|
|
|
@ -1,27 +1,30 @@
|
|
|
|
|
package com.logpm.factory.snm.service.impl; |
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
|
|
|
import com.logpm.factory.snm.constant.PanFactoryEnum; |
|
|
|
|
import com.logpm.factory.snm.entity.PanFactoryOrder; |
|
|
|
|
import com.logpm.factory.snm.entity.PanPackageInfo; |
|
|
|
|
import com.logpm.factory.snm.entity.PanPackageList; |
|
|
|
|
import com.logpm.factory.snm.service.IAsyncDataService; |
|
|
|
|
import com.logpm.factory.snm.service.IPanFactoryOrderService; |
|
|
|
|
import com.logpm.factory.snm.service.IPanPackageInfoService; |
|
|
|
|
import com.logpm.factory.snm.service.IPanPackageListService; |
|
|
|
|
import com.logpm.oldproject.entity.AdvanceDetailEntity; |
|
|
|
|
import com.logpm.oldproject.entity.AdvanceEntity; |
|
|
|
|
import com.logpm.oldproject.entity.DetailProductEntity; |
|
|
|
|
import com.logpm.oldproject.entity.ServiceNumEntity; |
|
|
|
|
import com.logpm.oldproject.feign.IAdvanceClient; |
|
|
|
|
import com.logpm.oldproject.feign.IAdvanceDetailClient; |
|
|
|
|
import com.logpm.oldproject.feign.IServiceNumClient; |
|
|
|
|
import com.logpm.oldproject.feign.IWarehouseClient; |
|
|
|
|
import com.logpm.oldproject.feign.*; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.extern.log4j.Log4j2; |
|
|
|
|
import org.springblade.core.tool.utils.StringUtil; |
|
|
|
|
import org.springframework.scheduling.annotation.Async; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import java.time.LocalDate; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Objects; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 异步线程处理 |
|
|
|
@ -34,7 +37,7 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
|
|
|
|
|
private final IAdvanceClient iAdvanceClient; |
|
|
|
|
private final IAdvanceDetailClient advanceDetailClient; |
|
|
|
|
private final IServiceNumClient serviceNumClient; |
|
|
|
|
private final IWarehouseClient warehouseClient; |
|
|
|
|
private final IDetailProductClient detailProductClient; |
|
|
|
|
private final IPanFactoryOrderService panFactoryOrderService; |
|
|
|
|
private final IPanPackageInfoService panPackageInfoService; |
|
|
|
|
private final IPanPackageListService panPackageListService; |
|
|
|
@ -60,43 +63,44 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
|
|
|
|
|
|
|
|
|
|
//添加订单信息
|
|
|
|
|
AdvanceEntity advanceEntity = new AdvanceEntity(); |
|
|
|
|
advanceEntity.setOrderSelfNum(panFactoryOrder.getOrderNo()); //订单自编号
|
|
|
|
|
advanceEntity.setSiteName(""); // 基地 TODO 通过工厂id映射
|
|
|
|
|
advanceEntity.setArea(""); // 区域
|
|
|
|
|
advanceEntity.setOrderSelfNum(StringUtil.isBlank(panFactoryOrder.getOrderNo())?"":panFactoryOrder.getOrderNo()); //订单自编号
|
|
|
|
|
advanceEntity.setSiteName(PanFactoryEnum.getMes(panFactoryOrder.getPlantId())); // 基地
|
|
|
|
|
advanceEntity.setArea(StringUtil.isBlank(panFactoryOrder.getReceiverArea())?"":panFactoryOrder.getReceiverArea()); // 区域
|
|
|
|
|
advanceEntity.setOrderTypeName(""); //订单类型名称 可以为空
|
|
|
|
|
advanceEntity.setOrderClassName("工厂"); //订单类型 可以为空
|
|
|
|
|
advanceEntity.setType("皮阿诺"); |
|
|
|
|
advanceEntity.setTotal(panFactoryOrder.getServiceCount()); //订单总数据
|
|
|
|
|
advanceEntity.setMctsTruck(panFactoryOrder.getDeliveryNumber()); //车次
|
|
|
|
|
advanceEntity.setMctsTruck(StringUtil.isBlank(panFactoryOrder.getDeliveryNumber())?"":panFactoryOrder.getDeliveryNumber()); //车次
|
|
|
|
|
advanceEntity.setMtdsNo("");// MTDS单号 可以为空
|
|
|
|
|
advanceEntity.setFirstPackName(""); //一级品类
|
|
|
|
|
advanceEntity.setFirstPackCode(""); //一级品类
|
|
|
|
|
advanceEntity.setDealerName(""); //商场名称
|
|
|
|
|
advanceEntity.setDealerCode(panFactoryOrder.getUserId()); //商场编码
|
|
|
|
|
advanceEntity.setDealerCode(StringUtil.isBlank(panFactoryOrder.getUserId())?"":panFactoryOrder.getUserId()); //商场编码
|
|
|
|
|
advanceEntity.setDueDate(""); // 交期
|
|
|
|
|
advanceEntity.setIsOpai(0); //是否干仓配
|
|
|
|
|
advanceEntity.setOrderNum("");//MSCS订单号 可以为空
|
|
|
|
|
advanceEntity.setCarrierName("汇通物流");//承运商 可以为空
|
|
|
|
|
advanceEntity.setCustomerName(panFactoryOrder.getCustomerName()); //顾客名称
|
|
|
|
|
advanceEntity.setCustomerPhone(panFactoryOrder.getCustomerNumber()); // 顾客电话
|
|
|
|
|
advanceEntity.setCustomerRoad(panFactoryOrder.getCustomerAddress());//顾客地址
|
|
|
|
|
advanceEntity.setCarrierName("汇通");//承运商 可以为空
|
|
|
|
|
advanceEntity.setCustomerName(StringUtil.isBlank(panFactoryOrder.getCustomerName())?"":panFactoryOrder.getCustomerName()); //顾客名称
|
|
|
|
|
advanceEntity.setCustomerPhone(StringUtil.isBlank(panFactoryOrder.getCustomerNumber())?"":panFactoryOrder.getCustomerNumber()); // 顾客电话
|
|
|
|
|
advanceEntity.setCustomerRoad(StringUtil.isBlank(panFactoryOrder.getCustomerAddress())?"":panFactoryOrder.getCustomerAddress());//顾客地址
|
|
|
|
|
advanceEntity.setSystemType("线上"); //订单类型
|
|
|
|
|
advanceEntity.setStoreNo(""); //门店编码
|
|
|
|
|
advanceEntity.setStoreName(""); //门店名称
|
|
|
|
|
advanceEntity.setSerialKey(""); //序列号
|
|
|
|
|
advanceEntity.setServiceNum(panFactoryOrder.getServiceNum()); //服务号
|
|
|
|
|
advanceEntity.setServiceNum(StringUtil.isBlank(panFactoryOrder.getServiceNum())?"":panFactoryOrder.getServiceNum()); //服务号
|
|
|
|
|
advanceEntity.setMatingCode("");//齐套模式 可以为空
|
|
|
|
|
advanceEntity.setContractNum("");//合同号 可以为空
|
|
|
|
|
advanceEntity.setLeaveBehind("");//遗留:Y=是,N=否
|
|
|
|
|
advanceEntity.setSenderMobile(panFactoryOrder.getSenderMobile());//发货人电话 可以为空
|
|
|
|
|
advanceEntity.setSenderAddress(panFactoryOrder.getSenderAddress()); //发货地址 可以为空
|
|
|
|
|
advanceEntity.setSenderName(panFactoryOrder.getSendFactory()); //发货工厂名称 可以为空
|
|
|
|
|
advanceEntity.setAdministratorsId(1073);// 导入人
|
|
|
|
|
advanceEntity.setSenderMobile(StringUtil.isBlank(panFactoryOrder.getSenderMobile())?"":panFactoryOrder.getSenderMobile());//发货人电话 可以为空
|
|
|
|
|
advanceEntity.setSenderAddress(StringUtil.isBlank(panFactoryOrder.getSenderAddress())?"":panFactoryOrder.getSenderAddress()); //发货地址 可以为空
|
|
|
|
|
advanceEntity.setSenderName(StringUtil.isBlank(panFactoryOrder.getSendFactory())?"":panFactoryOrder.getSendFactory()); //发货工厂名称 可以为空
|
|
|
|
|
advanceEntity.setAdministratorsId(0);// 导入人
|
|
|
|
|
advanceEntity.setCreateTime(LocalDate.now()); //添加时间
|
|
|
|
|
advanceEntity.setCarsNum(panFactoryOrder.getDeliveryNumber()); //派车单--snm 可以为空
|
|
|
|
|
advanceEntity.setCarsNum(StringUtil.isBlank(panFactoryOrder.getDeliveryNumber())?"":panFactoryOrder.getDeliveryNumber()); //派车单--snm 可以为空
|
|
|
|
|
advanceEntity.setDeleteTime(0); // 删除时间
|
|
|
|
|
advanceEntity.setWaybillNo("");//运单号 可以为空
|
|
|
|
|
advanceEntity.setWarehouseId(0); //导入人仓库id TODO 通过映射去查
|
|
|
|
|
Integer id = PanFactoryEnum.getId(panFactoryOrder.getPlantId()); |
|
|
|
|
advanceEntity.setWarehouseId(id); //导入人仓库id
|
|
|
|
|
advanceEntity.setWaybillStatus(Byte.parseByte("1"));//开单状态:1=未开单,2=已开单
|
|
|
|
|
advanceEntity.setOldId(0);//
|
|
|
|
|
advanceEntity.setFreeze(Byte.parseByte("1"));//冻结状态:1=正常,2=冻结
|
|
|
|
@ -116,10 +120,11 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
|
|
|
|
|
|
|
|
|
|
//通过订单id查询对应的包件
|
|
|
|
|
QueryWrapper<PanPackageInfo> packageQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
orderQueryWrapper.eq("order_id",orderId) |
|
|
|
|
packageQueryWrapper.eq("order_id",orderId) |
|
|
|
|
.eq("is_deleted",0); |
|
|
|
|
List<PanPackageInfo> packages = panPackageInfoService.list(packageQueryWrapper); |
|
|
|
|
for(PanPackageInfo panPackageInfo:packages){ |
|
|
|
|
Long packageId = panPackageInfo.getId(); |
|
|
|
|
//添加订单明细
|
|
|
|
|
AdvanceDetailEntity advanceDetailEntity = new AdvanceDetailEntity(); |
|
|
|
|
advanceDetailEntity.setAdvanceId(advanceId);//预仓id
|
|
|
|
@ -133,24 +138,24 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
|
|
|
|
|
advanceDetailEntity.setOrderNum("");//MSCS单号 可以为空
|
|
|
|
|
advanceDetailEntity.setIsOpai(0);//是否干仓配:1=是,0=否
|
|
|
|
|
advanceDetailEntity.setMtdsNo("");//MTDS单号 可以为空
|
|
|
|
|
advanceDetailEntity.setFirstPackName(panPackageInfo.getFirstPackName());//一级品类
|
|
|
|
|
advanceDetailEntity.setFirstPackCode(panPackageInfo.getFirstPackCode());//二级品类
|
|
|
|
|
advanceDetailEntity.setSiteName("Objects.isNull(stationlinenumEntity) ? null : stationlinenumEntity.getLogisticsLineName()");//基地名称 基地 TODO 通过工厂id映射
|
|
|
|
|
advanceDetailEntity.setFirstPackName(StringUtil.isBlank(panPackageInfo.getFirstPackName())?"":panPackageInfo.getFirstPackName());//一级品类
|
|
|
|
|
advanceDetailEntity.setFirstPackCode(StringUtil.isBlank(panPackageInfo.getFirstPackCode())?"":panPackageInfo.getFirstPackCode());//二级品类
|
|
|
|
|
advanceDetailEntity.setSiteName(PanFactoryEnum.getMes(panPackageInfo.getPlantId()));//基地名称 基地
|
|
|
|
|
advanceDetailEntity.setSiteCode("");//基地编码
|
|
|
|
|
advanceDetailEntity.setProductCode(panPackageInfo.getProductCode());//货品名称 可以为空
|
|
|
|
|
advanceDetailEntity.setSecondPackName(panPackageInfo.getSecondPackName());//二级品类名称
|
|
|
|
|
advanceDetailEntity.setSecondPackCode(panPackageInfo.getSecondPackCode());//二级品类
|
|
|
|
|
advanceDetailEntity.setThirdPackName(panPackageInfo.getThirdPackName());//三级品类名称
|
|
|
|
|
advanceDetailEntity.setThirdPackCode(panPackageInfo.getThirdPackCode());//三级品类
|
|
|
|
|
advanceDetailEntity.setProductCode(StringUtil.isBlank(panPackageInfo.getProductCode())?"":panPackageInfo.getProductCode());//货品名称 可以为空
|
|
|
|
|
advanceDetailEntity.setSecondPackName(StringUtil.isBlank(panPackageInfo.getSecondPackName())?"":panPackageInfo.getSecondPackName());//二级品类名称
|
|
|
|
|
advanceDetailEntity.setSecondPackCode(StringUtil.isBlank(panPackageInfo.getSecondPackCode())?"":panPackageInfo.getSecondPackCode());//二级品类
|
|
|
|
|
advanceDetailEntity.setThirdPackName(StringUtil.isBlank(panPackageInfo.getThirdPackName())?"":panPackageInfo.getThirdPackName());//三级品类名称
|
|
|
|
|
advanceDetailEntity.setThirdPackCode(StringUtil.isBlank(panPackageInfo.getThirdPackCode())?"":panPackageInfo.getThirdPackCode());//三级品类
|
|
|
|
|
advanceDetailEntity.setGoodName("");//v产品类型 可以为空
|
|
|
|
|
advanceDetailEntity.setIsAddin("Y");//例放:N=正常,Y=例放
|
|
|
|
|
advanceDetailEntity.setIsThirdAddin("N");//三级例放:N=正常,Y=例放
|
|
|
|
|
advanceDetailEntity.setIsSuppin("N");//补进:N=正常,Y=例放
|
|
|
|
|
advanceDetailEntity.setMscsNum(panPackageInfo.getProductNum()+"");//发货数量
|
|
|
|
|
advanceDetailEntity.setMscsNum(Objects.isNull(panPackageInfo.getProductNum())?"1":panPackageInfo.getProductNum()+"");//发货数量
|
|
|
|
|
advanceDetailEntity.setMtdsNum(0);//销售数量
|
|
|
|
|
advanceDetailEntity.setVolume("");//体积
|
|
|
|
|
advanceDetailEntity.setUnitNo(panPackageInfo.getUnitNo());//包条码
|
|
|
|
|
advanceDetailEntity.setMctsTruck(panFactoryOrder.getDeliveryNumber());//车次号
|
|
|
|
|
advanceDetailEntity.setUnitNo(StringUtil.isBlank(panPackageInfo.getUnitNo())?"":panPackageInfo.getUnitNo());//包条码
|
|
|
|
|
advanceDetailEntity.setMctsTruck(StringUtil.isBlank(panFactoryOrder.getDeliveryNumber())?"":panFactoryOrder.getDeliveryNumber());//车次号
|
|
|
|
|
advanceDetailEntity.setMctsTruckNo("");//车牌号
|
|
|
|
|
advanceDetailEntity.setDate100(null);//基地发货日期
|
|
|
|
|
advanceDetailEntity.setDate2("");//预约到厂时间
|
|
|
|
@ -160,14 +165,14 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
|
|
|
|
|
advanceDetailEntity.setDate6("");//车辆离厂时间
|
|
|
|
|
advanceDetailEntity.setCreateTime(LocalDate.now());//创建时间
|
|
|
|
|
advanceDetailEntity.setDeleteTime(0);//删除时间
|
|
|
|
|
advanceDetailEntity.setServiceNum(panFactoryOrder.getServiceNum());//服务号
|
|
|
|
|
advanceDetailEntity.setServiceNum(StringUtil.isBlank(panFactoryOrder.getServiceNum())?"":panFactoryOrder.getServiceNum());//服务号
|
|
|
|
|
advanceDetailEntity.setAdmin("");//
|
|
|
|
|
advanceDetailEntity.setAdministratorsId(0);//导入人
|
|
|
|
|
// advanceDetailEntity.setDueDate(0);//交期
|
|
|
|
|
advanceDetailEntity.setRemark("");//备注
|
|
|
|
|
advanceDetailEntity.setOldId(0);//
|
|
|
|
|
boolean b = advanceDetailClient.addAdvanceDetail(advanceDetailEntity); |
|
|
|
|
if(b){ |
|
|
|
|
Integer detailId = advanceDetailClient.addAdvanceDetail(advanceDetailEntity); |
|
|
|
|
if(detailId > 0){ |
|
|
|
|
//修改数据状态
|
|
|
|
|
panPackageInfo.setStatus(0); |
|
|
|
|
panPackageInfoService.saveOrUpdate(panPackageInfo); |
|
|
|
@ -175,31 +180,47 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
|
|
|
|
|
panPackageInfo.setStatus(2); |
|
|
|
|
panPackageInfoService.saveOrUpdate(panPackageInfo); |
|
|
|
|
} |
|
|
|
|
Integer detailId = advanceDetailEntity.getId(); |
|
|
|
|
|
|
|
|
|
//查询包件明细
|
|
|
|
|
// List<DetailProductEntity> saveList = new ArrayList<>();
|
|
|
|
|
// QueryWrapper<PanPackageList> listQueryWrapper = new QueryWrapper<>();
|
|
|
|
|
// orderQueryWrapper.eq("package_id",detailId)
|
|
|
|
|
// .eq("is_deleted",0);
|
|
|
|
|
// List<PanPackageList> lists = panPackageListService.list(listQueryWrapper);
|
|
|
|
|
// for (PanPackageList panPackageList:lists){
|
|
|
|
|
// DetailProductEntity detailProductEntity = new DetailProductEntity();
|
|
|
|
|
// detailProductEntity.setUnitNo(panPackageInfo.getUnitNo());
|
|
|
|
|
// detailProductEntity.setProductcode(panPackageList.get);
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
List<DetailProductEntity> saveList = new ArrayList<>(); |
|
|
|
|
QueryWrapper<PanPackageList> listQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
listQueryWrapper.eq("package_id",packageId) |
|
|
|
|
.eq("is_deleted",0); |
|
|
|
|
List<PanPackageList> lists = panPackageListService.list(listQueryWrapper); |
|
|
|
|
for (PanPackageList panPackageList:lists){ |
|
|
|
|
DetailProductEntity detailProductEntity = new DetailProductEntity(); |
|
|
|
|
detailProductEntity.setUnitNo(panPackageInfo.getUnitNo()); |
|
|
|
|
detailProductEntity.setProductcode(StringUtil.isBlank(panPackageList.getProsBarcode())?"":panPackageList.getProsBarcode()); |
|
|
|
|
detailProductEntity.setProductname(StringUtil.isBlank(panPackageList.getBoardName())?"":panPackageList.getBoardName()); |
|
|
|
|
detailProductEntity.setSalenum(0); |
|
|
|
|
detailProductEntity.setDelivernum(Objects.isNull(panPackageList.getQuantity())?0:panPackageList.getQuantity()); |
|
|
|
|
detailProductEntity.setProducttype(""); |
|
|
|
|
detailProductEntity.setBuyTime(""); |
|
|
|
|
detailProductEntity.setAdministratorsId(0); |
|
|
|
|
detailProductEntity.setDeleteTime(0); |
|
|
|
|
detailProductEntity.setCreateTime(LocalDate.now()); |
|
|
|
|
saveList.add(detailProductEntity); |
|
|
|
|
} |
|
|
|
|
if(saveList.size()>0){ |
|
|
|
|
boolean flag = detailProductClient.addDetailProductList(saveList); |
|
|
|
|
UpdateWrapper<PanPackageList> listUpdateWrapper = new UpdateWrapper<>(); |
|
|
|
|
if(!flag){ |
|
|
|
|
listUpdateWrapper.set("status",2).eq("package_id",packageId).eq("is_deleted",0); |
|
|
|
|
}else{ |
|
|
|
|
listUpdateWrapper.set("status",0).eq("package_id",packageId).eq("is_deleted",0); |
|
|
|
|
} |
|
|
|
|
panPackageListService.update(listUpdateWrapper); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ServiceNumEntity serviceNum = new ServiceNumEntity(); |
|
|
|
|
serviceNum.setServiceNum(panFactoryOrder.getServiceNum()); //服务号
|
|
|
|
|
serviceNum.setServiceNum(StringUtil.isBlank(panFactoryOrder.getServiceNum())?"":panFactoryOrder.getServiceNum()); //服务号
|
|
|
|
|
serviceNum.setTotal("1"); //订单数量
|
|
|
|
|
serviceNum.setDetailTotal(panFactoryOrder.getServiceCount()+""); // 包数量
|
|
|
|
|
serviceNum.setStoreName(panFactoryOrder.getUserName()); //商场名
|
|
|
|
|
serviceNum.setDetailTotal(Objects.isNull(panFactoryOrder.getServiceCount())?"":panFactoryOrder.getServiceCount()+""); // 包数量
|
|
|
|
|
serviceNum.setStoreName(StringUtil.isBlank(panFactoryOrder.getUserName())?"":panFactoryOrder.getUserName()); //商场名
|
|
|
|
|
serviceNum.setStoreNo(""); // 商场编号
|
|
|
|
|
serviceNum.setCustomerName(panFactoryOrder.getCustomerName()); //顾客姓名
|
|
|
|
|
serviceNum.setCustomerPhone(panFactoryOrder.getCustomerNumber()); //顾客电话
|
|
|
|
|
serviceNum.setCustomerName(StringUtil.isBlank(panFactoryOrder.getCustomerName())?"":panFactoryOrder.getCustomerName());//顾客姓名
|
|
|
|
|
serviceNum.setCustomerPhone(StringUtil.isBlank(panFactoryOrder.getCustomerNumber())?"":panFactoryOrder.getCustomerNumber()); //顾客电话
|
|
|
|
|
serviceNum.setCustomerRoad(""); //顾客地址
|
|
|
|
|
serviceNum.setIsOpai(1); //是否干仓配
|
|
|
|
|
serviceNum.setCompleteSet("V"); //齐套标识:Y=齐套,N=未齐套,V=未知
|
|
|
|
|