fix:MES对接相关代码优化
This commit is contained in:
@@ -1,40 +0,0 @@
|
||||
package org.nl.wms.ext.mes.rest;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.wms.ext.mes.service.LmsToMesService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
|
||||
@RequestMapping("/CamstarApi")
|
||||
@Slf4j
|
||||
public class BLmsToMesController {
|
||||
private final LmsToMesService lmsToMesService;
|
||||
|
||||
@PostMapping("/momAutoTransterMoveIn")
|
||||
@Log("表处、分切上料反馈接口")
|
||||
public ResponseEntity<Object> momAutoTransterMoveIn(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(lmsToMesService.momAutoTransterMoveIn(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/momGetPackingInfo")
|
||||
@Log("LMS通过木箱号调用木箱信息")
|
||||
public ResponseEntity<Object> momGetPackingInfo(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(lmsToMesService.momGetPackingInfo(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/momBoxPackageSubmit")
|
||||
@Log("LMS装箱完成传MES包装关系")
|
||||
public ResponseEntity<Object> momBoxPackageSubmit(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(lmsToMesService.momBoxPackageSubmit(jo), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -117,4 +117,22 @@ public class LmsToMesController {
|
||||
public ResponseEntity<Object> ChildScrapUpdate(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(lmsToMesService.ChildScrapUpdate(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/momAutoTransterMoveIn")
|
||||
@Log("表处、分切上料反馈接口")
|
||||
public ResponseEntity<Object> momAutoTransterMoveIn(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(lmsToMesService.momAutoTransterMoveIn(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/momGetPackingInfo")
|
||||
@Log("LMS通过木箱号调用木箱信息")
|
||||
public ResponseEntity<Object> momGetPackingInfo(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(lmsToMesService.momGetPackingInfo(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/momBoxPackageSubmit")
|
||||
@Log("LMS装箱完成传MES包装关系")
|
||||
public ResponseEntity<Object> momBoxPackageSubmit(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(lmsToMesService.momBoxPackageSubmit(jo), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -707,15 +707,15 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
String to_area = param.getString("to_area");
|
||||
String container_name = param.getString("container_name");
|
||||
|
||||
if (StrUtil.isEmpty(from_area)){
|
||||
if (StrUtil.isEmpty(from_area)) {
|
||||
throw new BadRequestException("起始区域不能为空!");
|
||||
}
|
||||
|
||||
if (StrUtil.isEmpty(to_area)){
|
||||
if (StrUtil.isEmpty(to_area)) {
|
||||
throw new BadRequestException("目的区域不能为空!");
|
||||
}
|
||||
|
||||
if (StrUtil.isEmpty(container_name)){
|
||||
if (StrUtil.isEmpty(container_name)) {
|
||||
throw new BadRequestException("子卷号不能为空!");
|
||||
}
|
||||
|
||||
@@ -808,19 +808,19 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
String box_weight = param.getString("box_weight");
|
||||
JSONArray rows = param.getJSONArray("rows");
|
||||
|
||||
if(StrUtil.isEmpty(box_no)){
|
||||
if (StrUtil.isEmpty(box_no)) {
|
||||
throw new BadRequestException("木箱号不能为空!");
|
||||
}
|
||||
|
||||
if(StrUtil.isEmpty(num)){
|
||||
if (StrUtil.isEmpty(num)) {
|
||||
throw new BadRequestException("箱内子卷数不能为空!");
|
||||
}
|
||||
|
||||
if(StrUtil.isEmpty(box_weight)){
|
||||
if (StrUtil.isEmpty(box_weight)) {
|
||||
throw new BadRequestException("木箱毛重不能为空!");
|
||||
}
|
||||
|
||||
if(ObjectUtil.isEmpty(rows)){
|
||||
if (ObjectUtil.isEmpty(rows)) {
|
||||
throw new BadRequestException("箱内子卷信息不能为空!");
|
||||
}
|
||||
|
||||
@@ -834,14 +834,17 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
String Password = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_PASSWORD").getValue();
|
||||
param.put("UserName", UserName);
|
||||
param.put("Password", Password);
|
||||
param.put("ContainerName", box_no);
|
||||
param.put("PackageBoxSN", box_no);
|
||||
param.put("QuanlityInBox", num);
|
||||
param.put("BoxWeight", box_weight);
|
||||
param.put("ContainerList", box_weight);
|
||||
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
.body(String.valueOf(param))
|
||||
.execute().body();
|
||||
result = JSONObject.parseObject(resultMsg);
|
||||
log.info("momGetPackingInfo接口输出参数为:-------------------" + result.toString());
|
||||
log.info("momBoxPackageSubmit接口输出参数为:-------------------" + result.toString());
|
||||
|
||||
|
||||
String RTYPE = result.getString("RTYPE");
|
||||
|
||||
@@ -8,13 +8,16 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.checkerframework.checker.units.qual.C;
|
||||
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.IPdmBiSlittingproductionplanService;
|
||||
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.PdmBiSlittingproductionplan;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
|
||||
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
|
||||
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
|
||||
import org.nl.b_lms.sch.tasks.ProcessTask;
|
||||
@@ -32,6 +35,7 @@ import org.nl.wms.ext.mes.service.MesToLmsService;
|
||||
import org.nl.wms.pda.mps.service.InService;
|
||||
import org.nl.wms.pda.mps.service.OutService;
|
||||
import org.nl.wms.pda.mps.service.impl.BakingServiceImpl;
|
||||
import org.nl.wms.pdm.bi.service.dto.SubpackagerelationDto;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.tasks.CoolCutTask;
|
||||
import org.nl.wms.st.inbill.service.CheckOutBillService;
|
||||
@@ -1736,6 +1740,32 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
public JSONObject momSendSplitMfgOrderBOM(JSONObject param) {
|
||||
log.info("momSendSplitMfgOrderBOM输入参数为:-------------------" + param.toString());
|
||||
|
||||
/* MES传递的入参内容
|
||||
[
|
||||
{
|
||||
"MfgOrderName": "25529502-20230926$02#02",
|
||||
"ProductName": "44151000900045",
|
||||
"Description": "木制包装容器及板材|木箱|650|4|3|1290*750*494",
|
||||
"CarrierName": "48221000000001",
|
||||
"CarrierDescription": "纸制筒管|纸管|3英寸|650",
|
||||
"Type": "RW2",
|
||||
"HL01": "A+",
|
||||
"HL02": "520",
|
||||
"HL03": "1,538.000",
|
||||
"HL031": "2,000.000",
|
||||
"HL04": "100.000",
|
||||
"HL041": "130.000",
|
||||
"HL05": "20,000.000",
|
||||
"HL06": "CC",
|
||||
"HL07": "4",
|
||||
"HL08": "ZT1(纸筒-3寸)",
|
||||
"HL081": "650",
|
||||
"HL09": "ROF(毛面朝外)",
|
||||
"HL10": "纸管长度650,中性包装",
|
||||
"HL11": null
|
||||
}
|
||||
]*/
|
||||
|
||||
JSONObject resultParam = new JSONObject();
|
||||
resultParam.put("RTYPE", "S");
|
||||
resultParam.put("Code", "0");
|
||||
@@ -1748,27 +1778,51 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
public JSONObject getRollInfo(JSONObject param) {
|
||||
String ContainerName = param.getString("ContainerName");
|
||||
PdmBiSlittingproductionplan one = slittingproductionplanService.getOne(new LambdaQueryWrapper<PdmBiSlittingproductionplan>().eq(PdmBiSlittingproductionplan::getContainer_name, ContainerName));
|
||||
if (ObjectUtil.isEmpty(one)){
|
||||
throw new BadRequestException("未查询到子卷号为["+ContainerName+"]的分切计划!");
|
||||
if (ObjectUtil.isEmpty(one)) {
|
||||
throw new BadRequestException("未查询到子卷号为[" + ContainerName + "]的分切计划!");
|
||||
}
|
||||
JSONObject resultParam = new JSONObject();
|
||||
resultParam.put("ContainerName",ContainerName);
|
||||
resultParam.put("ResourceName","");
|
||||
resultParam.put("Weight",one.getWeight());
|
||||
resultParam.put("WeighDate",DateUtil.now());
|
||||
resultParam.put("Type",one.getPaper_tube_or_FRP());
|
||||
resultParam.put("CarrierWeight",one.getPaper_weight());
|
||||
resultParam.put("ContainerName", ContainerName);
|
||||
resultParam.put("ResourceName", "");
|
||||
resultParam.put("Weight", one.getWeight());
|
||||
resultParam.put("WeighDate", DateUtil.now());
|
||||
resultParam.put("Type", one.getPaper_tube_or_FRP());
|
||||
resultParam.put("CarrierWeight", one.getPaper_weight());
|
||||
return resultParam;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject sendLevelInfo(JSONObject param) {
|
||||
log.info("sendLevelInfo输入参数为:-------------------" + param.toString());
|
||||
|
||||
JSONObject resultParam = new JSONObject();
|
||||
resultParam.put("RTYPE", "S");
|
||||
resultParam.put("Code", "0");
|
||||
resultParam.put("RTMSG", "操作成功!");
|
||||
|
||||
String ContainerName = param.getString("ContainerName");
|
||||
String Level = param.getString("Level");
|
||||
|
||||
try {
|
||||
if (StrUtil.isEmpty(ContainerName)) {
|
||||
throw new BadRequestException("子卷号不能为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(Level)) {
|
||||
throw new BadRequestException("子卷等级不能为空!");
|
||||
}
|
||||
|
||||
PdmBiSlittingproductionplan plan = slittingproductionplanService.getOne(new LambdaQueryWrapper<PdmBiSlittingproductionplan>().eq(PdmBiSlittingproductionplan::getContainer_name, ContainerName)
|
||||
.eq(PdmBiSlittingproductionplan::getIs_delete, "0"));
|
||||
if (ObjectUtil.isEmpty(plan)) {
|
||||
throw new BadRequestException("未查询到对应的分切计划!");
|
||||
}
|
||||
plan.setLevel(Level);
|
||||
slittingproductionplanService.update(plan);
|
||||
resultParam.put("RTYPE", "S");
|
||||
resultParam.put("Code", "0");
|
||||
resultParam.put("RTMSG", "操作成功!");
|
||||
} catch (Exception e) {
|
||||
resultParam.put("RTYPE", "E");
|
||||
resultParam.put("Code", "1");
|
||||
resultParam.put("RTMSG", "操作失败!," + e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
return resultParam;
|
||||
}
|
||||
@@ -1787,6 +1841,86 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
|
||||
@Override
|
||||
public JSONObject sendSubInfo(JSONObject param) {
|
||||
|
||||
/* {"ContainerName":"A1222211290105A3",
|
||||
"SAPLotNumber":"A000000168",
|
||||
"SaleOrderName":"100000022-100",
|
||||
"CustomerName":"10000282",
|
||||
"CustomerDescription":"深圳市金泰莱新材料有限公司",
|
||||
"WidthPlan":null,"ThicknessPlan":"6",
|
||||
"Width":"710","Thickness":"1",
|
||||
"MassPerUnitArea":"1","NetWeight":204.906,
|
||||
"Length":"6500","DateOfProduction":"2024-05-24",
|
||||
"isUnPlanProduction":"0",
|
||||
"UnPlanProductProperty1":"面密度/g/m²:1|面密度极差/g/m²:0.4|铬含量/ppm:1|断裂伸长率/%:1.0|高温抗氧化性(150℃|10min):1|M面光泽度/GU:1|M面粗糙度Rz/μm:1|S面粗糙度Ra/μm:1|抗拉强度/Mpa:1.0|厚度/μm:1|润湿性/mN/m - ≥:1|翘曲/mm:1",
|
||||
"UnPlanProductProperty2":"",
|
||||
"UnPlanProductProperty3":"",
|
||||
"SOTensileStrengthLowerLimit":null,
|
||||
"ETTensileStrengthLowerLimit":"300",
|
||||
"TensileStrength":"1.0"}*/
|
||||
|
||||
//子卷号
|
||||
String ContainerName = param.getString("ContainerName");
|
||||
//SAP批次
|
||||
String SAPLotNumber = param.getString("SAPLotNumber");
|
||||
//销售订单及行号
|
||||
String SaleOrderName = param.getString("SaleOrderName");
|
||||
//客户编号
|
||||
String CustomerName = param.getString("CustomerName");
|
||||
//客户名称
|
||||
String CustomerDescription = param.getString("CustomerDescription");
|
||||
//计划幅宽
|
||||
String WidthPlan = param.getString("WidthPlan");
|
||||
//计划厚度
|
||||
String ThicknessPlan = param.getString("ThicknessPlan");
|
||||
//产品幅宽
|
||||
String Width = param.getString("Width");
|
||||
//产品厚度
|
||||
String Thickness = param.getString("Thickness");
|
||||
//单位面积质量
|
||||
String MassPerUnitArea = param.getString("MassPerUnitArea");
|
||||
//净重
|
||||
String NetWeight = param.getString("NetWeight");
|
||||
//长度
|
||||
String Length = param.getString("Length");
|
||||
//制造完成日期
|
||||
String DateOfProduction = param.getString("DateOfProduction");
|
||||
//计划外分切的子卷
|
||||
String isUnPlanProduction = param.getString("isUnPlanProduction");
|
||||
//子卷的物性值1
|
||||
String UnPlanProductProperty1 = param.getString("UnPlanProductProperty1");
|
||||
//子卷的物性值2
|
||||
String UnPlanProductProperty2 = param.getString("UnPlanProductProperty2");
|
||||
//子卷的物性值3
|
||||
String UnPlanProductProperty3 = param.getString("UnPlanProductProperty3");
|
||||
//客户需求抗拉下限
|
||||
String SOTensileStrengthLowerLimit = param.getString("SOTensileStrengthLowerLimit");
|
||||
//内控标准抗拉下限
|
||||
String ETTensileStrengthLowerLimit = param.getString("ETTensileStrengthLowerLimit");
|
||||
//生产实际抗拉值
|
||||
String TensileStrength = param.getString("TensileStrength");
|
||||
|
||||
PdmBiSubpackagerelation dto = new PdmBiSubpackagerelation();
|
||||
dto.setContainer_name(ContainerName);
|
||||
dto.setSap_pcsn(SAPLotNumber);
|
||||
dto.setSale_order_name(SaleOrderName);
|
||||
dto.setContainer_name(CustomerName);
|
||||
dto.setCustomer_description(CustomerDescription);
|
||||
dto.setWidth(Width);
|
||||
dto.setThickness(Thickness);
|
||||
dto.setMass_per_unit_area(MassPerUnitArea);
|
||||
dto.setNet_weight(NetWeight);
|
||||
dto.setLength(Length);
|
||||
dto.setDate_of_production(DateOfProduction);
|
||||
dto.setIs_un_plan_production(isUnPlanProduction);
|
||||
dto.setUn_plan_product_property1(UnPlanProductProperty1);
|
||||
dto.setUn_plan_product_property2(UnPlanProductProperty2);
|
||||
dto.setUn_plan_product_property3(UnPlanProductProperty3);
|
||||
dto.setDemand_limit(SOTensileStrengthLowerLimit);
|
||||
dto.setStandard_limit(ETTensileStrengthLowerLimit);
|
||||
dto.setActual_value(TensileStrength);
|
||||
|
||||
|
||||
log.info("sendSubInfo输入参数为:-------------------" + param.toString());
|
||||
|
||||
JSONObject resultParam = new JSONObject();
|
||||
|
||||
@@ -90,17 +90,17 @@ public class SubpackagerelationDto implements Serializable {
|
||||
/**
|
||||
* 单位面积质量
|
||||
*/
|
||||
private BigDecimal mass_per_unit_area;
|
||||
private String mass_per_unit_area;
|
||||
|
||||
/**
|
||||
* 净重
|
||||
*/
|
||||
private BigDecimal net_weight;
|
||||
private String net_weight;
|
||||
|
||||
/**
|
||||
* 长度
|
||||
*/
|
||||
private BigDecimal length;
|
||||
private String length;
|
||||
|
||||
/**
|
||||
* 制造完成日期
|
||||
|
||||
Reference in New Issue
Block a user