1.重写涉及mongodb数据操作的业务逻辑

master
x_z 3 years ago
parent 75ae13cacd
commit 99c25cee34

@ -9,7 +9,7 @@ import com.glxp.udi.admin.entity.inout.*;
import com.glxp.udi.admin.entity.inout.WarehousetempEntity; import com.glxp.udi.admin.entity.inout.WarehousetempEntity;
import com.glxp.udi.admin.entity.mongo.*; import com.glxp.udi.admin.entity.mongo.*;
import com.glxp.udi.admin.mongo.dao.*; import com.glxp.udi.admin.mongo.dao.*;
import com.glxp.udi.admin.mongo.service.InvProductDetailMdService; import com.glxp.udi.admin.mongo.service.InvProductDetailService;
import com.glxp.udi.admin.mongo.service.InvProductService; import com.glxp.udi.admin.mongo.service.InvProductService;
import com.glxp.udi.admin.mongo.service.OrderDetailService; import com.glxp.udi.admin.mongo.service.OrderDetailService;
import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest; import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest;
@ -31,7 +31,7 @@ public class TestController {
@Resource @Resource
private InvProductService invProductService; private InvProductService invProductService;
@Resource @Resource
private InvProductDetailMdService invProductDetailMdService; private InvProductDetailService invProductDetailService;
@Resource @Resource
private UdiInfoDao udiInfoDao; private UdiInfoDao udiInfoDao;
@ -102,7 +102,7 @@ public class TestController {
}); });
//刷新库存详情表数据 //刷新库存详情表数据
List<InvProductDetailEntity> invProductDetailEntities = invProductDetailMdService.filterAllInvProduct(new FilterInvProductDetailRequest()); List<InvProductDetailEntity> invProductDetailEntities = invProductDetailService.filterAllInvProduct(new FilterInvProductDetailRequest());
invProductDetailEntities.forEach(invProductDetailEntity -> { invProductDetailEntities.forEach(invProductDetailEntity -> {
UdiInfoEntity udiInfoEntity = udiInfoDao.selectOne(new QueryWrapper<UdiInfoEntity>().eq(StrUtil.isNotBlank(invProductDetailEntity.getProductIdFk()), "uuid", invProductDetailEntity.getProductIdFk()) UdiInfoEntity udiInfoEntity = udiInfoDao.selectOne(new QueryWrapper<UdiInfoEntity>().eq(StrUtil.isNotBlank(invProductDetailEntity.getProductIdFk()), "uuid", invProductDetailEntity.getProductIdFk())
.eq(StrUtil.isNotBlank(invProductDetailEntity.getCustomerId()), "customerId", invProductDetailEntity.getCustomerId()) .eq(StrUtil.isNotBlank(invProductDetailEntity.getCustomerId()), "customerId", invProductDetailEntity.getCustomerId())
@ -110,7 +110,7 @@ public class TestController {
if (null != udiInfoEntity) { if (null != udiInfoEntity) {
invProductDetailEntity.setProductIdFk(String.valueOf(udiInfoEntity.getId())); invProductDetailEntity.setProductIdFk(String.valueOf(udiInfoEntity.getId()));
log.info("刷新库存详情"); log.info("刷新库存详情");
invProductDetailMdService.updateInvProduct(invProductDetailEntity); invProductDetailService.updateInvProduct(invProductDetailEntity);
} }
}); });
return "success"; return "success";

@ -10,9 +10,8 @@ import com.glxp.udi.admin.entity.auth.AuthAdmin;
import com.glxp.udi.admin.entity.inout.InvProductDetailEntity; import com.glxp.udi.admin.entity.inout.InvProductDetailEntity;
import com.glxp.udi.admin.entity.inout.InvProductEntity; import com.glxp.udi.admin.entity.inout.InvProductEntity;
import com.glxp.udi.admin.entity.inout.UdiInfoEntity; import com.glxp.udi.admin.entity.inout.UdiInfoEntity;
import com.glxp.udi.admin.mongo.service.InvProductDetailMdService; import com.glxp.udi.admin.mongo.service.InvProductDetailService;
import com.glxp.udi.admin.mongo.service.InvProductService; 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.DeleteRequest;
import com.glxp.udi.admin.req.inout.FilterInvProductDetailRequest; import com.glxp.udi.admin.req.inout.FilterInvProductDetailRequest;
import com.glxp.udi.admin.req.inout.FilterUdiInfoRequest; import com.glxp.udi.admin.req.inout.FilterUdiInfoRequest;
@ -44,7 +43,7 @@ public class InvProductsController {
@Resource @Resource
private InvProductService invProductService; private InvProductService invProductService;
@Resource @Resource
private InvProductDetailMdService invProductDetailService; private InvProductDetailService invProductDetailService;
@Resource @Resource
private UdiInfoService udiInfoService; private UdiInfoService udiInfoService;
@Resource @Resource
@ -80,8 +79,8 @@ public class InvProductsController {
codes.addAll(warehouseUserService.selectCodeByUserId(user.getId())); codes.addAll(warehouseUserService.selectCodeByUserId(user.getId()));
} }
filterInvProductRequest.setInvCodes(codes); filterInvProductRequest.setInvCodes(codes);
PageResult<InvProductEntity> invProductEntityPageResult = invProductService.filterInvProduct(filterInvProductRequest); IPage<InvProductEntity> page = invProductService.filterInvProduct(filterInvProductRequest);
List<InvProductEntity> invProductEntities = invProductEntityPageResult.getList(); List<InvProductEntity> invProductEntities = page.getRecords();
List<InvProductResponse> result = new ArrayList<>(); List<InvProductResponse> result = new ArrayList<>();
for (InvProductEntity invProductEntity : invProductEntities) { for (InvProductEntity invProductEntity : invProductEntities) {
InvProductResponse invProductResponse = new InvProductResponse(); InvProductResponse invProductResponse = new InvProductResponse();
@ -92,7 +91,7 @@ public class InvProductsController {
} }
PageSimpleResponse<InvProductResponse> pageSimpleResponse = new PageSimpleResponse<>(); PageSimpleResponse<InvProductResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(invProductEntityPageResult.getTotal()); pageSimpleResponse.setTotal(page.getTotal());
pageSimpleResponse.setList(result); pageSimpleResponse.setList(result);
return ResultVOUtils.success(pageSimpleResponse); return ResultVOUtils.success(pageSimpleResponse);
} }
@ -122,9 +121,9 @@ public class InvProductsController {
if (CollUtil.isNotEmpty(invCodes)) { if (CollUtil.isNotEmpty(invCodes)) {
filterInvProductRequest.setInvCodes(invCodes); filterInvProductRequest.setInvCodes(invCodes);
} }
PageResult<InvProductEntity> invProductEntityPageResult = invProductService.filterInvProduct(filterInvProductRequest); IPage<InvProductEntity> page = invProductService.filterInvProduct(filterInvProductRequest);
List<InvProductEntity> invProductEntities = invProductEntityPageResult.getList(); List<InvProductEntity> invProductEntities = page.getRecords();
List<InvProductResponse> invProductResponses = new ArrayList<>(); List<InvProductResponse> invProductResponses = new ArrayList<>();
for (InvProductEntity invProductEntity : invProductEntities) { for (InvProductEntity invProductEntity : invProductEntities) {
UdiInfoEntity udiInfoEntity = udiInfoService.findByUuid(invProductEntity.getRelIdFk(), invProductEntity.getCustomerId()); UdiInfoEntity udiInfoEntity = udiInfoService.findByUuid(invProductEntity.getRelIdFk(), invProductEntity.getCustomerId());
@ -141,7 +140,7 @@ public class InvProductsController {
} }
PageSimpleResponse<InvProductResponse> pageSimpleResponse = new PageSimpleResponse<>(); PageSimpleResponse<InvProductResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(invProductEntityPageResult.getTotal()); pageSimpleResponse.setTotal(page.getTotal());
pageSimpleResponse.setList(invProductResponses); pageSimpleResponse.setList(invProductResponses);
return ResultVOUtils.success(pageSimpleResponse); return ResultVOUtils.success(pageSimpleResponse);
} }
@ -159,8 +158,8 @@ public class InvProductsController {
} }
} }
filterInvProductRequest.setInvCodes(codes); filterInvProductRequest.setInvCodes(codes);
PageResult<InvProductDetailEntity> pageResult = invProductDetailService.filterInvProduct(filterInvProductRequest); IPage<InvProductDetailEntity> page = invProductDetailService.filterInvProduct(filterInvProductRequest);
List<InvProductDetailEntity> invProductDetailEntities = pageResult.getList(); List<InvProductDetailEntity> invProductDetailEntities = page.getRecords();
List<InvProductDetailResponse> invProductDetailResponses = new ArrayList<>(invProductDetailEntities.size()); List<InvProductDetailResponse> invProductDetailResponses = new ArrayList<>(invProductDetailEntities.size());
if (CollUtil.isNotEmpty(invProductDetailEntities)) { if (CollUtil.isNotEmpty(invProductDetailEntities)) {
@ -179,7 +178,7 @@ public class InvProductsController {
} }
PageSimpleResponse<InvProductDetailResponse> pageSimpleResponse = new PageSimpleResponse<>(); PageSimpleResponse<InvProductDetailResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageResult.getTotal()); pageSimpleResponse.setTotal(page.getTotal());
pageSimpleResponse.setList(invProductDetailResponses); pageSimpleResponse.setList(invProductDetailResponses);
return ResultVOUtils.success(pageSimpleResponse); return ResultVOUtils.success(pageSimpleResponse);
} }

