Commit baddd6ae109644d11030badb13f45b1f9ec9ef31

Authored by pengcheng
1 parent 459ec5d0

修改界面以及删除物料如果有库存无法删除的修改

src/main/java/com/huaheng/pc/config/material/controller/MaterialController.java
... ... @@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 4 import com.baomidou.mybatisplus.core.metadata.IPage;
5 5 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
6 6 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  7 +import com.huaheng.common.exception.service.ServiceException;
  8 +import com.huaheng.common.support.Convert;
7 9 import com.huaheng.common.utils.StringUtils;
8 10 import com.huaheng.common.utils.poi.ExcelUtil;
9 11 import com.huaheng.common.utils.security.ShiroUtils;
... ... @@ -16,6 +18,8 @@ import com.huaheng.framework.web.page.TableDataInfo;
16 18 import com.huaheng.framework.web.page.TableSupport;
17 19 import com.huaheng.pc.config.material.domain.Material;
18 20 import com.huaheng.pc.config.material.service.MaterialService;
  21 +import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail;
  22 +import com.huaheng.pc.inventory.inventoryDetail.service.InventoryDetailService;
19 23 import io.swagger.annotations.Api;
20 24 import io.swagger.annotations.ApiOperation;
21 25 import io.swagger.annotations.ApiParam;
... ... @@ -37,6 +41,8 @@ public class MaterialController extends BaseController {
37 41  
38 42 @Resource
39 43 private MaterialService materialService;
  44 + @Resource
  45 + private InventoryDetailService inventoryDetailService;
40 46  
41 47 @RequiresPermissions("config:material:view")
42 48 @GetMapping()
... ... @@ -66,7 +72,7 @@ public class MaterialController extends BaseController {
66 72 lambda.gt(StringUtils.isNotEmpty(createdBegin), Material::getCreated, createdBegin)
67 73 .lt(StringUtils.isNotEmpty(createdEnd), Material::getCreated, createdEnd)
68 74 .eq(StringUtils.isNotEmpty(material.getCode()), Material::getCode, material.getCode())
69   - .eq(StringUtils.isNotEmpty(material.getName()), Material::getName, material.getName())
  75 + .like(StringUtils.isNotEmpty(material.getName()), Material::getName, material.getName())
70 76 .eq(StringUtils.isNotEmpty(material.getType()), Material::getType, material.getType())
71 77 .like(StringUtils.isNotEmpty(material.getSpec()), Material::getSpec, material.getSpec())
72 78 .eq(Material::getWarehouseCode, ShiroUtils.getWarehouseCode())
... ... @@ -139,6 +145,16 @@ public class MaterialController extends BaseController {
139 145 if (StringUtils.isEmpty(ids)){
140 146 return AjaxResult.error("id不能为空");
141 147 } else {
  148 + for(Integer id :Convert.toIntArray(ids)){
  149 + Material material = materialService.getById(id);
  150 + LambdaQueryWrapper<InventoryDetail> lamb = Wrappers.lambdaQuery();
  151 + lamb.eq(InventoryDetail::getWarehouseCode,ShiroUtils.getWarehouseCode())
  152 + .eq(InventoryDetail::getMaterialCode,material.getCode());
  153 + List<InventoryDetail> inventoryDetails = inventoryDetailService.list(lamb);
  154 + if(inventoryDetails != null || inventoryDetails.size() > 0){
  155 + throw new ServiceException("id为"+id+"的物料有库存");
  156 + }
  157 + }
142 158 return materialService.removeByIds(ids);
143 159 }
144 160 }
... ...
src/main/java/com/huaheng/pc/config/materialType/controller/MaterialTypeController.java
... ... @@ -71,7 +71,7 @@ public class MaterialTypeController extends BaseController {
71 71 .eq(MaterialType::getWarehouseCode, ShiroUtils.getWarehouseCode())
72 72 .eq(StringUtils.isNotEmpty(materialType.getCode()),
73 73 MaterialType::getCode, materialType.getCode())
74   - .eq(StringUtils.isNotEmpty(materialType.getName()), MaterialType::getName, materialType.getName());
  74 + .like(StringUtils.isNotEmpty(materialType.getName()), MaterialType::getName, materialType.getName());
75 75  
76 76 if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){
77 77 /**
... ...
src/main/java/com/huaheng/pc/config/statusFlow/service/StatusFlowHeaderService.java
... ... @@ -26,6 +26,7 @@ public class StatusFlowHeaderService extends ServiceImpl&lt;StatusFlowHeaderMapper,
26 26 public List<Map<String, Object>> flowList(String recordType){
27 27 LambdaQueryWrapper<StatusFlowHeader> lambda = Wrappers.lambdaQuery();
28 28 lambda.select(StatusFlowHeader::getCode, StatusFlowHeader::getName)
  29 + .eq(StatusFlowHeader::getWarehouseCode,ShiroUtils.getWarehouseCode())
29 30 .eq(StatusFlowHeader::getRecordType, recordType);
30 31 return this.listMaps(lambda);
31 32 }
... ...
src/main/resources/templates/config/material/add.html
... ... @@ -60,7 +60,7 @@
60 60 <div class="form-group">
61 61 <label class="col-sm-3 control-label">定位规则:</label>
62 62 <div class="col-sm-8">
63   - <select id="locatingRule" name="locatingRule" class="form-control" th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('入库')}">
  63 + <select id="locatingRule" name="locatingRule" class="form-control" th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('locationRule')}">
64 64 <option value="">请选择</option>
65 65 <option th:each="flow : ${list}" th:text="${flow['description']}" th:value="${flow['code']}"></option>
66 66 </select>
... ... @@ -69,7 +69,7 @@
69 69 <div class="form-group">
70 70 <label class="col-sm-3 control-label">分配规则:</label>
71 71 <div class="col-sm-8">
72   - <select id="allocationRule" name="allocationRule" class="form-control" th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('分配规则')}">
  72 + <select id="allocationRule" name="allocationRule" class="form-control" th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('allocationRule')}">
73 73 <option value="">请选择</option>
74 74 <option th:each="flow : ${list}" th:text="${flow['description']}" th:value="${flow['code']}"></option>
75 75 </select>
... ... @@ -78,7 +78,7 @@
78 78 <div class="form-group">
79 79 <label class="col-sm-3 control-label">补货规则:</label>
80 80 <div class="col-sm-8">
81   - <select id="replenishmentRule" name="replenishmentRule" class="form-control" th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('补货规则')}">
  81 + <select id="replenishmentRule" name="replenishmentRule" class="form-control" th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('replenishmentRule')}">
82 82 <option value="">请选择</option>
83 83 <option th:each="flow : ${list}" th:text="${flow['description']}" th:value="${flow['code']}"></option>
84 84 </select>
... ... @@ -87,7 +87,7 @@
87 87 <div class="form-group">
88 88 <label class="col-sm-3 control-label">空货位规则:</label>
89 89 <div class="col-sm-8">
90   - <select id="emptyLocRule" name="emptyLocRule" class="form-control" th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('空货位规则')}">
  90 + <select id="emptyLocRule" name="emptyLocRule" class="form-control" th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('emptyLocRule')}">
91 91 <option value="">请选择</option>
92 92 <option th:each="flow : ${list}" th:text="${flow['description']}" th:value="${flow['code']}"></option>
93 93 </select>
... ... @@ -96,7 +96,7 @@
96 96 <div class="form-group">
97 97 <label class="col-sm-3 control-label">入库规则:</label>
98 98 <div class="col-sm-8">
99   - <select id="receivingFlow" name="receivingFlow" class="form-control" th:with="list=${@StatusFlow.flowList('入库单')}">
  99 + <select id="receivingFlow" name="receivingFlow" class="form-control" th:with="list=${@StatusFlow.flowList('receivingFlow')}">
100 100 <option value="">请选择</option>
101 101 <option th:each="flow : ${list}" th:text="${flow['name']}" th:value="${flow['code']}"></option>
102 102 </select>
... ... @@ -105,7 +105,7 @@
105 105 <div class="form-group">
106 106 <label class="col-sm-3 control-label">出库流程:</label>
107 107 <div class="col-sm-8">
108   - <select id="shippingFlow" name="shippingFlow" class="form-control" th:with="list=${@StatusFlow.flowList('出库单')}">
  108 + <select id="shippingFlow" name="shippingFlow" class="form-control" th:with="list=${@StatusFlow.flowList('shippingFlow')}">
109 109 <option value="">请选择</option>
110 110 <option th:each="flow : ${list}" th:text="${flow['name']}" th:value="${flow['code']}"></option>
111 111 </select>
... ...
src/main/resources/templates/config/material/material.html
... ... @@ -16,15 +16,12 @@
16 16 名称:<input type="text" name="name"/>
17 17 </li>
18 18 <li>
19   - 库区编码:<input type="text" name="zoneCode"/>
  19 + 规格:<input type="text" name="spec"/>
20 20 </li>
21 21 <li>
22   - 规格:<input type="text" name="specification"/>
23   - </li>
24   - <li>
25   - 物料类别:<select name="type" th:with="type=${@dict.getType('materialType')}">
  22 + 物料类别:<select name="type" th:with="type=${@materialType.list()}">
26 23 <option value="">所有</option>
27   - <option th:each="e : ${type}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option>
  24 + <option th:each="e : ${type}" th:text="${e['name']}" th:value="${e['code']}"></option>
28 25 </select>
29 26 </li>
30 27 <li class="time">
... ...
src/main/resources/templates/config/materialType/add.html
... ... @@ -40,7 +40,7 @@
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="receivingFlow" name="receivingFlow" class="form-control" th:with="list=${@StatusFlow.flowList('入库单')}">
  43 + <select id="receivingFlow" name="receivingFlow" class="form-control" th:with="list=${@StatusFlow.flowList('receivingFlow')}">
44 44 <option value="">请选择</option>
45 45 <option th:each="flow : ${list}" th:text="${flow['name']}" th:value="${flow['code']}"></option>
46 46 </select>
... ... @@ -49,7 +49,7 @@
49 49 <div class="form-group">
50 50 <label class="col-sm-3 control-label">出库流程:</label>
51 51 <div class="col-sm-8">
52   - <select id="shippingFlow" name="shippingFlow" class="form-control" th:with="list=${@StatusFlow.flowList('出库单')}">
  52 + <select id="shippingFlow" name="shippingFlow" class="form-control" th:with="list=${@StatusFlow.flowList('shippingFlow')}">
53 53 <option value="">请选择</option>
54 54 <option th:each="flow : ${list}" th:text="${flow['name']}" th:value="${flow['code']}"></option>
55 55 </select>
... ... @@ -58,7 +58,7 @@
58 58 <div class="form-group">
59 59 <label class="col-sm-3 control-label">定位规则:</label>
60 60 <div class="col-sm-8">
61   - <select id="locatingRule" name="locatingRule" class="form-control" th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('入库')}">
  61 + <select id="locatingRule" name="locatingRule" class="form-control" th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('locatingRule')}">
62 62 <option value="">请选择</option>
63 63 <option th:each="flow : ${list}" th:text="${flow['description']}" th:value="${flow['code']}"></option>
64 64 </select>
... ... @@ -67,7 +67,7 @@
67 67 <div class="form-group">
68 68 <label class="col-sm-3 control-label">分配规则:</label>
69 69 <div class="col-sm-8">
70   - <select id="allocationRule" name="allocationRule" class="form-control" th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('分配规则')}">
  70 + <select id="allocationRule" name="allocationRule" class="form-control" th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('allocationRule')}">
71 71 <option value="">请选择</option>
72 72 <option th:each="flow : ${list}" th:text="${flow['description']}" th:value="${flow['code']}"></option>
73 73 </select>
... ... @@ -76,7 +76,7 @@
76 76 <div class="form-group">
77 77 <label class="col-sm-3 control-label">补货规则:</label>
78 78 <div class="col-sm-8">
79   - <select id="replenishmentRule" name="replenishmentRule" class="form-control" th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('补货规则')}">
  79 + <select id="replenishmentRule" name="replenishmentRule" class="form-control" th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('replenishmentRule')}">
80 80 <option value="">请选择</option>
81 81 <option th:each="flow : ${list}" th:text="${flow['description']}" th:value="${flow['code']}"></option>
82 82 </select>
... ... @@ -85,7 +85,7 @@
85 85 <div class="form-group">
86 86 <label class="col-sm-3 control-label">空货位规则:</label>
87 87 <div class="col-sm-8">
88   - <select id="emptyLocRule" name="emptyLocRule" class="form-control" th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('空货位规则')}">
  88 + <select id="emptyLocRule" name="emptyLocRule" class="form-control" th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('emptyLocRule')}">
89 89 <option value="">请选择</option>
90 90 <option th:each="flow : ${list}" th:text="${flow['description']}" th:value="${flow['code']}"></option>
91 91 </select>
... ... @@ -94,7 +94,7 @@
94 94 <div class="form-group">
95 95 <label class="col-sm-3 control-label">拣货规则:</label>
96 96 <div class="col-sm-8">
97   - <select id="pickingRule" name="pickingRule" class="form-control" th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('出库')}">
  97 + <select id="pickingRule" name="pickingRule" class="form-control" th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('pickingRule')}">
98 98 <option value="">请选择</option>
99 99 <option th:each="flow : ${list}" th:text="${flow['description']}" th:value="${flow['code']}"></option>
100 100 </select>
... ...
src/main/resources/templates/config/materialType/edit.html
... ... @@ -43,7 +43,7 @@
43 43 <div class="form-group">
44 44 <label class="col-sm-3 control-label">入库流程:</label>
45 45 <div class="col-sm-8">
46   - <select id="receivingFlow" name="receivingFlow" class="form-control" th:with="list=${@StatusFlow.flowList('入库单')}" th:field="*{receivingFlow}">
  46 + <select id="receivingFlow" name="receivingFlow" class="form-control" th:with="list=${@StatusFlow.flowList('receivingFlow')}" th:field="*{receivingFlow}">
47 47 <option value="">请选择</option>
48 48 <option th:each="flow : ${list}" th:text="${flow['name']}" th:value="${flow['code']}"></option>
49 49 </select>
... ... @@ -52,7 +52,7 @@
52 52 <div class="form-group">
53 53 <label class="col-sm-3 control-label">出库流程:</label>
54 54 <div class="col-sm-8">
55   - <select id="shippingFlow" name="shippingFlow" class="form-control" th:with="list=${@StatusFlow.flowList('出库单')}" th:field="*{shippingFlow}">
  55 + <select id="shippingFlow" name="shippingFlow" class="form-control" th:with="list=${@StatusFlow.flowList('shippingFlow')}" th:field="*{shippingFlow}">
56 56 <option value="">请选择</option>
57 57 <option th:each="flow : ${list}" th:text="${flow['name']}" th:value="${flow['code']}"></option>
58 58 </select>
... ... @@ -62,7 +62,7 @@
62 62 <label class="col-sm-3 control-label">定位规则:</label>
63 63 <div class="col-sm-8">
64 64 <select id="locatingRule" name="locatingRule" class="form-control"
65   - th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('入库')}" th:field="*{locatingRule}">
  65 + th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('locatingRule')}" th:field="*{locatingRule}">
66 66 <option value="">请选择</option>
67 67 <option th:each="flow : ${list}" th:text="${flow['description']}" th:value="${flow['code']}"></option>
68 68 </select>
... ... @@ -72,7 +72,7 @@
72 72 <label class="col-sm-3 control-label">分配规则:</label>
73 73 <div class="col-sm-8">
74 74 <select id="allocationRule" name="allocationRule" class="form-control"
75   - th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('分配规则')}" th:field="*{allocationRule}">
  75 + th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('allocationRule')}" th:field="*{allocationRule}">
76 76 <option value="">请选择</option>
77 77 <option th:each="flow : ${list}" th:text="${flow['description']}" th:value="${flow['code']}"></option>
78 78 </select>
... ... @@ -82,7 +82,7 @@
82 82 <label class="col-sm-3 control-label">补货规则:</label>
83 83 <div class="col-sm-8">
84 84 <select id="replenishmentRule" name="replenishmentRule" class="form-control"
85   - th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('补货规则')}" th:field="*{replenishmentRule}">
  85 + th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('replenishmentRule')}" th:field="*{replenishmentRule}">
86 86 <option value="">请选择</option>
87 87 <option th:each="flow : ${list}" th:text="${flow['description']}" th:value="${flow['code']}"></option>
88 88 </select>
... ... @@ -92,7 +92,7 @@
92 92 <label class="col-sm-3 control-label">空货位规则:</label>
93 93 <div class="col-sm-8">
94 94 <select id="emptyLocRule" name="emptyLocRule" class="form-control"
95   - th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('空货位规则')}" th:field="*{emptyLocRule}">
  95 + th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('emptyLocRule')}" th:field="*{emptyLocRule}">
96 96 <option value="">请选择</option>
97 97 <option th:each="flow : ${list}" th:text="${flow['description']}" th:value="${flow['code']}"></option>
98 98 </select>
... ... @@ -102,7 +102,7 @@
102 102 <label class="col-sm-3 control-label">拣货规则:</label>
103 103 <div class="col-sm-8">
104 104 <select id="pickingRule" name="pickingRule" class="form-control"
105   - th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('出库')}" th:field="*{pickingRule}">
  105 + th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('pickingRule')}" th:field="*{pickingRule}">
106 106 <option value="">请选择</option>
107 107 <option th:each="flow : ${list}" th:text="${flow['description']}" th:value="${flow['code']}"></option>
108 108 </select>
... ...