This commit is contained in:
2023-03-01 11:08:54 +08:00
parent 7e3f088c69
commit 006856220d
8 changed files with 115 additions and 41 deletions

View File

@@ -1,6 +1,7 @@
package org.nl.wms.ext.mes.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSONArray;
@@ -8,6 +9,7 @@ import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.common.exception.BadRequestException;
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.mes.service.LmsToMesService;
@@ -91,6 +93,25 @@ public class LmsToMesServiceImpl implements LmsToMesService {
return result;
}
//判断母卷对应的设备是否启用,如果启用则回传,未启用则不回传
String iContainerName = param.getString("iContainerName");
//查询该母卷号、设备号对应的生箔工单
JSONObject raw_jo = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").query("container_name ='" + iContainerName + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(raw_jo)) {
throw new BadRequestException("未查询到母卷号:" + iContainerName + "对应的生箔工单!");
}
String resource_name = raw_jo.getString("resource_name");
JSONObject sb_jo = WQLObject.getWQLObject("st_ivt_sbpointivt").query("ext_code ='" + resource_name + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(sb_jo)) {
throw new BadRequestException("未查询到母卷号:" + iContainerName + "对应的生箔机台编号!");
}
if (StrUtil.equals("0", sb_jo.getString("is_used"))) {
result.put("status", HttpStatus.OK.value());
result.put("message", "设备:" + sb_jo.getString("point_code") + "未启动!");
result.put("data", new JSONObject());
return result;
}
JSONArray list = new JSONArray();
// String url = acsUrl + api;
@@ -134,6 +155,25 @@ public class LmsToMesServiceImpl implements LmsToMesService {
return result;
}
//判断母卷对应的设备是否启用,如果启用则回传,未启用则不回传
String iContainerName = param.getString("iContainerName");
//查询该母卷号、设备号对应的生箔工单
JSONObject raw_jo = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").query("container_name ='" + iContainerName + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(raw_jo)) {
throw new BadRequestException("未查询到母卷号:" + iContainerName + "对应的生箔工单!");
}
String resource_name = raw_jo.getString("resource_name");
JSONObject sb_jo = WQLObject.getWQLObject("st_ivt_sbpointivt").query("ext_code ='" + resource_name + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(sb_jo)) {
throw new BadRequestException("未查询到母卷号:" + iContainerName + "对应的生箔机台编号!");
}
if (StrUtil.equals("0", sb_jo.getString("is_used"))) {
result.put("status", HttpStatus.OK.value());
result.put("message", "设备:" + sb_jo.getString("point_code") + "未启动!");
result.put("data", new JSONObject());
return result;
}
String UserName = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_USERNAME").getValue();
String Password = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_PASSWORD").getValue();

View File

