Browse Source

1.皮阿诺数据接收逻辑修改 2023-06-16 18:43

dev-warehouse
zhenghaoyu 2 years ago
parent
commit
4c4f18795b
  1. 5
      blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/entity/DetailProductEntity.java
  2. 5
      blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IAdvanceDetailClient.java
  3. 8
      blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IDetailProductClient.java
  4. 2
      blade-service/logpm-factory/src/main/java/com/logpm/factory/jobhandler/FactoryXxlJob.java
  5. 65
      blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/constant/PanFactoryEnum.java
  6. 22
      blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/controller/PanFactoryDataController.java
  7. 5
      blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IPanFactoryDataService.java
  8. 129
      blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/AsyncDataServiceImpl.java
  9. 5
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/AdvanceDetailClient.java
  10. 8
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/DetailProductClient.java
  11. 5
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.xml
  12. 5
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/DetailProductMapper.java
  13. 12
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/DetailProductMapper.xml
  14. 9
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IDetailProductService.java
  15. 9
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/DetailProductServiceImpl.java

5
blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/entity/DetailProductEntity.java

@ -22,9 +22,6 @@ import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.tenant.mp.TenantEntity;
import java.time.LocalDate;
@ -37,7 +34,7 @@ import java.time.LocalDate;
@Data
@TableName("ht_detail_product")
@ApiModel(value = "DetailProduct对象", description = "包内产品明细")
public class DetailProductEntity {
public class DetailProductEntity{
@TableId(
value = "id",

5
blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IAdvanceDetailClient.java

@ -21,6 +21,7 @@ import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Map;
@ -55,7 +56,7 @@ public interface IAdvanceDetailClient {
* @return
*/
@PostMapping(API_PREFIX + "/addAdvanceDetail")
boolean addAdvanceDetail(@RequestBody AdvanceDetailEntity advanceDetailEntity);
Integer addAdvanceDetail(@RequestBody AdvanceDetailEntity advanceDetailEntity);
/**
@ -64,5 +65,5 @@ public interface IAdvanceDetailClient {
* @return
*/
@GetMapping(API_PREFIX + "/getSupplyData")
Map<String, String> getSupplyData(String unitNo);
Map<String, String> getSupplyData(@RequestParam String unitNo);
}

8
blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IDetailProductClient.java

@ -17,11 +17,12 @@
package com.logpm.oldproject.feign;
import com.logpm.oldproject.entity.DetailProductEntity;
import org.springblade.common.constant.LauncherConstant;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
* 包内产品明细 Feign接口类
*
@ -29,7 +30,7 @@ import org.springframework.web.bind.annotation.RequestBody;
* @since 2023-05-10
*/
@FeignClient(
value = "logpm-old-project-cyz"
value = "logpm-old-project"
)
public interface IDetailProductClient {
@ -54,5 +55,6 @@ public interface IDetailProductClient {
@PostMapping(API_PREFIX + "/addDetailProduct")
Boolean addDetailProduct(@RequestBody DetailProductEntity detailProductEntity);
@PostMapping(API_PREFIX + "/addDetailProductList")
Boolean addDetailProductList(@RequestBody List<DetailProductEntity> detailProductEntitys);
}

2
blade-service/logpm-factory/src/main/java/com/logpm/factory/jobhandler/FactoryXxlJob.java

@ -313,7 +313,7 @@ public class FactoryXxlJob {
// advanceDetailEntity.setDueDate(0);//交期
advanceDetailEntity.setRemark("");//备注
advanceDetailEntity.setOldId(0);//
boolean b = advanceDetailClient.addAdvanceDetail(advanceDetailEntity);
advanceDetailClient.addAdvanceDetail(advanceDetailEntity);
//XxlJobLogger.log("addAdvanceDetail 添加状态 {}", b);
});
// 添加包件信息

65
blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/constant/PanFactoryEnum.java

@ -0,0 +1,65 @@
package com.logpm.factory.snm.constant;
public enum PanFactoryEnum {
BF("3610","中山-广州仓",47),
FS("3110","中山市-广州仓",47),
TJ("3210","天津-天津基地仓",53),
LK("3310","河南-无",0);
private String typeCode;
private String typeMes;
private Integer typeId;
PanFactoryEnum(String typeCode, String typeMes,Integer typeId) {
this.typeCode = typeCode;
this.typeMes = typeMes;
this.typeId = typeId;
}
public String getTypeCode() {
return typeCode;
}
public void setTypeCode(String typeCode) {
this.typeCode = typeCode;
}
public String getTypeMes() {
return typeMes;
}
public void setTypeMes(String typeMes) {
this.typeMes = typeMes;
}
public Integer getTypeId() {
return typeId;
}
public void setTypeId(Integer typeId) {
this.typeId = typeId;
}
public static String getMes(String typeCode){
PanFactoryEnum[] values = PanFactoryEnum.values();
for(PanFactoryEnum panFactoryEnum:values){
if(panFactoryEnum.getTypeCode().equals(typeCode)){
return panFactoryEnum.getTypeMes();
}
}
return typeCode;
}
public static Integer getId(String typeCode){
PanFactoryEnum[] values = PanFactoryEnum.values();
for(PanFactoryEnum panFactoryEnum:values){
if(panFactoryEnum.getTypeCode().equals(typeCode)){
return panFactoryEnum.getTypeId();
}
}
return 0;
}
}

22
blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/controller/PanFactoryDataController.java

@ -17,10 +17,12 @@
package com.logpm.factory.snm.controller;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSONObject;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.logpm.factory.snm.bean.Resp;
import com.logpm.factory.snm.dto.*;
import com.logpm.factory.snm.entity.PanFactoryOrder;
import com.logpm.factory.snm.entity.PanOrderStatusLog;
import com.logpm.factory.snm.entity.PanPackageInfo;
import com.logpm.factory.snm.entity.PanPackageList;
import com.logpm.factory.snm.service.*;
@ -56,6 +58,7 @@ public class PanFactoryDataController extends BladeController {
private final IPanPackageListService packageListService;
private final IPanFactoryDataService factoryDataService;
private final IAsyncDataService syncDataService;
private final IPanOrderStatusLogService panOrderStatusLogService;
// @ResponseBody
// @PostMapping("/token")
@ -96,6 +99,13 @@ public class PanFactoryDataController extends BladeController {
log.info("############data: ");
String corpId = request.getHeader("corpId");
//先保存原始请求数据
PanOrderStatusLog panOrderStatusLog = new PanOrderStatusLog();
panOrderStatusLog.setArgs(JSONObject.toJSONString(factoryOrderDTO));
panOrderStatusLog.setStatus(1);
panOrderStatusLog.setType(3);
panOrderStatusLogService.save(panOrderStatusLog);
PanFactoryOrder factoryOrder = new PanFactoryOrder();
BeanUtil.copyProperties(factoryOrderDTO,factoryOrder);
factoryOrder.setCorpid(corpId);
@ -124,6 +134,10 @@ public class PanFactoryDataController extends BladeController {
packageListService.saveBatch(PanPackagelist);
}
//修改保存数据的状态
panOrderStatusLog.setStatus(0);
panOrderStatusLogService.saveOrUpdate(panOrderStatusLog);
//开启异步线程处理数据
syncDataService.handlerPanDataToHt();
@ -138,7 +152,8 @@ public class PanFactoryDataController extends BladeController {
public R sendOrders(@Validated @RequestBody OrderInfoDTO orderInfoDTO) {
log.info("############sendOrders: 请求参数{}",orderInfoDTO);
try{
factoryDataService.handleData(orderInfoDTO);
R r = factoryDataService.handleData(orderInfoDTO);
return r;
}catch (CustomerException e){
log.error(e.message,e);
return R.fail(e.code,e.message);
@ -146,7 +161,6 @@ public class PanFactoryDataController extends BladeController {
log.error("############sendOrders: 系统异常",e);
return R.fail(500,"############sendOrders: 系统异常");
}
return R.success("SUCCESS");
}
@ -157,7 +171,8 @@ public class PanFactoryDataController extends BladeController {
public R sendOrderStatus(@RequestBody OrderStatusDTO orderStatusDTO) {
log.info("############sendOrderStatus: 请求参数{}",orderStatusDTO);
try{
factoryDataService.handleStatusData(orderStatusDTO);
R r = factoryDataService.handleStatusData(orderStatusDTO);
return r;
}catch (CustomerException e){
log.error(e.message,e);
return R.fail(e.code,e.message);
@ -165,7 +180,6 @@ public class PanFactoryDataController extends BladeController {
log.error("############sendOrderStatus: 系统异常",e);
return R.fail(500,"############sendOrderStatus: 系统异常");
}
return Resp.success("SUCCESS");
}

5
blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IPanFactoryDataService.java

@ -2,6 +2,7 @@ package com.logpm.factory.snm.service;
import com.logpm.factory.snm.dto.OrderInfoDTO;
import com.logpm.factory.snm.dto.OrderStatusDTO;
import org.springblade.core.tool.api.R;
/**
* 工厂推送数据接口
@ -10,7 +11,7 @@ public interface IPanFactoryDataService {
void handleData(OrderInfoDTO orderInfoDTO);
R handleData(OrderInfoDTO orderInfoDTO);
void handleStatusData(OrderStatusDTO orderStatusDTO);
R handleStatusData(OrderStatusDTO orderStatusDTO);
}

129
blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/AsyncDataServiceImpl.java

@ -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=未知

5
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/AdvanceDetailClient.java

@ -51,10 +51,11 @@ public class AdvanceDetailClient implements IAdvanceDetailClient {
@Override
@PostMapping(API_PREFIX + "/addAdvanceDetail")
public boolean addAdvanceDetail(AdvanceDetailEntity advanceDetailEntity) {
public Integer addAdvanceDetail(AdvanceDetailEntity advanceDetailEntity) {
//新增数据
System.out.println("AdvanceDetailClient执行了");
return advanceDetailService.addAdvanceDetail(advanceDetailEntity);
advanceDetailService.addAdvanceDetail(advanceDetailEntity);
return advanceDetailEntity.getId();
}
@Override

8
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/DetailProductClient.java

@ -19,11 +19,12 @@ package com.logpm.oldproject.feign;
import com.logpm.oldproject.entity.DetailProductEntity;
import com.logpm.oldproject.service.IDetailProductService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
/**
* 包内产品明细 Feign实现类
*
@ -56,4 +57,9 @@ public class DetailProductClient implements IDetailProductClient {
return detailProductService.addDetailProduct(detailProductEntity);
}
@Override
public Boolean addDetailProductList(List<DetailProductEntity> detailProductEntitys) {
return detailProductService.saveBatch(detailProductEntitys);
}
}

5
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.xml

@ -78,10 +78,7 @@
<select id="getSupplyData" resultType="Map" >
SELECT
wo.waybill_no logiBillNo,
wb.arrive_site destinationWarehouse,
case wb.start_site_id
when 0 then '工厂ID'
END plantId
wb.arrive_site destinationWarehouse
FROM ht_advance_detail d
left join ht_waybill_order wo on wo.advance_id = d.advance_id and wo.delete_time = 0
left join ht_way_bill wb on wb.id = wo.way_bill_id and wb.delete_time = 0

5
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/DetailProductMapper.java

@ -16,12 +16,9 @@
*/
package com.logpm.oldproject.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.oldproject.entity.AdvanceDetailEntity;
import com.logpm.oldproject.entity.DetailProductEntity;
import com.logpm.oldproject.vo.DetailProductVO;
import org.apache.ibatis.annotations.Param;
@ -52,4 +49,6 @@ public interface DetailProductMapper extends BaseMapper<DetailProductEntity> {
* @return
*/
Boolean addAll(@Param("param") DetailProductEntity detailProduct);
Boolean addList(@Param("list") List<DetailProductEntity> detailProducts);
}

12
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/DetailProductMapper.xml

@ -19,4 +19,16 @@
NOW(), NOW(), #{param.administratorsId}, #{param.deleteTime});
</insert>
<insert id="addList" useGeneratedKeys="true" keyProperty="id">
INSERT INTO `ht_detail_product`( `unit_no`, `productcode`, `productname`, `salenum`, `delivernum`, `producttype`, `buy_time`,
`create_time`, `update_time`,`administrators_id`, `delete_time`)
VALUES
<foreach item="item" index="index" collection="list" separator=",">
( #{item.unitNo}, #{item.productcode}, #{item.productname}, #{item.salenum}, #{item.delivernum}, #{item.producttype}, #{item.buyTime},
NOW(), NOW(), #{item.administratorsId}, #{item.deleteTime})
</foreach>
</insert>
</mapper>

9
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IDetailProductService.java

@ -16,12 +16,7 @@
*/
package com.logpm.oldproject.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.oldproject.entity.AdvanceDetailEntity;
import com.logpm.oldproject.entity.DetailProductEntity;
import com.logpm.oldproject.vo.DetailProductVO;
import org.springblade.core.mp.base.BaseService;
import java.util.List;
@ -31,9 +26,11 @@ import java.util.List;
* @author BladeX
* @since 2023-05-10
*/
public interface IDetailProductService {
public interface IDetailProductService{
Boolean addDetailProduct(DetailProductEntity detailProductEntity);
Boolean saveBatch(List<DetailProductEntity> detailProductEntitys);
}

9
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/DetailProductServiceImpl.java

@ -16,14 +16,10 @@
*/
package com.logpm.oldproject.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.oldproject.entity.DetailProductEntity;
import com.logpm.oldproject.mapper.DetailProductMapper;
import com.logpm.oldproject.service.IDetailProductService;
import com.logpm.oldproject.vo.DetailProductVO;
import lombok.AllArgsConstructor;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
@ -44,4 +40,9 @@ public class DetailProductServiceImpl implements IDetailProductService {
public Boolean addDetailProduct(DetailProductEntity detailProductEntity) {
return detailProductMapper.addAll(detailProductEntity);
}
@Override
public Boolean saveBatch(List<DetailProductEntity> detailProductEntitys) {
return detailProductMapper.addList(detailProductEntitys);
}
}

Loading…
Cancel
Save