diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java index 81640729..f4ead77e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java @@ -1192,6 +1192,10 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService private void buildPurchaseStorage(PurchaseOrder purchaseOrder, List filterPurchaseOrderChildList, String warehouseStorageCode) { PurchaseStorage purchaseStorage = new PurchaseStorage(); + String supplierCode = purchaseOrder.getSupplierCode(); + + SysSupplier sysSupplier = sysSupplierService.selectSysSupplierByCode(supplierCode); + PurchaseOrderChild purchaseOrderChild = filterPurchaseOrderChildList.get(0); purchaseStorage.setWarehouseStorageStatus("0"); purchaseStorage.setWarehouseStorageType("5"); @@ -1202,8 +1206,11 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService purchaseStorage.setArrivedTime(purchaseOrder.getArrivedTime()); purchaseStorage.setRelatedOrderCode(purchaseOrder.getPurchaseOrderCode()); - purchaseStorage.setSupplierCode(purchaseOrder.getSupplierCode()); + purchaseStorage.setSupplierCode(supplierCode); purchaseStorage.setSupplierName(purchaseOrder.getSupplierName()); + purchaseStorage.setSupplierAddress(sysSupplier.getReceiveAddress()); + purchaseStorage.setContactNumber(sysSupplier.getReceivePersonPhone()); + purchaseStorage.setCustomerContact(sysSupplier.getReceivePerson()); purchaseStorage.setWarehouseStorageCode(warehouseStorageCode); int allNotifyArrivedNum = filterPurchaseOrderChildList.stream().mapToInt(PurchaseOrderChild::getNotifyArriveNum).sum(); @@ -1224,6 +1231,11 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService //采购入库生成仓库入库主表数据 private void buildWarehouseStorage(PurchaseOrder purchaseOrder, String warehouseStorageCode, List filterPurchaseOrderChildList) { + + String supplierCode = purchaseOrder.getSupplierCode(); + + SysSupplier sysSupplier = sysSupplierService.selectSysSupplierByCode(supplierCode); + PurchaseOrderChild purchaseOrderChild = filterPurchaseOrderChildList.get(0); WarehouseStorageOrder warehouseStorageOrder = new WarehouseStorageOrder(); warehouseStorageOrder.setWarehouseStorageCode(warehouseStorageCode); @@ -1233,6 +1245,14 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService warehouseStorageOrder.setWarehouseQualityStatus("0"); warehouseStorageOrder.setWarehouseOrderType("0"); warehouseStorageOrder.setArrivedTime(purchaseOrder.getArrivedTime()); + + warehouseStorageOrder.setSupplierCode(supplierCode); + warehouseStorageOrder.setSupplierName(purchaseOrder.getSupplierName()); + warehouseStorageOrder.setSupplierAddress(sysSupplier.getReceiveAddress()); + warehouseStorageOrder.setContactNumber(sysSupplier.getReceivePersonPhone()); + warehouseStorageOrder.setCustomerContact(sysSupplier.getReceivePerson()); + + int allNotifyArrivedNum = filterPurchaseOrderChildList.stream().mapToInt(PurchaseOrderChild::getNotifyArriveNum).sum(); int allNotifyHasArrivedNum = filterPurchaseOrderChildList.stream().mapToInt(PurchaseOrderChild::getNotifyHasArrivedNum).sum(); if (allNotifyHasArrivedNum == 0){ @@ -1290,6 +1310,7 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService }else { warehouseStorageOrderDetail.setNotifyHasArrivedNum(notifyHasArrivedNum + notifyArriveNum); } + warehouseStorageOrderDetail.setNotifyArriveNum(notifyArriveNum); warehouseStorageOrderDetailChildren.add(warehouseStorageOrderDetail); } int result = warehouseStorageOrderDetailMapper.insertBatchWarehouseStorageOrderDetail(warehouseStorageOrderDetailChildren); @@ -1338,6 +1359,7 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService }else { purchaseStorageChild.setNotifyHasArrivedNum(notifyHasArrivedNum + notifyArriveNum); } + purchaseStorageChild.setNotifyArriveNum(notifyArriveNum); purchaseStorageChildren.add(purchaseStorageChild); } int result = purchaseStorageChildMapper.insertBatchPurchaseStorageChild(purchaseStorageChildren); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java index 4a4191ba..ded0a48e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java @@ -234,11 +234,10 @@ public class WarehouseStorageOrderController extends BaseController */ @ResponseBody @RequestMapping("/temporaryPurchaseDetailList") - public Map> temporaryPurchaseDetail(String warehouseStorageCode){ - List allDetails = storageOrderDetailService.selectStorageOrderDetailListByCode(warehouseStorageCode); - List filterAllDetails = allDetails.stream().filter(wso -> "1".equals(wso.getMaterialDeptType())).collect(Collectors.toList()); - Map> groupedDetails = filterAllDetails.stream().collect(Collectors.groupingBy(WarehouseStorageOrderDetail::getSupplierCode)); - return groupedDetails; + public TableDataInfo temporaryPurchaseDetail(String warehouseStorageCode){ + startPage(); + List list = storageOrderDetailService.selectStorageOrderDetailListByCode(warehouseStorageCode); + return getDataTable(list); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java index 082b5f83..4cafa3ed 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java @@ -362,13 +362,14 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS @Override public int temporaryPurchaseSave(WarehouseStorageOrder warehouseStorageOrder) { + //流程说明:入库部门(采购):1、采购发起【采购入库单】:2、仓库暂收【入库单】;3、采购入库【入库单】 String loginName = ShiroUtils.getLoginName(); warehouseStorageOrder.setUpdateBy(loginName); warehouseStorageOrder.setUpdateTime(DateUtils.getNowDate()); //改变状态为已暂收 - warehouseStorageOrder.setWarehouseStorageStatus("1"); + warehouseStorageOrder.setWarehouseStorageStatus("2"); //设置品质状态,为待品质 - warehouseStorageOrder.setWarehouseQualityStatus("0"); + //warehouseStorageOrder.setWarehouseQualityStatus("0"); warehouseStorageOrder.setWarehouseEmployee(loginName); List warehouseStorageOrderDetailList = warehouseStorageOrder.getWarehouseStorageOrderDetailList(); @@ -385,19 +386,15 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS actualArriveNum = warehouseStorageOrderDetailList.stream().mapToInt(WarehouseStorageOrderDetail::getActualArriveNum).sum(); int temporaryQualifiedNum = 0; - //检查填写的品质合格数是否有空值 + //检查填写的暂收合格数是否有空值 boolean hasTemporaryQualifiedNumNull = warehouseStorageOrderDetailList.stream() .anyMatch(item -> item.getTemporaryQualifiedNum() == null); if (hasTemporaryQualifiedNumNull) { - throw new BusinessException("存在品质合格数为空,请检查!"); + throw new BusinessException("存在暂收合格数为空,请检查!"); } //入库单主表的暂收合格数为子表的合计 temporaryQualifiedNum = warehouseStorageOrderDetailList.stream().mapToInt(WarehouseStorageOrderDetail::getTemporaryQualifiedNum).sum(); - if (actualArriveNum < temporaryQualifiedNum) { - throw new BusinessException("暂收合格数不能大于实际到货数"); - } - //插入实际到货数 warehouseStorageOrder.setActualArrivedNum(actualArriveNum); //插入暂收合格数 @@ -425,13 +422,15 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS } - try { - qualityOrderService.insertQualityOrderByWarehouseStorageOrder(warehouseStorageOrder, warehouseStorageOrder.getWarehouseStorageOrderDetailList()); - } catch (Exception e) { - TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); - log.error("生成品质单时发生错误", e); - throw new BusinessException("生成品质单时发生错误"); - } + //新流程,采购入库不走品质 +// +// try { +// qualityOrderService.insertQualityOrderByWarehouseStorageOrder(warehouseStorageOrder, warehouseStorageOrder.getWarehouseStorageOrderDetailList()); +// } catch (Exception e) { +// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); +// log.error("生成品质单时发生错误", e); +// throw new BusinessException("生成品质单时发生错误"); +// } return updateResult; } @@ -1145,23 +1144,42 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS return 0; } for (WarehouseStorageOrderDetail detail : details) { - detail.setWarehouseStorageCode(warehouseStorageOrder.getWarehouseStorageCode()); - Integer actualArriveNum = detail.getActualArriveNum(); - Integer temporaryQualifiedNum = detail.getTemporaryQualifiedNum(); - //添加实际已到货数 + detail.setWarehouseStorageCode(warehouseStorageOrder.getWarehouseStorageCode()); + Integer actualArriveNum = detail.getActualArriveNum(); + Integer notifyArriveNum = detail.getNotifyArriveNum(); + Integer temporaryQualifiedNum = detail.getTemporaryQualifiedNum(); + Integer actualHasArrivedNum = detail.getActualHasArrivedNum(); + Integer temporaryHasQualifiedNum = detail.getTemporaryHasQualifiedNum(); + if (notifyArriveNum < temporaryQualifiedNum){ + throw new BusinessException("暂收合格数要小于等于通知到货数"); + } + if (notifyArriveNum < actualArriveNum){ + throw new BusinessException("实际到货数要小于等于通知到货数"); + } + + if (actualHasArrivedNum == null || actualHasArrivedNum == 0){ detail.setActualHasArrivedNum(actualArriveNum); - //添加暂收已合格数 + }else { + detail.setActualHasArrivedNum(actualHasArrivedNum + actualArriveNum); + } + if (temporaryHasQualifiedNum == null || temporaryHasQualifiedNum == 0){ detail.setTemporaryHasQualifiedNum(temporaryQualifiedNum); - if (actualArriveNum < temporaryQualifiedNum){ - throw new BusinessException("暂收合格数要小于等于实际到货数"); - } - if(detail.getWarehouseStorageType()!=null&&detail.getWarehouseStorageType().equals("4")){ - updateResultDetails += storageOrderDetailMapper.updateWarehouseStorageOrderDetail(detail); - }else { - updateResultDetails += storageOrderDetailMapper.updateWarehouseStorageOrderDetailByObject(detail); - } + }else { + detail.setTemporaryHasQualifiedNum(temporaryHasQualifiedNum + temporaryQualifiedNum); + } + + //添加实际已到货数 + detail.setActualArriveNum(actualArriveNum); + //添加暂收已合格数 + detail.setTemporaryQualifiedNum(temporaryQualifiedNum); + + if(detail.getWarehouseStorageType() != null && detail.getWarehouseStorageType().equals("4")){ + updateResultDetails += storageOrderDetailMapper.updateWarehouseStorageOrderDetail(detail); + }else { + updateResultDetails += storageOrderDetailMapper.updateWarehouseStorageOrderDetailByObject(detail); + } } - return updateResultDetails; + return updateResultDetails; } diff --git a/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchase.html b/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchase.html index 623a9a91..1aa977f5 100644 --- a/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchase.html +++ b/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchase.html @@ -3,6 +3,7 @@ +