Browse Source

1.补丁-新增零担拉取逻辑更新优化

pull/4/head
zhenghaoyu 11 months ago
parent
commit
21b2c40eb5
  1. 103
      blade-service/logpm-patch/src/main/java/com/logpm/patch/service/impl/SyncOrderInfoServiceImpl.java

103
blade-service/logpm-patch/src/main/java/com/logpm/patch/service/impl/SyncOrderInfoServiceImpl.java

@ -820,19 +820,17 @@ public class SyncOrderInfoServiceImpl implements ISyncOrderInfoService {
warehouseWaybill = saveZeroWayBillData(wayBillEntity);
}
//创建在库订单
createStockArticle(warehouseWaybill);
createZeroStockArticle(warehouseWaybill,num);
log.info("###############waybillDataHandler: 处理数据结束 waybillNo={}", waybillNo);
}
private void createStockArticle(WarehouseWaybillEntity warehouseWaybill) {
private void createZeroStockArticle(WarehouseWaybillEntity warehouseWaybill,Integer num) {
//判断新系统是否有这条订单数据
//自动生成的在库订单就用运单号作为订单号
String waybillNo = warehouseWaybill.getWaybillNo();
Long waybillId = warehouseWaybill.getId();
String destinationWarehouse = warehouseWaybill.getDestinationWarehouseName();//目的仓
Long destinationWarehouseId = warehouseWaybill.getDestinationWarehouseId();
Integer totalCount = warehouseWaybill.getTotalCount();//订单总数量
Integer stockCount = warehouseWaybill.getStockCount();//订单在库数量
String consignee = warehouseWaybill.getConsignee();
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(destinationWarehouseId);
DistributionStockArticleEntity distributionStockArticleEntity = distributionStockArticleClient.findByOrderSelfNum(waybillNo,destinationWarehouseId);
@ -855,7 +853,8 @@ public class SyncOrderInfoServiceImpl implements ISyncOrderInfoService {
distributionStockArticleEntity.setWarehouse(basicdataWarehouseEntity.getName());
distributionStockArticleEntity.setWarehouseEntryTime(date);
distributionStockArticleEntity.setTotalNumber(totalCount);
distributionStockArticleEntity.setHandQuantity(stockCount);
distributionStockArticleEntity.setHandQuantity(num);
distributionStockArticleEntity.setIncomingNum(num);
distributionStockArticleEntity.setDealerName(consignee);
if(!Objects.isNull(clientEntity)){
@ -885,21 +884,23 @@ public class SyncOrderInfoServiceImpl implements ISyncOrderInfoService {
distributionStockArticleEntity.setCustomerTelephone(warehouseWaybill.getConsigneeMobile());
distributionStockArticleEntity.setCustomerAddress(warehouseWaybill.getConsigneeAddress());
distributionStockArticleEntity.setGenre(1);
distributionStockArticleEntity.setCreateUser(1123598821738675201L);
distributionStockArticleEntity.setUpdateUser(1123598821738675201L);
distributionStockArticleEntity.setTenantId(TenantNum.HUITONGCODE);
distributionStockArticleEntity.setCreateUser(1714696768639311873L);
distributionStockArticleEntity.setUpdateUser(1714696768639311873L);
distributionStockArticleEntity.setCreateDept(1649331096241836033L);
distributionStockArticleEntity.setSortingQuantity(0); //分拣件数
distributionStockArticleEntity.setDeliveryQuantity(0); //配送件数
distributionStockArticleEntity.setTransferQuantity(0); //中转件数
distributionStockArticleEntity.setSigninQuantity(0); //签收件数
distributionStockArticleEntity.setSigninQuantity(totalCount-num); //签收件数
distributionStockArticleEntity.setFreezeStatus(OrderFreezeStatusConstant.weidongjie.getValue()); //冻结状态
distributionStockArticleEntity.setReservationStatus(OrderReservationStatusConstant.daiyuyue.getValue()); //预约状态
distributionStockArticleEntity.setStockupStatus(OrderStockupStatusConstant.daibeihuo.getValue()); //备货状态
distributionStockArticleEntity.setGroundingStatus(OrderGroundingStatusConstant.daishangjia.getValue()); //上架状态
distributionStockArticleEntity.setOrderStatus(OrderStatusConstant.bufenruku.getValue());
distributionStockArticleEntity.setOrderStatus(OrderStatusConstant.ruku.getValue());
distributionStockArticleEntity.setOrderReceiveStatus(OrderReceiveStatusConstant.bufenshouhuo.getValue());
checkStatus(distributionStockArticleEntity);
distributionStockArticleEntity.setConsigneeUnit(customerName);//收货单位(经销商)
distributionStockArticleEntity.setConsigneeUnit(warehouseWaybill.getConsignee());//收货单位(经销商)
distributionStockArticleEntity.setConsigneePerson(warehouseWaybill.getConsigneeName());//收货人
distributionStockArticleEntity.setConsigneeMobile(warehouseWaybill.getConsigneeMobile());
distributionStockArticleEntity.setConsigneeAddress(warehouseWaybill.getConsigneeAddress());
@ -969,9 +970,13 @@ public class SyncOrderInfoServiceImpl implements ISyncOrderInfoService {
List<DistributionParcelNumberEntity> parcelNumberList = new ArrayList<>();
for (DistributionParcelListEntity entity:ls){
DistributionParcelNumberEntity parcelNumberEntity = new DistributionParcelNumberEntity();
parcelNumberEntity.setTenantId(TenantNum.HUITONGCODE);
parcelNumberEntity.setCreateUser(1714696768639311873L);
parcelNumberEntity.setUpdateUser(1714696768639311873L);
parcelNumberEntity.setCreateDept(1649331096241836033L);
parcelNumberEntity.setStockArticleId(id);
parcelNumberEntity.setParcelListId(entity.getId());
if(totalCount.equals(stockCount)){
if(totalCount.equals(num)){
parcelNumberEntity.setHandQuantity(entity.getQuantity());
}else{
parcelNumberEntity.setHandQuantity(0);
@ -984,17 +989,6 @@ public class SyncOrderInfoServiceImpl implements ISyncOrderInfoService {
}
//存入零担订单包件数量
distributionParcelNumberClient.addBatch(parcelNumberList);
} else {
id = distributionStockArticleEntity.getId();
distributionStockArticleEntity.setTotalNumber(totalCount);
distributionStockArticleEntity.setHandQuantity(stockCount);
distributionStockArticleEntity.setWarehouseEntryTimeEnd(date);
log.info(">>>> 更新订单");
checkStatus(distributionStockArticleEntity);
distributionStockArticleClient.saveOrUpdate(distributionStockArticleEntity);
}
}
@ -1016,9 +1010,14 @@ public class SyncOrderInfoServiceImpl implements ISyncOrderInfoService {
Integer number = wayBillEntity.getNumber();//运单总数量
String packname = wayBillEntity.getPackname();
String agent = wayBillEntity.getAgent();
String waybillNo = wayBillEntity.getWaybillNo();
WarehouseWaybillEntity warehouseWaybill = new WarehouseWaybillEntity();
warehouseWaybill.setWaybillNo(wayBillEntity.getWaybillNo());
warehouseWaybill.setTenantId(TenantNum.HUITONGCODE);
warehouseWaybill.setCreateUser(1714696768639311873L);
warehouseWaybill.setUpdateUser(1714696768639311873L);
warehouseWaybill.setCreateDept(1649331096241836033L);
warehouseWaybill.setWaybillNo(waybillNo);
warehouseWaybill.setDestinationWarehouseName(warehouseName);
warehouseWaybill.setDestinationWarehouseId(Objects.isNull(endhouse) ? null : endhouse.getId());
warehouseWaybill.setDepartureWarehouseName(startSite);
@ -1029,7 +1028,6 @@ public class SyncOrderInfoServiceImpl implements ISyncOrderInfoService {
String takeCompany = wayBillEntity.getTakeCompany();//收货单位
BasicdataClientEntity sendClient = basicdataClientClient.findByName(sendCompany);
BasicdataClientEntity takeClient = basicdataClientClient.findByName(takeCompany);
warehouseWaybill.setServiceType(1);// 默认为商配
if (!Objects.isNull(sendClient)) {
Long clientEntityId = sendClient.getId();//基础客户
warehouseWaybill.setShipperId(clientEntityId);
@ -1044,20 +1042,20 @@ public class SyncOrderInfoServiceImpl implements ISyncOrderInfoService {
}
warehouseWaybill.setShipper(sendCompany);
warehouseWaybill.setShipperName(wayBillEntity.getSendPerson());
warehouseWaybill.setShipperMobile(wayBillEntity.getSendPhone());
warehouseWaybill.setShipperMobile(wayBillEntity.getSendMobile());
warehouseWaybill.setShipperAddress(wayBillEntity.getSendAddress());
warehouseWaybill.setConsignee(takeCompany);
warehouseWaybill.setConsigneeName(wayBillEntity.getTakePerson());
warehouseWaybill.setConsigneeMobile(wayBillEntity.getTakePhone());
warehouseWaybill.setConsigneeMobile(wayBillEntity.getTakeMobile());
warehouseWaybill.setConsigneeAddress(wayBillEntity.getTakeAddress());
warehouseWaybill.setDestination(wayBillEntity.getArriveSite());
warehouseWaybill.setGoodsName(packname);
warehouseWaybill.setTotalCount(number);
warehouseWaybill.setStockCount(number);
warehouseWaybill.setStockCount(1);
warehouseWaybill.setTotalWeight(wayBillEntity.getWeight());
warehouseWaybill.setTotalVolume(wayBillEntity.getVolume());
warehouseWaybill.setDeliveryMethod(wayBillEntity.getSendType());
warehouseWaybill.setUrgency(wayBillEntity.getUrgency()+"");
warehouseWaybill.setUrgency(wayBillEntity.getUrgency());
warehouseWaybill.setReceiptCount(wayBillEntity.getReceiptNum());
warehouseWaybill.setReceiptRequirement(wayBillEntity.getReceiptAsk());
//--------------2023-07-28-------------
@ -1066,15 +1064,38 @@ public class SyncOrderInfoServiceImpl implements ISyncOrderInfoService {
warehouseWaybill.setReplacePrice(wayBillEntity.getReplacePrice());
warehouseWaybill.setReceivedReplacePrice(BigDecimal.ZERO);
warehouseWaybill.setReceivedTotalPrice(BigDecimal.ZERO);
warehouseWaybill.setWaybillType(2);
warehouseWaybill.setWaybillType(wayBillEntity.getType());
warehouseWaybill.setReceivedStatus(0);
warehouseWaybill.setTenantId(TenantNum.HUITONGCODE);
warehouseWaybill.setTotalFreight(wayBillEntity.getFreight());
warehouseWaybill.setDeliveryFee(wayBillEntity.getDeliveryCost());
warehouseWaybill.setPickupFee(wayBillEntity.getTakeCost());
warehouseWaybill.setWarehouseManagementFee(wayBillEntity.getWarehouseManagementFee());
warehouseWaybill.setStorageFee(wayBillEntity.getWarehousingFee());
warehouseWaybill.setHandlingFee(wayBillEntity.getPretendCost());
warehouseWaybill.setOtherFee(wayBillEntity.getOtherFee());
warehouseWaybill.setInsuranceFee(wayBillEntity.getPriceProtectionFee());
warehouseWaybill.setClaimingValue(wayBillEntity.getValue());
warehouseWaybill.setPayType(wayBillEntity.getPayType()+"");
warehouseWaybill.setPayWay(wayBillEntity.getPaymentMethod()+"");
warehouseWaybill.setXPay(wayBillEntity.getXPay());
warehouseWaybill.setDPay(wayBillEntity.getDPay());
warehouseWaybill.setHPay(wayBillEntity.getHPay());
warehouseWaybill.setYPay(wayBillEntity.getYPay());
warehouseWaybill.setThirdOperationFee(wayBillEntity.getThreeHandleFee());
warehouseWaybill.setDeliveryWay(wayBillEntity.getSendType()+"");
warehouseWaybill.setUrgency(wayBillEntity.getUrgency()+"");
warehouseWaybill.setReceipt(wayBillEntity.getReceiptAsk());
warehouseWaybill.setReceiptNum(wayBillEntity.getReceiptNum());
warehouseWaybill.setTransportType(wayBillEntity.getShippingType()+"");
warehouseWaybill.setRebate(wayBillEntity.getRebate());
BasicdataClientEntity agentClient = basicdataClientClient.findByName(agent);
if (!Objects.isNull(agentClient)) {
Long clientEntityId = agentClient.getId();//基础客户
warehouseWaybill.setAgentId(clientEntityId);
}
Date date = new Date();
warehouseWaybill.setAgent(agent);
warehouseWaybill.setDocumentMakingTime(wayBillEntity.getPreparationTime());
warehouseWaybill.setRemark(wayBillEntity.getMsg());
@ -1082,7 +1103,6 @@ public class SyncOrderInfoServiceImpl implements ISyncOrderInfoService {
warehouseWaybill.setFreezeStatus(0);
warehouseWaybill.setStatus(0);
warehouseWaybill.setIsDeleted(0);
Date date = new Date();
warehouseWaybill.setCreateTime(date);
warehouseWaybill.setUpdateTime(date);
Long waybillId = warehouseWaybillClient.addEnntity(warehouseWaybill);
@ -1095,17 +1115,32 @@ public class SyncOrderInfoServiceImpl implements ISyncOrderInfoService {
for (WaybillDesEntity waybillDesEntity : des) {
WarehouseWayBillDetail warehouseWayBillDetail = new WarehouseWayBillDetail();
warehouseWayBillDetail.setCreateUser(1714696768639311873L);
warehouseWayBillDetail.setUpdateUser(1714696768639311873L);
warehouseWayBillDetail.setCreateDept(1649331096241836033L);
warehouseWayBillDetail.setWaybillId(waybillId);
warehouseWayBillDetail.setWaybillNo(wayBillEntity.getWaybillNo());
String name = waybillDesEntity.getName();
BasicdataCategoryEntity categoryEntity = categoryClient.findByName(name);
Long productId = null;
if(Objects.isNull(categoryEntity)){
categoryEntity = new BasicdataCategoryEntity();
categoryEntity.setTenantId(TenantNum.HUITONGCODE);
categoryEntity.setName(name);
categoryEntity.setType(1);
categoryEntity.setCreateUser(1714696768639311873L);
categoryEntity.setUpdateUser(1714696768639311873L);
categoryEntity.setCreateDept(1649331096241836033L);
productId = categoryClient.addReturnId(categoryEntity);
}else{
productId = categoryEntity.getId();
}
warehouseWayBillDetail.setProductName(waybillDesEntity.getName());
warehouseWayBillDetail.setProductId(productId);
warehouseWayBillDetail.setChargeType(waybillDesEntity.getPic());
warehouseWayBillDetail.setProductName(name);
warehouseWayBillDetail.setNum(waybillDesEntity.getNum());
warehouseWayBillDetail.setPrice(waybillDesEntity.getPrice());
warehouseWayBillDetail.setSubtotalFreight(waybillDesEntity.getTotalDesPrice());
warehouseWayBillDetail.setStatus(1);
warehouseWayBillDetail.setIsDeleted(0);
warehouseWayBillDetail.setCreateTime(date);

Loading…
Cancel
Save