|
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.fjhx.common.constant.SourceConstant;
|
|
|
import com.fjhx.common.enums.CodingRuleEnum;
|
|
|
import com.fjhx.common.service.coding.CodingRuleService;
|
|
|
+import com.fjhx.common.utils.Assert;
|
|
|
import com.fjhx.flow.core.FlowDelegate;
|
|
|
import com.fjhx.flow.core.FlowThreadLocalUtil;
|
|
|
import com.fjhx.purchase.entity.purchase.enums.PurchaseDataResourceEnum;
|
|
@@ -211,16 +212,18 @@ public class PurchaseFlowByWdly extends FlowDelegate {
|
|
|
JSONObject submitData = FlowThreadLocalUtil.getCurrentData();
|
|
|
//修改采购信息
|
|
|
Purchase purchase = submitData.toJavaObject(Purchase.class);
|
|
|
+ Assert.notEmpty(purchase.getId(), "采购id不能为空");
|
|
|
purchase.setPurchaseStatus(PurchaseStatusEnum.UNDER_REVIEW.getKey());
|
|
|
purchaseService.updateById(purchase);
|
|
|
//修改采购明细
|
|
|
List<PurchaseDetail> purchaseDetailList = purchase.getPurchaseDetailList();
|
|
|
if (CollectionUtils.isNotEmpty(purchaseDetailList)) {
|
|
|
for (PurchaseDetail s : purchaseDetailList) {
|
|
|
+ Assert.notEmpty(s.getId(), "采购明细id不能为空");
|
|
|
s.setPurchaseId(purchase.getId());
|
|
|
- //计算采购数量是否大于申购数量
|
|
|
+ //计算采购数量是否大于申购数量(因为是修改要排除本条采购的历史数量)
|
|
|
List<PurchaseDetail> purchaseDetailList1 = purchaseDetailService.list(q -> q.eq(PurchaseDetail::getSubscribeDetailId,
|
|
|
- s.getSubscribeDetailId()));
|
|
|
+ s.getSubscribeDetailId()).ne(PurchaseDetail::getId, s.getId()));
|
|
|
//求和
|
|
|
BigDecimal purchaseCount = purchaseDetailList1.stream()
|
|
|
.map(PurchaseDetail::getCount)
|