窑前缓存货架到输送线的线程修改
This commit is contained in:
@@ -106,47 +106,13 @@ public class StructFindUtil {
|
||||
|
||||
//获取空闲的输送线的上料位
|
||||
public static JSONObject getConveyor(JSONObject jsonObject) {
|
||||
JSONObject result = new JSONObject();
|
||||
//判断现在是否能去输送线
|
||||
WQLObject param_Table = WQLObject.getWQLObject("sys_param");
|
||||
String is_canToConveyor = param_Table.query("code='is_canToConveyor'").uniqueResult(0).getString("value");
|
||||
if (StrUtil.equals(is_canToConveyor, "0")) {
|
||||
return result;
|
||||
}
|
||||
String material_id = jsonObject.getString("material_id");
|
||||
//判断入输送线的规则有没有开启,假如开启需要带上物料,没有开启不需要带上物料
|
||||
String value = param_Table.query("code='is_inrule'").uniqueResult(0).getString("value");
|
||||
if (StrUtil.equals(value, "0")) {
|
||||
material_id = "";
|
||||
}
|
||||
WQLObject pointTable = WQLObject.getWQLObject("sch_base_point");
|
||||
WQLObject materialTable = WQLObject.getWQLObject("MD_ME_Material");
|
||||
WQLObject taskTable = WQLObject.getWQLObject("sch_base_task");
|
||||
JSONObject materialObj = materialTable.query("material_id ='" + material_id + "'").uniqueResult(0);
|
||||
//获取可以用的输送线数组
|
||||
result = WQL.getWO("QSTRUCT_RULE").addParam("flag", "6")
|
||||
JSONObject result = WQL.getWO("QSTRUCT_RULE").addParam("flag", "6")
|
||||
.addParam("material_type", materialObj.getString("material_type")).process().uniqueResult(0);
|
||||
/*for (int i = 0; i < deviceArr.size(); i++) {
|
||||
JSONObject deviceObj = deviceArr.getJSONObject(i);
|
||||
*//*int count = deviceObj.getIntValue("count");
|
||||
//假如到该输送线上料位置的任务>= 空闲的位置个数,则需要选择下一个输送线
|
||||
int task_num = WQL.getWO("QSTRUCT_RULE").addParam("flag", "7").process().uniqueResult(0).getIntValue("count");
|
||||
if (count > task_num) {
|
||||
result = pointTable.query("device_id = '" + deviceObj.getString("device_id") + "' and device_point_type='01'").uniqueResult(0);
|
||||
break;
|
||||
}*//*
|
||||
//判断输送线上料位置有无空位置
|
||||
result = pointTable.query("device_id = '" + deviceObj.getString("device_id") + "' and device_point_type='01' and point_status='00'")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
String point_code = result.getString("point_code");
|
||||
JSONObject joo = taskTable.query("next_point_code = '" + point_code + "' and is_delete='0' and task_status in('04','05','06')").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(joo)) {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -216,7 +216,6 @@ IF 输入.flag = "6"
|
||||
AND device_point_type = '01'
|
||||
AND point.MODE <> '0'
|
||||
AND ( point.vehicle_code = '' OR point.vehicle_code IS NULL )
|
||||
AND point.material_type = '1'
|
||||
AND task.task_code IS NULL
|
||||
OPTION 输入.material_type <> ""
|
||||
point.material_type = 输入.material_type
|
||||
@@ -371,4 +370,55 @@ IF 输入.flag = "12"
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "13"
|
||||
QUERY
|
||||
SELECT
|
||||
point.*,
|
||||
task.task_code
|
||||
FROM
|
||||
sch_base_point point
|
||||
LEFT JOIN sch_base_task task ON point.point_code = task.next_point_code
|
||||
AND task.task_status IN ( '04', '05', '06' )
|
||||
WHERE
|
||||
point.area_type = '07'
|
||||
AND device_point_type = '01'
|
||||
AND point.MODE <> '0'
|
||||
AND ( point.vehicle_code = '' OR point.vehicle_code IS NULL )
|
||||
AND task.task_code IS NULL
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "14"
|
||||
QUERY
|
||||
SELECT DISTINCT
|
||||
point.point_code AS struct_code,
|
||||
point.point_id AS struct_id,
|
||||
point.point_name AS struct_name,
|
||||
point.vehicle_code,
|
||||
ivt.canuse_qty,
|
||||
ruledis.out_seq_no,
|
||||
material.material_id,
|
||||
material.material_code,
|
||||
material.material_name,
|
||||
material.material_spec
|
||||
FROM
|
||||
st_ivt_structivt ivt
|
||||
LEFT JOIN sch_base_point point ON point.point_id = ivt.struct_id
|
||||
LEFT JOIN st_rule_IOdisStruct ruledis ON ruledis.struct_uuid = ivt.struct_id
|
||||
LEFT JOIN md_me_material material ON material.material_id = ivt.material_id
|
||||
WHERE
|
||||
ivt.canuse_qty > 0
|
||||
AND point.point_status = '02'
|
||||
AND point.lock_type = '00'
|
||||
AND point.is_used = '1'
|
||||
and TIME_TO_SEC(timediff(now(),ivt.instorage_time)) >=ivt.stewing_time*60
|
||||
OPTION 输入.area_type <> ""
|
||||
point.area_type = 输入.area_type
|
||||
ENDOPTION
|
||||
order by ruledis.out_seq_no
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
@@ -2,12 +2,14 @@
|
||||
package org.nl.wms.sch.task;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.wms.WorkProcedureEnum;
|
||||
import org.nl.wms.common.PointUpdateUtil;
|
||||
import org.nl.wms.common.StructFindUtil;
|
||||
import org.nl.wms.sch.manage.buss.CallMaterialTask;
|
||||
import org.nl.wql.WQL;
|
||||
@@ -28,40 +30,47 @@ public class AutoOutStructTask {
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
private void doExecute() {
|
||||
void doExecute() {
|
||||
WQLObject param_Table = WQLObject.getWQLObject("sys_param");
|
||||
int num = param_Table.query("code='stewing_num' ").uniqueResult(0).getInteger("value");
|
||||
int canuse_unm = WQL.getWO("QSTRUCT_RULE").addParam("flag", "10").process().uniqueResult(0).getIntValue("num");
|
||||
//达到可以出库的数量
|
||||
if (canuse_unm >= num) {
|
||||
//1.首先更新所有输送线的点位状态
|
||||
JSONArray pointarr = WQL.getWO("ACSTOMES_001").addParam("area_type", "07").addParam("flag", "4").process().getResultJSONArray(0);
|
||||
// PointUpdateUtil.updatePoint(pointarr);
|
||||
//2.将入库的缓存线规则停用,
|
||||
JSONObject in_rule = param_Table.query("code ='is_inrule'").uniqueResult(0);
|
||||
in_rule.put("value", "0");
|
||||
param_Table.update(in_rule);
|
||||
//2找一个合适的入库缓存
|
||||
JSONObject conveyorObj = StructFindUtil.getConveyor(new JSONObject());
|
||||
if (ObjectUtil.isEmpty(conveyorObj)) {
|
||||
return;
|
||||
//1.首先更新所有输送线的点位状态
|
||||
JSONArray pointarr = WQL.getWO("ACSTOMES_001").addParam("area_type", "07").addParam("flag", "4").process().getResultJSONArray(0);
|
||||
PointUpdateUtil.updatePoint(pointarr);
|
||||
//2找一个空余的缓存线,对应的物料是否有库存
|
||||
JSONArray arr = WQL.getWO("QSTRUCT_RULE").addParam("flag", "13").process().getResultJSONArray(0);
|
||||
String material_id = "";
|
||||
String vehicle_code = "";
|
||||
String point_code = "";
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
JSONObject jo = arr.getJSONObject(i);
|
||||
String material_type = jo.getString("material_type");
|
||||
JSONObject outObj = WQL.getWO("QSTRUCT_RULE").addParam("flag", "14").addParam("material_type", material_type).process().uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(outObj)) {
|
||||
material_id = outObj.getString("material_id");
|
||||
vehicle_code = outObj.getString("vehicle_code");
|
||||
point_code = jo.getString("point_code");
|
||||
break;
|
||||
}
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("flag", "9");
|
||||
param.put("area_type", "01");
|
||||
param.put("if_full", "1");
|
||||
JSONObject structObj = WQL.getWO("QSTRUCT_RULE").addParamMap(param).process().uniqueResult(0);
|
||||
CallMaterialTask callMaterialTask = new CallMaterialTask();
|
||||
JSONObject taskObj = new JSONObject();
|
||||
taskObj.put("next_point_code",conveyorObj.get("point_code"));
|
||||
taskObj.put("vehicle_code", structObj.get("vehicle_code"));
|
||||
taskObj.put("material_id", structObj.get("material_id"));
|
||||
taskObj.put("create_mode", "02");
|
||||
taskObj.put("is_full", "1");
|
||||
taskObj.put("workprocedure_id", WorkProcedureEnum.SZGX.getId());
|
||||
callMaterialTask.createTask(taskObj);
|
||||
}
|
||||
if (StrUtil.isEmpty(material_id)) {
|
||||
return;
|
||||
}
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("flag", "9");
|
||||
param.put("area_type", "01");
|
||||
param.put("if_full", "1");
|
||||
JSONObject structObj = WQL.getWO("QSTRUCT_RULE").addParamMap(param).process().uniqueResult(0);
|
||||
CallMaterialTask callMaterialTask = new CallMaterialTask();
|
||||
JSONObject taskObj = new JSONObject();
|
||||
taskObj.put("next_point_code", point_code);
|
||||
taskObj.put("vehicle_code", structObj.get("vehicle_code"));
|
||||
taskObj.put("material_id", structObj.get("material_id"));
|
||||
taskObj.put("create_mode", "02");
|
||||
taskObj.put("is_full", "1");
|
||||
taskObj.put("workprocedure_id", WorkProcedureEnum.SZGX.getId());
|
||||
callMaterialTask.createTask(taskObj);
|
||||
return;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user