From b0333f0289ad79171ac122e2e2359df7debfb3eb Mon Sep 17 00:00:00 2001 From: "pref_mail@163.com" <123456> Date: Fri, 25 Aug 2023 09:53:48 +0800 Subject: [PATCH 1/2] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../oupai/service/impl/OuPaiFactoryServiceImpl.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java index 6ef77e830..99469ff7c 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java @@ -357,11 +357,16 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService { */ private OpOrderStatusLogEntity findOurPaiDataByCarNumber(String carNumber) { - String url = ouPaiProperties.getUri() + "tims_odata_api/api/odata/ReceivingOrder?$filter=CarNumber eq '" + carNumber + "'&select=Code,Type,Status,Plate,PlateNum,CarNumber,CarrierCode,PackagesCount,ReceivePackageCount,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,PackageDetails,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;\n" + + String url = ouPaiProperties.getUri() + "tims_odata_api/api/odata/ReceivingOrder?$filter=CarNumber eq '"+carNumber+"'&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=FromWarehouse($select=Name,Code)&$expand=CurrentWarehouse($select=Name,Code)&$expand=EndWarehouse($select=Name,Code)"; + "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,OrgCode,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)"; log.info(">>> findOurPaiDataByCarNumber url {}", url); From 1ff2a4fe88fd88c52b6502c7a5d7d0f8d8280d1b Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Fri, 25 Aug 2023 10:55:22 +0800 Subject: [PATCH 2/2] =?UTF-8?q?1.=E6=AC=A7=E6=B4=BE=E7=89=A9=E6=96=99?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=AD=98=E5=85=A5=E7=BB=91=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/FactoryPackageDetailEntity.java | 56 +++++++++++++++++++ .../mapper/FactoryPackageDetailMapper.java | 9 +++ .../service/IFactoryPackageDetailService.java | 7 +++ .../impl/FactoryPackageDetailServiceImpl.java | 13 +++++ .../service/impl/OuPaiFactoryServiceImpl.java | 40 +++++++++---- 5 files changed, 115 insertions(+), 10 deletions(-) create mode 100644 blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryPackageDetailEntity.java create mode 100644 blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/FactoryPackageDetailMapper.java create mode 100644 blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IFactoryPackageDetailService.java create mode 100644 blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/FactoryPackageDetailServiceImpl.java diff --git a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryPackageDetailEntity.java b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryPackageDetailEntity.java new file mode 100644 index 000000000..1280a3644 --- /dev/null +++ b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryPackageDetailEntity.java @@ -0,0 +1,56 @@ +package com.logpm.factory.oupai.entity; + +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; + +@Data +@TableName("op_factory_package_detail") +@ApiModel(value = "FactoryPackageDetail对象", description = "欧派工厂物料表") +@EqualsAndHashCode(callSuper = true) +public class FactoryPackageDetailEntity extends BaseEntity { + + /** 预留1 */ + @ApiModelProperty(name = "预留1",notes = "") + private String reserve1 ; + /** 预留2 */ + @ApiModelProperty(name = "预留2",notes = "") + private String reserve2 ; + /** 预留3 */ + @ApiModelProperty(name = "预留3",notes = "") + private String reserve3 ; + /** 预留4 */ + @ApiModelProperty(name = "预留4",notes = "") + private String reserve4 ; + /** 预留5 */ + @ApiModelProperty(name = "预留5",notes = "") + private String reserve5 ; + + /** 包件id */ + @ApiModelProperty(name = "包件id",notes = "") + private Long packageId ; + + /** 物料编码 */ + @ApiModelProperty(name = "物料编码",notes = "") + private String code ; + + /** 物料名称 */ + @ApiModelProperty(name = "物料名称",notes = "") + private String name ; + + /** 物料规格 */ + @ApiModelProperty(name = "物料规格",notes = "") + private String type ; + + /** 物料单位 */ + @ApiModelProperty(name = "物料单位",notes = "") + private String unit ; + + /** 原物料编码 */ + @ApiModelProperty(name = "原物料编码",notes = "") + private String orgCode ; + +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/FactoryPackageDetailMapper.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/FactoryPackageDetailMapper.java new file mode 100644 index 000000000..1a66eb25c --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/FactoryPackageDetailMapper.java @@ -0,0 +1,9 @@ +package com.logpm.factory.oupai.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.logpm.factory.oupai.entity.FactoryPackageDetailEntity; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface FactoryPackageDetailMapper extends BaseMapper { +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IFactoryPackageDetailService.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IFactoryPackageDetailService.java new file mode 100644 index 000000000..1f0a0d6dd --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IFactoryPackageDetailService.java @@ -0,0 +1,7 @@ +package com.logpm.factory.oupai.service; + +import com.logpm.factory.oupai.entity.FactoryPackageDetailEntity; +import org.springblade.core.mp.base.BaseService; + +public interface IFactoryPackageDetailService extends BaseService { +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/FactoryPackageDetailServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/FactoryPackageDetailServiceImpl.java new file mode 100644 index 000000000..5a61fb439 --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/FactoryPackageDetailServiceImpl.java @@ -0,0 +1,13 @@ +package com.logpm.factory.oupai.service.impl; + +import com.logpm.factory.oupai.entity.FactoryPackageDetailEntity; +import com.logpm.factory.oupai.mapper.FactoryPackageDetailMapper; +import com.logpm.factory.oupai.service.IFactoryPackageDetailService; +import lombok.AllArgsConstructor; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +@Service +@AllArgsConstructor +public class FactoryPackageDetailServiceImpl extends BaseServiceImpl implements IFactoryPackageDetailService { +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java index 99469ff7c..00e547225 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java @@ -6,15 +6,9 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.StringUtils; -import com.logpm.factory.oupai.entity.FactoryOrderEntity; -import com.logpm.factory.oupai.entity.FactoryPackageEntity; -import com.logpm.factory.oupai.entity.OpOrderStatusLogEntity; -import com.logpm.factory.oupai.entity.ReceivingOrderEntity; +import com.logpm.factory.oupai.entity.*; import com.logpm.factory.oupai.mapper.ReceivingOrderMapper; -import com.logpm.factory.oupai.service.IFactoryOrderService; -import com.logpm.factory.oupai.service.IFactoryPackageService; -import com.logpm.factory.oupai.service.IOpOrderStatusLogService; -import com.logpm.factory.oupai.service.IOuPaiFactoryService; +import com.logpm.factory.oupai.service.*; import com.logpm.factory.props.OuPaiProperties; import lombok.extern.slf4j.Slf4j; import org.springblade.common.exception.CustomerException; @@ -43,6 +37,9 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService { @Autowired private IOpOrderStatusLogService opOrderStatusLogService; + @Autowired + private IFactoryPackageDetailService factoryPackageDetailService; + @Override public String saveOuPaiFactoryOrderDTOByCarCarNumber(String carNumber) { @@ -204,7 +201,11 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService { factoryOrderEntity.setReservationStatus(1); } - factoryOrderEntity.setStoreName("");//TODO 没有找到门店字段 + JSONObject store = orderEntity.getJSONObject("Store"); + if(!Objects.isNull(store)){ + factoryOrderEntity.setStoreCode(store.getString("Code")); + factoryOrderEntity.setStoreName(store.getString("Name")); + } factoryOrderEntity.setMatingCode(orderEntity.getString("MatingCode")); Boolean isMating = orderEntity.getBoolean("IsMating"); @@ -325,11 +326,30 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService { } else { factoryPackageEntity.setFreeze(0); } + //保存包件信息 factoryPackageEntity.setReceiptStatus(0); factoryPackageEntity.setPushStatus(0); factoryPackageEntity.setTurnStatus(0); - factoryPackageService.save(factoryPackageEntity); + boolean save = factoryPackageService.save(factoryPackageEntity); + if(save){ + Long packageId = factoryPackageEntity.getId(); + //保存物料信息 + JSONArray packageDetails = packageEntity.getJSONArray("PackageDetails"); + if(!Objects.isNull(packageDetails)){ + for (int k = 0; k < packageDetails.size(); k++) { + JSONObject packageDetailsJSONObject = packageDetails.getJSONObject(k); + FactoryPackageDetailEntity factoryPackageDetailEntity = new FactoryPackageDetailEntity(); + factoryPackageDetailEntity.setPackageId(packageId); + factoryPackageDetailEntity.setCode(packageDetailsJSONObject.getString("Code")); + factoryPackageDetailEntity.setName(packageDetailsJSONObject.getString("Name")); + factoryPackageDetailEntity.setType(packageDetailsJSONObject.getString("Type")); + factoryPackageDetailEntity.setUnit(packageDetailsJSONObject.getString("Unit")); + factoryPackageDetailEntity.setOrgCode(packageDetailsJSONObject.getString("OrgCode")); + factoryPackageDetailService.save(factoryPackageDetailEntity); + } + } + } } else { log.warn("############handleData: 包件码已存在 packageCode={}", packageCode); throw new CustomerException(403, "包件码已存在");