春风项目四线(合箱线、总装线)
cl
2024-01-15 05d42506f6eda85cc93060b1b4d6b779061bf24a
提交 | 用户 | 时间
fd2207 1 package com.jcdm.main.om.productionOrde.controller;
2
3 import java.util.List;
4 import javax.servlet.http.HttpServletResponse;
05d425 5
C 6 import com.jcdm.main.bs.orderScheduling.domain.BsOrderScheduling;
7 import com.jcdm.main.bs.orderScheduling.service.IBsOrderSchedulingService;
fd2207 8 import com.jcdm.main.om.productionOrde.domain.OmProductionOrdeInfo;
9 import com.jcdm.main.om.productionOrde.service.IOmProductionOrdeInfoService;
df1f2b 10 import com.jcdm.main.webservice.service.ReceivingServices;
05d425 11 import org.apache.commons.lang3.StringUtils;
fd2207 12 import org.springframework.security.access.prepost.PreAuthorize;
13 import org.springframework.beans.factory.annotation.Autowired;
14 import org.springframework.web.bind.annotation.GetMapping;
15 import org.springframework.web.bind.annotation.PostMapping;
16 import org.springframework.web.bind.annotation.PutMapping;
17 import org.springframework.web.bind.annotation.DeleteMapping;
18 import org.springframework.web.bind.annotation.PathVariable;
19 import org.springframework.web.bind.annotation.RequestBody;
20 import org.springframework.web.bind.annotation.RequestMapping;
21 import org.springframework.web.bind.annotation.RestController;
22 import com.jcdm.common.annotation.Log;
23 import com.jcdm.common.core.controller.BaseController;
24 import com.jcdm.common.core.domain.AjaxResult;
25 import com.jcdm.common.enums.BusinessType;
26 import com.jcdm.common.utils.poi.ExcelUtil;
27 import com.jcdm.common.core.page.TableDataInfo;
28
29 /**
30  * 生产工单Controller
31  * 
32  * @author ruimin
33  * @date 2023-12-11
34  */
35 @RestController
36 @RequestMapping("/om/productionOrde")
37 public class OmProductionOrdeInfoController extends BaseController
38 {
39     @Autowired
40     private IOmProductionOrdeInfoService omProductionOrdeInfoService;
05d425 41
C 42     @Autowired
43     private IBsOrderSchedulingService bsOrderSchedulingService;
fd2207 44
45     /**
46      * 查询生产工单列表
47      */
48     @PreAuthorize("@ss.hasPermi('om:productionOrde:list')")
49     @GetMapping("/list")
50     public TableDataInfo list(OmProductionOrdeInfo omProductionOrdeInfo)
51     {
52         startPage();
53         List<OmProductionOrdeInfo> list = omProductionOrdeInfoService.selectOmProductionOrdeInfoList(omProductionOrdeInfo);
54         return getDataTable(list);
55     }
56
57     /**
58      * 导出生产工单列表
59      */
60     @PreAuthorize("@ss.hasPermi('om:productionOrde:export')")
61     @Log(title = "生产工单", businessType = BusinessType.EXPORT)
62     @PostMapping("/export")
63     public void export(HttpServletResponse response, OmProductionOrdeInfo omProductionOrdeInfo)
64     {
65         List<OmProductionOrdeInfo> list = omProductionOrdeInfoService.selectOmProductionOrdeInfoList(omProductionOrdeInfo);
66         ExcelUtil<OmProductionOrdeInfo> util = new ExcelUtil<OmProductionOrdeInfo>(OmProductionOrdeInfo.class);
67         util.exportExcel(response, list, "生产工单数据");
68     }
69
70     /**
71      * 获取生产工单详细信息
72      */
73     @PreAuthorize("@ss.hasPermi('om:productionOrde:query')")
74     @GetMapping(value = "/{id}")
75     public AjaxResult getInfo(@PathVariable("id") Long id)
76     {
77         return success(omProductionOrdeInfoService.selectOmProductionOrdeInfoById(id));
78     }
79
80     /**
81      * 新增生产工单
82      */
83     @PreAuthorize("@ss.hasPermi('om:productionOrde:add')")
84     @Log(title = "生产工单", businessType = BusinessType.INSERT)
85     @PostMapping
86     public AjaxResult add(@RequestBody OmProductionOrdeInfo omProductionOrdeInfo)
87     {
88         return toAjax(omProductionOrdeInfoService.insertOmProductionOrdeInfo(omProductionOrdeInfo));
89     }
90
91     /**
05d425 92      * 新增生产工单
C 93      */
94     @PostMapping("/orderSchedulingForBoxCode")
95     public AjaxResult addOrderSchedulingForBoxCode(@RequestBody OmProductionOrdeInfo omProductionOrdeInfo)
96     {
97         Integer startCode = Integer.parseInt(omProductionOrdeInfo.getStartCode());//开始编号
98         Integer planQty = Math.toIntExact(omProductionOrdeInfo.getPlanQty());//计划数量
99         String dateTimeRule = omProductionOrdeInfo.getDateTimeRule();
100
101         for(int i=0;i<planQty;i++){
102             BsOrderScheduling bsOrderScheduling = new BsOrderScheduling();
103             bsOrderScheduling.setOrderNo(omProductionOrdeInfo.getWorkOrderNo());
104             bsOrderScheduling.setModel(omProductionOrdeInfo.getTypeZ());
105             bsOrderScheduling.setEngineNo(omProductionOrdeInfo.getTypeZ() + " "+dateTimeRule+ StringUtils.leftPad(String.valueOf(startCode),3, "0"));
106             bsOrderScheduling.setStatus("1");
107             bsOrderSchedulingService.insertBsOrderScheduling(bsOrderScheduling);
108             startCode ++;
109         }
110
111         omProductionOrdeInfo.setOrderStatus("2");//更新工单状态
112         return toAjax(omProductionOrdeInfoService.updateOmProductionOrdeInfo(omProductionOrdeInfo));
113     }
114
115     /**
fd2207 116      * 修改生产工单
117      */
118     @PreAuthorize("@ss.hasPermi('om:productionOrde:edit')")
119     @Log(title = "生产工单", businessType = BusinessType.UPDATE)
120     @PutMapping
121     public AjaxResult edit(@RequestBody OmProductionOrdeInfo omProductionOrdeInfo)
122     {
123         return toAjax(omProductionOrdeInfoService.updateOmProductionOrdeInfo(omProductionOrdeInfo));
124     }
125
126     /**
127      * 删除生产工单
128      */
129     @PreAuthorize("@ss.hasPermi('om:productionOrde:remove')")
130     @Log(title = "生产工单", businessType = BusinessType.DELETE)
131     @DeleteMapping("/{ids}")
132     public AjaxResult remove(@PathVariable Long[] ids)
133     {
134         return toAjax(omProductionOrdeInfoService.deleteOmProductionOrdeInfoByIds(ids));
135     }
136
137     /**
138      * table列上移下移
139      */
140     @Log(title = "生产工单", businessType = BusinessType.DELETE)
141     @GetMapping("/upDownMove")
142     public AjaxResult upDownMove(OmProductionOrdeInfo omProductionOrdeInfo)
143     {
144         return omProductionOrdeInfoService.upDownMove(omProductionOrdeInfo);
145     }
df1f2b 146
147     /**
148      * table列上移下移
149      */
150     @GetMapping("/getProductionNotice")
151     public AjaxResult getProductionNotice(OmProductionOrdeInfo omProductionOrdeInfo)
152     {
153         ReceivingServices.insertWebserviceData(omProductionOrdeInfo.getProductionNotice());
154         return AjaxResult.success();
155     }
fd2207 156 }