|
|
|
@ -2,14 +2,21 @@ package com.os.mes.prod.service.impl;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
|
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
|
|
|
|
import com.os.common.utils.DateUtils;
|
|
|
|
|
import com.os.common.utils.uuid.PlanCodeUtils;
|
|
|
|
|
import com.os.mes.api.domain.Material;
|
|
|
|
|
import com.os.mes.api.domain.RecordData;
|
|
|
|
|
import com.os.mes.api.domain.ResponseData;
|
|
|
|
|
import com.os.mes.api.domain.UpperLowerGlue;
|
|
|
|
|
import com.os.mes.prod.domain.ProdOrderDetail;
|
|
|
|
|
import com.os.mes.prod.domain.ProdPlanInfo;
|
|
|
|
|
import com.os.mes.prod.service.IProdOrderDetailService;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
@ -226,4 +233,69 @@ public class ProdOrderInfoServiceImpl implements IProdOrderInfoService {
|
|
|
|
|
|
|
|
|
|
return orderDetail;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据订单生成工单
|
|
|
|
|
* @param prodOrderInfo
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public HashMap<String, Object> generateWorkOrder(ProdOrderInfo prodOrderInfo) {
|
|
|
|
|
HashMap<String, Object> result = new HashMap<>();
|
|
|
|
|
List<ProdPlanInfo> planInfoList = new ArrayList<>();
|
|
|
|
|
ProdOrderInfo prodOrder = prodOrderInfoMapper.selectProdOrderInfoByObjId(prodOrderInfo.getObjId());
|
|
|
|
|
|
|
|
|
|
//布
|
|
|
|
|
ProdPlanInfo clothPlan = new ProdPlanInfo();
|
|
|
|
|
clothPlan.setOrderCode(prodOrder.getOrderCode());
|
|
|
|
|
clothPlan.setPlanCode(PlanCodeUtils.getPlanCode());
|
|
|
|
|
clothPlan.setPlanAmount(prodOrder.getOrderDetail().getEstimatedFabricUsage());
|
|
|
|
|
try {
|
|
|
|
|
String fabricSpecifications = prodOrder.getOrderDetail().getFabricSpecifications();
|
|
|
|
|
ObjectMapper resultMapper = new ObjectMapper();
|
|
|
|
|
Material material = resultMapper.readValue(fabricSpecifications, Material.class);
|
|
|
|
|
clothPlan.setMaterialCode(material.getMaterialNo());
|
|
|
|
|
clothPlan.setMaterialName(material.getMaterialName());
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//胶
|
|
|
|
|
ProdPlanInfo gluePlan = new ProdPlanInfo();
|
|
|
|
|
gluePlan.setOrderCode(prodOrder.getOrderCode());
|
|
|
|
|
gluePlan.setPlanCode(PlanCodeUtils.getPlanCode());
|
|
|
|
|
gluePlan.setPlanAmount(prodOrder.getOrderDetail().getUpperLowerGlueUsage());
|
|
|
|
|
try {
|
|
|
|
|
String upperLowerGlue = prodOrder.getOrderDetail().getUpperLowerGlue();
|
|
|
|
|
ObjectMapper resultMapper = new ObjectMapper();
|
|
|
|
|
UpperLowerGlue glue = resultMapper.readValue(upperLowerGlue, UpperLowerGlue.class);
|
|
|
|
|
gluePlan.setMaterialCode(glue.getMaterialList_1().get(0).getMaterial().getMaterialNo());
|
|
|
|
|
gluePlan.setMaterialName(glue.getMaterialList_1().get(0).getMaterial().getMaterialName());
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//输送带
|
|
|
|
|
ProdPlanInfo conveyorBeltsPlan = new ProdPlanInfo();
|
|
|
|
|
conveyorBeltsPlan.setOrderCode(prodOrder.getOrderCode());
|
|
|
|
|
conveyorBeltsPlan.setPlanCode(PlanCodeUtils.getPlanCode());
|
|
|
|
|
conveyorBeltsPlan.setPlanAmount(prodOrder.getOrderDetail().getBeltRequiredLength());
|
|
|
|
|
conveyorBeltsPlan.setMaterialCode("1000099");
|
|
|
|
|
String beltLengthSpecifications = prodOrder.getOrderDetail().getBeltLengthSpecifications();
|
|
|
|
|
if (beltLengthSpecifications != null && !beltLengthSpecifications.isEmpty()) {
|
|
|
|
|
int spaceIndex = beltLengthSpecifications.indexOf(' ');
|
|
|
|
|
if (spaceIndex != -1) {
|
|
|
|
|
beltLengthSpecifications = beltLengthSpecifications.substring(0, spaceIndex);
|
|
|
|
|
}
|
|
|
|
|
conveyorBeltsPlan.setMaterialName(beltLengthSpecifications);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
planInfoList.add(clothPlan);
|
|
|
|
|
planInfoList.add(gluePlan);
|
|
|
|
|
planInfoList.add(conveyorBeltsPlan);
|
|
|
|
|
result.put("prodOrder", prodOrder);
|
|
|
|
|
result.put("planInfoList", planInfoList);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|