diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/pda/service/impl/CacheLineHandServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/pda/service/impl/CacheLineHandServiceImpl.java index 2a7e01f4..bd5a5343 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/pda/service/impl/CacheLineHandServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/pda/service/impl/CacheLineHandServiceImpl.java @@ -345,9 +345,10 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{ if(ObjectUtil.isEmpty(meObj)) { throw new BadRequestException("物料查询错误,请检查物料"); } + String materialId = meObj.getString("material_id"); vehiobj.put("vehicle_code", vehicle_code); //2.缓存线位置通过扫码绑定料箱条码 - positionTab.update(vehiobj); + positionTab.update(vehiobj, "position_code = '" + position_code + "'"); // 缓存线载具物料表 WQLObject ivtTab = WQLObject.getWQLObject("sch_cacheline_vehilematerial"); //3.先删除料箱的所有关联信息,包括物料,工序,生产区域 @@ -357,12 +358,9 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{ json.put("vehmaterial_id", IdUtil.getStringId()); json.put("vehicle_code", vehicle_code); json.put("cacheLine_code", cacheLine_code); - json.put("material_id", meObj.getString("material_id")); - json.put("material_code", meObj.getString("material_code")); - json.put("material_spec", meObj.getString("material_spec")); - json.put("material_name", meObj.getString("material_name")); - json.put("weight", weight); + json.put("material_id", materialId); json.put("quantity", quantity); + json.put("weight", weight); // json.put("workprocedure_code", wpObj.getString("workprocedure_code")); // json.put("workprocedure_name", wpObj.getString("workprocedure_name")); //有箱有料 @@ -382,6 +380,8 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{ String position_code = param.getString("position_code"); // 载具条码 String vehicle_code = param.getString("vehicle_code"); + // 缓存线 + String wcsdevice_code = param.getString("wcsdevice_code"); // 缓存线载具物料表 WQLObject ivtTab = WQLObject.getWQLObject("sch_cacheline_vehilematerial"); // 缓存线位置表 @@ -392,9 +392,13 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{ } //1.缓存线位置通过扫码绑定料箱条码 vehiobj.put("vehicle_code", vehicle_code); - positionTab.update(vehiobj); - //2.清空 - JSONObject json = ivtTab.query("vehicle_code = '" + vehicle_code + "'").uniqueResult(0); + positionTab.update(vehiobj, "position_code = '" + position_code + "'"); + //2.先删除料箱的所有关联信息,包括物料,工序,生产区域 + ivtTab.delete("vehicle_code = '" + vehicle_code + "'"); + JSONObject json = new JSONObject(); + json.put("vehmaterial_id", IdUtil.getStringId()); + json.put("vehicle_code", vehicle_code); + json.put("cacheLine_code", wcsdevice_code); json.put("vehicle_status", StatusEnum.CACHE_VEL_EMT.getCode()); json.put("material_id", ""); json.put("material_code", ""); @@ -404,8 +408,9 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{ json.put("quantity", "0"); json.put("workprocedure_code", ""); json.put("workprocedure_name", ""); - json.put("update_time", DateUtil.now()); - ivtTab.update(json); + json.put("create_time", DateUtil.now()); + // 3.重新新建该缓存线位置上的料箱为空箱子,是空料箱没有放物料等其他信息 + ivtTab.insert(json); JSONObject res = new JSONObject(); res.put("message", "设置成功"); return res; @@ -830,7 +835,9 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{ // 指令标识 String instruct_uuid = param.getString("instruct_uuid"); // 指令点位表【sch_base_task】 - JSONObject instObj = WQLObject.getWQLObject("sch_base_task").query("task_id = '" + instruct_uuid + "'").uniqueResult(0); + JSONObject instObj = WQLObject.getWQLObject("sch_base_task") + .query("task_id = '" + instruct_uuid + "'") + .uniqueResult(0); int putquantity = instObj.getInteger("material_qty"); String producer = instObj.getString("point_code2"); JSONArray jsonArray = new JSONArray(); @@ -856,7 +863,10 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{ public JSONArray getCacheLine(JSONObject param) { // 生产区域 String product_area = param.getString("product_area"); - JSONArray resultJSONArray = WQL.getWO("PDA_QUERY").addParamMap(MapOf.of("flag", "7", "product_area", product_area)).process().getResultJSONArray(0); + JSONArray resultJSONArray = WQL.getWO("PDA_QUERY") + .addParamMap(MapOf.of("flag", "7", "product_area", product_area)) + .process() + .getResultJSONArray(0); return resultJSONArray; } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/pda/wql/PDA_QUERY.wql b/mes/hd/nladmin-system/src/main/java/org/nl/wms/pda/wql/PDA_QUERY.wql index a1896b11..830b828c 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/pda/wql/PDA_QUERY.wql +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/pda/wql/PDA_QUERY.wql @@ -189,15 +189,16 @@ sch_cacheline_vehilematerial.workprocedure_code, sch_cacheline_vehilematerial.workprocedure_name, sch_cacheline_vehilematerial.material_id as material_uuid, - sch_cacheline_vehilematerial.material_code, - sch_cacheline_vehilematerial.material_name, - sch_cacheline_vehilematerial.material_spec, + md_me_materialbase.material_code, + md_me_materialbase.material_name, + md_me_materialbase.material_spec, sch_cacheline_vehilematerial.quantity, sch_cacheline_vehilematerial.weight, IF(length(sch_cacheline_position.vehicle_code) > 0, IFNULL(sch_cacheline_vehilematerial.vehicle_status, 4), 5) AS vehicle_status FROM sch_cacheline_position LEFT JOIN sch_cacheline_vehilematerial ON sch_cacheline_position.vehicle_code = sch_cacheline_vehilematerial.vehicle_code + LEFT JOIN md_me_materialbase ON md_me_materialbase.material_id = sch_cacheline_vehilematerial.material_id WHERE 1 = 1 OPTION 输入.product_area <> ""