Commit 1a7134524f530ee63befbddb211e1765b3387395

Authored by xqs
2 parents 39fb88b3 36f99e0c

Merge branch 'develop' of http://172.16.29.40:8010/wms/wms2 into develop

src/main/java/com/huaheng/pc/config/materialType/service/MaterialTypeService.java
1 1 package com.huaheng.pc.config.materialType.service;
2 2  
  3 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
3 5 import org.springframework.stereotype.Service;
4 6 import javax.annotation.Resource;
5 7 import java.util.List;
  8 +import java.util.Map;
  9 +
6 10 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7 11 import com.huaheng.pc.config.materialType.domain.MaterialType;
8 12 import com.huaheng.pc.config.materialType.mapper.MaterialTypeMapper;
9   -@Service
  13 +@Service("materialType")
10 14 public class MaterialTypeService extends ServiceImpl<MaterialTypeMapper, MaterialType> {
11 15  
  16 + public List<Map<String, Object>> queryType(){
  17 + LambdaQueryWrapper<MaterialType> lambda = Wrappers.lambdaQuery();
  18 + lambda.select(MaterialType::getCode, MaterialType::getName);
  19 + return this.listMaps(lambda);
  20 + }
12 21 }
... ...
src/main/java/com/huaheng/pc/shipment/shipmentDetail/service/ShipmentDetailServiceImpl.java
... ... @@ -151,7 +151,12 @@ public class ShipmentDetailServiceImpl extends ServiceImpl&lt;ShipmentDetailMapper,
151 151 }
152 152  
153 153  
154   - //选中的单据加入波次
  154 + /**
  155 + * 选中的单据加入波次
  156 + * 根据选中的主单ID和波次主表的code,判断主单之和是否符合波次的限制条件,
  157 + * 看此code的波次是否建成未开始执行,如果是则只需修改波次属性,否则创建新的波次,
  158 + * 修改加入波次的子单,修改子单和主单的状态,并修改子单的waveId
  159 + */
155 160 @Override
156 161 @Transactional
157 162 public void saveWave(String ids, String code) {
... ... @@ -228,14 +233,29 @@ public class ShipmentDetailServiceImpl extends ServiceImpl&lt;ShipmentDetailMapper,
228 233 }
229 234 }
230 235  
231   - //修改出库子单
  236 + //修改出库子单,加入波次ID,并修改状态为波次
232 237 for(ShipmentDetail shipmentDetail :shipmentDetailList){
233 238 shipmentDetail.setWaveId(wave.getId());
  239 + shipmentDetail.setStatus(200);
234 240 }
235 241  
236 242 flag = this.updateBatchById(shipmentDetailList);
237 243 if(flag == false){
238 244 throw new ServiceException("出库子单加入波次失败");
239 245 }
  246 +
  247 + List<ShipmentHeader> shipmentHeaderList=new ArrayList<>();
  248 + //修改主单状态
  249 + for (Integer id : Convert.toIntArray(ids)){
  250 + ShipmentHeader shipmentHeader = shipmentHeaderService.getById(id);
  251 + shipmentHeader.setFirstStatus(200);
  252 + shipmentHeader.setLastStatus(200);
  253 + shipmentHeaderList.add(shipmentHeader);
  254 + }
  255 + flag = shipmentHeaderService.updateBatchById(shipmentHeaderList);
  256 + if(flag == false){
  257 + throw new ServiceException("修改主单状态失败");
  258 + }
  259 +
240 260 }
241 261 }
... ...
src/main/java/com/huaheng/pc/shipment/shipmentHeader/controller/ShipmentHeaderController.java
... ... @@ -272,6 +272,7 @@ public class ShipmentHeaderController extends BaseController
272 272 }
273 273  
274 274 shipmentDetailService.saveWave(ids,code);
  275 +
275 276 return AjaxResult.success("加入波次成功");
276 277 }
277 278  
... ...
src/main/java/com/huaheng/pc/shipment/wave/controller/WaveController.java
... ... @@ -173,4 +173,20 @@ public class WaveController extends BaseController {
173 173 return result;
174 174 }
175 175  
  176 +
  177 + /**
  178 + * 开始波次
  179 + */
  180 + @RequiresPermissions("shipment:wave:freed")
  181 + @Log(title = "出库-波次", operating = "开始波次", action = BusinessType.UPDATE)
  182 + @PostMapping("/freed")
  183 + @ResponseBody
  184 + public AjaxResult freed(String ids) {
  185 + if (StringUtils.isEmpty(ids)){
  186 + return AjaxResult.error("id不能为空");
  187 + }
  188 + AjaxResult result=waveService.freed(ids);
  189 + return result;
  190 + }
  191 +
