diff --git a/wms/hd/nladmin-system/src/main/java/org/nl/wms/WorkProcedureEnum.java b/wms/hd/nladmin-system/src/main/java/org/nl/wms/WorkProcedureEnum.java index b985737..7450757 100644 --- a/wms/hd/nladmin-system/src/main/java/org/nl/wms/WorkProcedureEnum.java +++ b/wms/hd/nladmin-system/src/main/java/org/nl/wms/WorkProcedureEnum.java @@ -11,7 +11,8 @@ public enum WorkProcedureEnum { HNGX(1, "1514444198529601536", "01", "混碾工序", ""), YZGX(2, "1514444247439380480", "02", "压制工序", ""), SZGX(3, "1514444321896665088", "03", "烧制工序", ""), - FJGX(4, "1514444386174373888", "04", "分拣工序", ""); + FJGX(4, "1514444386174373888", "04", "分拣工序", ""), + DPGX(4, "1514444386174373888", "05", "分拣工序", ""); //顺序号 private int index; //工序标识 diff --git a/wms/hd/nladmin-system/src/main/java/org/nl/wms/common/StructFindUtil.java b/wms/hd/nladmin-system/src/main/java/org/nl/wms/common/StructFindUtil.java index accbde6..b6d1270 100644 --- a/wms/hd/nladmin-system/src/main/java/org/nl/wms/common/StructFindUtil.java +++ b/wms/hd/nladmin-system/src/main/java/org/nl/wms/common/StructFindUtil.java @@ -2,9 +2,11 @@ package org.nl.wms.common; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import org.nl.exception.BadRequestException; import org.nl.start.day01.Struct; +import org.nl.wms.sch.manage.AreaEnum; import org.nl.wql.WQL; import org.nl.wql.core.bean.WQLObject; @@ -63,9 +65,14 @@ public class StructFindUtil { public static JSONObject getEmptyVehicleInStruct(JSONObject jsonObject) { String area_type = jsonObject.getString("area_type"); String vehicle_code = jsonObject.getString("vehicle_code"); + String point_code = jsonObject.getString("point_code"); if (StrUtil.isEmpty(vehicle_code)) { throw new BadRequestException("托盘不能为空!"); } + if (StrUtil.equals(point_code,"KGTPDDW05")){ + JSONArray pointarr = WQL.getWO("ACSTOMES_001").addParam("area_type", AreaEnum.KGTDDQ).addParam("flag", "2").process().getResultJSONArray(0); + PointUpdateUtil.updatePoint(pointarr); + } //根据托盘找托盘类型, JSONObject vehicleObj = WQLObject.getWQLObject("md_pb_vehicle").query("vehicle_code='" + vehicle_code + "'").uniqueResult(0); if (ObjectUtil.isEmpty(vehicleObj)) { @@ -76,18 +83,30 @@ public class StructFindUtil { } String vehice_type = vehicleObj.getString("vehicle_type"); JSONObject result = WQL.getWO("QSTRUCT_RULE").addParam("flag", "4") - .addParam("area_type", area_type).addParam("vehice_type", vehice_type).process().uniqueResult(0); + .addParam("area_type", area_type) + .addParam("vehice_type", vehice_type) + .addParam("point_code", point_code) + .process().uniqueResult(0); return result; } public static JSONObject getEmptyVehicleOutStruct(JSONObject jsonObject) { String area_type = jsonObject.getString("area_type"); String vehicle_type = jsonObject.getString("vehicle_type"); + String point_code = jsonObject.getString("point_code"); + //如果是堆叠位5 需要更新 设备状态 + if(StrUtil.equals(point_code,"KGTPDDW05")){ + JSONArray pointarr = WQL.getWO("ACSTOMES_001").addParam("area_type", AreaEnum.KGTDDQ).addParam("flag", "2").process().getResultJSONArray(0); + PointUpdateUtil.updatePoint(pointarr); + } if (StrUtil.isEmpty(area_type)) { throw new BadRequestException("区域不能为空!"); } JSONObject result = WQL.getWO("QSTRUCT_RULE").addParam("flag", "5") - .addParam("area_type", area_type).addParam("vehicle_type", vehicle_type).process().uniqueResult(0); + .addParam("area_type", area_type) + .addParam("vehicle_type", vehicle_type) + .addParam("point_code", point_code) + .process().uniqueResult(0); return result; } diff --git a/wms/hd/nladmin-system/src/main/java/org/nl/wms/common/wql/QSTRUCT_RULE.wql b/wms/hd/nladmin-system/src/main/java/org/nl/wms/common/wql/QSTRUCT_RULE.wql index 839aa94..58a4b00 100644 --- a/wms/hd/nladmin-system/src/main/java/org/nl/wms/common/wql/QSTRUCT_RULE.wql +++ b/wms/hd/nladmin-system/src/main/java/org/nl/wms/common/wql/QSTRUCT_RULE.wql @@ -13,15 +13,16 @@ ################################################# ## 表字段对应输入参数 ################################################# - 输入.flag TYPEAS s_string - 输入.code TYPEAS s_string + 输入.flag TYPEAS s_string + 输入.code TYPEAS s_string 输入.material_id TYPEAS s_string 输入.sect_id TYPEAS s_string - 输入.area_type TYPEAS s_string + 输入.area_type TYPEAS s_string 输入.vehicle_type TYPEAS s_string - 输入.workprocedure_id TYPEAS s_string + 输入.workprocedure_id TYPEAS s_string 输入.is_full TYPEAS s_string 输入.vehicle_type TYPEAS s_string + 输入.point_code TYPEAS s_string [临时表] @@ -149,13 +150,11 @@ ENDIF IF 输入.flag = "4" QUERY SELECT DISTINCT - structattr.struct_id, - structattr.struct_code, - structattr.struct_name + point.point_id as struct_id, + point.point_code as struct_code, + point.point_name as struct_name FROM - st_ivt_structattr structattr - LEFT JOIN sch_base_point point ON point.point_id = structattr.struct_id - LEFT JOIN ST_IVT_StructRelaVehicleType rulevehicle ON rulevehicle.struct_id = structattr.struct_id + sch_base_point point ON point.point_id = structattr.struct_id WHERE point.lock_type = '00' AND ( point.vehicle_code = '' OR point.vehicle_code IS NULL ) @@ -163,12 +162,12 @@ IF 输入.flag = "4" OPTION 输入.area_type <> "" point.area_type = 输入.area_type ENDOPTION - OPTION 输入.sect_id <> "" - point.structattr = 输入.sect_id - ENDOPTION OPTION 输入.vehicle_type <> "" rulevehicle.vehicle_type = 输入.vehicle_type ENDOPTION + OPTION 输入.point_code <> "" + point.point_code = 输入.point_code + ENDOPTION ENDSELECT ENDQUERY ENDIF @@ -181,8 +180,6 @@ IF 输入.flag = "5" point.point_code AS struct_code, point.point_name AS struct_name, point.vehicle_code - - FROM sch_base_point point LEFT JOIN md_pb_vehicle vehicle ON vehicle.vehicle_code = point.vehicle_code @@ -196,6 +193,11 @@ IF 输入.flag = "5" OPTION 输入.vehicle_type <> "" vehicle.vehicle_type = 输入.vehicle_type ENDOPTION + OPTION 输入.point_code <> "" + point.point_code = 输入.point_code + ENDOPTION + + ENDSELECT ENDQUERY ENDIF \ No newline at end of file diff --git a/wms/hd/nladmin-system/src/main/java/org/nl/wms/ext/acs/wql/ACSTOMES_001.wql b/wms/hd/nladmin-system/src/main/java/org/nl/wms/ext/acs/wql/ACSTOMES_001.wql index 13a4e9a..f387989 100644 --- a/wms/hd/nladmin-system/src/main/java/org/nl/wms/ext/acs/wql/ACSTOMES_001.wql +++ b/wms/hd/nladmin-system/src/main/java/org/nl/wms/ext/acs/wql/ACSTOMES_001.wql @@ -61,3 +61,22 @@ ENDSELECT ENDQUERY ENDIF + + IF 输入.flag = "2" + QUERY + SELECT + + point.point_code as device_code + FROM + sch_base_point point + WHERE + 1=1 + OPTION 输入.area_type <> "" + point.area_type = 输入.area_type + ENDOPTION + OPTION 输入.point_code <> "" + point.point_code = 输入.point_code + ENDOPTION + ENDSELECT + ENDQUERY + ENDIF \ No newline at end of file diff --git a/wms/hd/nladmin-system/src/main/java/org/nl/wms/sch/manage/buss/CallEmptyVehicleTask.java b/wms/hd/nladmin-system/src/main/java/org/nl/wms/sch/manage/buss/CallEmptyVehicleTask.java index d2b1f3d..f46aaaf 100644 --- a/wms/hd/nladmin-system/src/main/java/org/nl/wms/sch/manage/buss/CallEmptyVehicleTask.java +++ b/wms/hd/nladmin-system/src/main/java/org/nl/wms/sch/manage/buss/CallEmptyVehicleTask.java @@ -115,17 +115,17 @@ public class CallEmptyVehicleTask extends AbstractAcsTask { vehicle_type = VehicleTypeEnum.XLZ.getCode(); start_area = AreaEnum.KLHJ.getCode(); break; - // 压制工序 + // 压制工序 case YZGX: vehicle_type = VehicleTypeEnum.GTP.getCode(); start_area = AreaEnum.KLHJ.getCode(); break; - //烧制工序 + //烧制工序 case SZGX: vehicle_type = VehicleTypeEnum.GTP.getCode(); start_area = AreaEnum.KLHJ.getCode(); break; - //分拣工序 + //分拣工序 case FJGX: // 根据点位code查找对应设备,根据设备查找对应工单,从工单中取托盘类型 vehicle_type = WQL.getWO("BUSSTASK_001") @@ -141,7 +141,7 @@ public class CallEmptyVehicleTask extends AbstractAcsTask { start_area = AreaEnum.KLHJ.getCode(); } //寻找一个合适的仓位 - param.put("vehicle_type",vehicle_type); + param.put("vehicle_type", vehicle_type); JSONObject outStructObj = StructFindUtil.getEmptyVehicleOutStruct(param); if (ObjectUtil.isEmpty(outStructObj)) { continue; @@ -213,7 +213,7 @@ public class CallEmptyVehicleTask extends AbstractAcsTask { case YZGX: vehicle_type = VehicleTypeEnum.GTP.getCode(); start_area = AreaEnum.KGTDDQ.getCode(); - + start_point_code = "KGTPDDW05"; break; //烧制工序 case SZGX: @@ -227,6 +227,13 @@ public class CallEmptyVehicleTask extends AbstractAcsTask { start_area = AreaEnum.CYZC.getCode(); is_auto_issue = "0"; break; + //叠盘工序 + case DPGX: + //托盘类型取当前工单生产的托盘类型 + vehicle_type = VehicleTypeEnum.GTP.getCode(); + start_area = AreaEnum.CYHJ.getCode(); + is_auto_issue = "0"; + break; default: vehicle_type = VehicleTypeEnum.DLZ.getCode(); start_area = AreaEnum.KLHJ.getCode(); @@ -234,6 +241,7 @@ public class CallEmptyVehicleTask extends AbstractAcsTask { JSONObject param = new JSONObject(); param.put("vehicle_type", vehicle_type); param.put("area_type", start_area); + param.put("point_code", start_point_code); JSONObject outStructObj = StructFindUtil.getEmptyVehicleOutStruct(param); if (ObjectUtil.isEmpty(outStructObj)) { throw new BadRequestException("未找到合适的空托盘点位"); @@ -258,6 +266,10 @@ public class CallEmptyVehicleTask extends AbstractAcsTask { } String task_id = IdUtil.getSnowflake(1, 1).nextId() + ""; //生成空载具搬运单据 + //如果载具点位上取不到,则给一个默认的999 + if (StrUtil.isEmpty(vehicle_code)) { + vehicle_code = "999"; + } JSONObject EmptyVehicleObj = new JSONObject(); EmptyVehicleObj.put("record_uuid", IdUtil.getSnowflake(1, 1).nextId()); EmptyVehicleObj.put("bill_code", CodeUtil.getNewCode("KZJ_BILL_CODE")); diff --git a/wms/hd/nladmin-system/src/main/java/org/nl/wms/sch/manage/buss/SendEmptyVehicleTask.java b/wms/hd/nladmin-system/src/main/java/org/nl/wms/sch/manage/buss/SendEmptyVehicleTask.java index 2b9df6c..e138990 100644 --- a/wms/hd/nladmin-system/src/main/java/org/nl/wms/sch/manage/buss/SendEmptyVehicleTask.java +++ b/wms/hd/nladmin-system/src/main/java/org/nl/wms/sch/manage/buss/SendEmptyVehicleTask.java @@ -154,7 +154,6 @@ public class SendEmptyVehicleTask extends AbstractAcsTask { if (StrUtil.isEmpty(vehicle_code)) { throw new BadRequestException("载具未找到!"); } - //判断起点有没有未完成的指令 JSONObject beforTaskObj = taskTable. query("is_delete='0' and start_point_code='" + start_point_code + "' and task_status <>'" + TaskStatusEnum.FINISHED.getCode() + "'") @@ -162,7 +161,6 @@ public class SendEmptyVehicleTask extends AbstractAcsTask { if (ObjectUtil.isNotEmpty(beforTaskObj)) { throw new BadRequestException("存在指令号为'" + beforTaskObj.getString("task_code") + "' 未完成!"); } - //根据起点去找工序,找一个合适的仓位 并且生成单据 if (StrUtil.isEmpty(next_point_code)) { JSONObject workInfo = WQL.getWO("QSTRUCT_RULE").addParam("flag", "1").addParam("code", start_point_code) @@ -186,6 +184,7 @@ public class SendEmptyVehicleTask extends AbstractAcsTask { //分拣工序 case FJGX: next_area = AreaEnum.KGTDDQ.getCode(); + next_point_code = "KGTPDDW05"; break; default: next_area = AreaEnum.KLHJ.getCode(); @@ -193,6 +192,7 @@ public class SendEmptyVehicleTask extends AbstractAcsTask { JSONObject param = new JSONObject(); param.put("area_type", next_area); param.put("vehicle_code", vehicle_code); + param.put("point_code", next_point_code); JSONObject inStructObj = StructFindUtil.getEmptyVehicleInStruct(param); next_point_code = inStructObj.getString("struct_code"); }