Browse Source

Merge remote-tracking branch 'origin/dev' into dev

dev
王晓迪 3 days ago
parent
commit
b09f12d210
  1. 36
      ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseQuoteController.java
  2. 26
      ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchasePlan.java
  3. 14
      ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseQuoteHistory.java
  4. 2
      ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchasePlanChildMapper.java
  5. 5
      ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseQuoteChildMapper.java
  6. 15
      ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseQuoteHistoryMapper.java
  7. 5
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchasePlanService.java
  8. 8
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseQuoteHistoryService.java
  9. 7
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseQuoteService.java
  10. 158
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java
  11. 39
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseQuoteHistoryServiceImpl.java
  12. 82
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseQuoteServiceImpl.java
  13. 12
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java
  14. 72
      ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml
  15. 1
      ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanMapper.xml
  16. 8
      ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteChildMapper.xml
  17. 72
      ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteHistoryMapper.xml
  18. 7
      ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/purchaseOrder.html
  19. 20
      ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html
  20. 10
      ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/purchasePlan.html
  21. 6
      ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/purchaseQuote.html

36
ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseQuoteController.java

@ -32,6 +32,7 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
@ -85,11 +86,44 @@ public class PurchaseQuoteController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
/**
* 导入采购报价单
* */
@Log(title = "采购报价", businessType = BusinessType.IMPORT)
@RequiresPermissions("purchase:purchaseQuote:import")
@PostMapping("/importData")
@ResponseBody
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
{
ExcelUtil<PurchaseQuote> util = new ExcelUtil<PurchaseQuote>(PurchaseQuote.class);
List<PurchaseQuote> purchaseQuoteList = util.importExcel(file.getInputStream());
String operName = ShiroUtils.getSysUser().getLoginName();
String message = purchaseQuoteService.importPurchaseQuote(purchaseQuoteList, updateSupport, operName);
return AjaxResult.success(message);
}
/**
* 导入模板
* */
@RequiresPermissions("purchase:purchaseQuote:view")
@GetMapping("/importTemplate")
@ResponseBody
public AjaxResult importTemplate()
{
ExcelUtil<PurchaseQuote> util = new ExcelUtil<PurchaseQuote>(PurchaseQuote.class);
return util.importTemplateExcel("采购报价数据");
}
/** /**
* 导出采购报价单列表 * 导出采购报价单列表
*/ */
@RequiresPermissions("purchase:purchaseQuote:export") @RequiresPermissions("purchase:purchaseQuote:export")
@Log(title = "采购报价单", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
@ResponseBody @ResponseBody
public AjaxResult export(PurchaseQuote purchaseQuote) public AjaxResult export(PurchaseQuote purchaseQuote)

26
ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchasePlan.java

@ -1,6 +1,8 @@
package com.ruoyi.purchase.domain; package com.ruoyi.purchase.domain;
import java.math.BigDecimal; import java.math.BigDecimal;
import com.ruoyi.system.domain.Vo.Supplier;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
@ -83,6 +85,12 @@ public class PurchasePlan extends BaseEntity
/** 删除标志 0 启用 1逻辑删除 */ /** 删除标志 0 启用 1逻辑删除 */
private String delFlag; private String delFlag;
//用于前端 显示供应商名称
private String supplierName;
//用于前端 显示供应商Id
private String supplierCode;
public void setPurchasePlanId(Long purchasePlanId) public void setPurchasePlanId(Long purchasePlanId)
{ {
this.purchasePlanId = purchasePlanId; this.purchasePlanId = purchasePlanId;
@ -239,6 +247,22 @@ public class PurchasePlan extends BaseEntity
return delFlag; return delFlag;
} }
public String getSupplierName() {
return supplierName;
}
public void setSupplierName(String supplierName) {
this.supplierName = supplierName;
}
public String getSupplierCode() {
return supplierCode;
}
public void setSupplierCode(String supplierCode) {
this.supplierCode = supplierCode;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -264,6 +288,8 @@ public class PurchasePlan extends BaseEntity
.append("updateTime", getUpdateTime()) .append("updateTime", getUpdateTime())
.append("remark", getRemark()) .append("remark", getRemark())
.append("delFlag", getDelFlag()) .append("delFlag", getDelFlag())
.append("supplierName", getSupplierName())
.append("supplierCode", getSupplierCode())
.toString(); .toString();
} }
} }

14
ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseQuoteHistory.java

@ -96,6 +96,10 @@ public class PurchaseQuoteHistory extends BaseEntity
@Excel(name = "审核状态") @Excel(name = "审核状态")
private String auditStatus; private String auditStatus;
/** 是否是最新报价(0否、1是) */
@Excel(name = "是否是最新报价(0否、1是)")
private String isLatest;
/** 删除标志 */ /** 删除标志 */
private String delFlag; private String delFlag;
@ -279,6 +283,15 @@ public class PurchaseQuoteHistory extends BaseEntity
{ {
return auditStatus; return auditStatus;
} }
public String getIsLatest() {
return isLatest;
}
public void setIsLatest(String isLatest) {
this.isLatest = isLatest;
}
public void setDelFlag(String delFlag) public void setDelFlag(String delFlag)
{ {
this.delFlag = delFlag; this.delFlag = delFlag;
@ -317,6 +330,7 @@ public class PurchaseQuoteHistory extends BaseEntity
.append("remark", getRemark()) .append("remark", getRemark())
.append("useStatus", getUseStatus()) .append("useStatus", getUseStatus())
.append("auditStatus", getAuditStatus()) .append("auditStatus", getAuditStatus())
.append("isLatest", getIsLatest())
.append("delFlag", getDelFlag()) .append("delFlag", getDelFlag())
.toString(); .toString();
} }

2
ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchasePlanChildMapper.java

