diff --git a/lms/nladmin-system/src/main/java/org/nl/config/ConfigParam.java b/lms/nladmin-system/src/main/java/org/nl/config/ConfigParam.java new file mode 100644 index 0000000..6d832de --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/config/ConfigParam.java @@ -0,0 +1,23 @@ +package org.nl.config; + +import org.springframework.context.annotation.Configuration; + +import javax.annotation.PostConstruct; +import java.util.HashMap; +import java.util.Map; + +/* + * @author ZZQ + * @Date 2022/11/16 4:32 下午 + */ +@Configuration +public class ConfigParam { + + //旧料盅叫料跟空盅入库都从公共点位回去 + public static Map YZJ_OLD_POINT = new HashMap<>(); + + @PostConstruct + public void initData(){ + //数据库更新该配置数据YZJ_OLD_POINT + } +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/callEmpty/HnCallEmptyVehicleTask.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/callEmpty/HnCallEmptyVehicleTask.java index 518ad9b..712c78a 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/callEmpty/HnCallEmptyVehicleTask.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/callEmpty/HnCallEmptyVehicleTask.java @@ -166,7 +166,7 @@ public class HnCallEmptyVehicleTask extends AbstractAcsTask { .point_code2(point_code2) .acs_task_type("2") .vehicle_code(form.getString("vehicle_code")) - .vehicle_type(workOrderObj.getString("vehicle_type")) + .vehicle_type(workOrderObj.getString("vehicle_type"))//载具类型统一用载具表维护 .vehicle_qty(form.getIntValue("qty")) .task_group_id(org.nl.wms.util.IdUtil.getLongId()) .handle_class(THIS_CLASS) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/callEmpty/wql/QSCH_hnCallEmptyVehicle_01.wql b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/callEmpty/wql/QSCH_hnCallEmptyVehicle_01.wql index 9b9be89..7c0b63d 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/callEmpty/wql/QSCH_hnCallEmptyVehicle_01.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/callEmpty/wql/QSCH_hnCallEmptyVehicle_01.wql @@ -58,7 +58,7 @@ IF 输入.flag = "1" p.region_code = 输入.region_code ENDOPTION OPTION 输入.is_new <> "" - vehicle.is_new = 输入.is_new + vehicle.vehicle_type = 输入.is_new ENDOPTION ENDSELECT ENDQUERY diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/callMaterial/YzjCallMaterialTask.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/callMaterial/YzjCallMaterialTask.java index 2ed1f5c..10e3c6b 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/callMaterial/YzjCallMaterialTask.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/callMaterial/YzjCallMaterialTask.java @@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.nl.config.ConfigParam; import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.utils.SecurityUtils; import org.nl.modules.system.util.CodeUtil; @@ -116,29 +117,30 @@ public class YzjCallMaterialTask extends AbstractAcsTask { JSONObject requestObj = task.getJSONObject("request_param"); - //区域出入表【st_ivt_regionIO】 - WQLObject regionIoTab = WQLObject.getWQLObject("st_ivt_regionIO"); - JSONObject regionIoObj = new JSONObject(); - regionIoObj.put("iostorinv_id", IdUtil.getLongId()); - regionIoObj.put("bill_code", CodeUtil.getNewCode("IN_STORE_CODE")); - regionIoObj.put("buss_date", DateUtil.today()); - regionIoObj.put("io_type", "2"); // 出库 - regionIoObj.put("region_id", material_point.getString("region_id")); - regionIoObj.put("region_code", material_point.getString("region_code")); - regionIoObj.put("region_name", material_point.getString("region_name")); - regionIoObj.put("material_id", taskObj.getString("material_id")); - regionIoObj.put("vehicle_code", taskObj.getString("vehicle_code")); - regionIoObj.put("qty", requestObj.getString("qty")); - regionIoObj.put("bill_status", "3"); - regionIoObj.put("start_point_code", taskObj.getString("point_code1")); - regionIoObj.put("end_point_code", taskObj.getString("point_code2")); - regionIoObj.put("create_mode", "2"); - regionIoObj.put("pcsn", DateUtil.format(DateUtil.parse(DateUtil.today()), "yyyyMMdd")); - regionIoObj.put("create_id", SecurityUtils.getCurrentUserId()); - regionIoObj.put("create_name", SecurityUtils.getCurrentNickName()); - regionIoObj.put("create_time", DateUtil.now()); - regionIoTab.insert(regionIoObj); - + 插入区域表:{ + //区域出入表【st_ivt_regionIO】 + WQLObject regionIoTab = WQLObject.getWQLObject("st_ivt_regionIO"); + JSONObject regionIoObj = new JSONObject(); + regionIoObj.put("iostorinv_id", IdUtil.getLongId()); + regionIoObj.put("bill_code", CodeUtil.getNewCode("IN_STORE_CODE")); + regionIoObj.put("buss_date", DateUtil.today()); + regionIoObj.put("io_type", "2"); // 出库 + regionIoObj.put("region_id", material_point.getString("region_id")); + regionIoObj.put("region_code", material_point.getString("region_code")); + regionIoObj.put("region_name", material_point.getString("region_name")); + regionIoObj.put("material_id", taskObj.getString("material_id")); + regionIoObj.put("vehicle_code", taskObj.getString("vehicle_code")); + regionIoObj.put("qty", requestObj.getString("qty")); + regionIoObj.put("bill_status", "3"); + regionIoObj.put("start_point_code", taskObj.getString("point_code1")); + regionIoObj.put("end_point_code", taskObj.getString("point_code2")); + regionIoObj.put("create_mode", "2"); + regionIoObj.put("pcsn", DateUtil.format(DateUtil.parse(DateUtil.today()), "yyyyMMdd")); + regionIoObj.put("create_id", SecurityUtils.getCurrentUserId()); + regionIoObj.put("create_name", SecurityUtils.getCurrentNickName()); + regionIoObj.put("create_time", DateUtil.now()); + regionIoTab.insert(regionIoObj); + } //完成后 // 物料点位解锁 并设置空位 material_point.put("lock_type", "1"); @@ -179,7 +181,7 @@ public class YzjCallMaterialTask extends AbstractAcsTask { String device_code = pointTab.query("point_code = '" + point_code2 + "'").uniqueResult(0).getString("device_code"); JSONObject workOrderObj = workOrderTab.query("device_code = '" + device_code + "' and order_status = '3' and is_delete ='0'").uniqueResult(0); if (ObjectUtil.isEmpty(workOrderObj)) throw new BadRequestException("该设备当前未生产或者已删除"); - String oldMatSendPoint = YZJ_OLD_POINT.get(point_code2);//旧料盅终点 + String oldMatSendPoint = ConfigParam.YZJ_OLD_POINT.get(point_code2);//旧料盅终点 if (StringUtils.isNotEmpty(oldMatSendPoint)){ point_code2=oldMatSendPoint; } @@ -220,9 +222,17 @@ public class YzjCallMaterialTask extends AbstractAcsTask { */ WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表 WQLObject pointTab = WQLObject.getWQLObject("sch_base_point"); // 点位表 + WQLObject workOrderTab = WQLObject.getWQLObject("PDM_BD_WorkOrder"); // 工单表 + JSONArray taskArr = taskTab.query("handle_class = '" + THIS_CLASS + "'and is_delete = '0' and task_status = '" + TaskStatusEnum.SURE_END.getCode() + "'").getResultJSONArray(0); for (int i = 0; i < taskArr.size(); i++) { JSONObject taskObj = taskArr.getJSONObject(i); + // 获取工单 + String point_code2 = taskObj.getString("point_code2"); + String device_code = pointTab.query("point_code = '" + point_code2 + "'").uniqueResult(0).getString("device_code"); + + JSONObject workOrderObj = workOrderTab.query("device_code = '" + device_code + "' and order_status = '3' and is_delete ='0'").uniqueResult(0); + String material_id = taskObj.getString("material_id"); String vehicle_type = taskObj.getString("vehicle_type"); JSONObject queryParam = new JSONObject(); @@ -230,7 +240,8 @@ public class YzjCallMaterialTask extends AbstractAcsTask { queryParam.put("material_id", material_id); queryParam.put("region_code", "KLHJ"); queryParam.put("vehicle_type", "%" + vehicle_type + "%"); - //1、 + queryParam.put("is_new", workOrderObj.getString("is_new")); + //TODO: 如果点位表载具类型没有维护新旧盅,就从载具表关联 JSONObject json1 = WQL.getWO("QSCH_yzjCallMaterial_01").addParamMap(queryParam).process().uniqueResult(0); if (ObjectUtil.isNotEmpty(json1)) { // 拿到点位 diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/callMaterial/wql/QSCH_yzjCallMaterial_01.wql b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/callMaterial/wql/QSCH_yzjCallMaterial_01.wql index efa15e2..2379f26 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/callMaterial/wql/QSCH_yzjCallMaterial_01.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/callMaterial/wql/QSCH_yzjCallMaterial_01.wql @@ -51,6 +51,7 @@ p.row_num FROM SCH_BASE_Point p + LEFT JOIN md_pb_vehicle veh ON p.vehicle_code = veh.vehicle_code WHERE p.is_used = '1' AND standing_time is not null @@ -67,6 +68,10 @@ OPTION 输入.vehicle_type <> "" p.can_vehicle_type like 输入.vehicle_type ENDOPTION + OPTION 输入.is_new <> "" + vehicle.vehicle_type = 输入.is_new + ENDOPTION + ORDER BY col_num desc,row_num,layer_num ENDSELECT ENDQUERY ENDIF diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/sendEmpty/YzjSendEmpVehicleTask.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/sendEmpty/YzjSendEmpVehicleTask.java index 7dc1995..b62907b 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/sendEmpty/YzjSendEmpVehicleTask.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/sendEmpty/YzjSendEmpVehicleTask.java @@ -8,6 +8,8 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.nl.config.ConfigParam; import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.utils.SecurityUtils; import org.nl.modules.system.util.CodeUtil; @@ -69,7 +71,7 @@ public class YzjSendEmpVehicleTask extends AbstractAcsTask { * @param status 代表wcs任务完成状态: //0:acs,取消,:执行中,2:完成 * @return * @discription wcs请求wms任务完成状态反馈接口, 比如agv从a点往b点走。生成任务的时候绑定b的物料信息,任务完成的时候,清除a的物料信息 - * @author ldjun + * @author ldjun 载具类型由载具表维护 * @created 2019年4月17日 下午8:51:50 */ @Override @@ -145,7 +147,10 @@ public class YzjSendEmpVehicleTask extends AbstractAcsTask { WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表 String point_code1 = form.getString("point_code1"); - + String oldMatSendPoint = ConfigParam.YZJ_OLD_POINT.get(point_code1);//旧空料盅的回库的话从公共点位返回 + if (StringUtils.isNotEmpty(oldMatSendPoint)){ + point_code1=oldMatSendPoint; + } SchTaskDto dto = SchTaskDto.builder().task_id(org.nl.wms.util.IdUtil.getLongId()) .task_code(CodeUtil.getNewCode("TASK_CODE")) .task_type("")