|
@@ -15,6 +15,7 @@ import com.zkqy.amichi.domain.ProductionCardFlow;
|
|
|
import com.zkqy.amichi.domain.ProductionPlanningManagement;
|
|
|
import com.zkqy.amichi.jd.domain.JdMaterialInfoVo;
|
|
|
import com.zkqy.amichi.jd.domain.ProductionCardFlowVo;
|
|
|
+import com.zkqy.amichi.mapper.MaterialBaseInfoMapper;
|
|
|
import com.zkqy.amichi.mapper.PlanTaskDetailsMapper;
|
|
|
import com.zkqy.amichi.mapper.ProductionCardFlowMapper;
|
|
|
import com.zkqy.amichi.mapper.ProductionPlanningManagementMapper;
|
|
@@ -51,6 +52,9 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
|
|
|
@Autowired
|
|
|
private ProductionCardFlowMapper productionCardFlowMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private JdMaterialInfoServiceImpl jdMaterialInfoService;
|
|
|
+
|
|
|
/**
|
|
|
* 查询金蝶-生产订单信息
|
|
|
*
|
|
@@ -174,9 +178,9 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public AjaxResult jdProductionOrderPull(JdProductionOrder jdProductionOrder) {
|
|
|
- this.jdProductionOrderPullTwo();
|
|
|
- return AjaxResult.success("数据拉取成功");
|
|
|
+ public AjaxResult jdProductionOrderPull() {
|
|
|
+ AjaxResult ajaxResult = this.jdProductionOrderPullTwo();
|
|
|
+ return ajaxResult;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -301,6 +305,179 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
|
|
|
}
|
|
|
|
|
|
|
|
|
+// /**
|
|
|
+// * 物料编码不等于焊接
|
|
|
+// * 条件:所有开工数据
|
|
|
+// *
|
|
|
+// * @return
|
|
|
+// */
|
|
|
+//public AjaxResult jdProductionOrderPullTwo(){
|
|
|
+// //金蝶工具key
|
|
|
+// K3CloudApi api = new K3CloudApi();
|
|
|
+// //定义查询条件
|
|
|
+// String query="{\n" +
|
|
|
+// " \"FormId\": \"PRD_MO\",\n" +
|
|
|
+// " \"FieldKeys\": \"FDescription,F_PONP_teshuyaoqiu,FBillNo,FBillType,FDate,FDocumentStatus," +
|
|
|
+// "FProductType,FMaterialId,FWorkShopID0,FQty,FStatus,,FSaleOrderNo,FPickMtrlStatus," +
|
|
|
+// "FMaterialId.FNumber,FMaterialName,F_PONP_BaseProperty,FSpecification,FUnitId.FName,F_PONP_yanse,F_PONP_mingpai,F_PONP_hegezheng.FDataValue," +
|
|
|
+// "F_PONP_shuomingshu.FDataValue,F_PONP_KaiGuanXiang,F_PONP_baozhuangxiang,F_PONP_GongLv,FPlanFinishDate,FPlanStartDate\",\n" +
|
|
|
+// " \"FilterString\": [{\"Left\":\"\",\"FieldName\":\"FMaterialId.FNumber\",\"Compare\":\"34\",\"Value\":\"焊\",\"Right\":\"\",\"Logic\":0},{\"Left\":\"\",\"FieldName\":\"FStatus\",\"Compare\":\"105\",\"Value\":\"4\",\"Right\":\"\",\"Logic\":0}],\n" +
|
|
|
+// " \"OrderString\": \"\",\n" +
|
|
|
+// " \"TopRowCount\": 0,\n" +
|
|
|
+// " \"StartRow\": 0,\n" +
|
|
|
+// " \"Limit\": 8000,\n" +
|
|
|
+// " \"SubSystemId\": \"\"\n" +
|
|
|
+// "}";
|
|
|
+////
|
|
|
+// try {
|
|
|
+// //查询结果
|
|
|
+// String resultJson = api.billQuery(query);
|
|
|
+// //生产信息
|
|
|
+// List<JdProductionOrder> jdProductionOrders = JSON.parseArray(resultJson, JdProductionOrder.class);
|
|
|
+// //单据编号去重
|
|
|
+//// List<String> collectOne = jdProductionOrders.stream().map(JdProductionOrder::getDemandDocument).collect(Collectors.toSet())
|
|
|
+//// .stream().collect(Collectors.toList());
|
|
|
+//
|
|
|
+// //查询系统中的订单信息
|
|
|
+// ProductionPlanningManagement productionPlanningManagement1=new ProductionPlanningManagement();
|
|
|
+// productionPlanningManagement1.setIsWeldSheet("1");
|
|
|
+// List<ProductionPlanningManagement> productionPlanningManagements = productionPlanningManagementMapper.selectProductionPlanningManagementList(productionPlanningManagement1);
|
|
|
+//
|
|
|
+// List<String> collectTwo = productionPlanningManagements.stream().map(ProductionPlanningManagement::getOrderNumber).collect(Collectors.toSet())
|
|
|
+// .stream().collect(Collectors.toList());
|
|
|
+//
|
|
|
+//// List<String> cj= collectOne.stream().filter(item -> !collectTwo.contains(item)).collect(Collectors.toList());
|
|
|
+// //分组
|
|
|
+// // 按照订单号分组并去重
|
|
|
+//// Map<String, JdProductionOrder> groupedByDemandDocument = jdProductionOrders.stream().filter(item->!collectTwo.contains(item.getDemandDocument()))
|
|
|
+//// .collect(Collectors.toMap(
|
|
|
+//// JdProductionOrder::getDemandDocument,
|
|
|
+//// order -> order,
|
|
|
+//// (existing, replacement) -> existing // 保留第一个出现的订单
|
|
|
+//// ));
|
|
|
+// Map<String, List<JdProductionOrder>> groupedByDemandDocument = jdProductionOrders.stream()
|
|
|
+// .filter(item -> !collectTwo.contains(item.getDemandDocument()))
|
|
|
+// .collect(Collectors.groupingBy(JdProductionOrder::getDemandDocument));
|
|
|
+// if(groupedByDemandDocument.size()>0){
|
|
|
+// //订单循环
|
|
|
+// groupedByDemandDocument.forEach((k,v)->{
|
|
|
+// //计划编号
|
|
|
+// String planNumnber = generator.generateCommissionNumber();
|
|
|
+// //编号订单号
|
|
|
+// List<Map> mapList = this.jdSalesOrderInfoS(k);//订单详情信息
|
|
|
+// System.err.println(mapList.size());
|
|
|
+// //拿到了关于这个订单的销售订单
|
|
|
+// if(mapList.size()>0){
|
|
|
+// //编号订单号
|
|
|
+// String fBillNo = mapList.get(0).get("FBillNo").toString();//单据编号
|
|
|
+// //合同号
|
|
|
+// String F_PONP_Text = mapList.get(0).get("F.PONP.Text").toString();
|
|
|
+// //下单时间
|
|
|
+// String FDate = mapList.get(0).get("FCreateDate").toString();//日期
|
|
|
+// String F_PONP_Datetime;
|
|
|
+// if(mapList.get(0).get("F_PONP_DATETIME")!=null){
|
|
|
+// //要货日期
|
|
|
+// F_PONP_Datetime = mapList.get(0).get("F_PONP_DATETIME").toString();//要货日期
|
|
|
+// } else if(mapList.get(0).get("FDeliveryDate")!=null){
|
|
|
+// F_PONP_Datetime =mapList.get(0).get("FDeliveryDate").toString();//要货日期;
|
|
|
+// }else {
|
|
|
+// F_PONP_Datetime="";
|
|
|
+// }
|
|
|
+// ProductionPlanningManagement productionPlanningManagement=new ProductionPlanningManagement();
|
|
|
+// productionPlanningManagement.setPlanNumber(planNumnber);
|
|
|
+// productionPlanningManagement.setOrderNumber(fBillNo);
|
|
|
+// productionPlanningManagement.setContractNumber(F_PONP_Text);
|
|
|
+// if(StringUtils.isNotNull(v.get(0).getBz())){ //备注
|
|
|
+// productionPlanningManagement.setRemark(v.get(0).getBz());
|
|
|
+// }
|
|
|
+// productionPlanningManagement.setCreationtimeString(FDate);
|
|
|
+// productionPlanningManagement.setCompletionTime(F_PONP_Datetime);
|
|
|
+// if(StringUtils.isNotNull(v.get(0).getTsyq())){
|
|
|
+// productionPlanningManagement.setSpecialRequirements(v.get(0).getTsyq()); //特殊要求
|
|
|
+// }
|
|
|
+// productionPlanningManagement.setPlanType("0"); //待生产
|
|
|
+// productionPlanningManagement.setTaskStatus("2");//待排产
|
|
|
+// productionPlanningManagement.setIsWeldSheet("1"); //普通订单
|
|
|
+// //======处理基本的订单信息
|
|
|
+// productionPlanningManagementMapper.insertProductionPlanningManagement(productionPlanningManagement);
|
|
|
+// mapList.forEach(a->{
|
|
|
+// PlanTaskDetails planTaskDetails=new PlanTaskDetails();
|
|
|
+// List<JdProductionOrder> collect1 = jdProductionOrders.stream().filter(c -> c.getDemandDocument().equals(k) && c.getMaterialCode().equals(a.get("FMaterialId.FNumber").toString())).collect(Collectors.toList());
|
|
|
+// if(collect1.size()<=0){
|
|
|
+// System.out.println(k);
|
|
|
+// System.out.println(a.get("FMaterialId.FNumber").toString());
|
|
|
+// }
|
|
|
+// if(collect1.size()>0){
|
|
|
+// //需求单据(处理详情信息没有需求单据的问题)
|
|
|
+// planTaskDetails.setDemandDocument(collect1.get(0).getDocumentNumber()); //需求单据
|
|
|
+// //颜色
|
|
|
+// planTaskDetails.setColour(collect1.get(0).getYanse());
|
|
|
+// //铭牌
|
|
|
+// planTaskDetails.setMingpai(collect1.get(0).getMingpai());
|
|
|
+// //合格证
|
|
|
+// planTaskDetails.setHegezheng(collect1.get(0).getHegezheng());
|
|
|
+// //说明书
|
|
|
+// planTaskDetails.setShuomingshu(collect1.get(0).getShuomingshu());
|
|
|
+// //包装箱
|
|
|
+// planTaskDetails.setBaozhuangxiang(collect1.get(0).getBaozhuangxiang());
|
|
|
+// //开关箱子
|
|
|
+// planTaskDetails.setSwitchBox(collect1.get(0).getKaiguanxiang());
|
|
|
+// //功率
|
|
|
+// planTaskDetails.setPower(collect1.get(0).getGl());
|
|
|
+// }
|
|
|
+// planTaskDetails.setPlanId(productionPlanningManagement.getId());//计划id
|
|
|
+// planTaskDetails.setMaterialId(a.get("FMaterialId.FNumber").toString());//原材料编码
|
|
|
+// planTaskDetails.setMaterialName(a.get("FMaterialName").toString());//名称
|
|
|
+// planTaskDetails.setQuantity(a.get("FQty").toString());//数量
|
|
|
+// planTaskDetails.setTimeOfRequest(F_PONP_Datetime);
|
|
|
+// planTaskDetails.setCustomerModel(a.get("F.PONP.Text1").toString());//客户型号
|
|
|
+// planTaskDetails.setModelNumber(a.get("F.PONP.BaseProperty").toString());//型号
|
|
|
+// planTaskDetails.setSpecification(a.get("FMaterialModel").toString());//规格
|
|
|
+// planTaskDetails.setMaterialUnit(a.get("FUnitID.FName").toString());//单位
|
|
|
+//
|
|
|
+//// planTaskDetails.setColour(a.get("F.PONP.yanse").toString()); //颜色
|
|
|
+//// planTaskDetails.setMingpai(a.get("F.PONP.mingpai").toString()); //铭牌
|
|
|
+//// planTaskDetails.setHegezheng(a.get("F.PONP.hegezheng.FDataValue").toString()); //合格证
|
|
|
+//// planTaskDetails.setShuomingshu(a.get("F.PONP.shuomingshu.FDataValue").toString()); //说明书
|
|
|
+//// planTaskDetails.setBaozhuangxiang(a.get("F.PONP.baozhuangxiang").toString()); //包装箱
|
|
|
+//// planTaskDetails.setSwitchBox(a.get("F.PONP.Text5").toString()); //开关箱
|
|
|
+// planTaskDetailsMapper.insertPlanTaskDetails(planTaskDetails);
|
|
|
+// });
|
|
|
+// }
|
|
|
+// });
|
|
|
+// //处理订单序列号问题
|
|
|
+// groupedByDemandDocument.forEach((k,v)->{
|
|
|
+//// String documentNumber = item.getDocumentNumber();//需求单据编号
|
|
|
+// String stringQuery="{\n" +
|
|
|
+// " \"FormId\": \"PRD_MO\",\n" +
|
|
|
+// " \"FieldKeys\": \"FBillNo,FSNQty1,FSaleOrderNo,FSerialNo\",\n" +
|
|
|
+// " \"FilterString\": [{\"Left\":\"\",\"FieldName\":\"FMaterialId.FNumber\",\"Compare\":\"34\",\"Value\":\"焊\",\"Right\":\"\",\"Logic\":0},{\"Left\":\"\",\"FieldName\":\"FStatus\",\"Compare\":\"105\",\"Value\":\"4\",\"Right\":\"\",\"Logic\":0},{\"Left\":\"\",\"FieldName\":\"FSaleOrderNo\",\"Compare\":\"67\",\"Value\":\""+k+"\",\"Right\":\"\",\"Logic\":0}],\n" +
|
|
|
+// " \"OrderString\": \"\",\n" +
|
|
|
+// " \"TopRowCount\": 0,\n" +
|
|
|
+// " \"StartRow\": 0,\n" +
|
|
|
+// " \"Limit\": 2000,\n" +
|
|
|
+// " \"SubSystemId\": \"\"\n" +
|
|
|
+// "}";
|
|
|
+// try {
|
|
|
+// String xlhString = api.billQuery(stringQuery);
|
|
|
+// if(!xlhString.equals("[]")){
|
|
|
+// List<ProductionCardFlowVo> mapList1 = JSON.parseArray(xlhString, ProductionCardFlowVo.class);
|
|
|
+// int i = productionCardFlowMapper.insertProductionCardFlowBatchVo(mapList1);
|
|
|
+// }
|
|
|
+// } catch (Exception e) {
|
|
|
+// throw new RuntimeException(e);
|
|
|
+// }
|
|
|
+// });
|
|
|
+// }
|
|
|
+// } catch (Exception e) {
|
|
|
+// throw new RuntimeException(e);
|
|
|
+// }
|
|
|
+// return AjaxResult.success();
|
|
|
+//}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 物料编码不等于焊接
|
|
|
* 条件:所有开工数据
|
|
@@ -308,6 +485,8 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
|
|
|
* @return
|
|
|
*/
|
|
|
public AjaxResult jdProductionOrderPullTwo(){
|
|
|
+ AjaxResult ajaxResult = jdMaterialInfoService.pullMaterialBaseInfo();
|
|
|
+ System.out.println(ajaxResult);
|
|
|
//金蝶工具key
|
|
|
K3CloudApi api = new K3CloudApi();
|
|
|
//定义查询条件
|
|
@@ -316,7 +495,7 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
|
|
|
" \"FieldKeys\": \"FDescription,F_PONP_teshuyaoqiu,FBillNo,FBillType,FDate,FDocumentStatus," +
|
|
|
"FProductType,FMaterialId,FWorkShopID0,FQty,FStatus,,FSaleOrderNo,FPickMtrlStatus," +
|
|
|
"FMaterialId.FNumber,FMaterialName,F_PONP_BaseProperty,FSpecification,FUnitId.FName,F_PONP_yanse,F_PONP_mingpai,F_PONP_hegezheng.FDataValue," +
|
|
|
- "F_PONP_shuomingshu.FDataValue,F_PONP_KaiGuanXiang,F_PONP_baozhuangxiang,F_PONP_GongLv,FPlanFinishDate,FPlanStartDate\",\n" +
|
|
|
+ "F_PONP_shuomingshu.FDataValue,F_PONP_KaiGuanXiang,F_PONP_baozhuangxiang,F_PONP_GongLv,FPlanFinishDate,FPlanStartDate,F_PONP_XQRQ,FPlanStartDate,FPlanFinishDate\",\n" +
|
|
|
" \"FilterString\": [{\"Left\":\"\",\"FieldName\":\"FMaterialId.FNumber\",\"Compare\":\"34\",\"Value\":\"焊\",\"Right\":\"\",\"Logic\":0},{\"Left\":\"\",\"FieldName\":\"FStatus\",\"Compare\":\"105\",\"Value\":\"4\",\"Right\":\"\",\"Logic\":0}],\n" +
|
|
|
" \"OrderString\": \"\",\n" +
|
|
|
" \"TopRowCount\": 0,\n" +
|
|
@@ -330,117 +509,98 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
|
|
|
String resultJson = api.billQuery(query);
|
|
|
//生产信息
|
|
|
List<JdProductionOrder> jdProductionOrders = JSON.parseArray(resultJson, JdProductionOrder.class);
|
|
|
- //单据编号去重
|
|
|
-// List<String> collectOne = jdProductionOrders.stream().map(JdProductionOrder::getDemandDocument).collect(Collectors.toSet())
|
|
|
-// .stream().collect(Collectors.toList());
|
|
|
-
|
|
|
//查询系统中的订单信息
|
|
|
ProductionPlanningManagement productionPlanningManagement1=new ProductionPlanningManagement();
|
|
|
productionPlanningManagement1.setIsWeldSheet("1");
|
|
|
List<ProductionPlanningManagement> productionPlanningManagements = productionPlanningManagementMapper.selectProductionPlanningManagementList(productionPlanningManagement1);
|
|
|
-
|
|
|
List<String> collectTwo = productionPlanningManagements.stream().map(ProductionPlanningManagement::getOrderNumber).collect(Collectors.toSet())
|
|
|
.stream().collect(Collectors.toList());
|
|
|
|
|
|
-// List<String> cj= collectOne.stream().filter(item -> !collectTwo.contains(item)).collect(Collectors.toList());
|
|
|
- //分组
|
|
|
- // 按照订单号分组并去重
|
|
|
- Map<String, JdProductionOrder> groupedByDemandDocument = jdProductionOrders.stream().filter(item->!collectTwo.contains(item.getDemandDocument()))
|
|
|
- .collect(Collectors.toMap(
|
|
|
- JdProductionOrder::getDemandDocument,
|
|
|
- order -> order,
|
|
|
- (existing, replacement) -> existing // 保留第一个出现的订单
|
|
|
- ));
|
|
|
+
|
|
|
+ Map<String, List<JdProductionOrder>> groupedByDemandDocument = jdProductionOrders.stream()
|
|
|
+ .filter(item -> !collectTwo.contains(item.getDemandDocument()))
|
|
|
+ .collect(Collectors.groupingBy(JdProductionOrder::getDemandDocument));
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
if(groupedByDemandDocument.size()>0){
|
|
|
//订单循环
|
|
|
groupedByDemandDocument.forEach((k,v)->{
|
|
|
+ ProductionPlanningManagement productionPlanningManagement=new ProductionPlanningManagement();
|
|
|
+ //编号订单号
|
|
|
+ productionPlanningManagement.setOrderNumber(k);
|
|
|
//计划编号
|
|
|
String planNumnber = generator.generateCommissionNumber();
|
|
|
+ productionPlanningManagement.setPlanNumber(planNumnber);
|
|
|
+ //计算订单的最大完成时间
|
|
|
+// Optional<LocalDateTime> maxCompletionTime = v.stream()
|
|
|
+// .map(item -> LocalDateTime.parse(item.getCompletionTime(), DateTimeFormatter.ISO_LOCAL_DATE_TIME))
|
|
|
+// .max(Comparator.naturalOrder());
|
|
|
+// maxCompletionTime.ifPresent(maxTime ->{
|
|
|
+// System.out.println("最大的时间: " + maxTime);
|
|
|
+// String format1 = maxTime.format(formatter);
|
|
|
+// productionPlanningManagement.setCompletionTime(format1);//订单的最大完成时间
|
|
|
+// });
|
|
|
+ productionPlanningManagement.setPlanType("0"); //待生产
|
|
|
+ productionPlanningManagement.setTaskStatus("2");//待排产
|
|
|
+ productionPlanningManagement.setIsWeldSheet("1");//焊接订单
|
|
|
+ if(StringUtils.isNotNull(v.get(0).getCompletionTime())){
|
|
|
+ productionPlanningManagement.setCompletionTime(v.get(0).getCompletionTime());//完成时间
|
|
|
+ }
|
|
|
+ //备注
|
|
|
+ if(StringUtils.isNotNull(v.get(0).getRemark())){
|
|
|
+ productionPlanningManagement.setRemark(v.get(0).getRemark()); //备注
|
|
|
+ }
|
|
|
+ //订单的创建时间
|
|
|
+ productionPlanningManagement.setCreationtimeString(v.get(0).getCreationtimeString());//单据的创建时间
|
|
|
+ //特殊要求
|
|
|
+ if(StringUtils.isNotNull(v.get(0).getTsyq())){
|
|
|
+ productionPlanningManagement.setSpecialRequirements(v.get(0).getTsyq());//特殊要求
|
|
|
+ }
|
|
|
+
|
|
|
//编号订单号
|
|
|
List<Map> mapList = this.jdSalesOrderInfoS(k);//订单详情信息
|
|
|
- System.err.println(mapList.size());
|
|
|
+ String fDeliveryDate;
|
|
|
+ if(mapList.size()>0){
|
|
|
+ fDeliveryDate = mapList.get(0).get("FDeliveryDate").toString();
|
|
|
+ } else {
|
|
|
+ fDeliveryDate = "";
|
|
|
+ }
|
|
|
//拿到了关于这个订单的销售订单
|
|
|
if(mapList.size()>0){
|
|
|
- //编号订单号
|
|
|
- String fBillNo = mapList.get(0).get("FBillNo").toString();//单据编号
|
|
|
- //合同号
|
|
|
- String F_PONP_Text = mapList.get(0).get("F.PONP.Text").toString();
|
|
|
- //下单时间
|
|
|
- String FDate = mapList.get(0).get("FCreateDate").toString();//日期
|
|
|
- String F_PONP_Datetime;
|
|
|
- if(mapList.get(0).get("F_PONP_DATETIME")!=null){
|
|
|
- //要货日期
|
|
|
- F_PONP_Datetime = mapList.get(0).get("F_PONP_DATETIME").toString();//要货日期
|
|
|
- } else if(mapList.get(0).get("FDeliveryDate")!=null){
|
|
|
- F_PONP_Datetime =mapList.get(0).get("FDeliveryDate").toString();//要货日期;
|
|
|
- }else {
|
|
|
- F_PONP_Datetime="";
|
|
|
- }
|
|
|
- ProductionPlanningManagement productionPlanningManagement=new ProductionPlanningManagement();
|
|
|
- productionPlanningManagement.setPlanNumber(planNumnber);
|
|
|
- productionPlanningManagement.setOrderNumber(fBillNo);
|
|
|
- productionPlanningManagement.setContractNumber(F_PONP_Text);
|
|
|
- if(StringUtils.isNotNull(v.getBz())){ //备注
|
|
|
- productionPlanningManagement.setRemark(v.getBz());
|
|
|
- }
|
|
|
- productionPlanningManagement.setCreationtimeString(FDate);
|
|
|
- productionPlanningManagement.setCompletionTime(F_PONP_Datetime);
|
|
|
- if(StringUtils.isNotNull(v.getTsyq())){
|
|
|
- productionPlanningManagement.setSpecialRequirements(v.getTsyq()); //特殊要求
|
|
|
+ if(StringUtils.isNotNull(mapList.get(0).get("F.PONP.Text"))){
|
|
|
+ productionPlanningManagement.setContractNumber(mapList.get(0).get("F.PONP.Text").toString());
|
|
|
}
|
|
|
- productionPlanningManagement.setPlanType("0"); //待生产
|
|
|
- productionPlanningManagement.setTaskStatus("2");//待排产
|
|
|
- productionPlanningManagement.setIsWeldSheet("1"); //普通订单
|
|
|
+ productionPlanningManagement.setCompletionTime(fDeliveryDate);
|
|
|
//======处理基本的订单信息
|
|
|
productionPlanningManagementMapper.insertProductionPlanningManagement(productionPlanningManagement);
|
|
|
- mapList.forEach(a->{
|
|
|
+ v.forEach(a->{
|
|
|
PlanTaskDetails planTaskDetails=new PlanTaskDetails();
|
|
|
-// String string = a.get("FMaterialId.FNumber").toString();
|
|
|
- List<JdProductionOrder> collect1 = jdProductionOrders.stream().filter(c -> c.getDemandDocument().equals(k) && c.getMaterialCode().equals(a.get("FMaterialId.FNumber").toString())).collect(Collectors.toList());
|
|
|
- if(collect1.size()>0){
|
|
|
- //需求单据(处理详情信息没有需求单据的问题)
|
|
|
- planTaskDetails.setDemandDocument(collect1.get(0).getDocumentNumber()); //需求单据
|
|
|
- //颜色
|
|
|
- planTaskDetails.setColour(collect1.get(0).getYanse());
|
|
|
- //铭牌
|
|
|
- planTaskDetails.setMingpai(collect1.get(0).getMingpai());
|
|
|
- //合格证
|
|
|
- planTaskDetails.setHegezheng(collect1.get(0).getHegezheng());
|
|
|
- //说明书
|
|
|
- planTaskDetails.setShuomingshu(collect1.get(0).getShuomingshu());
|
|
|
- //包装箱
|
|
|
- planTaskDetails.setBaozhuangxiang(collect1.get(0).getBaozhuangxiang());
|
|
|
- //开关箱子
|
|
|
- planTaskDetails.setSwitchBox(collect1.get(0).getKaiguanxiang());
|
|
|
- //功率
|
|
|
- planTaskDetails.setPower(collect1.get(0).getGl());
|
|
|
- //数据
|
|
|
- //planTaskDetails.seti
|
|
|
- }
|
|
|
-// planTaskDetails.setDemandDocument(v.getDocumentNumber()); //需求单据
|
|
|
+ planTaskDetails.setDemandDocument(a.getDocumentNumber());//需求单据号
|
|
|
planTaskDetails.setPlanId(productionPlanningManagement.getId());//计划id
|
|
|
- planTaskDetails.setMaterialId(a.get("FMaterialId.FNumber").toString());//原材料编码
|
|
|
- planTaskDetails.setMaterialName(a.get("FMaterialName").toString());//名称
|
|
|
- planTaskDetails.setQuantity(a.get("FQty").toString());//数量
|
|
|
- planTaskDetails.setTimeOfRequest(F_PONP_Datetime);
|
|
|
- planTaskDetails.setCustomerModel(a.get("F.PONP.Text1").toString());//客户型号
|
|
|
- planTaskDetails.setModelNumber(a.get("F.PONP.BaseProperty").toString());//型号
|
|
|
- planTaskDetails.setSpecification(a.get("FMaterialModel").toString());//规格
|
|
|
- planTaskDetails.setMaterialUnit(a.get("FUnitID.FName").toString());//单位
|
|
|
-
|
|
|
-// planTaskDetails.setColour(a.get("F.PONP.yanse").toString()); //颜色
|
|
|
-// planTaskDetails.setMingpai(a.get("F.PONP.mingpai").toString()); //铭牌
|
|
|
-// planTaskDetails.setHegezheng(a.get("F.PONP.hegezheng.FDataValue").toString()); //合格证
|
|
|
-// planTaskDetails.setShuomingshu(a.get("F.PONP.shuomingshu.FDataValue").toString()); //说明书
|
|
|
-// planTaskDetails.setBaozhuangxiang(a.get("F.PONP.baozhuangxiang").toString()); //包装箱
|
|
|
-// planTaskDetails.setSwitchBox(a.get("F.PONP.Text5").toString()); //开关箱
|
|
|
+ planTaskDetails.setMaterialId(a.getMaterialCode());//原材料编码
|
|
|
+ planTaskDetails.setMaterialName(a.getMaterialName());//名称
|
|
|
+ planTaskDetails.setQuantity(a.getQuantity());//数量
|
|
|
+ planTaskDetails.setTimeOfRequest(a.getCompletionTime());//要货时间
|
|
|
+ planTaskDetails.setModelNumber(a.getModelNumber());//型号
|
|
|
+ planTaskDetails.setSpecification(a.getSpecification());//规格
|
|
|
+ planTaskDetails.setMaterialUnit(a.getUnit());//单位
|
|
|
+ planTaskDetails.setPower(a.getGl());//功率
|
|
|
+ planTaskDetails.setVoltage(a.getDianYaPinLv());//电压频率
|
|
|
+ planTaskDetails.setColour(a.getYanse());//颜色
|
|
|
+ planTaskDetails.setMingpai(a.getMingpai());//铭牌
|
|
|
+ planTaskDetails.setShuomingshu(a.getShuomingshu());//说明书
|
|
|
+ planTaskDetails.setHegezheng(a.getHegezheng());//合格证
|
|
|
+ planTaskDetails.setBaozhuangxiang(a.getBaozhuangxiang());//包装箱
|
|
|
+ planTaskDetails.setSwitchBox(a.getKaiguanxiang());//开关箱
|
|
|
+ planTaskDetails.setScheduledCommencement(a.getFPlanStartDate()); //计划开始时间
|
|
|
+ planTaskDetails.setScheduledCompletion(a.getFPlanFinishDate()); //计划完工时间
|
|
|
+ planTaskDetails.setRemark(a.getRemark());
|
|
|
+ planTaskDetails.setTimeOfRequest(fDeliveryDate);
|
|
|
planTaskDetailsMapper.insertPlanTaskDetails(planTaskDetails);
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
//处理订单序列号问题
|
|
|
groupedByDemandDocument.forEach((k,v)->{
|
|
|
-// String documentNumber = item.getDocumentNumber();//需求单据编号
|
|
|
String stringQuery="{\n" +
|
|
|
" \"FormId\": \"PRD_MO\",\n" +
|
|
|
" \"FieldKeys\": \"FBillNo,FSNQty1,FSaleOrderNo,FSerialNo\",\n" +
|
|
@@ -467,8 +627,6 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
|
|
|
}
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 拉取焊接
|
|
|
*/
|
|
@@ -497,11 +655,11 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
|
|
|
" \"OrderString\": \"\",\n" +
|
|
|
" \"TopRowCount\": 0,\n" +
|
|
|
" \"StartRow\": 0,\n" +
|
|
|
- " \"Limit\": 1000,\n" +
|
|
|
+ " \"Limit\": 5000,\n" +
|
|
|
" \"SubSystemId\": \"\"\n" +
|
|
|
"}";
|
|
|
int startRow = 0; // 起始行号
|
|
|
- int limit = 1000; // 每次查询的数量
|
|
|
+ int limit = 5000; // 每次查询的数量
|
|
|
// 更新查询条件中的起始行号
|
|
|
//查询条件
|
|
|
Map<String, Object> map = JSON.parseObject(query, Map.class);
|
|
@@ -542,15 +700,15 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
|
|
|
productionPlanningManagement.setPlanType("0"); //待生产
|
|
|
productionPlanningManagement.setTaskStatus("2");//待排产
|
|
|
productionPlanningManagement.setIsWeldSheet("2");//焊接订单
|
|
|
- //计算订单的最大完成时间
|
|
|
- Optional<LocalDateTime> maxCompletionTime = v.stream()
|
|
|
- .map(item -> LocalDateTime.parse(item.getCompletionTime(), DateTimeFormatter.ISO_LOCAL_DATE_TIME))
|
|
|
- .max(Comparator.naturalOrder());
|
|
|
- maxCompletionTime.ifPresent(maxTime ->{
|
|
|
- System.out.println("最大的时间: " + maxTime);
|
|
|
- String format1 = maxTime.format(formatter);
|
|
|
- productionPlanningManagement.setCompletionTime(format1);//订单的最大完成时间
|
|
|
- });
|
|
|
+// //计算订单的最大完成时间
|
|
|
+// Optional<LocalDateTime> maxCompletionTime = v.stream()
|
|
|
+// .map(item -> LocalDateTime.parse(item.getCompletionTime(), DateTimeFormatter.ISO_LOCAL_DATE_TIME))
|
|
|
+// .max(Comparator.naturalOrder());
|
|
|
+// maxCompletionTime.ifPresent(maxTime ->{
|
|
|
+// System.out.println("最大的时间: " + maxTime);
|
|
|
+// String format1 = maxTime.format(formatter);
|
|
|
+// productionPlanningManagement.setCompletionTime(format1);//订单的最大完成时间
|
|
|
+// });
|
|
|
//备注
|
|
|
if(StringUtils.isNotNull(v.get(0).getRemark())){
|
|
|
productionPlanningManagement.setRemark(v.get(0).getRemark()); //备注
|
|
@@ -563,14 +721,22 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
//编号订单号
|
|
|
List<Map> mapList = this.jdSalesOrderInfoS(k);//订单详情信息
|
|
|
-
|
|
|
+ String fDeliveryDate;
|
|
|
+ if(mapList.size()>0){
|
|
|
+ fDeliveryDate = mapList.get(0).get("FDeliveryDate").toString();
|
|
|
+ } else {
|
|
|
+ fDeliveryDate = "";
|
|
|
+ }
|
|
|
//拿到了关于这个订单的销售订单
|
|
|
if(mapList.size()>0){
|
|
|
if(StringUtils.isNotNull(mapList.get(0).get("F.PONP.Text"))){
|
|
|
productionPlanningManagement.setContractNumber(mapList.get(0).get("F.PONP.Text").toString());
|
|
|
}
|
|
|
+ productionPlanningManagement.setCompletionTime(fDeliveryDate);
|
|
|
//======处理基本的订单信息
|
|
|
productionPlanningManagementMapper.insertProductionPlanningManagement(productionPlanningManagement);
|
|
|
v.forEach(a->{
|
|
@@ -595,13 +761,14 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
|
|
|
planTaskDetails.setScheduledCommencement(a.getFPlanStartDate()); //计划开始时间
|
|
|
planTaskDetails.setScheduledCompletion(a.getFPlanFinishDate()); //计划完工时间
|
|
|
planTaskDetails.setRemark(a.getRemark());
|
|
|
+ planTaskDetails.setTimeOfRequest(fDeliveryDate);//要货日期
|
|
|
planTaskDetailsMapper.insertPlanTaskDetails(planTaskDetails);
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
System.out.println(1);
|
|
|
- if (jdProductionOrders.size() < 1000) {
|
|
|
+ if (jdProductionOrders.size() < 5000) {
|
|
|
flag = false;
|
|
|
}
|
|
|
// 更新起始行号
|