Browse Source

Merge branch 'dev' into pre-production

newStockUp
zhenghaoyu 1 year ago
parent
commit
6bfdea4574
  1. 4
      blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryPackageEntity.java
  2. 8
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java
  3. 71
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/receiver/OpReceivingDataHandler.java
  4. 2
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryDataServiceImpl.java
  5. 56
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java

4
blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryPackageEntity.java

@ -120,7 +120,9 @@ public class FactoryPackageEntity extends BaseEntity {
@ApiModelProperty(name = "预留5",notes = "")
private String reserve5 ;
/** oid */
@ApiModelProperty(name = "oid",notes = "")
private String oid ;
}

8
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java

@ -3287,7 +3287,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
}
total.put(categoryName,num);
}
total.put("合计数",totalNum);
map.put("合计数",totalNum);
@ -3326,7 +3326,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
Integer tn = 0;
Set<String> set = total.keySet();
for (String key:set){
if(!"合计数".equals(key)){
if(!"合计数".equals(key)){
numObj.put(key,0);
for (Map<String,Object> m:mapList){
String thirdProduct = (String)m.get("thirdProduct");
@ -3338,7 +3338,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
}
}
}
numObj.put("合计数量",tn);
orderMap.put("合计数量",tn);
orderMap.put("产品明细",numObj);
//通过订单id和预约id查询对应包件的物料信息
@ -3348,7 +3348,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
orderMap.put("到付运费",0);//todo 需要累加到totalPrice上
ls.add(orderMap);
}
total.put("到付费",totalPrice);
total.put("到付费",totalPrice);
map.put("明细",ls);
map.put("合计",total);
String popHtml =TemplateUtil.popTemplate("商配配配送单",map,html);

71
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/receiver/OpReceivingDataHandler.java

@ -1,8 +1,6 @@
package com.logpm.factory.oupai.receiver;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.logpm.factory.oupai.entity.OpOrderStatusLogEntity;
import com.logpm.factory.pan.service.IPanFactoryDataService;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
@ -34,38 +32,43 @@ public class OpReceivingDataHandler {
public void opReceivingDataHandler(Map map, Message message, Channel channel) throws IOException {
// 如果手动ACK,消息会被监听消费,但是消息在队列中依旧存在,如果 未配置 acknowledge-mode 默认是会在消费完毕后自动ACK掉
log.info("##################opReceivingDataHandler: 处理欧派收货数据到新系统");
OpOrderStatusLogEntity opOrderStatusLogEntity = (OpOrderStatusLogEntity) map.get("messageData");
String args = opOrderStatusLogEntity.getResponseBody();
JSONObject jsonObject = JSONObject.parseObject(args);
JSONArray jsonArray = jsonObject.getJSONArray("value");
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject valueObject = jsonArray.getJSONObject(i);
JSONArray packages = valueObject.getJSONArray("Packages");
for (int j = 0; j < packages.size(); j++) {
JSONObject packageJSON = packages.getJSONObject(j);
String packageStatus = packageJSON.getString("PackageStatus");
String orderPackageCode = packageJSON.getString("Code");
String receivingTime=null;
try{
receivingTime = packageJSON.getString("CreateTime");
}catch (Exception e){
log.error(e.getMessage());
}
log.info("##################opReceivingDataHandler: 处理欧派收货数据到新系统,packageStatus:{},orderPackageCode:{},receivingTime{}",
packageStatus,orderPackageCode,receivingTime);
//判断是否是已入库
if("已在库".equals(packageStatus)){
//真正的处理需要的数据
try {
panFactoryDataService.handleDataToPlatform(orderPackageCode, receivingTime);
} catch (Exception e) {
log.error("##################opReceivingDataHandler: 处理欧派收货数据到新系统,packageStatus:{},orderPackageCode:{},receivingTime{}",
packageStatus,orderPackageCode,receivingTime);
log.error(e.getMessage());
}
}
}
String jsonStr = (String) map.get("messageData");
JSONObject object = JSONObject.parseObject(jsonStr);
String orderPackageCode = object.getString("orderPackageCode");
String receivingTime = object.getString("receivingTime");
//真正的处理需要的数据
try {
panFactoryDataService.handleDataToPlatform(orderPackageCode, receivingTime);
} catch (Exception e) {
log.error("##################opReceivingDataHandler: 处理欧派收货数据到新系统,orderPackageCode:{},receivingTime{}",
orderPackageCode,receivingTime);
log.error(e.getMessage());
}
// String args = opOrderStatusLogEntity.getResponseBody();
// JSONObject jsonObject = JSONObject.parseObject(args);
// JSONArray jsonArray = jsonObject.getJSONArray("value");
// for (int i = 0; i < jsonArray.size(); i++) {
// JSONObject valueObject = jsonArray.getJSONObject(i);
// JSONArray packages = valueObject.getJSONArray("Packages");
// for (int j = 0; j < packages.size(); j++) {
// JSONObject packageJSON = packages.getJSONObject(j);
// String packageStatus = packageJSON.getString("PackageStatus");
// String orderPackageCode = packageJSON.getString("Code");
// String receivingTime=null;
// try{
// receivingTime = packageJSON.getString("CreateTime");
// }catch (Exception e){
// log.error(e.getMessage());
// }
// log.info("##################opReceivingDataHandler: 处理欧派收货数据到新系统,packageStatus:{},orderPackageCode:{},receivingTime{}",
// packageStatus,orderPackageCode,receivingTime);
// //判断是否是已入库
// if("已在库".equals(packageStatus)){
//
// }
// }
// }
}
}

