懒羊羊
2023-10-17 5d91e0a52879bf16511817b3cd20496f07717ab1
提交 | 用户 | 时间
1ac2bc 1 package cn.stylefeng.guns.modular.zsx.pm.salesOrderChild.controller;
2
3 import cn.stylefeng.guns.base.auth.context.LoginContextHolder;
4 import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
5 import cn.stylefeng.guns.modular.zsx.pm.salesOrder.entity.SalesOrder;
6 import cn.stylefeng.guns.modular.zsx.pm.salesOrder.service.SalesOrderService;
7 import cn.stylefeng.guns.modular.zsx.pm.salesOrderChild.entity.SalesOrderChild;
8 import cn.stylefeng.guns.modular.zsx.pm.salesOrderChild.model.params.SalesOrderChildParam;
9 import cn.stylefeng.guns.modular.zsx.pm.salesOrderChild.service.SalesOrderChildService;
10 import cn.stylefeng.roses.core.base.controller.BaseController;
11 import cn.stylefeng.roses.kernel.model.response.ResponseData;
12 import cn.stylefeng.roses.core.mutidatasource.annotion.DataSource;
13 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
14 import org.springframework.beans.factory.annotation.Autowired;
15 import org.springframework.stereotype.Controller;
16 import org.springframework.web.bind.annotation.RequestMapping;
17 import org.springframework.web.bind.annotation.ResponseBody;
18
19 import java.util.Date;
20
21
22 /**
23  * 生产订单拆分表控制器
24  *
25  * @author ruimin
26  * @Date 2023-08-29 09:17:56
27  */
28 @Controller
29 @RequestMapping("/salesOrderChild")
30 public class SalesOrderChildController extends BaseController {
31
32     private String PREFIX = "/modular/pm/salesOrderChild";
33
34     @Autowired
35     private SalesOrderChildService salesOrderChildService;
36
37     @Autowired
38     private SalesOrderService salesOrderService;
39
40
41     /**
42      * 跳转到主页面
43      *
44      * @author ruimin
45      * @Date 2023-08-29
46      */
47     @RequestMapping("")
48     public String index() {
49         return PREFIX + "/salesOrderChild.html";
50     }
51
52     /**
53      * 新增页面
54      *
55      * @author ruimin
56      * @Date 2023-08-29
57      */
58     @RequestMapping("/add")
59     public String add() {
60         return PREFIX + "/salesOrderChild_add.html";
61     }
62
63     /**
64      * 编辑页面
65      *
66      * @author ruimin
67      * @Date 2023-08-29
68      */
69     @RequestMapping("/edit")
70     public String edit() {
71         return PREFIX + "/salesOrderChild_edit.html";
72     }
73
74     /**
75      * 新增接口
76      *
77      * @author ruimin
78      * @Date 2023-08-29
79      */
80     @RequestMapping("/addItem")
81     @ResponseBody
82     @DataSource(name = "self")
83     public ResponseData addItem(SalesOrderChildParam salesOrderChildParam) {
84         SalesOrder salesOrderCode = salesOrderService.getOne(new QueryWrapper<SalesOrder>().eq("sales_order_code", salesOrderChildParam.getSalesOrderCode()));
85         salesOrderChildParam.setCustomerNo(salesOrderCode.getCustomerNo());
86         salesOrderChildParam.setCargoNo(salesOrderCode.getCargoNo());
87         salesOrderChildParam.setProductCode(salesOrderCode.getProductCode());
88         salesOrderChildParam.setProductName(salesOrderCode.getProductName());
89         salesOrderChildParam.setPlanNumber(salesOrderChildParam.getSplitNumber());
90         salesOrderChildParam.setPlanStartTime(salesOrderCode.getPlanStartTime());
91         salesOrderChildParam.setPlanEndTime(salesOrderCode.getPlanEndTime());
92         salesOrderChildParam.setWorkshopCode(salesOrderCode.getWorkshopCode());
93         salesOrderChildParam.setLineCode(salesOrderCode.getLineCode());
94         salesOrderChildParam.setDeliveryTime(salesOrderCode.getDeliveryTime());
95         salesOrderChildParam.setCreateTime(new Date());
96         salesOrderChildParam.setCreateUser(LoginContextHolder.getContext().getUser().getName());
97         this.salesOrderChildService.add(salesOrderChildParam);
98         return ResponseData.success();
99     }
100
101     /**
102      * 编辑接口
103      *
104      * @author ruimin
105      * @Date 2023-08-29
106      */
107     @RequestMapping("/editItem")
108     @ResponseBody
109     @DataSource(name = "self")
110     public ResponseData editItem(SalesOrderChildParam salesOrderChildParam) {
111         this.salesOrderChildService.update(salesOrderChildParam);
112         return ResponseData.success();
113     }
114
115     /**
116      * 删除接口
117      *
118      * @author ruimin
119      * @Date 2023-08-29
120      */
121     @RequestMapping("/delete")
122     @ResponseBody
123     @DataSource(name = "self")
124     public ResponseData delete(SalesOrderChildParam salesOrderChildParam) {
125         this.salesOrderChildService.delete(salesOrderChildParam);
126         return ResponseData.success();
127     }
128
129     /**
130      * 查看详情接口
131      *
132      * @author ruimin
133      * @Date 2023-08-29
134      */
135     @RequestMapping("/detail")
136     @ResponseBody
137     @DataSource(name = "self")
138     public ResponseData detail(SalesOrderChildParam salesOrderChildParam) {
139         SalesOrderChild detail = this.salesOrderChildService.getById(salesOrderChildParam.getId());
140         return ResponseData.success(detail);
141     }
142
143     /**
144      * 查询列表
145      *
146      * @author ruimin
147      * @Date 2023-08-29
148      */
149     @ResponseBody
150     @RequestMapping("/list")
151     @DataSource(name = "self")
152     public LayuiPageInfo list(SalesOrderChildParam salesOrderChildParam) {
153         return this.salesOrderChildService.findPageBySpec(salesOrderChildParam);
154     }
155
156     /**
157      * 查询列表
158      *
159      * @author ruimin
160      * @Date 2023-08-29
161      */
162     @ResponseBody
163     @RequestMapping("/deleteBySalesOrderCode")
164     @DataSource(name = "self")
165     public ResponseData deleteBySalesOrderCode(SalesOrderChildParam salesOrderChildParam) {
166         salesOrderChildService.remove(new QueryWrapper<SalesOrderChild>().eq("sales_order_code", salesOrderChildParam.getSalesOrderCode()));
167         return ResponseData.success();
168     }
169
170     /**
171      * 查询列表
172      *
173      * @author ruimin
174      * @Date 2023-08-29
175      */
176     @ResponseBody
177     @RequestMapping("/getPlanNumberTotal")
178     @DataSource(name = "self")
179     public ResponseData getPlanNumberTotal(SalesOrderChildParam salesOrderChildParam) {
180         Integer i = salesOrderChildService.getPlanNumberTotal(salesOrderChildParam);
181         return ResponseData.success(i);
182     }
183
184 }
185
186