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

@@ -53,10 +53,18 @@ public class SlitterPdaController {
public ResponseEntity<Object> getShaftPoint() {
return new ResponseEntity<>(slitterDevices.getShaftPoint(), HttpStatus.OK);
}
@PostMapping("/doInitShaftPoint")
@Log("初始化套拔轴点位")
@SaIgnore
public ResponseEntity<Object> doInitShaftPoint(@RequestBody JSONObject param) {
return new ResponseEntity<>(slitterDevices.doInitShaftPoint(param), HttpStatus.OK);
}
@PostMapping("/cutIn")
@Log("分切母卷上料")
@SaIgnore
public ResponseEntity<Object> cutIn(@RequestBody JSONObject param) {
return new ResponseEntity<>(slitterDevices.cutIn(param), HttpStatus.OK);
}
}

View File

@@ -12,6 +12,8 @@ import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.wms.ext.mes.service.LmsToMesService;
import org.nl.wms.sch.AcsTaskDto;
import org.nl.wms.sch.manage.AbstractAcsTask;
import org.nl.wms.sch.manage.TaskStatusEnum;
@@ -128,6 +130,17 @@ public class ProcessTask extends AbstractAcsTask {
map3.put("empty_vehicle_code", empty_vehicle_code);
map3.put("empty_point_status", "02");
ivtTab.update(map3, "empty_point_code = '" + point_code4 + "'");
//调用MES转移接口
String from_area = cool_jo1.getString("point_code").substring(0,2);
String to_area = st_jo1.getString("ext_code").substring(0, 2);
JSONObject mom_jo = new JSONObject();
mom_jo.put("from_area", from_area);
mom_jo.put("to_area", to_area);
mom_jo.put("container_name", container_name);
LmsToMesService bean = SpringContextHolder.getBean(LmsToMesService.class);
bean.momAutoTransterMoveIn(mom_jo);
}
if ("011002".equals(task_type)) {
//维护冷却区满轴点位的库存
@@ -142,6 +155,18 @@ public class ProcessTask extends AbstractAcsTask {
HashMap map2 = new HashMap();
map2.put("up_scroll", full_vehicle_code);
stTab.update(map2, "up_point_code = '" + point_code2.split("_K")[0] + "'").uniqueResult(0);
JSONObject st_jo1 = stTab.query("up_point_code = '" + point_code2.split("_M")[0] + "'").uniqueResult(0);
//调用MES转移接口
String from_area = cool_jo1.getString("point_code").substring(0,2);
String to_area = st_jo1.getString("ext_code").substring(0, 2);
JSONObject mom_jo = new JSONObject();
mom_jo.put("from_area", from_area);
mom_jo.put("to_area", to_area);
mom_jo.put("container_name", container_name);
LmsToMesService bean = SpringContextHolder.getBean(LmsToMesService.class);
bean.momAutoTransterMoveIn(mom_jo);
}
if ("010703".equals(task_type)) {
//维护表处区点位
@@ -169,6 +194,18 @@ public class ProcessTask extends AbstractAcsTask {
map3.put("container_name", container_name);
map3.put("full_point_status", "02");
ivtTab.update(map3, "full_point_code = '" + point_code2 + "'");
JSONObject cool_jo1 = ivtTab.query("full_point_code = '" + point_code2 + "'").uniqueResult(0);
//调用MES转移接口
String from_area = st_jo1.getString("ext_code").substring(0, 2);
String to_area = cool_jo1.getString("point_code").substring(0,2);
JSONObject mom_jo = new JSONObject();
mom_jo.put("from_area", from_area);
mom_jo.put("to_area", to_area);
mom_jo.put("container_name", container_name);
LmsToMesService bean = SpringContextHolder.getBean(LmsToMesService.class);
bean.momAutoTransterMoveIn(mom_jo);
}
}
}

View File

@@ -118,4 +118,6 @@ public interface SlitterService {
* @return /
*/
JSONObject doInitShaftPoint(JSONObject param);
JSONObject cutIn(JSONObject param);
}

View File

@@ -39,6 +39,7 @@ import org.nl.b_lms.sch.tasks.slitter.util.SlitterTaskUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.common.utils.TaskUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
@@ -610,7 +611,7 @@ public class SlitterServiceImpl implements SlitterService {
}
res.put("RTOAL", 0);
res.put("RTMSG", "操作失败!");
res.put("RTYPE", "F");
res.put("RTYPE", "E");
return res;
}
@@ -800,4 +801,23 @@ public class SlitterServiceImpl implements SlitterService {
res.put("message", "请求成功!");
return res;
}
@Override
public JSONObject cutIn(JSONObject param) {
String container_name = param.getString("container_name");
//如果have_empty为0则不做四个点的任务为1则做四个点的任务
String have_empty = param.getString("have_empty");
String device_code = param.getString("device_code");
//查询当前母卷所在的点位在哪
JSONObject cache_jo = WQLObject.getWQLObject("st_ivt_stpointcacheivt").query("container_name = '"+container_name+"'").uniqueResult(0);
if (ObjectUtil.isEmpty(cache_jo)) {
throw new BadRequestException("未查询到母卷所在的点位!");
}
return null;
}
}

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");