@ -3,6 +3,7 @@ package com.glxp.udi.admin.controller.inout;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
@ -16,13 +17,10 @@ import com.glxp.udi.admin.entity.auth.AuthAdmin;
import com.glxp.udi.admin.entity.basic.BussinessTypeEntity; import com.glxp.udi.admin.entity.basic.BussinessTypeEntity;
import com.glxp.udi.admin.entity.info.PlatformEntity; import com.glxp.udi.admin.entity.info.PlatformEntity;
import com.glxp.udi.admin.entity.inout.*; 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.OrderDetailService; import com.glxp.udi.admin.mongo.service.OrderDetailService;
import com.glxp.udi.admin.mongo.service.OrderService; import com.glxp.udi.admin.mongo.service.OrderService;
import com.glxp.udi.admin.mongo.service.WarehouseMdService; import com.glxp.udi.admin.mongo.service.WarehouseService;
import com.glxp.udi.admin.mongo.service.WarehouseTempMdService; import com.glxp.udi.admin.mongo.service.WarehouseTempService;
import com.glxp.udi.admin.mongo.utils.PageResult;
import com.glxp.udi.admin.req.inout.*; import com.glxp.udi.admin.req.inout.*;
import com.glxp.udi.admin.res.PageSimpleResponse; import com.glxp.udi.admin.res.PageSimpleResponse;
import com.glxp.udi.admin.res.inout.OrderMdResponse; import com.glxp.udi.admin.res.inout.OrderMdResponse;
@ -66,7 +64,7 @@ public class OrderController {
@Resource @Resource
private OrderService orderService; private OrderService orderService;
@Resource @Resource
private WarehouseMdService warehouseMdService; private WarehouseService warehouseService;
@Resource @Resource
private UnitMaintainService unitMaintainService; private UnitMaintainService unitMaintainService;
@Resource @Resource
@ -86,7 +84,7 @@ public class OrderController {
@Resource @Resource
private GennerOrderUtils gennerOrderUtils; private GennerOrderUtils gennerOrderUtils;
@Resource @Resource
private WarehouseTempMdService warehouseTempMdService; private WarehouseTempService warehouseTempService;
@AuthRuleAnnotation("") @AuthRuleAnnotation("")
@GetMapping("/warehouse/inout/order/filter") @GetMapping("/warehouse/inout/order/filter")
@ -178,10 +176,10 @@ public class OrderController {
orderFilterRequest.setInvCodes(codes); orderFilterRequest.setInvCodes(codes);
orderFilterRequest.setCustomerId(authAdmin.getCustomerId()); orderFilterRequest.setCustomerId(authAdmin.getCustomerId());
orderFilterRequest.setStatus(orderFilterRequest.getStatus()); orderFilterRequest.setStatus(orderFilterRequest.getStatus());
PageResult<OrderMdEntity> pageResult = orderService.filterList(orderFilterRequest); IPage<OrderEntity> page = orderService.filterList(orderFilterRequest);
PageSimpleResponse<OrderMdEntity> pageSimpleResponse = new PageSimpleResponse<>(); PageSimpleResponse<OrderEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageResult.getTotal()); pageSimpleResponse.setTotal(page.getTotal());
pageSimpleResponse.setList(pageResult.getList()); pageSimpleResponse.setList(page.getRecords());
return ResultVOUtils.success(pageSimpleResponse); return ResultVOUtils.success(pageSimpleResponse);
} }
@ -205,10 +203,10 @@ public class OrderController {
} }
orderFilterRequest.setInvCodes(invCodes); orderFilterRequest.setInvCodes(invCodes);
PageResult<OrderMdEntity> pageResult = orderService.filterList(orderFilterRequest); IPage<OrderEntity> page = orderService.filterList(orderFilterRequest);
PageSimpleResponse<OrderMdEntity> pageSimpleResponse = new PageSimpleResponse<>(); PageSimpleResponse<OrderEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageResult.getTotal()); pageSimpleResponse.setTotal(page.getTotal());
pageSimpleResponse.setList(pageResult.getList()); pageSimpleResponse.setList(page.getRecords());
return ResultVOUtils.success(pageSimpleResponse); return ResultVOUtils.success(pageSimpleResponse);
} }
@ -231,10 +229,10 @@ public class OrderController {
orderFilterRequest.setInvCodes(codes); orderFilterRequest.setInvCodes(codes);
orderFilterRequest.setCustomerId(authAdmin.getCustomerId()); orderFilterRequest.setCustomerId(authAdmin.getCustomerId());
orderFilterRequest.setStatus(ConstantStatus.ORDER_STATUS_ADDITIONAL); orderFilterRequest.setStatus(ConstantStatus.ORDER_STATUS_ADDITIONAL);
PageResult<OrderMdEntity> pageResult = orderService.filterList(orderFilterRequest); IPage<OrderEntity> page = orderService.filterList(orderFilterRequest);
List<OrderMdResponse> responses = new ArrayList<>(); List<OrderMdResponse> responses = new ArrayList<>();
if (CollUtil.isNotEmpty(pageResult.getList())) { if (CollUtil.isNotEmpty(page.getRecords())) {
pageResult.getList().forEach(order -> { page.getRecords().forEach(order -> {
OrderMdResponse response = new OrderMdResponse(); OrderMdResponse response = new OrderMdResponse();
BeanUtil.copyProperties(order, response); BeanUtil.copyProperties(order, response);
String name = invWarehouseDao.selectNameByCode(order.getLocStorageCode()); String name = invWarehouseDao.selectNameByCode(order.getLocStorageCode());
@ -245,7 +243,7 @@ public class OrderController {
}); });
} }
PageSimpleResponse<OrderMdResponse> pageSimpleResponse = new PageSimpleResponse<>(); PageSimpleResponse<OrderMdResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageResult.getTotal()); pageSimpleResponse.setTotal(page.getTotal());
pageSimpleResponse.setList(responses); pageSimpleResponse.setList(responses);
return ResultVOUtils.success(pageSimpleResponse); return ResultVOUtils.success(pageSimpleResponse);
} }
@ -267,28 +265,28 @@ public class OrderController {
} }
String mainOrder = orderList.get(0); String mainOrder = orderList.get(0);
for (int i = 1; i < orderList.size(); i++) { for (int i = 1; i < orderList.size(); i++) {
warehouseMdService.updateOrderId(orderList.get(i), mainOrder); warehouseService.updateOrderId(orderList.get(i), mainOrder);
DeleteRequest deleteRequest = new DeleteRequest(); DeleteRequest deleteRequest = new DeleteRequest();
deleteRequest.setOrderId(orderList.get(i)); deleteRequest.setOrderId(orderList.get(i));
orderService.deleteOrder(deleteRequest); orderService.deleteOrder(deleteRequest);
} }
new Thread(() -> { ThreadUtil.execute(() -> {
WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest(); WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest();
warehouseQueryRequest.setOrderId(mainOrder); warehouseQueryRequest.setOrderId(mainOrder);
List<WarehouseMdEntity> transData = warehouseMdService.filterWarehouse(warehouseQueryRequest); List<WarehouseEntity> transData = warehouseService.filterWarehouse(warehouseQueryRequest);
inoutUtils.generateConstrastDetail(udiInfoService, udiRelevanceService, orderDetailService, transData); inoutUtils.generateConstrastDetail(udiInfoService, udiRelevanceService, orderDetailService, transData);
}).start(); });
} }
return ResultVOUtils.success("合并成功,后台正在数据转换,请稍后刷新重试!"); return ResultVOUtils.success("合并成功,后台正在数据转换,请稍后刷新重试!");
} }
@PostMapping("/warehouse/inout/order/unit") @PostMapping("/warehouse/inout/order/unit")
public BaseResponse updateUnit(@RequestBody @Valid OrderMdEntity orderEntity, BindingResult bindingResult) { public BaseResponse updateUnit(@RequestBody @Valid OrderEntity orderEntity, BindingResult bindingResult) {
if (bindingResult.hasErrors()) { if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
} }
orderService.updateOrder(orderEntity); orderService.updateOrder(orderEntity);
warehouseMdService.updateUnit(orderEntity.getOrderId(), orderEntity.getFromCorpId(), orderEntity.getFromCorp()); warehouseService.updateUnit(orderEntity.getOrderId(), orderEntity.getFromCorpId(), orderEntity.getFromCorp());
return ResultVOUtils.success("添加成功"); return ResultVOUtils.success("添加成功");
} }
@ -317,7 +315,7 @@ public class OrderController {
orderBean.setAction(unitMaintainEntity.getTargetAction()); orderBean.setAction(unitMaintainEntity.getTargetAction());
WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest(); WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest();
warehouseQueryRequest.setOrderId(orderEntity.getOrderId()); warehouseQueryRequest.setOrderId(orderEntity.getOrderId());
List<WarehouseMdEntity> warehouseEntities = warehouseMdService.filterWarehouse(warehouseQueryRequest); List<WarehouseEntity> warehouseEntities = warehouseService.filterWarehouse(warehouseQueryRequest);
List<PostUdimsOrderRequest.OrderBean.CodeBean> codeBeans = new ArrayList<>(); List<PostUdimsOrderRequest.OrderBean.CodeBean> codeBeans = new ArrayList<>();
UnitMaintainEntity finalUnitMaintainEntity = unitMaintainEntity; UnitMaintainEntity finalUnitMaintainEntity = unitMaintainEntity;
warehouseEntities.forEach(data -> { warehouseEntities.forEach(data -> {
@ -480,7 +478,7 @@ public class OrderController {
String oldOrderId = originOrder.getOrderId(); String oldOrderId = originOrder.getOrderId();
String replicateNo = originOrder.getReplicateNo(); //复制单号 String replicateNo = originOrder.getReplicateNo(); //复制单号
//查询条码 //查询条码
List<WarehouseEntity> originCodes = warehouseMdService.findByOrderId(originOrder.getOrderId()); List<WarehouseEntity> originCodes = warehouseService.findByOrderId(originOrder.getOrderId());
originOrder.setActDate(cn.hutool.core.date.DateUtil.date().toString(DatePattern.NORM_DATETIME_PATTERN)); originOrder.setActDate(cn.hutool.core.date.DateUtil.date().toString(DatePattern.NORM_DATETIME_PATTERN));
originOrder.setFromCorp(addOrderChangeRequest.getFromCorp()); originOrder.setFromCorp(addOrderChangeRequest.getFromCorp());
originOrder.setFromCorpId(addOrderChangeRequest.getFromCorpId()); originOrder.setFromCorpId(addOrderChangeRequest.getFromCorpId());
@ -529,7 +527,7 @@ public class OrderController {
originOrder.setUpdateTime(new Date()); originOrder.setUpdateTime(new Date());
originOrder.setOrderId(null); originOrder.setOrderId(null);
orderService.insertOrder(originOrder); orderService.insertOrder(originOrder);
warehouseTempMdService.insertTempWarehouses(supplementCodes); warehouseTempService.insertTempWarehouses(supplementCodes);
orderService.updateReplicateNo(oldOrderId, replicateNo); orderService.updateReplicateNo(oldOrderId, replicateNo);
return ResultVOUtils.success(); return ResultVOUtils.success();
} }
@ -592,12 +590,13 @@ public class OrderController {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
} }
AuthAdmin authAdmin = customerService.getUserBean(); AuthAdmin authAdmin = customerService.getUserBean();
OrderMdEntity orderMdEntity = orderService.findByOne(updateExportStatusRequest.getOrderId()); OrderEntity orderEntity = orderService.findByOne(updateExportStatusRequest.getOrderId());
orderMdEntity.setReceiveStatus(ConstantStatus.RECEIVE_ED); //验收状态修改为已验收 //验收状态修改为已验收
orderMdEntity.setReviewUser(authAdmin.getId().intValue()); orderEntity.setReceiveStatus(ConstantStatus.RECEIVE_ED);
orderMdEntity.setUpdateTime(new Date()); orderEntity.setReviewUser(authAdmin.getId().intValue());
orderService.updateOrder(orderMdEntity); orderEntity.setUpdateTime(new Date());
invProductsTrService.genInvProducts(orderMdEntity.getOrderId()); orderService.updateOrder(orderEntity);
invProductsTrService.genInvProducts(orderEntity.getOrderId());
return ResultVOUtils.success("更新成功"); return ResultVOUtils.success("更新成功");
} }

@ -8,10 +8,10 @@ import com.glxp.udi.admin.common.res.BaseResponse;
import com.glxp.udi.admin.constant.Constant; import com.glxp.udi.admin.constant.Constant;
import com.glxp.udi.admin.entity.basic.StockPrintEntity; import com.glxp.udi.admin.entity.basic.StockPrintEntity;
import com.glxp.udi.admin.entity.info.CompanyEntity; import com.glxp.udi.admin.entity.info.CompanyEntity;
import com.glxp.udi.admin.entity.inout.OrderEntity;
import com.glxp.udi.admin.entity.inout.StockOrderPrintEntity; import com.glxp.udi.admin.entity.inout.StockOrderPrintEntity;
import com.glxp.udi.admin.entity.inout.StockQRCodeTextEntity; import com.glxp.udi.admin.entity.inout.StockQRCodeTextEntity;
import com.glxp.udi.admin.entity.inventory.StockPrintTempEntity; 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.SystemPDFModuleEntity;
import com.glxp.udi.admin.entity.param.SystemPDFTemplateEntity; import com.glxp.udi.admin.entity.param.SystemPDFTemplateEntity;
import com.glxp.udi.admin.mongo.service.OrderService; import com.glxp.udi.admin.mongo.service.OrderService;
@ -300,12 +300,12 @@ public class StockQRCodeTextController {
@PostMapping("/udiwms/pdf/template/inspection/stock/order/file") @PostMapping("/udiwms/pdf/template/inspection/stock/order/file")
public BaseResponse inspectionStockOrderPDFFromTemplateFile( public BaseResponse inspectionStockOrderPDFFromTemplateFile(
@RequestBody InspectionPDFTemplateRequest inspectionPDFTemplateRequest) { @RequestBody InspectionPDFTemplateRequest inspectionPDFTemplateRequest) {
OrderMdEntity orderMdEntity = orderService.findByOne(inspectionPDFTemplateRequest.getOrderId()); OrderEntity orderEntity = orderService.findByOne(inspectionPDFTemplateRequest.getOrderId());
if (orderMdEntity == null) { if (orderEntity == null) {
return ResultVOUtils.error(ResultEnum.DATA_NOT, "未找到该订单"); return ResultVOUtils.error(ResultEnum.DATA_NOT, "未找到该订单");
} }
SystemPDFTemplateRelevanceRequest systemPDFTemplateRelevanceRequest = new SystemPDFTemplateRelevanceRequest(); SystemPDFTemplateRelevanceRequest systemPDFTemplateRelevanceRequest = new SystemPDFTemplateRelevanceRequest();
systemPDFTemplateRelevanceRequest.setLocalAction(orderMdEntity.getAction()); systemPDFTemplateRelevanceRequest.setLocalAction(orderEntity.getAction());
systemPDFTemplateRelevanceRequest.setModuleId(inspectionPDFTemplateRequest.getModuleId()); systemPDFTemplateRelevanceRequest.setModuleId(inspectionPDFTemplateRequest.getModuleId());
IPage<SystemPDFTemplateRelevanceResponse> page = systemPDFTemplateRelevanceService.filterList(systemPDFTemplateRelevanceRequest); IPage<SystemPDFTemplateRelevanceResponse> page = systemPDFTemplateRelevanceService.filterList(systemPDFTemplateRelevanceRequest);
if (page.getTotal() == 0) { if (page.getTotal() == 0) {

@ -8,7 +8,7 @@ import com.glxp.udi.admin.common.res.BaseResponse;
import com.glxp.udi.admin.entity.inout.UdiInfoEntity; import com.glxp.udi.admin.entity.inout.UdiInfoEntity;
import com.glxp.udi.admin.entity.inout.WarehouseEntity; import com.glxp.udi.admin.entity.inout.WarehouseEntity;
import com.glxp.udi.admin.mongo.service.InvProductService; import com.glxp.udi.admin.mongo.service.InvProductService;
import com.glxp.udi.admin.mongo.service.WarehouseMdService; import com.glxp.udi.admin.mongo.service.WarehouseService;
import com.glxp.udi.admin.req.inout.DeleteRequest; import com.glxp.udi.admin.req.inout.DeleteRequest;
import com.glxp.udi.admin.req.inout.FilterUdiInfoRequest; import com.glxp.udi.admin.req.inout.FilterUdiInfoRequest;
import com.glxp.udi.admin.req.inout.FilterWarehouseRequest; import com.glxp.udi.admin.req.inout.FilterWarehouseRequest;
@ -49,7 +49,7 @@ public class UdiRelevanceController {
@Resource @Resource
private InvProductService invProductService; private InvProductService invProductService;
@Resource @Resource
private WarehouseMdService warehouseMdService; private WarehouseService warehouseService;
//客户端器械信息下载 //客户端器械信息下载
@GetMapping("/udi/udirel/download") @GetMapping("/udi/udirel/download")
@ -101,7 +101,7 @@ public class UdiRelevanceController {
FilterWarehouseRequest filterWarehouseRequest = new FilterWarehouseRequest(); FilterWarehouseRequest filterWarehouseRequest = new FilterWarehouseRequest();
filterWarehouseRequest.setCode(udiInfoEntity.getNameCode()); filterWarehouseRequest.setCode(udiInfoEntity.getNameCode());
filterWarehouseRequest.setCustomerId(Long.valueOf(customerId)); filterWarehouseRequest.setCustomerId(Long.valueOf(customerId));
List<WarehouseEntity> warehouseEntities = warehouseMdService.findByCode(filterWarehouseRequest); List<WarehouseEntity> warehouseEntities = warehouseService.findByCode(filterWarehouseRequest);
if (CollUtil.isNotEmpty(warehouseEntities)) { if (CollUtil.isNotEmpty(warehouseEntities)) {
return ResultVOUtils.error(500, "改产品已被" + warehouseEntities.get(0).getOrderId() + "订单关联不能删除"); return ResultVOUtils.error(500, "改产品已被" + warehouseEntities.get(0).getOrderId() + "订单关联不能删除");
} }

@ -9,11 +9,10 @@ import com.glxp.udi.admin.entity.inout.InvProductDetailEntity;
import com.glxp.udi.admin.entity.inout.OrderEntity; import com.glxp.udi.admin.entity.inout.OrderEntity;
import com.glxp.udi.admin.entity.inout.UdiInfoEntity; import com.glxp.udi.admin.entity.inout.UdiInfoEntity;
import com.glxp.udi.admin.entity.inout.WarehouseEntity; 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.entity.udid.UdiEntity;
import com.glxp.udi.admin.mongo.service.InvProductDetailMdService; import com.glxp.udi.admin.mongo.service.InvProductDetailService;
import com.glxp.udi.admin.mongo.service.OrderService; import com.glxp.udi.admin.mongo.service.OrderService;
import com.glxp.udi.admin.mongo.service.WarehouseMdService; import com.glxp.udi.admin.mongo.service.WarehouseService;
import com.glxp.udi.admin.req.inout.FilterInvProductDetailRequest; import com.glxp.udi.admin.req.inout.FilterInvProductDetailRequest;
import com.glxp.udi.admin.req.inout.OrderFilterRequest; import com.glxp.udi.admin.req.inout.OrderFilterRequest;
import com.glxp.udi.admin.req.inout.WarehouseQueryRequest; import com.glxp.udi.admin.req.inout.WarehouseQueryRequest;
@ -37,7 +36,7 @@ import java.util.stream.Collectors;
public class UdiTraceController { public class UdiTraceController {
@Resource @Resource
private WarehouseMdService warehouseMdService; private WarehouseService warehouseService;
@Resource @Resource
private UdiInfoService udiInfoService; private UdiInfoService udiInfoService;
@Resource @Resource
@ -45,7 +44,7 @@ public class UdiTraceController {
@Resource @Resource
private OrderService orderService; private OrderService orderService;
@Resource @Resource
private InvProductDetailMdService invProductDetailMdService; private InvProductDetailService invProductDetailService;
@GetMapping("/udiwarehouse/trace/filter") @GetMapping("/udiwarehouse/trace/filter")
public BaseResponse list(WarehouseQueryRequest warehouseQueryRequest) { public BaseResponse list(WarehouseQueryRequest warehouseQueryRequest) {
@ -71,19 +70,19 @@ public class UdiTraceController {
for (UdiInfoEntity udiInfoEntity : udiInfoEntityList) { for (UdiInfoEntity udiInfoEntity : udiInfoEntityList) {
warehouseQueryRequest.setBatchNo(udiEntity.getBatchNo()); warehouseQueryRequest.setBatchNo(udiEntity.getBatchNo());
warehouseQueryRequest.setUdi(udiInfoEntity.getNameCode()); warehouseQueryRequest.setUdi(udiInfoEntity.getNameCode());
List<OrderMdEntity> temps = filterUdiTrace(warehouseQueryRequest); List<OrderEntity> temps = filterUdiTrace(warehouseQueryRequest);
if (CollUtil.isEmpty(temps)) { if (CollUtil.isEmpty(temps)) {
break; break;
} }
for (OrderMdEntity temp : temps) { for (OrderEntity temp : temps) {
UdiTraceResponse udiTraceResponse = new UdiTraceResponse(); UdiTraceResponse udiTraceResponse = new UdiTraceResponse();
BeanUtil.copyProperties(temp, udiTraceResponse); BeanUtil.copyProperties(temp, udiTraceResponse);
udiTraceResponse.setActDate(temp.getActDate()); udiTraceResponse.setActDate(temp.getActDate());
udiTraceResponse.setYlqxzcrbarmc(udiInfoEntity.getYlqxzcrbarmc()); udiTraceResponse.setYlqxzcrbarmc(udiInfoEntity.getYlqxzcrbarmc());
udiTraceResponse.setCpmctymc(udiInfoEntity.getCpmctymc()); udiTraceResponse.setCpmctymc(udiInfoEntity.getCpmctymc());
udiTraceResponse.setGgxh(udiInfoEntity.getGgxh()); udiTraceResponse.setGgxh(udiInfoEntity.getGgxh());
List<WarehouseEntity> orderList = warehouseMdService.findByOrderId(temp.getOrderId()); List<WarehouseEntity> orderList = warehouseService.findByOrderId(temp.getOrderId());
if (CollUtil.isNotEmpty(orderList)) { if (CollUtil.isNotEmpty(orderList)) {
udiTraceResponse.setCount(orderList.get(0).getCount()); udiTraceResponse.setCount(orderList.get(0).getCount());
} else { } else {
@ -117,7 +116,7 @@ public class UdiTraceController {
if (StrUtil.isBlank(warehouseQueryRequest.getCode())) { if (StrUtil.isBlank(warehouseQueryRequest.getCode())) {
return ResultVOUtils.success(Collections.emptyList()); return ResultVOUtils.success(Collections.emptyList());
} }
List<OrderMdEntity> orderMdEntities = new ArrayList<>(); List<OrderEntity> orderEntities = new ArrayList<>();
String customerId = authAdminService.getCurrentUserCustomerId(); String customerId = authAdminService.getCurrentUserCustomerId();
if (!Long.valueOf(customerId).equals(110)) { if (!Long.valueOf(customerId).equals(110)) {
warehouseQueryRequest.setCustomerId(customerId); warehouseQueryRequest.setCustomerId(customerId);
@ -132,27 +131,27 @@ public class UdiTraceController {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "此产品信息在耗材字典中不存在"); return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "此产品信息在耗材字典中不存在");
} }
List<UdiInfoEntity> udiInfoEntities = udiInfoService.findByUuids(udiInfoEntity.getUuid(), customerId); List<UdiInfoEntity> udiInfoEntities = udiInfoService.findByUuids(udiInfoEntity.getUuid(), customerId);
Set<OrderMdEntity> set = new HashSet<>(); Set<OrderEntity> set = new HashSet<>();
if (udiInfoEntities != null && udiInfoEntities.size() > 0) { if (udiInfoEntities != null && udiInfoEntities.size() > 0) {
for (UdiInfoEntity temp : udiInfoEntities) { for (UdiInfoEntity temp : udiInfoEntities) {
warehouseQueryRequest.setBatchNo(udiEntity.getBatchNo()); warehouseQueryRequest.setBatchNo(udiEntity.getBatchNo());
warehouseQueryRequest.setUdi(temp.getNameCode()); warehouseQueryRequest.setUdi(temp.getNameCode());
List<OrderMdEntity> temps = filterUdiTrace(warehouseQueryRequest); List<OrderEntity> temps = filterUdiTrace(warehouseQueryRequest);
if (CollUtil.isNotEmpty(temps)) { if (CollUtil.isNotEmpty(temps)) {
set.addAll(temps); set.addAll(temps);
} }
} }
} }
orderMdEntities.addAll(set); orderEntities.addAll(set);
if (CollUtil.isNotEmpty(orderMdEntities)) { if (CollUtil.isNotEmpty(orderEntities)) {
//根据时间排序 //根据时间排序
orderMdEntities = orderMdEntities.stream().sorted(Comparator.comparing(OrderMdEntity::getActDate)).collect(Collectors.toList()); orderEntities = orderEntities.stream().sorted(Comparator.comparing(OrderEntity::getActDate)).collect(Collectors.toList());
} }
Page<OrderMdEntity> pageResult = new Page<>(warehouseQueryRequest.getPage(), warehouseQueryRequest.getLimit()); Page<OrderEntity> pageResult = new Page<>(warehouseQueryRequest.getPage(), warehouseQueryRequest.getLimit());
pageResult.setRecords(orderMdEntities); pageResult.setRecords(orderEntities);
PageSimpleResponse<OrderMdEntity> pageSimpleResponse = new PageSimpleResponse<>(); PageSimpleResponse<OrderEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageResult.getTotal()); pageSimpleResponse.setTotal(pageResult.getTotal());
pageSimpleResponse.setList(pageResult.getRecords()); pageSimpleResponse.setList(pageResult.getRecords());
return ResultVOUtils.success(pageSimpleResponse); return ResultVOUtils.success(pageSimpleResponse);
@ -176,14 +175,14 @@ public class UdiTraceController {
if (warehouseQueryRequest.getCustomerId() != null) { if (warehouseQueryRequest.getCustomerId() != null) {
filterInvProductDetailRequest.setCustomerId(warehouseQueryRequest.getCustomerId() + ""); filterInvProductDetailRequest.setCustomerId(warehouseQueryRequest.getCustomerId() + "");
} }
invProductDetailEntities = invProductDetailMdService.filterAllInvProduct(filterInvProductDetailRequest); invProductDetailEntities = invProductDetailService.filterAllInvProduct(filterInvProductDetailRequest);
} else if (udiInfoEntities.size() == 1) { //单级包装,且唯一查询条码 } else if (udiInfoEntities.size() == 1) { //单级包装,且唯一查询条码
FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest(); FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest();
filterInvProductDetailRequest.setCode(warehouseQueryRequest.getCode()); filterInvProductDetailRequest.setCode(warehouseQueryRequest.getCode());
if (warehouseQueryRequest.getCustomerId() != null) { if (warehouseQueryRequest.getCustomerId() != null) {
filterInvProductDetailRequest.setCustomerId(warehouseQueryRequest.getCustomerId() + ""); filterInvProductDetailRequest.setCustomerId(warehouseQueryRequest.getCustomerId() + "");
} }
invProductDetailEntities = invProductDetailMdService.filterAllInvProduct(filterInvProductDetailRequest); invProductDetailEntities = invProductDetailService.filterAllInvProduct(filterInvProductDetailRequest);
} else { } else {
return null; return null;
} }
@ -202,7 +201,7 @@ public class UdiTraceController {
if (warehouseQueryRequest.getCustomerId() != null) { if (warehouseQueryRequest.getCustomerId() != null) {
filterInvProductDetailRequest.setCustomerId(warehouseQueryRequest.getCustomerId() + ""); filterInvProductDetailRequest.setCustomerId(warehouseQueryRequest.getCustomerId() + "");
} }
invProductDetailEntities = invProductDetailMdService.filterAllInvProduct(filterInvProductDetailRequest); invProductDetailEntities = invProductDetailService.filterAllInvProduct(filterInvProductDetailRequest);
} }
if (invProductDetailEntities != null && invProductDetailEntities.size() > 0) { if (invProductDetailEntities != null && invProductDetailEntities.size() > 0) {
List<OrderEntity> orderEntities = new ArrayList<>(); List<OrderEntity> orderEntities = new ArrayList<>();

@ -2,20 +2,17 @@ package com.glxp.udi.admin.controller.inout;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.glxp.udi.admin.annotation.AuthRuleAnnotation; import com.glxp.udi.admin.annotation.AuthRuleAnnotation;
import com.glxp.udi.admin.common.res.BaseResponse; import com.glxp.udi.admin.common.res.BaseResponse;
import com.glxp.udi.admin.constant.ConstantStatus; import com.glxp.udi.admin.constant.ConstantStatus;
import com.glxp.udi.admin.entity.auth.AuthAdmin; import com.glxp.udi.admin.entity.auth.AuthAdmin;
import com.glxp.udi.admin.entity.inout.*; 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.entity.udid.UdiEntity;
import com.glxp.udi.admin.mongo.service.OrderService; import com.glxp.udi.admin.mongo.service.OrderService;
import com.glxp.udi.admin.mongo.service.WarehouseMdService; import com.glxp.udi.admin.mongo.service.WarehouseService;
import com.glxp.udi.admin.mongo.service.WarehouseTempMdService; import com.glxp.udi.admin.mongo.service.WarehouseTempService;
import com.glxp.udi.admin.mongo.utils.PageResult;
import com.glxp.udi.admin.req.inout.*; import com.glxp.udi.admin.req.inout.*;
import com.glxp.udi.admin.req.inventory.FilterInvLinkDataRequest; import com.glxp.udi.admin.req.inventory.FilterInvLinkDataRequest;
import com.glxp.udi.admin.res.PageSimpleResponse; import com.glxp.udi.admin.res.PageSimpleResponse;
@ -52,63 +49,62 @@ public class WareHouseController {
@Resource @Resource
private TransInoutService transInoutService; private TransInoutService transInoutService;
@Resource @Resource
private WarehouseMdService warehouseMdService; private WarehouseService warehouseService;
@Resource @Resource
private WarehouseTempMdService warehouseTempMdService; private WarehouseTempService warehouseTempService;
@Resource @Resource
private OrderService orderService; private OrderService orderService;
@Resource @Resource
private UdiInfoService udiInfoService; private UdiInfoService udiInfoService;
@AuthRuleAnnotation("") @AuthRuleAnnotation("")
@PostMapping("warehouse/inout/postOrders") @PostMapping("warehouse/inout/postOrders")
public BaseResponse postOrders(@RequestBody PostOrderRequest postOrderRequest, BindingResult bindingResult) { public BaseResponse postOrders(@RequestBody PostOrderRequest postOrderRequest, BindingResult bindingResult) {
if (bindingResult.hasErrors()) { if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
} }
transInoutService.createOrder(postOrderRequest, Long.valueOf(authAdminService.getCurrentUserCustomerId())); transInoutService.createOrder(postOrderRequest, Long.parseLong(authAdminService.getCurrentUserCustomerId()));
return ResultVOUtils.success("导入成功"); return ResultVOUtils.success("导入成功");
} }
@GetMapping("admin/warehouse/inout/findByOrderId") @GetMapping("admin/warehouse/inout/findByOrderId")
public BaseResponse findByOrderId(WarehouseQueryRequest warehouseQueryRequest) { public BaseResponse findByOrderId(WarehouseQueryRequest warehouseQueryRequest) {
PageResult<WarehouseMdEntity> pageResult = warehouseMdService.filterWarehouseByPage(warehouseQueryRequest); IPage<WarehouseEntity> page = warehouseService.filterWarehouseByPage(warehouseQueryRequest);
PageSimpleResponse<WarehouseMdEntity> pageSimpleResponse = new PageSimpleResponse<>(); PageSimpleResponse<WarehouseEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageResult.getTotal()); pageSimpleResponse.setTotal(page.getTotal());
pageSimpleResponse.setList(pageResult.getList()); pageSimpleResponse.setList(page.getRecords());
return ResultVOUtils.success(pageSimpleResponse); return ResultVOUtils.success(pageSimpleResponse);
} }
@GetMapping("admin/warehouse/inout/findErrorByOrderId") @GetMapping("admin/warehouse/inout/findErrorByOrderId")
public BaseResponse findErrorByOrderId(WarehouseQueryRequest warehouseQueryRequest) { public BaseResponse findErrorByOrderId(WarehouseQueryRequest warehouseQueryRequest) {
PageResult<WarehousetempMdEntity> pageResult = warehouseTempMdService.filterWarehouseByPage(warehouseQueryRequest); IPage<WarehousetempEntity> page = warehouseTempService.filterWarehouseByPage(warehouseQueryRequest);
PageSimpleResponse<WarehousetempMdEntity> pageSimpleResponse = new PageSimpleResponse<>(); PageSimpleResponse<WarehousetempEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageResult.getTotal()); pageSimpleResponse.setTotal(page.getTotal());
pageSimpleResponse.setList(pageResult.getList()); pageSimpleResponse.setList(page.getRecords());
return ResultVOUtils.success(pageSimpleResponse); return ResultVOUtils.success(pageSimpleResponse);
} }
@AuthRuleAnnotation("") @AuthRuleAnnotation("")
@GetMapping("warehouse/inout/deleteCodesTempById") @GetMapping("warehouse/inout/deleteCodesTempById")
public BaseResponse deleteCodesTempById(String id) { public BaseResponse deleteCodesTempById(String id) {
WarehousetempMdEntity warehousetemp = warehouseTempMdService.findTempById(id); WarehousetempEntity warehousetemp = warehouseTempService.findTempById(id);
if (null == warehousetemp) { if (null == warehousetemp) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
} }
if (warehousetemp.getCount() != null && warehousetemp.getCount() > 1) { if (warehousetemp.getCount() != null && warehousetemp.getCount() > 1) {
warehousetemp.setCount(warehousetemp.getCount() - 1); warehousetemp.setCount(warehousetemp.getCount() - 1);
warehouseTempMdService.updateById(warehousetemp); warehouseTempService.updateById(warehousetemp);
} else { } else {
warehouseTempMdService.deleteTempWarehouses(Collections.singletonList(warehousetemp.getId())); warehouseTempService.deleteTempWarehouses(Collections.singletonList(warehousetemp.getId()));
} }
List<WarehousetempMdEntity> tempByOrderId = warehouseTempMdService.findTempByOrderId(warehousetemp.getOrderId()); List<WarehousetempEntity> tempByOrderId = warehouseTempService.findTempByOrderId(warehousetemp.getOrderId());
if (tempByOrderId.size() == 0) { if (tempByOrderId.size() == 0) {
DeleteRequest deleteRequest = new DeleteRequest(); DeleteRequest deleteRequest = new DeleteRequest();
deleteRequest.setOrderId(warehousetemp.getOrderId()); deleteRequest.setOrderId(warehousetemp.getOrderId());
warehouseTempMdService.deleteCode(deleteRequest); warehouseTempService.deleteCode(deleteRequest);
} }
return ResultVOUtils.success(); return ResultVOUtils.success();
} }
@ -218,7 +214,7 @@ public class WareHouseController {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
} }
OrderMdEntity orderEntity = orderService.findByOne(commitRequest.getOrderId()); OrderEntity orderEntity = orderService.findByOne(commitRequest.getOrderId());
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_WAIT); orderEntity.setStatus(ConstantStatus.ORDER_STATUS_WAIT);
orderService.updateOrder(orderEntity); orderService.updateOrder(orderEntity);
return ResultVOUtils.success("提交成功"); return ResultVOUtils.success("提交成功");
@ -233,10 +229,10 @@ public class WareHouseController {
@AuthRuleAnnotation("") @AuthRuleAnnotation("")
@GetMapping("spms/inout/dlcode/findByOrderId") @GetMapping("spms/inout/dlcode/findByOrderId")
public BaseResponse downloadCodesByOrderId(WarehouseQueryRequest warehouseQueryRequest) { public BaseResponse downloadCodesByOrderId(WarehouseQueryRequest warehouseQueryRequest) {
PageResult<WarehouseMdEntity> pageResult = warehouseMdService.findOrdersById(warehouseQueryRequest); IPage<WarehouseEntity> page = warehouseService.filterWarehouseByPage(warehouseQueryRequest);
PageSimpleResponse<WarehouseMdEntity> pageSimpleResponse = new PageSimpleResponse<>(); PageSimpleResponse<WarehouseEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageResult.getTotal()); pageSimpleResponse.setTotal(page.getTotal());
pageSimpleResponse.setList(pageResult.getList()); pageSimpleResponse.setList(page.getRecords());
return ResultVOUtils.success(pageSimpleResponse); return ResultVOUtils.success(pageSimpleResponse);
} }
@ -261,7 +257,7 @@ public class WareHouseController {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "产品未维护"); return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "产品未维护");
} }
codesReplaceRequest.setUdiEntity(udiInfoEntity); codesReplaceRequest.setUdiEntity(udiInfoEntity);
warehouseMdService.replaceCodes(codesReplaceRequest); warehouseService.replaceCodes(codesReplaceRequest);
return ResultVOUtils.success(); return ResultVOUtils.success();
} }

@ -3,10 +3,45 @@ package com.glxp.udi.admin.dao.inout;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.udi.admin.entity.inout.WarehouseEntity; import com.glxp.udi.admin.entity.inout.WarehouseEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* *
*/ */
@Mapper @Mapper
public interface CodesDao extends BaseMapper<WarehouseEntity> { public interface CodesDao extends BaseMapper<WarehouseEntity> {
/**
*
*
* @param orderId
* @param fromCorp
* @param fromCorpId
*/
void updateUnit(@Param("orderId") String orderId, @Param("fromCorp") String fromCorp, @Param("fromCorpId") String fromCorpId);
/**
*
*
* @param orderId
* @param newOrderId
*/
void updateOrderId(@Param("orderId") String orderId, @Param("newOrderId") String newOrderId);
/**
*
*
* @param orderId
* @return
*/
List<WarehouseEntity> selectByOrderId(@Param("orderId") String orderId);
/**
*
* @param count
* @param id
*/
void updateCount(@Param("count") Integer count, @Param("id") String id);
} }

@ -3,10 +3,35 @@ package com.glxp.udi.admin.dao.inout;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.udi.admin.entity.inout.WarehousetempEntity; import com.glxp.udi.admin.entity.inout.WarehousetempEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* *
*/ */
@Mapper @Mapper
public interface CodesTempDao extends BaseMapper<WarehousetempEntity> { public interface CodesTempDao extends BaseMapper<WarehousetempEntity> {
/**
*
*
* @param orderId
* @return
*/
List<WarehousetempEntity> selectByOrderId(@Param("orderId") String orderId);
/**
*
* @param id
* @param orderId
*/
void delete(@Param("id") String id, @Param("orderId") String orderId);
/**
*
* @param id
* @param count
*/
void updateCount(@Param("id") String id, @Param("count") Integer count);
} }

@ -1,175 +0,0 @@
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.InvProductDetailEntity;
import com.glxp.udi.admin.entity.udid.UdiEntity;
import com.glxp.udi.admin.mongo.MongoDBName;
import com.glxp.udi.admin.mongo.utils.MongoPageHelper;
import com.glxp.udi.admin.mongo.utils.PageResult;
import com.glxp.udi.admin.req.inout.FilterInvProductDetailRequest;
import com.glxp.udi.admin.util.FilterUdiUtils;
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.List;
@Service
public class InvProductDetailMdService {
@Resource
private MongoTemplate mongoTemplate;
@Resource
private MongoPageHelper mongoPageHelper;
public PageResult<InvProductDetailEntity> filterInvProduct(FilterInvProductDetailRequest filterInvProductDetailRequest) {
Query query = new Query();
if (filterInvProductDetailRequest.getCode() != null && !filterInvProductDetailRequest.getCode().isEmpty()) {
query.addCriteria(Criteria.where("code").is(filterInvProductDetailRequest.getCode()));
}
if (filterInvProductDetailRequest.getProductIdFk() != null && !filterInvProductDetailRequest.getProductIdFk().isEmpty()) {
query.addCriteria(Criteria.where("productIdFk").is(filterInvProductDetailRequest.getProductIdFk()));
}
if (filterInvProductDetailRequest.getMainAction() != null && !filterInvProductDetailRequest.getMainAction().isEmpty()) {
query.addCriteria(Criteria.where("mainAction").is(filterInvProductDetailRequest.getMainAction()));
}
if (filterInvProductDetailRequest.getCustomerId() != null && !filterInvProductDetailRequest.getCustomerId().isEmpty()) {
query.addCriteria(Criteria.where("customerId").is(filterInvProductDetailRequest.getCustomerId()));
}
if (filterInvProductDetailRequest.getBatchNo() != null && !filterInvProductDetailRequest.getBatchNo().isEmpty()) {
query.addCriteria(Criteria.where("batchNo").is(filterInvProductDetailRequest.getBatchNo()));
}
if (CollUtil.isNotEmpty(filterInvProductDetailRequest.getInvCodes())) {
query.addCriteria(Criteria.where("locStorageCode").in(filterInvProductDetailRequest.getInvCodes()));
}
return mongoPageHelper.pageQuery(query, InvProductDetailEntity.class,
filterInvProductDetailRequest.getLimit(), filterInvProductDetailRequest.getPage(),
filterInvProductDetailRequest.getLastId(), MongoDBName.NAME_INV_PRODUCT_DETAIL);
}
public List<InvProductDetailEntity> filterAllInvProduct(FilterInvProductDetailRequest filterInvProductDetailRequest) {
Query query = new Query();
if (filterInvProductDetailRequest.getCode() != null && !filterInvProductDetailRequest.getCode().isEmpty()) {
query.addCriteria(Criteria.where("code").is(filterInvProductDetailRequest.getCode()));
}
if (filterInvProductDetailRequest.getProductIdFk() != null && !filterInvProductDetailRequest.getProductIdFk().isEmpty()) {
query.addCriteria(Criteria.where("productIdFk").is(filterInvProductDetailRequest.getProductIdFk()));
}
if (filterInvProductDetailRequest.getMainAction() != null && !filterInvProductDetailRequest.getMainAction().isEmpty()) {
query.addCriteria(Criteria.where("mainAction").is(filterInvProductDetailRequest.getMainAction()));
}
if (filterInvProductDetailRequest.getCustomerId() != null && !filterInvProductDetailRequest.getCustomerId().isEmpty()) {
query.addCriteria(Criteria.where("customerId").is(filterInvProductDetailRequest.getCustomerId()));
}
if (filterInvProductDetailRequest.getBatchNo() != null && !filterInvProductDetailRequest.getBatchNo().isEmpty()) {
query.addCriteria(Criteria.where("batchNo").is(filterInvProductDetailRequest.getBatchNo()));
}
if (StrUtil.isNotBlank(filterInvProductDetailRequest.getOrderIdFk())) {
query.addCriteria(Criteria.where("orderIdFk").is(filterInvProductDetailRequest.getOrderIdFk()));
}
if (CollUtil.isNotEmpty(filterInvProductDetailRequest.getInvCodes())) {
query.addCriteria(Criteria.where("locStorageCode").in(filterInvProductDetailRequest.getInvCodes()));
}
return mongoTemplate.find(query, InvProductDetailEntity.class, MongoDBName.NAME_INV_PRODUCT_DETAIL);
}
public void insertInvProduct(InvProductDetailEntity invProductDetailEntity) {
mongoTemplate.insert(invProductDetailEntity, MongoDBName.NAME_INV_PRODUCT_DETAIL);
}
public void updateInvProduct(InvProductDetailEntity invProductDetailEntity) {
Query query = new Query();
query.addCriteria(new Criteria().and("_id").is(invProductDetailEntity.getId()));
Update update = new Update();
if (invProductDetailEntity.getCount() != null) {
update.set("count", invProductDetailEntity.getCount());
}
if (invProductDetailEntity.getCode() != null) {
update.set("code", invProductDetailEntity.getCode());
}
if (invProductDetailEntity.getProductIdFk() != null) {
update.set("productIdFk", invProductDetailEntity.getProductIdFk());
}
if (invProductDetailEntity.getOrderIdFk() != null) {
update.set("orderIdFk", invProductDetailEntity.getOrderIdFk());
}
if (invProductDetailEntity.getCustomerId() != null) {
update.set("customerId", invProductDetailEntity.getCustomerId());
}
if (invProductDetailEntity.getMainAction() != null) {
update.set("mainAction", invProductDetailEntity.getMainAction());
}
if (invProductDetailEntity.getAction() != null) {
update.set("action", invProductDetailEntity.getAction());
}
mongoTemplate.updateMulti(query, update, MongoDBName.NAME_INV_PRODUCT_DETAIL);
}
public void deleteById(String id) {
Query query = new Query();
if (id != null) {
query.addCriteria(Criteria.where("id").is(id));
}
mongoTemplate.remove(query, InvProductDetailEntity.class, MongoDBName.NAME_INV_PRODUCT_DETAIL);
}
public void deleteByProductId(String productIdFk) {
Query query = new Query();
if (productIdFk != null) {
query.addCriteria(Criteria.where("invProductIdFk").is(productIdFk));
}
mongoTemplate.remove(query, InvProductDetailEntity.class, MongoDBName.NAME_INV_PRODUCT_DETAIL);
}
/**
*
*
* @param detailParams
* @return
*/
public long statCount(FilterInvProductDetailRequest detailParams) {
Query query = new Query();
if (StrUtil.isNotEmpty(detailParams.getBatchNo())) {
query.addCriteria(Criteria.where("batchNo").is(detailParams.getBatchNo()));
}
if (StrUtil.isNotBlank(detailParams.getProductIdFk())) {
query.addCriteria(Criteria.where("productIdFk").is(detailParams.getProductIdFk()));
}
if (CollUtil.isNotEmpty(detailParams.getInvCodes())) {
query.addCriteria(Criteria.where("locStorageCode").in(detailParams.getInvCodes()));
}
return mongoTemplate.count(query, MongoDBName.NAME_INV_PRODUCT_DETAIL);
}
public InvProductDetailEntity statInvPreInDetail(String code) {
FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest();
filterInvProductDetailRequest.setCode(code);
List<InvProductDetailEntity> datas = filterAllInvProduct(filterInvProductDetailRequest);
if (CollUtil.isEmpty(datas)) {
FilterInvProductDetailRequest tempQuery = new FilterInvProductDetailRequest();
UdiEntity udiEntity = FilterUdiUtils.getUdi(code);
if (StrUtil.isNotEmpty(udiEntity.getBatchNo())) {
tempQuery.setBatchNo(udiEntity.getBatchNo());
} else {
tempQuery.setBatchNo("empty");
}
datas = filterAllInvProduct(filterInvProductDetailRequest);
}
if (CollUtil.isNotEmpty(datas)) {
InvProductDetailEntity invProductDetailEntity = datas.get(0);
return invProductDetailEntity;
}
return null;
}
}

@ -0,0 +1,114 @@
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.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.glxp.udi.admin.dao.inout.InvProductDetailDao;
import com.glxp.udi.admin.entity.inout.InvProductDetailEntity;
import com.glxp.udi.admin.entity.udid.UdiEntity;
import com.glxp.udi.admin.req.inout.FilterInvProductDetailRequest;
import com.glxp.udi.admin.util.FilterUdiUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class InvProductDetailService {
@Resource
private InvProductDetailDao invProductDetailDao;
public IPage<InvProductDetailEntity> filterInvProduct(FilterInvProductDetailRequest filterInvProductDetailRequest) {
QueryWrapper<InvProductDetailEntity> wrapper = buildInvDetailQueryWrapper(filterInvProductDetailRequest);
IPage<InvProductDetailEntity> page = new Page<>(filterInvProductDetailRequest.getPage(), filterInvProductDetailRequest.getLimit());
return invProductDetailDao.selectPage(page, wrapper);
}
/**
*
*
* @param filterInvProductDetailRequest
* @return
*/
private QueryWrapper<InvProductDetailEntity> buildInvDetailQueryWrapper(FilterInvProductDetailRequest filterInvProductDetailRequest) {
QueryWrapper<InvProductDetailEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StrUtil.isNotBlank(filterInvProductDetailRequest.getCode()), "code", filterInvProductDetailRequest.getCode())
.eq(StrUtil.isNotBlank(filterInvProductDetailRequest.getProductIdFk()), "productIdFk", filterInvProductDetailRequest.getProductIdFk())
.eq(StrUtil.isNotBlank(filterInvProductDetailRequest.getMainAction()), "mainAction", filterInvProductDetailRequest.getMainAction())
.eq(null != filterInvProductDetailRequest.getCustomerId(), "customerId", filterInvProductDetailRequest.getCustomerId())
.eq(StrUtil.isNotBlank(filterInvProductDetailRequest.getBatchNo()), "batchNo", filterInvProductDetailRequest.getBatchNo())
.eq(StrUtil.isNotBlank(filterInvProductDetailRequest.getOrderIdFk()), "orderIdFk", filterInvProductDetailRequest.getOrderIdFk())
.in(CollUtil.isNotEmpty(filterInvProductDetailRequest.getInvCodes()), "locStorageCode", filterInvProductDetailRequest.getInvCodes());
return wrapper;
}
public List<InvProductDetailEntity> filterAllInvProduct(FilterInvProductDetailRequest filterInvProductDetailRequest) {
QueryWrapper<InvProductDetailEntity> wrapper = buildInvDetailQueryWrapper(filterInvProductDetailRequest);
return invProductDetailDao.selectList(wrapper);
}
public void insertInvProduct(InvProductDetailEntity invProductDetailEntity) {
invProductDetailDao.insert(invProductDetailEntity);
}
public void updateInvProduct(InvProductDetailEntity invProductDetailEntity) {
invProductDetailDao.updateById(invProductDetailEntity);
}
public void deleteById(String id) {
invProductDetailDao.deleteById(id);
}
/**
* ID
*
* @param productIdFk
*/
public void deleteByProductId(String productIdFk) {
QueryWrapper<InvProductDetailEntity> wrapper = new QueryWrapper<>();
wrapper.eq("productIdFk", productIdFk);
invProductDetailDao.delete(wrapper);
}
/**
*
*
* @param detailParams
* @return
*/
public long statCount(FilterInvProductDetailRequest detailParams) {
QueryWrapper<InvProductDetailEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StrUtil.isNotBlank(detailParams.getBatchNo()), "batchNo", detailParams.getBatchNo())
.eq(StrUtil.isNotBlank(detailParams.getProductIdFk()), "productIdFk", detailParams.getProductIdFk())
.eq(CollUtil.isNotEmpty(detailParams.getInvCodes()), "locStorageCode", detailParams.getInvCodes());
return invProductDetailDao.selectCount(wrapper);
}
public InvProductDetailEntity statInvPreInDetail(String code) {
FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest();
filterInvProductDetailRequest.setCode(code);
List<InvProductDetailEntity> datas = filterAllInvProduct(filterInvProductDetailRequest);
if (CollUtil.isEmpty(datas)) {
FilterInvProductDetailRequest tempQuery = new FilterInvProductDetailRequest();
UdiEntity udiEntity = FilterUdiUtils.getUdi(code);
if (StrUtil.isNotEmpty(udiEntity.getBatchNo())) {
tempQuery.setBatchNo(udiEntity.getBatchNo());
} else {
tempQuery.setBatchNo("empty");
}
datas = filterAllInvProduct(filterInvProductDetailRequest);
}
if (CollUtil.isNotEmpty(datas)) {
InvProductDetailEntity invProductDetailEntity = datas.get(0);
return invProductDetailEntity;
}
return null;
}
}

@ -2,193 +2,72 @@ package com.glxp.udi.admin.mongo.service;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil; 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.dao.inout.InvProductDao;
import com.glxp.udi.admin.entity.inout.InvProductEntity; import com.glxp.udi.admin.entity.inout.InvProductEntity;
import com.glxp.udi.admin.mongo.MongoDBName;
import com.glxp.udi.admin.mongo.utils.MongoPageHelper;
import com.glxp.udi.admin.mongo.utils.PageResult;
import com.glxp.udi.admin.req.inventory.FilterInvProductRequest; import com.glxp.udi.admin.req.inventory.FilterInvProductRequest;
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 org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.regex.Pattern;
@Service @Service
public class InvProductService { public class InvProductService {
@Resource @Resource
private MongoTemplate mongoTemplate; private InvProductDao invProductDao;
@Resource
private MongoPageHelper mongoPageHelper;
public PageResult<InvProductEntity> filterInvProduct(FilterInvProductRequest filterInvProductRequest) { public IPage<InvProductEntity> filterInvProduct(FilterInvProductRequest filterInvProductRequest) {
Query query = new Query(); QueryWrapper<InvProductEntity> wrapper = buildInvQueryWrapper(filterInvProductRequest);
if (filterInvProductRequest.getUuids() != null && filterInvProductRequest.getUuids().size() > 0) {
query.addCriteria(Criteria.where("relIdFk").in(filterInvProductRequest.getUuids())); IPage<InvProductEntity> page = new Page<>(filterInvProductRequest.getPage(), filterInvProductRequest.getLimit());
} return invProductDao.selectPage(page, wrapper);
if (filterInvProductRequest.getBatchNo() != null && !filterInvProductRequest.getBatchNo().isEmpty()) { }
query.addCriteria(Criteria.where("batchNo").is(filterInvProductRequest.getBatchNo()));
} private QueryWrapper<InvProductEntity> buildInvQueryWrapper(FilterInvProductRequest filterInvProductRequest) {
if (filterInvProductRequest.getCustomerId() != null && !filterInvProductRequest.getCustomerId().isEmpty()) { QueryWrapper<InvProductEntity> wrapper = new QueryWrapper<>();
query.addCriteria(Criteria.where("customerId").is(filterInvProductRequest.getCustomerId())); wrapper.eq(StrUtil.isNotBlank(filterInvProductRequest.getRelIdFk()), "relIdFk", filterInvProductRequest.getRelIdFk())
} .eq(StrUtil.isNotBlank(filterInvProductRequest.getBatchNo()), "batchNo", filterInvProductRequest.getBatchNo())
if (CollUtil.isNotEmpty(filterInvProductRequest.getInvCodes())) { .eq(StrUtil.isNotBlank(filterInvProductRequest.getCustomerId()), "customerId", filterInvProductRequest.getCustomerId())
query.addCriteria(Criteria.where("locStorageCode").in(filterInvProductRequest.getInvCodes())); .in(CollUtil.isNotEmpty(filterInvProductRequest.getInvCodes()), "locStorageCode", filterInvProductRequest.getInvCodes())
} .eq(StrUtil.isNotBlank(filterInvProductRequest.getNameCode()), "nameCode", filterInvProductRequest.getNameCode())
if (StrUtil.isNotBlank(filterInvProductRequest.getNameCode())) { .like(StrUtil.isNotBlank(filterInvProductRequest.getProductsName()), "productName", filterInvProductRequest.getProductsName())
query.addCriteria(Criteria.where("nameCode").is(filterInvProductRequest.getNameCode())); .like(StrUtil.isNotBlank(filterInvProductRequest.getZczbhhzbapzbh()), "zczbhhzbapzbh", filterInvProductRequest.getZczbhhzbapzbh())
} .like(StrUtil.isNotBlank(filterInvProductRequest.getManufactory()), "manufactory", filterInvProductRequest.getManufactory())
if (StrUtil.isNotBlank(filterInvProductRequest.getCpmctymc())) { .like(StrUtil.isNotBlank(filterInvProductRequest.getGgxh()), "ggxh", filterInvProductRequest.getGgxh());
Pattern pattern = Pattern.compile("^.*" + filterInvProductRequest.getCpmctymc() + ".*$"); return wrapper;
query.addCriteria(Criteria.where("productsName").regex(pattern));
}
if (StrUtil.isNotBlank(filterInvProductRequest.getZczbhhzbapzbh())) {
Pattern pattern = Pattern.compile("^.*" + filterInvProductRequest.getZczbhhzbapzbh() + ".*$");
query.addCriteria(Criteria.where("zczbhhzbapzbh").regex(pattern));
}
if (StrUtil.isNotBlank(filterInvProductRequest.getManufactory())) {
Pattern pattern = Pattern.compile("^.*" + filterInvProductRequest.getManufactory() + ".*$");
query.addCriteria(Criteria.where("manufactory").regex(pattern));
}
if (StrUtil.isNotBlank(filterInvProductRequest.getGgxh())) {
Pattern pattern = Pattern.compile("^.*" + filterInvProductRequest.getGgxh() + ".*$");
query.addCriteria(Criteria.where("ggxh").regex(pattern));
}
return mongoPageHelper.pageQuery(query, InvProductEntity.class,
filterInvProductRequest.getLimit(), filterInvProductRequest.getPage(), filterInvProductRequest.getLastId(), MongoDBName.NAME_INV_PRODUCT);
} }
public List<InvProductEntity> filterInvProductList(FilterInvProductRequest filterInvProductRequest) { public List<InvProductEntity> filterInvProductList(FilterInvProductRequest filterInvProductRequest) {
Query query = new Query(); QueryWrapper<InvProductEntity> wrapper = buildInvQueryWrapper(filterInvProductRequest);
if (filterInvProductRequest.getUuids() != null && filterInvProductRequest.getUuids().size() > 0) { return invProductDao.selectList(wrapper);
query.addCriteria(Criteria.where("relIdFk").in(filterInvProductRequest.getUuids()));
}
if (filterInvProductRequest.getBatchNo() != null && !filterInvProductRequest.getBatchNo().isEmpty()) {
query.addCriteria(Criteria.where("batchNo").is(filterInvProductRequest.getBatchNo()));
}
if (filterInvProductRequest.getCustomerId() != null && !filterInvProductRequest.getCustomerId().isEmpty()) {
query.addCriteria(Criteria.where("customerId").is(filterInvProductRequest.getCustomerId()));
}
if (CollUtil.isNotEmpty(filterInvProductRequest.getInvCodes())) {
query.addCriteria(Criteria.where("locStorageCode").in(filterInvProductRequest.getInvCodes()));
}
if (StrUtil.isNotBlank(filterInvProductRequest.getNameCode())) {
query.addCriteria(Criteria.where("nameCode").is(filterInvProductRequest.getNameCode()));
}
if (StrUtil.isNotBlank(filterInvProductRequest.getCpmctymc())) {
Pattern pattern = Pattern.compile("^.*" + filterInvProductRequest.getCpmctymc() + ".*$");
query.addCriteria(Criteria.where("productsName").regex(pattern));
}
if (StrUtil.isNotBlank(filterInvProductRequest.getZczbhhzbapzbh())) {
Pattern pattern = Pattern.compile("^.*" + filterInvProductRequest.getZczbhhzbapzbh() + ".*$");
query.addCriteria(Criteria.where("zczbhhzbapzbh").regex(pattern));
}
if (StrUtil.isNotBlank(filterInvProductRequest.getManufactory())) {
Pattern pattern = Pattern.compile("^.*" + filterInvProductRequest.getManufactory() + ".*$");
query.addCriteria(Criteria.where("manufactory").regex(pattern));
}
if (StrUtil.isNotBlank(filterInvProductRequest.getGgxh())) {
Pattern pattern = Pattern.compile("^.*" + filterInvProductRequest.getGgxh() + ".*$");
query.addCriteria(Criteria.where("ggxh").regex(pattern));
}
return mongoTemplate.find(query, InvProductEntity.class, MongoDBName.NAME_INV_PRODUCT);
} }
public InvProductEntity selectByUuid(String relIdFk, String batchNo, String customerId, String locStorageCode) { public InvProductEntity selectByUuid(String relIdFk, String batchNo, String customerId, String locStorageCode) {
Query query = new Query(); QueryWrapper<InvProductEntity> wrapper = new QueryWrapper<>();
if (relIdFk != null && !relIdFk.isEmpty()) { wrapper.eq(StrUtil.isNotBlank(relIdFk), "relIdFk", relIdFk)
query.addCriteria(Criteria.where("relIdFk").is(relIdFk)); .eq(StrUtil.isNotBlank(batchNo), "batchNo", batchNo)
} .eq(StrUtil.isNotBlank(customerId), "customerId", customerId)
if (batchNo != null && !batchNo.isEmpty()) { .eq(StrUtil.isNotBlank(locStorageCode), "locStorageCode", locStorageCode);
query.addCriteria(Criteria.where("batchNo").is(batchNo)); return invProductDao.selectOne(wrapper);
}
if (customerId != null && !customerId.isEmpty()) {
query.addCriteria(Criteria.where("customerId").is(customerId));
}
if (StrUtil.isNotBlank(locStorageCode)) {
query.addCriteria(Criteria.where("locStorageCode").is(locStorageCode));
}
List<InvProductEntity> invProductEntities = mongoTemplate.find(query, InvProductEntity.class, MongoDBName.NAME_INV_PRODUCT);
if (invProductEntities != null && invProductEntities.size() > 0) {
return invProductEntities.get(0);
}
return null;
} }
public InvProductEntity selectById(String id) { public InvProductEntity selectById(String id) {
Query query = new Query(); return invProductDao.selectById(id);
if (id != null && !id.isEmpty()) {
query.addCriteria(Criteria.where("id").is(id));
}
List<InvProductEntity> invProductEntities = mongoTemplate.find(query, InvProductEntity.class, MongoDBName.NAME_INV_PRODUCT);
if (CollUtil.isNotEmpty(invProductEntities)) {
return invProductEntities.get(0);
}
return null;
} }
public void insertInvProduct(InvProductEntity invProductEntity) { public void insertInvProduct(InvProductEntity invProductEntity) {
mongoTemplate.insert(invProductEntity, MongoDBName.NAME_INV_PRODUCT); invProductDao.insert(invProductEntity);
} }
public void updateInvProduct(InvProductEntity invProductEntity) { public void updateInvProduct(InvProductEntity invProductEntity) {
Query query = new Query(); invProductDao.updateById(invProductEntity);
query.addCriteria(new Criteria().and("_id").is(invProductEntity.getId()));
Update update = new Update();
if (invProductEntity.getInCount() != null) {
update.set("inCount", invProductEntity.getInCount());
}
if (invProductEntity.getOutCount() != null) {
update.set("outCount", invProductEntity.getOutCount());
}
if (invProductEntity.getProductsName() != null) {
update.set("productsName", invProductEntity.getProductsName());
}
if (invProductEntity.getNameCode() != null) {
update.set("nameCode", invProductEntity.getNameCode());
}
if (invProductEntity.getRelIdFk() != null) {
update.set("relIdFk", invProductEntity.getRelIdFk());
}
if (invProductEntity.getGgxh() != null) {
update.set("ggxh", invProductEntity.getGgxh());
}
if (invProductEntity.getBatchNo() != null) {
update.set("batchNo", invProductEntity.getBatchNo());
}
if (invProductEntity.getProductDate() != null) {
update.set("productionDate", invProductEntity.getProductDate());
}
if (invProductEntity.getExpireDate() != null) {
update.set("expireDate", invProductEntity.getExpireDate());
}
if (invProductEntity.getYlqxzcrbarmc() != null) {
update.set("ylqxzcrbarmc", invProductEntity.getYlqxzcrbarmc());
}
if (invProductEntity.getZczbhhzbapzbh() != null) {
update.set("zczbhhzbapzbh", invProductEntity.getZczbhhzbapzbh());
}
if (invProductEntity.getReCount() != null) {
update.set("reCount", invProductEntity.getReCount());
}
if (invProductEntity.getCustomerId() != null) {
update.set("customerId", invProductEntity.getCustomerId());
}
mongoTemplate.updateMulti(query, update, MongoDBName.NAME_INV_PRODUCT);
} }
public void deleteById(String id) { public void deleteById(String id) {
Query query = new Query(); invProductDao.deleteById(id);
if (id != null) {
query.addCriteria(Criteria.where("id").is(id));
}
mongoTemplate.remove(query, InvProductEntity.class, MongoDBName.NAME_INV_PRODUCT);
} }
/** /**
@ -198,9 +77,9 @@ public class InvProductService {
* @return * @return
*/ */
public boolean isExist(String code) { public boolean isExist(String code) {
Query query = new Query(); QueryWrapper<InvProductEntity> wrapper = new QueryWrapper<>();
query.addCriteria(Criteria.where("locStorageCode").is(code)); wrapper.eq("locStorageCode", code);
long count = mongoTemplate.count(query, InvProductEntity.class, MongoDBName.NAME_INV_PRODUCT); Long count = invProductDao.selectCount(wrapper);
if (count > 0) { if (count > 0) {
return true; return true;
} }
@ -215,10 +94,10 @@ public class InvProductService {
* @return * @return
*/ */
public Long countByNamecode(String nameCode, String customerId) { public Long countByNamecode(String nameCode, String customerId) {
Query query = new Query(); QueryWrapper<InvProductEntity> wrapper = new QueryWrapper<>();
query.addCriteria(Criteria.where("nameCode").is(nameCode)); wrapper.eq("nameCode", nameCode).eq("customerId", customerId);
query.addCriteria(Criteria.where("customerId").is(customerId)); Long count = invProductDao.selectCount(wrapper);
return mongoTemplate.count(query, InvProductEntity.class, MongoDBName.NAME_INV_PRODUCT); return count;
} }
} }

@ -21,11 +21,8 @@ import com.glxp.udi.admin.entity.auth.CustomerInfoEntity;
import com.glxp.udi.admin.entity.basic.BussinessTypeEntity; import com.glxp.udi.admin.entity.basic.BussinessTypeEntity;
import com.glxp.udi.admin.entity.inout.*; import com.glxp.udi.admin.entity.inout.*;
import com.glxp.udi.admin.entity.mongo.OrderMdEntity; 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.entity.param.SystemParamConfigEntity;
import com.glxp.udi.admin.mongo.MongoDBName; import com.glxp.udi.admin.mongo.MongoDBName;
import com.glxp.udi.admin.mongo.dao.OrderMdDao;
import com.glxp.udi.admin.req.inout.DeleteRequest; import com.glxp.udi.admin.req.inout.DeleteRequest;
import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest; import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest;
import com.glxp.udi.admin.req.inout.OrderFilterRequest; import com.glxp.udi.admin.req.inout.OrderFilterRequest;
@ -56,10 +53,10 @@ public class OrderService {
private SystemParamConfigService systemParamConfigService; private SystemParamConfigService systemParamConfigService;
@Lazy @Lazy
@Resource @Resource
private WarehouseMdService warehouseMdService; private WarehouseService warehouseService;
@Lazy @Lazy
@Resource @Resource
private WarehouseTempMdService warehouseTempMdService; private WarehouseTempService warehouseTempService;
@Lazy @Lazy
@Resource @Resource
private OrderDetailService orderDetailService; private OrderDetailService orderDetailService;
@ -77,8 +74,6 @@ public class OrderService {
@Resource @Resource
private BussinessTypeDao bussinessTypeDao; private BussinessTypeDao bussinessTypeDao;
@Resource @Resource
private OrderMdDao orderMdDao;
@Resource
private OrderDao orderDao; private OrderDao orderDao;
public IPage<OrderEntity> filterList(OrderFilterRequest orderFilterRequest) { public IPage<OrderEntity> filterList(OrderFilterRequest orderFilterRequest) {
@ -202,10 +197,10 @@ public class OrderService {
supplementOrder.setAction(supplementType.getAction()); supplementOrder.setAction(supplementType.getAction());
//复制码表 //复制码表
List<WarehouseMdEntity> codes = warehouseMdService.findByOrderId(orderEntity.getOrderId()); List<WarehouseEntity> codes = warehouseService.findByOrderId(orderEntity.getOrderId());
List<WarehousetempMdEntity> supplementCodes = new ArrayList<>(codes.size()); List<WarehousetempEntity> supplementCodes = new ArrayList<>(codes.size());
codes.forEach(code -> { codes.forEach(code -> {
WarehousetempMdEntity supplementCode = new WarehousetempEntity(); WarehousetempEntity supplementCode = new WarehousetempEntity();
BeanUtil.copyProperties(code, supplementCode); BeanUtil.copyProperties(code, supplementCode);
supplementCode.setFromCorpId(supplementOrder.getFromCorpId()); supplementCode.setFromCorpId(supplementOrder.getFromCorpId());
supplementCode.setFromCorp(supplementOrder.getFromCorp()); supplementCode.setFromCorp(supplementOrder.getFromCorp());
@ -219,12 +214,12 @@ public class OrderService {
//更新数据 //更新数据
try { try {
supplementOrder.setId(null); supplementOrder.setOrderId(null);
insertOrder(supplementOrder); insertOrder(supplementOrder);
//更新配货单表对应的单据补单号 //更新配货单表对应的单据补单号
orderEntity.setSupplementNo(supplementOrderNo); orderEntity.setSupplementNo(supplementOrderNo);
updateOrder(orderEntity); updateOrder(orderEntity);
warehouseTempMdService.insertTempWarehouses(supplementCodes); warehouseTempService.insertTempWarehouses(supplementCodes);
} catch (Exception e) { } catch (Exception e) {
log.error("补单数据插入失败", e); log.error("补单数据插入失败", e);
} }

@ -2,38 +2,25 @@ package com.glxp.udi.admin.mongo.service;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil; 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.constant.ConstantStatus; import com.glxp.udi.admin.constant.ConstantStatus;
import com.glxp.udi.admin.constant.ConstantType; import com.glxp.udi.admin.constant.ConstantType;
import com.glxp.udi.admin.entity.inout.InvProductDetailEntity; import com.glxp.udi.admin.dao.inout.CodesDao;
import com.glxp.udi.admin.entity.inout.InvProductEntity; import com.glxp.udi.admin.entity.inout.*;
import com.glxp.udi.admin.entity.inout.OrderDetailEntity;
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;
import com.glxp.udi.admin.req.inout.*; import com.glxp.udi.admin.req.inout.*;
import com.glxp.udi.admin.req.inventory.FilterInvProductRequest; import com.glxp.udi.admin.req.inventory.FilterInvProductRequest;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
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 org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@Service @Service
public class WarehouseMdService { public class WarehouseService {
@Resource
private MongoTemplate mongoTemplate;
@Resource
private MongoPageHelper mongoPageHelper;
@Lazy @Lazy
@Resource @Resource
private OrderService orderService; private OrderService orderService;
@ -42,101 +29,65 @@ public class WarehouseMdService {
private InvProductService invProductService; private InvProductService invProductService;
@Lazy @Lazy
@Resource @Resource
private InvProductDetailMdService invProductDetailMdService; private InvProductDetailService invProductDetailService;
@Lazy @Lazy
@Resource @Resource
private OrderDetailService orderDetailService; private OrderDetailService orderDetailService;
@Resource
private CodesDao codesDao;
public PageResult<WarehouseMdEntity> filterWarehouseByPage(WarehouseQueryRequest warehouseQueryRequest) { public IPage<WarehouseEntity> filterWarehouseByPage(WarehouseQueryRequest warehouseQueryRequest) {
Query query = new Query(); IPage<WarehouseEntity> page = new Page<>(warehouseQueryRequest.getPage(), warehouseQueryRequest.getLimit());
if (warehouseQueryRequest.getCode() != null && !warehouseQueryRequest.getCode().isEmpty()) { QueryWrapper<WarehouseEntity> wrapper = buildCodesQueryWrapper(warehouseQueryRequest);
query.addCriteria(Criteria.where("code").is(warehouseQueryRequest.getCode())); return codesDao.selectPage(page, wrapper);
}
if (warehouseQueryRequest.getCorpOrderId() != null && !warehouseQueryRequest.getCorpOrderId().isEmpty()) {
query.addCriteria(Criteria.where("corpOrderId").is(warehouseQueryRequest.getCorpOrderId()));
}
if (warehouseQueryRequest.getOrderId() != null && !warehouseQueryRequest.getOrderId().isEmpty()) {
query.addCriteria(Criteria.where("orderId").is(warehouseQueryRequest.getOrderId()));
}
return mongoPageHelper.pageQuery(query, WarehouseMdEntity.class,
warehouseQueryRequest.getLimit(), warehouseQueryRequest.getPage(), warehouseQueryRequest.getLastId(), MongoDBName.NAME_CODE);
} }
public List<WarehouseMdEntity> filterWarehouse(WarehouseQueryRequest warehouseQueryRequest) { public List<WarehouseEntity> filterWarehouse(WarehouseQueryRequest warehouseQueryRequest) {
Query query = new Query(); QueryWrapper<WarehouseEntity> wrapper = buildCodesQueryWrapper(warehouseQueryRequest);
if (warehouseQueryRequest.getCode() != null && !warehouseQueryRequest.getCode().isEmpty()) { return codesDao.selectList(wrapper);
query.addCriteria(Criteria.where("code").is(warehouseQueryRequest.getCode()));
}
if (warehouseQueryRequest.getCorpOrderId() != null && !warehouseQueryRequest.getCorpOrderId().isEmpty()) {
query.addCriteria(Criteria.where("corpOrderId").is(warehouseQueryRequest.getCorpOrderId()));
}
if (warehouseQueryRequest.getOrderId() != null && !warehouseQueryRequest.getOrderId().isEmpty()) {
query.addCriteria(Criteria.where("orderId").is(warehouseQueryRequest.getOrderId()));
}
if (StrUtil.isNotBlank(warehouseQueryRequest.getCustomerId())) {
query.addCriteria(Criteria.where("customerId").is(warehouseQueryRequest.getCustomerId()));
}
if (warehouseQueryRequest.getBatchNo() != null) {
query.addCriteria(Criteria.where("batchNo").is(warehouseQueryRequest.getBatchNo()));
}
if (warehouseQueryRequest.getUdi() != null) {
query.addCriteria(Criteria.where("udi").is(warehouseQueryRequest.getUdi()));
}
return mongoTemplate.find(query, WarehouseMdEntity.class, MongoDBName.NAME_CODE);
} }
public void insertWarehouses(List<WarehouseMdEntity> warehouseEntities) { private QueryWrapper<WarehouseEntity> buildCodesQueryWrapper(WarehouseQueryRequest warehouseQueryRequest) {
if (warehouseEntities != null) { QueryWrapper<WarehouseEntity> wrapper = new QueryWrapper<>();
Collection<WarehouseMdEntity> warehouseMdEntityCollection = new ArrayList<>(); wrapper.eq(StrUtil.isNotBlank(warehouseQueryRequest.getCode()), "code", warehouseQueryRequest.getCode())
warehouseMdEntityCollection.addAll(warehouseEntities); .eq(null != warehouseQueryRequest.getCorpOrderId(), "corpOrderId", warehouseQueryRequest.getCorpOrderId())
mongoTemplate.insert(warehouseMdEntityCollection, MongoDBName.NAME_CODE); .eq(StrUtil.isNotBlank(warehouseQueryRequest.getOrderId()), "orderId", warehouseQueryRequest.getOrderId())
.eq(StrUtil.isNotBlank(warehouseQueryRequest.getCustomerId()), "customerId", warehouseQueryRequest.getCustomerId())
.eq(StrUtil.isNotBlank(warehouseQueryRequest.getBatchNo()), "batchNo", warehouseQueryRequest.getBatchNo())
.eq(StrUtil.isNotBlank(warehouseQueryRequest.getUdi()), "nameCode", warehouseQueryRequest.getUdi())
.eq(StrUtil.isNotBlank(warehouseQueryRequest.getCode()), "code", warehouseQueryRequest.getCode());
return wrapper;
}
public void insertWarehouses(List<WarehouseEntity> warehouseEntities) {
if (CollUtil.isNotEmpty(warehouseEntities)) {
for (WarehouseEntity warehouseEntity : warehouseEntities) {
codesDao.insert(warehouseEntity);
}
} }
} }
public List<WarehouseMdEntity> findByCode(FilterWarehouseRequest filterWarehouseRequest) { public List<WarehouseEntity> findByCode(FilterWarehouseRequest filterWarehouseRequest) {
Query query = new Query(); QueryWrapper<WarehouseEntity> wrapper = new QueryWrapper<>();
query.addCriteria( wrapper.eq(null != filterWarehouseRequest.getCustomerId(), "customerId", filterWarehouseRequest.getCustomerId())
Criteria.where("customerId").is(filterWarehouseRequest.getCustomerId()) .eq(StrUtil.isNotBlank(filterWarehouseRequest.getCode()), "code", filterWarehouseRequest.getCode());
.and("code").is(filterWarehouseRequest.getCode()) return codesDao.selectList(wrapper);
);
return mongoTemplate.find(query, WarehouseMdEntity.class, MongoDBName.NAME_CODE);
} }
public void updateUnit(String orderId, String fromCorpId, String fromCorp) { public void updateUnit(String orderId, String fromCorpId, String fromCorp) {
Query query = new Query(); codesDao.updateUnit(orderId, fromCorp, fromCorpId);
query.addCriteria(new Criteria().and("orderId").is(orderId));
Update update = new Update();
update.set("fromCorp", fromCorp);
update.set("fromCorpId", fromCorpId);
mongoTemplate.updateMulti(query, update, MongoDBName.NAME_CODE);
} }
public void updateOrderId(String orderId, String newOrderId) { public void updateOrderId(String orderId, String newOrderId) {
Query query = new Query(); codesDao.updateOrderId(orderId, newOrderId);
query.addCriteria(new Criteria().and("orderId").is(orderId));
Update update = new Update();
update.set("orderId", newOrderId);
mongoTemplate.updateMulti(query, update, MongoDBName.NAME_CODE);
} }
public List<WarehouseMdEntity> findByOrderId(String orderId) { public List<WarehouseEntity> findByOrderId(String orderId) {
if (StrUtil.isBlank(orderId)) { if (StrUtil.isNotBlank(orderId)) {
return Collections.emptyList(); return Collections.emptyList();
} }
Query query = new Query(); return codesDao.selectByOrderId(orderId);
query.addCriteria(Criteria.where("orderId").is(orderId));
return mongoTemplate.find(query, WarehouseMdEntity.class, MongoDBName.NAME_CODE);
}
public PageResult<WarehouseMdEntity> 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<WarehouseMdEntity> pageResult = mongoPageHelper.pageQuery(query, WarehouseMdEntity.class, warehouseQueryRequest.getPage(), warehouseQueryRequest.getLimit(), MongoDBName.NAME_CODE);
return pageResult;
} }
public void replaceCodes(CodesReplaceRequest codesReplaceRequest) { public void replaceCodes(CodesReplaceRequest codesReplaceRequest) {
@ -149,9 +100,9 @@ public class WarehouseMdService {
WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest(); WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest();
warehouseQueryRequest.setCode(codesReplaceRequest.getCode()); warehouseQueryRequest.setCode(codesReplaceRequest.getCode());
warehouseQueryRequest.setOrderId(order.getOrderId()); warehouseQueryRequest.setOrderId(order.getOrderId());
List<WarehouseMdEntity> warehouseEntities = findByOrderId(warehouseQueryRequest); List<WarehouseEntity> warehouseEntities = filterWarehouse(warehouseQueryRequest);
if (CollUtil.isNotEmpty(warehouseEntities)) { if (CollUtil.isNotEmpty(warehouseEntities)) {
WarehouseMdEntity warehouseMdEntity = warehouseEntities.get(0); WarehouseEntity warehouseMdEntity = warehouseEntities.get(0);
if (warehouseMdEntity.getCount() > 1) { if (warehouseMdEntity.getCount() > 1) {
//删除一个条码 //删除一个条码
warehouseMdEntity.setCount(warehouseMdEntity.getCount() - 1); warehouseMdEntity.setCount(warehouseMdEntity.getCount() - 1);
@ -170,16 +121,16 @@ public class WarehouseMdService {
if (StrUtil.isNotBlank(warehouseMdEntity.getBatchNo())) { if (StrUtil.isNotBlank(warehouseMdEntity.getBatchNo())) {
filterInvProductDetailRequest.setBatchNo(warehouseMdEntity.getBatchNo()); filterInvProductDetailRequest.setBatchNo(warehouseMdEntity.getBatchNo());
} }
List<InvProductDetailEntity> invProductDetailEntities = invProductDetailMdService.filterAllInvProduct(filterInvProductDetailRequest); List<InvProductDetailEntity> invProductDetailEntities = invProductDetailService.filterAllInvProduct(filterInvProductDetailRequest);
if (CollUtil.isNotEmpty(invProductDetailEntities)) { if (CollUtil.isNotEmpty(invProductDetailEntities)) {
//库存详情不为空,单据已验收,扣减库存 //库存详情不为空,单据已验收,扣减库存
InvProductDetailEntity invProductDetailEntity = invProductDetailEntities.get(0); InvProductDetailEntity invProductDetailEntity = invProductDetailEntities.get(0);
if (invProductDetailEntity.getCount() > 1) { if (invProductDetailEntity.getCount() > 1) {
invProductDetailEntity.setCount(invProductDetailEntity.getCount() - 1); invProductDetailEntity.setCount(invProductDetailEntity.getCount() - 1);
invProductDetailMdService.updateInvProduct(invProductDetailEntity); invProductDetailService.updateInvProduct(invProductDetailEntity);
} else { } else {
//扣减库存后等于0删除库存详情 //扣减库存后等于0删除库存详情
invProductDetailMdService.deleteById(invProductDetailEntity.getId()); invProductDetailService.deleteById(invProductDetailEntity.getId());
} }
//查询原库存详情和新的库存详情 //查询原库存详情和新的库存详情
@ -204,7 +155,7 @@ public class WarehouseMdService {
detailParams.setBatchNo(invProductEntity.getBatchNo()); detailParams.setBatchNo(invProductEntity.getBatchNo());
detailParams.setInvCodes(Collections.singletonList(invProductEntity.getLocStorageCode())); detailParams.setInvCodes(Collections.singletonList(invProductEntity.getLocStorageCode()));
detailParams.setProductIdFk(invProductEntity.getRelIdFk()); detailParams.setProductIdFk(invProductEntity.getRelIdFk());
long count = invProductDetailMdService.statCount(detailParams); long count = invProductDetailService.statCount(detailParams);
if (count == 0) { if (count == 0) {
//删除库存 //删除库存
invProductService.deleteById(invProductEntity.getId()); invProductService.deleteById(invProductEntity.getId());
@ -245,39 +196,12 @@ public class WarehouseMdService {
} }
} }
/** public void updateCode(WarehouseEntity warehouseEntity) {
* 使ID codesDao.updateCount(warehouseEntity.getCount(), warehouseEntity.getId());
*
* @param warehouseQueryRequest
* @return
*/
public List<WarehouseMdEntity> findByOrderId(WarehouseQueryRequest warehouseQueryRequest) {
Query query = new Query();
if (StrUtil.isNotBlank(warehouseQueryRequest.getOrderId())) {
query.addCriteria(Criteria.where("orderId").is(warehouseQueryRequest.getOrderId()));
}
if (StrUtil.isNotBlank(warehouseQueryRequest.getCode())) {
query.addCriteria(Criteria.where("code").is(warehouseQueryRequest.getCode()));
}
return mongoTemplate.find(query, WarehouseMdEntity.class, MongoDBName.NAME_CODE);
}
public void updateCode(WarehouseMdEntity warehouseMdEntity) {
Query query = new Query();
query.addCriteria(Criteria.where("id").is(warehouseMdEntity.getId()));
Update update = new Update();
if (null != warehouseMdEntity.getCount()) {
update.set("count", warehouseMdEntity.getCount());
}
mongoTemplate.updateMulti(query, update, MongoDBName.NAME_CODE);
} }
public void deleteById(String id) { public void deleteById(String id) {
Query query = new Query(); codesDao.deleteById(id);
query.addCriteria(Criteria.where("id").is(id));
mongoTemplate.remove(query, WarehouseMdEntity.class, MongoDBName.NAME_CODE);
} }
} }

@ -1,102 +0,0 @@
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.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;
import com.glxp.udi.admin.req.inout.DeleteRequest;
import com.glxp.udi.admin.req.inout.WarehouseQueryRequest;
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 WarehouseTempMdService {
@Resource
private MongoTemplate mongoTemplate;
@Resource
private MongoPageHelper mongoPageHelper;
public PageResult<WarehousetempMdEntity> filterWarehouseByPage(WarehouseQueryRequest warehouseQueryRequest) {
Query query = new Query();
if (warehouseQueryRequest.getCode() != null && !warehouseQueryRequest.getCode().isEmpty()) {
query.addCriteria(Criteria.where("code").is(warehouseQueryRequest.getCode()));
}
if (warehouseQueryRequest.getCorpOrderId() != null && !warehouseQueryRequest.getCorpOrderId().isEmpty()) {
query.addCriteria(Criteria.where("corpOrderId").is(warehouseQueryRequest.getCorpOrderId()));
}
if (warehouseQueryRequest.getOrderId() != null && !warehouseQueryRequest.getOrderId().isEmpty()) {
query.addCriteria(Criteria.where("orderId").is(warehouseQueryRequest.getOrderId()));
}
if (warehouseQueryRequest.getCustomerId() != null) {
query.addCriteria(Criteria.where("customerId").is(warehouseQueryRequest.getCustomerId()));
}
return mongoPageHelper.pageQuery(query, WarehousetempMdEntity.class,
warehouseQueryRequest.getLimit(), warehouseQueryRequest.getPage(), warehouseQueryRequest.getLastId(), MongoDBName.NAME_CODE_TEMP);
}
public List<WarehousetempMdEntity> findTempByOrderId(String orderId) {
Query query = new Query(Criteria.where("orderId").is(orderId));
List<WarehousetempMdEntity> result = mongoTemplate.find(query, WarehousetempMdEntity.class, MongoDBName.NAME_CODE_TEMP);
return result;
}
public void insertTempWarehouses(List<WarehousetempMdEntity> warehouseEntities) {
if (warehouseEntities != null) {
Collection<WarehousetempMdEntity> warehousetempEntityCollection = new ArrayList<>(warehouseEntities);
mongoTemplate.insert(warehousetempEntityCollection, MongoDBName.NAME_CODE_TEMP);
}
}
public void deleteTempWarehouses(List<String> ids) {
if (ids != null) {
for (String id : ids) {
Query query = new Query();
query.addCriteria(Criteria.where("_id").is(id));
mongoTemplate.remove(query, MongoDBName.NAME_CODE_TEMP);
}
}
}
public void deleteCode(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()));
}
mongoTemplate.remove(query, WarehousetempMdEntity.class, MongoDBName.NAME_CODE_TEMP);
}
public WarehousetempMdEntity findTempById(String id) {
Query query = new Query();
if (StrUtil.isNotBlank(id)) {
query.addCriteria(Criteria.where("id").is(id));
List<WarehousetempMdEntity> warehousetempEntities = mongoTemplate.find(query, WarehousetempMdEntity.class, MongoDBName.NAME_CODE_TEMP);
if (CollUtil.isNotEmpty(warehousetempEntities)) {
return warehousetempEntities.get(0);
}
}
return null;
}
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, WarehousetempMdEntity.class, MongoDBName.NAME_CODE_TEMP);
}
}

@ -0,0 +1,74 @@
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.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.glxp.udi.admin.dao.inout.CodesTempDao;
import com.glxp.udi.admin.entity.inout.WarehousetempEntity;
import com.glxp.udi.admin.req.inout.DeleteRequest;
import com.glxp.udi.admin.req.inout.WarehouseQueryRequest;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class WarehouseTempService {
@Resource
private CodesTempDao codesTempDao;
public IPage<WarehousetempEntity> filterWarehouseByPage(WarehouseQueryRequest warehouseQueryRequest) {
QueryWrapper<WarehousetempEntity> wrapper = buildCodesTempQueryWrapper(warehouseQueryRequest);
IPage<WarehousetempEntity> page = new Page<>(warehouseQueryRequest.getPage(), warehouseQueryRequest.getLimit());
return codesTempDao.selectPage(page, wrapper);
}
/**
*
* @param warehouseQueryRequest
* @return
*/
private QueryWrapper<WarehousetempEntity> buildCodesTempQueryWrapper(WarehouseQueryRequest warehouseQueryRequest) {
QueryWrapper<WarehousetempEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StrUtil.isNotBlank(warehouseQueryRequest.getCode()), "code", warehouseQueryRequest.getCode())
.eq(StrUtil.isNotBlank(warehouseQueryRequest.getOrderId()),"orderId",warehouseQueryRequest.getOrderId())
.eq(StrUtil.isNotBlank(warehouseQueryRequest.getCorpOrderId()), "corpOrderId", warehouseQueryRequest.getCorpOrderId())
.eq(null != warehouseQueryRequest.getCustomerId(), "customerId", warehouseQueryRequest.getCustomerId());
return wrapper;
}
public List<WarehousetempEntity> findTempByOrderId(String orderId) {
return codesTempDao.selectByOrderId(orderId);
}
public void insertTempWarehouses(List<WarehousetempEntity> warehouseEntities) {
if (CollUtil.isNotEmpty(warehouseEntities)) {
warehouseEntities.forEach(warehousetemp -> codesTempDao.insert(warehousetemp));
}
}
public void deleteTempWarehouses(List<String> ids) {
if (CollUtil.isNotEmpty(ids)) {
for (String id : ids) {
codesTempDao.deleteById(id);
}
}
}
public void deleteCode(DeleteRequest deleteRequest) {
codesTempDao.delete(deleteRequest.getId(), deleteRequest.getOrderId());
}
public WarehousetempEntity findTempById(String id) {
return codesTempDao.selectById(id);
}
public void updateById(WarehousetempEntity warehousetemp) {
codesTempDao.updateCount(warehousetemp.getId(), warehousetemp.getCount());
}
}

@ -5,8 +5,6 @@ import cn.hutool.core.util.StrUtil;
import com.glxp.udi.admin.constant.ConstantStatus; import com.glxp.udi.admin.constant.ConstantStatus;
import com.glxp.udi.admin.constant.TypeConstant; import com.glxp.udi.admin.constant.TypeConstant;
import com.glxp.udi.admin.entity.inout.*; 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.mongo.service.*;
import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest; import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest;
import com.glxp.udi.admin.req.inout.OrderFilterRequest; import com.glxp.udi.admin.req.inout.OrderFilterRequest;
@ -36,7 +34,7 @@ public class InvProductsTrService {
private OrderDetailService myErpOrderService; private OrderDetailService myErpOrderService;
@Lazy @Lazy
@Resource @Resource
private WarehouseMdService codesService; private WarehouseService codesService;
@Lazy @Lazy
@Resource @Resource
private UdiInfoService udiInfoService; private UdiInfoService udiInfoService;
@ -45,7 +43,7 @@ public class InvProductsTrService {
private InvProductService invProductService; private InvProductService invProductService;
@Lazy @Lazy
@Resource @Resource
private InvProductDetailMdService invProductDetailService; private InvProductDetailService invProductDetailService;
@Resource @Resource
private InoutUtils inoutUtils; private InoutUtils inoutUtils;
@ -53,8 +51,8 @@ public class InvProductsTrService {
public void genInvProducts(String orderId) { public void genInvProducts(String orderId) {
OrderFilterRequest orderFilterRequest = new OrderFilterRequest(); OrderFilterRequest orderFilterRequest = new OrderFilterRequest();
orderFilterRequest.setId(orderId); orderFilterRequest.setId(orderId);
List<OrderMdEntity> orderMdEntities = orderService.findAll(orderFilterRequest); List<OrderEntity> orderEntities = orderService.findAll(orderFilterRequest);
OrderMdEntity orderEntity = orderMdEntities.get(0); OrderEntity orderEntity = orderEntities.get(0);
String customerId = orderEntity.getCustomerId() + ""; String customerId = orderEntity.getCustomerId() + "";
if (orderEntity.getStatus().equals(ConstantStatus.ORDER_STATUS_SUCCESS)) { if (orderEntity.getStatus().equals(ConstantStatus.ORDER_STATUS_SUCCESS)) {
FilterOrderDetailRequest filterOrderDetailRequest = new FilterOrderDetailRequest(); FilterOrderDetailRequest filterOrderDetailRequest = new FilterOrderDetailRequest();
@ -104,7 +102,7 @@ public class InvProductsTrService {
if (StrUtil.isNotBlank(invProductEntity.getBatchNo())) { if (StrUtil.isNotBlank(invProductEntity.getBatchNo())) {
warehouseQueryRequest.setBatchNo(invProductEntity.getBatchNo()); warehouseQueryRequest.setBatchNo(invProductEntity.getBatchNo());
} }
List<WarehouseMdEntity> warehouseEntities = codesService.filterWarehouse(warehouseQueryRequest); List<WarehouseEntity> warehouseEntities = codesService.filterWarehouse(warehouseQueryRequest);
if (CollUtil.isNotEmpty(warehouseEntities)) { if (CollUtil.isNotEmpty(warehouseEntities)) {
for (WarehouseEntity warehouseEntity : warehouseEntities) { for (WarehouseEntity warehouseEntity : warehouseEntities) {
UdiInfoEntity tempUdi = udiInfoService.findByNameCode(warehouseEntity.getNameCode(), customerId); UdiInfoEntity tempUdi = udiInfoService.findByNameCode(warehouseEntity.getNameCode(), customerId);

@ -14,12 +14,11 @@ import com.glxp.udi.admin.entity.info.ScheduledEntity;
import com.glxp.udi.admin.entity.inout.OrderDetailEntity; import com.glxp.udi.admin.entity.inout.OrderDetailEntity;
import com.glxp.udi.admin.entity.inout.OrderEntity; import com.glxp.udi.admin.entity.inout.OrderEntity;
import com.glxp.udi.admin.entity.inout.UnitMaintainEntity; import com.glxp.udi.admin.entity.inout.UnitMaintainEntity;
import com.glxp.udi.admin.entity.mongo.OrderMdEntity; import com.glxp.udi.admin.entity.inout.WarehouseEntity;
import com.glxp.udi.admin.entity.mongo.WarehouseMdEntity;
import com.glxp.udi.admin.entity.param.SystemParamConfigEntity; import com.glxp.udi.admin.entity.param.SystemParamConfigEntity;
import com.glxp.udi.admin.mongo.service.OrderDetailService; import com.glxp.udi.admin.mongo.service.OrderDetailService;
import com.glxp.udi.admin.mongo.service.OrderService; import com.glxp.udi.admin.mongo.service.OrderService;
import com.glxp.udi.admin.mongo.service.WarehouseMdService; import com.glxp.udi.admin.mongo.service.WarehouseService;
import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest; import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest;
import com.glxp.udi.admin.req.inout.PostUdimsOrderDetailRequest; import com.glxp.udi.admin.req.inout.PostUdimsOrderDetailRequest;
import com.glxp.udi.admin.req.inout.PostUdimsOrderRequest; import com.glxp.udi.admin.req.inout.PostUdimsOrderRequest;
@ -62,7 +61,7 @@ public class SubmitOrderToSpmsTask implements SchedulingConfigurer {
@Resource @Resource
private SystemParamCustomerConfigService systemParamCustomerConfigService; private SystemParamCustomerConfigService systemParamCustomerConfigService;
@Resource @Resource
private WarehouseMdService warehouseMdService; private WarehouseService warehouseService;
@Resource @Resource
private OrderDetailService orderDetailService; private OrderDetailService orderDetailService;
@Resource @Resource
@ -106,7 +105,7 @@ public class SubmitOrderToSpmsTask implements SchedulingConfigurer {
orderBean.setAction(unitMaintainEntity.getTargetAction()); orderBean.setAction(unitMaintainEntity.getTargetAction());
WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest(); WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest();
warehouseQueryRequest.setOrderId(orderEntity.getOrderId()); warehouseQueryRequest.setOrderId(orderEntity.getOrderId());
List<WarehouseMdEntity> warehouseEntities = warehouseMdService.filterWarehouse(warehouseQueryRequest); List<WarehouseEntity> warehouseEntities = warehouseService.filterWarehouse(warehouseQueryRequest);
List<PostUdimsOrderRequest.OrderBean.CodeBean> codeBeans = new ArrayList<>(); List<PostUdimsOrderRequest.OrderBean.CodeBean> codeBeans = new ArrayList<>();
warehouseEntities.forEach(data -> { warehouseEntities.forEach(data -> {
PostUdimsOrderRequest.OrderBean.CodeBean codeBean = new PostUdimsOrderRequest.OrderBean.CodeBean(); PostUdimsOrderRequest.OrderBean.CodeBean codeBean = new PostUdimsOrderRequest.OrderBean.CodeBean();
@ -150,10 +149,10 @@ public class SubmitOrderToSpmsTask implements SchedulingConfigurer {
}); });
if (baseResponse.getCode() == 20000) { if (baseResponse.getCode() == 20000) {
log.info("自动上传单据成功," + unitMaintainEntity.getName() + "上传单据数量为 " + orderEntities.size()); log.info("自动上传单据成功," + unitMaintainEntity.getName() + "上传单据数量为 " + orderEntities.size());
for (OrderMdEntity orderMdEntity : orderEntities) { for (OrderEntity orderEntity : orderEntities) {
log.info("修改单号为:{} 的上传状态", orderMdEntity.getOrderId()); log.info("修改单号为:{} 的上传状态", orderEntity.getOrderId());
orderMdEntity.setUploadStatus("1"); orderEntity.setUploadStatus("1");
orderService.updateOrder(orderMdEntity); orderService.updateOrder(orderEntity);
} }
} else { } else {
log.error("自动上传单据到自助平台异常,响应结果:{}", response); log.error("自动上传单据到自助平台异常,响应结果:{}", response);

@ -7,8 +7,8 @@ import com.glxp.udi.admin.entity.basic.BussinessTypeEntity;
import com.glxp.udi.admin.entity.inout.*; import com.glxp.udi.admin.entity.inout.*;
import com.glxp.udi.admin.mongo.service.OrderDetailService; import com.glxp.udi.admin.mongo.service.OrderDetailService;
import com.glxp.udi.admin.mongo.service.OrderService; import com.glxp.udi.admin.mongo.service.OrderService;
import com.glxp.udi.admin.mongo.service.WarehouseMdService; import com.glxp.udi.admin.mongo.service.WarehouseService;
import com.glxp.udi.admin.mongo.service.WarehouseTempMdService; import com.glxp.udi.admin.mongo.service.WarehouseTempService;
import com.glxp.udi.admin.req.inout.OrderFilterRequest; import com.glxp.udi.admin.req.inout.OrderFilterRequest;
import com.glxp.udi.admin.req.inout.PostOrderRequest; import com.glxp.udi.admin.req.inout.PostOrderRequest;
import com.glxp.udi.admin.service.basic.BussinessTypeService; import com.glxp.udi.admin.service.basic.BussinessTypeService;
@ -34,7 +34,6 @@ import java.util.List;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public class TransInoutService { public class TransInoutService {
@Resource @Resource
private UdiRelevanceService udiRelevanceService; private UdiRelevanceService udiRelevanceService;
@Resource @Resource
@ -44,9 +43,9 @@ public class TransInoutService {
@Resource @Resource
private OrderService orderService; private OrderService orderService;
@Resource @Resource
private WarehouseTempMdService warehouseTempMdService; private WarehouseTempService warehouseTempService;
@Resource @Resource
private WarehouseMdService warehouseMdService; private WarehouseService warehouseService;
@Resource @Resource
private OrderDetailService orderDetailService; private OrderDetailService orderDetailService;
@Resource @Resource
@ -117,7 +116,7 @@ public class TransInoutService {
} }
} }
List<WarehousetempEntity> filterList = warehouseTempMdService.findTempByOrderId(orderEntity.getOrderId()); List<WarehousetempEntity> filterList = warehouseTempService.findTempByOrderId(orderEntity.getOrderId());
List<WarehouseEntity> insertList = new ArrayList<>(); List<WarehouseEntity> insertList = new ArrayList<>();
if (StrUtil.isBlank(orderEntity.getLocStorageCode())) { if (StrUtil.isBlank(orderEntity.getLocStorageCode())) {
if (!StrUtil.isEmpty(bussinessTypeEntity.getStorageCode())) { if (!StrUtil.isEmpty(bussinessTypeEntity.getStorageCode())) {
@ -133,7 +132,7 @@ public class TransInoutService {
for (WarehousetempEntity warehousetemp : filterList) { for (WarehousetempEntity warehousetemp : filterList) {
warehousetemp.setLocStorageCode(orderEntity.getLocStorageCode()); warehousetemp.setLocStorageCode(orderEntity.getLocStorageCode());
String result = inoutUtils.filterCode(warehouseMdService, warehousetemp, setupService); String result = inoutUtils.filterCode(warehouseService, warehousetemp, setupService);
if (result == null) { if (result == null) {
WarehouseEntity warehouseEntity = new WarehouseEntity(); WarehouseEntity warehouseEntity = new WarehouseEntity();
BeanUtil.copyProperties(warehousetemp, warehouseEntity, "id"); BeanUtil.copyProperties(warehousetemp, warehouseEntity, "id");
@ -166,13 +165,13 @@ public class TransInoutService {
} }
if (insertList.size() > 0) { if (insertList.size() > 0) {
warehouseMdService.insertWarehouses(insertList); warehouseService.insertWarehouses(insertList);
List<WarehousetempEntity> temps = warehouseTempMdService.findTempByOrderId(orderEntity.getOrderId()); List<WarehousetempEntity> temps = warehouseTempService.findTempByOrderId(orderEntity.getOrderId());
List<String> ids = new ArrayList<>(); List<String> ids = new ArrayList<>();
for (WarehousetempEntity temp : temps) { for (WarehousetempEntity temp : temps) {
ids.add(temp.getId()); ids.add(temp.getId());
} }
warehouseTempMdService.deleteTempWarehouses(ids); warehouseTempService.deleteTempWarehouses(ids);
tempEntity.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS); tempEntity.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS);
orderService.updateOrder(tempEntity); orderService.updateOrder(tempEntity);
inoutUtils.generateConstrastDetail(udiInfoService, udiRelevanceService, orderDetailService, insertList); inoutUtils.generateConstrastDetail(udiInfoService, udiRelevanceService, orderDetailService, insertList);
@ -229,7 +228,7 @@ public class TransInoutService {
warehousetempList.get(index).setOrderId(orderId); warehousetempList.get(index).setOrderId(orderId);
warehousetempList.get(index).setCustomerId(customerId); warehousetempList.get(index).setCustomerId(customerId);
} }
warehouseTempMdService.insertTempWarehouses(warehousetempList); warehouseTempService.insertTempWarehouses(warehousetempList);
} }
} }
} }

@ -5,7 +5,7 @@ import com.glxp.udi.admin.constant.ConstantStatus;
import com.glxp.udi.admin.constant.SystemParamConstant; import com.glxp.udi.admin.constant.SystemParamConstant;
import com.glxp.udi.admin.dao.info.ScheduledDao; import com.glxp.udi.admin.dao.info.ScheduledDao;
import com.glxp.udi.admin.entity.info.ScheduledEntity; import com.glxp.udi.admin.entity.info.ScheduledEntity;
import com.glxp.udi.admin.entity.mongo.OrderMdEntity; import com.glxp.udi.admin.entity.inout.OrderEntity;
import com.glxp.udi.admin.entity.param.SystemParamConfigEntity; import com.glxp.udi.admin.entity.param.SystemParamConfigEntity;
import com.glxp.udi.admin.mongo.service.OrderService; import com.glxp.udi.admin.mongo.service.OrderService;
import com.glxp.udi.admin.req.inout.OrderFilterRequest; import com.glxp.udi.admin.req.inout.OrderFilterRequest;
@ -60,13 +60,13 @@ public class TransInoutTask implements SchedulingConfigurer {
//查询待处理单据,判断此单据的用户是否开启了自动处理单据,如果已开启则自动处理,未开启跳过 //查询待处理单据,判断此单据的用户是否开启了自动处理单据,如果已开启则自动处理,未开启跳过
OrderFilterRequest orderFilterRequest = new OrderFilterRequest(); OrderFilterRequest orderFilterRequest = new OrderFilterRequest();
orderFilterRequest.setStatus(ConstantStatus.ORDER_STATUS_WAIT); orderFilterRequest.setStatus(ConstantStatus.ORDER_STATUS_WAIT);
List<OrderMdEntity> list = orderService.findAll(orderFilterRequest); List<OrderEntity> list = orderService.findAll(orderFilterRequest);
if (CollUtil.isNotEmpty(list)) { if (CollUtil.isNotEmpty(list)) {
for (OrderMdEntity orderMdEntity : list) { for (OrderEntity orderEntity : list) {
SystemParamConfigEntity io_transInout_auto = systemParamCustomerConfigService.getParamByKey(SystemParamConstant.IO_TRANSINOUT_AUTO, orderMdEntity.getCustomerId()); SystemParamConfigEntity io_transInout_auto = systemParamCustomerConfigService.getParamByKey(SystemParamConstant.IO_TRANSINOUT_AUTO, orderEntity.getCustomerId());
if (null != io_transInout_auto && io_transInout_auto.getParamValue().equals("1")) { if (null != io_transInout_auto && io_transInout_auto.getParamValue().equals("1")) {
//此单可以自动提交 //此单可以自动提交
transInoutService.transInout(orderMdEntity); transInoutService.transInout(orderEntity);
} }
} }
} }

@ -11,7 +11,7 @@ import com.glxp.udi.admin.entity.inout.WarehouseEntity;
import com.glxp.udi.admin.entity.inout.WarehousetempEntity; import com.glxp.udi.admin.entity.inout.WarehousetempEntity;
import com.glxp.udi.admin.entity.udid.UdiEntity; import com.glxp.udi.admin.entity.udid.UdiEntity;
import com.glxp.udi.admin.mongo.service.OrderDetailService; import com.glxp.udi.admin.mongo.service.OrderDetailService;
import com.glxp.udi.admin.mongo.service.WarehouseMdService; import com.glxp.udi.admin.mongo.service.WarehouseService;
import com.glxp.udi.admin.req.inout.FilterWarehouseRequest; import com.glxp.udi.admin.req.inout.FilterWarehouseRequest;
import com.glxp.udi.admin.service.info.SetupService; import com.glxp.udi.admin.service.info.SetupService;
import com.glxp.udi.admin.service.inout.UdiInfoService; import com.glxp.udi.admin.service.inout.UdiInfoService;
@ -35,7 +35,7 @@ public class InoutUtils {
@Resource @Resource
private UdiInfoService udiInfoService; private UdiInfoService udiInfoService;
public String filterCode(WarehouseMdService warehouseService, WarehousetempEntity warehousetemp, SetupService setupService) { public String filterCode(WarehouseService warehouseService, WarehousetempEntity warehousetemp, SetupService setupService) {
SetupEntity setupEntity = setupService.selectSetup(String.valueOf(warehousetemp.getCustomerId())); SetupEntity setupEntity = setupService.selectSetup(String.valueOf(warehousetemp.getCustomerId()));
FilterWarehouseRequest filterWarehouseRequest = new FilterWarehouseRequest(); FilterWarehouseRequest filterWarehouseRequest = new FilterWarehouseRequest();
filterWarehouseRequest.setCode(warehousetemp.getCode()); filterWarehouseRequest.setCode(warehousetemp.getCode());
@ -44,7 +44,8 @@ public class InoutUtils {
WarehouseEntity warehouseData = new WarehouseEntity(); WarehouseEntity warehouseData = new WarehouseEntity();
BeanUtils.copyProperties(warehousetemp, warehouseData); BeanUtils.copyProperties(warehousetemp, warehouseData);
if (warehouseEntityList == null || warehouseEntityList.size() == 0) { //数据库为null,可以添加 //数据库为null,可以添加
if (warehouseEntityList == null || warehouseEntityList.size() == 0) {
return nullVail(warehousetemp, setupEntity); return nullVail(warehousetemp, setupEntity);
} }
List<WarehouseEntity> inList = new ArrayList<>(); List<WarehouseEntity> inList = new ArrayList<>();

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.glxp.udi.admin.dao.inout.CodesDao">
<update id="updateUnit">
update io_codes
set fromCorp = #{fromCorp} and fromCorpId = #{fromCorpId}
where orderId = #{orderId}
</update>
<update id="updateOrderId">
update io_codes set orderId = #{newOrderId} where orderId = #{orderId}
</update>
<update id="updateCount">
update io_codes set count = #{count} where id = #{id}
</update>
<select id="selectByOrderId" resultType="com.glxp.udi.admin.entity.inout.WarehouseEntity">
select * from io_codes where orderId = #{orderId}
</select>
</mapper>

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.glxp.udi.admin.dao.inout.CodesTempDao">
<update id="updateCount">
update io_codes_temp set count = #{count} where id = #{id}
</update>
<delete id="delete">
delete from io_codes_temp where id = #{id} and orderId = #{orderId}
</delete>
<select id="selectByOrderId" resultType="com.glxp.udi.admin.entity.inout.WarehousetempEntity">
select * from io_codes_temp where orderId = #{orderId}
</select>
</mapper>
Loading…
Cancel
Save