| 
@@ -3,6 +3,7 @@ package com.lframework.xingyun.sc.impl.order; | 
 | 
@@ -3,6 +3,7 @@ package com.lframework.xingyun.sc.impl.order; | 
| 
3
 | 
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 | 
3
 | 
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 | 
| 
4
 | 
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 | 
4
 | 
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 | 
| 
5
 | 
 import com.github.pagehelper.PageInfo;
 | 
5
 | 
 import com.github.pagehelper.PageInfo;
 | 
| 
 | 
   | 
6
 | 
+import com.lframework.starter.bpm.service.FlowInstanceWrapperService;
 | 
| 
6
 | 
 import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
 | 
7
 | 
 import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
 | 
| 
7
 | 
 import com.lframework.starter.web.core.utils.PageResultUtil;
 | 
8
 | 
 import com.lframework.starter.web.core.utils.PageResultUtil;
 | 
| 
8
 | 
 import com.lframework.starter.web.core.components.resp.PageResult;
 | 
9
 | 
 import com.lframework.starter.web.core.components.resp.PageResult;
 | 
 | 
@@ -25,20 +26,23 @@ import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService; | 
 | 
@@ -25,20 +26,23 @@ import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService; | 
| 
25
 | 
 import com.lframework.xingyun.sc.vo.customer.credit.QueryCustomerCreditVo;
 | 
26
 | 
 import com.lframework.xingyun.sc.vo.customer.credit.QueryCustomerCreditVo;
 | 
| 
26
 | 
 import com.lframework.xingyun.sc.vo.order.*;
 | 
27
 | 
 import com.lframework.xingyun.sc.vo.order.*;
 | 
| 
27
 | 
 import org.apache.commons.collections.CollectionUtils;
 | 
28
 | 
 import org.apache.commons.collections.CollectionUtils;
 | 
| 
 | 
   | 
29
 | 
+import org.apache.commons.lang3.StringUtils;
 | 
| 
28
 | 
 import org.springframework.transaction.annotation.Transactional;
 | 
30
 | 
 import org.springframework.transaction.annotation.Transactional;
 | 
| 
29
 | 
 import org.springframework.stereotype.Service;
 | 
31
 | 
 import org.springframework.stereotype.Service;
 | 
| 
30
 | 
 
 | 
32
 | 
 
 | 
| 
31
 | 
 import javax.annotation.Resource;
 | 
33
 | 
 import javax.annotation.Resource;
 | 
| 
32
 | 
-import java.util.Collection;
 | 
 | 
   | 
| 
33
 | 
 import java.util.List;
 | 
34
 | 
 import java.util.List;
 | 
| 
34
 | 
 
 | 
35
 | 
 
 | 
| 
35
 | 
 @Service
 | 
36
 | 
 @Service
 | 
| 
36
 | 
 public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrderInfoMapper, PurchaseOrderInfo> implements PurchaseOrderInfoService {
 | 
37
 | 
 public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrderInfoMapper, PurchaseOrderInfo> implements PurchaseOrderInfoService {
 | 
| 
 | 
   | 
38
 | 
+    private static final String BPM_FLAG = "PURCHASE_ORDER";
 | 
| 
37
 | 
 
 | 
39
 | 
 
 | 
| 
38
 | 
     @Resource
 | 
40
 | 
     @Resource
 | 
| 
39
 | 
     private PurchaseOrderLineService purchaseOrderLineService;
 | 
41
 | 
     private PurchaseOrderLineService purchaseOrderLineService;
 | 
| 
40
 | 
     @Resource
 | 
42
 | 
     @Resource
 | 
| 
41
 | 
     private CustomerCreditService customerCreditService;
 | 
43
 | 
     private CustomerCreditService customerCreditService;
 | 
| 
 | 
   | 
44
 | 
+    @Resource
 | 
| 
 | 
   | 
45
 | 
+    private FlowInstanceWrapperService flowInstanceWrapperService;
 | 
| 
42
 | 
 
 | 
46
 | 
 
 | 
| 
43
 | 
     @Override
 | 
47
 | 
     @Override
 | 
| 
44
 | 
     public PageResult<PurchaseOrderInfo> query(Integer pageIndex, Integer pageSize, QueryPurchaseOrderInfoVo vo) {
 | 
48
 | 
     public PageResult<PurchaseOrderInfo> query(Integer pageIndex, Integer pageSize, QueryPurchaseOrderInfoVo vo) {
 | 
 | 
@@ -160,6 +164,8 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde | 
 | 
@@ -160,6 +164,8 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde | 
| 
160
 | 
                 purchaseOrderLineService.create(createPurchaseOrderLineVo);
 | 
164
 | 
                 purchaseOrderLineService.create(createPurchaseOrderLineVo);
 | 
| 
161
 | 
             }
 | 
165
 | 
             }
 | 
| 
162
 | 
         }
 | 
166
 | 
         }
 | 
