Commit c7a0e440edf0121a6c30257fdcc3cd4acde6cbbf

Authored by mahuandong
2 parents 59cdc073 9b3fb0b5

Merge remote-tracking branch 'origin/develop' into develop

src/main/java/com/huaheng/pc/shipment/shipmentHeader/controller/ShipmentHeaderController.java
... ... @@ -184,6 +184,22 @@ public class ShipmentHeaderController extends BaseController
184 184 return AjaxResult.success("删除成功!");
185 185 }
186 186  
  187 +
  188 + /**
  189 + * 审核出库主单
  190 + */
  191 + @RequiresPermissions("shipment:bill:edit")
  192 + @Log(title = "出库-出库单", operating="审核出库主单", action = BusinessType.UPDATE)
  193 + @PostMapping("/review")
  194 + @ResponseBody
  195 + public AjaxResult review(String ids)
  196 + {
  197 + if (StringUtils.isEmpty(ids)) {
  198 + return AjaxResult.error("id不能为空");
  199 + }
  200 + return shipmentHeaderService.review(ids);
  201 + }
  202 +
187 203 /**
188 204 * 出库单报表打印
189 205 * @return
... ...
src/main/java/com/huaheng/pc/shipment/shipmentHeader/service/ShipmentHeaderService.java
... ... @@ -11,7 +11,6 @@ public interface ShipmentHeaderService extends IService<ShipmentHeader>{
11 11 //新增出库主单
12 12 AjaxResult<Boolean> saveHeader(ShipmentHeader shipmentHeader) ;
13 13  
14   -
15 14 //根据单据类型建单据号
16 15 String createCode(String shipmentType);
17 16  
... ... @@ -20,4 +19,7 @@ public interface ShipmentHeaderService extends IService&lt;ShipmentHeader&gt;{
20 19  
21 20 AjaxResult addHistory(ShipmentHeader shipmentHeader) throws InvocationTargetException, IllegalAccessException;
22 21  
  22 + //审核出库单
  23 + AjaxResult review(String ids);
  24 +
23 25 }
... ...
src/main/java/com/huaheng/pc/shipment/shipmentHeader/service/ShipmentHeaderServiceImpl.java
... ... @@ -3,6 +3,7 @@ package com.huaheng.pc.shipment.shipmentHeader.service;
3 3 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 4 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
5 5 import com.huaheng.common.exception.service.ServiceException;
  6 +import com.huaheng.common.support.Convert;
6 7 import com.huaheng.common.utils.security.ShiroUtils;
7 8 import com.huaheng.framework.web.domain.AjaxResult;
8 9 import com.huaheng.pc.shipment.shipmentContainerHeader.service.ShipmentContainerHeaderService;
... ... @@ -169,4 +170,59 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl&lt;ShipmentHeaderMapper,
169 170 }
170 171 return null;
171 172 }
  173 +
  174 + /**审核出库单,加入订单池
  175 + * 1、找到主单,确定主单的状态是否小于100
  176 + * 2.小于100时,把主单和相应的子单加入到list中,大于等于100时,直接跳过
  177 + * 3.将修改后的主单列表和子单列表进行修改,加入订单池
  178 + *
  179 + * @param ids
  180 + * @return
  181 + */
  182 +
  183 + @Override
  184 + public AjaxResult review(String ids) {
  185 +
  186 + List<ShipmentHeader> shipmentHeaders = new ArrayList<>();
  187 + List<ShipmentDetail> shipmentDetails = new ArrayList<>();
  188 +
  189 + //1、找到主单,确定主单的状态是否小于100
  190 + for (Integer id : Convert.toIntArray(ids)){
  191 + ShipmentHeader shipmentHeader = this.getById(id);
  192 + if(shipmentHeader == null){
  193 + return AjaxResult.error("id为"+id+"的主单在系统不存在");
  194 + }
  195 +
  196 + //2.小于100时,把主单和相应的子单加入到list中,大于等于100时,直接跳过
  197 + if(shipmentHeader.getFirstStatus() < 100 && shipmentHeader.getLastStatus() <100){
  198 + shipmentHeader.setFirstStatus(100);
  199 + shipmentHeader.setLastStatus(100);
  200 + shipmentHeaders.add(shipmentHeader);
  201 +
  202 + LambdaQueryWrapper<ShipmentDetail> lam = Wrappers.lambdaQuery();
  203 + lam.eq(ShipmentDetail::getShipmentId,id)
  204 + .eq(ShipmentDetail::getWarehouseCode,ShiroUtils.getWarehouseCode());
  205 + List<ShipmentDetail> shipmentDetailList = shipmentDetailService.list(lam);
  206 + if(shipmentDetailList != null){
  207 + for(ShipmentDetail shipmentDetail : shipmentDetailList){
  208 + shipmentDetail.setStatus(100);
  209 + }
  210 + shipmentDetails.addAll(shipmentDetailList);
  211 + }else {
  212 + return AjaxResult.error("id为"+id+"的出库明细在系统不存在");
  213 + }
  214 + }
  215 + }
  216 +
  217 + // 3.将修改后的主单列表和子单列表进行修改,加入订单池
  218 + Boolean flag = this.updateBatchById(shipmentHeaders);
  219 + if (flag == false){
  220 + throw new ServiceException("修改主单状态失败");
  221 + }
  222 + flag = shipmentDetailService.updateBatchById(shipmentDetails);
  223 + if (flag == false){
  224 + throw new ServiceException("修改明细状态失败");
  225 + }
  226 + return AjaxResult.success("订单审核成功,成功加入订单池");
  227 + }
