Commit 56210a8748575bbaea2ac115b2069e0257ecc5d8

Authored by mahuandong
1 parent 9919f1ed

添加入库明细中是否质检的判断

添加入库明细中判断入库流程
src/main/java/com/huaheng/pc/receipt/receiptDetail/domain/ReceiptDetail.java
... ... @@ -6,6 +6,8 @@ import io.swagger.annotations.ApiModelProperty;
6 6 import java.io.Serializable;
7 7 import java.math.BigDecimal;
8 8 import java.util.Date;
  9 +
  10 +import io.swagger.annotations.ApiParam;
9 11 import lombok.Data;
10 12  
11 13 @ApiModel(value = "com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail")
... ... @@ -341,4 +343,11 @@ public class ReceiptDetail implements Serializable {
341 343 @ApiModelProperty(value = "是否删除")
342 344 private Boolean deleted;
343 345  
  346 + /**
  347 + * 流程编码
  348 + */
  349 + @TableField(value = "statusFlowCode")
  350 + @ApiModelProperty(value = "流程编码")
  351 + private String statusFlowCode;
  352 +
344 353 }
345 354 \ No newline at end of file
... ...
src/main/java/com/huaheng/pc/receipt/receiptDetail/service/ReceiptDetailServiceImpl.java
... ... @@ -7,6 +7,8 @@ import com.huaheng.common.support.Convert;
7 7 import com.huaheng.common.utils.StringUtils;
8 8 import com.huaheng.common.utils.security.ShiroUtils;
9 9 import com.huaheng.framework.web.domain.AjaxResult;
  10 +import com.huaheng.pc.check.checkHeader.domain.CheckHeader;
  11 +import com.huaheng.pc.check.checkHeader.service.CheckHeaderService;
10 12 import com.huaheng.pc.config.material.domain.Material;
11 13 import com.huaheng.pc.config.material.service.MaterialService;
12 14 import com.huaheng.pc.config.materialType.domain.MaterialType;
... ... @@ -48,6 +50,8 @@ public class ReceiptDetailServiceImpl extends ServiceImpl<ReceiptDetailMapper, R
48 50 private ReceiptPreferenceService receiptPreferenceService;
49 51 @Resource
50 52 private IDictDataService dictDataService;
  53 + @Resource
  54 + private CheckHeaderService checkHeaderService;