| 
 | 
   | 
167
 | 
+        //开启审核
 | 
| 
 | 
   | 
168
 | 
+        flowInstanceWrapperService.startInstance(BPM_FLAG, data.getId(), BPM_FLAG, data);
 | 
| 
163
 | 
 
 | 
169
 | 
 
 | 
| 
164
 | 
         return data.getId();
 | 
170
 | 
         return data.getId();
 | 
| 
165
 | 
     }
 | 
171
 | 
     }
 | 
 | 
@@ -193,7 +199,7 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde | 
 | 
@@ -193,7 +199,7 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde | 
| 
193
 | 
                 .set(PurchaseOrderInfo::getPackaging, StringUtil.isBlank(vo.getPackaging()) ? null : vo.getPackaging())
 | 
199
 | 
                 .set(PurchaseOrderInfo::getPackaging, StringUtil.isBlank(vo.getPackaging()) ? null : vo.getPackaging())
 | 
| 
194
 | 
                 .set(PurchaseOrderInfo::getRemarks, StringUtil.isBlank(vo.getRemarks()) ? null : vo.getRemarks())
 | 
200
 | 
                 .set(PurchaseOrderInfo::getRemarks, StringUtil.isBlank(vo.getRemarks()) ? null : vo.getRemarks())
 | 
| 
195
 | 
                 .set(PurchaseOrderInfo::getStatus, StringUtil.isBlank(vo.getStatus()) ? null : vo.getStatus())
 | 
201
 | 
                 .set(PurchaseOrderInfo::getStatus, StringUtil.isBlank(vo.getStatus()) ? null : vo.getStatus())
 | 
| 
196
 | 
-                .set(PurchaseOrderInfo::getExamineStatus, StringUtil.isBlank(vo.getExamineStatus()) ? null : vo.getExamineStatus())
 | 
202
 | 
+                .set(PurchaseOrderInfo::getExamineStatus, "AUDIT")//审核中
 | 
| 
197
 | 
                 .set(PurchaseOrderInfo::getProductionProcess, StringUtil.isBlank(vo.getProductionProcess()) ? null : vo.getProductionProcess())
 | 
203
 | 
                 .set(PurchaseOrderInfo::getProductionProcess, StringUtil.isBlank(vo.getProductionProcess()) ? null : vo.getProductionProcess())
 | 
| 
198
 | 
                 .set(PurchaseOrderInfo::getDeptId, StringUtil.isBlank(vo.getDeptId()) ? null : vo.getDeptId())
 | 
204
 | 
                 .set(PurchaseOrderInfo::getDeptId, StringUtil.isBlank(vo.getDeptId()) ? null : vo.getDeptId())
 | 
| 
199
 | 
                 .set(PurchaseOrderInfo::getWorkshopId, StringUtil.isBlank(vo.getWorkshopId()) ? null : vo.getWorkshopId())
 | 
205
 | 
                 .set(PurchaseOrderInfo::getWorkshopId, StringUtil.isBlank(vo.getWorkshopId()) ? null : vo.getWorkshopId())
 | 
 | 
@@ -212,6 +218,8 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde | 
 | 
@@ -212,6 +218,8 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde | 
| 
212
 | 
 
 | 
218
 | 
 
 | 
| 
213
 | 
         OpLogUtil.setVariable("id", data.getId());
 | 
219
 | 
         OpLogUtil.setVariable("id", data.getId());
 | 
| 
214
 | 
         OpLogUtil.setExtra(vo);
 | 
220
 | 
         OpLogUtil.setExtra(vo);
 | 
| 
 | 
   | 
221
 | 
+        //开启审核
 | 
| 
 | 
   | 
222
 | 
+        flowInstanceWrapperService.startInstance(BPM_FLAG, data.getId(), BPM_FLAG, data);
 | 
| 
215
 | 
     }
 | 
