From fff81d3f6335ae69a3a7756326eacba22b54af77 Mon Sep 17 00:00:00 2001 From: "ZHOUZ\\Noble'lift" <1014987728@qq.com> Date: Thu, 21 Jul 2022 17:25:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sb/service/impl/SparePartServiceImpl.java | 41 +++++----- .../org/nl/pda/sb/wql/QPDAEM_BI_SPAREPART.wql | 1 - .../sb/core/rest/SparePartInController.java | 10 +++ .../sb/core/service/SparePartInService.java | 2 + .../service/impl/SparePartInServiceImpl.java | 18 ++++ mes/qd/src/api/wms/sb/sparepart.js | 8 ++ .../src/views/wms/sb/inbill/importOrder.vue | 82 +++++++++++++++++++ mes/qd/src/views/wms/sb/inbill/index.vue | 71 +++++++++++----- 8 files changed, 191 insertions(+), 42 deletions(-) create mode 100644 mes/qd/src/views/wms/sb/inbill/importOrder.vue diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/pda/sb/service/impl/SparePartServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/pda/sb/service/impl/SparePartServiceImpl.java index 22b92518..4ce9ae69 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/pda/sb/service/impl/SparePartServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/pda/sb/service/impl/SparePartServiceImpl.java @@ -63,19 +63,22 @@ public class SparePartServiceImpl implements SparePartService { if (StrUtil.isEmpty(sparepart_only_id)) { throw new PdaRequestException("备品备件不能为空!"); } - +/* JSONObject spare_bom = WQLObject.getWQLObject("EM_BI_EquipmentSpareBOM").query("sparepart_only_id = '" + sparepart_only_id + "'").uniqueResult(0); if (ObjectUtil.isEmpty(spare_bom)) { throw new PdaRequestException("该备件未查询到设备档案BOM备件表!"); } - String device_id = spare_bom.getString("devicerecord_id"); + String device_id = spare_bom.getString("devicerecord_id");*/ - JSONObject row = WQL.getWO("QPDAEM_BI_SPAREPART").addParam("flag", "1").addParam("device_id", device_id).addParam("sparepart_only_id", sparepart_only_id).process().uniqueResult(0); - if (ObjectUtil.isEmpty(jo)) { - if (ObjectUtil.isEmpty(spare_bom)) { - throw new PdaRequestException("该备件未查询到相关领用出库记录!"); - } + //查询是否已经入库 + JSONObject ivt = WQLObject.getWQLObject("em_bi_devicesparepartivt").query("sparepart_only_id = '"+sparepart_only_id+"'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(ivt)){ + throw new PdaRequestException("该备件已经入库!"); + } + JSONObject row = WQL.getWO("QPDAEM_BI_SPAREPART").addParam("flag", "1").addParam("sparepart_only_id", sparepart_only_id).process().uniqueResult(0); + if (ObjectUtil.isEmpty(row)) { + throw new PdaRequestException("该备件未查询到相关领用出库记录!"); } JSONObject returnjo = new JSONObject(); @@ -255,7 +258,7 @@ public class SparePartServiceImpl implements SparePartService { String iostorinvdtl_id = jo.getString("iostorinvdtl_id"); String io_flag = jo.getString("io_flag"); - JSONObject dtl = WQLObject.getWQLObject("EM_BI_IOStorInvDtl").query("iostorinvdtl_id = '"+iostorinvdtl_id+"'").uniqueResult(0); + JSONObject dtl = WQLObject.getWQLObject("EM_BI_IOStorInvDtl").query("iostorinvdtl_id = '" + iostorinvdtl_id + "'").uniqueResult(0); HashMap map = new HashMap<>(); map.put("flag", "4"); map.put("sparepart_only_id", sparepart_only_id); @@ -263,13 +266,13 @@ public class SparePartServiceImpl implements SparePartService { JSONObject row = WQL.getWO("QPDAEM_BI_SPAREPART").addParamMap(map).process().uniqueResult(0); - if (io_flag.equals("1") && ObjectUtil.isEmpty(row)){ + if (io_flag.equals("1") && ObjectUtil.isEmpty(row)) { //如果出库的话查询库存记录表 map.put("flag", "8"); - map.put("material_id",dtl.getString("material_id")); + map.put("material_id", dtl.getString("material_id")); row = WQL.getWO("QPDAEM_BI_SPAREPART").addParamMap(map).process().uniqueResult(0); } - if (ObjectUtil.isEmpty(row)){ + if (ObjectUtil.isEmpty(row)) { throw new PdaRequestException("请扫描或输入正确的备件唯一码!"); } JSONObject returnjo = new JSONObject(); @@ -296,7 +299,7 @@ public class SparePartServiceImpl implements SparePartService { JSONArray ja = new JSONArray(); for (int i = 0; i < rows.size(); i++) { JSONObject row = rows.getJSONObject(i); - if (StrUtil.isEmpty(row.getString("iostorinvdis_id"))){ + if (StrUtil.isEmpty(row.getString("iostorinvdis_id"))) { JSONObject dis_jo = new JSONObject(); dis_jo.put("iostorinvdis_id", IdUtil.getSnowflake(1, 1).nextId()); dis_jo.put("iostorinv_id", form.getString("iostorinv_id")); @@ -318,11 +321,11 @@ public class SparePartServiceImpl implements SparePartService { dis_jo.put("sparepart_only_id", row.getString("sparepart_only_id")); WQLObject.getWQLObject("EM_BI_IOStorInvDis").insert(dis_jo); ja.add(dis_jo); - }else { + } else { ja.add(row); } } - jo.put("rows",ja); + jo.put("rows", ja); sparePartOutService.disConfirm(jo); } @@ -351,7 +354,7 @@ public class SparePartServiceImpl implements SparePartService { } JSONObject content = new JSONObject(); - content.put("rows",rows); + content.put("rows", rows); JSONObject returnjo = new JSONObject(); returnjo.put("code", "1"); returnjo.put("rows", rows); @@ -586,7 +589,7 @@ public class SparePartServiceImpl implements SparePartService { } JSONObject content = new JSONObject(); - content.put("rows",rows); + content.put("rows", rows); JSONObject returnjo = new JSONObject(); returnjo.put("code", "1"); returnjo.put("content", content); @@ -771,11 +774,11 @@ public class SparePartServiceImpl implements SparePartService { String device_code = jo.getString("device_code"); String run_date = jo.getString("run_date"); - if (StrUtil.isEmpty(device_code)){ + if (StrUtil.isEmpty(device_code)) { throw new PdaRequestException("输入的设备编码不能为空!"); } - JSONObject content = WQL.getWO("QPDAEM_BI_SPAREPART").addParam("flag", "7").addParam("device_code", device_code).addParam("run_date",run_date).process().uniqueResult(0); + JSONObject content = WQL.getWO("QPDAEM_BI_SPAREPART").addParam("flag", "7").addParam("device_code", device_code).addParam("run_date", run_date).process().uniqueResult(0); JSONObject returnjo = new JSONObject(); returnjo.put("code", "1"); returnjo.put("content", content); @@ -847,7 +850,7 @@ public class SparePartServiceImpl implements SparePartService { double product_qty = jo.getDoubleValue("product_qty"); //生产总量 double nok_qty = jo.getDoubleValue("nok_qty"); //不合格数 double oee_value = jo.getDoubleValue("oee_value"); //不合格数 - if (ObjectUtil.isEmpty(jo.getString("oee_value"))){ + if (ObjectUtil.isEmpty(jo.getString("oee_value"))) { throw new PdaRequestException("oee不能为空!"); } double theory_beat = jsonFile.getDoubleValue("theory_beat"); // 理论节拍 diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/pda/sb/wql/QPDAEM_BI_SPAREPART.wql b/mes/hd/nladmin-system/src/main/java/org/nl/pda/sb/wql/QPDAEM_BI_SPAREPART.wql index f051f8fb..3d264ff0 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/pda/sb/wql/QPDAEM_BI_SPAREPART.wql +++ b/mes/hd/nladmin-system/src/main/java/org/nl/pda/sb/wql/QPDAEM_BI_SPAREPART.wql @@ -72,7 +72,6 @@ LEFT JOIN em_bi_equipmentfile file ON file.devicerecord_id = mst.device_id WHERE dis.sparepart_only_id = 输入.sparepart_only_id - AND mst.device_id = 输入.device_id AND mst.bill_type = '010901' AND mst.bill_status = '99' AND mst.is_delete = '0' diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/core/rest/SparePartInController.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/core/rest/SparePartInController.java index 9bbf4c79..5d981df5 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/core/rest/SparePartInController.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/core/rest/SparePartInController.java @@ -120,4 +120,14 @@ public class SparePartInController { sparePartInService.confirm(whereJson); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } + + @Log("导入视图数据") + @ApiOperation("导入视图数据") + //@PreAuthorize("@el.check('pcsIfPurchaseorderproc:del')") + @PutMapping("/importData") + public ResponseEntity importData(@RequestBody Map whereJson) { + sparePartInService.importData(whereJson); + return new ResponseEntity<>(HttpStatus.OK); + } + } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/core/service/SparePartInService.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/core/service/SparePartInService.java index a9896215..b4cca399 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/core/service/SparePartInService.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/core/service/SparePartInService.java @@ -32,6 +32,8 @@ public interface SparePartInService { void confirm(Map whereJson); + void importData(Map whereJson); + JSONArray getDisDtl(JSONObject whereJson); void divStruct(JSONObject whereJson); diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/core/service/impl/SparePartInServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/core/service/impl/SparePartInServiceImpl.java index b3fec805..487d040a 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/core/service/impl/SparePartInServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/core/service/impl/SparePartInServiceImpl.java @@ -13,6 +13,7 @@ import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.exception.BadRequestException; +import org.nl.ext.erp.service.WmsToErpService; import org.nl.modules.security.service.dto.JwtUserDto; import org.nl.modules.system.util.CodeUtil; import org.nl.utils.SecurityUtils; @@ -44,6 +45,8 @@ public class SparePartInServiceImpl implements SparePartInService { @Autowired private final StorattrService storattrService; + @Autowired + private WmsToErpService wmsToErpService; @Override public Map pageQuery(Map whereJson, Pageable page) { @@ -401,6 +404,21 @@ public class SparePartInServiceImpl implements SparePartInService { this.confirmMst((String) whereJson.get("iostorinv_id")); } + @Override + public void importData(Map whereJson) { + ArrayList arr = (ArrayList) whereJson.get("createTime"); + HashMap map = new HashMap<>(); + if (arr != null && arr.size() != 0) { + if (StrUtil.isNotEmpty(arr.get(0))) { + map.put("begin_time", arr.get(0)); + } + if (StrUtil.isNotEmpty(arr.get(1))) { + map.put("end_time", arr.get(1)); + } + } + wmsToErpService.getPurchaseInInfo(map); + } + public void confirmMst(String id) { WQLObject mst_wql = WQLObject.getWQLObject("EM_BI_IOStorInv"); Long currentUserId = SecurityUtils.getCurrentUserId(); diff --git a/mes/qd/src/api/wms/sb/sparepart.js b/mes/qd/src/api/wms/sb/sparepart.js index b50c0e6d..b90d252e 100644 --- a/mes/qd/src/api/wms/sb/sparepart.js +++ b/mes/qd/src/api/wms/sb/sparepart.js @@ -200,6 +200,14 @@ export function backConfirm(data) { }) } +export function importData(data) { + return request({ + url: 'api/inbill/importData', + method: 'put', + data: data + }) +} + export default { add, edit, del, getType, getBillDtl, disConfirm, insertDtl, getIODtl, commit, checkVehicle, deleteDisDtl, getDisDtl, createCode, divPoint, cancelCreate, divStruct, bucketDtl, updateTask, delTask, reIssueTask, confirmTask, cancelTask, confirm, backConfirm } diff --git a/mes/qd/src/views/wms/sb/inbill/importOrder.vue b/mes/qd/src/views/wms/sb/inbill/importOrder.vue new file mode 100644 index 00000000..34e87504 --- /dev/null +++ b/mes/qd/src/views/wms/sb/inbill/importOrder.vue @@ -0,0 +1,82 @@ + + + + diff --git a/mes/qd/src/views/wms/sb/inbill/index.vue b/mes/qd/src/views/wms/sb/inbill/index.vue index bfec5123..1da98122 100644 --- a/mes/qd/src/views/wms/sb/inbill/index.vue +++ b/mes/qd/src/views/wms/sb/inbill/index.vue @@ -95,11 +95,21 @@ /> - + + + 导入入库单 + - + {{ scope.row.bill_code }} - - + + - - - + + + - - - - - - - - - + + + + + + + + + - + - - - + + + + @@ -205,12 +217,23 @@ import pagination from '@crud/Pagination' import DateRangePicker from '@/components/DateRangePicker/index' import AddDialog from '@/views/wms/sb/inbill/AddDialog' import DivDialog from '@/views/wms/sb/inbill/DivDialog' +import importOrder from '@/views/wms/sb/inbill/importOrder' import { mapGetters } from 'vuex' import crudStorattr from '@/api/wms/basedata/st/storattr' export default { name: 'Handle', - components: { ViewDialog, AddDialog, crudOperation, rrOperation, udOperation, pagination, DateRangePicker, DivDialog }, + components: { + ViewDialog, + AddDialog, + crudOperation, + rrOperation, + udOperation, + pagination, + DateRangePicker, + DivDialog, + importOrder + }, cruds() { return CRUD({ title: '', @@ -240,6 +263,7 @@ export default { bussConfig: null, currentRow: null, viewShow: false, + importShow: false, mstrow: {}, storlist: [], billtypelist: [], @@ -273,10 +297,13 @@ export default { canUd(row) { return row.bill_status !== '10' }, - toView(index,row){ + toView(index, row) { this.mstrow = row this.viewShow = true }, + Import() { + this.importShow = true + }, handleSelectionChange(val, row) { if (val.length > 1) { this.$refs.table.clearSelection()