|
@@ -1339,7 +1339,9 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
|
|
List<InvLotLocIdLotattVO> invLotLocIdLotattList = invLotLocIdService.selectInvLocIdLotattList(locIdSearchFrom);
|
|
List<InvLotLocIdLotattVO> invLotLocIdLotattList = invLotLocIdService.selectInvLocIdLotattList(locIdSearchFrom);
|
|
|
|
|
|
if (invLotLocIdLotattList.size() == 0) {
|
|
if (invLotLocIdLotattList.size() == 0) {
|
|
- return AjaxResult.error(String.format("不存在对应库存!起始托盘:%s,条码:%s", palletNoFrom, sn));
|
|
+
|
|
|
|
+ return groupDiskUnAllocationBH(groupDiskFrom);
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
List<InvLotLocIdLotattVO> invLotLocIdLotattVOList = new ArrayList<>();
|
|
List<InvLotLocIdLotattVO> invLotLocIdLotattVOList = new ArrayList<>();
|
|
@@ -1444,7 +1446,131 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
|
|
boxInfoUpdate.setId(wmsBoxInfo.getId());
|
|
boxInfoUpdate.setId(wmsBoxInfo.getId());
|
|
boxInfoUpdate.setLocationId(currentVirtualZone);
|
|
boxInfoUpdate.setLocationId(currentVirtualZone);
|
|
wmsBoxInfoService.updateWmsBoxInfo(boxInfoUpdate);
|
|
wmsBoxInfoService.updateWmsBoxInfo(boxInfoUpdate);
|
|
- return AjaxResult.success("组盘成功!");
|
|
+ return AjaxResult.success("备货成功!");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ * 备货(不是当前出库单分配的)
|
|
|
|
+ *
|
|
|
|
+ * @param groupDiskFrom
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Transactional
|
|
|
|
+ public AjaxResult groupDiskUnAllocationBH(GroupDiskFrom groupDiskFrom) {
|
|
|
|
+ String palletNoFrom = groupDiskFrom.getPalletNoFrom();
|
|
|
|
+ String palletNoTo = groupDiskFrom.getPalletNoTo();
|
|
|
|
+ String sn = groupDiskFrom.getSn();
|
|
|
|
+ String orderNo = "";
|
|
|
|
+ String sku = "";
|
|
|
|
+ Double qty = Double.valueOf(groupDiskFrom.getQty());
|
|
|
|
+ boolean isAllUpdate = false;
|
|
|
|
+ boolean isStockPalletNoTo = groupDiskFrom.isStockPalletNoTo();
|
|
|
|
+ final Double toQty;
|
|
|
|
+ Long currentVirtualZone;
|
|
|
|
+ if (StringUtils.isNotEmpty(groupDiskFrom.getOrderNo())) {
|
|
|
|
+ orderNo = groupDiskFrom.getOrderNo();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ CodeSkuRelationshipVO codeSkuRelationshipVO = codeSkuRelationshipService.checkIsProduct(sn);
|
|
|
|
+ sku = codeSkuRelationshipVO.getSku();
|
|
|
|
+ if (codeSkuRelationshipVO.isProduct()) {
|
|
|
|
+ qty = 1.0;
|
|
|
|
+ }
|
|
|
|
+ toQty = qty;
|
|
|
|
+
|
|
|
|
+ InvLocIdSearchFrom locIdSearchFrom = new InvLocIdSearchFrom();
|
|
|
|
+ locIdSearchFrom.setSku(sku);
|
|
|
|
+ LotattDTO lotattDTO = new LotattDTO();
|
|
|
|
+ lotattDTO.setLotatt07(palletNoFrom);
|
|
|
|
+ lotattDTO.setLotatt02(sn);
|
|
|
|
+
|
|
|
|
+ locIdSearchFrom.setLotattDTO(lotattDTO);
|
|
|
|
+ List<InvLotLocIdLotattVO> invLotLocIdLotattList = invLotLocIdService.selectInvLocIdLotattList(locIdSearchFrom);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ List<InvLotLocIdLotattVO> invLotLocIdLotattVOList = new ArrayList<>();
|
|
|
|
+ InvLotLocIdLotattVO endLotattVO = null;
|
|
|
|
+ List<InvLotLocIdLotattVO> equalInv = invLotLocIdLotattList.stream().filter(v -> v.getQty().compareTo(toQty) == 0).collect(Collectors.toList());
|
|
|
|
+ if (equalInv.size() > 0) {
|
|
|
|
+ endLotattVO = equalInv.get(0);
|
|
|
|
+ isAllUpdate = true;
|
|
|
|
+ } else {
|
|
|
|
+ List<InvLotLocIdLotattVO> greaterInv = invLotLocIdLotattList.stream().filter(v -> v.getQty().compareTo(toQty) == 1).collect(Collectors.toList());
|
|
|
|
+ if (greaterInv.size() > 0) {
|
|
|
|
+ endLotattVO = greaterInv.get(0);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (endLotattVO == null) {
|
|
|
|
+ return AjaxResult.error("组盘数量大于单条库存数量!");
|
|
|
|
+ }
|
|
|
|
+ currentVirtualZone = endLotattVO.getLocationId();
|
|
|
|
+ invLotLocIdLotattVOList.add(endLotattVO);
|
|
|
|
+
|
|
|
|
+ if (StringUtils.isNotEmpty(endLotattVO.getLotatt14())) {
|
|
|
|
+ return AjaxResult.error("扫描条码已经备货,对应出库单:" + endLotattVO.getLotatt14());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ AjaxResult ajaxResultC = invLotLocIdService.checkPalletIsOnlyOrderNo(groupDiskFrom.getPalletNoTo()
|
|
|
|
+ , orderNo);
|
|
|
|
+ if (!ajaxResultC.isSuccess()) {
|
|
|
|
+ return ajaxResultC;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Map<String, List<InvLotLocIdLotattVO>> lotnumAndInvLocIdMap = new HashMap<>();
|
|
|
|
+ invLotLocIdLotattVOList.stream().forEach(v -> {
|
|
|
|
+ if (lotnumAndInvLocIdMap.get(v) == null) {
|
|
|
|
+ lotnumAndInvLocIdMap.put(v.getLotnum(), Arrays.asList(v));
|
|
|
|
+ } else {
|
|
|
|
+ List<InvLotLocIdLotattVO> locIdLotattVOList = lotnumAndInvLocIdMap.get(v.getLotnum());
|
|
|
|
+ locIdLotattVOList.add(v);
|
|
|
|
+ lotnumAndInvLocIdMap.put(v.getLotnum(), locIdLotattVOList);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ for (Map.Entry<String, List<InvLotLocIdLotattVO>> lotnumToInvLocId : lotnumAndInvLocIdMap.entrySet()) {
|
|
|
|
+ String lotnum = lotnumToInvLocId.getKey();
|
|
|
|
+ List<InvLotLocIdLotattVO> invLocIdList = lotnumToInvLocId.getValue();
|
|
|
|
+ InvLotAtt invLotAtt = invLotAttMapper.selectInvLotAttByLotnum(lotnum);
|
|
|
|
+ String newLotnum = idSequenceUtils.generateId("LOTNUMBER");
|
|
|
|
+ invLotAtt.setLotnum(newLotnum);
|
|
|
|
+ invLotAtt.setLotatt07(palletNoTo);
|
|
|
|
+ invLotAtt.setLotatt14(orderNo);
|
|
|
|
+ InvLotLocIdLotattVO invLotLocIdLotattVO = invLocIdList.get(0);
|
|
|
|
+ if (StringUtils.isEmpty(invLotLocIdLotattVO.getLotatt15())) {
|
|
|
|
+ invLotAtt.setLotatt15(orderNo);
|
|
|
|
+ } else {
|
|
|
|
+ invLotAtt.setLotatt15(invLotLocIdLotattVO.getLotatt15());
|
|
|
|
+ }
|
|
|
|
+ invLotAtt.setCreateTime(DateUtils.getNowDate());
|
|
|
|
+ if (invLotAttMapper.insertInvLotAtt(invLotAtt) > 0) {
|
|
|
|
+ for (InvLotLocIdLotattVO v : invLocIdList) {
|
|
|
|
+ if (isAllUpdate) {
|
|
|
|
+ InvLotLocIdForm invLotLocIdUpdate = new InvLotLocIdForm();
|
|
|
|
+ invLotLocIdUpdate.setLotnum(lotnum);
|
|
|
|
+ invLotLocIdUpdate.setLocationId(v.getLocationId().toString());
|
|
|
|
+ invLotLocIdUpdate.setCustomerId(v.getCustomerId());
|
|
|
|
+ invLotLocIdUpdate.setSku(v.getSku());
|
|
|
|
+ invLotLocIdUpdate.setQtyallocated(invLotLocIdUpdate.getQty());
|
|
|
|
+ invLotLocIdUpdate.setLotnumTo(newLotnum);
|
|
|
|
+ invLotLocIdService.updateInvLotLocId(invLotLocIdUpdate);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ wmsDocOrderHeaderService.modifystockCompletionStatus(orderNo, sku, new BigDecimal(toQty));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ WmsBoxInfo wmsBoxInfo = wmsBoxInfoService.selectWmsBoxInfoByBoxNo(palletNoTo);
|
|
|
|
+ WmsBoxInfo boxInfoUpdate = new WmsBoxInfo();
|
|
|
|
+ boxInfoUpdate.setId(wmsBoxInfo.getId());
|
|
|
|
+ boxInfoUpdate.setLocationId(currentVirtualZone);
|
|
|
|
+ wmsBoxInfoService.updateWmsBoxInfo(boxInfoUpdate);
|
|
|
|
+ return AjaxResult.success("备货成功!(未分配条码)");
|
|
}
|
|
}
|
|
|
|
|
|
@Transactional
|
|
@Transactional
|