@ -42,7 +42,7 @@ public interface PurchasePlanChildMapper
* @param purchasePlanChildList 采购计划单物料信息集合 * @param purchasePlanChildList 采购计划单物料信息集合
* @return 结果 * @return 结果
*/ */
public int batchInsertPurchasePlanChild(@Param("list") List<PurchasePlanChild> purchasePlanChildList); public int batchInsertPurchasePlanChild(List<PurchasePlanChild> purchasePlanChildList);
/** /**
* 修改采购计划单物料信息 * 修改采购计划单物料信息

5
ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseQuoteChildMapper.java

@ -89,4 +89,9 @@ public interface PurchaseQuoteChildMapper
* 通过采购报价单号查找所有采购报价子表集合 * 通过采购报价单号查找所有采购报价子表集合
* */ * */
List<PurchaseQuoteChild> selectPurchaseQuoteChildListByQuoteCodeList(List<String> purchaseQuoteCodes); List<PurchaseQuoteChild> selectPurchaseQuoteChildListByQuoteCodeList(List<String> purchaseQuoteCodes);
/**
* 通过供应商编码查找所有采购报价子表集合
* */
List<PurchaseQuoteChild> selectQuoteChildBySupplierCode(String supplierCode);
} }

15
ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseQuoteHistoryMapper.java

@ -27,6 +27,12 @@ public interface PurchaseQuoteHistoryMapper
*/ */
public List<PurchaseQuoteHistory> selectPurchaseQuoteHistoryList(PurchaseQuoteHistory purchaseQuoteHistory); public List<PurchaseQuoteHistory> selectPurchaseQuoteHistoryList(PurchaseQuoteHistory purchaseQuoteHistory);
/*
* 根据报价编号和物料号查询最新一条记录
* */
public PurchaseQuoteHistory findLatestPurchaseQuoteHistory(PurchaseQuoteHistory purchaseQuoteHistory);
/** /**
* 新增采购物料历史报价信息 * 新增采购物料历史报价信息
* *
@ -35,6 +41,15 @@ public interface PurchaseQuoteHistoryMapper
*/ */
public int insertPurchaseQuoteHistory(PurchaseQuoteHistory purchaseQuoteHistory); public int insertPurchaseQuoteHistory(PurchaseQuoteHistory purchaseQuoteHistory);
/**
* 批量新增采购物料历史报价信息
*
* @param purchaseQuoteHistoryList 采购物料历史报价信息集合
* @return 结果
*/
public int insertBatchPurchaseQuoteHistory(List<PurchaseQuoteHistory> purchaseQuoteHistoryList);
/** /**
* 修改采购物料历史报价信息 * 修改采购物料历史报价信息
* *

5
ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchasePlanService.java

@ -4,6 +4,7 @@ import com.ruoyi.erp.domain.vo.ErpDevelopModifyorderVo;
import com.ruoyi.purchase.domain.PurchasePlan; import com.ruoyi.purchase.domain.PurchasePlan;
import com.ruoyi.purchase.domain.PurchasePlanChild; import com.ruoyi.purchase.domain.PurchasePlanChild;
import com.ruoyi.purchase.domain.Vo.PurchasePlanSelectSupplierVo; import com.ruoyi.purchase.domain.Vo.PurchasePlanSelectSupplierVo;
import com.ruoyi.system.domain.SysMakeOrder;
import com.ruoyi.system.domain.SysMakeorderBom; import com.ruoyi.system.domain.SysMakeorderBom;
import java.util.List; import java.util.List;
@ -88,9 +89,9 @@ public interface IPurchasePlanService
public List<PurchasePlan> selectPurchasePlanByPlanCode(String purchasePlanCodes); public List<PurchasePlan> selectPurchasePlanByPlanCode(String purchasePlanCodes);
/** /**
* 生产订单工程审核后生成采购计划 * 生产订单采购审核后生成采购计划
* */ * */
void generatePurchasePlanByMakeOrder(List<SysMakeorderBom> insertedSysMakeorderBoms); void generatePurchasePlanByMakeOrder(SysMakeOrder sysMakeOrder);
/** /**
* 开发修改单审核通过后生成采购计划 * 开发修改单审核通过后生成采购计划

8
ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseQuoteHistoryService.java

@ -1,6 +1,8 @@
package com.ruoyi.purchase.service; package com.ruoyi.purchase.service;
import java.util.List; import java.util.List;
import com.ruoyi.purchase.domain.PurchaseQuote;
import com.ruoyi.purchase.domain.PurchaseQuoteHistory; import com.ruoyi.purchase.domain.PurchaseQuoteHistory;
/** /**
@ -72,4 +74,10 @@ public interface IPurchaseQuoteHistoryService
* @return * @return
*/ */
int restorePurchaseQuoteHistoryById(Long purchaseQuoteChildId); int restorePurchaseQuoteHistoryById(Long purchaseQuoteChildId);
/**
* 采购报价新增的时候生成采购报价历史数据
*
* */
int generatePurchaseQuoteHistory(PurchaseQuote purchaseQuote);
} }

7
ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseQuoteService.java

@ -6,6 +6,8 @@ import com.ruoyi.purchase.domain.PurchaseQuote;
import org.activiti.engine.runtime.ProcessInstance; import org.activiti.engine.runtime.ProcessInstance;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/** /**
* 采购报价单Service接口 * 采购报价单Service接口
* *
@ -92,4 +94,9 @@ public interface IPurchaseQuoteService
* @return 结果 * @return 结果
*/ */
Object getId(); Object getId();
/**
* 导入采购报价单
* */
String importPurchaseQuote(List<PurchaseQuote> purchaseQuoteList, boolean updateSupport, String operName);
} }

158
ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java