223
 | 
     }
 | 
| 
216
 | 
 
 | 
224
 | 
 
 | 
| 
217
 | 
     @OpLog(type = OtherOpLogType.class, name = "删除订货单表,ID:{}", params = {"#id"})
 | 
225
 | 
     @OpLog(type = OtherOpLogType.class, name = "删除订货单表,ID:{}", params = {"#id"})
 | 
 | 
@@ -222,6 +230,66 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde | 
 | 
@@ -222,6 +230,66 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde | 
| 
222
 | 
         getBaseMapper().deleteById(id);
 | 
230
 | 
         getBaseMapper().deleteById(id);
 | 
| 
223
 | 
     }
 | 
231
 | 
     }
 | 
| 
224
 | 
 
 | 
232
 | 
 
 | 
| 
 | 
   | 
233
 | 
+    @OpLog(type = OtherOpLogType.class, name = "更新不走审核,ID:{}", params = {"#id"})
 | 
| 
 | 
   | 
234
 | 
+    @Transactional(rollbackFor = Exception.class)
 | 
| 
 | 
   | 
235
 | 
+    @Override
 | 
| 
 | 
   | 
236
 | 
+    public void updateNoFlowInstance(UpdatePurchaseOrderInfoVo vo) {
 | 
| 
 | 
   | 
237
 | 
+        PurchaseOrderInfo data = getBaseMapper().selectById(vo.getId());
 | 
| 
 | 
   | 
238
 | 
+        if (ObjectUtil.isNull(data)) {
 | 
| 
 | 
   | 
239
 | 
+            throw new DefaultClientException("订货单表不存在!");
 | 
| 
 | 
   | 
240
 | 
+        }
 | 
| 
 | 
   | 
241
 | 
+
 | 
| 
 | 
   | 
242
 | 
+        LambdaUpdateWrapper<PurchaseOrderInfo> updateWrapper = Wrappers.lambdaUpdate(PurchaseOrderInfo.class)
 | 
| 
 | 
   | 
243
 | 
+                .set(PurchaseOrderInfo::getPriceListNo, StringUtil.isBlank(vo.getPriceListNo()) ? null : vo.getPriceListNo())
 | 
| 
 | 
   | 
244
 | 
+                .set(PurchaseOrderInfo::getExecutionStandard, StringUtil.isBlank(vo.getExecutionStandard()) ? null : vo.getExecutionStandard())
 | 
| 
 | 
   | 
245
 | 
+                .set(PurchaseOrderInfo::getInvoicingStatus, StringUtil.isBlank(vo.getInvoicingStatus()) ? null : vo.getInvoicingStatus())
 | 
| 
 | 
   | 
246
 | 
+                .set(PurchaseOrderInfo::getShippingCost, StringUtil.isBlank(vo.getShippingCost()) ? null : vo.getShippingCost())
 | 
| 
 | 
   | 
247
 | 
+                .set(PurchaseOrderInfo::getPieceWeightHeader, StringUtil.isBlank(vo.getPieceWeightHeader()) ? null : vo.getPieceWeightHeader())
 | 
| 
 | 
   | 
248
 | 
+                .set(PurchaseOrderInfo::getSurface, StringUtil.isBlank(vo.getSurface()) ? null : vo.getSurface())
 | 
| 
 | 
   | 
249
 | 
+                .set(PurchaseOrderInfo::getTolerance, StringUtil.isBlank(vo.getTolerance()) ? null : vo.getTolerance())
 | 
| 
 | 
   | 
250
 | 
+                .set(PurchaseOrderInfo::getPerformance, StringUtil.isBlank(vo.getPerformance()) ? null : vo.getPerformance())
 | 
| 
 | 
   | 
251
 | 
+                .set(PurchaseOrderInfo::getElement, StringUtil.isBlank(vo.getElement()) ? null : vo.getElement())
 | 
| 
 | 
   | 
252
 | 
+                .set(PurchaseOrderInfo::getPackaging, StringUtil.isBlank(vo.getPackaging()) ? null : vo.getPackaging())
 | 
| 
 | 
   | 
253
 | 
+                .set(PurchaseOrderInfo::getRemarks, StringUtil.isBlank(vo.getRemarks()) ? null : vo.getRemarks())
 | 
| 
 | 
   | 
254
 | 
+                .set(PurchaseOrderInfo::getProductionProcess, StringUtil.isBlank(vo.getProductionProcess()) ? null : vo.getProductionProcess())
 | 
| 
 | 
   | 
255
 | 
+                .eq(PurchaseOrderInfo::getId, vo.getId());
 | 
| 
 | 
   | 
256
 | 
+
 | 
| 
 | 
   | 
257
 | 
+        getBaseMapper().update(updateWrapper);
 | 
| 
 | 
   | 
258
 | 
+
 | 
| 
 | 
   | 
259
 | 
+        //更新订货单表物料行
 | 
| 
 | 
   | 
260
 | 
+        List<UpdatePurchaseOrderLineVo> updatePurchaseOrderLineVoList = vo.getUpdatePurchaseOrderLineVoList();
 | 
| 
 | 
   | 
261
 | 
+        if (CollectionUtils.isNotEmpty(updatePurchaseOrderLineVoList)) {
 | 
| 
 | 
   | 
262
 | 
+            for (UpdatePurchaseOrderLineVo updatePurchaseOrderLineVo : updatePurchaseOrderLineVoList) {
 | 
| 
 | 
   | 
263
 | 
+                purchaseOrderLineService.update(updatePurchaseOrderLineVo);
 | 
| 
 | 
   | 
264
 | 
+            }
 | 
| 
 | 
   | 
265
 | 
+        }
 | 
| 
 | 
   | 
266
 | 
+
 | 
| 
 | 
   | 
267
 | 
+        OpLogUtil.setVariable("id", data.getId());
 | 
| 
 | 
   | 
268
 | 
+        OpLogUtil.setExtra(vo);
 | 
| 
 | 
   | 
269
 | 
+
 | 
| 
 | 
   | 
270
 | 
+    }
 | 
