From 75ae13cacd0a1758d77a3e2c658d97fe4421ac15 Mon Sep 17 00:00:00 2001 From: x_z Date: Tue, 20 Sep 2022 18:01:05 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E5=8D=95=E6=8D=AE=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E7=9A=84=E4=BB=A3=E7=A0=81=EF=BC=8C=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E9=83=A8=E5=88=86=E8=BF=81=E7=A7=BB=E5=B7=A5=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../udi/admin/controller/TestController.java | 122 +++++- .../basic/BussinessTypeController.java | 6 +- .../inout/InvProductsController.java | 4 +- .../controller/inout/OrderController.java | 141 ++++--- .../inout/StockQRCodeTextController.java | 8 +- .../inout/UdiRelevanceController.java | 7 +- .../controller/inout/UdiTraceController.java | 17 +- .../controller/inout/WareHouseController.java | 32 +- .../inventory/InvWarehouseController.java | 6 +- .../glxp/udi/admin/dao/inout/OrderDao.java | 27 ++ .../entity/inout/InvProductDetailEntity.java | 5 + .../admin/entity/inout/InvProductEntity.java | 5 + .../admin/entity/inout/OrderDetailEntity.java | 5 + .../udi/admin/entity/inout/OrderEntity.java | 6 +- .../admin/entity/inout/WarehouseEntity.java | 5 + .../entity/inout/WarehousetempEntity.java | 5 + ...ity.java => InvProductDetailMdEntity.java} | 2 +- ...uctEntity.java => InvProductMdEntity.java} | 2 +- ...ouseEntity.java => WarehouseMdEntity.java} | 2 +- ...Entity.java => WarehousetempMdEntity.java} | 2 +- .../dao/{CodesDao.java => CodesMdDao.java} | 7 +- ...{CodesTempDao.java => CodesTempMdDao.java} | 7 +- ...ailDao.java => InvProductDetailMdDao.java} | 8 +- ...nvProductDao.java => InvProductMdDao.java} | 7 +- ...erDetailDao.java => OrderDetailMdDao.java} | 43 ++- .../dao/{OrderDao.java => OrderMdDao.java} | 8 +- ...tMdService.java => InvProductService.java} | 2 +- .../mongo/service/OrderDetailMdService.java | 93 ----- .../mongo/service/OrderDetailService.java | 70 ++++ ...{OrderMdService.java => OrderService.java} | 354 ++++++------------ .../mongo/service/WarehouseMdService.java | 102 ++--- .../mongo/service/WarehouseTempMdService.java | 25 +- ...est.java => FilterOrderDetailRequest.java} | 2 +- .../udi/admin/res/inout/OrderNoResult.java | 7 +- .../admin/thread/InvProductsTrService.java | 17 +- .../admin/thread/SubmitOrderToSpmsTask.java | 37 +- .../udi/admin/thread/SupplementOrderTask.java | 11 +- .../udi/admin/thread/TransInoutService.java | 54 ++- .../glxp/udi/admin/thread/TransInoutTask.java | 6 +- .../glxp/udi/admin/util/inout/InoutUtils.java | 6 +- .../mybatis/mapper/inout/OrderDao.xml | 23 ++ 42 files changed, 681 insertions(+), 619 deletions(-) rename src/main/java/com/glxp/udi/admin/entity/mongo/{InvProductDetailEntity.java => InvProductDetailMdEntity.java} (94%) rename src/main/java/com/glxp/udi/admin/entity/mongo/{InvProductEntity.java => InvProductMdEntity.java} (96%) rename src/main/java/com/glxp/udi/admin/entity/mongo/{WarehouseEntity.java => WarehouseMdEntity.java} (97%) rename src/main/java/com/glxp/udi/admin/entity/mongo/{WarehousetempEntity.java => WarehousetempMdEntity.java} (96%) rename src/main/java/com/glxp/udi/admin/mongo/dao/{CodesDao.java => CodesMdDao.java} (93%) rename src/main/java/com/glxp/udi/admin/mongo/dao/{CodesTempDao.java => CodesTempMdDao.java} (94%) rename src/main/java/com/glxp/udi/admin/mongo/dao/{InvProductDetailDao.java => InvProductDetailMdDao.java} (92%) rename src/main/java/com/glxp/udi/admin/mongo/dao/{InvProductDao.java => InvProductMdDao.java} (95%) rename src/main/java/com/glxp/udi/admin/mongo/dao/{OrderDetailDao.java => OrderDetailMdDao.java} (74%) rename src/main/java/com/glxp/udi/admin/mongo/dao/{OrderDao.java => OrderMdDao.java} (96%) rename src/main/java/com/glxp/udi/admin/mongo/service/{InvProductMdService.java => InvProductService.java} (99%) delete mode 100644 src/main/java/com/glxp/udi/admin/mongo/service/OrderDetailMdService.java create mode 100644 src/main/java/com/glxp/udi/admin/mongo/service/OrderDetailService.java rename src/main/java/com/glxp/udi/admin/mongo/service/{OrderMdService.java => OrderService.java} (56%) rename src/main/java/com/glxp/udi/admin/req/inout/{FilterErpOrderRequest.java => FilterOrderDetailRequest.java} (89%) create mode 100644 src/main/resources/mybatis/mapper/inout/OrderDao.xml diff --git a/pom.xml b/pom.xml index a936209..86a262f 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ - 1.8 + 11 11.0 3.5.1 diff --git a/src/main/java/com/glxp/udi/admin/controller/TestController.java b/src/main/java/com/glxp/udi/admin/controller/TestController.java index 0adc6b9..67b2f05 100644 --- a/src/main/java/com/glxp/udi/admin/controller/TestController.java +++ b/src/main/java/com/glxp/udi/admin/controller/TestController.java @@ -1,11 +1,18 @@ package com.glxp.udi.admin.controller; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.glxp.udi.admin.dao.inout.UdiInfoDao; import com.glxp.udi.admin.entity.inout.*; -import com.glxp.udi.admin.mongo.service.*; -import com.glxp.udi.admin.req.inout.FilterErpOrderRequest; +import com.glxp.udi.admin.entity.inout.WarehousetempEntity; +import com.glxp.udi.admin.entity.mongo.*; +import com.glxp.udi.admin.mongo.dao.*; +import com.glxp.udi.admin.mongo.service.InvProductDetailMdService; +import com.glxp.udi.admin.mongo.service.InvProductService; +import com.glxp.udi.admin.mongo.service.OrderDetailService; +import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest; import com.glxp.udi.admin.req.inout.FilterInvProductDetailRequest; import com.glxp.udi.admin.req.inventory.FilterInvProductRequest; import lombok.extern.slf4j.Slf4j; @@ -20,21 +27,48 @@ import java.util.List; public class TestController { @Resource - private OrderMdService orderMdService; + private OrderDetailService orderDetailService; @Resource - private OrderDetailMdService orderDetailMdService; - @Resource - private InvProductMdService invProductMdService; + private InvProductService invProductService; @Resource private InvProductDetailMdService invProductDetailMdService; @Resource private UdiInfoDao udiInfoDao; + //mongodb dao + @Resource + private OrderMdDao orderMdDao; + @Resource + private OrderDetailMdDao orderDetailMdDao; + @Resource + private CodesMdDao codesMdDao; + @Resource + private CodesTempMdDao codesTempMdDao; + @Resource + private InvProductMdDao invProductMdDao; + @Resource + private InvProductDetailMdDao invProductDetailMdDao; + + //mysql dao + @Resource + private com.glxp.udi.admin.dao.inout.OrderDao orderDao; + @Resource + private com.glxp.udi.admin.dao.inout.OrderDetailDao orderDetailDao; + @Resource + private com.glxp.udi.admin.dao.inout.CodesDao codesDao; + @Resource + private com.glxp.udi.admin.dao.inout.CodesTempDao codesTempDao; + @Resource + private com.glxp.udi.admin.dao.inout.InvProductDao invProductDao; + @Resource + private com.glxp.udi.admin.dao.inout.InvProductDetailDao invProductDetailDao; + + @GetMapping("/test/refreshOrderData") private String refreshOrderData() { try { //刷新订单详情表的数据 - List erpOrderEntities = orderDetailMdService.filterOrderDetails(new FilterErpOrderRequest()); + List erpOrderEntities = orderDetailService.filterOrderDetails(new FilterOrderDetailRequest()); /*erpOrderEntities.forEach(orderDetail -> { String orderId = orderDetail.getOrderIdFk(); if (StrUtil.isNotBlank(orderId)) { @@ -54,7 +88,7 @@ public class TestController { });*/ //刷新库存表的数据 - List invProductEntities = invProductMdService.filterInvProductList(new FilterInvProductRequest()); + List invProductEntities = invProductService.filterInvProductList(new FilterInvProductRequest()); invProductEntities.forEach(invProductEntity -> { UdiInfoEntity udiInfoEntity = udiInfoDao.selectOne(new QueryWrapper().eq(StrUtil.isNotBlank(invProductEntity.getRelIdFk()), "uuid", invProductEntity.getRelIdFk()) .eq(StrUtil.isNotBlank(invProductEntity.getCustomerId()), "customerId", invProductEntity.getCustomerId()) @@ -63,7 +97,7 @@ public class TestController { if (null != udiInfoEntity) { invProductEntity.setRelIdFk(String.valueOf(udiInfoEntity.getId())); log.info("刷新库存"); - invProductMdService.updateInvProduct(invProductEntity); + invProductService.updateInvProduct(invProductEntity); } }); @@ -95,6 +129,76 @@ public class TestController { @GetMapping("/test/copyData") public String copyData() { try { + log.info("开始拷贝单据数据"); + List orderList = orderMdDao.getOrderList(); + if (CollUtil.isNotEmpty(orderList)) { + orderList.forEach(orderMdEntity -> { + OrderEntity orderEntity = new OrderEntity(); + BeanUtil.copyProperties(orderMdEntity, orderEntity); + orderDao.insert(orderEntity); + }); + } + log.info("单据数据拷贝完成"); + + log.info("开始拷贝单据详情数据"); + List orderDetailList = orderDetailMdDao.getOrderDetailList(); + if (CollUtil.isNotEmpty(orderDetailList)) { + orderDetailList.forEach(orderMdDetail -> { + OrderDetailEntity orderDetailEntity = new OrderDetailEntity(); + BeanUtil.copyProperties(orderMdDetail, orderDetailEntity, "id"); + orderDetailEntity.setBatchNo(orderMdDetail.getLotno()); + orderDetailEntity.setProductName(orderMdDetail.getCoName()); + orderDetailDao.insert(orderDetailEntity); + }); + } + log.info("单据详情数据拷贝完成"); + + log.info("开始拷贝码数据"); + List codesList = codesMdDao.getCodesList(); + if (CollUtil.isNotEmpty(codesList)) { + codesList.forEach(code -> { + WarehouseEntity warehouseEntity = new WarehouseEntity(); + BeanUtil.copyProperties(code, warehouseEntity, "id"); + codesDao.insert(warehouseEntity); + }); + } + log.info("码数据拷贝完成"); + + log.info("开始拷贝临时码表"); + List codesTempList = codesTempMdDao.getCodesTempList(); + if (CollUtil.isNotEmpty(codesTempList)) { + codesTempList.forEach(codesTemp -> { + WarehousetempEntity warehousetempEntity = new WarehousetempEntity(); + BeanUtil.copyProperties(codesTemp, warehousetempEntity, "id"); + codesTempDao.insert(warehousetempEntity); + }); + } + log.info("临时码表数据拷贝完成"); + + log.info("开始拷贝库存数据"); + List invList = invProductMdDao.getInvList(); + if (CollUtil.isNotEmpty(invList)) { + invList.forEach(inv -> { + InvProductEntity invProductEntity = new InvProductEntity(); + BeanUtil.copyProperties(inv, invProductEntity, "id"); + invProductDao.insert(invProductEntity); + if (StrUtil.isNotBlank(invProductEntity.getId())) { + //拷贝;临时码表的数据 + log.info("开始拷贝临时码表数据"); + //查询此库存对应的库存详情,根据已经插入到mysql的数据,生成mysql的库存详情数据 + List invDetailList = invProductDetailMdDao.getInvDetailList(inv.getId()); + if (CollUtil.isNotEmpty(invDetailList)) { + invDetailList.forEach(invDetail -> { + InvProductDetailEntity invProductDetailEntity = new InvProductDetailEntity(); + BeanUtil.copyProperties(inv, invProductDetailEntity, "id"); + invProductDetailEntity.setProductIdFk(invProductEntity.getId()); + invProductDetailDao.insert(invProductDetailEntity); + log.info("插入库存详情数据"); + }); + } + } + }); + } return "success"; } catch (Exception e) { diff --git a/src/main/java/com/glxp/udi/admin/controller/basic/BussinessTypeController.java b/src/main/java/com/glxp/udi/admin/controller/basic/BussinessTypeController.java index d6815ed..cef116b 100644 --- a/src/main/java/com/glxp/udi/admin/controller/basic/BussinessTypeController.java +++ b/src/main/java/com/glxp/udi/admin/controller/basic/BussinessTypeController.java @@ -7,7 +7,7 @@ import com.glxp.udi.admin.common.res.BaseResponse; import com.glxp.udi.admin.constant.Constant; import com.glxp.udi.admin.entity.basic.BussinessTypeEntity; import com.glxp.udi.admin.entity.basic.CndidateRequest; -import com.glxp.udi.admin.mongo.service.OrderMdService; +import com.glxp.udi.admin.mongo.service.OrderService; import com.glxp.udi.admin.req.basic.BussinessLocalTypeFilterRequest; import com.glxp.udi.admin.req.basic.BussinessTypeFilterRequest; import com.glxp.udi.admin.req.info.DeleteRequest; @@ -44,7 +44,7 @@ public class BussinessTypeController { @Resource private CustomerService customerService; @Resource - private OrderMdService orderMdService; + private OrderService orderService; @ApiOperation(value = "扫码单据列表") @AuthRuleAnnotation("") @@ -98,7 +98,7 @@ public class BussinessTypeController { String id = deleteRequest.getId(); BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.selectById(id); - long count = orderMdService.countByAction(bussinessTypeEntity.getAction()); + long count = orderService.countByAction(bussinessTypeEntity.getAction()); if (count > 0) { return ResultVOUtils.error(500, "已存在该类型扫码单据,无法删除!"); } diff --git a/src/main/java/com/glxp/udi/admin/controller/inout/InvProductsController.java b/src/main/java/com/glxp/udi/admin/controller/inout/InvProductsController.java index 622ae1b..2a74ace 100644 --- a/src/main/java/com/glxp/udi/admin/controller/inout/InvProductsController.java +++ b/src/main/java/com/glxp/udi/admin/controller/inout/InvProductsController.java @@ -11,7 +11,7 @@ import com.glxp.udi.admin.entity.inout.InvProductDetailEntity; import com.glxp.udi.admin.entity.inout.InvProductEntity; import com.glxp.udi.admin.entity.inout.UdiInfoEntity; import com.glxp.udi.admin.mongo.service.InvProductDetailMdService; -import com.glxp.udi.admin.mongo.service.InvProductMdService; +import com.glxp.udi.admin.mongo.service.InvProductService; import com.glxp.udi.admin.mongo.utils.PageResult; import com.glxp.udi.admin.req.inout.DeleteRequest; import com.glxp.udi.admin.req.inout.FilterInvProductDetailRequest; @@ -42,7 +42,7 @@ import java.util.List; public class InvProductsController { @Resource - private InvProductMdService invProductService; + private InvProductService invProductService; @Resource private InvProductDetailMdService invProductDetailService; @Resource diff --git a/src/main/java/com/glxp/udi/admin/controller/inout/OrderController.java b/src/main/java/com/glxp/udi/admin/controller/inout/OrderController.java index 4026e68..d090e86 100644 --- a/src/main/java/com/glxp/udi/admin/controller/inout/OrderController.java +++ b/src/main/java/com/glxp/udi/admin/controller/inout/OrderController.java @@ -7,6 +7,7 @@ import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.glxp.udi.admin.annotation.AuthRuleAnnotation; import com.glxp.udi.admin.common.res.BaseResponse; import com.glxp.udi.admin.constant.ConstantStatus; @@ -14,13 +15,11 @@ import com.glxp.udi.admin.dao.inventory.InvWarehouseDao; import com.glxp.udi.admin.entity.auth.AuthAdmin; import com.glxp.udi.admin.entity.basic.BussinessTypeEntity; import com.glxp.udi.admin.entity.info.PlatformEntity; -import com.glxp.udi.admin.entity.inout.OrderDetailEntity; -import com.glxp.udi.admin.entity.inout.UnitMaintainEntity; -import com.glxp.udi.admin.entity.inout.WarehouseEntity; -import com.glxp.udi.admin.entity.inout.WarehousetempEntity; +import com.glxp.udi.admin.entity.inout.*; import com.glxp.udi.admin.entity.mongo.OrderMdEntity; -import com.glxp.udi.admin.mongo.service.OrderDetailMdService; -import com.glxp.udi.admin.mongo.service.OrderMdService; +import com.glxp.udi.admin.entity.mongo.WarehouseMdEntity; +import com.glxp.udi.admin.mongo.service.OrderDetailService; +import com.glxp.udi.admin.mongo.service.OrderService; import com.glxp.udi.admin.mongo.service.WarehouseMdService; import com.glxp.udi.admin.mongo.service.WarehouseTempMdService; import com.glxp.udi.admin.mongo.utils.PageResult; @@ -63,9 +62,9 @@ public class OrderController { @Resource private AuthAdminService authAdminService; @Resource - private OrderDetailMdService orderDetailMdService; + private OrderDetailService orderDetailService; @Resource - private OrderMdService orderMdService; + private OrderService orderService; @Resource private WarehouseMdService warehouseMdService; @Resource @@ -112,10 +111,10 @@ public class OrderController { orderFilterRequest.setCheckReceiveStatus(true); } - PageResult pageResult = orderMdService.filterList(orderFilterRequest); + IPage page = orderService.filterList(orderFilterRequest); List responses = new ArrayList<>(); - if (CollUtil.isNotEmpty(pageResult.getList())) { - pageResult.getList().forEach(order -> { + if (CollUtil.isNotEmpty(page.getRecords())) { + page.getRecords().forEach(order -> { OrderMdResponse response = new OrderMdResponse(); BeanUtil.copyProperties(order, response); String name = invWarehouseDao.selectNameByCode(order.getLocStorageCode()); @@ -129,12 +128,12 @@ public class OrderController { } //设置上传状态 - response.setUploadFlag(orderMdService.checkUpload(order)); + response.setUploadFlag(orderService.checkUpload(order)); responses.add(response); }); } PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); - pageSimpleResponse.setTotal(pageResult.getTotal()); + pageSimpleResponse.setTotal(page.getTotal()); pageSimpleResponse.setList(responses); return ResultVOUtils.success(pageSimpleResponse); } @@ -157,10 +156,10 @@ public class OrderController { if (CollUtil.isNotEmpty(deleteRequest.getIds())) { //全部删除 - orderMdService.deleteOrders(deleteRequest.getIds()); + orderService.deleteOrders(deleteRequest.getIds()); } else { //删除单条单据 - orderMdService.deleteOrders(Collections.singletonList(deleteRequest.getOrderId())); + orderService.deleteOrders(Collections.singletonList(deleteRequest.getOrderId())); } return ResultVOUtils.success("删除成功"); } @@ -179,7 +178,7 @@ public class OrderController { orderFilterRequest.setInvCodes(codes); orderFilterRequest.setCustomerId(authAdmin.getCustomerId()); orderFilterRequest.setStatus(orderFilterRequest.getStatus()); - PageResult pageResult = orderMdService.filterList(orderFilterRequest); + PageResult pageResult = orderService.filterList(orderFilterRequest); PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); pageSimpleResponse.setTotal(pageResult.getTotal()); pageSimpleResponse.setList(pageResult.getList()); @@ -206,7 +205,7 @@ public class OrderController { } orderFilterRequest.setInvCodes(invCodes); - PageResult pageResult = orderMdService.filterList(orderFilterRequest); + PageResult pageResult = orderService.filterList(orderFilterRequest); PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); pageSimpleResponse.setTotal(pageResult.getTotal()); pageSimpleResponse.setList(pageResult.getList()); @@ -232,7 +231,7 @@ public class OrderController { orderFilterRequest.setInvCodes(codes); orderFilterRequest.setCustomerId(authAdmin.getCustomerId()); orderFilterRequest.setStatus(ConstantStatus.ORDER_STATUS_ADDITIONAL); - PageResult pageResult = orderMdService.filterList(orderFilterRequest); + PageResult pageResult = orderService.filterList(orderFilterRequest); List responses = new ArrayList<>(); if (CollUtil.isNotEmpty(pageResult.getList())) { pageResult.getList().forEach(order -> { @@ -264,20 +263,20 @@ public class OrderController { for (String orderId : orderList) { DeleteRequest deleteRequest = new DeleteRequest(); deleteRequest.setOrderId(orderId); - orderDetailMdService.deleteOrderDetail(deleteRequest); + orderDetailService.deleteOrderDetail(deleteRequest); } String mainOrder = orderList.get(0); for (int i = 1; i < orderList.size(); i++) { warehouseMdService.updateOrderId(orderList.get(i), mainOrder); DeleteRequest deleteRequest = new DeleteRequest(); deleteRequest.setOrderId(orderList.get(i)); - orderMdService.deleteOrder(deleteRequest); + orderService.deleteOrder(deleteRequest); } new Thread(() -> { WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest(); warehouseQueryRequest.setOrderId(mainOrder); - List transData = warehouseMdService.filterWarehouse(warehouseQueryRequest); - inoutUtils.generateConstrastDetail(udiInfoService, udiRelevanceService, orderDetailMdService, transData); + List transData = warehouseMdService.filterWarehouse(warehouseQueryRequest); + inoutUtils.generateConstrastDetail(udiInfoService, udiRelevanceService, orderDetailService, transData); }).start(); } return ResultVOUtils.success("合并成功,后台正在数据转换,请稍后刷新重试!"); @@ -288,7 +287,7 @@ public class OrderController { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } - orderMdService.updateOrder(orderEntity); + orderService.updateOrder(orderEntity); warehouseMdService.updateUnit(orderEntity.getOrderId(), orderEntity.getFromCorpId(), orderEntity.getFromCorp()); return ResultVOUtils.success("添加成功"); } @@ -304,21 +303,21 @@ public class OrderController { List orderBeans = new ArrayList<>(); UnitMaintainEntity unitMaintainEntity = null; String orderId = orderUploadRequest.getOrderIds().get(0); - OrderMdEntity orderMdEntity = orderMdService.findByOne(orderId); - if (orderMdEntity != null) { - unitMaintainEntity = unitMaintainService.selectByUnitId(orderMdEntity.getFromCorpId()); + OrderEntity orderEntity = orderService.findByOne(orderId); + if (orderEntity != null) { + unitMaintainEntity = unitMaintainService.selectByUnitId(orderEntity.getFromCorpId()); if (unitMaintainEntity == null || unitMaintainEntity.getAppid() == null) { return ResultVOUtils.error(500, "该往来单位未绑定UDI自助平台!"); } - if (!orderMdEntity.getAction().equals(unitMaintainEntity.getSourceAction())) { + if (!orderEntity.getAction().equals(unitMaintainEntity.getSourceAction())) { return ResultVOUtils.error(500, "该单据类型不支持提交!"); } PostUdimsOrderRequest.OrderBean orderBean = new PostUdimsOrderRequest.OrderBean(); - BeanUtils.copyProperties(orderMdEntity, orderBean); + BeanUtils.copyProperties(orderEntity, orderBean); orderBean.setAction(unitMaintainEntity.getTargetAction()); WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest(); - warehouseQueryRequest.setOrderId(orderMdEntity.getOrderId()); - List warehouseEntities = warehouseMdService.filterWarehouse(warehouseQueryRequest); + warehouseQueryRequest.setOrderId(orderEntity.getOrderId()); + List warehouseEntities = warehouseMdService.filterWarehouse(warehouseQueryRequest); List codeBeans = new ArrayList<>(); UnitMaintainEntity finalUnitMaintainEntity = unitMaintainEntity; warehouseEntities.forEach(data -> { @@ -329,10 +328,10 @@ public class OrderController { codeBeans.add(codeBean); }); //查询单据详情 - FilterErpOrderRequest filterErpOrderRequest = new FilterErpOrderRequest(); - filterErpOrderRequest.setOrderId(orderBean.getOrderId()); + FilterOrderDetailRequest filterOrderDetailRequest = new FilterOrderDetailRequest(); + filterOrderDetailRequest.setOrderId(orderBean.getOrderId()); //单据详情 - List erpOrderEntities = orderDetailMdService.filterOrderDetails(filterErpOrderRequest); + List erpOrderEntities = orderDetailService.filterOrderDetails(filterOrderDetailRequest); if (CollUtil.isNotEmpty(erpOrderEntities)) { List orderDetails = new ArrayList<>(); for (OrderDetailEntity orderDetailEntity : erpOrderEntities) { @@ -365,8 +364,8 @@ public class OrderController { JSONObject.parseObject(response, new TypeReference() { }); if (baseResponse.getCode() == 20000) { - orderMdEntity.setUploadStatus("1"); - orderMdService.updateOrder(orderMdEntity); + orderEntity.setUploadStatus("1"); + orderService.updateOrder(orderEntity); return baseResponse; } else { return ResultVOUtils.error(500, baseResponse.getMessage()); @@ -376,13 +375,13 @@ public class OrderController { } @GetMapping(value = "/warehouse/inout/order/detail") - public BaseResponse orderDetail(FilterErpOrderRequest filterErpOrderRequest, BindingResult bindingResult) { + public BaseResponse orderDetail(FilterOrderDetailRequest filterOrderDetailRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } - filterErpOrderRequest.setPage(1); - filterErpOrderRequest.setLimit(100); - List erpOrderEntities = orderDetailMdService.filterOrderDetails(filterErpOrderRequest); + filterOrderDetailRequest.setPage(1); + filterOrderDetailRequest.setLimit(100); + List erpOrderEntities = orderDetailService.filterOrderDetails(filterOrderDetailRequest); if (CollUtil.isNotEmpty(erpOrderEntities)) { erpOrderEntities.forEach(erpOrderEntity -> { erpOrderEntity.setReCount(erpOrderEntity.getCount()); @@ -402,7 +401,7 @@ public class OrderController { @PostMapping("/warehouse/inout/order/detail/update") public BaseResponse updateStockOrderDetail(OrderDetailEntity orderDetailEntity) { if (null != orderDetailEntity) { - orderDetailMdService.updateOrderDetail(orderDetailEntity); + orderDetailService.updateOrderDetail(orderDetailEntity); } return ResultVOUtils.success("更新成功"); } @@ -413,7 +412,7 @@ public class OrderController { if (null == orderEditRequest || StrUtil.isBlank(orderEditRequest.getActDate()) || CollUtil.isEmpty(orderEditRequest.getOrderIds())) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); } - orderMdService.updateOrderInfo(orderEditRequest.getActDate(), orderEditRequest.getOrderIds()); + orderService.updateOrderInfo(orderEditRequest.getActDate(), orderEditRequest.getOrderIds()); return ResultVOUtils.success(); } @@ -429,9 +428,9 @@ public class OrderController { if (StrUtil.isBlank(orderId)) { return ResultVOUtils.error(ResultEnum.DATA_ERROR); } - OrderMdEntity orderMdEntity = orderMdService.findByOne(orderId); - if (StrUtil.isEmpty(orderMdEntity.getSupplementNo())) { - return orderMdService.supplementOrder(orderMdEntity); + OrderEntity orderEntity = orderService.findByOne(orderId); + if (StrUtil.isEmpty(orderEntity.getSupplementNo())) { + return orderService.supplementOrder(orderEntity); } else { return ResultVOUtils.error(500, "当前单据已补单,请勿重复补单"); } @@ -449,8 +448,8 @@ public class OrderController { if (StrUtil.isBlank(orderId)) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); } - List orderMdEntities = orderMdService.filterForDelete(orderId); - return ResultVOUtils.success(orderMdEntities); + List orderEntities = orderService.filterForDelete(orderId); + return ResultVOUtils.success(orderEntities); } /** @@ -464,8 +463,8 @@ public class OrderController { if (StrUtil.isBlank(id)) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); } - OrderMdEntity orderMdEntity = orderMdService.findById(id); - return ResultVOUtils.success(orderMdEntity); + OrderEntity orderEntity = orderService.findById(id); + return ResultVOUtils.success(orderEntity); } /** @@ -477,7 +476,7 @@ public class OrderController { @AuthRuleAnnotation("") @PostMapping("/udiwms/stock/order/change") public BaseResponse stockOrderChange(@RequestBody AddOrderChangeRequest addOrderChangeRequest) { - OrderMdEntity originOrder = orderMdService.findById(addOrderChangeRequest.getOrderId()); + OrderEntity originOrder = orderService.findById(addOrderChangeRequest.getOrderId()); String oldOrderId = originOrder.getOrderId(); String replicateNo = originOrder.getReplicateNo(); //复制单号 //查询条码 @@ -528,10 +527,10 @@ public class OrderController { } ); originOrder.setUpdateTime(new Date()); - originOrder.setId(null); - orderMdService.insertOrder(originOrder); + originOrder.setOrderId(null); + orderService.insertOrder(originOrder); warehouseTempMdService.insertTempWarehouses(supplementCodes); - orderMdService.updateReplicateNo(oldOrderId, replicateNo); + orderService.updateReplicateNo(oldOrderId, replicateNo); return ResultVOUtils.success(); } @@ -546,20 +545,20 @@ public class OrderController { orderFilterRequest.setCustomerId(customerId); BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(orderFilterRequest.getAction(), String.valueOf(customerId)); if (StrUtil.isNotBlank(orderFilterRequest.getOrderId())) { - OrderMdEntity orderMdEntity = orderMdService.findByOne(orderFilterRequest.getOrderId()); - if (null == orderMdEntity || null == bussinessTypeEntity) { + OrderEntity orderEntity = orderService.findByOne(orderFilterRequest.getOrderId()); + if (null == orderEntity || null == bussinessTypeEntity) { return ResultVOUtils.error(500, "单据未找到!"); - } else if (!bussinessTypeEntity.getAction().equals(orderMdEntity.getAction())) { + } else if (!bussinessTypeEntity.getAction().equals(orderEntity.getAction())) { return ResultVOUtils.error(500, "非" + bussinessTypeEntity.getName() + "类型单据!"); - } else if (orderMdEntity.getReceiveStatus().equals(ConstantStatus.RECEIVE_ED)) { + } else if (orderEntity.getReceiveStatus().equals(ConstantStatus.RECEIVE_ED)) { return ResultVOUtils.error(500, "单据已验收"); } else { - orderMdEntity.setId(orderMdEntity.getOrderId()); - orderMdEntity.setExportStatus(null); - List orderMdEntities = Collections.singletonList(orderMdEntity); - PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); - pageSimpleResponse.setTotal((long) orderMdEntities.size()); - pageSimpleResponse.setList(orderMdEntities); + orderEntity.setOrderId(orderEntity.getOrderId()); + orderEntity.setExportStatus(null); + List orderEntities = Collections.singletonList(orderEntity); + PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); + pageSimpleResponse.setTotal((long) orderEntities.size()); + pageSimpleResponse.setList(orderEntities); return ResultVOUtils.success(pageSimpleResponse); } } @@ -572,16 +571,16 @@ public class OrderController { List invCodes = warehouseUserService.selectCodeByUserId(Long.valueOf(customerService.getUserId())); orderFilterRequest.setInvCodes(invCodes); orderFilterRequest.setAction(bussinessTypeEntity.getAction()); - PageResult pageResult = orderMdService.findByPage(orderFilterRequest); - if (pageResult.getTotal() > 0) { - pageResult.getList().forEach(orderMdEntity -> { - orderMdEntity.setId(orderMdEntity.getOrderId()); + IPage page = orderService.filterList(orderFilterRequest); + if (page.getTotal() > 0) { + page.getRecords().forEach(orderMdEntity -> { + orderMdEntity.setOrderId(orderMdEntity.getOrderId()); orderMdEntity.setExportStatus(null); }); } - PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); - pageSimpleResponse.setTotal(pageResult.getTotal()); - pageSimpleResponse.setList(pageResult.getList()); + PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); + pageSimpleResponse.setTotal(page.getTotal()); + pageSimpleResponse.setList(page.getRecords()); return ResultVOUtils.success(pageSimpleResponse); } @@ -593,11 +592,11 @@ public class OrderController { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } AuthAdmin authAdmin = customerService.getUserBean(); - OrderMdEntity orderMdEntity = orderMdService.findByOne(updateExportStatusRequest.getOrderId()); + OrderMdEntity orderMdEntity = orderService.findByOne(updateExportStatusRequest.getOrderId()); orderMdEntity.setReceiveStatus(ConstantStatus.RECEIVE_ED); //验收状态修改为已验收 orderMdEntity.setReviewUser(authAdmin.getId().intValue()); orderMdEntity.setUpdateTime(new Date()); - orderMdService.updateOrder(orderMdEntity); + orderService.updateOrder(orderMdEntity); invProductsTrService.genInvProducts(orderMdEntity.getOrderId()); return ResultVOUtils.success("更新成功"); } diff --git a/src/main/java/com/glxp/udi/admin/controller/inout/StockQRCodeTextController.java b/src/main/java/com/glxp/udi/admin/controller/inout/StockQRCodeTextController.java index ad12daf..8728279 100644 --- a/src/main/java/com/glxp/udi/admin/controller/inout/StockQRCodeTextController.java +++ b/src/main/java/com/glxp/udi/admin/controller/inout/StockQRCodeTextController.java @@ -14,7 +14,7 @@ import com.glxp.udi.admin.entity.inventory.StockPrintTempEntity; import com.glxp.udi.admin.entity.mongo.OrderMdEntity; import com.glxp.udi.admin.entity.param.SystemPDFModuleEntity; import com.glxp.udi.admin.entity.param.SystemPDFTemplateEntity; -import com.glxp.udi.admin.mongo.service.OrderMdService; +import com.glxp.udi.admin.mongo.service.OrderService; import com.glxp.udi.admin.req.basic.FilterStockprintRequest; import com.glxp.udi.admin.req.inout.DeleteRequest; import com.glxp.udi.admin.req.inout.StockQRCodeTextFilterRequest; @@ -80,7 +80,7 @@ public class StockQRCodeTextController { @Resource private JaspaperService jaspaperService; @Resource - private OrderMdService orderMdService; + private OrderService orderService; @Resource private CustomerService customerService; @@ -300,7 +300,7 @@ public class StockQRCodeTextController { @PostMapping("/udiwms/pdf/template/inspection/stock/order/file") public BaseResponse inspectionStockOrderPDFFromTemplateFile( @RequestBody InspectionPDFTemplateRequest inspectionPDFTemplateRequest) { - OrderMdEntity orderMdEntity = orderMdService.findByOne(inspectionPDFTemplateRequest.getOrderId()); + OrderMdEntity orderMdEntity = orderService.findByOne(inspectionPDFTemplateRequest.getOrderId()); if (orderMdEntity == null) { return ResultVOUtils.error(ResultEnum.DATA_NOT, "未找到该订单"); } @@ -330,7 +330,7 @@ public class StockQRCodeTextController { return; } /*打印订单*/ - List list = orderMdService.listOrderPrint(stockQRCodeTextPDFTemplateRequest.getOrderId()); + List list = orderService.listOrderPrint(stockQRCodeTextPDFTemplateRequest.getOrderId()); if (list != null && list.size() > 0) { SystemPDFModuleEntity systemPDFModuleEntity = systemPDFModuleService.selectById(stockQRCodeTextPDFTemplateRequest.getModuleId() + ""); SystemPDFTemplateRelevanceRequest systemPDFTemplateRelevanceRequest = new SystemPDFTemplateRelevanceRequest(); diff --git a/src/main/java/com/glxp/udi/admin/controller/inout/UdiRelevanceController.java b/src/main/java/com/glxp/udi/admin/controller/inout/UdiRelevanceController.java index 1d77c98..9a22a08 100644 --- a/src/main/java/com/glxp/udi/admin/controller/inout/UdiRelevanceController.java +++ b/src/main/java/com/glxp/udi/admin/controller/inout/UdiRelevanceController.java @@ -3,12 +3,11 @@ package com.glxp.udi.admin.controller.inout; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.glxp.udi.admin.annotation.AuthRuleAnnotation; import com.glxp.udi.admin.common.res.BaseResponse; import com.glxp.udi.admin.entity.inout.UdiInfoEntity; import com.glxp.udi.admin.entity.inout.WarehouseEntity; -import com.glxp.udi.admin.mongo.service.InvProductMdService; +import com.glxp.udi.admin.mongo.service.InvProductService; import com.glxp.udi.admin.mongo.service.WarehouseMdService; import com.glxp.udi.admin.req.inout.DeleteRequest; import com.glxp.udi.admin.req.inout.FilterUdiInfoRequest; @@ -48,7 +47,7 @@ public class UdiRelevanceController { @Resource private UdiRelevanceService udiRelevanceService; @Resource - private InvProductMdService invProductMdService; + private InvProductService invProductService; @Resource private WarehouseMdService warehouseMdService; @@ -170,7 +169,7 @@ public class UdiRelevanceController { } UdiInfoEntity udiInfoEntity = udiInfoService.findById(combineRequest.getRelId()); if (combineRequest.getIsDisable()) { - Long count = invProductMdService.countByNamecode(udiInfoEntity.getNameCode(), authAdminService.getCurrentUserCustomerId()); + Long count = invProductService.countByNamecode(udiInfoEntity.getNameCode(), authAdminService.getCurrentUserCustomerId()); if (null != count && count > 0) { return ResultVOUtils.error(500, "库存已存在,无法禁用"); } diff --git a/src/main/java/com/glxp/udi/admin/controller/inout/UdiTraceController.java b/src/main/java/com/glxp/udi/admin/controller/inout/UdiTraceController.java index 00fd0a3..5e0b139 100644 --- a/src/main/java/com/glxp/udi/admin/controller/inout/UdiTraceController.java +++ b/src/main/java/com/glxp/udi/admin/controller/inout/UdiTraceController.java @@ -6,12 +6,13 @@ import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.glxp.udi.admin.common.res.BaseResponse; import com.glxp.udi.admin.entity.inout.InvProductDetailEntity; +import com.glxp.udi.admin.entity.inout.OrderEntity; import com.glxp.udi.admin.entity.inout.UdiInfoEntity; import com.glxp.udi.admin.entity.inout.WarehouseEntity; import com.glxp.udi.admin.entity.mongo.OrderMdEntity; import com.glxp.udi.admin.entity.udid.UdiEntity; import com.glxp.udi.admin.mongo.service.InvProductDetailMdService; -import com.glxp.udi.admin.mongo.service.OrderMdService; +import com.glxp.udi.admin.mongo.service.OrderService; import com.glxp.udi.admin.mongo.service.WarehouseMdService; import com.glxp.udi.admin.req.inout.FilterInvProductDetailRequest; import com.glxp.udi.admin.req.inout.OrderFilterRequest; @@ -42,7 +43,7 @@ public class UdiTraceController { @Resource private AuthAdminService authAdminService; @Resource - private OrderMdService orderMdService; + private OrderService orderService; @Resource private InvProductDetailMdService invProductDetailMdService; @@ -157,7 +158,7 @@ public class UdiTraceController { return ResultVOUtils.success(pageSimpleResponse); } - public List filterUdiTrace(WarehouseQueryRequest warehouseQueryRequest) { + public List filterUdiTrace(WarehouseQueryRequest warehouseQueryRequest) { String code = warehouseQueryRequest.getCode(); UdiEntity udiEntity = FilterUdiUtils.getUdi(code); List invProductDetailEntities; @@ -204,7 +205,7 @@ public class UdiTraceController { invProductDetailEntities = invProductDetailMdService.filterAllInvProduct(filterInvProductDetailRequest); } if (invProductDetailEntities != null && invProductDetailEntities.size() > 0) { - List orderMdEntities = new ArrayList<>(); + List orderEntities = new ArrayList<>(); List orderS = new ArrayList<>(); invProductDetailEntities.stream().filter( v -> { @@ -220,11 +221,11 @@ public class UdiTraceController { for (String orderId : orderS) { OrderFilterRequest orderFilterRequest = new OrderFilterRequest(); orderFilterRequest.setId(orderId); - List temps = orderMdService.findAll(orderFilterRequest); - orderMdEntities.addAll(temps); + List temps = orderService.findAll(orderFilterRequest); + orderEntities.addAll(temps); } - orderMdEntities.sort(Comparator.comparing(OrderMdEntity::getId)); - return orderMdEntities; + orderEntities.sort(Comparator.comparing(OrderEntity::getOrderId)); + return orderEntities; } else { return null; } diff --git a/src/main/java/com/glxp/udi/admin/controller/inout/WareHouseController.java b/src/main/java/com/glxp/udi/admin/controller/inout/WareHouseController.java index 6030add..21d0417 100644 --- a/src/main/java/com/glxp/udi/admin/controller/inout/WareHouseController.java +++ b/src/main/java/com/glxp/udi/admin/controller/inout/WareHouseController.java @@ -9,8 +9,10 @@ import com.glxp.udi.admin.constant.ConstantStatus; import com.glxp.udi.admin.entity.auth.AuthAdmin; import com.glxp.udi.admin.entity.inout.*; import com.glxp.udi.admin.entity.mongo.OrderMdEntity; +import com.glxp.udi.admin.entity.mongo.WarehouseMdEntity; +import com.glxp.udi.admin.entity.mongo.WarehousetempMdEntity; import com.glxp.udi.admin.entity.udid.UdiEntity; -import com.glxp.udi.admin.mongo.service.OrderMdService; +import com.glxp.udi.admin.mongo.service.OrderService; import com.glxp.udi.admin.mongo.service.WarehouseMdService; import com.glxp.udi.admin.mongo.service.WarehouseTempMdService; import com.glxp.udi.admin.mongo.utils.PageResult; @@ -54,7 +56,7 @@ public class WareHouseController { @Resource private WarehouseTempMdService warehouseTempMdService; @Resource - private OrderMdService orderMdService; + private OrderService orderService; @Resource private UdiInfoService udiInfoService; @@ -71,8 +73,8 @@ public class WareHouseController { @GetMapping("admin/warehouse/inout/findByOrderId") public BaseResponse findByOrderId(WarehouseQueryRequest warehouseQueryRequest) { - PageResult pageResult = warehouseMdService.filterWarehouseByPage(warehouseQueryRequest); - PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); + PageResult pageResult = warehouseMdService.filterWarehouseByPage(warehouseQueryRequest); + PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); pageSimpleResponse.setTotal(pageResult.getTotal()); pageSimpleResponse.setList(pageResult.getList()); return ResultVOUtils.success(pageSimpleResponse); @@ -80,8 +82,8 @@ public class WareHouseController { @GetMapping("admin/warehouse/inout/findErrorByOrderId") public BaseResponse findErrorByOrderId(WarehouseQueryRequest warehouseQueryRequest) { - PageResult pageResult = warehouseTempMdService.filterWarehouseByPage(warehouseQueryRequest); - PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); + PageResult pageResult = warehouseTempMdService.filterWarehouseByPage(warehouseQueryRequest); + PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); pageSimpleResponse.setTotal(pageResult.getTotal()); pageSimpleResponse.setList(pageResult.getList()); return ResultVOUtils.success(pageSimpleResponse); @@ -90,7 +92,7 @@ public class WareHouseController { @AuthRuleAnnotation("") @GetMapping("warehouse/inout/deleteCodesTempById") public BaseResponse deleteCodesTempById(String id) { - WarehousetempEntity warehousetemp = warehouseTempMdService.findTempById(id); + WarehousetempMdEntity warehousetemp = warehouseTempMdService.findTempById(id); if (null == warehousetemp) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); } @@ -102,8 +104,8 @@ public class WareHouseController { warehouseTempMdService.deleteTempWarehouses(Collections.singletonList(warehousetemp.getId())); } - List tempByOrderId = warehouseTempMdService.findTempByOrderId(warehousetemp.getOrderId()); - if (tempByOrderId.size() <= 0) { + List tempByOrderId = warehouseTempMdService.findTempByOrderId(warehousetemp.getOrderId()); + if (tempByOrderId.size() == 0) { DeleteRequest deleteRequest = new DeleteRequest(); deleteRequest.setOrderId(warehousetemp.getOrderId()); warehouseTempMdService.deleteCode(deleteRequest); @@ -197,8 +199,8 @@ public class WareHouseController { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } - OrderMdEntity orderMdEntity = orderMdService.findByOne(commitRequest.getOrderId()); - transInoutService.transInout(orderMdEntity); + OrderEntity orderEntity = orderService.findByOne(commitRequest.getOrderId()); + transInoutService.transInout(orderEntity); return ResultVOUtils.success("提交成功"); } @@ -216,9 +218,9 @@ public class WareHouseController { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } - OrderMdEntity orderEntity = orderMdService.findByOne(commitRequest.getOrderId()); + OrderMdEntity orderEntity = orderService.findByOne(commitRequest.getOrderId()); orderEntity.setStatus(ConstantStatus.ORDER_STATUS_WAIT); - orderMdService.updateOrder(orderEntity); + orderService.updateOrder(orderEntity); return ResultVOUtils.success("提交成功"); } @@ -231,8 +233,8 @@ public class WareHouseController { @AuthRuleAnnotation("") @GetMapping("spms/inout/dlcode/findByOrderId") public BaseResponse downloadCodesByOrderId(WarehouseQueryRequest warehouseQueryRequest) { - PageResult pageResult = warehouseMdService.findOrdersById(warehouseQueryRequest); - PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); + PageResult pageResult = warehouseMdService.findOrdersById(warehouseQueryRequest); + PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); pageSimpleResponse.setTotal(pageResult.getTotal()); pageSimpleResponse.setList(pageResult.getList()); return ResultVOUtils.success(pageSimpleResponse); diff --git a/src/main/java/com/glxp/udi/admin/controller/inventory/InvWarehouseController.java b/src/main/java/com/glxp/udi/admin/controller/inventory/InvWarehouseController.java index da77ef4..eecf7f4 100644 --- a/src/main/java/com/glxp/udi/admin/controller/inventory/InvWarehouseController.java +++ b/src/main/java/com/glxp/udi/admin/controller/inventory/InvWarehouseController.java @@ -8,7 +8,7 @@ import com.glxp.udi.admin.entity.auth.AuthAdmin; import com.glxp.udi.admin.entity.inout.WarehouseBussinessTypeEntity; import com.glxp.udi.admin.entity.inventory.InvWarehouseEntity; import com.glxp.udi.admin.entity.param.SystemParamConfigEntity; -import com.glxp.udi.admin.mongo.service.InvProductMdService; +import com.glxp.udi.admin.mongo.service.InvProductService; import com.glxp.udi.admin.req.info.DeleteRequest; import com.glxp.udi.admin.req.inventory.FilterInvWarehouseRequest; import com.glxp.udi.admin.res.inventory.InvWarehouseExportResponse; @@ -47,7 +47,7 @@ public class InvWarehouseController { @Resource private WarehouseBussinessTypeService warehouseBussinessTypeService; @Resource - private InvProductMdService invProductMdService; + private InvProductService invProductService; @AuthRuleAnnotation("") @GetMapping("spms/inv/warehouse/filter") @@ -214,7 +214,7 @@ public class InvWarehouseController { } InvWarehouseEntity invWarehouseEntity = invWarehouseService.selectById(deleteRequest.getId()); - boolean exist = invProductMdService.isExist(invWarehouseEntity.getCode()); + boolean exist = invProductService.isExist(invWarehouseEntity.getCode()); if (exist) { return ResultVOUtils.error(500, "该仓库已有库存,不能删除!"); } diff --git a/src/main/java/com/glxp/udi/admin/dao/inout/OrderDao.java b/src/main/java/com/glxp/udi/admin/dao/inout/OrderDao.java index 6039cad..9e0e9be 100644 --- a/src/main/java/com/glxp/udi/admin/dao/inout/OrderDao.java +++ b/src/main/java/com/glxp/udi/admin/dao/inout/OrderDao.java @@ -2,7 +2,11 @@ package com.glxp.udi.admin.dao.inout; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.glxp.udi.admin.entity.inout.OrderEntity; +import com.glxp.udi.admin.res.inout.OrderNoResult; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 单据数据接口 @@ -10,4 +14,27 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface OrderDao extends BaseMapper { + /** + * 更新单据创建时间 + * + * @param actDate + * @param orderIds + */ + void updateActDate(@Param("actDate") String actDate, @Param("orderIds") List orderIds); + + /** + * 查询单据关联的单据号数据 + * + * @param orderId + * @return + */ + OrderNoResult selectNos(String orderId); + + /** + * 更新复制单号 + * + * @param replicateNo + * @param orderId + */ + void updateReplicateNo(@Param("replicateNo") String replicateNo, @Param("orderId") String orderId); } diff --git a/src/main/java/com/glxp/udi/admin/entity/inout/InvProductDetailEntity.java b/src/main/java/com/glxp/udi/admin/entity/inout/InvProductDetailEntity.java index 2ca3e2e..adedf37 100644 --- a/src/main/java/com/glxp/udi/admin/entity/inout/InvProductDetailEntity.java +++ b/src/main/java/com/glxp/udi/admin/entity/inout/InvProductDetailEntity.java @@ -1,13 +1,18 @@ package com.glxp.udi.admin.entity.inout; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.util.Date; @Data +@TableName("io_inv_product_detail") public class InvProductDetailEntity { + @TableId(type = IdType.AUTO) private String id; /** diff --git a/src/main/java/com/glxp/udi/admin/entity/inout/InvProductEntity.java b/src/main/java/com/glxp/udi/admin/entity/inout/InvProductEntity.java index 7d6c455..666ef62 100644 --- a/src/main/java/com/glxp/udi/admin/entity/inout/InvProductEntity.java +++ b/src/main/java/com/glxp/udi/admin/entity/inout/InvProductEntity.java @@ -1,10 +1,15 @@ package com.glxp.udi.admin.entity.inout; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @Data +@TableName("io_inv_product") public class InvProductEntity { + @TableId(type = IdType.AUTO) private String id; /** diff --git a/src/main/java/com/glxp/udi/admin/entity/inout/OrderDetailEntity.java b/src/main/java/com/glxp/udi/admin/entity/inout/OrderDetailEntity.java index 65cd724..b187d72 100644 --- a/src/main/java/com/glxp/udi/admin/entity/inout/OrderDetailEntity.java +++ b/src/main/java/com/glxp/udi/admin/entity/inout/OrderDetailEntity.java @@ -1,12 +1,17 @@ package com.glxp.udi.admin.entity.inout; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import java.math.BigDecimal; @Data +@TableName("io_order_detail") public class OrderDetailEntity { + @TableId(type = IdType.AUTO) private String id; /** diff --git a/src/main/java/com/glxp/udi/admin/entity/inout/OrderEntity.java b/src/main/java/com/glxp/udi/admin/entity/inout/OrderEntity.java index 111732b..16cf988 100644 --- a/src/main/java/com/glxp/udi/admin/entity/inout/OrderEntity.java +++ b/src/main/java/com/glxp/udi/admin/entity/inout/OrderEntity.java @@ -3,16 +3,18 @@ package com.glxp.udi.admin.entity.inout; import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.util.Date; @Data +@TableName("io_order") public class OrderEntity { - private String id; - + @TableId private String orderId; private String action; diff --git a/src/main/java/com/glxp/udi/admin/entity/inout/WarehouseEntity.java b/src/main/java/com/glxp/udi/admin/entity/inout/WarehouseEntity.java index 807295f..c7b9300 100644 --- a/src/main/java/com/glxp/udi/admin/entity/inout/WarehouseEntity.java +++ b/src/main/java/com/glxp/udi/admin/entity/inout/WarehouseEntity.java @@ -1,10 +1,15 @@ package com.glxp.udi.admin.entity.inout; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @Data +@TableName("io_codes") public class WarehouseEntity { + @TableId(type = IdType.AUTO) private String id; /** diff --git a/src/main/java/com/glxp/udi/admin/entity/inout/WarehousetempEntity.java b/src/main/java/com/glxp/udi/admin/entity/inout/WarehousetempEntity.java index 562a516..be4d241 100644 --- a/src/main/java/com/glxp/udi/admin/entity/inout/WarehousetempEntity.java +++ b/src/main/java/com/glxp/udi/admin/entity/inout/WarehousetempEntity.java @@ -1,10 +1,15 @@ package com.glxp.udi.admin.entity.inout; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @Data +@TableName("io_codes_temp") public class WarehousetempEntity { + @TableId(type = IdType.AUTO) private String id; /** diff --git a/src/main/java/com/glxp/udi/admin/entity/mongo/InvProductDetailEntity.java b/src/main/java/com/glxp/udi/admin/entity/mongo/InvProductDetailMdEntity.java similarity index 94% rename from src/main/java/com/glxp/udi/admin/entity/mongo/InvProductDetailEntity.java rename to src/main/java/com/glxp/udi/admin/entity/mongo/InvProductDetailMdEntity.java index b9aebb0..70b613f 100644 --- a/src/main/java/com/glxp/udi/admin/entity/mongo/InvProductDetailEntity.java +++ b/src/main/java/com/glxp/udi/admin/entity/mongo/InvProductDetailMdEntity.java @@ -6,7 +6,7 @@ import lombok.Data; import java.util.Date; @Data -public class InvProductDetailEntity { +public class InvProductDetailMdEntity { private String id; private String code; diff --git a/src/main/java/com/glxp/udi/admin/entity/mongo/InvProductEntity.java b/src/main/java/com/glxp/udi/admin/entity/mongo/InvProductMdEntity.java similarity index 96% rename from src/main/java/com/glxp/udi/admin/entity/mongo/InvProductEntity.java rename to src/main/java/com/glxp/udi/admin/entity/mongo/InvProductMdEntity.java index a63868e..4a59c1f 100644 --- a/src/main/java/com/glxp/udi/admin/entity/mongo/InvProductEntity.java +++ b/src/main/java/com/glxp/udi/admin/entity/mongo/InvProductMdEntity.java @@ -3,7 +3,7 @@ package com.glxp.udi.admin.entity.mongo; import lombok.Data; @Data -public class InvProductEntity { +public class InvProductMdEntity { private String id; private String productsName; diff --git a/src/main/java/com/glxp/udi/admin/entity/mongo/WarehouseEntity.java b/src/main/java/com/glxp/udi/admin/entity/mongo/WarehouseMdEntity.java similarity index 97% rename from src/main/java/com/glxp/udi/admin/entity/mongo/WarehouseEntity.java rename to src/main/java/com/glxp/udi/admin/entity/mongo/WarehouseMdEntity.java index 7f7c2d2..674da94 100644 --- a/src/main/java/com/glxp/udi/admin/entity/mongo/WarehouseEntity.java +++ b/src/main/java/com/glxp/udi/admin/entity/mongo/WarehouseMdEntity.java @@ -3,7 +3,7 @@ package com.glxp.udi.admin.entity.mongo; import lombok.Data; @Data -public class WarehouseEntity { +public class WarehouseMdEntity { private String id; private String action; diff --git a/src/main/java/com/glxp/udi/admin/entity/mongo/WarehousetempEntity.java b/src/main/java/com/glxp/udi/admin/entity/mongo/WarehousetempMdEntity.java similarity index 96% rename from src/main/java/com/glxp/udi/admin/entity/mongo/WarehousetempEntity.java rename to src/main/java/com/glxp/udi/admin/entity/mongo/WarehousetempMdEntity.java index eed125b..de78299 100644 --- a/src/main/java/com/glxp/udi/admin/entity/mongo/WarehousetempEntity.java +++ b/src/main/java/com/glxp/udi/admin/entity/mongo/WarehousetempMdEntity.java @@ -3,7 +3,7 @@ package com.glxp.udi.admin.entity.mongo; import lombok.Data; @Data -public class WarehousetempEntity { +public class WarehousetempMdEntity { private String action; private String mainAction; diff --git a/src/main/java/com/glxp/udi/admin/mongo/dao/CodesDao.java b/src/main/java/com/glxp/udi/admin/mongo/dao/CodesMdDao.java similarity index 93% rename from src/main/java/com/glxp/udi/admin/mongo/dao/CodesDao.java rename to src/main/java/com/glxp/udi/admin/mongo/dao/CodesMdDao.java index ccd2f52..4911ebf 100644 --- a/src/main/java/com/glxp/udi/admin/mongo/dao/CodesDao.java +++ b/src/main/java/com/glxp/udi/admin/mongo/dao/CodesMdDao.java @@ -3,6 +3,7 @@ package com.glxp.udi.admin.mongo.dao; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ReflectUtil; import com.glxp.udi.admin.entity.inout.WarehouseEntity; +import com.glxp.udi.admin.entity.mongo.WarehouseMdEntity; import com.glxp.udi.admin.mongo.MongoDBName; import com.glxp.udi.admin.mongo.dao.base.MongoBaseDao; import com.glxp.udi.admin.mongo.utils.MongoPageHelper; @@ -20,7 +21,7 @@ import java.util.Arrays; import java.util.List; @Component -public class CodesDao implements MongoBaseDao { +public class CodesMdDao implements MongoBaseDao { @Resource private MongoTemplate mongoTemplate; @@ -142,5 +143,9 @@ public class CodesDao implements MongoBaseDao getCodesList() { + List all = mongoTemplate.findAll(WarehouseMdEntity.class, MongoDBName.NAME_ORDER); + return all; + } } diff --git a/src/main/java/com/glxp/udi/admin/mongo/dao/CodesTempDao.java b/src/main/java/com/glxp/udi/admin/mongo/dao/CodesTempMdDao.java similarity index 94% rename from src/main/java/com/glxp/udi/admin/mongo/dao/CodesTempDao.java rename to src/main/java/com/glxp/udi/admin/mongo/dao/CodesTempMdDao.java index 5b092fa..b793dd3 100644 --- a/src/main/java/com/glxp/udi/admin/mongo/dao/CodesTempDao.java +++ b/src/main/java/com/glxp/udi/admin/mongo/dao/CodesTempMdDao.java @@ -3,6 +3,7 @@ package com.glxp.udi.admin.mongo.dao; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ReflectUtil; import com.glxp.udi.admin.entity.inout.WarehousetempEntity; +import com.glxp.udi.admin.entity.mongo.WarehousetempMdEntity; import com.glxp.udi.admin.mongo.MongoDBName; import com.glxp.udi.admin.mongo.dao.base.MongoBaseDao; import com.glxp.udi.admin.mongo.utils.MongoPageHelper; @@ -20,7 +21,7 @@ import java.util.Arrays; import java.util.List; @Component -public class CodesTempDao implements MongoBaseDao { +public class CodesTempMdDao implements MongoBaseDao { @Resource private MongoTemplate mongoTemplate; @@ -141,4 +142,8 @@ public class CodesTempDao implements MongoBaseDao getCodesTempList() { + return mongoTemplate.findAll(WarehousetempMdEntity.class, MongoDBName.NAME_CODE_TEMP); + } + } diff --git a/src/main/java/com/glxp/udi/admin/mongo/dao/InvProductDetailDao.java b/src/main/java/com/glxp/udi/admin/mongo/dao/InvProductDetailMdDao.java similarity index 92% rename from src/main/java/com/glxp/udi/admin/mongo/dao/InvProductDetailDao.java rename to src/main/java/com/glxp/udi/admin/mongo/dao/InvProductDetailMdDao.java index c4bc21b..f5c73e2 100644 --- a/src/main/java/com/glxp/udi/admin/mongo/dao/InvProductDetailDao.java +++ b/src/main/java/com/glxp/udi/admin/mongo/dao/InvProductDetailMdDao.java @@ -3,6 +3,7 @@ package com.glxp.udi.admin.mongo.dao; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ReflectUtil; import com.glxp.udi.admin.entity.inout.InvProductDetailEntity; +import com.glxp.udi.admin.entity.mongo.InvProductDetailMdEntity; import com.glxp.udi.admin.mongo.MongoDBName; import com.glxp.udi.admin.mongo.dao.base.MongoBaseDao; import com.glxp.udi.admin.mongo.utils.MongoPageHelper; @@ -20,7 +21,7 @@ import java.util.Arrays; import java.util.List; @Component -public class InvProductDetailDao implements MongoBaseDao { +public class InvProductDetailMdDao implements MongoBaseDao { @Resource private MongoTemplate mongoTemplate; @@ -152,5 +153,10 @@ public class InvProductDetailDao implements MongoBaseDao getInvDetailList(String invProductId) { + Query query = new Query(); + query.addCriteria(Criteria.where("invProductIdFk").is(invProductId)); + return mongoTemplate.find(query, InvProductDetailMdEntity.class, MongoDBName.NAME_INV_PRODUCT_DETAIL); + } } diff --git a/src/main/java/com/glxp/udi/admin/mongo/dao/InvProductDao.java b/src/main/java/com/glxp/udi/admin/mongo/dao/InvProductMdDao.java similarity index 95% rename from src/main/java/com/glxp/udi/admin/mongo/dao/InvProductDao.java rename to src/main/java/com/glxp/udi/admin/mongo/dao/InvProductMdDao.java index 249b8f1..e9546ac 100644 --- a/src/main/java/com/glxp/udi/admin/mongo/dao/InvProductDao.java +++ b/src/main/java/com/glxp/udi/admin/mongo/dao/InvProductMdDao.java @@ -3,6 +3,7 @@ package com.glxp.udi.admin.mongo.dao; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ReflectUtil; import com.glxp.udi.admin.entity.inout.InvProductEntity; +import com.glxp.udi.admin.entity.mongo.InvProductMdEntity; import com.glxp.udi.admin.mongo.MongoDBName; import com.glxp.udi.admin.mongo.dao.base.MongoBaseDao; import com.glxp.udi.admin.mongo.utils.MongoPageHelper; @@ -21,7 +22,7 @@ import java.util.List; import java.util.regex.Pattern; @Component -public class InvProductDao implements MongoBaseDao { +public class InvProductMdDao implements MongoBaseDao { @Resource private MongoTemplate mongoTemplate; @@ -179,4 +180,8 @@ public class InvProductDao implements MongoBaseDao getInvList() { + return mongoTemplate.findAll(InvProductMdEntity.class, MongoDBName.NAME_INV_PRODUCT); + } + } diff --git a/src/main/java/com/glxp/udi/admin/mongo/dao/OrderDetailDao.java b/src/main/java/com/glxp/udi/admin/mongo/dao/OrderDetailMdDao.java similarity index 74% rename from src/main/java/com/glxp/udi/admin/mongo/dao/OrderDetailDao.java rename to src/main/java/com/glxp/udi/admin/mongo/dao/OrderDetailMdDao.java index ef0eb2d..0d90822 100644 --- a/src/main/java/com/glxp/udi/admin/mongo/dao/OrderDetailDao.java +++ b/src/main/java/com/glxp/udi/admin/mongo/dao/OrderDetailMdDao.java @@ -3,11 +3,12 @@ package com.glxp.udi.admin.mongo.dao; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ReflectUtil; import com.glxp.udi.admin.entity.inout.OrderDetailEntity; +import com.glxp.udi.admin.entity.mongo.ErpOrderEntity; import com.glxp.udi.admin.mongo.MongoDBName; import com.glxp.udi.admin.mongo.dao.base.MongoBaseDao; import com.glxp.udi.admin.mongo.utils.MongoPageHelper; import com.glxp.udi.admin.mongo.utils.PageResult; -import com.glxp.udi.admin.req.inout.FilterErpOrderRequest; +import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest; import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; @@ -20,7 +21,7 @@ import java.util.Arrays; import java.util.List; @Component -public class OrderDetailDao implements MongoBaseDao { +public class OrderDetailMdDao implements MongoBaseDao { @Resource private MongoTemplate mongoTemplate; @@ -29,25 +30,25 @@ public class OrderDetailDao implements MongoBaseDao pageQuery(Query query, FilterErpOrderRequest filterErpOrderRequest, int page, int size) { - if (null == query && null != filterErpOrderRequest) { - query = buildQuery(filterErpOrderRequest); + public PageResult pageQuery(Query query, FilterOrderDetailRequest filterOrderDetailRequest, int page, int size) { + if (null == query && null != filterOrderDetailRequest) { + query = buildQuery(filterOrderDetailRequest); } return mongoPageHelper.pageQuery(query, OrderDetailEntity.class, size, page, MongoDBName.NAME_ORDER_DETAIL); } @Override - public List findList(Query query, FilterErpOrderRequest filterErpOrderRequest) { - if (null == query && null != filterErpOrderRequest) { - query = buildQuery(filterErpOrderRequest); + public List findList(Query query, FilterOrderDetailRequest filterOrderDetailRequest) { + if (null == query && null != filterOrderDetailRequest) { + query = buildQuery(filterOrderDetailRequest); } return mongoTemplate.find(query, OrderDetailEntity.class, MongoDBName.NAME_ORDER_DETAIL); } @Override - public OrderDetailEntity findOne(Query query, FilterErpOrderRequest filterErpOrderRequest) { - if (null == query && null != filterErpOrderRequest) { - query = buildQuery(filterErpOrderRequest); + public OrderDetailEntity findOne(Query query, FilterOrderDetailRequest filterOrderDetailRequest) { + if (null == query && null != filterOrderDetailRequest) { + query = buildQuery(filterOrderDetailRequest); } return mongoTemplate.findOne(query, OrderDetailEntity.class, MongoDBName.NAME_ORDER_DETAIL); } @@ -64,17 +65,17 @@ public class OrderDetailDao implements MongoBaseDao { - Object fieldValue = ReflectUtil.getFieldValue(filterErpOrderRequest, field); + Object fieldValue = ReflectUtil.getFieldValue(filterOrderDetailRequest, field); if (ObjectUtil.isNotEmpty(fieldValue)) { if ("orderId".equals(field.getName())) { query.addCriteria(Criteria.where("orderIdFk").is(fieldValue)); @@ -154,4 +155,8 @@ public class OrderDetailDao implements MongoBaseDao getOrderDetailList() { + return mongoTemplate.findAll(ErpOrderEntity.class, MongoDBName.NAME_ORDER_DETAIL); + } + } diff --git a/src/main/java/com/glxp/udi/admin/mongo/dao/OrderDao.java b/src/main/java/com/glxp/udi/admin/mongo/dao/OrderMdDao.java similarity index 96% rename from src/main/java/com/glxp/udi/admin/mongo/dao/OrderDao.java rename to src/main/java/com/glxp/udi/admin/mongo/dao/OrderMdDao.java index c863a32..1617d12 100644 --- a/src/main/java/com/glxp/udi/admin/mongo/dao/OrderDao.java +++ b/src/main/java/com/glxp/udi/admin/mongo/dao/OrderMdDao.java @@ -23,7 +23,7 @@ import java.util.List; * 订单数据操作类 */ @Component -public class OrderDao implements MongoBaseDao { +public class OrderMdDao implements MongoBaseDao { @Resource private MongoTemplate mongoTemplate; @@ -177,4 +177,10 @@ public class OrderDao implements MongoBaseDao } return update; } + + public List getOrderList() { + return mongoTemplate.findAll(OrderMdEntity.class, MongoDBName.NAME_ORDER); + } + + } diff --git a/src/main/java/com/glxp/udi/admin/mongo/service/InvProductMdService.java b/src/main/java/com/glxp/udi/admin/mongo/service/InvProductService.java similarity index 99% rename from src/main/java/com/glxp/udi/admin/mongo/service/InvProductMdService.java rename to src/main/java/com/glxp/udi/admin/mongo/service/InvProductService.java index 24f4a20..d8855a9 100644 --- a/src/main/java/com/glxp/udi/admin/mongo/service/InvProductMdService.java +++ b/src/main/java/com/glxp/udi/admin/mongo/service/InvProductService.java @@ -18,7 +18,7 @@ import java.util.List; import java.util.regex.Pattern; @Service -public class InvProductMdService { +public class InvProductService { @Resource private MongoTemplate mongoTemplate; diff --git a/src/main/java/com/glxp/udi/admin/mongo/service/OrderDetailMdService.java b/src/main/java/com/glxp/udi/admin/mongo/service/OrderDetailMdService.java deleted file mode 100644 index 7683ab9..0000000 --- a/src/main/java/com/glxp/udi/admin/mongo/service/OrderDetailMdService.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.glxp.udi.admin.mongo.service; - -import cn.hutool.core.util.StrUtil; -import com.glxp.udi.admin.entity.inout.OrderDetailEntity; -import com.glxp.udi.admin.mongo.MongoDBName; -import com.glxp.udi.admin.req.inout.DeleteRequest; -import com.glxp.udi.admin.req.inout.FilterErpOrderRequest; -import org.springframework.data.mongodb.core.MongoTemplate; -import org.springframework.data.mongodb.core.query.Criteria; -import org.springframework.data.mongodb.core.query.Query; -import org.springframework.data.mongodb.core.query.Update; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -@Service -public class OrderDetailMdService { - - @Resource - private MongoTemplate mongoTemplate; - - public List filterOrderDetails(FilterErpOrderRequest filterErpOrderRequest) { - Query query = new Query(); - if (filterErpOrderRequest.getOrderId() != null && !filterErpOrderRequest.getOrderId().isEmpty()) { - query.addCriteria(Criteria.where("orderIdFk").is(filterErpOrderRequest.getOrderId())); - } - if (StrUtil.isNotBlank(filterErpOrderRequest.getOrderIdFk())) { - query.addCriteria(Criteria.where("orderIdFk").is(filterErpOrderRequest.getOrderIdFk())); - } - if (filterErpOrderRequest.getCustomerId() != null) { - query.addCriteria(Criteria.where("customerId").is(filterErpOrderRequest.getCustomerId())); - } - if (StrUtil.isNotBlank(filterErpOrderRequest.getUuidFk())) { - query.addCriteria(Criteria.where("uuidFk").is(filterErpOrderRequest.getUuidFk())); - } - if (StrUtil.isNotBlank(filterErpOrderRequest.getLotno())) { - query.addCriteria(Criteria.where("lotno").is(filterErpOrderRequest.getLotno())); - } - return mongoTemplate.find(query, OrderDetailEntity.class, MongoDBName.NAME_ORDER_DETAIL); - } - - public void insertOrderDetail(List erpOrderEntities) { - if (erpOrderEntities != null) { - Collection warehouseEntityCollection = new ArrayList<>(); - warehouseEntityCollection.addAll(erpOrderEntities); - mongoTemplate.insert(warehouseEntityCollection, MongoDBName.NAME_ORDER_DETAIL); - } - } - - public void deleteOrderDetail(DeleteRequest deleteRequest) { - Query query = new Query(); - if (deleteRequest.getId() != null) { - query.addCriteria(Criteria.where("id").is(deleteRequest.getId())); - } - if (deleteRequest.getOrderId() != null) { - query.addCriteria(Criteria.where("orderIdFk").is(deleteRequest.getOrderId())); - } - mongoTemplate.remove(query, OrderDetailEntity.class, MongoDBName.NAME_ORDER_DETAIL); - } - - public void updateOrderDetail(OrderDetailEntity orderDetailEntity) { - Query query = new Query(); - query.addCriteria(new Criteria().and("_id").is(orderDetailEntity.getId())); - Update update = new Update(); - - if (orderDetailEntity.getCount() != null) { - update.set("count", orderDetailEntity.getCount()); - } - if (orderDetailEntity.getReCount() != null) { - update.set("reCount", orderDetailEntity.getReCount()); - } - - //更新发票号等字段 - update.set("firstSalesInvNo", orderDetailEntity.getFirstSalesInvNo()); - update.set("secSalesInvNo", orderDetailEntity.getSecSalesInvNo()); - update.set("secSalesListNo", orderDetailEntity.getSecSalesListNo()); - update.set("invoiceDate", orderDetailEntity.getInvoiceDate()); - if (null != orderDetailEntity.getPrice()) { - update.set("price", orderDetailEntity.getPrice()); - } - - mongoTemplate.updateMulti(query, update, MongoDBName.NAME_ORDER_DETAIL); - } - - public long statCount(String orderId) { - Query query = new Query(); - query.addCriteria(Criteria.where("orderIdFk").is(orderId)); - return mongoTemplate.count(query, MongoDBName.NAME_ORDER_DETAIL); - } -} diff --git a/src/main/java/com/glxp/udi/admin/mongo/service/OrderDetailService.java b/src/main/java/com/glxp/udi/admin/mongo/service/OrderDetailService.java new file mode 100644 index 0000000..142705f --- /dev/null +++ b/src/main/java/com/glxp/udi/admin/mongo/service/OrderDetailService.java @@ -0,0 +1,70 @@ +package com.glxp.udi.admin.mongo.service; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.glxp.udi.admin.dao.inout.OrderDetailDao; +import com.glxp.udi.admin.entity.inout.OrderDetailEntity; +import com.glxp.udi.admin.req.inout.DeleteRequest; +import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +@Service +public class OrderDetailService { + + @Resource + private MongoTemplate mongoTemplate; + @Resource + private OrderDetailDao orderDetailDao; + + public List filterOrderDetails(FilterOrderDetailRequest orderDetailRequest) { + QueryWrapper wrapper = buildDetailQueryWrapper(orderDetailRequest); + return orderDetailDao.selectList(wrapper); + } + + public void insertOrderDetail(List orderDetailEntities) { + if (CollUtil.isNotEmpty(orderDetailEntities)) { + for (OrderDetailEntity orderDetailEntity : orderDetailEntities) { + orderDetailDao.insert(orderDetailEntity); + } + } + } + + public void deleteOrderDetail(DeleteRequest deleteRequest) { + QueryWrapper deleteWrapper = new QueryWrapper<>(); + deleteWrapper.eq(StrUtil.isNotBlank(deleteRequest.getId()), "id", deleteRequest.getId()) + .eq(StrUtil.isNotBlank(deleteRequest.getOrderId()), "orderIdFk", deleteRequest.getOrderId()); + orderDetailDao.delete(deleteWrapper); + } + + public void updateOrderDetail(OrderDetailEntity orderDetailEntity) { + orderDetailDao.updateById(orderDetailEntity); + } + + public long statCount(String orderId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("orderIdFk", orderId); + return orderDetailDao.selectCount(wrapper); + } + + /** + * 构造单据详情查询条件 + * + * @param orderDetailRequest + * @return + */ + private static QueryWrapper buildDetailQueryWrapper(FilterOrderDetailRequest orderDetailRequest) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StrUtil.isNotBlank(orderDetailRequest.getOrderId()), "orderIdFk", orderDetailRequest.getOrderId()) + .eq(StrUtil.isNotBlank(orderDetailRequest.getOrderIdFk()), "orderIdFk", orderDetailRequest.getOrderIdFk()) + .eq(null != orderDetailRequest.getCustomerId(), "customerId", orderDetailRequest.getCustomerId()) + .eq(StrUtil.isNotBlank(orderDetailRequest.getUuidFk()), "uuidFk", orderDetailRequest.getUuidFk()) + .eq(StrUtil.isNotBlank(orderDetailRequest.getLotno()), "batchNo", orderDetailRequest.getLotno()); + return wrapper; + } + +} diff --git a/src/main/java/com/glxp/udi/admin/mongo/service/OrderMdService.java b/src/main/java/com/glxp/udi/admin/mongo/service/OrderService.java similarity index 56% rename from src/main/java/com/glxp/udi/admin/mongo/service/OrderMdService.java rename to src/main/java/com/glxp/udi/admin/mongo/service/OrderService.java index 2a6b052..16425b7 100644 --- a/src/main/java/com/glxp/udi/admin/mongo/service/OrderMdService.java +++ b/src/main/java/com/glxp/udi/admin/mongo/service/OrderService.java @@ -4,12 +4,16 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ReflectUtil; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.glxp.udi.admin.common.res.BaseResponse; import com.glxp.udi.admin.constant.ConstantStatus; import com.glxp.udi.admin.constant.ConstantType; import com.glxp.udi.admin.constant.SystemParamConstant; import com.glxp.udi.admin.dao.auth.CustomerInfoDao; import com.glxp.udi.admin.dao.basic.BussinessTypeDao; +import com.glxp.udi.admin.dao.inout.OrderDao; import com.glxp.udi.admin.dao.inout.UdiInfoDao; import com.glxp.udi.admin.dao.inout.UnitMaintainDao; import com.glxp.udi.admin.dao.inventory.InvWarehouseDao; @@ -17,19 +21,18 @@ import com.glxp.udi.admin.entity.auth.CustomerInfoEntity; import com.glxp.udi.admin.entity.basic.BussinessTypeEntity; import com.glxp.udi.admin.entity.inout.*; import com.glxp.udi.admin.entity.mongo.OrderMdEntity; +import com.glxp.udi.admin.entity.mongo.WarehouseMdEntity; +import com.glxp.udi.admin.entity.mongo.WarehousetempMdEntity; import com.glxp.udi.admin.entity.param.SystemParamConfigEntity; import com.glxp.udi.admin.mongo.MongoDBName; -import com.glxp.udi.admin.mongo.dao.OrderDao; -import com.glxp.udi.admin.mongo.utils.MongoPageHelper; -import com.glxp.udi.admin.mongo.utils.PageResult; +import com.glxp.udi.admin.mongo.dao.OrderMdDao; import com.glxp.udi.admin.req.inout.DeleteRequest; -import com.glxp.udi.admin.req.inout.FilterErpOrderRequest; +import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest; import com.glxp.udi.admin.req.inout.OrderFilterRequest; import com.glxp.udi.admin.req.inventory.FilterInvProductRequest; import com.glxp.udi.admin.res.inout.OrderNoResult; import com.glxp.udi.admin.service.param.SystemParamConfigService; import com.glxp.udi.admin.util.CustomUtil; -import com.glxp.udi.admin.util.DateUtil; import com.glxp.udi.common.util.ResultVOUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.context.annotation.Lazy; @@ -46,7 +49,7 @@ import java.util.stream.Collectors; @Slf4j @Service -public class OrderMdService { +public class OrderService { @Lazy @Resource @@ -59,7 +62,7 @@ public class OrderMdService { private WarehouseTempMdService warehouseTempMdService; @Lazy @Resource - private OrderDetailMdService orderDetailMdService; + private OrderDetailService orderDetailService; @Resource private CustomerInfoDao customerInfoDao; @@ -72,108 +75,70 @@ public class OrderMdService { @Resource private MongoTemplate mongoTemplate; @Resource - private MongoPageHelper mongoPageHelper; - @Resource private BussinessTypeDao bussinessTypeDao; @Resource + private OrderMdDao orderMdDao; + @Resource private OrderDao orderDao; - public PageResult filterList(OrderFilterRequest orderFilterRequest) { - return orderDao.pageQuery(null, orderFilterRequest, orderFilterRequest.getPage(), orderFilterRequest.getLimit()); + public IPage filterList(OrderFilterRequest orderFilterRequest) { + IPage page = new Page<>(orderFilterRequest.getPage(), orderFilterRequest.getLimit()); + QueryWrapper wrapper = buildQueryWrapper(orderFilterRequest); + return orderDao.selectPage(page, wrapper); } + /** + * 构造单据表查询条件 + * + * @param orderFilterRequest + * @return + */ + private static QueryWrapper buildQueryWrapper(OrderFilterRequest orderFilterRequest) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StrUtil.isNotBlank(orderFilterRequest.getId()), "orderId", orderFilterRequest.getId()) + .in(CollUtil.isNotEmpty(orderFilterRequest.getInvCodes()), "locStorageCode", orderFilterRequest.getInvCodes()) + .le(StrUtil.isNotBlank(orderFilterRequest.getStartTime()), "actDate", orderFilterRequest.getStartTime()) + .ge(StrUtil.isNotBlank(orderFilterRequest.getEndTime()), "actDate", orderFilterRequest.getEndTime()) + .eq(StrUtil.isNotBlank(orderFilterRequest.getIsError()), "status", orderFilterRequest.getStatus()) + .eq(StrUtil.isNotBlank(orderFilterRequest.getAction()), "action", orderFilterRequest.getAction()) + .ne(StrUtil.isBlank(orderFilterRequest.getAction()), "action", orderFilterRequest.getAction()) + .eq(StrUtil.isNotBlank(orderFilterRequest.getOrderId()), "orderId", orderFilterRequest.getOrderId()) + .eq(StrUtil.isNotBlank(orderFilterRequest.getMainAction()), "mainAction", orderFilterRequest.getMainAction()) + .eq(null != orderFilterRequest.getStatus(), "status", orderFilterRequest.getStatus()) + .eq(StrUtil.isNotBlank(orderFilterRequest.getExportStatus()), "exportStatus", orderFilterRequest.getExportStatus()) + .eq(null != orderFilterRequest.getCustomerId(), "customerId", orderFilterRequest.getCustomerId()) + .eq(StrUtil.isNotBlank(orderFilterRequest.getCorpOrderId()), "corpOrderId", orderFilterRequest.getCorpOrderId()) + .eq(null != orderFilterRequest.getReceiveStatus(), "receiveStatus", orderFilterRequest.getReceiveStatus()); + return wrapper; + } - public OrderMdEntity findByOne(String orderId) { + public OrderEntity findByOne(String orderId) { OrderFilterRequest orderFilterRequest = new OrderFilterRequest(); orderFilterRequest.setId(orderId); - List orderMdEntities = findAll(orderFilterRequest); + List orderMdEntities = findAll(orderFilterRequest); if (orderMdEntities != null && orderMdEntities.size() > 0) { return orderMdEntities.get(0); } return null; } - public List findAll(OrderFilterRequest orderFilterRequest) { - Query query = new Query(); - if (orderFilterRequest.getId() != null && !orderFilterRequest.getId().isEmpty()) { - query.addCriteria(Criteria.where("orderId").is(orderFilterRequest.getId())); - } - if (orderFilterRequest.getMainAction() != null && !orderFilterRequest.getMainAction().isEmpty()) { - query.addCriteria(Criteria.where("mainAction").is(orderFilterRequest.getMainAction())); - } - if (orderFilterRequest.getAction() != null && !orderFilterRequest.getAction().isEmpty()) { - query.addCriteria(Criteria.where("action").is(orderFilterRequest.getAction())); - } - if (orderFilterRequest.getAction() == null || orderFilterRequest.getAction().isEmpty()) { - query.addCriteria(Criteria.where("action").ne("StockCheck")); - } - if (null != orderFilterRequest.getStatus()) { - query.addCriteria(Criteria.where("status").is(orderFilterRequest.getStatus())); - } - if (orderFilterRequest.getExportStatus() != null && !orderFilterRequest.getExportStatus().isEmpty()) { - query.addCriteria(Criteria.where("exportStatus").is(orderFilterRequest.getExportStatus())); - } - if (StrUtil.isNotBlank(orderFilterRequest.getCorpOrderId())) { - query.addCriteria(Criteria.where("corpOrderId").is(orderFilterRequest.getCorpOrderId())); - } - if (orderFilterRequest.getCustomerId() != null) { - if (orderFilterRequest.getStartTime() != null && !orderFilterRequest.getStartTime().isEmpty() - && orderFilterRequest.getEndTime() != null && !orderFilterRequest.getEndTime().isEmpty()) { - Date sdate, edate = null; - if (orderFilterRequest.getStartTime().contains("T")) { - sdate = DateUtil.convertTimeFormat(orderFilterRequest.getStartTime()); - } else { - sdate = DateUtil.parseDate(orderFilterRequest.getStartTime()); - } - if (orderFilterRequest.getEndTime().contains("T")) { - edate = DateUtil.convertTimeFormat(orderFilterRequest.getEndTime()); - } else { - edate = DateUtil.parseDate(orderFilterRequest.getEndTime()); - } - query.addCriteria(Criteria.where("customerId").is(orderFilterRequest.getCustomerId()).andOperator(Criteria.where("actDate").gte(DateUtil.dateToISODate(sdate) - ), Criteria.where("actDate").lt(DateUtil.dateToISODate(edate)))); - } else { - query.addCriteria(Criteria.where("customerId").is(orderFilterRequest.getCustomerId())); - } - } - - if (orderFilterRequest.getIsError() != null) { - query.addCriteria(Criteria.where("status").ne(orderFilterRequest.getIsError())); - } - if (orderFilterRequest.getReceiveStatus() != null) { - query.addCriteria(Criteria.where("receiveStatus").is(orderFilterRequest.getReceiveStatus())); - } - return mongoTemplate.find(query, OrderMdEntity.class, MongoDBName.NAME_ORDER); + public List findAll(OrderFilterRequest orderFilterRequest) { + QueryWrapper wrapper = buildQueryWrapper(orderFilterRequest); + return orderDao.selectList(wrapper); } - public void updateOrder(OrderMdEntity orderMdEntity) { - Query query = new Query(); - if (orderMdEntity.getOrderId() != null && !orderMdEntity.getOrderId().isEmpty()) { - query.addCriteria(new Criteria().and("orderId").is(orderMdEntity.getOrderId())); - } else if (orderMdEntity.getId() != null && !orderMdEntity.getId().isEmpty()) { - query.addCriteria(new Criteria().and("_id").is(orderMdEntity.getId())); - } else { - log.error("更新失败,未指定orderId"); - return; - } - - orderDao.update(query, null, orderMdEntity); + public void updateOrder(OrderEntity orderEntity) { + orderDao.updateById(orderEntity); } public void deleteOrder(DeleteRequest deleteRequest) { - Query query = new Query(); - if (deleteRequest.getId() != null) { - query.addCriteria(Criteria.where("id").is(deleteRequest.getId())); - } - if (deleteRequest.getOrderId() != null) { - query.addCriteria(Criteria.where("orderId").is(deleteRequest.getOrderId())); - } - orderDao.delete(query, null); + String orderId = StrUtil.isBlank(deleteRequest.getId()) ? deleteRequest.getOrderId() : deleteRequest.getId(); + orderDao.deleteById(orderId); } - public void insertOrder(OrderMdEntity orderMdEntity) { - orderDao.insert(orderMdEntity); + public void insertOrder(OrderEntity orderEntity) { + orderDao.insert(orderEntity); } /** @@ -183,10 +148,10 @@ public class OrderMdService { * @return */ public long countByAction(String action) { - Query query = new Query(); if (StrUtil.isNotBlank(action)) { - query.addCriteria(Criteria.where("action").is(action)); - return orderDao.count(query, null); + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StrUtil.isNotBlank(action), "action", action); + orderDao.selectCount(wrapper); } return 0; } @@ -194,22 +159,22 @@ public class OrderMdService { /** * 补单 * - * @param orderMdEntity + * @param orderEntity * @return */ - public BaseResponse supplementOrder(OrderMdEntity orderMdEntity) { + public BaseResponse supplementOrder(OrderEntity orderEntity) { //查询此单据是否可以补单 - String supplementTypeAction = bussinessTypeDao.selectSupplementTypeByAction(orderMdEntity.getAction()); + String supplementTypeAction = bussinessTypeDao.selectSupplementTypeByAction(orderEntity.getAction()); if (StrUtil.isBlank(supplementTypeAction)) { return ResultVOUtils.error(500, "此类型单据不可补单"); } //拷贝生成补单数据 - OrderMdEntity supplementOrder = new OrderMdEntity(); - BeanUtil.copyProperties(orderMdEntity, supplementOrder); + OrderEntity supplementOrder = new OrderEntity(); + BeanUtil.copyProperties(orderEntity, supplementOrder); //生成补单单号 String supplementOrderNo = "SM" + CustomUtil.getId(); - supplementOrder.setSupplementNo(orderMdEntity.getOrderId()); + supplementOrder.setSupplementNo(orderEntity.getOrderId()); supplementOrder.setOrderId(supplementOrderNo); supplementOrder.setCorpOrderId(CustomUtil.getId()); //生成一个新的来源ID @@ -225,8 +190,8 @@ public class OrderMdService { supplementOrder.setUploadStatus("0"); //设置上传状态为未上传 //修改往来单位及库存号 - supplementOrder.setFromCorpId(orderMdEntity.getLocStorageCode()); - supplementOrder.setLocStorageCode(orderMdEntity.getFromCorpId()); + supplementOrder.setFromCorpId(orderEntity.getLocStorageCode()); + supplementOrder.setLocStorageCode(orderEntity.getFromCorpId()); String name = invWarehouseDao.getNameByCode(supplementOrder.getFromCorpId()); supplementOrder.setFromCorp(name); supplementOrder.setFromType("平衡补单"); @@ -237,10 +202,10 @@ public class OrderMdService { supplementOrder.setAction(supplementType.getAction()); //复制码表 - List codes = warehouseMdService.findByOrderId(orderMdEntity.getOrderId()); - List supplementCodes = new ArrayList<>(codes.size()); + List codes = warehouseMdService.findByOrderId(orderEntity.getOrderId()); + List supplementCodes = new ArrayList<>(codes.size()); codes.forEach(code -> { - WarehousetempEntity supplementCode = new WarehousetempEntity(); + WarehousetempMdEntity supplementCode = new WarehousetempEntity(); BeanUtil.copyProperties(code, supplementCode); supplementCode.setFromCorpId(supplementOrder.getFromCorpId()); supplementCode.setFromCorp(supplementOrder.getFromCorp()); @@ -257,8 +222,8 @@ public class OrderMdService { supplementOrder.setId(null); insertOrder(supplementOrder); //更新配货单表对应的单据补单号 - orderMdEntity.setSupplementNo(supplementOrderNo); - updateOrder(orderMdEntity); + orderEntity.setSupplementNo(supplementOrderNo); + updateOrder(orderEntity); warehouseTempMdService.insertTempWarehouses(supplementCodes); } catch (Exception e) { log.error("补单数据插入失败", e); @@ -271,12 +236,11 @@ public class OrderMdService { * * @return */ - public List getSupplementOrderBillNoList() { + public List getSupplementOrderBillNoList() { //查询补单单号为空,且单据状态为已完成的单据 - Query query = new Query(); - query.addCriteria(Criteria.where("supplementNo").is(null)); - query.addCriteria(Criteria.where("status").is(ConstantStatus.ORDER_STATUS_SUCCESS)); - return mongoTemplate.find(query, OrderMdEntity.class, MongoDBName.NAME_ORDER); + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.isNull("supplementNo").eq("status", ConstantStatus.ORDER_STATUS_SUCCESS); + return orderDao.selectList(wrapper); } /** @@ -285,7 +249,7 @@ public class OrderMdService { * @param order * @return */ - public boolean checkUpload(OrderMdEntity order) { + public boolean checkUpload(OrderEntity order) { //查询此往来单位的本地单据类型 Integer count = unitMaintainDao.checkUpload(order.getCustomerId(), order.getAction()); if (count > 0) { @@ -302,14 +266,14 @@ public class OrderMdService { */ public List listOrderPrint(String orderId) { List list = new ArrayList<>(1); - OrderMdEntity orderMdEntity = findByOne(orderId); - if (null != orderMdEntity) { + OrderEntity orderEntity = findByOne(orderId); + if (null != orderEntity) { //查询单据详情 - FilterErpOrderRequest detailRequest = new FilterErpOrderRequest(); + FilterOrderDetailRequest detailRequest = new FilterOrderDetailRequest(); detailRequest.setOrderId(orderId); - List erpOrderEntities = orderDetailMdService.filterOrderDetails(detailRequest); - CustomerInfoEntity customerInfoEntity = customerInfoDao.selectById(orderMdEntity.getCustomerId()); + List erpOrderEntities = orderDetailService.filterOrderDetails(detailRequest); + CustomerInfoEntity customerInfoEntity = customerInfoDao.selectById(orderEntity.getCustomerId()); String customerId = String.valueOf(customerInfoEntity.getCustomerId()); erpOrderEntities.forEach(erpOrderEntity -> { //查询产品批次 @@ -317,13 +281,13 @@ public class OrderMdService { printEntity.setBatchNo(erpOrderEntity.getBatchNo()); //批次号 printEntity.setProductId(erpOrderEntity.getNameCode()); //产品ID printEntity.setCorpId(customerId); //本企业ID - printEntity.setCorpName(orderMdEntity.getFromCorp()); //往来单位名称 - printEntity.setBillType(orderMdEntity.getAction()); //单据类型编码 + printEntity.setCorpName(orderEntity.getFromCorp()); //往来单位名称 + printEntity.setBillType(orderEntity.getAction()); //单据类型编码 printEntity.setCount(String.valueOf(erpOrderEntity.getCount())); //数量 - printEntity.setUnitIdFk(orderMdEntity.getFromCorpId());//往来单位ID + printEntity.setUnitIdFk(orderEntity.getFromCorpId());//往来单位ID printEntity.setPrice(erpOrderEntity.getPrice());//金额 - printEntity.setBillNo(orderMdEntity.getOrderId()); //单号 - printEntity.setBilldate(orderMdEntity.getActDate()); //单据日期 + printEntity.setBillNo(orderEntity.getOrderId()); //单号 + printEntity.setBilldate(orderEntity.getActDate()); //单据日期 printEntity.setZczbhhzbapzbh(erpOrderEntity.getZczbhhzbapzbh()); //注册/备案证号 printEntity.setSpec(erpOrderEntity.getGgxh()); //规格型号 printEntity.setTitle(customerInfoEntity.getCompanyName()); //企业名称,单据抬头 @@ -332,12 +296,12 @@ public class OrderMdService { invProductRequest.setBatchNo(erpOrderEntity.getBatchNo()); invProductRequest.setRelIdFk(erpOrderEntity.getUuidFk()); invProductRequest.setCustomerId(customerId); - invProductRequest.setInvCodes(Arrays.asList(orderMdEntity.getLocStorageCode())); + invProductRequest.setInvCodes(Arrays.asList(orderEntity.getLocStorageCode())); invProductRequest.setPage(1); invProductRequest.setLimit(100); - UdiInfoEntity udiInfoEntity = udiInfoDao.findByUuid(erpOrderEntity.getUuidFk(), String.valueOf(orderMdEntity.getCustomerId())); + UdiInfoEntity udiInfoEntity = udiInfoDao.findByUuid(erpOrderEntity.getUuidFk(), String.valueOf(orderEntity.getCustomerId())); printEntity.setManufactory(udiInfoEntity.getManufactory()); //生产厂家 - printEntity.setLocInv(invWarehouseDao.getNameByCode(orderMdEntity.getLocStorageCode())); + printEntity.setLocInv(invWarehouseDao.getNameByCode(orderEntity.getLocStorageCode())); printEntity.setProductName(erpOrderEntity.getProductName()); //产品名称 printEntity.setProductDate(erpOrderEntity.getProduceDate()); //生产日期 printEntity.setExpireDate(erpOrderEntity.getExpireDate()); //失效日期 @@ -354,54 +318,54 @@ public class OrderMdService { * @param unitMaintainEntity * @return */ - public List findWaitUploadOrders(UnitMaintainEntity unitMaintainEntity) { - Query query = new Query(); + public List findWaitUploadOrders(UnitMaintainEntity unitMaintainEntity) { + QueryWrapper wrapper = new QueryWrapper(); //查询已完成单据 - query.addCriteria(Criteria.where("status").is(ConstantStatus.ORDER_STATUS_SUCCESS)) + wrapper.eq("status", ConstantStatus.ORDER_STATUS_SUCCESS) //查询未上传单据 - .addCriteria(Criteria.where("uploadStatus").ne("1")) + .ne("uploadStatus", "1") //客户ID - .addCriteria(Criteria.where("customerId").is(Long.valueOf(unitMaintainEntity.getCustomerId()))) + .eq("customerId", unitMaintainEntity.getCustomerId()) //本地单据类型 - .addCriteria(Criteria.where("action").is(unitMaintainEntity.getSourceAction())); - return orderDao.findList(query, null); + .eq("action", unitMaintainEntity.getSourceAction()); + + return orderDao.selectList(wrapper); } - public List filterForDelete(String orderId) { - Query query = new Query(); - query.addCriteria(Criteria.where("orderId").is(orderId)); - query.addCriteria(Criteria.where("status").is(ConstantStatus.ORDER_STATUS_SUCCESS)); //查询已完成单据 - OrderMdEntity order = mongoTemplate.findOne(query, OrderMdEntity.class, MongoDBName.NAME_ORDER); - if (null == order) { + public List filterForDelete(String orderId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("orderId", orderId).eq("status", ConstantStatus.ORDER_STATUS_SUCCESS); + OrderEntity orderEntity = orderDao.selectOne(wrapper); + if (null == orderEntity) { return Collections.emptyList(); } - return getAllOrder(order); + return getAllOrder(orderEntity); } - public List getAllOrder(OrderMdEntity orderMdEntity) { + public List getAllOrder(OrderEntity orderEntity) { Set orderIds = new HashSet<>(); - orderIds.add(orderMdEntity.getOrderId()); + orderIds.add(orderEntity.getOrderId()); - getLinkedOrderId(orderMdEntity.getOrderId(), orderIds); + getLinkedOrderId(orderEntity.getOrderId(), orderIds); //去除查询参数的单据号 Iterator iterator = orderIds.iterator(); while (iterator.hasNext()) { - if (iterator.next().equals(orderMdEntity.getOrderId())) { + if (iterator.next().equals(orderEntity.getOrderId())) { iterator.remove(); break; } } - List orders = new ArrayList<>(); - orders.add(orderMdEntity); + List orders = new ArrayList<>(); + orders.add(orderEntity); //查询除本单以外的所有单据 if (CollUtil.isNotEmpty(orderIds)) { - Query query = new Query(); - query.addCriteria(Criteria.where("orderId").in(orderIds)); - List orderMdEntities = mongoTemplate.find(query, OrderMdEntity.class, MongoDBName.NAME_ORDER); - orders.addAll(orderMdEntities); + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.in("orderId", orderIds); + List orderEntities = orderDao.selectList(wrapper); + orders.addAll(orderEntities); } return orders; } @@ -426,9 +390,7 @@ public class OrderMdService { //通过单号获取此单据所有的单号字段值 public List getOneOrderById(String orderId) { List orderIds = new ArrayList<>(); - Query query = new Query(); - query.addCriteria(Criteria.where("orderId").is(orderId)); - OrderNoResult orderNo = mongoTemplate.findOne(query, OrderNoResult.class, MongoDBName.NAME_ORDER); + OrderNoResult orderNo = orderDao.selectNos(orderId); if (orderNo == null) { return orderIds; } @@ -454,10 +416,8 @@ public class OrderMdService { * @param orderId * @return */ - public OrderMdEntity findById(String orderId) { - Query query = new Query(); - query.addCriteria(Criteria.where("orderId").is(orderId)); - return mongoTemplate.findOne(query, OrderMdEntity.class, MongoDBName.NAME_ORDER); + public OrderEntity findById(String orderId) { + return orderDao.selectById(orderId); } /** @@ -467,20 +427,8 @@ public class OrderMdService { * @param replicateNo * @return */ - public boolean updateReplicateNo(String orderId, String replicateNo) { - //构造查询条件 - Query query = new Query(); - query.addCriteria(Criteria.where("orderId").is(orderId)); - - Update update = new Update(); - update.set("replicateNo", replicateNo); - try { - mongoTemplate.updateMulti(query, update, MongoDBName.NAME_ORDER); - return true; - } catch (Exception e) { - log.error("更新 {} 单据的复制单据号失败", orderId, e); - return false; - } + public void updateReplicateNo(String orderId, String replicateNo) { + orderDao.updateReplicateNo(replicateNo, orderId); } /** @@ -581,81 +529,11 @@ public class OrderMdService { } public void updateOrderInfo(String actDate, List orderIds) { - if (CollUtil.isNotEmpty(orderIds)) { - //构造查询条件 - Query query = new Query(); - query.addCriteria(Criteria.where("orderId").in(orderIds)); - - Update update = new Update(); - update.set("actDate", actDate); - - try { - //更新单据表 - mongoTemplate.updateMulti(query, update, OrderMdEntity.class, MongoDBName.NAME_ORDER); - //更新码表 - mongoTemplate.updateMulti(query, update, WarehouseEntity.class, MongoDBName.NAME_CODE); - } catch (Exception e) { - log.error("更新单据时间异常", e); - } - } + orderDao.updateActDate(actDate, orderIds); } public void deleteById(String id) { - Query query = new Query(); - query.addCriteria(Criteria.where("id").is(id)); - mongoTemplate.remove(query, OrderMdEntity.class, MongoDBName.NAME_ORDER); + orderDao.deleteById(id); } - public PageResult findByPage(OrderFilterRequest orderFilterRequest) { - Query query = new Query(); - if (orderFilterRequest.getId() != null && !orderFilterRequest.getId().isEmpty()) { - query.addCriteria(Criteria.where("orderId").is(orderFilterRequest.getId())); - } - if (orderFilterRequest.getMainAction() != null && !orderFilterRequest.getMainAction().isEmpty()) { - query.addCriteria(Criteria.where("mainAction").is(orderFilterRequest.getMainAction())); - } - if (orderFilterRequest.getAction() != null && !orderFilterRequest.getAction().isEmpty()) { - query.addCriteria(Criteria.where("action").is(orderFilterRequest.getAction())); - } - if (orderFilterRequest.getAction() == null || orderFilterRequest.getAction().isEmpty()) { - query.addCriteria(Criteria.where("action").ne("StockCheck")); - } - if (null != orderFilterRequest.getStatus()) { - query.addCriteria(Criteria.where("status").is(orderFilterRequest.getStatus())); - } - if (orderFilterRequest.getExportStatus() != null && !orderFilterRequest.getExportStatus().isEmpty()) { - query.addCriteria(Criteria.where("exportStatus").is(orderFilterRequest.getExportStatus())); - } - if (StrUtil.isNotBlank(orderFilterRequest.getCorpOrderId())) { - query.addCriteria(Criteria.where("corpOrderId").is(orderFilterRequest.getCorpOrderId())); - } - if (orderFilterRequest.getCustomerId() != null) { - if (orderFilterRequest.getStartTime() != null && !orderFilterRequest.getStartTime().isEmpty() - && orderFilterRequest.getEndTime() != null && !orderFilterRequest.getEndTime().isEmpty()) { - Date sdate, edate = null; - if (orderFilterRequest.getStartTime().contains("T")) { - sdate = DateUtil.convertTimeFormat(orderFilterRequest.getStartTime()); - } else { - sdate = DateUtil.parseDate(orderFilterRequest.getStartTime()); - } - if (orderFilterRequest.getEndTime().contains("T")) { - edate = DateUtil.convertTimeFormat(orderFilterRequest.getEndTime()); - } else { - edate = DateUtil.parseDate(orderFilterRequest.getEndTime()); - } - query.addCriteria(Criteria.where("customerId").is(orderFilterRequest.getCustomerId()).andOperator(Criteria.where("actDate").gte(DateUtil.dateToISODate(sdate) - ), Criteria.where("actDate").lt(DateUtil.dateToISODate(edate)))); - } else { - query.addCriteria(Criteria.where("customerId").is(orderFilterRequest.getCustomerId())); - } - } - - if (orderFilterRequest.getIsError() != null) { - query.addCriteria(Criteria.where("status").ne(orderFilterRequest.getIsError())); - } - if (orderFilterRequest.getReceiveStatus() != null) { - query.addCriteria(Criteria.where("receiveStatus").is(orderFilterRequest.getReceiveStatus())); - } - return mongoPageHelper.pageQuery(query, OrderMdEntity.class, orderFilterRequest.getPage(), orderFilterRequest.getLimit(), MongoDBName.NAME_ORDER); - } } diff --git a/src/main/java/com/glxp/udi/admin/mongo/service/WarehouseMdService.java b/src/main/java/com/glxp/udi/admin/mongo/service/WarehouseMdService.java index 0e657a5..d2efb3d 100644 --- a/src/main/java/com/glxp/udi/admin/mongo/service/WarehouseMdService.java +++ b/src/main/java/com/glxp/udi/admin/mongo/service/WarehouseMdService.java @@ -7,8 +7,8 @@ import com.glxp.udi.admin.constant.ConstantType; import com.glxp.udi.admin.entity.inout.InvProductDetailEntity; import com.glxp.udi.admin.entity.inout.InvProductEntity; import com.glxp.udi.admin.entity.inout.OrderDetailEntity; -import com.glxp.udi.admin.entity.inout.WarehouseEntity; -import com.glxp.udi.admin.entity.mongo.OrderMdEntity; +import com.glxp.udi.admin.entity.inout.OrderEntity; +import com.glxp.udi.admin.entity.mongo.WarehouseMdEntity; import com.glxp.udi.admin.mongo.MongoDBName; import com.glxp.udi.admin.mongo.utils.MongoPageHelper; import com.glxp.udi.admin.mongo.utils.PageResult; @@ -36,19 +36,19 @@ public class WarehouseMdService { private MongoPageHelper mongoPageHelper; @Lazy @Resource - private OrderMdService orderMdService; + private OrderService orderService; @Lazy @Resource - private InvProductMdService invProductMdService; + private InvProductService invProductService; @Lazy @Resource private InvProductDetailMdService invProductDetailMdService; @Lazy @Resource - private OrderDetailMdService orderDetailMdService; + private OrderDetailService orderDetailService; - public PageResult filterWarehouseByPage(WarehouseQueryRequest warehouseQueryRequest) { + public PageResult filterWarehouseByPage(WarehouseQueryRequest warehouseQueryRequest) { Query query = new Query(); if (warehouseQueryRequest.getCode() != null && !warehouseQueryRequest.getCode().isEmpty()) { query.addCriteria(Criteria.where("code").is(warehouseQueryRequest.getCode())); @@ -59,11 +59,11 @@ public class WarehouseMdService { if (warehouseQueryRequest.getOrderId() != null && !warehouseQueryRequest.getOrderId().isEmpty()) { query.addCriteria(Criteria.where("orderId").is(warehouseQueryRequest.getOrderId())); } - return mongoPageHelper.pageQuery(query, WarehouseEntity.class, + return mongoPageHelper.pageQuery(query, WarehouseMdEntity.class, warehouseQueryRequest.getLimit(), warehouseQueryRequest.getPage(), warehouseQueryRequest.getLastId(), MongoDBName.NAME_CODE); } - public List filterWarehouse(WarehouseQueryRequest warehouseQueryRequest) { + public List filterWarehouse(WarehouseQueryRequest warehouseQueryRequest) { Query query = new Query(); if (warehouseQueryRequest.getCode() != null && !warehouseQueryRequest.getCode().isEmpty()) { query.addCriteria(Criteria.where("code").is(warehouseQueryRequest.getCode())); @@ -83,24 +83,24 @@ public class WarehouseMdService { if (warehouseQueryRequest.getUdi() != null) { query.addCriteria(Criteria.where("udi").is(warehouseQueryRequest.getUdi())); } - return mongoTemplate.find(query, WarehouseEntity.class, MongoDBName.NAME_CODE); + return mongoTemplate.find(query, WarehouseMdEntity.class, MongoDBName.NAME_CODE); } - public void insertWarehouses(List warehouseEntities) { + public void insertWarehouses(List warehouseEntities) { if (warehouseEntities != null) { - Collection warehouseEntityCollection = new ArrayList<>(); - warehouseEntityCollection.addAll(warehouseEntities); - mongoTemplate.insert(warehouseEntityCollection, MongoDBName.NAME_CODE); + Collection warehouseMdEntityCollection = new ArrayList<>(); + warehouseMdEntityCollection.addAll(warehouseEntities); + mongoTemplate.insert(warehouseMdEntityCollection, MongoDBName.NAME_CODE); } } - public List findByCode(FilterWarehouseRequest filterWarehouseRequest) { + public List findByCode(FilterWarehouseRequest filterWarehouseRequest) { Query query = new Query(); query.addCriteria( Criteria.where("customerId").is(filterWarehouseRequest.getCustomerId()) .and("code").is(filterWarehouseRequest.getCode()) ); - return mongoTemplate.find(query, WarehouseEntity.class, MongoDBName.NAME_CODE); + return mongoTemplate.find(query, WarehouseMdEntity.class, MongoDBName.NAME_CODE); } public void updateUnit(String orderId, String fromCorpId, String fromCorp) { @@ -120,55 +120,55 @@ public class WarehouseMdService { mongoTemplate.updateMulti(query, update, MongoDBName.NAME_CODE); } - public List findByOrderId(String orderId) { + public List findByOrderId(String orderId) { if (StrUtil.isBlank(orderId)) { return Collections.emptyList(); } Query query = new Query(); query.addCriteria(Criteria.where("orderId").is(orderId)); - return mongoTemplate.find(query, WarehouseEntity.class, MongoDBName.NAME_CODE); + return mongoTemplate.find(query, WarehouseMdEntity.class, MongoDBName.NAME_CODE); } - public PageResult findOrdersById(WarehouseQueryRequest warehouseQueryRequest) { + public PageResult findOrdersById(WarehouseQueryRequest warehouseQueryRequest) { if (null != warehouseQueryRequest && StrUtil.isBlank(warehouseQueryRequest.getOrderId())) { return new PageResult<>(); } Query query = new Query(); query.addCriteria(Criteria.where("orderId").is(warehouseQueryRequest.getOrderId())); - PageResult pageResult = mongoPageHelper.pageQuery(query, WarehouseEntity.class, warehouseQueryRequest.getPage(), warehouseQueryRequest.getLimit(), MongoDBName.NAME_CODE); + PageResult pageResult = mongoPageHelper.pageQuery(query, WarehouseMdEntity.class, warehouseQueryRequest.getPage(), warehouseQueryRequest.getLimit(), MongoDBName.NAME_CODE); return pageResult; } public void replaceCodes(CodesReplaceRequest codesReplaceRequest) { - OrderMdEntity orderMdEntity = orderMdService.findById(codesReplaceRequest.getOrderId()); + OrderEntity orderEntity = orderService.findById(codesReplaceRequest.getOrderId()); //查询所有单据 - List orderList = orderMdService.getAllOrder(orderMdEntity); + List orderList = orderService.getAllOrder(orderEntity); - for (OrderMdEntity order : orderList) { + for (OrderEntity order : orderList) { //查询条码 WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest(); warehouseQueryRequest.setCode(codesReplaceRequest.getCode()); warehouseQueryRequest.setOrderId(order.getOrderId()); - List warehouseEntities = findByOrderId(warehouseQueryRequest); + List warehouseEntities = findByOrderId(warehouseQueryRequest); if (CollUtil.isNotEmpty(warehouseEntities)) { - WarehouseEntity warehouseEntity = warehouseEntities.get(0); - if (warehouseEntity.getCount() > 1) { + WarehouseMdEntity warehouseMdEntity = warehouseEntities.get(0); + if (warehouseMdEntity.getCount() > 1) { //删除一个条码 - warehouseEntity.setCount(warehouseEntity.getCount() - 1); - updateCode(warehouseEntity); + warehouseMdEntity.setCount(warehouseMdEntity.getCount() - 1); + updateCode(warehouseMdEntity); } else { //如果数量扣减之后为0,直接删除此条码 - deleteById(warehouseEntity.getId()); + deleteById(warehouseMdEntity.getId()); } //库存详情扣减1 if (order.getStatus().equals(ConstantStatus.ORDER_STATUS_SUCCESS)) { //查询库存 FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest(); - filterInvProductDetailRequest.setCode(warehouseEntity.getCode()); + filterInvProductDetailRequest.setCode(warehouseMdEntity.getCode()); filterInvProductDetailRequest.setOrderIdFk(order.getOrderId()); - if (StrUtil.isNotBlank(warehouseEntity.getBatchNo())) { - filterInvProductDetailRequest.setBatchNo(warehouseEntity.getBatchNo()); + if (StrUtil.isNotBlank(warehouseMdEntity.getBatchNo())) { + filterInvProductDetailRequest.setBatchNo(warehouseMdEntity.getBatchNo()); } List invProductDetailEntities = invProductDetailMdService.filterAllInvProduct(filterInvProductDetailRequest); if (CollUtil.isNotEmpty(invProductDetailEntities)) { @@ -186,11 +186,11 @@ public class WarehouseMdService { FilterInvProductRequest filterInvProductRequest = new FilterInvProductRequest(); filterInvProductRequest.setRelIdFk(invProductDetailEntity.getProductIdFk()); filterInvProductRequest.setInvStorageCode(invProductDetailEntity.getLocStorageCode()); - filterInvProductRequest.setNameCode(warehouseEntity.getNameCode()); + filterInvProductRequest.setNameCode(warehouseMdEntity.getNameCode()); if (StrUtil.isNotBlank(invProductDetailEntity.getBatchNo())) { filterInvProductRequest.setBatchNo(invProductDetailEntity.getBatchNo()); } - InvProductEntity invProductEntity = invProductMdService.filterInvProductList(filterInvProductRequest).get(0); + InvProductEntity invProductEntity = invProductService.filterInvProductList(filterInvProductRequest).get(0); if (invProductDetailEntity.getMainAction().equals(ConstantType.TYPE_PUT)) { //入库 invProductEntity.setInCount(invProductEntity.getInCount() - 1); @@ -207,36 +207,36 @@ public class WarehouseMdService { long count = invProductDetailMdService.statCount(detailParams); if (count == 0) { //删除库存 - invProductMdService.deleteById(invProductEntity.getId()); + invProductService.deleteById(invProductEntity.getId()); } else { //库存码详情不为空,更新库存数据 - invProductMdService.updateInvProduct(invProductEntity); + invProductService.updateInvProduct(invProductEntity); } //查询单据详情 - FilterErpOrderRequest filterErpOrderRequest = new FilterErpOrderRequest(); - filterErpOrderRequest.setOrderIdFk(order.getOrderId()); - filterErpOrderRequest.setUuidFk(invProductEntity.getRelIdFk()); - filterErpOrderRequest.setLotno(warehouseEntity.getBatchNo()); - List erpOrderEntities = orderDetailMdService.filterOrderDetails(filterErpOrderRequest); + FilterOrderDetailRequest filterOrderDetailRequest = new FilterOrderDetailRequest(); + filterOrderDetailRequest.setOrderIdFk(order.getOrderId()); + filterOrderDetailRequest.setUuidFk(invProductEntity.getRelIdFk()); + filterOrderDetailRequest.setLotno(warehouseMdEntity.getBatchNo()); + List erpOrderEntities = orderDetailService.filterOrderDetails(filterOrderDetailRequest); if (CollUtil.isNotEmpty(erpOrderEntities)) { OrderDetailEntity orderDetailEntity = erpOrderEntities.get(0); if (orderDetailEntity.getCount() > 1) { orderDetailEntity.setCount(orderDetailEntity.getCount() - 1); //更新单据详情 - orderDetailMdService.updateOrderDetail(orderDetailEntity); + orderDetailService.updateOrderDetail(orderDetailEntity); } else { //删除扫码单据详情 DeleteRequest deleteRequest = new DeleteRequest(); deleteRequest.setId(orderDetailEntity.getId()); - orderDetailMdService.deleteOrderDetail(deleteRequest); + orderDetailService.deleteOrderDetail(deleteRequest); } } //校验单据详情是否已经被全部删除,若全部被删除,则将此扫码单据也进行删除 - long orderDetailCount = orderDetailMdService.statCount(order.getOrderId()); + long orderDetailCount = orderDetailService.statCount(order.getOrderId()); if (orderDetailCount == 0) { - orderMdService.deleteById(order.getId()); + orderService.deleteById(order.getOrderId()); } } @@ -251,7 +251,7 @@ public class WarehouseMdService { * @param warehouseQueryRequest * @return */ - public List findByOrderId(WarehouseQueryRequest warehouseQueryRequest) { + public List findByOrderId(WarehouseQueryRequest warehouseQueryRequest) { Query query = new Query(); if (StrUtil.isNotBlank(warehouseQueryRequest.getOrderId())) { query.addCriteria(Criteria.where("orderId").is(warehouseQueryRequest.getOrderId())); @@ -259,16 +259,16 @@ public class WarehouseMdService { if (StrUtil.isNotBlank(warehouseQueryRequest.getCode())) { query.addCriteria(Criteria.where("code").is(warehouseQueryRequest.getCode())); } - return mongoTemplate.find(query, WarehouseEntity.class, MongoDBName.NAME_CODE); + return mongoTemplate.find(query, WarehouseMdEntity.class, MongoDBName.NAME_CODE); } - public void updateCode(WarehouseEntity warehouseEntity) { + public void updateCode(WarehouseMdEntity warehouseMdEntity) { Query query = new Query(); - query.addCriteria(Criteria.where("id").is(warehouseEntity.getId())); + query.addCriteria(Criteria.where("id").is(warehouseMdEntity.getId())); Update update = new Update(); - if (null != warehouseEntity.getCount()) { - update.set("count", warehouseEntity.getCount()); + if (null != warehouseMdEntity.getCount()) { + update.set("count", warehouseMdEntity.getCount()); } mongoTemplate.updateMulti(query, update, MongoDBName.NAME_CODE); } @@ -277,7 +277,7 @@ public class WarehouseMdService { Query query = new Query(); query.addCriteria(Criteria.where("id").is(id)); - mongoTemplate.remove(query, WarehouseEntity.class, MongoDBName.NAME_CODE); + mongoTemplate.remove(query, WarehouseMdEntity.class, MongoDBName.NAME_CODE); } } diff --git a/src/main/java/com/glxp/udi/admin/mongo/service/WarehouseTempMdService.java b/src/main/java/com/glxp/udi/admin/mongo/service/WarehouseTempMdService.java index 3ef4bc8..3a82599 100644 --- a/src/main/java/com/glxp/udi/admin/mongo/service/WarehouseTempMdService.java +++ b/src/main/java/com/glxp/udi/admin/mongo/service/WarehouseTempMdService.java @@ -2,8 +2,7 @@ package com.glxp.udi.admin.mongo.service; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; -import com.glxp.udi.admin.entity.inout.WarehouseEntity; -import com.glxp.udi.admin.entity.inout.WarehousetempEntity; +import com.glxp.udi.admin.entity.mongo.WarehousetempMdEntity; import com.glxp.udi.admin.mongo.MongoDBName; import com.glxp.udi.admin.mongo.utils.MongoPageHelper; import com.glxp.udi.admin.mongo.utils.PageResult; @@ -28,7 +27,7 @@ public class WarehouseTempMdService { @Resource private MongoPageHelper mongoPageHelper; - public PageResult filterWarehouseByPage(WarehouseQueryRequest warehouseQueryRequest) { + public PageResult filterWarehouseByPage(WarehouseQueryRequest warehouseQueryRequest) { Query query = new Query(); if (warehouseQueryRequest.getCode() != null && !warehouseQueryRequest.getCode().isEmpty()) { query.addCriteria(Criteria.where("code").is(warehouseQueryRequest.getCode())); @@ -42,19 +41,19 @@ public class WarehouseTempMdService { if (warehouseQueryRequest.getCustomerId() != null) { query.addCriteria(Criteria.where("customerId").is(warehouseQueryRequest.getCustomerId())); } - return mongoPageHelper.pageQuery(query, WarehousetempEntity.class, + return mongoPageHelper.pageQuery(query, WarehousetempMdEntity.class, warehouseQueryRequest.getLimit(), warehouseQueryRequest.getPage(), warehouseQueryRequest.getLastId(), MongoDBName.NAME_CODE_TEMP); } - public List findTempByOrderId(String orderId) { + public List findTempByOrderId(String orderId) { Query query = new Query(Criteria.where("orderId").is(orderId)); - List result = mongoTemplate.find(query, WarehousetempEntity.class, MongoDBName.NAME_CODE_TEMP); + List result = mongoTemplate.find(query, WarehousetempMdEntity.class, MongoDBName.NAME_CODE_TEMP); return result; } - public void insertTempWarehouses(List warehouseEntities) { + public void insertTempWarehouses(List warehouseEntities) { if (warehouseEntities != null) { - Collection warehousetempEntityCollection = new ArrayList<>(warehouseEntities); + Collection warehousetempEntityCollection = new ArrayList<>(warehouseEntities); mongoTemplate.insert(warehousetempEntityCollection, MongoDBName.NAME_CODE_TEMP); } } @@ -77,14 +76,14 @@ public class WarehouseTempMdService { if (deleteRequest.getOrderId() != null) { query.addCriteria(Criteria.where("orderId").is(deleteRequest.getOrderId())); } - mongoTemplate.remove(query, WarehouseEntity.class, MongoDBName.NAME_CODE_TEMP); + mongoTemplate.remove(query, WarehousetempMdEntity.class, MongoDBName.NAME_CODE_TEMP); } - public WarehousetempEntity findTempById(String id) { + public WarehousetempMdEntity findTempById(String id) { Query query = new Query(); if (StrUtil.isNotBlank(id)) { query.addCriteria(Criteria.where("id").is(id)); - List warehousetempEntities = mongoTemplate.find(query, WarehousetempEntity.class, MongoDBName.NAME_CODE_TEMP); + List warehousetempEntities = mongoTemplate.find(query, WarehousetempMdEntity.class, MongoDBName.NAME_CODE_TEMP); if (CollUtil.isNotEmpty(warehousetempEntities)) { return warehousetempEntities.get(0); } @@ -92,12 +91,12 @@ public class WarehouseTempMdService { return null; } - public void updateById(WarehousetempEntity warehousetemp) { + public void updateById(WarehousetempMdEntity warehousetemp) { Query query = new Query(); query.addCriteria(Criteria.where("id").is(warehousetemp.getId())); Update update = new Update(); update.set("count", warehousetemp.getCount()); - mongoTemplate.updateMulti(query, update, WarehousetempEntity.class, MongoDBName.NAME_CODE_TEMP); + mongoTemplate.updateMulti(query, update, WarehousetempMdEntity.class, MongoDBName.NAME_CODE_TEMP); } } diff --git a/src/main/java/com/glxp/udi/admin/req/inout/FilterErpOrderRequest.java b/src/main/java/com/glxp/udi/admin/req/inout/FilterOrderDetailRequest.java similarity index 89% rename from src/main/java/com/glxp/udi/admin/req/inout/FilterErpOrderRequest.java rename to src/main/java/com/glxp/udi/admin/req/inout/FilterOrderDetailRequest.java index cfe75d6..38c606a 100644 --- a/src/main/java/com/glxp/udi/admin/req/inout/FilterErpOrderRequest.java +++ b/src/main/java/com/glxp/udi/admin/req/inout/FilterOrderDetailRequest.java @@ -6,7 +6,7 @@ import lombok.Data; import java.util.List; @Data -public class FilterErpOrderRequest extends ListPageRequest { +public class FilterOrderDetailRequest extends ListPageRequest { private String docid; private String goodsname; diff --git a/src/main/java/com/glxp/udi/admin/res/inout/OrderNoResult.java b/src/main/java/com/glxp/udi/admin/res/inout/OrderNoResult.java index 2d3f66d..bc3389b 100644 --- a/src/main/java/com/glxp/udi/admin/res/inout/OrderNoResult.java +++ b/src/main/java/com/glxp/udi/admin/res/inout/OrderNoResult.java @@ -9,15 +9,10 @@ import lombok.Data; public class OrderNoResult { private String id; + //补单单号 private String supplementNo; - //缺量补单上级单号 - private String originUllageSupNo; - - //缺量补单单号 - private String ullageSupNo; - //复制单号,多个单号之间使用英文逗号,分隔 private String replicateNo; diff --git a/src/main/java/com/glxp/udi/admin/thread/InvProductsTrService.java b/src/main/java/com/glxp/udi/admin/thread/InvProductsTrService.java index fac675d..c95a07d 100644 --- a/src/main/java/com/glxp/udi/admin/thread/InvProductsTrService.java +++ b/src/main/java/com/glxp/udi/admin/thread/InvProductsTrService.java @@ -6,8 +6,9 @@ import com.glxp.udi.admin.constant.ConstantStatus; import com.glxp.udi.admin.constant.TypeConstant; import com.glxp.udi.admin.entity.inout.*; import com.glxp.udi.admin.entity.mongo.OrderMdEntity; +import com.glxp.udi.admin.entity.mongo.WarehouseMdEntity; import com.glxp.udi.admin.mongo.service.*; -import com.glxp.udi.admin.req.inout.FilterErpOrderRequest; +import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest; import com.glxp.udi.admin.req.inout.OrderFilterRequest; import com.glxp.udi.admin.req.inout.WarehouseQueryRequest; import com.glxp.udi.admin.service.inout.UdiInfoService; @@ -29,10 +30,10 @@ public class InvProductsTrService { @Lazy @Resource - private OrderMdService orderService; + private OrderService orderService; @Lazy @Resource - private OrderDetailMdService myErpOrderService; + private OrderDetailService myErpOrderService; @Lazy @Resource private WarehouseMdService codesService; @@ -41,7 +42,7 @@ public class InvProductsTrService { private UdiInfoService udiInfoService; @Lazy @Resource - private InvProductMdService invProductService; + private InvProductService invProductService; @Lazy @Resource private InvProductDetailMdService invProductDetailService; @@ -56,9 +57,9 @@ public class InvProductsTrService { OrderMdEntity orderEntity = orderMdEntities.get(0); String customerId = orderEntity.getCustomerId() + ""; if (orderEntity.getStatus().equals(ConstantStatus.ORDER_STATUS_SUCCESS)) { - FilterErpOrderRequest filterErpOrderRequest = new FilterErpOrderRequest(); - filterErpOrderRequest.setOrderId(orderId); - List erpOrderEntities = myErpOrderService.filterOrderDetails(filterErpOrderRequest); + FilterOrderDetailRequest filterOrderDetailRequest = new FilterOrderDetailRequest(); + filterOrderDetailRequest.setOrderId(orderId); + List erpOrderEntities = myErpOrderService.filterOrderDetails(filterOrderDetailRequest); if (erpOrderEntities != null && erpOrderEntities.size() > 0) { for (OrderDetailEntity orderDetailEntity : erpOrderEntities) { String nameCode = orderDetailEntity.getNameCode(); @@ -103,7 +104,7 @@ public class InvProductsTrService { if (StrUtil.isNotBlank(invProductEntity.getBatchNo())) { warehouseQueryRequest.setBatchNo(invProductEntity.getBatchNo()); } - List warehouseEntities = codesService.filterWarehouse(warehouseQueryRequest); + List warehouseEntities = codesService.filterWarehouse(warehouseQueryRequest); if (CollUtil.isNotEmpty(warehouseEntities)) { for (WarehouseEntity warehouseEntity : warehouseEntities) { UdiInfoEntity tempUdi = udiInfoService.findByNameCode(warehouseEntity.getNameCode(), customerId); diff --git a/src/main/java/com/glxp/udi/admin/thread/SubmitOrderToSpmsTask.java b/src/main/java/com/glxp/udi/admin/thread/SubmitOrderToSpmsTask.java index c20a7e2..bf383a2 100644 --- a/src/main/java/com/glxp/udi/admin/thread/SubmitOrderToSpmsTask.java +++ b/src/main/java/com/glxp/udi/admin/thread/SubmitOrderToSpmsTask.java @@ -12,14 +12,15 @@ import com.glxp.udi.admin.dao.info.ScheduledDao; import com.glxp.udi.admin.entity.info.PlatformEntity; import com.glxp.udi.admin.entity.info.ScheduledEntity; import com.glxp.udi.admin.entity.inout.OrderDetailEntity; +import com.glxp.udi.admin.entity.inout.OrderEntity; import com.glxp.udi.admin.entity.inout.UnitMaintainEntity; -import com.glxp.udi.admin.entity.inout.WarehouseEntity; import com.glxp.udi.admin.entity.mongo.OrderMdEntity; +import com.glxp.udi.admin.entity.mongo.WarehouseMdEntity; import com.glxp.udi.admin.entity.param.SystemParamConfigEntity; -import com.glxp.udi.admin.mongo.service.OrderDetailMdService; -import com.glxp.udi.admin.mongo.service.OrderMdService; +import com.glxp.udi.admin.mongo.service.OrderDetailService; +import com.glxp.udi.admin.mongo.service.OrderService; import com.glxp.udi.admin.mongo.service.WarehouseMdService; -import com.glxp.udi.admin.req.inout.FilterErpOrderRequest; +import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest; import com.glxp.udi.admin.req.inout.PostUdimsOrderDetailRequest; import com.glxp.udi.admin.req.inout.PostUdimsOrderRequest; import com.glxp.udi.admin.req.inout.WarehouseQueryRequest; @@ -53,7 +54,7 @@ public class SubmitOrderToSpmsTask implements SchedulingConfigurer { @Resource private ScheduledDao scheduledDao; @Resource - private OrderMdService orderMdService; + private OrderService orderService; @Resource private UnitMaintainService unitMaintainService; @Resource @@ -63,7 +64,7 @@ public class SubmitOrderToSpmsTask implements SchedulingConfigurer { @Resource private WarehouseMdService warehouseMdService; @Resource - private OrderDetailMdService orderDetailMdService; + private OrderDetailService orderDetailService; @Resource private PlatformService platformService; @@ -94,18 +95,18 @@ public class SubmitOrderToSpmsTask implements SchedulingConfigurer { SystemParamConfigEntity systemParamConfigEntity = systemParamCustomerConfigService.getParamByKey(SystemParamConstant.IS_AUTO_SUBMIT_TO_SPMS, Long.valueOf(unitMaintainEntity.getCustomerId())); if (null != systemParamConfigEntity && systemParamConfigEntity.getParamValue().equals("1")) { //查询此用户未提交到自助平台且单据类型匹配的数据 - List orderMdEntities = orderMdService.findWaitUploadOrders(unitMaintainEntity); - if (CollUtil.isNotEmpty(orderMdEntities)) { + List orderEntities = orderService.findWaitUploadOrders(unitMaintainEntity); + if (CollUtil.isNotEmpty(orderEntities)) { //构造参数 PostUdimsOrderRequest postUdimsOrderRequest = new PostUdimsOrderRequest(); List orderBeans = new ArrayList<>(); - for (OrderMdEntity orderMdEntity : orderMdEntities) { + for (OrderEntity orderEntity : orderEntities) { PostUdimsOrderRequest.OrderBean orderBean = new PostUdimsOrderRequest.OrderBean(); - BeanUtil.copyProperties(orderMdEntity, orderBean); + BeanUtil.copyProperties(orderEntity, orderBean); orderBean.setAction(unitMaintainEntity.getTargetAction()); WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest(); - warehouseQueryRequest.setOrderId(orderMdEntity.getOrderId()); - List warehouseEntities = warehouseMdService.filterWarehouse(warehouseQueryRequest); + warehouseQueryRequest.setOrderId(orderEntity.getOrderId()); + List warehouseEntities = warehouseMdService.filterWarehouse(warehouseQueryRequest); List codeBeans = new ArrayList<>(); warehouseEntities.forEach(data -> { PostUdimsOrderRequest.OrderBean.CodeBean codeBean = new PostUdimsOrderRequest.OrderBean.CodeBean(); @@ -113,10 +114,10 @@ public class SubmitOrderToSpmsTask implements SchedulingConfigurer { codeBeans.add(codeBean); }); //查询单据详情 - FilterErpOrderRequest filterErpOrderRequest = new FilterErpOrderRequest(); - filterErpOrderRequest.setOrderId(orderBean.getOrderId()); + FilterOrderDetailRequest filterOrderDetailRequest = new FilterOrderDetailRequest(); + filterOrderDetailRequest.setOrderId(orderBean.getOrderId()); //单据详情 - List erpOrderEntities = orderDetailMdService.filterOrderDetails(filterErpOrderRequest); + List erpOrderEntities = orderDetailService.filterOrderDetails(filterOrderDetailRequest); if (CollUtil.isNotEmpty(erpOrderEntities)) { List orderDetails = new ArrayList<>(); for (OrderDetailEntity orderDetailEntity : erpOrderEntities) { @@ -148,11 +149,11 @@ public class SubmitOrderToSpmsTask implements SchedulingConfigurer { JSONObject.parseObject(response, new TypeReference() { }); if (baseResponse.getCode() == 20000) { - log.info("自动上传单据成功," + unitMaintainEntity.getName() + "上传单据数量为 " + orderMdEntities.size()); - for (OrderMdEntity orderMdEntity : orderMdEntities) { + log.info("自动上传单据成功," + unitMaintainEntity.getName() + "上传单据数量为 " + orderEntities.size()); + for (OrderMdEntity orderMdEntity : orderEntities) { log.info("修改单号为:{} 的上传状态", orderMdEntity.getOrderId()); orderMdEntity.setUploadStatus("1"); - orderMdService.updateOrder(orderMdEntity); + orderService.updateOrder(orderMdEntity); } } else { log.error("自动上传单据到自助平台异常,响应结果:{}", response); diff --git a/src/main/java/com/glxp/udi/admin/thread/SupplementOrderTask.java b/src/main/java/com/glxp/udi/admin/thread/SupplementOrderTask.java index ad137ae..077dd61 100644 --- a/src/main/java/com/glxp/udi/admin/thread/SupplementOrderTask.java +++ b/src/main/java/com/glxp/udi/admin/thread/SupplementOrderTask.java @@ -5,9 +5,10 @@ import com.glxp.udi.admin.common.res.BaseResponse; import com.glxp.udi.admin.constant.SystemParamConstant; import com.glxp.udi.admin.dao.info.ScheduledDao; import com.glxp.udi.admin.entity.info.ScheduledEntity; +import com.glxp.udi.admin.entity.inout.OrderEntity; import com.glxp.udi.admin.entity.mongo.OrderMdEntity; import com.glxp.udi.admin.entity.param.SystemParamConfigEntity; -import com.glxp.udi.admin.mongo.service.OrderMdService; +import com.glxp.udi.admin.mongo.service.OrderService; import com.glxp.udi.admin.req.udidl.ScheduledRequest; import com.glxp.udi.admin.service.param.SystemParamConfigService; import lombok.extern.slf4j.Slf4j; @@ -32,7 +33,7 @@ public class SupplementOrderTask implements SchedulingConfigurer { @Resource private ScheduledDao scheduledDao; @Resource - private OrderMdService orderMdService; + private OrderService orderService; @Resource private SystemParamConfigService systemParamConfigService; @@ -57,10 +58,10 @@ public class SupplementOrderTask implements SchedulingConfigurer { log.info("开始扫描补单数据"); //计数器 AtomicInteger counter = new AtomicInteger(0); - List orderEntities = orderMdService.getSupplementOrderBillNoList(); + List orderEntities = orderService.getSupplementOrderBillNoList(); if (CollUtil.isNotEmpty(orderEntities)) { - orderEntities.forEach(orderMdEntity -> { - BaseResponse baseResponse = orderMdService.supplementOrder(orderMdEntity); + orderEntities.forEach(orderEntity -> { + BaseResponse baseResponse = orderService.supplementOrder(orderEntity); if (baseResponse.getCode() == 20000) { counter.addAndGet(1); } diff --git a/src/main/java/com/glxp/udi/admin/thread/TransInoutService.java b/src/main/java/com/glxp/udi/admin/thread/TransInoutService.java index d9a02f5..47bb967 100644 --- a/src/main/java/com/glxp/udi/admin/thread/TransInoutService.java +++ b/src/main/java/com/glxp/udi/admin/thread/TransInoutService.java @@ -4,13 +4,9 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.StrUtil; import com.glxp.udi.admin.constant.ConstantStatus; import com.glxp.udi.admin.entity.basic.BussinessTypeEntity; -import com.glxp.udi.admin.entity.inout.UdiInfoEntity; -import com.glxp.udi.admin.entity.inout.UnitMaintainEntity; -import com.glxp.udi.admin.entity.inout.WarehouseEntity; -import com.glxp.udi.admin.entity.inout.WarehousetempEntity; -import com.glxp.udi.admin.entity.mongo.OrderMdEntity; -import com.glxp.udi.admin.mongo.service.OrderDetailMdService; -import com.glxp.udi.admin.mongo.service.OrderMdService; +import com.glxp.udi.admin.entity.inout.*; +import com.glxp.udi.admin.mongo.service.OrderDetailService; +import com.glxp.udi.admin.mongo.service.OrderService; import com.glxp.udi.admin.mongo.service.WarehouseMdService; import com.glxp.udi.admin.mongo.service.WarehouseTempMdService; import com.glxp.udi.admin.req.inout.OrderFilterRequest; @@ -46,13 +42,13 @@ public class TransInoutService { @Resource private UdiInfoService udiInfoService; @Resource - private OrderMdService orderService; + private OrderService orderService; @Resource private WarehouseTempMdService warehouseTempMdService; @Resource private WarehouseMdService warehouseMdService; @Resource - private OrderDetailMdService orderDetailMdService; + private OrderDetailService orderDetailService; @Resource private InvProductsTrService invProductsTrService; @Resource @@ -65,13 +61,13 @@ public class TransInoutService { private GennerOrderUtils gennerOrderUtils; @Async - public void transInout(OrderMdEntity orderMdEntity) { + public void transInout(OrderEntity orderEntity) { OrderFilterRequest orderFilterRequest = new OrderFilterRequest(); - orderFilterRequest.setCorpOrderId(orderMdEntity.getCorpOrderId()); + orderFilterRequest.setCorpOrderId(orderEntity.getCorpOrderId()); orderFilterRequest.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS); //查询已完成单据 - List orderMdEntities = orderService.findAll(orderFilterRequest); - OrderMdEntity tempEntity = new OrderMdEntity(); - tempEntity.setOrderId(orderMdEntity.getOrderId()); + List orderEntities = orderService.findAll(orderFilterRequest); + OrderEntity tempEntity = new OrderEntity(); + tempEntity.setOrderId(orderEntity.getOrderId()); tempEntity.setStatus(ConstantStatus.ORDER_STATUS_PROCESS); orderService.updateOrder(tempEntity); /** @@ -81,36 +77,36 @@ public class TransInoutService { * * 此逻辑可以正常处理多条重复单据中的一条,若不添加状态查询,则多单全部无法处理 */ - if (orderMdEntities.size() >= 1) { + if (orderEntities.size() >= 1) { tempEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL); tempEntity.setRemark("单据重复上传"); orderService.updateOrder(tempEntity); return; } - BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(orderMdEntity.getAction(), String.valueOf(orderMdEntity.getCustomerId())); + BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(orderEntity.getAction(), String.valueOf(orderEntity.getCustomerId())); if (bussinessTypeEntity == null) { return; } - if (StrUtil.isBlank(orderMdEntity.getFromCorp())) { + if (StrUtil.isBlank(orderEntity.getFromCorp())) { tempEntity.setRemark("未选择往来单位"); tempEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL); orderService.updateOrder(tempEntity); return; - } else if (StrUtil.isBlank(orderMdEntity.getFromCorpId())) { + } else if (StrUtil.isBlank(orderEntity.getFromCorpId())) { if (bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_INPUT && bussinessTypeEntity.isGenUnit()) { UnitMaintainEntity basicUnitMaintainEntity = new UnitMaintainEntity(); basicUnitMaintainEntity.setErpId(CustomUtil.getUnitId()); basicUnitMaintainEntity.setCorpType(ConstantStatus.CORP_SICK); basicUnitMaintainEntity.setOutType(ConstantStatus.CORP_SICK_SICK); - basicUnitMaintainEntity.setName(orderMdEntity.getFromCorp()); - basicUnitMaintainEntity.setCustomerId(orderMdEntity.getCustomerId().toString()); + basicUnitMaintainEntity.setName(orderEntity.getFromCorp()); + basicUnitMaintainEntity.setCustomerId(orderEntity.getCustomerId().toString()); tempEntity.setFromCorpId(basicUnitMaintainEntity.getErpId()); orderService.updateOrder(tempEntity); unitMaintainService.insertUnitMaintain(basicUnitMaintainEntity); } - UnitMaintainEntity unitMaintainEntity = unitMaintainService.selectByName(orderMdEntity.getFromCorp()); + UnitMaintainEntity unitMaintainEntity = unitMaintainService.selectByName(orderEntity.getFromCorp()); if (unitMaintainEntity == null) { tempEntity.setRemark("未选择往来单位"); tempEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL); @@ -121,11 +117,11 @@ public class TransInoutService { } } - List filterList = warehouseTempMdService.findTempByOrderId(orderMdEntity.getOrderId()); + List filterList = warehouseTempMdService.findTempByOrderId(orderEntity.getOrderId()); List insertList = new ArrayList<>(); - if (StrUtil.isBlank(orderMdEntity.getLocStorageCode())) { + if (StrUtil.isBlank(orderEntity.getLocStorageCode())) { if (!StrUtil.isEmpty(bussinessTypeEntity.getStorageCode())) { - orderMdEntity.setLocStorageCode(bussinessTypeEntity.getStorageCode()); + orderEntity.setLocStorageCode(bussinessTypeEntity.getStorageCode()); orderService.updateOrder(tempEntity); } else { tempEntity.setRemark("未选择当前仓库信息"); @@ -136,7 +132,7 @@ public class TransInoutService { } for (WarehousetempEntity warehousetemp : filterList) { - warehousetemp.setLocStorageCode(orderMdEntity.getLocStorageCode()); + warehousetemp.setLocStorageCode(orderEntity.getLocStorageCode()); String result = inoutUtils.filterCode(warehouseMdService, warehousetemp, setupService); if (result == null) { WarehouseEntity warehouseEntity = new WarehouseEntity(); @@ -171,7 +167,7 @@ public class TransInoutService { if (insertList.size() > 0) { warehouseMdService.insertWarehouses(insertList); - List temps = warehouseTempMdService.findTempByOrderId(orderMdEntity.getOrderId()); + List temps = warehouseTempMdService.findTempByOrderId(orderEntity.getOrderId()); List ids = new ArrayList<>(); for (WarehousetempEntity temp : temps) { ids.add(temp.getId()); @@ -179,7 +175,7 @@ public class TransInoutService { warehouseTempMdService.deleteTempWarehouses(ids); tempEntity.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS); orderService.updateOrder(tempEntity); - inoutUtils.generateConstrastDetail(udiInfoService, udiRelevanceService, orderDetailMdService, insertList); + inoutUtils.generateConstrastDetail(udiInfoService, udiRelevanceService, orderDetailService, insertList); insertList.clear(); //单据处理完成后判断单据类型是否开启二次验收校验,设置验收状态 if (bussinessTypeEntity.isSecCheckEnable()) { @@ -190,7 +186,7 @@ public class TransInoutService { tempEntity.setReceiveStatus(ConstantStatus.RECEIVE_NOT); //此单据类型不需要验收 tempEntity.setRemark("已完成"); orderService.updateOrder(tempEntity); - invProductsTrService.genInvProducts(orderMdEntity.getOrderId()); + invProductsTrService.genInvProducts(orderEntity.getOrderId()); } } } @@ -206,7 +202,7 @@ public class TransInoutService { WarehousetempEntity warehousetempEntity = warehousetempList.get(0); BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(postOrder.getBillType(), String.valueOf(customerId)); String orderId = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER + StrUtil.trimToEmpty(bussinessTypeEntity.getPrefix()), "yyyyMMdd")); - OrderMdEntity orderSaveRequest = new OrderMdEntity(); + OrderEntity orderSaveRequest = new OrderEntity(); orderSaveRequest.setOrderId(orderId); orderSaveRequest.setActDate(warehousetempEntity.getActDate()); orderSaveRequest.setCustomerId(customerId); diff --git a/src/main/java/com/glxp/udi/admin/thread/TransInoutTask.java b/src/main/java/com/glxp/udi/admin/thread/TransInoutTask.java index 80bf29c..d2b2bff 100644 --- a/src/main/java/com/glxp/udi/admin/thread/TransInoutTask.java +++ b/src/main/java/com/glxp/udi/admin/thread/TransInoutTask.java @@ -7,7 +7,7 @@ import com.glxp.udi.admin.dao.info.ScheduledDao; import com.glxp.udi.admin.entity.info.ScheduledEntity; import com.glxp.udi.admin.entity.mongo.OrderMdEntity; import com.glxp.udi.admin.entity.param.SystemParamConfigEntity; -import com.glxp.udi.admin.mongo.service.OrderMdService; +import com.glxp.udi.admin.mongo.service.OrderService; import com.glxp.udi.admin.req.inout.OrderFilterRequest; import com.glxp.udi.admin.req.udidl.ScheduledRequest; import com.glxp.udi.admin.service.param.SystemParamConfigService; @@ -34,7 +34,7 @@ public class TransInoutTask implements SchedulingConfigurer { @Resource private SystemParamCustomerConfigService systemParamCustomerConfigService; @Resource - private OrderMdService orderMdService; + private OrderService orderService; @Resource protected ScheduledDao scheduledDao; @@ -60,7 +60,7 @@ public class TransInoutTask implements SchedulingConfigurer { //查询待处理单据,判断此单据的用户是否开启了自动处理单据,如果已开启则自动处理,未开启跳过 OrderFilterRequest orderFilterRequest = new OrderFilterRequest(); orderFilterRequest.setStatus(ConstantStatus.ORDER_STATUS_WAIT); - List list = orderMdService.findAll(orderFilterRequest); + List list = orderService.findAll(orderFilterRequest); if (CollUtil.isNotEmpty(list)) { for (OrderMdEntity orderMdEntity : list) { SystemParamConfigEntity io_transInout_auto = systemParamCustomerConfigService.getParamByKey(SystemParamConstant.IO_TRANSINOUT_AUTO, orderMdEntity.getCustomerId()); diff --git a/src/main/java/com/glxp/udi/admin/util/inout/InoutUtils.java b/src/main/java/com/glxp/udi/admin/util/inout/InoutUtils.java index bb046f5..9864a45 100644 --- a/src/main/java/com/glxp/udi/admin/util/inout/InoutUtils.java +++ b/src/main/java/com/glxp/udi/admin/util/inout/InoutUtils.java @@ -10,7 +10,7 @@ import com.glxp.udi.admin.entity.inout.UdiInfoEntity; import com.glxp.udi.admin.entity.inout.WarehouseEntity; import com.glxp.udi.admin.entity.inout.WarehousetempEntity; import com.glxp.udi.admin.entity.udid.UdiEntity; -import com.glxp.udi.admin.mongo.service.OrderDetailMdService; +import com.glxp.udi.admin.mongo.service.OrderDetailService; import com.glxp.udi.admin.mongo.service.WarehouseMdService; import com.glxp.udi.admin.req.inout.FilterWarehouseRequest; import com.glxp.udi.admin.service.info.SetupService; @@ -208,7 +208,7 @@ public class InoutUtils { } public void generateConstrastDetail(UdiInfoService udiInfoService, UdiRelevanceService udiRelevanceService, - OrderDetailMdService orderDetailMdService, + OrderDetailService orderDetailService, List warehouseEntityList) { if (warehouseEntityList != null && warehouseEntityList.size() > 0) { List udiInfoEntities = new ArrayList<>(); @@ -254,7 +254,7 @@ public class InoutUtils { erpOrderEntities.add(orderDetailEntity); } if (!erpOrderEntities.isEmpty()) { - orderDetailMdService.insertOrderDetail(erpOrderEntities); + orderDetailService.insertOrderDetail(erpOrderEntities); } } } diff --git a/src/main/resources/mybatis/mapper/inout/OrderDao.xml b/src/main/resources/mybatis/mapper/inout/OrderDao.xml new file mode 100644 index 0000000..4d9040d --- /dev/null +++ b/src/main/resources/mybatis/mapper/inout/OrderDao.xml @@ -0,0 +1,23 @@ + + + + + + + update io_order set actDate = #{actDate} + + + orderId = #{item} + + + + + + + + update io_order set replicateNo = #{replicateNo} where orderId = #{orderId} + + + \ No newline at end of file