Commit 9eb5943c28ab62931d891ae0597d1c4c5459bd9b

Authored by 肖超群
1 parent df2f5cfe

修复批量出库 选错出库口的问题

ant-design-vue-jeecg/src/api/api.js
... ... @@ -286,6 +286,8 @@ export const createBatchShipmentTaskByAgv = (params) => postAction('/shipment/sh
286 286 export const createShipmentTaskAndAgvTask = (params) => postAction('/shipment/shipmentCombination/createShipmentTaskAndAgvTask', params);
287 287 //完成平库出库
288 288 export const completeFlatShipment = (params) => postAction('/shipment/shipmentCombination/completeFlatShipment', params);
  289 +//平库入库
  290 +export const flatReceipt = (params) => postAction('/receipt/receiveHeader/flatReceipt', params);
289 291  
290 292 // 中转HTTP请求
291 293 export const transitRESTful = {
... ...
ant-design-vue-jeecg/src/views/system/inventory/InventoryTransactionList.vue
... ... @@ -40,8 +40,13 @@
40 40 </a-form-item>
41 41 </a-col>
42 42 <a-col :xl="6" :lg="7" :md="8" :sm="24">
43   - <a-form-item label="库位编码">
44   - <a-input placeholder="请输入库位编码" v-model="queryParam.locationCode"></a-input>
  43 + <a-form-item label="起始库位编码">
  44 + <a-input placeholder="请输入起始库位编码" v-model="queryParam.fromLocationCode"></a-input>
  45 + </a-form-item>
  46 + </a-col>
  47 + <a-col :xl="6" :lg="7" :md="8" :sm="24">
  48 + <a-form-item label="目标库位编码">
  49 + <a-input placeholder="请输入目标库位编码" v-model="queryParam.toLocationCode"></a-input>
45 50 </a-form-item>
46 51 </a-col>
47 52 <a-col :xl="6" :lg="7" :md="8" :sm="24">
... ...
ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerHeaderList.vue
... ... @@ -132,7 +132,7 @@
132 132 <!-- <a v-else-if="record.status == 0" @click="selectContainerStatus(record)" v-has="'receiptContainerHeader:createTask'"><a-button type="primary">生成任务</a-button><a-divider type="vertical"/></a>-->
133 133 <a v-if="record.status == 0 && record.taskType == 200" @click="selectPort(record)" v-has="'receiptContainerHeader:createTask'"><a-button type="primary">生成任务</a-button><a-divider type="vertical"/></a>
134 134 <a v-else-if="record.status == 0" @click="createTask(record)" v-has="'receiptContainerHeader:createTask'"><a-button type="primary">生成任务</a-button><a-divider type="vertical"/></a>
135   - <a-popconfirm v-if="record.status == 0" v-has="'receiptContainerHeader:delete'" title="确定取消配盘吗?" @confirm="() => handleDelete(record.id)">
  135 + <a-popconfirm v-if="record.status == 0" v-has="'receipatContainerHeader:delete'" title="确定取消配盘吗?" @confirm="() => handleDelete(record.id)">
136 136 <a><a-button type="danger">取消配盘</a-button> <a-divider type="vertical"/></a>
137 137 </a-popconfirm>
138 138  
... ...
ant-design-vue-jeecg/src/views/system/shipment/ShipmentContainerHeaderList.vue
... ... @@ -130,7 +130,7 @@
130 130 <a><a-button type="danger">取消配盘</a-button> <a-divider type="vertical"/></a>
131 131 </a-popconfirm>
132 132 <a v-has="'shipmentContainerHeader:edit'" @click="handleEdit(record)"><a-button type="default">编辑</a-button> <a-divider type="vertical"/></a>
133   - <a v-if="record.status == 10" v-has="'shipmentContainerHeader:reduceInventoryDetailBySn'" @click="openReduce(record)"><a-button type="primary">扣减库存</a-button></a>
  133 + <a v-if="record.status == 10 && record.taskType == 400" v-has="'shipmentContainerHeader:reduceInventoryDetailBySn'" @click="openReduce(record)"><a-button type="primary">扣减库存</a-button></a>
134 134 </span>
135 135 </a-table>
136 136 </div>
... ...
ant-design-vue-jeecg/src/views/system/task/modules/QualityRegisterDetailModal.vue
... ... @@ -27,6 +27,11 @@
27 27 </a-form-model-item>
28 28 </a-col>
29 29 <a-col :xs="24">
  30 + <a-form-model-item label="合格数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="qualityfiedQty">
  31 + <a-input v-model="model.qualityfiedQty" placeholder="请输入合格数量"></a-input>
  32 + </a-form-model-item>
  33 + </a-col>
  34 + <a-col :xs="24">
30 35 <a-form-model-item label="不合格数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="unqualityfiedQty">
31 36 <a-input v-model="model.unqualityfiedQty" placeholder="请输入不合格数量"></a-input>
32 37 </a-form-model-item>
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/port/service/IPortService.java
... ... @@ -18,7 +18,9 @@ public interface IPortService extends IService&lt;Port&gt; {
18 18  
19 19 List<Port> getPortListByType(int type, Integer roadWay, String zoneCode, String warehouseCode);
20 20  
21   - Port getPortByCode(String code, Integer roadWay, String zoneCode, String warehouseCode);
  21 +// Port getPortByCode(String code, Integer roadWay, String zoneCode, String warehouseCode);
  22 +
  23 + Port getPortByCode(String code, Integer type, String zoneCode, String warehouseCode);
22 24  
23 25 Port getPortByCode(String code, String zoneCode, String warehouseCode);
24 26  
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/port/service/impl/PortServiceImpl.java
... ... @@ -42,10 +42,10 @@ public class PortServiceImpl extends ServiceImpl&lt;PortMapper, Port&gt; implements IP
42 42 }
43 43  
44 44 @Override
45   - public Port getPortByCode(String code, Integer roadWay, String zoneCode, String warehouseCode) {
  45 + public Port getPortByCode(String code, Integer type, String zoneCode, String warehouseCode) {
46 46 LambdaQueryWrapper<Port> portLambdaQueryWrapper = Wrappers.lambdaQuery();
47   - portLambdaQueryWrapper.eq(Port::getCode, code).eq(Port::getZoneCode, zoneCode).eq(Port::getWarehouseCode, warehouseCode).in(roadWay != null,
48   - Port::getRoadWay, roadWay);
  47 + portLambdaQueryWrapper.eq(Port::getCode, code).eq(Port::getZoneCode, zoneCode).eq(Port::getWarehouseCode, warehouseCode).in(type != null, Port::getType,
  48 + type);
49 49 Port port = getOne(portLambdaQueryWrapper);
50 50 return port;
51 51 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/controller/ReceiptContainerHeaderController.java
1 1 package org.jeecg.modules.wms.receipt.receiptContainerHeader.controller;
2 2  
3 3 import java.io.IOException;
  4 +import java.util.ArrayList;
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;
... ... @@ -45,6 +47,7 @@ import org.springframework.web.servlet.ModelAndView;
45 47  
46 48 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
47 49 import com.baomidou.mybatisplus.core.metadata.IPage;
  50 +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
48 51 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
49 52  
50 53 import io.swagger.annotations.Api;
... ... @@ -357,6 +360,33 @@ public class ReceiptContainerHeaderController extends JeecgController&lt;ReceiptCon
357 360 @ResponseBody
358 361 public Result createReceiptBatchTask(@RequestBody List<ReceiptContainerHeader> receiptContainerHeaderList, HttpServletRequest req) {
359 362 String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req);
  363 + if (CollectionUtils.isEmpty(receiptContainerHeaderList)) {
  364 + return Result.error("批量创建入库任务失败,没有组盘明细");
  365 + }
  366 + String toPort = receiptContainerHeaderList.get(0).getToPort();
  367 + if (StringUtils.isEmpty(toPort)) {
  368 + return Result.error("批量创建入库任务失败,没有去向");
  369 + }
  370 + List<ReceiptContainerHeader> removeList = new ArrayList<>();
  371 + for (ReceiptContainerHeader receiptContainerHeader : receiptContainerHeaderList) {
  372 + String fromLocationCode = receiptContainerHeader.getFromLocationCode();
  373 + Location fromLocation = locationService.getLocationByCode(fromLocationCode, warehouseCode);
  374 + if (fromLocation == null) {
  375 + throw new JeecgBootException("批量创建入库任务失败,没有找到库位" + fromLocationCode);
  376 + }
  377 + int roadWay = fromLocation.getRoadWay();
  378 + String zoneCode = fromLocation.getZoneCode();
  379 + List<Port> portList = portService.getPortListByType(QuantityConstant.PORT_TYPE_PICK, roadWay, zoneCode, warehouseCode);
  380 + if (CollectionUtils.isEmpty(portList)) {
  381 + removeList.add(receiptContainerHeader);
  382 + continue;
  383 + }
  384 + List<String> portCodeList = portList.stream().map(Port::getCode).collect(Collectors.toList());
  385 + if (!portCodeList.contains(toPort)) {
  386 + removeList.add(receiptContainerHeader);
  387 + }
  388 + }
  389 + receiptContainerHeaderList.removeAll(removeList);
360 390 for (ReceiptContainerHeader receiptContainerHeader : receiptContainerHeaderList) {
361 391 Result result = huahengMultiHandlerService.createReceiptTask(receiptContainerHeader, warehouseCode);
362 392 if (!result.isSuccess()) {
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/impl/ReceiptContainerHeaderServiceImpl.java
... ... @@ -15,6 +15,8 @@ import org.jeecg.modules.wms.config.container.entity.Container;
15 15 import org.jeecg.modules.wms.config.container.service.IContainerService;
16 16 import org.jeecg.modules.wms.config.location.service.ILocationService;
17 17 import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterConfigurationService;
  18 +import org.jeecg.modules.wms.config.zone.entity.Zone;
  19 +import org.jeecg.modules.wms.config.zone.service.IZoneService;
18 20 import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderService;
19 21 import org.jeecg.modules.wms.lockStation.service.ILockStationService;
20 22 import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerDetail;
... ... @@ -94,6 +96,8 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl&lt;ReceiptContai
94 96  
95 97 @Resource
96 98 private ILockStationService lockStationService;
  99 + @Resource
  100 + private IZoneService zoneService;
97 101  
98 102 @Override
99 103 @Transactional
... ... @@ -146,6 +150,10 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl&lt;ReceiptContai
146 150 if (StringUtils.isEmpty(zoneCode)) {
147 151 return Result.error("容器没有配置库区,请配置!");
148 152 }
  153 + Zone zone = zoneService.getZoneByCode(zoneCode, warehouseCode);
  154 + if (zone == null) {
  155 + return Result.error("库区:" + zoneCode + " 信息为空");
  156 + }
149 157 boolean success = false;
150 158 List<ReceiptContainerDetail> receiptContainerDetailList =
151 159 receiptContainerDetailService.getReceiptContainerDetailListByHeaderId(receiptContainerHeader.getId());
... ... @@ -185,6 +193,11 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl&lt;ReceiptContai
185 193 taskHeader.setWarehouseCode(warehouseCode);
186 194 taskHeader.setZoneCode(zoneCode);
187 195 taskHeader.setToPortCode(toPort);
  196 + if (StringUtils.isNotEmpty(zone.getType())) {
  197 + if (zone.getType().equals(QuantityConstant.ZONE_TYPE_AGV)) {
  198 + taskHeader.setToWcs(QuantityConstant.NOT_TO_WCS);
  199 + }
  200 + }
188 201 success = taskHeaderService.save(taskHeader);
189 202 if (!success) {
190 203 throw new JeecgBootException("创建入库任务, 任务生成失败");
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/controller/ReceiveController.java
... ... @@ -223,7 +223,6 @@ public class ReceiveController extends HuahengBaseController {
223 223 @Override
224 224 public Result<?> doProcess() {
225 225 Result result = receiveService.receivingAndCreateTask(receiveList, warehouseCode);
226   -
227 226 return result;
228 227 }
229 228 });
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/controller/ShipmentCombinationController.java
1 1 package org.jeecg.modules.wms.shipment.shipmentCombination.controller;
2 2  
3 3 import java.math.BigDecimal;
  4 +import java.util.ArrayList;
4 5 import java.util.List;
  6 +import java.util.stream.Collectors;
5 7  
6 8 import javax.annotation.Resource;
7 9 import javax.servlet.http.HttpServletRequest;
8 10  
9 11 import org.jeecg.common.api.vo.Result;
10 12 import org.jeecg.common.aspect.annotation.AutoLog;
  13 +import org.jeecg.common.exception.JeecgBootException;
11 14 import org.jeecg.modules.wms.config.location.entity.Location;
12 15 import org.jeecg.modules.wms.config.location.service.ILocationService;
13 16 import org.jeecg.modules.wms.config.port.entity.Port;
... ... @@ -33,6 +36,7 @@ import org.jeecg.utils.constant.QuantityConstant;
33 36 import org.springframework.web.bind.annotation.*;
34 37  
35 38 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  39 +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
36 40 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
37 41  
38 42 import io.swagger.annotations.Api;
... ... @@ -133,6 +137,38 @@ public class ShipmentCombinationController extends HuahengBaseController {
133 137 @ResponseBody
134 138 public Result createShipmentBatchTask(@RequestBody List<ShipmentContainerHeader> shipmentContainerHeaderList, HttpServletRequest req) {
135 139 String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req);
  140 + if (CollectionUtils.isEmpty(shipmentContainerHeaderList)) {
  141 + return Result.error("批量创建出库任务失败,没有组盘明细");
  142 + }
  143 + String toPort = shipmentContainerHeaderList.get(0).getToPort();
  144 + if (StringUtils.isEmpty(toPort)) {
  145 + return Result.error("批量创建出库任务失败,没有去向");
  146 + }
  147 + List<ShipmentContainerHeader> removeList = new ArrayList<>();
  148 + for (ShipmentContainerHeader shipmentContainerHeader : shipmentContainerHeaderList) {
  149 + String fromLocationCode = shipmentContainerHeader.getFromLocationCode();
  150 + Location fromLocation = locationService.getLocationByCode(fromLocationCode, warehouseCode);
  151 + if (fromLocation == null) {
  152 + throw new JeecgBootException("批量创建出库任务失败,没有找到库位" + fromLocationCode);
  153 + }
  154 + int roadWay = fromLocation.getRoadWay();
  155 + String zoneCode = fromLocation.getZoneCode();
  156 + int taskType = shipmentContainerHeader.getTaskType();
  157 + int portType = QuantityConstant.PORT_TYPE_PICK;
  158 + if (taskType == QuantityConstant.TASK_TYPE_WHOLESHIPMENT) {
  159 + portType = QuantityConstant.PORT_TYPE_OUT;
  160 + }
  161 + List<Port> portList = portService.getPortListByType(portType, roadWay, zoneCode, warehouseCode);
  162 + if (CollectionUtils.isEmpty(portList)) {
  163 + removeList.add(shipmentContainerHeader);
  164 + continue;
  165 + }
  166 + List<String> portCodeList = portList.stream().map(Port::getCode).collect(Collectors.toList());
  167 + if (!portCodeList.contains(toPort)) {
  168 + removeList.add(shipmentContainerHeader);
  169 + }
  170 + }
  171 + shipmentContainerHeaderList.removeAll(removeList);
136 172 for (ShipmentContainerHeader shipmentContainerHeader : shipmentContainerHeaderList) {
137 173 Result result = huahengMultiHandlerService.createShipmentTask(shipmentContainerHeader, warehouseCode, 0, 0, 0);
138 174 if (!result.isSuccess()) {
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
... ... @@ -414,7 +414,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
414 414 }
415 415 TaskLockEntity taskLockEntity = (TaskLockEntity)result.getResult();
416 416 String zoneCode = taskLockEntity.getZoneCode();
417   - Port port = portService.getPortByCode(toPortCode, zoneCode, warehouseCode);
  417 + Port port = portService.getPortByCode(toPortCode, QuantityConstant.PORT_TYPE_PICK, zoneCode, warehouseCode);
418 418 if (port == null) {
419 419 throw new JeecgBootException("创建质检任务失败,没有找到出库口:" + toPortCode);
420 420 }
... ... @@ -1005,10 +1005,13 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1005 1005 break;
1006 1006 }
1007 1007 taskHeaderService.cancelLocationAndContainerStatus(taskHeader);
1008   - if (taskHeader.getStatus().intValue() > QuantityConstant.TASK_STATUS_BUILD) {
1009   - result = wcsService.cancelWcsTask(taskHeader);
1010   - if (!result.isSuccess()) {
1011   - throw new JeecgBootException(result.getMessage());
  1008 + int toWcs = taskHeader.getToWcs();
  1009 + if (toWcs == QuantityConstant.TO_WCS) {
  1010 + if (taskHeader.getStatus().intValue() > QuantityConstant.TASK_STATUS_BUILD) {
  1011 + result = wcsService.cancelWcsTask(taskHeader);
  1012 + if (!result.isSuccess()) {
  1013 + throw new JeecgBootException(result.getMessage());
  1014 + }
1012 1015 }
1013 1016 }
1014 1017 if (!inventoryHeaderService.updateInventoryContainerStatusByContainerCode(taskHeader.getContainerCode(), taskHeader.getWarehouseCode())) {
... ... @@ -1040,9 +1043,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
1040 1043 if (taskHeader.getStatus() >= QuantityConstant.TASK_STATUS_RELEASE) {
1041 1044 return Result.error("下发wcs任务时, 任务" + taskId + "已经下发,请不要重复下发,操作中止");
1042 1045 }
1043   - Result result = wcsService.wcsTaskAssign(taskHeader);
1044   - if (!result.isSuccess()) {
1045   - return Result.error(result.getMessage());
  1046 + int toWcs = taskHeader.getToWcs();
  1047 + if (toWcs == QuantityConstant.TO_WCS) {
  1048 + Result result = wcsService.wcsTaskAssign(taskHeader);
  1049 + if (!result.isSuccess()) {
  1050 + return Result.error(result.getMessage());
  1051 + }
1046 1052 }
1047 1053 taskHeader.setStatus(QuantityConstant.TASK_STATUS_RELEASE);
1048 1054 boolean success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_RELEASE, taskHeader.getId());
... ...