From 1ae16bd771fda2eb8b92c642f38c1ae18e26e008 Mon Sep 17 00:00:00 2001 From: chenhc <2369838784@qq.com> Date: Wed, 4 Sep 2024 16:16:59 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix:=20=E8=AF=B7=E6=B1=82=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../glxp/api/controller/collect/IoCollectOrderController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/glxp/api/controller/collect/IoCollectOrderController.java b/src/main/java/com/glxp/api/controller/collect/IoCollectOrderController.java index bd036bc51..73ab1b826 100644 --- a/src/main/java/com/glxp/api/controller/collect/IoCollectOrderController.java +++ b/src/main/java/com/glxp/api/controller/collect/IoCollectOrderController.java @@ -205,7 +205,7 @@ public class IoCollectOrderController extends BaseController { * * @return */ - @GetMapping("/udiwms/basic/collect/order/biz/save") + @PostMapping("/udiwms/basic/collect/order/biz/save") public BaseResponse saveOrderBiz(@RequestBody IoCollectOrderBiz collectOrderBiz) { collectOrderBizService.updateById(collectOrderBiz); return ResultVOUtils.success("更新成功"); From 00788a0597c01d79a08778cdeb021b4dac4b0963 Mon Sep 17 00:00:00 2001 From: yewj Date: Wed, 4 Sep 2024 16:34:39 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=A4=87=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/inout/IoSplitController.java | 9 +-- .../api/entity/collect/IoCollectOrderBiz.java | 7 +++ .../collect/IoCollectOrderService.java | 13 +++++ .../api/service/inout/IoSplitCodeService.java | 58 +++++++++++++++++++ .../service/inout/IoSplitFifoCodeService.java | 13 +++++ src/main/resources/schemas/schema_v2.4.sql | 42 ++++++++------ 6 files changed, 121 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/glxp/api/controller/inout/IoSplitController.java b/src/main/java/com/glxp/api/controller/inout/IoSplitController.java index ac56d1af7..e0f7455a2 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoSplitController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoSplitController.java @@ -136,10 +136,11 @@ public class IoSplitController extends BaseController { SysWorkplaceDocumentEntity sysWorkplaceDocumentEntity = sysWorkplaceDocumentService.findByWorkplaceCode(collectOrder.getWorkPlaceCode(), collectOrder.getBusType()); if (IntUtil.value(sysWorkplaceDocumentEntity.getAutoTag()) == 1) { - //未拆零 - if (IntUtil.value(collectOrder.getSplitStatus()) != 2) { - splitCodeService.orderAutoTagCode(collectOrder); - } + splitCodeService.preAutoTagCode(collectOrder); +// //未拆零 +// if (IntUtil.value(collectOrder.getSplitStatus()) != 2) { +// splitCodeService.orderAutoTagCode(collectOrder); +// } return ResultVOUtils.success("后台已开始赋码,请稍后刷新查看"); } else { return ResultVOUtils.success("无需自动赋码"); diff --git a/src/main/java/com/glxp/api/entity/collect/IoCollectOrderBiz.java b/src/main/java/com/glxp/api/entity/collect/IoCollectOrderBiz.java index da7191c32..de00914aa 100644 --- a/src/main/java/com/glxp/api/entity/collect/IoCollectOrderBiz.java +++ b/src/main/java/com/glxp/api/entity/collect/IoCollectOrderBiz.java @@ -198,6 +198,13 @@ public class IoCollectOrderBiz implements Serializable { @ApiModelProperty(value = "上传替换码") private String replaceCode; + /** + * 自动赋码状态:1:无法自动赋码;2:可以自动赋码;3:可以自动赋码,但是数量不足 + */ + @TableField(value = "autoTagStatus") + @ApiModelProperty(value = "autoTagStatus") + private Integer autoTagStatus; + private static final long serialVersionUID = 1L; } diff --git a/src/main/java/com/glxp/api/service/collect/IoCollectOrderService.java b/src/main/java/com/glxp/api/service/collect/IoCollectOrderService.java index 09a76f4db..00522d696 100644 --- a/src/main/java/com/glxp/api/service/collect/IoCollectOrderService.java +++ b/src/main/java/com/glxp/api/service/collect/IoCollectOrderService.java @@ -544,6 +544,19 @@ public class IoCollectOrderService extends ServiceImpl { //插入到码表 collectCodeService.insertCodesByBill(collectOrderRequest.getBillNo()); diff --git a/src/main/java/com/glxp/api/service/inout/IoSplitCodeService.java b/src/main/java/com/glxp/api/service/inout/IoSplitCodeService.java index 02883aa41..33beba52e 100644 --- a/src/main/java/com/glxp/api/service/inout/IoSplitCodeService.java +++ b/src/main/java/com/glxp/api/service/inout/IoSplitCodeService.java @@ -8,6 +8,7 @@ import com.github.pagehelper.PageHelper; import com.glxp.api.dao.inout.IoSplitCodeMapper; import com.glxp.api.entity.basic.BasicSkPrescribeDiEntity; import com.glxp.api.entity.basic.BasicSkPrescribeEntity; +import com.glxp.api.entity.basic.UdiRelevanceEntity; import com.glxp.api.entity.collect.IoCollectOrder; import com.glxp.api.entity.collect.IoCollectOrderBiz; import com.glxp.api.entity.collect.IoCollectOrderCodeAuto; @@ -17,6 +18,7 @@ import com.glxp.api.entity.inout.IoSplitFifoInv; import com.glxp.api.req.inout.IoSplitCodeRequest; import com.glxp.api.service.basic.BasicSkPrescribeDiService; import com.glxp.api.service.basic.BasicSkPrescribeService; +import com.glxp.api.service.basic.UdiRelevanceService; import com.glxp.api.service.collect.IoCollectOrderBizService; import com.glxp.api.service.collect.IoCollectOrderCodeAutoService; import com.glxp.api.service.collect.IoCollectOrderService; @@ -29,6 +31,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; +import java.util.stream.Collectors; @Service public class IoSplitCodeService extends ServiceImpl { @@ -262,6 +265,61 @@ public class IoSplitCodeService extends ServiceImpl collectOrderBizs = collectOrderBizService.listByBillNo(collectOrder.getBillNo()); + List needAutotagBizs = new ArrayList<>(); + for (IoCollectOrderBiz collectOrderBiz : collectOrderBizs) { + int unTagCount = collectOrderBiz.getCount() - IntUtil.value(collectOrderBiz.getScanActCount()); + if (unTagCount > 0) { + collectOrderBiz.setUnTagCount(unTagCount); + } else { + collectOrderBiz.setTagStatus(3); + continue; + } + UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(collectOrderBiz.getRelId()); + int quotient = collectOrderBiz.getUnTagCount() / IntUtil.value(udiRelevanceEntity.getUseLeverCount()); + int remainder = collectOrderBiz.getUnTagCount() % IntUtil.value(udiRelevanceEntity.getUseLeverCount()); + if (quotient > 0) { + + for(int i = 0;i collectOrderBizs = collectOrderBizService.listByBillNo(collectOrder.getBillNo()); + for (IoCollectOrderBiz collectOrderBiz : collectOrderBizs) { + List splitFifoCodeEntities = + splitFifoCodeService.findByRelId(collectOrder.getWorkPlaceCode(), collectOrder.getBusType(), + collectOrderBiz.getRelId(), collectOrderBiz.getBatchNo()); + + int total = splitFifoCodeEntities.stream() + .mapToInt(IoSplitFifoCodeEntity::getTotalCount) + .sum(); + //todo 拆零表里取数据 + if (total > IntUtil.value(collectOrderBiz.getCount())) { + collectOrderBiz.setAutoTagStatus(2); + } else if (total > 0) { + collectOrderBiz.setAutoTagStatus(3); + } else + collectOrderBiz.setAutoTagStatus(1); + } + } + /** * 拆零单据撤回,则将拆零表剩余数量加回预出库队列 diff --git a/src/main/java/com/glxp/api/service/inout/IoSplitFifoCodeService.java b/src/main/java/com/glxp/api/service/inout/IoSplitFifoCodeService.java index 4463140bb..f0e00e09b 100644 --- a/src/main/java/com/glxp/api/service/inout/IoSplitFifoCodeService.java +++ b/src/main/java/com/glxp/api/service/inout/IoSplitFifoCodeService.java @@ -50,6 +50,19 @@ public class IoSplitFifoCodeService extends ServiceImpl findByRelId(Long workPlaceCode, String busType, Long relId, String batchNo) { + List splitFifoCodeEntities = + list(new LambdaQueryWrapper() + .eq(IoSplitFifoCodeEntity::getWorkPlaceCode, workPlaceCode) + .eq(StrUtil.isNotEmpty(busType), IoSplitFifoCodeEntity::getBusType, busType) + .eq(IoSplitFifoCodeEntity::getRelId, relId) + .eq(StrUtil.isNotEmpty(batchNo), IoSplitFifoCodeEntity::getBatchNo, batchNo) + .orderByAsc(IoSplitFifoCodeEntity::getInBactchNo) + ); + + return splitFifoCodeEntities; + } + public List filterGroupList(IoSplitFifoCodeRequest splitFifoCodeRequest) { if (splitFifoCodeRequest == null) { return Collections.emptyList(); diff --git a/src/main/resources/schemas/schema_v2.4.sql b/src/main/resources/schemas/schema_v2.4.sql index ca256efdf..0095048b8 100644 --- a/src/main/resources/schemas/schema_v2.4.sql +++ b/src/main/resources/schemas/schema_v2.4.sql @@ -3876,22 +3876,25 @@ CALL Pro_Temp_ColumnWork('inv_remind_set', 'isDateBy', 1); -CREATE TABLE IF NOT EXISTS `sys_msg_todo` ( - `id` int NOT NULL AUTO_INCREMENT, - `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '消息编码', - `msgType` tinyint DEFAULT NULL COMMENT '消息类型(1:入院物资申请;2:单据审核;3:单据发票确认;5.资质审核;6:领用单审核;7:申购单审核;8:采购订单审核;)', - `msgContent` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '消息内容', - `dealStatus` tinyint DEFAULT NULL COMMENT '处理状态', - `pushStatus` tinyint DEFAULT NULL COMMENT '推送小程序状态(1:未推送;2:推送成功;3:推送失败', - `toUrl` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '跳转地址', - `createTime` datetime DEFAULT NULL COMMENT '创建时间', - `updateUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '更新人', - `updateTime` datetime DEFAULT NULL COMMENT '更新时间', - `deptCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '所属仓库', - `invCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '所属仓库', - `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '备注', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; +CREATE TABLE IF NOT EXISTS `sys_msg_todo` +( + `id` int NOT NULL AUTO_INCREMENT, + `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '消息编码', + `msgType` tinyint DEFAULT NULL COMMENT '消息类型(1:入院物资申请;2:单据审核;3:单据发票确认;5.资质审核;6:领用单审核;7:申购单审核;8:采购订单审核;)', + `msgContent` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '消息内容', + `dealStatus` tinyint DEFAULT NULL COMMENT '处理状态', + `pushStatus` tinyint DEFAULT NULL COMMENT '推送小程序状态(1:未推送;2:推送成功;3:推送失败', + `toUrl` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '跳转地址', + `createTime` datetime DEFAULT NULL COMMENT '创建时间', + `updateUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '更新人', + `updateTime` datetime DEFAULT NULL COMMENT '更新时间', + `deptCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '所属仓库', + `invCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '所属仓库', + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 + COLLATE = utf8mb4_0900_ai_ci; CREATE TABLE IF NOT EXISTS `sys_workplace` ( @@ -4211,7 +4214,7 @@ CALL Pro_Temp_ColumnWork('basic_collect_bustype', 'updateTime', ' datetime NULL DEFAULT NULL COMMENT ''更新时间''', 1); CALL Pro_Temp_ColumnWork('basic_collect_bustype', 'sortNumber', - 'int NULL DEFAULT NULL COMMENT ''排序数字''', + 'int NULL DEFAULT NULL COMMENT ''排序数字''', 1); CALL Pro_Temp_ColumnWork('sys_workplace', 'invRemindNumber', 'int NULL DEFAULT b''0'' COMMENT ''存量提醒数''', @@ -4319,3 +4322,8 @@ CALL Pro_Temp_ColumnWork('io_collect_order', 'uploadStatus', CALL Pro_Temp_ColumnWork('io_collect_order', 'uploadError', ' varchar(1024) NULL COMMENT ''上传错误信息''', 1); + + +CALL Pro_Temp_ColumnWork('io_collect_order_biz', 'autoTagStatus', + 'tinyint NULL DEFAULT 1 COMMENT ''自动赋码状态:1:无法自动赋码;2:可以自动赋码;3:可以自动赋码,但是数量不足''', + 1); \ No newline at end of file From 78f87227f1225f6061c85a5530c75191e543b449 Mon Sep 17 00:00:00 2001 From: yewj Date: Wed, 4 Sep 2024 17:21:34 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=8D=95=E6=8D=AE=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../collect/IoCollectOrderService.java | 30 +-- .../api/service/inout/IoSplitCodeService.java | 176 +++++++++++++++++- 2 files changed, 180 insertions(+), 26 deletions(-) diff --git a/src/main/java/com/glxp/api/service/collect/IoCollectOrderService.java b/src/main/java/com/glxp/api/service/collect/IoCollectOrderService.java index 00522d696..906ff794c 100644 --- a/src/main/java/com/glxp/api/service/collect/IoCollectOrderService.java +++ b/src/main/java/com/glxp/api/service/collect/IoCollectOrderService.java @@ -124,6 +124,8 @@ public class IoCollectOrderService extends ServiceImpl().eq(IoCollectOrder::getBillNo, billNo).last("limit 1")); @@ -541,28 +543,13 @@ public class IoCollectOrderService extends ServiceImpl { //插入到码表 collectCodeService.insertCodesByBill(collectOrderRequest.getBillNo()); - //更新数据至第三方系统 - }); } @@ -632,10 +619,10 @@ public class IoCollectOrderService extends ServiceImpl baseResponse = erpBasicClient.postOrder(orderRequest); log.debug("单据返回=========" + baseResponse); - if(baseResponse.getCode() == 20000){ + if (baseResponse.getCode() == 20000) { // - }else { - throw new JsonException("连接第三方系统接口服务出错,"+baseResponse.getMessage()); + } else { + throw new JsonException("连接第三方系统接口服务出错," + baseResponse.getMessage()); } } @@ -665,16 +652,17 @@ public class IoCollectOrderService extends ServiceImpl ioSplitCodeEntities = findSplitCodes(collectOrderBiz.getRelId(), collectOrderBiz.getBatchNo(), collectOrder.getWorkPlaceCode()); + + //2.如果拆零表为空,则自动从预出库队列中获拉取数据 + if (CollUtil.isEmpty(ioSplitCodeEntities)) { + addFifoCode(collectOrderBiz.getRelId(), collectOrderBiz.getBatchNo(), IntUtil.value(collectOrderBiz.getCount())); + ioSplitCodeEntities = findSplitCodes(collectOrderBiz.getRelId(), collectOrderBiz.getBatchNo(), collectOrder.getWorkPlaceCode()); + } + //3.如果拆零表不为空,则开始扣除数量 + int count = 0; + int unCount = 0; //剩余未扣减数量 + unCount = IntUtil.value(collectOrderBiz.getUnTagCount()); + for (IoSplitCodeEntity ioSplitCodeEntity : ioSplitCodeEntities) { + count = IntUtil.value(ioSplitCodeEntity.getRemainCount()) - unCount; + collectOrderCodeAutoService.save(IoCollectOrderCodeAuto.builder() + .codeIdFk(ioSplitCodeEntity.getId()) + .udiCode(ioSplitCodeEntity.getCode()) + .orderIdFk(collectOrder.getBillNo()) + .batchNo(ioSplitCodeEntity.getBatchNo()) + .productDate(ioSplitCodeEntity.getProduceDate()) + .expireDate(ioSplitCodeEntity.getExpireDate()) + .serialNo(ioSplitCodeEntity.getSerialNo()) + .relId(collectOrderBiz.getRelId()) + .bizIdFk(collectOrderBiz.getId()) + .fifoSplit(ioSplitCodeEntity.getFifoSplit()) + .createTime(new Date()) + .updateTime(new Date()) + .build()); + if (count > 0) { + ioSplitCodeEntity.setRemainCount(count); + unCount = 0; + splitCodeMapper.updateById(ioSplitCodeEntity); + break; + } else if (count == 0) { + ioSplitCodeEntity.setRemainCount(0); + unCount = 0; + } else { + ioSplitCodeEntity.setRemainCount(0); + unCount = -count; + } + splitCodeMapper.updateById(ioSplitCodeEntity); + } + + if (unCount > 0) { + //4.拆零表数量不足,则从预出库队列中获取数据 + Integer fifoCount = addFifoCode(collectOrderBiz.getRelId(), collectOrderBiz.getBatchNo(), unCount); + if (fifoCount == 0) { + //预出库队列数量不足 + collectOrderBiz.setTagStatus(2); + collectOrderBiz.setTagMsg("预出库队列码数量不足,赋码失败!"); + throw new JsonException(500, "提交失败,工位库存数量不足!"); + } else { + //再次执行赋码 + ioSplitCodeEntities = findSplitCodes(collectOrderBiz.getRelId(), collectOrderBiz.getBatchNo(), collectOrder.getWorkPlaceCode()); + for (IoSplitCodeEntity ioSplitCodeEntity : ioSplitCodeEntities) { + count = IntUtil.value(ioSplitCodeEntity.getRemainCount()) - unCount; + collectOrderCodeAutoService.save(IoCollectOrderCodeAuto.builder() + .codeIdFk(ioSplitCodeEntity.getId()) + .udiCode(ioSplitCodeEntity.getCode()) + .orderIdFk(collectOrder.getBillNo()) + .batchNo(ioSplitCodeEntity.getBatchNo()) + .productDate(ioSplitCodeEntity.getProduceDate()) + .expireDate(ioSplitCodeEntity.getExpireDate()) + .serialNo(ioSplitCodeEntity.getSerialNo()) + .relId(collectOrderBiz.getRelId()) + .bizIdFk(collectOrderBiz.getId()) + .fifoSplit(ioSplitCodeEntity.getFifoSplit()) + .createTime(new Date()) + .updateTime(new Date()) + .build()); + if (count > 0) { + ioSplitCodeEntity.setRemainCount(count); + break; + } else if (count == 0) { + ioSplitCodeEntity.setRemainCount(0); + } else { + ioSplitCodeEntity.setRemainCount(0); + unCount = -count; + } + } + if (unCount > 0) { + collectOrderBiz.setTagStatus(2); + collectOrderBiz.setTagMsg("预出库队列码数量不足,赋码失败!"); + throw new JsonException(500, "提交失败,工位库存数量不足!"); + } else { + collectOrderBiz.setTagStatus(3); + collectOrderBiz.setTagMsg("赋码完成!"); + } + } + } else { + collectOrderBiz.setTagStatus(3); + collectOrderBiz.setTagMsg("赋码完成!"); + } + collectOrderBiz.setUnTagCount(unCount); + collectOrderBizService.updateById(collectOrderBiz); + } + @Resource UdiRelevanceService udiRelevanceService; + @Resource + IoCollectOrderCodeManService collectOrderCodeManService; + @Transactional(rollbackFor = Exception.class) public void finishAutoTagCode(IoCollectOrder collectOrder) { List collectOrderBizs = collectOrderBizService.listByBillNo(collectOrder.getBillNo()); - List needAutotagBizs = new ArrayList<>(); + + + //如果手动扫码判断该码是否在队列里,如果已在队列,则队列里剔除 + List collectOrderCodeMEN = collectOrderCodeManService.listByBillNo(collectOrder.getBillNo()); + if (CollUtil.isNotEmpty(collectOrderCodeMEN)) { + for (IoCollectOrderCodeMan collectOrderCodeMan : collectOrderCodeMEN) { + IoSplitFifoCodeEntity splitFifoCodeEntity = splitFifoCodeService.findByCode(collectOrderCodeMan.getUdiCode(), collectOrder.getWorkPlaceCode()); + if (IntUtil.value(splitFifoCodeEntity.getScanCount()) - IntUtil.value(collectOrderCodeMan.getScanCount()) <= 0) { + splitFifoCodeService.removeById(splitFifoCodeEntity.getId()); + + IoSplitFifoInv splitFifoInv = splitFifoInvService.findByFifoCode(splitFifoCodeEntity); + if (splitFifoInv != null) { + splitFifoInv.setOutCount(IntUtil.value(splitFifoInv.getOutCount()) + IntUtil.value(splitFifoCodeEntity.getTotalCount())); + splitFifoInv.setLockCount(IntUtil.value(splitFifoInv.getLockCount()) - IntUtil.value(splitFifoCodeEntity.getTotalCount())); + splitFifoInv.setReCount(IntUtil.value(splitFifoInv.getInCount() - IntUtil.value(splitFifoInv.getOutCount()))); + splitFifoInv.setAvailableCount(IntUtil.value(splitFifoInv.getInCount() - IntUtil.value(splitFifoInv.getLockCount()) - IntUtil.value(splitFifoInv.getOutCount()))); + } + + } else { + UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(collectOrderCodeMan.getRelId()); + int removeCount = IntUtil.value(collectOrderCodeMan.getScanCount()) * udiRelevanceEntity.getUseLeverCount(); + splitFifoCodeService.updateById(IoSplitFifoCodeEntity.builder() + .id(splitFifoCodeEntity.getId()) + .scanCount(IntUtil.value(splitFifoCodeEntity.getScanCount()) - IntUtil.value(collectOrderCodeMan.getScanCount())) + .totalCount(IntUtil.value(splitFifoCodeEntity.getTotalCount()) - removeCount) + .build()); + + IoSplitFifoInv splitFifoInv = splitFifoInvService.findByFifoCode(splitFifoCodeEntity); + if (splitFifoInv != null) { + splitFifoInv.setOutCount(IntUtil.value(splitFifoInv.getOutCount()) + removeCount); + splitFifoInv.setLockCount(IntUtil.value(splitFifoInv.getLockCount()) - removeCount); + splitFifoInv.setReCount(IntUtil.value(splitFifoInv.getInCount() - IntUtil.value(splitFifoInv.getOutCount()))); + splitFifoInv.setAvailableCount(IntUtil.value(splitFifoInv.getInCount() - IntUtil.value(splitFifoInv.getLockCount()) - IntUtil.value(splitFifoInv.getOutCount()))); + } + } + } + } + List removeIds = new ArrayList<>(); for (IoCollectOrderBiz collectOrderBiz : collectOrderBizs) { int unTagCount = collectOrderBiz.getCount() - IntUtil.value(collectOrderBiz.getScanActCount()); if (unTagCount > 0) { @@ -282,12 +425,35 @@ public class IoSplitCodeService extends ServiceImpl 0) { - - for(int i = 0;i ioSplitFifoCodeEntities = splitFifoCodeService.findByRelId(collectOrder.getWorkPlaceCode(), collectOrder.getBusType(), collectOrderBiz.getRelId(), collectOrderBiz.getBatchNo()); + if (ioSplitFifoCodeEntities.size() < quotient) { + throw new JsonException(500, "提交失败,工位库存数量不足!"); } - + for (int i = 0; i < quotient; i++) { + IoSplitFifoCodeEntity splitFifoCodeEntity = ioSplitFifoCodeEntities.get(i); + removeIds.add(splitFifoCodeEntity.getId()); + collectOrderBiz.setUnTagCount(IntUtil.value(collectOrderBiz.getUnTagCount()) - IntUtil.value(udiRelevanceEntity.getUseLeverCount())); + collectOrderCodeAutoService.save(IoCollectOrderCodeAuto.builder() + .codeIdFk(splitFifoCodeEntity.getId()) + .udiCode(splitFifoCodeEntity.getCode()) + .orderIdFk(collectOrder.getBillNo()) + .batchNo(splitFifoCodeEntity.getBatchNo()) + .productDate(splitFifoCodeEntity.getProduceDate()) + .expireDate(splitFifoCodeEntity.getExpireDate()) + .serialNo(splitFifoCodeEntity.getSerialNo()) + .relId(collectOrderBiz.getRelId()) + .bizIdFk(collectOrderBiz.getId()) + .fifoSplit(splitFifoCodeEntity.getFifoSplit()) + .createTime(new Date()) + .updateTime(new Date()) + .build()); + } + } + //.如果拆零,拆零表扣除 + if (remainder > 0) { + splitRemove(collectOrderBiz, collectOrder); } } From a068acd71a6ac5e0593310564973669f7eaf5803 Mon Sep 17 00:00:00 2001 From: wangwei <1610949092@qq.com> Date: Wed, 4 Sep 2024 17:23:19 +0800 Subject: [PATCH 4/4] =?UTF-8?q?9/4=20bug=20=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/controller/auth/DeptController.java | 12 +++++ .../controller/auth/SysUserController.java | 1 + .../basic/UdiRelevanceController.java | 3 ++ .../com/glxp/api/dao/auth/AuthAdminDao.java | 2 + .../api/service/auth/AuthAdminService.java | 2 + .../auth/impl/AuthAdminServiceImpl.java | 13 +++++ .../api/service/basic/UdiContrastService.java | 12 ++++- .../api/service/basic/UdiProductService.java | 10 ++-- .../mybatis/mapper/auth/AuthAdminDao.xml | 52 ++++++++++++++++++- .../mybatis/mapper/basic/UdiRelevanceDao.xml | 6 ++- src/main/resources/schemas/schema_v2.4.sql | 7 ++- 11 files changed, 111 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/glxp/api/controller/auth/DeptController.java b/src/main/java/com/glxp/api/controller/auth/DeptController.java index 65106d494..2b8de05dc 100644 --- a/src/main/java/com/glxp/api/controller/auth/DeptController.java +++ b/src/main/java/com/glxp/api/controller/auth/DeptController.java @@ -369,6 +369,18 @@ public class DeptController { return ResultVOUtils.success(list); } + @AuthRuleAnnotation("") + @GetMapping("spms/inv/dept/filter") + public BaseResponse filterDeptsByUser(FilterInvWarehouseRequest filterInvWarehouseRequest) { + List invWarehouseEntities = deptService.filterInvWarehouse(filterInvWarehouseRequest); + PageInfo pageInfo = new PageInfo<>(invWarehouseEntities); + PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); + pageSimpleResponse.setTotal(pageInfo.getTotal()); + pageSimpleResponse.setList(invWarehouseEntities); + return ResultVOUtils.success(pageSimpleResponse); + + } + public String isCheckStatus(Integer status, DeptEntity deptEntity) { //启用的时候需要判断上级是不是被禁用 if (status == 1) { diff --git a/src/main/java/com/glxp/api/controller/auth/SysUserController.java b/src/main/java/com/glxp/api/controller/auth/SysUserController.java index 1ffa4772c..3366cbd7f 100644 --- a/src/main/java/com/glxp/api/controller/auth/SysUserController.java +++ b/src/main/java/com/glxp/api/controller/auth/SysUserController.java @@ -67,6 +67,7 @@ public class SysUserController extends BaseController { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } List authAdminList = userService.listAdminPage(filterAuthUserRequest); +// List authAdminList1 = userService.getDepts(filterAuthUserRequest); //查询对应角色和部门 List authAdminResponseList = authAdminList.stream().map(item -> { AuthAdminResponse authAdminResponse = new AuthAdminResponse(); diff --git a/src/main/java/com/glxp/api/controller/basic/UdiRelevanceController.java b/src/main/java/com/glxp/api/controller/basic/UdiRelevanceController.java index 88813fcf0..3050ce53d 100644 --- a/src/main/java/com/glxp/api/controller/basic/UdiRelevanceController.java +++ b/src/main/java/com/glxp/api/controller/basic/UdiRelevanceController.java @@ -364,6 +364,9 @@ public class UdiRelevanceController extends BaseController { udiRelevanceEntity.setDistributeLevelCount(udiRelevanceSaveRequest.getDistributeLevelCount()); udiRelevanceEntity.setDistributeLevel(udiRelevanceSaveRequest.getDistributeLevel()); udiRelevanceEntity.setPayFeeCode(udiRelevanceSaveRequest.getPayFeeCode()); + udiRelevanceEntity.setSplitEnable(udiRelevanceSaveRequest.getSplitEnable()); + udiRelevanceEntity.setAutoCode(udiRelevanceSaveRequest.getAutoCode()); + udiRelevanceEntity.setPayFeeCode(udiRelevanceSaveRequest.getPayFeeCode()); udiRelevanceService.updateUdiRelevance(udiRelevanceEntity); //关联更新 diff --git a/src/main/java/com/glxp/api/dao/auth/AuthAdminDao.java b/src/main/java/com/glxp/api/dao/auth/AuthAdminDao.java index 04c7e2a29..7a2f27a36 100644 --- a/src/main/java/com/glxp/api/dao/auth/AuthAdminDao.java +++ b/src/main/java/com/glxp/api/dao/auth/AuthAdminDao.java @@ -89,4 +89,6 @@ public interface AuthAdminDao extends BaseMapperPlus companyUserList(@Param("param")FilterInvLinkDataRequest filterInvLinkDataRequest); List getUserByIds(@Param("userIds") List ids,@Param("key") String key); + + List getDepts(FilterAuthUserRequest filterAuthUserRequest); } diff --git a/src/main/java/com/glxp/api/service/auth/AuthAdminService.java b/src/main/java/com/glxp/api/service/auth/AuthAdminService.java index 008aea75f..2775152c9 100644 --- a/src/main/java/com/glxp/api/service/auth/AuthAdminService.java +++ b/src/main/java/com/glxp/api/service/auth/AuthAdminService.java @@ -50,4 +50,6 @@ public interface AuthAdminService extends IService { List getUserByIds(SysWorkplaceRequest request); List getUserByDeptCode(String deptCode); + + List getDepts(FilterAuthUserRequest filterAuthUserRequest); } diff --git a/src/main/java/com/glxp/api/service/auth/impl/AuthAdminServiceImpl.java b/src/main/java/com/glxp/api/service/auth/impl/AuthAdminServiceImpl.java index 1d34c9743..037837cbf 100644 --- a/src/main/java/com/glxp/api/service/auth/impl/AuthAdminServiceImpl.java +++ b/src/main/java/com/glxp/api/service/auth/impl/AuthAdminServiceImpl.java @@ -224,6 +224,19 @@ public class AuthAdminServiceImpl extends ServiceImpl i return authAdmins; } + @Override + public List getDepts(FilterAuthUserRequest filterAuthUserRequest) { + if (filterAuthUserRequest == null) { + return Collections.emptyList(); + } + if (filterAuthUserRequest.getPage() != null) { + int offset = (filterAuthUserRequest.getPage() - 1) * filterAuthUserRequest.getLimit(); + PageHelper.offsetPage(offset, filterAuthUserRequest.getLimit()); + } + + return authAdminDao.getDepts(filterAuthUserRequest); + } + public void insertUserRole(Long userId, List roleIds) { if (ArrayUtil.isNotEmpty(roleIds)) { diff --git a/src/main/java/com/glxp/api/service/basic/UdiContrastService.java b/src/main/java/com/glxp/api/service/basic/UdiContrastService.java index b6a75dfe9..589444e14 100644 --- a/src/main/java/com/glxp/api/service/basic/UdiContrastService.java +++ b/src/main/java/com/glxp/api/service/basic/UdiContrastService.java @@ -245,6 +245,8 @@ public class UdiContrastService { udiRelevanceEntity.setUuid(CustomUtil.getUUId()); udiRelevanceEntity.setSupName(thrProductsEntity.getSupName()); udiRelevanceEntity.setId(gennerOrderUtils.getRelId()); + udiRelevanceEntity.setSplitEnable(true); + udiRelevanceEntity.setAutoCode(true); udiRelevanceEntity.setIsDisable(false); UdiProductEntity udiProductEntity = new UdiProductEntity(); @@ -257,7 +259,15 @@ public class UdiContrastService { udiProductEntity.setManufactory(thrProductsEntity.getManufactory()); udiProductEntity.setYlqxzcrbarmc(thrProductsEntity.getManufactory()); udiProductEntity.setGgxh(thrProductsEntity.getSpec()); - udiProductEntity.setZczbhhzbapzbh(thrProductsEntity.getRegisterNo()); + if (thrProductsEntity.getProductType() == 2){ + //不是药品就设置namecode + udiProductEntity.setBzgg(thrProductsEntity.getSpec()); + } + if (thrProductsEntity.getProductType() != 2){ + //不是药品就设置namecode + udiProductEntity.setZczbhhzbapzbh(thrProductsEntity.getRegisterNo()); + } + udiProductEntity.setUuid(udiRelevanceEntity.getUuid()); udiProductEntity.setProductType(ConstantStatus.PRODUCT_TYPE_THIRD); udiProductEntity.setDiType(1); diff --git a/src/main/java/com/glxp/api/service/basic/UdiProductService.java b/src/main/java/com/glxp/api/service/basic/UdiProductService.java index edfc13e5a..40468f531 100644 --- a/src/main/java/com/glxp/api/service/basic/UdiProductService.java +++ b/src/main/java/com/glxp/api/service/basic/UdiProductService.java @@ -267,7 +267,10 @@ public class UdiProductService { if (IntUtil.value(udiProductEntity.getPackLevel()) == 1) { udiProductEntity.setDiType(1); } - udiProductDao.updateUdiInfo(udiProductEntity); + int i = udiProductDao.updateById(udiProductEntity); + if (i == 0){ + throw new JsonException(500,"更新错误"); + } } //修改关联表 @@ -291,8 +294,8 @@ public class UdiProductService { udiRelevanceEntity.setIsUseDy(false); udiRelevanceEntity.setUuid(IdUtil.getSnowflakeNextId() + ""); udiRelevanceEntity.setNeedCert(false); - udiRelevanceEntity.setSplitEnable(false); - udiRelevanceEntity.setAutoCode(false); + udiRelevanceEntity.setSplitEnable(true); + udiRelevanceEntity.setAutoCode(true); udiRelevanceEntity.setPurType(1); udiRelevanceEntity.setProductsType(2); udiRelevanceEntity.setAttributeType(addProductRequest.getAttributeType()); @@ -346,6 +349,7 @@ public class UdiProductService { udiProductEntity.setZczbhhzbapzbh(addProductRequest.getRegisterNo()); udiProductEntity.setPackLevel(updateLevelDrugRequest.getPackLevel() + ""); udiProductEntity.setUuid(udiProductEntity.getUuid()); + udiProductEntity.setPrice(udiProductEntity.getPrice()); if (IntUtil.value(udiProductEntity.getPackLevel()) == 1 || addProductRequest.getDrugLevelLists().size() == 1) { udiProductEntity.setDiType(1); if (IntUtil.value(udiProductEntity.getPackLevel()) == 1) { diff --git a/src/main/resources/mybatis/mapper/auth/AuthAdminDao.xml b/src/main/resources/mybatis/mapper/auth/AuthAdminDao.xml index bbd39adf9..52a57de40 100644 --- a/src/main/resources/mybatis/mapper/auth/AuthAdminDao.xml +++ b/src/main/resources/mybatis/mapper/auth/AuthAdminDao.xml @@ -6,7 +6,8 @@ resultType="com.glxp.api.entity.auth.AuthAdmin"> SELECT auth_user.*, auth_dept.name deptName,aw.name invName FROM auth_user - left join auth_dept on auth_user.locDeptCode = auth_dept.code + left join auth_dept_user adu on adu.userId = auth_user.id + left join auth_dept on adu.deptId = auth_dept.id left join auth_warehouse aw on aw.code = auth_user.locInvCode @@ -43,9 +44,11 @@ ) - AND auth_user.locDeptCode = #{deptCode} + AND auth_dept.code = #{deptCode} + GROUP BY + auth_user.userName ORDER BY id DESC @@ -295,5 +298,50 @@ order by u.createTime desc + diff --git a/src/main/resources/mybatis/mapper/basic/UdiRelevanceDao.xml b/src/main/resources/mybatis/mapper/basic/UdiRelevanceDao.xml index 03d248093..954062b71 100644 --- a/src/main/resources/mybatis/mapper/basic/UdiRelevanceDao.xml +++ b/src/main/resources/mybatis/mapper/basic/UdiRelevanceDao.xml @@ -1283,7 +1283,7 @@ updateUser, remark, useExpireTime, `dispatch`, groupBuy, needCert, isStack,distributeLevelDi, - distributeLevelUnit,distributeLevelCount,useLevelDi,useLevelUnit,useLeverCount,useLevel,distributeLevel) + distributeLevelUnit,distributeLevelCount,useLevelDi,useLevelUnit,useLeverCount,useLevel,distributeLevel,splitEnable,autoCode) values ( #{id}, #{uuid}, @@ -1324,7 +1324,9 @@ #{useLevelUnit}, #{useLeverCount}, #{useLevel}, - #{distributeLevel} + #{distributeLevel}, + #{splitEnable}, + #{autoCode} ) diff --git a/src/main/resources/schemas/schema_v2.4.sql b/src/main/resources/schemas/schema_v2.4.sql index 0095048b8..ca17f9ec8 100644 --- a/src/main/resources/schemas/schema_v2.4.sql +++ b/src/main/resources/schemas/schema_v2.4.sql @@ -4315,6 +4315,7 @@ CALL Pro_Temp_ColumnWork('sys_workplace_document', 'autoTag', ' tinyint NULL DEFAULT b''0'' COMMENT ''管理设备(是否自动赋码):: 1:是; 0:否''', 1); + CALL Pro_Temp_ColumnWork('io_collect_order', 'uploadStatus', ' tinyint NULL DEFAULT 1 COMMENT ''上传状态(1.未上传,2.已上传,3.上传失败)''', 1); @@ -4323,7 +4324,11 @@ CALL Pro_Temp_ColumnWork('io_collect_order', 'uploadError', ' varchar(1024) NULL COMMENT ''上传错误信息''', 1); +CALL Pro_Temp_ColumnWork('sys_workplace_document', 'monopoly', + ' tinyint NULL DEFAULT b''0'' COMMENT ''独占工位库存:: 0:否; 1:是''', + 1); + CALL Pro_Temp_ColumnWork('io_collect_order_biz', 'autoTagStatus', 'tinyint NULL DEFAULT 1 COMMENT ''自动赋码状态:1:无法自动赋码;2:可以自动赋码;3:可以自动赋码,但是数量不足''', - 1); \ No newline at end of file + 1);