diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sch/tasks/ProductInTask.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sch/tasks/ProductInTask.java index bb485ea2..db4f1b00 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sch/tasks/ProductInTask.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sch/tasks/ProductInTask.java @@ -10,6 +10,7 @@ import org.nl.common.utils.SecurityUtils; import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.util.SpringContextHolder; +import org.nl.system.service.param.impl.SysParamServiceImpl; import org.nl.wms.basedata.st.service.dto.StructattrDto; import org.nl.wms.basedata.st.service.impl.StructattrServiceImpl; import org.nl.wms.sch.manage.AbstractAcsTask; @@ -33,14 +34,18 @@ public class ProductInTask extends AbstractAcsTask { WQLObject disTab = WQLObject.getWQLObject("st_ivt_iostorinvdis"); // 出入库分配表 WQLObject mstTab = WQLObject.getWQLObject("ST_IVT_IOStorInv"); // 出入库主表 WQLObject dtlTab = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl"); // 出入库明细表 + WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料表 + WQLObject pointTab = WQLObject.getWQLObject("sch_base_point"); // 点位表 + WQLObject taskTab = WQLObject.getWQLObject("sch_base_task"); // 任务表表 String currentUserId = SecurityUtils.getCurrentUserId(); String nickName = SecurityUtils.getCurrentNickName(); String now = DateUtil.now(); HashMap map = new HashMap<>(); + JSONObject jsonTask = taskTab.query("task_id = '" + taskObj.getString("task_id") + "'").uniqueResult(0); - //1:执行中,2:完成 ,0:acs取消 + //1:执行中,2:完成 ,3:acs取消 if (StrUtil.equals(status, "1")) { map.put("task_status", TaskStatusEnum.EXECUTING.getCode()); //更新入库单分配任务状态 @@ -57,10 +62,7 @@ public class ProductInTask extends AbstractAcsTask { dis_form.put("task_id", taskObj.getString("task_id")); productInService.confirmDis(dis_form); } - if (StrUtil.equals(status, "0")) { - WQLObject point_table = WQLObject.getWQLObject("SCH_BASE_Point"); - WQLObject struct_table = WQLObject.getWQLObject("ST_IVT_StructAttr"); - + if (StrUtil.equals(status, "3")) { if (taskObj.getIntValue("task_status") > Integer.valueOf(TaskStatusEnum.ISSUE.getCode())) { throw new BadRequestException("任务已执行不能取消"); } @@ -73,33 +75,37 @@ public class ProductInTask extends AbstractAcsTask { String iostorinv_id = jsonDis.getString("iostorinv_id"); // 解锁货位 - HashMap unlock_map = new HashMap<>(); - unlock_map.put("lock_type", "1"); - unlock_map.put("taskdtl_type", ""); - unlock_map.put("taskdtl_id", ""); - unlock_map.put("task_code", ""); - unlock_map.put("inv_type", ""); - unlock_map.put("inv_id", ""); - unlock_map.put("inv_code", ""); - point_table.update(unlock_map, "point_code = '" + taskObj.get("point_code2") + "'"); - struct_table.update(unlock_map, "struct_code = '" + taskObj.get("point_code2") + "'"); + JSONObject jsonPoint1 = pointTab.query("point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0); + jsonPoint1.put("lock_type", "1"); + pointTab.update(jsonPoint1); + + // 判断物料是否超长: 超长解锁对应点位 + JSONObject jsonMater = materTab.query("material_id = '" + jsonDis.getString("material_id") + "'").uniqueResult(0); + + String length_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MATERIAL_LENGTH_UP").getValue(); + double material_length = jsonMater.getDoubleValue("length"); + double material_length_up = Double.valueOf(length_up); + + if (material_length > material_length_up) { + JSONObject jsonPoint2 = pointTab.query("point_id = '" + jsonPoint1.getString("control_point") + "'").uniqueResult(0); + jsonPoint2.put("lock_type","1"); + pointTab.update(jsonPoint2); + } //减去原货位的待入数 - JSONArray dis_rows = disTab.query("struct_code = '" + taskObj.get("point_code2") + "' AND work_status < '99'").getResultJSONArray(0); + JSONArray dis_rows = disTab.query("struct_code = '" + jsonTask.get("point_code2") + "' AND work_status < '99'").getResultJSONArray(0); if (dis_rows.size() <= 0) { throw new BadRequestException("数据参数有误!"); } - StructattrDto old_struct = new StructattrServiceImpl().findByCode(taskObj.getString("point_code2")); JSONObject mst_jo = WQLObject.getWQLObject("ST_IVT_IOStorInv").query("iostorinv_id = '" + dis_rows.getJSONObject(0).getString("iostorinv_id") + "'").uniqueResult(0); for (int i = 0; i < dis_rows.size(); i++) { JSONObject i_form = new JSONObject(); JSONObject dis_row = dis_rows.getJSONObject(i); - i_form.put("struct_id", old_struct.getStruct_id()); + i_form.put("struct_id", jsonPoint1.getString("point_id")); i_form.put("material_id", dis_row.getString("material_id")); - i_form.put("quality_scode", dis_row.getString("quality_scode")); + i_form.put("quality_scode", "01"); i_form.put("pcsn", dis_row.getString("pcsn")); - i_form.put("ivt_level", dis_row.getString("ivt_level")); i_form.put("change_qty", dis_row.getString("plan_qty")); i_form.put("bill_type_scode", mst_jo.getString("bill_type")); i_form.put("inv_id", mst_jo.getString("iostorinv_id")); @@ -112,7 +118,7 @@ public class ProductInTask extends AbstractAcsTask { // 修改主表状态为分配中:30 JSONObject mstMap = new JSONObject(); - mstMap.put("bill_status", "30"); + mstMap.put("bill_status", "20"); mstMap.put("update_optid", currentUserId); mstMap.put("update_optname", nickName); mstMap.put("update_time", now); @@ -128,9 +134,6 @@ public class ProductInTask extends AbstractAcsTask { disMap.put("work_status", "00"); disMap.put("point_id", ""); disMap.put("task_id", ""); - disMap.put("sect_id", ""); - disMap.put("sect_code", ""); - disMap.put("sect_name", ""); disMap.put("struct_id", ""); disMap.put("struct_code", ""); disMap.put("struct_name", ""); @@ -176,7 +179,7 @@ public class ProductInTask extends AbstractAcsTask { json.put("point_code1", start_device_code); json.put("point_code2", next_device_code); json.put("vehicle_code", form.getString("vehicle_code")); - json.put("handle_class", this.getClass().getName()); + json.put("handle_class", THIS_CLASS); json.put("create_id", currentUserId); json.put("create_name", currentUsername); json.put("create_time", DateUtil.now()); @@ -194,7 +197,6 @@ public class ProductInTask extends AbstractAcsTask { this.updateTaskStatus(taskObj, "0"); } - @Override public void pointConfirm(JSONObject param) {