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.mongo.*;
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.OrderDetailService;
import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest;
@ -31,7 +31,7 @@ public class TestController {
@Resource
private InvProductService invProductService;
@Resource
private InvProductDetailMdService invProductDetailMdService;
private InvProductDetailService invProductDetailService;
@Resource
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 -> {
UdiInfoEntity udiInfoEntity = udiInfoDao.selectOne(new QueryWrapper<UdiInfoEntity>().eq(StrUtil.isNotBlank(invProductDetailEntity.getProductIdFk()), "uuid", invProductDetailEntity.getProductIdFk())
.eq(StrUtil.isNotBlank(invProductDetailEntity.getCustomerId()), "customerId", invProductDetailEntity.getCustomerId())
@ -110,7 +110,7 @@ public class TestController {
if (null != udiInfoEntity) {
invProductDetailEntity.setProductIdFk(String.valueOf(udiInfoEntity.getId()));
log.info("刷新库存详情");
invProductDetailMdService.updateInvProduct(invProductDetailEntity);
invProductDetailService.updateInvProduct(invProductDetailEntity);
}
});
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.InvProductEntity;
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.utils.PageResult;
import com.glxp.udi.admin.req.inout.DeleteRequest;
import com.glxp.udi.admin.req.inout.FilterInvProductDetailRequest;
import com.glxp.udi.admin.req.inout.FilterUdiInfoRequest;
@ -44,7 +43,7 @@ public class InvProductsController {
@Resource
private InvProductService invProductService;
@Resource
private InvProductDetailMdService invProductDetailService;
private InvProductDetailService invProductDetailService;
@Resource
private UdiInfoService udiInfoService;
@Resource
@ -80,8 +79,8 @@ public class InvProductsController {
codes.addAll(warehouseUserService.selectCodeByUserId(user.getId()));
}
filterInvProductRequest.setInvCodes(codes);
PageResult<InvProductEntity> invProductEntityPageResult = invProductService.filterInvProduct(filterInvProductRequest);
List<InvProductEntity> invProductEntities = invProductEntityPageResult.getList();
IPage<InvProductEntity> page = invProductService.filterInvProduct(filterInvProductRequest);
List<InvProductEntity> invProductEntities = page.getRecords();
List<InvProductResponse> result = new ArrayList<>();
for (InvProductEntity invProductEntity : invProductEntities) {
InvProductResponse invProductResponse = new InvProductResponse();
@ -92,7 +91,7 @@ public class InvProductsController {
}
PageSimpleResponse<InvProductResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(invProductEntityPageResult.getTotal());
pageSimpleResponse.setTotal(page.getTotal());
pageSimpleResponse.setList(result);
return ResultVOUtils.success(pageSimpleResponse);
}
@ -122,9 +121,9 @@ public class InvProductsController {
if (CollUtil.isNotEmpty(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<>();
for (InvProductEntity invProductEntity : invProductEntities) {
UdiInfoEntity udiInfoEntity = udiInfoService.findByUuid(invProductEntity.getRelIdFk(), invProductEntity.getCustomerId());
@ -141,7 +140,7 @@ public class InvProductsController {
}
PageSimpleResponse<InvProductResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(invProductEntityPageResult.getTotal());
pageSimpleResponse.setTotal(page.getTotal());
pageSimpleResponse.setList(invProductResponses);
return ResultVOUtils.success(pageSimpleResponse);
}
@ -159,8 +158,8 @@ public class InvProductsController {
}
}
filterInvProductRequest.setInvCodes(codes);
PageResult<InvProductDetailEntity> pageResult = invProductDetailService.filterInvProduct(filterInvProductRequest);
List<InvProductDetailEntity> invProductDetailEntities = pageResult.getList();
IPage<InvProductDetailEntity> page = invProductDetailService.filterInvProduct(filterInvProductRequest);
List<InvProductDetailEntity> invProductDetailEntities = page.getRecords();
List<InvProductDetailResponse> invProductDetailResponses = new ArrayList<>(invProductDetailEntities.size());
if (CollUtil.isNotEmpty(invProductDetailEntities)) {
@ -179,7 +178,7 @@ public class InvProductsController {
}
PageSimpleResponse<InvProductDetailResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageResult.getTotal());
pageSimpleResponse.setTotal(page.getTotal());
pageSimpleResponse.setList(invProductDetailResponses);
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.collection.CollUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
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.info.PlatformEntity;
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.OrderService;
import com.glxp.udi.admin.mongo.service.WarehouseMdService;
import com.glxp.udi.admin.mongo.service.WarehouseTempMdService;
import com.glxp.udi.admin.mongo.utils.PageResult;
import com.glxp.udi.admin.mongo.service.WarehouseService;
import com.glxp.udi.admin.mongo.service.WarehouseTempService;
import com.glxp.udi.admin.req.inout.*;
import com.glxp.udi.admin.res.PageSimpleResponse;
import com.glxp.udi.admin.res.inout.OrderMdResponse;
@ -66,7 +64,7 @@ public class OrderController {
@Resource
private OrderService orderService;
@Resource
private WarehouseMdService warehouseMdService;
private WarehouseService warehouseService;
@Resource
private UnitMaintainService unitMaintainService;
@Resource
@ -86,7 +84,7 @@ public class OrderController {
@Resource
private GennerOrderUtils gennerOrderUtils;
@Resource
private WarehouseTempMdService warehouseTempMdService;
private WarehouseTempService warehouseTempService;
@AuthRuleAnnotation("")
@GetMapping("/warehouse/inout/order/filter")
@ -178,10 +176,10 @@ public class OrderController {
orderFilterRequest.setInvCodes(codes);
orderFilterRequest.setCustomerId(authAdmin.getCustomerId());
orderFilterRequest.setStatus(orderFilterRequest.getStatus());
PageResult<OrderMdEntity> pageResult = orderService.filterList(orderFilterRequest);
PageSimpleResponse<OrderMdEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageResult.getTotal());
pageSimpleResponse.setList(pageResult.getList());
IPage<OrderEntity> page = orderService.filterList(orderFilterRequest);
PageSimpleResponse<OrderEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(page.getTotal());
pageSimpleResponse.setList(page.getRecords());
return ResultVOUtils.success(pageSimpleResponse);
}
@ -205,10 +203,10 @@ public class OrderController {
}
orderFilterRequest.setInvCodes(invCodes);
PageResult<OrderMdEntity> pageResult = orderService.filterList(orderFilterRequest);
PageSimpleResponse<OrderMdEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageResult.getTotal());
pageSimpleResponse.setList(pageResult.getList());
IPage<OrderEntity> page = orderService.filterList(orderFilterRequest);
PageSimpleResponse<OrderEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(page.getTotal());
pageSimpleResponse.setList(page.getRecords());
return ResultVOUtils.success(pageSimpleResponse);
}
@ -231,10 +229,10 @@ public class OrderController {
orderFilterRequest.setInvCodes(codes);
orderFilterRequest.setCustomerId(authAdmin.getCustomerId());
orderFilterRequest.setStatus(ConstantStatus.ORDER_STATUS_ADDITIONAL);
PageResult<OrderMdEntity> pageResult = orderService.filterList(orderFilterRequest);
IPage<OrderEntity> page = orderService.filterList(orderFilterRequest);
List<OrderMdResponse> responses = new ArrayList<>();
if (CollUtil.isNotEmpty(pageResult.getList())) {
pageResult.getList().forEach(order -> {
if (CollUtil.isNotEmpty(page.getRecords())) {
page.getRecords().forEach(order -> {
OrderMdResponse response = new OrderMdResponse();
BeanUtil.copyProperties(order, response);
String name = invWarehouseDao.selectNameByCode(order.getLocStorageCode());
@ -245,7 +243,7 @@ public class OrderController {
});
}
PageSimpleResponse<OrderMdResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageResult.getTotal());
pageSimpleResponse.setTotal(page.getTotal());
pageSimpleResponse.setList(responses);
return ResultVOUtils.success(pageSimpleResponse);
}
@ -267,28 +265,28 @@ public class OrderController {
}
String mainOrder = orderList.get(0);
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.setOrderId(orderList.get(i));
orderService.deleteOrder(deleteRequest);
}
new Thread(() -> {
ThreadUtil.execute(() -> {
WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest();
warehouseQueryRequest.setOrderId(mainOrder);
List<WarehouseMdEntity> transData = warehouseMdService.filterWarehouse(warehouseQueryRequest);
List<WarehouseEntity> transData = warehouseService.filterWarehouse(warehouseQueryRequest);
inoutUtils.generateConstrastDetail(udiInfoService, udiRelevanceService, orderDetailService, transData);
}).start();
});
}
return ResultVOUtils.success("合并成功,后台正在数据转换,请稍后刷新重试!");
}
@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()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
orderService.updateOrder(orderEntity);
warehouseMdService.updateUnit(orderEntity.getOrderId(), orderEntity.getFromCorpId(), orderEntity.getFromCorp());
warehouseService.updateUnit(orderEntity.getOrderId(), orderEntity.getFromCorpId(), orderEntity.getFromCorp());
return ResultVOUtils.success("添加成功");
}
@ -317,7 +315,7 @@ public class OrderController {
orderBean.setAction(unitMaintainEntity.getTargetAction());
WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest();
warehouseQueryRequest.setOrderId(orderEntity.getOrderId());
List<WarehouseMdEntity> warehouseEntities = warehouseMdService.filterWarehouse(warehouseQueryRequest);
List<WarehouseEntity> warehouseEntities = warehouseService.filterWarehouse(warehouseQueryRequest);
List<PostUdimsOrderRequest.OrderBean.CodeBean> codeBeans = new ArrayList<>();
UnitMaintainEntity finalUnitMaintainEntity = unitMaintainEntity;
warehouseEntities.forEach(data -> {
@ -480,7 +478,7 @@ public class OrderController {
String oldOrderId = originOrder.getOrderId();
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.setFromCorp(addOrderChangeRequest.getFromCorp());
originOrder.setFromCorpId(addOrderChangeRequest.getFromCorpId());
@ -529,7 +527,7 @@ public class OrderController {
originOrder.setUpdateTime(new Date());
originOrder.setOrderId(null);
orderService.insertOrder(originOrder);
warehouseTempMdService.insertTempWarehouses(supplementCodes);
warehouseTempService.insertTempWarehouses(supplementCodes);
orderService.updateReplicateNo(oldOrderId, replicateNo);
return ResultVOUtils.success();
}
@ -592,12 +590,13 @@ public class OrderController {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
AuthAdmin authAdmin = customerService.getUserBean();
OrderMdEntity orderMdEntity = orderService.findByOne(updateExportStatusRequest.getOrderId());
orderMdEntity.setReceiveStatus(ConstantStatus.RECEIVE_ED); //验收状态修改为已验收
orderMdEntity.setReviewUser(authAdmin.getId().intValue());
orderMdEntity.setUpdateTime(new Date());
orderService.updateOrder(orderMdEntity);
invProductsTrService.genInvProducts(orderMdEntity.getOrderId());
OrderEntity orderEntity = orderService.findByOne(updateExportStatusRequest.getOrderId());
//验收状态修改为已验收
orderEntity.setReceiveStatus(ConstantStatus.RECEIVE_ED);
orderEntity.setReviewUser(authAdmin.getId().intValue());
orderEntity.setUpdateTime(new Date());
orderService.updateOrder(orderEntity);
invProductsTrService.genInvProducts(orderEntity.getOrderId());
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.entity.basic.StockPrintEntity;
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.StockQRCodeTextEntity;
import com.glxp.udi.admin.entity.inventory.StockPrintTempEntity;
import com.glxp.udi.admin.entity.mongo.OrderMdEntity;
import com.glxp.udi.admin.entity.param.SystemPDFModuleEntity;
import com.glxp.udi.admin.entity.param.SystemPDFTemplateEntity;
import com.glxp.udi.admin.mongo.service.OrderService;
@ -300,12 +300,12 @@ public class StockQRCodeTextController {
@PostMapping("/udiwms/pdf/template/inspection/stock/order/file")
public BaseResponse inspectionStockOrderPDFFromTemplateFile(
@RequestBody InspectionPDFTemplateRequest inspectionPDFTemplateRequest) {
OrderMdEntity orderMdEntity = orderService.findByOne(inspectionPDFTemplateRequest.getOrderId());
if (orderMdEntity == null) {
OrderEntity orderEntity = orderService.findByOne(inspectionPDFTemplateRequest.getOrderId());
if (orderEntity == null) {
return ResultVOUtils.error(ResultEnum.DATA_NOT, "未找到该订单");
}
SystemPDFTemplateRelevanceRequest systemPDFTemplateRelevanceRequest = new SystemPDFTemplateRelevanceRequest();
systemPDFTemplateRelevanceRequest.setLocalAction(orderMdEntity.getAction());
systemPDFTemplateRelevanceRequest.setLocalAction(orderEntity.getAction());
systemPDFTemplateRelevanceRequest.setModuleId(inspectionPDFTemplateRequest.getModuleId());
IPage<SystemPDFTemplateRelevanceResponse> page = systemPDFTemplateRelevanceService.filterList(systemPDFTemplateRelevanceRequest);
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.WarehouseEntity;
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.FilterUdiInfoRequest;
import com.glxp.udi.admin.req.inout.FilterWarehouseRequest;
@ -49,7 +49,7 @@ public class UdiRelevanceController {
@Resource
private InvProductService invProductService;
@Resource
private WarehouseMdService warehouseMdService;
private WarehouseService warehouseService;
//客户端器械信息下载
@GetMapping("/udi/udirel/download")
@ -101,7 +101,7 @@ public class UdiRelevanceController {
FilterWarehouseRequest filterWarehouseRequest = new FilterWarehouseRequest();
filterWarehouseRequest.setCode(udiInfoEntity.getNameCode());
filterWarehouseRequest.setCustomerId(Long.valueOf(customerId));
List<WarehouseEntity> warehouseEntities = warehouseMdService.findByCode(filterWarehouseRequest);
List<WarehouseEntity> warehouseEntities = warehouseService.findByCode(filterWarehouseRequest);
if (CollUtil.isNotEmpty(warehouseEntities)) {
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.UdiInfoEntity;
import com.glxp.udi.admin.entity.inout.WarehouseEntity;
import com.glxp.udi.admin.entity.mongo.OrderMdEntity;
import com.glxp.udi.admin.entity.udid.UdiEntity;
import com.glxp.udi.admin.mongo.service.InvProductDetailMdService;
import com.glxp.udi.admin.mongo.service.InvProductDetailService;
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.OrderFilterRequest;
import com.glxp.udi.admin.req.inout.WarehouseQueryRequest;
@ -37,7 +36,7 @@ import java.util.stream.Collectors;
public class UdiTraceController {
@Resource
private WarehouseMdService warehouseMdService;
private WarehouseService warehouseService;
@Resource
private UdiInfoService udiInfoService;
@Resource
@ -45,7 +44,7 @@ public class UdiTraceController {
@Resource
private OrderService orderService;
@Resource
private InvProductDetailMdService invProductDetailMdService;
private InvProductDetailService invProductDetailService;
@GetMapping("/udiwarehouse/trace/filter")
public BaseResponse list(WarehouseQueryRequest warehouseQueryRequest) {
@ -71,19 +70,19 @@ public class UdiTraceController {
for (UdiInfoEntity udiInfoEntity : udiInfoEntityList) {
warehouseQueryRequest.setBatchNo(udiEntity.getBatchNo());
warehouseQueryRequest.setUdi(udiInfoEntity.getNameCode());
List<OrderMdEntity> temps = filterUdiTrace(warehouseQueryRequest);
List<OrderEntity> temps = filterUdiTrace(warehouseQueryRequest);
if (CollUtil.isEmpty(temps)) {
break;
}
for (OrderMdEntity temp : temps) {
for (OrderEntity temp : temps) {
UdiTraceResponse udiTraceResponse = new UdiTraceResponse();
BeanUtil.copyProperties(temp, udiTraceResponse);
udiTraceResponse.setActDate(temp.getActDate());
udiTraceResponse.setYlqxzcrbarmc(udiInfoEntity.getYlqxzcrbarmc());
udiTraceResponse.setCpmctymc(udiInfoEntity.getCpmctymc());
udiTraceResponse.setGgxh(udiInfoEntity.getGgxh());
List<WarehouseEntity> orderList = warehouseMdService.findByOrderId(temp.getOrderId());
List<WarehouseEntity> orderList = warehouseService.findByOrderId(temp.getOrderId());
if (CollUtil.isNotEmpty(orderList)) {
udiTraceResponse.setCount(orderList.get(0).getCount());
} else {
@ -117,7 +116,7 @@ public class UdiTraceController {
if (StrUtil.isBlank(warehouseQueryRequest.getCode())) {
return ResultVOUtils.success(Collections.emptyList());
}
List<OrderMdEntity> orderMdEntities = new ArrayList<>();
List<OrderEntity> orderEntities = new ArrayList<>();
String customerId = authAdminService.getCurrentUserCustomerId();
if (!Long.valueOf(customerId).equals(110)) {
warehouseQueryRequest.setCustomerId(customerId);
@ -132,27 +131,27 @@ public class UdiTraceController {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "此产品信息在耗材字典中不存在");
}
List<UdiInfoEntity> udiInfoEntities = udiInfoService.findByUuids(udiInfoEntity.getUuid(), customerId);
Set<OrderMdEntity> set = new HashSet<>();
Set<OrderEntity> set = new HashSet<>();
if (udiInfoEntities != null && udiInfoEntities.size() > 0) {
for (UdiInfoEntity temp : udiInfoEntities) {
warehouseQueryRequest.setBatchNo(udiEntity.getBatchNo());
warehouseQueryRequest.setUdi(temp.getNameCode());
List<OrderMdEntity> temps = filterUdiTrace(warehouseQueryRequest);
List<OrderEntity> temps = filterUdiTrace(warehouseQueryRequest);
if (CollUtil.isNotEmpty(temps)) {
set.addAll(temps);
}
}
}
orderMdEntities.addAll(set);
if (CollUtil.isNotEmpty(orderMdEntities)) {
orderEntities.addAll(set);
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());
pageResult.setRecords(orderMdEntities);
PageSimpleResponse<OrderMdEntity> pageSimpleResponse = new PageSimpleResponse<>();
Page<OrderEntity> pageResult = new Page<>(warehouseQueryRequest.getPage(), warehouseQueryRequest.getLimit());
pageResult.setRecords(orderEntities);
PageSimpleResponse<OrderEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageResult.getTotal());
pageSimpleResponse.setList(pageResult.getRecords());
return ResultVOUtils.success(pageSimpleResponse);
@ -176,14 +175,14 @@ public class UdiTraceController {
if (warehouseQueryRequest.getCustomerId() != null) {
filterInvProductDetailRequest.setCustomerId(warehouseQueryRequest.getCustomerId() + "");
}
invProductDetailEntities = invProductDetailMdService.filterAllInvProduct(filterInvProductDetailRequest);
invProductDetailEntities = invProductDetailService.filterAllInvProduct(filterInvProductDetailRequest);
} else if (udiInfoEntities.size() == 1) { //单级包装,且唯一查询条码
FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest();
filterInvProductDetailRequest.setCode(warehouseQueryRequest.getCode());
if (warehouseQueryRequest.getCustomerId() != null) {
filterInvProductDetailRequest.setCustomerId(warehouseQueryRequest.getCustomerId() + "");
}
invProductDetailEntities = invProductDetailMdService.filterAllInvProduct(filterInvProductDetailRequest);
invProductDetailEntities = invProductDetailService.filterAllInvProduct(filterInvProductDetailRequest);
} else {
return null;
}
@ -202,7 +201,7 @@ public class UdiTraceController {
if (warehouseQueryRequest.getCustomerId() != null) {
filterInvProductDetailRequest.setCustomerId(warehouseQueryRequest.getCustomerId() + "");
}
invProductDetailEntities = invProductDetailMdService.filterAllInvProduct(filterInvProductDetailRequest);
invProductDetailEntities = invProductDetailService.filterAllInvProduct(filterInvProductDetailRequest);
}
if (invProductDetailEntities != null && invProductDetailEntities.size() > 0) {
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.json.JSONUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.glxp.udi.admin.annotation.AuthRuleAnnotation;
import com.glxp.udi.admin.common.res.BaseResponse;
import com.glxp.udi.admin.constant.ConstantStatus;
import com.glxp.udi.admin.entity.auth.AuthAdmin;
import com.glxp.udi.admin.entity.inout.*;
import com.glxp.udi.admin.entity.mongo.OrderMdEntity;
import com.glxp.udi.admin.entity.mongo.WarehouseMdEntity;
import com.glxp.udi.admin.entity.mongo.WarehousetempMdEntity;
import com.glxp.udi.admin.entity.udid.UdiEntity;
import com.glxp.udi.admin.mongo.service.OrderService;
import com.glxp.udi.admin.mongo.service.WarehouseMdService;
import com.glxp.udi.admin.mongo.service.WarehouseTempMdService;
import com.glxp.udi.admin.mongo.utils.PageResult;
import com.glxp.udi.admin.mongo.service.WarehouseService;
import com.glxp.udi.admin.mongo.service.WarehouseTempService;
import com.glxp.udi.admin.req.inout.*;
import com.glxp.udi.admin.req.inventory.FilterInvLinkDataRequest;
import com.glxp.udi.admin.res.PageSimpleResponse;
@ -52,63 +49,62 @@ public class WareHouseController {
@Resource
private TransInoutService transInoutService;
@Resource
private WarehouseMdService warehouseMdService;
private WarehouseService warehouseService;
@Resource
private WarehouseTempMdService warehouseTempMdService;
private WarehouseTempService warehouseTempService;
@Resource
private OrderService orderService;
@Resource
private UdiInfoService udiInfoService;
@AuthRuleAnnotation("")
@PostMapping("warehouse/inout/postOrders")
public BaseResponse postOrders(@RequestBody PostOrderRequest postOrderRequest, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
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("导入成功");
}
@GetMapping("admin/warehouse/inout/findByOrderId")
public BaseResponse findByOrderId(WarehouseQueryRequest warehouseQueryRequest) {
PageResult<WarehouseMdEntity> pageResult = warehouseMdService.filterWarehouseByPage(warehouseQueryRequest);
PageSimpleResponse<WarehouseMdEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageResult.getTotal());
pageSimpleResponse.setList(pageResult.getList());
IPage<WarehouseEntity> page = warehouseService.filterWarehouseByPage(warehouseQueryRequest);
PageSimpleResponse<WarehouseEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(page.getTotal());
pageSimpleResponse.setList(page.getRecords());
return ResultVOUtils.success(pageSimpleResponse);
}
@GetMapping("admin/warehouse/inout/findErrorByOrderId")
public BaseResponse findErrorByOrderId(WarehouseQueryRequest warehouseQueryRequest) {
PageResult<WarehousetempMdEntity> pageResult = warehouseTempMdService.filterWarehouseByPage(warehouseQueryRequest);
PageSimpleResponse<WarehousetempMdEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageResult.getTotal());
pageSimpleResponse.setList(pageResult.getList());
IPage<WarehousetempEntity> page = warehouseTempService.filterWarehouseByPage(warehouseQueryRequest);
PageSimpleResponse<WarehousetempEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(page.getTotal());
pageSimpleResponse.setList(page.getRecords());
return ResultVOUtils.success(pageSimpleResponse);
}
@AuthRuleAnnotation("")
@GetMapping("warehouse/inout/deleteCodesTempById")
public BaseResponse deleteCodesTempById(String id) {
WarehousetempMdEntity warehousetemp = warehouseTempMdService.findTempById(id);
WarehousetempEntity warehousetemp = warehouseTempService.findTempById(id);
if (null == warehousetemp) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
if (warehousetemp.getCount() != null && warehousetemp.getCount() > 1) {
warehousetemp.setCount(warehousetemp.getCount() - 1);
warehouseTempMdService.updateById(warehousetemp);
warehouseTempService.updateById(warehousetemp);
} 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) {
DeleteRequest deleteRequest = new DeleteRequest();
deleteRequest.setOrderId(warehousetemp.getOrderId());
warehouseTempMdService.deleteCode(deleteRequest);
warehouseTempService.deleteCode(deleteRequest);
}
return ResultVOUtils.success();
}
@ -218,7 +214,7 @@ public class WareHouseController {
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);
orderService.updateOrder(orderEntity);
return ResultVOUtils.success("提交成功");
@ -233,10 +229,10 @@ public class WareHouseController {
@AuthRuleAnnotation("")
@GetMapping("spms/inout/dlcode/findByOrderId")
public BaseResponse downloadCodesByOrderId(WarehouseQueryRequest warehouseQueryRequest) {
PageResult<WarehouseMdEntity> pageResult = warehouseMdService.findOrdersById(warehouseQueryRequest);
PageSimpleResponse<WarehouseMdEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageResult.getTotal());
pageSimpleResponse.setList(pageResult.getList());
IPage<WarehouseEntity> page = warehouseService.filterWarehouseByPage(warehouseQueryRequest);
PageSimpleResponse<WarehouseEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(page.getTotal());
pageSimpleResponse.setList(page.getRecords());
return ResultVOUtils.success(pageSimpleResponse);
}
@ -261,7 +257,7 @@ public class WareHouseController {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "产品未维护");
}
codesReplaceRequest.setUdiEntity(udiInfoEntity);
warehouseMdService.replaceCodes(codesReplaceRequest);
warehouseService.replaceCodes(codesReplaceRequest);
return ResultVOUtils.success();
}

@ -3,10 +3,45 @@ package com.glxp.udi.admin.dao.inout;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.udi.admin.entity.inout.WarehouseEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
*/
@Mapper
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.glxp.udi.admin.entity.inout.WarehousetempEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
*/
@Mapper
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.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.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 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;
import java.util.regex.Pattern;
@Service
public class InvProductService {
@Resource
private MongoTemplate mongoTemplate;
@Resource
private MongoPageHelper mongoPageHelper;
private InvProductDao invProductDao;
public PageResult<InvProductEntity> filterInvProduct(FilterInvProductRequest filterInvProductRequest) {
Query query = new Query();
if (filterInvProductRequest.getUuids() != null && filterInvProductRequest.getUuids().size() > 0) {
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));
public IPage<InvProductEntity> filterInvProduct(FilterInvProductRequest filterInvProductRequest) {
QueryWrapper<InvProductEntity> wrapper = buildInvQueryWrapper(filterInvProductRequest);
IPage<InvProductEntity> page = new Page<>(filterInvProductRequest.getPage(), filterInvProductRequest.getLimit());
return invProductDao.selectPage(page, wrapper);
}
return mongoPageHelper.pageQuery(query, InvProductEntity.class,
filterInvProductRequest.getLimit(), filterInvProductRequest.getPage(), filterInvProductRequest.getLastId(), MongoDBName.NAME_INV_PRODUCT);
private QueryWrapper<InvProductEntity> buildInvQueryWrapper(FilterInvProductRequest filterInvProductRequest) {
QueryWrapper<InvProductEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StrUtil.isNotBlank(filterInvProductRequest.getRelIdFk()), "relIdFk", filterInvProductRequest.getRelIdFk())
.eq(StrUtil.isNotBlank(filterInvProductRequest.getBatchNo()), "batchNo", filterInvProductRequest.getBatchNo())
.eq(StrUtil.isNotBlank(filterInvProductRequest.getCustomerId()), "customerId", filterInvProductRequest.getCustomerId())
.in(CollUtil.isNotEmpty(filterInvProductRequest.getInvCodes()), "locStorageCode", filterInvProductRequest.getInvCodes())
.eq(StrUtil.isNotBlank(filterInvProductRequest.getNameCode()), "nameCode", filterInvProductRequest.getNameCode())
.like(StrUtil.isNotBlank(filterInvProductRequest.getProductsName()), "productName", filterInvProductRequest.getProductsName())
.like(StrUtil.isNotBlank(filterInvProductRequest.getZczbhhzbapzbh()), "zczbhhzbapzbh", filterInvProductRequest.getZczbhhzbapzbh())
.like(StrUtil.isNotBlank(filterInvProductRequest.getManufactory()), "manufactory", filterInvProductRequest.getManufactory())
.like(StrUtil.isNotBlank(filterInvProductRequest.getGgxh()), "ggxh", filterInvProductRequest.getGgxh());
return wrapper;
}
public List<InvProductEntity> filterInvProductList(FilterInvProductRequest filterInvProductRequest) {
Query query = new Query();
if (filterInvProductRequest.getUuids() != null && filterInvProductRequest.getUuids().size() > 0) {
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);
QueryWrapper<InvProductEntity> wrapper = buildInvQueryWrapper(filterInvProductRequest);
return invProductDao.selectList(wrapper);
}
public InvProductEntity selectByUuid(String relIdFk, String batchNo, String customerId, String locStorageCode) {
Query query = new Query();
if (relIdFk != null && !relIdFk.isEmpty()) {
query.addCriteria(Criteria.where("relIdFk").is(relIdFk));
}
if (batchNo != null && !batchNo.isEmpty()) {
query.addCriteria(Criteria.where("batchNo").is(batchNo));
}
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;
QueryWrapper<InvProductEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StrUtil.isNotBlank(relIdFk), "relIdFk", relIdFk)
.eq(StrUtil.isNotBlank(batchNo), "batchNo", batchNo)
.eq(StrUtil.isNotBlank(customerId), "customerId", customerId)
.eq(StrUtil.isNotBlank(locStorageCode), "locStorageCode", locStorageCode);
return invProductDao.selectOne(wrapper);
}
public InvProductEntity selectById(String id) {
Query query = new Query();
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;
return invProductDao.selectById(id);
}
public void insertInvProduct(InvProductEntity invProductEntity) {
mongoTemplate.insert(invProductEntity, MongoDBName.NAME_INV_PRODUCT);
invProductDao.insert(invProductEntity);
}
public void updateInvProduct(InvProductEntity invProductEntity) {
Query query = new Query();
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);
invProductDao.updateById(invProductEntity);
}
public void deleteById(String id) {
Query query = new Query();
if (id != null) {
query.addCriteria(Criteria.where("id").is(id));
}
mongoTemplate.remove(query, InvProductEntity.class, MongoDBName.NAME_INV_PRODUCT);
invProductDao.deleteById(id);
}
/**
@ -198,9 +77,9 @@ public class InvProductService {
* @return
*/
public boolean isExist(String code) {
Query query = new Query();
query.addCriteria(Criteria.where("locStorageCode").is(code));
long count = mongoTemplate.count(query, InvProductEntity.class, MongoDBName.NAME_INV_PRODUCT);
QueryWrapper<InvProductEntity> wrapper = new QueryWrapper<>();
wrapper.eq("locStorageCode", code);
Long count = invProductDao.selectCount(wrapper);
if (count > 0) {
return true;
}
@ -215,10 +94,10 @@ public class InvProductService {
* @return
*/
public Long countByNamecode(String nameCode, String customerId) {
Query query = new Query();
query.addCriteria(Criteria.where("nameCode").is(nameCode));
query.addCriteria(Criteria.where("customerId").is(customerId));
return mongoTemplate.count(query, InvProductEntity.class, MongoDBName.NAME_INV_PRODUCT);
QueryWrapper<InvProductEntity> wrapper = new QueryWrapper<>();
wrapper.eq("nameCode", nameCode).eq("customerId", customerId);
Long count = invProductDao.selectCount(wrapper);
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.inout.*;
import com.glxp.udi.admin.entity.mongo.OrderMdEntity;
import com.glxp.udi.admin.entity.mongo.WarehouseMdEntity;
import com.glxp.udi.admin.entity.mongo.WarehousetempMdEntity;
import com.glxp.udi.admin.entity.param.SystemParamConfigEntity;
import com.glxp.udi.admin.mongo.MongoDBName;
import com.glxp.udi.admin.mongo.dao.OrderMdDao;
import com.glxp.udi.admin.req.inout.DeleteRequest;
import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest;
import com.glxp.udi.admin.req.inout.OrderFilterRequest;
@ -56,10 +53,10 @@ public class OrderService {
private SystemParamConfigService systemParamConfigService;
@Lazy
@Resource
private WarehouseMdService warehouseMdService;
private WarehouseService warehouseService;
@Lazy
@Resource
private WarehouseTempMdService warehouseTempMdService;
private WarehouseTempService warehouseTempService;
@Lazy
@Resource
private OrderDetailService orderDetailService;
@ -77,8 +74,6 @@ public class OrderService {
@Resource
private BussinessTypeDao bussinessTypeDao;
@Resource
private OrderMdDao orderMdDao;
@Resource
private OrderDao orderDao;
public IPage<OrderEntity> filterList(OrderFilterRequest orderFilterRequest) {
@ -202,10 +197,10 @@ public class OrderService {
supplementOrder.setAction(supplementType.getAction());
//复制码表
List<WarehouseMdEntity> codes = warehouseMdService.findByOrderId(orderEntity.getOrderId());
List<WarehousetempMdEntity> supplementCodes = new ArrayList<>(codes.size());
List<WarehouseEntity> codes = warehouseService.findByOrderId(orderEntity.getOrderId());
List<WarehousetempEntity> supplementCodes = new ArrayList<>(codes.size());
codes.forEach(code -> {
WarehousetempMdEntity supplementCode = new WarehousetempEntity();
WarehousetempEntity supplementCode = new WarehousetempEntity();
BeanUtil.copyProperties(code, supplementCode);
supplementCode.setFromCorpId(supplementOrder.getFromCorpId());
supplementCode.setFromCorp(supplementOrder.getFromCorp());
@ -219,12 +214,12 @@ public class OrderService {
//更新数据
try {
supplementOrder.setId(null);
supplementOrder.setOrderId(null);
insertOrder(supplementOrder);
//更新配货单表对应的单据补单号
orderEntity.setSupplementNo(supplementOrderNo);
updateOrder(orderEntity);
warehouseTempMdService.insertTempWarehouses(supplementCodes);
warehouseTempService.insertTempWarehouses(supplementCodes);
} catch (Exception 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.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.ConstantType;
import com.glxp.udi.admin.entity.inout.InvProductDetailEntity;
import com.glxp.udi.admin.entity.inout.InvProductEntity;
import com.glxp.udi.admin.entity.inout.OrderDetailEntity;
import com.glxp.udi.admin.entity.inout.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.dao.inout.CodesDao;
import com.glxp.udi.admin.entity.inout.*;
import com.glxp.udi.admin.req.inout.*;
import com.glxp.udi.admin.req.inventory.FilterInvProductRequest;
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 javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@Service
public class WarehouseMdService {
public class WarehouseService {
@Resource
private MongoTemplate mongoTemplate;
@Resource
private MongoPageHelper mongoPageHelper;
@Lazy
@Resource
private OrderService orderService;
@ -42,101 +29,65 @@ public class WarehouseMdService {
private InvProductService invProductService;
@Lazy
@Resource
private InvProductDetailMdService invProductDetailMdService;
private InvProductDetailService invProductDetailService;
@Lazy
@Resource
private OrderDetailService orderDetailService;
@Resource
private CodesDao codesDao;
public PageResult<WarehouseMdEntity> 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()));
}
return mongoPageHelper.pageQuery(query, WarehouseMdEntity.class,
warehouseQueryRequest.getLimit(), warehouseQueryRequest.getPage(), warehouseQueryRequest.getLastId(), MongoDBName.NAME_CODE);
public IPage<WarehouseEntity> filterWarehouseByPage(WarehouseQueryRequest warehouseQueryRequest) {
IPage<WarehouseEntity> page = new Page<>(warehouseQueryRequest.getPage(), warehouseQueryRequest.getLimit());
QueryWrapper<WarehouseEntity> wrapper = buildCodesQueryWrapper(warehouseQueryRequest);
return codesDao.selectPage(page, wrapper);
}
public List<WarehouseMdEntity> filterWarehouse(WarehouseQueryRequest warehouseQueryRequest) {
Query query = new Query();
if (warehouseQueryRequest.getCode() != null && !warehouseQueryRequest.getCode().isEmpty()) {
query.addCriteria(Criteria.where("code").is(warehouseQueryRequest.getCode()));
public List<WarehouseEntity> filterWarehouse(WarehouseQueryRequest warehouseQueryRequest) {
QueryWrapper<WarehouseEntity> wrapper = buildCodesQueryWrapper(warehouseQueryRequest);
return codesDao.selectList(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()));
}
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);
private QueryWrapper<WarehouseEntity> buildCodesQueryWrapper(WarehouseQueryRequest warehouseQueryRequest) {
QueryWrapper<WarehouseEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StrUtil.isNotBlank(warehouseQueryRequest.getCode()), "code", warehouseQueryRequest.getCode())
.eq(null != warehouseQueryRequest.getCorpOrderId(), "corpOrderId", warehouseQueryRequest.getCorpOrderId())
.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<WarehouseMdEntity> warehouseEntities) {
if (warehouseEntities != null) {
Collection<WarehouseMdEntity> warehouseMdEntityCollection = new ArrayList<>();
warehouseMdEntityCollection.addAll(warehouseEntities);
mongoTemplate.insert(warehouseMdEntityCollection, MongoDBName.NAME_CODE);
public void insertWarehouses(List<WarehouseEntity> warehouseEntities) {
if (CollUtil.isNotEmpty(warehouseEntities)) {
for (WarehouseEntity warehouseEntity : warehouseEntities) {
codesDao.insert(warehouseEntity);
}
}
}
public List<WarehouseMdEntity> findByCode(FilterWarehouseRequest filterWarehouseRequest) {
Query query = new Query();
query.addCriteria(
Criteria.where("customerId").is(filterWarehouseRequest.getCustomerId())
.and("code").is(filterWarehouseRequest.getCode())
);
return mongoTemplate.find(query, WarehouseMdEntity.class, MongoDBName.NAME_CODE);
public List<WarehouseEntity> findByCode(FilterWarehouseRequest filterWarehouseRequest) {
QueryWrapper<WarehouseEntity> wrapper = new QueryWrapper<>();
wrapper.eq(null != filterWarehouseRequest.getCustomerId(), "customerId", filterWarehouseRequest.getCustomerId())
.eq(StrUtil.isNotBlank(filterWarehouseRequest.getCode()), "code", filterWarehouseRequest.getCode());
return codesDao.selectList(wrapper);
}
public void updateUnit(String orderId, String fromCorpId, String fromCorp) {
Query query = new Query();
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);
codesDao.updateUnit(orderId, fromCorp, fromCorpId);
}
public void updateOrderId(String orderId, String newOrderId) {
Query query = new Query();
query.addCriteria(new Criteria().and("orderId").is(orderId));
Update update = new Update();
update.set("orderId", newOrderId);
mongoTemplate.updateMulti(query, update, MongoDBName.NAME_CODE);
codesDao.updateOrderId(orderId, newOrderId);
}
public List<WarehouseMdEntity> findByOrderId(String orderId) {
if (StrUtil.isBlank(orderId)) {
public List<WarehouseEntity> findByOrderId(String orderId) {
if (StrUtil.isNotBlank(orderId)) {
return Collections.emptyList();
}
Query query = new Query();
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;
return codesDao.selectByOrderId(orderId);
}
public void replaceCodes(CodesReplaceRequest codesReplaceRequest) {
@ -149,9 +100,9 @@ public class WarehouseMdService {
WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest();
warehouseQueryRequest.setCode(codesReplaceRequest.getCode());
warehouseQueryRequest.setOrderId(order.getOrderId());
List<WarehouseMdEntity> warehouseEntities = findByOrderId(warehouseQueryRequest);
List<WarehouseEntity> warehouseEntities = filterWarehouse(warehouseQueryRequest);
if (CollUtil.isNotEmpty(warehouseEntities)) {
WarehouseMdEntity warehouseMdEntity = warehouseEntities.get(0);
WarehouseEntity warehouseMdEntity = warehouseEntities.get(0);
if (warehouseMdEntity.getCount() > 1) {
//删除一个条码
warehouseMdEntity.setCount(warehouseMdEntity.getCount() - 1);
@ -170,16 +121,16 @@ public class WarehouseMdService {
if (StrUtil.isNotBlank(warehouseMdEntity.getBatchNo())) {
filterInvProductDetailRequest.setBatchNo(warehouseMdEntity.getBatchNo());
}
List<InvProductDetailEntity> invProductDetailEntities = invProductDetailMdService.filterAllInvProduct(filterInvProductDetailRequest);
List<InvProductDetailEntity> invProductDetailEntities = invProductDetailService.filterAllInvProduct(filterInvProductDetailRequest);
if (CollUtil.isNotEmpty(invProductDetailEntities)) {
//库存详情不为空,单据已验收,扣减库存
InvProductDetailEntity invProductDetailEntity = invProductDetailEntities.get(0);
if (invProductDetailEntity.getCount() > 1) {
invProductDetailEntity.setCount(invProductDetailEntity.getCount() - 1);
invProductDetailMdService.updateInvProduct(invProductDetailEntity);
invProductDetailService.updateInvProduct(invProductDetailEntity);
} else {
//扣减库存后等于0删除库存详情
invProductDetailMdService.deleteById(invProductDetailEntity.getId());
invProductDetailService.deleteById(invProductDetailEntity.getId());
}
//查询原库存详情和新的库存详情
@ -204,7 +155,7 @@ public class WarehouseMdService {
detailParams.setBatchNo(invProductEntity.getBatchNo());
detailParams.setInvCodes(Collections.singletonList(invProductEntity.getLocStorageCode()));
detailParams.setProductIdFk(invProductEntity.getRelIdFk());
long count = invProductDetailMdService.statCount(detailParams);
long count = invProductDetailService.statCount(detailParams);
if (count == 0) {
//删除库存
invProductService.deleteById(invProductEntity.getId());
@ -245,39 +196,12 @@ public class WarehouseMdService {
}
}
/**
* 使ID
*
* @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 updateCode(WarehouseEntity warehouseEntity) {
codesDao.updateCount(warehouseEntity.getCount(), warehouseEntity.getId());
}
public void deleteById(String id) {
Query query = new Query();
query.addCriteria(Criteria.where("id").is(id));
mongoTemplate.remove(query, WarehouseMdEntity.class, MongoDBName.NAME_CODE);
codesDao.deleteById(id);
}
}

@ -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.TypeConstant;
import com.glxp.udi.admin.entity.inout.*;
import com.glxp.udi.admin.entity.mongo.OrderMdEntity;
import com.glxp.udi.admin.entity.mongo.WarehouseMdEntity;
import com.glxp.udi.admin.mongo.service.*;
import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest;
import com.glxp.udi.admin.req.inout.OrderFilterRequest;
@ -36,7 +34,7 @@ public class InvProductsTrService {
private OrderDetailService myErpOrderService;
@Lazy
@Resource
private WarehouseMdService codesService;
private WarehouseService codesService;
@Lazy
@Resource
private UdiInfoService udiInfoService;
@ -45,7 +43,7 @@ public class InvProductsTrService {
private InvProductService invProductService;
@Lazy
@Resource
private InvProductDetailMdService invProductDetailService;
private InvProductDetailService invProductDetailService;
@Resource
private InoutUtils inoutUtils;
@ -53,8 +51,8 @@ public class InvProductsTrService {
public void genInvProducts(String orderId) {
OrderFilterRequest orderFilterRequest = new OrderFilterRequest();
orderFilterRequest.setId(orderId);
List<OrderMdEntity> orderMdEntities = orderService.findAll(orderFilterRequest);
OrderMdEntity orderEntity = orderMdEntities.get(0);
List<OrderEntity> orderEntities = orderService.findAll(orderFilterRequest);
OrderEntity orderEntity = orderEntities.get(0);
String customerId = orderEntity.getCustomerId() + "";
if (orderEntity.getStatus().equals(ConstantStatus.ORDER_STATUS_SUCCESS)) {
FilterOrderDetailRequest filterOrderDetailRequest = new FilterOrderDetailRequest();
@ -104,7 +102,7 @@ public class InvProductsTrService {
if (StrUtil.isNotBlank(invProductEntity.getBatchNo())) {
warehouseQueryRequest.setBatchNo(invProductEntity.getBatchNo());
}
List<WarehouseMdEntity> warehouseEntities = codesService.filterWarehouse(warehouseQueryRequest);
List<WarehouseEntity> warehouseEntities = codesService.filterWarehouse(warehouseQueryRequest);
if (CollUtil.isNotEmpty(warehouseEntities)) {
for (WarehouseEntity warehouseEntity : warehouseEntities) {
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.OrderEntity;
import com.glxp.udi.admin.entity.inout.UnitMaintainEntity;
import com.glxp.udi.admin.entity.mongo.OrderMdEntity;
import com.glxp.udi.admin.entity.mongo.WarehouseMdEntity;
import com.glxp.udi.admin.entity.inout.WarehouseEntity;
import com.glxp.udi.admin.entity.param.SystemParamConfigEntity;
import com.glxp.udi.admin.mongo.service.OrderDetailService;
import com.glxp.udi.admin.mongo.service.OrderService;
import com.glxp.udi.admin.mongo.service.WarehouseMdService;
import com.glxp.udi.admin.mongo.service.WarehouseService;
import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest;
import com.glxp.udi.admin.req.inout.PostUdimsOrderDetailRequest;
import com.glxp.udi.admin.req.inout.PostUdimsOrderRequest;
@ -62,7 +61,7 @@ public class SubmitOrderToSpmsTask implements SchedulingConfigurer {
@Resource
private SystemParamCustomerConfigService systemParamCustomerConfigService;
@Resource
private WarehouseMdService warehouseMdService;
private WarehouseService warehouseService;
@Resource
private OrderDetailService orderDetailService;
@Resource
@ -106,7 +105,7 @@ public class SubmitOrderToSpmsTask implements SchedulingConfigurer {
orderBean.setAction(unitMaintainEntity.getTargetAction());
WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest();
warehouseQueryRequest.setOrderId(orderEntity.getOrderId());
List<WarehouseMdEntity> warehouseEntities = warehouseMdService.filterWarehouse(warehouseQueryRequest);
List<WarehouseEntity> warehouseEntities = warehouseService.filterWarehouse(warehouseQueryRequest);
List<PostUdimsOrderRequest.OrderBean.CodeBean> codeBeans = new ArrayList<>();
warehouseEntities.forEach(data -> {
PostUdimsOrderRequest.OrderBean.CodeBean codeBean = new PostUdimsOrderRequest.OrderBean.CodeBean();
@ -150,10 +149,10 @@ public class SubmitOrderToSpmsTask implements SchedulingConfigurer {
});
if (baseResponse.getCode() == 20000) {
log.info("自动上传单据成功," + unitMaintainEntity.getName() + "上传单据数量为 " + orderEntities.size());
for (OrderMdEntity orderMdEntity : orderEntities) {
log.info("修改单号为:{} 的上传状态", orderMdEntity.getOrderId());
orderMdEntity.setUploadStatus("1");
orderService.updateOrder(orderMdEntity);
for (OrderEntity orderEntity : orderEntities) {
log.info("修改单号为:{} 的上传状态", orderEntity.getOrderId());
orderEntity.setUploadStatus("1");
orderService.updateOrder(orderEntity);
}
} else {
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.mongo.service.OrderDetailService;
import com.glxp.udi.admin.mongo.service.OrderService;
import com.glxp.udi.admin.mongo.service.WarehouseMdService;
import com.glxp.udi.admin.mongo.service.WarehouseTempMdService;
import com.glxp.udi.admin.mongo.service.WarehouseService;
import com.glxp.udi.admin.mongo.service.WarehouseTempService;
import com.glxp.udi.admin.req.inout.OrderFilterRequest;
import com.glxp.udi.admin.req.inout.PostOrderRequest;
import com.glxp.udi.admin.service.basic.BussinessTypeService;
@ -34,7 +34,6 @@ import java.util.List;
@Transactional(rollbackFor = Exception.class)
public class TransInoutService {
@Resource
private UdiRelevanceService udiRelevanceService;
@Resource
@ -44,9 +43,9 @@ public class TransInoutService {
@Resource
private OrderService orderService;
@Resource
private WarehouseTempMdService warehouseTempMdService;
private WarehouseTempService warehouseTempService;
@Resource
private WarehouseMdService warehouseMdService;
private WarehouseService warehouseService;
@Resource
private OrderDetailService orderDetailService;
@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<>();
if (StrUtil.isBlank(orderEntity.getLocStorageCode())) {
if (!StrUtil.isEmpty(bussinessTypeEntity.getStorageCode())) {
@ -133,7 +132,7 @@ public class TransInoutService {
for (WarehousetempEntity warehousetemp : filterList) {
warehousetemp.setLocStorageCode(orderEntity.getLocStorageCode());
String result = inoutUtils.filterCode(warehouseMdService, warehousetemp, setupService);
String result = inoutUtils.filterCode(warehouseService, warehousetemp, setupService);
if (result == null) {
WarehouseEntity warehouseEntity = new WarehouseEntity();
BeanUtil.copyProperties(warehousetemp, warehouseEntity, "id");
@ -166,13 +165,13 @@ public class TransInoutService {
}
if (insertList.size() > 0) {
warehouseMdService.insertWarehouses(insertList);
List<WarehousetempEntity> temps = warehouseTempMdService.findTempByOrderId(orderEntity.getOrderId());
warehouseService.insertWarehouses(insertList);
List<WarehousetempEntity> temps = warehouseTempService.findTempByOrderId(orderEntity.getOrderId());
List<String> ids = new ArrayList<>();
for (WarehousetempEntity temp : temps) {
ids.add(temp.getId());
}
warehouseTempMdService.deleteTempWarehouses(ids);
warehouseTempService.deleteTempWarehouses(ids);
tempEntity.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS);
orderService.updateOrder(tempEntity);
inoutUtils.generateConstrastDetail(udiInfoService, udiRelevanceService, orderDetailService, insertList);
@ -229,7 +228,7 @@ public class TransInoutService {
warehousetempList.get(index).setOrderId(orderId);
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.dao.info.ScheduledDao;
import com.glxp.udi.admin.entity.info.ScheduledEntity;
import com.glxp.udi.admin.entity.mongo.OrderMdEntity;
import com.glxp.udi.admin.entity.inout.OrderEntity;
import com.glxp.udi.admin.entity.param.SystemParamConfigEntity;
import com.glxp.udi.admin.mongo.service.OrderService;
import com.glxp.udi.admin.req.inout.OrderFilterRequest;
@ -60,13 +60,13 @@ public class TransInoutTask implements SchedulingConfigurer {
//查询待处理单据,判断此单据的用户是否开启了自动处理单据,如果已开启则自动处理,未开启跳过
OrderFilterRequest orderFilterRequest = new OrderFilterRequest();
orderFilterRequest.setStatus(ConstantStatus.ORDER_STATUS_WAIT);
List<OrderMdEntity> list = orderService.findAll(orderFilterRequest);
List<OrderEntity> list = orderService.findAll(orderFilterRequest);
if (CollUtil.isNotEmpty(list)) {
for (OrderMdEntity orderMdEntity : list) {
SystemParamConfigEntity io_transInout_auto = systemParamCustomerConfigService.getParamByKey(SystemParamConstant.IO_TRANSINOUT_AUTO, orderMdEntity.getCustomerId());
for (OrderEntity orderEntity : list) {
SystemParamConfigEntity io_transInout_auto = systemParamCustomerConfigService.getParamByKey(SystemParamConstant.IO_TRANSINOUT_AUTO, orderEntity.getCustomerId());
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.udid.UdiEntity;
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.service.info.SetupService;
import com.glxp.udi.admin.service.inout.UdiInfoService;
@ -35,7 +35,7 @@ public class InoutUtils {
@Resource
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()));
FilterWarehouseRequest filterWarehouseRequest = new FilterWarehouseRequest();
filterWarehouseRequest.setCode(warehousetemp.getCode());
@ -44,7 +44,8 @@ public class InoutUtils {
WarehouseEntity warehouseData = new WarehouseEntity();
BeanUtils.copyProperties(warehousetemp, warehouseData);
if (warehouseEntityList == null || warehouseEntityList.size() == 0) { //数据库为null,可以添加
//数据库为null,可以添加
if (warehouseEntityList == null || warehouseEntityList.size() == 0) {
return nullVail(warehousetemp, setupEntity);
}
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