1.修改单据相关的代码,完成部分迁移工作

master
x_z 3 years ago
parent d7ee22b16c
commit 75ae13cacd

@ -19,7 +19,7 @@
</parent> </parent>
<properties> <properties>
<java.version>1.8</java.version> <java.version>11</java.version>
<openfegin.version>11.0</openfegin.version> <openfegin.version>11.0</openfegin.version>
<mybatis-plus.version>3.5.1</mybatis-plus.version> <mybatis-plus.version>3.5.1</mybatis-plus.version>
</properties> </properties>

@ -1,11 +1,18 @@
package com.glxp.udi.admin.controller; package com.glxp.udi.admin.controller;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.glxp.udi.admin.dao.inout.UdiInfoDao; import com.glxp.udi.admin.dao.inout.UdiInfoDao;
import com.glxp.udi.admin.entity.inout.*; import com.glxp.udi.admin.entity.inout.*;
import com.glxp.udi.admin.mongo.service.*; import com.glxp.udi.admin.entity.inout.WarehousetempEntity;
import com.glxp.udi.admin.req.inout.FilterErpOrderRequest; import com.glxp.udi.admin.entity.mongo.*;
import com.glxp.udi.admin.mongo.dao.*;
import com.glxp.udi.admin.mongo.service.InvProductDetailMdService;
import com.glxp.udi.admin.mongo.service.InvProductService;
import com.glxp.udi.admin.mongo.service.OrderDetailService;
import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest;
import com.glxp.udi.admin.req.inout.FilterInvProductDetailRequest; import com.glxp.udi.admin.req.inout.FilterInvProductDetailRequest;
import com.glxp.udi.admin.req.inventory.FilterInvProductRequest; import com.glxp.udi.admin.req.inventory.FilterInvProductRequest;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -20,21 +27,48 @@ import java.util.List;
public class TestController { public class TestController {
@Resource @Resource
private OrderMdService orderMdService; private OrderDetailService orderDetailService;
@Resource @Resource
private OrderDetailMdService orderDetailMdService; private InvProductService invProductService;
@Resource
private InvProductMdService invProductMdService;
@Resource @Resource
private InvProductDetailMdService invProductDetailMdService; private InvProductDetailMdService invProductDetailMdService;
@Resource @Resource
private UdiInfoDao udiInfoDao; private UdiInfoDao udiInfoDao;
//mongodb dao
@Resource
private OrderMdDao orderMdDao;
@Resource
private OrderDetailMdDao orderDetailMdDao;
@Resource
private CodesMdDao codesMdDao;
@Resource
private CodesTempMdDao codesTempMdDao;
@Resource
private InvProductMdDao invProductMdDao;
@Resource
private InvProductDetailMdDao invProductDetailMdDao;
//mysql dao
@Resource
private com.glxp.udi.admin.dao.inout.OrderDao orderDao;
@Resource
private com.glxp.udi.admin.dao.inout.OrderDetailDao orderDetailDao;
@Resource
private com.glxp.udi.admin.dao.inout.CodesDao codesDao;
@Resource
private com.glxp.udi.admin.dao.inout.CodesTempDao codesTempDao;
@Resource
private com.glxp.udi.admin.dao.inout.InvProductDao invProductDao;
@Resource
private com.glxp.udi.admin.dao.inout.InvProductDetailDao invProductDetailDao;
@GetMapping("/test/refreshOrderData") @GetMapping("/test/refreshOrderData")
private String refreshOrderData() { private String refreshOrderData() {
try { try {
//刷新订单详情表的数据 //刷新订单详情表的数据
List<OrderDetailEntity> erpOrderEntities = orderDetailMdService.filterOrderDetails(new FilterErpOrderRequest()); List<OrderDetailEntity> erpOrderEntities = orderDetailService.filterOrderDetails(new FilterOrderDetailRequest());
/*erpOrderEntities.forEach(orderDetail -> { /*erpOrderEntities.forEach(orderDetail -> {
String orderId = orderDetail.getOrderIdFk(); String orderId = orderDetail.getOrderIdFk();
if (StrUtil.isNotBlank(orderId)) { if (StrUtil.isNotBlank(orderId)) {
@ -54,7 +88,7 @@ public class TestController {
});*/ });*/
//刷新库存表的数据 //刷新库存表的数据
List<InvProductEntity> invProductEntities = invProductMdService.filterInvProductList(new FilterInvProductRequest()); List<InvProductEntity> invProductEntities = invProductService.filterInvProductList(new FilterInvProductRequest());
invProductEntities.forEach(invProductEntity -> { invProductEntities.forEach(invProductEntity -> {
UdiInfoEntity udiInfoEntity = udiInfoDao.selectOne(new QueryWrapper<UdiInfoEntity>().eq(StrUtil.isNotBlank(invProductEntity.getRelIdFk()), "uuid", invProductEntity.getRelIdFk()) UdiInfoEntity udiInfoEntity = udiInfoDao.selectOne(new QueryWrapper<UdiInfoEntity>().eq(StrUtil.isNotBlank(invProductEntity.getRelIdFk()), "uuid", invProductEntity.getRelIdFk())
.eq(StrUtil.isNotBlank(invProductEntity.getCustomerId()), "customerId", invProductEntity.getCustomerId()) .eq(StrUtil.isNotBlank(invProductEntity.getCustomerId()), "customerId", invProductEntity.getCustomerId())
@ -63,7 +97,7 @@ public class TestController {
if (null != udiInfoEntity) { if (null != udiInfoEntity) {
invProductEntity.setRelIdFk(String.valueOf(udiInfoEntity.getId())); invProductEntity.setRelIdFk(String.valueOf(udiInfoEntity.getId()));
log.info("刷新库存"); log.info("刷新库存");
invProductMdService.updateInvProduct(invProductEntity); invProductService.updateInvProduct(invProductEntity);
} }
}); });
@ -95,6 +129,76 @@ public class TestController {
@GetMapping("/test/copyData") @GetMapping("/test/copyData")
public String copyData() { public String copyData() {
try { try {
log.info("开始拷贝单据数据");
List<OrderMdEntity> orderList = orderMdDao.getOrderList();
if (CollUtil.isNotEmpty(orderList)) {
orderList.forEach(orderMdEntity -> {
OrderEntity orderEntity = new OrderEntity();
BeanUtil.copyProperties(orderMdEntity, orderEntity);
orderDao.insert(orderEntity);
});
}
log.info("单据数据拷贝完成");
log.info("开始拷贝单据详情数据");
List<ErpOrderEntity> orderDetailList = orderDetailMdDao.getOrderDetailList();
if (CollUtil.isNotEmpty(orderDetailList)) {
orderDetailList.forEach(orderMdDetail -> {
OrderDetailEntity orderDetailEntity = new OrderDetailEntity();
BeanUtil.copyProperties(orderMdDetail, orderDetailEntity, "id");
orderDetailEntity.setBatchNo(orderMdDetail.getLotno());
orderDetailEntity.setProductName(orderMdDetail.getCoName());
orderDetailDao.insert(orderDetailEntity);
});
}
log.info("单据详情数据拷贝完成");
log.info("开始拷贝码数据");
List<WarehouseMdEntity> codesList = codesMdDao.getCodesList();
if (CollUtil.isNotEmpty(codesList)) {
codesList.forEach(code -> {
WarehouseEntity warehouseEntity = new WarehouseEntity();
BeanUtil.copyProperties(code, warehouseEntity, "id");
codesDao.insert(warehouseEntity);
});
}
log.info("码数据拷贝完成");
log.info("开始拷贝临时码表");
List<WarehousetempMdEntity> codesTempList = codesTempMdDao.getCodesTempList();
if (CollUtil.isNotEmpty(codesTempList)) {
codesTempList.forEach(codesTemp -> {
WarehousetempEntity warehousetempEntity = new WarehousetempEntity();
BeanUtil.copyProperties(codesTemp, warehousetempEntity, "id");
codesTempDao.insert(warehousetempEntity);
});
}
log.info("临时码表数据拷贝完成");
log.info("开始拷贝库存数据");
List<InvProductMdEntity> invList = invProductMdDao.getInvList();
if (CollUtil.isNotEmpty(invList)) {
invList.forEach(inv -> {
InvProductEntity invProductEntity = new InvProductEntity();
BeanUtil.copyProperties(inv, invProductEntity, "id");
invProductDao.insert(invProductEntity);
if (StrUtil.isNotBlank(invProductEntity.getId())) {
//拷贝;临时码表的数据
log.info("开始拷贝临时码表数据");
//查询此库存对应的库存详情根据已经插入到mysql的数据生成mysql的库存详情数据
List<InvProductDetailMdEntity> invDetailList = invProductDetailMdDao.getInvDetailList(inv.getId());
if (CollUtil.isNotEmpty(invDetailList)) {
invDetailList.forEach(invDetail -> {
InvProductDetailEntity invProductDetailEntity = new InvProductDetailEntity();
BeanUtil.copyProperties(inv, invProductDetailEntity, "id");
invProductDetailEntity.setProductIdFk(invProductEntity.getId());
invProductDetailDao.insert(invProductDetailEntity);
log.info("插入库存详情数据");
});
}
}
});
}
return "success"; return "success";
} catch (Exception e) { } catch (Exception e) {

@ -7,7 +7,7 @@ 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.BussinessTypeEntity; import com.glxp.udi.admin.entity.basic.BussinessTypeEntity;
import com.glxp.udi.admin.entity.basic.CndidateRequest; import com.glxp.udi.admin.entity.basic.CndidateRequest;
import com.glxp.udi.admin.mongo.service.OrderMdService; import com.glxp.udi.admin.mongo.service.OrderService;
import com.glxp.udi.admin.req.basic.BussinessLocalTypeFilterRequest; import com.glxp.udi.admin.req.basic.BussinessLocalTypeFilterRequest;
import com.glxp.udi.admin.req.basic.BussinessTypeFilterRequest; import com.glxp.udi.admin.req.basic.BussinessTypeFilterRequest;
import com.glxp.udi.admin.req.info.DeleteRequest; import com.glxp.udi.admin.req.info.DeleteRequest;
@ -44,7 +44,7 @@ public class BussinessTypeController {
@Resource @Resource
private CustomerService customerService; private CustomerService customerService;
@Resource @Resource
private OrderMdService orderMdService; private OrderService orderService;
@ApiOperation(value = "扫码单据列表") @ApiOperation(value = "扫码单据列表")
@AuthRuleAnnotation("") @AuthRuleAnnotation("")
@ -98,7 +98,7 @@ public class BussinessTypeController {
String id = deleteRequest.getId(); String id = deleteRequest.getId();
BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.selectById(id); BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.selectById(id);
long count = orderMdService.countByAction(bussinessTypeEntity.getAction()); long count = orderService.countByAction(bussinessTypeEntity.getAction());
if (count > 0) { if (count > 0) {
return ResultVOUtils.error(500, "已存在该类型扫码单据,无法删除!"); return ResultVOUtils.error(500, "已存在该类型扫码单据,无法删除!");
} }

@ -11,7 +11,7 @@ import com.glxp.udi.admin.entity.inout.InvProductDetailEntity;
import com.glxp.udi.admin.entity.inout.InvProductEntity; import com.glxp.udi.admin.entity.inout.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.InvProductDetailMdService;
import com.glxp.udi.admin.mongo.service.InvProductMdService; import com.glxp.udi.admin.mongo.service.InvProductService;
import com.glxp.udi.admin.mongo.utils.PageResult; import com.glxp.udi.admin.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;
@ -42,7 +42,7 @@ import java.util.List;
public class InvProductsController { public class InvProductsController {
@Resource @Resource
private InvProductMdService invProductService; private InvProductService invProductService;
@Resource @Resource
private InvProductDetailMdService invProductDetailService; private InvProductDetailMdService invProductDetailService;
@Resource @Resource

@ -7,6 +7,7 @@ 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;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.metadata.IPage;
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;
@ -14,13 +15,11 @@ import com.glxp.udi.admin.dao.inventory.InvWarehouseDao;
import com.glxp.udi.admin.entity.auth.AuthAdmin; import com.glxp.udi.admin.entity.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.OrderDetailEntity; import com.glxp.udi.admin.entity.inout.*;
import com.glxp.udi.admin.entity.inout.UnitMaintainEntity;
import com.glxp.udi.admin.entity.inout.WarehouseEntity;
import com.glxp.udi.admin.entity.inout.WarehousetempEntity;
import com.glxp.udi.admin.entity.mongo.OrderMdEntity; import com.glxp.udi.admin.entity.mongo.OrderMdEntity;
import com.glxp.udi.admin.mongo.service.OrderDetailMdService; import com.glxp.udi.admin.entity.mongo.WarehouseMdEntity;
import com.glxp.udi.admin.mongo.service.OrderMdService; import com.glxp.udi.admin.mongo.service.OrderDetailService;
import com.glxp.udi.admin.mongo.service.OrderService;
import com.glxp.udi.admin.mongo.service.WarehouseMdService; import com.glxp.udi.admin.mongo.service.WarehouseMdService;
import com.glxp.udi.admin.mongo.service.WarehouseTempMdService; import com.glxp.udi.admin.mongo.service.WarehouseTempMdService;
import com.glxp.udi.admin.mongo.utils.PageResult; import com.glxp.udi.admin.mongo.utils.PageResult;
@ -63,9 +62,9 @@ public class OrderController {
@Resource @Resource
private AuthAdminService authAdminService; private AuthAdminService authAdminService;
@Resource @Resource
private OrderDetailMdService orderDetailMdService; private OrderDetailService orderDetailService;
@Resource @Resource
private OrderMdService orderMdService; private OrderService orderService;
@Resource @Resource
private WarehouseMdService warehouseMdService; private WarehouseMdService warehouseMdService;
@Resource @Resource
@ -112,10 +111,10 @@ public class OrderController {
orderFilterRequest.setCheckReceiveStatus(true); orderFilterRequest.setCheckReceiveStatus(true);
} }
PageResult<OrderMdEntity> pageResult = orderMdService.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());
@ -129,12 +128,12 @@ public class OrderController {
} }
//设置上传状态 //设置上传状态
response.setUploadFlag(orderMdService.checkUpload(order)); response.setUploadFlag(orderService.checkUpload(order));
responses.add(response); responses.add(response);
}); });
} }
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);
} }
@ -157,10 +156,10 @@ public class OrderController {
if (CollUtil.isNotEmpty(deleteRequest.getIds())) { if (CollUtil.isNotEmpty(deleteRequest.getIds())) {
//全部删除 //全部删除
orderMdService.deleteOrders(deleteRequest.getIds()); orderService.deleteOrders(deleteRequest.getIds());
} else { } else {
//删除单条单据 //删除单条单据
orderMdService.deleteOrders(Collections.singletonList(deleteRequest.getOrderId())); orderService.deleteOrders(Collections.singletonList(deleteRequest.getOrderId()));
} }
return ResultVOUtils.success("删除成功"); return ResultVOUtils.success("删除成功");
} }
@ -179,7 +178,7 @@ 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 = orderMdService.filterList(orderFilterRequest); PageResult<OrderMdEntity> pageResult = orderService.filterList(orderFilterRequest);
PageSimpleResponse<OrderMdEntity> pageSimpleResponse = new PageSimpleResponse<>(); PageSimpleResponse<OrderMdEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageResult.getTotal()); pageSimpleResponse.setTotal(pageResult.getTotal());
pageSimpleResponse.setList(pageResult.getList()); pageSimpleResponse.setList(pageResult.getList());
@ -206,7 +205,7 @@ public class OrderController {
} }
orderFilterRequest.setInvCodes(invCodes); orderFilterRequest.setInvCodes(invCodes);
PageResult<OrderMdEntity> pageResult = orderMdService.filterList(orderFilterRequest); PageResult<OrderMdEntity> pageResult = orderService.filterList(orderFilterRequest);
PageSimpleResponse<OrderMdEntity> pageSimpleResponse = new PageSimpleResponse<>(); PageSimpleResponse<OrderMdEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageResult.getTotal()); pageSimpleResponse.setTotal(pageResult.getTotal());
pageSimpleResponse.setList(pageResult.getList()); pageSimpleResponse.setList(pageResult.getList());
@ -232,7 +231,7 @@ 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 = orderMdService.filterList(orderFilterRequest); PageResult<OrderMdEntity> pageResult = orderService.filterList(orderFilterRequest);
List<OrderMdResponse> responses = new ArrayList<>(); List<OrderMdResponse> responses = new ArrayList<>();
if (CollUtil.isNotEmpty(pageResult.getList())) { if (CollUtil.isNotEmpty(pageResult.getList())) {
pageResult.getList().forEach(order -> { pageResult.getList().forEach(order -> {
@ -264,20 +263,20 @@ public class OrderController {
for (String orderId : orderList) { for (String orderId : orderList) {
DeleteRequest deleteRequest = new DeleteRequest(); DeleteRequest deleteRequest = new DeleteRequest();
deleteRequest.setOrderId(orderId); deleteRequest.setOrderId(orderId);
orderDetailMdService.deleteOrderDetail(deleteRequest); orderDetailService.deleteOrderDetail(deleteRequest);
} }
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); warehouseMdService.updateOrderId(orderList.get(i), mainOrder);
DeleteRequest deleteRequest = new DeleteRequest(); DeleteRequest deleteRequest = new DeleteRequest();
deleteRequest.setOrderId(orderList.get(i)); deleteRequest.setOrderId(orderList.get(i));
orderMdService.deleteOrder(deleteRequest); orderService.deleteOrder(deleteRequest);
} }
new Thread(() -> { new Thread(() -> {
WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest(); WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest();
warehouseQueryRequest.setOrderId(mainOrder); warehouseQueryRequest.setOrderId(mainOrder);
List<WarehouseEntity> transData = warehouseMdService.filterWarehouse(warehouseQueryRequest); List<WarehouseMdEntity> transData = warehouseMdService.filterWarehouse(warehouseQueryRequest);
inoutUtils.generateConstrastDetail(udiInfoService, udiRelevanceService, orderDetailMdService, transData); inoutUtils.generateConstrastDetail(udiInfoService, udiRelevanceService, orderDetailService, transData);
}).start(); }).start();
} }
return ResultVOUtils.success("合并成功,后台正在数据转换,请稍后刷新重试!"); return ResultVOUtils.success("合并成功,后台正在数据转换,请稍后刷新重试!");
@ -288,7 +287,7 @@ public class OrderController {
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());
} }
orderMdService.updateOrder(orderEntity); orderService.updateOrder(orderEntity);
warehouseMdService.updateUnit(orderEntity.getOrderId(), orderEntity.getFromCorpId(), orderEntity.getFromCorp()); warehouseMdService.updateUnit(orderEntity.getOrderId(), orderEntity.getFromCorpId(), orderEntity.getFromCorp());
return ResultVOUtils.success("添加成功"); return ResultVOUtils.success("添加成功");
} }
@ -304,21 +303,21 @@ public class OrderController {
List<PostUdimsOrderRequest.OrderBean> orderBeans = new ArrayList<>(); List<PostUdimsOrderRequest.OrderBean> orderBeans = new ArrayList<>();
UnitMaintainEntity unitMaintainEntity = null; UnitMaintainEntity unitMaintainEntity = null;
String orderId = orderUploadRequest.getOrderIds().get(0); String orderId = orderUploadRequest.getOrderIds().get(0);
OrderMdEntity orderMdEntity = orderMdService.findByOne(orderId); OrderEntity orderEntity = orderService.findByOne(orderId);
if (orderMdEntity != null) { if (orderEntity != null) {
unitMaintainEntity = unitMaintainService.selectByUnitId(orderMdEntity.getFromCorpId()); unitMaintainEntity = unitMaintainService.selectByUnitId(orderEntity.getFromCorpId());
if (unitMaintainEntity == null || unitMaintainEntity.getAppid() == null) { if (unitMaintainEntity == null || unitMaintainEntity.getAppid() == null) {
return ResultVOUtils.error(500, "该往来单位未绑定UDI自助平台"); return ResultVOUtils.error(500, "该往来单位未绑定UDI自助平台");
} }
if (!orderMdEntity.getAction().equals(unitMaintainEntity.getSourceAction())) { if (!orderEntity.getAction().equals(unitMaintainEntity.getSourceAction())) {
return ResultVOUtils.error(500, "该单据类型不支持提交!"); return ResultVOUtils.error(500, "该单据类型不支持提交!");
} }
PostUdimsOrderRequest.OrderBean orderBean = new PostUdimsOrderRequest.OrderBean(); PostUdimsOrderRequest.OrderBean orderBean = new PostUdimsOrderRequest.OrderBean();
BeanUtils.copyProperties(orderMdEntity, orderBean); BeanUtils.copyProperties(orderEntity, orderBean);
orderBean.setAction(unitMaintainEntity.getTargetAction()); orderBean.setAction(unitMaintainEntity.getTargetAction());
WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest(); WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest();
warehouseQueryRequest.setOrderId(orderMdEntity.getOrderId()); warehouseQueryRequest.setOrderId(orderEntity.getOrderId());
List<WarehouseEntity> warehouseEntities = warehouseMdService.filterWarehouse(warehouseQueryRequest); List<WarehouseMdEntity> warehouseEntities = warehouseMdService.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 -> {
@ -329,10 +328,10 @@ public class OrderController {
codeBeans.add(codeBean); codeBeans.add(codeBean);
}); });
//查询单据详情 //查询单据详情
FilterErpOrderRequest filterErpOrderRequest = new FilterErpOrderRequest(); FilterOrderDetailRequest filterOrderDetailRequest = new FilterOrderDetailRequest();
filterErpOrderRequest.setOrderId(orderBean.getOrderId()); filterOrderDetailRequest.setOrderId(orderBean.getOrderId());
//单据详情 //单据详情
List<OrderDetailEntity> erpOrderEntities = orderDetailMdService.filterOrderDetails(filterErpOrderRequest); List<OrderDetailEntity> erpOrderEntities = orderDetailService.filterOrderDetails(filterOrderDetailRequest);
if (CollUtil.isNotEmpty(erpOrderEntities)) { if (CollUtil.isNotEmpty(erpOrderEntities)) {
List<PostUdimsOrderDetailRequest> orderDetails = new ArrayList<>(); List<PostUdimsOrderDetailRequest> orderDetails = new ArrayList<>();
for (OrderDetailEntity orderDetailEntity : erpOrderEntities) { for (OrderDetailEntity orderDetailEntity : erpOrderEntities) {
@ -365,8 +364,8 @@ public class OrderController {
JSONObject.parseObject(response, new TypeReference<BaseResponse>() { JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
}); });
if (baseResponse.getCode() == 20000) { if (baseResponse.getCode() == 20000) {
orderMdEntity.setUploadStatus("1"); orderEntity.setUploadStatus("1");
orderMdService.updateOrder(orderMdEntity); orderService.updateOrder(orderEntity);
return baseResponse; return baseResponse;
} else { } else {
return ResultVOUtils.error(500, baseResponse.getMessage()); return ResultVOUtils.error(500, baseResponse.getMessage());
@ -376,13 +375,13 @@ public class OrderController {
} }
@GetMapping(value = "/warehouse/inout/order/detail") @GetMapping(value = "/warehouse/inout/order/detail")
public BaseResponse orderDetail(FilterErpOrderRequest filterErpOrderRequest, BindingResult bindingResult) { public BaseResponse orderDetail(FilterOrderDetailRequest filterOrderDetailRequest, 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());
} }
filterErpOrderRequest.setPage(1); filterOrderDetailRequest.setPage(1);
filterErpOrderRequest.setLimit(100); filterOrderDetailRequest.setLimit(100);
List<OrderDetailEntity> erpOrderEntities = orderDetailMdService.filterOrderDetails(filterErpOrderRequest); List<OrderDetailEntity> erpOrderEntities = orderDetailService.filterOrderDetails(filterOrderDetailRequest);
if (CollUtil.isNotEmpty(erpOrderEntities)) { if (CollUtil.isNotEmpty(erpOrderEntities)) {
erpOrderEntities.forEach(erpOrderEntity -> { erpOrderEntities.forEach(erpOrderEntity -> {
erpOrderEntity.setReCount(erpOrderEntity.getCount()); erpOrderEntity.setReCount(erpOrderEntity.getCount());
@ -402,7 +401,7 @@ public class OrderController {
@PostMapping("/warehouse/inout/order/detail/update") @PostMapping("/warehouse/inout/order/detail/update")
public BaseResponse updateStockOrderDetail(OrderDetailEntity orderDetailEntity) { public BaseResponse updateStockOrderDetail(OrderDetailEntity orderDetailEntity) {
if (null != orderDetailEntity) { if (null != orderDetailEntity) {
orderDetailMdService.updateOrderDetail(orderDetailEntity); orderDetailService.updateOrderDetail(orderDetailEntity);
} }
return ResultVOUtils.success("更新成功"); return ResultVOUtils.success("更新成功");
} }
@ -413,7 +412,7 @@ public class OrderController {
if (null == orderEditRequest || StrUtil.isBlank(orderEditRequest.getActDate()) || CollUtil.isEmpty(orderEditRequest.getOrderIds())) { if (null == orderEditRequest || StrUtil.isBlank(orderEditRequest.getActDate()) || CollUtil.isEmpty(orderEditRequest.getOrderIds())) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
} }
orderMdService.updateOrderInfo(orderEditRequest.getActDate(), orderEditRequest.getOrderIds()); orderService.updateOrderInfo(orderEditRequest.getActDate(), orderEditRequest.getOrderIds());
return ResultVOUtils.success(); return ResultVOUtils.success();
} }
@ -429,9 +428,9 @@ public class OrderController {
if (StrUtil.isBlank(orderId)) { if (StrUtil.isBlank(orderId)) {
return ResultVOUtils.error(ResultEnum.DATA_ERROR); return ResultVOUtils.error(ResultEnum.DATA_ERROR);
} }
OrderMdEntity orderMdEntity = orderMdService.findByOne(orderId); OrderEntity orderEntity = orderService.findByOne(orderId);
if (StrUtil.isEmpty(orderMdEntity.getSupplementNo())) { if (StrUtil.isEmpty(orderEntity.getSupplementNo())) {
return orderMdService.supplementOrder(orderMdEntity); return orderService.supplementOrder(orderEntity);
} else { } else {
return ResultVOUtils.error(500, "当前单据已补单,请勿重复补单"); return ResultVOUtils.error(500, "当前单据已补单,请勿重复补单");
} }
@ -449,8 +448,8 @@ public class OrderController {
if (StrUtil.isBlank(orderId)) { if (StrUtil.isBlank(orderId)) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
} }
List<OrderMdEntity> orderMdEntities = orderMdService.filterForDelete(orderId); List<OrderEntity> orderEntities = orderService.filterForDelete(orderId);
return ResultVOUtils.success(orderMdEntities); return ResultVOUtils.success(orderEntities);
} }
/** /**
@ -464,8 +463,8 @@ public class OrderController {
if (StrUtil.isBlank(id)) { if (StrUtil.isBlank(id)) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
} }
OrderMdEntity orderMdEntity = orderMdService.findById(id); OrderEntity orderEntity = orderService.findById(id);
return ResultVOUtils.success(orderMdEntity); return ResultVOUtils.success(orderEntity);
} }
/** /**
@ -477,7 +476,7 @@ public class OrderController {
@AuthRuleAnnotation("") @AuthRuleAnnotation("")
@PostMapping("/udiwms/stock/order/change") @PostMapping("/udiwms/stock/order/change")
public BaseResponse stockOrderChange(@RequestBody AddOrderChangeRequest addOrderChangeRequest) { public BaseResponse stockOrderChange(@RequestBody AddOrderChangeRequest addOrderChangeRequest) {
OrderMdEntity originOrder = orderMdService.findById(addOrderChangeRequest.getOrderId()); OrderEntity originOrder = orderService.findById(addOrderChangeRequest.getOrderId());
String oldOrderId = originOrder.getOrderId(); String oldOrderId = originOrder.getOrderId();
String replicateNo = originOrder.getReplicateNo(); //复制单号 String replicateNo = originOrder.getReplicateNo(); //复制单号
//查询条码 //查询条码
@ -528,10 +527,10 @@ public class OrderController {
} }
); );
originOrder.setUpdateTime(new Date()); originOrder.setUpdateTime(new Date());
originOrder.setId(null); originOrder.setOrderId(null);
orderMdService.insertOrder(originOrder); orderService.insertOrder(originOrder);
warehouseTempMdService.insertTempWarehouses(supplementCodes); warehouseTempMdService.insertTempWarehouses(supplementCodes);
orderMdService.updateReplicateNo(oldOrderId, replicateNo); orderService.updateReplicateNo(oldOrderId, replicateNo);
return ResultVOUtils.success(); return ResultVOUtils.success();
} }
@ -546,20 +545,20 @@ public class OrderController {
orderFilterRequest.setCustomerId(customerId); orderFilterRequest.setCustomerId(customerId);
BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(orderFilterRequest.getAction(), String.valueOf(customerId)); BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(orderFilterRequest.getAction(), String.valueOf(customerId));
if (StrUtil.isNotBlank(orderFilterRequest.getOrderId())) { if (StrUtil.isNotBlank(orderFilterRequest.getOrderId())) {
OrderMdEntity orderMdEntity = orderMdService.findByOne(orderFilterRequest.getOrderId()); OrderEntity orderEntity = orderService.findByOne(orderFilterRequest.getOrderId());
if (null == orderMdEntity || null == bussinessTypeEntity) { if (null == orderEntity || null == bussinessTypeEntity) {
return ResultVOUtils.error(500, "单据未找到!"); return ResultVOUtils.error(500, "单据未找到!");
} else if (!bussinessTypeEntity.getAction().equals(orderMdEntity.getAction())) { } else if (!bussinessTypeEntity.getAction().equals(orderEntity.getAction())) {
return ResultVOUtils.error(500, "非" + bussinessTypeEntity.getName() + "类型单据!"); return ResultVOUtils.error(500, "非" + bussinessTypeEntity.getName() + "类型单据!");
} else if (orderMdEntity.getReceiveStatus().equals(ConstantStatus.RECEIVE_ED)) { } else if (orderEntity.getReceiveStatus().equals(ConstantStatus.RECEIVE_ED)) {
return ResultVOUtils.error(500, "单据已验收"); return ResultVOUtils.error(500, "单据已验收");
} else { } else {
orderMdEntity.setId(orderMdEntity.getOrderId()); orderEntity.setOrderId(orderEntity.getOrderId());
orderMdEntity.setExportStatus(null); orderEntity.setExportStatus(null);
List<OrderMdEntity> orderMdEntities = Collections.singletonList(orderMdEntity); List<OrderEntity> orderEntities = Collections.singletonList(orderEntity);
PageSimpleResponse<OrderMdEntity> pageSimpleResponse = new PageSimpleResponse<>(); PageSimpleResponse<OrderEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal((long) orderMdEntities.size()); pageSimpleResponse.setTotal((long) orderEntities.size());
pageSimpleResponse.setList(orderMdEntities); pageSimpleResponse.setList(orderEntities);
return ResultVOUtils.success(pageSimpleResponse); return ResultVOUtils.success(pageSimpleResponse);
} }
} }
@ -572,16 +571,16 @@ public class OrderController {
List<String> invCodes = warehouseUserService.selectCodeByUserId(Long.valueOf(customerService.getUserId())); List<String> invCodes = warehouseUserService.selectCodeByUserId(Long.valueOf(customerService.getUserId()));
orderFilterRequest.setInvCodes(invCodes); orderFilterRequest.setInvCodes(invCodes);
orderFilterRequest.setAction(bussinessTypeEntity.getAction()); orderFilterRequest.setAction(bussinessTypeEntity.getAction());
PageResult<OrderMdEntity> pageResult = orderMdService.findByPage(orderFilterRequest); IPage<OrderEntity> page = orderService.filterList(orderFilterRequest);
if (pageResult.getTotal() > 0) { if (page.getTotal() > 0) {
pageResult.getList().forEach(orderMdEntity -> { page.getRecords().forEach(orderMdEntity -> {
orderMdEntity.setId(orderMdEntity.getOrderId()); orderMdEntity.setOrderId(orderMdEntity.getOrderId());
orderMdEntity.setExportStatus(null); orderMdEntity.setExportStatus(null);
}); });
} }
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);
} }
@ -593,11 +592,11 @@ 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 = orderMdService.findByOne(updateExportStatusRequest.getOrderId()); OrderMdEntity orderMdEntity = orderService.findByOne(updateExportStatusRequest.getOrderId());
orderMdEntity.setReceiveStatus(ConstantStatus.RECEIVE_ED); //验收状态修改为已验收 orderMdEntity.setReceiveStatus(ConstantStatus.RECEIVE_ED); //验收状态修改为已验收
orderMdEntity.setReviewUser(authAdmin.getId().intValue()); orderMdEntity.setReviewUser(authAdmin.getId().intValue());
orderMdEntity.setUpdateTime(new Date()); orderMdEntity.setUpdateTime(new Date());
orderMdService.updateOrder(orderMdEntity); orderService.updateOrder(orderMdEntity);
invProductsTrService.genInvProducts(orderMdEntity.getOrderId()); invProductsTrService.genInvProducts(orderMdEntity.getOrderId());
return ResultVOUtils.success("更新成功"); return ResultVOUtils.success("更新成功");
} }

@ -14,7 +14,7 @@ import com.glxp.udi.admin.entity.inventory.StockPrintTempEntity;
import com.glxp.udi.admin.entity.mongo.OrderMdEntity; import com.glxp.udi.admin.entity.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.OrderMdService; import com.glxp.udi.admin.mongo.service.OrderService;
import com.glxp.udi.admin.req.basic.FilterStockprintRequest; import com.glxp.udi.admin.req.basic.FilterStockprintRequest;
import com.glxp.udi.admin.req.inout.DeleteRequest; import com.glxp.udi.admin.req.inout.DeleteRequest;
import com.glxp.udi.admin.req.inout.StockQRCodeTextFilterRequest; import com.glxp.udi.admin.req.inout.StockQRCodeTextFilterRequest;
@ -80,7 +80,7 @@ public class StockQRCodeTextController {
@Resource @Resource
private JaspaperService jaspaperService; private JaspaperService jaspaperService;
@Resource @Resource
private OrderMdService orderMdService; private OrderService orderService;
@Resource @Resource
private CustomerService customerService; private CustomerService customerService;
@ -300,7 +300,7 @@ 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 = orderMdService.findByOne(inspectionPDFTemplateRequest.getOrderId()); OrderMdEntity orderMdEntity = orderService.findByOne(inspectionPDFTemplateRequest.getOrderId());
if (orderMdEntity == null) { if (orderMdEntity == null) {
return ResultVOUtils.error(ResultEnum.DATA_NOT, "未找到该订单"); return ResultVOUtils.error(ResultEnum.DATA_NOT, "未找到该订单");
} }
@ -330,7 +330,7 @@ public class StockQRCodeTextController {
return; return;
} }
/*打印订单*/ /*打印订单*/
List<StockOrderPrintEntity> list = orderMdService.listOrderPrint(stockQRCodeTextPDFTemplateRequest.getOrderId()); List<StockOrderPrintEntity> list = orderService.listOrderPrint(stockQRCodeTextPDFTemplateRequest.getOrderId());
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
SystemPDFModuleEntity systemPDFModuleEntity = systemPDFModuleService.selectById(stockQRCodeTextPDFTemplateRequest.getModuleId() + ""); SystemPDFModuleEntity systemPDFModuleEntity = systemPDFModuleService.selectById(stockQRCodeTextPDFTemplateRequest.getModuleId() + "");
SystemPDFTemplateRelevanceRequest systemPDFTemplateRelevanceRequest = new SystemPDFTemplateRelevanceRequest(); SystemPDFTemplateRelevanceRequest systemPDFTemplateRelevanceRequest = new SystemPDFTemplateRelevanceRequest();

@ -3,12 +3,11 @@ package com.glxp.udi.admin.controller.inout;
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.metadata.IPage; 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.annotation.AuthRuleAnnotation;
import com.glxp.udi.admin.common.res.BaseResponse; 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.InvProductMdService; import com.glxp.udi.admin.mongo.service.InvProductService;
import com.glxp.udi.admin.mongo.service.WarehouseMdService; import com.glxp.udi.admin.mongo.service.WarehouseMdService;
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;
@ -48,7 +47,7 @@ public class UdiRelevanceController {
@Resource @Resource
private UdiRelevanceService udiRelevanceService; private UdiRelevanceService udiRelevanceService;
@Resource @Resource
private InvProductMdService invProductMdService; private InvProductService invProductService;
@Resource @Resource
private WarehouseMdService warehouseMdService; private WarehouseMdService warehouseMdService;
@ -170,7 +169,7 @@ public class UdiRelevanceController {
} }
UdiInfoEntity udiInfoEntity = udiInfoService.findById(combineRequest.getRelId()); UdiInfoEntity udiInfoEntity = udiInfoService.findById(combineRequest.getRelId());
if (combineRequest.getIsDisable()) { if (combineRequest.getIsDisable()) {
Long count = invProductMdService.countByNamecode(udiInfoEntity.getNameCode(), authAdminService.getCurrentUserCustomerId()); Long count = invProductService.countByNamecode(udiInfoEntity.getNameCode(), authAdminService.getCurrentUserCustomerId());
if (null != count && count > 0) { if (null != count && count > 0) {
return ResultVOUtils.error(500, "库存已存在,无法禁用"); return ResultVOUtils.error(500, "库存已存在,无法禁用");
} }

@ -6,12 +6,13 @@ import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.glxp.udi.admin.common.res.BaseResponse; import com.glxp.udi.admin.common.res.BaseResponse;
import com.glxp.udi.admin.entity.inout.InvProductDetailEntity; 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.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.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.InvProductDetailMdService;
import com.glxp.udi.admin.mongo.service.OrderMdService; import com.glxp.udi.admin.mongo.service.OrderService;
import com.glxp.udi.admin.mongo.service.WarehouseMdService; import com.glxp.udi.admin.mongo.service.WarehouseMdService;
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;
@ -42,7 +43,7 @@ public class UdiTraceController {
@Resource @Resource
private AuthAdminService authAdminService; private AuthAdminService authAdminService;
@Resource @Resource
private OrderMdService orderMdService; private OrderService orderService;
@Resource @Resource
private InvProductDetailMdService invProductDetailMdService; private InvProductDetailMdService invProductDetailMdService;
@ -157,7 +158,7 @@ public class UdiTraceController {
return ResultVOUtils.success(pageSimpleResponse); return ResultVOUtils.success(pageSimpleResponse);
} }
public List<OrderMdEntity> filterUdiTrace(WarehouseQueryRequest warehouseQueryRequest) { public List<OrderEntity> filterUdiTrace(WarehouseQueryRequest warehouseQueryRequest) {
String code = warehouseQueryRequest.getCode(); String code = warehouseQueryRequest.getCode();
UdiEntity udiEntity = FilterUdiUtils.getUdi(code); UdiEntity udiEntity = FilterUdiUtils.getUdi(code);
List<InvProductDetailEntity> invProductDetailEntities; List<InvProductDetailEntity> invProductDetailEntities;
@ -204,7 +205,7 @@ public class UdiTraceController {
invProductDetailEntities = invProductDetailMdService.filterAllInvProduct(filterInvProductDetailRequest); invProductDetailEntities = invProductDetailMdService.filterAllInvProduct(filterInvProductDetailRequest);
} }
if (invProductDetailEntities != null && invProductDetailEntities.size() > 0) { if (invProductDetailEntities != null && invProductDetailEntities.size() > 0) {
List<OrderMdEntity> orderMdEntities = new ArrayList<>(); List<OrderEntity> orderEntities = new ArrayList<>();
List<String> orderS = new ArrayList<>(); List<String> orderS = new ArrayList<>();
invProductDetailEntities.stream().filter( invProductDetailEntities.stream().filter(
v -> { v -> {
@ -220,11 +221,11 @@ public class UdiTraceController {
for (String orderId : orderS) { for (String orderId : orderS) {
OrderFilterRequest orderFilterRequest = new OrderFilterRequest(); OrderFilterRequest orderFilterRequest = new OrderFilterRequest();
orderFilterRequest.setId(orderId); orderFilterRequest.setId(orderId);
List<OrderMdEntity> temps = orderMdService.findAll(orderFilterRequest); List<OrderEntity> temps = orderService.findAll(orderFilterRequest);
orderMdEntities.addAll(temps); orderEntities.addAll(temps);
} }
orderMdEntities.sort(Comparator.comparing(OrderMdEntity::getId)); orderEntities.sort(Comparator.comparing(OrderEntity::getOrderId));
return orderMdEntities; return orderEntities;
} else { } else {
return null; return null;
} }

@ -9,8 +9,10 @@ import com.glxp.udi.admin.constant.ConstantStatus;
import com.glxp.udi.admin.entity.auth.AuthAdmin; import com.glxp.udi.admin.entity.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.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.OrderMdService; import com.glxp.udi.admin.mongo.service.OrderService;
import com.glxp.udi.admin.mongo.service.WarehouseMdService; import com.glxp.udi.admin.mongo.service.WarehouseMdService;
import com.glxp.udi.admin.mongo.service.WarehouseTempMdService; import com.glxp.udi.admin.mongo.service.WarehouseTempMdService;
import com.glxp.udi.admin.mongo.utils.PageResult; import com.glxp.udi.admin.mongo.utils.PageResult;
@ -54,7 +56,7 @@ public class WareHouseController {
@Resource @Resource
private WarehouseTempMdService warehouseTempMdService; private WarehouseTempMdService warehouseTempMdService;
@Resource @Resource
private OrderMdService orderMdService; private OrderService orderService;
@Resource @Resource
private UdiInfoService udiInfoService; private UdiInfoService udiInfoService;
@ -71,8 +73,8 @@ public class WareHouseController {
@GetMapping("admin/warehouse/inout/findByOrderId") @GetMapping("admin/warehouse/inout/findByOrderId")
public BaseResponse findByOrderId(WarehouseQueryRequest warehouseQueryRequest) { public BaseResponse findByOrderId(WarehouseQueryRequest warehouseQueryRequest) {
PageResult<WarehouseEntity> pageResult = warehouseMdService.filterWarehouseByPage(warehouseQueryRequest); PageResult<WarehouseMdEntity> pageResult = warehouseMdService.filterWarehouseByPage(warehouseQueryRequest);
PageSimpleResponse<WarehouseEntity> pageSimpleResponse = new PageSimpleResponse<>(); PageSimpleResponse<WarehouseMdEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageResult.getTotal()); pageSimpleResponse.setTotal(pageResult.getTotal());
pageSimpleResponse.setList(pageResult.getList()); pageSimpleResponse.setList(pageResult.getList());
return ResultVOUtils.success(pageSimpleResponse); return ResultVOUtils.success(pageSimpleResponse);
@ -80,8 +82,8 @@ public class WareHouseController {
@GetMapping("admin/warehouse/inout/findErrorByOrderId") @GetMapping("admin/warehouse/inout/findErrorByOrderId")
public BaseResponse findErrorByOrderId(WarehouseQueryRequest warehouseQueryRequest) { public BaseResponse findErrorByOrderId(WarehouseQueryRequest warehouseQueryRequest) {
PageResult<WarehousetempEntity> pageResult = warehouseTempMdService.filterWarehouseByPage(warehouseQueryRequest); PageResult<WarehousetempMdEntity> pageResult = warehouseTempMdService.filterWarehouseByPage(warehouseQueryRequest);
PageSimpleResponse<WarehousetempEntity> pageSimpleResponse = new PageSimpleResponse<>(); PageSimpleResponse<WarehousetempMdEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageResult.getTotal()); pageSimpleResponse.setTotal(pageResult.getTotal());
pageSimpleResponse.setList(pageResult.getList()); pageSimpleResponse.setList(pageResult.getList());
return ResultVOUtils.success(pageSimpleResponse); return ResultVOUtils.success(pageSimpleResponse);
@ -90,7 +92,7 @@ public class WareHouseController {
@AuthRuleAnnotation("") @AuthRuleAnnotation("")
@GetMapping("warehouse/inout/deleteCodesTempById") @GetMapping("warehouse/inout/deleteCodesTempById")
public BaseResponse deleteCodesTempById(String id) { public BaseResponse deleteCodesTempById(String id) {
WarehousetempEntity warehousetemp = warehouseTempMdService.findTempById(id); WarehousetempMdEntity warehousetemp = warehouseTempMdService.findTempById(id);
if (null == warehousetemp) { if (null == warehousetemp) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
} }
@ -102,8 +104,8 @@ public class WareHouseController {
warehouseTempMdService.deleteTempWarehouses(Collections.singletonList(warehousetemp.getId())); warehouseTempMdService.deleteTempWarehouses(Collections.singletonList(warehousetemp.getId()));
} }
List<WarehousetempEntity> tempByOrderId = warehouseTempMdService.findTempByOrderId(warehousetemp.getOrderId()); List<WarehousetempMdEntity> tempByOrderId = warehouseTempMdService.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); warehouseTempMdService.deleteCode(deleteRequest);
@ -197,8 +199,8 @@ public class WareHouseController {
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());
} }
OrderMdEntity orderMdEntity = orderMdService.findByOne(commitRequest.getOrderId()); OrderEntity orderEntity = orderService.findByOne(commitRequest.getOrderId());
transInoutService.transInout(orderMdEntity); transInoutService.transInout(orderEntity);
return ResultVOUtils.success("提交成功"); return ResultVOUtils.success("提交成功");
} }
@ -216,9 +218,9 @@ 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 = orderMdService.findByOne(commitRequest.getOrderId()); OrderMdEntity orderEntity = orderService.findByOne(commitRequest.getOrderId());
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_WAIT); orderEntity.setStatus(ConstantStatus.ORDER_STATUS_WAIT);
orderMdService.updateOrder(orderEntity); orderService.updateOrder(orderEntity);
return ResultVOUtils.success("提交成功"); return ResultVOUtils.success("提交成功");
} }
@ -231,8 +233,8 @@ 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<WarehouseEntity> pageResult = warehouseMdService.findOrdersById(warehouseQueryRequest); PageResult<WarehouseMdEntity> pageResult = warehouseMdService.findOrdersById(warehouseQueryRequest);
PageSimpleResponse<WarehouseEntity> pageSimpleResponse = new PageSimpleResponse<>(); PageSimpleResponse<WarehouseMdEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageResult.getTotal()); pageSimpleResponse.setTotal(pageResult.getTotal());
pageSimpleResponse.setList(pageResult.getList()); pageSimpleResponse.setList(pageResult.getList());
return ResultVOUtils.success(pageSimpleResponse); return ResultVOUtils.success(pageSimpleResponse);

@ -8,7 +8,7 @@ import com.glxp.udi.admin.entity.auth.AuthAdmin;
import com.glxp.udi.admin.entity.inout.WarehouseBussinessTypeEntity; import com.glxp.udi.admin.entity.inout.WarehouseBussinessTypeEntity;
import com.glxp.udi.admin.entity.inventory.InvWarehouseEntity; import com.glxp.udi.admin.entity.inventory.InvWarehouseEntity;
import com.glxp.udi.admin.entity.param.SystemParamConfigEntity; import com.glxp.udi.admin.entity.param.SystemParamConfigEntity;
import com.glxp.udi.admin.mongo.service.InvProductMdService; import com.glxp.udi.admin.mongo.service.InvProductService;
import com.glxp.udi.admin.req.info.DeleteRequest; import com.glxp.udi.admin.req.info.DeleteRequest;
import com.glxp.udi.admin.req.inventory.FilterInvWarehouseRequest; import com.glxp.udi.admin.req.inventory.FilterInvWarehouseRequest;
import com.glxp.udi.admin.res.inventory.InvWarehouseExportResponse; import com.glxp.udi.admin.res.inventory.InvWarehouseExportResponse;
@ -47,7 +47,7 @@ public class InvWarehouseController {
@Resource @Resource
private WarehouseBussinessTypeService warehouseBussinessTypeService; private WarehouseBussinessTypeService warehouseBussinessTypeService;
@Resource @Resource
private InvProductMdService invProductMdService; private InvProductService invProductService;
@AuthRuleAnnotation("") @AuthRuleAnnotation("")
@GetMapping("spms/inv/warehouse/filter") @GetMapping("spms/inv/warehouse/filter")
@ -214,7 +214,7 @@ public class InvWarehouseController {
} }
InvWarehouseEntity invWarehouseEntity = invWarehouseService.selectById(deleteRequest.getId()); InvWarehouseEntity invWarehouseEntity = invWarehouseService.selectById(deleteRequest.getId());
boolean exist = invProductMdService.isExist(invWarehouseEntity.getCode()); boolean exist = invProductService.isExist(invWarehouseEntity.getCode());
if (exist) { if (exist) {
return ResultVOUtils.error(500, "该仓库已有库存,不能删除!"); return ResultVOUtils.error(500, "该仓库已有库存,不能删除!");
} }

@ -2,7 +2,11 @@ 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.OrderEntity; import com.glxp.udi.admin.entity.inout.OrderEntity;
import com.glxp.udi.admin.res.inout.OrderNoResult;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* *
@ -10,4 +14,27 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface OrderDao extends BaseMapper<OrderEntity> { public interface OrderDao extends BaseMapper<OrderEntity> {
/**
*
*
* @param actDate
* @param orderIds
*/
void updateActDate(@Param("actDate") String actDate, @Param("orderIds") List<String> orderIds);
/**
*
*
* @param orderId
* @return
*/
OrderNoResult selectNos(String orderId);
/**
*
*
* @param replicateNo
* @param orderId
*/
void updateReplicateNo(@Param("replicateNo") String replicateNo, @Param("orderId") String orderId);
} }

@ -1,13 +1,18 @@
package com.glxp.udi.admin.entity.inout; package com.glxp.udi.admin.entity.inout;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
@Data @Data
@TableName("io_inv_product_detail")
public class InvProductDetailEntity { public class InvProductDetailEntity {
@TableId(type = IdType.AUTO)
private String id; private String id;
/** /**

@ -1,10 +1,15 @@
package com.glxp.udi.admin.entity.inout; package com.glxp.udi.admin.entity.inout;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
@Data @Data
@TableName("io_inv_product")
public class InvProductEntity { public class InvProductEntity {
@TableId(type = IdType.AUTO)
private String id; private String id;
/** /**

@ -1,12 +1,17 @@
package com.glxp.udi.admin.entity.inout; package com.glxp.udi.admin.entity.inout;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
@Data @Data
@TableName("io_order_detail")
public class OrderDetailEntity { public class OrderDetailEntity {
@TableId(type = IdType.AUTO)
private String id; private String id;
/** /**

@ -3,16 +3,18 @@ package com.glxp.udi.admin.entity.inout;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
@Data @Data
@TableName("io_order")
public class OrderEntity { public class OrderEntity {
private String id; @TableId
private String orderId; private String orderId;
private String action; private String action;

@ -1,10 +1,15 @@
package com.glxp.udi.admin.entity.inout; package com.glxp.udi.admin.entity.inout;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
@Data @Data
@TableName("io_codes")
public class WarehouseEntity { public class WarehouseEntity {
@TableId(type = IdType.AUTO)
private String id; private String id;
/** /**

@ -1,10 +1,15 @@
package com.glxp.udi.admin.entity.inout; package com.glxp.udi.admin.entity.inout;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
@Data @Data
@TableName("io_codes_temp")
public class WarehousetempEntity { public class WarehousetempEntity {
@TableId(type = IdType.AUTO)
private String id; private String id;
/** /**

@ -6,7 +6,7 @@ import lombok.Data;
import java.util.Date; import java.util.Date;
@Data @Data
public class InvProductDetailEntity { public class InvProductDetailMdEntity {
private String id; private String id;
private String code; private String code;

@ -3,7 +3,7 @@ package com.glxp.udi.admin.entity.mongo;
import lombok.Data; import lombok.Data;
@Data @Data
public class InvProductEntity { public class InvProductMdEntity {
private String id; private String id;
private String productsName; private String productsName;

@ -3,7 +3,7 @@ package com.glxp.udi.admin.entity.mongo;
import lombok.Data; import lombok.Data;
@Data @Data
public class WarehouseEntity { public class WarehouseMdEntity {
private String id; private String id;
private String action; private String action;

@ -3,7 +3,7 @@ package com.glxp.udi.admin.entity.mongo;
import lombok.Data; import lombok.Data;
@Data @Data
public class WarehousetempEntity { public class WarehousetempMdEntity {
private String action; private String action;
private String mainAction; private String mainAction;

@ -3,6 +3,7 @@ package com.glxp.udi.admin.mongo.dao;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.ReflectUtil; import cn.hutool.core.util.ReflectUtil;
import com.glxp.udi.admin.entity.inout.WarehouseEntity; import com.glxp.udi.admin.entity.inout.WarehouseEntity;
import com.glxp.udi.admin.entity.mongo.WarehouseMdEntity;
import com.glxp.udi.admin.mongo.MongoDBName; import com.glxp.udi.admin.mongo.MongoDBName;
import com.glxp.udi.admin.mongo.dao.base.MongoBaseDao; import com.glxp.udi.admin.mongo.dao.base.MongoBaseDao;
import com.glxp.udi.admin.mongo.utils.MongoPageHelper; import com.glxp.udi.admin.mongo.utils.MongoPageHelper;
@ -20,7 +21,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
@Component @Component
public class CodesDao implements MongoBaseDao<WarehouseEntity, FilterWarehouseRequest> { public class CodesMdDao implements MongoBaseDao<WarehouseEntity, FilterWarehouseRequest> {
@Resource @Resource
private MongoTemplate mongoTemplate; private MongoTemplate mongoTemplate;
@ -142,5 +143,9 @@ public class CodesDao implements MongoBaseDao<WarehouseEntity, FilterWarehouseRe
return update; return update;
} }
public List<WarehouseMdEntity> getCodesList() {
List<WarehouseMdEntity> all = mongoTemplate.findAll(WarehouseMdEntity.class, MongoDBName.NAME_ORDER);
return all;
}
} }

@ -3,6 +3,7 @@ package com.glxp.udi.admin.mongo.dao;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.ReflectUtil; import cn.hutool.core.util.ReflectUtil;
import com.glxp.udi.admin.entity.inout.WarehousetempEntity; import com.glxp.udi.admin.entity.inout.WarehousetempEntity;
import com.glxp.udi.admin.entity.mongo.WarehousetempMdEntity;
import com.glxp.udi.admin.mongo.MongoDBName; import com.glxp.udi.admin.mongo.MongoDBName;
import com.glxp.udi.admin.mongo.dao.base.MongoBaseDao; import com.glxp.udi.admin.mongo.dao.base.MongoBaseDao;
import com.glxp.udi.admin.mongo.utils.MongoPageHelper; import com.glxp.udi.admin.mongo.utils.MongoPageHelper;
@ -20,7 +21,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
@Component @Component
public class CodesTempDao implements MongoBaseDao<WarehousetempEntity, FilterWarehouseRequest> { public class CodesTempMdDao implements MongoBaseDao<WarehousetempEntity, FilterWarehouseRequest> {
@Resource @Resource
private MongoTemplate mongoTemplate; private MongoTemplate mongoTemplate;
@ -141,4 +142,8 @@ public class CodesTempDao implements MongoBaseDao<WarehousetempEntity, FilterWar
return update; return update;
} }
public List<WarehousetempMdEntity> getCodesTempList() {
return mongoTemplate.findAll(WarehousetempMdEntity.class, MongoDBName.NAME_CODE_TEMP);
}
} }

@ -3,6 +3,7 @@ package com.glxp.udi.admin.mongo.dao;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.ReflectUtil; import cn.hutool.core.util.ReflectUtil;
import com.glxp.udi.admin.entity.inout.InvProductDetailEntity; import com.glxp.udi.admin.entity.inout.InvProductDetailEntity;
import com.glxp.udi.admin.entity.mongo.InvProductDetailMdEntity;
import com.glxp.udi.admin.mongo.MongoDBName; import com.glxp.udi.admin.mongo.MongoDBName;
import com.glxp.udi.admin.mongo.dao.base.MongoBaseDao; import com.glxp.udi.admin.mongo.dao.base.MongoBaseDao;
import com.glxp.udi.admin.mongo.utils.MongoPageHelper; import com.glxp.udi.admin.mongo.utils.MongoPageHelper;
@ -20,7 +21,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
@Component @Component
public class InvProductDetailDao implements MongoBaseDao<InvProductDetailEntity, FilterInvProductDetailRequest> { public class InvProductDetailMdDao implements MongoBaseDao<InvProductDetailEntity, FilterInvProductDetailRequest> {
@Resource @Resource
private MongoTemplate mongoTemplate; private MongoTemplate mongoTemplate;
@ -152,5 +153,10 @@ public class InvProductDetailDao implements MongoBaseDao<InvProductDetailEntity,
return update; return update;
} }
public List<InvProductDetailMdEntity> getInvDetailList(String invProductId) {
Query query = new Query();
query.addCriteria(Criteria.where("invProductIdFk").is(invProductId));
return mongoTemplate.find(query, InvProductDetailMdEntity.class, MongoDBName.NAME_INV_PRODUCT_DETAIL);
}
} }

@ -3,6 +3,7 @@ package com.glxp.udi.admin.mongo.dao;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.ReflectUtil; import cn.hutool.core.util.ReflectUtil;
import com.glxp.udi.admin.entity.inout.InvProductEntity; import com.glxp.udi.admin.entity.inout.InvProductEntity;
import com.glxp.udi.admin.entity.mongo.InvProductMdEntity;
import com.glxp.udi.admin.mongo.MongoDBName; import com.glxp.udi.admin.mongo.MongoDBName;
import com.glxp.udi.admin.mongo.dao.base.MongoBaseDao; import com.glxp.udi.admin.mongo.dao.base.MongoBaseDao;
import com.glxp.udi.admin.mongo.utils.MongoPageHelper; import com.glxp.udi.admin.mongo.utils.MongoPageHelper;
@ -21,7 +22,7 @@ import java.util.List;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@Component @Component
public class InvProductDao implements MongoBaseDao<InvProductEntity, FilterInvProductRequest> { public class InvProductMdDao implements MongoBaseDao<InvProductEntity, FilterInvProductRequest> {
@Resource @Resource
private MongoTemplate mongoTemplate; private MongoTemplate mongoTemplate;
@ -179,4 +180,8 @@ public class InvProductDao implements MongoBaseDao<InvProductEntity, FilterInvPr
return update; return update;
} }
public List<InvProductMdEntity> getInvList() {
return mongoTemplate.findAll(InvProductMdEntity.class, MongoDBName.NAME_INV_PRODUCT);
}
} }

@ -3,11 +3,12 @@ package com.glxp.udi.admin.mongo.dao;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.ReflectUtil; import cn.hutool.core.util.ReflectUtil;
import com.glxp.udi.admin.entity.inout.OrderDetailEntity; import com.glxp.udi.admin.entity.inout.OrderDetailEntity;
import com.glxp.udi.admin.entity.mongo.ErpOrderEntity;
import com.glxp.udi.admin.mongo.MongoDBName; import com.glxp.udi.admin.mongo.MongoDBName;
import com.glxp.udi.admin.mongo.dao.base.MongoBaseDao; import com.glxp.udi.admin.mongo.dao.base.MongoBaseDao;
import com.glxp.udi.admin.mongo.utils.MongoPageHelper; import com.glxp.udi.admin.mongo.utils.MongoPageHelper;
import com.glxp.udi.admin.mongo.utils.PageResult; import com.glxp.udi.admin.mongo.utils.PageResult;
import com.glxp.udi.admin.req.inout.FilterErpOrderRequest; import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest;
import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Query;
@ -20,7 +21,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
@Component @Component
public class OrderDetailDao implements MongoBaseDao<OrderDetailEntity, FilterErpOrderRequest> { public class OrderDetailMdDao implements MongoBaseDao<OrderDetailEntity, FilterOrderDetailRequest> {
@Resource @Resource
private MongoTemplate mongoTemplate; private MongoTemplate mongoTemplate;
@ -29,25 +30,25 @@ public class OrderDetailDao implements MongoBaseDao<OrderDetailEntity, FilterErp
@Override @Override
public PageResult<OrderDetailEntity> pageQuery(Query query, FilterErpOrderRequest filterErpOrderRequest, int page, int size) { public PageResult<OrderDetailEntity> pageQuery(Query query, FilterOrderDetailRequest filterOrderDetailRequest, int page, int size) {
if (null == query && null != filterErpOrderRequest) { if (null == query && null != filterOrderDetailRequest) {
query = buildQuery(filterErpOrderRequest); query = buildQuery(filterOrderDetailRequest);
} }
return mongoPageHelper.pageQuery(query, OrderDetailEntity.class, size, page, MongoDBName.NAME_ORDER_DETAIL); return mongoPageHelper.pageQuery(query, OrderDetailEntity.class, size, page, MongoDBName.NAME_ORDER_DETAIL);
} }
@Override @Override
public List<OrderDetailEntity> findList(Query query, FilterErpOrderRequest filterErpOrderRequest) { public List<OrderDetailEntity> findList(Query query, FilterOrderDetailRequest filterOrderDetailRequest) {
if (null == query && null != filterErpOrderRequest) { if (null == query && null != filterOrderDetailRequest) {
query = buildQuery(filterErpOrderRequest); query = buildQuery(filterOrderDetailRequest);
} }
return mongoTemplate.find(query, OrderDetailEntity.class, MongoDBName.NAME_ORDER_DETAIL); return mongoTemplate.find(query, OrderDetailEntity.class, MongoDBName.NAME_ORDER_DETAIL);
} }
@Override @Override
public OrderDetailEntity findOne(Query query, FilterErpOrderRequest filterErpOrderRequest) { public OrderDetailEntity findOne(Query query, FilterOrderDetailRequest filterOrderDetailRequest) {
if (null == query && null != filterErpOrderRequest) { if (null == query && null != filterOrderDetailRequest) {
query = buildQuery(filterErpOrderRequest); query = buildQuery(filterOrderDetailRequest);
} }
return mongoTemplate.findOne(query, OrderDetailEntity.class, MongoDBName.NAME_ORDER_DETAIL); return mongoTemplate.findOne(query, OrderDetailEntity.class, MongoDBName.NAME_ORDER_DETAIL);
} }
@ -64,17 +65,17 @@ public class OrderDetailDao implements MongoBaseDao<OrderDetailEntity, FilterErp
} }
@Override @Override
public void delete(Query query, FilterErpOrderRequest filterErpOrderRequest) { public void delete(Query query, FilterOrderDetailRequest filterOrderDetailRequest) {
if (null == query) { if (null == query) {
query = buildQuery(filterErpOrderRequest); query = buildQuery(filterOrderDetailRequest);
} }
mongoTemplate.remove(query, OrderDetailEntity.class, MongoDBName.NAME_ORDER_DETAIL); mongoTemplate.remove(query, OrderDetailEntity.class, MongoDBName.NAME_ORDER_DETAIL);
} }
@Override @Override
public long count(Query query, FilterErpOrderRequest filterErpOrderRequest) { public long count(Query query, FilterOrderDetailRequest filterOrderDetailRequest) {
if (null == query) { if (null == query) {
query = buildQuery(filterErpOrderRequest); query = buildQuery(filterOrderDetailRequest);
} }
return mongoTemplate.count(query, OrderDetailEntity.class, MongoDBName.NAME_ORDER_DETAIL); return mongoTemplate.count(query, OrderDetailEntity.class, MongoDBName.NAME_ORDER_DETAIL);
} }
@ -93,14 +94,14 @@ public class OrderDetailDao implements MongoBaseDao<OrderDetailEntity, FilterErp
/** /**
* mongodb * mongodb
* *
* @param filterErpOrderRequest * @param filterOrderDetailRequest
* @return * @return
*/ */
private Query buildQuery(FilterErpOrderRequest filterErpOrderRequest) { private Query buildQuery(FilterOrderDetailRequest filterOrderDetailRequest) {
Query query = new Query(); Query query = new Query();
Field[] fields = ReflectUtil.getFields(FilterErpOrderRequest.class); Field[] fields = ReflectUtil.getFields(FilterOrderDetailRequest.class);
Arrays.stream(fields).forEach(field -> { Arrays.stream(fields).forEach(field -> {
Object fieldValue = ReflectUtil.getFieldValue(filterErpOrderRequest, field); Object fieldValue = ReflectUtil.getFieldValue(filterOrderDetailRequest, field);
if (ObjectUtil.isNotEmpty(fieldValue)) { if (ObjectUtil.isNotEmpty(fieldValue)) {
if ("orderId".equals(field.getName())) { if ("orderId".equals(field.getName())) {
query.addCriteria(Criteria.where("orderIdFk").is(fieldValue)); query.addCriteria(Criteria.where("orderIdFk").is(fieldValue));
@ -154,4 +155,8 @@ public class OrderDetailDao implements MongoBaseDao<OrderDetailEntity, FilterErp
return update; return update;
} }
public List<ErpOrderEntity> getOrderDetailList() {
return mongoTemplate.findAll(ErpOrderEntity.class, MongoDBName.NAME_ORDER_DETAIL);
}
} }

@ -23,7 +23,7 @@ import java.util.List;
* *
*/ */
@Component @Component
public class OrderDao implements MongoBaseDao<OrderMdEntity, OrderFilterRequest> { public class OrderMdDao implements MongoBaseDao<OrderMdEntity, OrderFilterRequest> {
@Resource @Resource
private MongoTemplate mongoTemplate; private MongoTemplate mongoTemplate;
@ -177,4 +177,10 @@ public class OrderDao implements MongoBaseDao<OrderMdEntity, OrderFilterRequest>
} }
return update; return update;
} }
public List<OrderMdEntity> getOrderList() {
return mongoTemplate.findAll(OrderMdEntity.class, MongoDBName.NAME_ORDER);
}
} }

@ -18,7 +18,7 @@ import java.util.List;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@Service @Service
public class InvProductMdService { public class InvProductService {
@Resource @Resource
private MongoTemplate mongoTemplate; private MongoTemplate mongoTemplate;

@ -1,93 +0,0 @@
package com.glxp.udi.admin.mongo.service;
import cn.hutool.core.util.StrUtil;
import com.glxp.udi.admin.entity.inout.OrderDetailEntity;
import com.glxp.udi.admin.mongo.MongoDBName;
import com.glxp.udi.admin.req.inout.DeleteRequest;
import com.glxp.udi.admin.req.inout.FilterErpOrderRequest;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@Service
public class OrderDetailMdService {
@Resource
private MongoTemplate mongoTemplate;
public List<OrderDetailEntity> filterOrderDetails(FilterErpOrderRequest filterErpOrderRequest) {
Query query = new Query();
if (filterErpOrderRequest.getOrderId() != null && !filterErpOrderRequest.getOrderId().isEmpty()) {
query.addCriteria(Criteria.where("orderIdFk").is(filterErpOrderRequest.getOrderId()));
}
if (StrUtil.isNotBlank(filterErpOrderRequest.getOrderIdFk())) {
query.addCriteria(Criteria.where("orderIdFk").is(filterErpOrderRequest.getOrderIdFk()));
}
if (filterErpOrderRequest.getCustomerId() != null) {
query.addCriteria(Criteria.where("customerId").is(filterErpOrderRequest.getCustomerId()));
}
if (StrUtil.isNotBlank(filterErpOrderRequest.getUuidFk())) {
query.addCriteria(Criteria.where("uuidFk").is(filterErpOrderRequest.getUuidFk()));
}
if (StrUtil.isNotBlank(filterErpOrderRequest.getLotno())) {
query.addCriteria(Criteria.where("lotno").is(filterErpOrderRequest.getLotno()));
}
return mongoTemplate.find(query, OrderDetailEntity.class, MongoDBName.NAME_ORDER_DETAIL);
}
public void insertOrderDetail(List<OrderDetailEntity> erpOrderEntities) {
if (erpOrderEntities != null) {
Collection<OrderDetailEntity> warehouseEntityCollection = new ArrayList<>();
warehouseEntityCollection.addAll(erpOrderEntities);
mongoTemplate.insert(warehouseEntityCollection, MongoDBName.NAME_ORDER_DETAIL);
}
}
public void deleteOrderDetail(DeleteRequest deleteRequest) {
Query query = new Query();
if (deleteRequest.getId() != null) {
query.addCriteria(Criteria.where("id").is(deleteRequest.getId()));
}
if (deleteRequest.getOrderId() != null) {
query.addCriteria(Criteria.where("orderIdFk").is(deleteRequest.getOrderId()));
}
mongoTemplate.remove(query, OrderDetailEntity.class, MongoDBName.NAME_ORDER_DETAIL);
}
public void updateOrderDetail(OrderDetailEntity orderDetailEntity) {
Query query = new Query();
query.addCriteria(new Criteria().and("_id").is(orderDetailEntity.getId()));
Update update = new Update();
if (orderDetailEntity.getCount() != null) {
update.set("count", orderDetailEntity.getCount());
}
if (orderDetailEntity.getReCount() != null) {
update.set("reCount", orderDetailEntity.getReCount());
}
//更新发票号等字段
update.set("firstSalesInvNo", orderDetailEntity.getFirstSalesInvNo());
update.set("secSalesInvNo", orderDetailEntity.getSecSalesInvNo());
update.set("secSalesListNo", orderDetailEntity.getSecSalesListNo());
update.set("invoiceDate", orderDetailEntity.getInvoiceDate());
if (null != orderDetailEntity.getPrice()) {
update.set("price", orderDetailEntity.getPrice());
}
mongoTemplate.updateMulti(query, update, MongoDBName.NAME_ORDER_DETAIL);
}
public long statCount(String orderId) {
Query query = new Query();
query.addCriteria(Criteria.where("orderIdFk").is(orderId));
return mongoTemplate.count(query, MongoDBName.NAME_ORDER_DETAIL);
}
}

@ -0,0 +1,70 @@
package com.glxp.udi.admin.mongo.service;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.glxp.udi.admin.dao.inout.OrderDetailDao;
import com.glxp.udi.admin.entity.inout.OrderDetailEntity;
import com.glxp.udi.admin.req.inout.DeleteRequest;
import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class OrderDetailService {
@Resource
private MongoTemplate mongoTemplate;
@Resource
private OrderDetailDao orderDetailDao;
public List<OrderDetailEntity> filterOrderDetails(FilterOrderDetailRequest orderDetailRequest) {
QueryWrapper<OrderDetailEntity> wrapper = buildDetailQueryWrapper(orderDetailRequest);
return orderDetailDao.selectList(wrapper);
}
public void insertOrderDetail(List<OrderDetailEntity> orderDetailEntities) {
if (CollUtil.isNotEmpty(orderDetailEntities)) {
for (OrderDetailEntity orderDetailEntity : orderDetailEntities) {
orderDetailDao.insert(orderDetailEntity);
}
}
}
public void deleteOrderDetail(DeleteRequest deleteRequest) {
QueryWrapper<OrderDetailEntity> deleteWrapper = new QueryWrapper<>();
deleteWrapper.eq(StrUtil.isNotBlank(deleteRequest.getId()), "id", deleteRequest.getId())
.eq(StrUtil.isNotBlank(deleteRequest.getOrderId()), "orderIdFk", deleteRequest.getOrderId());
orderDetailDao.delete(deleteWrapper);
}
public void updateOrderDetail(OrderDetailEntity orderDetailEntity) {
orderDetailDao.updateById(orderDetailEntity);
}
public long statCount(String orderId) {
QueryWrapper<OrderDetailEntity> wrapper = new QueryWrapper<>();
wrapper.eq("orderIdFk", orderId);
return orderDetailDao.selectCount(wrapper);
}
/**
*
*
* @param orderDetailRequest
* @return
*/
private static QueryWrapper<OrderDetailEntity> buildDetailQueryWrapper(FilterOrderDetailRequest orderDetailRequest) {
QueryWrapper<OrderDetailEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StrUtil.isNotBlank(orderDetailRequest.getOrderId()), "orderIdFk", orderDetailRequest.getOrderId())
.eq(StrUtil.isNotBlank(orderDetailRequest.getOrderIdFk()), "orderIdFk", orderDetailRequest.getOrderIdFk())
.eq(null != orderDetailRequest.getCustomerId(), "customerId", orderDetailRequest.getCustomerId())
.eq(StrUtil.isNotBlank(orderDetailRequest.getUuidFk()), "uuidFk", orderDetailRequest.getUuidFk())
.eq(StrUtil.isNotBlank(orderDetailRequest.getLotno()), "batchNo", orderDetailRequest.getLotno());
return wrapper;
}
}

@ -4,12 +4,16 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ReflectUtil; import cn.hutool.core.util.ReflectUtil;
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.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.constant.ConstantType; import com.glxp.udi.admin.constant.ConstantType;
import com.glxp.udi.admin.constant.SystemParamConstant; import com.glxp.udi.admin.constant.SystemParamConstant;
import com.glxp.udi.admin.dao.auth.CustomerInfoDao; import com.glxp.udi.admin.dao.auth.CustomerInfoDao;
import com.glxp.udi.admin.dao.basic.BussinessTypeDao; import com.glxp.udi.admin.dao.basic.BussinessTypeDao;
import com.glxp.udi.admin.dao.inout.OrderDao;
import com.glxp.udi.admin.dao.inout.UdiInfoDao; import com.glxp.udi.admin.dao.inout.UdiInfoDao;
import com.glxp.udi.admin.dao.inout.UnitMaintainDao; import com.glxp.udi.admin.dao.inout.UnitMaintainDao;
import com.glxp.udi.admin.dao.inventory.InvWarehouseDao; import com.glxp.udi.admin.dao.inventory.InvWarehouseDao;
@ -17,19 +21,18 @@ import com.glxp.udi.admin.entity.auth.CustomerInfoEntity;
import com.glxp.udi.admin.entity.basic.BussinessTypeEntity; import com.glxp.udi.admin.entity.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.OrderDao; import com.glxp.udi.admin.mongo.dao.OrderMdDao;
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.DeleteRequest;
import com.glxp.udi.admin.req.inout.FilterErpOrderRequest; import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest;
import com.glxp.udi.admin.req.inout.OrderFilterRequest; import com.glxp.udi.admin.req.inout.OrderFilterRequest;
import com.glxp.udi.admin.req.inventory.FilterInvProductRequest; import com.glxp.udi.admin.req.inventory.FilterInvProductRequest;
import com.glxp.udi.admin.res.inout.OrderNoResult; import com.glxp.udi.admin.res.inout.OrderNoResult;
import com.glxp.udi.admin.service.param.SystemParamConfigService; import com.glxp.udi.admin.service.param.SystemParamConfigService;
import com.glxp.udi.admin.util.CustomUtil; import com.glxp.udi.admin.util.CustomUtil;
import com.glxp.udi.admin.util.DateUtil;
import com.glxp.udi.common.util.ResultVOUtils; import com.glxp.udi.common.util.ResultVOUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
@ -46,7 +49,7 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
@Service @Service
public class OrderMdService { public class OrderService {
@Lazy @Lazy
@Resource @Resource
@ -59,7 +62,7 @@ public class OrderMdService {
private WarehouseTempMdService warehouseTempMdService; private WarehouseTempMdService warehouseTempMdService;
@Lazy @Lazy
@Resource @Resource
private OrderDetailMdService orderDetailMdService; private OrderDetailService orderDetailService;
@Resource @Resource
private CustomerInfoDao customerInfoDao; private CustomerInfoDao customerInfoDao;
@ -72,108 +75,70 @@ public class OrderMdService {
@Resource @Resource
private MongoTemplate mongoTemplate; private MongoTemplate mongoTemplate;
@Resource @Resource
private MongoPageHelper mongoPageHelper;
@Resource
private BussinessTypeDao bussinessTypeDao; private BussinessTypeDao bussinessTypeDao;
@Resource @Resource
private OrderMdDao orderMdDao;
@Resource
private OrderDao orderDao; private OrderDao orderDao;
public PageResult<OrderMdEntity> filterList(OrderFilterRequest orderFilterRequest) { public IPage<OrderEntity> filterList(OrderFilterRequest orderFilterRequest) {
return orderDao.pageQuery(null, orderFilterRequest, orderFilterRequest.getPage(), orderFilterRequest.getLimit()); IPage<OrderEntity> page = new Page<>(orderFilterRequest.getPage(), orderFilterRequest.getLimit());
QueryWrapper<OrderEntity> wrapper = buildQueryWrapper(orderFilterRequest);
return orderDao.selectPage(page, wrapper);
} }
/**
*
*
* @param orderFilterRequest
* @return
*/
private static QueryWrapper<OrderEntity> buildQueryWrapper(OrderFilterRequest orderFilterRequest) {
QueryWrapper<OrderEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StrUtil.isNotBlank(orderFilterRequest.getId()), "orderId", orderFilterRequest.getId())
.in(CollUtil.isNotEmpty(orderFilterRequest.getInvCodes()), "locStorageCode", orderFilterRequest.getInvCodes())
.le(StrUtil.isNotBlank(orderFilterRequest.getStartTime()), "actDate", orderFilterRequest.getStartTime())
.ge(StrUtil.isNotBlank(orderFilterRequest.getEndTime()), "actDate", orderFilterRequest.getEndTime())
.eq(StrUtil.isNotBlank(orderFilterRequest.getIsError()), "status", orderFilterRequest.getStatus())
.eq(StrUtil.isNotBlank(orderFilterRequest.getAction()), "action", orderFilterRequest.getAction())
.ne(StrUtil.isBlank(orderFilterRequest.getAction()), "action", orderFilterRequest.getAction())
.eq(StrUtil.isNotBlank(orderFilterRequest.getOrderId()), "orderId", orderFilterRequest.getOrderId())
.eq(StrUtil.isNotBlank(orderFilterRequest.getMainAction()), "mainAction", orderFilterRequest.getMainAction())
.eq(null != orderFilterRequest.getStatus(), "status", orderFilterRequest.getStatus())
.eq(StrUtil.isNotBlank(orderFilterRequest.getExportStatus()), "exportStatus", orderFilterRequest.getExportStatus())
.eq(null != orderFilterRequest.getCustomerId(), "customerId", orderFilterRequest.getCustomerId())
.eq(StrUtil.isNotBlank(orderFilterRequest.getCorpOrderId()), "corpOrderId", orderFilterRequest.getCorpOrderId())
.eq(null != orderFilterRequest.getReceiveStatus(), "receiveStatus", orderFilterRequest.getReceiveStatus());
return wrapper;
}
public OrderMdEntity findByOne(String orderId) { public OrderEntity findByOne(String orderId) {
OrderFilterRequest orderFilterRequest = new OrderFilterRequest(); OrderFilterRequest orderFilterRequest = new OrderFilterRequest();
orderFilterRequest.setId(orderId); orderFilterRequest.setId(orderId);
List<OrderMdEntity> orderMdEntities = findAll(orderFilterRequest); List<OrderEntity> orderMdEntities = findAll(orderFilterRequest);
if (orderMdEntities != null && orderMdEntities.size() > 0) { if (orderMdEntities != null && orderMdEntities.size() > 0) {
return orderMdEntities.get(0); return orderMdEntities.get(0);
} }
return null; return null;
} }
public List<OrderMdEntity> findAll(OrderFilterRequest orderFilterRequest) { public List<OrderEntity> findAll(OrderFilterRequest orderFilterRequest) {
Query query = new Query(); QueryWrapper<OrderEntity> wrapper = buildQueryWrapper(orderFilterRequest);
if (orderFilterRequest.getId() != null && !orderFilterRequest.getId().isEmpty()) { return orderDao.selectList(wrapper);
query.addCriteria(Criteria.where("orderId").is(orderFilterRequest.getId()));
}
if (orderFilterRequest.getMainAction() != null && !orderFilterRequest.getMainAction().isEmpty()) {
query.addCriteria(Criteria.where("mainAction").is(orderFilterRequest.getMainAction()));
}
if (orderFilterRequest.getAction() != null && !orderFilterRequest.getAction().isEmpty()) {
query.addCriteria(Criteria.where("action").is(orderFilterRequest.getAction()));
}
if (orderFilterRequest.getAction() == null || orderFilterRequest.getAction().isEmpty()) {
query.addCriteria(Criteria.where("action").ne("StockCheck"));
}
if (null != orderFilterRequest.getStatus()) {
query.addCriteria(Criteria.where("status").is(orderFilterRequest.getStatus()));
}
if (orderFilterRequest.getExportStatus() != null && !orderFilterRequest.getExportStatus().isEmpty()) {
query.addCriteria(Criteria.where("exportStatus").is(orderFilterRequest.getExportStatus()));
}
if (StrUtil.isNotBlank(orderFilterRequest.getCorpOrderId())) {
query.addCriteria(Criteria.where("corpOrderId").is(orderFilterRequest.getCorpOrderId()));
}
if (orderFilterRequest.getCustomerId() != null) {
if (orderFilterRequest.getStartTime() != null && !orderFilterRequest.getStartTime().isEmpty()
&& orderFilterRequest.getEndTime() != null && !orderFilterRequest.getEndTime().isEmpty()) {
Date sdate, edate = null;
if (orderFilterRequest.getStartTime().contains("T")) {
sdate = DateUtil.convertTimeFormat(orderFilterRequest.getStartTime());
} else {
sdate = DateUtil.parseDate(orderFilterRequest.getStartTime());
}
if (orderFilterRequest.getEndTime().contains("T")) {
edate = DateUtil.convertTimeFormat(orderFilterRequest.getEndTime());
} else {
edate = DateUtil.parseDate(orderFilterRequest.getEndTime());
}
query.addCriteria(Criteria.where("customerId").is(orderFilterRequest.getCustomerId()).andOperator(Criteria.where("actDate").gte(DateUtil.dateToISODate(sdate)
), Criteria.where("actDate").lt(DateUtil.dateToISODate(edate))));
} else {
query.addCriteria(Criteria.where("customerId").is(orderFilterRequest.getCustomerId()));
}
}
if (orderFilterRequest.getIsError() != null) {
query.addCriteria(Criteria.where("status").ne(orderFilterRequest.getIsError()));
}
if (orderFilterRequest.getReceiveStatus() != null) {
query.addCriteria(Criteria.where("receiveStatus").is(orderFilterRequest.getReceiveStatus()));
}
return mongoTemplate.find(query, OrderMdEntity.class, MongoDBName.NAME_ORDER);
} }
public void updateOrder(OrderMdEntity orderMdEntity) { public void updateOrder(OrderEntity orderEntity) {
Query query = new Query(); orderDao.updateById(orderEntity);
if (orderMdEntity.getOrderId() != null && !orderMdEntity.getOrderId().isEmpty()) {
query.addCriteria(new Criteria().and("orderId").is(orderMdEntity.getOrderId()));
} else if (orderMdEntity.getId() != null && !orderMdEntity.getId().isEmpty()) {
query.addCriteria(new Criteria().and("_id").is(orderMdEntity.getId()));
} else {
log.error("更新失败未指定orderId");
return;
}
orderDao.update(query, null, orderMdEntity);
} }
public void deleteOrder(DeleteRequest deleteRequest) { public void deleteOrder(DeleteRequest deleteRequest) {
Query query = new Query(); String orderId = StrUtil.isBlank(deleteRequest.getId()) ? deleteRequest.getOrderId() : deleteRequest.getId();
if (deleteRequest.getId() != null) { orderDao.deleteById(orderId);
query.addCriteria(Criteria.where("id").is(deleteRequest.getId()));
}
if (deleteRequest.getOrderId() != null) {
query.addCriteria(Criteria.where("orderId").is(deleteRequest.getOrderId()));
}
orderDao.delete(query, null);
} }
public void insertOrder(OrderMdEntity orderMdEntity) { public void insertOrder(OrderEntity orderEntity) {
orderDao.insert(orderMdEntity); orderDao.insert(orderEntity);
} }
/** /**
@ -183,10 +148,10 @@ public class OrderMdService {
* @return * @return
*/ */
public long countByAction(String action) { public long countByAction(String action) {
Query query = new Query();
if (StrUtil.isNotBlank(action)) { if (StrUtil.isNotBlank(action)) {
query.addCriteria(Criteria.where("action").is(action)); QueryWrapper<OrderEntity> wrapper = new QueryWrapper<>();
return orderDao.count(query, null); wrapper.eq(StrUtil.isNotBlank(action), "action", action);
orderDao.selectCount(wrapper);
} }
return 0; return 0;
} }
@ -194,22 +159,22 @@ public class OrderMdService {
/** /**
* *
* *
* @param orderMdEntity * @param orderEntity
* @return * @return
*/ */
public BaseResponse supplementOrder(OrderMdEntity orderMdEntity) { public BaseResponse supplementOrder(OrderEntity orderEntity) {
//查询此单据是否可以补单 //查询此单据是否可以补单
String supplementTypeAction = bussinessTypeDao.selectSupplementTypeByAction(orderMdEntity.getAction()); String supplementTypeAction = bussinessTypeDao.selectSupplementTypeByAction(orderEntity.getAction());
if (StrUtil.isBlank(supplementTypeAction)) { if (StrUtil.isBlank(supplementTypeAction)) {
return ResultVOUtils.error(500, "此类型单据不可补单"); return ResultVOUtils.error(500, "此类型单据不可补单");
} }
//拷贝生成补单数据 //拷贝生成补单数据
OrderMdEntity supplementOrder = new OrderMdEntity(); OrderEntity supplementOrder = new OrderEntity();
BeanUtil.copyProperties(orderMdEntity, supplementOrder); BeanUtil.copyProperties(orderEntity, supplementOrder);
//生成补单单号 //生成补单单号
String supplementOrderNo = "SM" + CustomUtil.getId(); String supplementOrderNo = "SM" + CustomUtil.getId();
supplementOrder.setSupplementNo(orderMdEntity.getOrderId()); supplementOrder.setSupplementNo(orderEntity.getOrderId());
supplementOrder.setOrderId(supplementOrderNo); supplementOrder.setOrderId(supplementOrderNo);
supplementOrder.setCorpOrderId(CustomUtil.getId()); //生成一个新的来源ID supplementOrder.setCorpOrderId(CustomUtil.getId()); //生成一个新的来源ID
@ -225,8 +190,8 @@ public class OrderMdService {
supplementOrder.setUploadStatus("0"); //设置上传状态为未上传 supplementOrder.setUploadStatus("0"); //设置上传状态为未上传
//修改往来单位及库存号 //修改往来单位及库存号
supplementOrder.setFromCorpId(orderMdEntity.getLocStorageCode()); supplementOrder.setFromCorpId(orderEntity.getLocStorageCode());
supplementOrder.setLocStorageCode(orderMdEntity.getFromCorpId()); supplementOrder.setLocStorageCode(orderEntity.getFromCorpId());
String name = invWarehouseDao.getNameByCode(supplementOrder.getFromCorpId()); String name = invWarehouseDao.getNameByCode(supplementOrder.getFromCorpId());
supplementOrder.setFromCorp(name); supplementOrder.setFromCorp(name);
supplementOrder.setFromType("平衡补单"); supplementOrder.setFromType("平衡补单");
@ -237,10 +202,10 @@ public class OrderMdService {
supplementOrder.setAction(supplementType.getAction()); supplementOrder.setAction(supplementType.getAction());
//复制码表 //复制码表
List<WarehouseEntity> codes = warehouseMdService.findByOrderId(orderMdEntity.getOrderId()); List<WarehouseMdEntity> codes = warehouseMdService.findByOrderId(orderEntity.getOrderId());
List<WarehousetempEntity> supplementCodes = new ArrayList<>(codes.size()); List<WarehousetempMdEntity> supplementCodes = new ArrayList<>(codes.size());
codes.forEach(code -> { codes.forEach(code -> {
WarehousetempEntity supplementCode = new WarehousetempEntity(); WarehousetempMdEntity 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());
@ -257,8 +222,8 @@ public class OrderMdService {
supplementOrder.setId(null); supplementOrder.setId(null);
insertOrder(supplementOrder); insertOrder(supplementOrder);
//更新配货单表对应的单据补单号 //更新配货单表对应的单据补单号
orderMdEntity.setSupplementNo(supplementOrderNo); orderEntity.setSupplementNo(supplementOrderNo);
updateOrder(orderMdEntity); updateOrder(orderEntity);
warehouseTempMdService.insertTempWarehouses(supplementCodes); warehouseTempMdService.insertTempWarehouses(supplementCodes);
} catch (Exception e) { } catch (Exception e) {
log.error("补单数据插入失败", e); log.error("补单数据插入失败", e);
@ -271,12 +236,11 @@ public class OrderMdService {
* *
* @return * @return
*/ */
public List<OrderMdEntity> getSupplementOrderBillNoList() { public List<OrderEntity> getSupplementOrderBillNoList() {
//查询补单单号为空,且单据状态为已完成的单据 //查询补单单号为空,且单据状态为已完成的单据
Query query = new Query(); QueryWrapper<OrderEntity> wrapper = new QueryWrapper<>();
query.addCriteria(Criteria.where("supplementNo").is(null)); wrapper.isNull("supplementNo").eq("status", ConstantStatus.ORDER_STATUS_SUCCESS);
query.addCriteria(Criteria.where("status").is(ConstantStatus.ORDER_STATUS_SUCCESS)); return orderDao.selectList(wrapper);
return mongoTemplate.find(query, OrderMdEntity.class, MongoDBName.NAME_ORDER);
} }
/** /**
@ -285,7 +249,7 @@ public class OrderMdService {
* @param order * @param order
* @return * @return
*/ */
public boolean checkUpload(OrderMdEntity order) { public boolean checkUpload(OrderEntity order) {
//查询此往来单位的本地单据类型 //查询此往来单位的本地单据类型
Integer count = unitMaintainDao.checkUpload(order.getCustomerId(), order.getAction()); Integer count = unitMaintainDao.checkUpload(order.getCustomerId(), order.getAction());
if (count > 0) { if (count > 0) {
@ -302,14 +266,14 @@ public class OrderMdService {
*/ */
public List<StockOrderPrintEntity> listOrderPrint(String orderId) { public List<StockOrderPrintEntity> listOrderPrint(String orderId) {
List<StockOrderPrintEntity> list = new ArrayList<>(1); List<StockOrderPrintEntity> list = new ArrayList<>(1);
OrderMdEntity orderMdEntity = findByOne(orderId); OrderEntity orderEntity = findByOne(orderId);
if (null != orderMdEntity) { if (null != orderEntity) {
//查询单据详情 //查询单据详情
FilterErpOrderRequest detailRequest = new FilterErpOrderRequest(); FilterOrderDetailRequest detailRequest = new FilterOrderDetailRequest();
detailRequest.setOrderId(orderId); detailRequest.setOrderId(orderId);
List<OrderDetailEntity> erpOrderEntities = orderDetailMdService.filterOrderDetails(detailRequest); List<OrderDetailEntity> erpOrderEntities = orderDetailService.filterOrderDetails(detailRequest);
CustomerInfoEntity customerInfoEntity = customerInfoDao.selectById(orderMdEntity.getCustomerId()); CustomerInfoEntity customerInfoEntity = customerInfoDao.selectById(orderEntity.getCustomerId());
String customerId = String.valueOf(customerInfoEntity.getCustomerId()); String customerId = String.valueOf(customerInfoEntity.getCustomerId());
erpOrderEntities.forEach(erpOrderEntity -> { erpOrderEntities.forEach(erpOrderEntity -> {
//查询产品批次 //查询产品批次
@ -317,13 +281,13 @@ public class OrderMdService {
printEntity.setBatchNo(erpOrderEntity.getBatchNo()); //批次号 printEntity.setBatchNo(erpOrderEntity.getBatchNo()); //批次号
printEntity.setProductId(erpOrderEntity.getNameCode()); //产品ID printEntity.setProductId(erpOrderEntity.getNameCode()); //产品ID
printEntity.setCorpId(customerId); //本企业ID printEntity.setCorpId(customerId); //本企业ID
printEntity.setCorpName(orderMdEntity.getFromCorp()); //往来单位名称 printEntity.setCorpName(orderEntity.getFromCorp()); //往来单位名称
printEntity.setBillType(orderMdEntity.getAction()); //单据类型编码 printEntity.setBillType(orderEntity.getAction()); //单据类型编码
printEntity.setCount(String.valueOf(erpOrderEntity.getCount())); //数量 printEntity.setCount(String.valueOf(erpOrderEntity.getCount())); //数量
printEntity.setUnitIdFk(orderMdEntity.getFromCorpId());//往来单位ID printEntity.setUnitIdFk(orderEntity.getFromCorpId());//往来单位ID
printEntity.setPrice(erpOrderEntity.getPrice());//金额 printEntity.setPrice(erpOrderEntity.getPrice());//金额
printEntity.setBillNo(orderMdEntity.getOrderId()); //单号 printEntity.setBillNo(orderEntity.getOrderId()); //单号
printEntity.setBilldate(orderMdEntity.getActDate()); //单据日期 printEntity.setBilldate(orderEntity.getActDate()); //单据日期
printEntity.setZczbhhzbapzbh(erpOrderEntity.getZczbhhzbapzbh()); //注册/备案证号 printEntity.setZczbhhzbapzbh(erpOrderEntity.getZczbhhzbapzbh()); //注册/备案证号
printEntity.setSpec(erpOrderEntity.getGgxh()); //规格型号 printEntity.setSpec(erpOrderEntity.getGgxh()); //规格型号
printEntity.setTitle(customerInfoEntity.getCompanyName()); //企业名称,单据抬头 printEntity.setTitle(customerInfoEntity.getCompanyName()); //企业名称,单据抬头
@ -332,12 +296,12 @@ public class OrderMdService {
invProductRequest.setBatchNo(erpOrderEntity.getBatchNo()); invProductRequest.setBatchNo(erpOrderEntity.getBatchNo());
invProductRequest.setRelIdFk(erpOrderEntity.getUuidFk()); invProductRequest.setRelIdFk(erpOrderEntity.getUuidFk());
invProductRequest.setCustomerId(customerId); invProductRequest.setCustomerId(customerId);
invProductRequest.setInvCodes(Arrays.asList(orderMdEntity.getLocStorageCode())); invProductRequest.setInvCodes(Arrays.asList(orderEntity.getLocStorageCode()));
invProductRequest.setPage(1); invProductRequest.setPage(1);
invProductRequest.setLimit(100); invProductRequest.setLimit(100);
UdiInfoEntity udiInfoEntity = udiInfoDao.findByUuid(erpOrderEntity.getUuidFk(), String.valueOf(orderMdEntity.getCustomerId())); UdiInfoEntity udiInfoEntity = udiInfoDao.findByUuid(erpOrderEntity.getUuidFk(), String.valueOf(orderEntity.getCustomerId()));
printEntity.setManufactory(udiInfoEntity.getManufactory()); //生产厂家 printEntity.setManufactory(udiInfoEntity.getManufactory()); //生产厂家
printEntity.setLocInv(invWarehouseDao.getNameByCode(orderMdEntity.getLocStorageCode())); printEntity.setLocInv(invWarehouseDao.getNameByCode(orderEntity.getLocStorageCode()));
printEntity.setProductName(erpOrderEntity.getProductName()); //产品名称 printEntity.setProductName(erpOrderEntity.getProductName()); //产品名称
printEntity.setProductDate(erpOrderEntity.getProduceDate()); //生产日期 printEntity.setProductDate(erpOrderEntity.getProduceDate()); //生产日期
printEntity.setExpireDate(erpOrderEntity.getExpireDate()); //失效日期 printEntity.setExpireDate(erpOrderEntity.getExpireDate()); //失效日期
@ -354,54 +318,54 @@ public class OrderMdService {
* @param unitMaintainEntity * @param unitMaintainEntity
* @return * @return
*/ */
public List<OrderMdEntity> findWaitUploadOrders(UnitMaintainEntity unitMaintainEntity) { public List<OrderEntity> findWaitUploadOrders(UnitMaintainEntity unitMaintainEntity) {
Query query = new Query(); QueryWrapper<OrderEntity> wrapper = new QueryWrapper();
//查询已完成单据 //查询已完成单据
query.addCriteria(Criteria.where("status").is(ConstantStatus.ORDER_STATUS_SUCCESS)) wrapper.eq("status", ConstantStatus.ORDER_STATUS_SUCCESS)
//查询未上传单据 //查询未上传单据
.addCriteria(Criteria.where("uploadStatus").ne("1")) .ne("uploadStatus", "1")
//客户ID //客户ID
.addCriteria(Criteria.where("customerId").is(Long.valueOf(unitMaintainEntity.getCustomerId()))) .eq("customerId", unitMaintainEntity.getCustomerId())
//本地单据类型 //本地单据类型
.addCriteria(Criteria.where("action").is(unitMaintainEntity.getSourceAction())); .eq("action", unitMaintainEntity.getSourceAction());
return orderDao.findList(query, null);
return orderDao.selectList(wrapper);
} }
public List<OrderMdEntity> filterForDelete(String orderId) { public List<OrderEntity> filterForDelete(String orderId) {
Query query = new Query(); QueryWrapper<OrderEntity> wrapper = new QueryWrapper<>();
query.addCriteria(Criteria.where("orderId").is(orderId)); wrapper.eq("orderId", orderId).eq("status", ConstantStatus.ORDER_STATUS_SUCCESS);
query.addCriteria(Criteria.where("status").is(ConstantStatus.ORDER_STATUS_SUCCESS)); //查询已完成单据 OrderEntity orderEntity = orderDao.selectOne(wrapper);
OrderMdEntity order = mongoTemplate.findOne(query, OrderMdEntity.class, MongoDBName.NAME_ORDER); if (null == orderEntity) {
if (null == order) {
return Collections.emptyList(); return Collections.emptyList();
} }
return getAllOrder(order); return getAllOrder(orderEntity);
} }
public List<OrderMdEntity> getAllOrder(OrderMdEntity orderMdEntity) { public List<OrderEntity> getAllOrder(OrderEntity orderEntity) {
Set<String> orderIds = new HashSet<>(); Set<String> orderIds = new HashSet<>();
orderIds.add(orderMdEntity.getOrderId()); orderIds.add(orderEntity.getOrderId());
getLinkedOrderId(orderMdEntity.getOrderId(), orderIds); getLinkedOrderId(orderEntity.getOrderId(), orderIds);
//去除查询参数的单据号 //去除查询参数的单据号
Iterator<String> iterator = orderIds.iterator(); Iterator<String> iterator = orderIds.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
if (iterator.next().equals(orderMdEntity.getOrderId())) { if (iterator.next().equals(orderEntity.getOrderId())) {
iterator.remove(); iterator.remove();
break; break;
} }
} }
List<OrderMdEntity> orders = new ArrayList<>(); List<OrderEntity> orders = new ArrayList<>();
orders.add(orderMdEntity); orders.add(orderEntity);
//查询除本单以外的所有单据 //查询除本单以外的所有单据
if (CollUtil.isNotEmpty(orderIds)) { if (CollUtil.isNotEmpty(orderIds)) {
Query query = new Query(); QueryWrapper<OrderEntity> wrapper = new QueryWrapper<>();
query.addCriteria(Criteria.where("orderId").in(orderIds)); wrapper.in("orderId", orderIds);
List<OrderMdEntity> orderMdEntities = mongoTemplate.find(query, OrderMdEntity.class, MongoDBName.NAME_ORDER); List<OrderEntity> orderEntities = orderDao.selectList(wrapper);
orders.addAll(orderMdEntities); orders.addAll(orderEntities);
} }
return orders; return orders;
} }
@ -426,9 +390,7 @@ public class OrderMdService {
//通过单号获取此单据所有的单号字段值 //通过单号获取此单据所有的单号字段值
public List<String> getOneOrderById(String orderId) { public List<String> getOneOrderById(String orderId) {
List<String> orderIds = new ArrayList<>(); List<String> orderIds = new ArrayList<>();
Query query = new Query(); OrderNoResult orderNo = orderDao.selectNos(orderId);
query.addCriteria(Criteria.where("orderId").is(orderId));
OrderNoResult orderNo = mongoTemplate.findOne(query, OrderNoResult.class, MongoDBName.NAME_ORDER);
if (orderNo == null) { if (orderNo == null) {
return orderIds; return orderIds;
} }
@ -454,10 +416,8 @@ public class OrderMdService {
* @param orderId * @param orderId
* @return * @return
*/ */
public OrderMdEntity findById(String orderId) { public OrderEntity findById(String orderId) {
Query query = new Query(); return orderDao.selectById(orderId);
query.addCriteria(Criteria.where("orderId").is(orderId));
return mongoTemplate.findOne(query, OrderMdEntity.class, MongoDBName.NAME_ORDER);
} }
/** /**
@ -467,20 +427,8 @@ public class OrderMdService {
* @param replicateNo * @param replicateNo
* @return * @return
*/ */
public boolean updateReplicateNo(String orderId, String replicateNo) { public void updateReplicateNo(String orderId, String replicateNo) {
//构造查询条件 orderDao.updateReplicateNo(replicateNo, orderId);
Query query = new Query();
query.addCriteria(Criteria.where("orderId").is(orderId));
Update update = new Update();
update.set("replicateNo", replicateNo);
try {
mongoTemplate.updateMulti(query, update, MongoDBName.NAME_ORDER);
return true;
} catch (Exception e) {
log.error("更新 {} 单据的复制单据号失败", orderId, e);
return false;
}
} }
/** /**
@ -581,81 +529,11 @@ public class OrderMdService {
} }
public void updateOrderInfo(String actDate, List<String> orderIds) { public void updateOrderInfo(String actDate, List<String> orderIds) {
if (CollUtil.isNotEmpty(orderIds)) { orderDao.updateActDate(actDate, orderIds);
//构造查询条件
Query query = new Query();
query.addCriteria(Criteria.where("orderId").in(orderIds));
Update update = new Update();
update.set("actDate", actDate);
try {
//更新单据表
mongoTemplate.updateMulti(query, update, OrderMdEntity.class, MongoDBName.NAME_ORDER);
//更新码表
mongoTemplate.updateMulti(query, update, WarehouseEntity.class, MongoDBName.NAME_CODE);
} catch (Exception e) {
log.error("更新单据时间异常", e);
}
}
} }
public void deleteById(String id) { public void deleteById(String id) {
Query query = new Query(); orderDao.deleteById(id);
query.addCriteria(Criteria.where("id").is(id));
mongoTemplate.remove(query, OrderMdEntity.class, MongoDBName.NAME_ORDER);
} }
public PageResult<OrderMdEntity> findByPage(OrderFilterRequest orderFilterRequest) {
Query query = new Query();
if (orderFilterRequest.getId() != null && !orderFilterRequest.getId().isEmpty()) {
query.addCriteria(Criteria.where("orderId").is(orderFilterRequest.getId()));
}
if (orderFilterRequest.getMainAction() != null && !orderFilterRequest.getMainAction().isEmpty()) {
query.addCriteria(Criteria.where("mainAction").is(orderFilterRequest.getMainAction()));
}
if (orderFilterRequest.getAction() != null && !orderFilterRequest.getAction().isEmpty()) {
query.addCriteria(Criteria.where("action").is(orderFilterRequest.getAction()));
}
if (orderFilterRequest.getAction() == null || orderFilterRequest.getAction().isEmpty()) {
query.addCriteria(Criteria.where("action").ne("StockCheck"));
}
if (null != orderFilterRequest.getStatus()) {
query.addCriteria(Criteria.where("status").is(orderFilterRequest.getStatus()));
}
if (orderFilterRequest.getExportStatus() != null && !orderFilterRequest.getExportStatus().isEmpty()) {
query.addCriteria(Criteria.where("exportStatus").is(orderFilterRequest.getExportStatus()));
}
if (StrUtil.isNotBlank(orderFilterRequest.getCorpOrderId())) {
query.addCriteria(Criteria.where("corpOrderId").is(orderFilterRequest.getCorpOrderId()));
}
if (orderFilterRequest.getCustomerId() != null) {
if (orderFilterRequest.getStartTime() != null && !orderFilterRequest.getStartTime().isEmpty()
&& orderFilterRequest.getEndTime() != null && !orderFilterRequest.getEndTime().isEmpty()) {
Date sdate, edate = null;
if (orderFilterRequest.getStartTime().contains("T")) {
sdate = DateUtil.convertTimeFormat(orderFilterRequest.getStartTime());
} else {
sdate = DateUtil.parseDate(orderFilterRequest.getStartTime());
}
if (orderFilterRequest.getEndTime().contains("T")) {
edate = DateUtil.convertTimeFormat(orderFilterRequest.getEndTime());
} else {
edate = DateUtil.parseDate(orderFilterRequest.getEndTime());
}
query.addCriteria(Criteria.where("customerId").is(orderFilterRequest.getCustomerId()).andOperator(Criteria.where("actDate").gte(DateUtil.dateToISODate(sdate)
), Criteria.where("actDate").lt(DateUtil.dateToISODate(edate))));
} else {
query.addCriteria(Criteria.where("customerId").is(orderFilterRequest.getCustomerId()));
}
}
if (orderFilterRequest.getIsError() != null) {
query.addCriteria(Criteria.where("status").ne(orderFilterRequest.getIsError()));
}
if (orderFilterRequest.getReceiveStatus() != null) {
query.addCriteria(Criteria.where("receiveStatus").is(orderFilterRequest.getReceiveStatus()));
}
return mongoPageHelper.pageQuery(query, OrderMdEntity.class, orderFilterRequest.getPage(), orderFilterRequest.getLimit(), MongoDBName.NAME_ORDER);
}
} }

@ -7,8 +7,8 @@ import com.glxp.udi.admin.constant.ConstantType;
import com.glxp.udi.admin.entity.inout.InvProductDetailEntity; import com.glxp.udi.admin.entity.inout.InvProductDetailEntity;
import com.glxp.udi.admin.entity.inout.InvProductEntity; import com.glxp.udi.admin.entity.inout.InvProductEntity;
import com.glxp.udi.admin.entity.inout.OrderDetailEntity; import com.glxp.udi.admin.entity.inout.OrderDetailEntity;
import com.glxp.udi.admin.entity.inout.WarehouseEntity; import com.glxp.udi.admin.entity.inout.OrderEntity;
import com.glxp.udi.admin.entity.mongo.OrderMdEntity; import com.glxp.udi.admin.entity.mongo.WarehouseMdEntity;
import com.glxp.udi.admin.mongo.MongoDBName; import com.glxp.udi.admin.mongo.MongoDBName;
import com.glxp.udi.admin.mongo.utils.MongoPageHelper; import com.glxp.udi.admin.mongo.utils.MongoPageHelper;
import com.glxp.udi.admin.mongo.utils.PageResult; import com.glxp.udi.admin.mongo.utils.PageResult;
@ -36,19 +36,19 @@ public class WarehouseMdService {
private MongoPageHelper mongoPageHelper; private MongoPageHelper mongoPageHelper;
@Lazy @Lazy
@Resource @Resource
private OrderMdService orderMdService; private OrderService orderService;
@Lazy @Lazy
@Resource @Resource
private InvProductMdService invProductMdService; private InvProductService invProductService;
@Lazy @Lazy
@Resource @Resource
private InvProductDetailMdService invProductDetailMdService; private InvProductDetailMdService invProductDetailMdService;
@Lazy @Lazy
@Resource @Resource
private OrderDetailMdService orderDetailMdService; private OrderDetailService orderDetailService;
public PageResult<WarehouseEntity> filterWarehouseByPage(WarehouseQueryRequest warehouseQueryRequest) { public PageResult<WarehouseMdEntity> filterWarehouseByPage(WarehouseQueryRequest warehouseQueryRequest) {
Query query = new Query(); Query query = new Query();
if (warehouseQueryRequest.getCode() != null && !warehouseQueryRequest.getCode().isEmpty()) { if (warehouseQueryRequest.getCode() != null && !warehouseQueryRequest.getCode().isEmpty()) {
query.addCriteria(Criteria.where("code").is(warehouseQueryRequest.getCode())); query.addCriteria(Criteria.where("code").is(warehouseQueryRequest.getCode()));
@ -59,11 +59,11 @@ public class WarehouseMdService {
if (warehouseQueryRequest.getOrderId() != null && !warehouseQueryRequest.getOrderId().isEmpty()) { if (warehouseQueryRequest.getOrderId() != null && !warehouseQueryRequest.getOrderId().isEmpty()) {
query.addCriteria(Criteria.where("orderId").is(warehouseQueryRequest.getOrderId())); query.addCriteria(Criteria.where("orderId").is(warehouseQueryRequest.getOrderId()));
} }
return mongoPageHelper.pageQuery(query, WarehouseEntity.class, return mongoPageHelper.pageQuery(query, WarehouseMdEntity.class,
warehouseQueryRequest.getLimit(), warehouseQueryRequest.getPage(), warehouseQueryRequest.getLastId(), MongoDBName.NAME_CODE); warehouseQueryRequest.getLimit(), warehouseQueryRequest.getPage(), warehouseQueryRequest.getLastId(), MongoDBName.NAME_CODE);
} }
public List<WarehouseEntity> filterWarehouse(WarehouseQueryRequest warehouseQueryRequest) { public List<WarehouseMdEntity> filterWarehouse(WarehouseQueryRequest warehouseQueryRequest) {
Query query = new Query(); Query query = new Query();
if (warehouseQueryRequest.getCode() != null && !warehouseQueryRequest.getCode().isEmpty()) { if (warehouseQueryRequest.getCode() != null && !warehouseQueryRequest.getCode().isEmpty()) {
query.addCriteria(Criteria.where("code").is(warehouseQueryRequest.getCode())); query.addCriteria(Criteria.where("code").is(warehouseQueryRequest.getCode()));
@ -83,24 +83,24 @@ public class WarehouseMdService {
if (warehouseQueryRequest.getUdi() != null) { if (warehouseQueryRequest.getUdi() != null) {
query.addCriteria(Criteria.where("udi").is(warehouseQueryRequest.getUdi())); query.addCriteria(Criteria.where("udi").is(warehouseQueryRequest.getUdi()));
} }
return mongoTemplate.find(query, WarehouseEntity.class, MongoDBName.NAME_CODE); return mongoTemplate.find(query, WarehouseMdEntity.class, MongoDBName.NAME_CODE);
} }
public void insertWarehouses(List<WarehouseEntity> warehouseEntities) { public void insertWarehouses(List<WarehouseMdEntity> warehouseEntities) {
if (warehouseEntities != null) { if (warehouseEntities != null) {
Collection<WarehouseEntity> warehouseEntityCollection = new ArrayList<>(); Collection<WarehouseMdEntity> warehouseMdEntityCollection = new ArrayList<>();
warehouseEntityCollection.addAll(warehouseEntities); warehouseMdEntityCollection.addAll(warehouseEntities);
mongoTemplate.insert(warehouseEntityCollection, MongoDBName.NAME_CODE); mongoTemplate.insert(warehouseMdEntityCollection, MongoDBName.NAME_CODE);
} }
} }
public List<WarehouseEntity> findByCode(FilterWarehouseRequest filterWarehouseRequest) { public List<WarehouseMdEntity> findByCode(FilterWarehouseRequest filterWarehouseRequest) {
Query query = new Query(); Query query = new Query();
query.addCriteria( query.addCriteria(
Criteria.where("customerId").is(filterWarehouseRequest.getCustomerId()) Criteria.where("customerId").is(filterWarehouseRequest.getCustomerId())
.and("code").is(filterWarehouseRequest.getCode()) .and("code").is(filterWarehouseRequest.getCode())
); );
return mongoTemplate.find(query, WarehouseEntity.class, MongoDBName.NAME_CODE); return mongoTemplate.find(query, WarehouseMdEntity.class, MongoDBName.NAME_CODE);
} }
public void updateUnit(String orderId, String fromCorpId, String fromCorp) { public void updateUnit(String orderId, String fromCorpId, String fromCorp) {
@ -120,55 +120,55 @@ public class WarehouseMdService {
mongoTemplate.updateMulti(query, update, MongoDBName.NAME_CODE); mongoTemplate.updateMulti(query, update, MongoDBName.NAME_CODE);
} }
public List<WarehouseEntity> findByOrderId(String orderId) { public List<WarehouseMdEntity> findByOrderId(String orderId) {
if (StrUtil.isBlank(orderId)) { if (StrUtil.isBlank(orderId)) {
return Collections.emptyList(); return Collections.emptyList();
} }
Query query = new Query(); Query query = new Query();
query.addCriteria(Criteria.where("orderId").is(orderId)); query.addCriteria(Criteria.where("orderId").is(orderId));
return mongoTemplate.find(query, WarehouseEntity.class, MongoDBName.NAME_CODE); return mongoTemplate.find(query, WarehouseMdEntity.class, MongoDBName.NAME_CODE);
} }
public PageResult<WarehouseEntity> findOrdersById(WarehouseQueryRequest warehouseQueryRequest) { public PageResult<WarehouseMdEntity> findOrdersById(WarehouseQueryRequest warehouseQueryRequest) {
if (null != warehouseQueryRequest && StrUtil.isBlank(warehouseQueryRequest.getOrderId())) { if (null != warehouseQueryRequest && StrUtil.isBlank(warehouseQueryRequest.getOrderId())) {
return new PageResult<>(); return new PageResult<>();
} }
Query query = new Query(); Query query = new Query();
query.addCriteria(Criteria.where("orderId").is(warehouseQueryRequest.getOrderId())); query.addCriteria(Criteria.where("orderId").is(warehouseQueryRequest.getOrderId()));
PageResult<WarehouseEntity> pageResult = mongoPageHelper.pageQuery(query, WarehouseEntity.class, warehouseQueryRequest.getPage(), warehouseQueryRequest.getLimit(), MongoDBName.NAME_CODE); PageResult<WarehouseMdEntity> pageResult = mongoPageHelper.pageQuery(query, WarehouseMdEntity.class, warehouseQueryRequest.getPage(), warehouseQueryRequest.getLimit(), MongoDBName.NAME_CODE);
return pageResult; return pageResult;
} }
public void replaceCodes(CodesReplaceRequest codesReplaceRequest) { public void replaceCodes(CodesReplaceRequest codesReplaceRequest) {
OrderMdEntity orderMdEntity = orderMdService.findById(codesReplaceRequest.getOrderId()); OrderEntity orderEntity = orderService.findById(codesReplaceRequest.getOrderId());
//查询所有单据 //查询所有单据
List<OrderMdEntity> orderList = orderMdService.getAllOrder(orderMdEntity); List<OrderEntity> orderList = orderService.getAllOrder(orderEntity);
for (OrderMdEntity order : orderList) { for (OrderEntity order : orderList) {
//查询条码 //查询条码
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<WarehouseEntity> warehouseEntities = findByOrderId(warehouseQueryRequest); List<WarehouseMdEntity> warehouseEntities = findByOrderId(warehouseQueryRequest);
if (CollUtil.isNotEmpty(warehouseEntities)) { if (CollUtil.isNotEmpty(warehouseEntities)) {
WarehouseEntity warehouseEntity = warehouseEntities.get(0); WarehouseMdEntity warehouseMdEntity = warehouseEntities.get(0);
if (warehouseEntity.getCount() > 1) { if (warehouseMdEntity.getCount() > 1) {
//删除一个条码 //删除一个条码
warehouseEntity.setCount(warehouseEntity.getCount() - 1); warehouseMdEntity.setCount(warehouseMdEntity.getCount() - 1);
updateCode(warehouseEntity); updateCode(warehouseMdEntity);
} else { } else {
//如果数量扣减之后为0直接删除此条码 //如果数量扣减之后为0直接删除此条码
deleteById(warehouseEntity.getId()); deleteById(warehouseMdEntity.getId());
} }
//库存详情扣减1 //库存详情扣减1
if (order.getStatus().equals(ConstantStatus.ORDER_STATUS_SUCCESS)) { if (order.getStatus().equals(ConstantStatus.ORDER_STATUS_SUCCESS)) {
//查询库存 //查询库存
FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest(); FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest();
filterInvProductDetailRequest.setCode(warehouseEntity.getCode()); filterInvProductDetailRequest.setCode(warehouseMdEntity.getCode());
filterInvProductDetailRequest.setOrderIdFk(order.getOrderId()); filterInvProductDetailRequest.setOrderIdFk(order.getOrderId());
if (StrUtil.isNotBlank(warehouseEntity.getBatchNo())) { if (StrUtil.isNotBlank(warehouseMdEntity.getBatchNo())) {
filterInvProductDetailRequest.setBatchNo(warehouseEntity.getBatchNo()); filterInvProductDetailRequest.setBatchNo(warehouseMdEntity.getBatchNo());
} }
List<InvProductDetailEntity> invProductDetailEntities = invProductDetailMdService.filterAllInvProduct(filterInvProductDetailRequest); List<InvProductDetailEntity> invProductDetailEntities = invProductDetailMdService.filterAllInvProduct(filterInvProductDetailRequest);
if (CollUtil.isNotEmpty(invProductDetailEntities)) { if (CollUtil.isNotEmpty(invProductDetailEntities)) {
@ -186,11 +186,11 @@ public class WarehouseMdService {
FilterInvProductRequest filterInvProductRequest = new FilterInvProductRequest(); FilterInvProductRequest filterInvProductRequest = new FilterInvProductRequest();
filterInvProductRequest.setRelIdFk(invProductDetailEntity.getProductIdFk()); filterInvProductRequest.setRelIdFk(invProductDetailEntity.getProductIdFk());
filterInvProductRequest.setInvStorageCode(invProductDetailEntity.getLocStorageCode()); filterInvProductRequest.setInvStorageCode(invProductDetailEntity.getLocStorageCode());
filterInvProductRequest.setNameCode(warehouseEntity.getNameCode()); filterInvProductRequest.setNameCode(warehouseMdEntity.getNameCode());
if (StrUtil.isNotBlank(invProductDetailEntity.getBatchNo())) { if (StrUtil.isNotBlank(invProductDetailEntity.getBatchNo())) {
filterInvProductRequest.setBatchNo(invProductDetailEntity.getBatchNo()); filterInvProductRequest.setBatchNo(invProductDetailEntity.getBatchNo());
} }
InvProductEntity invProductEntity = invProductMdService.filterInvProductList(filterInvProductRequest).get(0); InvProductEntity invProductEntity = invProductService.filterInvProductList(filterInvProductRequest).get(0);
if (invProductDetailEntity.getMainAction().equals(ConstantType.TYPE_PUT)) { if (invProductDetailEntity.getMainAction().equals(ConstantType.TYPE_PUT)) {
//入库 //入库
invProductEntity.setInCount(invProductEntity.getInCount() - 1); invProductEntity.setInCount(invProductEntity.getInCount() - 1);
@ -207,36 +207,36 @@ public class WarehouseMdService {
long count = invProductDetailMdService.statCount(detailParams); long count = invProductDetailMdService.statCount(detailParams);
if (count == 0) { if (count == 0) {
//删除库存 //删除库存
invProductMdService.deleteById(invProductEntity.getId()); invProductService.deleteById(invProductEntity.getId());
} else { } else {
//库存码详情不为空,更新库存数据 //库存码详情不为空,更新库存数据
invProductMdService.updateInvProduct(invProductEntity); invProductService.updateInvProduct(invProductEntity);
} }
//查询单据详情 //查询单据详情
FilterErpOrderRequest filterErpOrderRequest = new FilterErpOrderRequest(); FilterOrderDetailRequest filterOrderDetailRequest = new FilterOrderDetailRequest();
filterErpOrderRequest.setOrderIdFk(order.getOrderId()); filterOrderDetailRequest.setOrderIdFk(order.getOrderId());
filterErpOrderRequest.setUuidFk(invProductEntity.getRelIdFk()); filterOrderDetailRequest.setUuidFk(invProductEntity.getRelIdFk());
filterErpOrderRequest.setLotno(warehouseEntity.getBatchNo()); filterOrderDetailRequest.setLotno(warehouseMdEntity.getBatchNo());
List<OrderDetailEntity> erpOrderEntities = orderDetailMdService.filterOrderDetails(filterErpOrderRequest); List<OrderDetailEntity> erpOrderEntities = orderDetailService.filterOrderDetails(filterOrderDetailRequest);
if (CollUtil.isNotEmpty(erpOrderEntities)) { if (CollUtil.isNotEmpty(erpOrderEntities)) {
OrderDetailEntity orderDetailEntity = erpOrderEntities.get(0); OrderDetailEntity orderDetailEntity = erpOrderEntities.get(0);
if (orderDetailEntity.getCount() > 1) { if (orderDetailEntity.getCount() > 1) {
orderDetailEntity.setCount(orderDetailEntity.getCount() - 1); orderDetailEntity.setCount(orderDetailEntity.getCount() - 1);
//更新单据详情 //更新单据详情
orderDetailMdService.updateOrderDetail(orderDetailEntity); orderDetailService.updateOrderDetail(orderDetailEntity);
} else { } else {
//删除扫码单据详情 //删除扫码单据详情
DeleteRequest deleteRequest = new DeleteRequest(); DeleteRequest deleteRequest = new DeleteRequest();
deleteRequest.setId(orderDetailEntity.getId()); deleteRequest.setId(orderDetailEntity.getId());
orderDetailMdService.deleteOrderDetail(deleteRequest); orderDetailService.deleteOrderDetail(deleteRequest);
} }
} }
//校验单据详情是否已经被全部删除,若全部被删除,则将此扫码单据也进行删除 //校验单据详情是否已经被全部删除,若全部被删除,则将此扫码单据也进行删除
long orderDetailCount = orderDetailMdService.statCount(order.getOrderId()); long orderDetailCount = orderDetailService.statCount(order.getOrderId());
if (orderDetailCount == 0) { if (orderDetailCount == 0) {
orderMdService.deleteById(order.getId()); orderService.deleteById(order.getOrderId());
} }
} }
@ -251,7 +251,7 @@ public class WarehouseMdService {
* @param warehouseQueryRequest * @param warehouseQueryRequest
* @return * @return
*/ */
public List<WarehouseEntity> findByOrderId(WarehouseQueryRequest warehouseQueryRequest) { public List<WarehouseMdEntity> findByOrderId(WarehouseQueryRequest warehouseQueryRequest) {
Query query = new Query(); Query query = new Query();
if (StrUtil.isNotBlank(warehouseQueryRequest.getOrderId())) { if (StrUtil.isNotBlank(warehouseQueryRequest.getOrderId())) {
query.addCriteria(Criteria.where("orderId").is(warehouseQueryRequest.getOrderId())); query.addCriteria(Criteria.where("orderId").is(warehouseQueryRequest.getOrderId()));
@ -259,16 +259,16 @@ public class WarehouseMdService {
if (StrUtil.isNotBlank(warehouseQueryRequest.getCode())) { if (StrUtil.isNotBlank(warehouseQueryRequest.getCode())) {
query.addCriteria(Criteria.where("code").is(warehouseQueryRequest.getCode())); query.addCriteria(Criteria.where("code").is(warehouseQueryRequest.getCode()));
} }
return mongoTemplate.find(query, WarehouseEntity.class, MongoDBName.NAME_CODE); return mongoTemplate.find(query, WarehouseMdEntity.class, MongoDBName.NAME_CODE);
} }
public void updateCode(WarehouseEntity warehouseEntity) { public void updateCode(WarehouseMdEntity warehouseMdEntity) {
Query query = new Query(); Query query = new Query();
query.addCriteria(Criteria.where("id").is(warehouseEntity.getId())); query.addCriteria(Criteria.where("id").is(warehouseMdEntity.getId()));
Update update = new Update(); Update update = new Update();
if (null != warehouseEntity.getCount()) { if (null != warehouseMdEntity.getCount()) {
update.set("count", warehouseEntity.getCount()); update.set("count", warehouseMdEntity.getCount());
} }
mongoTemplate.updateMulti(query, update, MongoDBName.NAME_CODE); mongoTemplate.updateMulti(query, update, MongoDBName.NAME_CODE);
} }
@ -277,7 +277,7 @@ public class WarehouseMdService {
Query query = new Query(); Query query = new Query();
query.addCriteria(Criteria.where("id").is(id)); query.addCriteria(Criteria.where("id").is(id));
mongoTemplate.remove(query, WarehouseEntity.class, MongoDBName.NAME_CODE); mongoTemplate.remove(query, WarehouseMdEntity.class, MongoDBName.NAME_CODE);
} }
} }

@ -2,8 +2,7 @@ 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.glxp.udi.admin.entity.inout.WarehouseEntity; import com.glxp.udi.admin.entity.mongo.WarehousetempMdEntity;
import com.glxp.udi.admin.entity.inout.WarehousetempEntity;
import com.glxp.udi.admin.mongo.MongoDBName; import com.glxp.udi.admin.mongo.MongoDBName;
import com.glxp.udi.admin.mongo.utils.MongoPageHelper; import com.glxp.udi.admin.mongo.utils.MongoPageHelper;
import com.glxp.udi.admin.mongo.utils.PageResult; import com.glxp.udi.admin.mongo.utils.PageResult;
@ -28,7 +27,7 @@ public class WarehouseTempMdService {
@Resource @Resource
private MongoPageHelper mongoPageHelper; private MongoPageHelper mongoPageHelper;
public PageResult<WarehousetempEntity> filterWarehouseByPage(WarehouseQueryRequest warehouseQueryRequest) { public PageResult<WarehousetempMdEntity> filterWarehouseByPage(WarehouseQueryRequest warehouseQueryRequest) {
Query query = new Query(); Query query = new Query();
if (warehouseQueryRequest.getCode() != null && !warehouseQueryRequest.getCode().isEmpty()) { if (warehouseQueryRequest.getCode() != null && !warehouseQueryRequest.getCode().isEmpty()) {
query.addCriteria(Criteria.where("code").is(warehouseQueryRequest.getCode())); query.addCriteria(Criteria.where("code").is(warehouseQueryRequest.getCode()));
@ -42,19 +41,19 @@ public class WarehouseTempMdService {
if (warehouseQueryRequest.getCustomerId() != null) { if (warehouseQueryRequest.getCustomerId() != null) {
query.addCriteria(Criteria.where("customerId").is(warehouseQueryRequest.getCustomerId())); query.addCriteria(Criteria.where("customerId").is(warehouseQueryRequest.getCustomerId()));
} }
return mongoPageHelper.pageQuery(query, WarehousetempEntity.class, return mongoPageHelper.pageQuery(query, WarehousetempMdEntity.class,
warehouseQueryRequest.getLimit(), warehouseQueryRequest.getPage(), warehouseQueryRequest.getLastId(), MongoDBName.NAME_CODE_TEMP); warehouseQueryRequest.getLimit(), warehouseQueryRequest.getPage(), warehouseQueryRequest.getLastId(), MongoDBName.NAME_CODE_TEMP);
} }
public List<WarehousetempEntity> findTempByOrderId(String orderId) { public List<WarehousetempMdEntity> findTempByOrderId(String orderId) {
Query query = new Query(Criteria.where("orderId").is(orderId)); Query query = new Query(Criteria.where("orderId").is(orderId));
List<WarehousetempEntity> result = mongoTemplate.find(query, WarehousetempEntity.class, MongoDBName.NAME_CODE_TEMP); List<WarehousetempMdEntity> result = mongoTemplate.find(query, WarehousetempMdEntity.class, MongoDBName.NAME_CODE_TEMP);
return result; return result;
} }
public void insertTempWarehouses(List<WarehousetempEntity> warehouseEntities) { public void insertTempWarehouses(List<WarehousetempMdEntity> warehouseEntities) {
if (warehouseEntities != null) { if (warehouseEntities != null) {
Collection<WarehousetempEntity> warehousetempEntityCollection = new ArrayList<>(warehouseEntities); Collection<WarehousetempMdEntity> warehousetempEntityCollection = new ArrayList<>(warehouseEntities);
mongoTemplate.insert(warehousetempEntityCollection, MongoDBName.NAME_CODE_TEMP); mongoTemplate.insert(warehousetempEntityCollection, MongoDBName.NAME_CODE_TEMP);
} }
} }
@ -77,14 +76,14 @@ public class WarehouseTempMdService {
if (deleteRequest.getOrderId() != null) { if (deleteRequest.getOrderId() != null) {
query.addCriteria(Criteria.where("orderId").is(deleteRequest.getOrderId())); query.addCriteria(Criteria.where("orderId").is(deleteRequest.getOrderId()));
} }
mongoTemplate.remove(query, WarehouseEntity.class, MongoDBName.NAME_CODE_TEMP); mongoTemplate.remove(query, WarehousetempMdEntity.class, MongoDBName.NAME_CODE_TEMP);
} }
public WarehousetempEntity findTempById(String id) { public WarehousetempMdEntity findTempById(String id) {
Query query = new Query(); Query query = new Query();
if (StrUtil.isNotBlank(id)) { if (StrUtil.isNotBlank(id)) {
query.addCriteria(Criteria.where("id").is(id)); query.addCriteria(Criteria.where("id").is(id));
List<WarehousetempEntity> warehousetempEntities = mongoTemplate.find(query, WarehousetempEntity.class, MongoDBName.NAME_CODE_TEMP); List<WarehousetempMdEntity> warehousetempEntities = mongoTemplate.find(query, WarehousetempMdEntity.class, MongoDBName.NAME_CODE_TEMP);
if (CollUtil.isNotEmpty(warehousetempEntities)) { if (CollUtil.isNotEmpty(warehousetempEntities)) {
return warehousetempEntities.get(0); return warehousetempEntities.get(0);
} }
@ -92,12 +91,12 @@ public class WarehouseTempMdService {
return null; return null;
} }
public void updateById(WarehousetempEntity warehousetemp) { public void updateById(WarehousetempMdEntity warehousetemp) {
Query query = new Query(); Query query = new Query();
query.addCriteria(Criteria.where("id").is(warehousetemp.getId())); query.addCriteria(Criteria.where("id").is(warehousetemp.getId()));
Update update = new Update(); Update update = new Update();
update.set("count", warehousetemp.getCount()); update.set("count", warehousetemp.getCount());
mongoTemplate.updateMulti(query, update, WarehousetempEntity.class, MongoDBName.NAME_CODE_TEMP); mongoTemplate.updateMulti(query, update, WarehousetempMdEntity.class, MongoDBName.NAME_CODE_TEMP);
} }
} }

@ -6,7 +6,7 @@ import lombok.Data;
import java.util.List; import java.util.List;
@Data @Data
public class FilterErpOrderRequest extends ListPageRequest { public class FilterOrderDetailRequest extends ListPageRequest {
private String docid; private String docid;
private String goodsname; private String goodsname;

@ -9,15 +9,10 @@ import lombok.Data;
public class OrderNoResult { public class OrderNoResult {
private String id; private String id;
//补单单号 //补单单号
private String supplementNo; private String supplementNo;
//缺量补单上级单号
private String originUllageSupNo;
//缺量补单单号
private String ullageSupNo;
//复制单号,多个单号之间使用英文逗号,分隔 //复制单号,多个单号之间使用英文逗号,分隔
private String replicateNo; private String replicateNo;

@ -6,8 +6,9 @@ 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.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.FilterErpOrderRequest; import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest;
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;
import com.glxp.udi.admin.service.inout.UdiInfoService; import com.glxp.udi.admin.service.inout.UdiInfoService;
@ -29,10 +30,10 @@ public class InvProductsTrService {
@Lazy @Lazy
@Resource @Resource
private OrderMdService orderService; private OrderService orderService;
@Lazy @Lazy
@Resource @Resource
private OrderDetailMdService myErpOrderService; private OrderDetailService myErpOrderService;
@Lazy @Lazy
@Resource @Resource
private WarehouseMdService codesService; private WarehouseMdService codesService;
@ -41,7 +42,7 @@ public class InvProductsTrService {
private UdiInfoService udiInfoService; private UdiInfoService udiInfoService;
@Lazy @Lazy
@Resource @Resource
private InvProductMdService invProductService; private InvProductService invProductService;
@Lazy @Lazy
@Resource @Resource
private InvProductDetailMdService invProductDetailService; private InvProductDetailMdService invProductDetailService;
@ -56,9 +57,9 @@ public class InvProductsTrService {
OrderMdEntity orderEntity = orderMdEntities.get(0); OrderMdEntity orderEntity = orderMdEntities.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)) {
FilterErpOrderRequest filterErpOrderRequest = new FilterErpOrderRequest(); FilterOrderDetailRequest filterOrderDetailRequest = new FilterOrderDetailRequest();
filterErpOrderRequest.setOrderId(orderId); filterOrderDetailRequest.setOrderId(orderId);
List<OrderDetailEntity> erpOrderEntities = myErpOrderService.filterOrderDetails(filterErpOrderRequest); List<OrderDetailEntity> erpOrderEntities = myErpOrderService.filterOrderDetails(filterOrderDetailRequest);
if (erpOrderEntities != null && erpOrderEntities.size() > 0) { if (erpOrderEntities != null && erpOrderEntities.size() > 0) {
for (OrderDetailEntity orderDetailEntity : erpOrderEntities) { for (OrderDetailEntity orderDetailEntity : erpOrderEntities) {
String nameCode = orderDetailEntity.getNameCode(); String nameCode = orderDetailEntity.getNameCode();
@ -103,7 +104,7 @@ public class InvProductsTrService {
if (StrUtil.isNotBlank(invProductEntity.getBatchNo())) { if (StrUtil.isNotBlank(invProductEntity.getBatchNo())) {
warehouseQueryRequest.setBatchNo(invProductEntity.getBatchNo()); warehouseQueryRequest.setBatchNo(invProductEntity.getBatchNo());
} }
List<WarehouseEntity> warehouseEntities = codesService.filterWarehouse(warehouseQueryRequest); List<WarehouseMdEntity> 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);

@ -12,14 +12,15 @@ import com.glxp.udi.admin.dao.info.ScheduledDao;
import com.glxp.udi.admin.entity.info.PlatformEntity; import com.glxp.udi.admin.entity.info.PlatformEntity;
import com.glxp.udi.admin.entity.info.ScheduledEntity; 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.UnitMaintainEntity; import com.glxp.udi.admin.entity.inout.UnitMaintainEntity;
import com.glxp.udi.admin.entity.inout.WarehouseEntity;
import com.glxp.udi.admin.entity.mongo.OrderMdEntity; import com.glxp.udi.admin.entity.mongo.OrderMdEntity;
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.OrderDetailMdService; import com.glxp.udi.admin.mongo.service.OrderDetailService;
import com.glxp.udi.admin.mongo.service.OrderMdService; import com.glxp.udi.admin.mongo.service.OrderService;
import com.glxp.udi.admin.mongo.service.WarehouseMdService; import com.glxp.udi.admin.mongo.service.WarehouseMdService;
import com.glxp.udi.admin.req.inout.FilterErpOrderRequest; import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest;
import com.glxp.udi.admin.req.inout.PostUdimsOrderDetailRequest; import com.glxp.udi.admin.req.inout.PostUdimsOrderDetailRequest;
import com.glxp.udi.admin.req.inout.PostUdimsOrderRequest; import com.glxp.udi.admin.req.inout.PostUdimsOrderRequest;
import com.glxp.udi.admin.req.inout.WarehouseQueryRequest; import com.glxp.udi.admin.req.inout.WarehouseQueryRequest;
@ -53,7 +54,7 @@ public class SubmitOrderToSpmsTask implements SchedulingConfigurer {
@Resource @Resource
private ScheduledDao scheduledDao; private ScheduledDao scheduledDao;
@Resource @Resource
private OrderMdService orderMdService; private OrderService orderService;
@Resource @Resource
private UnitMaintainService unitMaintainService; private UnitMaintainService unitMaintainService;
@Resource @Resource
@ -63,7 +64,7 @@ public class SubmitOrderToSpmsTask implements SchedulingConfigurer {
@Resource @Resource
private WarehouseMdService warehouseMdService; private WarehouseMdService warehouseMdService;
@Resource @Resource
private OrderDetailMdService orderDetailMdService; private OrderDetailService orderDetailService;
@Resource @Resource
private PlatformService platformService; private PlatformService platformService;
@ -94,18 +95,18 @@ public class SubmitOrderToSpmsTask implements SchedulingConfigurer {
SystemParamConfigEntity systemParamConfigEntity = systemParamCustomerConfigService.getParamByKey(SystemParamConstant.IS_AUTO_SUBMIT_TO_SPMS, Long.valueOf(unitMaintainEntity.getCustomerId())); SystemParamConfigEntity systemParamConfigEntity = systemParamCustomerConfigService.getParamByKey(SystemParamConstant.IS_AUTO_SUBMIT_TO_SPMS, Long.valueOf(unitMaintainEntity.getCustomerId()));
if (null != systemParamConfigEntity && systemParamConfigEntity.getParamValue().equals("1")) { if (null != systemParamConfigEntity && systemParamConfigEntity.getParamValue().equals("1")) {
//查询此用户未提交到自助平台且单据类型匹配的数据 //查询此用户未提交到自助平台且单据类型匹配的数据
List<OrderMdEntity> orderMdEntities = orderMdService.findWaitUploadOrders(unitMaintainEntity); List<OrderEntity> orderEntities = orderService.findWaitUploadOrders(unitMaintainEntity);
if (CollUtil.isNotEmpty(orderMdEntities)) { if (CollUtil.isNotEmpty(orderEntities)) {
//构造参数 //构造参数
PostUdimsOrderRequest postUdimsOrderRequest = new PostUdimsOrderRequest(); PostUdimsOrderRequest postUdimsOrderRequest = new PostUdimsOrderRequest();
List<PostUdimsOrderRequest.OrderBean> orderBeans = new ArrayList<>(); List<PostUdimsOrderRequest.OrderBean> orderBeans = new ArrayList<>();
for (OrderMdEntity orderMdEntity : orderMdEntities) { for (OrderEntity orderEntity : orderEntities) {
PostUdimsOrderRequest.OrderBean orderBean = new PostUdimsOrderRequest.OrderBean(); PostUdimsOrderRequest.OrderBean orderBean = new PostUdimsOrderRequest.OrderBean();
BeanUtil.copyProperties(orderMdEntity, orderBean); BeanUtil.copyProperties(orderEntity, orderBean);
orderBean.setAction(unitMaintainEntity.getTargetAction()); orderBean.setAction(unitMaintainEntity.getTargetAction());
WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest(); WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest();
warehouseQueryRequest.setOrderId(orderMdEntity.getOrderId()); warehouseQueryRequest.setOrderId(orderEntity.getOrderId());
List<WarehouseEntity> warehouseEntities = warehouseMdService.filterWarehouse(warehouseQueryRequest); List<WarehouseMdEntity> warehouseEntities = warehouseMdService.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();
@ -113,10 +114,10 @@ public class SubmitOrderToSpmsTask implements SchedulingConfigurer {
codeBeans.add(codeBean); codeBeans.add(codeBean);
}); });
//查询单据详情 //查询单据详情
FilterErpOrderRequest filterErpOrderRequest = new FilterErpOrderRequest(); FilterOrderDetailRequest filterOrderDetailRequest = new FilterOrderDetailRequest();
filterErpOrderRequest.setOrderId(orderBean.getOrderId()); filterOrderDetailRequest.setOrderId(orderBean.getOrderId());
//单据详情 //单据详情
List<OrderDetailEntity> erpOrderEntities = orderDetailMdService.filterOrderDetails(filterErpOrderRequest); List<OrderDetailEntity> erpOrderEntities = orderDetailService.filterOrderDetails(filterOrderDetailRequest);
if (CollUtil.isNotEmpty(erpOrderEntities)) { if (CollUtil.isNotEmpty(erpOrderEntities)) {
List<PostUdimsOrderDetailRequest> orderDetails = new ArrayList<>(); List<PostUdimsOrderDetailRequest> orderDetails = new ArrayList<>();
for (OrderDetailEntity orderDetailEntity : erpOrderEntities) { for (OrderDetailEntity orderDetailEntity : erpOrderEntities) {
@ -148,11 +149,11 @@ public class SubmitOrderToSpmsTask implements SchedulingConfigurer {
JSONObject.parseObject(response, new TypeReference<BaseResponse>() { JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
}); });
if (baseResponse.getCode() == 20000) { if (baseResponse.getCode() == 20000) {
log.info("自动上传单据成功," + unitMaintainEntity.getName() + "上传单据数量为 " + orderMdEntities.size()); log.info("自动上传单据成功," + unitMaintainEntity.getName() + "上传单据数量为 " + orderEntities.size());
for (OrderMdEntity orderMdEntity : orderMdEntities) { for (OrderMdEntity orderMdEntity : orderEntities) {
log.info("修改单号为:{} 的上传状态", orderMdEntity.getOrderId()); log.info("修改单号为:{} 的上传状态", orderMdEntity.getOrderId());
orderMdEntity.setUploadStatus("1"); orderMdEntity.setUploadStatus("1");
orderMdService.updateOrder(orderMdEntity); orderService.updateOrder(orderMdEntity);
} }
} else { } else {
log.error("自动上传单据到自助平台异常,响应结果:{}", response); log.error("自动上传单据到自助平台异常,响应结果:{}", response);

@ -5,9 +5,10 @@ import com.glxp.udi.admin.common.res.BaseResponse;
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.inout.OrderEntity;
import com.glxp.udi.admin.entity.mongo.OrderMdEntity; import com.glxp.udi.admin.entity.mongo.OrderMdEntity;
import com.glxp.udi.admin.entity.param.SystemParamConfigEntity; import com.glxp.udi.admin.entity.param.SystemParamConfigEntity;
import com.glxp.udi.admin.mongo.service.OrderMdService; import com.glxp.udi.admin.mongo.service.OrderService;
import com.glxp.udi.admin.req.udidl.ScheduledRequest; import com.glxp.udi.admin.req.udidl.ScheduledRequest;
import com.glxp.udi.admin.service.param.SystemParamConfigService; import com.glxp.udi.admin.service.param.SystemParamConfigService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -32,7 +33,7 @@ public class SupplementOrderTask implements SchedulingConfigurer {
@Resource @Resource
private ScheduledDao scheduledDao; private ScheduledDao scheduledDao;
@Resource @Resource
private OrderMdService orderMdService; private OrderService orderService;
@Resource @Resource
private SystemParamConfigService systemParamConfigService; private SystemParamConfigService systemParamConfigService;
@ -57,10 +58,10 @@ public class SupplementOrderTask implements SchedulingConfigurer {
log.info("开始扫描补单数据"); log.info("开始扫描补单数据");
//计数器 //计数器
AtomicInteger counter = new AtomicInteger(0); AtomicInteger counter = new AtomicInteger(0);
List<OrderMdEntity> orderEntities = orderMdService.getSupplementOrderBillNoList(); List<OrderEntity> orderEntities = orderService.getSupplementOrderBillNoList();
if (CollUtil.isNotEmpty(orderEntities)) { if (CollUtil.isNotEmpty(orderEntities)) {
orderEntities.forEach(orderMdEntity -> { orderEntities.forEach(orderEntity -> {
BaseResponse baseResponse = orderMdService.supplementOrder(orderMdEntity); BaseResponse baseResponse = orderService.supplementOrder(orderEntity);
if (baseResponse.getCode() == 20000) { if (baseResponse.getCode() == 20000) {
counter.addAndGet(1); counter.addAndGet(1);
} }

@ -4,13 +4,9 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil; 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.entity.basic.BussinessTypeEntity; import com.glxp.udi.admin.entity.basic.BussinessTypeEntity;
import com.glxp.udi.admin.entity.inout.UdiInfoEntity; import com.glxp.udi.admin.entity.inout.*;
import com.glxp.udi.admin.entity.inout.UnitMaintainEntity; import com.glxp.udi.admin.mongo.service.OrderDetailService;
import com.glxp.udi.admin.entity.inout.WarehouseEntity; import com.glxp.udi.admin.mongo.service.OrderService;
import com.glxp.udi.admin.entity.inout.WarehousetempEntity;
import com.glxp.udi.admin.entity.mongo.OrderMdEntity;
import com.glxp.udi.admin.mongo.service.OrderDetailMdService;
import com.glxp.udi.admin.mongo.service.OrderMdService;
import com.glxp.udi.admin.mongo.service.WarehouseMdService; import com.glxp.udi.admin.mongo.service.WarehouseMdService;
import com.glxp.udi.admin.mongo.service.WarehouseTempMdService; import com.glxp.udi.admin.mongo.service.WarehouseTempMdService;
import com.glxp.udi.admin.req.inout.OrderFilterRequest; import com.glxp.udi.admin.req.inout.OrderFilterRequest;
@ -46,13 +42,13 @@ public class TransInoutService {
@Resource @Resource
private UdiInfoService udiInfoService; private UdiInfoService udiInfoService;
@Resource @Resource
private OrderMdService orderService; private OrderService orderService;
@Resource @Resource
private WarehouseTempMdService warehouseTempMdService; private WarehouseTempMdService warehouseTempMdService;
@Resource @Resource
private WarehouseMdService warehouseMdService; private WarehouseMdService warehouseMdService;
@Resource @Resource
private OrderDetailMdService orderDetailMdService; private OrderDetailService orderDetailService;
@Resource @Resource
private InvProductsTrService invProductsTrService; private InvProductsTrService invProductsTrService;
@Resource @Resource
@ -65,13 +61,13 @@ public class TransInoutService {
private GennerOrderUtils gennerOrderUtils; private GennerOrderUtils gennerOrderUtils;
@Async @Async
public void transInout(OrderMdEntity orderMdEntity) { public void transInout(OrderEntity orderEntity) {
OrderFilterRequest orderFilterRequest = new OrderFilterRequest(); OrderFilterRequest orderFilterRequest = new OrderFilterRequest();
orderFilterRequest.setCorpOrderId(orderMdEntity.getCorpOrderId()); orderFilterRequest.setCorpOrderId(orderEntity.getCorpOrderId());
orderFilterRequest.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS); //查询已完成单据 orderFilterRequest.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS); //查询已完成单据
List<OrderMdEntity> orderMdEntities = orderService.findAll(orderFilterRequest); List<OrderEntity> orderEntities = orderService.findAll(orderFilterRequest);
OrderMdEntity tempEntity = new OrderMdEntity(); OrderEntity tempEntity = new OrderEntity();
tempEntity.setOrderId(orderMdEntity.getOrderId()); tempEntity.setOrderId(orderEntity.getOrderId());
tempEntity.setStatus(ConstantStatus.ORDER_STATUS_PROCESS); tempEntity.setStatus(ConstantStatus.ORDER_STATUS_PROCESS);
orderService.updateOrder(tempEntity); orderService.updateOrder(tempEntity);
/** /**
@ -81,36 +77,36 @@ public class TransInoutService {
* *
* *
*/ */
if (orderMdEntities.size() >= 1) { if (orderEntities.size() >= 1) {
tempEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL); tempEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL);
tempEntity.setRemark("单据重复上传"); tempEntity.setRemark("单据重复上传");
orderService.updateOrder(tempEntity); orderService.updateOrder(tempEntity);
return; return;
} }
BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(orderMdEntity.getAction(), String.valueOf(orderMdEntity.getCustomerId())); BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(orderEntity.getAction(), String.valueOf(orderEntity.getCustomerId()));
if (bussinessTypeEntity == null) { if (bussinessTypeEntity == null) {
return; return;
} }
if (StrUtil.isBlank(orderMdEntity.getFromCorp())) { if (StrUtil.isBlank(orderEntity.getFromCorp())) {
tempEntity.setRemark("未选择往来单位"); tempEntity.setRemark("未选择往来单位");
tempEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL); tempEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL);
orderService.updateOrder(tempEntity); orderService.updateOrder(tempEntity);
return; return;
} else if (StrUtil.isBlank(orderMdEntity.getFromCorpId())) { } else if (StrUtil.isBlank(orderEntity.getFromCorpId())) {
if (bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_INPUT && bussinessTypeEntity.isGenUnit()) { if (bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_INPUT && bussinessTypeEntity.isGenUnit()) {
UnitMaintainEntity basicUnitMaintainEntity = new UnitMaintainEntity(); UnitMaintainEntity basicUnitMaintainEntity = new UnitMaintainEntity();
basicUnitMaintainEntity.setErpId(CustomUtil.getUnitId()); basicUnitMaintainEntity.setErpId(CustomUtil.getUnitId());
basicUnitMaintainEntity.setCorpType(ConstantStatus.CORP_SICK); basicUnitMaintainEntity.setCorpType(ConstantStatus.CORP_SICK);
basicUnitMaintainEntity.setOutType(ConstantStatus.CORP_SICK_SICK); basicUnitMaintainEntity.setOutType(ConstantStatus.CORP_SICK_SICK);
basicUnitMaintainEntity.setName(orderMdEntity.getFromCorp()); basicUnitMaintainEntity.setName(orderEntity.getFromCorp());
basicUnitMaintainEntity.setCustomerId(orderMdEntity.getCustomerId().toString()); basicUnitMaintainEntity.setCustomerId(orderEntity.getCustomerId().toString());
tempEntity.setFromCorpId(basicUnitMaintainEntity.getErpId()); tempEntity.setFromCorpId(basicUnitMaintainEntity.getErpId());
orderService.updateOrder(tempEntity); orderService.updateOrder(tempEntity);
unitMaintainService.insertUnitMaintain(basicUnitMaintainEntity); unitMaintainService.insertUnitMaintain(basicUnitMaintainEntity);
} }
UnitMaintainEntity unitMaintainEntity = unitMaintainService.selectByName(orderMdEntity.getFromCorp()); UnitMaintainEntity unitMaintainEntity = unitMaintainService.selectByName(orderEntity.getFromCorp());
if (unitMaintainEntity == null) { if (unitMaintainEntity == null) {
tempEntity.setRemark("未选择往来单位"); tempEntity.setRemark("未选择往来单位");
tempEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL); tempEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL);
@ -121,11 +117,11 @@ public class TransInoutService {
} }
} }
List<WarehousetempEntity> filterList = warehouseTempMdService.findTempByOrderId(orderMdEntity.getOrderId()); List<WarehousetempEntity> filterList = warehouseTempMdService.findTempByOrderId(orderEntity.getOrderId());
List<WarehouseEntity> insertList = new ArrayList<>(); List<WarehouseEntity> insertList = new ArrayList<>();
if (StrUtil.isBlank(orderMdEntity.getLocStorageCode())) { if (StrUtil.isBlank(orderEntity.getLocStorageCode())) {
if (!StrUtil.isEmpty(bussinessTypeEntity.getStorageCode())) { if (!StrUtil.isEmpty(bussinessTypeEntity.getStorageCode())) {
orderMdEntity.setLocStorageCode(bussinessTypeEntity.getStorageCode()); orderEntity.setLocStorageCode(bussinessTypeEntity.getStorageCode());
orderService.updateOrder(tempEntity); orderService.updateOrder(tempEntity);
} else { } else {
tempEntity.setRemark("未选择当前仓库信息"); tempEntity.setRemark("未选择当前仓库信息");
@ -136,7 +132,7 @@ public class TransInoutService {
} }
for (WarehousetempEntity warehousetemp : filterList) { for (WarehousetempEntity warehousetemp : filterList) {
warehousetemp.setLocStorageCode(orderMdEntity.getLocStorageCode()); warehousetemp.setLocStorageCode(orderEntity.getLocStorageCode());
String result = inoutUtils.filterCode(warehouseMdService, warehousetemp, setupService); String result = inoutUtils.filterCode(warehouseMdService, warehousetemp, setupService);
if (result == null) { if (result == null) {
WarehouseEntity warehouseEntity = new WarehouseEntity(); WarehouseEntity warehouseEntity = new WarehouseEntity();
@ -171,7 +167,7 @@ public class TransInoutService {
if (insertList.size() > 0) { if (insertList.size() > 0) {
warehouseMdService.insertWarehouses(insertList); warehouseMdService.insertWarehouses(insertList);
List<WarehousetempEntity> temps = warehouseTempMdService.findTempByOrderId(orderMdEntity.getOrderId()); List<WarehousetempEntity> temps = warehouseTempMdService.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());
@ -179,7 +175,7 @@ public class TransInoutService {
warehouseTempMdService.deleteTempWarehouses(ids); warehouseTempMdService.deleteTempWarehouses(ids);
tempEntity.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS); tempEntity.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS);
orderService.updateOrder(tempEntity); orderService.updateOrder(tempEntity);
inoutUtils.generateConstrastDetail(udiInfoService, udiRelevanceService, orderDetailMdService, insertList); inoutUtils.generateConstrastDetail(udiInfoService, udiRelevanceService, orderDetailService, insertList);
insertList.clear(); insertList.clear();
//单据处理完成后判断单据类型是否开启二次验收校验,设置验收状态 //单据处理完成后判断单据类型是否开启二次验收校验,设置验收状态
if (bussinessTypeEntity.isSecCheckEnable()) { if (bussinessTypeEntity.isSecCheckEnable()) {
@ -190,7 +186,7 @@ public class TransInoutService {
tempEntity.setReceiveStatus(ConstantStatus.RECEIVE_NOT); //此单据类型不需要验收 tempEntity.setReceiveStatus(ConstantStatus.RECEIVE_NOT); //此单据类型不需要验收
tempEntity.setRemark("已完成"); tempEntity.setRemark("已完成");
orderService.updateOrder(tempEntity); orderService.updateOrder(tempEntity);
invProductsTrService.genInvProducts(orderMdEntity.getOrderId()); invProductsTrService.genInvProducts(orderEntity.getOrderId());
} }
} }
} }
@ -206,7 +202,7 @@ public class TransInoutService {
WarehousetempEntity warehousetempEntity = warehousetempList.get(0); WarehousetempEntity warehousetempEntity = warehousetempList.get(0);
BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(postOrder.getBillType(), String.valueOf(customerId)); BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(postOrder.getBillType(), String.valueOf(customerId));
String orderId = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER + StrUtil.trimToEmpty(bussinessTypeEntity.getPrefix()), "yyyyMMdd")); String orderId = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER + StrUtil.trimToEmpty(bussinessTypeEntity.getPrefix()), "yyyyMMdd"));
OrderMdEntity orderSaveRequest = new OrderMdEntity(); OrderEntity orderSaveRequest = new OrderEntity();
orderSaveRequest.setOrderId(orderId); orderSaveRequest.setOrderId(orderId);
orderSaveRequest.setActDate(warehousetempEntity.getActDate()); orderSaveRequest.setActDate(warehousetempEntity.getActDate());
orderSaveRequest.setCustomerId(customerId); orderSaveRequest.setCustomerId(customerId);

@ -7,7 +7,7 @@ import com.glxp.udi.admin.dao.info.ScheduledDao;
import com.glxp.udi.admin.entity.info.ScheduledEntity; import com.glxp.udi.admin.entity.info.ScheduledEntity;
import com.glxp.udi.admin.entity.mongo.OrderMdEntity; import com.glxp.udi.admin.entity.mongo.OrderMdEntity;
import com.glxp.udi.admin.entity.param.SystemParamConfigEntity; import com.glxp.udi.admin.entity.param.SystemParamConfigEntity;
import com.glxp.udi.admin.mongo.service.OrderMdService; import com.glxp.udi.admin.mongo.service.OrderService;
import com.glxp.udi.admin.req.inout.OrderFilterRequest; import com.glxp.udi.admin.req.inout.OrderFilterRequest;
import com.glxp.udi.admin.req.udidl.ScheduledRequest; import com.glxp.udi.admin.req.udidl.ScheduledRequest;
import com.glxp.udi.admin.service.param.SystemParamConfigService; import com.glxp.udi.admin.service.param.SystemParamConfigService;
@ -34,7 +34,7 @@ public class TransInoutTask implements SchedulingConfigurer {
@Resource @Resource
private SystemParamCustomerConfigService systemParamCustomerConfigService; private SystemParamCustomerConfigService systemParamCustomerConfigService;
@Resource @Resource
private OrderMdService orderMdService; private OrderService orderService;
@Resource @Resource
protected ScheduledDao scheduledDao; protected ScheduledDao scheduledDao;
@ -60,7 +60,7 @@ 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 = orderMdService.findAll(orderFilterRequest); List<OrderMdEntity> list = orderService.findAll(orderFilterRequest);
if (CollUtil.isNotEmpty(list)) { if (CollUtil.isNotEmpty(list)) {
for (OrderMdEntity orderMdEntity : list) { for (OrderMdEntity orderMdEntity : list) {
SystemParamConfigEntity io_transInout_auto = systemParamCustomerConfigService.getParamByKey(SystemParamConstant.IO_TRANSINOUT_AUTO, orderMdEntity.getCustomerId()); SystemParamConfigEntity io_transInout_auto = systemParamCustomerConfigService.getParamByKey(SystemParamConstant.IO_TRANSINOUT_AUTO, orderMdEntity.getCustomerId());

@ -10,7 +10,7 @@ import com.glxp.udi.admin.entity.inout.UdiInfoEntity;
import com.glxp.udi.admin.entity.inout.WarehouseEntity; import com.glxp.udi.admin.entity.inout.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.OrderDetailMdService; import com.glxp.udi.admin.mongo.service.OrderDetailService;
import com.glxp.udi.admin.mongo.service.WarehouseMdService; import com.glxp.udi.admin.mongo.service.WarehouseMdService;
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;
@ -208,7 +208,7 @@ public class InoutUtils {
} }
public void generateConstrastDetail(UdiInfoService udiInfoService, UdiRelevanceService udiRelevanceService, public void generateConstrastDetail(UdiInfoService udiInfoService, UdiRelevanceService udiRelevanceService,
OrderDetailMdService orderDetailMdService, OrderDetailService orderDetailService,
List<WarehouseEntity> warehouseEntityList) { List<WarehouseEntity> warehouseEntityList) {
if (warehouseEntityList != null && warehouseEntityList.size() > 0) { if (warehouseEntityList != null && warehouseEntityList.size() > 0) {
List<UdiInfoEntity> udiInfoEntities = new ArrayList<>(); List<UdiInfoEntity> udiInfoEntities = new ArrayList<>();
@ -254,7 +254,7 @@ public class InoutUtils {
erpOrderEntities.add(orderDetailEntity); erpOrderEntities.add(orderDetailEntity);
} }
if (!erpOrderEntities.isEmpty()) { if (!erpOrderEntities.isEmpty()) {
orderDetailMdService.insertOrderDetail(erpOrderEntities); orderDetailService.insertOrderDetail(erpOrderEntities);
} }
} }
} }

@ -0,0 +1,23 @@
<?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.OrderDao">
<update id="updateActDate">
update io_order set actDate = #{actDate}
<where>
<foreach collection="orderIds" item="item" separator="," open="(" close=")" index="index">
orderId = #{item}
</foreach>
</where>
</update>
<select id="selectNos" resultType="com.glxp.udi.admin.res.inout.OrderNoResult">
select supplementNo, replicateNo from io_order where orderId = #{orderId}
</select>
<update id="updateReplicateNo">
update io_order set replicateNo = #{replicateNo} where orderId = #{orderId}
</update>
</mapper>
Loading…
Cancel
Save