Browse Source

[feat]

基础资料 请购单
新增请购单service更新审批信息接口;
修改请购单service根据请购单生成采购计划接口,补全字段;
修改请购单controller审批完成接口,修改错误,添加生成采购计划语句;
dev
王晓迪 3 months ago
parent
commit
0833a6ccee
  1. 11
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/BaseRequisitioningOrderController.java
  2. 16
      ruoyi-admin/src/main/java/com/ruoyi/system/service/IBaseRequisitioningOrderService.java
  3. 51
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BaseRequisitioningOrderServiceImpl.java

11
ruoyi-admin/src/main/java/com/ruoyi/system/controller/BaseRequisitioningOrderController.java

@ -280,13 +280,13 @@ public class BaseRequisitioningOrderController extends BaseController
baseRequisitioningOrderVo.setBaseRequisitioningOrderChildList(JSON.parseArray(baseRequisitioningOrderChildList, BaseRequisitioningOrderChild.class));
boolean saveEntityBoolean = BooleanUtils.toBoolean(saveEntity);
if (saveEntityBoolean) {
baseRequisitioningOrderService.updateBaseRequisitioningOrder(baseRequisitioningOrderVo);
baseRequisitioningOrderService.updateVerifyBaseRequisitioningOrder(baseRequisitioningOrderVo);
}
String instanceId = baseRequisitioningOrderVo.getInstanceId();
String instanceType = baseRequisitioningOrderVo.getInstanceType();
boolean approvedFlag = processService.complete(taskId, instanceId,
baseRequisitioningOrderVo.getApplyTitle(), baseRequisitioningOrderVo.getRequisitioningCode(),
"requisition", new HashMap<String, Object>(), request);
"requisitioning", new HashMap<String, Object>(), request);
if(!approvedFlag){
// 审核状态-审核拒绝
baseRequisitioningOrderVo.setAuditStatus("2");
@ -298,8 +298,9 @@ public class BaseRequisitioningOrderController extends BaseController
baseRequisitioningOrderVo.setAuditStatus("1");
//查通过的审核订单
BaseRequisitioningOrder baseRequisitioningOrder = baseRequisitioningOrderService.selectBaseRequisitioningOrderById(baseRequisitioningOrderVo.getRequisitioningId());
//生产采购计划
baseRequisitioningOrder.setRequisitioningId(baseRequisitioningOrderVo.getRequisitioningId());
//生产采购计划
baseRequisitioningOrderService.generatePurchasePlan(baseRequisitioningOrder);
// 提交
if("submit".equals(instanceType)){
// 使用状态-是
@ -316,10 +317,10 @@ public class BaseRequisitioningOrderController extends BaseController
baseRequisitioningOrderVo.setUseStatus("1");
}
}
baseRequisitioningOrderService.updateBaseRequisitioningOrder(baseRequisitioningOrderVo);
baseRequisitioningOrderService.updateVerifyBaseRequisitioningOrder(baseRequisitioningOrderVo);
// 驳回申请后继续申请,可能修改表单
if (saveEntityBoolean) {
baseRequisitioningOrderService.updateBaseRequisitioningOrder(baseRequisitioningOrderVo);
baseRequisitioningOrderService.updateVerifyBaseRequisitioningOrder(baseRequisitioningOrderVo);
}
return success("任务已完成");
}

16
ruoyi-admin/src/main/java/com/ruoyi/system/service/IBaseRequisitioningOrderService.java

@ -48,12 +48,16 @@ public interface IBaseRequisitioningOrderService
*/
public int updateBaseRequisitioningOrder(BaseRequisitioningOrder baseRequisitioningOrder);
/**
* 批量删除请购单
*
* @param ids 需要删除的数据ID
* @return 结果
*/
// 更新审批信息
public int updateVerifyBaseRequisitioningOrder(BaseRequisitioningOrder baseRequisitioningOrder);
/**
* 批量删除请购单
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteBaseRequisitioningOrderByIds(String ids);
/**

51
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BaseRequisitioningOrderServiceImpl.java

@ -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);
}
}

Loading…
Cancel
Save