2
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryDataServiceImpl.java

@ -49,7 +49,7 @@ public class OuPaiFactoryDataServiceImpl implements IOuPaiFactoryDataService {
code = ouPaiFactoryService.savaOuPaiSignBillByCode(orderCode,event);
}else if(event == 6){
//签收单部分签收
code = ouPaiFactoryService.savaOuPaiSignBillByCode(orderCode,event);
// code = ouPaiFactoryService.savaOuPaiSignBillByCode(orderCode,event);
}
return code;
}

56
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java

@ -5,17 +5,14 @@ import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.logpm.factory.comfac.service.IAsyncDataService;
import com.logpm.factory.oupai.entity.*;
import com.logpm.factory.oupai.mapper.ReceivingOrderMapper;
import com.logpm.factory.oupai.service.*;
import com.logpm.factory.oupai.vo.OpOrderStatusLogVO;
import com.logpm.factory.props.OuPaiProperties;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.io.IOUtils;
import org.jetbrains.annotations.NotNull;
@ -27,7 +24,6 @@ import org.springblade.core.oss.model.BladeFile;
import org.springblade.core.tool.api.R;
import org.springblade.resource.feign.IOssClient;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
@ -89,25 +85,50 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
@Override
public String saveOuPaiPackageStatusByCode(String orderCode, Integer event) {
//
String url = ouPaiProperties.getUri() + "tims_odata_api/api/odata/ReceivingOrder?$filter=Code eq '" + orderCode + "'&select=Code,Type,Status,Plate,PackagesCount,ReceivePackageCount,PlateNum,CarNumber,CarrierCode,SendTime,ArrivalTime,ReceiveTime,CreateTime,ReturnNumber\n" +
"&$expand=" +
"Packages($select=Code,PdaNumber,FirstClassCode,FirstClassName,SecondClassCode,SecondClassName,ThirdClassCode,ThirdClassName,BuyIn,CosourcingCode,CosourcingUnit,SortingCenter,DistributionCenter,Length,Width,Height,Weight,OrderDetail,Order,PathIndex,PathDetail,DeliveryOrders,ReceivingOrders,LPN,LpnSerialNum,IsEntruck,ReservationOrder,OutGoingOrderDetail,SignBill,IsInventory,Inventories,InventoryInDetails,Freeze,OutGoingOrderDetailInventoryDetail,From,Creator,CreateTime,ShipTime,CarNumber,DeliveryMethod,DeliveryReceiver,DeliveryReceiverPhone,ReturnNumber,GroupType,CarrierCode,CarrierName,PackageDetailNames,ReceivingTime,SendTime,ExceptionSignRemark,Descript,SignTime,OutOrder,IsReceiveByHand,PackageStatus,PackageDetailNames;" +
"$expand=Order($select=" +
"Code,SelfCode,ContractNumber,ServiceNumber,OrderClass,OrderType,Status,FactoryShipStatus,FactorySendQty,WarehouseReceiveStatus,WarehouseReceiveQty,ReservationStatus,Store,MatingCode,IsMating,FirstClassCode,Leave,Customer,Province,City,CustomerAddress,CustomerPhone,ShopReceiver,BrandCode,BrandName,From,OutGoingTime,CreateTime,Freeze,FirstShipTime,MatingShipTime,FirstReceiveTime,MatingReceiveTime;\n" +
"$expand=Store($select=Name,Code))" +
"&$expand=PackageDetails($select=Code,Name,Type,Unit,OrgCode)" +
"&$expand=CurrentWarehouse($select=Name,Code)" +
"&$expand=SendWarehouse($select=Name,Code)" +
")&$expand=FromWarehouse($select=Name,Code)&$expand=CurrentWarehouse($select=Name,Code)&$expand=EndWarehouse($select=Name,Code)";
// String url = ouPaiProperties.getUri() + "tims_odata_api/api/odata/ReceivingOrder?$filter=Code eq '" + orderCode + "'&select=Code,Type,Status,Plate,PackagesCount,ReceivePackageCount,PlateNum,CarNumber,CarrierCode,SendTime,ArrivalTime,ReceiveTime,CreateTime,ReturnNumber\n" +
// "&$expand=" +
// "Packages($select=Code,PdaNumber,FirstClassCode,FirstClassName,SecondClassCode,SecondClassName,ThirdClassCode,ThirdClassName,BuyIn,CosourcingCode,CosourcingUnit,SortingCenter,DistributionCenter,Length,Width,Height,Weight,OrderDetail,Order,PathIndex,PathDetail,DeliveryOrders,ReceivingOrders,LPN,LpnSerialNum,IsEntruck,ReservationOrder,OutGoingOrderDetail,SignBill,IsInventory,Inventories,InventoryInDetails,Freeze,OutGoingOrderDetailInventoryDetail,From,Creator,CreateTime,ShipTime,CarNumber,DeliveryMethod,DeliveryReceiver,DeliveryReceiverPhone,ReturnNumber,GroupType,CarrierCode,CarrierName,PackageDetailNames,ReceivingTime,SendTime,ExceptionSignRemark,Descript,SignTime,OutOrder,IsReceiveByHand,PackageStatus,PackageDetailNames;" +
// "$expand=Order($select=" +
// "Code,SelfCode,ContractNumber,ServiceNumber,OrderClass,OrderType,Status,FactoryShipStatus,FactorySendQty,WarehouseReceiveStatus,WarehouseReceiveQty,ReservationStatus,Store,MatingCode,IsMating,FirstClassCode,Leave,Customer,Province,City,CustomerAddress,CustomerPhone,ShopReceiver,BrandCode,BrandName,From,OutGoingTime,CreateTime,Freeze,FirstShipTime,MatingShipTime,FirstReceiveTime,MatingReceiveTime;\n" +
// "$expand=Store($select=Name,Code))" +
// "&$expand=PackageDetails($select=Code,Name,Type,Unit,OrgCode)" +
// "&$expand=CurrentWarehouse($select=Name,Code)" +
// "&$expand=SendWarehouse($select=Name,Code)" +
// ")&$expand=FromWarehouse($select=Name,Code)&$expand=CurrentWarehouse($select=Name,Code)&$expand=EndWarehouse($select=Name,Code)";
//
// handlePackageData(url, event);
//orderCode现在是包件码
QueryWrapper<FactoryPackageEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("oid",orderCode);
FactoryPackageEntity packageEntity = factoryPackageService.getOne(queryWrapper);
packageEntity.setPackageStatus(5);
factoryPackageService.updateById(packageEntity);
JSONObject jo = new JSONObject();
jo.put("orderPackageCode",orderCode);
jo.put("receivingTime",CommonUtil.dateToString(packageEntity.getUpdateTime()));
//真正的处理需要的数据
Map<String, Object> map = new HashMap<>();
map.put("messageId", CommonUtil.getUUID());
map.put("type", "Push");
map.put("messageData", jo.toJSONString());
map.put("createTime", new Date().getTime());
try {
rabbitTemplate.convertAndSend(RabbitConstant.OUPAI_RECEIVING_EXCHANGE, RabbitConstant.OUPAI_RECEIVING_ROUTING, map);
} catch (Exception e) {
log.error("############saveOuPaiPackageStatusByCode: {}", e.getMessage());
}
log.info("############saveOuPaiPackageStatusByCode: 数据处理结束");
handlePackageData(url, event);
return orderCode;
}
@Override
public String saveOuPaiOutGoingOrderByCode(String orderCode, Integer event) {
//
String url = ouPaiProperties.getUri() + "tims_odata_api/api/odata/OutGoingOrder?$filter=Code eq 'PS20230802-6'" +
String url = ouPaiProperties.getUri() + "tims_odata_api/api/odata/OutGoingOrder?$filter=Code eq '"+orderCode+"'" +
"&$select=Code,Status,Truck,DriverPhone,Platform,DeliveryDate,Creator,CreateTime,IsAdjust,SendTime," +
"Customers,Volume" +
"&$expand=Warehouse($select=Code,Name)" +
@ -459,6 +480,7 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
factoryPackageEntity = new FactoryPackageEntity();
factoryPackageEntity.setOrderId(orderId);
factoryPackageEntity.setCode(packageCode);
factoryPackageEntity.setOid(packageEntity.getString("Oid"));
factoryPackageEntity.setFirstClassCode(packageEntity.getString("FirstClassCode"));
factoryPackageEntity.setFirstClassName(packageEntity.getString("FirstClassName"));
factoryPackageEntity.setSecondClassCode(packageEntity.getString("SecondClassCode"));
@ -577,7 +599,7 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
String url = ouPaiProperties.getUri() + "tims_odata_api/api/odata/ReceivingOrder?$filter=Code eq '" + code + "'&select=Code,Type,Status,Plate,PackagesCount,ReceivePackageCount,PlateNum,CarNumber,CarrierCode,SendTime,ArrivalTime,ReceiveTime,CreateTime,ReturnNumber\n" +
"&$expand=" +
"Packages($select=Code,PdaNumber,FirstClassCode,FirstClassName,SecondClassCode,SecondClassName,ThirdClassCode,ThirdClassName,BuyIn,CosourcingCode,CosourcingUnit,SortingCenter,DistributionCenter,Length,Width,Height,Weight,OrderDetail,Order,PathIndex,PathDetail,DeliveryOrders,ReceivingOrders,LPN,LpnSerialNum,IsEntruck,ReservationOrder,OutGoingOrderDetail,SignBill,IsInventory,Inventories,InventoryInDetails,Freeze,OutGoingOrderDetailInventoryDetail,From,Creator,CreateTime,ShipTime,CarNumber,DeliveryMethod,DeliveryReceiver,DeliveryReceiverPhone,ReturnNumber,GroupType,CarrierCode,CarrierName,PackageDetailNames,ReceivingTime,SendTime,ExceptionSignRemark,Descript,SignTime,OutOrder,IsReceiveByHand,PackageStatus,PackageDetailNames;" +
"Packages($select=Oid,Code,PdaNumber,FirstClassCode,FirstClassName,SecondClassCode,SecondClassName,ThirdClassCode,ThirdClassName,BuyIn,CosourcingCode,CosourcingUnit,SortingCenter,DistributionCenter,Length,Width,Height,Weight,OrderDetail,Order,PathIndex,PathDetail,DeliveryOrders,ReceivingOrders,LPN,LpnSerialNum,IsEntruck,ReservationOrder,OutGoingOrderDetail,SignBill,IsInventory,Inventories,InventoryInDetails,Freeze,OutGoingOrderDetailInventoryDetail,From,Creator,CreateTime,ShipTime,CarNumber,DeliveryMethod,DeliveryReceiver,DeliveryReceiverPhone,ReturnNumber,GroupType,CarrierCode,CarrierName,PackageDetailNames,ReceivingTime,SendTime,ExceptionSignRemark,Descript,SignTime,OutOrder,IsReceiveByHand,PackageStatus,PackageDetailNames;" +
"$expand=Order($select=" +
"Code,SelfCode,ContractNumber,ServiceNumber,OrderClass,OrderType,Status,FactoryShipStatus,FactorySendQty,WarehouseReceiveStatus,WarehouseReceiveQty,ReservationStatus,Store,MatingCode,IsMating,FirstClassCode,Leave,Customer,Province,City,CustomerAddress,CustomerPhone,ShopReceiver,BrandCode,BrandName,From,OutGoingTime,CreateTime,Freeze,FirstShipTime,MatingShipTime,FirstReceiveTime,MatingReceiveTime;\n" +
"$expand=Store($select=Name,Code;$expand=Shop))" +

Loading…
Cancel
Save