懒羊羊
2024-01-10 1b72fc0dd1d7004de54ab0886e0323cb1b96198d
提交 | 用户 | 时间
71e81e 1 package cn.stylefeng.guns.modular.om.productionOrderBatchInfo.controller;
2
3 import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
4 import cn.stylefeng.guns.modular.om.productionOrderBatchInfo.entity.ProductionOrderBatchInfo;
5 import cn.stylefeng.guns.modular.om.productionOrderBatchInfo.model.params.ProductionOrderBatchInfoParam;
6 import cn.stylefeng.guns.modular.om.productionOrderBatchInfo.service.ProductionOrderBatchInfoService;
7 import cn.stylefeng.roses.core.base.controller.BaseController;
8 import cn.stylefeng.roses.kernel.model.response.ResponseData;
9 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
a55627 10 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
71e81e 11 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.stereotype.Controller;
13 import org.springframework.web.bind.annotation.RequestMapping;
14 import org.springframework.web.bind.annotation.ResponseBody;
15
16 import java.util.List;
17
18
19 /**
20  * 工单批次上料信息控制器
21  *
22  * @author ruimin
23  * @Date 2023-02-24 10:47:39
24  */
25 @Controller
26 @RequestMapping("/productionOrderBatchInfo")
27 public class ProductionOrderBatchInfoController extends BaseController {
28
29     private String PREFIX = "modular/om/productionOrderBatchInfo";
30
31     @Autowired
32     private ProductionOrderBatchInfoService productionOrderBatchInfoService;
33
34     /**
35      * 跳转到主页面
36      *
37      * @author ruimin
38      * @Date 2023-02-24
39      */
40     @RequestMapping("")
41     public String index() {
42         return PREFIX + "/productionOrderBatchInfo.html";
43     }
44
45     /**
46      * 新增页面
47      *
48      * @author ruimin
49      * @Date 2023-02-24
50      */
51     @RequestMapping("/add")
52     public String add() {
53         return PREFIX + "/productionOrderBatchInfo_add.html";
54     }
55
56     /**
57      * 编辑页面
58      *
59      * @author ruimin
60      * @Date 2023-02-24
61      */
62     @RequestMapping("/edit")
63     public String edit() {
64         return PREFIX + "/productionOrderBatchInfo_edit.html";
65     }
66
67     /**
68      * 新增接口
69      *
70      * @author ruimin
71      * @Date 2023-02-24
72      */
73     @RequestMapping("/addItem")
74     @ResponseBody
75     public ResponseData addItem(ProductionOrderBatchInfoParam productionOrderBatchInfoParam) {
76         this.productionOrderBatchInfoService.add(productionOrderBatchInfoParam);
77         return ResponseData.success();
78     }
79
80     /**
81      * 编辑接口
82      *
83      * @author ruimin
84      * @Date 2023-02-24
85      */
86     @RequestMapping("/editItem")
87     @ResponseBody
88     public ResponseData editItem(ProductionOrderBatchInfoParam productionOrderBatchInfoParam) {
89         this.productionOrderBatchInfoService.update(productionOrderBatchInfoParam);
90         return ResponseData.success();
91     }
92
93     /**
94      * 删除接口
95      *
96      * @author ruimin
97      * @Date 2023-02-24
98      */
99     @RequestMapping("/delete")
100     @ResponseBody
101     public ResponseData delete(ProductionOrderBatchInfoParam productionOrderBatchInfoParam) {
102         this.productionOrderBatchInfoService.delete(productionOrderBatchInfoParam);
103         return ResponseData.success();
104     }
105
106     /**
107      * 查看详情接口
108      *
109      * @author ruimin
110      * @Date 2023-02-24
111      */
112     @RequestMapping("/detail")
113     @ResponseBody
114     public ResponseData detail(ProductionOrderBatchInfoParam productionOrderBatchInfoParam) {
115         ProductionOrderBatchInfo detail = this.productionOrderBatchInfoService.getById(productionOrderBatchInfoParam.getId());
116         return ResponseData.success(detail);
117     }
118
119     /**
120      * 查询列表
121      *
122      * @author ruimin
123      * @Date 2023-02-24
124      */
125     @ResponseBody
126     @RequestMapping("/list")
127     public LayuiPageInfo list(ProductionOrderBatchInfoParam productionOrderBatchInfoParam) {
128         return this.productionOrderBatchInfoService.findPageBySpec(productionOrderBatchInfoParam);
129     }
130
131     @ResponseBody
132     @RequestMapping("/boardList")
133     public ResponseData boardList(ProductionOrderBatchInfoParam productionOrderBatchInfoParam) {
a55627 134         productionOrderBatchInfoService.findPageBySpec(productionOrderBatchInfoParam);
71e81e 135         List<ProductionOrderBatchInfo> list = productionOrderBatchInfoService.list(new QueryWrapper<ProductionOrderBatchInfo>()
136                 .eq("work_order_no", productionOrderBatchInfoParam.getWorkOrderNo())
a55627 137                 .isNotNull("location_code")
71e81e 138         );
139         return ResponseData.success(0,null,list);
140     }
141
142     @ResponseBody
143     @RequestMapping("/barCodeCheck")
144     public ResponseData barCodeCheck(ProductionOrderBatchInfoParam productionOrderBatchInfoParam) {
145         int i = productionOrderBatchInfoService.barCodeCheck(productionOrderBatchInfoParam);
146         return ResponseData.success(i);
147     }
148
149     @ResponseBody
150     @RequestMapping("/updateState")
151     public ResponseData updateState(ProductionOrderBatchInfoParam productionOrderBatchInfoParam) {
152         this.productionOrderBatchInfoService.updateState(productionOrderBatchInfoParam);
153         return ResponseData.success();
154     }
155
a55627 156     @ResponseBody
157     @RequestMapping("/checkLocationCode")
158     public ResponseData checkLocationCode(ProductionOrderBatchInfoParam productionOrderBatchInfoParam) {
159         List<ProductionOrderBatchInfo> list = productionOrderBatchInfoService.list(new QueryWrapper<ProductionOrderBatchInfo>()
160                 .eq("material_code", productionOrderBatchInfoParam.getMaterialCode())
161                 .eq("work_order_no", productionOrderBatchInfoParam.getWorkOrderNo())
162                 .isNotNull("location_code")
163                 .eq("state", "否")
164         );
165         return ResponseData.success(list.size());
166     }
167
168     @ResponseBody
169     @RequestMapping("/updateOrderBatchInfo")
170     public ResponseData updateOrderBatchInfo(ProductionOrderBatchInfoParam productionOrderBatchInfoParam) {
1b72fc 171         List<ProductionOrderBatchInfo> checkLocationCodeList = getCheckLocationCodeList(productionOrderBatchInfoParam);
172         ProductionOrderBatchInfo batchInfo = checkLocationCodeList.get(0);
173         ProductionOrderBatchInfo byId = productionOrderBatchInfoService.getById(batchInfo.getId());
174         byId.setSpareField1(productionOrderBatchInfoParam.getSpareField1());
175         if(batchInfo.getState().equals("是")){
176             if(!productionOrderBatchInfoParam.getLoadingCode().equals(batchInfo.getLoadingCode())){
177                 return  ResponseData.success("0");
178             }else {
179                 Integer count1 = Integer.parseInt(productionOrderBatchInfoParam.getSpareField1())+Integer.parseInt(batchInfo.getSpareField1());
180                 byId.setSpareField1(count1.toString());
181             }
182         }
a55627 183         byId.setState("是");
184         byId.setLoadingCode(productionOrderBatchInfoParam.getLoadingCode());
1b72fc 185         productionOrderBatchInfoService.saveOrUpdate(byId);
186         return ResponseData.success("1");
187     }
188
189     @ResponseBody
190     @RequestMapping("/resetting")
191     public ResponseData resetting(ProductionOrderBatchInfoParam productionOrderBatchInfoParam) {
192         ProductionOrderBatchInfo byId = productionOrderBatchInfoService.getById(productionOrderBatchInfoParam.getId());
193         byId.setState("否");
194         byId.setSpareField1("0");
195         byId.setLoadingCode("");
a55627 196         productionOrderBatchInfoService.saveOrUpdate(byId);
197         return ResponseData.success();
198     }
199
200     public List<ProductionOrderBatchInfo> getCheckLocationCodeList(ProductionOrderBatchInfoParam productionOrderBatchInfoParam){
201         List<ProductionOrderBatchInfo> list = productionOrderBatchInfoService.list(new QueryWrapper<ProductionOrderBatchInfo>()
202                 .eq("material_code", productionOrderBatchInfoParam.getMaterialCode())
203                 .eq("work_order_no", productionOrderBatchInfoParam.getWorkOrderNo())
204                 .isNotNull("location_code")
205         );
206         return list;
207     }
71e81e 208 }
209
210