From 9229c77301b18f7c096d42218719037fbb0ce628 Mon Sep 17 00:00:00 2001 From: wws <18630710203@163.com> Date: Tue, 12 Sep 2023 14:54:16 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A1=E5=88=92=E6=A8=A1=E5=9D=97(=E4=BC=98?= =?UTF-8?q?=E5=8C=96)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plan/controller/ProOrderController.java | 3 + .../ProOrderWorkorderController.java | 277 +++++++++--------- .../impl/ProOrderWorkorderServiceImpl.java | 153 +++++----- .../resources/mapper/plan/ProOrderMapper.xml | 1 + 4 files changed, 220 insertions(+), 214 deletions(-) diff --git a/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderController.java b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderController.java index 2e854970..a5a6dd1c 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderController.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderController.java @@ -42,6 +42,7 @@ public class ProOrderController extends BaseController { /** * 通过订单Code查询级联订单信息并封装返回 + * * @param orderCode * @return */ @@ -146,6 +147,7 @@ public class ProOrderController extends BaseController { /** * 通过订单物料号code查询对应工艺 + * * @param prodCode * @return */ @@ -166,6 +168,7 @@ public class ProOrderController extends BaseController { /** * 通过工艺编码获取设备信息list + * * @param routeCode * @return */ diff --git a/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderWorkorderController.java b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderWorkorderController.java index a02e6770..f08392b2 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderWorkorderController.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderWorkorderController.java @@ -38,155 +38,156 @@ import com.op.common.core.web.page.TableDataInfo; @RestController @RequestMapping("/pro/workorder") public class ProOrderWorkorderController extends BaseController { - @Autowired - private IProOrderWorkorderService proOrderWorkorderService; - @Autowired - private IProWetMaterialPlanDetailService proWetMaterialPlanDetailService; + @Autowired + private IProOrderWorkorderService proOrderWorkorderService; + @Autowired + private IProWetMaterialPlanDetailService proWetMaterialPlanDetailService; - /** - * 通过子工单code查询并返回所有级联工单 - * @param code - * @return - */ - @GetMapping("/getWorkOrders/{code}") - public AjaxResult getWorkOrders(@PathVariable("code") String code) { - return proOrderWorkorderService.getWorkOrders(code); - } + /** + * 通过子工单code查询并返回所有级联工单 + * + * @param code + * @return + */ + @GetMapping("/getWorkOrders/{code}") + public AjaxResult getWorkOrders(@PathVariable("code") String code) { + return proOrderWorkorderService.getWorkOrders(code); + } - /** - * 校验工单是否可以修改 - * - * @return - */ - @GetMapping("/checkWorkOrder/{id}") - public AjaxResult checkWorkOrder(@PathVariable("id") String id){ - return proOrderWorkorderService.checkWorkOrder(id); - } + /** + * 校验工单是否可以修改 + * + * @return + */ + @GetMapping("/checkWorkOrder/{id}") + public AjaxResult checkWorkOrder(@PathVariable("id") String id) { + return proOrderWorkorderService.checkWorkOrder(id); + } - /** - * 提交修改工单接口 - * - * @param splitOrderDTO - * @return - */ - @PostMapping("/subChangeWorkOrder") - @RequiresPermissions("mes:pro:workorder:edit") - @Log(title = "修改工单", businessType = BusinessType.UPDATE) - public AjaxResult subChangeWorkOrder(@RequestBody SplitOrderDTO splitOrderDTO){ - return proOrderWorkorderService.subChangeWorkOrder(splitOrderDTO); - } + /** + * 提交修改工单接口 + * + * @param splitOrderDTO + * @return + */ + @PostMapping("/subChangeWorkOrder") + @RequiresPermissions("mes:pro:workorder:edit") + @Log(title = "修改工单", businessType = BusinessType.UPDATE) + public AjaxResult subChangeWorkOrder(@RequestBody SplitOrderDTO splitOrderDTO) { + return proOrderWorkorderService.subChangeWorkOrder(splitOrderDTO); + } - /** - * 通过子工单获取批次信息list(父工单批次信息) - * - * @param proOrderWorkorder - * @return - */ - @PostMapping("/getWorkBatchList") - public AjaxResult getWorkBatchList(@RequestBody ProOrderWorkorder proOrderWorkorder){ - return proOrderWorkorderService.getWorkBatchList(proOrderWorkorder); - } + /** + * 通过子工单获取批次信息list(父工单批次信息) + * + * @param proOrderWorkorder + * @return + */ + @PostMapping("/getWorkBatchList") + public AjaxResult getWorkBatchList(@RequestBody ProOrderWorkorder proOrderWorkorder) { + return proOrderWorkorderService.getWorkBatchList(proOrderWorkorder); + } - /** - * 通过子工单信息查询订单信息和工单信息 - * - * @param proOrderWorkorder - * @return - */ - @PostMapping("/getOrderAndWorkInfo") - public AjaxResult getOrderAndWorkInfo(@RequestBody ProOrderWorkorder proOrderWorkorder){ - return proOrderWorkorderService.getOrderAndWorkInfo(proOrderWorkorder); - } + /** + * 通过子工单信息查询订单信息和工单信息 + * + * @param proOrderWorkorder + * @return + */ + @PostMapping("/getOrderAndWorkInfo") + public AjaxResult getOrderAndWorkInfo(@RequestBody ProOrderWorkorder proOrderWorkorder) { + return proOrderWorkorderService.getOrderAndWorkInfo(proOrderWorkorder); + } - /** - * 查询生产工单列表 - */ - @RequiresPermissions("mes:pro:proworkorder:list") - @GetMapping("/list") - public TableDataInfo list(ProOrderWorkorder proOrderWorkorder) { - startPage(); - List list = proOrderWorkorderService.selectProOrderWorkorderList(proOrderWorkorder); - return getDataTable(list); - } + /** + * 查询生产工单列表 + */ + @RequiresPermissions("mes:pro:proworkorder:list") + @GetMapping("/list") + public TableDataInfo list(ProOrderWorkorder proOrderWorkorder) { + startPage(); + List list = proOrderWorkorderService.selectProOrderWorkorderList(proOrderWorkorder); + return getDataTable(list); + } - /** - * 导出生产工单列表 - */ - @RequiresPermissions("mes:pro:workorder:export") - @Log(title = "生产工单", businessType = BusinessType.EXPORT) - @PostMapping("/export") - public void export(HttpServletResponse response, ProOrderWorkorder proOrderWorkorder) { - List list = proOrderWorkorderService.selectProOrderWorkorderList(proOrderWorkorder); - ExcelUtil util = new ExcelUtil(ProOrderWorkorder.class); - util.exportExcel(response, list, "生产工单数据"); - } + /** + * 导出生产工单列表 + */ + @RequiresPermissions("mes:pro:workorder:export") + @Log(title = "生产工单", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ProOrderWorkorder proOrderWorkorder) { + List list = proOrderWorkorderService.selectProOrderWorkorderList(proOrderWorkorder); + ExcelUtil util = new ExcelUtil(ProOrderWorkorder.class); + util.exportExcel(response, list, "生产工单数据"); + } - /** - * 获取生产工单详细信息 - */ - @RequiresPermissions("mes:pro:workorder:query") - @GetMapping(value = "/{workorderId}") - public AjaxResult getInfo(@PathVariable("workorderId") String workorderId) { - return success(proOrderWorkorderService.selectProOrderWorkorderByWorkorderId(workorderId)); - } + /** + * 获取生产工单详细信息 + */ + @RequiresPermissions("mes:pro:workorder:query") + @GetMapping(value = "/{workorderId}") + public AjaxResult getInfo(@PathVariable("workorderId") String workorderId) { + return success(proOrderWorkorderService.selectProOrderWorkorderByWorkorderId(workorderId)); + } - /** - * 新增生产工单 - */ - @RequiresPermissions("mes:pro:workorder:add") - @Log(title = "生产工单", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody ProOrderWorkorder proOrderWorkorder) { - return toAjax(proOrderWorkorderService.insertProOrderWorkorder(proOrderWorkorder)); - } + /** + * 新增生产工单 + */ + @RequiresPermissions("mes:pro:workorder:add") + @Log(title = "生产工单", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ProOrderWorkorder proOrderWorkorder) { + return toAjax(proOrderWorkorderService.insertProOrderWorkorder(proOrderWorkorder)); + } - /** - * 修改生产工单 - */ - @RequiresPermissions("mes:pro:workorder:edit") - @Log(title = "生产工单", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody ProOrderWorkorder proOrderWorkorder) { - return toAjax(proOrderWorkorderService.updateProOrderWorkorder(proOrderWorkorder)); - } + /** + * 修改生产工单 + */ + @RequiresPermissions("mes:pro:workorder:edit") + @Log(title = "生产工单", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ProOrderWorkorder proOrderWorkorder) { + return toAjax(proOrderWorkorderService.updateProOrderWorkorder(proOrderWorkorder)); + } - /** - * 删除生产工单 - */ - @RequiresPermissions("mes:pro:workorder:remove") - @Log(title = "生产工单", businessType = BusinessType.DELETE) - @DeleteMapping("/{workorderIds}") - public AjaxResult remove(@PathVariable String[] workorderIds) { - //什么时候可以删除工单?TODO;没进入生产之前都可以? + /** + * 删除生产工单 + */ + @RequiresPermissions("mes:pro:workorder:remove") + @Log(title = "生产工单", businessType = BusinessType.DELETE) + @DeleteMapping("/{workorderIds}") + public AjaxResult remove(@PathVariable String[] workorderIds) { + //什么时候可以删除工单?TODO;没进入生产之前都可以? // 根据工单的ids查工单的信息 - List proOrderWorkorders = proOrderWorkorderService.selectProOrderWorkorderByWorkIds(workorderIds); - if (ObjectUtils.isEmpty(proOrderWorkorders)){ - throw new ServiceException("所查询的工单为空!!"); - } - ArrayList strings = new ArrayList<>(); - for (ProOrderWorkorder proOrderWorkorder : proOrderWorkorders) { - String status = proOrderWorkorder.getStatus(); - if (status.equals("w0")){ - strings.add(proOrderWorkorder.getWorkorderId()); - } else { - throw new ServiceException("工单已经下发,不能删除!"); - } - // 判断是否含有湿料计划 boolean值(存在为true,不存在为false) - if (proWetMaterialPlanDetailService.selectProWetMaterialPlanDetailByWorkId(proOrderWorkorder.getWorkorderId())) { - throw new ServiceException("工单已创建湿料计划,不能删除!"); - } - } - String[] orderWorkerIds= strings.toArray(new String[0]); - return toAjax(proOrderWorkorderService.deleteProOrderWorkorderByWorkorderIds(orderWorkerIds)); - } + List proOrderWorkorders = proOrderWorkorderService.selectProOrderWorkorderByWorkIds(workorderIds); + if (ObjectUtils.isEmpty(proOrderWorkorders)) { + throw new ServiceException("所查询的工单为空!!"); + } + ArrayList strings = new ArrayList<>(); + for (ProOrderWorkorder proOrderWorkorder : proOrderWorkorders) { + String status = proOrderWorkorder.getStatus(); + if (status.equals("w0")) { + strings.add(proOrderWorkorder.getWorkorderId()); + } else { + throw new ServiceException("工单已经下发,不能删除!"); + } + // 判断是否含有湿料计划 boolean值(存在为true,不存在为false) + if (proWetMaterialPlanDetailService.selectProWetMaterialPlanDetailByWorkId(proOrderWorkorder.getWorkorderId())) { + throw new ServiceException("工单已创建湿料计划,不能删除!"); + } + } + String[] orderWorkerIds = strings.toArray(new String[0]); + return toAjax(proOrderWorkorderService.deleteProOrderWorkorderByWorkorderIds(orderWorkerIds)); + } - /** - * 下发生产工单 - */ - @RequiresPermissions("mes:pro:workorder:edit") - @Log(title = "下发生产工单", businessType = BusinessType.OTHER) - @PostMapping("/downWorkorder/{workorderIds}") - public AjaxResult downWorkorder(@PathVariable String[] workorderIds) { - return toAjax(proOrderWorkorderService.downProOrderWorkorderByWorkorderIds(workorderIds)); - } + /** + * 下发生产工单 + */ + @RequiresPermissions("mes:pro:workorder:edit") + @Log(title = "下发生产工单", businessType = BusinessType.OTHER) + @PostMapping("/downWorkorder/{workorderIds}") + public AjaxResult downWorkorder(@PathVariable String[] workorderIds) { + return toAjax(proOrderWorkorderService.downProOrderWorkorderByWorkorderIds(workorderIds)); + } } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java index 7ed4ab9c..a09f8e16 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java @@ -55,6 +55,7 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { private ProWetMaterialPlanDetailMapper proWetMaterialPlanDetailMapper; @Autowired private RemoteSapService remoteSapService; + /** * 查询生产工单 * @@ -81,14 +82,14 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { String prodLineName = ""; String equipCods = "'"; JSONArray codeArray = JSONArray.parseArray(workorder.getProdLineCode()); - for(int c=0;c equipMap = proOrderMapper.getEquipInfoByCodes(equipCods.substring(1));//设备字典 Set keys = equipMap.keySet(); for (String key : keys) { - prodLineName += equipMap.get(key).getLabel()+","; + prodLineName += equipMap.get(key).getLabel() + ","; } workorder.setProdLineName(prodLineName); // // 通过设备code查询出机型名称 @@ -135,39 +136,39 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { @DS("#header.poolName") @Transactional(rollbackFor = Exception.class) public int deleteProOrderWorkorderByWorkorderIds(String[] workorderIds) { - for(String workorderId:workorderIds){ + for (String workorderId : workorderIds) { //要删除的工单id们 List delteIds = new ArrayList<>(); delteIds.add(workorderId); //最底级,用来还原订单拆分数量 List workers = new ArrayList<>(); ProOrderWorkorder work = proOrderWorkorderMapper.selectProOrderWorkorderByWorkorderId(workorderId); - if(work != null){ + if (work != null) { workers.add(work); ProOrderWorkorder bottomWork = work; Boolean run = true; - while(run){ + while (run) { //上级 ProOrderWorkorder topworkers = proOrderWorkorderMapper.selectWorkOrderByCode(bottomWork.getParentOrder()); //有上级code - if(topworkers!=null) { + if (topworkers != null) { workers.add(topworkers); delteIds.add(topworkers.getWorkorderId()); bottomWork.setParentOrder(topworkers.getParentOrder()); - }else{ + } else { run = false; } } } - String[] workorderIds0 = (String[])delteIds.toArray(new String[delteIds.size()]); - if(workorderIds0.length>0){ + String[] workorderIds0 = (String[]) delteIds.toArray(new String[delteIds.size()]); + if (workorderIds0.length > 0) { //删除工单(字母)pro_order_workorder proOrderWorkorderMapper.deleteProOrderWorkorderByWorkorderIds(workorderIds0); //删除批次pro_order_workorder_batch proOrderWorkorderBatchMapper.deleteProOrderWorkorderBatchByWorkorderIds(workorderIds0); } - if(!CollectionUtils.isEmpty(workers)){ + if (!CollectionUtils.isEmpty(workers)) { //释放订单拆分数pro_order proOrderMapper.updateOrderBatch(workers); } @@ -192,6 +193,7 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { /** * 下发生产工单信息 * (附:回传sap工单,获取工单对应的领料单) + * * @param workorderIds 生产工单主键 * @return 结果 */ @@ -201,12 +203,12 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { public int downProOrderWorkorderByWorkorderIds(String[] workorderIds) { List workorders = proOrderWorkorderMapper.getWorkOrderByIds(workorderIds); - for(ProOrderWorkorder workorder:workorders){ + for (ProOrderWorkorder workorder : workorders) { //关联工艺 - if(StringUtils.isNotBlank(workorder.getRouteCode())){ + if (StringUtils.isNotBlank(workorder.getRouteCode())) { List workDetails = proWorkorderProcessDetailMapper.getWorkOrderDetailsByRouteCode(workorder); - if(!CollectionUtils.isEmpty(workDetails)){ - workDetails.forEach(str->{ + if (!CollectionUtils.isEmpty(workDetails)) { + workDetails.forEach(str -> { str.setRecordId(IdUtils.fastSimpleUUID()); str.setWorkorderId(workorder.getWorkorderId()); str.setStatus("s0");//未执行 @@ -220,54 +222,54 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { } List sapList = null;//回传给sap的工单 //如果是白坯生成备料单 - for(String workorderId:workorderIds){ + for (String workorderId : workorderIds) { ProOrderWorkorder whiteOrder = proOrderWorkorderMapper.selectProOrderWorkorderByWorkorderId(workorderId); - if(whiteOrder!=null&&"white".equals(whiteOrder.getProdType())){//是白坯订单,自主生成领料单; + if (whiteOrder != null && "white".equals(whiteOrder.getProdType())) {//是白坯订单,自主生成领料单; //备(领)料主单 MesPrepareDTO mesPrepare = new MesPrepareDTO(); - BeanUtils.copyBeanProp(mesPrepare,whiteOrder); - mesPrepare.setPrepareId(whiteOrder.getWorkorderCode()+"L");//领料单号 + BeanUtils.copyBeanProp(mesPrepare, whiteOrder); + mesPrepare.setPrepareId(whiteOrder.getWorkorderCode() + "L");//领料单号 mesPrepare.setWorkorderCode(whiteOrder.getWorkorderCode()); mesPrepare.setCreateBy(SecurityUtils.getUsername()); mesPrepare.setCreateTime(DateUtils.getNowDate()); mesPrepare.setStatus("L0");//待确认 proOrderWorkorderMapper.createPrepare(mesPrepare); //备(领)料明细 - ProWetMaterialPlanDetail planDetail= proWetMaterialPlanDetailMapper.getWetInfo(workorderId); + ProWetMaterialPlanDetail planDetail = proWetMaterialPlanDetailMapper.getWetInfo(workorderId); List details = new ArrayList<>(); MesPrepareDetailDTO detail = new MesPrepareDetailDTO(); detail.setCreateTime(DateUtils.getNowDate()); detail.setCreateBy(SecurityUtils.getUsername()); detail.setRecordId(IdUtils.fastSimpleUUID()); - if(planDetail != null){ + if (planDetail != null) { detail.setMaterailName(planDetail.getMaterialName()); detail.setMaterialCode(planDetail.getMaterialCode()); detail.setProductDate(planDetail.getProductDate()); - detail.setShiftId(planDetail.getShiftId()+""); + detail.setShiftId(planDetail.getShiftId() + ""); detail.setProdType("white"); detail.setFactoryCode(planDetail.getFactoryCode()); } details.add(detail); proOrderWorkorderMapper.createPrepareDetails(details); - }else if(whiteOrder!=null){//成品的母工单回传sap + } else if (whiteOrder != null) {//成品的母工单回传sap sapList = new ArrayList<>(); SapCreateOrder sap = new SapCreateOrder(); sap.setWerks(whiteOrder.getFactoryCode());//工厂编码 sap.setAufpar(whiteOrder.getProdType());//订单类型 sap.setMatnr(whiteOrder.getProductCode());//物料编号 - sap.setQuantity(whiteOrder.getQuantitySplit()+"");//数量 - sap.setDates(DateUtils.parseDateToStr("yyyy-MM-dd",whiteOrder.getProductDate()));//开始时间 - sap.setDatee(DateUtils.parseDateToStr("yyyy-MM-dd",whiteOrder.getProductDate()));//完成时间 + sap.setQuantity(whiteOrder.getQuantitySplit() + "");//数量 + sap.setDates(DateUtils.parseDateToStr("yyyy-MM-dd", whiteOrder.getProductDate()));//开始时间 + sap.setDatee(DateUtils.parseDateToStr("yyyy-MM-dd", whiteOrder.getProductDate()));//完成时间 sapList.add(sap); R> r = remoteSapService.SapCreateOrder(sapList); - logger.info("sap工单回传:"+r.getMsg()); - if(500==r.getCode()){ - logger.error("sap工单回传:"+r.getMsg()); + logger.info("sap工单回传:" + r.getMsg()); + if (500 == r.getCode()) { + logger.error("sap工单回传:" + r.getMsg()); return 0; } List returnCodes = r.getData(); - if(!CollectionUtils.isEmpty(returnCodes)){ - for(String sapCode:returnCodes){ + if (!CollectionUtils.isEmpty(returnCodes)) { + for (String sapCode : returnCodes) { ProOrderWorkorder oworkSap = new ProOrderWorkorder(); oworkSap.setWorkorderCodeSap(sapCode); oworkSap.setWorkorderId(workorderId);//工单编码 @@ -282,7 +284,7 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { oworkSapParent.setUpdateTime(DateUtils.getNowDate()); proOrderWorkorderMapper.updateWorkOrderCodeSap(oworkSapParent); - logger.info("sap工单回传sap虚拟工单号:"+sapCode); + logger.info("sap工单回传sap虚拟工单号:" + sapCode); } } @@ -294,7 +296,7 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { return 1; } -// //获取最低级材料 + // //获取最低级材料 // private void getLastChildren(List all, List allChildren , BaseBomComponentDTO bc) { // List cList = all.stream().filter(item -> item.getCumc().equals(bc.getComponent())) // .collect(Collectors.toList()); @@ -334,10 +336,10 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { // return bomdtos; // } //根据工单子单编码获取最顶级订单的母单 - private ProOrder getTopOrder(String workorderId){ + private ProOrder getTopOrder(String workorderId) { //pro_order_workorder ProOrder topOrder = proOrderWorkorderMapper.getOrderCodeById(workorderId); - while(!"0".equals(topOrder.getParentOrder())&& StringUtils.isNotEmpty(topOrder.getParentOrder())){ + while (!"0".equals(topOrder.getParentOrder()) && StringUtils.isNotEmpty(topOrder.getParentOrder())) { //pro_order_workorder topOrder = proOrderWorkorderMapper.getOrderCodeById(topOrder.getParentOrder()); } @@ -358,15 +360,15 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { while (run) { ProOrderWorkorder fatherWorkOrder = proOrderWorkorderMapper.selectWorkOrderByCode(proOrderWorkorder.getParentOrder()); // 如果存在父工单 - if (fatherWorkOrder != null ){ - BeanUtils.copyProperties(fatherWorkOrder,proOrderWorkorder); - }else { + if (fatherWorkOrder != null) { + BeanUtils.copyProperties(fatherWorkOrder, proOrderWorkorder); + } else { run = false; } } // 通过母订单id查询母订单详情 ProOrder proOrder = proOrderMapper.selectProOrderById(proOrderWorkorder.getOrderId()); - if(proOrder != null){ + if (proOrder != null) { // 递归查询子订单 recursiveQueryChildOrder(proOrder); } @@ -374,8 +376,8 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { formatProOrderWorkorder(proOrderWorkorder); Map orderAndWork = new HashMap(); - orderAndWork.put("order",proOrder); - orderAndWork.put("workOrder",proOrderWorkorder); + orderAndWork.put("order", proOrder); + orderAndWork.put("workOrder", proOrderWorkorder); return success(orderAndWork); } @@ -390,12 +392,12 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { @DS("#header.poolName") public AjaxResult getWorkBatchList(ProOrderWorkorder proOrderWorkorder) { boolean run = true; - while (run){ + while (run) { ProOrderWorkorder fatherWorkOrder = proOrderWorkorderMapper.selectWorkOrderByCode(proOrderWorkorder.getParentOrder()); // 如果存在父工单 - if (fatherWorkOrder != null){ - BeanUtils.copyProperties(fatherWorkOrder,proOrderWorkorder); - }else { + if (fatherWorkOrder != null) { + BeanUtils.copyProperties(fatherWorkOrder, proOrderWorkorder); + } else { run = false; } } @@ -428,19 +430,19 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { // 用于循环 ProOrderWorkorder childWorkOrder = new ProOrderWorkorder(); - BeanUtils.copyProperties(proWorkOrder,childWorkOrder); + BeanUtils.copyProperties(proWorkOrder, childWorkOrder); while (getworkOrder) { // 通过parentOrder查询父工单信息 ProOrderWorkorder fatherWorkOrder = proOrderWorkorderMapper.selectWorkOrderByCode(childWorkOrder.getParentOrder()); - if (fatherWorkOrder != null){ + if (fatherWorkOrder != null) { // 将重置对象 - BeanUtils.copyProperties(fatherWorkOrder,childWorkOrder); + BeanUtils.copyProperties(fatherWorkOrder, childWorkOrder); // 将工单放入list workOrderList.add(fatherWorkOrder); // 将id放入 ids.add(fatherWorkOrder.getWorkorderId()); - }else { + } else { // 终止循环 getworkOrder = false; } @@ -459,22 +461,22 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { } } //校验各工序设备是否已选择 - List processes= proOrderMapper.getRouteProcess(splitOrderDTO.getRouteCode()); - if(splitOrderDTO.getProdLineCodeArray().length == 0){ + List processes = proOrderMapper.getRouteProcess(splitOrderDTO.getRouteCode()); + if (splitOrderDTO.getProdLineCodeArray().length == 0) { checkout = false; return error(500, "必须选择工单生产设备!"); - }else{ + } else { String codeArray = JSONArray.toJSONString(splitOrderDTO.getProdLineCodeArray()); - for(int i=0;i0){ + if (proOrder.getChildren().size() > 0) { ProOrderDTO newProOrder = (ProOrderDTO) proOrder.getChildren().get(0); // 更新换算值 conver = (newProOrder.getQuantity() / quantity); @@ -584,11 +586,8 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { public AjaxResult checkWorkOrder(String id) { // 判断工单状态1.活动不可以2.已报工不可以 ProOrderWorkorder proOrderWorkorder = proOrderWorkorderMapper.selectProOrderWorkorderByWorkorderId(id); - if (proOrderWorkorder.getStatus().equals("w2")) { - return error("工单处于活动状态!不可更改!"); - } - if (proOrderWorkorder.getStatus().equals("w3")) { - return error("工单处于报工状态!不可更改!"); + if (!(proOrderWorkorder.getStatus().equals("w0") ||proOrderWorkorder.getStatus().equals("w1"))) { + return error("工单已生产,不可变更!"); } return success(); } @@ -596,6 +595,7 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { /** * 根据workerIds查询ProOrderWorkorder + * * @param workerIds * @return */ @@ -607,6 +607,7 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { /** * 通过子工单code查询并返回所有级联工单 + * * @param code * @return */ @@ -637,7 +638,7 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { // 反转list List reversalWorkOrderList = new ArrayList<>(); - for (int i = proOrderWorkorderList.size()-1; i >= 0; i--) { + for (int i = proOrderWorkorderList.size() - 1; i >= 0; i--) { reversalWorkOrderList.add(proOrderWorkorderList.get(i)); } @@ -655,22 +656,22 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { JSONArray codeArray = JSONArray.parseArray(proOrderWorkorder.getProdLineCode()); String[][] array = new String[codeArray.size()][2]; - for(int c1=0;c1 equipMap = proOrderMapper.getEquipInfoByCodes(equipCods.substring(1));//设备字典 Set keys = equipMap.keySet(); for (String key : keys) { - prodLineName += equipMap.get(key).getLabel()+","; + prodLineName += equipMap.get(key).getLabel() + ","; } proOrderWorkorder.setProdLineCode(prodLineName); diff --git a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml index 9561ede1..9a99ca80 100644 --- a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml +++ b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml @@ -64,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and CONVERT(varchar(10),plan_pro_date, 120) >= '${planDateStart}' and '${planDateEnd}%' >= CONVERT(varchar(10),plan_pro_date, 120) + and prod_type != 'white' ORDER BY plan_pro_date DESC