diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java index 466e3d0..c1e86e7 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java @@ -25,6 +25,7 @@ import org.nl.wms.sch.task.call.empty.GTKCallEmptyTask; import org.nl.wms.sch.task.call.empty.HLCallEmptyTask; import org.nl.wms.sch.task.call.empty.YZCallEmptyTask; import org.nl.wms.sch.task.call.material.FJCallMaterialTask; +import org.nl.wms.sch.task.call.material.SZCallMaterialTask; import org.nl.wms.sch.task.call.material.YZCallMaterialTask; import org.nl.wms.sch.task.send.empty.FJSendEmptyTask; import org.nl.wms.sch.task.send.empty.YZSendEmptyTask; @@ -75,6 +76,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { private final YZSendEmptyTask yzSendEmptyTask; + private final SZCallMaterialTask szCallMaterialTask; + /** * task_id:任务标识 * task_code:任务编码 @@ -313,14 +316,18 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { break; case "2": // 叫料 - JSONObject workorder = TaskUtils.hasWorkOrder(point); - method_param.put("workorder", workorder); - switch (region) { case YZ: + JSONObject workorder = TaskUtils.hasWorkOrder(point); + method_param.put("workorder", workorder); task_code = yzCallMaterialTask.createTask(method_param); break; + case SZ: + task_code = szCallMaterialTask.createTask(method_param); + break; case FJ: + workorder = TaskUtils.hasWorkOrder(point); + method_param.put("workorder", workorder); task_code = fjCallMaterialTask.createTask(method_param); break; default: @@ -329,7 +336,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { break; case "3": // 送空 - workorder = WQLObject + JSONObject workorder = WQLObject .getWQLObject("pdm_bd_workorder") .query("is_delete = '0' AND device_code = '" + point.getString("device_code") + "' AND order_status = '3'") .uniqueResult(0); @@ -347,6 +354,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } JSONObject vd_update = new JSONObject(); vd_update.put("is_delete", TrueOrFalse.TRUE.value()); + TaskUtils.addACSUpdateColum(vd_update); WQLObject .getWQLObject("st_ivt_vehicle_detail") .update(vd_update, "vehicle_type = " + vehicle_type + " AND vehicle_code = '" + vehicle_code + "'"); @@ -364,6 +372,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { method_param.put("vehicle_code", vehicle_code); vd_update = new JSONObject(); vd_update.put("is_delete", TrueOrFalse.TRUE.value()); + TaskUtils.addACSUpdateColum(vd_update); WQLObject .getWQLObject("st_ivt_vehicle_detail") .update(vd_update, "vehicle_type = '2' AND vehicle_code = '" + vehicle_code + "'"); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/rest/PdaController.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/rest/PdaController.java index f4572eb..6da4a8d 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/rest/PdaController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/rest/PdaController.java @@ -140,4 +140,22 @@ public class PdaController { pdaService.callMaterial(point_code, param.toJSONString()); return PdaUtils.buildSuccessResultJSON(null); } + + @PostMapping("/sendEmpty") + @Log("送空") + @ApiOperation("送空") + @PdaAnnotation + public JSONObject sendEmpty(@RequestBody JSONObject param) { + String point_code = param.getString("point_code"); + if (StrUtil.isBlank(point_code)) { + throw new BadRequestException("点位编码不能为空!"); + } + String vehicle_code = param.getString("vehicle_code"); + if (StrUtil.isBlank(vehicle_code)) { + throw new BadRequestException("载具编码不能为空!"); + } + + pdaService.sendEmpty(point_code, vehicle_code, param.toJSONString()); + return PdaUtils.buildSuccessResultJSON(null); + } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/service/PdaService.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/service/PdaService.java index 576d37f..9eaa038 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/service/PdaService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/service/PdaService.java @@ -61,4 +61,12 @@ public interface PdaService { * @param point_code 点位编码 */ void callMaterial(String point_code, String request_param); + + /** + * 送空 + * + * @param point_code 点位编码 + * @param vehicle_code 载具编码 + */ + void sendEmpty(String point_code, String vehicle_code, String request_param); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java index 8ab4e7c..44efceb 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java @@ -13,12 +13,16 @@ import org.nl.modules.common.utils.SecurityUtils; import org.nl.modules.wql.WQL; import org.nl.modules.wql.core.bean.WQLObject; import org.nl.wms.basedata.eum.TrueOrFalse; +import org.nl.wms.basedata.eum.VehicleType; import org.nl.wms.pda.service.PdaService; import org.nl.wms.sch.manage.ACSSystem; import org.nl.wms.sch.manage.CreateMode; +import org.nl.wms.sch.manage.PointStatus; import org.nl.wms.sch.manage.Region; import org.nl.wms.sch.task.call.material.FJCallMaterialTask; import org.nl.wms.sch.task.call.material.YZCallMaterialTask; +import org.nl.wms.sch.task.send.empty.FJSendEmptyTask; +import org.nl.wms.sch.task.send.empty.YZSendEmptyTask; import org.nl.wms.sch.task.send.material.FJSendMaterialTask; import org.nl.wms.sch.task.send.material.HLSendMaterialTask; import org.nl.wms.sch.task.send.material.YZSendMaterialTask; @@ -45,19 +49,31 @@ public class PdaServiceImpl implements PdaService { private final FJCallMaterialTask fjCallMaterialTask; + private final YZSendEmptyTask yzSendEmptyTask; + + private final FJSendEmptyTask fjSendEmptyTask; + @Override public JSONArray region(String func) { switch (func) { case "send_material": // 送料 - case "call_material": - // 送料 return WQL .getWO("PDA") .addParam("flag", "1") .addParam("where", "('HL', 'YZ', 'FJ')") .process() .getResultJSONArray(0); + case "call_material": + // 叫料 + case "send_empty": + // 送空 + return WQL + .getWO("PDA") + .addParam("flag", "1") + .addParam("where", "('YZ', 'FJ')") + .process() + .getResultJSONArray(0); default: throw new BadRequestException("未知功能!"); } @@ -131,6 +147,36 @@ public class PdaServiceImpl implements PdaService { default: throw new BadRequestException(region.label() + "没有叫料点位!"); } + case "send_empty": + // 送空 + switch (region) { + case YZ: + JSONArray result = WQL + .getWO("PDA") + .addParam("flag", "2") + .addParam("region_code", region_code) + .addParam("point_type", "('2', '3')") + .process() + .getResultJSONArray(0); + result.addAll(WQL + .getWO("PDA") + .addParam("flag", "2") + .addParam("region_code", Region.KLHJ.value()) + .addParam("point_type", "('3')") + .process() + .getResultJSONArray(0)); + return result; + case FJ: + return WQL + .getWO("PDA") + .addParam("flag", "2") + .addParam("region_code", region_code) + .addParam("point_type", "('1')") + .process() + .getResultJSONArray(0); + default: + throw new BadRequestException(region.label() + "没有送空点位!"); + } default: throw new BadRequestException("未知功能!"); } @@ -174,11 +220,11 @@ public class PdaServiceImpl implements PdaService { TaskUtils.isLocked(point); JSONObject workorder = TaskUtils.hasWorkOrder(point); String vehicle_type = workorder.getString("vehicle_type"); - String device_code = workorder.getString("device_code"); WQLObject vd_table = WQLObject.getWQLObject("st_ivt_vehicle_detail"); JSONObject vd_update = new JSONObject(); vd_update.put("is_delete", TrueOrFalse.TRUE.value()); - vd_table.update(vd_update, "vehicle_type = '" + vehicle_type + "' AND vehicle_code = '" + vehicle_code + "'"); + TaskUtils.addCurrentUpdateColum(vd_update); + vd_table.update(vd_update, "is_delete = '0' AND vehicle_type = '" + vehicle_type + "' AND vehicle_code = '" + vehicle_code + "'"); // 组盘 JSONObject vd = new JSONObject(); @@ -191,17 +237,25 @@ public class PdaServiceImpl implements PdaService { vd.put("is_full", is_full); vd.put("workorder_id", workorder.getString("workorder_id")); vd.put("point_code", point_code); - vd.put("create_id", SecurityUtils.getCurrentUserId()); - vd.put("create_name", SecurityUtils.getCurrentNickName()); + Long user_id = SecurityUtils.getCurrentUserId(); + vd.put("create_id", user_id); + String nick_name = SecurityUtils.getCurrentNickName(); + vd.put("create_name", nick_name); vd.put("create_time", DateUtil.now()); - vd.put("is_delete", "0"); - if (device_code.startsWith("FJ")) { + vd.put("is_delete", TrueOrFalse.FALSE.value()); + + String region_code = point.getString("region_code"); + vd.put("is_fire", TrueOrFalse.FALSE.value()); + if (Region.FJ.value().equals(region_code)) { vd.put("is_fire", TrueOrFalse.TRUE.value()); } - vd.put("is_in_kiln", TrueOrFalse.trueOrFalse(is_full) ? TrueOrFalse.TRUE.value() : TrueOrFalse.FALSE.value()); - if (device_code.startsWith("FJ")) { + vd.put("is_in_kiln", is_full); + if (Region.FJ.value().equals(region_code)) { vd.put("is_in_kiln", TrueOrFalse.FALSE.value()); } + if (Region.FJ.value().equals(region_code)) { + vd.put("is_package", TrueOrFalse.TRUE.value()); + } vd_table.insert(vd); Region region = Region.get(point.getString("region_code")); @@ -211,8 +265,8 @@ public class PdaServiceImpl implements PdaService { method_param.put("vd", vd); method_param.put("create_mode", CreateMode.SCCJ.value()); method_param.put("request_param", request_param); - method_param.put("create_id", SecurityUtils.getCurrentUserId()); - method_param.put("create_name", SecurityUtils.getCurrentNickName()); + method_param.put("create_id", user_id); + method_param.put("create_name", nick_name); switch (region) { case HL: @@ -250,6 +304,7 @@ public class PdaServiceImpl implements PdaService { method_param.put("create_name", SecurityUtils.getCurrentNickName()); switch (region) { + case KLHJ: case YZ: yzCallMaterialTask.createTask(method_param); break; @@ -260,4 +315,54 @@ public class PdaServiceImpl implements PdaService { throw new BadRequestException("[" + region.label() + "] 不能发起叫料任务!"); } } + + @Override + public void sendEmpty(String point_code, String vehicle_code, String request_param) { + JSONObject point = WQLObject + .getWQLObject("sch_base_point") + .query("is_used = '1' AND point_code = '" + point_code + "'") + .uniqueResult(0); + if (ObjectUtil.isEmpty(point)) { + throw new BadRequestException("[" + point_code + "] 已删除或未启用!"); + } + + JSONObject workorder = WQLObject + .getWQLObject("pdm_bd_workorder") + .query("is_delete = '0' AND device_code = '" + point.getString("device_code") + "' AND order_status = '3'") + .uniqueResult(0); + + Region region = Region.get(point.getString("region_code")); + JSONObject method_param = new JSONObject(); + method_param.put("point", point); + method_param.put("workorder", workorder); + method_param.put("create_mode", CreateMode.SCCJ.value()); + method_param.put("request_param", request_param); + method_param.put("create_id", SecurityUtils.getCurrentUserId()); + method_param.put("create_name", SecurityUtils.getCurrentNickName()); + + switch (region) { + case KLHJ: + WQLObject point_table = WQLObject.getWQLObject("sch_base_point"); + point.put("vehicle_type", VehicleType.CUP.value()); + point.put("vehicle_code", vehicle_code); + point.put("point_status", PointStatus.NOT_EMPTY.value()); + TaskUtils.addCurrentUpdateColum(point); + point_table.update(point); + JSONObject point_update = new JSONObject(); + point_update.put("vehicle_type", ""); + point_update.put("vehicle_code", ""); + point_update.put("point_status", PointStatus.EMPTY.value()); + TaskUtils.addCurrentUpdateColum(point_update); + point_table.update(point_update, "region_code = 'KLHJ' AND point_type = '2' AND vehicle_type = '1' AND vehicle_code = '" + vehicle_code + "'"); + case YZ: + yzSendEmptyTask.createTask(method_param); + break; + case FJ: + method_param.put("vehicle_code", vehicle_code); + fjSendEmptyTask.createTask(method_param); + break; + default: + throw new BadRequestException("[" + region.label() + "] 不能发起送空任务!"); + } + } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/dto/DeviceDto.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/dto/DeviceDto.java index 34e6f92..736ed46 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/dto/DeviceDto.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/dto/DeviceDto.java @@ -77,4 +77,9 @@ public class DeviceDto implements Serializable { * 设备产能 */ private BigDecimal productivity; + + /** + * 是否工单设备 + */ + private String is_workorder; } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/DeviceServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/DeviceServiceImpl.java index fca055b..c3c4cdd 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/DeviceServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/DeviceServiceImpl.java @@ -46,6 +46,7 @@ public class DeviceServiceImpl implements DeviceService { if (!StrUtil.isEmpty(search)) { map.put("search", "%" + search + "%"); } + map.put("is_workorder", MapUtil.getStr(whereJson, "is_workorder")); map.put("region_str", MapUtil.getStr(whereJson, "region_str")); JSONObject json = WQL.getWO("PDM_BI_DEVICE01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "device.device_model ASC, device.device_code ASC"); return json; diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/PDM_BI_DEVICE01.wql b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/PDM_BI_DEVICE01.wql index b2de6a3..87eb529 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/PDM_BI_DEVICE01.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/PDM_BI_DEVICE01.wql @@ -16,6 +16,7 @@ 输入.flag TYPEAS s_string 输入.search TYPEAS s_string 输入.region_str TYPEAS f_string + 输入.is_workorder TYPEAS s_string [临时表] @@ -58,7 +59,9 @@ OPTION 输入.region_str <> "" device.region_code IN 输入.region_str ENDOPTION - + OPTION 输入.is_workorder <> "" + device.is_workorder = 输入.is_workorder + ENDOPTION ENDSELECT ENDPAGEQUERY ENDIF diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/material/SZCallMaterialTask.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/material/SZCallMaterialTask.java index 709bbe5..f90783e 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/material/SZCallMaterialTask.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/material/SZCallMaterialTask.java @@ -22,24 +22,6 @@ import org.springframework.stereotype.Component; public class SZCallMaterialTask extends AbstractAcsTask { - @Override - public void autoCreate() { - JSONArray points = WQL.getWO("CALL_MATERIAL_TASK").addParam("flag", "2").process().getResultJSONArray(0); - if (ObjectUtil.isNotEmpty(points) && !points.isEmpty()) { - JSONObject form = new JSONObject(); - form.put("create_mode", CreateMode.ZDSC.value()); - form.put("create_id", AutoCreate.id); - form.put("create_name", AutoCreate.nick_name); - form.put("request_param", "auto"); - for (int i = 0; i < points.size(); i++) { - JSONObject point = points.getJSONObject(i); - form.put("point", point); - this.createTask(form); - } - } - } - - @Override public void updateTaskStatus(JSONObject task, String status) { if (TaskStatus.EXECUTING.value().equals(status)) { diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/wms.xls b/lms/nladmin-system/src/main/java/org/nl/wms/wms.xls index de3b32e..de1dabd 100644 Binary files a/lms/nladmin-system/src/main/java/org/nl/wms/wms.xls and b/lms/nladmin-system/src/main/java/org/nl/wms/wms.xls differ diff --git a/lms/nladmin-ui/src/utils/nladmin.js b/lms/nladmin-ui/src/utils/nladmin.js index e6bc266..ab52624 100644 --- a/lms/nladmin-ui/src/utils/nladmin.js +++ b/lms/nladmin-ui/src/utils/nladmin.js @@ -234,14 +234,16 @@ export async function blobValidate(data) { * 注:prop,title有一个必传 */ export function flexWidth(prop, tableData, title, num = 0) { - if (tableData.length === 0) { // 表格没数据不做处理 - return - } let flexWidth = 0// 初始化表格列宽 let columnContent = ''// 占位最宽的内容 const canvas = document.createElement('canvas') const context = canvas.getContext('2d') context.font = '14px Microsoft YaHei' + if (tableData.length === 0) { // 表格没数据采用标题 + const width = context.measureText(title) + flexWidth = width.width + 20 + num + return flexWidth + 'px' + } // 获取占位最宽的内容 let index = 0 for (let i = 0; i < tableData.length; i++) { // 循环表格内容,获取表格内容中最长的数据 diff --git a/lms/nladmin-ui/src/views/wms/pdm/device/index.vue b/lms/nladmin-ui/src/views/wms/pdm/device/index.vue index e482a32..7f36884 100644 --- a/lms/nladmin-ui/src/views/wms/pdm/device/index.vue +++ b/lms/nladmin-ui/src/views/wms/pdm/device/index.vue @@ -33,7 +33,7 @@ :title="crud.status.title" width="600px" > - + @@ -44,7 +44,6 @@ @@ -60,7 +59,6 @@ @@ -75,6 +73,10 @@ + + + + @@ -97,16 +99,46 @@ @selection-change="crud.selectionChangeHandler" > - - - - + + + + - - + + + + +