diff --git a/src/main/java/com/huaheng/pc/config/materialType/service/MaterialTypeService.java b/src/main/java/com/huaheng/pc/config/materialType/service/MaterialTypeService.java index c08bd9e..f7cd661 100644 --- a/src/main/java/com/huaheng/pc/config/materialType/service/MaterialTypeService.java +++ b/src/main/java/com/huaheng/pc/config/materialType/service/MaterialTypeService.java @@ -1,12 +1,21 @@ package com.huaheng.pc.config.materialType.service; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; +import java.util.Map; + import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.huaheng.pc.config.materialType.domain.MaterialType; import com.huaheng.pc.config.materialType.mapper.MaterialTypeMapper; -@Service +@Service("materialType") public class MaterialTypeService extends ServiceImpl<MaterialTypeMapper, MaterialType> { + public List<Map<String, Object>> queryType(){ + LambdaQueryWrapper<MaterialType> lambda = Wrappers.lambdaQuery(); + lambda.select(MaterialType::getCode, MaterialType::getName); + return this.listMaps(lambda); + } } diff --git a/src/main/java/com/huaheng/pc/inventory/adjustDetail/controller/adjustDetailController.java b/src/main/java/com/huaheng/pc/inventory/adjustDetail/controller/adjustDetailController.java index f79561e..6874187 100644 --- a/src/main/java/com/huaheng/pc/inventory/adjustDetail/controller/adjustDetailController.java +++ b/src/main/java/com/huaheng/pc/inventory/adjustDetail/controller/adjustDetailController.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huaheng.common.support.Convert; import com.huaheng.common.utils.StringUtils; import com.huaheng.common.utils.security.ShiroUtils; import com.huaheng.framework.aspectj.lang.annotation.Log; @@ -99,34 +100,26 @@ public class adjustDetailController extends BaseController { } /** - * 只调整数量 - * 修改 - */ - @GetMapping("/adjustEdit") - public String editAdjust(Integer id, ModelMap mmap) - { - AdjustDetail adjustDetailEdit = adjustDetailService.getById(id); - mmap.put("adjustDetailEdit", adjustDetailEdit); - return prefix + "/adjustEdit"; - } - - /** - * 修改保存调整数量 + * 调整, + * 调整数量,调整库存状态 + * 调整插入库存 */ //@RequiresPermissions("inventory:cyclecountAdjustDetail:addAdjust") @Log(title = "库存-调整单", operating = "调整单调整库存差异,调整数量", action = BusinessType.UPDATE) - @PostMapping("/editAdjustSave") + @PostMapping("/adjustEdit") @ResponseBody - public AjaxResult editAdjustSave(AdjustDetail adjustDetail) + public AjaxResult editAdjustSave(String ids) { - //未上传不允许进行明细差异调整 -// CyclecountAdjust cyclecountAdjust = cycleconutAdjustService.selectEntityById(cyclecountAdjustDetail.getCyclecountAdjustId()); -// if(cyclecountAdjust.getStatus() != 30 ){ -// return AjaxResult.error("单据未上传,没有调整单下发,不允许差异调整!!"); -// //throw new ServiceException("单据未上传,没有调整单下发,不允许差异调整!"); -// } - AjaxResult result = adjustDetailService.updateAdjustDetail(adjustDetail); - return result; + if(ids == null){ + throw new SecurityException("ID不能为空!"); + } + Integer[] integers = Convert.toIntArray(ids); + for (Integer id : integers) + { + AdjustDetail adjustDetailEdit = adjustDetailService.getById(id); + adjustDetailService.updateAdjustDetail(adjustDetailEdit); + } + return AjaxResult.success("调整下发成功!"); } diff --git a/src/main/java/com/huaheng/pc/inventory/adjustDetail/service/AdjustDetailServiceImpl.java b/src/main/java/com/huaheng/pc/inventory/adjustDetail/service/AdjustDetailServiceImpl.java index 998d43f..75086d4 100644 --- a/src/main/java/com/huaheng/pc/inventory/adjustDetail/service/AdjustDetailServiceImpl.java +++ b/src/main/java/com/huaheng/pc/inventory/adjustDetail/service/AdjustDetailServiceImpl.java @@ -2,9 +2,11 @@ package com.huaheng.pc.inventory.adjustDetail.service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.common.utils.StringUtils; import com.huaheng.common.utils.security.ShiroUtils; import com.huaheng.framework.web.domain.AjaxResult; import com.huaheng.pc.config.container.service.ContainerService; +import com.huaheng.pc.config.location.domain.Location; import com.huaheng.pc.config.location.service.LocationService; import com.huaheng.pc.inventory.adjustHeader.domain.AdjustHeader; import com.huaheng.pc.inventory.adjustHeader.service.AdjustHeaderService; @@ -58,25 +60,80 @@ public class AdjustDetailServiceImpl extends ServiceImpl<AdjustDetailMapper, Adj /** - * 调整库存数量 + * 调整库存 + * 调整数量,调整库存状态 + * 调整插入库存 * @param adjustDetail * @return */ @Transactional @Override public AjaxResult updateAdjustDetail(AdjustDetail adjustDetail) { - /*修改库存数量,调整单据状态,写入库存交易*/ - //已调整过不允许修改。 if(adjustDetail.getStatus() == 1){ AjaxResult.error("该单据已调整,不允许再次调整!" ); } //查询调整的库存明细 - InventoryDetail inventoryDetail = inventoryDetailService.getById(adjustDetail.getInventoryDetailId()); + InventoryDetail inventoryDetail = new InventoryDetail(); + //调整单中不带库存明细时不查询 + if(adjustDetail.getInventoryDetailId() != null) { + inventoryDetail = inventoryDetailService.getById(adjustDetail.getInventoryDetailId()); + //验证该条库存是不是正在使用,通过库位是否锁定来判断 + if (!adjustDetail.getLocationCode().equals(inventoryDetail.getLocationCode()) || + !adjustDetail.getContainerCode().equals(inventoryDetail.getContainerCode())) { + throw new SecurityException("调整单和所调整库存的库位容器不符,前检查数据"); + } + Location location = new Location(); + location.setCode(inventoryDetail.getLocationCode()); + location.setWarehouseCode(inventoryDetail.getWarehouseCode()); + LambdaQueryWrapper<Location> lambdaQueryWrapper = Wrappers.lambdaQuery(location); + location = locationService.getOne(lambdaQueryWrapper); + if (!location.getStatus().equals("empty")) { + throw new SecurityException(inventoryDetail.getId() + "库存非空闲,请等待任务完成再进行调整!"); + } + + //判断调整哪一个属性值 + /*以下方法有待验证讨论,BigDecimal传入null,如何避免传入0?*/ + + //把BigDecimal类型转换成String再判断null + + String toQtyString = adjustDetail.getToQty().toString(); //调整后库存 + String gapQtyString = adjustDetail.getGapQty().toString(); //调整变动数量 + if (StringUtils.isNotEmpty(toQtyString) || StringUtils.isNotEmpty(gapQtyString)) { + //调整数量 + updateAdjustDetailNumber(adjustDetail, inventoryDetail); + } + if (StringUtils.isNotEmpty(adjustDetail.getFromInventorySts()) && StringUtils.isNotEmpty(adjustDetail.getToInventorySts())) { + //调整库存状态 + updateAdjustDetailState(adjustDetail, inventoryDetail); + } + } + String fromQtyString = adjustDetail.getFromQty().toString(); //调整前库存数量 + if(StringUtils.isNotEmpty(fromQtyString)){ + //调整插入库存 + updateAdjustDetailInsert(adjustDetail); + } + + //修改调整单明细状态 + adjustDetail.setStatus(1); + adjustDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); + adjustDetail.setLastUpdated(new Date()); + this.saveOrUpdate(adjustDetail); + + return AjaxResult.success("调整库存成功!"); + } + + /** + * 调整修改库存数量 + * @param adjustDetail + */ + @Transactional + public void updateAdjustDetailNumber (AdjustDetail adjustDetail,InventoryDetail inventoryDetail){ + /*修改库存数量,调整单据状态,写入库存交易*/ + /*调整后的数量写入库存*/ //比较大小可以用 .compareTo()返回值 -1 小于 0 等于 1 大于 //Bigdecimal 自带运算方法.add加法 .subtract减法 - if(adjustDetail.getToQty().compareTo(BigDecimal.ZERO) == 0){ //当调整后数量为0时,直接删除该条库存,并写入库存交易 //删除库存,并查询当前库位还有没有其他物料,没有则删除库存头,恢复容器和库位状态 @@ -87,13 +144,13 @@ public class AdjustDetailServiceImpl extends ServiceImpl<AdjustDetailMapper, Adj LambdaQueryWrapper<InventoryDetail> lamdDetail = Wrappers.lambdaQuery(inv); List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(lamdDetail); inventoryDetailService.removeById(adjustDetail.getInventoryDetailId());//删除实际库存数量为0的库存明细 - if(inventoryDetailList.size() == 0){ + if(inventoryDetailList.size() == 0){ //恢复库位和容器状态,删除库存头 inventoryHeaderService.removeById(inventoryDetail.getInventoryHeaderId()); locationService.updateContainerCodeAndStatus(inventoryDetail.getLocationCode(),"","empty"); containerService.updateLocationCodeAndStatus(inventoryDetail.getContainerCode(),"","empty"); - } - }else{ + } + }else{ //修改库存 //BigDecimal temp =(adjustDetail.getFromQty()).add(adjustDetail.getGapQty()); inventoryDetail.setQty(adjustDetail.getToQty());//调整后的数量 @@ -113,7 +170,7 @@ public class AdjustDetailServiceImpl extends ServiceImpl<AdjustDetailMapper, Adj inventoryTransaction.setMaterialName(inventoryDetail.getMaterialName()); inventoryTransaction.setMaterialSpec(inventoryDetail.getMaterialSpec()); inventoryTransaction.setMaterialUnit(inventoryDetail.getMaterialUnit()); - inventoryTransaction.setTaskQty(inventoryDetail.getTaskQty()); + inventoryTransaction.setTaskQty(adjustDetail.getGapQty()); inventoryTransaction.setInventorySts(inventoryDetail.getInventorySts()); inventoryTransaction.setReferCode(inventoryDetail.getReferCode()); inventoryTransaction.setReferDetailId(inventoryDetail.getReferDetailId()); @@ -142,15 +199,100 @@ public class AdjustDetailServiceImpl extends ServiceImpl<AdjustDetailMapper, Adj inventoryTransaction.setSupplierCode(inventoryDetail.getSupplierCode()); inventoryTransactionService.saveOrUpdate(inventoryTransaction); - //修改调整单明细状态 - adjustDetail.setStatus(1); - adjustDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); - adjustDetail.setLastUpdated(new Date()); - this.saveOrUpdate(adjustDetail); + } + + /** + * 调整库存属性 + * @param adjustDetail + */ + @Transactional + public void updateAdjustDetailState (AdjustDetail adjustDetail,InventoryDetail inventoryDetail) { + /*不考虑其他只改变库存状态即可,也需要写入库存交易。*/ + + //修改库存的状态 + inventoryDetail.setInventorySts(adjustDetail.getToInventorySts());//修改为调整库存 + inventoryDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); + inventoryDetail.setLastUpdated(new Date()); + inventoryDetailService.saveOrUpdate(inventoryDetail); + + //写入库存交易,库存交易2条一条出,一条入 + //调整出 + InventoryTransaction inventoryTransaction = new InventoryTransaction(); + inventoryTransaction.setWarehouseCode(inventoryDetail.getWarehouseCode()); + inventoryTransaction.setCompanyCode(inventoryDetail.getCompanyCode()); + inventoryTransaction.setLocationCode(inventoryDetail.getLocationCode()); + inventoryTransaction.setContainerCode(inventoryDetail.getContainerCode()); + inventoryTransaction.setTransactionType(40); + inventoryTransaction.setMaterialCode(inventoryDetail.getMaterialCode()); + inventoryTransaction.setMaterialName(inventoryDetail.getMaterialName()); + inventoryTransaction.setMaterialSpec(inventoryDetail.getMaterialSpec()); + inventoryTransaction.setMaterialUnit(inventoryDetail.getMaterialUnit()); + inventoryTransaction.setTaskQty(null);//数量不变 + inventoryTransaction.setInventorySts(adjustDetail.getFromInventorySts());//状态 + inventoryTransaction.setReferCode(inventoryDetail.getReferCode()); + inventoryTransaction.setReferDetailId(inventoryDetail.getReferDetailId()); + inventoryTransaction.setBatch(inventoryDetail.getBatch()); + inventoryTransaction.setLot(inventoryDetail.getLot()); + inventoryTransaction.setProjectNo(inventoryDetail.getProjectNo()); + inventoryTransaction.setQcCheck(inventoryDetail.getQcCheck()); + inventoryTransaction.setWeight(inventoryDetail.getWeight()); + inventoryTransaction.setManufactureDate(inventoryDetail.getManufactureDate()); + inventoryTransaction.setExpirationDate(inventoryDetail.getExpirationDate()); + inventoryTransaction.setAgingDate(inventoryDetail.getCreated()); + inventoryTransaction.setAttributeId(inventoryDetail.getAttributeId()); + inventoryTransaction.setAttribute1(inventoryDetail.getAttribute1()); + inventoryTransaction.setAttribute2(inventoryDetail.getAttribute2()); + inventoryTransaction.setAttribute3(inventoryDetail.getAttribute3()); + inventoryTransaction.setCreated(new Date()); + inventoryTransaction.setCreatedBy(ShiroUtils.getLoginName()); + inventoryTransaction.setBillDetailId(inventoryDetail.getReceiptDetailId()); + inventoryTransaction.setSupplierCode(inventoryDetail.getSupplierCode()); + inventoryTransactionService.saveOrUpdate(inventoryTransaction); + + //调整入 + InventoryTransaction inventoryTransaction2 = new InventoryTransaction(); + inventoryTransaction2.setWarehouseCode(inventoryDetail.getWarehouseCode()); + inventoryTransaction2.setCompanyCode(inventoryDetail.getCompanyCode()); + inventoryTransaction2.setLocationCode(inventoryDetail.getLocationCode()); + inventoryTransaction2.setContainerCode(inventoryDetail.getContainerCode()); + inventoryTransaction2.setTransactionType(30); + inventoryTransaction2.setMaterialCode(inventoryDetail.getMaterialCode()); + inventoryTransaction2.setMaterialName(inventoryDetail.getMaterialName()); + inventoryTransaction2.setMaterialSpec(inventoryDetail.getMaterialSpec()); + inventoryTransaction2.setMaterialUnit(inventoryDetail.getMaterialUnit()); + inventoryTransaction2.setTaskQty(null);//数量不变 + inventoryTransaction2.setInventorySts(inventoryDetail.getInventorySts());//状态 + inventoryTransaction2.setReferCode(inventoryDetail.getReferCode()); + inventoryTransaction2.setReferDetailId(inventoryDetail.getReferDetailId()); + inventoryTransaction2.setBatch(inventoryDetail.getBatch()); + inventoryTransaction2.setLot(inventoryDetail.getLot()); + inventoryTransaction2.setProjectNo(inventoryDetail.getProjectNo()); + inventoryTransaction2.setQcCheck(inventoryDetail.getQcCheck()); + inventoryTransaction2.setWeight(inventoryDetail.getWeight()); + inventoryTransaction2.setManufactureDate(inventoryDetail.getManufactureDate()); + inventoryTransaction2.setExpirationDate(inventoryDetail.getExpirationDate()); + inventoryTransaction2.setAgingDate(inventoryDetail.getCreated()); + inventoryTransaction2.setAttributeId(inventoryDetail.getAttributeId()); + inventoryTransaction2.setAttribute1(inventoryDetail.getAttribute1()); + inventoryTransaction2.setAttribute2(inventoryDetail.getAttribute2()); + inventoryTransaction2.setAttribute3(inventoryDetail.getAttribute3()); + inventoryTransaction2.setCreated(new Date()); + inventoryTransaction2.setCreatedBy(ShiroUtils.getLoginName()); + inventoryTransaction2.setBillDetailId(inventoryDetail.getReceiptDetailId()); + inventoryTransaction2.setSupplierCode(inventoryDetail.getSupplierCode()); + inventoryTransactionService.saveOrUpdate(inventoryTransaction2); - return AjaxResult.success("调整库存数量成功!"); } + /** + * 调整插入库存 + * @param adjustDetail + */ + @Transactional + public void updateAdjustDetailInsert (AdjustDetail adjustDetail) { + /*当实际库存为0时,调整单触发插入新库存状态*/ + //判断是否存在库存头,没有需要生成,有库存头直接插入库存明细即可 + //新生成库存头时,库位,容器都需要更新数据 @@ -159,6 +301,7 @@ public class AdjustDetailServiceImpl extends ServiceImpl<AdjustDetailMapper, Adj + } diff --git a/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/controller/CycleCountDetailController.java b/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/controller/CycleCountDetailController.java index 4c7e8eb..865cf34 100644 --- a/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/controller/CycleCountDetailController.java +++ b/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/controller/CycleCountDetailController.java @@ -237,6 +237,7 @@ public class CycleCountDetailController extends BaseController { @PostMapping("/createCyclecountWithGapQty") @ResponseBody public AjaxResult createCyclecountWithGapQty(String cycleCountHeadCode){ + return cycleCountDetailService.createCyclecountWithGapQty(cycleCountHeadCode); } diff --git a/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/service/CycleCountDetailServiceImpl.java b/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/service/CycleCountDetailServiceImpl.java index ea2e37d..d3b5d7c 100644 --- a/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/service/CycleCountDetailServiceImpl.java +++ b/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/service/CycleCountDetailServiceImpl.java @@ -415,6 +415,9 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap cycleCountDetail.setCompanyCode(cycleCountHeader.getCompanyCode()); LambdaQueryWrapper<CycleCountDetail> cycleCountDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); List<CycleCountDetail> cycleCountDetails = this.list(cycleCountDetailLambdaQueryWrapper);//明细 + if(cycleCountDetails.size() == 0){ + throw new SecurityException("没有明细!"); + } //生成复盘盘点主单 cycleCountHeader.setCode(cycleCountHeaderService.createCode()); cycleCountHeader.setRound(cycleCountHeader.getRound() + 1);//盘点轮次+1 @@ -438,6 +441,9 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap } } + if(cycleCountDetailList.size() == 0){ + throw new SecurityException("该单据没有符合复盘条件的明细!"); + } if(!this.saveBatch(cycleCountDetailList)){ throw new ServiceException("复盘明细子单生成失败"); } diff --git a/src/main/resources/static/huaheng/js/huahengUI.js b/src/main/resources/static/huaheng/js/huahengUI.js index 40260c3..48e350c 100644 --- a/src/main/resources/static/huaheng/js/huahengUI.js +++ b/src/main/resources/static/huaheng/js/huahengUI.js @@ -29,7 +29,7 @@ pageList: [10, 25, 50], // 可供选择的每页的行数(*) iconSize: 'outline', // 图标大小:undefined默认的按钮尺寸 xs超小按钮sm小按钮lg大按钮 toolbar: '#toolbar', // 指定工作栏 - sidePagination: "server", // 启用服务端分页 + sidePagination: "server", // 启用服务端分页 search: $.common.visible(options.search), // 是否显示搜索框功能 showRefresh: $.common.visible(options.showRefresh), // 是否显示刷新按钮 showColumns: $.common.visible(options.showColumns), // 是否显示隐藏某列下拉框 diff --git a/src/main/resources/templates/config/filterConfigDetail/filterConfigDetail.html b/src/main/resources/templates/config/filterConfigDetail/filterConfigDetail.html index b26417d..c47d919 100644 --- a/src/main/resources/templates/config/filterConfigDetail/filterConfigDetail.html +++ b/src/main/resources/templates/config/filterConfigDetail/filterConfigDetail.html @@ -30,7 +30,7 @@ createUrl: prefix + "/add", updateUrl: prefix + "/edit/{id}", removeUrl: prefix + "/remove", - modalName: "订单分析明细", + modalName: "规则明细", queryParams:function(params) { return { // 传递参数查询参数 diff --git a/src/main/resources/templates/config/filterConfigHeader/add.html b/src/main/resources/templates/config/filterConfigHeader/add.html index edf4339..5fdaef0 100644 --- a/src/main/resources/templates/config/filterConfigHeader/add.html +++ b/src/main/resources/templates/config/filterConfigHeader/add.html @@ -8,7 +8,9 @@ <div class="form-group"> <label class="col-sm-3 control-label">模块:</label> <div class="col-sm-8"> - <input id="moduleType" name="moduleType" class="form-control" type="text"> + <select class="form-control" name="moduleType" th:with="moduleType=${@dict.getType('moduleType')}"> + <option th:each="e : ${moduleType}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option> + </select> </div> </div> <div class="form-group"> @@ -81,6 +83,7 @@ submitHandler: function (form) { // $.operate.save(prefix + "/add", $('#form-locationType-add').serialize()); var tableValue = $.common.getTableValue("#form-filterConfigHeader-add"); + tableValue = formValueReplace(tableValue, "moduleType", $("#moduleType option:selected").val()); $.operate.save(prefix + "/add", tableValue); } }); diff --git a/src/main/resources/templates/config/filterConfigHeader/edit.html b/src/main/resources/templates/config/filterConfigHeader/edit.html index 5018cda..36b8b31 100644 --- a/src/main/resources/templates/config/filterConfigHeader/edit.html +++ b/src/main/resources/templates/config/filterConfigHeader/edit.html @@ -9,7 +9,9 @@ <div class="form-group"> <label class="col-sm-3 control-label">模块:</label> <div class="col-sm-8"> - <input id="moduleType" name="moduleType" class="form-control" type="text" th:field="*{moduleType}"> + <select class="form-control" name="moduleType" th:with="moduleType=${@dict.getType('moduleType')}" th:field="*{moduleType}"> + <option th:each="e : ${moduleType}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option> + </select> </div> </div> <div class="form-group"> @@ -90,6 +92,7 @@ }, submitHandler: function(form) { var tableValue = $.common.getTableValue("#form-filterConfigHeader-edit"); + tableValue = formValueReplace(tableValue, "moduleType", $("#moduleType option:selected").val()); $.operate.save(prefix + "/edit", tableValue); } }); diff --git a/src/main/resources/templates/config/filterConfigHeader/filterConfigHeader.html b/src/main/resources/templates/config/filterConfigHeader/filterConfigHeader.html index f162b82..c396b23 100644 --- a/src/main/resources/templates/config/filterConfigHeader/filterConfigHeader.html +++ b/src/main/resources/templates/config/filterConfigHeader/filterConfigHeader.html @@ -74,14 +74,14 @@ var editFlag = [[${@permission.hasPermi('config:filterConfigHeader:edit')}]]; var removeFlag = [[${@permission.hasPermi('config:filterConfigHeader:remove')}]]; var datas = [[${@dict.getType('sys_normal_disable')}]]; - + var moduleType = [[${@dict.getType('moduleType')}]]; $(function() { var options = { url: prefix + "/list", createUrl: prefix + "/add", updateUrl: prefix + "/edit/{id}", removeUrl: prefix + "/remove", - modalName: "订单分析主表", + modalName: "规则配置主表", search: false, sortName: "id", sortOrder: "desc", @@ -97,7 +97,11 @@ }, { field : 'moduleType', - title : '模块' + title : '模块', + align : "center", + formatter: function (value, item, index) { + return $.table.selectDictLabel(moduleType, value); + } }, { field : 'recordType', diff --git a/src/main/resources/templates/config/material/add.html b/src/main/resources/templates/config/material/add.html index a1a199c..4a6c67d 100644 --- a/src/main/resources/templates/config/material/add.html +++ b/src/main/resources/templates/config/material/add.html @@ -40,8 +40,8 @@ <div class="form-group"> <label class="col-sm-3 control-label">物料类别:</label> <div class="col-sm-8"> - <select id="type" name="type" class="form-control" th:with="materialType=${@dict.getType('materialType')}"> - <option th:each="item : ${materialType}" th:text="${item['dictLabel']}" th:value="${item['dictValue']}"></option> + <select id="type" name="type" class="form-control" th:with="materialType=${@materialType.queryType()}"> + <option th:each="item : ${materialType}" th:text="${item['name']}" th:value="${item['code']}"></option> </select> </div> </div> diff --git a/src/main/resources/templates/config/material/edit.html b/src/main/resources/templates/config/material/edit.html index dea4517..92fd634 100644 --- a/src/main/resources/templates/config/material/edit.html +++ b/src/main/resources/templates/config/material/edit.html @@ -35,9 +35,8 @@ <div class="form-group"> <label class="col-sm-3 control-label">物料类别:</label> <div class="col-sm-8"> - <select id="type" name="type" class="form-control" th:with="materialType=${@dict.getType('materialType')}"> - <option th:each="item : ${materialType}" th:text="${item['dictLabel']}" th:value="${item['dictValue']}" - th:field="*{type}"></option> + <select id="type" name="type" class="form-control" th:with="materialType=${@materialType.queryType()}" th:field="*{type}"> + <option th:each="item : ${materialType}" th:text="${item['name']}" th:value="${item['code']}"></option> </select> </div> </div> diff --git a/src/main/resources/templates/config/material/material.html b/src/main/resources/templates/config/material/material.html index 410a2df..0b48f64 100644 --- a/src/main/resources/templates/config/material/material.html +++ b/src/main/resources/templates/config/material/material.html @@ -66,7 +66,7 @@ var removeFlag = [[${@permission.hasPermi('config:material:remove')}]]; var prefix = ctx + "config/material"; var datas = [[${@dict.getType('sys_normal_disable')}]]; - var mType = [[${@dict.getType('materialType')}]]; + var mType = [[${@materialType.queryType()}]]; $(function() { var options = { url: prefix + "/list", @@ -95,7 +95,14 @@ title : '物料类别' , align: 'center', formatter: function(value, row, index) { - return $.table.selectDictLabel(mType, value); + var actions = []; + $.each(mType, function(index, dict) { + if (dict.code == value) { + actions.push("<span class='badge badge-" + dict.code + "'>" + dict.name + "</span>"); + return false; + } + }); + return actions.join(''); } }, { diff --git a/src/main/resources/templates/config/statusFlowHeader/add.html b/src/main/resources/templates/config/statusFlowHeader/add.html index c6ad1b4..e5e8f7a 100644 --- a/src/main/resources/templates/config/statusFlowHeader/add.html +++ b/src/main/resources/templates/config/statusFlowHeader/add.html @@ -20,7 +20,9 @@ <div class="form-group"> <label class="col-sm-3 control-label">模块:</label> <div class="col-sm-8"> - <input id="moduleType" name="moduleType" class="form-control" type="text"> + <select id="moduleType" name="moduleType" class="form-control" th:with="moduleTyped=${@dict.getType('moduleType')}"> + <option th:each="item : ${moduleType}" th:text="${item['dictLabel']}" th:value="${item['dictValue']}"></option> + </select> </div> </div> <div class="form-group"> diff --git a/src/main/resources/templates/config/statusFlowHeader/edit.html b/src/main/resources/templates/config/statusFlowHeader/edit.html index 61ebc57..38fe41d 100644 --- a/src/main/resources/templates/config/statusFlowHeader/edit.html +++ b/src/main/resources/templates/config/statusFlowHeader/edit.html @@ -21,7 +21,9 @@ <div class="form-group"> <label class="col-sm-3 control-label">模块:</label> <div class="col-sm-8"> - <input id="moduleType" name="moduleType" class="form-control" type="text" th:field="*{moduleType}"> + <select id="moduleType" name="moduleType" class="form-control" th:with="moduleTyped=${@dict.getType('moduleType')}" th:field="*{moduleType}"> + <option th:each="item : ${moduleType}" th:text="${item['dictLabel']}" th:value="${item['dictValue']}"></option> + </select> </div> </div> <div class="form-group"> diff --git a/src/main/resources/templates/config/waveMaster/waveMaster.html b/src/main/resources/templates/config/waveMaster/waveMaster.html index 270959f..38719d3 100644 --- a/src/main/resources/templates/config/waveMaster/waveMaster.html +++ b/src/main/resources/templates/config/waveMaster/waveMaster.html @@ -6,61 +6,138 @@ <div class="container-div"> <div class="row"> <div class="col-sm-12 select-info"> - <form id="waveMaster-form"> - <div class="select-list"> - <ul> - <li> - 编码:<input type="text" name="code"/> - </li> - <li> - 出库单条件:<input type="text" name="shipmentFilterCode"/> - </li> - <li> - 波次流程:<input type="text" name="waveFlowCode"/> - </li> - <li class="time"> - <label>创建时间: </label> - <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="createdBegin"/> - <span>-</span> - <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="createdEnd"/> - </li> - <li> - <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a> - <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('waveMaster-form')"><i class="fa fa-refresh"></i> 重置</a> - <!--<a class="btn btn-success btn-rounded btn-sm" onclick="$.table.exportExcel()" shiro:hasPermission="system:role:export"><i class="fa fa-download"></i> 导出</a>--> - </li> - </ul> + <div class="col-sm-12 select-info"> + <ul id="myTab" class="nav nav-tabs"> + <li class="active"><a href="#tabMaster" data-toggle="tab">波次主表</a></li> + <li><a href="#tabHeader" data-toggle="tab" onclick="header()">主表</a></li> + <li><a href="#tabDetail" data-toggle="tab" onclick="detail()">明细</a></li> + </ul> + <div id="myTabContent" class="tab-content"> + <div class="tab-pane fade in active" id="tabMaster"> + <div class="col-sm-12 select-info"> + <form id="waveMaster-form"> + <div class="select-list"> + <ul> + <li> + 编码:<input type="text" name="code"/> + </li> + <li> + 出库单条件:<input type="text" name="shipmentFilterCode"/> + </li> + <li> + 波次流程:<input type="text" name="waveFlowCode"/> + </li> + <li class="time"> + <label>创建时间: </label> + <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="createdBegin"/> + <span>-</span> + <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="createdEnd"/> + </li> + <li> + <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a> + <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('waveMaster-form')"><i class="fa fa-refresh"></i> 重置</a> + <!--<a class="btn btn-success btn-rounded btn-sm" onclick="$.table.exportExcel()" shiro:hasPermission="system:role:export"><i class="fa fa-download"></i> 导出</a>--> + </li> + </ul> + </div> + </form> + </div> + + <div class="col-sm-12 select-info"> + <table id="bootstrap-table" data-mobile-responsive="true" class="table table-bordered table-hover"></table> + </div> + + <div class="btn-group hidden-xs" id="toolbar" role="group"> + <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" shiro:hasPermission="config:waveMaster:add"> + <i class="fa fa-plus"></i> 新增 + </a> + <a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.batRemove()" shiro:hasPermission="config:waveMaster:remove"> + <i class="fa fa-trash-o"></i> 删除 + </a> + </div> + </div> + + <div class="tab-pane fade" id="tabHeader"> + <div class="col-sm-12 select-info"> + <form id="waveFlowHeader-form"> + <div class="select-list"> + <ul> + <li> + 编码:<input type="text" name="code"/> + </li> + <li> + 出库单条件:<input type="text" name="shipmentFilterCode"/> + </li> + <li> + 波次流程:<input type="text" name="waveFlowCode"/> + </li> + <li class="time"> + <label>创建时间: </label> + <input type="text" class="time-input" id="waveFlowHeaderStartTime" placeholder="开始时间" name="createdBegin"/> + <span>-</span> + <input type="text" class="time-input" id="waveFlowHeaderEndTime" placeholder="结束时间" name="createdEnd"/> + </li> + <li> + <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a> + <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('waveMaster-form')"><i class="fa fa-refresh"></i> 重置</a> + <!--<a class="btn btn-success btn-rounded btn-sm" onclick="$.table.exportExcel()" shiro:hasPermission="system:role:export"><i class="fa fa-download"></i> 导出</a>--> + </li> + </ul> + </div> + </form> + </div> + <div class="btn-group hidden-xs" id="toolbar1" role="group"> + <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" + shiro:hasPermission="config:waveFlowHeader:add"> + <i class="fa fa-plus"></i> 新增 + </a> + <a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.batRemove()" + shiro:hasPermission="config:waveFlowHeader:remove"> + <i class="fa fa-trash-o"></i> 删除 + </a> + </div> + + <table id="bootstrap-table1" data-mobile-responsive="true" class="table table-bordered table-hover"></table> + + </div> + + <div class="tab-pane fade" id="tabDetail"> + <table id="bootstrap-table2" data-mobile-responsive="true" + class="table table-bordered table-hover"></table> + </div> </div> - </form> - </div> - <div class="btn-group hidden-xs" id="toolbar" role="group"> - <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" shiro:hasPermission="config:waveMaster:add"> - <i class="fa fa-plus"></i> 新增 - </a> - <a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.batRemove()" shiro:hasPermission="config:waveMaster:remove"> - <i class="fa fa-trash-o"></i> 删除 - </a> - </div> - <div class="col-sm-12 select-info"> - <table id="bootstrap-table" data-mobile-responsive="true" class="table table-bordered table-hover"></table> - </div> - <div> </div> + + <div th:include="include :: footer"></div> <script th:inline="javascript"> var editFlag = [[${@permission.hasPermi('config:waveMaster:edit')}]]; var removeFlag = [[${@permission.hasPermi('config:waveMaster:remove')}]]; var prefix = ctx + "config/waveMaster"; var datas = [[${@dict.getType('sys_normal_disable')}]]; + var code = ""; + var headerId = ""; + var prefix1 = ctx + "config/waveFlowHeader"; + var prefix2 = ctx + "config/waveFlowDetail"; + var editFlag1 = [[${@permission.hasPermi('config:waveFlowHeader:edit')}]]; + var removeFlag1 = [[${@permission.hasPermi('config:waveFlowHeader:remove')}]]; + $(function() { - var options = { + $("#bootstrap-table").bootstrapTable({ url: prefix + "/list", createUrl: prefix + "/add", updateUrl: prefix + "/edit/{id}", removeUrl: prefix + "/remove", modalName: "波次主表", search: false, + showRefresh: true, + showColumns: true, + showExport: true, + smartDisplay:true, + iconSize: 'outline', + method: "post", + toolbar: "#toolbar", columns: [{ checkbox: true }, @@ -188,10 +265,253 @@ actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')" ><i class="fa fa-trash-o"></i>删除</a>'); return actions.join(''); } - }] - }; - $.table.init(options); + }], + onDblClickRow: function (row) { + headerReg(row.waveFlowCode) + } + }); + }); + + $("#bootstrap-table1").bootstrapTable({ + url: prefix1 + "/list", + createUrl: prefix1 + "/add", + updateUrl: prefix1 + "/edit/{id}", + removeUrl: prefix1 + "/remove", + modalName: "波次流主表", + search: false, + sortName: "id", + sortOrder: "desc", + toolbar: "#toolbar1", + onRefresh: function(){ + loadHeader(); + }, + columns: [{ + checkbox: true + }, + { + field : 'id', + title : 'id' + }, + { + field : 'code', + title : '流程名称' + }, + { + field : 'version', + title : '数据版本', + visible : false + }, + { + field : 'processStamp', + title : '处理标记', + visible : false + }, + { + field : 'created', + title : '创建时间' + }, + { + field : 'createdBy', + title : '创建用户' + }, + { + field : 'lastUpdated', + title : '更新时间' + }, + { + field : 'lastUpdatedBy', + title : '更新用户' + }, + { + field : 'userDef1', + title : '自定义字段1', + visible:false + }, + { + field : 'userDef2', + title : '自定义字段2' , + visible:false + }, + { + field : 'userDef3', + title : '自定义字段3' , + visible:false + }, + { + title: '操作', + align: 'center', + formatter: function(value, row, index) { + var actions = []; + actions.push('<a class="btn btn-success btn-xs ' + editFlag1 + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> '); + actions.push('<a class="btn btn-danger btn-xs ' + removeFlag1 + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-trash-o"></i>删除</a>'); + return actions.join(''); + } + }], + onDblClickRow: function (row) { + detailReg(row.id) + } }); + + $("#bootstrap-table2").bootstrapTable({ + url: prefix + "/list", + createUrl: prefix + "/add", + updateUrl: prefix + "/edit/{id}", + removeUrl: prefix + "/remove", + modalName: "波次流明细", + queryParams:function(params) { + return { + // 传递参数查询参数 + pageSize: params.limit, + pageNum: params.offset / params.limit + 1, + searchValue: params.search, + orderByColumn: params.sort, + isAsc: params.order + }; + }, + onRefresh: function(){ + loadDeatil(); + }, + search: false, + sortName: "id", + sortOrder: "desc", + columns: [{ + checkbox: true + }, + { + field : 'id', + title : 'id' + }, + { + field : 'headerId', + title : '头表id', + visible: false + }, + { + field : 'waveFlowCode', + title : '波次流程' + }, + { + field : 'sequence', + title : '序号' + }, + { + field : 'waveStepCode', + title : '波次步骤' + }, + { + field : 'waveStepName', + title : '描述' + }, + { + field : 'value1', + title : '参数1', + visible : false + }, + { + field : 'value2', + title : '参数2', + visible : false + }, + { + field : 'value3', + title : '参数3', + visible : false + }, + { + field : 'created', + title : '创建时间' + }, + { + field : 'createdBy', + title : '创建用户' + }, + { + field : 'lastUpdated', + title : '更新时间' + }, + { + field : 'lastUpdatedBy', + title : '更新用户' + }, + { + field : 'userDef1', + title : '自定义字段1' , + visible:false + }, + { + field : 'userDef2', + title : '自定义字段2' , + visible:false + }, + { + field : 'userDef3', + title : '自定义字段3' , + visible:false + }, + { + title: '操作', + align: 'center', + formatter: function(value, row, index) { + var actions = []; + actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> '); + actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-trash-o"></i>删除</a>'); + return actions.join(''); + } + }] + }) + + function header() { + $("#myTab li").removeClass("active"); + $("#tabMaster").removeClass("in active"); + $("#myTab li:eq(1)").addClass("active"); + $("#tabHeader").addClass("in active"); + loadHeader(); + } + + function detail() { + $("#myTab li").removeClass("active"); + $("#tabMaster").removeClass("in active"); + $("#tabHeader").removeClass("in active"); + $("#myTab li:eq(2)").addClass("active"); + $("#tabDetail").addClass("in active"); + loadDeatil(); + } + + function loadHeader(){ + $.ajax({ + url:prefix1+'/list', + type:"post", + data:{ + code: code, + }, + success:function (value) { + $("#bootstrap-table1").bootstrapTable('load',value.data); + } + }); + } + + function loadDeatil() { + $.ajax({ + url:prefix2+'/list', + type:"post", + data:{ + headerId: headerId, + }, + success:function (value) { + $("#bootstrap-table2").bootstrapTable('load',value.data); + } + }); + } + + function headerReg(waveFlowCode) { + code = waveFlowCode; + header(); + } + + function detailReg(rowId){ + headerId = rowId; + detail(); + } </script> </body> </html> \ No newline at end of file diff --git a/src/main/resources/templates/inventory/adjustDetail/adjustDetail.html b/src/main/resources/templates/inventory/adjustDetail/adjustDetail.html index 700cd04..b38a854 100644 --- a/src/main/resources/templates/inventory/adjustDetail/adjustDetail.html +++ b/src/main/resources/templates/inventory/adjustDetail/adjustDetail.html @@ -118,9 +118,6 @@ var created; $(function () { - update(); - }); - function update() { let adjustCode=null; let options = { url:prefix + "/list", @@ -129,9 +126,12 @@ sortOrder: "desc", search: false, showRefresh: true, + onRefresh: function(){ + update(); + }, columns: [ { - radio: true + checkbox: true }, /*{ title: '调整操作', @@ -351,44 +351,24 @@ $.table.init(options); } - /*$.ajax({ - url: prefix_head + "/getHeader", - type: "post", - data: { - id: $('#cyclecountAdjustId').val() - }, - success: function (value) { - if (value.data) { - $('#code').val(value.data.code); - // $('#type').val(value.data.typeLabel); - $('#status').val(value.data.statusLabel); - $('#created').val(value.data.created); - var text_val = $('#created').val(); - $('#created').val(text_val.replace("T", " ")); - //$('#createdBy').val(value.data.createdBy); - $('#lastUpdated').val(value.data.lastUpdated); - var text_val_t = $('#lastUpdated').val(); - $('#lastUpdated').val(text_val_t.replace("T", " ")); - //$('#lastUpdatedBy').val(value.data.lastUpdatedBy); - } - } - })*/ - } - - /**盘点差异调整*/ - function addAdjust() { - var row = $('#bootstrap-table').bootstrapTable('getSelections'); + }); - $.modal.confirm("注意:该操作将更改库存,当实盘数量为0且库位上只剩空容器时,请手动执行空托出库任务,容器上有货则无需其他操作!", - function () { - /*判断是否已经调整过*/ - if (row[0].status == 2) { - $.modal.msg('该条明细已调整,请勿重复调整!') - } else { - $.modal.open("差异调整单", prefix + "/adjustEdit?id=" + row[0].id) - } - }); + /* + *盘点差异调整 + * */ + function addAdjust() { + var rows = $.common.isEmpty($.table._option.id) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.id); + if (rows.length == 0) { + $.modal.alertWarning("请至少选择一条记录"); + return; + } + $.modal.confirm("注意:该操作将更改库存,当实盘数量为0且库位上只剩空容器时,请手动执行空托出库任务,容器上有货则无需其他操作!" + , function() { + var url = prefix + "/adjustEdit"; + var data = { "ids": rows.join() }; + postInner(url, data); + }); } // @@ -422,51 +402,23 @@ // shadeClose: true, //点击遮罩关闭层 }) } - - /* - * 差异复盘 - */ - function createCyclecountWithGapQty() { - $.modal.confirm("确认进行差异复盘么?该操作会将有差异的明细重新生成一个新的盘点单。", function () { - var url = prefix + "/createCyclecountWithGapQty"; - var data = {"headId": $('#headId').val()}; - postInner(url, data); - }); - } - - /* //调整差异库存 - function adjust() { - $.modal.confirm("注意:该操作将更改库存,当实盘数量为0且库位上只剩空容器时,请手动执行空托出库任务,容器上有货则无需其他操作!", - function() { - var url = prefix + "/adjust"; - var data = { "headId": $('#headId').val() }; - postInner(url,data); - }); - } - function postInner(url,data) { - $.modal.loading("正在处理中,请稍后..."); - $.ajax({ - url:url, - type:"post", - data:data, - success:function (result) { - if (result.code == web_status.SUCCESS) { - $.modal.msgSuccess(result.msg); - update(); - } else { - $.modal.alertError(result.msg); - } - $.modal.closeLoading(); + function postInner(url,data) { + $.modal.loading("正在处理中,请稍后..."); + $.ajax({ + url:url, + type:"post", + data:data, + success:function (result) { + if (result.code == web_status.SUCCESS) { + $.modal.msgSuccess(result.msg); + update(); + } else { + $.modal.alertError(result.msg); } - }) - }*/ - - /* //下发单条盘点 - function outcheck(id) { - var url = prefix + "/createCyccoutTaskByDetailId"; - var data = { "detailId": id }; - postInner(url,data); - }*/ + $.modal.closeLoading(); + } + }) + } </script> diff --git a/src/main/resources/templates/system/dict/data/data.html b/src/main/resources/templates/system/dict/data/data.html index da082d3..35a424a 100644 --- a/src/main/resources/templates/system/dict/data/data.html +++ b/src/main/resources/templates/system/dict/data/data.html @@ -146,7 +146,12 @@ function queryParams(params) { return { - dictType: $("#dictType").val() + dictType: $("#dictType").val(), + pageSize: params.limit, + pageNum: params.offset / params.limit + 1, + searchValue: params.search, + orderByColumn: params.sort, + isAsc: params.order }; }