diff --git a/src/main/java/com/huaheng/pc/config/location/service/LocationServiceImpl.java b/src/main/java/com/huaheng/pc/config/location/service/LocationServiceImpl.java index 339ca18..d616478 100644 --- a/src/main/java/com/huaheng/pc/config/location/service/LocationServiceImpl.java +++ b/src/main/java/com/huaheng/pc/config/location/service/LocationServiceImpl.java @@ -63,6 +63,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i } //插入数据库 + location.setCode(code); location.setWarehouseCode(ShiroUtils.getWarehouseCode()); location.setCreatedBy(ShiroUtils.getLoginName()); Boolean flag=this.save(location); @@ -124,7 +125,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i queryWrapper.eq(Location::getCode,code) .eq(Location::getWarehouseCode,ShiroUtils.getWarehouseCode()); List<Location> locationList = locationService.list(queryWrapper); - if (locationList.size() != 0) { + if (locationList.size() == 0) { param.setCode(code); locations.add(param); } diff --git a/src/main/resources/templates/config/location/add.html b/src/main/resources/templates/config/location/add.html index a26f10a..14cafc4 100644 --- a/src/main/resources/templates/config/location/add.html +++ b/src/main/resources/templates/config/location/add.html @@ -33,7 +33,7 @@ <label class="col-sm-3 control-label">库位类型:</label> <div class="col-sm-8"> <select id="locationType" name="locationType" class="form-control" th:with="locationType=${@locationType.getLocationPrefix()}"> - <option th:each="item : ${locationType}" th:text="${item['name']}" th:value="${item['prefix']}"></option> + <option th:each="item : ${locationType}" th:text="${item['name']}" th:value="${item['code']}"></option> </select> </div> </div> @@ -48,8 +48,8 @@ <div class="form-group"> <label class="col-sm-3 control-label">库位状态:</label> <div class="col-sm-8"> - <select id="status" name="status" class="form-control" th:with="statusList=${@dict.getType('locationStatus')}"> - <option th:each="item : ${statusList}" th:text="${item['dictLabel']}" th:value="${item['dictValue']}"></option> + <select id="status" name="status" class="form-control" th:with="status=${@dict.getType('locationStatus')}"> + <option th:each="item : ${status}" th:text="${item['dictLabel']}" th:value="${item['dictValue']}"></option> </select> </div> </div> @@ -66,30 +66,22 @@ var prefix = ctx + "config/location" $("#form-location-add").validate({ rules:{ - row:{ + iRow:{ required:true, digits:true }, - line:{ + iColumn:{ required:true, digits:true }, - layer:{ + iLayer:{ required:true, digits:true }, - grid:{ + iGrid:{ required:true, digits:true - }, - rowIndex:{ - required:true, - range:[1,4] - }, - roadway:{ - required:true, - min:0 - }, + } }, submitHandler: function(form) { $.ajax({ @@ -101,9 +93,9 @@ "iColumn": $("input[name='iColumn']").val(), "iLayer": $("input[name='iLayer']").val(), "iGrid": $("input[name='iGrid']").val(), - "locationType": $("#type option:selected").val(), + "locationType": $("#locationType option:selected").val(), "zoneCode": $("#zoneCode option:selected").attr("code"), - "enable" : $("input[name='enable']").is(':checked'), + "status" : $("#status option:selected").val(), }, async : false, error : function(request) { diff --git a/src/main/resources/templates/config/location/addBatch.html b/src/main/resources/templates/config/location/addBatch.html index 2982097..972b851 100644 --- a/src/main/resources/templates/config/location/addBatch.html +++ b/src/main/resources/templates/config/location/addBatch.html @@ -29,12 +29,12 @@ <input id="iGrid" name="iGrid" class="form-control" type="text"> </div> </div> - <div class="form-group"> + <div class="form-group"> <label class="col-sm-3 control-label">库位类型:</label> <div class="col-sm-8"> - <select id="locationType" class="form-control" th:with="locationType=${@locationType.getLocationPrefix()}"> - <option th:each="item : ${locationType}" th:text="${item['name']}" th:value="${item['code']}"></option> - </select> + <select id="locationType" name="locationType" class="form-control" th:with="locationType=${@locationType.getLocationPrefix()}"> + <option th:each="item : ${locationType}" th:text="${item['name']}" th:value="${item['code']}"></option> + </select> </div> </div> <div class="form-group"> @@ -48,8 +48,8 @@ <div class="form-group"> <label class="col-sm-3 control-label">库位状态:</label> <div class="col-sm-8"> - <select id="status" name="status" class="form-control" th:with="statusList=${@dict.getType('locationStatus')}"> - <option th:each="item : ${statusList}" th:text="${item['dictLabel']}" th:value="${item['dictValue']}"></option> + <select id="status" name="status" class="form-control" th:with="status=${@dict.getType('locationStatus')}"> + <option th:each="item : ${status}" th:text="${item['dictLabel']}" th:value="${item['dictValue']}"></option> </select> </div> </div> @@ -87,13 +87,12 @@ digits:true }, locationType:{ - required:true, - digits:true + required:true }, - status:{ - required:true, - digits:true - } + // status:{ + // required:true, + // digits:true + // } }, submitHandler: function(form) { $.ajax({ @@ -107,7 +106,7 @@ "iGrid": $("input[name='iGrid']").val(), "locationType": $("#locationType option:selected").val(), "zoneCode": $("#zone option:selected").attr("code"), - "status" : $("input[name='status']").is(':checked'), + "status" : $("#status option:selected").val(), }, async : false, error : function(request) {