diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/RemoteQualityService.java b/op-api/op-api-system/src/main/java/com/op/system/api/RemoteQualityService.java index 6197718d..646c3fa5 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/RemoteQualityService.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/RemoteQualityService.java @@ -4,7 +4,6 @@ import com.op.common.core.constant.ServiceNameConstants; import com.op.common.core.domain.R; import com.op.system.api.domain.quality.QcCheckTaskIncomeDTO; import com.op.system.api.domain.quality.QcCheckTaskWarehousingDTO; -import com.op.system.api.factory.RemoteDeviceFallbackFactory; import com.op.system.api.factory.RemoteQualityFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteQualityFallbackFactory.java b/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteQualityFallbackFactory.java index 4d63c12c..0400c399 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteQualityFallbackFactory.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteQualityFallbackFactory.java @@ -2,7 +2,6 @@ package com.op.system.api.factory; import com.op.common.core.domain.R; -import com.op.system.api.RemoteDeviceService; import com.op.system.api.RemoteQualityService; import com.op.system.api.domain.quality.QcCheckTaskIncomeDTO; import com.op.system.api.domain.quality.QcCheckTaskWarehousingDTO; diff --git a/op-api/op-api-system/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/op-api/op-api-system/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index 6e7b448c..113093cf 100644 --- a/op-api/op-api-system/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/op-api/op-api-system/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -7,3 +7,4 @@ com.op.system.api.factory.RemoteTechnologyFallbackFactory com.op.system.api.factory.RemoteSapFallbackFactory com.op.system.api.factory.RemoteDeviceFallbackFactory com.op.system.api.factory.RemoteQualityFallbackFactory +com.op.system.api.factory.RemoteOpenFallbackFactory diff --git a/op-common/op-common-core/src/main/java/com/op/common/core/constant/ServiceNameConstants.java b/op-common/op-common-core/src/main/java/com/op/common/core/constant/ServiceNameConstants.java index ec2d8c09..42e0f23f 100644 --- a/op-common/op-common-core/src/main/java/com/op/common/core/constant/ServiceNameConstants.java +++ b/op-common/op-common-core/src/main/java/com/op/common/core/constant/ServiceNameConstants.java @@ -55,4 +55,5 @@ public class ServiceNameConstants { * 接口模块的serviceid */ public static final String OPEN_SERVICE = "op-open"; + } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/controller/ProBPOrderWorkorderController.java b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProBPOrderWorkorderController.java new file mode 100644 index 00000000..50d1d653 --- /dev/null +++ b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProBPOrderWorkorderController.java @@ -0,0 +1,218 @@ +package com.op.plan.controller; + +import com.op.common.core.exception.ServiceException; +import com.op.common.core.utils.poi.ExcelUtil; +import com.op.common.core.web.controller.BaseController; +import com.op.common.core.web.domain.AjaxResult; +import com.op.common.core.web.page.TableDataInfo; +import com.op.common.log.annotation.Log; +import com.op.common.log.enums.BusinessType; +import com.op.common.security.annotation.RequiresPermissions; +import com.op.plan.domain.ProOrderWorkorder; +import com.op.plan.domain.dto.SplitOrderDTO; +import com.op.plan.service.IProOrderWorkorderService; +import com.op.plan.service.IProWetMaterialPlanDetailService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.ObjectUtils; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.List; + +/** + * 白坯生产工单Controller + * + * @author Open Platform + * @date 2023-07-26 + */ +@RestController +@RequestMapping("/bppro/workorder") +public class ProBPOrderWorkorderController extends BaseController { + @Autowired + private IProOrderWorkorderService proOrderWorkorderService; + + /** + * 通过子工单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); + } + + /** + * 提交修改工单接口 + * + * @param splitOrderDTO + * @return + */ + @PostMapping("/subChangeWorkOrder") + @RequiresPermissions("mes:bppro:workorder:edit") + @Log(title = "修改工单", businessType = BusinessType.UPDATE) + public AjaxResult subChangeWorkOrder(@RequestBody SplitOrderDTO splitOrderDTO) { + return proOrderWorkorderService.subChangeWorkOrder(splitOrderDTO); + } + + /** + * 提交修改工单-设备变更接口 + * + * @param splitOrderDTO + * @return + */ + @PostMapping("/subChangeWorkOrderM") + @RequiresPermissions("mes:bppro:workorder:edit") + public AjaxResult subChangeWorkOrderM(@RequestBody SplitOrderDTO splitOrderDTO) { + return proOrderWorkorderService.subChangeWorkOrderM(splitOrderDTO); + } + + /** + * 通过子工单获取批次信息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); + } + + /** + * 查询生产工单列表 + */ + @RequiresPermissions("mes:bppro:proworkorder:list") + @GetMapping("/list") + public TableDataInfo list(ProOrderWorkorder proOrderWorkorder) { + startPage(); + List list = proOrderWorkorderService.selectProOrderWorkorderList(proOrderWorkorder); + return getDataTable(list); + } + + /** + * 导出生产工单列表 + */ + @RequiresPermissions("mes:bppro: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:bppro:workorder:query") + @GetMapping(value = "/{workorderId}") + public AjaxResult getInfo(@PathVariable("workorderId") String workorderId) { + return success(proOrderWorkorderService.selectProOrderWorkorderByWorkorderId(workorderId)); + } + + /** + * 新增生产工单 + */ + @RequiresPermissions("mes:bppro:workorder:add") + @Log(title = "生产工单", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ProOrderWorkorder proOrderWorkorder) { + return toAjax(proOrderWorkorderService.insertProOrderWorkorder(proOrderWorkorder)); + } + + /** + * 修改生产工单 + */ + @RequiresPermissions("mes:bppro:workorder:edit") + @Log(title = "生产工单", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ProOrderWorkorder proOrderWorkorder) { + return toAjax(proOrderWorkorderService.updateProOrderWorkorder(proOrderWorkorder)); + } + + /** + * 删除生产工单 + */ + @RequiresPermissions("mes:bppro:workorder:remove") + @Log(title = "生产工单", businessType = BusinessType.DELETE) + @DeleteMapping("/{workorderIds}") + public AjaxResult remove(@PathVariable String[] workorderIds) { + //没进入生产之前都可以删除 +// 根据工单的ids查工单的信息 + List proOrderWorkorders = proOrderWorkorderService.selectProOrderWorkorderByWorkIds(workorderIds); + if (ObjectUtils.isEmpty(proOrderWorkorders)) { + throw new ServiceException("所查询的工单为空!!"); + } + // 划分工单 + List whiteWorkOrder = new ArrayList<>(); + List proWorkOrder = new ArrayList<>(); + for (ProOrderWorkorder data : proOrderWorkorders) { + if (data.getProdType().equals("white")) { + whiteWorkOrder.add(data); + }else { + proWorkOrder.add(data); + } + } + + // 白坯检验逻辑 + for (ProOrderWorkorder white : whiteWorkOrder) { + if (!(white.getStatus().equals("w0") || white.getStatus().equals("w1"))) { + throw new ServiceException("工单已进行生产,不允许删除!"); + } + } + + if (whiteWorkOrder.size() > 0) { + proOrderWorkorderService.deleteWhiteWorkorderByWorkOrder(whiteWorkOrder); + } + + // 成品检验逻辑 + ArrayList strings = new ArrayList<>(); + for (ProOrderWorkorder proOrderWorkorder : proWorkOrder) { + String status = proOrderWorkorder.getStatus(); + if (status.equals("w0") || status.equals("w1")) { + strings.add(proOrderWorkorder.getWorkorderId()); + } else { + throw new ServiceException("工单已进行生产,不允许删除!"); + } + } + String[] orderWorkerIds = strings.toArray(new String[0]); + + // 删除成品工单 + if (orderWorkerIds.length > 0) { + proOrderWorkorderService.deleteProOrderWorkorderByWorkorderIds(orderWorkerIds); + } + return toAjax(1); + } + + /** + * 下发生产工单 + */ + @RequiresPermissions("mes:bppro: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/mapper/ProOrderWorkorderMapper.java b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java index 421ad7ff..34be5801 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java @@ -167,5 +167,6 @@ public interface ProOrderWorkorderMapper { ProOrderWorkorder getPWorkOrder(ProOrderWorkorder whiteOrder); + List selectProOrderWorkorderList999(ProOrderWorkorder proOrderWorkorder); } 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 683b337f..16dbb893 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 @@ -93,7 +93,16 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { @Override @DS("#header.poolName") public List selectProOrderWorkorderList(ProOrderWorkorder proOrderWorkorder) { - List workorderList = proOrderWorkorderMapper.selectProOrderWorkorderList(proOrderWorkorder); + List workorderList = null; + String key = "#header.poolName"; + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String factoryCode = request.getHeader(key.substring(8)).replace("ds_",""); + if("999".equals(factoryCode)){ + workorderList = proOrderWorkorderMapper.selectProOrderWorkorderList999(proOrderWorkorder); + }else{ + workorderList = proOrderWorkorderMapper.selectProOrderWorkorderList(proOrderWorkorder); + } + for (ProOrderWorkorder workorder : workorderList) { String prodLineName = ""; String equipCods = "'"; diff --git a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml index 938b4e95..79a1df96 100644 --- a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml +++ b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml @@ -49,7 +49,7 @@ select workorder_id, workorder_code, workorder_name, order_id, order_code, product_id, product_code, product_name, product_spc, unit, quantity_produced, quantity_split, route_code, prod_line_code, product_date, shift_id, parent_order, ancestors, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, - update_by, update_time, prod_type, factory_code , end_flag , car_num,sort_no + update_by, update_time, prod_type, factory_code , end_flag , car_num,sort_no,workorder_code_sap from pro_order_workorder @@ -83,7 +83,40 @@ and pow.del_flag = '0' and ppow.del_flag = '0' - + SELECT ctp.id, + ctp.project_no, ctp.project_id, cp.rule_name, cp.property_code,