51 55  
52 56 /**
53 57 * 新增入库明细
... ... @@ -163,6 +167,18 @@ public class ReceiptDetailServiceImpl extends ServiceImpl<ReceiptDetailMapper, R
163 167 return receiptDetail;
164 168 }
165 169  
  170 + //如果入库明细绑定了入库流程则从入库明细中选择流程
  171 + if ( StringUtils.isNotEmpty(receiptDetail.getStatusFlowCode())){
  172 + List<StatusFlowDetail> statusFlowDetails = statusFlowDetailService.queryStatusFlowDetail(receiptDetail.getStatusFlowCode());
  173 + String status = nextStatusFlow(statusFlowDetails, receiptDetail.getProcessStamp());
  174 + //在状态到达时候是判断是否要质检
  175 + if ("200".equals(status) && inspection(receiptDetail)){
  176 + receiptDetail.setProcessStamp("180");
  177 + } else {
  178 + receiptDetail.setProcessStamp(status);
  179 + }
  180 + return receiptDetail;
  181 + }
166 182 //查询头表信息
167 183 LambdaQueryWrapper<ReceiptHeader> lambdaReceiptHeader = Wrappers.lambdaQuery();
168 184 lambdaReceiptHeader.eq(ReceiptHeader::getCode, receiptDetail.getReceiptCode());
... ... @@ -183,13 +199,23 @@ public class ReceiptDetailServiceImpl extends ServiceImpl&lt;ReceiptDetailMapper, R
183 199 //物料是否有入库流程
184 200 List<StatusFlowDetail> statusFlowDetails = statusFlowDetailService.queryStatusFlowDetail(receiptType.getReceiptFlow());
185 201 String status = nextStatusFlow(statusFlowDetails, receiptDetail.getProcessStamp());
186   - receiptDetail.setProcessStamp(status);
  202 + //在状态到达时候是判断是否要质检
  203 + if ("200".equals(status) && inspection(receiptDetail)){
  204 + receiptDetail.setProcessStamp("180");
  205 + } else {
  206 + receiptDetail.setProcessStamp(status);
  207 + }
187 208 return receiptDetail;
188 209 } else if (material.getReceivingFlow() != null){
189 210 //物料是否有入库流程
190 211 List<StatusFlowDetail> statusFlowDetails = statusFlowDetailService.queryStatusFlowDetail(material.getReceivingFlow());
191 212 String status = nextStatusFlow(statusFlowDetails, receiptDetail.getProcessStamp());
192   - receiptDetail.setProcessStamp(status);
  213 + //在状态到达时候是判断是否要质检
  214 + if ("200".equals(status) && inspection(receiptDetail)){
  215 + receiptDetail.setProcessStamp("180");
  216 + } else {
  217 + receiptDetail.setProcessStamp(status);
  218 + }
193 219 return receiptDetail;
194 220 } else {
195 221 //该物料类别是否有入库流程
... ... @@ -199,7 +225,12 @@ public class ReceiptDetailServiceImpl extends ServiceImpl&lt;ReceiptDetailMapper, R
199 225 if (materialType.getReceivingFlow() != null) {
200 226 List<StatusFlowDetail> statusFlowDetails = statusFlowDetailService.queryStatusFlowDetail(materialType.getReceivingFlow());
201 227 String status = nextStatusFlow(statusFlowDetails, receiptDetail.getProcessStamp());
202   - receiptDetail.setProcessStamp(status);
  228 + //在状态到达时候是判断是否要质检
  229 + if ("200".equals(status) && inspection(receiptDetail)){
  230 + receiptDetail.setProcessStamp("180");
  231 + } else {
  232 + receiptDetail.setProcessStamp(status);
  233 + }
203 234 return receiptDetail;
204 235 } else {
205 236 //以上都没有的情况下查询入库首选项中的入库流程
... ... @@ -208,7 +239,12 @@ public class ReceiptDetailServiceImpl extends ServiceImpl&lt;ReceiptDetailMapper, R
208 239 ReceiptPreference receiptPreference = receiptPreferenceService.getOne(lambda);
209 240 List<StatusFlowDetail> statusFlowDetails = statusFlowDetailService.queryStatusFlowDetail(receiptPreference.getReceivingFlow());
210 241 String status = nextStatusFlow(statusFlowDetails, receiptDetail.getProcessStamp());
211   - receiptDetail.setProcessStamp(status);
  242 + //在状态到达时候是判断是否要质检
  243 + if ("200".equals(status) && inspection(receiptDetail)){
  244 + receiptDetail.setProcessStamp("180");
  245 + } else {
  246 + receiptDetail.setProcessStamp(status);
  247 + }
212 248 return receiptDetail;
213 249 }
214 250 }
... ... @@ -308,4 +344,20 @@ public class ReceiptDetailServiceImpl extends ServiceImpl&lt;ReceiptDetailMapper, R
308 344 }
309 345 return AjaxResult.success("审核完成");
310 346 }
  347 +
  348 + /**
  349 + * 判断明细中是否质检
  350 + */
  351 + public boolean inspection(ReceiptDetail receiptDetail){
  352 + //如果明细中需要质检,则判断是否已经生成质检单
  353 + if ("0".equals(receiptDetail.getQcCheck())){
  354 + LambdaQueryWrapper<CheckHeader> lambda = Wrappers.lambdaQuery();
  355 + lambda.eq(CheckHeader::getReferCode, receiptDetail.getReceiptCode());
  356 + CheckHeader checkHeader = checkHeaderService.getOne(lambda);
  357 + if (checkHeader == null){
  358 + return true;
  359 + }
  360 + }
  361 + return false;
  362 + }
311 363 }
... ...
src/main/java/com/huaheng/pc/receipt/receiptHeader/service/ReceiptHeaderService.java
... ... @@ -158,6 +158,13 @@ public class ReceiptHeaderService extends ServiceImpl&lt;ReceiptHeaderMapper, Recei
158 158 receiptDetailLambda.eq(ReceiptDetail::getReceiptId, id);
159 159 List<ReceiptDetail> receiptDetails = receiptDetailService.list(receiptDetailLambda);
160 160  
  161 + //判断是否已经生成了质检单
  162 + LambdaQueryWrapper<CheckHeader> checkHeaderLambdaQueryWrapper = Wrappers.lambdaQuery();
  163 + checkHeaderLambdaQueryWrapper.eq(CheckHeader::getReferCode, receiptHeader.getCode());
  164 + CheckHeader checkHeaderQuery = checkHeaderService.getOne(checkHeaderLambdaQueryWrapper);
  165 + if (checkHeaderQuery != null){
  166 + throw new ServiceException("质检表已生成");
  167 + }
