|
|
|
@ -38,6 +38,7 @@ public class InvProductsTrService {
|
|
|
|
|
orderFilterRequest.setId(orderId);
|
|
|
|
|
List<OrderMdEntity> orderMdEntities = orderService.findAll(orderFilterRequest);
|
|
|
|
|
OrderMdEntity orderEntity = orderMdEntities.get(0);
|
|
|
|
|
String customerId = orderEntity.getCustomerId() + "";
|
|
|
|
|
if (orderEntity.getStatus().equals("success")) {
|
|
|
|
|
FilterErpOrderRequest filterErpOrderRequest = new FilterErpOrderRequest();
|
|
|
|
|
filterErpOrderRequest.setOrderId(orderId);
|
|
|
|
@ -46,8 +47,8 @@ public class InvProductsTrService {
|
|
|
|
|
for (ErpOrderEntity erpOrderEntity : erpOrderEntities) {
|
|
|
|
|
|
|
|
|
|
String nameCode = erpOrderEntity.getNameCode();
|
|
|
|
|
UdiInfoEntity udiInfoEntity = udiInfoService.findByNameCode(nameCode);
|
|
|
|
|
InvProductEntity invProductEntity = invProductService.selectByUuid(udiInfoEntity.getUuid(), erpOrderEntity.getLotno());
|
|
|
|
|
UdiInfoEntity udiInfoEntity = udiInfoService.findByNameCode(nameCode, customerId);
|
|
|
|
|
InvProductEntity invProductEntity = invProductService.selectByUuid(udiInfoEntity.getUuid(), erpOrderEntity.getLotno(), orderEntity.getCustomerId() + "");
|
|
|
|
|
if (invProductEntity == null) {
|
|
|
|
|
invProductEntity = new InvProductEntity();
|
|
|
|
|
invProductEntity.setRelIdFk(udiInfoEntity.getUuid());
|
|
|
|
@ -62,11 +63,13 @@ public class InvProductsTrService {
|
|
|
|
|
invProductEntity.setZczbhhzbapzbh(erpOrderEntity.getAuthCode());
|
|
|
|
|
if (orderEntity.getMainAction().equals(TypeConstant.TYPE_OUT)) {
|
|
|
|
|
invProductEntity.setOutCount(erpOrderEntity.getCount());
|
|
|
|
|
invProductEntity.setInCount(0);
|
|
|
|
|
} else if (orderEntity.getMainAction().equals(TypeConstant.TYPE_PUT)) {
|
|
|
|
|
invProductEntity.setInCount(erpOrderEntity.getCount());
|
|
|
|
|
invProductEntity.setOutCount(0);
|
|
|
|
|
}
|
|
|
|
|
invProductService.insertInvProduct(invProductEntity);
|
|
|
|
|
invProductEntity = invProductService.selectByUuid(invProductEntity.getRelIdFk(), invProductEntity.getBatchNo());
|
|
|
|
|
invProductEntity = invProductService.selectByUuid(invProductEntity.getRelIdFk(), invProductEntity.getBatchNo(), orderEntity.getCustomerId() + "");
|
|
|
|
|
} else {
|
|
|
|
|
if (orderEntity.getMainAction().equals(TypeConstant.TYPE_OUT)) {
|
|
|
|
|
invProductEntity.setOutCount(invProductEntity.getOutCount() + erpOrderEntity.getCount());
|
|
|
|
@ -81,17 +84,21 @@ public class InvProductsTrService {
|
|
|
|
|
if (warehouseEntities != null && warehouseEntities.size() > 0) {
|
|
|
|
|
|
|
|
|
|
for (WarehouseEntity warehouseEntity : warehouseEntities) {
|
|
|
|
|
UdiInfoEntity tempUdi = udiInfoService.findByNameCode(warehouseEntity.getUdi());
|
|
|
|
|
UdiInfoEntity tempUdi = udiInfoService.findByNameCode(warehouseEntity.getUdi(), customerId);
|
|
|
|
|
if (tempUdi.getUuid().equals(erpOrderEntity.getUuidFk())) {
|
|
|
|
|
if ((warehouseEntity.getBatchNo() == null && erpOrderEntity.getLotno() == null) ||
|
|
|
|
|
warehouseEntity.getBatchNo().equals(erpOrderEntity.getLotno())) {
|
|
|
|
|
InvProductDetailEntity invProductDetailEntity = new InvProductDetailEntity();
|
|
|
|
|
invProductDetailEntity.setProductIdFk(invProductEntity.getId() + "");
|
|
|
|
|
invProductDetailEntity.setProductIdFk(invProductEntity.getRelIdFk() + "");
|
|
|
|
|
invProductDetailEntity.setInvProductIdFk(invProductEntity.getId());
|
|
|
|
|
invProductDetailEntity.setCode(warehouseEntity.getCode());
|
|
|
|
|
invProductDetailEntity.setOrderIdFk(warehouseEntity.getOrderId());
|
|
|
|
|
invProductDetailEntity.setCount(warehouseEntity.getCount());
|
|
|
|
|
invProductDetailEntity.setAction(warehouseEntity.getAction());
|
|
|
|
|
invProductDetailEntity.setBatchNo(warehouseEntity.getBatchNo());
|
|
|
|
|
invProductDetailEntity.setMainAction(warehouseEntity.getMainAction());
|
|
|
|
|
invProductDetailEntity.setProductionDate(warehouseEntity.getProduceDate());
|
|
|
|
|
invProductDetailEntity.setExpireDate(warehouseEntity.getExpireDate());
|
|
|
|
|
invProductDetailEntity.setUpdateTime(new Date());
|
|
|
|
|
invProductDetailEntity.setCustomerId(orderEntity.getCustomerId() + "");
|
|
|
|
|
invProductDetailService.insertInvProduct(invProductDetailEntity);
|
|
|
|
|