diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/pda/sb/rest/SparePartController.java b/mes/hd/nladmin-system/src/main/java/org/nl/pda/sb/rest/SparePartController.java index cd994826..541ba1b5 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/pda/sb/rest/SparePartController.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/pda/sb/rest/SparePartController.java @@ -8,6 +8,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.annotation.Log; import org.nl.pda.sb.service.SparePartService; +import org.nl.wql.core.content.HttpContext; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; @@ -169,4 +170,21 @@ public class SparePartController { public ResponseEntity save(@RequestBody Map whereJson) { return new ResponseEntity<>(sparePartService.save(whereJson),HttpStatus.OK); } + + @PostMapping("/deptList") + @Log("部门下拉框") + @ApiOperation("部门下拉框") + public ResponseEntity deptList(@RequestBody Map whereJson) { + return new ResponseEntity<>(sparePartService.deptList(whereJson),HttpStatus.OK); + } + + @PostMapping("/repairRequest") + @Log("查询报修单") + @ApiOperation("查询报修单") + public ResponseEntity repairRequest(@RequestBody Map whereJson) { + HttpContext ctx = new HttpContext("11"); + ctx.setPage((String)(whereJson.get("page"))); + ctx.setRows((String)(whereJson.get("size"))); + return new ResponseEntity<>(sparePartService.repairRequest(whereJson,ctx),HttpStatus.OK); + } } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/pda/sb/service/SparePartService.java b/mes/hd/nladmin-system/src/main/java/org/nl/pda/sb/service/SparePartService.java index 211eb92f..c6dee6a3 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/pda/sb/service/SparePartService.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/pda/sb/service/SparePartService.java @@ -1,5 +1,6 @@ package org.nl.pda.sb.service; +import org.nl.wql.core.content.HttpContext; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; @@ -51,5 +52,9 @@ public interface SparePartService { Map save(Map jsonObject); + Map deptList(Map jsonObject); + + Map repairRequest(Map jsonObject, HttpContext ctx); + Map repairs(Map map, HttpServletRequest request); } 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 5b89c36f..b8863947 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 @@ -27,6 +27,7 @@ import org.nl.wms.sb.repair.service.DevicerepairmstService; import org.nl.wms.sb.upkeep.service.DevicemaintenancemstService; import org.nl.wql.WQL; import org.nl.wql.core.bean.WQLObject; +import org.nl.wql.core.content.HttpContext; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; @@ -72,8 +73,8 @@ public class SparePartServiceImpl implements SparePartService { String device_id = spare_bom.getString("devicerecord_id");*/ //查询是否已经入库 - JSONObject ivt = WQLObject.getWQLObject("em_bi_devicesparepartivt").query("sparepart_only_id = '"+sparepart_only_id+"'").uniqueResult(0); - if (ObjectUtil.isNotEmpty(ivt)){ + 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); @@ -889,6 +890,33 @@ public class SparePartServiceImpl implements SparePartService { return returnjo; } + @Override + public Map deptList(Map jsonObject) { + JSONArray rows = WQL.getWO("QPDAEM_BI_SPAREPART").addParam("flag", "9").process().getResultJSONArray(0); + JSONObject returnjo = new JSONObject(); + returnjo.put("code", "1"); + returnjo.put("desc", "操作成功!"); + returnjo.put("rows", rows); + return returnjo; + } + + @Override + public Map repairRequest(Map jsonObject, HttpContext ctx) { + if (ObjectUtil.isEmpty(jsonObject)) { + throw new PdaRequestException("传入参数不能为空!"); + } + JSONObject form = JSONObject.parseObject(JSON.toJSONString(jsonObject)); + String dept_id = form.getString("dept_id"); + + JSONObject jo1 = WQL.getWO("QPDAEM_BI_SPAREPART").addParam("flag", "10").addParam("dept_id", dept_id).pageQuery(ctx,"create_time desc"); + JSONObject returnjo = new JSONObject(); + returnjo.put("code", "1"); + returnjo.put("desc", "查询成功!"); + returnjo.put("rows", jo1.getJSONArray("content")); + returnjo.put("size", jo1.getJSONArray("content").size()); + return returnjo; + } + @Transactional(rollbackFor = Exception.class) @Override public Map repairs(Map map, HttpServletRequest request) { 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 2dd095b3..dcd6fd17 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 @@ -307,6 +307,17 @@ ENDQUERY ENDIF + IF 输入.flag = "9" + QUERY + SELECT + dept_id AS value, + `name` AS label + FROM + sys_dept + ENDSELECT + ENDQUERY + ENDIF +