fix:MES相关优化

This commit is contained in:
zhouz
2024-06-26 21:49:19 +08:00
parent 0814124414
commit 2fad0075c6
8 changed files with 176 additions and 12 deletions

View File

@@ -1874,6 +1874,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
if (ObjectUtil.isEmpty(whereJson.getString("material_barcode"))) {
throw new BadRequestException("子卷号不能为空!");
}
if (whereJson.getIntValue("weight") <= 0) {
throw new BadRequestException("上报的重量不能为0!");
}
whereJson.put("bill_type", IOSEnum.IN_TYPE.code("生产入库"));
inBussManageService.inTask(whereJson);
} else if (type.equals(IOSEnum.ACSTOLMS_TYPE.code("空盘入库"))) {

View File

@@ -1,5 +1,6 @@
package org.nl.wms.ext.mes.rest;
import cn.dev33.satoken.annotation.SaIgnore;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -120,18 +121,21 @@ public class LmsToMesController {
@PostMapping("/momAutoTransterMoveIn")
@Log("表处、分切上料反馈接口")
@SaIgnore
public ResponseEntity<Object> momAutoTransterMoveIn(@RequestBody JSONObject jo) {
return new ResponseEntity<>(lmsToMesService.momAutoTransterMoveIn(jo), HttpStatus.OK);
}
@PostMapping("/momGetPackingInfo")
@Log("LMS通过木箱号调用木箱信息")
@SaIgnore
public ResponseEntity<Object> momGetPackingInfo(@RequestBody JSONObject jo) {
return new ResponseEntity<>(lmsToMesService.momGetPackingInfo(jo), HttpStatus.OK);
}
@PostMapping("/momBoxPackageSubmit")
@Log("LMS装箱完成传MES包装关系")
@SaIgnore
public ResponseEntity<Object> momBoxPackageSubmit(@RequestBody JSONObject jo) {
return new ResponseEntity<>(lmsToMesService.momBoxPackageSubmit(jo), HttpStatus.OK);
}

View File

@@ -724,7 +724,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
log.info("momAutoTransterMoveIn接口输入参数为-------------------" + param.toString());
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_URL").getValue();
String api = "CamstarApi/momAutoTransterMoveIn";
String api = "/momAutoTransterMoveIn";
url = url + api;
String UserName = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_USERNAME").getValue();
@@ -768,7 +768,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
log.info("momGetPackingInfo接口输入参数为-------------------" + param.toString());
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_URL").getValue();
String api = "CamstarApi/momGetPackingInfo";
String api = "momGetPackingInfo";
url = url + api;
String UserName = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_USERNAME").getValue();
@@ -827,7 +827,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
JSONObject result = new JSONObject();
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_URL").getValue();
String api = "CamstarApi/momBoxPackageSubmit";
String api = "momBoxPackageSubmit";
url = url + api;
String UserName = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_USERNAME").getValue();
@@ -837,7 +837,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
param.put("PackageBoxSN", box_no);
param.put("QuanlityInBox", num);
param.put("BoxWeight", box_weight);
param.put("ContainerList", box_weight);
param.put("ContainerList", rows);
try {
String resultMsg = HttpRequest.post(url)

View File

@@ -5,6 +5,7 @@ import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpStatus;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -15,6 +16,10 @@ 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.bst.ivt.scale.bound.service.IBstIvtScaleboundService;
import org.nl.b_lms.bst.ivt.scale.bound.service.dao.BstIvtScalebound;
import org.nl.b_lms.bst.ivt.scale.history.service.IBstIvtScalehistoryService;
import org.nl.b_lms.bst.ivt.scale.history.service.dao.BstIvtScalehistory;
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;
@@ -23,6 +28,7 @@ import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
import org.nl.b_lms.sch.tasks.ProcessTask;
import org.nl.b_lms.sch.tasks.first_floor_area.DjqTask;
import org.nl.b_lms.sch.tasks.first_floor_area.GzqTask;
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterConstant;
import org.nl.common.enums.PackageInfoIvtEnum;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
@@ -31,6 +37,7 @@ import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.system.service.param.impl.SysParamServiceImpl;
import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.nl.wms.ext.mes.service.MesToLmsService;
import org.nl.wms.pda.mps.service.InService;
import org.nl.wms.pda.mps.service.OutService;
@@ -64,11 +71,20 @@ public class MesToLmsServiceImpl implements MesToLmsService {
@Autowired
private IPdmBiSlittingproductionplanService slittingproductionplanService;
@Autowired
private WmsToAcsService wmsToAcsService;
@Resource
private DjqTask djqTask;
@Resource
private GzqTask gzqTask;
@Autowired
private IBstIvtScalehistoryService scaleHistoryService;
@Autowired
private IBstIvtScaleboundService scaleBoundService;
@Resource
private IbstIvtPackageinfoivtService packageinfoivtService;
@@ -102,6 +118,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
String EqpVelocity = param.getString("EqpVelocity");
String UpCoilerDate = param.getString("UpCoilerDate");
String IsReloadSend = param.getString("IsReloadSend");
String Attribute1 = param.getString("Attribute1");
WQLObject pointTab = WQLObject.getWQLObject("ST_IVT_SbPointIvt");
WQLObject orderTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder");
@@ -153,6 +170,11 @@ public class MesToLmsServiceImpl implements MesToLmsService {
json.put("is_reload_send", IsReloadSend);
json.put("product_area", jsonPoint.getString("product_area"));
json.put("point_code", jsonPoint.getString("point_code"));
if (Attribute1.equals("SF1")) {
json.put("order_type", "1");
} else if (Attribute1.equals("SF2")) {
json.put("order_type", "2");
}
json.put("realstart_time", DateUtil.now());
json.put("status", "01");
json.put("is_delete", "0");
@@ -1776,11 +1798,13 @@ public class MesToLmsServiceImpl implements MesToLmsService {
@Override
public JSONObject getRollInfo(JSONObject param) {
JSONObject result = new JSONObject();
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 + "]的分切计划!");
}
JSONArray arr = new JSONArray();
JSONObject resultParam = new JSONObject();
resultParam.put("ContainerName", ContainerName);
resultParam.put("ResourceName", "");
@@ -1788,7 +1812,13 @@ public class MesToLmsServiceImpl implements MesToLmsService {
resultParam.put("WeighDate", DateUtil.now());
resultParam.put("Type", one.getPaper_tube_or_FRP());
resultParam.put("CarrierWeight", one.getPaper_weight());
return resultParam;
arr.add(resultParam);
result.put("RTYPE", "S");
result.put("RTMSG", "操作成功!");
result.put("RTOAL", 1);
result.put("RTDAT", arr);
return result;
}
@Override
@@ -1947,18 +1977,78 @@ public class MesToLmsServiceImpl implements MesToLmsService {
public JSONObject getWasteFoilWeight(JSONObject param) {
log.info("getWasteFoilWeight输入参数为-------------------" + param.toString());
JSONObject resultParam = new JSONObject();
resultParam.put("RTYPE", "S");
resultParam.put("Code", "0");
resultParam.put("RTMSG", "操作成功!");
return resultParam;
{
log.info("分切子卷获取LMSAGV废箔称重重量的输入参数为{}", param);
JSONObject res = new JSONObject();
JSONObject resData = new JSONObject();
String resourceName = param.getString("ResourceName");
// 获取称的设备号
BstIvtScalebound scaleEquipment = scaleBoundService.getOne(new LambdaQueryWrapper<BstIvtScalebound>()
.eq(BstIvtScalebound::getDevice_code, resourceName));
// 下发给acs称重
JSONObject acsWeighing = new JSONObject();
acsWeighing.put("device_code", scaleEquipment.getScale_code());
acsWeighing.put("type", "1");
acsWeighing.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
JSONObject action = wmsToAcsService.getWeight(acsWeighing);
if (HttpStatus.HTTP_OK == action.getInteger("status")) {
JSONObject data = action.getJSONObject("data");
String currentWeight = data.getString("currentWeight");
String lastWeight = data.getString("lastWeight");
String weightGap = data.getString("weightGap");
String now = DateUtil.now();
// 记录数据库
BstIvtScalehistory history = new BstIvtScalehistory();
history.setHistory_id(IdUtil.getSnowflake(1, 1).nextIdStr());
history.setScale_code(scaleEquipment.getScale_code());
history.setDevice_code(scaleEquipment.getDevice_code());
history.setCurrent_weight(currentWeight);
history.setLast_weight(lastWeight);
history.setWeight_gap(weightGap);
history.setRecord_time(now);
scaleHistoryService.save(history);
log.info("废箔称重记录:{}", history);
res.put("RTOAL", 1);
res.put("RTMSG", "操作成功!");
res.put("RTYPE", "S");
res.put("RTDAT", resData);
resData.put("ResourceName", resourceName);
resData.put("Weight", weightGap);
resData.put("WeighDate", now);
log.info("废箔称重反馈MES, 反馈信息:{}", res);
return res;
}
res.put("RTOAL", 0);
res.put("RTMSG", "称重失败!");
res.put("RTYPE", "F");
log.error("废箔称重反馈MES, 反馈信息:{}", res);
return res;
}
}
@Override
public JSONObject WasteFoilSuccess(JSONObject param) {
log.info("WasteFoilSuccess输入参数为-------------------" + param.toString());
log.info("分切子卷获取LMSAGV废箔称重重量MES提交废箔成功的输入参数为{}", param);
JSONObject res = new JSONObject();
String resourceName = param.getString("ResourceName");
// 获取称的设备号
BstIvtScalebound scaleEquipment = scaleBoundService.getOne(new LambdaQueryWrapper<BstIvtScalebound>()
.eq(BstIvtScalebound::getDevice_code, resourceName));
// 下发给acs称重
JSONObject acsWeighing = new JSONObject();
acsWeighing.put("device_code", scaleEquipment.getScale_code());
acsWeighing.put("type", "2");
acsWeighing.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
JSONObject action = wmsToAcsService.getWeight(acsWeighing);
if (HttpStatus.HTTP_OK == action.getInteger("status")) {
// 记录数据库
res.put("RTOAL", 1);
res.put("RTMSG", "操作成功!");
res.put("RTYPE", "S");
return res;
}
JSONObject resultParam = new JSONObject();
resultParam.put("RTYPE", "S");
resultParam.put("Code", "0");