This commit is contained in:
2023-02-20 13:40:55 +08:00
parent 9b3909ad96
commit 2abf86ef7a
7 changed files with 185 additions and 109 deletions

View File

@@ -202,7 +202,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
} catch (Exception e) {
throw new BadRequestException("MES提示错误" + e.getMessage());
log.info("MES提示错误" + e.getMessage());
}
return result;
}
@@ -252,7 +252,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
} catch (Exception e) {
throw new BadRequestException("MES提示错误" + e.getMessage());
log.info("MES提示错误" + e.getMessage());
}
return result;
}
@@ -363,7 +363,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
} catch (Exception e) {
throw new BadRequestException("MES提示错误" + e.getMessage());
log.info("MES提示错误" + e.getMessage());
}
return result;
}

View File

@@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.K;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.common.utils.SecurityUtils;
@@ -653,110 +654,118 @@ 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 Status = param.getJSONObject(0).getString("Status");
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);
if (ObjectUtil.isEmpty(plan_jo)) {
throw new BadRequestException("未查询到分切计划:" + row.getString("ContainerGroup"));
}
plan_jo.put("status", "05");
WQLObject.getWQLObject("pdm_bi_slittingproductionplan").update(plan_jo);
}
}
if (Status.equals("2")) {
String ResourceName = param.getJSONObject(0).getString("ResourceName");
JSONObject cut_jo = WQLObject.getWQLObject("ST_IVT_CutPointIvt").query("ext_code = '" + ResourceName + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(cut_jo)) {
throw new BadRequestException("分切点位库存不存在:" + ResourceName);
}
String up_point_code = cut_jo.getString("up_point_code");
String down_point_code = cut_jo.getString("down_point_code");
JSONArray up_rows = new JSONArray();
JSONArray down_rows = new JSONArray();
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);
if (ObjectUtil.isEmpty(plan_jo)) {
throw new BadRequestException("未查询到分切计划:" + row.getString("ContainerGroup"));
}
if (row.getString("ContainerPosition").equals("1")) {
up_rows.add(plan_jo);
}
if (row.getString("ContainerPosition").equals("2")) {
down_rows.add(plan_jo);
}
}
if (ObjectUtil.isEmpty(up_rows) && ObjectUtil.isEmpty(down_rows)) {
throw new BadRequestException("分切机上轴、下轴不存在一个分切计划!");
}
//查询输送线上该分切机下一分切组可用的气涨轴
JSONObject group_jo = WQL.getWO("PDA_02").addParam("flag","14").addParam("resource_name",ResourceName).process().uniqueResult(0);
JSONArray del_rows = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("resource_name = '"+ResourceName+"' AND split_group = '"+group_jo.getString("split_group")+"' AND (parent_container_name = '"+group_jo.getString("source_container_name")+"' OR parent_container_name = '"+group_jo.getString("source_container_name")+"')").getResultJSONArray(0);
if (up_rows.size() > 0) {
JSONObject jo = new JSONObject();
jo.put("point_code", up_point_code);
jo.put("cut_rows", up_rows);
if (del_rows.size() > 0) {
jo.put("is_last", "0");
} else {
jo.put("is_last", "1");
}
outService.confirm(jo);
}
if (down_rows.size() > 0) {
JSONObject jo = new JSONObject();
jo.put("point_code", down_point_code);
jo.put("cut_rows", down_rows);
if (del_rows.size() > 1) {
jo.put("is_last", "0");
} else {
jo.put("is_last", "1");
}
outService.confirm(jo);
}
if ((ObjectUtil.isEmpty(up_rows) || ObjectUtil.isEmpty(down_rows)) && del_rows.size() == 2) {
String point_code = "";
//分切机上只存在一个气涨轴,下一分切组存在两个气涨轴,执行一个进站
if (ObjectUtil.isEmpty(up_rows)) {
point_code = up_point_code;
}
if (ObjectUtil.isEmpty(down_rows)) {
point_code = down_point_code;
}
//查询当前输送线上可用的气涨轴
JSONObject del_row = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("resource_name = '"+ResourceName+"' AND split_group = '"+group_jo.getString("split_group")+"' AND (parent_container_name = '"+group_jo.getString("source_container_name")+"' OR parent_container_name = '"+group_jo.getString("source_container_name")+"') AND status = '03'").uniqueResult(0);
JSONObject del_jo = WQLObject.getWQLObject("st_ivt_deliverypointivt").query("qzzno = '"+del_row.getString("qzzno")+"'").uniqueResult(0);
del_row.put("delivery_code",del_jo.getString("point_code"));
JSONObject whereJson = new JSONObject();
whereJson.put("point_code",point_code);
whereJson.put("cut_rows",del_row);
inService.confirm(whereJson);
if (ObjectUtil.isEmpty(param)) {
throw new BadRequestException("MES传入的参数不能为空");
}
String Status = param.getJSONObject(0).getString("Status");
String ResourceName = param.getJSONObject(0).getString("ResourceName");
JSONObject cut_jo = WQLObject.getWQLObject("ST_IVT_CutPointIvt").query("ext_code = '" + ResourceName + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(cut_jo)) {
throw new BadRequestException("分切计划对应的分切机不存在:" + ResourceName);
}
if ("0".equals(cut_jo.getString("is_used"))) {
result.put("RTYPE", "S");
result.put("RTMSG", "设备" + ResourceName + "在LMS系统中未启用!");
result.put("RTOAL", 1);
result.put("RTDAT", null);
return result;
}
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);
if (ObjectUtil.isEmpty(plan_jo)) {
throw new BadRequestException("未查询到分切计划:" + row.getString("ContainerGroup"));
}
plan_jo.put("status", "05");
WQLObject.getWQLObject("pdm_bi_slittingproductionplan").update(plan_jo);
}
}
if (Status.equals("2")) {
String up_point_code = cut_jo.getString("up_point_code");
String down_point_code = cut_jo.getString("down_point_code");
JSONArray up_rows = new JSONArray();
JSONArray down_rows = new JSONArray();
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);
if (ObjectUtil.isEmpty(plan_jo)) {
throw new BadRequestException("未查询到分切计划:" + row.getString("ContainerGroup"));
}
if (row.getString("ContainerPosition").equals("1")) {
up_rows.add(plan_jo);
}
if (row.getString("ContainerPosition").equals("2")) {
down_rows.add(plan_jo);
}
}
if (ObjectUtil.isEmpty(up_rows) && ObjectUtil.isEmpty(down_rows)) {
throw new BadRequestException("MES传入的分切计划不能为空");
}
//查询输送线上该分切机下一分切组可用的气涨轴
JSONObject group_jo = WQL.getWO("PDA_02").addParam("flag", "14").addParam("resource_name", ResourceName).process().uniqueResult(0);
if (ObjectUtil.isEmpty(group_jo)){
group_jo = new JSONObject();
}
JSONArray del_rows = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("resource_name = '" + ResourceName + "' AND split_group = '" + group_jo.getString("split_group") + "' AND (parent_container_name = '" + group_jo.getString("source_container_name") + "' OR parent_container_name = '" + group_jo.getString("source_container_name") + "')").getResultJSONArray(0);
if (up_rows.size() > 0) {
JSONObject jo = new JSONObject();
jo.put("point_code", up_point_code);
jo.put("cut_rows", up_rows);
if (del_rows.size() > 0) {
jo.put("is_last", "0");
} else {
jo.put("is_last", "1");
}
outService.confirm(jo);
}
if (down_rows.size() > 0) {
JSONObject jo = new JSONObject();
jo.put("point_code", down_point_code);
jo.put("cut_rows", down_rows);
if (del_rows.size() > 1) {
jo.put("is_last", "0");
} else {
jo.put("is_last", "1");
}
outService.confirm(jo);
}
if ((ObjectUtil.isEmpty(up_rows) || ObjectUtil.isEmpty(down_rows)) && del_rows.size() == 2) {
String point_code = "";
//分切机上只存在一个气涨轴,下一分切组存在两个气涨轴,执行一个进站
if (ObjectUtil.isEmpty(up_rows)) {
point_code = up_point_code;
}
if (ObjectUtil.isEmpty(down_rows)) {
point_code = down_point_code;
}
//查询当前输送线上可用的气涨轴
JSONObject del_row = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("resource_name = '" + ResourceName + "' AND split_group = '" + group_jo.getString("split_group") + "' AND (parent_container_name = '" + group_jo.getString("source_container_name") + "' OR parent_container_name = '" + group_jo.getString("source_container_name") + "') AND status = '03'").uniqueResult(0);
JSONObject del_jo = WQLObject.getWQLObject("st_ivt_deliverypointivt").query("qzzno = '" + del_row.getString("qzzno") + "'").uniqueResult(0);
del_row.put("delivery_code", del_jo.getString("point_code"));
JSONObject whereJson = new JSONObject();
whereJson.put("point_code", point_code);
whereJson.put("cut_rows", del_row);
inService.confirm(whereJson);
}
}
result.put("RTYPE", "S");
result.put("RTMSG", "操作成功!");
result.put("RTOAL", 1);
result.put("RTDAT", null);
System.out.println(result);
} catch (Exception e) {
result.put("RTYPE", "E");
result.put("RTMSG", "操作失败!" + e.getMessage());
result.put("RTOAL", 0);
result.put("RTDAT", null);
System.out.println(result);
}
log.info("childRollCutStartComp接口输出参数为-------------------" + result.toString());
return result;
@@ -819,9 +828,9 @@ public class MesToLmsServiceImpl implements MesToLmsService {
String width_standard = detail.getString("Attribute3");//要求幅宽
//查询库内是否存在相同的子卷号
JSONObject container_jo = WQLObject.getWQLObject("PDM_BI_SubPackageRelation").query("container_name = '"+ContainerName+"'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(container_jo)){
throw new BadRequestException("LMS系统中已存在子卷号"+ContainerName+",请检查!");
JSONObject container_jo = WQLObject.getWQLObject("PDM_BI_SubPackageRelation").query("container_name = '" + ContainerName + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(container_jo)) {
throw new BadRequestException("LMS系统中已存在子卷号" + ContainerName + ",请检查!");
}
JSONObject jo = new JSONObject();
@@ -1076,7 +1085,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
@Override
@Transactional(rollbackFor = Exception.class)
public JSONObject cutPlanTransferCancel(JSONObject param){
public JSONObject cutPlanTransferCancel(JSONObject param) {
log.info("cutPlanTransferCancel接口输入参数为-------------------" + param.toString());
JSONObject result = new JSONObject();
@@ -1084,19 +1093,19 @@ public class MesToLmsServiceImpl implements MesToLmsService {
String ContainerName = param.getString("ContainerName");
String CancelledDate = param.getString("CancelledDate");
if(StrUtil.isEmpty(ContainerName)){
if (StrUtil.isEmpty(ContainerName)) {
throw new BadRequestException("子卷号不能为空!");
}
JSONObject plan_jo = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("container_name = '"+ContainerName+"'").uniqueResult(0);
if (ObjectUtil.isEmpty(plan_jo)){
throw new BadRequestException("系统中不存在子卷号为:"+ContainerName+"的分切计划!");
JSONObject plan_jo = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("container_name = '" + ContainerName + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(plan_jo)) {
throw new BadRequestException("系统中不存在子卷号为:" + ContainerName + "的分切计划!");
}
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
plan_jo.put("is_delete","1");
plan_jo.put("is_delete", "1");
plan_jo.put("update_optid", currentUserId);
plan_jo.put("update_optname", nickName);
plan_jo.put("update_time", DateUtil.now());

View File

@@ -52,12 +52,19 @@ public class RawFoilController {
}
@PostMapping("/needEmptyAxis")
@Log("呼叫空轴")
@ApiOperation("呼叫空轴")
@Log("呼叫")
@ApiOperation("呼叫")
public ResponseEntity<Object> needEmptyAxis(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(rawFoilService.needEmptyAxis(whereJson), HttpStatus.OK);
}
@PostMapping("/needEmptyVehicle")
@Log("呼叫空轴")
@ApiOperation("呼叫空轴")
public ResponseEntity<Object> needEmptyVehicle(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(rawFoilService.needEmptyVehicle(whereJson), HttpStatus.OK);
}
@PostMapping("/confirmBlanking")
@Log("确认下卷")
@ApiOperation("确认下卷")

View File

@@ -27,12 +27,19 @@ public interface RawFoilService {
JSONObject queryRawFoilList(JSONObject whereJson, HttpContext ctx);
/**
* 呼叫空卷轴
* 呼叫
* @param whereJson /
* @return JSONObject
*/
JSONObject needEmptyAxis(JSONObject whereJson);
/**
* 呼叫空卷轴
* @param whereJson /
* @return JSONObject
*/
JSONObject needEmptyVehicle(JSONObject whereJson);
/**
* 下卷确认
* @param whereJson /

View File

@@ -107,7 +107,7 @@ public class OutServiceImpl implements OutService {
throw new BadRequestException("未查询到对应的分切机!");
}
if (!StrUtil.equals(rows.getJSONObject(0).getString("point_code"), cut_ivt.getString("point_code"))) {
if (!StrUtil.equals(rows.getJSONObject(0).getString("resource_name"), cut_ivt.getString("ext_code"))) {
throw new BadRequestException("请选择和分切计划相同的设备点位进行上空轴!");
}

View File

@@ -186,6 +186,51 @@ public class RawFoilServiceImpl implements RawFoilService {
return jo;
}
@Override
@Transactional(rollbackFor = Exception.class)
public JSONObject needEmptyVehicle(JSONObject whereJson) {
String point_code = whereJson.getString("point_code");
if (ObjectUtil.isEmpty(point_code)){
throw new BadRequestException("输入的点位不能为空!");
}
JSONObject raw_jo = WQLObject.getWQLObject("st_ivt_sbpointivt").query("point_code = '"+point_code+"'").uniqueResult(0);
if (ObjectUtil.isEmpty(raw_jo)){
throw new BadRequestException("未查到相关的生箔机点位!");
}
// 2.根据就近原则查对应空卷抽
JSONObject map = new JSONObject();
map.put("flag", "1");
map.put("product_area", raw_jo.getString("product_area"));
map.put("point_location", raw_jo.getString("point_location"));
JSONObject jsonIvt = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).process().uniqueResult(0);
// 3.如果没找到则继续找下一节点
String start_pint_code = "";
if (ObjectUtil.isEmpty(jsonIvt)) {
/*String point_location = jsonSb.getString("point_location");
if (StrUtil.equals(point_location, "0")) map.put("point_location", "1");
if (StrUtil.equals(point_location, "1")) map.put("point_location", "0");
JSONObject jsonIvt_tow = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).process().uniqueResult(0);*/
throw new BadRequestException("未查询到有空轴且母卷位置为空的点位!");
} else {
start_pint_code = jsonIvt.getString("empty_point_code");
}
// 起点和终点确定 生成任务
JSONObject param = new JSONObject();
param.put("point_code1", start_pint_code);
param.put("point_code2", point_code+"_K");
param.put("task_type", "010103");
param.put("product_area", jsonIvt.getString("product_area"));
CallEmpReelTask callEmpReelTask = new CallEmpReelTask();
callEmpReelTask.createTask(param);
JSONObject jo = new JSONObject();
jo.put("message", "操作成功!");
return jo;
}
@Override
public JSONObject confirmBlanking(JSONObject whereJson) {
WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单

View File

@@ -117,6 +117,7 @@
st_ivt_deliverypointivt ivt
WHERE
point_status = '02'
AND ivt.is_used = '1'
AND NOT EXISTS (
SELECT
*
@@ -147,6 +148,7 @@
st_ivt_deliverypointivt ivt
WHERE
point_status = '01'
AND ivt.is_used = '1'
AND NOT EXISTS (
SELECT
*
@@ -297,6 +299,7 @@
plan.is_child_ps_ok = '1'
AND
plan.status = '03'
AND del.is_used = '1'
AND
plan.is_delete = '0'
OPTION 输入.product_area <> ""
@@ -361,7 +364,7 @@
FROM
st_ivt_deliverypointivt del
WHERE
1=1
del.is_used = '1'
OPTION 输入.product_area <> ""
del.product_area = 输入.product_area
ENDOPTION
@@ -513,6 +516,7 @@
ivt.point_status = '03'
AND plan.`status` = '03'
AND plan.is_delete = '0'
AND ivt.is_used = '1'
AND plan.resource_name = 输入.resource_name
ORDER BY
plan.manufacture_sort,
@@ -556,6 +560,8 @@
plan.is_delete = '0'
AND
del.point_status = '03'
AND
del.is_used = '1'
OPTION 输入.ext_code <> ""
plan.resource_name = 输入.ext_code
ENDOPTION
@@ -578,6 +584,8 @@
point_location = 输入.point_location
AND
point_code <> 输入.point_code
AND
ivt.is_used = '1'
OPTION 输入.find_type = "1"
point_status <> '01'
ENDOPTION