@ -7,6 +7,7 @@ import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.redis.RedisCache;
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;
@ -15,6 +16,7 @@ import com.ruoyi.erp.domain.ErpDevelopModifyorderDetail;
import com.ruoyi.erp.domain.vo.ErpDevelopModifyorderVo; import com.ruoyi.erp.domain.vo.ErpDevelopModifyorderVo;
import com.ruoyi.erp.mapper.ErpDevelopModifyorderDetailMapper; import com.ruoyi.erp.mapper.ErpDevelopModifyorderDetailMapper;
import com.ruoyi.erp.service.IErpBomService; import com.ruoyi.erp.service.IErpBomService;
import com.ruoyi.purchase.controller.PurchaseQuoteController;
import com.ruoyi.purchase.domain.PurchasePlan; import com.ruoyi.purchase.domain.PurchasePlan;
import com.ruoyi.purchase.domain.PurchasePlanChild; import com.ruoyi.purchase.domain.PurchasePlanChild;
import com.ruoyi.purchase.domain.PurchaseQuote; import com.ruoyi.purchase.domain.PurchaseQuote;
@ -26,6 +28,7 @@ import com.ruoyi.purchase.mapper.PurchaseQuoteMapper;
import com.ruoyi.system.domain.*; import com.ruoyi.system.domain.*;
import com.ruoyi.system.domain.Vo.SysSupplierVo; import com.ruoyi.system.domain.Vo.SysSupplierVo;
import com.ruoyi.system.mapper.SysMakeOrderMapper; import com.ruoyi.system.mapper.SysMakeOrderMapper;
import com.ruoyi.system.mapper.SysMakeorderBomMapper;
import com.ruoyi.system.mapper.SysSalesOrderChildMapper; import com.ruoyi.system.mapper.SysSalesOrderChildMapper;
import com.ruoyi.system.mapper.SysSupplierMapper; import com.ruoyi.system.mapper.SysSupplierMapper;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@ -75,6 +78,13 @@ public class PurchasePlanServiceImpl implements IPurchasePlanService
@Autowired @Autowired
private SysSupplierMapper sysSupplierMapper; private SysSupplierMapper sysSupplierMapper;
@Autowired
private SysMakeorderBomMapper sysMakeorderBomMapper;
/** /**
* 查询采购计划单 * 查询采购计划单
* *
@ -194,6 +204,11 @@ public class PurchasePlanServiceImpl implements IPurchasePlanService
purchasePlanCodeList = Arrays.asList(splitSalesOrderCode); purchasePlanCodeList = Arrays.asList(splitSalesOrderCode);
} }
String supplierCode = purchasePlan.getSupplierCode();
List<PurchaseQuoteChild> purchaseQuoteChildList = purchaseQuoteChildMapper.selectQuoteChildBySupplierCode(supplierCode);
//采购计划子表数据 //采购计划子表数据
List<PurchasePlanChild> purchasePlanChildList = purchasePlanChildMapper.selectPurchasePlanChildPlanCodeList(purchasePlanCodeList); List<PurchasePlanChild> purchasePlanChildList = purchasePlanChildMapper.selectPurchasePlanChildPlanCodeList(purchasePlanCodeList);
@ -235,7 +250,7 @@ public class PurchasePlanServiceImpl implements IPurchasePlanService
mergedList.forEach(item->{ mergedList.forEach(item->{
//字段(本次占用共享库存数):必填;默认为0,若共享可用库存数>0,则默认=共享可用库存数,可修改;需0<=本次占用共享库存数<=共享可用库存数 //字段(本次占用共享库存数):必填;默认为0,若共享可用库存数>0,则默认=共享可用库存数,可修改;需0<=本次占用共享库存数<=共享可用库存数
if (item.getSharedAvailableInventoryNum() > 0){ if (item.getSharedAvailableInventoryNum() != null && item.getSharedAvailableInventoryNum() > 0){
item.setSharedInventoryOccupancyNum(item.getSharedAvailableInventoryNum()); item.setSharedInventoryOccupancyNum(item.getSharedAvailableInventoryNum());
}else { }else {
item.setSharedInventoryOccupancyNum(0); item.setSharedInventoryOccupancyNum(0);
@ -337,106 +352,85 @@ public class PurchasePlanServiceImpl implements IPurchasePlanService
/* /*
* 生产订单工程审核后生成采购计划 * 生产订单采购审核后生成采购计划
* */ * */
@Override @Override
public void generatePurchasePlanByMakeOrder(List<SysMakeorderBom> insertedSysMakeorderBoms) { public void generatePurchasePlanByMakeOrder(SysMakeOrder makeOrder) {
// 假设此处有一个生成唯一采购计划单号的方法 // 生成唯一采购计划单号的方法
String purchasePlanCode = generateUniquePurchasePlanCode(); String purchasePlanCode = generateUniquePurchasePlanCode();
String loginName = ShiroUtils.getLoginName();
List<SysMakeorderBom> uniqueBoms = insertedSysMakeorderBoms.stream() PurchasePlan purchasePlan = new PurchasePlan();
// 分组依据为MaterialNo
.collect(Collectors.groupingBy(SysMakeorderBom::getMaterialNo))
// 把每个分组转为流,然后取第一个元素
.values().stream()
.map(groupedBoms -> groupedBoms.stream().findFirst().orElse(null))
// 过滤掉null值,以防万一某些分组是空的
.filter(Objects::nonNull)
.collect(Collectors.toList());
//过滤掉 只有采购的类型
List<SysMakeorderBom> filterUniqueBoms = uniqueBoms.stream().filter(bom -> "0".equals(bom.getProcessMethod())).collect(Collectors.toList());
//统计物料种类的数量
Integer materialAmount = filterUniqueBoms.size();
// 仅查询一次,因为所有SysMakeorderBom都关联同一生产单号
SysMakeOrder sysMakeOrder = sysMakeOrderMapper.selectMakeOrderByMakeNo(insertedSysMakeorderBoms.get(0).getMakeNo());
//保存所有加工方式为采购的物料
List<SysMakeorderBom> filterSysMakeorderBoms = insertedSysMakeorderBoms.stream().filter(bom -> "0".equals(bom.getProcessMethod())).collect(Collectors.toList());
if(StringUtils.isNotEmpty(filterUniqueBoms)){
//所有数据的销售订单号相同,只需查一条的销售订单号
String quoteId = filterSysMakeorderBoms.get(0).getSalesOrderCode();
// 第一步:收集所有不同的salesOrderMaterialNo 利用set key值不重复的特性 String makeNo = makeOrder.getMakeNo();
Set<String> uniqueSalesOrderMaterialNos = new HashSet<>();
for (SysMakeorderBom filterSysMakeorderBom : filterSysMakeorderBoms) {
uniqueSalesOrderMaterialNos.add(filterSysMakeorderBom.getSalesOrderMaterialNo());
}
// 第二步:查询每个salesOrderMaterialNo对应的SalesOrder数据 List<SysMakeorderBom> sysMakeorderBoms = sysMakeorderBomMapper.selectSysMakeorderBomByMakeNo(makeNo);
Map<String, SysSalesOrderChild> salesOrderChildByMaterialNo = new HashMap<>();
for (String salesOrderMaterialNo : uniqueSalesOrderMaterialNos) {
SysSalesOrderChild sysSalesOrderChild = new SysSalesOrderChild();
sysSalesOrderChild.setMaterialCode(salesOrderMaterialNo);
sysSalesOrderChild.setQuoteId(quoteId);
SysSalesOrderChild salesOrderChild = salesOrderChildMapper.selectSalesOrderChildByCodeAndNo(sysSalesOrderChild);
salesOrderChildByMaterialNo.put(salesOrderMaterialNo, salesOrderChild);
}
Integer purchasePlanMaterialSum = 0; //保留 只有采购的类型
// 第三步:计算purchasePlanNum List<SysMakeorderBom> filterUniqueBoms = sysMakeorderBoms.stream().filter(bom -> "0".equals(bom.getProcessMethod())).collect(Collectors.toList());
for (SysMakeorderBom filterSysMakeorderBom : filterSysMakeorderBoms) {
String salesOrderMaterialNo = filterSysMakeorderBom.getSalesOrderMaterialNo();
SysSalesOrderChild sysSalesOrderChild = salesOrderChildByMaterialNo.get(salesOrderMaterialNo);
if (sysSalesOrderChild != null) {
//物料数量
Integer materialNum = sysSalesOrderChild.getMaterialNum();
//用量
Integer useNum = filterSysMakeorderBom.getUseNum();
//采购计划数 List<PurchasePlanChild> purchasePlanChildList = new ArrayList<>();
Integer purchasePlanNum = materialNum * useNum;
// 立即创建PurchasePlanChild对象 for (SysMakeorderBom filterUniqueBom : filterUniqueBoms) {
PurchasePlanChild purchasePlanChild = new PurchasePlanChild(); PurchasePlanChild purchasePlanChild = new PurchasePlanChild();
purchasePlanChild.setPurchasePlanCode(purchasePlanCode); String salesOrderMaterialNo = filterUniqueBom.getSalesOrderMaterialNo();
purchasePlanChild.setMaterialNo(filterSysMakeorderBom.getMaterialNo()); String tempMakeNo = filterUniqueBom.getMakeNo();
PurchasePlanChild tempPurchasePlanChild = purchasePlanChildMapper.selectPurchasePlanChildByCodeAndNo(purchasePlanChild); int orderNum = 0;
if (tempPurchasePlanChild != null){ if (StringUtils.isNotEmpty(salesOrderMaterialNo)){
SysMakeorderBom tempMakeorderBom = new SysMakeorderBom();
purchasePlanChild.setPurchasePlanChildId(tempPurchasePlanChild.getPurchasePlanChildId()); tempMakeorderBom.setMaterialNo(salesOrderMaterialNo);
//设置计划采购数 tempMakeorderBom.setMakeNo(tempMakeNo);
purchasePlanChildMapper.updatePurchasePlanChild(purchasePlanChild); SysMakeorderBom oldMakeorderBom = sysMakeorderBomMapper.selectSysMakeorderBomByNo(tempMakeorderBom);
orderNum = oldMakeorderBom.getOrderNum();
purchasePlanChild.setPlanPurchaseNum(orderNum * filterUniqueBom.getUseNum());
purchasePlanChild.setPurchaseNum(orderNum * filterUniqueBom.getUseNum());
}else { }else {
purchasePlanChild.setMaterialName(filterSysMakeorderBom.getMaterialName()); purchasePlanChild.setPlanPurchaseNum(filterUniqueBom.getOrderNum());
purchasePlanChild.setMaterialType(filterSysMakeorderBom.getMaterialType()); purchasePlanChild.setPurchaseNum(filterUniqueBom.getOrderNum());
purchasePlanChild.setWarehouseDept(filterSysMakeorderBom.getWarehouseDept()); }
purchasePlanChild.setMaterialProcessMethod("0"); purchasePlanChild.setPurchasePlanStatus("0");
purchasePlanChild.setMaterialBrand(filterSysMakeorderBom.getBrand()); purchasePlanChild.setPurchasePlanCode(purchasePlanCode);
purchasePlanChild.setMaterialDescribe(filterSysMakeorderBom.getDescribe()); purchasePlanChild.setMaterialNo(filterUniqueBom.getMaterialNo());
purchasePlanChild.setMaterialUnit(filterSysMakeorderBom.getUnit()); purchasePlanChild.setMaterialName(filterUniqueBom.getMaterialName());
purchasePlanChild.setWarehouseDept(filterSysMakeorderBom.getWarehouseDept()); purchasePlanChild.setMaterialUnit(filterUniqueBom.getUnit());
// 物料的计划采购数,使用计算出的purchasePlanNum purchasePlanChild.setMaterialDescribe(filterUniqueBom.getDescribe());
purchasePlanChild.setCreateBy(ShiroUtils.getLoginName()); purchasePlanChild.setMaterialProcessMethod(filterUniqueBom.getProcessMethod());
purchasePlanChild.setMaterialBrand(filterUniqueBom.getBrand());
purchasePlanChild.setMaterialType(filterUniqueBom.getMaterialType());
purchasePlanChild.setMaterialPhotourl(filterUniqueBom.getPhotoUrl());
purchasePlanChild.setMaterialModel(filterUniqueBom.getMaterialModel());
purchasePlanChild.setWarehouseDept(filterUniqueBom.getWarehouseDept());
purchasePlanChild.setCreateTime(new Date()); purchasePlanChild.setCreateTime(new Date());
// 直接保存PurchasePlanChild对象 purchasePlanChild.setCreateBy(loginName);
purchasePlanChildMapper.insertPurchasePlanChild(purchasePlanChild); purchasePlanChildList.add(purchasePlanChild);
} }
// 更新总和 int batchInsertPurchasePlanChildResult = purchasePlanChildMapper.batchInsertPurchasePlanChild(purchasePlanChildList);
purchasePlanMaterialSum += purchasePlanNum; if (batchInsertPurchasePlanChildResult <= 0){
} throw new BusinessException("插入采购计划子表数据失败");
} }
//计算计划采购总数
int planPurchaseSum = purchasePlanChildList.stream().mapToInt(PurchasePlanChild::getPlanPurchaseNum).sum();
// 创建采购计划主记录 purchasePlan.setPurchaseSum(planPurchaseSum);
PurchasePlan purchasePlan = buildPurchasePlan(sysMakeOrder, purchasePlanCode,materialAmount,purchasePlanMaterialSum); purchasePlan.setPlanPurchaseSum(planPurchaseSum);
purchasePlanMapper.insertPurchasePlan(purchasePlan); purchasePlan.setMaterialSum(filterUniqueBoms.size());
purchasePlan.setPurchasePlanType("1");//生产单
purchasePlan.setPurchasePlanCode(purchasePlanCode);
purchasePlan.setPurchasePlanStatus("0");
purchasePlan.setCorrelationCode(makeOrder.getMakeNo());
purchasePlan.setCreateTime(new Date());
purchasePlan.setCreateBy(loginName);
int insertPurchasePlanResult = purchasePlanMapper.insertPurchasePlan(purchasePlan);
if (insertPurchasePlanResult <= 0){
throw new BusinessException("插入采购计划数据失败");
} }
} }
/** /**

39
ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseQuoteHistoryServiceImpl.java

@ -1,8 +1,11 @@
package com.ruoyi.purchase.service.impl; package com.ruoyi.purchase.service.impl;
import java.util.ArrayList;
import java.util.List; import java.util.List;
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.purchase.domain.PurchaseQuote;
import com.ruoyi.purchase.domain.PurchaseQuoteChild;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.purchase.mapper.PurchaseQuoteHistoryMapper; import com.ruoyi.purchase.mapper.PurchaseQuoteHistoryMapper;
@ -123,4 +126,40 @@ public class PurchaseQuoteHistoryServiceImpl implements IPurchaseQuoteHistorySer
{ {
return purchaseQuoteHistoryMapper.restorePurchaseQuoteHistoryById(purchaseQuoteChildId); return purchaseQuoteHistoryMapper.restorePurchaseQuoteHistoryById(purchaseQuoteChildId);
} }
/**
* 采购报价新增的时候生成采购报价历史数据
*
* */
@Override
public int generatePurchaseQuoteHistory(PurchaseQuote purchaseQuote) {
String loginName = ShiroUtils.getLoginName();
List<PurchaseQuoteChild> purchaseQuoteChildList = purchaseQuote.getPurchaseQuoteChildList();
String supplierQuoteCode = purchaseQuote.getSupplierQuoteCode();
String supplierName = purchaseQuote.getSupplierName();
String auditStatus = purchaseQuote.getAuditStatus();
String purchaseQuoteCode = purchaseQuote.getPurchaseQuoteCode();
List<PurchaseQuoteHistory> purchaseQuoteHistoryChildren = new ArrayList<>();
for (PurchaseQuoteChild purchaseQuoteChild : purchaseQuoteChildList) {
PurchaseQuoteHistory purchaseQuoteHistory = new PurchaseQuoteHistory();
purchaseQuoteHistory.setPurchaseQuoteCode(purchaseQuoteCode);
purchaseQuoteHistory.setMaterialCode(purchaseQuoteChild.getMaterialCode());
purchaseQuoteHistory.setMaterialName(purchaseQuoteChild.getMaterialName());
purchaseQuoteHistory.setMaterialNormb(purchaseQuoteChild.getMaterialNoRmb());
purchaseQuoteHistory.setMaterialRmb(purchaseQuoteChild.getMaterialRmb());
purchaseQuoteHistory.setSupplierCode(supplierQuoteCode);
purchaseQuoteHistory.setSupplierName(supplierName);
purchaseQuoteHistory.setIsLatest("0"); //第一次添加没有值
purchaseQuoteHistory.setAuditStatus(auditStatus);
purchaseQuoteHistory.setCreateBy(loginName);
purchaseQuoteHistory.setCreateTime(DateUtils.getNowDate());
purchaseQuoteHistoryChildren.add(purchaseQuoteHistory);
}
return purchaseQuoteHistoryMapper.insertBatchPurchaseQuoteHistory(purchaseQuoteHistoryChildren);
}
} }

