From 4f30f55b66b6f2530ed265eb87d123582aeb52d6 Mon Sep 17 00:00:00 2001 From: zds <2388969634@qq.com> Date: Tue, 19 Jul 2022 18:54:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/EquipmentfileServiceImpl.java | 22 +++++++--- .../basedata/em/wql/QEM_EQUIPMENTFILE01.wql | 4 +- .../basedata/em/equipmentfile/AddDialog.vue | 43 +++++++++---------- .../em/equipmentfile/ChangeDialog.vue | 1 - .../basedata/em/equipmentfile/ViewDialog.vue | 33 ++++++-------- .../wms/basedata/em/equipmentfile/index.vue | 19 ++++---- 6 files changed, 62 insertions(+), 60 deletions(-) diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/basedata/em/service/impl/EquipmentfileServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/basedata/em/service/impl/EquipmentfileServiceImpl.java index 1c0fc8b4..fbcb60d4 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/basedata/em/service/impl/EquipmentfileServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/basedata/em/service/impl/EquipmentfileServiceImpl.java @@ -67,6 +67,12 @@ public class EquipmentfileServiceImpl implements EquipmentfileService { Long deptId = currentUser.getDeptId(); WQLObject mstTab = WQLObject.getWQLObject("EM_BI_EquipmentFile"); // 工艺路线主表 WQLObject EM_BI_DeviceLifeCycle = WQLObject.getWQLObject("EM_BI_DeviceLifeCycle"); // 工艺路线主表 + + String device_code = json.getString("device_code"); + JSONObject old = mstTab.query("is_delete='0' and device_code='"+device_code+"'").uniqueResult(0); + if(old!=null){ + throw new BadRequestException("已存在相同设备代码的档案!"); + } // 插入主表 String devicerecord_id = IdUtil.getSnowflake(1, 1).nextId()+""; json.put("devicerecord_id", devicerecord_id); @@ -100,8 +106,13 @@ public class EquipmentfileServiceImpl implements EquipmentfileService { String now = DateUtil.now(); JwtUserDto currentUser = (JwtUserDto) SecurityUtils.getCurrentUser(); Long deptId = currentUser.getDeptId(); - WQLObject mstTab = WQLObject.getWQLObject("EM_BI_EquipmentFile"); // 工艺路线主表 + String device_code = whereJson.getString("device_code"); + String devicerecord_id = whereJson.getString("devicerecord_id"); + JSONObject old = mstTab.query("is_delete='0' and device_code='"+device_code+"' and devicerecord_id <>'"+devicerecord_id+"'").uniqueResult(0); + if(old!=null){ + throw new BadRequestException("已存在相同设备代码的档案!"); + } WQLObject EM_BI_DeviceLifeCycle = WQLObject.getWQLObject("EM_BI_DeviceLifeCycle"); // 工艺路线主表 whereJson.put("update_optid", currentUserId); whereJson.put("update_optname", nickName); @@ -186,7 +197,7 @@ public class EquipmentfileServiceImpl implements EquipmentfileService { jo2.put("create_id", currentUserId); jo2.put("create_name", nickName); jo2.put("create_time", now); - EM_BI_DeviceLifeCycle.insert(jo); + EM_BI_DeviceLifeCycle.insert(jo2); } else if ("11".equals(status)) {//禁用 map.put("status", "11"); @@ -201,12 +212,12 @@ public class EquipmentfileServiceImpl implements EquipmentfileService { jo2.put("create_id", currentUserId); jo2.put("create_name", nickName); jo2.put("create_time", now); - EM_BI_DeviceLifeCycle.insert(jo); + EM_BI_DeviceLifeCycle.insert(jo2); } map.put("update_optid", currentUserId + ""); map.put("update_optname", nickName); map.put("update_time", now); - mstTab.update(map, "workorder_id ='" + jo.getString("workorder_id") + "'"); + mstTab.update(map, "devicerecord_id ='" + jo.getString("devicerecord_id") + "'"); } } @@ -249,7 +260,8 @@ public class EquipmentfileServiceImpl implements EquipmentfileService { @Override public JSONArray queryBomList(Map whereJson) { WQLObject EM_BI_DeviceBOM = WQLObject.getWQLObject("EM_BI_DeviceBOM"); // 工艺路线主表 - JSONArray ja = EM_BI_DeviceBOM.query("is_delete='0' and is_used='1'").getResultJSONArray(0); + String material_type_id = (String) whereJson.get("material_type_id"); + JSONArray ja = EM_BI_DeviceBOM.query("is_delete='0' and is_used='1' and material_type_id='"+material_type_id+"'").getResultJSONArray(0); return ja; } } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/basedata/em/wql/QEM_EQUIPMENTFILE01.wql b/mes/hd/nladmin-system/src/main/java/org/nl/wms/basedata/em/wql/QEM_EQUIPMENTFILE01.wql index afdbb7d2..dea27e5e 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/basedata/em/wql/QEM_EQUIPMENTFILE01.wql +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/basedata/em/wql/QEM_EQUIPMENTFILE01.wql @@ -55,12 +55,14 @@ equipmentfile.*, classstandard.class_name AS material_type_name, dept1.name AS use_deptname, - dept2.name AS belong_deptname + dept2.name AS belong_deptname, + dept3.name AS use_groupname FROM em_bi_equipmentfile equipmentfile LEFT JOIN md_pb_classstandard classstandard ON classstandard.class_id = equipmentfile.material_type_id LEFT JOIN sys_dept dept1 ON dept1.dept_id = equipmentfile.use_deptid LEFT JOIN sys_dept dept2 ON dept2.dept_id = equipmentfile.belong_deptid + LEFT JOIN sys_dept dept3 ON dept3.dept_id = equipmentfile.use_groupid WHERE equipmentfile.is_delete = '0' OPTION 输入.is_produceuse <> "" diff --git a/mes/qd/src/views/wms/basedata/em/equipmentfile/AddDialog.vue b/mes/qd/src/views/wms/basedata/em/equipmentfile/AddDialog.vue index 42f68b00..2cfd9ab1 100644 --- a/mes/qd/src/views/wms/basedata/em/equipmentfile/AddDialog.vue +++ b/mes/qd/src/views/wms/basedata/em/equipmentfile/AddDialog.vue @@ -73,7 +73,9 @@ :options="classes" :load-options="loadClass" style="width: 210px;" + :clearable= "false" placeholder="设备类别" + @select="typeChange" /> @@ -101,19 +103,13 @@ /> - - - + placeholder="使用班组" + /> { this.workProcedureList = res }) - - equipmentfile.queryBomList().then(res => { - this.bomlist = res - }) }, methods: { close() { this.$emit('AddChanged') }, [CRUD.HOOK.afterToCU](crud, form) { - debugger if (!form.devicerecord_code) { this.getDepts() @@ -372,13 +363,18 @@ export default { this.class_idStr = res.class_idStr this.queryClassId() }) + equipmentfile.queryBomList({ material_type_id: '-1' }).then(res => { + this.bomlist = res + }) } else { + equipmentfile.queryBomList({ material_type_id: form.material_type_id }).then(res => { + this.bomlist = res + }) this.getSupDepts(form.use_deptid) const param = { 'materOpt_code': '26' } crudDevicebom.getBjId(param).then(res => { - debugger const data = {} data.id = form.material_type_id data.goal_id = res.class_idStr @@ -387,9 +383,7 @@ export default { } }, getSubTypes(id) { - debugger crudClassstandard.getClassSuperior2(id).then(res => { - debugger const date = res.content this.buildClass(date) this.classes = date @@ -434,7 +428,6 @@ export default { } }, getSupDepts(deptId) { - debugger var number = parseFloat(deptId) getDeptSuperior(number).then(res => { const date = res.content @@ -443,7 +436,6 @@ export default { }) }, buildDepts(depts) { - debugger depts.forEach(data => { if (data.children) { this.buildDepts(data.children) @@ -479,6 +471,13 @@ export default { }) }) }, + typeChange(old) { + debugger + this.form.device_bom_id = '' + equipmentfile.queryBomList({ material_type_id: old.class_id }).then(res => { + this.bomlist = res + }) + }, [CRUD.HOOK.beforeSubmit]() { } } diff --git a/mes/qd/src/views/wms/basedata/em/equipmentfile/ChangeDialog.vue b/mes/qd/src/views/wms/basedata/em/equipmentfile/ChangeDialog.vue index 56ac7877..93b12cdc 100644 --- a/mes/qd/src/views/wms/basedata/em/equipmentfile/ChangeDialog.vue +++ b/mes/qd/src/views/wms/basedata/em/equipmentfile/ChangeDialog.vue @@ -101,7 +101,6 @@ > - diff --git a/mes/qd/src/views/wms/basedata/em/equipmentfile/ViewDialog.vue b/mes/qd/src/views/wms/basedata/em/equipmentfile/ViewDialog.vue index eaf7c0ae..582abbcd 100644 --- a/mes/qd/src/views/wms/basedata/em/equipmentfile/ViewDialog.vue +++ b/mes/qd/src/views/wms/basedata/em/equipmentfile/ViewDialog.vue @@ -4,6 +4,7 @@ width="1100px" :visible.sync="dialogVisible" @close="close" + @open="open" > @@ -91,20 +92,8 @@ - - - + + @@ -230,6 +219,7 @@