Commit d2c4f00199ef7fa9c70c76283eb57a75336de553

Authored by 谭毅彬
2 parents e11a7fd4 e34edde1

Merge branch 'develop' of http://git.huahengcloud.com/wms/wms4.git into develop

Showing 18 changed files with 397 additions and 14 deletions
ant-design-vue-jeecg/src/api/api.js
... ... @@ -330,6 +330,8 @@ export const queryInventoryDetailListByMainIds = (params) => postAction("/invent
330 330 export const getInventoryByShipmentDetail = (params) => postAction('/shipment/shipmentHeader/getInventoryByShipmentDetail', params);
331 331 //指定库位
332 332 export const allocation = (params) => postAction('/receipt/receiptContainerHeader/allocation', params);
  333 +//添加BOM
  334 +export const addBomHeader = (params) => postAction('/config/bomHeader/addBomHeader', params);
333 335  
334 336 // 中转HTTP请求
335 337 export const transitRESTful = {
... ...
ant-design-vue-jeecg/src/views/system/shipment/ShipmentDetailList.vue
... ... @@ -3,6 +3,7 @@
3 3 <!-- 操作按钮区域 -->
4 4 <div class="table-operator" v-if="mainId">
5 5 <a-button @click="handleAdd" v-has="'shipmentDetail:add'" type="primary" icon="plus">新增</a-button>
  6 + <a-button @click="handleAddBom()" v-has="'shipmentDetail:addBom'" type="primary" icon="plus">新增BOM</a-button>
6 7 <a-button v-has="'shipmentDetail:print'" @click="batchPrint()" type="primary">打印</a-button>
7 8 <a-button v-has="'shipmentDetail:export'" type="primary" icon="download" @click="handleExportXls('出库单详情')">导出</a-button>
8 9 <a-upload
... ... @@ -72,6 +73,7 @@
72 73 </div>
73 74  
74 75 <shipmentDetail-modal ref="modalForm" @ok="modalFormOk" @dataSearch="dataSearch" :mainId="mainId"></shipmentDetail-modal>
  76 + <shipment-detail-bom-modal ref="modalBomForm" @ok="modalFormOk" :mainId="mainId"></shipment-detail-bom-modal>
75 77 <shipment-detail-edit-modal ref="modalEditForm" @ok="modalFormOk" @close="searchQuery" :mainId="mainId"></shipment-detail-edit-modal>
76 78 <shipment-detail-combine-modal ref="modalCombineForm" @ok="modalFormOk" @close="searchQuery" :mainId="mainId"></shipment-detail-combine-modal>
77 79  
... ... @@ -84,11 +86,12 @@ import {JeecgListMixin} from &#39;@/mixins/JeecgListMixin&#39;
84 86 import ShipmentDetailModal from './modules/ShipmentDetailModal'
85 87 import ShipmentDetailEditModal from './modules/ShipmentDetailEditModal'
86 88 import ShipmentDetailCombineModal from './modules/ShipmentDetailCombineModal'
  89 +import ShipmentDetailBomModal from "@views/system/shipment/modules/ShipmentDetailBomModal.vue";
87 90  
88 91 export default {
89 92 name: "ShipmentDetailList",
90 93 mixins: [JeecgListMixin],
91   - components: {ShipmentDetailCombineModal, ShipmentDetailEditModal, ShipmentDetailModal},
  94 + components: {ShipmentDetailBomModal, ShipmentDetailCombineModal, ShipmentDetailEditModal, ShipmentDetailModal},
92 95 props: {
93 96 mainId: {
94 97 type: String,
... ... @@ -283,6 +286,11 @@ export default {
283 286 window.open(window._CONFIG['domianURL'] + "/jmreport/view/963962951128367104/?id=" + ids, "newWindow", "toolbar=no,scrollbars=no,menubar=no,screenX=100,screenY=100");
284 287 }
285 288 },
  289 + handleAddBom() {
  290 + this.$refs.modalBomForm.add();
  291 + this.$refs.modalBomForm.title = "新增BOM";
  292 + this.$refs.modalBomForm.disableSubmit = false;
  293 + },
286 294 edit(record) {
287 295 this.$refs.modalEditForm.edit(record);
288 296 this.$refs.modalEditForm.title = "编辑";
... ...
ant-design-vue-jeecg/src/views/system/shipment/modules/ShipmentDetailBomModal.vue 0 → 100644
  1 +<template>
  2 + <j-modal
  3 + :title="title"
  4 + :width="width"
  5 + :visible="visible"
  6 + :confirmLoading="confirmLoading"
  7 + switchFullscreen
  8 + @ok="handleOk"
  9 + @cancel="handleCancel"
  10 + cancelText="关闭">
  11 + <a-spin :spinning="confirmLoading">
  12 + <a-form-model ref="form" :model="model" :rules="validatorRules">
  13 + <a-row>
  14 + <a-form-model-item label="物料BOM" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialCode">
  15 + <j-search-select-tag
  16 + placeholder="请选择物料BOM"
  17 + v-model="model.materialCode"
  18 + dict="bom_header,material_name,material_code"
  19 + :pageSize="10"
  20 + :async="true">
  21 + </j-search-select-tag>
  22 + </a-form-model-item>
  23 + <a-col :span="24">
  24 + <a-form-model-item label="套数" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="qty">
  25 + <a-input-number v-model="model.qty" placeholder="请输入套数" style="width: 100%"/>
  26 + </a-form-model-item>
  27 + </a-col>
  28 + </a-row>
  29 + </a-form-model>
  30 + </a-spin>
  31 + </j-modal>
  32 +</template>
  33 +
  34 +<script>
  35 +
  36 +import {httpAction} from '@/api/manage'
  37 +import {validateDuplicateValue} from '@/utils/util'
  38 +import {addBomHeader, getInventoryByShipmentDetail, searchMaterialByCode} from '@/api/api'
  39 +
  40 +export default {
  41 + name: "ShipmentDetailBomModal",
  42 + components: {},
  43 + props: {
  44 + mainId: {
  45 + type: String,
  46 + required: false,
  47 + default: ''
  48 + }
  49 + },
  50 + data() {
  51 + return {
  52 + title: "操作",
  53 + width: 800,
  54 + visible: false,
  55 + materialList: {},
  56 + shipmentDetail: {},
  57 + querySource: {},
  58 + model: {},
  59 + labelCol: {
  60 + xs: {span: 24},
  61 + sm: {span: 5},
  62 + },
  63 + wrapperCol: {
  64 + xs: {span: 24},
  65 + sm: {span: 16},
  66 + },
  67 +
  68 + confirmLoading: false,
  69 + validatorRules: {
  70 + materialCode: [
  71 + {required: true, message: '请输入物料编码!'},
  72 + ],
  73 + qty: [
  74 + {required: true, message: '请输入单据数量!'},
  75 + ],
  76 + inventoryStatus: [
  77 + {required: true, message: '请输入库存状态!'},
  78 + ],
  79 + },
  80 + url: {
  81 + add: "/shipment/shipmentHeader/addShipmentDetail",
  82 + edit: "/shipment/shipmentHeader/editShipmentDetail",
  83 + }
  84 +
  85 + }
  86 + },
  87 + created() {
  88 + //备份model原始值
  89 + this.modelDefault = JSON.parse(JSON.stringify(this.model));
  90 + },
  91 + methods: {
  92 + add() {
  93 + let record={inventoryStatus:'good'}
  94 + this.edit(record);
  95 + },
  96 + edit(record) {
  97 + this.model = Object.assign({}, record);
  98 + this.visible = true;
  99 + },
  100 + close() {
  101 + this.$emit('close');
  102 + this.visible = false;
  103 + this.$refs.form.clearValidate();
  104 + },
  105 + handleOk() {
  106 + const that = this;
  107 + // 触发表单验证
  108 + this.$refs.form.validate(valid => {
  109 + if (valid) {
  110 + that.confirmLoading = true;
  111 + this.model['shipmentHeaderId'] = this.mainId
  112 + addBomHeader(this.model).then((res) => {
  113 + if (res.success) {
  114 + that.$message.success(res.message);
  115 + that.$emit('ok');
  116 + that.$emit('dataSearch');
  117 + } else {
  118 + that.$message.warning(res.message);
  119 + }
  120 + }).finally(() => {
  121 + that.confirmLoading = false;
  122 + that.close();
  123 + })
  124 + } else {
  125 + return false
  126 + }
  127 + })
  128 + },
  129 + handleCancel() {
  130 + this.close()
  131 + },
  132 +
  133 + }
  134 +}
  135 +</script>
... ...
ant-design-vue-jeecg/src/views/system/stocktaking/CycleCountHeaderList.vue
... ... @@ -56,7 +56,7 @@
56 56 :dataSource="dataSource"
57 57 :pagination="ipagination"
58 58 :loading="loading"
59   - :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  59 + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'radio'}"
60 60 :customRow="clickThenSelect"
61 61 :rowClassName="rowClassName"
62 62 class="j-table-force-nowrap"
... ... @@ -226,6 +226,18 @@ export default {
226 226 exportXlsUrl: '/cycleCountHeader/cycleCountHeader/exportXls',
227 227 importExcelUrl: 'cycleCountHeader/cycleCountHeader/importExcel'
228 228 },
  229 + /* 分页参数 */
  230 + ipagination: {
  231 + current: 1,
  232 + pageSize: 5,
  233 + pageSizeOptions: ['5', '10', '50'],
  234 + showTotal: (total, range) => {
  235 + return range[0] + "-" + range[1] + " 共" + total + "条"
  236 + },
  237 + showQuickJumper: true,
  238 + showSizeChanger: true,
  239 + total: 0
  240 + },
229 241 superFieldList: []
230 242 }
231 243 },
... ...
ant-design-vue-jeecg/src/views/system/task/AllTaskHeaderList.vue
... ... @@ -170,6 +170,9 @@
170 170 <a-popconfirm v-if="record.status <= 10" v-has="'taskHeader:cancelTask'" title="确定取消任务吗?" @confirm="() => cancelTask(record)">
171 171 <a-button type="danger">取消</a-button>
172 172 </a-popconfirm>
  173 + <a-popconfirm v-if="record.status <= 10 && record.taskType != 600 " v-has="'taskHeader:switchTask'" title="确定切换任务吗?" @confirm="() => switchTask(record)">
  174 + <a-button type="danger">切换任务</a-button>
  175 + </a-popconfirm>
173 176 </span>
174 177  
175 178 </a-table>
... ... @@ -207,7 +210,7 @@ import {getAction} from &#39;@/api/manage&#39;
207 210 import TaskDetailList from './TaskDetailList'
208 211 import {initDictOptions, filterMultiDictText} from '@/components/dict/JDictSelectUtil'
209 212 import '@/assets/less/TableExpand.less'
210   -import {completeTaskByWMS, cancelTask} from '@/api/api'
  213 +import {completeTaskByWMS, cancelTask, switchTask} from '@/api/api'
211 214 import {execute} from '@/api/api'
212 215 import {getZoneList, handleEmptyOut, handlePickupError, handleDoubleIn} from '@/api/api'
213 216 import EmptyInTaskModal from './modules/EmptyInTaskModal'
... ... @@ -453,6 +456,19 @@ export default {
453 456 this.ipagination = pagination;
454 457 this.loadData();
455 458 },
  459 + switchTask(record) {
  460 + this.loading = true;
  461 + this.model = Object.assign({}, record);
  462 + switchTask(this.model.id).then((res) => {
  463 + this.loading = false;
  464 + if (res.success) {
  465 + this.$message.success(res.message);
  466 + } else {
  467 + this.$message.error(res.message);
  468 + }
  469 + this.searchQuery();
  470 + });
  471 + },
456 472 getStatusColor(status) {
457 473 const colors = {
458 474 '生成任务': 'green',
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/bomHeader/controller/BomHeaderController.java
1 1 package org.jeecg.modules.wms.config.bomHeader.controller;
2 2  
3 3 import java.io.IOException;
  4 +import java.math.BigDecimal;
4 5 import java.util.Arrays;
5 6 import java.util.List;
6 7 import java.util.Map;
... ... @@ -14,6 +15,7 @@ import org.apache.shiro.SecurityUtils;
14 15 import org.apache.shiro.authz.annotation.RequiresPermissions;
15 16 import org.jeecg.common.api.vo.Result;
16 17 import org.jeecg.common.aspect.annotation.AutoLog;
  18 +import org.jeecg.common.exception.JeecgBootException;
17 19 import org.jeecg.common.system.base.controller.JeecgController;
18 20 import org.jeecg.common.system.query.QueryGenerator;
19 21 import org.jeecg.common.system.vo.LoginUser;
... ... @@ -24,7 +26,10 @@ import org.jeecg.modules.wms.config.bomHeader.service.IBomDetailService;
24 26 import org.jeecg.modules.wms.config.bomHeader.service.IBomHeaderService;
25 27 import org.jeecg.modules.wms.config.material.entity.Material;
26 28 import org.jeecg.modules.wms.config.material.service.IMaterialService;
  29 +import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail;
  30 +import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentDetailService;
27 31 import org.jeecg.utils.HuahengJwtUtil;
  32 +import org.jeecg.utils.constant.QuantityConstant;
28 33 import org.jeecgframework.poi.excel.ExcelImportUtil;
29 34 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
30 35 import org.jeecgframework.poi.excel.entity.ExportParams;
... ... @@ -36,8 +41,10 @@ import org.springframework.web.multipart.MultipartFile;
36 41 import org.springframework.web.multipart.MultipartHttpServletRequest;
37 42 import org.springframework.web.servlet.ModelAndView;
38 43  
  44 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
39 45 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
40 46 import com.baomidou.mybatisplus.core.metadata.IPage;
  47 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
41 48 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
42 49  
43 50 import io.swagger.annotations.Api;
... ... @@ -65,6 +72,9 @@ public class BomHeaderController extends JeecgController&lt;BomHeader, IBomHeaderSe
65 72 @Resource
66 73 private IMaterialService materialService;
67 74  
  75 + @Resource
  76 + private IShipmentDetailService shipmentDetailService;
  77 +
68 78 /*---------------------------------主表处理-begin-------------------------------------*/
69 79  
70 80 /**
... ... @@ -321,4 +331,34 @@ public class BomHeaderController extends JeecgController&lt;BomHeader, IBomHeaderSe
321 331  
322 332 /*--------------------------------子表处理-bom子表-end----------------------------------------------*/
323 333  
  334 + /**
  335 + * 添加
  336 + * @return
  337 + */
  338 + @AutoLog(value = "bom子表-添加")
  339 + @ApiOperation(value = "bom子表-添加", notes = "bom子表-添加")
  340 + @PostMapping(value = "/addBomHeader")
  341 + public Result addBomHeader(@RequestBody BomHeader bomHeader, HttpServletRequest req) {
  342 + String bomCode = bomHeader.getMaterialCode();
  343 + BigDecimal qty = bomHeader.getQty();
  344 + int shipmentHeaderId = bomHeader.getShipmentHeaderId();
  345 + LambdaQueryWrapper<BomHeader> bomHeaderLambdaQueryWrapper = Wrappers.lambdaQuery();
  346 + bomHeaderLambdaQueryWrapper.eq(BomHeader::getMaterialCode, bomCode);
  347 + BomHeader bomHeader1 = bomHeaderService.getOne(bomHeaderLambdaQueryWrapper);
  348 + List<BomDetail> bomDetailList = bomDetailService.selectByMainId(String.valueOf(bomHeader1.getId()));
  349 + for (BomDetail bomDetail : bomDetailList) {
  350 + ShipmentDetail shipmentDetail = new ShipmentDetail();
  351 + shipmentDetail.setShipmentId(shipmentHeaderId);
  352 + shipmentDetail.setMaterialCode(bomDetail.getMaterialCode());
  353 + shipmentDetail.setInventoryStatus(QuantityConstant.QUALITY_GOOD);
  354 + BigDecimal bomDetailQty = bomDetail.getQty();
  355 + bomDetailQty = bomDetailQty.multiply(qty);
  356 + shipmentDetail.setQty(bomDetailQty);
  357 + Result result = shipmentDetailService.saveShipmentDetail(shipmentDetail);
  358 + if (!result.isSuccess()) {
  359 + throw new JeecgBootException("添加失败," + result.getMessage());
  360 + }
  361 + }
  362 + return Result.OK("添加成功!");
  363 + }
324 364 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/bomHeader/entity/BomHeader.java
... ... @@ -76,4 +76,8 @@ public class BomHeader implements Serializable {
76 76 /** 齐套数量 */
77 77 @TableField(exist = false)
78 78 private java.math.BigDecimal completeQty;
  79 +
  80 + /** 出库单ID */
  81 + @TableField(exist = false)
  82 + private Integer shipmentHeaderId;
79 83 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java
... ... @@ -108,8 +108,8 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
108 108 @Override
109 109 public List<Location> getLocationListByZoneCode(String zoneCode, String warehouseCode) {
110 110 LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery();
111   - locationLambdaQueryWrapper.eq(Location::getZoneCode, zoneCode).eq(Location::getEnable, QuantityConstant.STATUS_ENABLE).eq(Location::getWarehouseCode,
112   - warehouseCode);
  111 + locationLambdaQueryWrapper.eq(Location::getZoneCode, zoneCode).eq(Location::getEnable, QuantityConstant.STATUS_ENABLE)
  112 + .eq(Location::getWarehouseCode, warehouseCode).orderByDesc(Location::getLayer);
113 113 return locationService.list(locationLambdaQueryWrapper);
114 114 }
115 115  
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/entity/InventoryDetail.java
... ... @@ -137,6 +137,9 @@ public class InventoryDetail implements Serializable {
137 137 /** 巷道 */
138 138 @ApiModelProperty(value = "巷道")
139 139 private Integer roadWay;
  140 + /** 内外侧 */
  141 + @ApiModelProperty(value = "内外侧")
  142 + private Integer rowFlag;
140 143 /** 备用字段1 */
141 144 @Excel(name = "备用字段1", width = 15)
142 145 @ApiModelProperty(value = "备用字段1")
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/entity/InventoryHeader.java
... ... @@ -81,6 +81,9 @@ public class InventoryHeader implements Serializable {
81 81 /** 巷道 */
82 82 @ApiModelProperty(value = "巷道")
83 83 private Integer roadWay;
  84 + /** 内外侧 */
  85 + @ApiModelProperty(value = "内外侧")
  86 + private Integer rowFlag;
84 87 /** 备用字段1 */
85 88 @Excel(name = "备用字段1", width = 15)
86 89 @ApiModelProperty(value = "备用字段1")
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryDetailServiceImpl.java
... ... @@ -508,6 +508,7 @@ public class InventoryDetailServiceImpl extends ServiceImpl&lt;InventoryDetailMappe
508 508 return Result.error("增加库存,没有找到库位" + locationCode);
509 509 }
510 510 Integer roadWay = location.getRoadWay();
  511 + Integer rowFlag = location.getRowFlag();
511 512 String zoneType = zone.getType();
512 513 InventoryDetail inventoryDetail = new InventoryDetail();
513 514 inventoryDetail.setInventoryHeaderId(inventoryHeader.getId());
... ... @@ -524,6 +525,7 @@ public class InventoryDetailServiceImpl extends ServiceImpl&lt;InventoryDetailMappe
524 525 inventoryDetail.setMaterialUnit(material.getUnit());
525 526 inventoryDetail.setQty(qty);
526 527 inventoryDetail.setRoadWay(roadWay);
  528 + inventoryDetail.setRowFlag(rowFlag);
527 529 inventoryDetail.setInventoryStatus(QuantityConstant.QUALITY_GOOD);
528 530 inventoryDetail.setReceiptDate(new Date());
529 531 if (!inventoryDetailService.save(inventoryDetail)) {
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryHeaderServiceImpl.java
... ... @@ -490,6 +490,7 @@ public class InventoryHeaderServiceImpl extends ServiceImpl&lt;InventoryHeaderMappe
490 490 }
491 491  
492 492 @Override
  493 + @Transactional
493 494 public boolean updateInventory(String containerCode, String locationCode, String warehouseCode) {
494 495 InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode);
495 496 if (inventoryHeader == null) {
... ... @@ -526,6 +527,7 @@ public class InventoryHeaderServiceImpl extends ServiceImpl&lt;InventoryHeaderMappe
526 527 inventoryDetail1.setZoneCode(zoneCode);
527 528 inventoryDetail1.setZoneType(zoneType);
528 529 inventoryDetail1.setRoadWay(toLocation.getRoadWay());
  530 + inventoryDetail1.setRowFlag(toLocation.getRowFlag());
529 531 updateInventoryDetailList.add(inventoryDetail1);
530 532 }
531 533 success = inventoryDetailService.updateBatchById(updateInventoryDetailList);
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/monitor/job/AutoTransferTask.java 0 → 100644
  1 +package org.jeecg.modules.wms.monitor.job;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.List;
  5 +import java.util.stream.Collectors;
  6 +
  7 +import javax.annotation.Resource;
  8 +
  9 +import org.jeecg.common.util.DateUtils;
  10 +import org.jeecg.modules.wms.api.wcs.service.LocationAllocationService;
  11 +import org.jeecg.modules.wms.config.container.service.IContainerService;
  12 +import org.jeecg.modules.wms.config.location.entity.Location;
  13 +import org.jeecg.modules.wms.config.location.service.ILocationService;
  14 +import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterConfigurationService;
  15 +import org.jeecg.modules.wms.config.zone.entity.Zone;
  16 +import org.jeecg.modules.wms.config.zone.service.IZoneService;
  17 +import org.jeecg.modules.wms.framework.service.IHuahengMultiHandlerService;
  18 +import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader;
  19 +import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService;
  20 +import org.jeecg.utils.StringUtils;
  21 +import org.jeecg.utils.constant.QuantityConstant;
  22 +import org.quartz.*;
  23 +
  24 +import lombok.extern.slf4j.Slf4j;
  25 +
  26 +/**
  27 + * 定时任务
  28 + * @author 游杰
  29 + */
  30 +
  31 +@Slf4j
  32 +@PersistJobDataAfterExecution
  33 +@DisallowConcurrentExecution
  34 +public class AutoTransferTask implements Job {
  35 +
  36 + @Resource
  37 + private ITaskHeaderService taskHeaderService;
  38 +
  39 + @Resource
  40 + private IHuahengMultiHandlerService huahengMultiHandlerService;
  41 +
  42 + @Resource
  43 + private IContainerService containerService;
  44 + @Resource
  45 + private IParameterConfigurationService parameterConfigurationService;
  46 +
  47 + private String parameter;
  48 +
  49 + @Resource
  50 + private IZoneService zoneService;
  51 +
  52 + @Resource
  53 + private ILocationService locationService;
  54 +
  55 + @Resource
  56 + private LocationAllocationService locationAllocationService;
  57 +
  58 + /*
  59 + * 定时筛选立库区托盘从高库位移动到低库位
  60 + */
  61 + @Override
  62 + public void execute(JobExecutionContext context) throws JobExecutionException {
  63 + log.info(String.format(" AutoTransferTask 执行任务! 时间:" + DateUtils.getTimestamp()));
  64 + List<Zone> zoneList = zoneService.getZoneListByType(QuantityConstant.ZONE_TYPE_STEREOSCOPIC, QuantityConstant.DEFAULT_WAREHOUSE);
  65 + for (Zone zone : zoneList) {
  66 + String zoneCode = zone.getCode();
  67 + String warehouseCode = zone.getWarehouseCode();
  68 + List<Location> locationList = locationService.getLocationListByZoneCode(zoneCode, QuantityConstant.DEFAULT_WAREHOUSE);
  69 + List<Integer> roadWayList = locationList.stream().map(Location::getRoadWay).distinct().collect(Collectors.toList());
  70 + for (Integer roadWay : roadWayList) {
  71 + List<TaskHeader> taskHeaderList = taskHeaderService.getUnCompleteListTaskByRoadWay(roadWay, warehouseCode);
  72 + if (!taskHeaderList.isEmpty()) {
  73 + continue;
  74 + }
  75 + List<Location> roadWayLocationList =
  76 + locationList.stream().filter(x -> x.getRoadWay().equals(roadWay) && StringUtils.isNotEmpty(x.getContainerCode())).collect(Collectors.toList());
  77 + String value = parameterConfigurationService.getValueByZoneCode(QuantityConstant.RULE_ALLOCATION, zoneCode);
  78 + if (StringUtils.isEmpty(value)) {
  79 + continue;
  80 + }
  81 + int allocationRule = Integer.parseInt(value);
  82 + Location fromLocation = roadWayLocationList.get(0);
  83 + int high = fromLocation.getHigh();
  84 + List<String> locationTypeCodeList = new ArrayList<>();
  85 + locationTypeCodeList.add(fromLocation.getLocationTypeCode());
  86 + List<Integer> roadWays = new ArrayList<>();
  87 + roadWays.add(fromLocation.getRoadWay());
  88 + String locationCode = locationAllocationService.allocation(allocationRule, locationTypeCodeList, high, zoneCode, roadWays, warehouseCode,
  89 + fromLocation.getContainerCode(), null, null, false);
  90 + if (StringUtils.isEmpty(locationCode)) {
  91 + continue;
  92 + }
  93 + Location toLocation = locationService.getLocationByCode(locationCode, warehouseCode);
  94 + if (fromLocation.getLayer() > toLocation.getLayer()) {
  95 + taskHeaderService.createTransferTask(fromLocation.getCode(), locationCode, warehouseCode);
  96 + }
  97 + }
  98 + }
  99 + }
  100 +}
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/impl/ReceiptContainerHeaderServiceImpl.java
... ... @@ -285,6 +285,9 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl&lt;ReceiptContai
285 285 }
286 286 }
287 287 }
  288 + if (!taskHeaderService.updateTaskRoadWay(containerCode, fromLocationCode, warehouseCode)) {
  289 + throw new JeecgBootException("创建任务时,更新巷道值失败");
  290 + }
288 291 LogRecordContext.putVariable("taskHeader", taskHeader);// 操作日志收集
289 292 LogRecordContext.putVariable("receiptContainerDetailList", receiptContainerDetailList);// 操作日志收集
290 293 LogRecordContext.putVariable("extraJsonString1", JSON.toJSONString(receiptContainerDetailList));// 操作日志收集
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/IShipmentCombinationService.java
... ... @@ -19,6 +19,8 @@ public interface IShipmentCombinationService {
19 19  
20 20 List<InventoryDetail> getInventorys(ShipmentDetail shipmentDetail);
21 21  
  22 + List<InventoryDetail> groupInventorysByRowFlag(List<InventoryDetail> inventoryDetailList);
  23 +
22 24 List<InventoryDetail> getInventorys(ShipmentDetail shipmentDetail, String containerCode);
23 25  
24 26 List<InventoryDetail> getAllInventorys(ShipmentDetail shipmentDetail);
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/impl/ShipmentCombinationServiceImpl.java
... ... @@ -3,6 +3,7 @@ package org.jeecg.modules.wms.shipment.shipmentCombination.service.impl;
3 3 import java.math.BigDecimal;
4 4 import java.util.ArrayList;
5 5 import java.util.Collections;
  6 +import java.util.Comparator;
6 7 import java.util.List;
7 8 import java.util.stream.Collectors;
8 9  
... ... @@ -174,10 +175,19 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi
174 175 }
175 176 inventoryDetailList = inventoryDetailList.stream().filter(t -> result.getResult().contains(t.getRoadWay())).collect(Collectors.toList());
176 177 }
  178 +
  179 + inventoryDetailList = groupInventorysByRowFlag(inventoryDetailList);
177 180 return inventoryDetailList;
178 181 }
179 182  
180 183 @Override
  184 + public List<InventoryDetail> groupInventorysByRowFlag(List<InventoryDetail> inventoryDetailList) {
  185 + List<InventoryDetail> inventoryDetails = inventoryDetailList.stream()
  186 + .sorted(Comparator.comparing(InventoryDetail::getReceiptDate).thenComparing(InventoryDetail::getRowFlag)).collect(Collectors.toList());
  187 + return inventoryDetails;
  188 + }
  189 +
  190 + @Override
181 191 public List<InventoryDetail> getInventorys(ShipmentDetail shipmentDetail, String containerCode) {
182 192 String warehouseCode = shipmentDetail.getWarehouseCode();
183 193 String companyCode = shipmentDetail.getCompanyCode();
... ... @@ -1470,6 +1480,9 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi
1470 1480 if (!success) {
1471 1481 throw new JeecgBootException("生成出库任务时, 更新出库组盘头失败");
1472 1482 }
  1483 + if (!taskHeaderService.updateTaskRoadWay(containerCode, fromLocationCode, warehouseCode)) {
  1484 + throw new JeecgBootException("创建任务时,更新巷道值失败");
  1485 + }
1473 1486 LogRecordContext.putVariable("taskHeader", taskHeader);// 操作日志收集
1474 1487 LogRecordContext.putVariable("shipmentContainerDetailList", shipmentContainerDetailList);// 操作日志收集
1475 1488 LogRecordContext.putVariable("extraJsonString1", JSON.toJSONString(shipmentContainerDetailList));// 操作日志收集
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskHeaderService.java
... ... @@ -90,6 +90,8 @@ public interface ITaskHeaderService extends IService&lt;TaskHeader&gt; {
90 90  
91 91 List<TaskHeader> getUnCompleteListTask(String warehouseCode);
92 92  
  93 + List<TaskHeader> getUnCompleteListTaskByRoadWay(Integer roadWay, String warehouseCode);
  94 +
93 95 /**
94 96 * 完成WMS任务
95 97 * @param taskId
... ... @@ -392,6 +394,8 @@ public interface ITaskHeaderService extends IService&lt;TaskHeader&gt; {
392 394 */
393 395 boolean combineInventoryDetail(String containerCode, String warehouseCode);
394 396  
  397 + boolean updateTaskRoadWay(String containerCode, String fromLocationCode, String warehouseCode);
  398 +
395 399 /**
396 400 * 根据任务区分,在生产任务的时候,锁定容器和库位
397 401 * @param
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
... ... @@ -353,6 +353,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
353 353 if (!success) {
354 354 throw new JeecgBootException("创建移库任务时,创建任务失败");
355 355 }
  356 + if (!taskHeaderService.updateTaskRoadWay(containerCode, fromLocationCode, warehouseCode)) {
  357 + throw new JeecgBootException("创建任务时,更新巷道值失败");
  358 + }
356 359 log.info("完成创建移库任务,起始库位" + fromLocationCode + ",目的库位" + toLocationCode);
357 360 return Result.OK("创建移库任务成功", taskHeader);
358 361 }
... ... @@ -705,6 +708,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
705 708 taskHeader.setToPortCode(toPortCode);
706 709 taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD);
707 710 boolean success = taskHeaderService.save(taskHeader);
  711 + if (!taskHeaderService.updateTaskRoadWay(containerCode, fromLocationCode, warehouseCode)) {
  712 + throw new JeecgBootException("创建任务时,更新巷道值失败");
  713 + }
708 714 log.info("完成创建空托盘组出库任务,容器编码" + containerCode + ",去向位置编码" + toPortCode);
709 715 if (!success) {
710 716 throw new JeecgBootException("创建空托盘组出库任务时,生成任务失败");
... ... @@ -1038,6 +1044,15 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1038 1044 return taskHeaderList;
1039 1045 }
1040 1046  
  1047 + @Override
  1048 + public List<TaskHeader> getUnCompleteListTaskByRoadWay(Integer roadWay, String warehouseCode) {
  1049 + LambdaQueryWrapper<TaskHeader> taskHeaderLambdaQueryWrapper = Wrappers.lambdaQuery();
  1050 + taskHeaderLambdaQueryWrapper.eq(TaskHeader::getRoadWay, roadWay).eq(TaskHeader::getWarehouseCode, warehouseCode).lt(TaskHeader::getStatus,
  1051 + QuantityConstant.TASK_STATUS_COMPLETED);
  1052 + List<TaskHeader> taskHeaderList = taskHeaderService.list(taskHeaderLambdaQueryWrapper);
  1053 + return taskHeaderList;
  1054 + }
  1055 +
1041 1056 /**
1042 1057 * WMS完成任务
1043 1058 */
... ... @@ -1264,15 +1279,15 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1264 1279 taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD);
1265 1280 taskHeader.setZoneCode(zoneCode);
1266 1281 boolean success = taskHeaderService.save(taskHeader);
1267   -// String value = parameterConfigurationService.getValueByCode(QuantityConstant.START_LOCKING_STATION, zoneCode);
1268   -// if (StringUtils.isNotEmpty(value)) {
1269   -// int lockStation = Integer.parseInt(value);
1270   -// if (lockStation == QuantityConstant.START_LOCK_STATION) {
1271   -// if (!lockStationService.lockStation(toPortCode, warehouseCode)) {
1272   -// throw new JeecgBootException("生成入库任务时,站台已经锁定:" + toPortCode);
1273   -// }
1274   -// }
1275   -// }
  1282 + String value = parameterConfigurationService.getValueByCode(QuantityConstant.START_LOCKING_STATION, zoneCode);
  1283 + if (StringUtils.isNotEmpty(value)) {
  1284 + int lockStation = Integer.parseInt(value);
  1285 + if (lockStation == QuantityConstant.START_LOCK_STATION) {
  1286 + if (!lockStationService.lockStation(toPortCode, warehouseCode)) {
  1287 + throw new JeecgBootException("生成入库任务时,站台已经锁定:" + toPortCode);
  1288 + }
  1289 + }
  1290 + }
1276 1291 log.info("完成创建空托入库任务");
1277 1292 if (!success) {
1278 1293 throw new JeecgBootException("创建空托盘入库时,保存任务失败");
... ... @@ -1327,6 +1342,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1327 1342 if (!success) {
1328 1343 throw new JeecgBootException("创建空托盘出库时,保存任务失败");
1329 1344 }
  1345 + if (!taskHeaderService.updateTaskRoadWay(containerCode, fromLocationCode, warehouseCode)) {
  1346 + throw new JeecgBootException("创建任务时,更新巷道值失败");
  1347 + }
1330 1348 return Result.OK("创建空托盘出库任务成功");
1331 1349 }
1332 1350  
... ... @@ -1958,6 +1976,22 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1958 1976 return success;
1959 1977 }
1960 1978  
  1979 + @Override
  1980 + public boolean updateTaskRoadWay(String containerCode, String fromLocationCode, String warehouseCode) {
  1981 + TaskHeader taskHeader = taskHeaderService.getUnCompleteTaskByContainerCode(containerCode, warehouseCode);
  1982 + if (taskHeader != null) {
  1983 + Location fromLocation = locationService.getLocationByCode(fromLocationCode, warehouseCode);
  1984 + if (fromLocation != null) {
  1985 + TaskHeader taskHeader1 = new TaskHeader();
  1986 + taskHeader1.setId(taskHeader.getId());
  1987 + taskHeader1.setRoadWay(fromLocation.getRoadWay());
  1988 + boolean success = taskHeaderService.updateById(taskHeader1);
  1989 + return success;
  1990 + }
  1991 + }
  1992 + return true;
  1993 + }
  1994 +
1961 1995 /**
1962 1996 * 锁定容器和库位分4种情况,入库任务、出库任务、分拣任务、换站任务
1963 1997 * @param
... ...