82
ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseQuoteServiceImpl.java

@ -7,13 +7,16 @@ import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.PageDomain; import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableSupport; import com.ruoyi.common.core.page.TableSupport;
import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.service.ICommonService; import com.ruoyi.common.service.ICommonService;
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;
import com.ruoyi.purchase.domain.PurchaseQuoteHistory;
import com.ruoyi.purchase.domain.Vo.PurchaseQuoteVo; import com.ruoyi.purchase.domain.Vo.PurchaseQuoteVo;
import com.ruoyi.process.general.service.IProcessService; import com.ruoyi.process.general.service.IProcessService;
import com.ruoyi.process.todoitem.mapper.BizTodoItemMapper; import com.ruoyi.process.todoitem.mapper.BizTodoItemMapper;
import com.ruoyi.purchase.service.IPurchaseQuoteHistoryService;
import com.ruoyi.system.domain.SysAttach; import com.ruoyi.system.domain.SysAttach;
import com.ruoyi.purchase.domain.PurchaseQuoteChild; import com.ruoyi.purchase.domain.PurchaseQuoteChild;
import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.system.mapper.SysUserMapper;
@ -75,6 +78,10 @@ public class PurchaseQuoteServiceImpl implements IPurchaseQuoteService
@Autowired @Autowired
private IPurchaseQuoteChildService purchaseQuoteChildService; private IPurchaseQuoteChildService purchaseQuoteChildService;
@Autowired
private IPurchaseQuoteHistoryService purchaseQuoteHistoryService;
/** /**
* 查询采购报价单 * 查询采购报价单
* *
@ -202,10 +209,22 @@ public class PurchaseQuoteServiceImpl implements IPurchaseQuoteService
} }
} }
purchaseQuote.setMaterialAmount(String.valueOf(childResult)); purchaseQuote.setMaterialAmount(String.valueOf(childResult));
int result = purchaseQuoteMapper.insertPurchaseQuote(purchaseQuote); int result = purchaseQuoteMapper.insertPurchaseQuote(purchaseQuote);
//新增采购报价历史数据
int insertHistoryResult = purchaseQuoteHistoryService.generatePurchaseQuoteHistory(purchaseQuote);
if (insertHistoryResult <= 0){
throw new BusinessException("新增采购报价历史数据失败");
}
return result; return result;
} }
/** /**
* 修改采购报价单 * 修改采购报价单
* *
@ -438,4 +457,67 @@ public class PurchaseQuoteServiceImpl implements IPurchaseQuoteService
public Object getId(){ public Object getId(){
return redisCache.generateBillNo("CGBJ"); return redisCache.generateBillNo("CGBJ");
} }
/**
* 导入采购报价单
* */
@Override
public String importPurchaseQuote(List<PurchaseQuote> purchaseQuoteList, boolean updateSupport, String operName) {
if (StringUtils.isNull(purchaseQuoteList) || purchaseQuoteList.size() == 0)
{
throw new BusinessException("导入采购报价数据不能为空!");
}
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
// for (PurchaseQuote purchaseQuote : purchaseQuoteList)
// {
// try
// {
// // 验证是否存在这个用户
// SysUser u = userMapper.selectUserByLoginName(user.getLoginName());
// if (StringUtils.isNull(u))
// {
// user.setPassword(Md5Utils.hash(user.getLoginName() + password));
// user.setCreateBy(operName);
// this.insertUser(user);
// successNum++;
// successMsg.append("<br/>" + successNum + "、账号 " + user.getLoginName() + " 导入成功");
// }
// else if (isUpdateSupport)
// {
// user.setUpdateBy(operName);
// this.updateUser(user);
// successNum++;
// successMsg.append("<br/>" + successNum + "、账号 " + user.getLoginName() + " 更新成功");
// }
// else
// {
// failureNum++;
// failureMsg.append("<br/>" + failureNum + "、账号 " + user.getLoginName() + " 已存在");
// }
// }
// catch (Exception e)
// {
// failureNum++;
// String msg = "<br/>" + failureNum + "、账号 " + user.getLoginName() + " 导入失败:";
// failureMsg.append(msg + e.getMessage());
// log.error(msg, e);
// }
// }
// if (failureNum > 0)
// {
// failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
// throw new BusinessException(failureMsg.toString());
// }
// else
// {
// successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
// }
return successMsg.toString();
}
} }

