From 5b15f6ff453ea253fa3ed2e4f9d521a6b816d0a3 Mon Sep 17 00:00:00 2001 From: anthonywj Date: Mon, 28 Aug 2023 09:27:53 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=AF=8A=E6=96=AD=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E4=BA=A7=E5=93=81=E4=BF=A1=E6=81=AF=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E9=80=89=E5=85=A5=E6=97=B6=EF=BC=8C=E8=87=AA=E5=8A=A8=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=88=B0=E8=80=97=E6=9D=90=E5=AD=97=E5=85=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../thrsys/impl/ThrProductsServiceImpl.java | 26 +++++++++++++++++++ src/main/java/com/glxp/api/util/IntUtil.java | 6 ++--- src/main/resources/application-dev.yml | 2 +- src/main/resources/schemas/schema_v2.2.sql | 11 +++++--- 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/glxp/api/service/thrsys/impl/ThrProductsServiceImpl.java b/src/main/java/com/glxp/api/service/thrsys/impl/ThrProductsServiceImpl.java index 967ea650..5dc589d7 100644 --- a/src/main/java/com/glxp/api/service/thrsys/impl/ThrProductsServiceImpl.java +++ b/src/main/java/com/glxp/api/service/thrsys/impl/ThrProductsServiceImpl.java @@ -6,11 +6,14 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.pagehelper.PageHelper; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; +import com.glxp.api.dao.basic.UdiRelevanceDao; import com.glxp.api.dao.thrsys.ThrProductsDao; +import com.glxp.api.entity.basic.UdiRelevanceEntity; import com.glxp.api.entity.thrsys.ThrProductsEntity; import com.glxp.api.entity.thrsys.ThrSystemDetailEntity; import com.glxp.api.http.ErpBasicClient; @@ -19,7 +22,10 @@ import com.glxp.api.req.thrsys.PostThrProductsRequest; import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.res.basic.UdiRelevanceResponse; import com.glxp.api.res.thrsys.ThrProductsResponse; +import com.glxp.api.service.basic.UdiContrastService; +import com.glxp.api.service.system.SystemParamConfigService; import com.glxp.api.service.thrsys.ThrProductsService; +import com.glxp.api.util.IntUtil; import com.glxp.api.util.RedisUtil; import lombok.extern.slf4j.Slf4j; import org.apache.ibatis.session.ExecutorType; @@ -53,6 +59,8 @@ public class ThrProductsServiceImpl extends ServiceImpl().eq("mainId", thrProductsEntity.getCode())); + if (!isExit) { + udiContrastService.createOnlyMainId(thrProductsEntity.getCode()); + } + } + } + + } else { boolean isChange = verifyDataChange(thrProductsEntity, item); if (isChange) { diff --git a/src/main/java/com/glxp/api/util/IntUtil.java b/src/main/java/com/glxp/api/util/IntUtil.java index 397b316c..6969ec1f 100644 --- a/src/main/java/com/glxp/api/util/IntUtil.java +++ b/src/main/java/com/glxp/api/util/IntUtil.java @@ -25,13 +25,11 @@ public class IntUtil { else return value; } - public static int value(String value) { if (StrUtil.isEmpty(value)) return 0; - else - return Integer.parseInt(value); - } + else return Integer.parseInt(value); + } } diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index b2df4abe..458a4284 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -4,7 +4,7 @@ server: spring: datasource: driver-class-name: com.p6spy.engine.spy.P6SpyDriver - jdbc-url: jdbc:p6spy:mysql://127.0.0.1:3306/udi_wms_pt?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true + jdbc-url: jdbc:p6spy:mysql://127.0.0.1:3306/udi_wms_pzh?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true username: root password: 123456 hikari: diff --git a/src/main/resources/schemas/schema_v2.2.sql b/src/main/resources/schemas/schema_v2.2.sql index 717ffe2c..ca48c794 100644 --- a/src/main/resources/schemas/schema_v2.2.sql +++ b/src/main/resources/schemas/schema_v2.2.sql @@ -8,8 +8,8 @@ CREATE TABLE IF NOT EXISTS `device_inspect_task` `deptCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '部门', `invCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '仓库', `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '资产编码', - `status` int NULL DEFAULT NULL COMMENT '状态', - `type` int NULL DEFAULT NULL COMMENT '类型', + `status` int NULL DEFAULT NULL COMMENT '状态', + `type` int NULL DEFAULT NULL COMMENT '类型', `inspectUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检人', `remindTime` datetime(0) NULL DEFAULT NULL COMMENT '提醒时间', `remark` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检备注', @@ -34,7 +34,7 @@ CREATE TABLE IF NOT EXISTS `device_inspect_task_detail` `id` int NOT NULL AUTO_INCREMENT, `projectCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检项目编码', `projectContent` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检内容', - `status` int NULL DEFAULT NULL COMMENT '状态(1:未开始;2:已检查;3:异常;4:不巡检', + `status` int NULL DEFAULT NULL COMMENT '状态(1:未开始;2:已检查;3:异常;4:不巡检', `result` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检结果备注', `inspectImage` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检图片', `inspectUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检人', @@ -265,3 +265,8 @@ CALL Pro_Temp_ColumnWork('dept_device_detail', 'nameCode', 'varchar(255)', 1); CALL Pro_Temp_ColumnWork('device_inspect_plan', 'executeCount', 'int', 1); CALL Pro_Temp_ColumnWork('device_inspect_plan', 'useFrequency', 'int', 1); + + +INSERT ignore INTO `sys_param_config`(`id`, `parentId`, `paramName`, `paramKey`, `paramValue`, `paramStatus`, + `paramType`, `paramExplain`, `updateTime`) +VALUES (2090, 0, '更新第三方产品信息是否选入耗材字典', 'update_third_in_rel', '0', 0, 0, '更新第三方产品信息是否选入耗材字典(0:否;1:是)', NULL); From 90f7f1f92783b39f22bcd49a2e4d544e7cf28a40 Mon Sep 17 00:00:00 2001 From: anthonywj Date: Tue, 29 Aug 2023 09:18:14 +0800 Subject: [PATCH 2/2] =?UTF-8?q?PDA=E6=89=8B=E6=8C=81=E7=BB=88=E7=AB=AF?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/controller/auth/DeptController.java | 6 +- .../inout/IoCodeTempController.java | 16 +- .../controller/inout/IoOrderController.java | 44 +-- .../basic/BasicBussinessTypeEntity.java | 6 +- .../api/req/inout/PdaPostOrderRequest.java | 1 + .../res/basic/BasicBussinessTypeResponse.java | 5 + .../api/service/inout/IoAddInoutService.java | 274 +++++++++++------- .../service/inout/IoCheckInoutService.java | 11 +- src/main/resources/application-dev.yml | 2 +- src/main/resources/schemas/schema_v2.2.sql | 8 +- 10 files changed, 219 insertions(+), 154 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 92dda8f7..32bc7424 100644 --- a/src/main/java/com/glxp/api/controller/auth/DeptController.java +++ b/src/main/java/com/glxp/api/controller/auth/DeptController.java @@ -151,12 +151,12 @@ public class DeptController { @AuthRuleAnnotation("") @GetMapping("spms/inv/warehouse/filterAllByUser") public BaseResponse filterAllByUser(FilterInvWarehouseRequest filterInvWarehouseRequest) { - List invWarehouseEntities; + List deptEntities; AuthAdmin authAdmin = customerService.getUserBean(); filterInvWarehouseRequest.setUserId(authAdmin.getId()); filterInvWarehouseRequest.setPid(0L); - invWarehouseEntities = deptService.filterAllByUser(filterInvWarehouseRequest); - return ResultVOUtils.success(invWarehouseEntities); + deptEntities = deptService.filterAllByUser(filterInvWarehouseRequest); + return ResultVOUtils.success(deptEntities); } diff --git a/src/main/java/com/glxp/api/controller/inout/IoCodeTempController.java b/src/main/java/com/glxp/api/controller/inout/IoCodeTempController.java index 4134c98e..c7538ff4 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoCodeTempController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoCodeTempController.java @@ -98,7 +98,9 @@ public class IoCodeTempController extends BaseController { @Resource IoOrderDetailCodeService ioOrderDetailCodeService; - //手持端扫码单据上传调用接口 + /** + * PDA-----单据上传 + */ @RepeatSubmit() @AuthRuleAnnotation("") @PostMapping("udiwms/pda/inout/order/upload") @@ -114,7 +116,17 @@ public class IoCodeTempController extends BaseController { if (pdaPostOrderRequest.getCodeTempEntities() == null) { return ResultVOUtils.error(500, "单据未扫码,请检查后提交!"); } - ioAddInoutService.creatOrderByPda(pdaPostOrderRequest); + IoOrderEntity orderEntity = pdaPostOrderRequest.getOrderEntity(); + BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(orderEntity.getAction()); + + if (bussinessTypeEntity.getCheckWebNew() == 0) { + return ioAddInoutService.creatOrderByPda(pdaPostOrderRequest); + } else if (bussinessTypeEntity.getCheckWebNew() == 1 || bussinessTypeEntity.getCheckWebNew() == 2) { + return ioAddInoutService.waitOrderByPda(pdaPostOrderRequest); + } else if (bussinessTypeEntity.getCheckWebNew() == 3) { + return ioAddInoutService.checkCodeResultByPda(bussinessTypeEntity.getCheckWebNewType(), pdaPostOrderRequest); + } + return ResultVOUtils.success("上传成功,等待后台处理"); } 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 fd4a77d2..b27079da 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoOrderController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoOrderController.java @@ -304,25 +304,7 @@ public class IoOrderController extends BaseController { BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(addOrderRequest.getAction()); BasicCorpEntity basicCorpEntity; //要是特殊往来信息没有就创建 - if (bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_INPUT && bussinessTypeEntity.isGenUnit()) { - basicCorpEntity = basicCorpService.selectByName(orderEntity.getFromCorp()); - if (basicCorpEntity == null) { - basicCorpEntity = new BasicCorpEntity(); - basicCorpEntity.setErpId(CustomUtil.getUnitId()); - basicCorpEntity.setCorpType(ConstantStatus.CORP_SICK); - basicCorpEntity.setOutType(ConstantStatus.CORP_SICK_SICK); - basicCorpEntity.setName(addOrderRequest.getFromCorp()); - basicCorpEntity.setId(IdUtil.getSnowflakeNextId()); - basicCorpService.insert(basicCorpEntity); - } - if (addOrderRequest.getAction().equals(bussinessTypeEntity.getAction())){ - orderEntity.setFromCorp(basicCorpEntity.getName()); - }else { - orderEntity.setFromCorp(basicCorpEntity.getErpId()); - } - } else { - orderEntity.setFromCorp(addOrderRequest.getFromCorp()); - } + orderEntity.setFromCorp(ioAddInoutService.updateCorp(bussinessTypeEntity, addOrderRequest.getFromCorp())); orderEntity.setAction(addOrderRequest.getAction()); orderEntity.setMainAction(bussinessTypeEntity.getMainAction()); orderEntity.setRemark(addOrderRequest.getRemark()); @@ -330,10 +312,7 @@ public class IoOrderController extends BaseController { orderEntity.setDeptCode(addOrderRequest.getDeptCode()); orderEntity.setBillNo(addOrderRequest.getBillNo()); orderEntity.setInvCode(addOrderRequest.getInvCode()); - orderService.updateByBillNo(orderEntity); - - IoCodeTempEntity warehouseEntity = new IoCodeTempEntity(); warehouseEntity.setOrderId(orderEntity.getBillNo()); warehouseEntity.setAction(orderEntity.getAction()); @@ -344,7 +323,7 @@ public class IoOrderController extends BaseController { return ResultVOUtils.success("保存成功!"); } - //待配货/待校验-立即提交 + //待配货(有三期,无三期)-立即提交 @RepeatSubmit() @AuthRuleAnnotation("") @PostMapping("warehouse/inout/submitOrderWeb") @@ -365,7 +344,7 @@ public class IoOrderController extends BaseController { List orderDetailCodeEntities = orderDetailCodeService.findByOrderId(addOrderRequest.getBillNo()); if (CollUtil.isEmpty(orderDetailCodeEntities)) { - return ResultVOUtils.error(500, "单据还未扫码或和扫码校验存在异常无法提交!"); + return ResultVOUtils.error(500, "提交失败,单据还未扫码或和扫码校验存在异常!"); } BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(orderEntity.getAction()); if (checkInoutService.checkManual(addOrderRequest.getBillNo())) { @@ -396,7 +375,7 @@ public class IoOrderController extends BaseController { BeanUtil.copyProperties(orderDetailCodeEntity, orderDetailBizEntity); orderDetailBizEntity.setId(null); orderDetailBizEntity.setCount(IntUtil.value(orderDetailCodeEntity.getReCount())); - getSomeBiz(orderDetailBizEntities, orderDetailBizEntity); + checkInoutService.getSomeBiz(orderDetailBizEntities, orderDetailBizEntity); orderDetailBizService.insert(orderDetailBizEntity); } saveOrderWeb(addOrderRequest); @@ -498,7 +477,6 @@ public class IoOrderController extends BaseController { if (orderEntity == null) { return ResultVOUtils.error(500, "提交失败,请先添加物资!"); } - if (orderEntity.getStatus() == ORDER_STATUS_CHECK_PROCESS || orderEntity.getStatus() == ConstantStatus.ORDER_STATUS_PROCESS || orderEntity.getStatus() == ConstantStatus.ORDER_STATUS_PROCESSING) { return ResultVOUtils.error(500, "提交失败,单据正在处理,请稍后刷新查看!"); @@ -618,8 +596,6 @@ public class IoOrderController extends BaseController { } } } - - return codeEntities; } @@ -653,7 +629,7 @@ public class IoOrderController extends BaseController { BeanUtil.copyProperties(orderDetailCodeEntity, orderDetailBizEntity); orderDetailBizEntity.setCount(IntUtil.value(orderDetailCodeEntity.getReCount())); orderDetailBizEntity.setId(null); - getSomeBiz(orderDetailBizEntities, orderDetailBizEntity); + checkInoutService.getSomeBiz(orderDetailBizEntities, orderDetailBizEntity); orderDetailBizService.insert(orderDetailBizEntity); } saveOrderWeb(addOrderRequest); @@ -667,16 +643,6 @@ public class IoOrderController extends BaseController { } - public void getSomeBiz(List orderDetailBizEntities, IoOrderDetailBizEntity resutBizEntity) { - for (IoOrderDetailBizEntity orderDetailBizEntity : orderDetailBizEntities) { - if (orderDetailBizEntity.getBindRlFk().longValue() == resutBizEntity.getBindRlFk().longValue()) { - resutBizEntity.setCertCode(orderDetailBizEntity.getCertCode()); - resutBizEntity.setPrice(orderDetailBizEntity.getPrice()); - } - } - } - - @Resource IoCodeService codeService; diff --git a/src/main/java/com/glxp/api/entity/basic/BasicBussinessTypeEntity.java b/src/main/java/com/glxp/api/entity/basic/BasicBussinessTypeEntity.java index 16d149d6..3c0eaf8b 100644 --- a/src/main/java/com/glxp/api/entity/basic/BasicBussinessTypeEntity.java +++ b/src/main/java/com/glxp/api/entity/basic/BasicBussinessTypeEntity.java @@ -434,5 +434,9 @@ public class BasicBussinessTypeEntity { @TableField(value = "spaceOut") private int spaceOut; - + /** + * 有三期业务单校验 0:按扫码结果提交,1:按比对结果提交 + */ + @TableField(value = "checkWebNewType") + private int checkWebNewType; } diff --git a/src/main/java/com/glxp/api/req/inout/PdaPostOrderRequest.java b/src/main/java/com/glxp/api/req/inout/PdaPostOrderRequest.java index a83a0548..aa9a7234 100644 --- a/src/main/java/com/glxp/api/req/inout/PdaPostOrderRequest.java +++ b/src/main/java/com/glxp/api/req/inout/PdaPostOrderRequest.java @@ -9,6 +9,7 @@ import java.util.List; @Data public class PdaPostOrderRequest implements Serializable { + IoOrderEntity orderEntity; List orderDetailBizEntities; List orderDetailResultEntities; diff --git a/src/main/java/com/glxp/api/res/basic/BasicBussinessTypeResponse.java b/src/main/java/com/glxp/api/res/basic/BasicBussinessTypeResponse.java index 0b58db4e..005b227a 100644 --- a/src/main/java/com/glxp/api/res/basic/BasicBussinessTypeResponse.java +++ b/src/main/java/com/glxp/api/res/basic/BasicBussinessTypeResponse.java @@ -172,4 +172,9 @@ public class BasicBussinessTypeResponse { * 是否核对单据验收补单 */ private boolean thrCheckReview; + + /** + * 有三期业务单校验 0:按扫码结果提交,1:按比对结果提交 + */ + private int checkWebNewType; } diff --git a/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java b/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java index e94d881b..3d068c96 100644 --- a/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java +++ b/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java @@ -29,20 +29,20 @@ import com.glxp.api.service.basic.UdiRelevanceService; import com.glxp.api.service.basic.UdiRlSupService; import com.glxp.api.service.inv.InvProductDetailService; import com.glxp.api.service.system.SystemParamConfigService; -import com.glxp.api.util.CustomUtil; -import com.glxp.api.util.MsDateUtil; -import com.glxp.api.util.GennerOrderUtils; -import com.glxp.api.util.OrderNoTypeBean; +import com.glxp.api.util.*; import com.glxp.api.util.udi.FilterUdiUtils; import com.glxp.api.util.udi.UdiCalCountUtil; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.ArrayList; import java.util.Date; import java.util.List; +import static com.glxp.api.constant.ConstantStatus.ORDER_STATUS_CHECK_PROCESS; + @Service public class IoAddInoutService { @@ -408,7 +408,7 @@ public class IoAddInoutService { /** - * 手持终端上传生成扫码单据 + * 手持终端-----新增出入库单据 * * @param pdaPostOrderRequest * @return @@ -438,112 +438,141 @@ public class IoAddInoutService { } return ResultVOUtils.success("单据上传成功!"); -// List postOrders = postOrderRequest.getPostOrders(); -// if (postOrders != null && postOrders.size() > 0) { -// for (int i = 0; i < postOrders.size(); i++) { -// PostOrderRequest.PostOrder postOrder = postOrders.get(i); -// //创建单据 -// PdaOrderEntity pdaOrderEntity = postOrder.getOrderBean(); -// IoOrderEntity orderEntity = null; -// if (StrUtil.isNotEmpty(pdaOrderEntity.getDocid())) { -// orderEntity = orderService.findByBillNo(pdaOrderEntity.getDocid()); -// } -// if (orderEntity != null) { -// //已包含业务单据校验 -// orderEntity.setUpdateUser(postOrderRequest.getUserId() + ""); -// orderEntity.setUpdateTime(new Date()); -// orderService.update(orderEntity); -// List pdaCodeEntities = postOrder.getCodes(); -// if (pdaCodeEntities != null && pdaCodeEntities.size() > 0) { -// PdaCodeEntity pdaCodeEntity = pdaCodeEntities.get(0); -// //写入条码 -// List ioCodeEnttities = new ArrayList<>(); -// for (int index = 0; index < pdaCodeEntities.size(); index++) { -// IoCodeTempEntity codeEnttity = new IoCodeTempEntity(); -// BeanUtil.copyProperties(pdaCodeEntities.get(index), codeEnttity); -// codeEnttity.setAction(orderEntity.getAction()); -// codeEnttity.setMainAction(orderEntity.getMainAction()); -// codeEnttity.setDeptCode(orderEntity.getDeptCode()); -// codeEnttity.setOrderId(orderEntity.getBillNo()); -// codeEnttity.setInvCode(orderEntity.getInvCode()); -// codeEnttity.setReCount(codeEnttity.getCount() * udiCalCountUtil.getActCount(codeEnttity.getNameCode())); -// codeEnttity.setUpdateTime(new Date()); -// codeEnttity.setCreateTime(MsDateUtil.parseDate(pdaCodeEntity.getActDate())); -// ioCodeEnttities.add(codeEnttity); -// } -// codeTempService.insertBatch(ioCodeEnttities); -// dealProcess(orderEntity); -// if (!ioCheckInoutService.checkManual(orderEntity.getBillNo())) { -// ioCheckInoutService.check(orderEntity.getBillNo()); -// } -// } -// } else { -// //创建新单据 -// BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(pdaOrderEntity.getType()); -// String orderNo = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER + StrUtil.trimToEmpty(bussinessTypeEntity.getPrefix()), "yyyyMMdd")); -// IoOrderEntity orderSaveRequest = new IoOrderEntity(); -// orderSaveRequest.setBillNo(orderNo); -// orderSaveRequest.setMainAction(pdaOrderEntity.getInout()); -// orderSaveRequest.setAction(pdaOrderEntity.getType()); -// orderSaveRequest.setCorpOrderId(pdaOrderEntity.getOrder()); -// orderSaveRequest.setFromCorp(pdaOrderEntity.getFromCorpID()); -// orderSaveRequest.setCustomerId(postOrderRequest.getCustomerId()); -// orderSaveRequest.setFromDeptCode(pdaOrderEntity.getFromDeptCode()); -// orderSaveRequest.setFromInvCode(pdaOrderEntity.getFromInvCode()); -// orderSaveRequest.setDeptCode(pdaOrderEntity.getDeptCode()); -// orderSaveRequest.setInvCode(pdaOrderEntity.getInvCode()); -// orderSaveRequest.setStatus(ConstantStatus.ORDER_STATUS_PROCESS); -// orderSaveRequest.setDealStatus(ConstantStatus.ORDER_DEAL_POST); -// orderSaveRequest.setCreateUser(postOrderRequest.getUserId() + ""); -// orderSaveRequest.setUpdateUser(postOrderRequest.getUserId() + ""); -// orderSaveRequest.setUpdateTime(new Date()); -// orderSaveRequest.setBusType(bussinessTypeEntity.getBusType()); -// orderSaveRequest.setOrderType(ConstantStatus.ORDER_TYPE_SCAN); -// if (postOrder.getErpOrders() != null && postOrder.getErpOrders().size() > 0) -// orderSaveRequest.setFromType(ConstantStatus.FROM_PDAED); -// else -// orderSaveRequest.setFromType(ConstantStatus.FROM_PDAUN); -// List pdaCodeEntities = postOrder.getCodes(); -// if (pdaCodeEntities != null && pdaCodeEntities.size() > 0) { -// PdaCodeEntity pdaCodeEntity = pdaCodeEntities.get(0); -// if (pdaCodeEntity.getActDate() != null) { -// orderSaveRequest.setCreateTime(MsDateUtil.parseDate(pdaCodeEntity.getActDate())); -// } -// //写入条码 -// List ioCodeEnttities = new ArrayList<>(); -// for (int index = 0; index < pdaCodeEntities.size(); index++) { -// IoCodeTempEntity codeEnttity = new IoCodeTempEntity(); -// BeanUtil.copyProperties(pdaCodeEntities.get(index), codeEnttity); -// codeEnttity.setAction(orderSaveRequest.getAction()); -// codeEnttity.setMainAction(orderSaveRequest.getMainAction()); -// codeEnttity.setDeptCode(orderSaveRequest.getDeptCode()); -// codeEnttity.setOrderId(orderSaveRequest.getBillNo()); -// codeEnttity.setInvCode(orderSaveRequest.getInvCode()); -// codeEnttity.setReCount(codeEnttity.getCount() * udiCalCountUtil.getActCount(codeEnttity.getNameCode())); -// codeEnttity.setUpdateTime(new Date()); -// codeEnttity.setCreateTime(MsDateUtil.parseDate(pdaCodeEntity.getActDate())); -// ioCodeEnttities.add(codeEnttity); -// } -// codeTempService.insertBatch(ioCodeEnttities); -// } -// orderService.insertOrder(orderSaveRequest); -// dealProcess(orderSaveRequest); -// if (!ioCheckInoutService.checkManual(orderEntity.getBillNo())) { -// ioCheckInoutService.check(orderEntity.getBillNo()); -// } -// } -// -// -// } -// } } /** - * 待配货,待校验单据提交 + * 手持终端-----待配货(无三期,有三期)单据提交 * * @return */ + @Transactional(rollbackFor = Exception.class) public BaseResponse waitOrderByPda(PdaPostOrderRequest pdaPostOrderRequest) { + if (CollUtil.isEmpty(pdaPostOrderRequest.getOrderDetailCodeEntities())) { + return ResultVOUtils.error(500, "提交失败,单据还未扫码或和扫码校验存在异常!"); + } + IoOrderEntity orderEntity = pdaPostOrderRequest.getOrderEntity(); + List orderDetailBizEntities = pdaPostOrderRequest.getOrderDetailBizEntities(); + List orderDetailCodeEntities = pdaPostOrderRequest.getOrderDetailCodeEntities(); + List codeTempEntities = pdaPostOrderRequest.getCodeTempEntities(); + + orderDetailBizService.deleteByOrderId(orderEntity.getBillNo()); + orderDetailCodeService.deleteByOrderId(orderEntity.getBillNo()); + codeTempService.deleteByBillNo(orderEntity.getBillNo()); + if (CollUtil.isNotEmpty(orderDetailBizEntities)) { + orderDetailBizEntities.forEach(orderDetailBizEntity -> { + orderDetailBizService.insert(orderDetailBizEntity); + }); + } + if (CollUtil.isNotEmpty(orderDetailCodeEntities)) { + orderDetailCodeEntities.forEach(orderDetailCodeEntity -> { + orderDetailCodeService.insert(orderDetailCodeEntity); + }); + } + if (CollUtil.isNotEmpty(codeTempEntities)) { + codeTempEntities.forEach(codeTempEntity -> { + codeTempService.insert(codeTempEntity); + }); + } + + BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(orderEntity.getAction()); + if (ioCheckInoutService.checkManual(orderEntity.getBillNo())) { + if (CollUtil.isNotEmpty(orderDetailBizEntities)) { + if (bussinessTypeEntity.getCheckWebNew() == 1) { + String errMsg = ioCheckInoutService.bizOrderCheck(orderDetailBizEntities, orderDetailCodeEntities); + if (StrUtil.isNotEmpty(errMsg)) { + return ResultVOUtils.error(500, errMsg); + } + errMsg = ioCheckInoutService.codeOrderCheck(orderDetailCodeEntities, orderDetailBizEntities); + if (StrUtil.isNotEmpty(errMsg)) { + return ResultVOUtils.error(500, errMsg); + } +// saveOrderWeb(addOrderRequest); + orderEntity.setStatus(ORDER_STATUS_CHECK_PROCESS); + orderEntity.setDealStatus(ConstantStatus.ORDER_DEAL_POST); + orderService.update(orderEntity); + ioCheckInoutService.check(orderEntity.getBillNo()); + } else { + String errMsg = ioCheckInoutService.bizNoPiCheck(orderDetailBizEntities, orderEntity); + if (StrUtil.isNotEmpty(errMsg)) { + return ResultVOUtils.error(500, errMsg); + } + orderDetailBizService.deleteByOrderId(orderEntity.getBillNo()); + for (IoOrderDetailCodeEntity orderDetailCodeEntity : orderDetailCodeEntities) { + IoOrderDetailBizEntity orderDetailBizEntity = new IoOrderDetailBizEntity(); + BeanUtil.copyProperties(orderDetailCodeEntity, orderDetailBizEntity); + orderDetailBizEntity.setId(null); + orderDetailBizEntity.setCount(IntUtil.value(orderDetailCodeEntity.getReCount())); + ioCheckInoutService.getSomeBiz(orderDetailBizEntities, orderDetailBizEntity); + orderDetailBizService.insert(orderDetailBizEntity); + } +// saveOrderWeb(addOrderRequest); + orderEntity.setStatus(ConstantStatus.ORDER_STATUS_CHECK); + orderEntity.setDealStatus(ConstantStatus.ORDER_DEAL_POST); + orderService.update(orderEntity); + dealProcess(orderEntity); + ioCheckInoutService.check(orderEntity.getBillNo()); + } + + + } else { + return ResultVOUtils.error(500, "单据校验提交失败,请先录入业务单据!"); + } + } else { + orderEntity.setStatus(ORDER_STATUS_CHECK_PROCESS); + dealProcess(orderEntity); + ioCheckInoutService.check(orderEntity.getBillNo()); + return ResultVOUtils.success("提交成功!"); + } + return ResultVOUtils.success("提交成功!"); + } + + + /** + * 手持终端------扫码结果提交 + * + * @return + */ + @Transactional(rollbackFor = Exception.class) + public BaseResponse checkCodeResultByPda(Integer checkWebNewType, PdaPostOrderRequest pdaPostOrderRequest) { + + IoOrderEntity orderEntity = pdaPostOrderRequest.getOrderEntity(); + IoOrderEntity temp = orderService.findByBillNo(orderEntity.getBillNo()); + BaseResponse tempResponse = checkSubmitEnable(temp); + if (tempResponse != null) + return tempResponse; + + List orderDetailBizEntities = pdaPostOrderRequest.getOrderDetailBizEntities(); + List orderDetailCodeEntities = pdaPostOrderRequest.getOrderDetailCodeEntities(); + List codeTempEntities = pdaPostOrderRequest.getCodeTempEntities(); + + orderDetailBizService.deleteByOrderId(orderEntity.getBillNo()); + orderDetailCodeService.deleteByOrderId(orderEntity.getBillNo()); + codeTempService.deleteByBillNo(orderEntity.getBillNo()); + if (CollUtil.isNotEmpty(orderDetailBizEntities)) { + orderDetailBizEntities.forEach(orderDetailBizEntity -> { + orderDetailBizService.insert(orderDetailBizEntity); + }); + } + if (CollUtil.isNotEmpty(orderDetailCodeEntities)) { + orderDetailCodeEntities.forEach(orderDetailCodeEntity -> { + orderDetailCodeService.insert(orderDetailCodeEntity); + }); + } + if (CollUtil.isNotEmpty(codeTempEntities)) { + codeTempEntities.forEach(codeTempEntity -> { + codeTempService.insert(codeTempEntity); + }); + } + orderEntity.setStatus(ORDER_STATUS_CHECK_PROCESS); + orderEntity.setDealStatus(ConstantStatus.ORDER_DEAL_POST); + orderService.update(orderEntity); + + if (checkWebNewType == 0) { + ioCheckInoutService.checkCodeResult(orderEntity.getBillNo()); + } else { + dealProcess(orderEntity); + ioCheckInoutService.checkRightResult(orderEntity.getBillNo()); + } return ResultVOUtils.success("提交成功!"); } @@ -729,4 +758,41 @@ public class IoAddInoutService { } + /** + * 临床出库时更新往来单位信息 + */ + public String updateCorp(BasicBussinessTypeEntity bussinessTypeEntity, String fromCorp) { + BasicCorpEntity basicCorpEntity; + //要是特殊往来信息没有就创建 + if (bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_INPUT && bussinessTypeEntity.isGenUnit()) { + basicCorpEntity = basicCorpService.selectByName(fromCorp); + if (basicCorpEntity == null) { + basicCorpEntity = new BasicCorpEntity(); + basicCorpEntity.setErpId(CustomUtil.getUnitId()); + basicCorpEntity.setCorpType(ConstantStatus.CORP_SICK); + basicCorpEntity.setOutType(ConstantStatus.CORP_SICK_SICK); + basicCorpEntity.setName(fromCorp); + basicCorpEntity.setId(IdUtil.getSnowflakeNextId()); + basicCorpService.insert(basicCorpEntity); + } + return basicCorpEntity.getErpId(); + + } else { + return fromCorp; + } + } + + public BaseResponse checkSubmitEnable(IoOrderEntity orderEntity) { + if (orderEntity == null) { + return ResultVOUtils.error(500, "提交失败,请先添加物资!"); + } + if (orderEntity.getStatus() == ORDER_STATUS_CHECK_PROCESS || orderEntity.getStatus() == ConstantStatus.ORDER_STATUS_PROCESS + || orderEntity.getStatus() == ConstantStatus.ORDER_STATUS_PROCESSING) { + return ResultVOUtils.error(500, "提交失败,单据正在处理,请稍后刷新查看!"); + } + if (orderEntity.getStatus() != 1 && orderEntity.getStatus() != 3 && orderEntity.getStatus() != 4 && orderEntity.getStatus() != 6) { + return ResultVOUtils.error(500, "提交失败,单据已提交,请稍后刷新查看!"); + } + return null; + } } 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 5bcfb265..5da5cead 100644 --- a/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java +++ b/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java @@ -220,7 +220,6 @@ public class IoCheckInoutService { }); //生成多出来的 - List codeTempEntities = codeTempService.findByOrderId(orderEntity.getBillNo()); for (IoCodeTempEntity codeTempEntity : codeTempEntities) { IoCodeEntity codeEnttity = new IoCodeEntity(); @@ -1203,4 +1202,14 @@ public class IoCheckInoutService { } return bizEntity.getCoName() + "数量不匹配!"; } + + public void getSomeBiz(List orderDetailBizEntities, IoOrderDetailBizEntity resutBizEntity) { + for (IoOrderDetailBizEntity orderDetailBizEntity : orderDetailBizEntities) { + if (orderDetailBizEntity.getBindRlFk().longValue() == resutBizEntity.getBindRlFk().longValue()) { + resutBizEntity.setCertCode(orderDetailBizEntity.getCertCode()); + resutBizEntity.setPrice(orderDetailBizEntity.getPrice()); + } + } + } + } diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 458a4284..b2df4abe 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -4,7 +4,7 @@ server: spring: datasource: driver-class-name: com.p6spy.engine.spy.P6SpyDriver - jdbc-url: jdbc:p6spy:mysql://127.0.0.1:3306/udi_wms_pzh?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true + jdbc-url: jdbc:p6spy:mysql://127.0.0.1:3306/udi_wms_pt?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true username: root password: 123456 hikari: diff --git a/src/main/resources/schemas/schema_v2.2.sql b/src/main/resources/schemas/schema_v2.2.sql index ca48c794..7b0bd7fd 100644 --- a/src/main/resources/schemas/schema_v2.2.sql +++ b/src/main/resources/schemas/schema_v2.2.sql @@ -8,8 +8,8 @@ CREATE TABLE IF NOT EXISTS `device_inspect_task` `deptCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '部门', `invCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '仓库', `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '资产编码', - `status` int NULL DEFAULT NULL COMMENT '状态', - `type` int NULL DEFAULT NULL COMMENT '类型', + `status` int NULL DEFAULT NULL COMMENT '状态', + `type` int NULL DEFAULT NULL COMMENT '类型', `inspectUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检人', `remindTime` datetime(0) NULL DEFAULT NULL COMMENT '提醒时间', `remark` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检备注', @@ -34,7 +34,7 @@ CREATE TABLE IF NOT EXISTS `device_inspect_task_detail` `id` int NOT NULL AUTO_INCREMENT, `projectCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检项目编码', `projectContent` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检内容', - `status` int NULL DEFAULT NULL COMMENT '状态(1:未开始;2:已检查;3:异常;4:不巡检', + `status` int NULL DEFAULT NULL COMMENT '状态(1:未开始;2:已检查;3:异常;4:不巡检', `result` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检结果备注', `inspectImage` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检图片', `inspectUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '巡检人', @@ -270,3 +270,5 @@ CALL Pro_Temp_ColumnWork('device_inspect_plan', 'useFrequency', 'int', 1); INSERT ignore INTO `sys_param_config`(`id`, `parentId`, `paramName`, `paramKey`, `paramValue`, `paramStatus`, `paramType`, `paramExplain`, `updateTime`) VALUES (2090, 0, '更新第三方产品信息是否选入耗材字典', 'update_third_in_rel', '0', 0, 0, '更新第三方产品信息是否选入耗材字典(0:否;1:是)', NULL); + +CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'checkWebNewType', 'tinyint', 1);