|
@@ -10,6 +10,8 @@ import com.fjhx.common.constant.SourceConstant;
|
|
|
import com.fjhx.common.enums.CodingRuleEnum;
|
|
|
import com.fjhx.common.service.coding.CodingRuleService;
|
|
|
import com.fjhx.flow.core.FlowDelegate;
|
|
|
+import com.fjhx.flow.core.FlowThreadLocalUtil;
|
|
|
+import com.fjhx.flow.enums.HandleTypeEnum;
|
|
|
import com.fjhx.purchase.entity.purchase.enums.PurchaseDataResourceEnum;
|
|
|
import com.fjhx.purchase.entity.purchase.enums.PurchaseDetailStatusEnum;
|
|
|
import com.fjhx.purchase.entity.purchase.enums.PurchaseStatusEnum;
|
|
@@ -24,7 +26,9 @@ import com.fjhx.sale.entity.contract.po.ContractProduct;
|
|
|
import com.fjhx.sale.entity.sample.po.SampleProduct;
|
|
|
import com.fjhx.sale.service.contract.ContractProductService;
|
|
|
import com.fjhx.sale.service.sample.SampleProductService;
|
|
|
+import com.ruoyi.common.core.domain.BasePo;
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
+import com.ruoyi.common.utils.SecurityUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
@@ -122,9 +126,9 @@ public class PurchaseFlow extends FlowDelegate {
|
|
|
p.getDataResource() == PurchaseDataResourceEnum.DATA_RESOURCE_1.getKey()) {//如果采购的是外销合同
|
|
|
ContractProduct contractProduct = contractProductService.getById(p.getDataResourceId());
|
|
|
BigDecimal expendQuantity = contractProduct.getExpendQuantity().subtract(p.getCount());
|
|
|
- if (expendQuantity.compareTo(BigDecimal.ZERO) < 1) {//小于0不让继续执行
|
|
|
- throw new ServiceException("采购数量不得大于合同剩余采购数量");
|
|
|
- }
|
|
|
+// if (expendQuantity.compareTo(BigDecimal.ZERO) < 1) {//小于0不让继续执行
|
|
|
+// throw new ServiceException("采购数量不得大于合同剩余采购数量");
|
|
|
+// }
|
|
|
contractProduct.setExpendQuantity(expendQuantity);
|
|
|
upContractProduct.add(contractProduct);
|
|
|
}
|
|
@@ -156,4 +160,18 @@ public class PurchaseFlow extends FlowDelegate {
|
|
|
.lambda().eq(PurchaseDetail::getPurchaseId, purchase.getId()));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 驳回方法
|
|
|
+ */
|
|
|
+ public void reject() {
|
|
|
+ if (HandleTypeEnum.REJECT.equals(FlowThreadLocalUtil.getHandleTypeEnum())) {
|
|
|
+ purchaseService.update(q -> q
|
|
|
+ .eq(Purchase::getId, FlowThreadLocalUtil.getBusinessId())
|
|
|
+ .set(Purchase::getPurchaseStatus, 20)
|
|
|
+ .set(Purchase::getUpdateTime, new Date())
|
|
|
+ .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|