|
|
@ -18,6 +18,8 @@ import com.ruoyi.process.general.service.IProcessService; |
|
|
|
import com.ruoyi.process.todoitem.mapper.BizTodoItemMapper; |
|
|
|
import com.ruoyi.purchase.domain.PurchasePlan; |
|
|
|
import com.ruoyi.purchase.domain.PurchasePlanChild; |
|
|
|
import com.ruoyi.purchase.mapper.PurchasePlanChildMapper; |
|
|
|
import com.ruoyi.purchase.mapper.PurchasePlanMapper; |
|
|
|
import com.ruoyi.purchase.service.IPurchasePlanService; |
|
|
|
import com.ruoyi.system.domain.BaseRequisitioningOrderChild; |
|
|
|
import com.ruoyi.system.domain.Vo.BaseRequisitioningOrderVo; |
|
|
@ -56,6 +58,12 @@ public class BaseRequisitioningOrderServiceImpl implements IBaseRequisitioningOr |
|
|
|
@Autowired |
|
|
|
private BaseRequisitioningOrderChildMapper baseRequisitioningOrderChildMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private PurchasePlanMapper purchasePlanMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private PurchasePlanChildMapper planChildMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private RedisCache redisCache; |
|
|
|
|
|
|
@ -236,11 +244,8 @@ public class BaseRequisitioningOrderServiceImpl implements IBaseRequisitioningOr |
|
|
|
Long materialSum = 0L; |
|
|
|
BigDecimal materialRmbSum = new BigDecimal(0); |
|
|
|
BigDecimal materialNoRmbSum = new BigDecimal(0); |
|
|
|
if(ObjectUtils.isEmpty(childList)) { |
|
|
|
return 0; |
|
|
|
} |
|
|
|
Integer childSize = childList.size(); |
|
|
|
if (childSize > 0) { |
|
|
|
// Integer childSize = childList.size();
|
|
|
|
if (!StringUtils.isEmpty(childList)) { |
|
|
|
baseRequisitioningOrderChildMapper.deleteBaseRequisitioningOrderChildByRequisitioningCode(baseRequisitioningOrder.getRequisitioningCode()); |
|
|
|
for (BaseRequisitioningOrderChild child: childList) { |
|
|
|
materialSum += child.getMaterialNum(); |
|
|
@ -253,14 +258,21 @@ public class BaseRequisitioningOrderServiceImpl implements IBaseRequisitioningOr |
|
|
|
child.setUpdateTime(DateUtils.getNowDate()); |
|
|
|
baseRequisitioningOrderChildMapper.insertBaseRequisitioningOrderChild(child); |
|
|
|
} |
|
|
|
baseRequisitioningOrder.setMaterialAmount(childList.size()); |
|
|
|
} |
|
|
|
baseRequisitioningOrder.setMaterialAmount(childSize); |
|
|
|
baseRequisitioningOrder.setMaterialSum(materialSum); |
|
|
|
baseRequisitioningOrder.setRmbSum(materialRmbSum); |
|
|
|
baseRequisitioningOrder.setNoRmbSum(materialNoRmbSum); |
|
|
|
return baseRequisitioningOrderMapper.updateBaseRequisitioningOrder(baseRequisitioningOrder); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = NullPointerException.class) |
|
|
|
public int updateVerifyBaseRequisitioningOrder(BaseRequisitioningOrder baseRequisitioningOrder) { |
|
|
|
baseRequisitioningOrder.setUpdateBy(ShiroUtils.getLoginName()); |
|
|
|
baseRequisitioningOrder.setUpdateTime(DateUtils.getNowDate()); |
|
|
|
return baseRequisitioningOrderMapper.updateBaseRequisitioningOrder(baseRequisitioningOrder); |
|
|
|
} |
|
|
|
/** |
|
|
|
* 删除请购单对象 |
|
|
|
* |
|
|
@ -514,35 +526,42 @@ public class BaseRequisitioningOrderServiceImpl implements IBaseRequisitioningOr |
|
|
|
//先将请购物料转换为采购物料需求
|
|
|
|
List<PurchasePlanChild> purchasePlanChildList = new ArrayList<>(); |
|
|
|
PurchasePlan purchasePlan = new PurchasePlan(); |
|
|
|
Long noRmbSum = 0L; |
|
|
|
Long rmbSum = 0L; |
|
|
|
BigDecimal noRmbSum = BigDecimal.ZERO; |
|
|
|
BigDecimal rmbSum = BigDecimal.ZERO; |
|
|
|
Long materialAmount = Long.valueOf(requisitioningOrderDetailList.size()); |
|
|
|
Integer materialSum = 0; |
|
|
|
Long materialSum = 0L; |
|
|
|
//采购计划关联单号
|
|
|
|
purchasePlan.setPurchasePlanCode(redisCache.generateBillNo("CGJH")); |
|
|
|
purchasePlan.setPurchasePlanStatus("0"); |
|
|
|
purchasePlan.setCorrelationCode(requisitioningOrder.getRequisitioningCode()); |
|
|
|
purchasePlan.setPurchasePlanType("2"); |
|
|
|
purchasePlan.setMaterialAmount(materialAmount); |
|
|
|
for (BaseRequisitioningOrderChild requisitioningOrderDetail : requisitioningOrderDetailList) { |
|
|
|
PurchasePlanChild purchasePlanChild = new PurchasePlanChild(); |
|
|
|
purchasePlanChild.setPurchasePlanCode(purchasePlan.getPurchasePlanCode()); |
|
|
|
purchasePlanChild.setMaterialId(requisitioningOrderDetail.getMaterialId()); |
|
|
|
purchasePlanChild.setWarehouseDept(requisitioningOrderDetail.getWarehouseDept()); |
|
|
|
purchasePlanChild.setMaterialCode(requisitioningOrderDetail.getMaterialCode()); |
|
|
|
purchasePlanChild.setMaterialName(requisitioningOrderDetail.getMaterialName()); |
|
|
|
purchasePlanChild.setDescribe(requisitioningOrderDetail.getDescribe()); |
|
|
|
purchasePlanChild.setBrand(requisitioningOrderDetail.getBrand()); |
|
|
|
purchasePlanChild.setUnit(requisitioningOrderDetail.getUnit()); |
|
|
|
purchasePlanChild.setPhotoUrl(requisitioningOrderDetail.getPhotoUrl()); |
|
|
|
purchasePlanChild.setMaterialNum(Double.valueOf(requisitioningOrderDetail.getMaterialNum())); |
|
|
|
purchasePlanChild.setMaterialType(requisitioningOrderDetail.getMaterialType()); |
|
|
|
purchasePlanChild.setMaterialNoRmb(requisitioningOrderDetail.getMaterialNoRmb()); |
|
|
|
purchasePlanChild.setMaterialRmb(requisitioningOrderDetail.getMaterialRmb()); |
|
|
|
noRmbSum = noRmbSum + Long.valueOf(String.valueOf(requisitioningOrderDetail.getMaterialNoRmb())); |
|
|
|
rmbSum = rmbSum + Long.valueOf(String.valueOf(requisitioningOrderDetail.getMaterialRmbSum())); |
|
|
|
noRmbSum = noRmbSum.add(requisitioningOrderDetail.getMaterialNoRmb()); |
|
|
|
rmbSum = rmbSum.add(requisitioningOrderDetail.getMaterialRmbSum()); |
|
|
|
materialSum += requisitioningOrderDetail.getMaterialNum(); |
|
|
|
planChildMapper.insertPurchasePlanChild(purchasePlanChild); |
|
|
|
purchasePlanChildList.add(purchasePlanChild); |
|
|
|
} |
|
|
|
purchasePlan.setNoRmbSum(noRmbSum); |
|
|
|
purchasePlan.setRmbSum(rmbSum); |
|
|
|
purchasePlan.setMaterialSum(materialSum); |
|
|
|
|
|
|
|
purchasePlan.setCreateBy(requisitioningOrder.getCreateBy()); |
|
|
|
purchasePlan.setApplyUser(requisitioningOrder.getApplyUser()); |
|
|
|
purchasePlan.setCreateTime(DateUtils.getNowDate()); |
|
|
|
purchasePlan.setUpdateBy(requisitioningOrder.getUpdateBy()); |
|
|
|
purchasePlan.setUpdateTime(DateUtils.getNowDate()); |
|
|
|
return purchasePlanService.insertPurchasePlan(purchasePlan); |
|
|
|
return purchasePlanMapper.insertPurchasePlan(purchasePlan); |
|
|
|
} |
|
|
|
} |
|
|
|