Commit 81e4d4c8c78ab85cb152e48356de3ee7e008ab0c
1 parent
5e71560a
开始波次
Showing
2 changed files
with
90 additions
and
45 deletions
src/main/java/com/huaheng/pc/shipment/wave/controller/WaveController.java
@@ -15,6 +15,8 @@ import com.huaheng.framework.web.domain.AjaxResult; | @@ -15,6 +15,8 @@ import com.huaheng.framework.web.domain.AjaxResult; | ||
15 | import com.huaheng.framework.web.page.PageDomain; | 15 | import com.huaheng.framework.web.page.PageDomain; |
16 | import com.huaheng.framework.web.page.TableDataInfo; | 16 | import com.huaheng.framework.web.page.TableDataInfo; |
17 | import com.huaheng.framework.web.page.TableSupport; | 17 | import com.huaheng.framework.web.page.TableSupport; |
18 | +import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail; | ||
19 | +import com.huaheng.pc.shipment.shipmentDetail.service.ShipmentDetailService; | ||
18 | import com.huaheng.pc.shipment.wave.domain.Wave; | 20 | import com.huaheng.pc.shipment.wave.domain.Wave; |
19 | import com.huaheng.pc.shipment.wave.service.WaveService; | 21 | import com.huaheng.pc.shipment.wave.service.WaveService; |
20 | import io.swagger.annotations.Api; | 22 | import io.swagger.annotations.Api; |
@@ -43,6 +45,8 @@ public class WaveController extends BaseController { | @@ -43,6 +45,8 @@ public class WaveController extends BaseController { | ||
43 | 45 | ||
44 | @Autowired | 46 | @Autowired |
45 | private WaveService waveService; | 47 | private WaveService waveService; |
48 | + @Autowired | ||
49 | + private ShipmentDetailService shipmentDetailService; | ||
46 | 50 | ||
47 | @RequiresPermissions("shipment:wave:view") | 51 | @RequiresPermissions("shipment:wave:view") |
48 | @GetMapping() | 52 | @GetMapping() |
@@ -86,48 +90,48 @@ public class WaveController extends BaseController { | @@ -86,48 +90,48 @@ public class WaveController extends BaseController { | ||
86 | } | 90 | } |
87 | } | 91 | } |
88 | 92 | ||
89 | - /** | ||
90 | - * 新增波次 | ||
91 | - */ | ||
92 | - @GetMapping("/add") | ||
93 | - public String add() { | ||
94 | - return prefix + "/add"; | ||
95 | - } | ||
96 | - | ||
97 | - /** | ||
98 | - * 新增波次 | ||
99 | - */ | ||
100 | - @RequiresPermissions("shipment:wave:add") | ||
101 | - @Log(title = "出库-波次", operating = "新增波次", action = BusinessType.INSERT) | ||
102 | - @PostMapping("/add") | ||
103 | - @ResponseBody | ||
104 | - public AjaxResult addSave(Wave wave){ | ||
105 | - wave.setWarehouseCode(ShiroUtils.getWarehouseCode()); | ||
106 | - wave.setCreatedBy(ShiroUtils.getLoginName()); | ||
107 | - wave.setLastUpdatedBy(ShiroUtils.getLoginName()); | ||
108 | - return toAjax(waveService.save(wave)); | ||
109 | - } | ||
110 | - | ||
111 | - /** | ||
112 | - * 修改波次 | ||
113 | - */ | ||
114 | - @GetMapping("/edit/{id}") | ||
115 | - public String edit(@PathVariable("id") Integer id, ModelMap mmap) { | ||
116 | - mmap.put("wave", waveService.getById(id)); | ||
117 | - return prefix + "/edit"; | ||
118 | - } | ||
119 | - | ||
120 | - /** | ||
121 | - * 修改波次 | ||
122 | - */ | ||
123 | - @RequiresPermissions("shipment:wave:edit") | ||
124 | - @Log(title = "出库-波次", operating = "修改波次", action = BusinessType.UPDATE) | ||
125 | - @PostMapping("/edit") | ||
126 | - @ResponseBody | ||
127 | - public AjaxResult editSave(Wave wave) { | ||
128 | - wave.setLastUpdatedBy(ShiroUtils.getLoginName()); | ||
129 | - return toAjax(waveService.updateById(wave)); | ||
130 | - } | 93 | +// /** |
94 | +// * 新增波次 | ||
95 | +// */ | ||
96 | +// @GetMapping("/add") | ||
97 | +// public String add() { | ||
98 | +// return prefix + "/add"; | ||
99 | +// } | ||
100 | +// | ||
101 | +// /** | ||
102 | +// * 新增波次 | ||
103 | +// */ | ||
104 | +// @RequiresPermissions("shipment:wave:add") | ||
105 | +// @Log(title = "出库-波次", operating = "新增波次", action = BusinessType.INSERT) | ||
106 | +// @PostMapping("/add") | ||
107 | +// @ResponseBody | ||
108 | +// public AjaxResult addSave(Wave wave){ | ||
109 | +// wave.setWarehouseCode(ShiroUtils.getWarehouseCode()); | ||
110 | +// wave.setCreatedBy(ShiroUtils.getLoginName()); | ||
111 | +// wave.setLastUpdatedBy(ShiroUtils.getLoginName()); | ||
112 | +// return toAjax(waveService.save(wave)); | ||
113 | +// } | ||
114 | + | ||
115 | +// /** | ||
116 | +// * 修改波次 | ||
117 | +// */ | ||
118 | +// @GetMapping("/edit/{id}") | ||
119 | +// public String edit(@PathVariable("id") Integer id, ModelMap mmap) { | ||
120 | +// mmap.put("wave", waveService.getById(id)); | ||
121 | +// return prefix + "/edit"; | ||
122 | +// } | ||
123 | +// | ||
124 | +// /** | ||
125 | +// * 修改波次 | ||
126 | +// */ | ||
127 | +// @RequiresPermissions("shipment:wave:edit") | ||
128 | +// @Log(title = "出库-波次", operating = "修改波次", action = BusinessType.UPDATE) | ||
129 | +// @PostMapping("/edit") | ||
130 | +// @ResponseBody | ||
131 | +// public AjaxResult editSave(Wave wave) { | ||
132 | +// wave.setLastUpdatedBy(ShiroUtils.getLoginName()); | ||
133 | +// return toAjax(waveService.updateById(wave)); | ||
134 | +// } | ||
131 | 135 | ||
132 | /** | 136 | /** |
133 | * 删除波次 | 137 | * 删除波次 |
@@ -142,10 +146,28 @@ public class WaveController extends BaseController { | @@ -142,10 +146,28 @@ public class WaveController extends BaseController { | ||
142 | } | 146 | } |
143 | List<Integer> list = new ArrayList<>(); | 147 | List<Integer> list = new ArrayList<>(); |
144 | for (Integer id : Convert.toIntArray(ids)) { | 148 | for (Integer id : Convert.toIntArray(ids)) { |
149 | + LambdaQueryWrapper<ShipmentDetail> lam=Wrappers.lambdaQuery(); | ||
150 | + lam.eq(ShipmentDetail::getWarehouseCode,ShiroUtils.getWarehouseCode()) | ||
151 | + .eq(ShipmentDetail::getWaveId,id); | ||
152 | + List<ShipmentDetail> shipmentDetails=shipmentDetailService.list(lam); | ||
153 | + if(shipmentDetails !=null || shipmentDetails.size()>0){ | ||
154 | + return AjaxResult.error("id为"+ id +"的波次不能删除,有单据处于此波次中"); | ||
155 | + } | ||
145 | list.add(id); | 156 | list.add(id); |
146 | } | 157 | } |
147 | return toAjax(waveService.removeByIds(list)); | 158 | return toAjax(waveService.removeByIds(list)); |
148 | } | 159 | } |
149 | 160 | ||
161 | + /** | ||
162 | + * 开始波次 | ||
163 | + */ | ||
164 | + @RequiresPermissions("shipment:wave:startWave") | ||
165 | + @Log(title = "出库-波次", operating = "开始波次", action = BusinessType.UPDATE) | ||
166 | + @PostMapping("/startWave") | ||
167 | + @ResponseBody | ||
168 | + public AjaxResult editSave(Wave wave) { | ||
169 | + wave.setLastUpdatedBy(ShiroUtils.getLoginName()); | ||
170 | + return toAjax(waveService.updateById(wave)); | ||
171 | + } | ||
150 | 172 | ||
151 | } | 173 | } |
src/main/resources/templates/shipment/wave/wave.html
@@ -30,8 +30,14 @@ | @@ -30,8 +30,14 @@ | ||
30 | </form> | 30 | </form> |
31 | </div> | 31 | </div> |
32 | <div class="btn-group hidden-xs" id="toolbar" role="group"> | 32 | <div class="btn-group hidden-xs" id="toolbar" role="group"> |
33 | - <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" shiro:hasPermission="shipment:wave:add"> | ||
34 | - <i class="fa fa-plus"></i> 新增 | 33 | + <!--<a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" shiro:hasPermission="shipment:wave:add">--> |
34 | + <!--<i class="fa fa-plus"></i> 新增--> | ||
35 | + <!--</a>--> | ||
36 | + <a class="btn btn-outline btn-success btn-rounded" onclick="startWave()" shiro:hasPermission="shipment:wave:startWave"> | ||
37 | + <i class="fa fa-plus"></i> 开始波次 | ||
38 | + </a> | ||
39 | + <a class="btn btn-outline btn-success btn-rounded" onclick="freed()" shiro:hasPermission="shipment:wave:freed"> | ||
40 | + <i class="fa fa-plus"></i> 释放 | ||
35 | </a> | 41 | </a> |
36 | <a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.batRemove()" shiro:hasPermission="shipment:wave:remove"> | 42 | <a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.batRemove()" shiro:hasPermission="shipment:wave:remove"> |
37 | <i class="fa fa-trash-o"></i> 删除 | 43 | <i class="fa fa-trash-o"></i> 删除 |
@@ -200,7 +206,7 @@ | @@ -200,7 +206,7 @@ | ||
200 | align: 'center', | 206 | align: 'center', |
201 | formatter: function(value, row, index) { | 207 | formatter: function(value, row, index) { |
202 | var actions = []; | 208 | var actions = []; |
203 | - actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')" ><i class="fa fa-edit"></i>编辑</a> '); | 209 | + // actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')" ><i class="fa fa-edit"></i>编辑</a> '); |
204 | actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')" ><i class="fa fa-trash-o"></i>删除</a>'); | 210 | actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')" ><i class="fa fa-trash-o"></i>删除</a>'); |
205 | return actions.join(''); | 211 | return actions.join(''); |
206 | } | 212 | } |
@@ -208,6 +214,23 @@ | @@ -208,6 +214,23 @@ | ||
208 | }; | 214 | }; |
209 | $.table.init(options); | 215 | $.table.init(options); |
210 | }); | 216 | }); |
217 | + | ||
218 | + | ||
219 | + //开始波次 | ||
220 | + function startWave() { | ||
221 | + var rows = $("#bootstrap-table").bootstrapTable('getSelections'); | ||
222 | + if (rows.length == 0) { | ||
223 | + $.modal.alertWarning("请至少选择一条记录"); | ||
224 | + return; | ||
225 | + } | ||
226 | + var url = prefix + "/startWave"; | ||
227 | + var data = { | ||
228 | + "ids": rows.map(function (v) { | ||
229 | + return v.id; | ||
230 | + }).join(',') | ||
231 | + }; | ||
232 | + localSubmit(url, "post", "json", data); | ||
233 | + } | ||
211 | </script> | 234 | </script> |
212 | </body> | 235 | </body> |
213 | </html> | 236 | </html> |
214 | \ No newline at end of file | 237 | \ No newline at end of file |