feat: 自动化混碾<>压制

This commit is contained in:
2024-04-12 15:05:14 +08:00
parent be0749833b
commit eb36ab0921
4 changed files with 108 additions and 10 deletions

View File

@@ -0,0 +1,42 @@
package org.nl.wms.sch.manage;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.core.engine.object.WO;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
/**
* @Author: lyd
* @Description: 布料机自动叫料
* @Date: 2024/3/28
*/
@Slf4j
@Component("autoCallMaterial")
public class AutoCallMaterial {
public void run() {
// 获取所有布料机点位:状态不等于'4',区域'YZ',类型'2'
WQLObject pointTable = WQLObject.getWQLObject("sch_base_point");
WO manageQuery = WQL.getWO("MANAGE_QUERY");
JSONArray objects = manageQuery.addParam("flag", "4").process().getResultJSONArray(0);
if (objects.size() == 0) {
return;
}
String now = DateUtil.now();
// 标记并存储
for (int i = 0; i < objects.size(); i++) {
JSONObject object = objects.getJSONObject(i);
object.put("point_status", "4");
object.put("update_optname", "定时调度");
object.put("update_time", now);
pointTable.update(object);
}
log.info("自动叫料完毕,更新布料机数量:{},更新参数:{}", objects.size(), objects);
}
}

View File

@@ -85,3 +85,17 @@
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "4"
QUERY
SELECT
DISTINCT p.*
FROM
`sch_base_point` p
LEFT JOIN pdm_bd_workorder w ON w.device_code = p.device_code AND w.order_status < '4'
WHERE p.region_code = 'YZ'
AND p.point_type = '2'
AND p.point_status <> '4'
AND w.workorder_id IS NOT NULL
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -94,7 +94,8 @@ public class HLSendMaterialTask extends AbstractAcsTask {
JSONObject startPoint = point_table.query("point_code = '" + task.getString("point_code1") + "'").uniqueResult(0);
JSONObject nextPoint = null;
// 如果是高速混料机下料位就只能去液压机困料货位,如果不是高速混料机下料位优先去普通压机困料货位,普通压机困料货位没有位置再去公用困料货位。
// 如果是高速混料机下料位就只能去液压机困料货位,如果不是高速混料机下料位优先去普通压机困料货位,
// 普通压机困料货位没有位置再去公用困料货位。
String startPointType = startPoint.getString("point_type");
if ("1".equals(startPointType)) {
nextPoint = WQL.getWO("SEND_MATERIAL_TASK")
@@ -104,18 +105,34 @@ public class HLSendMaterialTask extends AbstractAcsTask {
.uniqueResult(0);
flag = false;
} else if ("2".equals(startPointType)) {
// 判断压机上是否有点位状态是4物料对应
nextPoint = WQL.getWO("SEND_MATERIAL_TASK")
.addParam("flag", "10")
.addParam("material_id", task.getString("material_id"))
// 获取混碾工单,用于判断是否存在指定压机
JSONObject object = WQL.getWO("SEND_MATERIAL_TASK")
.addParam("flag", "11")
.addParam("point_code", task.getString("point_code1"))
.process()
.uniqueResult(0);
if (ObjectUtil.isEmpty(nextPoint) || ObjectUtil.isEmpty(nextPoint.get("point_code"))) {
if (ObjectUtil.isNotEmpty(object.getString("associated_device"))) {
// 如果有关联压机(状态4锁定1),直接送到对应的布料机上
nextPoint = WQL.getWO("SEND_MATERIAL_TASK")
.addParam("flag", "12")
.addParam("point_code", object.getString("associated_device"))
.process()
.uniqueResult(0);
}
if (ObjectUtil.isEmpty(nextPoint)) {
// 判断压机上是否有点位状态是4物料对应
nextPoint = WQL.getWO("SEND_MATERIAL_TASK")
.addParam("flag", "10")
.addParam("material_id", task.getString("material_id"))
.process()
.uniqueResult(0);
}
if (ObjectUtil.isEmpty(nextPoint)) {
flag = false;
// 通过工单的关联压机送到对应位置,如果不满足就走以下流程
nextPoint = WQL.getWO("SEND_MATERIAL_TASK")
.addParam("flag", "8")
.addParam("device_code", startPoint.getString("device_code"))
.addParam("point_code", startPoint.getString("device_code"))
.process()
.uniqueResult(0);
if (ObjectUtil.isEmpty(nextPoint) || ObjectUtil.isEmpty(nextPoint.get("point_code"))) {

View File

@@ -170,7 +170,7 @@
`pdm_bd_workorder` wo
LEFT JOIN sch_base_point p ON p.device_code = wo.associated_device AND p.region_code = 'KLHJ'
AND p.point_type = '3' AND p.point_status = '1' AND p.lock_type = '1' AND p.is_used = '1'
WHERE wo.order_status = '3' AND wo.device_code = 输入.device_code
WHERE wo.order_status = '3' AND wo.device_code = 输入.point_code
ENDSELECT
ENDQUERY
ENDIF
@@ -191,10 +191,10 @@
IF 输入.flag = "10"
QUERY
SELECT
p.*
DISTINCT p.*
FROM
sch_base_point p
LEFT JOIN pdm_bd_workorder w ON p.device_code = w.device_code AND w.order_status = '3'
LEFT JOIN pdm_bd_workorder w ON p.device_code = w.device_code AND w.order_status < '4'
WHERE
p.is_used = '1'
AND p.lock_type = '1'
@@ -205,3 +205,28 @@
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "11"
QUERY
SELECT
wo.*
FROM
`pdm_bd_workorder` wo
LEFT JOIN sch_base_point p ON p.point_code = 输入.point_code
WHERE wo.order_status = '3' AND wo.device_code = p.device_code
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "12"
QUERY
SELECT
p.*
FROM
`sch_base_point` p
WHERE p.region_code = 'YZ'
AND p.point_type = '2'
AND p.point_status = '4'
AND p.lock_type = '1'
AND p.device_code = 输入.point_code
ENDSELECT
ENDQUERY
ENDIF