172 228 }
... ...
src/main/resources/templates/config/statusFlowDetail/statusFlowDetail.html
... ... @@ -23,6 +23,7 @@
23 23 var editFlag = [[${@permission.hasPermi('config:statusFlowDetails:edit')}]];
24 24 var removeFlag = [[${@permission.hasPermi('config:statusFlowDetails:remove')}]];
25 25 var datas = [[${@dict.getType('sys_normal_disable')}]];
  26 + var moduleType = [[${@dict.getType('moduleType')}]];
26 27 var nessaryDatas = [[${@dict.getType('nessary')}]];
27 28 var moduleType = [[${@dict.getType('moduleType')}]];
28 29  
... ...
src/main/resources/templates/shipment/shipmentHeader/shipmentHeader.html
... ... @@ -87,10 +87,10 @@
87 87 shiro:hasPermission="shipment:bill:remove">
88 88 <i class="fa fa-trash-o"></i> 删除
89 89 </a>
90   - <!--<a class="btn btn-outline btn-success btn-rounded" onclick="analysis()"-->
91   - <!--shiro:hasPermission="shipment:bill:analysis">-->
92   - <!--<i class="fa fa-plus"></i> 订单分析-->
93   - <!--</a>-->
  90 + <a class="btn btn-outline btn-success btn-rounded" onclick="review()"
  91 + shiro:hasPermission="shipment:bill:edit">
  92 + <i class="fa fa-plus"></i> 订单审核
  93 + </a>
94 94 <a class="btn btn-outline btn-success btn-rounded" onclick="wave()"
95 95 shiro:hasPermission="shipment:bill:wave">
96 96 <i class="fa fa-plus"></i> 加入波次
... ... @@ -214,7 +214,8 @@
214 214 var uploadStatus=[[${@dict.getType('uploadStatus')}]];
215 215 var detailCreateUrl=prefix_detail+"/add";
216 216 var detailRemoveUrl=prefix_detail+"/remove";
217   - var detailanalysisUrl=prefix+"/analysis";
  217 + var reviewUrl=prefix+"/review";
  218 + var analysisUrl=prefix+"/analysis";
218 219 var inventoryStatus=[[${@dict.getType('inventoryStatus')}]];
219 220 var rossDoccking = [[${@permission.hasPermi('shipment:bill:rossDoccking')}]];
220 221 var rossDocckingUrl =prefix_detail+"/rossDoccking";
... ... @@ -640,10 +641,22 @@
640 641 });
641 642 }
642 643  
  644 + /* 订单审核 */
  645 + function review() {
  646 + var rows=$("#bootstrap-table").bootstrapTable('getSelections');
  647 + if (rows.length == 0) {
  648 + $.modal.alertWarning("请至少选择一条记录");
  649 + return;
  650 + }
  651 + var url = reviewUrl;
  652 + var data = { "ids": rows.map(function(v){return v.id;}).join(',') };
  653 + localSubmit(url, "post", "json", data);
  654 + }
  655 +
643 656  
644 657 /* 订单分析 */
645 658 function analysis() {
646   - var rows=$("#bootstrap-table-detail").bootstrapTable('getSelections');
  659 + var rows=$("#bootstrap-table").bootstrapTable('getSelections');
647 660 if (rows.length == 0) {
648 661 $.modal.alertWarning("请至少选择一条记录");
649 662 return;
... ...