176 192 }
... ...
src/main/java/com/huaheng/pc/shipment/wave/service/WaveService.java
... ... @@ -3,6 +3,7 @@ package com.huaheng.pc.shipment.wave.service;
3 3 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 4 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
5 5 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  6 +import com.huaheng.common.exception.service.ServiceException;
6 7 import com.huaheng.common.support.Convert;
7 8 import com.huaheng.common.utils.security.ShiroUtils;
8 9 import com.huaheng.framework.web.domain.AjaxResult;
... ... @@ -28,12 +29,28 @@ public class WaveService extends ServiceImpl&lt;WaveMapper, Wave&gt; {
28 29 @Autowired
29 30 private ShipmentContainerHeaderService shipmentContainerHeaderService;
30 31  
31   - //开始波次,对带有此波次号的单据进行后续的后台操作
  32 + /**
  33 + * 开始波次,对带有此波次号的单据进行后续的后台操作
  34 + * 1、查看波次是否符合开始波次的条件
  35 + * 2、整合波次的所有子单单据
  36 + * 3、对每个单据自动组盘,失败则回退
  37 + * 4、生成任务
  38 + * 5、修改波次的状态
  39 + */
32 40  
33 41 @Transactional
34 42 public AjaxResult startWave(String ids) {
  43 + List<Wave> waves = new ArrayList<>();
35 44 List<ShipmentDetail> list = new ArrayList<>();
36 45 for (Integer id : Convert.toIntArray(ids)) {
  46 +
  47 + //查看此波次的状态,状态不为o时,无法开始波次
  48 + Wave wave = this.getById(id);
  49 + if(wave == null || wave.getStatus() != 0){
  50 + return AjaxResult.error("id为"+id+"的波次找不到,或者状态不能做开始操作");
  51 + }
  52 + waves.add(wave);
  53 +
37 54 //找到此波次的单据
38 55 LambdaQueryWrapper<ShipmentDetail> lam = Wrappers.lambdaQuery();
39 56 lam.eq(ShipmentDetail::getWaveId,id)
... ... @@ -52,6 +69,27 @@ public class WaveService extends ServiceImpl&lt;WaveMapper, Wave&gt; {
52 69 //生成任务
53 70 shipmentContainerHeaderService.createTask(Arrays.asList(Convert.toIntArray(ajaxResult.getData().toString())));
54 71 }
  72 +
  73 + for(Wave wave : waves){
  74 + wave.setStatus(400);
  75 + wave.setCurrentWaveStep("生成任务");
  76 + }
  77 + Boolean flag = this.updateBatchById(waves);
  78 + if(flag == false){
  79 + throw new ServiceException("波次运行失败,修改波次状态时报错");
  80 + }
55 81 return AjaxResult.success("波次运行成功");
56 82 }
  83 +
  84 +
  85 + /**
  86 + * 释放波次,执行任务
  87 + * @param ids
  88 + * @return
  89 + */
  90 + @Transactional
  91 + public AjaxResult freed(String ids) {
  92 +
  93 + return null;
  94 + }
57 95 }
... ...
src/main/resources/static/huaheng/js/huahengUI.js
... ... @@ -29,7 +29,7 @@
29 29 pageList: [10, 25, 50], // 可供选择的每页的行数(*)
30 30 iconSize: 'outline', // 图标大小:undefined默认的按钮尺寸 xs超小按钮sm小按钮lg大按钮
31 31 toolbar: '#toolbar', // 指定工作栏
32   - sidePagination: "server", // 启用服务端分页
  32 + sidePagination: "server", // 启用服务端分页
33 33 search: $.common.visible(options.search), // 是否显示搜索框功能
34 34 showRefresh: $.common.visible(options.showRefresh), // 是否显示刷新按钮
35 35 showColumns: $.common.visible(options.showColumns), // 是否显示隐藏某列下拉框
... ...
src/main/resources/templates/config/material/add.html
... ... @@ -40,8 +40,8 @@
40 40 <div class="form-group">
41 41 <label class="col-sm-3 control-label">物料类别:</label>
42 42 <div class="col-sm-8">
43   - <select id="type" name="type" class="form-control" th:with="materialType=${@dict.getType('materialType')}">
44   - <option th:each="item : ${materialType}" th:text="${item['dictLabel']}" th:value="${item['dictValue']}"></option>
  43 + <select id="type" name="type" class="form-control" th:with="materialType=${@materialType.queryType()}">
  44 + <option th:each="item : ${materialType}" th:text="${item['name']}" th:value="${item['code']}"></option>
45 45 </select>
46 46 </div>
47 47 </div>
... ...
src/main/resources/templates/config/material/edit.html
... ... @@ -35,9 +35,8 @@
35 35 <div class="form-group">
36 36 <label class="col-sm-3 control-label">物料类别:</label>
37 37 <div class="col-sm-8">
38   - <select id="type" name="type" class="form-control" th:with="materialType=${@dict.getType('materialType')}">
39   - <option th:each="item : ${materialType}" th:text="${item['dictLabel']}" th:value="${item['dictValue']}"
40   - th:field="*{type}"></option>
  38 + <select id="type" name="type" class="form-control" th:with="materialType=${@materialType.queryType()}" th:field="*{type}">
  39 + <option th:each="item : ${materialType}" th:text="${item['name']}" th:value="${item['code']}"></option>
41 40 </select>
42 41 </div>
43 42 </div>
... ...
src/main/resources/templates/config/material/material.html
... ... @@ -66,7 +66,7 @@
66 66 var removeFlag = [[${@permission.hasPermi('config:material:remove')}]];
67 67 var prefix = ctx + "config/material";
68 68 var datas = [[${@dict.getType('sys_normal_disable')}]];
69   - var mType = [[${@dict.getType('materialType')}]];
  69 + var mType = [[${@materialType.queryType()}]];
70 70 $(function() {
71 71 var options = {
72 72 url: prefix + "/list",
... ... @@ -95,7 +95,14 @@
95 95 title : '物料类别' ,
96 96 align: 'center',
97 97 formatter: function(value, row, index) {
98   - return $.table.selectDictLabel(mType, value);
  98 + var actions = [];
  99 + $.each(mType, function(index, dict) {
  100 + if (dict.code == value) {
  101 + actions.push("<span class='badge badge-" + dict.code + "'>" + dict.name + "</span>");
  102 + return false;
  103 + }
  104 + });
  105 + return actions.join('');
99 106 }
100 107 },
101 108 {
... ...
src/main/resources/templates/config/statusFlowHeader/add.html
... ... @@ -20,7 +20,9 @@
20 20 <div class="form-group">
21 21 <label class="col-sm-3 control-label">模块:</label>
22 22 <div class="col-sm-8">
23   - <input id="moduleType" name="moduleType" class="form-control" type="text">
  23 + <select id="moduleType" name="moduleType" class="form-control" th:with="moduleTyped=${@dict.getType('moduleType')}">
  24 + <option th:each="item : ${moduleType}" th:text="${item['dictLabel']}" th:value="${item['dictValue']}"></option>
  25 + </select>
24 26 </div>
25 27 </div>
26 28 <div class="form-group">
... ...
src/main/resources/templates/config/statusFlowHeader/edit.html
... ... @@ -21,7 +21,9 @@
21 21 <div class="form-group">
22 22 <label class="col-sm-3 control-label">模块:</label>
23 23 <div class="col-sm-8">
24   - <input id="moduleType" name="moduleType" class="form-control" type="text" th:field="*{moduleType}">
  24 + <select id="moduleType" name="moduleType" class="form-control" th:with="moduleTyped=${@dict.getType('moduleType')}" th:field="*{moduleType}">
  25 + <option th:each="item : ${moduleType}" th:text="${item['dictLabel']}" th:value="${item['dictValue']}"></option>
  26 + </select>
25 27 </div>
26 28 </div>
27 29 <div class="form-group">
... ...
src/main/resources/templates/shipment/wave/wave.html
... ... @@ -231,6 +231,23 @@
231 231 };
232 232 localSubmit(url, "post", "json", data);
233 233 }
  234 +
  235 +
  236 + //释放
  237 + function freed() {
  238 + var rows = $("#bootstrap-table").bootstrapTable('getSelections');
  239 + if (rows.length == 0) {
  240 + $.modal.alertWarning("请至少选择一条记录");
  241 + return;
  242 + }
  243 + var url = prefix + "/freed";
  244 + var data = {
  245 + "ids": rows.map(function (v) {
  246 + return v.id;
  247 + }).join(',')
  248 + };
  249 + localSubmit(url, "post", "json", data);
  250 + }
234 251 </script>
235 252 </body>
236 253 </html>
237 254 \ No newline at end of file
... ...
src/main/resources/templates/system/dict/data/data.html
... ... @@ -146,7 +146,12 @@
146 146  
147 147 function queryParams(params) {
148 148 return {
149   - dictType: $("#dictType").val()
  149 + dictType: $("#dictType").val(),
  150 + pageSize: params.limit,
  151 + pageNum: params.offset / params.limit + 1,
  152 + searchValue: params.search,
  153 + orderByColumn: params.sort,
  154 + isAsc: params.order
150 155 };
151 156 }
152 157  
... ...