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

master
x_z 3 years ago
parent d7ee22b16c
commit 75ae13cacd

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

@ -1,11 +1,18 @@
package com.glxp.udi.admin.controller;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.glxp.udi.admin.dao.inout.UdiInfoDao;
import com.glxp.udi.admin.entity.inout.*;
import com.glxp.udi.admin.mongo.service.*;
import com.glxp.udi.admin.req.inout.FilterErpOrderRequest;
import com.glxp.udi.admin.entity.inout.WarehousetempEntity;
import com.glxp.udi.admin.entity.mongo.*;
import com.glxp.udi.admin.mongo.dao.*;
import com.glxp.udi.admin.mongo.service.InvProductDetailMdService;
import com.glxp.udi.admin.mongo.service.InvProductService;
import com.glxp.udi.admin.mongo.service.OrderDetailService;
import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest;
import com.glxp.udi.admin.req.inout.FilterInvProductDetailRequest;
import com.glxp.udi.admin.req.inventory.FilterInvProductRequest;
import lombok.extern.slf4j.Slf4j;
@ -20,21 +27,48 @@ import java.util.List;
public class TestController {
@Resource
private OrderMdService orderMdService;
private OrderDetailService orderDetailService;
@Resource
private OrderDetailMdService orderDetailMdService;
@Resource
private InvProductMdService invProductMdService;
private InvProductService invProductService;
@Resource
private InvProductDetailMdService invProductDetailMdService;
@Resource
private UdiInfoDao udiInfoDao;
//mongodb dao
@Resource
private OrderMdDao orderMdDao;
@Resource
private OrderDetailMdDao orderDetailMdDao;
@Resource
private CodesMdDao codesMdDao;
@Resource
private CodesTempMdDao codesTempMdDao;
@Resource
private InvProductMdDao invProductMdDao;
@Resource
private InvProductDetailMdDao invProductDetailMdDao;
//mysql dao
@Resource
private com.glxp.udi.admin.dao.inout.OrderDao orderDao;
@Resource
private com.glxp.udi.admin.dao.inout.OrderDetailDao orderDetailDao;
@Resource
private com.glxp.udi.admin.dao.inout.CodesDao codesDao;
@Resource
private com.glxp.udi.admin.dao.inout.CodesTempDao codesTempDao;
@Resource
private com.glxp.udi.admin.dao.inout.InvProductDao invProductDao;
@Resource
private com.glxp.udi.admin.dao.inout.InvProductDetailDao invProductDetailDao;
@GetMapping("/test/refreshOrderData")
private String refreshOrderData() {
try {
//刷新订单详情表的数据
List<OrderDetailEntity> erpOrderEntities = orderDetailMdService.filterOrderDetails(new FilterErpOrderRequest());
List<OrderDetailEntity> erpOrderEntities = orderDetailService.filterOrderDetails(new FilterOrderDetailRequest());
/*erpOrderEntities.forEach(orderDetail -> {
String orderId = orderDetail.getOrderIdFk();
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 -> {
UdiInfoEntity udiInfoEntity = udiInfoDao.selectOne(new QueryWrapper<UdiInfoEntity>().eq(StrUtil.isNotBlank(invProductEntity.getRelIdFk()), "uuid", invProductEntity.getRelIdFk())
.eq(StrUtil.isNotBlank(invProductEntity.getCustomerId()), "customerId", invProductEntity.getCustomerId())
@ -63,7 +97,7 @@ public class TestController {
if (null != udiInfoEntity) {
invProductEntity.setRelIdFk(String.valueOf(udiInfoEntity.getId()));
log.info("刷新库存");
invProductMdService.updateInvProduct(invProductEntity);
invProductService.updateInvProduct(invProductEntity);
}
});
@ -95,6 +129,76 @@ public class TestController {
@GetMapping("/test/copyData")
public String copyData() {
try {
log.info("开始拷贝单据数据");
List<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";
} 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.entity.basic.BussinessTypeEntity;
import com.glxp.udi.admin.entity.basic.CndidateRequest;
import com.glxp.udi.admin.mongo.service.OrderMdService;
import com.glxp.udi.admin.mongo.service.OrderService;
import com.glxp.udi.admin.req.basic.BussinessLocalTypeFilterRequest;
import com.glxp.udi.admin.req.basic.BussinessTypeFilterRequest;
import com.glxp.udi.admin.req.info.DeleteRequest;
@ -44,7 +44,7 @@ public class BussinessTypeController {
@Resource
private CustomerService customerService;
@Resource
private OrderMdService orderMdService;
private OrderService orderService;
@ApiOperation(value = "扫码单据列表")
@AuthRuleAnnotation("")
@ -98,7 +98,7 @@ public class BussinessTypeController {
String id = deleteRequest.getId();
BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.selectById(id);
long count = orderMdService.countByAction(bussinessTypeEntity.getAction());
long count = orderService.countByAction(bussinessTypeEntity.getAction());
if (count > 0) {
return ResultVOUtils.error(500, "已存在该类型扫码单据,无法删除!");
}

@ -11,7 +11,7 @@ import com.glxp.udi.admin.entity.inout.InvProductDetailEntity;
import com.glxp.udi.admin.entity.inout.InvProductEntity;
import com.glxp.udi.admin.entity.inout.UdiInfoEntity;
import com.glxp.udi.admin.mongo.service.InvProductDetailMdService;
import com.glxp.udi.admin.mongo.service.InvProductMdService;
import com.glxp.udi.admin.mongo.service.InvProductService;
import com.glxp.udi.admin.mongo.utils.PageResult;
import com.glxp.udi.admin.req.inout.DeleteRequest;
import com.glxp.udi.admin.req.inout.FilterInvProductDetailRequest;
@ -42,7 +42,7 @@ import java.util.List;
public class InvProductsController {
@Resource
private InvProductMdService invProductService;
private InvProductService invProductService;
@Resource
private InvProductDetailMdService invProductDetailService;
@Resource

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

@ -14,7 +14,7 @@ import com.glxp.udi.admin.entity.inventory.StockPrintTempEntity;
import com.glxp.udi.admin.entity.mongo.OrderMdEntity;
import com.glxp.udi.admin.entity.param.SystemPDFModuleEntity;
import com.glxp.udi.admin.entity.param.SystemPDFTemplateEntity;
import com.glxp.udi.admin.mongo.service.OrderMdService;
import com.glxp.udi.admin.mongo.service.OrderService;
import com.glxp.udi.admin.req.basic.FilterStockprintRequest;
import com.glxp.udi.admin.req.inout.DeleteRequest;
import com.glxp.udi.admin.req.inout.StockQRCodeTextFilterRequest;
@ -80,7 +80,7 @@ public class StockQRCodeTextController {
@Resource
private JaspaperService jaspaperService;
@Resource
private OrderMdService orderMdService;
private OrderService orderService;
@Resource
private CustomerService customerService;
@ -300,7 +300,7 @@ public class StockQRCodeTextController {
@PostMapping("/udiwms/pdf/template/inspection/stock/order/file")
public BaseResponse inspectionStockOrderPDFFromTemplateFile(
@RequestBody InspectionPDFTemplateRequest inspectionPDFTemplateRequest) {
OrderMdEntity orderMdEntity = orderMdService.findByOne(inspectionPDFTemplateRequest.getOrderId());
OrderMdEntity orderMdEntity = orderService.findByOne(inspectionPDFTemplateRequest.getOrderId());
if (orderMdEntity == null) {
return ResultVOUtils.error(ResultEnum.DATA_NOT, "未找到该订单");
}
@ -330,7 +330,7 @@ public class StockQRCodeTextController {
return;
}
/*打印订单*/
List<StockOrderPrintEntity> list = orderMdService.listOrderPrint(stockQRCodeTextPDFTemplateRequest.getOrderId());
List<StockOrderPrintEntity> list = orderService.listOrderPrint(stockQRCodeTextPDFTemplateRequest.getOrderId());
if (list != null && list.size() > 0) {
SystemPDFModuleEntity systemPDFModuleEntity = systemPDFModuleService.selectById(stockQRCodeTextPDFTemplateRequest.getModuleId() + "");
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.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.glxp.udi.admin.annotation.AuthRuleAnnotation;
import com.glxp.udi.admin.common.res.BaseResponse;
import com.glxp.udi.admin.entity.inout.UdiInfoEntity;
import com.glxp.udi.admin.entity.inout.WarehouseEntity;
import com.glxp.udi.admin.mongo.service.InvProductMdService;
import com.glxp.udi.admin.mongo.service.InvProductService;
import com.glxp.udi.admin.mongo.service.WarehouseMdService;
import com.glxp.udi.admin.req.inout.DeleteRequest;
import com.glxp.udi.admin.req.inout.FilterUdiInfoRequest;
@ -48,7 +47,7 @@ public class UdiRelevanceController {
@Resource
private UdiRelevanceService udiRelevanceService;
@Resource
private InvProductMdService invProductMdService;
private InvProductService invProductService;
@Resource
private WarehouseMdService warehouseMdService;
@ -170,7 +169,7 @@ public class UdiRelevanceController {
}
UdiInfoEntity udiInfoEntity = udiInfoService.findById(combineRequest.getRelId());
if (combineRequest.getIsDisable()) {
Long count = invProductMdService.countByNamecode(udiInfoEntity.getNameCode(), authAdminService.getCurrentUserCustomerId());
Long count = invProductService.countByNamecode(udiInfoEntity.getNameCode(), authAdminService.getCurrentUserCustomerId());
if (null != count && count > 0) {
return ResultVOUtils.error(500, "库存已存在,无法禁用");
}

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

@ -9,8 +9,10 @@ import com.glxp.udi.admin.constant.ConstantStatus;
import com.glxp.udi.admin.entity.auth.AuthAdmin;
import com.glxp.udi.admin.entity.inout.*;
import com.glxp.udi.admin.entity.mongo.OrderMdEntity;
import com.glxp.udi.admin.entity.mongo.WarehouseMdEntity;
import com.glxp.udi.admin.entity.mongo.WarehousetempMdEntity;
import com.glxp.udi.admin.entity.udid.UdiEntity;
import com.glxp.udi.admin.mongo.service.OrderMdService;
import com.glxp.udi.admin.mongo.service.OrderService;
import com.glxp.udi.admin.mongo.service.WarehouseMdService;
import com.glxp.udi.admin.mongo.service.WarehouseTempMdService;
import com.glxp.udi.admin.mongo.utils.PageResult;
@ -54,7 +56,7 @@ public class WareHouseController {
@Resource
private WarehouseTempMdService warehouseTempMdService;
@Resource
private OrderMdService orderMdService;
private OrderService orderService;
@Resource
private UdiInfoService udiInfoService;
@ -71,8 +73,8 @@ public class WareHouseController {
@GetMapping("admin/warehouse/inout/findByOrderId")
public BaseResponse findByOrderId(WarehouseQueryRequest warehouseQueryRequest) {
PageResult<WarehouseEntity> pageResult = warehouseMdService.filterWarehouseByPage(warehouseQueryRequest);
PageSimpleResponse<WarehouseEntity> pageSimpleResponse = new PageSimpleResponse<>();
PageResult<WarehouseMdEntity> pageResult = warehouseMdService.filterWarehouseByPage(warehouseQueryRequest);
PageSimpleResponse<WarehouseMdEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageResult.getTotal());
pageSimpleResponse.setList(pageResult.getList());
return ResultVOUtils.success(pageSimpleResponse);
@ -80,8 +82,8 @@ public class WareHouseController {
@GetMapping("admin/warehouse/inout/findErrorByOrderId")
public BaseResponse findErrorByOrderId(WarehouseQueryRequest warehouseQueryRequest) {
PageResult<WarehousetempEntity> pageResult = warehouseTempMdService.filterWarehouseByPage(warehouseQueryRequest);
PageSimpleResponse<WarehousetempEntity> pageSimpleResponse = new PageSimpleResponse<>();
PageResult<WarehousetempMdEntity> pageResult = warehouseTempMdService.filterWarehouseByPage(warehouseQueryRequest);
PageSimpleResponse<WarehousetempMdEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageResult.getTotal());
pageSimpleResponse.setList(pageResult.getList());
return ResultVOUtils.success(pageSimpleResponse);
@ -90,7 +92,7 @@ public class WareHouseController {
@AuthRuleAnnotation("")
@GetMapping("warehouse/inout/deleteCodesTempById")
public BaseResponse deleteCodesTempById(String id) {
WarehousetempEntity warehousetemp = warehouseTempMdService.findTempById(id);
WarehousetempMdEntity warehousetemp = warehouseTempMdService.findTempById(id);
if (null == warehousetemp) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
@ -102,8 +104,8 @@ public class WareHouseController {
warehouseTempMdService.deleteTempWarehouses(Collections.singletonList(warehousetemp.getId()));
}
List<WarehousetempEntity> tempByOrderId = warehouseTempMdService.findTempByOrderId(warehousetemp.getOrderId());
if (tempByOrderId.size() <= 0) {
List<WarehousetempMdEntity> tempByOrderId = warehouseTempMdService.findTempByOrderId(warehousetemp.getOrderId());
if (tempByOrderId.size() == 0) {
DeleteRequest deleteRequest = new DeleteRequest();
deleteRequest.setOrderId(warehousetemp.getOrderId());
warehouseTempMdService.deleteCode(deleteRequest);
@ -197,8 +199,8 @@ public class WareHouseController {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
OrderMdEntity orderMdEntity = orderMdService.findByOne(commitRequest.getOrderId());
transInoutService.transInout(orderMdEntity);
OrderEntity orderEntity = orderService.findByOne(commitRequest.getOrderId());
transInoutService.transInout(orderEntity);
return ResultVOUtils.success("提交成功");
}
@ -216,9 +218,9 @@ public class WareHouseController {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
OrderMdEntity orderEntity = orderMdService.findByOne(commitRequest.getOrderId());
OrderMdEntity orderEntity = orderService.findByOne(commitRequest.getOrderId());
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_WAIT);
orderMdService.updateOrder(orderEntity);
orderService.updateOrder(orderEntity);
return ResultVOUtils.success("提交成功");
}
@ -231,8 +233,8 @@ public class WareHouseController {
@AuthRuleAnnotation("")
@GetMapping("spms/inout/dlcode/findByOrderId")
public BaseResponse downloadCodesByOrderId(WarehouseQueryRequest warehouseQueryRequest) {
PageResult<WarehouseEntity> pageResult = warehouseMdService.findOrdersById(warehouseQueryRequest);
PageSimpleResponse<WarehouseEntity> pageSimpleResponse = new PageSimpleResponse<>();
PageResult<WarehouseMdEntity> pageResult = warehouseMdService.findOrdersById(warehouseQueryRequest);
PageSimpleResponse<WarehouseMdEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageResult.getTotal());
pageSimpleResponse.setList(pageResult.getList());
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.inventory.InvWarehouseEntity;
import com.glxp.udi.admin.entity.param.SystemParamConfigEntity;
import com.glxp.udi.admin.mongo.service.InvProductMdService;
import com.glxp.udi.admin.mongo.service.InvProductService;
import com.glxp.udi.admin.req.info.DeleteRequest;
import com.glxp.udi.admin.req.inventory.FilterInvWarehouseRequest;
import com.glxp.udi.admin.res.inventory.InvWarehouseExportResponse;
@ -47,7 +47,7 @@ public class InvWarehouseController {
@Resource
private WarehouseBussinessTypeService warehouseBussinessTypeService;
@Resource
private InvProductMdService invProductMdService;
private InvProductService invProductService;
@AuthRuleAnnotation("")
@GetMapping("spms/inv/warehouse/filter")
@ -214,7 +214,7 @@ public class InvWarehouseController {
}
InvWarehouseEntity invWarehouseEntity = invWarehouseService.selectById(deleteRequest.getId());
boolean exist = invProductMdService.isExist(invWarehouseEntity.getCode());
boolean exist = invProductService.isExist(invWarehouseEntity.getCode());
if (exist) {
return ResultVOUtils.error(500, "该仓库已有库存,不能删除!");
}

@ -2,7 +2,11 @@ package com.glxp.udi.admin.dao.inout;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.udi.admin.entity.inout.OrderEntity;
import com.glxp.udi.admin.res.inout.OrderNoResult;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
@ -10,4 +14,27 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface OrderDao extends BaseMapper<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;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
@Data
@TableName("io_inv_product_detail")
public class InvProductDetailEntity {
@TableId(type = IdType.AUTO)
private String id;
/**

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

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

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

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

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

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

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

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

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

@ -3,6 +3,7 @@ package com.glxp.udi.admin.mongo.dao;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.ReflectUtil;
import com.glxp.udi.admin.entity.inout.WarehouseEntity;
import com.glxp.udi.admin.entity.mongo.WarehouseMdEntity;
import com.glxp.udi.admin.mongo.MongoDBName;
import com.glxp.udi.admin.mongo.dao.base.MongoBaseDao;
import com.glxp.udi.admin.mongo.utils.MongoPageHelper;
@ -20,7 +21,7 @@ import java.util.Arrays;
import java.util.List;
@Component
public class CodesDao implements MongoBaseDao<WarehouseEntity, FilterWarehouseRequest> {
public class CodesMdDao implements MongoBaseDao<WarehouseEntity, FilterWarehouseRequest> {
@Resource
private MongoTemplate mongoTemplate;
@ -142,5 +143,9 @@ public class CodesDao implements MongoBaseDao<WarehouseEntity, FilterWarehouseRe
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.ReflectUtil;
import com.glxp.udi.admin.entity.inout.WarehousetempEntity;
import com.glxp.udi.admin.entity.mongo.WarehousetempMdEntity;
import com.glxp.udi.admin.mongo.MongoDBName;
import com.glxp.udi.admin.mongo.dao.base.MongoBaseDao;
import com.glxp.udi.admin.mongo.utils.MongoPageHelper;
@ -20,7 +21,7 @@ import java.util.Arrays;
import java.util.List;
@Component
public class CodesTempDao implements MongoBaseDao<WarehousetempEntity, FilterWarehouseRequest> {
public class CodesTempMdDao implements MongoBaseDao<WarehousetempEntity, FilterWarehouseRequest> {
@Resource
private MongoTemplate mongoTemplate;
@ -141,4 +142,8 @@ public class CodesTempDao implements MongoBaseDao<WarehousetempEntity, FilterWar
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.ReflectUtil;
import com.glxp.udi.admin.entity.inout.InvProductDetailEntity;
import com.glxp.udi.admin.entity.mongo.InvProductDetailMdEntity;
import com.glxp.udi.admin.mongo.MongoDBName;
import com.glxp.udi.admin.mongo.dao.base.MongoBaseDao;
import com.glxp.udi.admin.mongo.utils.MongoPageHelper;
@ -20,7 +21,7 @@ import java.util.Arrays;
import java.util.List;
@Component
public class InvProductDetailDao implements MongoBaseDao<InvProductDetailEntity, FilterInvProductDetailRequest> {
public class InvProductDetailMdDao implements MongoBaseDao<InvProductDetailEntity, FilterInvProductDetailRequest> {
@Resource
private MongoTemplate mongoTemplate;
@ -152,5 +153,10 @@ public class InvProductDetailDao implements MongoBaseDao<InvProductDetailEntity,
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.ReflectUtil;
import com.glxp.udi.admin.entity.inout.InvProductEntity;
import com.glxp.udi.admin.entity.mongo.InvProductMdEntity;
import com.glxp.udi.admin.mongo.MongoDBName;
import com.glxp.udi.admin.mongo.dao.base.MongoBaseDao;
import com.glxp.udi.admin.mongo.utils.MongoPageHelper;
@ -21,7 +22,7 @@ import java.util.List;
import java.util.regex.Pattern;
@Component
public class InvProductDao implements MongoBaseDao<InvProductEntity, FilterInvProductRequest> {
public class InvProductMdDao implements MongoBaseDao<InvProductEntity, FilterInvProductRequest> {
@Resource
private MongoTemplate mongoTemplate;
@ -179,4 +180,8 @@ public class InvProductDao implements MongoBaseDao<InvProductEntity, FilterInvPr
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.ReflectUtil;
import com.glxp.udi.admin.entity.inout.OrderDetailEntity;
import com.glxp.udi.admin.entity.mongo.ErpOrderEntity;
import com.glxp.udi.admin.mongo.MongoDBName;
import com.glxp.udi.admin.mongo.dao.base.MongoBaseDao;
import com.glxp.udi.admin.mongo.utils.MongoPageHelper;
import com.glxp.udi.admin.mongo.utils.PageResult;
import com.glxp.udi.admin.req.inout.FilterErpOrderRequest;
import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
@ -20,7 +21,7 @@ import java.util.Arrays;
import java.util.List;
@Component
public class OrderDetailDao implements MongoBaseDao<OrderDetailEntity, FilterErpOrderRequest> {
public class OrderDetailMdDao implements MongoBaseDao<OrderDetailEntity, FilterOrderDetailRequest> {
@Resource
private MongoTemplate mongoTemplate;
@ -29,25 +30,25 @@ public class OrderDetailDao implements MongoBaseDao<OrderDetailEntity, FilterErp
@Override
public PageResult<OrderDetailEntity> pageQuery(Query query, FilterErpOrderRequest filterErpOrderRequest, int page, int size) {
if (null == query && null != filterErpOrderRequest) {
query = buildQuery(filterErpOrderRequest);
public PageResult<OrderDetailEntity> pageQuery(Query query, FilterOrderDetailRequest filterOrderDetailRequest, int page, int size) {
if (null == query && null != filterOrderDetailRequest) {
query = buildQuery(filterOrderDetailRequest);
}
return mongoPageHelper.pageQuery(query, OrderDetailEntity.class, size, page, MongoDBName.NAME_ORDER_DETAIL);
}
@Override
public List<OrderDetailEntity> findList(Query query, FilterErpOrderRequest filterErpOrderRequest) {
if (null == query && null != filterErpOrderRequest) {
query = buildQuery(filterErpOrderRequest);
public List<OrderDetailEntity> findList(Query query, FilterOrderDetailRequest filterOrderDetailRequest) {
if (null == query && null != filterOrderDetailRequest) {
query = buildQuery(filterOrderDetailRequest);
}
return mongoTemplate.find(query, OrderDetailEntity.class, MongoDBName.NAME_ORDER_DETAIL);
}
@Override
public OrderDetailEntity findOne(Query query, FilterErpOrderRequest filterErpOrderRequest) {
if (null == query && null != filterErpOrderRequest) {
query = buildQuery(filterErpOrderRequest);
public OrderDetailEntity findOne(Query query, FilterOrderDetailRequest filterOrderDetailRequest) {
if (null == query && null != filterOrderDetailRequest) {
query = buildQuery(filterOrderDetailRequest);
}
return mongoTemplate.findOne(query, OrderDetailEntity.class, MongoDBName.NAME_ORDER_DETAIL);
}
@ -64,17 +65,17 @@ public class OrderDetailDao implements MongoBaseDao<OrderDetailEntity, FilterErp
}
@Override
public void delete(Query query, FilterErpOrderRequest filterErpOrderRequest) {
public void delete(Query query, FilterOrderDetailRequest filterOrderDetailRequest) {
if (null == query) {
query = buildQuery(filterErpOrderRequest);
query = buildQuery(filterOrderDetailRequest);
}
mongoTemplate.remove(query, OrderDetailEntity.class, MongoDBName.NAME_ORDER_DETAIL);
}
@Override
public long count(Query query, FilterErpOrderRequest filterErpOrderRequest) {
public long count(Query query, FilterOrderDetailRequest filterOrderDetailRequest) {
if (null == query) {
query = buildQuery(filterErpOrderRequest);
query = buildQuery(filterOrderDetailRequest);
}
return mongoTemplate.count(query, OrderDetailEntity.class, MongoDBName.NAME_ORDER_DETAIL);
}
@ -93,14 +94,14 @@ public class OrderDetailDao implements MongoBaseDao<OrderDetailEntity, FilterErp
/**
* mongodb
*
* @param filterErpOrderRequest
* @param filterOrderDetailRequest
* @return
*/
private Query buildQuery(FilterErpOrderRequest filterErpOrderRequest) {
private Query buildQuery(FilterOrderDetailRequest filterOrderDetailRequest) {
Query query = new Query();
Field[] fields = ReflectUtil.getFields(FilterErpOrderRequest.class);
Field[] fields = ReflectUtil.getFields(FilterOrderDetailRequest.class);
Arrays.stream(fields).forEach(field -> {
Object fieldValue = ReflectUtil.getFieldValue(filterErpOrderRequest, field);
Object fieldValue = ReflectUtil.getFieldValue(filterOrderDetailRequest, field);
if (ObjectUtil.isNotEmpty(fieldValue)) {
if ("orderId".equals(field.getName())) {
query.addCriteria(Criteria.where("orderIdFk").is(fieldValue));
@ -154,4 +155,8 @@ public class OrderDetailDao implements MongoBaseDao<OrderDetailEntity, FilterErp
return update;
}
public List<ErpOrderEntity> getOrderDetailList() {
return mongoTemplate.findAll(ErpOrderEntity.class, MongoDBName.NAME_ORDER_DETAIL);
}
}

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

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

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

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

@ -6,8 +6,9 @@ import com.glxp.udi.admin.constant.ConstantStatus;
import com.glxp.udi.admin.constant.TypeConstant;
import com.glxp.udi.admin.entity.inout.*;
import com.glxp.udi.admin.entity.mongo.OrderMdEntity;
import com.glxp.udi.admin.entity.mongo.WarehouseMdEntity;
import com.glxp.udi.admin.mongo.service.*;
import com.glxp.udi.admin.req.inout.FilterErpOrderRequest;
import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest;
import com.glxp.udi.admin.req.inout.OrderFilterRequest;
import com.glxp.udi.admin.req.inout.WarehouseQueryRequest;
import com.glxp.udi.admin.service.inout.UdiInfoService;
@ -29,10 +30,10 @@ public class InvProductsTrService {
@Lazy
@Resource
private OrderMdService orderService;
private OrderService orderService;
@Lazy
@Resource
private OrderDetailMdService myErpOrderService;
private OrderDetailService myErpOrderService;
@Lazy
@Resource
private WarehouseMdService codesService;
@ -41,7 +42,7 @@ public class InvProductsTrService {
private UdiInfoService udiInfoService;
@Lazy
@Resource
private InvProductMdService invProductService;
private InvProductService invProductService;
@Lazy
@Resource
private InvProductDetailMdService invProductDetailService;
@ -56,9 +57,9 @@ public class InvProductsTrService {
OrderMdEntity orderEntity = orderMdEntities.get(0);
String customerId = orderEntity.getCustomerId() + "";
if (orderEntity.getStatus().equals(ConstantStatus.ORDER_STATUS_SUCCESS)) {
FilterErpOrderRequest filterErpOrderRequest = new FilterErpOrderRequest();
filterErpOrderRequest.setOrderId(orderId);
List<OrderDetailEntity> erpOrderEntities = myErpOrderService.filterOrderDetails(filterErpOrderRequest);
FilterOrderDetailRequest filterOrderDetailRequest = new FilterOrderDetailRequest();
filterOrderDetailRequest.setOrderId(orderId);
List<OrderDetailEntity> erpOrderEntities = myErpOrderService.filterOrderDetails(filterOrderDetailRequest);
if (erpOrderEntities != null && erpOrderEntities.size() > 0) {
for (OrderDetailEntity orderDetailEntity : erpOrderEntities) {
String nameCode = orderDetailEntity.getNameCode();
@ -103,7 +104,7 @@ public class InvProductsTrService {
if (StrUtil.isNotBlank(invProductEntity.getBatchNo())) {
warehouseQueryRequest.setBatchNo(invProductEntity.getBatchNo());
}
List<WarehouseEntity> warehouseEntities = codesService.filterWarehouse(warehouseQueryRequest);
List<WarehouseMdEntity> warehouseEntities = codesService.filterWarehouse(warehouseQueryRequest);
if (CollUtil.isNotEmpty(warehouseEntities)) {
for (WarehouseEntity warehouseEntity : warehouseEntities) {
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.ScheduledEntity;
import com.glxp.udi.admin.entity.inout.OrderDetailEntity;
import com.glxp.udi.admin.entity.inout.OrderEntity;
import com.glxp.udi.admin.entity.inout.UnitMaintainEntity;
import com.glxp.udi.admin.entity.inout.WarehouseEntity;
import com.glxp.udi.admin.entity.mongo.OrderMdEntity;
import com.glxp.udi.admin.entity.mongo.WarehouseMdEntity;
import com.glxp.udi.admin.entity.param.SystemParamConfigEntity;
import com.glxp.udi.admin.mongo.service.OrderDetailMdService;
import com.glxp.udi.admin.mongo.service.OrderMdService;
import com.glxp.udi.admin.mongo.service.OrderDetailService;
import com.glxp.udi.admin.mongo.service.OrderService;
import com.glxp.udi.admin.mongo.service.WarehouseMdService;
import com.glxp.udi.admin.req.inout.FilterErpOrderRequest;
import com.glxp.udi.admin.req.inout.FilterOrderDetailRequest;
import com.glxp.udi.admin.req.inout.PostUdimsOrderDetailRequest;
import com.glxp.udi.admin.req.inout.PostUdimsOrderRequest;
import com.glxp.udi.admin.req.inout.WarehouseQueryRequest;
@ -53,7 +54,7 @@ public class SubmitOrderToSpmsTask implements SchedulingConfigurer {
@Resource
private ScheduledDao scheduledDao;
@Resource
private OrderMdService orderMdService;
private OrderService orderService;
@Resource
private UnitMaintainService unitMaintainService;
@Resource
@ -63,7 +64,7 @@ public class SubmitOrderToSpmsTask implements SchedulingConfigurer {
@Resource
private WarehouseMdService warehouseMdService;
@Resource
private OrderDetailMdService orderDetailMdService;
private OrderDetailService orderDetailService;
@Resource
private PlatformService platformService;
@ -94,18 +95,18 @@ public class SubmitOrderToSpmsTask implements SchedulingConfigurer {
SystemParamConfigEntity systemParamConfigEntity = systemParamCustomerConfigService.getParamByKey(SystemParamConstant.IS_AUTO_SUBMIT_TO_SPMS, Long.valueOf(unitMaintainEntity.getCustomerId()));
if (null != systemParamConfigEntity && systemParamConfigEntity.getParamValue().equals("1")) {
//查询此用户未提交到自助平台且单据类型匹配的数据
List<OrderMdEntity> orderMdEntities = orderMdService.findWaitUploadOrders(unitMaintainEntity);
if (CollUtil.isNotEmpty(orderMdEntities)) {
List<OrderEntity> orderEntities = orderService.findWaitUploadOrders(unitMaintainEntity);
if (CollUtil.isNotEmpty(orderEntities)) {
//构造参数
PostUdimsOrderRequest postUdimsOrderRequest = new PostUdimsOrderRequest();
List<PostUdimsOrderRequest.OrderBean> orderBeans = new ArrayList<>();
for (OrderMdEntity orderMdEntity : orderMdEntities) {
for (OrderEntity orderEntity : orderEntities) {
PostUdimsOrderRequest.OrderBean orderBean = new PostUdimsOrderRequest.OrderBean();
BeanUtil.copyProperties(orderMdEntity, orderBean);
BeanUtil.copyProperties(orderEntity, orderBean);
orderBean.setAction(unitMaintainEntity.getTargetAction());
WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest();
warehouseQueryRequest.setOrderId(orderMdEntity.getOrderId());
List<WarehouseEntity> warehouseEntities = warehouseMdService.filterWarehouse(warehouseQueryRequest);
warehouseQueryRequest.setOrderId(orderEntity.getOrderId());
List<WarehouseMdEntity> warehouseEntities = warehouseMdService.filterWarehouse(warehouseQueryRequest);
List<PostUdimsOrderRequest.OrderBean.CodeBean> codeBeans = new ArrayList<>();
warehouseEntities.forEach(data -> {
PostUdimsOrderRequest.OrderBean.CodeBean codeBean = new PostUdimsOrderRequest.OrderBean.CodeBean();
@ -113,10 +114,10 @@ public class SubmitOrderToSpmsTask implements SchedulingConfigurer {
codeBeans.add(codeBean);
});
//查询单据详情
FilterErpOrderRequest filterErpOrderRequest = new FilterErpOrderRequest();
filterErpOrderRequest.setOrderId(orderBean.getOrderId());
FilterOrderDetailRequest filterOrderDetailRequest = new FilterOrderDetailRequest();
filterOrderDetailRequest.setOrderId(orderBean.getOrderId());
//单据详情
List<OrderDetailEntity> erpOrderEntities = orderDetailMdService.filterOrderDetails(filterErpOrderRequest);
List<OrderDetailEntity> erpOrderEntities = orderDetailService.filterOrderDetails(filterOrderDetailRequest);
if (CollUtil.isNotEmpty(erpOrderEntities)) {
List<PostUdimsOrderDetailRequest> orderDetails = new ArrayList<>();
for (OrderDetailEntity orderDetailEntity : erpOrderEntities) {
@ -148,11 +149,11 @@ public class SubmitOrderToSpmsTask implements SchedulingConfigurer {
JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
});
if (baseResponse.getCode() == 20000) {
log.info("自动上传单据成功," + unitMaintainEntity.getName() + "上传单据数量为 " + orderMdEntities.size());
for (OrderMdEntity orderMdEntity : orderMdEntities) {
log.info("自动上传单据成功," + unitMaintainEntity.getName() + "上传单据数量为 " + orderEntities.size());
for (OrderMdEntity orderMdEntity : orderEntities) {
log.info("修改单号为:{} 的上传状态", orderMdEntity.getOrderId());
orderMdEntity.setUploadStatus("1");
orderMdService.updateOrder(orderMdEntity);
orderService.updateOrder(orderMdEntity);
}
} else {
log.error("自动上传单据到自助平台异常,响应结果:{}", response);

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

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

@ -7,7 +7,7 @@ import com.glxp.udi.admin.dao.info.ScheduledDao;
import com.glxp.udi.admin.entity.info.ScheduledEntity;
import com.glxp.udi.admin.entity.mongo.OrderMdEntity;
import com.glxp.udi.admin.entity.param.SystemParamConfigEntity;
import com.glxp.udi.admin.mongo.service.OrderMdService;
import com.glxp.udi.admin.mongo.service.OrderService;
import com.glxp.udi.admin.req.inout.OrderFilterRequest;
import com.glxp.udi.admin.req.udidl.ScheduledRequest;
import com.glxp.udi.admin.service.param.SystemParamConfigService;
@ -34,7 +34,7 @@ public class TransInoutTask implements SchedulingConfigurer {
@Resource
private SystemParamCustomerConfigService systemParamCustomerConfigService;
@Resource
private OrderMdService orderMdService;
private OrderService orderService;
@Resource
protected ScheduledDao scheduledDao;
@ -60,7 +60,7 @@ public class TransInoutTask implements SchedulingConfigurer {
//查询待处理单据,判断此单据的用户是否开启了自动处理单据,如果已开启则自动处理,未开启跳过
OrderFilterRequest orderFilterRequest = new OrderFilterRequest();
orderFilterRequest.setStatus(ConstantStatus.ORDER_STATUS_WAIT);
List<OrderMdEntity> list = orderMdService.findAll(orderFilterRequest);
List<OrderMdEntity> list = orderService.findAll(orderFilterRequest);
if (CollUtil.isNotEmpty(list)) {
for (OrderMdEntity orderMdEntity : list) {
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.WarehousetempEntity;
import com.glxp.udi.admin.entity.udid.UdiEntity;
import com.glxp.udi.admin.mongo.service.OrderDetailMdService;
import com.glxp.udi.admin.mongo.service.OrderDetailService;
import com.glxp.udi.admin.mongo.service.WarehouseMdService;
import com.glxp.udi.admin.req.inout.FilterWarehouseRequest;
import com.glxp.udi.admin.service.info.SetupService;
@ -208,7 +208,7 @@ public class InoutUtils {
}
public void generateConstrastDetail(UdiInfoService udiInfoService, UdiRelevanceService udiRelevanceService,
OrderDetailMdService orderDetailMdService,
OrderDetailService orderDetailService,
List<WarehouseEntity> warehouseEntityList) {
if (warehouseEntityList != null && warehouseEntityList.size() > 0) {
List<UdiInfoEntity> udiInfoEntities = new ArrayList<>();
@ -254,7 +254,7 @@ public class InoutUtils {
erpOrderEntities.add(orderDetailEntity);
}
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