12
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java

@ -452,12 +452,16 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService
makeorderBomMapper.updateSysMakeorderBom(makeBom); makeorderBomMapper.updateSysMakeorderBom(makeBom);
} }
} }
// sysMakeOrder.setMakeStatus("3");//生产状态-待生产 sysMakeOrder.setMakeStatus("3");//生产状态-待生产
// sysMakeOrder.setEceiptStatus("0");//入库状态-待采购 sysMakeOrder.setEceiptStatus("0");//入库状态-待采购
//测试用状态(跳过采购) //测试用状态(跳过采购)
sysMakeOrder.setMakeStatus("4");//生产状态-待生产 // sysMakeOrder.setMakeStatus("4");//生产状态-待生产
sysMakeOrder.setEceiptStatus("7");//入库状态-待采购 // sysMakeOrder.setEceiptStatus("7");//入库状态-待采购
//生成采购计划
purchasePlanService.generatePurchasePlanByMakeOrder(sysMakeOrder);
updateSysMakeOrder(sysMakeOrder); updateSysMakeOrder(sysMakeOrder);
} }

72
ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml

@ -142,6 +142,78 @@
</trim> </trim>
</insert> </insert>
<insert id="batchInsertPurchasePlanChild" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="purchasePlanChildId">
insert into purchase_plan_child (
purchase_plan_code,
purchase_plan_status,
correlation_code,
purchase_plan_type,
material_no,
material_name,
material_type,
material_photoUrl,
material_brand,
material_unit,
material_describe,
material_process_method,
material_model,
warehouse_dept,
material_noRmb_sum,
material_rmb_sum,
plan_purchase_num,
purchase_num,
actual_purchase_num,
shared_inventory_occupancy_num,
cancel_num,
plan_delivery_time,
this_purchase_num,
shared_available_inventory_num,
latest_quote_rmb,
create_by,
create_time,
remark,
del_flag
) values
<foreach collection="list" item="item" separator=",">
(
#{item.purchasePlanCode},
#{item.purchasePlanStatus},
#{item.correlationCode},
#{item.purchasePlanType},
#{item.materialNo},
#{item.materialName},
#{item.materialType},
#{item.materialPhotourl},
#{item.materialBrand},
#{item.materialUnit},
#{item.materialDescribe},
#{item.materialProcessMethod},
#{item.materialModel},
#{item.warehouseDept},
#{item.materialNoRmbSum},
#{item.materialRmbSum},
#{item.planPurchaseNum},
#{item.purchaseNum},
#{item.actualPurchaseNum},
#{item.sharedInventoryOccupancyNum},
#{item.cancelNum},
#{item.planDeliveryTime},
#{item.thisPurchaseNum},
#{item.sharedAvailableInventoryNum},
#{item.latestQuoteRmb},
#{item.createBy},
#{item.createTime},
#{item.remark},
#{item.delFlag}
)
</foreach>
</insert>
<update id="updatePurchasePlanChild" parameterType="PurchasePlanChild"> <update id="updatePurchasePlanChild" parameterType="PurchasePlanChild">
update purchase_plan_child update purchase_plan_child
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">

