提交 | 用户 | 时间
|
fd2207
|
1 |
package com.jcdm.main.om.productionOrde.controller; |
懒 |
2 |
|
64e175
|
3 |
import java.text.SimpleDateFormat; |
懒 |
4 |
import java.time.LocalDateTime; |
|
5 |
import java.time.format.DateTimeFormatter; |
f11989
|
6 |
import java.util.Date; |
fd2207
|
7 |
import java.util.List; |
懒 |
8 |
import javax.servlet.http.HttpServletResponse; |
05d425
|
9 |
|
749044
|
10 |
import com.jcdm.main.bs.modelNumber.domain.BsModelNumber; |
C |
11 |
import com.jcdm.main.bs.modelNumber.service.IBsModelNumberService; |
05d425
|
12 |
import com.jcdm.main.bs.orderScheduling.domain.BsOrderScheduling; |
C |
13 |
import com.jcdm.main.bs.orderScheduling.service.IBsOrderSchedulingService; |
fd2207
|
14 |
import com.jcdm.main.om.productionOrde.domain.OmProductionOrdeInfo; |
懒 |
15 |
import com.jcdm.main.om.productionOrde.service.IOmProductionOrdeInfoService; |
df1f2b
|
16 |
import com.jcdm.main.webservice.service.ReceivingServices; |
05d425
|
17 |
import org.apache.commons.lang3.StringUtils; |
fd2207
|
18 |
import org.springframework.security.access.prepost.PreAuthorize; |
懒 |
19 |
import org.springframework.beans.factory.annotation.Autowired; |
|
20 |
import org.springframework.web.bind.annotation.GetMapping; |
|
21 |
import org.springframework.web.bind.annotation.PostMapping; |
|
22 |
import org.springframework.web.bind.annotation.PutMapping; |
|
23 |
import org.springframework.web.bind.annotation.DeleteMapping; |
|
24 |
import org.springframework.web.bind.annotation.PathVariable; |
|
25 |
import org.springframework.web.bind.annotation.RequestBody; |
|
26 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
27 |
import org.springframework.web.bind.annotation.RestController; |
|
28 |
import com.jcdm.common.annotation.Log; |
|
29 |
import com.jcdm.common.core.controller.BaseController; |
|
30 |
import com.jcdm.common.core.domain.AjaxResult; |
|
31 |
import com.jcdm.common.enums.BusinessType; |
|
32 |
import com.jcdm.common.utils.poi.ExcelUtil; |
|
33 |
import com.jcdm.common.core.page.TableDataInfo; |
f11989
|
34 |
|
懒 |
35 |
import static org.apache.commons.lang3.SystemUtils.getUserName; |
fd2207
|
36 |
|
懒 |
37 |
/** |
|
38 |
* 生产工单Controller |
|
39 |
* |
|
40 |
* @author ruimin |
|
41 |
* @date 2023-12-11 |
|
42 |
*/ |
|
43 |
@RestController |
|
44 |
@RequestMapping("/om/productionOrde") |
|
45 |
public class OmProductionOrdeInfoController extends BaseController |
|
46 |
{ |
|
47 |
@Autowired |
|
48 |
private IOmProductionOrdeInfoService omProductionOrdeInfoService; |
05d425
|
49 |
|
C |
50 |
@Autowired |
|
51 |
private IBsOrderSchedulingService bsOrderSchedulingService; |
749044
|
52 |
|
C |
53 |
@Autowired |
|
54 |
private IBsModelNumberService bsModelNumberService; |
fd2207
|
55 |
|
懒 |
56 |
/** |
|
57 |
* 查询生产工单列表 |
|
58 |
*/ |
|
59 |
@PreAuthorize("@ss.hasPermi('om:productionOrde:list')") |
|
60 |
@GetMapping("/list") |
|
61 |
public TableDataInfo list(OmProductionOrdeInfo omProductionOrdeInfo) |
|
62 |
{ |
|
63 |
startPage(); |
|
64 |
List<OmProductionOrdeInfo> list = omProductionOrdeInfoService.selectOmProductionOrdeInfoList(omProductionOrdeInfo); |
|
65 |
return getDataTable(list); |
|
66 |
} |
|
67 |
|
|
68 |
/** |
|
69 |
* 导出生产工单列表 |
|
70 |
*/ |
|
71 |
@PreAuthorize("@ss.hasPermi('om:productionOrde:export')") |
|
72 |
@Log(title = "生产工单", businessType = BusinessType.EXPORT) |
|
73 |
@PostMapping("/export") |
|
74 |
public void export(HttpServletResponse response, OmProductionOrdeInfo omProductionOrdeInfo) |
|
75 |
{ |
|
76 |
List<OmProductionOrdeInfo> list = omProductionOrdeInfoService.selectOmProductionOrdeInfoList(omProductionOrdeInfo); |
|
77 |
ExcelUtil<OmProductionOrdeInfo> util = new ExcelUtil<OmProductionOrdeInfo>(OmProductionOrdeInfo.class); |
|
78 |
util.exportExcel(response, list, "生产工单数据"); |
|
79 |
} |
|
80 |
|
|
81 |
/** |
|
82 |
* 获取生产工单详细信息 |
|
83 |
*/ |
|
84 |
@PreAuthorize("@ss.hasPermi('om:productionOrde:query')") |
|
85 |
@GetMapping(value = "/{id}") |
|
86 |
public AjaxResult getInfo(@PathVariable("id") Long id) |
|
87 |
{ |
|
88 |
return success(omProductionOrdeInfoService.selectOmProductionOrdeInfoById(id)); |
|
89 |
} |
|
90 |
|
|
91 |
/** |
|
92 |
* 新增生产工单 |
|
93 |
*/ |
|
94 |
@PreAuthorize("@ss.hasPermi('om:productionOrde:add')") |
|
95 |
@Log(title = "生产工单", businessType = BusinessType.INSERT) |
|
96 |
@PostMapping |
|
97 |
public AjaxResult add(@RequestBody OmProductionOrdeInfo omProductionOrdeInfo) |
|
98 |
{ |
|
99 |
return toAjax(omProductionOrdeInfoService.insertOmProductionOrdeInfo(omProductionOrdeInfo)); |
|
100 |
} |
|
101 |
|
|
102 |
/** |
05d425
|
103 |
* 新增生产工单 |
C |
104 |
*/ |
|
105 |
@PostMapping("/orderSchedulingForBoxCode") |
|
106 |
public AjaxResult addOrderSchedulingForBoxCode(@RequestBody OmProductionOrdeInfo omProductionOrdeInfo) |
|
107 |
{ |
64e175
|
108 |
//获取当前时间 |
懒 |
109 |
LocalDateTime date= LocalDateTime.now(); |
|
110 |
//创建日期时间对象格式化器,日期格式类似: 2023-05-23 22:18:38 |
|
111 |
DateTimeFormatter formatter= DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
|
112 |
//将时间转化为对应格式的字符串 |
|
113 |
String fomateDate=date.format(formatter).toString(); |
749044
|
114 |
|
C |
115 |
|
05d425
|
116 |
Integer startCode = Integer.parseInt(omProductionOrdeInfo.getStartCode());//开始编号 |
C |
117 |
Integer planQty = Math.toIntExact(omProductionOrdeInfo.getPlanQty());//计划数量 |
|
118 |
String dateTimeRule = omProductionOrdeInfo.getDateTimeRule(); |
|
119 |
|
749044
|
120 |
String engineNo = ""; |
C |
121 |
if(planQty>0) { |
|
122 |
for (int i = 0; i < planQty; i++) { |
|
123 |
engineNo = omProductionOrdeInfo.getTypeZ() + " " + dateTimeRule + StringUtils.leftPad(String.valueOf(startCode), 3, "0"); |
|
124 |
BsOrderScheduling bsOrderScheduling = new BsOrderScheduling(); |
|
125 |
bsOrderScheduling.setOrderNo(omProductionOrdeInfo.getWorkOrderNo()); |
|
126 |
bsOrderScheduling.setModel(omProductionOrdeInfo.getTypeZ()); |
|
127 |
bsOrderScheduling.setEngineNo(engineNo); |
|
128 |
bsOrderScheduling.setProductionStatus("1"); |
|
129 |
bsOrderScheduling.setOperator(getUserName()); |
|
130 |
bsOrderScheduling.setOperateTime(fomateDate); |
a5f938
|
131 |
bsOrderScheduling.setProductType(omProductionOrdeInfo.getTypeL());//产品类型 |
40126d
|
132 |
bsOrderScheduling.setWhetherOrPrint("0"); |
749044
|
133 |
bsOrderSchedulingService.insertBsOrderScheduling(bsOrderScheduling); |
C |
134 |
startCode++; |
|
135 |
} |
05d425
|
136 |
|
749044
|
137 |
//新增机型序号 |
C |
138 |
BsModelNumber bsModelNumber = new BsModelNumber(); |
|
139 |
bsModelNumber.setModel(omProductionOrdeInfo.getTypeZ()); |
|
140 |
bsModelNumber.setModelDate(dateTimeRule); |
|
141 |
bsModelNumber.setMaxnumValue((startCode - 1) + ""); |
|
142 |
bsModelNumber.setSaveTime(fomateDate); |
a5f938
|
143 |
bsModelNumber.setLastNumber((startCode - 1) + ""); |
749044
|
144 |
bsModelNumberService.insertBsModelNumber(bsModelNumber); |
C |
145 |
} |
|
146 |
//更新工单状态 |
|
147 |
omProductionOrdeInfo.setOrderStatus("2"); |
05d425
|
148 |
return toAjax(omProductionOrdeInfoService.updateOmProductionOrdeInfo(omProductionOrdeInfo)); |
749044
|
149 |
|
C |
150 |
|
05d425
|
151 |
} |
C |
152 |
|
|
153 |
/** |
fd2207
|
154 |
* 修改生产工单 |
懒 |
155 |
*/ |
|
156 |
@PreAuthorize("@ss.hasPermi('om:productionOrde:edit')") |
|
157 |
@Log(title = "生产工单", businessType = BusinessType.UPDATE) |
|
158 |
@PutMapping |
|
159 |
public AjaxResult edit(@RequestBody OmProductionOrdeInfo omProductionOrdeInfo) |
|
160 |
{ |
|
161 |
return toAjax(omProductionOrdeInfoService.updateOmProductionOrdeInfo(omProductionOrdeInfo)); |
|
162 |
} |
|
163 |
|
|
164 |
/** |
|
165 |
* 删除生产工单 |
|
166 |
*/ |
|
167 |
@PreAuthorize("@ss.hasPermi('om:productionOrde:remove')") |
|
168 |
@Log(title = "生产工单", businessType = BusinessType.DELETE) |
|
169 |
@DeleteMapping("/{ids}") |
|
170 |
public AjaxResult remove(@PathVariable Long[] ids) |
|
171 |
{ |
|
172 |
return toAjax(omProductionOrdeInfoService.deleteOmProductionOrdeInfoByIds(ids)); |
|
173 |
} |
|
174 |
|
|
175 |
/** |
|
176 |
* table列上移下移 |
|
177 |
*/ |
|
178 |
@Log(title = "生产工单", businessType = BusinessType.DELETE) |
|
179 |
@GetMapping("/upDownMove") |
|
180 |
public AjaxResult upDownMove(OmProductionOrdeInfo omProductionOrdeInfo) |
|
181 |
{ |
|
182 |
return omProductionOrdeInfoService.upDownMove(omProductionOrdeInfo); |
|
183 |
} |
df1f2b
|
184 |
|
懒 |
185 |
/** |
1391b3
|
186 |
* 接收工单 |
df1f2b
|
187 |
*/ |
1391b3
|
188 |
@PreAuthorize("@ss.hasPermi('om:productionOrde:receive')") |
df1f2b
|
189 |
@GetMapping("/getProductionNotice") |
懒 |
190 |
public AjaxResult getProductionNotice(OmProductionOrdeInfo omProductionOrdeInfo) |
|
191 |
{ |
5f7e70
|
192 |
String productionNotice = omProductionOrdeInfo.getProductionNotice(); |
懒 |
193 |
List<OmProductionOrdeInfo> omProductionOrdeInfos = omProductionOrdeInfoService.selectOmProductionOrdeInfoList(omProductionOrdeInfo); |
|
194 |
if(omProductionOrdeInfos.size() == 0){ |
|
195 |
try { |
|
196 |
ReceivingServices.insertWebserviceData(productionNotice); |
|
197 |
} catch (Exception e) { |
|
198 |
return error("接收失败!请检查通知单号"); |
|
199 |
} |
1de44b
|
200 |
}else { |
e4f64a
|
201 |
return warn("该通知单已经接收完毕,不能重复接收!"); |
5f7e70
|
202 |
} |
1de44b
|
203 |
return AjaxResult.success("接收成功!"); |
df1f2b
|
204 |
} |
fd2207
|
205 |
} |