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