From 7938c80929d3b5951cda09bc0a23786dc10981f2 Mon Sep 17 00:00:00 2001 From: x_z Date: Tue, 31 May 2022 09:58:37 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=B7=BB=E5=8A=A0=E5=8D=95=E6=8D=AE=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=8A=9F=E8=83=BD=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=202.=E6=89=AB=E7=A0=81=E5=8D=95=E6=8D=AE=E5=92=8C=E4=B8=9A?= =?UTF-8?q?=E5=8A=A1=E5=8D=95=E6=8D=AE=E6=B7=BB=E5=8A=A0=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ----- 添加数据sql脚本 ----- -- 扫码单据表添加审核时间字段 ALTER TABLE `spms`.`io_order` ADD COLUMN `auditTime` datetime NULL COMMENT '审核时间' AFTER `updateTime`; -- 刷写审核时间字段 update io_order set auditTime = updateTime; -- 业务单据表添加审核时间字段 ALTER TABLE `spms`.`stock_order` ADD COLUMN `auditTime` datetime NULL COMMENT '审核时间' AFTER `updateTime`; -- 刷写审核时间字段 update stock_order set auditTime = updateTime; --- .../controller/inout/OrderController.java | 51 ++++++-- .../inout/StockOrderController.java | 60 --------- .../controller/inout/WareHouseController.java | 54 ++++++-- .../glxp/sale/admin/dao/inout/CodesDao.java | 11 +- .../glxp/sale/admin/dao/inout/OrderDao.java | 19 ++- .../sale/admin/dao/inout/OrderDetailDao.java | 19 ++- .../sale/admin/dao/inout/StockOrderDao.java | 8 +- .../admin/dao/inout/StockOrderDetailDao.java | 2 +- .../dao/inventory/InvProductDetailDao.java | 9 +- .../admin/entity/inout/ErpOrderEntity.java | 5 +- .../sale/admin/entity/inout/OrderEntity.java | 5 +- .../entity/inout/StockOrderDetailEntity.java | 3 - .../admin/entity/inout/StockOrderEntity.java | 7 +- .../admin/entity/inout/WarehouseEntity.java | 3 - .../inventory/InvProductDetailEntity.java | 3 - .../admin/req/inout/CodesReplaceRequest.java | 34 +++++ .../admin/res/inout/OrderEditRequest.java | 19 +++ .../admin/res/inout/WarehouseResponse.java | 1 + .../admin/service/inout/CodesService.java | 8 ++ .../admin/service/inout/OrderService.java | 25 ++++ .../service/inout/StockOrderService.java | 9 -- .../service/inout/impl/CodesServiceImpl.java | 77 +++++++++++- .../service/inout/impl/OrderServiceImpl.java | 115 +++++++++++++++++ .../inout/impl/StockOrderServiceImpl.java | 75 +---------- .../mybatis/mapper/inout/CodesDao.xml | 24 ++-- .../mybatis/mapper/inout/OrderDao.xml | 116 +++++++++--------- .../mybatis/mapper/inout/OrderDetailDao.xml | 44 +++---- .../mybatis/mapper/inout/StockOrderDao.xml | 27 ++-- .../mybatis/mapper/inout/StockOrderDetail.xml | 24 ++-- .../mapper/inventory/InvProductDetailDao.xml | 29 ++--- 30 files changed, 560 insertions(+), 326 deletions(-) create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/req/inout/CodesReplaceRequest.java create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/res/inout/OrderEditRequest.java diff --git a/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/OrderController.java b/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/OrderController.java index f3bb4c5..db14e1c 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/OrderController.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/OrderController.java @@ -16,13 +16,13 @@ import com.glxp.sale.admin.entity.udid.UdiEntity; import com.glxp.sale.admin.req.inout.*; import com.glxp.sale.admin.req.inventory.FilterInvUserRequest; import com.glxp.sale.admin.res.PageSimpleResponse; +import com.glxp.sale.admin.res.inout.OrderEditRequest; import com.glxp.sale.admin.service.auth.CustomerService; import com.glxp.sale.admin.service.basic.BussinessTypeService; import com.glxp.sale.admin.service.info.CompanyService; import com.glxp.sale.admin.service.inout.*; import com.glxp.sale.admin.service.inventory.InvWarehouseService; import com.glxp.sale.admin.thread.InvProductsTrService; -import com.glxp.sale.admin.thread.IoTransInoutService; import com.glxp.sale.admin.util.CustomUtil; import com.glxp.sale.admin.util.FilterUdiUtils; import com.glxp.sale.common.enums.ResultEnum; @@ -38,10 +38,7 @@ import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.io.IOException; import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; @RestController @@ -56,8 +53,6 @@ public class OrderController { @Resource private OrderDetailService orderDetailService; @Resource - IoTransInoutService ioTransInoutService; - @Resource StockOrderService stockOrderService; @Resource InvProductsTrService invProductsTrService; @@ -71,7 +66,6 @@ public class OrderController { InvWarehouseService invWarehouseService; @Resource WarehouseUserService warehouseUserService; - @Resource CustomerService customerService; @@ -137,14 +131,18 @@ public class OrderController { @AuthRuleAnnotation("") @PostMapping("udiwms/inout/order/delete") public BaseResponse deleteOrder(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) { - if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } - String id = deleteRequest.getId(); + if (StrUtil.isBlank(deleteRequest.getId()) && CollUtil.isEmpty(deleteRequest.getIds())) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); + } + if (CollUtil.isNotEmpty(deleteRequest.getIds())) { + orderService.deleteOrders(deleteRequest.getIds()); + } else { + orderService.deleteOrders(Arrays.asList(deleteRequest.getId())); + } - orderService.deleteById(id); - orderDetailService.deleteByOrderId(id); return ResultVOUtils.success("删除成功"); } @@ -525,5 +523,34 @@ public class OrderController { } } + /** + * 查询单据删除页面数据 + * + * @param billNo + * @return + */ + @AuthRuleAnnotation("") + @GetMapping("/udiwms/inout/order/filterOrderForDelete") + public BaseResponse filterOrderForDelete(String billNo) { + if (StrUtil.isBlank(billNo)) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); + } + List orderEntities = orderService.filterOrderForDelete(billNo); + PageInfo pageInfo = new PageInfo<>(orderEntities); + PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); + pageSimpleResponse.setTotal(pageInfo.getTotal()); + pageSimpleResponse.setList(orderEntities); + return ResultVOUtils.success(pageSimpleResponse); + } + + @AuthRuleAnnotation("") + @PostMapping("/udiwms/inout/order/updateOrderInfo") + public BaseResponse updateOrderInfo(@RequestBody OrderEditRequest orderEditRequest) { + if (null == orderEditRequest || StrUtil.isBlank(orderEditRequest.getActDate()) || CollUtil.isEmpty(orderEditRequest.getOrderIds())) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); + } + orderService.updateOrderInfo(orderEditRequest.getActDate(), orderEditRequest.getAuditTime(), orderEditRequest.getOrderIds()); + return ResultVOUtils.success(); + } } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/StockOrderController.java b/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/StockOrderController.java index 235b9c8..91571a8 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/StockOrderController.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/StockOrderController.java @@ -292,51 +292,6 @@ public class StockOrderController { return ResultVOUtils.success(pageSimpleResponse); } - /** - * 单据删除页面查询单据列表 - * - * @param stockOrderFilterRequest - * @return - */ - @GetMapping("/udiwms/stock/order/filterOrderForDelete") - public BaseResponse filterOrderForDelete(StockOrderFilterRequest stockOrderFilterRequest, BindingResult bindingResult) { - if (bindingResult.hasErrors()) { - return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); - } - List stockOrderEntityList; - - if (StringUtils.isNotBlank(stockOrderFilterRequest.getCorpId())) { - CompanyEntity companyEntity = companyService.findCompany(Long.parseLong(stockOrderFilterRequest.getCorpId())); - if (companyEntity.getUnitIdFk().equals("110")) { - Integer userId = customerService.getUserId(); - stockOrderFilterRequest.setUnitIdFk(null); - stockOrderFilterRequest.setUserId(customerService.getUserId()); - InvWarehouseEntity invWarehouseEntity = invWarehouseService.selectByCode(stockOrderFilterRequest.getLocStorageCode()); - FilterInvUserRequest filterInvUserRequest = new FilterInvUserRequest(); - filterInvUserRequest.setCode(invWarehouseEntity.getCode()); - filterInvUserRequest.setUserid(userId.longValue()); - filterInvUserRequest.setIsDirector(true); - List warehouseUserEntities = warehouseUserService.filterWarehouseUsers(filterInvUserRequest); - if (CollUtil.isEmpty(warehouseUserEntities)) { - stockOrderFilterRequest.setUnionUser(userId); - } - } else - stockOrderFilterRequest.setUnitIdFk(companyEntity.getUnitIdFk()); - stockOrderFilterRequest.setCorpId(null); - } - - stockOrderEntityList = stockOrderService.filterListOr(stockOrderFilterRequest); - PageInfo pageInfo; - pageInfo = new PageInfo<>(stockOrderEntityList); - - //判断订单是否可以补单 - List resultList = orderService.checkSupplementOrder(stockOrderEntityList); - PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); - pageSimpleResponse.setTotal(pageInfo.getTotal()); - pageSimpleResponse.setList(resultList); - return ResultVOUtils.success(pageSimpleResponse); - } - @AuthRuleAnnotation("") @GetMapping("/udiwms/stock/order/filterDetail") public BaseResponse filterDetail(StockOrderFilterRequest stockOrderFilterRequest, @@ -419,21 +374,6 @@ public class StockOrderController { return ResultVOUtils.success(); } - /** - * 删除单据 - * - * @param id - * @return - */ - @AuthRuleAnnotation("") - @GetMapping("/udiwms/stock/order/deleteOrder") - public BaseResponse deleteOrder(@RequestParam("id") String id) { - if (StrUtil.isBlank(id)) { - return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); - } - return stockOrderService.deleteOrder(id); - } - @AuthRuleAnnotation("") @PostMapping("/udiwms/stock/order/update") public BaseResponse submitStockOrder(@RequestBody StockOrderEntity stockOrderEntity) { diff --git a/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/WareHouseController.java b/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/WareHouseController.java index 21ca91a..f6d83e3 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/WareHouseController.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/WareHouseController.java @@ -11,18 +11,18 @@ import com.glxp.sale.admin.entity.auth.AuthAdmin; import com.glxp.sale.admin.entity.auth.AuthLicense; import com.glxp.sale.admin.entity.basic.BasicUnitMaintainEntity; import com.glxp.sale.admin.entity.basic.BussinessTypeEntity; +import com.glxp.sale.admin.entity.basic.UdiInfoEntity; import com.glxp.sale.admin.entity.info.CompanyEntity; -import com.glxp.sale.admin.entity.info.CompanyProductRelevanceEntity; -import com.glxp.sale.admin.entity.inout.*; +import com.glxp.sale.admin.entity.inout.OrderEntity; +import com.glxp.sale.admin.entity.inout.StockOrderEntity; +import com.glxp.sale.admin.entity.inout.WarehouseEntity; +import com.glxp.sale.admin.entity.inout.WarehouseUserEntity; import com.glxp.sale.admin.entity.inventory.InvProductDetailEntity; import com.glxp.sale.admin.entity.param.SystemParamConfigEntity; import com.glxp.sale.admin.entity.udid.UdiEntity; import com.glxp.sale.admin.exception.JsonException; import com.glxp.sale.admin.req.basic.CompanyProductRelevanceRequest; -import com.glxp.sale.admin.req.basic.FilterUdiInfoRequest; -import com.glxp.sale.admin.req.info.FilterCompanyProductRelevanceRequest; import com.glxp.sale.admin.req.inout.*; -import com.glxp.sale.admin.req.inventory.FilterInvProductDetailRequest; import com.glxp.sale.admin.res.PageSimpleResponse; import com.glxp.sale.admin.res.basic.BussinessTypResponse; import com.glxp.sale.admin.res.basic.CompanyProductRelevanceResponse; @@ -32,6 +32,7 @@ import com.glxp.sale.admin.service.auth.AuthAdminService; import com.glxp.sale.admin.service.auth.CustomerService; import com.glxp.sale.admin.service.basic.BasicUnitMaintainService; import com.glxp.sale.admin.service.basic.BussinessTypeService; +import com.glxp.sale.admin.service.basic.UdiInfoService; import com.glxp.sale.admin.service.basic.UdiRelevanceService; import com.glxp.sale.admin.service.info.CompanyProductRelevanceService; import com.glxp.sale.admin.service.info.CompanyService; @@ -44,8 +45,6 @@ import com.glxp.sale.common.enums.ResultEnum; import com.glxp.sale.common.res.BaseResponse; import com.glxp.sale.common.util.ResultVOUtils; import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.*; @@ -55,7 +54,10 @@ import org.springframework.web.context.request.ServletRequestAttributes; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; -import java.util.*; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; import java.util.stream.Collectors; @RestController @@ -91,11 +93,12 @@ public class WareHouseController { CompanyProductRelevanceService companyProductRelevanceService; @Resource SystemParamConfigService systemParamConfigService; - Logger logger = LoggerFactory.getLogger(StockOrderController.class); @Resource StockOrderService stockOrderService; @Resource GennerOrderUtils gennerOrderUtils; + @Resource + private UdiInfoService udiInfoService; @AuthRuleAnnotation("") @GetMapping("admin/warehouse/inout/list") @@ -414,8 +417,8 @@ public class WareHouseController { return ResultVOUtils.error(500, "超出预验收库存数量"); } } - }else { - if(invProductDetailEntity.getCount()<1){ + } else { + if (invProductDetailEntity.getCount() < 1) { return ResultVOUtils.error(500, "超出预验收库存数量"); } } @@ -677,11 +680,11 @@ public class WareHouseController { try { String customerId = getCustomerId(); - if(customerId.equals("110")){ + if (customerId.equals("110")) { Integer userId = customerService.getUserId(); postOrderRequest.setCustomerId(customerId); postOrderRequest.setUserId(userId); - }else { + } else { postOrderRequest.setUserId(null); } @@ -844,4 +847,29 @@ public class WareHouseController { return ResultVOUtils.success(); } + /** + * 替换单据条码 + * + * @return + */ + @AuthRuleAnnotation("") + @PostMapping("/warehouse/inout/replaceCodes") + public BaseResponse replaceCodes(@RequestBody CodesReplaceRequest codesReplaceRequest) { + if (StrUtil.isBlank(codesReplaceRequest.getCode())) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); + } + UdiEntity udi = FilterUdiUtils.getUdi(codesReplaceRequest.getCode()); + if (null == udi || StrUtil.isBlank(udi.getUdi())) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "条码错误"); + } + //判断udi码是否在产品信息中已维护,如未维护则返回错误,否则库存无法对应 + UdiInfoEntity udiInfoEntity = udiInfoService.findByNameCode(udi.getUdi()); + if (null == udiInfoEntity) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "产品未维护"); + } + codesReplaceRequest.setUdiEntity(udiInfoEntity); + codesService.replaceCodes(codesReplaceRequest); + return ResultVOUtils.success(); + } + } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/dao/inout/CodesDao.java b/api-admin/src/main/java/com/glxp/sale/admin/dao/inout/CodesDao.java index 8ec753d..69f8689 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/dao/inout/CodesDao.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/dao/inout/CodesDao.java @@ -45,6 +45,13 @@ public interface CodesDao { boolean updateSupId(@Param("supId") String supId, @Param("nameCode") String nameCode, @Param("orderId") String orderId); - - void updateDelFlag(@Param("orderId") String orderId, @Param("delFlag") boolean delFlag); + /** + * 通过订单号,查询此订单号在码表中所关联的全部订单 + * + * @param orderId + * @return + */ + List selectOrderIdsByOrderId(@Param("orderId") String orderId); + + boolean deleteByOrderIdAndCode(@Param("orderId") String orderId, @Param("code") String code); } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/dao/inout/OrderDao.java b/api-admin/src/main/java/com/glxp/sale/admin/dao/inout/OrderDao.java index f42c8c3..ca1a7fd 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/dao/inout/OrderDao.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/dao/inout/OrderDao.java @@ -53,5 +53,22 @@ public interface OrderDao { List findAllByTime(OrderFilterRequest orderFilterRequest); - void updateDelFlag(@Param("id") String id, @Param("delFlag") boolean delFlag); + /** + * 根据扫码单据ID和业务单据ID查询已完成单据 + * + * @param billNo + * @return + */ + OrderEntity selectByBillNo(String billNo); + + List selectByIds(@Param("orderIds") List orderIds); + + /** + * 批量更新单据信息 + * + * @param actDate + * @param orderIds + * @return + */ + boolean updateOrderTime(@Param("actDate") String actDate, @Param("auditTime") String auditTime, @Param("updateTime") String updateTime, @Param("orderIds") List orderIds); } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/dao/inout/OrderDetailDao.java b/api-admin/src/main/java/com/glxp/sale/admin/dao/inout/OrderDetailDao.java index 7a910c6..8474064 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/dao/inout/OrderDetailDao.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/dao/inout/OrderDetailDao.java @@ -44,5 +44,22 @@ public interface OrderDetailDao { boolean deleteByOrderId(@Param("id") String id); - void updateDelFlag(@Param("orderIdFk") String orderIdFk, @Param("delFlag") boolean delFlag); + /** + * 根据nameCode和orderId查询扫码单据详情 + * + * @param nameCode + * @param orderId + * @return + */ + ErpOrderEntity selectByNameCodeAndOrderId(@Param("nameCode") String nameCode, @Param("orderId") String orderId); + + boolean deleteByOrderIdAndNameCode(@Param("orderId") String orderId, @Param("nameCode") String nameCode); + + /** + * 根据单号统计单据详情数量 + * + * @param orderId + * @return + */ + int countByOrderId(@Param("orderId") String orderId); } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/dao/inout/StockOrderDao.java b/api-admin/src/main/java/com/glxp/sale/admin/dao/inout/StockOrderDao.java index 5122e19..ed80aa9 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/dao/inout/StockOrderDao.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/dao/inout/StockOrderDao.java @@ -49,5 +49,11 @@ public interface StockOrderDao { */ StockOrderEntity selectById(@Param("id") String id); - void updateDelFlag(@Param("id") String id, @Param("delFlag") boolean delFlag); + /** + * 根据扫码单据号删除业务单据 + * + * @param orderIdFk + * @return + */ + boolean deleteByOrderIdFk(String orderIdFk); } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/dao/inout/StockOrderDetailDao.java b/api-admin/src/main/java/com/glxp/sale/admin/dao/inout/StockOrderDetailDao.java index 929d451..9adecbc 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/dao/inout/StockOrderDetailDao.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/dao/inout/StockOrderDetailDao.java @@ -27,5 +27,5 @@ public interface StockOrderDetailDao { StockOrderDetailEntity findOne(@Param("id") String id); - void updateDelFlag(@Param("orderIdFk") String orderIdFk, @Param("delFlag") boolean delFlag); + boolean deleteByOrderIdAndProductId(@Param("orderId") String orderId, @Param("productId") String productId); } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/dao/inventory/InvProductDetailDao.java b/api-admin/src/main/java/com/glxp/sale/admin/dao/inventory/InvProductDetailDao.java index e85b538..68dce81 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/dao/inventory/InvProductDetailDao.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/dao/inventory/InvProductDetailDao.java @@ -30,5 +30,12 @@ public interface InvProductDetailDao { InvProductDetailEntity isExit(FilterInvProductDetailRequest filterInvProductDetailRequest); - void updateDelFlag(@Param("orderIdFk") String orderIdFk, @Param("delFlag") boolean delFlag); + /** + * 根据orderId删除库存详情 + * + * @param orderIdFk + */ + boolean deleteByOrderId(@Param("orderIdFk") String orderIdFk); + + boolean deleteByOrderIdAndCode(@Param("orderId") String orderId, @Param("code") String code); } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/entity/inout/ErpOrderEntity.java b/api-admin/src/main/java/com/glxp/sale/admin/entity/inout/ErpOrderEntity.java index 0f8f7b4..b53f748 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/entity/inout/ErpOrderEntity.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/entity/inout/ErpOrderEntity.java @@ -23,7 +23,7 @@ public class ErpOrderEntity { * dtlgoodsqty : 4000 */ - private long id; + private Long id; private String erpOrderId; private String iodtlId; private String inoutId; @@ -77,7 +77,4 @@ public class ErpOrderEntity { private String bindRlFk; - //是否删除 - private boolean delFlag; - } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/entity/inout/OrderEntity.java b/api-admin/src/main/java/com/glxp/sale/admin/entity/inout/OrderEntity.java index cdb4456..97bba5f 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/entity/inout/OrderEntity.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/entity/inout/OrderEntity.java @@ -48,8 +48,7 @@ public class OrderEntity { private String originUllageSupNo; private Date updateTime; private boolean preCheck; - - //是否删除 - private boolean delFlag; + //审核时间 + private Date auditTime; } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/entity/inout/StockOrderDetailEntity.java b/api-admin/src/main/java/com/glxp/sale/admin/entity/inout/StockOrderDetailEntity.java index 5cfb566..f61c8e9 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/entity/inout/StockOrderDetailEntity.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/entity/inout/StockOrderDetailEntity.java @@ -37,7 +37,4 @@ public class StockOrderDetailEntity { private String manufactory; private boolean allowNoBatch; - //是否删除 - private boolean delFlag; - } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/entity/inout/StockOrderEntity.java b/api-admin/src/main/java/com/glxp/sale/admin/entity/inout/StockOrderEntity.java index dee3ae1..a6d1899 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/entity/inout/StockOrderEntity.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/entity/inout/StockOrderEntity.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.math.BigDecimal; +import java.util.Date; @Data public class StockOrderEntity { @@ -35,7 +36,9 @@ public class StockOrderEntity { private Integer createUser; private Integer reviewUser; - //是否删除 - private boolean delFlag; + //审核时间 + private Date auditTime; + //更新时间 + private Date updateTime; } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/entity/inout/WarehouseEntity.java b/api-admin/src/main/java/com/glxp/sale/admin/entity/inout/WarehouseEntity.java index f4ec56a..d2a863f 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/entity/inout/WarehouseEntity.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/entity/inout/WarehouseEntity.java @@ -35,9 +35,6 @@ public class WarehouseEntity { private String mySupId; - //是否删除 - private boolean delFlag; - public String getSupId() { if (supId == null) { diff --git a/api-admin/src/main/java/com/glxp/sale/admin/entity/inventory/InvProductDetailEntity.java b/api-admin/src/main/java/com/glxp/sale/admin/entity/inventory/InvProductDetailEntity.java index 31405fb..10f569f 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/entity/inventory/InvProductDetailEntity.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/entity/inventory/InvProductDetailEntity.java @@ -26,7 +26,4 @@ public class InvProductDetailEntity { private String invStorageCode; private String invWarehouseCode; - //是否删除 - private boolean delFlag; - } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/req/inout/CodesReplaceRequest.java b/api-admin/src/main/java/com/glxp/sale/admin/req/inout/CodesReplaceRequest.java new file mode 100644 index 0000000..616b6f1 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/req/inout/CodesReplaceRequest.java @@ -0,0 +1,34 @@ +package com.glxp.sale.admin.req.inout; + +import com.glxp.sale.admin.entity.basic.UdiInfoEntity; +import lombok.Data; + +/** + * 替换单据条码请求参数 + */ +@Data +public class CodesReplaceRequest { + + /** + * 原条码 + */ + private String code; + + /** + * 原扫码数量 + */ + private String count; + + /** + * 新条码 + */ + private String newCode; + + /** + * 新扫码数量 + */ + private Integer newCount; + + private UdiInfoEntity udiEntity; + +} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/res/inout/OrderEditRequest.java b/api-admin/src/main/java/com/glxp/sale/admin/res/inout/OrderEditRequest.java new file mode 100644 index 0000000..b2dadf0 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/res/inout/OrderEditRequest.java @@ -0,0 +1,19 @@ +package com.glxp.sale.admin.res.inout; + +import lombok.Data; + +import java.util.List; + +@Data +public class OrderEditRequest { + + //创建时间 + private String actDate; + + //审核时间 + private String auditTime; + + //扫码单据号 + private List orderIds; + +} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/res/inout/WarehouseResponse.java b/api-admin/src/main/java/com/glxp/sale/admin/res/inout/WarehouseResponse.java index 974c44d..1886fa8 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/res/inout/WarehouseResponse.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/res/inout/WarehouseResponse.java @@ -16,4 +16,5 @@ public class WarehouseResponse { private long id; private String fromCorp; private Integer count; + private String orderId; } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/inout/CodesService.java b/api-admin/src/main/java/com/glxp/sale/admin/service/inout/CodesService.java index 27a3f67..22d0204 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/service/inout/CodesService.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/inout/CodesService.java @@ -1,6 +1,7 @@ package com.glxp.sale.admin.service.inout; import com.glxp.sale.admin.entity.inout.WarehouseEntity; +import com.glxp.sale.admin.req.inout.CodesReplaceRequest; import com.glxp.sale.admin.req.inout.WarehouseQueryRequest; import java.util.List; @@ -39,4 +40,11 @@ public interface CodesService { boolean updateRelId(String relId, String nameCode, String orderId); boolean updateSupId(String sup, String nameCode, String orderId); + + /** + * 替换单据条码 + * + * @param codesReplaceRequest + */ + void replaceCodes(CodesReplaceRequest codesReplaceRequest); } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/inout/OrderService.java b/api-admin/src/main/java/com/glxp/sale/admin/service/inout/OrderService.java index 82c9371..eced6db 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/service/inout/OrderService.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/inout/OrderService.java @@ -71,4 +71,29 @@ public interface OrderService { * @return */ List checkSupplementOrder(List stockOrderEntityList); + + /** + * 查询单据删除页面订单列表 + * + * @param billNo + * @return + */ + List filterOrderForDelete(String billNo); + + /** + * 删除单据 + * + * @param ids + */ + void deleteOrders(List ids); + + /** + * 批量更新单据信息 + * + * @param actDate + * @param auditTime + * @param orderIds + * @return + */ + boolean updateOrderInfo(String actDate, String auditTime, List orderIds); } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/inout/StockOrderService.java b/api-admin/src/main/java/com/glxp/sale/admin/service/inout/StockOrderService.java index d31a5b6..8b046cf 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/service/inout/StockOrderService.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/inout/StockOrderService.java @@ -4,7 +4,6 @@ import com.glxp.sale.admin.entity.inout.StockOrderEntity; import com.glxp.sale.admin.entity.inout.StockOrderPrintEntity; import com.glxp.sale.admin.req.inout.StockOrderFilterRequest; import com.glxp.sale.admin.req.inout.StockOrderQueryRequest; -import com.glxp.sale.common.res.BaseResponse; import java.util.List; @@ -44,12 +43,4 @@ public interface StockOrderService { */ List getSupplementOrderBillNoList(); - /** - * 删除订单 - * - * @param id - * @return - */ - BaseResponse deleteOrder(String id); - } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/inout/impl/CodesServiceImpl.java b/api-admin/src/main/java/com/glxp/sale/admin/service/inout/impl/CodesServiceImpl.java index bb7080c..fc8194d 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/service/inout/impl/CodesServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/inout/impl/CodesServiceImpl.java @@ -1,11 +1,20 @@ package com.glxp.sale.admin.service.inout.impl; import com.github.pagehelper.PageHelper; -import com.glxp.sale.admin.dao.inout.CodesDao; +import com.glxp.sale.admin.constant.ConstantType; +import com.glxp.sale.admin.dao.inout.*; +import com.glxp.sale.admin.dao.inventory.InvProductDao; +import com.glxp.sale.admin.dao.inventory.InvProductDetailDao; import com.glxp.sale.admin.entity.inout.WarehouseEntity; +import com.glxp.sale.admin.entity.inventory.InvProductDetailEntity; +import com.glxp.sale.admin.entity.inventory.InvProductEntity; +import com.glxp.sale.admin.req.inout.CodesReplaceRequest; import com.glxp.sale.admin.req.inout.WarehouseQueryRequest; +import com.glxp.sale.admin.req.inventory.FilterInvProductDetailRequest; +import com.glxp.sale.admin.req.inventory.FilterInvProductRequest; import com.glxp.sale.admin.service.inout.CodesService; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.Collections; @@ -16,6 +25,18 @@ public class CodesServiceImpl implements CodesService { @Resource CodesDao codesDao; + @Resource + private InvProductDao invProductDao; + @Resource + private InvProductDetailDao invProductDetailDao; + @Resource + private OrderDetailDao orderDetailDao; + @Resource + private StockOrderDetailDao stockOrderDetailDao; + @Resource + private OrderDao orderDao; + @Resource + private StockOrderDao stockOrderDao; @Override public List listWarehouse(WarehouseQueryRequest warehouseQueryRequest) { @@ -130,4 +151,58 @@ public class CodesServiceImpl implements CodesService { return codesDao.updateSupId(sup, nameCode, orderId); } + @Transactional(rollbackFor = Exception.class) + @Override + public void replaceCodes(CodesReplaceRequest codesReplaceRequest) { + List codeList = codesDao.findByCode(codesReplaceRequest.getCode()); + + //删除码表,添加新的条码,并更新库存 + for (WarehouseEntity warehouseEntity : codeList) { + //构造新的码 + WarehouseEntity codeEntity = new WarehouseEntity(); + //删除码详情 + codesDao.deleteByOrderIdAndCode(warehouseEntity.getOrderId(), warehouseEntity.getCode()); + + //查询库存详情 + FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest(); + filterInvProductDetailRequest.setOriginCode(codesReplaceRequest.getCode()); + filterInvProductDetailRequest.setOrderIdFk(codeEntity.getOrderId()); + List invProductDetailEntities = invProductDetailDao.filterInvProductDetail(filterInvProductDetailRequest); + + InvProductDetailEntity invProductDetailEntity = invProductDetailEntities.get(0); //库存 + + //删除库存详情 + invProductDetailDao.deleteByOrderIdAndCode(warehouseEntity.getOrderId(), codesReplaceRequest.getCode()); + //查询原库存详情和新的库存详情 + FilterInvProductRequest filterInvProductRequest = new FilterInvProductRequest(); + filterInvProductRequest.setRelIdFk(invProductDetailEntity.getProductIdFk()); + InvProductEntity invProductEntity = invProductDao.filterInvProduct(filterInvProductRequest).get(0); + + if (invProductDetailEntity.getMainAction().equals(ConstantType.TYPE_OUT)) { + //出库 + int count = invProductEntity.getOutCount() + invProductDetailEntity.getCount(); + invProductEntity.setOutCount(count); + } else if (invProductDetailEntity.getMainAction().equals(ConstantType.TYPE_PUT)) { + //入库 + int count = invProductEntity.getInCount() - invProductDetailEntity.getCount(); + invProductEntity.setInCount(count); + } + + //更新库存 + invProductDao.updateInvProduct(invProductEntity); + + //删除单据详情 + orderDetailDao.deleteByOrderIdAndNameCode(warehouseEntity.getOrderId(), codesReplaceRequest.getUdiEntity().getNameCode()); + stockOrderDetailDao.deleteByOrderIdAndProductId(warehouseEntity.getOrderId(), warehouseEntity.getRelId()); + + int orderDetailCount = orderDetailDao.countByOrderId(warehouseEntity.getOrderId()); + if (orderDetailCount == 0) { + //当单据详情数量为0时,删除扫码单据和业务单据 + orderDao.deleteById(warehouseEntity.getOrderId()); + stockOrderDao.deleteByOrderIdFk(warehouseEntity.getOrderId()); + } + + } + } + } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/inout/impl/OrderServiceImpl.java b/api-admin/src/main/java/com/glxp/sale/admin/service/inout/impl/OrderServiceImpl.java index 18b2d7b..20da7d8 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/service/inout/impl/OrderServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/inout/impl/OrderServiceImpl.java @@ -5,16 +5,24 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import com.github.pagehelper.PageHelper; import com.glxp.sale.admin.constant.ConstantStatus; +import com.glxp.sale.admin.constant.ConstantType; import com.glxp.sale.admin.dao.basic.BussinessTypeDao; import com.glxp.sale.admin.dao.inout.*; +import com.glxp.sale.admin.dao.inventory.InvProductDao; +import com.glxp.sale.admin.dao.inventory.InvProductDetailDao; import com.glxp.sale.admin.dao.inventory.InvWarehouseDao; import com.glxp.sale.admin.entity.basic.BussinessTypeEntity; import com.glxp.sale.admin.entity.inout.OrderEntity; import com.glxp.sale.admin.entity.inout.StockOrderEntity; import com.glxp.sale.admin.entity.inout.WarehouseEntity; +import com.glxp.sale.admin.entity.inventory.InvProductDetailEntity; +import com.glxp.sale.admin.entity.inventory.InvProductEntity; import com.glxp.sale.admin.entity.param.SystemParamConfigEntity; import com.glxp.sale.admin.req.inout.OrderFilterRequest; import com.glxp.sale.admin.req.inout.OrderQueryRequest; +import com.glxp.sale.admin.req.inout.StockOrderFilterRequest; +import com.glxp.sale.admin.req.inventory.FilterInvProductDetailRequest; +import com.glxp.sale.admin.req.inventory.FilterInvProductRequest; import com.glxp.sale.admin.res.inout.StockOrderResponse; import com.glxp.sale.admin.service.inout.OrderService; import com.glxp.sale.admin.service.param.SystemParamConfigService; @@ -24,11 +32,14 @@ import com.glxp.sale.common.res.BaseResponse; import com.glxp.sale.common.util.ResultVOUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; @Slf4j @Service @@ -52,6 +63,14 @@ public class OrderServiceImpl implements OrderService { SystemParamConfigService systemParamConfigService; @Resource GennerOrderUtils gennerOrderUtils; + @Resource + private InvProductDao invProductDao; + @Resource + private InvProductDetailDao invProductDetailDao; + @Resource + private StockOrderDetailDao stockOrderDetailDao; + @Resource + private OrderDetailDao orderDetailDao; @Override public List listOrders(OrderQueryRequest orderQueryRequest) { @@ -294,5 +313,101 @@ public class OrderServiceImpl implements OrderService { return result; } + @Override + public List filterOrderForDelete(String billNo) { + OrderEntity orderEntity = orderDao.selectByBillNo(billNo); + if (null == orderEntity) { + return Collections.emptyList(); + } + //查询码表中所有的单据号 + List orderIds = codesDao.selectOrderIdsByOrderId(orderEntity.getId()); + if (orderIds.size() > 1) { + orderIds.removeIf(s -> s.equals(orderEntity.getId())); + } else { + return Collections.singletonList(orderEntity); + } + + List orderEntities = orderDao.selectByIds(orderIds); + orderEntities.add(0, orderEntity); + return orderEntities; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteOrders(List ids) { + for (String id : ids) { + log.info("开始删除单号为:" + id + "的单据"); + //查询扫码单据 + OrderFilterRequest orderFilterRequest = new OrderFilterRequest(); + orderFilterRequest.setId(id); + OrderEntity orderEntity = orderDao.findOne(orderFilterRequest); + if (orderEntity.getStatus() == 4) { + //查询库存详情 + FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest(); + filterInvProductDetailRequest.setOrderIdFk(id); + List invProductDetailEntities = invProductDetailDao.filterInvProductDetail(filterInvProductDetailRequest); + Map> invProductDetailMap = invProductDetailEntities.stream().collect(Collectors.groupingBy(InvProductDetailEntity::getProductIdFk)); + + List invProductList = new ArrayList<>(invProductDetailMap.keySet().size()); + for (String productIdFk : invProductDetailMap.keySet()) { + FilterInvProductRequest filterInvProductRequest = new FilterInvProductRequest(); + filterInvProductRequest.setRelIdFk(productIdFk); + List invProductEntities = invProductDao.filterInvProduct(filterInvProductRequest); + InvProductEntity invProductEntity = invProductEntities.get(0); + List temp = invProductDetailMap.get(productIdFk); + String mainAction = temp.get(0).getMainAction(); + int sum = temp.stream().mapToInt(InvProductDetailEntity::getCount).sum(); + if (mainAction.equals(ConstantType.TYPE_PUT)) { + //入库,在原有库存基础上减库存 + int count = invProductEntity.getInCount() - sum; + invProductEntity.setInCount(count); + } else if (mainAction.equals(ConstantType.TYPE_OUT)) { + //出库,在原有库存上增加库存 + int count = invProductEntity.getOutCount() + sum; + invProductEntity.setOutCount(count); + } + + invProductList.add(invProductEntity); + } + + //删除单据相关数据,更新库存 + try { + //更新库存 + for (InvProductEntity invProductEntity : invProductList) { + invProductDao.updateInvProduct(invProductEntity); + } + //删除库存详情 + invProductDetailDao.deleteByOrderId(id); + //删除码详情 + codesDao.deleteByOrderId(id); + //查询业务单据 + StockOrderFilterRequest stockOrderFilterRequest = new StockOrderFilterRequest(); + stockOrderFilterRequest.setBillNo(orderEntity.getErpFk()); + StockOrderEntity stockOrderEntity = stockOrderDao.findOne(stockOrderFilterRequest); + //删除业务单据详情 + stockOrderDetailDao.deleteByOrderIdFk(stockOrderEntity.getId()); + //删除业务单据 + stockOrderDao.deleteById(stockOrderEntity.getId()); + //删除扫码单据详情 + orderDetailDao.deleteByOrderId(id); + //删除扫码单据 + orderDao.deleteById(id); + log.info("单号为:" + id + " 的单据已删除"); + } catch (Exception e) { + log.error("删除单据失败", e); + throw new RuntimeException("删除单据失败"); + } + } else { + //未验收单据 + orderDao.deleteById(id); + orderDetailDao.deleteByOrderId(id); + } + } + } + + @Override + public boolean updateOrderInfo(String actDate, String auditTime, List orderIds) { + return orderDao.updateOrderTime(actDate, auditTime, DateUtil.getDateTime(), orderIds); + } } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/inout/impl/StockOrderServiceImpl.java b/api-admin/src/main/java/com/glxp/sale/admin/service/inout/impl/StockOrderServiceImpl.java index 6457b33..6eb02da 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/service/inout/impl/StockOrderServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/inout/impl/StockOrderServiceImpl.java @@ -1,48 +1,23 @@ package com.glxp.sale.admin.service.inout.impl; import com.github.pagehelper.PageHelper; -import com.glxp.sale.admin.constant.ConstantType; -import com.glxp.sale.admin.dao.inout.*; -import com.glxp.sale.admin.dao.inventory.InvProductDao; -import com.glxp.sale.admin.dao.inventory.InvProductDetailDao; +import com.glxp.sale.admin.dao.inout.StockOrderDao; import com.glxp.sale.admin.entity.inout.StockOrderEntity; import com.glxp.sale.admin.entity.inout.StockOrderPrintEntity; -import com.glxp.sale.admin.entity.inventory.InvProductDetailEntity; -import com.glxp.sale.admin.entity.inventory.InvProductEntity; import com.glxp.sale.admin.req.inout.StockOrderFilterRequest; import com.glxp.sale.admin.req.inout.StockOrderQueryRequest; -import com.glxp.sale.admin.req.inventory.FilterInvProductDetailRequest; -import com.glxp.sale.admin.req.inventory.FilterInvProductRequest; import com.glxp.sale.admin.service.inout.StockOrderService; -import com.glxp.sale.common.res.BaseResponse; -import com.glxp.sale.common.util.ResultVOUtils; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; -import java.util.ArrayList; import java.util.Collections; import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; @Service public class StockOrderServiceImpl implements StockOrderService { @Resource StockOrderDao stockOrderDao; - @Resource - private InvProductDetailDao invProductDetailDao; - @Resource - private InvProductDao invProductDao; - @Resource - private StockOrderDetailDao stockOrderDetailDao; - @Resource - private OrderDao orderDao; - @Resource - private OrderDetailDao orderDetailDao; - @Resource - private CodesDao codesDao; @Override public List listStockOrders(StockOrderQueryRequest stockOrderQueryRequest) { @@ -137,52 +112,4 @@ public class StockOrderServiceImpl implements StockOrderService { return stockOrderDao.selectSupplementOrderList(); } - @Transactional(rollbackFor = Exception.class) - @Override - public BaseResponse deleteOrder(String id) { - //查询业务单据数据 - StockOrderEntity stockOrderEntity = stockOrderDao.selectById(id); - //查询库存详情 - FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest(); - filterInvProductDetailRequest.setOrderIdFk(stockOrderEntity.getOrderIdFk()); - List invProductDetailEntities = invProductDetailDao.filterInvProductDetail(filterInvProductDetailRequest); - Map> map = invProductDetailEntities.stream().collect(Collectors.groupingBy(InvProductDetailEntity::getProductIdFk)); - - List invProductEntities = new ArrayList<>(map.keySet().size()); - for (String key : map.keySet()) { - //查询库存 - FilterInvProductRequest filterInvProductRequest = new FilterInvProductRequest(); - filterInvProductRequest.setRelIdFk(key); - List invProductEntityList = invProductDao.filterInvProduct(filterInvProductRequest); - InvProductEntity invProductEntity = invProductEntityList.get(0); - - List list = map.get(key); - String mainAction = list.get(0).getMainAction(); - int count = list.stream().mapToInt(InvProductDetailEntity::getCount).sum(); - if (mainAction.equals(ConstantType.TYPE_OUT)) { - //出库,删除单据,库存做增加 - int result = invProductEntity.getOutCount() + count; - invProductEntity.setOutCount(result); - } else if (mainAction.equals(ConstantType.TYPE_PUT)) { - //入库,删除单据,库存做扣减 - int result = invProductEntity.getInCount() - count; - invProductEntity.setInCount(result); - } - - invProductEntities.add(invProductEntity); - } - - //更新单据状态和库存数据 - stockOrderDao.updateDelFlag(stockOrderEntity.getId(), true); - stockOrderDetailDao.updateDelFlag(stockOrderEntity.getId(), true); - orderDao.updateDelFlag(stockOrderEntity.getOrderIdFk(), true); - orderDetailDao.updateDelFlag(stockOrderEntity.getOrderIdFk(), true); - codesDao.updateDelFlag(stockOrderEntity.getOrderIdFk(), true); - for (InvProductEntity invProductEntity : invProductEntities) { - invProductDao.updateInvProduct(invProductEntity); - } - invProductDetailDao.updateDelFlag(stockOrderEntity.getOrderIdFk(), true); - return ResultVOUtils.success("删除成功"); - } - } diff --git a/api-admin/src/main/resources/mybatis/mapper/inout/CodesDao.xml b/api-admin/src/main/resources/mybatis/mapper/inout/CodesDao.xml index f6ddd2a..f897a91 100644 --- a/api-admin/src/main/resources/mybatis/mapper/inout/CodesDao.xml +++ b/api-admin/src/main/resources/mybatis/mapper/inout/CodesDao.xml @@ -15,7 +15,6 @@ SELECT * FROM io_codes - delFlag = 0 and orderId = #{corpOrderId} @@ -100,21 +99,19 @@ FROM io_codes WHERE `code` = #{code} AND 'action' ]]> 'StockCheck' - AND delFlag = 0 select * from io_codes where corpOrderId = #{corpOrderId} - and delFlag = 0 UPDATE io_codes @@ -177,15 +172,20 @@ invStorageCode=#{invStorageCode}, invWarehouseCode=#{invWarehouseCode}, locStorageCode=#{locStorageCode}, - delFlag=#{delFlag}, WHERE id=#{id} + - - update io_codes - set delFlag = #{delFlag} + + delete + from io_codes where orderId = #{orderId} - + and code = #{code} + \ No newline at end of file diff --git a/api-admin/src/main/resources/mybatis/mapper/inout/OrderDao.xml b/api-admin/src/main/resources/mybatis/mapper/inout/OrderDao.xml index f059ec6..4988b26 100644 --- a/api-admin/src/main/resources/mybatis/mapper/inout/OrderDao.xml +++ b/api-admin/src/main/resources/mybatis/mapper/inout/OrderDao.xml @@ -8,7 +8,6 @@ SELECT * FROM io_order where status = 'success' - and delFlag = false @@ -27,7 +25,6 @@ select * from io_order where corpOrderId in (select corpOrderId from io_order group by corpOrderId HAVING COUNT(corpOrderId) > 1) - and delFlag = false ORDER BY actDate DESC @@ -36,7 +33,7 @@ fromCorp, status, remark, exportStatus, fromType, contrastStatus, signStatus, receiveStatus, erpFk, stockCheckFk, customerId, supId, exportFilePath, locStorageCode, supplementNo, ullageSupNo, createUser, reviewUser, - outChangeEnable, originUllageSupNo,preCheck,delFlag) + outChangeEnable, originUllageSupNo, preCheck) values (#{id}, #{action}, #{corpOrderId}, @@ -55,49 +52,45 @@ #{erpFk}, #{stockCheckFk}, #{customerId}, #{supId}, #{exportFilePath}, #{locStorageCode}, #{supplementNo}, - #{ullageSupNo}, #{createUser}, #{reviewUser}, #{outChangeEnable}, #{originUllageSupNo},#{preCheck} - #{delFlag}) + #{ullageSupNo}, #{createUser}, #{reviewUser}, #{outChangeEnable}, #{originUllageSupNo}, #{preCheck}) replace - INTO io_order(id, action, corpOrderId, actDate, fromCorpId, actor, mainAction, - fromCorp, status, remark, exportStatus, fromType, contrastStatus, signStatus, - receiveStatus, erpFk, stockCheckFk, customerId, supId, - exportFilePath, locStorageCode, supplementNo, ullageSupNo, createUser, reviewUser, - outChangeEnable, originUllageSupNo,preCheck, delFlag) - values ( - #{id}, - #{action}, - #{corpOrderId}, - #{actDate}, - #{fromCorpId}, - #{actor}, - #{mainAction}, - #{fromCorp}, - #{status}, - #{remark}, - #{exportStatus}, - #{fromType}, - #{contrastStatus}, - #{signStatus}, - #{receiveStatus}, - #{erpFk}, - #{stockCheckFk}, - #{customerId}, - #{supId}, - #{exportFilePath}, - #{locStorageCode}, - #{supplementNo}, - #{ullageSupNo}, - #{createUser}, - #{reviewUser}, - #{outChangeEnable}, - #{originUllageSupNo}, - #{preCheck}, - #{delFlag} - ) + INTO io_order(id, action, corpOrderId, actDate, fromCorpId, actor, mainAction, + fromCorp, status, remark, exportStatus, fromType, contrastStatus, signStatus, + receiveStatus, erpFk, stockCheckFk, customerId, supId, + exportFilePath, locStorageCode, supplementNo, ullageSupNo, createUser, reviewUser, + outChangeEnable, originUllageSupNo, preCheck) + values (#{id}, + #{action}, + #{corpOrderId}, + #{actDate}, + #{fromCorpId}, + #{actor}, + #{mainAction}, + #{fromCorp}, + #{status}, + #{remark}, + #{exportStatus}, + #{fromType}, + #{contrastStatus}, + #{signStatus}, + #{receiveStatus}, + #{erpFk}, + #{stockCheckFk}, + #{customerId}, + #{supId}, + #{exportFilePath}, + #{locStorageCode}, + #{supplementNo}, + #{ullageSupNo}, + #{createUser}, + #{reviewUser}, + #{outChangeEnable}, + #{originUllageSupNo}, + #{preCheck}) @@ -133,7 +126,7 @@ outChangeEnable=#{outChangeEnable}, originUllageSupNo=#{originUllageSupNo}, preCheck=#{preCheck}, - delFlag=#{delFlag}, + auditTime=#{auditTime}, WHERE id = #{id} @@ -187,7 +180,6 @@ SELECT io_order.* FROM io_order INNER JOIN inv_warehouse_user on io_order.locStorageCode = inv_warehouse_user.`code` - io_order.delFlag = false and io_order.id =#{id} @@ -268,7 +260,6 @@ SELECT io_order.* FROM io_order INNER JOIN inv_warehouse_user on io_order.locStorageCode = inv_warehouse_user.`code` - io_order.delFlag = false and io_order.id =#{id} @@ -343,7 +334,6 @@ SELECT io_order.* FROM io_order INNER JOIN inv_warehouse_user on io_order.locStorageCode = inv_warehouse_user.`code` - io_order.delFlag = false and io_order.id =#{id} @@ -414,7 +404,6 @@ SELECT io_order.* FROM io_order INNER JOIN inv_warehouse_user on io_order.locStorageCode = inv_warehouse_user.`code` - io_order.delFlag = false and io_order.id =#{id} @@ -477,7 +466,6 @@ resultType="com.glxp.sale.admin.entity.inout.OrderEntity"> SELECT * FROM io_order - io_order.delFlag = false and id =#{id} @@ -507,7 +495,6 @@ resultType="com.glxp.sale.admin.entity.inout.OrderEntity"> SELECT * FROM io_order - io_order.delFlag = false and status = #{status} @@ -533,7 +520,6 @@ #{item.orderId} - and delFlag = false - + + + + + update io_order - set delFlag = #{delFlag} - where id = #{id} + set actDate = #{actDate}, + auditTime = #{auditTime}, + updateTime = #{updateTime} + where id in + + #{item} + - \ No newline at end of file diff --git a/api-admin/src/main/resources/mybatis/mapper/inout/OrderDetailDao.xml b/api-admin/src/main/resources/mybatis/mapper/inout/OrderDetailDao.xml index 59b3620..d989815 100644 --- a/api-admin/src/main/resources/mybatis/mapper/inout/OrderDetailDao.xml +++ b/api-admin/src/main/resources/mybatis/mapper/inout/OrderDetailDao.xml @@ -8,7 +8,6 @@ select io_order_detail.* ,basic_corp.name supName from io_order_detail left join basic_corp on io_order_detail.supId = basic_corp.erpId - io_order_detail.delFlag = false and io_order_detail.erpOrderId = #{erpOrderId} @@ -31,14 +30,12 @@ #{item} - and delFlag = false @@ -94,7 +88,6 @@ resultType="java.lang.String"> select erpOrderId from io_order_detail - delFlag = false and orderIdFk = #{orderId} @@ -106,7 +99,6 @@ resultType="com.glxp.sale.admin.entity.inout.ErpOrderEntity"> select erpOrderId,orderIdFk from io_order_detail - delFlag = false and orderIdFk ]]> #{orderId} @@ -122,7 +114,7 @@ batchNo,erpCount,credate,nameCode,productCompany, coName,authCode,packSpec,packRatio,bhzxxsbzsl, zxxsbzbhsydysl,orderIdFk,`count`,reCount,productDate,expireDate,bindStatus,bindRlFk,uuidFk,supId,bindSupStatus - ,ylqxzcrbarmc,secSalesListNo,firstSalesInvNo,secSalesInvNo,invoiceDate,price,delFlag) + ,ylqxzcrbarmc,secSalesListNo,firstSalesInvNo,secSalesInvNo,invoiceDate,price) values( #{id}, #{companyid}, @@ -149,8 +141,7 @@ #{count}, #{reCount}, #{productDate}, - #{expireDate} - , + #{expireDate}, #{bindStatus}, #{bindRlFk}, #{uuidFk}, @@ -161,8 +152,7 @@ #{firstSalesInvNo}, #{secSalesInvNo}, #{invoiceDate}, - #{price}, - #{delFlag} + #{price} ) @@ -171,7 +161,7 @@ companyid,erpOrderId,iodtlId,inoutId,goodsunit,goodsid,batchNoId,goodsname,companyname, batchNo,erpCount,credate,nameCode,productCompany, coName,authCode,packSpec,packRatio,bhzxxsbzsl,zxxsbzbhsydysl,orderIdFk,count,reCount,productDate,expireDate - ,bindStatus,bindRlFk,uuidFk,supId,bindSupStatus,ylqxzcrbarmc,secSalesListNo,firstSalesInvNo,secSalesInvNo,invoiceDate,price,delFlag) + ,bindStatus,bindRlFk,uuidFk,supId,bindSupStatus,ylqxzcrbarmc,secSalesListNo,firstSalesInvNo,secSalesInvNo,invoiceDate,price) values @@ -198,7 +188,7 @@ #{item.secSalesListNo}, #{item.firstSalesInvNo}, #{item.secSalesInvNo}, - #{item.invoiceDate},#{item.price}, #{item.delFlag} + #{item.invoiceDate},#{item.price} ) @@ -226,7 +216,6 @@ invoiceDate=#{invoiceDate}, productCompany=#{productCompany}, bindSupStatus=#{bindSupStatus}, - delFlag=#{delFlag}, WHERE id = #{id} @@ -255,10 +244,23 @@ WHERE `id` = #{id} - - update io_order_detail - set delFlag = #{delFlag} - where orderIdFk = #{orderIdFk} - + + + + delete from io_order_detail + where orderIdFk = #{orderId} + and nameCode = #{nameCode} + + + \ No newline at end of file diff --git a/api-admin/src/main/resources/mybatis/mapper/inout/StockOrderDao.xml b/api-admin/src/main/resources/mybatis/mapper/inout/StockOrderDao.xml index 4579163..4a10b0b 100644 --- a/api-admin/src/main/resources/mybatis/mapper/inout/StockOrderDao.xml +++ b/api-admin/src/main/resources/mybatis/mapper/inout/StockOrderDao.xml @@ -8,7 +8,7 @@ SELECT * FROM stock_order INNER JOIN inv_warehouse_user on stock_order.locStorageCode = inv_warehouse_user.`code` - where status = 'success' and delFlag = false + where status = 'success' group by stock_order.id @@ -18,7 +18,7 @@ select * from stock_order INNER JOIN inv_warehouse_user on stock_order.locStorageCode = inv_warehouse_user.`code` - where `status` = '101' and stock_order.delFlag = false + where `status` = '101' group by stock_order.id ORDER BY id DESC @@ -29,7 +29,7 @@ insert INTO stock_order(id, billNo, billdate, corpId, corpName, billType, billFlag, thirdSysFk, status, statusInfo, type, sourceType, printStatus, unitIdFk, customerId, thirdOrderFk, orderIdFk, - totalPrice, locStorageCode, supplementNo, createUser, reviewUser, delFlag) + totalPrice, locStorageCode, supplementNo, createUser, reviewUser) values (#{id}, #{billNo}, #{billdate}, @@ -43,7 +43,7 @@ #{type}, #{sourceType}, #{printStatus}, #{unitIdFk}, #{customerId}, #{thirdOrderFk}, #{orderIdFk}, #{totalPrice}, - #{locStorageCode}, #{supplementNo}, #{createUser}, #{reviewUser}, #{delFlag}) + #{locStorageCode}, #{supplementNo}, #{createUser}, #{reviewUser}) UPDATE stock_order @@ -69,7 +69,6 @@ supplementNo=#{supplementNo}, createUser=#{createUser}, reviewUser=#{reviewUser}, - delFlag=#{delFlag}, WHERE id = #{id} @@ -101,7 +100,6 @@ SELECT stock_order.* FROM stock_order INNER JOIN inv_warehouse_user on stock_order.locStorageCode = inv_warehouse_user.`code` - stock_order.delFlag = false and id =#{id} @@ -187,7 +185,6 @@ resultType="com.glxp.sale.admin.entity.inout.StockOrderEntity"> SELECT * FROM stock_order - delFlag = false and id =#{id} @@ -232,7 +229,6 @@ stock_order_detail.orderIdFk left join inv_warehouse on inv_warehouse.code = stock_order.locStorageCode - stock_order.delFlag = false and stock_order.id =#{id} @@ -252,9 +248,8 @@ - - update stock_order - set delFlag = #{delFlag} - where id = #{id} - + + delete + from stock_order + where orderIdFk = #{orderIdFk} + \ No newline at end of file diff --git a/api-admin/src/main/resources/mybatis/mapper/inout/StockOrderDetail.xml b/api-admin/src/main/resources/mybatis/mapper/inout/StockOrderDetail.xml index 2ac51df..a155c87 100644 --- a/api-admin/src/main/resources/mybatis/mapper/inout/StockOrderDetail.xml +++ b/api-admin/src/main/resources/mybatis/mapper/inout/StockOrderDetail.xml @@ -8,7 +8,6 @@ select stock_order_detail.*,basic_udirel.allowNoBatch from stock_order_detail left join basic_udirel on stock_order_detail.relId = basic_udirel.id - delFlag = false and orderIdFk = #{orderIdFk} @@ -41,7 +40,6 @@ right JOIN basic_products ON stock_order_detail.productId = basic_products.uuid - stock_order_detail.delFlag = false and orderIdFk = #{orderIdFk} @@ -68,7 +66,7 @@ INTO stock_order_detail(id, orderIdFk,productId,productName,spec,batchNo,productDate, expireDate,count,reCount,sweepCount,ylqxzcrbarmc,zczbhhzbapzbh,price,relId, - manufactory,firstSalesInvNo,secSalesInvNo,secSalesListNo,invoiceDate,delFlag) + manufactory,firstSalesInvNo,secSalesInvNo,secSalesListNo,invoiceDate) values( #{id}, #{orderIdFk}, @@ -89,8 +87,7 @@ #{firstSalesInvNo}, #{secSalesInvNo}, #{secSalesListNo}, - #{invoiceDate}, - #{delFlag} + #{invoiceDate} ) @@ -99,7 +96,7 @@ replace INTO stock_order_detail(id, orderIdFk,productId,productName,spec,batchNo,productDate, expireDate,count,reCount,sweepCount,ylqxzcrbarmc,zczbhhzbapzbh,price,relId, - manufactory,firstSalesInvNo,secSalesInvNo,secSalesListNo,invoiceDate,delFlag) + manufactory,firstSalesInvNo,secSalesInvNo,secSalesListNo,invoiceDate) values @@ -117,7 +114,7 @@ #{item.sweepCount}, #{item.ylqxzcrbarmc}, #{item.zczbhhzbapzbh},#{item.price},#{item.relId},#{item.manufactory},#{item.firstSalesInvNo},#{item.secSalesInvNo}, - #{item.secSalesListNo},#{item.invoiceDate},#{item.delFlag} + #{item.secSalesListNo},#{item.invoiceDate} ) @@ -139,7 +136,6 @@ invoiceDate=#{invoiceDate}, relId=#{relId}, manufactory=#{manufactory}, - delFlag=#{delFlag}, WHERE id = #{id} @@ -161,14 +157,14 @@ SELECT * FROM stock_order_detail WHERE id = #{id} - and delFlag = false limit 1 - - update stock_order_detail - set delFlag = #{delFlag} - where orderIdFk = #{orderIdFk} - + + delete + from stock_order_detail + where productId = #{productId} + and orderIdFk = (select id from stock_order where stock_order.orderIdFk = #{orderId}) + \ No newline at end of file diff --git a/api-admin/src/main/resources/mybatis/mapper/inventory/InvProductDetailDao.xml b/api-admin/src/main/resources/mybatis/mapper/inventory/InvProductDetailDao.xml index 3c616ad..159dc8d 100644 --- a/api-admin/src/main/resources/mybatis/mapper/inventory/InvProductDetailDao.xml +++ b/api-admin/src/main/resources/mybatis/mapper/inventory/InvProductDetailDao.xml @@ -8,7 +8,6 @@ SELECT * FROM inv_product_detail - delFlag = false AND productIdFk = #{productIdFk} @@ -64,7 +63,6 @@ SELECT inv_product_detail.* ,io_order.fromCorp,io_order.fromCorpId FROM inv_product_detail inner join io_order on inv_product_detail.orderIdFk = io_order.id - inv_product_detail.delFlag = false AND productIdFk = #{productIdFk} @@ -119,12 +117,12 @@ (code, productIdFk, orderIdFk, customerId, mainAction, `action`, `count`, updateTime, purchaseType, batchNo, productionDate, expireDate, unitFk, stockIdFk, supId, originCode, invStorageCode, - invWarehouseCode, delFlag) + invWarehouseCode) values (#{code}, #{productIdFk}, #{orderIdFk}, #{customerId}, #{mainAction}, #{action}, #{count}, #{updateTime}, #{purchaseType}, #{batchNo}, #{productionDate}, #{expireDate}, #{unitFk}, #{stockIdFk}, #{supId}, - #{originCode}, #{invStorageCode}, #{invWarehouseCode}, #{delFlag}) + #{originCode}, #{invStorageCode}, #{invWarehouseCode}) @@ -195,7 +192,6 @@ originCode=#{originCode}, invStorageCode=#{invStorageCode}, invWarehouseCode=#{invWarehouseCode}, - delFlag=#{delFlag}, WHERE id = #{id} @@ -203,7 +199,6 @@ resultType="java.lang.Integer"> SELECT count(0) FROM inv_product_detail - delFlag = false AND productIdFk = #{productIdFk} @@ -253,7 +248,6 @@ resultType="com.glxp.sale.admin.entity.inventory.InvProductDetailEntity"> SELECT * FROM inv_product_detail - delFlag = false AND productIdFk = #{productIdFk} @@ -292,10 +286,17 @@ - - update inv_product_detail - set delFlag = #{delFlag} + + delete + from inv_product_detail where orderIdFk = #{orderIdFk} - + + + + delete + from inv_product_detail + where orderIdFk = #{orderId} + and code = #{code} + \ No newline at end of file