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, "包件码已存在");