-
懒羊羊
2024-03-29 0caf8761b4af8163a691ebb56723286926529ee4
提交 | 用户 | 时间
e57a89 1 package com.jcdm.main.bs.formulaChild.controller;
2
3 import java.util.List;
4 import javax.servlet.http.HttpServletResponse;
0caf87 5
6 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
e57a89 7 import org.springframework.security.access.prepost.PreAuthorize;
8 import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.web.bind.annotation.GetMapping;
10 import org.springframework.web.bind.annotation.PostMapping;
11 import org.springframework.web.bind.annotation.PutMapping;
12 import org.springframework.web.bind.annotation.DeleteMapping;
13 import org.springframework.web.bind.annotation.PathVariable;
14 import org.springframework.web.bind.annotation.RequestBody;
15 import org.springframework.web.bind.annotation.RequestMapping;
16 import org.springframework.web.bind.annotation.RestController;
17 import com.jcdm.common.annotation.Log;
18 import com.jcdm.common.core.controller.BaseController;
19 import com.jcdm.common.core.domain.AjaxResult;
20 import com.jcdm.common.enums.BusinessType;
21 import com.jcdm.main.bs.formulaChild.domain.BsFormulaChildInfo;
22 import com.jcdm.main.bs.formulaChild.service.IBsFormulaChildInfoService;
23 import com.jcdm.common.utils.poi.ExcelUtil;
24 import com.jcdm.common.core.page.TableDataInfo;
25
26 /**
27  * 配方配置子信息Controller
28  * 
29  * @author ruimin
30  * @date 2023-12-26
31  */
32 @RestController
33 @RequestMapping("/bs/formulaChild")
34 public class BsFormulaChildInfoController extends BaseController
35 {
36     @Autowired
37     private IBsFormulaChildInfoService bsFormulaChildInfoService;
38
39     /**
40      * 查询配方配置子信息列表
41      */
0caf87 42     @GetMapping("/noPageListFormulaChild")
43     public TableDataInfo noPageListFormulaChild(BsFormulaChildInfo bsFormulaChildInfo)
44     {
45         List<BsFormulaChildInfo> list = bsFormulaChildInfoService.list(new LambdaQueryWrapper<BsFormulaChildInfo>()
46                 .eq(BsFormulaChildInfo::getProductCode,bsFormulaChildInfo.getProductCode())
47                 .eq(BsFormulaChildInfo::getProcessesCode,bsFormulaChildInfo.getProcessesCode()));
48         for (BsFormulaChildInfo formulaChildInfo : list) {
49 //            formulaChildInfo.setSort(formulaChildInfo.getStepSort());
50 //            formulaChildInfo.setAddress(formulaChildInfo.getTechRequirement());
51 //            formulaChildInfo.setImg(formulaChildInfo.getOperationSteps());
52             if(formulaChildInfo.getCollectData()!=null&& !"".equals(formulaChildInfo.getCollectData())){
53                 if(formulaChildInfo.getCollectData().contains("[")){
54                     String data = formulaChildInfo.getCollectData();
55                     data = data.replace("[", "").replace("]", "").replace(" ", "");
56                     String[] tightenDataParts = data.split(",");
57                     formulaChildInfo.setCollectData("扭矩"+tightenDataParts[0]+"角度"+tightenDataParts[1]+"扭矩结果"+tightenDataParts[2]+"角度结果"+tightenDataParts[3]);
58                 }
59             }
60         }
61         return getDataTable(list);
62     }
63
64     /**
65      * 查询配方配置子信息列表
66      */
e57a89 67     @PreAuthorize("@ss.hasPermi('bs:formulaChild:list')")
68     @GetMapping("/list")
69     public TableDataInfo list(BsFormulaChildInfo bsFormulaChildInfo)
70     {
71         startPage();
72         List<BsFormulaChildInfo> list = bsFormulaChildInfoService.selectBsFormulaChildInfoList(bsFormulaChildInfo);
73         for (BsFormulaChildInfo formulaChildInfo : list) {
74             formulaChildInfo.setSort(formulaChildInfo.getStepSort());
75             formulaChildInfo.setAddress(formulaChildInfo.getTechRequirement());
76             formulaChildInfo.setImg(formulaChildInfo.getOperationSteps());
b77303 77             if(formulaChildInfo.getCollectData()!=null&& !"".equals(formulaChildInfo.getCollectData())){
78                 if(formulaChildInfo.getCollectData().contains("[")){
79                     String data = formulaChildInfo.getCollectData();
80                     data = data.replace("[", "").replace("]", "").replace(" ", "");
81                     String[] tightenDataParts = data.split(",");
82                     formulaChildInfo.setCollectData("扭矩"+tightenDataParts[0]+"角度"+tightenDataParts[1]+"扭矩结果"+tightenDataParts[2]+"角度结果"+tightenDataParts[3]);
83                 }
84             }
e57a89 85         }
86         return getDataTable(list);
87     }
88
b77303 89 //    /**
90 //     * 检查是否可以放行
91 //     */
92 //    @GetMapping("/releaseCheck")
93 //    public AjaxResult releaseCheck(BsFormulaChildInfo bsFormulaChildInfo)
94 //    {
95 //        List<BsFormulaChildInfo> i = bsFormulaChildInfoService.releaseCheck(bsFormulaChildInfo);
96 //        return AjaxResult.success(i.size());
97 //    }
e57a89 98
99     /**
100      * 扫码确认
101      */
102     @GetMapping("/updateResults")
103     public AjaxResult updateResults(BsFormulaChildInfo bsFormulaChildInfo)
104     {
105         return bsFormulaChildInfoService.updateResults(bsFormulaChildInfo);
106     }
107
108     /**
109      * 放行请空状态
110      */
111     @GetMapping("/workpieceRelease")
112     public AjaxResult workpieceRelease(BsFormulaChildInfo bsFormulaChildInfo)
113     {
114         return bsFormulaChildInfoService.workpieceRelease(bsFormulaChildInfo);
115     }
116
117     /**
b77303 118      * 拧紧后更新对应数据
119      */
120     @GetMapping("/updateTighteningFormula")
121     public AjaxResult updateTighteningFormula(BsFormulaChildInfo bsFormulaChildInfo)
122     {
123         return bsFormulaChildInfoService.updateTighteningFormula(bsFormulaChildInfo);
124     }
125
126     /**
e57a89 127      * 导出配方配置子信息列表
128      */
129     @PreAuthorize("@ss.hasPermi('bs:formulaChild:export')")
130     @Log(title = "配方配置子信息", businessType = BusinessType.EXPORT)
131     @PostMapping("/export")
132     public void export(HttpServletResponse response, BsFormulaChildInfo bsFormulaChildInfo)
133     {
134         List<BsFormulaChildInfo> list = bsFormulaChildInfoService.selectBsFormulaChildInfoList(bsFormulaChildInfo);
135         ExcelUtil<BsFormulaChildInfo> util = new ExcelUtil<BsFormulaChildInfo>(BsFormulaChildInfo.class);
136         util.exportExcel(response, list, "配方配置子信息数据");
137     }
138
139     /**
140      * 获取配方配置子信息详细信息
141      */
142     @PreAuthorize("@ss.hasPermi('bs:formulaChild:query')")
143     @GetMapping(value = "/{id}")
144     public AjaxResult getInfo(@PathVariable("id") Long id)
145     {
146         return success(bsFormulaChildInfoService.selectBsFormulaChildInfoById(id));
147     }
148
149     /**
150      * 新增配方配置子信息
151      */
152     @PreAuthorize("@ss.hasPermi('bs:formulaChild:add')")
153     @Log(title = "配方配置子信息", businessType = BusinessType.INSERT)
154     @PostMapping
155     public AjaxResult add(@RequestBody BsFormulaChildInfo bsFormulaChildInfo)
156     {
157         return toAjax(bsFormulaChildInfoService.insertBsFormulaChildInfo(bsFormulaChildInfo));
158     }
159
160     /**
161      * 修改配方配置子信息
162      */
163     @PreAuthorize("@ss.hasPermi('bs:formulaChild:edit')")
164     @Log(title = "配方配置子信息", businessType = BusinessType.UPDATE)
165     @PutMapping
166     public AjaxResult edit(@RequestBody BsFormulaChildInfo bsFormulaChildInfo)
167     {
168         return toAjax(bsFormulaChildInfoService.updateBsFormulaChildInfo(bsFormulaChildInfo));
169     }
170
171     /**
172      * 删除配方配置子信息
173      */
174     @PreAuthorize("@ss.hasPermi('bs:formulaChild:remove')")
175     @Log(title = "配方配置子信息", businessType = BusinessType.DELETE)
176     @DeleteMapping("/{ids}")
177     public AjaxResult remove(@PathVariable Long[] ids)
178     {
179         return toAjax(bsFormulaChildInfoService.deleteBsFormulaChildInfoByIds(ids));
180     }
181 }