1
ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanMapper.xml

@ -42,6 +42,7 @@
<if test="purchasePlanType != null and purchasePlanType != ''"> and purchase_plan_type = #{purchasePlanType}</if> <if test="purchasePlanType != null and purchasePlanType != ''"> and purchase_plan_type = #{purchasePlanType}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if> <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
</where> </where>
order by create_time desc
</select> </select>
<select id="selectPurchasePlanById" parameterType="Long" resultMap="PurchasePlanResult"> <select id="selectPurchasePlanById" parameterType="Long" resultMap="PurchasePlanResult">

8
ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteChildMapper.xml

@ -84,6 +84,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectQuoteChildBySupplierCode" parameterType="String" resultMap="PurchaseQuoteChildResult">
<include refid="selectPurchaseQuoteChildVo"/>
where supplier_code = #{supplierCode}
</select>
<insert id="insertPurchaseQuoteChild" parameterType="PurchaseQuoteChild" useGeneratedKeys="true" keyProperty="purchaseQuoteChildId"> <insert id="insertPurchaseQuoteChild" parameterType="PurchaseQuoteChild" useGeneratedKeys="true" keyProperty="purchaseQuoteChildId">
insert into purchase_quote_child insert into purchase_quote_child
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
@ -242,4 +249,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
</mapper> </mapper>

