|
|
|
@ -106,8 +106,6 @@ public class IoTransInoutService {
|
|
|
|
|
@Resource
|
|
|
|
|
private CheckOrderUtils checkOrderUtils;
|
|
|
|
|
@Resource
|
|
|
|
|
InvProductDetailService invProductDetailService;
|
|
|
|
|
@Resource
|
|
|
|
|
InvProductService invProductService;
|
|
|
|
|
@Resource
|
|
|
|
|
InvPreProductService invPreProductService;
|
|
|
|
@ -428,14 +426,6 @@ public class IoTransInoutService {
|
|
|
|
|
orderService.updateRemark(orderEntity.getId(), "udi码:" + warehouseEntity.getCode() + "该产品不允许以使用单元入库!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// if (bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_OUT && bussinessTypeEntity.getMainAction().equals(ConstantType.TYPE_PUT)) {
|
|
|
|
|
// CompanyProductRelevanceEntity companyProductRelevanceEntity = companyProductRelevanceService.findByUdiRlIdUnitFk(udiRelevanceResponse.getId() + "", warehouseEntity.getFromCorpId());
|
|
|
|
|
// if (companyProductRelevanceEntity == null) {
|
|
|
|
|
// orderService.updateOrderStatus(warehouseEntity.getOrderId(), ConstantStatus.ORDER_STATUS_FAIL);
|
|
|
|
|
// orderService.updateRemark(orderEntity.getId(), udiRelevanceResponse.getCpmctymc() + "该产品非此供应商配送");
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -702,145 +692,6 @@ public class IoTransInoutService {
|
|
|
|
|
new InoutUtils(udiUrl).generateConstrastDetail(udiInfoService, udiRelevanceService, myErpOrderService, warehouseEntityList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void checkMutiDi(String orderId, BussinessTypeEntity bussinessTypeEntity) {
|
|
|
|
|
//校验是否di绑定多个产品ID
|
|
|
|
|
OrderEntity orderEntity = orderService.findById(orderId);
|
|
|
|
|
FilterErpOrderRequest filterErpOrderRequest = new FilterErpOrderRequest();
|
|
|
|
|
filterErpOrderRequest.setOrderId(orderId);
|
|
|
|
|
List<ErpOrderEntity> erpOrderEntities = myErpOrderService.filterAllMyErpOrder(filterErpOrderRequest);
|
|
|
|
|
int checkStatus = ConstantStatus.ORDER_STATUS_CHECK;
|
|
|
|
|
if (erpOrderEntities != null && erpOrderEntities.size() > 0) {
|
|
|
|
|
for (ErpOrderEntity erpOrderEntity : erpOrderEntities) {
|
|
|
|
|
|
|
|
|
|
//校验DI是否绑定多个产品ID
|
|
|
|
|
FilterUdiInfoRequest filterUdiInfoRequest = new FilterUdiInfoRequest();
|
|
|
|
|
filterUdiInfoRequest.setNameCode(erpOrderEntity.getNameCode());
|
|
|
|
|
List<UdiRelevanceResponse> udiRelevanceEntities = udiRelevanceService.filterUdiRelevance(filterUdiInfoRequest);
|
|
|
|
|
if (udiRelevanceEntities != null && udiRelevanceEntities.size() > 1 && erpOrderEntity.getBindRlFk() == null) {
|
|
|
|
|
|
|
|
|
|
erpOrderEntity.setBindStatus(ConstantStatus.ORDER_DETAIL_DI_MUTI);
|
|
|
|
|
myErpOrderService.updateErpOrder(erpOrderEntity);
|
|
|
|
|
orderEntity.setRemark("该产品维护多个产品信息,请在扫码单据详情绑定对应产品产品信息");
|
|
|
|
|
checkStatus = ConstantStatus.ORDER_CHECK_FAIL;
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
if ((erpOrderEntity.getSupId() == null || erpOrderEntity.getSupId().equals("MUTI"))) {
|
|
|
|
|
if (erpOrderEntity.getSupId() == null) {
|
|
|
|
|
erpOrderEntity.setBindStatus(ConstantStatus.ORDER_DETAIL_SUP_NONE);
|
|
|
|
|
orderEntity.setRemark("该产品未指定供应商");
|
|
|
|
|
} else {
|
|
|
|
|
erpOrderEntity.setBindStatus(ConstantStatus.ORDER_DETAIL_SUP_MUTI);
|
|
|
|
|
orderEntity.setRemark("该产品指定多个供应商");
|
|
|
|
|
}
|
|
|
|
|
checkStatus = ConstantStatus.ORDER_CHECK_FAIL;
|
|
|
|
|
} else {
|
|
|
|
|
CompanyProductRelevanceEntity companyProductRelevanceEntity = companyProductRelevanceService.findByUdiRlIdUnitFk(erpOrderEntity.getBindRlFk(), erpOrderEntity.getSupId());
|
|
|
|
|
if (companyProductRelevanceEntity == null) {
|
|
|
|
|
orderEntity.setRemark(erpOrderEntity.getCoName() + "该产品非此供应商配送");
|
|
|
|
|
checkStatus = ConstantStatus.ORDER_CHECK_FAIL;
|
|
|
|
|
} else {
|
|
|
|
|
orderEntity.setContrastStatus(checkStatus);
|
|
|
|
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_CHECK);
|
|
|
|
|
orderService.updateOrder(orderEntity);
|
|
|
|
|
erpOrderEntity.setBindStatus(ConstantStatus.ORDER_DETAIL_SUP_ONE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
myErpOrderService.updateErpOrder(erpOrderEntity);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
orderEntity.setContrastStatus(checkStatus);
|
|
|
|
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS);
|
|
|
|
|
orderService.updateOrder(orderEntity);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void updateSuccess(OrderEntity orderEntity, int checkStatus, int status, String remark) {
|
|
|
|
|
orderEntity.setContrastStatus(ConstantStatus.ORDER_CHECK_UN);
|
|
|
|
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_CHECK);
|
|
|
|
|
orderService.updateOrder(orderEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// //校验ERP单
|
|
|
|
|
@Async
|
|
|
|
|
public void checkOrder() {
|
|
|
|
|
|
|
|
|
|
OrderFilterRequest orderFilterRequest = new OrderFilterRequest();
|
|
|
|
|
orderFilterRequest.setStatus(ConstantStatus.ORDER_STATUS_CHECK);
|
|
|
|
|
List<OrderEntity> orderEntities = orderService.findAllOrders(orderFilterRequest);
|
|
|
|
|
for (int i = 0; i < orderEntities.size(); i++) {
|
|
|
|
|
OrderEntity orderEntity = orderEntities.get(i);
|
|
|
|
|
checkOrder(orderEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Async
|
|
|
|
|
public void repeatPrint(OrderEntity orderEntity) {
|
|
|
|
|
syncprintOrder(orderEntity.getId());
|
|
|
|
|
invProductsTrService.genInvProducts(orderEntity.getId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void checkOrder(OrderEntity orderEntity) {
|
|
|
|
|
orderEntity = orderService.findById(orderEntity.getId());
|
|
|
|
|
List<String> erpIds = DataTransUtil.strToErpList(orderEntity.getErpFk());
|
|
|
|
|
List<WarehouseEntity> transData = warehouseService.findByReceiptId(orderEntity.getId());
|
|
|
|
|
myErpOrderService.deleteByOrderId(orderEntity.getId());
|
|
|
|
|
genOrderDetail(transData);
|
|
|
|
|
if (erpIds != null && erpIds.size() > 0) {
|
|
|
|
|
List<ErpOrderEntity> erpOrderEntities = thrDataService.getStockOrders(erpIds);
|
|
|
|
|
checkOrderUtils.check(orderEntity.getId(), erpOrderEntities);
|
|
|
|
|
} else {
|
|
|
|
|
// orderEntity.setContrastStatus(ConstantStatus.ORDER_CHECK_UN);
|
|
|
|
|
// orderEntity.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS);
|
|
|
|
|
// orderEntity.setRemark("未选入第三方出入库单据进行校验,请手动选择");
|
|
|
|
|
// orderService.updateOrder(orderEntity);
|
|
|
|
|
// myErpOrderService.deleteByOrderId(orderEntity.getId());
|
|
|
|
|
// new InoutUtils(udiUrl).generateConstrastDetail(udiInfoService, udiRelevanceService, myErpOrderService, transData);
|
|
|
|
|
// printOrder(orderEntity.getId());
|
|
|
|
|
// if (orderEntity.getCustomerId().equals(Constant.SYSTEM_CUSTOMER_ID)) {
|
|
|
|
|
// invProductsTrService.genInvProducts(orderEntity.getId());
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void checkThirdOrder(List<ErpOrderEntity> cloudErps, OrderEntity orderEntity, List<WarehouseEntity> transData) {
|
|
|
|
|
if (cloudErps != null && cloudErps.size() > 0) {
|
|
|
|
|
List<ErpOrderEntity> returnOrders = new ContrastErpUtil().transErp(cloudErps, udiRelevanceService, orderEntity.getId());
|
|
|
|
|
ErpOrderEntity temp = returnOrders.get(0);
|
|
|
|
|
for (int i = 0; i < returnOrders.size(); i++) {
|
|
|
|
|
if (!temp.getCompanyname().equals(returnOrders.get(i).getCompanyname())) {
|
|
|
|
|
orderEntity.setContrastStatus(ConstantStatus.ORDER_CHECK_FAIL);
|
|
|
|
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS);
|
|
|
|
|
orderEntity.setRemark("选择Erp订单往来单位不一致");
|
|
|
|
|
orderService.updateOrder(orderEntity);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
myErpOrderService.deleteByOrderId(orderEntity.getId());
|
|
|
|
|
myErpOrderService.insertErpOrders(returnOrders);
|
|
|
|
|
BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(orderEntity.getAction());
|
|
|
|
|
new ContrastErpUtil(udiUrl).contrastErp(udiInfoService, udiRelevanceService, myErpOrderService,
|
|
|
|
|
orderService, transData, systemParamConfigService, bussinessTypeEntity);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
orderEntity.setContrastStatus(ConstantStatus.ORDER_CHECK_FAIL);
|
|
|
|
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS);
|
|
|
|
|
orderEntity.setRemark("获取ERP出入库单据失败");
|
|
|
|
|
orderService.updateOrder(orderEntity);
|
|
|
|
|
myErpOrderService.deleteByOrderId(orderEntity.getId());
|
|
|
|
|
new InoutUtils(udiUrl).generateConstrastDetail(udiInfoService, udiRelevanceService, myErpOrderService, transData);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//重码校验错误重新提交
|
|
|
|
|
@Async
|
|
|
|
@ -852,13 +703,6 @@ public class IoTransInoutService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//重新校验
|
|
|
|
|
@Async
|
|
|
|
|
public void repeatCheck(String orderId) {
|
|
|
|
|
OrderEntity orderEntity = orderService.findById(orderId);
|
|
|
|
|
checkOrder(orderEntity);
|
|
|
|
|
WebSocketServer.sendInfo("单据:" + orderId + "校验已完成,请刷新查看!", null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//校验ERP单后,订单详情转入等待打印
|
|
|
|
|
@Async
|
|
|
|
@ -886,6 +730,7 @@ public class IoTransInoutService {
|
|
|
|
|
for (ErpOrderEntity erpOrderEntity : erpOrderEntities) {
|
|
|
|
|
StockOrderDetailEntity stockOrderDetailEntity = new StockOrderDetailEntity();
|
|
|
|
|
stockOrderDetailEntity.setProductId(erpOrderEntity.getGoodsid());
|
|
|
|
|
stockOrderDetailEntity.setRelId(erpOrderEntity.getGoodsid());
|
|
|
|
|
stockOrderDetailEntity.setProductName(erpOrderEntity.getGoodsname());
|
|
|
|
|
|
|
|
|
|
if (erpOrderEntity.getGoodsid() == null)
|
|
|
|
@ -910,27 +755,6 @@ public class IoTransInoutService {
|
|
|
|
|
if (erpOrderEntity.getErpCount() != null) {
|
|
|
|
|
stockOrderDetailEntity.setCount(erpOrderEntity.getErpCount() + "");
|
|
|
|
|
}
|
|
|
|
|
// FilterUdiInfoRequest filterUdiInfoRequest = new FilterUdiInfoRequest();
|
|
|
|
|
// filterUdiInfoRequest.setNameCode(erpOrderEntity.getNameCode());
|
|
|
|
|
// List<UdiRelevanceResponse> udiRelevanceEntities = udiRelevanceService.filterUdiRelevance(filterUdiInfoRequest);
|
|
|
|
|
// if (udiRelevanceEntities != null && udiRelevanceEntities.size() > 1 && erpOrderEntity.getBindRlFk() == null) {
|
|
|
|
|
// isError = true;
|
|
|
|
|
// erpOrderEntity.setBindStatus(ConstantStatus.ORDER_DETAIL_DI_MUTI);
|
|
|
|
|
// myErpOrderService.updateErpOrder(erpOrderEntity);
|
|
|
|
|
// } else if (udiRelevanceEntities.size() == 1) {
|
|
|
|
|
// UdiRelevanceResponse udiRelevanceEntity = udiRelevanceEntities.get(0);
|
|
|
|
|
// setThridName(bussinessTypeEntity, stockOrderDetailEntity, udiRelevanceEntity);
|
|
|
|
|
//
|
|
|
|
|
// } else if (erpOrderEntity.getBindRlFk() != null) {
|
|
|
|
|
// UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(erpOrderEntity.getBindRlFk());
|
|
|
|
|
// UdiRelevanceResponse udiRelevanceResponse = new UdiRelevanceResponse();
|
|
|
|
|
// BeanUtils.copyProperties(udiRelevanceEntity, udiRelevanceResponse);
|
|
|
|
|
// udiRelevanceResponse.setId(Integer.parseInt(udiRelevanceEntity.getId()));
|
|
|
|
|
// setThridName(bussinessTypeEntity, stockOrderDetailEntity, udiRelevanceResponse);
|
|
|
|
|
// erpOrderEntity.setGoodsid(stockOrderDetailEntity.getProductId());
|
|
|
|
|
// erpOrderEntity.setGoodsname(stockOrderDetailEntity.getProductName());
|
|
|
|
|
// myErpOrderService.updateErpOrder(erpOrderEntity);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
stockOrderDetailEntities.add(stockOrderDetailEntity);
|
|
|
|
|
}
|
|
|
|
@ -1024,29 +848,6 @@ public class IoTransInoutService {
|
|
|
|
|
return stockOrderEntity;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setThridName(BussinessTypeEntity bussinessTypeEntity, StockOrderDetailEntity stockOrderDetailEntity, UdiRelevanceResponse udiRelevanceEntity) {
|
|
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.getThirdSysFk() == null) {
|
|
|
|
|
stockOrderDetailEntity.setProductId(udiRelevanceEntity.getId() + "");
|
|
|
|
|
} else if (bussinessTypeEntity.getThirdSysFk().equals("thirdId")) {
|
|
|
|
|
stockOrderDetailEntity.setProductId(udiRelevanceEntity.getThirdId());
|
|
|
|
|
stockOrderDetailEntity.setProductName(udiRelevanceEntity.getThirdName());
|
|
|
|
|
} else if (bussinessTypeEntity.getThirdSysFk().equals("thirdId1")) {
|
|
|
|
|
stockOrderDetailEntity.setProductId(udiRelevanceEntity.getThirdId1());
|
|
|
|
|
stockOrderDetailEntity.setProductName(udiRelevanceEntity.getThirdName1());
|
|
|
|
|
} else if (bussinessTypeEntity.getThirdSysFk().equals("thirdId2")) {
|
|
|
|
|
stockOrderDetailEntity.setProductId(udiRelevanceEntity.getThirdId2());
|
|
|
|
|
stockOrderDetailEntity.setProductName(udiRelevanceEntity.getThirdName2());
|
|
|
|
|
} else if (bussinessTypeEntity.getThirdSysFk().equals("thirdId3")) {
|
|
|
|
|
stockOrderDetailEntity.setProductId(udiRelevanceEntity.getThirdId3());
|
|
|
|
|
stockOrderDetailEntity.setProductName(udiRelevanceEntity.getThirdName3());
|
|
|
|
|
} else if (bussinessTypeEntity.getThirdSysFk().equals("thirdId4")) {
|
|
|
|
|
stockOrderDetailEntity.setProductId(udiRelevanceEntity.getThirdId4());
|
|
|
|
|
stockOrderDetailEntity.setProductName(udiRelevanceEntity.getThirdName4());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|