From 1514065484f4f3c5c1cc7d542e5600c82c1cf145 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=98=8E=E6=A2=81?= <2429105222@qq.com> Date: Fri, 11 Aug 2023 16:39:24 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=BA=93=E5=AD=98=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../glxp/api/entity/inv/InvProductEntity.java | 31 ++++++++ .../service/inout/IoCheckInoutService.java | 5 +- .../api/service/inout/IoOrderService.java | 3 + .../inout/impl/IoOrderServiceImpl.java | 73 +++++++++++++++++++ .../service/inv/InvPreinProductService.java | 2 + .../api/service/inv/InvProductService.java | 2 + .../inv/impl/InvPreinProductServiceImpl.java | 7 ++ .../inv/impl/InvProductServiceImpl.java | 6 ++ 8 files changed, 128 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/glxp/api/entity/inv/InvProductEntity.java b/src/main/java/com/glxp/api/entity/inv/InvProductEntity.java index 75c99f7ac..f1cfb4375 100644 --- a/src/main/java/com/glxp/api/entity/inv/InvProductEntity.java +++ b/src/main/java/com/glxp/api/entity/inv/InvProductEntity.java @@ -105,5 +105,36 @@ public class InvProductEntity { @TableField(value = "updateTime") private Date updateTime; + /** + * 现存量 + */ + @TableField(value = "nowStock") + private Integer nowStock; + /** + * 冻结量 + */ + @TableField(value = "frozenCount") + private Integer frozenCount; + /** + * 预计入库量 + */ + @TableField(value = "planInCount") + private Integer planInCount; + /** + * 预计出库量 + */ + @TableField(value = "planOutCount") + private Integer planOutCount; + /** + * 在途库存 + */ + @TableField(value = "onWayCount") + private Integer onWayCount; + /** + * 可用库存 + */ + @TableField(value = "availableStock") + private Integer availableStock; + } diff --git a/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java b/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java index 079d0d683..6149a18cb 100644 --- a/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java +++ b/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java @@ -426,6 +426,8 @@ public class IoCheckInoutService { orderEntity.setDealStatus(ConstantStatus.ORDER_DEAL_POST); orderEntity.setUpdateTime(new Date()); orderService.update(orderEntity); + //生成预存的库存 + orderService.updateOrderInventory(orderEntity.getBillNo(),orderEntity.getStatus()); genLostCode(orderEntity.getBillNo()); checkThird(orderEntity); } @@ -540,7 +542,7 @@ public class IoCheckInoutService { orderEntity.setDealStatus(ConstantStatus.ORDER_DEAL_POST); orderEntity.setUpdateTime(new Date()); orderService.update(orderEntity); - + orderService.updateOrderInventory(orderEntity.getBillNo(),orderEntity.getStatus()); //生成缺失码 genLostCode(orderEntity.getBillNo()); @@ -1051,6 +1053,7 @@ public class IoCheckInoutService { genInvService.genPreInv(orderEntity.getBillNo()); } else { genInvService.genNorInv(orderEntity.getBillNo()); + orderService.updateOrderInventory(orderEntity.getBillNo(),orderEntity.getStatus()); } } else { //不入库存,直接进行单据流转 diff --git a/src/main/java/com/glxp/api/service/inout/IoOrderService.java b/src/main/java/com/glxp/api/service/inout/IoOrderService.java index 90ceb2977..2c29c59a0 100644 --- a/src/main/java/com/glxp/api/service/inout/IoOrderService.java +++ b/src/main/java/com/glxp/api/service/inout/IoOrderService.java @@ -149,4 +149,7 @@ public interface IoOrderService { List selectOrderIdList(@Param("data") String data); + void updateOrderInventory(String billNo,Integer status); + + } diff --git a/src/main/java/com/glxp/api/service/inout/impl/IoOrderServiceImpl.java b/src/main/java/com/glxp/api/service/inout/impl/IoOrderServiceImpl.java index 5cebaac78..e12d8bb59 100644 --- a/src/main/java/com/glxp/api/service/inout/impl/IoOrderServiceImpl.java +++ b/src/main/java/com/glxp/api/service/inout/impl/IoOrderServiceImpl.java @@ -22,6 +22,7 @@ import com.glxp.api.dao.basic.BasicCorpDao; import com.glxp.api.dao.inout.IoOrderDao; import com.glxp.api.dao.thrsys.ThrSystemBusApiDao; import com.glxp.api.dao.thrsys.ThrSystemDao; +import com.glxp.api.entity.auth.InvWarehouseEntity; import com.glxp.api.entity.basic.BasicBussinessTypeEntity; import com.glxp.api.entity.basic.BasicCorpEntity; import com.glxp.api.entity.inout.*; @@ -969,6 +970,24 @@ public class IoOrderServiceImpl implements IoOrderService { return orderDao.selectOrderIdList(data); } + @Override + public void updateOrderInventory(String billNo, Integer status) { + //查询单据表 + QueryWrapper ew = new QueryWrapper<>(); + ew.eq("billNo", billNo); + IoOrderEntity ioOrderEntity = orderDao.selectVoOne(ew); + //查询单据result表 + List ioOrderDetailResultEntityList = ioOrderDetailResultService.findByOrderId(billNo); + //查询产库信息 + InvWarehouseEntity invWarehouseEntity = invWarehouseDao.filterGroupInvSubAndcode(ioOrderEntity.getInvCode()); + if (ioOrderEntity != null && invWarehouseEntity != null) { + //判断是哪个类型的库存 + if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_NORMAL) { + setInvProductEntityList(ioOrderDetailResultEntityList, ioOrderEntity.getMainAction(), status); + } + } + } + /** * 查询此单据关联的所有单据 * @@ -1072,4 +1091,58 @@ public class IoOrderServiceImpl implements IoOrderService { return orderDao.getfilterOrderList(filterOrderRequest); } + public Boolean setInvProductEntityList(List ioOrderDetailResultEntityList, String mainAction, Integer status) { + + for (IoOrderDetailResultEntity ioOrderDetailResultEntity : ioOrderDetailResultEntityList) { + //查询该产品是不是存在 + InvProductEntity invProductEntity = invProductService.selectByUnique(ioOrderDetailResultEntity.getBindRlFk(), ioOrderDetailResultEntity.getBatchNo(), ioOrderDetailResultEntity.getSupId()); + if (invProductEntity == null) { + //没有该产品就填充数据 + invProductEntity = new InvProductEntity(); + invProductEntity.setRelIdFk(ioOrderDetailResultEntity.getBindRlFk()); + invProductEntity.setNameCode(ioOrderDetailResultEntity.getNameCode()); + invProductEntity.setBatchNo(ioOrderDetailResultEntity.getBatchNo()); + invProductEntity.setProductionDate(ioOrderDetailResultEntity.getProductDate()); + invProductEntity.setExpireDate(ioOrderDetailResultEntity.getExpireDate()); + invProductEntity.setInCount(0); + invProductEntity.setOutCount(0); + invProductEntity.setSupId(ioOrderDetailResultEntity.getSupId()); + invProductEntity.setDeptCode(ioOrderDetailResultEntity.getDeptCode()); + invProductEntity.setCreateTime(new Date()); + invProductEntity.setUpdateTime(new Date()); + invProductEntity.setNowStock(0); //现存量 + invProductEntity.setFrozenCount(0); //冻结量 + invProductEntity.setPlanInCount(0);//预计入库量 + invProductEntity.setPlanOutCount(0);//预计出库量 + invProductEntity.setOnWayCount(0);//在途库存 + invProductEntity.setAvailableStock(0);//可用库存 + } + if (mainAction.equals(ConstantType.TYPE_PUT)) { + //出库 + if (status == ConstantStatus.ORDER_STATUS_CHECK_SUCCESS) { + invProductEntity.setPlanOutCount((invProductEntity.getPlanOutCount() != null ? invProductEntity.getPlanOutCount() : 0) + ioOrderDetailResultEntity.getReCount());//预计出库量 + invProductEntity.setFrozenCount((invProductEntity.getFrozenCount() != null ? invProductEntity.getFrozenCount() : 0) + ioOrderDetailResultEntity.getReCount());//预计出库量 + } else if (status == ConstantStatus.ORDER_STATUS_AUDITED) { + invProductEntity.setPlanOutCount((invProductEntity.getPlanOutCount() != null ? invProductEntity.getPlanOutCount() : 0) - ioOrderDetailResultEntity.getReCount());//预计出库量 + invProductEntity.setFrozenCount((invProductEntity.getFrozenCount() != null ? invProductEntity.getFrozenCount() : 0) - ioOrderDetailResultEntity.getReCount());//预计出库量 + } + } else if (mainAction.equals(ConstantType.TYPE_OUT)) { + //入库 + if (status == ConstantStatus.ORDER_STATUS_CHECK_SUCCESS) { + invProductEntity.setPlanInCount((invProductEntity.getInCount() != null ? invProductEntity.getInCount() : 0) + ioOrderDetailResultEntity.getReCount());//预计出库量 + } else if (status == ConstantStatus.ORDER_STATUS_AUDITED) { + invProductEntity.setPlanInCount((invProductEntity.getInCount() != null ? invProductEntity.getInCount() : 0) - ioOrderDetailResultEntity.getReCount());//预计出库量 + } + } + //判断有没有id走插入或者更新方法 + if (invProductEntity.getId() == null) { + invProductService.insert(invProductEntity); + } else { + invProductService.update(invProductEntity); + } + + } + return true; + } + } diff --git a/src/main/java/com/glxp/api/service/inv/InvPreinProductService.java b/src/main/java/com/glxp/api/service/inv/InvPreinProductService.java index 9f3121129..4f460fcec 100644 --- a/src/main/java/com/glxp/api/service/inv/InvPreinProductService.java +++ b/src/main/java/com/glxp/api/service/inv/InvPreinProductService.java @@ -18,6 +18,8 @@ public interface InvPreinProductService { InvPreinProductEntity selectByUnique(Long relId, String batchNo, String supId, String deptCode, String invCode); + InvPreinProductEntity selectByUnique(Long relId, String batchNo, String supId); + boolean deleteById(Integer id); /** diff --git a/src/main/java/com/glxp/api/service/inv/InvProductService.java b/src/main/java/com/glxp/api/service/inv/InvProductService.java index 7e2b64c0b..fb2120985 100644 --- a/src/main/java/com/glxp/api/service/inv/InvProductService.java +++ b/src/main/java/com/glxp/api/service/inv/InvProductService.java @@ -17,6 +17,8 @@ public interface InvProductService { InvProductEntity selectByUnique(Long relId, String batchNo, String supId, String deptCode, String invCode); + InvProductEntity selectByUnique(Long relId, String batchNo, String supId); + /** * 库存查询 * diff --git a/src/main/java/com/glxp/api/service/inv/impl/InvPreinProductServiceImpl.java b/src/main/java/com/glxp/api/service/inv/impl/InvPreinProductServiceImpl.java index b19b7c4bf..5ebfa831f 100644 --- a/src/main/java/com/glxp/api/service/inv/impl/InvPreinProductServiceImpl.java +++ b/src/main/java/com/glxp/api/service/inv/impl/InvPreinProductServiceImpl.java @@ -41,6 +41,13 @@ public class InvPreinProductServiceImpl implements InvPreinProductService { } + @Override + public InvPreinProductEntity selectByUnique(Long relId, String batchNo, String supId) { + return invPreinProductDao.selectOne(new QueryWrapper().eq("relIdFk", relId).eq(StrUtil.isNotEmpty(batchNo), "batchNo", batchNo) + .isNull(StrUtil.isEmpty(batchNo), "batchNo").eq("supId", supId)); + + } + @Override public boolean deleteById(Integer id) { return invPreinProductDao.deleteById(id) == 1 ? true : false; diff --git a/src/main/java/com/glxp/api/service/inv/impl/InvProductServiceImpl.java b/src/main/java/com/glxp/api/service/inv/impl/InvProductServiceImpl.java index 7d5629767..111ef36a7 100644 --- a/src/main/java/com/glxp/api/service/inv/impl/InvProductServiceImpl.java +++ b/src/main/java/com/glxp/api/service/inv/impl/InvProductServiceImpl.java @@ -47,6 +47,12 @@ public class InvProductServiceImpl implements InvProductService { .isNull(StrUtil.isEmpty(batchNo), "batchNo").eq("supId", supId).eq("deptCode", deptCode).eq("invCode", invCode)); } + @Override + public InvProductEntity selectByUnique(Long relId, String batchNo, String supId) { + return invProductDao.selectOne(new QueryWrapper().eq("relIdFk", relId).eq(StrUtil.isNotEmpty(batchNo), "batchNo", batchNo) + .isNull(StrUtil.isEmpty(batchNo), "batchNo").eq("supId", supId)); + } + @Override public List filterList(FilterInvProductRequest filterInvProductRequest) { if (null == filterInvProductRequest) { From 4ffe2f71c895b331efa76648b106ce94bd8d6812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=98=8E=E6=A2=81?= <2429105222@qq.com> Date: Fri, 11 Aug 2023 17:04:06 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=BA=93=E5=AD=98=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inout/impl/IoOrderServiceImpl.java | 22 ++++++++++--------- .../inv/impl/InvProductServiceImpl.java | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/glxp/api/service/inout/impl/IoOrderServiceImpl.java b/src/main/java/com/glxp/api/service/inout/impl/IoOrderServiceImpl.java index e12d8bb59..ce68c067f 100644 --- a/src/main/java/com/glxp/api/service/inout/impl/IoOrderServiceImpl.java +++ b/src/main/java/com/glxp/api/service/inout/impl/IoOrderServiceImpl.java @@ -983,7 +983,7 @@ public class IoOrderServiceImpl implements IoOrderService { if (ioOrderEntity != null && invWarehouseEntity != null) { //判断是哪个类型的库存 if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_NORMAL) { - setInvProductEntityList(ioOrderDetailResultEntityList, ioOrderEntity.getMainAction(), status); + setInvProductEntityList(ioOrderDetailResultEntityList, ioOrderEntity); } } } @@ -1091,11 +1091,12 @@ public class IoOrderServiceImpl implements IoOrderService { return orderDao.getfilterOrderList(filterOrderRequest); } - public Boolean setInvProductEntityList(List ioOrderDetailResultEntityList, String mainAction, Integer status) { + public Boolean setInvProductEntityList(List ioOrderDetailResultEntityList,IoOrderEntity ioOrderEntity) { for (IoOrderDetailResultEntity ioOrderDetailResultEntity : ioOrderDetailResultEntityList) { //查询该产品是不是存在 - InvProductEntity invProductEntity = invProductService.selectByUnique(ioOrderDetailResultEntity.getBindRlFk(), ioOrderDetailResultEntity.getBatchNo(), ioOrderDetailResultEntity.getSupId()); + InvProductEntity invProductEntity = invProductService.selectByUnique(ioOrderDetailResultEntity.getBindRlFk(), ioOrderDetailResultEntity.getBatchNo(), + ioOrderDetailResultEntity.getSupId(),ioOrderEntity.getDeptCode(),ioOrderEntity.getInvCode()); if (invProductEntity == null) { //没有该产品就填充数据 invProductEntity = new InvProductEntity(); @@ -1107,7 +1108,8 @@ public class IoOrderServiceImpl implements IoOrderService { invProductEntity.setInCount(0); invProductEntity.setOutCount(0); invProductEntity.setSupId(ioOrderDetailResultEntity.getSupId()); - invProductEntity.setDeptCode(ioOrderDetailResultEntity.getDeptCode()); + invProductEntity.setDeptCode(ioOrderEntity.getDeptCode()); + invProductEntity.setInvCode(ioOrderEntity.getInvCode()); invProductEntity.setCreateTime(new Date()); invProductEntity.setUpdateTime(new Date()); invProductEntity.setNowStock(0); //现存量 @@ -1117,20 +1119,20 @@ public class IoOrderServiceImpl implements IoOrderService { invProductEntity.setOnWayCount(0);//在途库存 invProductEntity.setAvailableStock(0);//可用库存 } - if (mainAction.equals(ConstantType.TYPE_PUT)) { + if (ioOrderEntity.getMainAction().equals(ConstantType.TYPE_PUT)) { //出库 - if (status == ConstantStatus.ORDER_STATUS_CHECK_SUCCESS) { + if (ioOrderEntity.getStatus() == ConstantStatus.ORDER_STATUS_CHECK_SUCCESS) { invProductEntity.setPlanOutCount((invProductEntity.getPlanOutCount() != null ? invProductEntity.getPlanOutCount() : 0) + ioOrderDetailResultEntity.getReCount());//预计出库量 invProductEntity.setFrozenCount((invProductEntity.getFrozenCount() != null ? invProductEntity.getFrozenCount() : 0) + ioOrderDetailResultEntity.getReCount());//预计出库量 - } else if (status == ConstantStatus.ORDER_STATUS_AUDITED) { + } else if (ioOrderEntity.getStatus() == ConstantStatus.ORDER_STATUS_AUDITED) { invProductEntity.setPlanOutCount((invProductEntity.getPlanOutCount() != null ? invProductEntity.getPlanOutCount() : 0) - ioOrderDetailResultEntity.getReCount());//预计出库量 invProductEntity.setFrozenCount((invProductEntity.getFrozenCount() != null ? invProductEntity.getFrozenCount() : 0) - ioOrderDetailResultEntity.getReCount());//预计出库量 } - } else if (mainAction.equals(ConstantType.TYPE_OUT)) { + } else if (ioOrderEntity.getMainAction().equals(ConstantType.TYPE_OUT)) { //入库 - if (status == ConstantStatus.ORDER_STATUS_CHECK_SUCCESS) { + if (ioOrderEntity.getStatus() == ConstantStatus.ORDER_STATUS_CHECK_SUCCESS) { invProductEntity.setPlanInCount((invProductEntity.getInCount() != null ? invProductEntity.getInCount() : 0) + ioOrderDetailResultEntity.getReCount());//预计出库量 - } else if (status == ConstantStatus.ORDER_STATUS_AUDITED) { + } else if (ioOrderEntity.getStatus() == ConstantStatus.ORDER_STATUS_AUDITED) { invProductEntity.setPlanInCount((invProductEntity.getInCount() != null ? invProductEntity.getInCount() : 0) - ioOrderDetailResultEntity.getReCount());//预计出库量 } } diff --git a/src/main/java/com/glxp/api/service/inv/impl/InvProductServiceImpl.java b/src/main/java/com/glxp/api/service/inv/impl/InvProductServiceImpl.java index 111ef36a7..33a20bab9 100644 --- a/src/main/java/com/glxp/api/service/inv/impl/InvProductServiceImpl.java +++ b/src/main/java/com/glxp/api/service/inv/impl/InvProductServiceImpl.java @@ -50,7 +50,7 @@ public class InvProductServiceImpl implements InvProductService { @Override public InvProductEntity selectByUnique(Long relId, String batchNo, String supId) { return invProductDao.selectOne(new QueryWrapper().eq("relIdFk", relId).eq(StrUtil.isNotEmpty(batchNo), "batchNo", batchNo) - .isNull(StrUtil.isEmpty(batchNo), "batchNo").eq("supId", supId)); + .isNull(StrUtil.isEmpty(batchNo), "batchNo").eq("supId", supId).last("limit 1")); } @Override From a6436a464247b836d2c475210e2cf86924f6da58 Mon Sep 17 00:00:00 2001 From: anthonywj Date: Sat, 12 Aug 2023 12:05:20 +0800 Subject: [PATCH 3/3] =?UTF-8?q?pda=E5=BE=85=E6=A0=A1=E9=AA=8C=E5=BE=85?= =?UTF-8?q?=E9=85=8D=E8=B4=A7=E7=AD=89=E5=8D=95=E6=8D=AE=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/inout/IoOrderController.java | 42 +++++++++++++++++++ .../api/res/inout/IoOrderPdaResponse.java | 13 ++++++ 2 files changed, 55 insertions(+) create mode 100644 src/main/java/com/glxp/api/res/inout/IoOrderPdaResponse.java diff --git a/src/main/java/com/glxp/api/controller/inout/IoOrderController.java b/src/main/java/com/glxp/api/controller/inout/IoOrderController.java index 58f06959d..13f35bd0b 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoOrderController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoOrderController.java @@ -517,6 +517,48 @@ public class IoOrderController extends BaseController { } + /** + * PDA获取待校验、待配货等单据 + * + * @param filterOrderRequest + * @return + */ + @AuthRuleAnnotation("") + @GetMapping("/udiwms/inout/order/pda/download") + public BaseResponse pdaFilterOrder(FilterOrderRequest filterOrderRequest) { + + if (StrUtil.isEmpty(filterOrderRequest.getBillNo())) { + return ResultVOUtils.error(500, "单据号不能为空!"); + } + if (StrUtil.isNotBlank(filterOrderRequest.getStatusType())) { + orderService.setFilterStatus(filterOrderRequest); + } + if (StrUtil.isNotBlank(filterOrderRequest.getVueType())) { + orderService.setActions(filterOrderRequest); + //要是不存在要查询的单据类型就直接放回空 + if (CollUtil.isEmpty(filterOrderRequest.getActions())) { + PageInfo pageInfo = new PageInfo<>(new ArrayList<>()); + return ResultVOUtils.page(pageInfo); + } + } + String customerId = getCustomerId(); + if (!customerId.equals("110")) { + filterOrderRequest.setFromCorp(customerId); + } + List list = orderService.filterList(filterOrderRequest); + if (CollUtil.isEmpty(list)) + return ResultVOUtils.error(500, "未查询到单据"); + FilterOrderDetailBizRequest filterOrderDetailBizRequest = new FilterOrderDetailBizRequest(); + filterOrderDetailBizRequest.setOrderIdFk(filterOrderRequest.getBillNo()); + List orderDetailBizResponses = orderDetailBizService.filterList(filterOrderDetailBizRequest); + IoOrderPdaResponse orderPdaResponse = new IoOrderPdaResponse(); + orderPdaResponse.setOrderResponse(list.get(0)); + orderPdaResponse.setOrderDetailBizResponses(orderDetailBizResponses); + PageInfo pageInfo = new PageInfo<>(list); + return ResultVOUtils.page(pageInfo); + } + + public List getOtherCode(String billNo, List codeEntities) { List orderDetailBizEntities = orderDetailBizService.findByOrderId(billNo); diff --git a/src/main/java/com/glxp/api/res/inout/IoOrderPdaResponse.java b/src/main/java/com/glxp/api/res/inout/IoOrderPdaResponse.java new file mode 100644 index 000000000..38fadad4a --- /dev/null +++ b/src/main/java/com/glxp/api/res/inout/IoOrderPdaResponse.java @@ -0,0 +1,13 @@ +package com.glxp.api.res.inout; + +import lombok.Data; + +import java.util.List; + +@Data +public class IoOrderPdaResponse { + + private IoOrderResponse orderResponse; + private List orderDetailBizResponses; + +}