72
ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteHistoryMapper.xml

@ -30,11 +30,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="remark" column="remark" /> <result property="remark" column="remark" />
<result property="useStatus" column="use_status" /> <result property="useStatus" column="use_status" />
<result property="auditStatus" column="audit_status" /> <result property="auditStatus" column="audit_status" />
<result property="isLatest" column=" is_latest"/>
<result property="delFlag" column="del_flag" /> <result property="delFlag" column="del_flag" />
</resultMap> </resultMap>
<sql id="selectPurchaseQuoteHistoryVo"> <sql id="selectPurchaseQuoteHistoryVo">
select purchase_quote_child_id, purchase_quote_code, material_id, material_code, material_name, material_type, processMethod, brand, photoUrl, describe, tax_rate, usd_rate, material_num, material_sole, material_rmb, material_noRmb, supplier_code, supplier_name, create_by, create_time, update_by, update_time, remark, use_status, audit_status, del_flag from purchase_quote_history select purchase_quote_child_id, purchase_quote_code, material_id, material_code, material_name, material_type, processMethod, brand, photoUrl, describe, tax_rate, usd_rate, material_num, material_sole, material_rmb, material_noRmb, supplier_code, supplier_name, create_by, create_time, update_by, update_time, remark, use_status, audit_status, is_latest,del_flag from purchase_quote_history
</sql> </sql>
<select id="selectPurchaseQuoteHistoryList" parameterType="PurchaseQuoteHistory" resultMap="PurchaseQuoteHistoryResult"> <select id="selectPurchaseQuoteHistoryList" parameterType="PurchaseQuoteHistory" resultMap="PurchaseQuoteHistoryResult">
@ -95,6 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
<if test="useStatus != null">use_status,</if> <if test="useStatus != null">use_status,</if>
<if test="auditStatus != null">audit_status,</if> <if test="auditStatus != null">audit_status,</if>
<if test="isLatest != null">is_latest,</if>
<if test="delFlag != null">del_flag,</if> <if test="delFlag != null">del_flag,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
@ -122,10 +124,68 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
<if test="useStatus != null">#{useStatus},</if> <if test="useStatus != null">#{useStatus},</if>
<if test="auditStatus != null">#{auditStatus},</if> <if test="auditStatus != null">#{auditStatus},</if>
<if test="isLatest != null">#{isLatest},</if>
<if test="delFlag != null">#{delFlag},</if> <if test="delFlag != null">#{delFlag},</if>
</trim> </trim>
</insert> </insert>
<insert id="insertBatchPurchaseQuoteHistory" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="purchaseQuoteChildId">
insert into purchase_quote_history (
purchase_quote_code,
material_id,
material_code,
material_name,
tax_rate,
usd_rate,
material_num,
material_sole,
material_rmb,
material_noRmb,
supplier_code,
supplier_name,
create_by,
create_time,
remark,
use_status,
audit_status,
is_latest,
del_flag
) values
<foreach collection="list" item="item" separator=",">
(
#{item.purchaseQuoteCode},
#{item.materialId},
#{item.materialCode},
#{item.materialName},
#{item.taxRate},
#{item.usdRate},
#{item.materialNum},
#{item.materialSole},
#{item.materialRmb},
#{item.materialNormb},
#{item.supplierCode},
#{item.supplierName},
#{item.createBy},
#{item.createTime},
#{item.remark},
#{item.useStatus},
#{item.auditStatus},
#{item.isLatest},
#{item.delFlag}
)
</foreach>
</insert>
<update id="updatePurchaseQuoteHistory" parameterType="PurchaseQuoteHistory"> <update id="updatePurchaseQuoteHistory" parameterType="PurchaseQuoteHistory">
update purchase_quote_history update purchase_quote_history
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
@ -153,6 +213,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="useStatus != null">use_status = #{useStatus},</if> <if test="useStatus != null">use_status = #{useStatus},</if>
<if test="auditStatus != null">audit_status = #{auditStatus},</if> <if test="auditStatus != null">audit_status = #{auditStatus},</if>
<if test="isLatest != null">is_latest = #{isLatest},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if> <if test="delFlag != null">del_flag = #{delFlag},</if>
</trim> </trim>
where purchase_quote_child_id = #{purchaseQuoteChildId} where purchase_quote_child_id = #{purchaseQuoteChildId}
@ -177,4 +238,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update purchase_quote_history set del_flag = '0' where purchase_quote_child_id = #{purchaseQuoteChildId} update purchase_quote_history set del_flag = '0' where purchase_quote_child_id = #{purchaseQuoteChildId}
</update> </update>
<select id="findLatestPurchaseQuoteHistory" parameterType="String" resultMap="PurchaseQuoteHistoryResult" >
<include refid="selectPurchaseQuoteHistoryVo"/>
where purchase_quote_code = #{purchaseQuoteCode} and material_code = #{materialCode} and audit_status = '1'
order by update_time desc
limit 1
</select>
</mapper> </mapper>

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

