Commit afa312f00498a81f1e6602b3b403c3c0d5688ad5

Authored by pengcheng
1 parent 630d0722

仓库,货主,容器等bug修改

src/main/java/com/huaheng/pc/config/company/controller/CompanyController.java
... ... @@ -60,7 +60,8 @@ public class CompanyController extends BaseController {
60 60 lambdaQueryWrapper.gt(StringUtils.isNotEmpty(createdBegin), Company::getCreated, createdBegin)
61 61 .lt(StringUtils.isNotEmpty(createdEnd), Company::getCreated, createdEnd)
62 62 .eq(StringUtils.isNotEmpty(company.getCode()), Company::getCode, company.getCode())
63   - .eq(StringUtils.isNotEmpty(company.getName()), Company::getName, company.getName())
  63 + .like(StringUtils.isNotEmpty(company.getName()), Company::getName, company.getName())
  64 + .eq(Company::getDeleted,false)
64 65 .orderByDesc(Company::getCreated);
65 66  
66 67 if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){
... ...
src/main/java/com/huaheng/pc/config/company/service/CompanyServiceImpl.java
... ... @@ -91,7 +91,6 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
91 91 {
92 92 record.setCompanyId(company.getId());
93 93 record.setCompanyCode(company.getCode());
94   - record.setWarehouseId(Integer.valueOf(warehouse[i]));
95 94 record.setWarehouseCode(warehouse[i+1]);
96 95 warehouseCompanyService.save(record);
97 96 }
... ...
src/main/java/com/huaheng/pc/config/container/controller/ContainerController.java
... ... @@ -71,7 +71,8 @@ public class ContainerController extends BaseController {
71 71 .eq(StringUtils.isNotEmpty(container.getWarehouseCode()), Container::getWarehouseCode, container.getWarehouseCode())
72 72 .eq(StringUtils.isNotEmpty(container.getLocationCode()), Container::getLocationCode, container.getLocationCode())
73 73 .eq(Container::getWarehouseCode, ShiroUtils.getWarehouseCode())
74   - .orderByDesc(Container::getCreated);
  74 + .eq(Container::getEnable,true)
  75 + .orderByDesc(Container::getId);
75 76  
76 77 if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){
77 78 /*使用分页查询*/
... ... @@ -147,7 +148,7 @@ public class ContainerController extends BaseController {
147 148 for (Integer id : Convert.toIntArray(ids)) {
148 149 Container container = containerService.getById(id);
149 150 if (container.getStatus().equals("empty") && StringUtils.isEmpty(container.getLocationCode())) {
150   - container.setDeleted(true);
  151 + container.setEnable(false);
151 152 container.setLastUpdatedBy(ShiroUtils.getLoginName());
152 153 containerService.updateById(container);
153 154 } else {
... ...
src/main/java/com/huaheng/pc/config/container/domain/Container.java
... ... @@ -106,7 +106,7 @@ public class Container implements Serializable {
106 106 @TableField(value = "enable")
107 107 @ApiModelProperty(value="启用;0—禁用")
108 108 @Excel(name = "是否启用", prompt = "启用;0 禁用:1")
109   - private Integer enable;
  109 + private Boolean enable;
110 110  
111 111 /**
112 112 * 打印次数
... ... @@ -185,10 +185,7 @@ public class Container implements Serializable {
185 185 @ApiModelProperty(value="处理标记")
186 186 private String processStamp;
187 187  
188   - @TableField(value = "deleted")
189   - @ApiModelProperty(value = "是否删除")
190   - @TableLogic
191   - private Boolean deleted;
  188 +
192 189  
193 190 private static final long serialVersionUID = 1L;
194 191  
... ...
src/main/java/com/huaheng/pc/config/container/service/ContainerServiceImpl.java
... ... @@ -41,8 +41,7 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container
41 41 container.setCreatedBy(ShiroUtils.getLoginName());
42 42 container.setLastUpdated(null);
43 43 container.setLastUpdatedBy(null);
44   - container.setEnable(0);
45   - container.setDeleted(false);
  44 + container.setEnable(true);
46 45 container.setCompanyCode(ShiroUtils.getCompanyCodeList().get(0));
47 46 container.setWarehouseCode(ShiroUtils.getWarehouseCode());
48 47 this.save(container);
... ... @@ -60,7 +59,7 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container
60 59 Container container = containerMapper.selectOne(lambda);
61 60  
62 61 //如果指定类型的最后的code存在,那么 code = 容器类型 + (排序号 + 1)
63   - if (container.getCode() != null) {
  62 + if (container!=null && container.getCode() != null) {
64 63 Integer number = Integer.valueOf(container.getCode().substring(container.getCode().length() - 5, container.getCode().length()));
65 64 return number;
66 65 } else {
... ...
src/main/java/com/huaheng/pc/config/material/service/MaterialServiceImpl.java
... ... @@ -144,7 +144,11 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
144 144 material.setWarehouseCode(ShiroUtils.getWarehouseCode());
145 145 material.setCreatedBy(ShiroUtils.getLoginName());
146 146 material.setLastUpdatedBy(ShiroUtils.getLoginName());
147   - return null;
  147 + Boolean flag=this.save(material);
  148 + if(flag==false){
  149 + return AjaxResult.error("新增物料失败,存入数据库时报错");
  150 + }
  151 + return AjaxResult.success("新增物料成功");
148 152 }
149 153  
150 154 /**
... ...
src/main/java/com/huaheng/pc/config/warehouse/controller/WareHouseController.java
... ... @@ -67,9 +67,9 @@ public class WareHouseController extends BaseController {
67 67 lambdaQueryWrapper.gt(StringUtils.isNotEmpty(createdBegin), Warehouse::getCreated, createdBegin)
68 68 .lt(StringUtils.isNotEmpty(createdEnd), Warehouse::getCreated, createdEnd)
69 69 .eq(StringUtils.isNotEmpty(warehouse.getCode()), Warehouse::getCode, warehouse.getCode())
70   - .eq(StringUtils.isNotEmpty(warehouse.getName()), Warehouse::getName,warehouse.getName())
71   - .orderByDesc(Warehouse::getCreated)
72   - .eq(Warehouse::getDeleted,0);
  70 + .like(StringUtils.isNotEmpty(warehouse.getName()), Warehouse::getName,warehouse.getName())
  71 + .eq(Warehouse::getDeleted,false)
  72 + .orderByDesc(Warehouse::getCreated);
73 73 /**
74 74 * 使用分页查询
75 75 */
... ... @@ -149,9 +149,10 @@ public class WareHouseController extends BaseController {
149 149 if (count != 0) {
150 150 return AjaxResult.error("仓库编码(" + warehouse.getCode() +")还有库存,不能删除!");
151 151 }
  152 + warehouse.setCode(code);
152 153 warehouse.setLastUpdatedBy(ShiroUtils.getLoginName());
153 154 warehouse.setDeleted(true);
154   - warehouseService.updateById(warehouse);
  155 + warehouseService.saveOrUpdate(warehouse);
155 156 dictDataService.deleteDictDataByWarehouseCode(code);
156 157 dictTypeService.deleteDictTypeByWarehouseCode(code);
157 158 }
... ...
src/main/java/com/huaheng/pc/config/warehouseCompany/domain/WarehouseCompany.java
... ... @@ -17,11 +17,6 @@ public class WarehouseCompany implements Serializable {
17 17 @TableId(value = "id", type = IdType.AUTO)
18 18 private Integer id;
19 19  
20   - /**
21   - * 仓库id
22   - */
23   - @TableField(value = "warehouseId")
24   - private Integer warehouseId;
25 20  
26 21 /**
27 22 * 仓库编码
... ...
src/main/resources/templates/config/company/edit.html
... ... @@ -18,14 +18,14 @@
18 18 <input id="name" name="name" th:field="*{name}" class="form-control" type="text">
19 19 </div>
20 20 </div>
21   - <div class="form-group">
22   - <label class="col-sm-3 control-label">仓库:</label>
23   - <div class="col-sm-8">
24   - <select id="warehouseCode" name="warehouseCode" class="form-control" >
25   - <option th:each="item : ${warehouseList}" th:text="${item['name']}" th:value="${item['code']}" th:attr = " code = ${item['name']}"></option>
26   - </select>
27   - </div>
28   - </div>
  21 + <!--<div class="form-group">-->
  22 + <!--<label class="col-sm-3 control-label">仓库:</label>-->
  23 + <!--<div class="col-sm-8">-->
  24 + <!--<select id="warehouseCode" name="warehouseCode" class="form-control" >-->
  25 + <!--<option th:each="item : ${warehouseList}" th:text="${item['name']}" th:value="${item['code']}" th:attr = " code = ${item['name']}"></option>-->
  26 + <!--</select>-->
  27 + <!--</div>-->
  28 + <!--</div>-->
29 29 <div class="form-group">
30 30 <label class="col-sm-3 control-label">地址1:</label>
31 31 <div class="col-sm-8">
... ...
src/main/resources/templates/config/container/container.html
... ... @@ -24,7 +24,7 @@
24 24 <li>
25 25 容器类型:<select name="containerType" th:with="containerType = ${@containerType.getCode()}">
26 26 <option value="">所有</option>
27   - <option th:each="item : ${containerType}" th:text="${item['name']}" th:value="${item['prefix']}"></option>
  27 + <option th:each="item : ${containerType}" th:text="${item['name']}" th:value="${item['code']}"></option>
28 28 </select>
29 29 </li>
30 30 <li class="time">
... ... @@ -102,10 +102,10 @@
102 102 {
103 103 field : 'containerType',
104 104 title : '容器类型',
105   - align: 'center',
106   - formatter: function(value, row, index) {
107   - return $.table.selectPrefixToName(containerTypes, value);
108   - }
  105 + // align: 'center',
  106 + // formatter: function(value, row, index) {
  107 + // return $.table.selectPrefixToName(containerTypes, value);
  108 + // }
109 109 },
110 110 {
111 111 field : 'locationCode',
... ...
src/main/resources/templates/config/warehouse/warehouse.html
... ... @@ -213,7 +213,7 @@
213 213 formatter: function(value, row, index) {
214 214 var actions = [];
215 215 actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick= edit(\''+row.code+'\')><i class="fa fa-edit"></i>编辑</a> ');
216   - actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(' + row.code + ')"><i class="fa fa-trash-o"></i>删除</a>');
  216 + actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick=removes(\''+row.code+'\')><i class="fa fa-trash-o"></i>删除</a>');
217 217 return actions.join('');
218 218 }
219 219 }]
... ... @@ -225,6 +225,15 @@
225 225 var url = prefix + "/edit/"+code;
226 226 $.modal.open("修改" + $.table._option.modalName, url);
227 227 }
  228 +
  229 + // 删除信息
  230 + function removes(code) {
  231 + $.modal.confirm("确定删除该条" + $.table._option.modalName + "信息吗?", function() {
  232 + var url = $.common.isEmpty(code) ? $.table._option.removeUrl : $.table._option.removeUrl.replace("{code}", code);
  233 + var data = { "codes": code };
  234 + $.operate.submit(url, "post", "json", data);
  235 + });
  236 + }
228 237 </script>
229 238 </body>
230 239 </html>
231 240 \ No newline at end of file
... ...