diff --git a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/PanFactoryOrder.java b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/PanFactoryOrder.java index 0a213bd09..c58738708 100644 --- a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/PanFactoryOrder.java +++ b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/PanFactoryOrder.java @@ -28,6 +28,10 @@ public class PanFactoryOrder extends BaseEntity { @NotEmpty(message = "客户名称不能为空") private String userName; + @ApiModelProperty(value = "发货单号") + @NotEmpty(message = "发货单号不能为空") + private String deliveryNumber; + @ApiModelProperty(value = "订单来源编码") @NotEmpty(message = "订单来源编码不能为空") private String sources; @@ -84,6 +88,10 @@ public class PanFactoryOrder extends BaseEntity { @ApiModelProperty(value = "总体积") private BigDecimal totalCapacity; + @ApiModelProperty(value = "工厂ID") + @NotEmpty(message = "工厂ID不能为空") + private String plantId; + @ApiModelProperty(value = "发货工厂名称") @NotEmpty(message = "发货工厂名称不能为空") private String sendFactory; diff --git a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/PanOrderStatusLog.java b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/PanOrderStatusLog.java index 23613a7bc..9367fde74 100644 --- a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/PanOrderStatusLog.java +++ b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/PanOrderStatusLog.java @@ -14,4 +14,6 @@ public class PanOrderStatusLog extends BaseEntity { private String args; + private Integer type; + } diff --git a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/PanPackageInfo.java b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/PanPackageInfo.java index 216b41e1b..88db3c06a 100644 --- a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/PanPackageInfo.java +++ b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/PanPackageInfo.java @@ -7,6 +7,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import org.springblade.core.mp.base.BaseEntity; +import javax.validation.constraints.NotEmpty; import java.math.BigDecimal; @Data @@ -18,6 +19,14 @@ public class PanPackageInfo extends BaseEntity { @ApiModelProperty(value = "订单id") private Long orderId; + @ApiModelProperty(value = "客户订单号") + @NotEmpty(message = "客户订单号不能为空") + private String orderNo; + + @ApiModelProperty(value = "工厂ID") + @NotEmpty(message = "工厂ID不能为空") + private String plantId; + @ApiModelProperty(value = "包件码") private String unitNo; @@ -54,4 +63,7 @@ public class PanPackageInfo extends BaseEntity { @ApiModelProperty(value = "三级品类编码") private String thirdPackCode; + @ApiModelProperty(value = "直发标识") + private String directSignage; + } diff --git a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/PanPackageList.java b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/PanPackageList.java index fbab7f5fb..36a73cd2d 100644 --- a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/PanPackageList.java +++ b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/PanPackageList.java @@ -16,6 +16,9 @@ public class PanPackageList extends BaseEntity { @ApiModelProperty(value = "包件id") private Long packageId; + @ApiModelProperty(value = "包件编码") + private String unitNo; + @ApiModelProperty(value = "板件条码") private String prosBarcode; diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/dto/OrderInfoDTO.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/dto/OrderInfoDTO.java index 63c2575b6..77e88be22 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/dto/OrderInfoDTO.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/dto/OrderInfoDTO.java @@ -33,8 +33,10 @@ public class OrderInfoDTO { @NotEmpty(message = "客户订单号不能为空") private String orderNo;//客户订单号 - private String loadingList;//WMS装车清单号 + private String plantId;//工厂id + + private String deliveryNumber;//发货单号 @NotEmpty(message = "物流单号不能为空") - private String logiBillNo;//物流单号 + private String logiBillNo;//物流单号 } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/PanFactoryDataServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/PanFactoryDataServiceImpl.java index cc6104554..8a6f411eb 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/PanFactoryDataServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/PanFactoryDataServiceImpl.java @@ -85,16 +85,62 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { @Transactional(rollbackFor = Exception.class) @Override public void handleData(OrderInfoDTO orderInfoDTO) { + + //先保存原始请求数据 + PanOrderStatusLog panOrderStatusLog = new PanOrderStatusLog(); + panOrderStatusLog.setArgs(JSONObject.toJSONString(orderInfoDTO)); + panOrderStatusLog.setStatus(1); + panOrderStatusLog.setType(1); + panOrderStatusLogService.save(panOrderStatusLog); + //根据客户订单号去查询WMS装车清单号 QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("order_no",orderInfoDTO.getOrderNo()); PanFactoryOrder panFactoryOrder = factoryOrderService.getOne(queryWrapper); - String loadingList = panFactoryOrder.getLoadingList();//装车清单编号 - orderInfoDTO.setLoadingList(loadingList); + String plantId = panFactoryOrder.getPlantId();//工厂id + String deliveryNumber = panFactoryOrder.getDeliveryNumber(); + orderInfoDTO.setPlantId(plantId); + orderInfoDTO.setDeliveryNumber(deliveryNumber); + + //拼接参数 + Map map = new HashMap<>(); + map.put("payload", JSONObject.toJSONString(orderInfoDTO)); + + Gson gson = new GsonBuilder().setPrettyPrinting().create(); + String s = gson.toJson(map); + + //先获取token + String panToken = getPanToken(); + + //请求参数 + logger.info("##############handleData: 推送包件状态请求参数 {}",s); + //处理逻辑 + //TODO 这里还差那边给到请求接口 + String result = HttpRequest.post(panFactoryProperties.getUrl()+"") + .header("Authorization","Bearer "+panToken) + .header("Content-Type","application/json") + .body(s).timeout(5 * 1000) + .execute().body(); + + logger.info("##############handleData: 推送包件状态返回参数 {}",result); + + //把结果字符串转为json对象 + JSONObject jsonObject = JSONObject.parseObject(result); + JSONObject payload = jsonObject.getJSONObject("payload"); + if(!Objects.isNull(payload)){ + Integer code = payload.getInteger("code"); + String message = payload.getString("data"); + if(code.equals(1)){ + logger.info("##########handleData: 物流状态传递成功"); + panOrderStatusLog.setStatus(0); + panOrderStatusLogService.saveOrUpdate(panOrderStatusLog); + }else{ + throw new CustomerException(400,message); + } + }else{ + throw new CustomerException(400,"返回格式有误:"+result); + } - //推送到皮阿诺系统 - String url = ""; -// String result = HttpRequest.post(url+"/oauth/oauth/token").form(map).timeout(5 * 1000).execute().body(); } @@ -105,12 +151,11 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { PanOrderStatusLog panOrderStatusLog = new PanOrderStatusLog(); panOrderStatusLog.setArgs(JSONObject.toJSONString(orderStatusDTO)); panOrderStatusLog.setStatus(1); + panOrderStatusLog.setType(2); panOrderStatusLogService.save(panOrderStatusLog); //拼接参数 Map map = new HashMap<>(); -// map.put("payload",JSONObject.toJSONString(orderStatusDTO)); -// map.put("payload", CommonUtil.formatJson(orderStatusDTO)); map.put("payload", JSONObject.toJSONString(orderStatusDTO)); Gson gson = new GsonBuilder().setPrettyPrinting().create();