@ -92,7 +92,6 @@
fixedColumns: true, // 启用冻结列 fixedColumns: true, // 启用冻结列
fixedRightNumber: 1, // 冻结右列个数 fixedRightNumber: 1, // 冻结右列个数
sortable: true, // 是否启用排序 sortable: true, // 是否启用排序
sortStable: true, // 设置为 true 将获得稳定的排序
columns: [{ columns: [{
checkbox: true checkbox: true
}, },
@ -101,7 +100,6 @@
field: 'purchaseOrderId', field: 'purchaseOrderId',
visible: false visible: false
}, },
{title: '流程实例ID',field: 'instanceId',visible: false}, {title: '流程实例ID',field: 'instanceId',visible: false},
{ title: '流程提交实例ID',field: 'submitInstanceId',visible: false}, { title: '流程提交实例ID',field: 'submitInstanceId',visible: false},
{ title:'流程作废实例ID',field: 'cancelInstanceId',visible: false}, { title:'流程作废实例ID',field: 'cancelInstanceId',visible: false},
@ -116,11 +114,6 @@
} }
}, },
{title: '审核状态',field: 'auditStatus',visible: false,
formatter: function(value, row, index) {
return $.table.selectDictLabel(auditStatusDatas, value);}
},
{title: '当前状态',field: 'taskStatus', {title: '当前状态',field: 'taskStatus',
formatter: function(value, row, index) { formatter: function(value, row, index) {
if(row.auditStatus!="1"&&value != "未启动"){ if(row.auditStatus!="1"&&value != "未启动"){

20
ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html

@ -267,6 +267,10 @@ animation-fill-mode: none;
var prefix = ctx + "purchase/purchasePlan" var prefix = ctx + "purchase/purchasePlan"
// 全局变量存储 supplierCode
var selectedSupplierCode = '';
$("#form-addPurchaseOrder-addTwo").validate({focusCleanup: true}); $("#form-addPurchaseOrder-addTwo").validate({focusCleanup: true});
$("input[name='planDeliveryTime']").datetimepicker({ $("input[name='planDeliveryTime']").datetimepicker({
@ -303,6 +307,15 @@ animation-fill-mode: none;
$('#supplierCode').val(supplierCode); $('#supplierCode').val(supplierCode);
$('#supplierName').val(supplierName); $('#supplierName').val(supplierName);
// 存储 supplierCode 到全局变量
selectedSupplierCode = supplierCode;
// 切换到第二步前,刷新 bootstrap-table
$('#selectMaterial-bootstrap-table').bootstrapTable('refresh', {
url: prefix + "/selectMaterialTwoList",
queryParams: queryParamsTwo
});
// 切换到第二步 // 切换到第二步
$('#smartwizard').smartWizard("next"); $('#smartwizard').smartWizard("next");
}); });
@ -513,7 +526,6 @@ animation-fill-mode: none;
$(function() { $(function() {
var options = { var options = {
id: "selectMaterial-bootstrap-table", id: "selectMaterial-bootstrap-table",
url: prefix + "/selectMaterialTwoList",
queryParams: queryParamsTwo, queryParams: queryParamsTwo,
showSearch: false, showSearch: false,
showRefresh: false, showRefresh: false,
@ -720,11 +732,11 @@ animation-fill-mode: none;
function queryParamsTwo(params) { function queryParamsTwo(params) {
var curParams = { var curParams = {
purchasePlanCode : $("#purchasePlanCodes").val() purchasePlanCode: $("#purchasePlanCodes").val(),
supplierCode: selectedSupplierCode // 使用全局变量
}; };
return curParams return curParams;
} }

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

@ -25,10 +25,6 @@
<label>关联单号:</label> <label>关联单号:</label>
<input type="text" name="correlationCode"/> <input type="text" name="correlationCode"/>
</li> </li>
<li>
<label>申请人:</label>
<input type="text" name="applyUser"/>
</li>
<li class="select-time"> <li class="select-time">
<label>录入时间:</label> <label>录入时间:</label>
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginCreateTime]"/> <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginCreateTime]"/>
@ -86,6 +82,7 @@
detailView: true, detailView: true,
fixedColumns: true, // 启用冻结列 fixedColumns: true, // 启用冻结列
fixedRightNumber: 1, // 冻结右列个数 fixedRightNumber: 1, // 冻结右列个数
sortable: true,
onExpandRow : function(index,row,$detail){ onExpandRow : function(index,row,$detail){
$detail.html('<table class="table-container" id="purchase_plan_'+row.id+'"></table>').find('table'); $detail.html('<table class="table-container" id="purchase_plan_'+row.id+'"></table>').find('table');
// 一阶 // 一阶
@ -108,8 +105,9 @@
{title: '作废总数',field: 'cancelSum',}, {title: '作废总数',field: 'cancelSum',},
{title: '不含税总价(RMB)',field: 'noRmbSum',}, {title: '不含税总价(RMB)',field: 'noRmbSum',},
{title: '含税总价(RMB)',field: 'rmbSum',}, {title: '含税总价(RMB)',field: 'rmbSum',},
{title: '申请人',field: 'applyUser',}, {title: '录入时间',field: 'createTime',
{title: '录入时间',field: 'createTime',}, sortable: true,
},
{title: '更新人',field: 'updateBy',}, {title: '更新人',field: 'updateBy',},
{title: '上次更新时间',field: 'updateTime',}, {title: '上次更新时间',field: 'updateTime',},
{title: '操作',align: 'center', {title: '操作',align: 'center',

6
ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/purchaseQuote.html

@ -69,9 +69,9 @@
<a class="btn btn-success" onclick="$.table.exportExcel()" shiro:hasPermission="purchase:purchaseQuote:export"> <a class="btn btn-success" onclick="$.table.exportExcel()" shiro:hasPermission="purchase:purchaseQuote:export">
<i class="fa fa-download"></i> 导出 <i class="fa fa-download"></i> 导出
</a> </a>
<a class="btn btn-success" onclick="$.table.importExcel()" shiro:hasPermission="purchase:purchaseQuote:import"> <!-- <a class="btn btn-success" onclick="$.table.importExcel()" shiro:hasPermission="purchase:purchaseQuote:import">-->
<i class="fa fa-upload"></i> 导入 <!-- <i class="fa fa-upload"></i> 导入-->
</a> <!-- </a>-->
</div> </div>
<div class="col-sm-12 select-table table-striped"> <div class="col-sm-12 select-table table-striped">

Loading…
Cancel
Save