懒羊羊
2024-04-08 42cfe3f13b09d8b06935fb371fe327387292abc9
提交 | 用户 | 时间
e57a89 1 package com.jcdm.main.om.productionOrde.controller;
2
42cfe3 3 import java.util.ArrayList;
4 import java.util.Date;
e57a89 5 import java.util.List;
6 import javax.servlet.http.HttpServletResponse;
0ce25f 7
W 8 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
42cfe3 9 import com.jcdm.common.core.domain.entity.SysUser;
10 import com.jcdm.common.core.domain.model.LoginUser;
11 import com.jcdm.common.utils.ServletUtils;
e57a89 12 import com.jcdm.main.om.productionOrde.domain.OmProductionOrdeInfo;
42cfe3 13 import com.jcdm.main.om.productionOrde.domain.OmProductionOrdeInfoExcelImport;
e57a89 14 import com.jcdm.main.om.productionOrde.service.IOmProductionOrdeInfoService;
15 import org.springframework.security.access.prepost.PreAuthorize;
16 import org.springframework.beans.factory.annotation.Autowired;
17 import org.springframework.web.bind.annotation.GetMapping;
18 import org.springframework.web.bind.annotation.PostMapping;
19 import org.springframework.web.bind.annotation.PutMapping;
20 import org.springframework.web.bind.annotation.DeleteMapping;
21 import org.springframework.web.bind.annotation.PathVariable;
22 import org.springframework.web.bind.annotation.RequestBody;
23 import org.springframework.web.bind.annotation.RequestMapping;
24 import org.springframework.web.bind.annotation.RestController;
25 import com.jcdm.common.annotation.Log;
26 import com.jcdm.common.core.controller.BaseController;
27 import com.jcdm.common.core.domain.AjaxResult;
28 import com.jcdm.common.enums.BusinessType;
29 import com.jcdm.common.utils.poi.ExcelUtil;
30 import com.jcdm.common.core.page.TableDataInfo;
42cfe3 31 import org.springframework.web.multipart.MultipartFile;
e57a89 32
33 /**
34  * 生产工单Controller
35  * 
36  * @author ruimin
37  * @date 2023-12-11
38  */
39 @RestController
40 @RequestMapping("/om/productionOrde")
41 public class OmProductionOrdeInfoController extends BaseController
42 {
43     @Autowired
44     private IOmProductionOrdeInfoService omProductionOrdeInfoService;
45
46     /**
47      * 查询生产工单列表
48      */
49     @PreAuthorize("@ss.hasPermi('om:productionOrde:list')")
50     @GetMapping("/list")
51     public TableDataInfo list(OmProductionOrdeInfo omProductionOrdeInfo)
52     {
53         startPage();
0ce25f 54 //        List<OmProductionOrdeInfo> list = omProductionOrdeInfoService.list(new LambdaQueryWrapper<OmProductionOrdeInfo>().eq(OmProductionOrdeInfo::getWorkOrderNo, "W_202403120001"));
e57a89 55         List<OmProductionOrdeInfo> list = omProductionOrdeInfoService.selectOmProductionOrdeInfoList(omProductionOrdeInfo);
56         return getDataTable(list);
57     }
58
59     /**
60      * 导出生产工单列表
61      */
62     @PreAuthorize("@ss.hasPermi('om:productionOrde:export')")
63     @Log(title = "生产工单", businessType = BusinessType.EXPORT)
64     @PostMapping("/export")
65     public void export(HttpServletResponse response, OmProductionOrdeInfo omProductionOrdeInfo)
66     {
67         List<OmProductionOrdeInfo> list = omProductionOrdeInfoService.selectOmProductionOrdeInfoList(omProductionOrdeInfo);
68         ExcelUtil<OmProductionOrdeInfo> util = new ExcelUtil<OmProductionOrdeInfo>(OmProductionOrdeInfo.class);
69         util.exportExcel(response, list, "生产工单数据");
70     }
71
72     /**
73      * 获取生产工单详细信息
74      */
75     @PreAuthorize("@ss.hasPermi('om:productionOrde:query')")
76     @GetMapping(value = "/{id}")
77     public AjaxResult getInfo(@PathVariable("id") Long id)
78     {
79         return success(omProductionOrdeInfoService.selectOmProductionOrdeInfoById(id));
80     }
81
82     /**
83      * 新增生产工单
84      */
85     @PreAuthorize("@ss.hasPermi('om:productionOrde:add')")
86     @Log(title = "生产工单", businessType = BusinessType.INSERT)
87     @PostMapping
88     public AjaxResult add(@RequestBody OmProductionOrdeInfo omProductionOrdeInfo)
89     {
90         return toAjax(omProductionOrdeInfoService.insertOmProductionOrdeInfo(omProductionOrdeInfo));
91     }
92
93     /**
94      * 修改生产工单
95      */
96     @PreAuthorize("@ss.hasPermi('om:productionOrde:edit')")
97     @Log(title = "生产工单", businessType = BusinessType.UPDATE)
98     @PutMapping
99     public AjaxResult edit(@RequestBody OmProductionOrdeInfo omProductionOrdeInfo)
100     {
101         return toAjax(omProductionOrdeInfoService.updateOmProductionOrdeInfo(omProductionOrdeInfo));
102     }
103
104     /**
105      * 删除生产工单
106      */
107     @PreAuthorize("@ss.hasPermi('om:productionOrde:remove')")
108     @Log(title = "生产工单", businessType = BusinessType.DELETE)
109     @DeleteMapping("/{ids}")
110     public AjaxResult remove(@PathVariable Long[] ids)
111     {
112         return toAjax(omProductionOrdeInfoService.deleteOmProductionOrdeInfoByIds(ids));
113     }
114
115     /**
116      * table列上移下移
117      */
118     @Log(title = "生产工单", businessType = BusinessType.DELETE)
119     @GetMapping("/upDownMove")
120     public AjaxResult upDownMove(OmProductionOrdeInfo omProductionOrdeInfo)
121     {
122         return omProductionOrdeInfoService.upDownMove(omProductionOrdeInfo);
123     }
42cfe3 124
125     @PostMapping("/importData")
126     public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
127     {
128         ExcelUtil<OmProductionOrdeInfo> util = new ExcelUtil<OmProductionOrdeInfo>(OmProductionOrdeInfo.class);
129         List<OmProductionOrdeInfo> ordeInfo = util.importExcel(file.getInputStream());
130         for (OmProductionOrdeInfo omProductionOrdeInfo : ordeInfo) {
131             omProductionOrdeInfo.setCreateTime(new Date());
132             omProductionOrdeInfo.setCreateBy("工厂MES");
133         }
134         omProductionOrdeInfoService.overrideSaveBatch(ordeInfo);
135         return AjaxResult.success();
136     }
137
138     @PostMapping("/importTemplate")
139     public void importTemplate(HttpServletResponse response)
140     {
141         ExcelUtil<OmProductionOrdeInfoExcelImport> util = new ExcelUtil<OmProductionOrdeInfoExcelImport>(OmProductionOrdeInfoExcelImport.class);
142         util.importTemplateExcel(response, "订单数据");
143     }
e57a89 144 }