Compare commits

...

4 Commits

  1. 52
      ruoyi-activiti/src/main/java/com/ruoyi/process/general/service/impl/ProcessServiceImpl.java
  2. 17
      ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderChildMapper.java
  3. 15
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderChildService.java
  4. 10
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderChildServiceImpl.java
  5. 286
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java
  6. 10
      ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml
  7. 13
      ruoyi-admin/src/main/resources/templates/financial/receivables/receivables.html
  8. 8
      ruoyi-admin/src/main/resources/templates/index.html
  9. 10
      ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/purchaseOrder.html

52
ruoyi-activiti/src/main/java/com/ruoyi/process/general/service/impl/ProcessServiceImpl.java

@ -2,6 +2,7 @@ package com.ruoyi.process.general.service.impl;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
@ -17,6 +18,7 @@ import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService; import org.activiti.engine.TaskService;
import org.activiti.engine.history.HistoricActivityInstance; import org.activiti.engine.history.HistoricActivityInstance;
import org.activiti.engine.history.HistoricActivityInstanceQuery; import org.activiti.engine.history.HistoricActivityInstanceQuery;
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.runtime.ProcessInstance; import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Comment; import org.activiti.engine.task.Comment;
import org.activiti.engine.task.Task; import org.activiti.engine.task.Task;
@ -28,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -35,6 +38,7 @@ import java.util.ArrayList;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
@Service @Service
@Transactional @Transactional
@ -94,6 +98,54 @@ public class ProcessServiceImpl implements IProcessService {
return activityList; return activityList;
} }
@Override
public List<HistoricActivity> selectHistoryList(@RequestParam(required = false) String businessKey, String processInstanceId, HistoricActivity historicActivity) {
// 查询特定 businessKey 的完成过的所有流程实例
List<HistoricProcessInstance> historicProcessInstanceList = historyService.createHistoricProcessInstanceQuery()
.processInstanceBusinessKey(businessKey)
.list();
List<HistoricActivity> activityList = new ArrayList<>();
// 如果没有找到流程实例,可以抛出异常或采取其他措施
if (CollectionUtils.isEmpty(historicProcessInstanceList)) {
throw new BusinessException("没有找到与业务键 " + businessKey + " 相关的流程实例");
}
HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery()
.processInstanceId(processInstanceId)
.activityType("userTask")
.finished()
.orderByHistoricActivityInstanceStartTime()
.desc();
if (StringUtils.isNotBlank(historicActivity.getAssignee())) {
query.taskAssignee(historicActivity.getAssignee());
}
if (StringUtils.isNotBlank(historicActivity.getActivityName())) {
query.activityName(historicActivity.getActivityName());
}
List<HistoricActivityInstance> list = query.list();
for (HistoricActivityInstance instance : list) {
HistoricActivity activity = new HistoricActivity();
BeanUtils.copyProperties(instance, activity);
String taskId = instance.getTaskId();
List<Comment> comment = taskService.getTaskComments(taskId, "comment");
if (!CollectionUtils.isEmpty(comment)) {
activity.setComment(comment.get(0).getFullMessage());
}
SysUser sysUser = userMapper.selectUserByLoginName(instance.getAssignee());
if (sysUser != null) {
activity.setAssigneeName(sysUser.getUserName());
}
activityList.add(activity);
}
return activityList;
}
@Override @Override
public String selectLastActName(String processInstanceId) { public String selectLastActName(String processInstanceId) {
// TODO Auto-generated method stub // TODO Auto-generated method stub

17
ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderChildMapper.java

@ -2,6 +2,7 @@ package com.ruoyi.purchase.mapper;
import java.util.List; import java.util.List;
import com.ruoyi.purchase.domain.PurchaseOrderChild; import com.ruoyi.purchase.domain.PurchaseOrderChild;
import org.apache.ibatis.annotations.Mapper;
/** /**
* 采购订单子表Mapper接口 * 采购订单子表Mapper接口
@ -9,6 +10,7 @@ import com.ruoyi.purchase.domain.PurchaseOrderChild;
* @author zhang * @author zhang
* @date 2024-06-19 * @date 2024-06-19
*/ */
@Mapper
public interface PurchaseOrderChildMapper public interface PurchaseOrderChildMapper
{ {
/** /**
@ -50,6 +52,14 @@ public interface PurchaseOrderChildMapper
* @return 结果 * @return 结果
*/ */
public int deletePurchaseOrderChildById(Long purchaseOrderChildId); public int deletePurchaseOrderChildById(Long purchaseOrderChildId);
/**
* 删除采购订单子表
*
* @param purchaseOrderCode 采购订单子表号
* @return 结果
*/
public int deletePurchaseOrderChildByPurchaseOrderCode(String purchaseOrderCode);
/** /**
* 批量删除采购订单子表 * 批量删除采购订单子表
@ -58,6 +68,13 @@ public interface PurchaseOrderChildMapper
* @return 结果 * @return 结果
*/ */
public int deletePurchaseOrderChildByIds(String[] purchaseOrderChildIds); public int deletePurchaseOrderChildByIds(String[] purchaseOrderChildIds);
/**
* 批量删除采购订单子表
*
* @param purchaseOrderCodes 需要删除的数据单号列表
* @return 结果
*/
public int deletePurchaseOrderChildByPurchaseOrderCodes(String[] purchaseOrderCodes);
/** /**
* 作废采购订单子表 * 作废采购订单子表

15
ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderChildService.java

@ -52,6 +52,13 @@ public interface IPurchaseOrderChildService
* @return 结果 * @return 结果
*/ */
public int deletePurchaseOrderChildByIds(String ids); public int deletePurchaseOrderChildByIds(String ids);
/**
* 批量删除采购订单子表
*
* @param purchaseOrderCodes 需要删除的数据单号
* @return 结果
*/
public int deletePurchaseOrderChildByPurchaseOrderCodes(String purchaseOrderCodes);
/** /**
* 删除采购订单子表信息 * 删除采购订单子表信息
@ -61,6 +68,14 @@ public interface IPurchaseOrderChildService
*/ */
public int deletePurchaseOrderChildById(Long purchaseOrderChildId); public int deletePurchaseOrderChildById(Long purchaseOrderChildId);
/**
* 删除采购订单子表信息
*
* @param purchaseOrderCode 采购订单子表单号
* @return 结果
*/
public int deletePurchaseOrderChildByPurchaseOrderCode(String purchaseOrderCode);
/** /**
* 作废采购订单子表 * 作废采购订单子表
* @param purchaseOrderChildId 采购订单子表ID * @param purchaseOrderChildId 采购订单子表ID

10
ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderChildServiceImpl.java

@ -90,6 +90,11 @@ public class PurchaseOrderChildServiceImpl implements IPurchaseOrderChildService
return purchaseOrderChildMapper.deletePurchaseOrderChildByIds(Convert.toStrArray(ids)); return purchaseOrderChildMapper.deletePurchaseOrderChildByIds(Convert.toStrArray(ids));
} }
@Override
public int deletePurchaseOrderChildByPurchaseOrderCodes(String purchaseOrderCodes) {
return purchaseOrderChildMapper.deletePurchaseOrderChildByPurchaseOrderCodes(Convert.toStrArray(purchaseOrderCodes));
}
/** /**
* 删除采购订单子表信息 * 删除采购订单子表信息
* *
@ -102,6 +107,11 @@ public class PurchaseOrderChildServiceImpl implements IPurchaseOrderChildService
return purchaseOrderChildMapper.deletePurchaseOrderChildById(purchaseOrderChildId); return purchaseOrderChildMapper.deletePurchaseOrderChildById(purchaseOrderChildId);
} }
@Override
public int deletePurchaseOrderChildByPurchaseOrderCode(String purchaseOrderCode) {
return purchaseOrderChildMapper.deletePurchaseOrderChildByPurchaseOrderCode(purchaseOrderCode);
}
/** /**
* 作废采购订单子表 * 作废采购订单子表
* *

286
ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java

@ -255,7 +255,8 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
//订单子表去除实际物料数量位null或者0的物料信息 //订单子表去除实际物料数量位null或者0的物料信息
purchaseOrderChildList = purchaseOrderChildList.stream().filter(child -> child.getMaterialRealNum() != null).collect(Collectors.toList()); purchaseOrderChildList = purchaseOrderChildList.stream().filter(child -> child.getMaterialRealNum() != null).collect(Collectors.toList());
for (PurchaseOrderChild child : purchaseOrderChildList) { for (PurchaseOrderChild child : purchaseOrderChildList) {
if (child.getCorrelationCode().contains(",")) { if (child.getCorrelationCode().contains(","))
{
String[] correlationCodes = child.getCorrelationCode().split(","); String[] correlationCodes = child.getCorrelationCode().split(",");
String[] planCodes = child.getPurchasePlanCode().split(","); String[] planCodes = child.getPurchasePlanCode().split(",");
String[] purchaseQuoteCodes = child.getPurchaseQuoteCode().split(","); String[] purchaseQuoteCodes = child.getPurchaseQuoteCode().split(",");
@ -286,7 +287,7 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
materialRmbSum = materialRmbSum.add(suplierMaterialRmbSumLocal); materialRmbSum = materialRmbSum.add(suplierMaterialRmbSumLocal);
// 设置采购报价单编号和供应商信息到QuoteChild // 设置采购报价单编号和供应商信息到QuoteChild
material.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode()); material.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode());
material.setPurchasePlanCorrelationCode(child.getCorrelationCode()); material.setPurchasePlanCorrelationCode(correlationCodes[i]);
material.setSupplierCode(child.getSupplierCode()); material.setSupplierCode(child.getSupplierCode());
material.setMaterialUnit(child.getMaterialUnit()); material.setMaterialUnit(child.getMaterialUnit());
material.setWarehouseDept(child.getWarehouseDept()); material.setWarehouseDept(child.getWarehouseDept());
@ -311,9 +312,9 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
//实际采购单价合计 //实际采购单价合计
material.setMaterialRealRmbSum(suplierMaterialRmbSumLocal); material.setMaterialRealRmbSum(suplierMaterialRmbSumLocal);
material.setMaterialRealNoRmbSum(suplierMaterialNoRmbSumLocal); material.setMaterialRealNoRmbSum(suplierMaterialNoRmbSumLocal);
material.setCorrelationCode(child.getCorrelationCode()); material.setCorrelationCode(correlationCodes[i]);
material.setDeliveryTime(child.getDeliveryTime()); material.setDeliveryTime(child.getDeliveryTime());
material.setPurchasePlanCode(child.getPurchasePlanCode()); material.setPurchasePlanCode(planCode);
material.setPurchaseQuoteCode(child.getPurchaseQuoteCode()); material.setPurchaseQuoteCode(child.getPurchaseQuoteCode());
//收货状态,0:未收货,1:已收货 收款状态:0:待付款,1:已付款 //收货状态,0:未收货,1:已收货 收款状态:0:待付款,1:已付款
material.setEceiptStatus("0"); material.setEceiptStatus("0");
@ -321,15 +322,23 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
// 执行子表插入操作 // 执行子表插入操作
purchaseOrderChildService.insertPurchaseOrderChild(material); purchaseOrderChildService.insertPurchaseOrderChild(material);
PurchasePlan plan = new PurchasePlan(); PurchasePlan plan = new PurchasePlan();
plan.setPurchasePlanCode(child.getPurchasePlanCode()); plan.setPurchasePlanCode(planCode);
plan.setPurchasePlanStatus("1"); plan.setPurchasePlanStatus("1");
int result = purchasePlanService.updatePurchasePlan(plan); int result = purchasePlanService.updatePurchasePlan(plan);
} }
} }
} }
else if ((!child.getCorrelationCode().contains(",")) else if ((child.getPurchasePlanCode().contains(",") && !child.getCorrelationCode().contains(",")
&& child.getPurchasePlanCode() != null) { && child.getCorrelationCode()!= null))
PurchasePlan purchasePlan = purchasePlanService.selectPurchasePlanByPlanCode(child.getPurchasePlanCode()); {
String[] planCodes = child.getPurchasePlanCode().split(",");
for (int i = 0; i < planCodes.length - 1; i++) {
String[] correlationCodes = child.getCorrelationCode().split(",");
String[] planCode2 = child.getPurchasePlanCode().split(",");
String[] purchaseQuoteCodes = child.getPurchaseQuoteCode().split(",");
String planCode = planCode2[i];
PurchasePlan purchasePlan = purchasePlanService.selectPurchasePlanByPlanCode(planCode);
if (planCode != null) {
PurchaseOrderChild material = new PurchaseOrderChild(); PurchaseOrderChild material = new PurchaseOrderChild();
child.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode()); child.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode());
//获取物料供应商不含税采购价格 //获取物料供应商不含税采购价格
@ -338,9 +347,91 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
BigDecimal suplierMaterialRmb = child.getMaterialRealRmb(); BigDecimal suplierMaterialRmb = child.getMaterialRealRmb();
// 获取物料数量 // 获取物料数量
BigDecimal suplierMaterialNum = child.getMaterialRealNum(); BigDecimal suplierMaterialNum = child.getMaterialRealNum();
if(suplierMaterialNoRmb == null){suplierMaterialNoRmb = BigDecimal.ZERO;} if (suplierMaterialNoRmb == null) {
if(suplierMaterialRmb == null){suplierMaterialRmb = BigDecimal.ZERO;} suplierMaterialNoRmb = BigDecimal.ZERO;
if(suplierMaterialNum == null){suplierMaterialNum = new BigDecimal(0);} }
if (suplierMaterialRmb == null) {
suplierMaterialRmb = BigDecimal.ZERO;
}
if (suplierMaterialNum == null) {
suplierMaterialNum = new BigDecimal(0);
}
//获取供应商不含税价格合计 = 物料数量 * 供应商采购不含税价格
BigDecimal suplierMaterialNoRmbSumLocal = suplierMaterialNoRmb.multiply(suplierMaterialNum);
//获取供应商含税价格合计 = 物料数量 * 供应商采购含税价格
BigDecimal suplierMaterialRmbSumLocal = suplierMaterialRmb.multiply(suplierMaterialNum);
// 累加物料数量
materialNum = materialNum.add(suplierMaterialNum);
// 累加物料总价
materialNoRmbSum = materialNoRmbSum.add(suplierMaterialNoRmbSumLocal);
// 累加物料含税总价
materialRmbSum = materialRmbSum.add(suplierMaterialRmbSumLocal);
// 设置采购报价单编号和供应商信息到QuoteChild
material.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode());
material.setCorrelationCode(purchasePlan.getCorrelationCode());
material.setPurchasePlanCorrelationCode(correlationCodes[i]);
material.setSupplierCode(child.getSupplierCode());
material.setMaterialUnit(child.getMaterialUnit());
material.setWarehouseDept(child.getWarehouseDept());
material.setSupplierName(child.getSupplierName());
material.setMaterialCode(child.getMaterialCode());
material.setMaterialName(child.getMaterialName());
material.setMaterialBrand(child.getMaterialBrand());
material.setMaterialDescribe(child.getMaterialDescribe());
material.setMaterialPhotoUrl(child.getMaterialPhotoUrl());
material.setMaterialProcessMethod(child.getMaterialProcessMethod());
material.setWarehouseDept(child.getWarehouseDept());
//计划采购数
material.setMaterialNum(child.getMaterialNum());
material.setMaterialNoRmb(child.getMaterialNoRmb());
material.setMaterialRmb(child.getMaterialRmb());
material.setMaterialNoRmbSum(child.getMaterialNoRmbSum());
material.setMaterialRmbSum(child.getMaterialRmbSum());
//实际采购数
material.setMaterialRealNum(child.getMaterialRealNum());
material.setMaterialRealNoRmb(child.getMaterialRealNoRmb());
material.setMaterialRealRmb(child.getMaterialRealRmb());
material.setDeliveryTime(child.getDeliveryTime());
//实际采购单价合计
material.setMaterialRealRmbSum(suplierMaterialRmbSumLocal);
material.setMaterialRealNoRmbSum(suplierMaterialNoRmbSumLocal);
material.setCorrelationCode(child.getCorrelationCode());
material.setPurchasePlanCode(planCode);
material.setPurchaseQuoteCode(child.getPurchaseQuoteCode());
//收货状态,0:未收货,1:已收货 收款状态:0:待付款,1:已付款
material.setEceiptStatus("0");
material.setPaymentStatus("0");
// 执行子表插入操作
purchaseOrderChildService.insertPurchaseOrderChild(material);
PurchasePlan plan = new PurchasePlan();
plan.setPurchasePlanCode(planCode);
plan.setPurchasePlanStatus("1");
int result = purchasePlanService.updatePurchasePlan(plan);
}
}
}
else if(child.getCorrelationCode().contains(",") && child.getCorrelationCode().contains(",") &&
child.getPurchasePlanCode()!=null && child.getCorrelationCode()!=null){
String planCode = child.getPurchasePlanCode();
PurchasePlan purchasePlan = purchasePlanService.selectPurchasePlanByPlanCode(planCode);
if (planCode != null) {
PurchaseOrderChild material = new PurchaseOrderChild();
child.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode());
//获取物料供应商不含税采购价格
BigDecimal suplierMaterialNoRmb = child.getMaterialRealNoRmb();
// 获取物料供应商含税采购价格
BigDecimal suplierMaterialRmb = child.getMaterialRealRmb();
// 获取物料数量
BigDecimal suplierMaterialNum = child.getMaterialRealNum();
if (suplierMaterialNoRmb == null) {
suplierMaterialNoRmb = BigDecimal.ZERO;
}
if (suplierMaterialRmb == null) {
suplierMaterialRmb = BigDecimal.ZERO;
}
if (suplierMaterialNum == null) {
suplierMaterialNum = new BigDecimal(0);
}
//获取供应商不含税价格合计 = 物料数量 * 供应商采购不含税价格 //获取供应商不含税价格合计 = 物料数量 * 供应商采购不含税价格
BigDecimal suplierMaterialNoRmbSumLocal = suplierMaterialNoRmb.multiply(suplierMaterialNum); BigDecimal suplierMaterialNoRmbSumLocal = suplierMaterialNoRmb.multiply(suplierMaterialNum);
//获取供应商含税价格合计 = 物料数量 * 供应商采购含税价格 //获取供应商含税价格合计 = 物料数量 * 供应商采购含税价格
@ -395,6 +486,7 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
} }
} }
} }
}
// 遍历处理采购订单子表 // 遍历处理采购订单子表
// 设置累加的物料信息到子表 // 设置累加的物料信息到子表
@ -430,6 +522,178 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
@Override @Override
public int updatePurchaseOrder(PurchaseOrder purchaseOrder) public int updatePurchaseOrder(PurchaseOrder purchaseOrder)
{ {
// 初始化累加变量
BigDecimal materialNoRmb = BigDecimal.ZERO;
BigDecimal materialRmb = BigDecimal.ZERO;
BigDecimal materialNoRmbSum = BigDecimal.ZERO;
BigDecimal materialRmbSum = BigDecimal.ZERO;
BigDecimal materialNum = BigDecimal.ZERO;
int supplierNum = 0;
//根据上传的物料信息做采购订单子项
if (!CollectionUtils.isEmpty(purchaseOrder.getPurchaseOrderChildList())) {
supplierNum = purchaseOrder.getPurchaseOrderChildList().size();
}
if (purchaseOrder.getPurchaseOrderChildList() != null) {
List<PurchaseOrderChild> purchaseOrderChildList = purchaseOrder.getPurchaseOrderChildList();
//订单子表去除实际物料数量位null或者0的物料信息
purchaseOrderChildList = purchaseOrderChildList.stream().filter(child -> child.getMaterialRealNum() != null).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(purchaseOrderChildList)) {
purchaseOrderChildService.deletePurchaseOrderChildByPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode());
for (PurchaseOrderChild child : purchaseOrderChildList) {
if (child.getCorrelationCode().contains(",")) {
String[] correlationCodes = child.getCorrelationCode().split(",");
String[] planCodes = child.getPurchasePlanCode().split(",");
String[] purchaseQuoteCodes = child.getPurchaseQuoteCode().split(",");
for (int i = 0; i < planCodes.length - 1; i++) {
String planCode = planCodes[i];
PurchasePlan purchasePlan = purchasePlanService.selectPurchasePlanByPlanCode(planCode);
if (planCode != null) {
PurchaseOrderChild material = new PurchaseOrderChild();
child.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode());
//获取物料供应商不含税采购价格
BigDecimal suplierMaterialNoRmb = child.getMaterialRealNoRmb();
// 获取物料供应商含税采购价格
BigDecimal suplierMaterialRmb = child.getMaterialRealRmb();
// 获取物料数量
BigDecimal suplierMaterialNum = child.getMaterialRealNum();
if(suplierMaterialNoRmb == null){suplierMaterialNoRmb = BigDecimal.ZERO;}
if(suplierMaterialRmb == null){suplierMaterialRmb = BigDecimal.ZERO;}
if(suplierMaterialNum == null){suplierMaterialNum = new BigDecimal(0);}
//获取供应商不含税价格合计 = 物料数量 * 供应商采购不含税价格
BigDecimal suplierMaterialNoRmbSumLocal = suplierMaterialNoRmb.multiply(suplierMaterialNum);
//获取供应商含税价格合计 = 物料数量 * 供应商采购含税价格
BigDecimal suplierMaterialRmbSumLocal = suplierMaterialRmb.multiply(suplierMaterialNum);
// 累加物料数量
materialNum = materialNum.add(suplierMaterialNum);
// 累加物料总价
materialNoRmbSum = materialNoRmbSum.add(suplierMaterialNoRmbSumLocal);
// 累加物料含税总价
materialRmbSum = materialRmbSum.add(suplierMaterialRmbSumLocal);
// 设置采购报价单编号和供应商信息到QuoteChild
material.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode());
material.setPurchasePlanCorrelationCode(child.getCorrelationCode());
material.setSupplierCode(child.getSupplierCode());
material.setMaterialUnit(child.getMaterialUnit());
material.setWarehouseDept(child.getWarehouseDept());
material.setSupplierName(child.getSupplierName());
material.setMaterialCode(child.getMaterialCode());
material.setMaterialName(child.getMaterialName());
material.setMaterialBrand(child.getMaterialBrand());
material.setMaterialDescribe(child.getMaterialDescribe());
material.setMaterialPhotoUrl(child.getMaterialPhotoUrl());
material.setMaterialProcessMethod(child.getMaterialProcessMethod());
material.setWarehouseDept(child.getWarehouseDept());
//计划采购数
material.setMaterialNum(child.getMaterialNum());
material.setMaterialNoRmb(child.getMaterialNoRmb());
material.setMaterialRmb(child.getMaterialRmb());
material.setMaterialNoRmbSum(child.getMaterialNoRmbSum());
material.setMaterialRmbSum(child.getMaterialRmbSum());
//实际采购数
material.setMaterialRealNum(child.getMaterialRealNum());
material.setMaterialRealNoRmb(child.getMaterialRealNoRmb());
material.setMaterialRealRmb(child.getMaterialRealRmb());
//实际采购单价合计
material.setMaterialRealRmbSum(suplierMaterialRmbSumLocal);
material.setMaterialRealNoRmbSum(suplierMaterialNoRmbSumLocal);
material.setCorrelationCode(child.getCorrelationCode());
material.setDeliveryTime(child.getDeliveryTime());
material.setPurchasePlanCode(child.getPurchasePlanCode());
material.setPurchaseQuoteCode(child.getPurchaseQuoteCode());
//收货状态,0:未收货,1:已收货 收款状态:0:待付款,1:已付款
material.setEceiptStatus("0");
material.setPaymentStatus("0");
// 执行子表插入操作
purchaseOrderChildService.insertPurchaseOrderChild(material);
PurchasePlan plan = new PurchasePlan();
plan.setPurchasePlanCode(child.getPurchasePlanCode());
plan.setPurchasePlanStatus("1");
int result = purchasePlanService.updatePurchasePlan(plan);
}
}
}
else if ((!child.getCorrelationCode().contains(","))
&& child.getPurchasePlanCode() != null) {
PurchasePlan purchasePlan = purchasePlanService.selectPurchasePlanByPlanCode(child.getPurchasePlanCode());
PurchaseOrderChild material = new PurchaseOrderChild();
child.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode());
//获取物料供应商不含税采购价格
BigDecimal suplierMaterialNoRmb = child.getMaterialRealNoRmb();
// 获取物料供应商含税采购价格
BigDecimal suplierMaterialRmb = child.getMaterialRealRmb();
// 获取物料数量
BigDecimal suplierMaterialNum = child.getMaterialRealNum();
if(suplierMaterialNoRmb == null){suplierMaterialNoRmb = BigDecimal.ZERO;}
if(suplierMaterialRmb == null){suplierMaterialRmb = BigDecimal.ZERO;}
if(suplierMaterialNum == null){suplierMaterialNum = new BigDecimal(0);}
//获取供应商不含税价格合计 = 物料数量 * 供应商采购不含税价格
BigDecimal suplierMaterialNoRmbSumLocal = suplierMaterialNoRmb.multiply(suplierMaterialNum);
//获取供应商含税价格合计 = 物料数量 * 供应商采购含税价格
BigDecimal suplierMaterialRmbSumLocal = suplierMaterialRmb.multiply(suplierMaterialNum);
// 累加物料数量
materialNum = materialNum.add(suplierMaterialNum);
// 累加物料总价
materialNoRmbSum = materialNoRmbSum.add(suplierMaterialNoRmbSumLocal);
// 累加物料含税总价
materialRmbSum = materialRmbSum.add(suplierMaterialRmbSumLocal);
// 设置采购报价单编号和供应商信息到QuoteChild
material.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode());
material.setCorrelationCode(purchasePlan.getCorrelationCode());
material.setPurchasePlanCorrelationCode(child.getCorrelationCode());
material.setSupplierCode(child.getSupplierCode());
material.setMaterialUnit(child.getMaterialUnit());
material.setWarehouseDept(child.getWarehouseDept());
material.setSupplierName(child.getSupplierName());
material.setMaterialCode(child.getMaterialCode());
material.setMaterialName(child.getMaterialName());
material.setMaterialBrand(child.getMaterialBrand());
material.setMaterialDescribe(child.getMaterialDescribe());
material.setMaterialPhotoUrl(child.getMaterialPhotoUrl());
material.setMaterialProcessMethod(child.getMaterialProcessMethod());
material.setWarehouseDept(child.getWarehouseDept());
//计划采购数
material.setMaterialNum(child.getMaterialNum());
material.setMaterialNoRmb(child.getMaterialNoRmb());
material.setMaterialRmb(child.getMaterialRmb());
material.setMaterialNoRmbSum(child.getMaterialNoRmbSum());
material.setMaterialRmbSum(child.getMaterialRmbSum());
//实际采购数
material.setMaterialRealNum(child.getMaterialRealNum());
material.setMaterialRealNoRmb(child.getMaterialRealNoRmb());
material.setMaterialRealRmb(child.getMaterialRealRmb());
material.setDeliveryTime(child.getDeliveryTime());
//实际采购单价合计
material.setMaterialRealRmbSum(suplierMaterialRmbSumLocal);
material.setMaterialRealNoRmbSum(suplierMaterialNoRmbSumLocal);
material.setCorrelationCode(child.getCorrelationCode());
material.setPurchasePlanCode(child.getPurchasePlanCode());
material.setPurchaseQuoteCode(child.getPurchaseQuoteCode());
//收货状态,0:未收货,1:已收货 收款状态:0:待付款,1:已付款
material.setEceiptStatus("0");
material.setPaymentStatus("0");
// 执行子表插入操作
purchaseOrderChildService.insertPurchaseOrderChild(material);
PurchasePlan plan = new PurchasePlan();
plan.setPurchasePlanCode(child.getPurchasePlanCode());
plan.setPurchasePlanStatus("1");
int result = purchasePlanService.updatePurchasePlan(plan);
}
}
}
}
// 遍历处理采购订单子表// 设置累加的物料信息到子表// 设置主表的供应商数量
purchaseOrder.setSupplierNum(supplierNum);
purchaseOrder.setNoRmbSum(materialNoRmbSum);
purchaseOrder.setRmbSum(materialRmbSum);
purchaseOrder.setDelFlag("0");
purchaseOrder.setEceiptStatus("0");
purchaseOrder.setPaymentStatus("0");
purchaseOrder.setPurchaseBuyer(purchaseOrder.getPurchaseBuyer());
purchaseOrder.setCreateTime(DateUtils.getNowDate());
purchaseOrder.setCreateBy(ShiroUtils.getLoginName());
Set<String> amountSet = purchaseOrder.getPurchaseOrderChildList().stream().map(PurchaseOrderChild::getMaterialCode).collect(Collectors.toSet());
Integer amount = amountSet.size();
purchaseOrder.setMaterialAmount(amount);
purchaseOrder.setCreateTime(DateUtils.getNowDate()); purchaseOrder.setCreateTime(DateUtils.getNowDate());
purchaseOrder.setCreateBy(ShiroUtils.getLoginName()); purchaseOrder.setCreateBy(ShiroUtils.getLoginName());
return purchaseOrderMapper.updatePurchaseOrder(purchaseOrder); return purchaseOrderMapper.updatePurchaseOrder(purchaseOrder);

10
ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml

@ -240,7 +240,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<delete id="deletePurchaseOrderChildById" parameterType="Long"> <delete id="deletePurchaseOrderChildById" parameterType="Long">
delete from purchase_order_child where purchase_order_child_id = #{purchaseOrderChildId} delete from purchase_order_child where purchase_order_child_id = #{purchaseOrderChildId}
</delete> </delete>
<delete id="deletePurchaseOrderChildByPurchaseOrderCode" parameterType="String">
delete from purchase_order_child where purchase_order_code = #{purchaseOrderCode}
</delete>
<delete id="deletePurchaseOrderChildByPurchaseOrderCodes" parameterType="String">
delete from purchase_order_child where purchase_order_code = in
<foreach collection="array" item="purchaseOrderCode" open="(" separator="," close=")">
#{purchaseOrderCode}
</foreach>
</delete>
<delete id="deletePurchaseOrderChildByIds" parameterType="String"> <delete id="deletePurchaseOrderChildByIds" parameterType="String">
delete from purchase_order_child where purchase_order_child_id in delete from purchase_order_child where purchase_order_child_id in
<foreach item="purchaseOrderChildId" collection="array" open="(" separator="," close=")"> <foreach item="purchaseOrderChildId" collection="array" open="(" separator="," close=")">

13
ruoyi-admin/src/main/resources/templates/financial/receivables/receivables.html

@ -154,7 +154,7 @@
{title: '操作', align: 'center', {title: '操作', align: 'center',
formatter: function(value, row, index) { formatter: function(value, row, index) {
var actions = []; var actions = [];
if (row.debitAccount =="" || row.debitBank =="") { if (row.debitAccount == null || row.debitBank == null) {
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="addDebit(\'' + row.financialReceivablesId + '\')"><i class="fa fa-edit"></i>添加借方明细</a> ') actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="addDebit(\'' + row.financialReceivablesId + '\')"><i class="fa fa-edit"></i>添加借方明细</a> ')
}else{ }else{
actions.push('<a class="btn btn-success btn-xs ' + addReceivablesVoucherFlag + '" href="javascript:void(0)" onclick="addReceivablesVoucher(\'' + row.financialReceivablesId + '\')"><i class="fa fa-edit"></i>创建收款凭证</a> '); actions.push('<a class="btn btn-success btn-xs ' + addReceivablesVoucherFlag + '" href="javascript:void(0)" onclick="addReceivablesVoucher(\'' + row.financialReceivablesId + '\')"><i class="fa fa-edit"></i>创建收款凭证</a> ');
@ -232,9 +232,14 @@
//导出应收款账单收款凭证,单个导出 //导出应收款账单收款凭证,单个导出
function exportReceivablesVoucher() { function exportReceivablesVoucher() {
var bootstrpa = $("#bootstrap-table").bootstrapTable('getSelections'); //导出前需要确定借方明细
var financialReceivablesId = bootstrpa[0].financialReceivablesId; var bootstrap = $("#bootstrap-table").bootstrapTable('getSelections');
if (bootstrpa.length !== 1) { if ($.common.isEmpty(bootstrap.debitAccount) || $.common.isEmpty(bootstrap.debitBank)) {
$.modal.alertWarning("请先添加借方明细");
return;
}
var financialReceivablesId = bootstrap[0].financialReceivablesId;
if (bootstrap.length !== 1) {
$.modal.alertWarning("请选择一条数据"); $.modal.alertWarning("请选择一条数据");
return; return;
} }

8
ruoyi-admin/src/main/resources/templates/index.html

@ -198,10 +198,10 @@
<ul class="pro-body"> <ul class="pro-body">
<!--<li><a href="javascript:" class="dropdown-item menuItem"><i class="feather icon-settings"></i>个人中心</a></li>--> <!--<li><a href="javascript:" class="dropdown-item menuItem"><i class="feather icon-settings"></i>个人中心</a></li>-->
<li><a href="/system/user/profile" class="dropdown-item menuItem"><i class="feather icon-user"></i>个人中心</a></li> <li><a href="/system/user/profile" class="dropdown-item menuItem"><i class="feather icon-user"></i>个人中心</a></li>
<li><a href="/process/requestitem" class="dropdown-item menuItem"><i class="feather icon-mail"></i>我的请求</a></li> <!-- <li><a href="/flow/requestitem" class="dropdown-item menuItem"><i class="feather icon-mail"></i>我的请求</a></li>-->
<li><a href="/remind" class="dropdown-item menuItem"><i class="feather icon-bell"></i>我的提醒</a></li> <li><a href="/remind" class="dropdown-item menuItem"><i class="feather icon-bell"></i>我的提醒</a></li>
<li><a href="/process/todoitem" class="dropdown-item menuItem" id="todoBadge2"><i class="fa fa-rocket"></i>我的待办</a></li> <li><a href="/process/todoitem" class="dropdown-item menuItem" id="todoBadge2"><i class="fa fa-rocket"></i>我的待办</a></li>
<li><a href="/process/doneitem" class="dropdown-item menuItem" id="todoBadge3"><i class="fa fa-fighter-jet"></i>我的已办</a></li> <li><a href="/process/todoitem/doneitemView" class="dropdown-item menuItem" id="todoBadge3"><i class="fa fa-fighter-jet"></i>我的已办</a></li>
</ul> </ul>
</div> </div>
</div> </div>
@ -386,7 +386,7 @@
var offset = transDate(obj.todoTime) var offset = transDate(obj.todoTime)
//$("#todoItemList").append("<li><a href="+ctx+obj.moduleUrl+"/edit/"+obj.keyNo+"> <span class=\"time\">"+transDate(obj.todoTime)+"</span> <span class=\"details\"> <span class=\"label label-sm label-icon label-info\"> <i class=\"fa fa-bullhorn\"></i></span>"+obj.itemName+"</span></a></li>"); //$("#todoItemList").append("<li><a href="+ctx+obj.moduleUrl+"/edit/"+obj.keyNo+"> <span class=\"time\">"+transDate(obj.todoTime)+"</span> <span class=\"details\"> <span class=\"label label-sm label-icon label-info\"> <i class=\"fa fa-bullhorn\"></i></span>"+obj.itemName+"</span></a></li>");
var url = ctx + obj.moduleUrl + "/edit/" + obj.itemContent; var url = ctx + obj.moduleUrl + "/edit/" + obj.itemContent;
$("#todoItemList").append("<li class=\"todoItemLi\"><a href=\"javascript:;\" data-url="+url+"> <span class=\"time\">"+transDate(obj.todoTime)+"</span> <span class=\"details\"> <span class=\"label label-sm label-icon label-info\"> <i class=\"fa fa-bullhorn\"></i></span>"+obj.itemName+"</span></a></li>"); $("#todoItemList").append("<li class=\"todoItemLi\"><a class=\"dropdown-item menuItem\" href=\"javascript:;\" data-url="+url+"> <span class=\"time\">"+transDate(obj.todoTime)+"</span> <span class=\"details\"> <span class=\"label label-sm label-icon label-info\"> <i class=\"fa fa-bullhorn\"></i></span>"+obj.itemName+"</span></a></li>");
// $("#todoItemList").append( // $("#todoItemList").append(
// "<li class=\"todoItemLi notification \">" + // "<li class=\"todoItemLi notification \">" +
// "<div class='media'>" + // "<div class='media'>" +
@ -425,7 +425,7 @@
var url = ctx + "remind/view/" + obj.id; var url = ctx + "remind/view/" + obj.id;
$("#remindList").append( $("#remindList").append(
"<li class=\"remindLi\">" + "<li class=\"remindLi\">" +
"<a href=" + url + "> " + "<a href=" + url + " data-url= "+ url +"> " +
"<span class=\"time\">" + offset + "</span> " + "<span class=\"time\">" + offset + "</span> " +
"<span class=\"details\"> " + "<span class=\"details\"> " +
"<span class=\"label label-sm label-icon label-info\"> <i class=\"fa fa-bolt\"></i></span>" + "<span class=\"label label-sm label-icon label-info\"> <i class=\"fa fa-bolt\"></i></span>" +

10
ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/purchaseOrder.html

@ -288,7 +288,15 @@
return actions.join(''); return actions.join('');
} }
} }
] ],
rowStyle: function (row, index) {
if (row.auditStatus=="0") {
// 如果审核状态为待审核,则设置为红色
return {css:{"color":"red"}};
}
// 否则使用默认样式
return {};
}
}; };
$.table.init(options); $.table.init(options);
}); });

Loading…
Cancel
Save