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 4907a411..9bf417ed 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 @@ -9,6 +9,9 @@ import javax.servlet.http.HttpServletResponse; import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; import com.op.common.core.domain.R; import com.op.common.core.utils.DateUtils; +import com.op.plan.domain.ProLine; +import com.op.plan.domain.ProRoute; +import com.op.plan.domain.ProShift; import com.op.plan.domain.dto.SplitOrderDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -138,13 +141,33 @@ public class ProOrderController extends BaseController { } /** - * 获取成型机 + * 通过订单物料号code查询对应工艺 + * @param prodCode + * @return + */ + @GetMapping(value = "/getProRoutes/{prodCode}") + public AjaxResult getProRoutes(@PathVariable("prodCode") String prodCode) { + return success(proOrderService.getProRoutes(prodCode)); + } + + /** + * 获取班次信息list * * @return */ - @GetMapping("/getProdLineShift") - public AjaxResult getProdLineShift(String type) { - return success(proOrderService.getProdLineShift(type)); + @GetMapping("/getProShifts") + public AjaxResult getProShifts() { + return success(proOrderService.getProShifts()); + } + + /** + * 通过工艺编码获取设备信息list + * @param routeCode + * @return + */ + @GetMapping(value = "/getProEquipment/{routeCode}") + public AjaxResult getProEquipment(@PathVariable("routeCode") String routeCode) { + return success(proOrderService.getProEquipment(routeCode)); } /** @@ -223,6 +246,7 @@ public class ProOrderController extends BaseController { /** * 同步SAP订单 + * * @param * @return */ @@ -231,6 +255,7 @@ public class ProOrderController extends BaseController { public AjaxResult syncSAP() { return proOrderService.syncSAP(); } + @Log(title = "自动同步SAP订单", businessType = BusinessType.INSERT) @PostMapping("/syncSAPOrders") public R syncSAPOrders() { 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 5e646888..a02e6770 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 @@ -55,7 +55,6 @@ public class ProOrderWorkorderController extends BaseController { /** * 校验工单是否可以修改 - * 如果工单已生成湿料计划则不允许修改 * * @return */ diff --git a/op-modules/op-plan/src/main/java/com/op/plan/domain/vo/LineAndShiftVo.java b/op-modules/op-plan/src/main/java/com/op/plan/domain/vo/LineAndShiftVo.java deleted file mode 100644 index 89c68526..00000000 --- a/op-modules/op-plan/src/main/java/com/op/plan/domain/vo/LineAndShiftVo.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.op.plan.domain.vo; - -import com.op.plan.domain.ProLine; -import com.op.plan.domain.ProRoute; -import com.op.plan.domain.ProShift; - -import java.util.List; - -// 返回工艺、成型机、班次VO -public class LineAndShiftVo { - // 成型机 - private List lines; - // 班次 - private List shifts; - // 工艺 - private List routes; - - public LineAndShiftVo(List lines, List shifts, List routes) { - this.lines = lines; - this.shifts = shifts; - this.routes = routes; - } - - public List getLines() { - return lines; - } - - public void setLines(List lines) { - this.lines = lines; - } - - public List getShifts() { - return shifts; - } - - public void setShifts(List shifts) { - this.shifts = shifts; - } - - public List getRoutes() { - return routes; - } - - public void setRoutes(List routes) { - this.routes = routes; - } - - @Override - public String toString() { - return "LineAndShiftVo{" + - "lines=" + lines + - ", shifts=" + shifts + - ", routes=" + routes + - '}'; - } - - public LineAndShiftVo() { - } -} diff --git a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderMapper.java b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderMapper.java index f025f1cb..d55dec19 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderMapper.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderMapper.java @@ -76,13 +76,6 @@ public interface ProOrderMapper { */ public int deleteProOrderByIds(String[] ids); - /** - * 获取成型机 - * - * @return - */ - public List selectProdLine(); - /** * 获取班次 * @@ -175,4 +168,18 @@ public interface ProOrderMapper { * @return */ public String selectChildProOrderCodeByCode(String orderCode); + + /** + * 通过工艺编码查询设备codes + * @param routeCode + * @return + */ + String selectEquipmentListByRouteCode(String routeCode); + + /** + * 通过设备code查询设备list + * @param codes + * @return + */ + List selectEquipment(String[] codes); } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProRouteMapper.java b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProRouteMapper.java index 38c2d97b..969fa105 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProRouteMapper.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProRouteMapper.java @@ -14,10 +14,11 @@ import java.util.List; */ @Mapper public interface ProRouteMapper { + /** - * 查询所有工艺信息list(不分页) - * + * 通过物料code查询工艺list + * @param itemCode * @return */ - List selectAllRoute(); + List selectRouteByItemCode(String itemCode); } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProWetMaterialPlanDetailMapper.java b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProWetMaterialPlanDetailMapper.java index 8a6991ff..02468a51 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProWetMaterialPlanDetailMapper.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProWetMaterialPlanDetailMapper.java @@ -1,6 +1,7 @@ package com.op.plan.mapper; +import com.op.plan.domain.ProOrderWorkorder; import com.op.plan.domain.ProWetMaterialPlan; import com.op.plan.domain.ProWetMaterialPlanDetail; import org.apache.ibatis.annotations.Mapper; @@ -95,4 +96,10 @@ public interface ProWetMaterialPlanDetailMapper { List selectWetPlanList(ProWetMaterialPlan proWetMaterialPlan); ProWetMaterialPlanDetail getWetInfo(String workorderId); + + /** + * 通过工单id删除湿料详情 + * @param workorderId + */ + void deleteProWetMaterialPlanDetailByWorkId(String workorderId); } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderService.java b/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderService.java index ef5d9475..47735c34 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderService.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderService.java @@ -4,10 +4,8 @@ import java.util.List; import com.op.common.core.domain.R; import com.op.common.core.web.domain.AjaxResult; -import com.op.plan.domain.Convert; -import com.op.plan.domain.ProOrder; +import com.op.plan.domain.*; import com.op.plan.domain.dto.SplitOrderDTO; -import com.op.plan.domain.vo.LineAndShiftVo; /** * 订单Service接口 @@ -17,13 +15,6 @@ import com.op.plan.domain.vo.LineAndShiftVo; */ public interface IProOrderService { - /** - * 获取成型机 - * - * @return - */ - public LineAndShiftVo getProdLineShift(String type); - /** * 查询订单 * @@ -122,4 +113,24 @@ public interface IProOrderService { AjaxResult importOrder(List orderList); R syncSAPOrders(); + + /** + * 获取班次信息list + * @return + */ + List getProShifts(); + + /** + * 通过订单物料code查询工艺list + * @param prodCode + * @return + */ + List getProRoutes(String prodCode); + + /** + * 通过工艺编码获取设备信息list + * @param routeCode + * @return + */ + List getProEquipment(String routeCode); } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderWorkorderService.java b/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderWorkorderService.java index f96b5a8b..4c6a69dc 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderWorkorderService.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderWorkorderService.java @@ -96,7 +96,6 @@ public interface IProOrderWorkorderService { /** * 校验工单是否可以修改 - * 如果工单已生成湿料计划则不允许修改 * * @return */ diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java index 7f78e5e7..e749a123 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java @@ -22,7 +22,6 @@ import com.op.common.security.utils.SecurityUtils; import com.op.plan.domain.*; import com.op.plan.domain.dto.ProOrderDTO; import com.op.plan.domain.dto.SplitOrderDTO; -import com.op.plan.domain.vo.LineAndShiftVo; import com.op.plan.mapper.*; import com.op.system.api.RemoteSapService; import com.op.system.api.RemoteUserService; @@ -482,6 +481,38 @@ public class ProOrderServiceImpl implements IProOrderService { return R.ok(true); } + /** + * 获取班次信息list + * @return + */ + @Override + @DS("#header.poolName") + public List getProShifts() { + return proOrderMapper.selectProShift(); + } + + /** + * 通过订单物料code查询工艺list + * @param prodCode + * @return + */ + @Override + @DS("#header.poolName") + public List getProRoutes(String prodCode) { + return proRouteMapper.selectRouteByItemCode(prodCode); + } + + /** + * 通过工艺编码获取设备信息list + * @param routeCode + * @return + */ + @Override + @DS("#header.poolName") + public List getProEquipment(String routeCode) { + return proOrderMapper.selectEquipment(proOrderMapper.selectEquipmentListByRouteCode(routeCode).split(",")); + } + public void getSAPOrderByFactory(String poolName) { DynamicDataSourceContextHolder.push(poolName);// 这是数据源的key SapProOrder sapqo = new SapProOrder();//proOrderMapper.getMaxCreatetime(); @@ -517,24 +548,6 @@ public class ProOrderServiceImpl implements IProOrderService { } } - /** - * 获取成型机 - * - * @return - */ - @Override - @DS("#header.poolName") - public LineAndShiftVo getProdLineShift(String type) { - if (type.equals("white")) { - LineAndShiftVo lineAndShiftVo = new LineAndShiftVo(proOrderMapper.selectProdLine(), - proOrderMapper.selectProShift(), proRouteMapper.selectAllRoute()); - return lineAndShiftVo; - } - LineAndShiftVo lineAndShiftVo = new LineAndShiftVo(proOrderMapper.selectPackageLine(), - proOrderMapper.selectProShift(), proRouteMapper.selectAllRoute()); - return lineAndShiftVo; - } - /** * 查询订单 * 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 21590aa1..05c19dee 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 @@ -450,6 +450,8 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { if (checkout){ // 删除所有工单s下的批次信息 int i = proOrderWorkorderBatchMapper.deleteProOrderWorkorderBatchByWorkorderIds(workorderIds); + // 删除湿料计划 + proWetMaterialPlanDetailMapper.deleteProWetMaterialPlanDetailByWorkId(proWorkOrder.getWorkorderId()); // 创建订单信息,并将信息copy进去 ProOrder proOrder = new ProOrder(); BeanUtils.copyProperties(splitOrderDTO.getProduct(),proOrder); @@ -537,9 +539,13 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { @Override @DS("#header.poolName") public AjaxResult checkWorkOrder(String id) { - ProWetMaterialPlanDetail proWetMaterialPlanDetail = proWetMaterialPlanDetailMapper.selectProWetMaterialPlanDetailByWorkId(id); - if (proWetMaterialPlanDetail != null){ - return error(500,"工单已有湿料计划!不可修改!"); + // 判断工单状态1.活动不可以2.已报工不可以 + ProOrderWorkorder proOrderWorkorder = proOrderWorkorderMapper.selectProOrderWorkorderByWorkorderId(id); + if (proOrderWorkorder.getStatus().equals("w2")) { + return error("工单处于活动状态!不可更改!"); + } + if (proOrderWorkorder.getStatus().equals("w3")) { + return error("工单处于报工状态!不可更改!"); } return success(); } 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 ea02f7da..59815104 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 @@ -80,12 +80,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where parent_order = #{orderCode} - - SELECT equipment_name AS 'prodLineName' FROM base_equipment - WHERE equipment_id = #{prodLineCode} + WHERE equipment_code = #{prodLineCode} + + + + insert into pro_order diff --git a/op-modules/op-plan/src/main/resources/mapper/plan/ProRouteMapper.xml b/op-modules/op-plan/src/main/resources/mapper/plan/ProRouteMapper.xml index 89f0835f..3976b7dd 100644 --- a/op-modules/op-plan/src/main/resources/mapper/plan/ProRouteMapper.xml +++ b/op-modules/op-plan/src/main/resources/mapper/plan/ProRouteMapper.xml @@ -24,10 +24,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + select pr.route_code,pr.route_name + from pro_route pr + INNER JOIN pro_route_product prp ON pr.route_id = prp.route_id + where prp.item_code = #{itemCode} and pr.enable_flag = 'Y' diff --git a/op-modules/op-plan/src/main/resources/mapper/plan/ProWetMaterialPlanDetailMapper.xml b/op-modules/op-plan/src/main/resources/mapper/plan/ProWetMaterialPlanDetailMapper.xml index 4dd7082b..55bdf74b 100644 --- a/op-modules/op-plan/src/main/resources/mapper/plan/ProWetMaterialPlanDetailMapper.xml +++ b/op-modules/op-plan/src/main/resources/mapper/plan/ProWetMaterialPlanDetailMapper.xml @@ -199,4 +199,8 @@ #{id} + + + delete from pro_wet_material_plan_detail where workorder_id = #{workorderId} +