diff --git a/ant-design-vue-jeecg/src/components/jeecgbiz/JButtonBizComponent/JSelectBizComponentModal.vue b/ant-design-vue-jeecg/src/components/jeecgbiz/JButtonBizComponent/JSelectBizComponentModal.vue index 58814bc..2c93370 100644 --- a/ant-design-vue-jeecg/src/components/jeecgbiz/JButtonBizComponent/JSelectBizComponentModal.vue +++ b/ant-design-vue-jeecg/src/components/jeecgbiz/JButtonBizComponent/JSelectBizComponentModal.vue @@ -59,7 +59,7 @@ </a-card> </a-col> </a-row> - <InventoryDetailList></InventoryDetailList> + <InventoryDetailSelectList></InventoryDetailSelectList> </j-modal> </template> @@ -72,12 +72,13 @@ import JSelectBizQueryItem from './JSelectBizQueryItem' import {cloneDeep} from 'lodash' import {stockTakeTask} from "../../../api/api"; import Utils from './util.js'; -import InventoryDetailList from "../../../views/system/inventory/InventoryDetailList"; +import InventoryDetailSelectList from "../../../views/system/inventory/InventoryDetailSelectList"; + export default { name: 'JSelectBizComponentModal', mixins: [JeecgListMixin], - components: {Ellipsis, JSelectBizQueryItem,InventoryDetailList}, + components: {Ellipsis, JSelectBizQueryItem,InventoryDetailSelectList}, props: { value: { type: Array, @@ -242,6 +243,7 @@ export default { this.selectedTable.dataSource = val.map(key => { for (let data of this.dataSource) { if (data[this.rowKey] === key) { + Utils.$emit('methodA',data[this.valueKey]); pushIfNotExist(this.innerValue, data[this.valueKey]) return data } @@ -264,6 +266,7 @@ export default { /** 关闭弹窗 */ close() { this.$emit('update:visible', false) + this.handleDeleteSelected(this.selectedTable.dataSource,0); }, valueWatchHandler(val) { @@ -348,9 +351,11 @@ export default { { alert("至少选择一项") } + this.handleDeleteSelected(this.selectedTable.dataSource,0); }, /** 删除已选择的 */ handleDeleteSelected(record, index) { + Utils.$emit('methodA',10); this.selectedRowKeys.splice(this.selectedRowKeys.indexOf(record[this.rowKey]), 1) //update--begin--autor:wangshuai-----date:20200722------for:JSelectBizComponent组件切换页数值问题------ this.selectedTable.dataSource.splice(this.selectedTable.dataSource.indexOf(record), 1) diff --git a/ant-design-vue-jeecg/src/components/jeecgbiz/JSelectMultiCycleCount.vue b/ant-design-vue-jeecg/src/components/jeecgbiz/JSelectMultiCycleCount.vue index dc42bf8..9371d1b 100644 --- a/ant-design-vue-jeecg/src/components/jeecgbiz/JSelectMultiCycleCount.vue +++ b/ant-design-vue-jeecg/src/components/jeecgbiz/JSelectMultiCycleCount.vue @@ -29,7 +29,7 @@ export default { }, data() { return { - url: {list: '/inventory/inventoryHeader/list'}, + url: {list: '/inventory/inventoryHeader/freeList'}, columns: [ {title: 'ID', align: 'center', width: '20%',widthRight: '70%', dataIndex: 'id'}, {title: '容器号', align: 'center', width: '25%', dataIndex: 'containerCode'}, diff --git a/ant-design-vue-jeecg/src/views/system/inventory/InventoryDetailSelectList.vue b/ant-design-vue-jeecg/src/views/system/inventory/InventoryDetailSelectList.vue new file mode 100644 index 0000000..84637af --- /dev/null +++ b/ant-design-vue-jeecg/src/views/system/inventory/InventoryDetailSelectList.vue @@ -0,0 +1,238 @@ +<template> + <a-card :bordered="false" :class="'cust-erp-sub-tab'"> + <!-- 操作按钮区域 --> + <div class="table-operator" v-if="mainId"> + <a-button v-has="'inventoryDetail:add'" @click="handleAdd" type="primary" icon="plus">新增</a-button> + <a-button type="primary" icon="download" @click="handleExportXls('库存详情')">导出</a-button> + <a-upload + name="file" + :showUploadList="false" + :multiple="false" + :headers="tokenHeader" + :action="importExcelUrl" + @change="handleImportExcel"> + <a-button type="primary" icon="import">导入</a-button> + </a-upload> + + </div> + + <!-- table区域-begin --> + <div> + <a-table + ref="table" + size="middle" + bordered + rowKey="id" + :scroll="{x:true}" + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + :loading="loading" + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" + @change="handleTableChange"> + + <span slot="companyCode" slot-scope="companyCode"> + <a-tag :key="companyCode" color=blue> + {{ solutionCompany(companyCode) }} + </a-tag> + </span> + + <template slot="htmlSlot" slot-scope="text"> + <div v-html="text"></div> + </template> + <template slot="imgSlot" slot-scope="text"> + <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> + <img v-else :src="getImgView(text)" height="25px" alt="" + style="max-width:80px;font-size: 12px;font-style: italic;"/> + </template> + <template slot="fileSlot" slot-scope="text"> + <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> + <a-button + v-else + :ghost="true" + type="primary" + icon="download" + size="small" + @click="downloadFile(text)"> + 下载 + </a-button> + </template> + + + </a-table> + </div> + <inventoryDetail-modal ref="modalForm" @ok="modalFormOk" :mainId="mainId"></inventoryDetail-modal> + </a-card> +</template> + +<script> + +import {JeecgListMixin} from '@/mixins/JeecgListMixin' +import InventoryDetailModal from './modules/InventoryDetailModal' +import {getCompanyList} from '@/api/api' +import {getAction} from '@/api/manage' +import Utils from "../../../components/jeecgbiz/JButtonBizComponent/util"; + +export default { + name: "InventoryDetailSelectList", + mixins: [JeecgListMixin], + components: {InventoryDetailModal}, + props: { + mainId: { + type: String, + default: '', + required: false + } + }, + watch: { + mainId: { + immediate: true, + handler(val) { + if (!this.mainId) { + this.clearList() + } else { + this.queryParam['inventoryHeaderId'] = val + this.loadData(1); + } + } + } + }, + data() { + return { + description: '库存表管理页面', + disableMixinCreated: true, + companyList: [], + // 表头 + columns: [ + { + title: '容器编码', + align: "center", + dataIndex: 'containerCode' + }, + { + title: '库位编码', + align: "center", + dataIndex: 'locationCode' + }, + { + title: '物料编码', + align: "center", + dataIndex: 'materialCode' + }, + { + title: '物料名称', + align: "center", + dataIndex: 'materialName' + }, + { + title: '物料规格', + align: "center", + dataIndex: 'materialSpec' + }, + { + title: '物料单位', + align: "center", + dataIndex: 'materialUnit' + }, + { + title: '数量', + align: "center", + dataIndex: 'qty' + }, + { + title: '库存状态', + align: "center", + dataIndex: 'inventoryStatus_dictText', + }, + { + title: '批次', + align: "center", + dataIndex: 'batch' + }, + { + title: '入库日期', + align: "center", + dataIndex: 'receiptDate' + }, + ], + url: { + list: "/inventory/inventoryHeader/listInventoryDetailByMainId", + delete: "/inventory/inventoryHeader/deleteInventoryDetail", + deleteBatch: "/inventory/inventoryHeader/deleteBatchInventoryDetail", + exportXlsUrl: "/inventory/inventoryHeader/exportInventoryDetail", + importUrl: "/inventory/inventoryHeader/importInventoryDetail", + }, + dictOptions: { + containerStatus: [], + } + } + }, + created() { + this.loadFrom(); + }, + mounted() { + let _this = this; + Utils.$on('methodA',(data)=> { + _this.methodA(data); + }) + // var _this = this; + // setInterval(function () { + // if(_this.isLoad) { + // _this.loadDataList(); + // } + // },1000) + }, + computed: { + importExcelUrl() { + return `${window._CONFIG['domianURL']}/${this.url.importUrl}/${this.mainId}`; + } + }, + methods: { + + methodA(data) { + var _this = this; + _this.loadDatas(data); + }, + + loadDatas(record) { + this.loading = true + this.dataSource = [] + getAction(this.url.list, { + inventoryHeaderId: record + }).then((res) => { + if (res.success) { + this.dataSource = res.result.records + } + }).finally(() => { + this.loading = false + }) + }, + loadFrom() { + getCompanyList().then((res) => { + if (res.success) { + this.companyList = res.result + } + }); + }, + solutionCompany(value) { + var actions = [] + Object.keys(this.companyList).some((key) => { + if (this.companyList[key].code == ('' + value)) { + actions.push(this.companyList[key].name) + return true + } + }) + return actions.join('') + }, + clearList() { + this.dataSource = [] + this.selectedRowKeys = [] + this.ipagination.current = 1 + } + + } +} +</script> +<style scoped> +@import '~@assets/less/common.less' +</style> diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/container/service/IContainerService.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/container/service/IContainerService.java index 8c35705..6a65556 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/container/service/IContainerService.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/container/service/IContainerService.java @@ -21,6 +21,8 @@ public interface IContainerService extends IService<Container> { boolean updateStatus(String containerCode, String status, String wareohuseCode); + boolean restoreContainer(String containerCode, String wareohuseCode); + boolean updateLocationCodeAndStatus(String containerCode, String locationCode, String status, String warehouseCode); // 创建零时容器 diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/container/service/impl/ContainerServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/container/service/impl/ContainerServiceImpl.java index d4cbb72..da679b1 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/container/service/impl/ContainerServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/container/service/impl/ContainerServiceImpl.java @@ -72,12 +72,25 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container if (container == null) { return false; } + container.setLastStatus(container.getStatus()); container.setStatus(status); boolean result = this.updateById(container); return result; } @Override + public boolean restoreContainer(String containerCode, String wareohuseCode) { + Container container = this.getContainerByCode(containerCode, wareohuseCode); + if (container == null) { + return false; + } + container.setLastStatus(container.getStatus()); + container.setStatus(container.getLastStatus()); + boolean result = this.updateById(container); + return result; + } + + @Override public boolean updateLocationCodeAndStatus(String containerCode, String locationCode, String status, String warehouseCode) { Container container = getContainerByCode(containerCode, warehouseCode); if (container == null) { diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/controller/InventoryHeaderController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/controller/InventoryHeaderController.java index ef5fe89..9313a9a 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/controller/InventoryHeaderController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/controller/InventoryHeaderController.java @@ -12,6 +12,7 @@ import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryHeader; import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderService; +import org.jeecg.utils.constant.QuantityConstant; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; @@ -252,6 +253,29 @@ public class InventoryHeaderController extends JeecgController<InventoryHeader, } /** + * 有货非锁定列表查询 + * @param inventoryHeader + * @param pageNo + * @param pageSize + * @param req + * @return + */ + // @AutoLog(value = "库存表-分页列表查询") + @ApiOperation(value = "库存表-有货非锁定列表查询", notes = "库存表-有货非锁定列表查询") + @GetMapping(value = "/freeList") + public Result<IPage<InventoryHeader>> freeList(InventoryHeader inventoryHeader, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { + + + + QueryWrapper<InventoryHeader> queryWrapper = QueryGenerator.initQueryWrapper(inventoryHeader, req.getParameterMap()); + queryWrapper.eq("container_status", QuantityConstant.STATUS_CONTAINER_SOME); + Page<InventoryHeader> page = new Page<InventoryHeader>(pageNo, pageSize); + IPage<InventoryHeader> pageList = inventoryHeaderService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** * 导入 * @return */ diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailServiceImpl.java index 61c0a90..063af56 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailServiceImpl.java @@ -4,6 +4,8 @@ import com.aliyun.oss.ServiceException; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.wms.config.container.entity.Container; +import org.jeecg.modules.wms.config.container.service.impl.ContainerServiceImpl; import org.jeecg.modules.wms.config.location.entity.Location; import org.jeecg.modules.wms.config.location.service.impl.LocationServiceImpl; import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; @@ -32,6 +34,7 @@ import java.math.BigDecimal; import java.util.Date; import java.util.List; import java.util.Collection; +import java.util.stream.Stream; /** * @Description: 盘点明细表 @@ -58,6 +61,8 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap private TaskDetailServiceImpl taskDetailService; @Resource private CycleCountHeaderServiceImpl cycleCountHeaderService; + @Resource + private ContainerServiceImpl containerServiceImpl; @Override @@ -119,21 +124,20 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap inventoryDetailLambdaQueryWrapper.eq(InventoryDetail::getInventoryHeaderId,taskId); List<InventoryDetail> inventoryDetails = inventoryDetailService.list(inventoryDetailLambdaQueryWrapper); -// LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); -// locationLambdaQueryWrapper.eq(Location::getCode, inventoryDetails.get(0).getLocationCode()) -// .eq(Location::getWarehouseCode, inventoryDetails.get(0).getWarehouseCode()) -// .ne(Location::getStatus, QuantityConstant.STATUS_LOCATION_LOCK); -// Location location = locationService.getOne(locationLambdaQueryWrapper); -// if (StringUtils.isNull(location)) { -// return Result.error("库位已锁定!"); -// } + + LambdaQueryWrapper<CycleCountDetail> cycleCountDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); + cycleCountDetailLambdaQueryWrapper.eq(CycleCountDetail::getContainerCode,inventoryDetails.get(0).getContainerCode()) + .ne(CycleCountDetail::getEnableStatus,QuantityConstant.CYCLECOUNT_STATUS_COMPLETED); + List<CycleCountDetail> cycleCountDetails = this.list(cycleCountDetailLambdaQueryWrapper); + if (cycleCountDetails.size() >0) + { + return Result.error("当前容器已经在盘点队列还没有完成 盘点单号"+cycleCountDetails.get(0).getCycleCountHeadCode()); + } CycleCountDetail cycleCountDetail = new CycleCountDetail(); cycleCountDetail.setCycleCountHeadId(headerId); cycleCountDetail.setContainerCode(inventoryDetails.get(0).getContainerCode()); - - cycleCountDetail.setCycleCountHeadCode(code); cycleCountDetail.setCompanyCode(inventoryDetails.get(0).getCompanyCode()); cycleCountDetail.setWarehouseCode(inventoryDetails.get(0).getWarehouseCode()); @@ -198,14 +202,21 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap } Location location = locationService.getLocationByCode( cycleCountDetail.getLocationCode(), warehouseCode); - /*if(!loc.getStatus().equals(QuantityConstant.STATUS_EMPTY)){ - return AjaxResult.error(cycleCountDetail.getLocationCode() + "库位不在空闲状态,请先完成其他任务,操作失败!"); - }*/ + if(!location.getStatus().equals(QuantityConstant.STATUS_LOCATION_EMPTY)){ + return Result.error(cycleCountDetail.getLocationCode() + "库位不在空闲状态,请先完成其他任务,操作失败!"); + } if(StringUtils.isEmpty(location.getContainerCode())){ return Result.error(cycleCountDetail.getLocationCode() + "库位中没有容器,操作失败!"); } + //生成任务同时锁定库位 locationService.updateStatus(location.getCode(), QuantityConstant.STATUS_LOCATION_LOCK,warehouseCode); + + //生成任务同时锁定容器 + containerServiceImpl.updateStatus(location.getContainerCode(),QuantityConstant.STATUS_LOCATION_LOCK,warehouseCode); + + + //每个明细单生成一张主任务,子单就是任务明细。 TaskHeader task = new TaskHeader(); task.setWarehouseCode(warehouseCode); diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java index 4f60d12..1ff8ff0 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java @@ -1725,6 +1725,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea locationService.updateStatus(cycleCountDetail.getLocationCode(), QuantityConstant.STATUS_LOCATION_EMPTY, taskHeader.getWarehouseCode()); + + //还原容器状态 + containerService.restoreContainer(cycleCountDetail.getLocationCode(),taskHeader.getWarehouseCode()); + return Result.OK("完成盘点任务成功"); }