161 168 //创建质检头表
162 169 CheckHeader checkHeader = new CheckHeader();
163 170 checkHeader.setCode(receiptHeader.getCode());
... ... @@ -170,7 +177,7 @@ public class ReceiptHeaderService extends ServiceImpl&lt;ReceiptHeaderMapper, Recei
170 177 checkHeader.setLastUpdatedBy(ShiroUtils.getLoginName());
171 178  
172 179 if (!checkHeaderService.save(checkHeader)){
173   - throw new ServiceException("添加质检头表发送错误");
  180 + throw new ServiceException("添加质检头表错误");
174 181 }
175 182  
176 183 //查询保存后的质检头表
... ...
src/main/java/com/huaheng/pc/receipt/receiptHeaderHistory/service/ReceiptHeaderHistoryService.java
... ... @@ -63,16 +63,19 @@ public class ReceiptHeaderHistoryService extends ServiceImpl&lt;ReceiptHeaderHistor
63 63 if (!receiptHeaderService.removeById(receiptHeader.getId())){
64 64 throw new ServiceException("删除头表失败");
65 65 }
66   - //删除入库明细
67   - List<Integer> ids = new ArrayList<>();
68   - for (int i=0; i<receiptDetailHistoryList.size();i++){
69   - receiptDetailHistoryList.get(i).setLastUpdatedBy(ShiroUtils.getLoginName());
70   - ids.add(receiptDetailHistoryList.get(i).getId());
71   - }
72   - if (!receiptDetailService.removeByIds(ids)) {
73   - throw new ServiceException("删除明细表失败");
  66 + // 当存在明细时删除
  67 + if (list.size()!= 0){
  68 + //删除入库明细
  69 + List<Integer> ids = new ArrayList<>();
  70 + for (int i=0; i<receiptDetailHistoryList.size();i++){
  71 + receiptDetailHistoryList.get(i).setLastUpdatedBy(ShiroUtils.getLoginName());
  72 + ids.add(receiptDetailHistoryList.get(i).getId());
  73 + }
  74 + if (!receiptDetailService.removeByIds(ids)) {
  75 + throw new ServiceException("删除明细表失败");
  76 + }
  77 + receiptDetailHistoryService.saveBatch(receiptDetailHistoryList);
74 78 }
75   - receiptDetailHistoryService.saveBatch(receiptDetailHistoryList);
76 79 this.save(receiptHeaderHistory);
77 80 }else {
78 81 return AjaxResult.success("入库单没有完成,无法删除");
... ...
src/main/resources/templates/config/receiptType/edit.html
... ... @@ -48,7 +48,7 @@
48 48 <div class="form-group">
49 49 <label class="col-sm-3 control-label">入库流程:</label>
50 50 <div class="col-sm-8">
51   - <select id="receiptFlow" name="receiptFlow" class="form-control" th:with="statusFlowList=${@StatusFlow.flowList('入库单')}" th:field="*{receiptFlow}">
  51 + <select id="receiptFlow" name="receiptFlow" class="form-control" th:with="statusFlowList=${@StatusFlow.flowList('receivingFlow')}" th:field="*{receiptFlow}">
52 52 <option th:each="flow : ${statusFlowList}" th:text="${flow['name']}" th:value="${flow['code']}"></option>
53 53 </select>
54 54 </div>
... ...
src/main/resources/templates/receipt/receiptDetail/add.html
... ... @@ -52,7 +52,10 @@
52 52 <div class="form-group">
53 53 <label class="col-sm-3 control-label">是否质检:</label>
54 54 <div class="col-sm-8">
55   - <input id="qcCheck" name="qcCheck" class="form-control" type="text">
  55 + <select id="qcCheck" name="qcCheck" class="form-control">
  56 + <option value="1">否</option>
  57 + <option value="0">是</option>
  58 + </select>
56 59 </div>
57 60 </div>
58 61 <div class="form-group">
... ... @@ -70,7 +73,7 @@
70 73 <div class="form-group">
71 74 <label class="col-sm-3 control-label">库存状态:</label>
72 75 <div class="col-sm-8">
73   - <select id="inventorySts" name="inventorySts" class="form-control" th:with="inventoryStatus=${@dict.getType('inventoryStatus')}">
  76 + <select id="inventorySts" name="inventorySts" class="form-control" th:with="inventoryStatus=${@dict.getType('inventorySts')}">
74 77 <option th:each="dict : ${inventoryStatus}" th:text="${dict['dictLabel']}" th:value="${dict['dictValue']}"></option>
75 78 </select>
76 79 </div>
... ... @@ -84,12 +87,21 @@
84 87 <div class="form-group">
85 88 <label class="col-sm-3 control-label">定位规则:</label>
86 89 <div class="col-sm-8">
87   - <select id="locatingRule" name="locatingRule" class="form-control" th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('入库')}">
  90 + <select id="locatingRule" name="locatingRule" class="form-control" th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('locationRule')}">
