Commit df80d48165f15426b643c985cd65eb40573f75cd

Authored by 肖超群
1 parent 87af5c22

1. 出库单详情 新增时提供库存情况

2. 修复原库位和目的库位是同一个库位,重新申请库位后,会解锁原库位导致任务完成失败
ant-design-vue-jeecg/src/api/api.js
... ... @@ -322,6 +322,8 @@ export const listCycleDetailChildByDetailId = (params) => postAction("/cycleCoun
322 322 export const flatOnShell = (params) => postAction("/receipt/receiveHeader/flatOnShell", params);
323 323 //查询库存详情
324 324 export const queryInventoryDetailListByMainIds = (params) => postAction("/inventory/inventoryDetail/getInventoryDetailListByInventoryDetailIds", params);
  325 +//根据出库单头ID查询出库单详情
  326 +export const getInventoryByShipmentDetail = (params) => postAction('/shipment/shipmentHeader/getInventoryByShipmentDetail', params);
325 327  
326 328 // 中转HTTP请求
327 329 export const transitRESTful = {
... ...
ant-design-vue-jeecg/src/views/system/shipment/ShipmentHeaderList.vue
... ... @@ -214,10 +214,10 @@
214 214 <a><a-button type="default">回传</a-button></a>
215 215 </a-popconfirm>
216 216 <a v-show="record.lastStatus == 850" @click="viewReason(record)"><a-button type="danger">原因</a-button></a>
217   - <a v-if="((record.firstStatus >= 15 && record.firstStatus != '20' && record.lastStatus < 800 && record.totalLines != null))
218   - || (flowOff == '0' && record.lastStatus < 800 && record.totalLines != null)" @click="manualShipmentCombine(record.id)" v-has="'shipmentHeader:autoShipmentCombine'"><a-button type="primary">手动配盘</a-button></a>
219   - <a v-if="((record.firstStatus >= 15 && record.firstStatus != '20' && record.lastStatus < 800 && record.totalLines != null))
220   - || (flowOff == '0' && record.lastStatus < 800 && record.totalLines != null)" @click="autoShipmentCombine(record)" v-has="'shipmentHeader:autoShipmentCombine'"><a-button type="primary">自动配盘</a-button></a>
  217 + <a v-if="((record.firstStatus >= 15 && record.firstStatus != '20' && record.lastStatus < 800 && record.totalLines != 0))
  218 + || (flowOff == '0' && record.lastStatus < 800 && record.totalLines != 0)" @click="manualShipmentCombine(record.id)" v-has="'shipmentHeader:autoShipmentCombine'"><a-button type="primary">手动配盘</a-button></a>
  219 + <a v-if="((record.firstStatus >= 15 && record.firstStatus != '20' && record.lastStatus < 800 && record.totalLines != 0))
  220 + || (flowOff == '0' && record.lastStatus < 800 && record.totalLines != 0)" @click="autoShipmentCombine(record)" v-has="'shipmentHeader:autoShipmentCombine'"><a-button type="primary">自动配盘</a-button></a>
221 221 <a-dropdown v-if="(record.firstStatus > 0 && record.firstStatus <= 20 && flowOff=='1')
222 222 || (record.firstStatus == 0 && record.lastStatus == 0 && record.referCode == null)
223 223 || (record.firstStatus >= 15 && record.firstStatus != '20' && record.lastStatus < 800)
... ... @@ -227,10 +227,10 @@
227 227 <a-menu-item v-if="record.firstStatus > 0 && record.firstStatus <= 20 && flowOff=='1'">
228 228 <a @click="openProcess(record)" type="primary">审核进度</a>
229 229 </a-menu-item>
230   - <a-menu-item v-if="(record.firstStatus >= 15 && record.firstStatus != '20' && record.lastStatus < 800) && record.totalLines != null || (flowOff == '0' && record.lastStatus <= 200 && record.totalLines != null)" v-has="'shipmentHeader:autoShipment'">
  230 + <a-menu-item v-if="(record.firstStatus >= 15 && record.firstStatus != '20' && record.lastStatus < 800) && record.totalLines != 0 || (flowOff == '0' && record.lastStatus <= 200 && record.totalLines != 0)" v-has="'shipmentHeader:autoShipment'">
231 231 <a @click="autoShipment(record)" type="primary">自动出库</a>
232 232 </a-menu-item>
233   - <a-menu-item v-if="(record.firstStatus >= 15 && record.firstStatus != '20' && record.lastStatus < 800 && record.totalLines != null) || (flowOff == '0' && record.lastStatus <= 200 && record.totalLines != null)" v-has="'shipmentHeader:autoShipmentAdvice'">
  233 + <a-menu-item v-if="(record.firstStatus >= 15 && record.firstStatus != '20' && record.lastStatus < 800 && record.totalLines != 0) || (flowOff == '0' && record.lastStatus <= 200 && record.totalLines != 0)" v-has="'shipmentHeader:autoShipmentAdvice'">
234 234 <a @click="autoShipmentAdvice(record)" type="primary">预配盘出库</a>
235 235 </a-menu-item>
236 236 <a-menu-item v-has="'shipmentHeader:edit'" v-if="record.firstStatus == 0 && record.lastStatus == 0 && record.referCode == null">
... ...
ant-design-vue-jeecg/src/views/system/shipment/modules/ShipmentDetailCombineModal.vue
... ... @@ -109,6 +109,7 @@ export default {
109 109 shipmentParam: {},
110 110 visible: false,
111 111 materialList: {},
  112 + shipmentDetail: {},
112 113 querySource: {},
113 114 /* 筛选参数 */
114 115 filters: {},
... ...
ant-design-vue-jeecg/src/views/system/shipment/modules/ShipmentDetailModal.vue
... ... @@ -16,7 +16,7 @@
16 16 placeholder="请选择物料编码"
17 17 v-model="model.materialCode"
18 18 dict="material,name,code"
19   - @change="getShipmentInventory()"
  19 + @change="getInventoryByShipmentDetail()"
20 20 :pageSize="10"
21 21 :async="true">
22 22 </j-search-select-tag>
... ... @@ -29,17 +29,18 @@
29 29 <a-col :span="24">
30 30 <a-form-model-item label="库存状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="inventoryStatus">
31 31 <j-dict-select-tag type="list" v-model="model.inventoryStatus" dictCode="inventory_status"
  32 + @change="getInventoryByShipmentDetail()"
32 33 placeholder="请选择库存状态"/>
33 34 </a-form-model-item>
34 35 </a-col>
35 36 <a-col :span="24">
36 37 <a-form-model-item label="批次" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="batch">
37   - <a-input v-model="model.batch" placeholder="请输入批次"></a-input>
  38 + <a-input v-model="model.batch" placeholder="请输入批次" @change="getInventoryByShipmentDetail()"></a-input>
38 39 </a-form-model-item>
39 40 </a-col>
40 41 <a-col :span="24">
41 42 <a-form-model-item label="库存数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="inventoryQty">
42   - <a-input-number v-model="model.inventoryQty" disabled="true" style="width: 100%"/>
  43 + <a-input-number v-model="model.inventoryQty" :disabled="true" style="width: 100%"/>
43 44 </a-form-model-item>
44 45 </a-col>
45 46 </a-row>
... ... @@ -52,7 +53,7 @@
52 53  
53 54 import {httpAction} from '@/api/manage'
54 55 import {validateDuplicateValue} from '@/utils/util'
55   -import {searchMaterialByCode} from '@/api/api'
  56 +import {getInventoryByShipmentDetail, searchMaterialByCode} from '@/api/api'
56 57  
57 58 export default {
58 59 name: "ShipmentDetailModal",
... ... @@ -70,6 +71,7 @@ export default {
70 71 width: 800,
71 72 visible: false,
72 73 materialList: {},
  74 + shipmentDetail: {},
73 75 querySource: {},
74 76 model: {},
75 77 labelCol: {
... ... @@ -119,8 +121,20 @@ export default {
119 121 this.visible = false;
120 122 this.$refs.form.clearValidate();
121 123 },
122   - getShipmentInventory() {
123   - console.log("getShipmentInventory");
  124 + getInventoryByShipmentDetail() {
  125 + this.model['shipmentId'] = this.mainId
  126 + console.log("getInventoryByShipmentDetail ")
  127 + getInventoryByShipmentDetail(this.model).then((res) => {
  128 + if (res.success) {
  129 + this.model = res.result;
  130 + console.log("getInventoryByShipmentDetail " + this.model.inventoryQty)
  131 + } else {
  132 + this.model.inventoryQty = 0;
  133 + }
  134 + this.$refs.form.validate(valid => {
  135 +
  136 + })
  137 + })
124 138 },
125 139 handleOk() {
126 140 const that = this;
... ... @@ -161,7 +175,6 @@ export default {
161 175 searchMaterial() {
162 176 const that = this;
163 177 that.querySource.materialCode = that.model.materialCode;
164   - console.log("model.materialCode:" + that.model.materialCode);
165 178 searchMaterialByCode(that.querySource).then((res) => {
166 179 that.materialList = res.result;
167 180 })
... ...
ant-design-vue-jeecg/src/views/system/shipment/modules/ShipmentManualCombineModal.vue
... ... @@ -296,7 +296,7 @@ export default {
296 296 return actions.join('')
297 297 },
298 298 handleOk() {
299   -
  299 + this.close();
300 300 },
301 301 onSelectChange(selectedRowKeys, selectionRows) {
302 302 this.selectedRowKeys = selectedRowKeys;
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/LocationAllocationServiceImpl.java
... ... @@ -195,6 +195,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService
195 195 }
196 196 }
197 197 locationList.removeAll(removeLocaationList);
  198 + // 外侧库位为空,再找内侧库位
198 199 if (CollectionUtils.isEmpty(locationList)) {
199 200 locationLambda = Wrappers.lambdaQuery();
200 201 locationLambda.eq(Location::getZoneCode, zoneCode).eq(Location::getWarehouseCode, warehouseCode).eq(Location::getRoadWay, roadWay)
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java
... ... @@ -242,10 +242,14 @@ public class WcsServiceImpl implements WcsService {
242 242 if (!success) {
243 243 throw new JeecgBootException("分配库位时,更新库位状态失败");
244 244 }
245   - if (StringUtils.isNotEmpty(taskHeader.getToLocationCode()) && !locationCode.equals(taskHeader.getToLocationCode())) {
246   - success = locationService.updateStatus(taskHeader.getToLocationCode(), QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode);
247   - if (!success) {
248   - throw new JeecgBootException("分配库位时,更新之前分配的库位状态失败");
  245 + String taskFromLocationCode = taskHeader.getFromLocationCode();
  246 + String taskToLocationCode = taskHeader.getToLocationCode();
  247 + if (StringUtils.isNotEmpty(taskToLocationCode) && !locationCode.equals(taskToLocationCode)) {
  248 + if (StringUtils.isEmpty(taskFromLocationCode) || (StringUtils.isNotEmpty(taskFromLocationCode) && !taskToLocationCode.equals(taskFromLocationCode))) {
  249 + success = locationService.updateStatus(taskToLocationCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode);
  250 + if (!success) {
  251 + throw new JeecgBootException("分配库位时,更新之前分配的库位状态失败");
  252 + }
249 253 }
250 254 }
251 255 List<ReceiptContainerDetail> receiptContainerDetailList = new ArrayList<>();
... ... @@ -860,8 +864,8 @@ public class WcsServiceImpl implements WcsService {
860 864 if (containerList != null && containerList.size() > 0) {
861 865 for (Container container : containerList) {
862 866 String locationCode = container.getLocationCode();
863   - //库位值为空时,查询会报空指针异常
864   - if(StringUtils.isEmpty(locationCode)){
  867 + // 库位值为空时,查询会报空指针异常
  868 + if (StringUtils.isEmpty(locationCode)) {
865 869 removeContainerList.add(container);
866 870 continue;
867 871 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/container/service/IContainerService.java
... ... @@ -31,6 +31,8 @@ public interface IContainerService extends IService&lt;Container&gt; {
31 31  
32 32 boolean updateLocationCodeAndStatus(String containerCode, String locationCode, String status, String fillStatus, String warehouseCode);
33 33  
  34 + boolean updateFlatLocationCodeAndStatus(String containerCode, String locationCode, String status, String fillStatus, String warehouseCode);
  35 +
34 36 // 创建零时容器
35 37 Container createLSContainer(String warehouseCode);
36 38  
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/container/service/impl/ContainerServiceImpl.java
... ... @@ -146,15 +146,6 @@ public class ContainerServiceImpl extends ServiceImpl&lt;ContainerMapper, Container
146 146 @Override
147 147 @Transactional
148 148 public boolean updateLocationCode(String containerCode, String locationCode, String warehouseCode) {
149   -// if (StringUtils.isNotEmpty(locationCode)) {
150   -// LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery();
151   -// containerLambdaQueryWrapper.eq(Container::getLocationCode, locationCode).ne(Container::getCode, containerCode).eq(Container::getWarehouseCode,
152   -// warehouseCode);
153   -// Container container = getOne(containerLambdaQueryWrapper);
154   -// if (container != null) {
155   -// throw new JeecgBootException("容器已经存在于库位上" + container);
156   -// }
157   -// }
158 149 LambdaUpdateWrapper<Container> updateWrapper = Wrappers.lambdaUpdate();
159 150 updateWrapper.eq(Container::getCode, containerCode).eq(Container::getWarehouseCode, warehouseCode).set(Container::getLocationCode, locationCode);
160 151 return containerService.update(updateWrapper);
... ... @@ -170,6 +161,14 @@ public class ContainerServiceImpl extends ServiceImpl&lt;ContainerMapper, Container
170 161 }
171 162  
172 163 @Override
  164 + public boolean updateFlatLocationCodeAndStatus(String containerCode, String locationCode, String status, String fillStatus, String warehouseCode) {
  165 + LambdaUpdateWrapper<Container> updateWrapper = Wrappers.lambdaUpdate();
  166 + updateWrapper.eq(Container::getCode, containerCode).eq(Container::getWarehouseCode, warehouseCode).set(Container::getLocationCode, locationCode)
  167 + .set(Container::getStatus, status).set(Container::getFillStatus, fillStatus);
  168 + return containerService.update(updateWrapper);
  169 + }
  170 +
  171 + @Override
173 172 public Container createLSContainer(String warehouseCode) {
174 173 String code = MessageFormat.format("{0}{1}", QuantityConstant.CONTAINER_TYPE_LS, String.format("%d", Calendar.getInstance().getTimeInMillis()));
175 174 Container container = new Container();
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/service/impl/HuahengMultiHandlerServiceImpl.java
... ... @@ -240,9 +240,6 @@ public class HuahengMultiHandlerServiceImpl extends HuahengBaseController implem
240 240 if (!rs1.isSuccess()) {
241 241 return rs1;
242 242 }
243   - if (!QuantityConstant.ZONE_TYPE_FLAT.equals(location.getZoneCode())) {
244   - return Result.error("库位:" + bean.getLocationCode() + "不是平库库位");
245   - }
246 243 // 创建入库单明细
247 244 List<ReceiptDetail> receiptDetails = bean.getReceiptDetails();
248 245 List<Receive> receiveList = new ArrayList<>();
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/service/impl/ReceiveServiceImpl.java
... ... @@ -540,12 +540,20 @@ public class ReceiveServiceImpl extends ServiceImpl&lt;ReceiveMapper, Receive&gt; impl
540 540 }
541 541 String zoneCode = toLocation.getZoneCode();
542 542 if (StringUtils.isEmpty(zoneCode)) {
543   - return Result.error("完成上架失败,没有找到目的库区编码");
  543 + return Result.error("完成上架失败,库区为空");
544 544 }
545 545 Zone zone = zoneService.getZoneByCode(zoneCode, warehouseCode);
546 546 if (zone == null) {
547 547 return Result.error("完成上架失败,没有找到库区");
548 548 }
  549 + String zoneType = zone.getType();
  550 + if (StringUtils.isEmpty(zoneType)) {
  551 + return Result.error("完成上架失败,库区类型为空");
  552 + }
  553 + if (!zoneType.equals(QuantityConstant.ZONE_TYPE_FLAT)) {
  554 + return Result.error("完成上架失败,库区类型不为平库");
  555 + }
  556 +
549 557 InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode);
550 558 if (inventoryHeader == null) {
551 559 inventoryHeader = new InventoryHeader();
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/impl/ShipmentCombinationServiceImpl.java
... ... @@ -1003,10 +1003,10 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi
1003 1003 throw new JeecgBootException("完成平库出库,删除容器失败");
1004 1004 }
1005 1005 } else {
1006   - if (!containerService.updateLocationCodeAndStatus(containerCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_CONTAINER_EMPTY,
  1006 + if (!containerService.updateFlatLocationCodeAndStatus(containerCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_CONTAINER_EMPTY,
1007 1007 QuantityConstant.STATUS_CONTAINER_FILL_EMPTY, warehouseCode)) {
1008 1008 throw new JeecgBootException("完成平库出库,更新容器状态失败");
1009   - } ;
  1009 + }
1010 1010 }
1011 1011 // 设置库位容器编码为空值
1012 1012 if (!locationService.updateContainerCode(fromLocation.getCode(), QuantityConstant.EMPTY_STRING, warehouseCode)) {
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/controller/ShipmentHeaderController.java
... ... @@ -27,6 +27,7 @@ import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail;
27 27 import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService;
28 28 import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail;
29 29 import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader;
  30 +import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentInventory;
30 31 import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentDetailService;
31 32 import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentHeaderService;
32 33 import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader;
... ... @@ -458,4 +459,31 @@ public class ShipmentHeaderController extends JeecgController&lt;ShipmentHeader, IS
458 459 Result result = huahengMultiHandlerService.autoShipmentAdvice(shipmentCode, warehouseCode);
459 460 return result;
460 461 }
  462 +
  463 + /**
  464 + * 获取出库单物料库存信息
  465 + * @return
  466 + */
  467 + @ApiOperation(value = "获取出库单物料库存信息", notes = "获取出库单物料库存信息")
  468 + @PostMapping(value = "/getInventoryByShipmentDetail")
  469 + @ResponseBody
  470 + public Result<?> getInventoryByShipmentDetail(@RequestBody ShipmentInventory shipmentInventory, HttpServletRequest req) {
  471 + String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req);
  472 + ShipmentHeader shipmentHeader = shipmentHeaderService.getById(shipmentInventory.getShipmentId());
  473 + InventoryDetail inventoryDetail = new InventoryDetail();
  474 + inventoryDetail.setMaterialCode(shipmentInventory.getMaterialCode());
  475 + inventoryDetail.setWarehouseCode(warehouseCode);
  476 + inventoryDetail.setInventoryStatus(shipmentInventory.getInventoryStatus());
  477 + inventoryDetail.setZoneCode(shipmentHeader.getZoneCode());
  478 + inventoryDetail.setCompanyCode(shipmentHeader.getCompanyCode());
  479 + inventoryDetail.setBatch(shipmentInventory.getBatch());
  480 + inventoryDetail.setProject(shipmentInventory.getProject());
  481 + inventoryDetail.setLot(shipmentInventory.getLot());
  482 + BigDecimal sumQty = inventoryDetailService.getSumQty(inventoryDetail);
  483 + BigDecimal availQty = inventoryDetailService.getAvailSumQty(inventoryDetail);
  484 + shipmentInventory.setInventoryQty(sumQty);
  485 + shipmentInventory.setAvailableQty(availQty);
  486 + return Result.OK(shipmentInventory);
  487 + }
  488 +
461 489 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/entity/ShipmentInventory.java 0 → 100644
  1 +package org.jeecg.modules.wms.shipment.shipmentHeader.entity;
  2 +
  3 +import org.jeecgframework.poi.excel.annotation.Excel;
  4 +
  5 +import io.swagger.annotations.ApiModelProperty;
  6 +import lombok.Data;
  7 +
  8 +@Data
  9 +public class ShipmentInventory {
  10 +
  11 + /** 出库单ID */
  12 + @ApiModelProperty(value = "出库单ID")
  13 + private Integer shipmentId;
  14 +
  15 + @ApiModelProperty(value = "物料编码")
  16 + private String materialCode;
  17 +
  18 + @ApiModelProperty(value = "库存状态")
  19 + private String inventoryStatus;
  20 +
  21 + /** 可出数量 */
  22 + @ApiModelProperty(value = "可出数量")
  23 + private java.math.BigDecimal availableQty;
  24 + /** 库存数量 */
  25 + @ApiModelProperty(value = "库存数量")
  26 + private java.math.BigDecimal inventoryQty;
  27 +
  28 + /** 批次 */
  29 + @Excel(name = "批次", width = 15)
  30 + @ApiModelProperty(value = "批次")
  31 + private String batch;
  32 + /** 批号 */
  33 + @Excel(name = "批号", width = 15)
  34 + @ApiModelProperty(value = "批号")
  35 + private String lot;
  36 + /** 项目号 */
  37 + @Excel(name = "项目号", width = 15)
  38 + @ApiModelProperty(value = "项目号")
  39 + private String project;
  40 +}
... ...