@@ -147,31 +147,34 @@ public class MesToLmsServiceImpl implements MesToLmsService {
JSONObject result = new JSONObject();
try {
String is_mesTolms = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("is_mesTolms").getValue();
if (StrUtil.equals(is_mesTolms, "1")) {
String ContainerName = param.getString("ContainerName");
String ResourceName = param.getString("ResourceName");
//查询该母卷号、设备号对应的生箔工单
JSONObject raw_jo = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").query("container_name ='" + ContainerName + "' AND resource_name = '" + ResourceName + "'").uniqueResult(0);
JSONArray arr = new JSONArray();
String ContainerName = param.getString("ContainerName");
String ResourceName = param.getString("ResourceName");
//查询该母卷号、设备号对应的生箔工单
JSONObject raw_jo = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").query("container_name ='" + ContainerName + "' AND resource_name = '" + ResourceName + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(raw_jo)) {
throw new BadRequestException("未查询到对应的生箔工单!");
}
if (ObjectUtil.isEmpty(raw_jo)) {
throw new BadRequestException("未查询到对应的生箔工单!");
}
JSONArray data = new JSONArray();
//查询对应的设备是否启用
JSONObject jsonPoint = WQLObject.getWQLObject("ST_IVT_SbPointIvt").query("ext_code ='" + ResourceName + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonPoint)) {
jsonPoint = new JSONObject();
}
if (StrUtil.equals("1", jsonPoint.getString("is_used"))) {
JSONObject json = new JSONObject();
json.put("ContainerName", raw_jo.getString("container_name"));
json.put("ResourceName", raw_jo.getString("resource_name"));
json.put("Weight", String.format("%.2f", raw_jo.getDoubleValue("productin_qty")));
json.put("WeighDate", DateUtil.now());
data.add(json);
arr.add(json);
}
result.put("RTYPE", "S");
result.put("RTMSG", "操作成功!");
result.put("RTOAL", 1);
result.put("RTDAT", null);
result.put("RTDAT", arr);
System.out.println(result);
} catch (Exception e) {
result.put("RTYPE", "E");
result.put("RTMSG", "操作失败!" + e.getMessage());
@@ -199,16 +202,22 @@ public class MesToLmsServiceImpl implements MesToLmsService {
WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单表
try {
String is_mesTolms = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("is_mesTolms").getValue();
if (StrUtil.equals(is_mesTolms, "1")) {
String containerName = param.getString("ContainerName");
String resourceName = param.getString("ResourceName");
if (ObjectUtil.isEmpty(resourceName)) throw new BadRequestException("机台编码不能为空");
if (ObjectUtil.isEmpty(containerName)) throw new BadRequestException("母卷号不能为空");
String containerName = param.getString("ContainerName");
String resourceName = param.getString("ResourceName");
if (ObjectUtil.isEmpty(resourceName)) throw new BadRequestException("机台编码不能为空");
if (ObjectUtil.isEmpty(containerName)) throw new BadRequestException("母卷号不能为空");
JSONObject jsonSb = sbTab.query("ext_code = '" + resourceName + "' and is_used = '1'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonSb)) throw new BadRequestException("点位设备不存在");
JSONObject jsonSb = sbTab.query("ext_code = '" + resourceName + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonSb)) throw new BadRequestException("点位设备不存在");
if (StrUtil.equals("1", jsonSb.getString("is_used"))) {
//查询该母卷对应的工单状态是否为准备就绪,如果不是则提示报错
// 更新工单状态
JSONObject jsonRaw = rawTab.query("container_name = '" + containerName + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonRaw)) throw new BadRequestException("工单不存在");
if (!jsonRaw.getString("status").equals("03")) {
throw new BadRequestException("该生箔工单对应的状态不为准备就绪,不允许确认下卷!");
}
// 下发ACS更改任务状态
JSONArray paramArr = new JSONArray();
JSONObject json = new JSONObject();
@@ -220,10 +229,6 @@ public class MesToLmsServiceImpl implements MesToLmsService {
if (!StrUtil.equals(resultAcs.getString("status"), "200")) {
throw new BadRequestException(resultAcs.getString("message "));
}
// 更新工单状态
JSONObject jsonRaw = rawTab.query("container_name = '" + containerName + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonRaw)) throw new BadRequestException("工单不存在");
jsonRaw.put("status", "04");
rawTab.update(jsonRaw);
}
@@ -259,16 +264,28 @@ public class MesToLmsServiceImpl implements MesToLmsService {
JSONObject jsonParam = new JSONObject();
try {
String is_mesTolms = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("is_mesTolms").getValue();
if (StrUtil.equals(is_mesTolms, "1")) {
String containerName = param.getString("ContainerName"); // 母卷号
String nextSpec = param.getString("NextSpec"); // 下工序1-入烘箱2-入冷却
String bakingTemperature = param.getString("BakingTemperature"); // 温度
String bakingTimer = param.getString("BakingTimer"); // 烘烤时间
String containerName = param.getString("ContainerName"); // 母卷号
String nextSpec = param.getString("NextSpec"); // 下工序1-入烘箱2-入冷却
String bakingTemperature = param.getString("BakingTemperature"); // 温度
String bakingTimer = param.getString("BakingTimer"); // 烘烤时间
if (ObjectUtil.isEmpty(containerName)) throw new BadRequestException("母卷号不能为空");
if (ObjectUtil.isEmpty(nextSpec)) throw new BadRequestException("下工序不能为空");
if (ObjectUtil.isEmpty(containerName)) throw new BadRequestException("母卷号不能为空");
if (ObjectUtil.isEmpty(nextSpec)) throw new BadRequestException("下工序不能为空");
//判断母卷号对应的设备是否启用启用则调度生成任务未启用返回MES成功
String ContainerName = param.getString("ContainerName");
//查询该母卷号、设备号对应的生箔工单
JSONObject raw_jo = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").query("container_name ='" + ContainerName + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(raw_jo)) {
throw new BadRequestException("未查询到对应的生箔工单!");
}
String resource_name = raw_jo.getString("resource_name");
JSONObject sb_jo = WQLObject.getWQLObject("st_ivt_sbpointivt").query("ext_code ='" + resource_name + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(sb_jo)) {
throw new BadRequestException("未查询到母卷号:" + ContainerName + "对应的生箔机台编号!");
}
if (StrUtil.equals("1", sb_jo.getString("is_used"))) {
if (StrUtil.equals(nextSpec, "1")) {
/*
* 入烘箱
@@ -675,7 +692,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
if (Status.equals("1")) {
for (int i = 0; i < param.size(); i++) {
JSONObject row = param.getJSONObject(i);
JSONObject plan_jo = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("container_name = '" + row.getString("ContainerGroup") + "'").uniqueResult(0);
JSONObject plan_jo = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("container_name = '" + row.getString("ContainerGroup") + "' AND is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isEmpty(plan_jo)) {
throw new BadRequestException("未查询到分切计划:" + row.getString("ContainerGroup"));
}
@@ -697,7 +714,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
} else {
for (int i = 0; i < param.size(); i++) {
JSONObject row = param.getJSONObject(i);
JSONObject plan_jo = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("container_name = '" + row.getString("ContainerGroup") + "'").uniqueResult(0);
JSONObject plan_jo = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("container_name = '" + row.getString("ContainerGroup") + "' AND is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isEmpty(plan_jo)) {
throw new BadRequestException("未查询到分切计划:" + row.getString("ContainerGroup"));
}
@@ -715,7 +732,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
//更新分切计划表状态
for (int i = 0; i < param.size(); i++) {
JSONObject row = param.getJSONObject(i);
JSONObject plan_jo = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("container_name = '" + row.getString("ContainerGroup") + "'").uniqueResult(0);
JSONObject plan_jo = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("container_name = '" + row.getString("ContainerGroup") + "' AND is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isEmpty(plan_jo)) {
throw new BadRequestException("未查询到分切计划:" + row.getString("ContainerGroup"));
}
@@ -747,7 +764,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
for (int i = 0; i < param.size(); i++) {
JSONObject row = param.getJSONObject(i);
//查询对应的分切计划
JSONObject plan_jo = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("container_name = '" + row.getString("ContainerGroup") + "'").uniqueResult(0);
JSONObject plan_jo = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("container_name = '" + row.getString("ContainerGroup") + "' AND is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isEmpty(plan_jo)) {
throw new BadRequestException("未查询到分切计划:" + row.getString("ContainerGroup"));
}
@@ -833,6 +850,8 @@ public class MesToLmsServiceImpl implements MesToLmsService {
} else {
jo.put("is_last", "1");
}
} else {
jo.put("is_last", "0");
}
} else {
jo.put("is_last", "1");

View File

@@ -55,6 +55,10 @@ public class OutServiceImpl implements OutService {
String point_code = whereJson.getString("point_code");
String is_last = whereJson.getString("is_last");
if (StrUtil.isEmpty(is_last)){
throw new BadRequestException("是否末次下卷不能为空!");
}
JSONArray rows = whereJson.getJSONArray("cut_rows");
if (rows.size() > 2) {

View File

@@ -21,6 +21,7 @@ import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl;
import org.nl.wms.pda.mps.service.RawFoilService;
import org.nl.wms.sch.service.PointService;
import org.nl.wms.sch.tasks.CallEmpReelTask;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -142,7 +143,11 @@ public class RawFoilServiceImpl implements RawFoilService {
if (!StrUtil.equals(jsonRaw.getString("status"), "01")) throw new BadRequestException("工单状态不为开始");
JSONObject jsonSb = sbTab.query("ext_code = '" + jsonRaw.getString("resource_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonSb)) throw new BadRequestException("生箔点位不存在");
if (ObjectUtil.isEmpty(jsonSb)) throw new BadRequestException("点位"+jsonRaw.getString("resource_name")+"生箔设备不存在");
if (StrUtil.equals("0", jsonSb.getString("is_used"))) {
throw new BadRequestException("当前生箔机:"+jsonSb.getString("ext_code")+"未启用!");
}
String start_pint_code = "";
String point_code4 = "";
@@ -198,6 +203,10 @@ public class RawFoilServiceImpl implements RawFoilService {
throw new BadRequestException("未查到相关的生箔机点位!");
}
if (StrUtil.equals("0", raw_jo.getString("is_used"))) {
throw new BadRequestException("当前生箔机:"+raw_jo.getString("ext_code")+"未启用!");
}
// 2.根据就近原则查对应空卷抽
JSONObject map = new JSONObject();
map.put("flag", "1");

View File

@@ -49,7 +49,7 @@
der.STATUS
WHEN '01' THEN '开始'
WHEN '02' THEN '空轴搬出'
WHEN '03' THEN '确认下卷'
WHEN '03' THEN '准备就绪'
WHEN '04' THEN '下卷完成'
WHEN '09' THEN '结束'
END

View File

@@ -382,7 +382,7 @@ public class CutTrussTask extends AbstractAcsTask {
//更新入站气涨轴的分切计划状态
JSONArray plan_jo = WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").query("qzzno = '" + json.getString("vehicle_code") + "' AND is_child_tz_ok = '1' AND is_child_ps_ok = '1' AND is_delete = '0' AND status = '03'").getResultJSONArray(0);
if (ObjectUtil.isEmpty(plan_jo)) {
throw new BadRequestException("未查询到气涨轴:" + json.getString("vehicle_code") + "对应的分切计划!");
throw new BadRequestException("未查询到状态为入站完成气涨轴:" + json.getString("vehicle_code") + "对应的分切计划!");
}
for (int i = 0; i < plan_jo.size(); i++) {
JSONObject plan_row = plan_jo.getJSONObject(i);
@@ -394,7 +394,7 @@ public class CutTrussTask extends AbstractAcsTask {
//更新出站气涨轴的分切计划状态
JSONArray plan_jo2 = WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").query("qzzno = '" + json.getString("vehicle_code2") + "' AND is_child_tz_ok = '1' AND is_child_ps_ok = '1' AND is_delete = '0' AND status = '05'").getResultJSONArray(0);
if (ObjectUtil.isEmpty(plan_jo2)) {
throw new BadRequestException("未查询到气涨轴:" + json.getString("vehicle_code2") + "对应的分切计划!");
throw new BadRequestException("未查询到状态为入站完成气涨轴:" + json.getString("vehicle_code2") + "对应的分切计划!");
}
for (int i = 0; i < plan_jo2.size(); i++) {
JSONObject plan_row = plan_jo2.getJSONObject(i);

View File

@@ -208,6 +208,8 @@ public class InCoolIvtTask extends AbstractAcsTask {
json.put("acs_task_type","3" );
tab.insert(json);
this.immediateNotifyAcs(null);
return json.getString("task_id");
}