88 91 <option value="">请选择</option>
89 92 <option th:each="item : ${list}" th:text="${item['description']}" th:value="${item['code']}"></option>
90 93 </select>
91 94 </div>
92 95 </div>
  96 + <div class="form-group">
  97 + <label class="col-sm-3 control-label">入库流程:</label>
  98 + <div class="col-sm-8">
  99 + <select id="statusFlowCode" name="statusFlowCode" class="form-control" th:with="statusFlowList=${@StatusFlow.flowList('receivingFlow')}">
  100 + <option value="">请选择</option>
  101 + <option th:each="flow : ${statusFlowList}" th:text="${flow['name']}" th:value="${flow['code']}"></option>
  102 + </select>
  103 + </div>
  104 + </div>
93 105 <!-- <div class="form-group">-->
94 106 <!-- <label class="col-sm-3 control-label">标价:</label>-->
95 107 <!-- <div class="col-sm-8">-->
... ... @@ -150,6 +162,7 @@
150 162 submitHandler: function(form) {
151 163 var tableValue = $("#form-receiptDetail-add").serialize();
152 164 tableValue = formValueReplace(tableValue, "inventorySts", $("#inventorySts option:selected").val());
  165 + tableValue = formValueReplace(tableValue, "qcCheck", $("#qcCheck option:selected").val());
153 166 $.operate.save(prefix + "/add", tableValue);
154 167 }
155 168 });
... ...
src/main/resources/templates/receipt/receiptDetail/edit.html
... ... @@ -53,7 +53,10 @@
53 53 <div class="form-group">
54 54 <label class="col-sm-3 control-label">是否质检:</label>
55 55 <div class="col-sm-8">
56   - <input id="qcCheck" name="qcCheck" class="form-control" type="text" th:field="*{qcCheck}">
  56 + <select id="qcCheck" name="qcCheck" class="form-control">
  57 + <option value="1">否</option>
  58 + <option value="0">是</option>
  59 + </select>
57 60 </div>
58 61 </div>
59 62 <div class="form-group">
... ... @@ -72,7 +75,7 @@
72 75 <label class="col-sm-3 control-label">库存状态:</label>
73 76 <div class="col-sm-8">
74 77 <select id="inventorySts" name="inventorySts" class="form-control"
75   - th:with="inventoryStatus=${@dict.getType('inventoryStatus')}" th:field="*{inventorySts}">
  78 + th:with="inventoryStatus=${@dict.getType('inventorySts')}" th:field="*{inventorySts}">
76 79 <option th:each="dict : ${inventoryStatus}" th:text="${dict['dictLabel']}" th:value="${dict['dictValue']}"></option>
77 80 </select>
78 81 </div>
... ... @@ -86,7 +89,11 @@
86 89 <div class="form-group">
87 90 <label class="col-sm-3 control-label">定位规则:</label>
88 91 <div class="col-sm-8">
89   - <input id="locatingRule" name="locatingRule" class="form-control" type="text" th:field="*{locatingRule}">
  92 + <select id="locatingRule" name="locatingRule" class="form-control"
  93 + th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('locationRule')}" th:field="*{locatingRule}">
  94 + <option value="">请选择</option>
  95 + <option th:each="item : ${list}" th:text="${item['description']}" th:value="${item['code']}"></option>
  96 + </select>
90 97 </div>
91 98 </div>
92 99 <div class="form-group">
... ... @@ -101,6 +108,16 @@
101 108 <input id="itemNetPrice" name="itemNetPrice" class="form-control" type="text" th:field="*{itemNetPrice}">
102 109 </div>
103 110 </div>
  111 + <div class="form-group">
  112 + <label class="col-sm-3 control-label">入库流程:</label>
  113 + <div class="col-sm-8">
  114 + <select id="statusFlowCode" name="statusFlowCode" class="form-control"
  115 + th:with="statusFlowList=${@StatusFlow.flowList('receivingFlow')}" th:field="*{statusFlowCode}">
  116 + <option value="">请选择</option>
  117 + <option th:each="flow : ${statusFlowList}" th:text="${flow['name']}" th:value="${flow['code']}"></option>
  118 + </select>
  119 + </div>
  120 + </div>
104 121 <!--<div class="form-group">-->
105 122 <!--<label class="col-sm-3 control-label">自定义字段1:</label>-->
106 123 <!--<div class="col-sm-8">-->
... ...
src/main/resources/templates/receipt/receiptHeader/receiptHeader.html
... ... @@ -541,6 +541,10 @@
541 541 visible:false
542 542 },
543 543 {
  544 + field : 'statusFlowCode',
  545 + title : '流程编码'
  546 + },
  547 + {
544 548 field : 'isVirtualBom',
545 549 title : '是否虚拟套件',
546 550 formatter: function(value, row, index) {
... ...