| 
 | 
   | 
271
 | 
+
 | 
| 
 | 
   | 
272
 | 
+    @OpLog(type = OtherOpLogType.class, name = "更新审核状态,ID:{}", params = {"#id"})
 | 
| 
 | 
   | 
273
 | 
+    @Transactional(rollbackFor = Exception.class)
 | 
| 
 | 
   | 
274
 | 
+    @Override
 | 
| 
 | 
   | 
275
 | 
+    public void updateStatus(String id, String status) {
 | 
| 
 | 
   | 
276
 | 
+        if (StringUtils.isBlank(id) || StringUtils.isBlank(status)) {
 | 
| 
 | 
   | 
277
 | 
+            return;
 | 
| 
 | 
   | 
278
 | 
+        }
 | 
| 
 | 
   | 
279
 | 
+        if ("PASS".equals(status)) {
 | 
| 
 | 
   | 
280
 | 
+            LambdaUpdateWrapper<PurchaseOrderInfo> updateWrapper = Wrappers.lambdaUpdate(PurchaseOrderInfo.class)
 | 
| 
 | 
   | 
281
 | 
+                    .set(PurchaseOrderInfo::getExamineStatus, status)
 | 
| 
 | 
   | 
282
 | 
+                    .set(PurchaseOrderInfo::getStatus, "ISSUED")//已下发
 | 
| 
 | 
   | 
283
 | 
+                    .eq(PurchaseOrderInfo::getId, id);
 | 
| 
 | 
   | 
284
 | 
+            getBaseMapper().update(updateWrapper);
 | 
| 
 | 
   | 
285
 | 
+        } else {
 | 
| 
 | 
   | 
286
 | 
+            LambdaUpdateWrapper<PurchaseOrderInfo> updateWrapper = Wrappers.lambdaUpdate(PurchaseOrderInfo.class)
 | 
| 
 | 
   | 
287
 | 
+                    .set(PurchaseOrderInfo::getExamineStatus, status)
 | 
| 
 | 
   | 
288
 | 
+                    .eq(PurchaseOrderInfo::getId, id);
 | 
| 
 | 
   | 
289
 | 
+            getBaseMapper().update(updateWrapper);
 | 
| 
 | 
   | 
290
 | 
+        }
 | 
| 
 | 
   | 
291
 | 
+    }
 | 
| 
 | 
   | 
292
 | 
+
 | 
| 
225
 | 
     @Override
 | 
293
 | 
     @Override
 | 
| 
226
 | 
     public void cleanCacheByKey(Serializable key) {
 | 
294
 | 
     public void cleanCacheByKey(Serializable key) {
 | 
| 
227
 | 
 
 | 
295
 | 
 
 |