Browse Source

[feat]

删除旧版的采购计划的所有相关的文件,和其数据库的文件
删除旧版的采购计划子表的所有相关的文件,和其数据的文件
修改采购计划前端页面按照新版prd调整
按照新版prd
新增采购计划表purchase_plan
数据库新增5条测试数据
新增采购计划实体类
新增采购计划Controller
新增采购计划Mapper
新增采购计划Mapper.XML
新增采购计划Service接口
新增采购计划ServiceImpl实现类
按照新版prd
新增采购计划子表purchase_plan_child
数据库新增10条测试数据
新增采购计划子表实体类
新增采购计划子表Mapper
新增采购计划子表Mapper.XML
新增采购计划子表Service接口
新增采购计划子表ServiceImpl实现类
修改请购单的关联采购计划的方法,修改部分方法吗,采用最新的字段
dev
liuxiaoxu 2 weeks ago
parent
commit
45f4b369a2
  1. 6
      ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchasePlanController.java
  2. 216
      ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchasePlan.java
  3. 423
      ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchasePlanChild.java
  4. 71
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java
  5. 25
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BaseRequisitioningOrderServiceImpl.java
  6. 311
      ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml
  7. 109
      ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanMapper.xml
  8. 36
      ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/purchasePlan.html

6
ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchasePlanController.java

@ -126,9 +126,9 @@ public class PurchasePlanController extends BaseController
List<PurchasePlanChild> purchasePlanChildList = purchasePlanChildService.getPurchasePlanChildByPlanCodes(uniquePurchasePlanCodes); List<PurchasePlanChild> purchasePlanChildList = purchasePlanChildService.getPurchasePlanChildByPlanCodes(uniquePurchasePlanCodes);
for(PurchasePlanChild purchasePlanChild : purchasePlanChildList){ for(PurchasePlanChild purchasePlanChild : purchasePlanChildList){
String materialCode = purchasePlanChild.getMaterialCode(); String materialCode = purchasePlanChild.getMaterialNo();
List<PurchaseQuoteChild> purchaseQuoteChildList = purchaseQuoteChildService.selectQuoteChildByMaterialCode(materialCode); // List<PurchaseQuoteChild> purchaseQuoteChildList = purchaseQuoteChildService.selectQuoteChildByMaterialCode(materialCode);
purchasePlanChild.setPurchaseSupplierList(purchaseQuoteChildList); // purchasePlanChild.setPurchaseSupplierList(purchaseQuoteChildList);
} }
//再根据采购计划编号分组查询对应的采购报价数据分组 //再根据采购计划编号分组查询对应的采购报价数据分组
//用stream流处理相同供应商\物料\ //用stream流处理相同供应商\物料\

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

@ -1,158 +1,154 @@
package com.ruoyi.purchase.domain; package com.ruoyi.purchase.domain;
import java.math.BigDecimal;
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;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
import java.math.BigDecimal;
import java.util.List;
/** /**
* 采购计划单对象 purchase_plan * 采购计划单对象 purchase_plan
* *
* @author 刘晓旭 * @author 刘晓旭
* @date 2024-04-15 * @date 2024-11-15
*/ */
public class PurchasePlan extends BaseEntity public class PurchasePlan extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 采购计划索引id */ /** 采购计划id */
private Long purchasePlanId; private Long purchasePlanId;
/** 采购计划单号 */ /** 采购计划单号 */
@Excel(name = "采购计划单号") @Excel(name = "采购计划单号")
private String purchasePlanCode; private String purchasePlanCode;
/** 采购计划状态 (0待申请、1申请中、2申请通过、3审核拒绝、4已作废)*/ /** 采购计划状态(0待申请、1部分申请、2全部申请、3全部作废) */
@Excel(name = "采购计划状态") @Excel(name = "采购计划状态",dictType = "purchase_plan_status")
private String purchasePlanStatus; private String purchasePlanStatus;
/** 关联单号 */ /** 关联单号 */
@Excel(name = "关联单号") @Excel(name = "关联单号")
private String correlationCode; private String correlationCode;
/** 采购计划状态 (1生产单、2请购单、3开发修改单)*/ /** 采购来源(1生产单、2请购单、3开发修改单) */
@Excel(name = "采购来源") @Excel(name = "采购来源",dictType = "purchase_plan_type")
private String purchasePlanType; private String purchasePlanType;
/** 物料合计 */ /** 物料合计 */
@Excel(name = "物料合计") @Excel(name = "物料合计")
private Long materialAmount; private Integer materialSum;
/** 数量计 */ /** 数量计 */
@Excel(name = "数量计") @Excel(name = "数量计")
private Long materialSum; private Integer enterpriseSum;
/** 不含税总价(RMB) */ /** 不含税总价(RMB) */
@Excel(name = "不含税总价(RMB)") @Excel(name = "不含税总价(RMB)")
private BigDecimal noRmbSum; private BigDecimal normbSum;
/** 含税总价(RMB) */ /** 含税总价(RMB) */
@Excel(name = "含税总价(RMB)") @Excel(name = "含税总价(RMB)")
private BigDecimal rmbSum; private BigDecimal rmbSum;
/** 申请人 */ /** 计划采购总数 */
@Excel(name = "申请人") @Excel(name = "计划采购总数")
private String applyUser; private Integer planPurchaseSum;
/** 录入时间 */
@Excel(name = "录入时间")
private String firstAddTime;
/** 修改时间 */
@Excel(name = "修改时间")
private String updateInfoTime;
/** 审核状态 */ /** 待采购总数 */
private String auditStatus; @Excel(name = "待采购总数")
private Integer purchaseSum;
/** 使用状态 */ /** 实际采购总数 */
private String useStatus; @Excel(name = "实际采购总数")
private Integer actualPurchaseSum;
private List<PurchasePlanChild> purchasePlanDetailList; /** 共享库存占用总数 */
@Excel(name = "共享库存占用总数")
private Integer sharedInventoryOccupancySum;
/** 作废总数 */
@Excel(name = "作废总数")
private Integer cancelSum;
public List<PurchasePlanChild> getPurchasePlanDetailList() { /** 申请人 */
return purchasePlanDetailList; @Excel(name = "申请人")
} private String applyUser;
public void setPurchasePlanDetailList(List<PurchasePlanChild> purchasePlanDetailList) { /** 删除标志 0 启用 1逻辑删除 */
this.purchasePlanDetailList = purchasePlanDetailList; private String delFlag;
}
public void setPurchasePlanId(Long purchasePlanId) public void setPurchasePlanId(Long purchasePlanId)
{ {
this.purchasePlanId = purchasePlanId; this.purchasePlanId = purchasePlanId;
} }
public Long getPurchasePlanId() public Long getPurchasePlanId()
{ {
return purchasePlanId; return purchasePlanId;
} }
public void setPurchasePlanCode(String purchasePlanCode) public void setPurchasePlanCode(String purchasePlanCode)
{ {
this.purchasePlanCode = purchasePlanCode; this.purchasePlanCode = purchasePlanCode;
} }
public String getPurchasePlanCode() public String getPurchasePlanCode()
{ {
return purchasePlanCode; return purchasePlanCode;
} }
public void setPurchasePlanStatus(String purchasePlanStatus) public void setPurchasePlanStatus(String purchasePlanStatus)
{ {
this.purchasePlanStatus = purchasePlanStatus; this.purchasePlanStatus = purchasePlanStatus;
} }
public String getPurchasePlanStatus() public String getPurchasePlanStatus()
{ {
return purchasePlanStatus; return purchasePlanStatus;
} }
public void setCorrelationCode(String correlationCode) public void setCorrelationCode(String correlationCode)
{ {
this.correlationCode = correlationCode; this.correlationCode = correlationCode;
} }
public String getCorrelationCode() public String getCorrelationCode()
{ {
return correlationCode; return correlationCode;
} }
public void setPurchasePlanType(String purchasePlanType) public void setPurchasePlanType(String purchasePlanType)
{ {
this.purchasePlanType = purchasePlanType; this.purchasePlanType = purchasePlanType;
} }
public String getPurchasePlanType() public String getPurchasePlanType()
{ {
return purchasePlanType; return purchasePlanType;
} }
public void setMaterialAmount(Long materialAmount) public void setMaterialSum(Integer materialSum)
{ {
this.materialAmount = materialAmount; this.materialSum = materialSum;
} }
public Long getMaterialAmount() public Integer getMaterialSum()
{ {
return materialAmount; return materialSum;
} }
public void setMaterialSum(Long materialSum) public void setEnterpriseSum(Integer enterpriseSum)
{ {
this.materialSum = materialSum; this.enterpriseSum = enterpriseSum;
} }
public Long getMaterialSum() public Integer getEnterpriseSum()
{ {
return materialSum; return enterpriseSum;
} }
public void setNoRmbSum(BigDecimal noRmbSum) public void setNormbSum(BigDecimal normbSum)
{ {
this.noRmbSum = noRmbSum; this.normbSum = normbSum;
} }
public BigDecimal getNoRmbSum() public BigDecimal getNormbSum()
{ {
return noRmbSum; return normbSum;
} }
public void setRmbSum(BigDecimal rmbSum) public void setRmbSum(BigDecimal rmbSum)
{ {
@ -163,74 +159,94 @@ public class PurchasePlan extends BaseEntity
{ {
return rmbSum; return rmbSum;
} }
public void setApplyUser(String applyUser) public void setPlanPurchaseSum(Integer planPurchaseSum)
{ {
this.applyUser = applyUser; this.planPurchaseSum = planPurchaseSum;
} }
public String getApplyUser() public Integer getPlanPurchaseSum()
{ {
return applyUser; return planPurchaseSum;
}
public void setPurchaseSum(Integer purchaseSum)
{
this.purchaseSum = purchaseSum;
}
public Integer getPurchaseSum()
{
return purchaseSum;
} }
public void setFirstAddTime(String firstAddTime) public void setActualPurchaseSum(Integer actualPurchaseSum)
{ {
this.firstAddTime = firstAddTime; this.actualPurchaseSum = actualPurchaseSum;
} }
public String getFirstAddTime() public Integer getActualPurchaseSum()
{ {
return firstAddTime; return actualPurchaseSum;
} }
public void setUpdateInfoTime(String updateInfoTime) public void setSharedInventoryOccupancySum(Integer sharedInventoryOccupancySum)
{ {
this.updateInfoTime = updateInfoTime; this.sharedInventoryOccupancySum = sharedInventoryOccupancySum;
} }
public String getUpdateInfoTime() public Integer getSharedInventoryOccupancySum()
{ {
return updateInfoTime; return sharedInventoryOccupancySum;
} }
public void setAuditStatus(String auditStatus) public void setCancelSum(Integer cancelSum)
{ {
this.auditStatus = auditStatus; this.cancelSum = cancelSum;
} }
public String getAuditStatus() public Integer getCancelSum()
{ {
return auditStatus; return cancelSum;
}
public void setApplyUser(String applyUser)
{
this.applyUser = applyUser;
}
public String getApplyUser()
{
return applyUser;
} }
public void setUseStatus(String useStatus) public void setDelFlag(String delFlag)
{ {
this.useStatus = useStatus; this.delFlag = delFlag;
} }
public String getUseStatus() public String getDelFlag()
{ {
return useStatus; return delFlag;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("purchasePlanId", getPurchasePlanId()) .append("purchasePlanId", getPurchasePlanId())
.append("purchasePlanCode", getPurchasePlanCode()) .append("purchasePlanCode", getPurchasePlanCode())
.append("purchasePlanStatus", getPurchasePlanStatus()) .append("purchasePlanStatus", getPurchasePlanStatus())
.append("correlationCode", getCorrelationCode()) .append("correlationCode", getCorrelationCode())
.append("purchasePlanType", getPurchasePlanType()) .append("purchasePlanType", getPurchasePlanType())
.append("materialAmount", getMaterialAmount()) .append("materialSum", getMaterialSum())
.append("materialSum", getMaterialSum()) .append("enterpriseSum", getEnterpriseSum())
.append("noRmbSum", getNoRmbSum()) .append("normbSum", getNormbSum())
.append("rmbSum", getRmbSum()) .append("rmbSum", getRmbSum())
.append("applyUser", getApplyUser()) .append("planPurchaseSum", getPlanPurchaseSum())
.append("firstAddTime", getFirstAddTime()) .append("purchaseSum", getPurchaseSum())
.append("updateInfoTime", getUpdateInfoTime()) .append("actualPurchaseSum", getActualPurchaseSum())
.append("createBy", getCreateBy()) .append("sharedInventoryOccupancySum", getSharedInventoryOccupancySum())
.append("createTime", getCreateTime()) .append("cancelSum", getCancelSum())
.append("updateBy", getUpdateBy()) .append("applyUser", getApplyUser())
.append("updateTime", getUpdateTime()) .append("createBy", getCreateBy())
.append("auditStatus", getAuditStatus()) .append("createTime", getCreateTime())
.append("useStatus", getUseStatus()) .append("updateBy", getUpdateBy())
.append("remark", getRemark()) .append("updateTime", getUpdateTime())
.toString(); .append("remark", getRemark())
.append("delFlag", getDelFlag())
.toString();
} }
} }

423
ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchasePlanChild.java

@ -1,383 +1,350 @@
package com.ruoyi.purchase.domain; package com.ruoyi.purchase.domain;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
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;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
/** /**
* 采购计划单物料信息对象 purchase_plan_child * 采购计划单对象 purchase_plan_child
* *
* @author zhang * @author 刘晓旭
* @date 2024-05-16 * @date 2024-11-15
*/ */
public class PurchasePlanChild extends BaseEntity public class PurchasePlanChild extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public List<PurchaseQuoteChild> parseSupplierMaterialCombinations;
/** 采购计划物料清单索引 */ /** 采购计划子表id */
private Long purchasePlanChildId; private Long purchasePlanChildId;
/** 关联采购计划编号字段 */ /** 采购计划编号 */
@Excel(name = "关联采购计划编号字段") @Excel(name = "采购计划编号")
private String purchasePlanCode; private String purchasePlanCode;
/** 物料表中的id */ /** 采购计划状态(0待申请、1部分申请、2全部申请、3全部作废) */
@Excel(name = "物料表中的id") @Excel(name = "采购计划状态(0待申请、1部分申请、2全部申请、3全部作废)")
private Long materialId; private String purchasePlanStatus;
/** 物料表中的编号 */ /** 关联单号 */
@Excel(name = "物料表中的编号") @Excel(name = "关联单号")
private String materialCode; private String correlationCode;
/** 物料的名称 */ /** 采购来源(1生产单、2请购单、3开发修改单) */
@Excel(name = "物料的名称") @Excel(name = "采购来源(1生产单、2请购单、3开发修改单)")
private String materialName; private String purchasePlanType;
/** 物料的类型 */ /** 料号 */
@Excel(name = "物料的类型") @Excel(name = "料号")
private String materialType; private String materialNo;
/** 物料的加工方式 */ /** 物料名称 */
@Excel(name = "物料的加工方式") @Excel(name = "物料名称")
private String processMethod; private String materialName;
/** 物料的品牌 */ /** 物料类型 */
@Excel(name = "物料的品牌") @Excel(name = "物料类型")
private String brand; private String materialType;
/** 物料图片 */ /** 物料图片地址 */
@Excel(name = "物料图片") @Excel(name = "物料图片地址")
private String photoUrl; private String materialPhotourl;
/** 物料的描述 */ /** 物料品牌 */
@Excel(name = "物料的描述") @Excel(name = "物料品牌")
private String describe; private String materialBrand;
/** 物料单位 */
@Excel(name = "物料单位") @Excel(name = "物料单位")
private String unit; private String materialUnit;
@Excel(name = "物料入库部门")
private String warehouseDept;
/** 采购计划数 */ /** 物料描述 */
@Excel(name = "采购计划数") @Excel(name = "物料描述")
private Double materialNum; private String materialDescribe;
/** 物料的对外报价 */ /** 物料加工方式 */
private Long materialSole; @Excel(name = "物料加工方式")
private String materialProcessMethod;
/** 物料的不含税单价(RMB) */ /** 物料型号 */
private BigDecimal materialRmb; @Excel(name = "物料型号")
private String materialModel;
/** 物料的含税单价(RMB) */ /** 入库部门(0仓库、1采购) */
private BigDecimal materialNoRmb; @Excel(name = "入库部门(0仓库、1采购)")
private String warehouseDept;
/*供应商编号*/ /** 物料不含税总价(RMB) */
private String supplierCode; @Excel(name = "物料不含税总价(RMB)")
/** 物料供应商 */ private BigDecimal materialNormbSum;
private String supplierName;
/** 使用状态 */ /** 物料含税总价(RMB) */
private String useStatus; @Excel(name = "物料含税总价(RMB)")
private BigDecimal materialRmbSum;
/** 审核状态 */ /** 计划采购数 */
private String auditStatus; @Excel(name = "计划采购数")
private Integer planPurchaseNum;
/** 删除标志 */ /** 待采购数 */
private String delFlag; @Excel(name = "待采购数")
/** 关联供应商编号 */ private Integer purchaseNum;
private String supplierCodes;
/** 关联采购报价单编号 */
private String correlationCodes;
private String planCodes; /** 实际采购数 */
private List<PurchaseQuoteChild> purchaseSupplierList; @Excel(name = "实际采购数")
private Integer actualPurchaseNum;
public String getSupplierCodes() { /** 共享库存占用数 */
return supplierCodes; @Excel(name = "共享库存占用数")
} private Integer sharedInventoryOccupancyNum;
public void setSupplierCodes(String supplierCodes) {
this.supplierCodes = supplierCodes;
}
public String getCorrelationCodes() { /** 作废数 */
return correlationCodes; @Excel(name = "作废数")
} private Integer cancelNum;
public void setCorrelationCodes(String correlationCodes) { /** 删除标志 0 启用 1逻辑删除 */
this.correlationCodes = correlationCodes; private String delFlag;
}
public void setPurchasePlanChildId(Long purchasePlanChildId) public void setPurchasePlanChildId(Long purchasePlanChildId)
{ {
this.purchasePlanChildId = purchasePlanChildId; this.purchasePlanChildId = purchasePlanChildId;
} }
public Long getPurchasePlanChildId() public Long getPurchasePlanChildId()
{ {
return purchasePlanChildId; return purchasePlanChildId;
} }
public void setPurchasePlanCode(String purchasePlanCode) public void setPurchasePlanCode(String purchasePlanCode)
{ {
this.purchasePlanCode = purchasePlanCode; this.purchasePlanCode = purchasePlanCode;
} }
public String getPurchasePlanCode() public String getPurchasePlanCode()
{ {
return purchasePlanCode; return purchasePlanCode;
} }
public void setMaterialId(Long materialId) public void setPurchasePlanStatus(String purchasePlanStatus)
{ {
this.materialId = materialId; this.purchasePlanStatus = purchasePlanStatus;
} }
public Long getMaterialId() public String getPurchasePlanStatus()
{ {
return materialId; return purchasePlanStatus;
} }
public void setMaterialCode(String materialCode) public void setCorrelationCode(String correlationCode)
{ {
this.materialCode = materialCode; this.correlationCode = correlationCode;
} }
public String getMaterialCode() public String getCorrelationCode()
{ {
return materialCode; return correlationCode;
} }
public void setMaterialName(String materialName) public void setPurchasePlanType(String purchasePlanType)
{ {
this.materialName = materialName; this.purchasePlanType = purchasePlanType;
} }
public String getMaterialName() public String getPurchasePlanType()
{ {
return materialName; return purchasePlanType;
} }
public void setMaterialType(String materialType) public void setMaterialNo(String materialNo)
{ {
this.materialType = materialType; this.materialNo = materialNo;
} }
public String getMaterialType() public String getMaterialNo()
{ {
return materialType; return materialNo;
} }
public void setProcessMethod(String processMethod) public void setMaterialName(String materialName)
{ {
this.processMethod = processMethod; this.materialName = materialName;
} }
public String getProcessMethod() public String getMaterialName()
{ {
return processMethod; return materialName;
} }
public void setBrand(String brand) public void setMaterialType(String materialType)
{ {
this.brand = brand; this.materialType = materialType;
} }
public String getBrand() public String getMaterialType()
{ {
return brand; return materialType;
} }
public void setPhotoUrl(String photoUrl) public void setMaterialPhotourl(String materialPhotourl)
{ {
this.photoUrl = photoUrl; this.materialPhotourl = materialPhotourl;
} }
public String getPhotoUrl() public String getMaterialPhotourl()
{ {
return photoUrl; return materialPhotourl;
} }
public void setDescribe(String describe) public void setMaterialBrand(String materialBrand)
{ {
this.describe = describe; this.materialBrand = materialBrand;
} }
public String getDescribe() public String getMaterialBrand()
{ {
return describe; return materialBrand;
} }
public void setMaterialUnit(String materialUnit)
public String getUnit() { {
return unit; this.materialUnit = materialUnit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public Double getMaterialNum() {
return materialNum;
} }
public void setMaterialNum(Double materialNum) { public String getMaterialUnit()
this.materialNum = materialNum; {
return materialUnit;
} }
public void setMaterialDescribe(String materialDescribe)
{
this.materialDescribe = materialDescribe;
public List<PurchaseQuoteChild> getParseSupplierMaterialCombinations() {
return parseSupplierMaterialCombinations;
} }
public void setParseSupplierMaterialCombinations(List<PurchaseQuoteChild> parseSupplierMaterialCombinations) { public String getMaterialDescribe()
this.parseSupplierMaterialCombinations = parseSupplierMaterialCombinations; {
return materialDescribe;
} }
public void setMaterialProcessMethod(String materialProcessMethod)
public void setMaterialSole(Long materialSole)
{ {
this.materialSole = materialSole; this.materialProcessMethod = materialProcessMethod;
} }
public Long getMaterialSole() public String getMaterialProcessMethod()
{ {
return materialSole; return materialProcessMethod;
} }
public void setMaterialRmb(BigDecimal materialRmb) public void setMaterialModel(String materialModel)
{ {
this.materialRmb = materialRmb; this.materialModel = materialModel;
} }
public BigDecimal getMaterialRmb() public String getMaterialModel()
{ {
return materialRmb; return materialModel;
} }
public void setMaterialNoRmb(BigDecimal materialNoRmb) public void setWarehouseDept(String warehouseDept)
{ {
this.materialNoRmb = materialNoRmb; this.warehouseDept = warehouseDept;
} }
public BigDecimal getMaterialNoRmb() public String getWarehouseDept()
{ {
return materialNoRmb; return warehouseDept;
} }
public void setUseStatus(String useStatus) public void setMaterialNormbSum(BigDecimal materialNormbSum)
{ {
this.useStatus = useStatus; this.materialNormbSum = materialNormbSum;
} }
public String getSupplierCode() { public BigDecimal getMaterialNormbSum()
return supplierCode; {
return materialNormbSum;
} }
public void setMaterialRmbSum(BigDecimal materialRmbSum)
public void setSupplierCode(String supplierCode) { {
this.supplierCode = supplierCode; this.materialRmbSum = materialRmbSum;
} }
public String getSupplierName() { public BigDecimal getMaterialRmbSum()
return supplierName; {
return materialRmbSum;
} }
public void setPlanPurchaseNum(Integer planPurchaseNum)
public void setSupplierName(String supplierName) { {
this.supplierName = supplierName; this.planPurchaseNum = planPurchaseNum;
} }
public String getWarehouseDept() { public Integer getPlanPurchaseNum()
return warehouseDept; {
return planPurchaseNum;
} }
public void setPurchaseNum(Integer purchaseNum)
public void setWarehouseDept(String warehouseDept) { {
this.warehouseDept = warehouseDept; this.purchaseNum = purchaseNum;
} }
public List<PurchaseQuoteChild> getPurchaseSupplierList() { public Integer getPurchaseNum()
return purchaseSupplierList; {
return purchaseNum;
} }
public void setActualPurchaseNum(Integer actualPurchaseNum)
public void setPurchaseSupplierList(List<PurchaseQuoteChild> purchaseSupplierList) { {
this.purchaseSupplierList = purchaseSupplierList; this.actualPurchaseNum = actualPurchaseNum;
} }
public String getPlanCodes() { public Integer getActualPurchaseNum()
return planCodes; {
return actualPurchaseNum;
} }
public void setSharedInventoryOccupancyNum(Integer sharedInventoryOccupancyNum)
public void setPlanCodes(String planCodes) { {
this.planCodes = planCodes; this.sharedInventoryOccupancyNum = sharedInventoryOccupancyNum;
} }
public String getUseStatus() public Integer getSharedInventoryOccupancyNum()
{ {
return useStatus; return sharedInventoryOccupancyNum;
} }
public void setAuditStatus(String auditStatus) public void setCancelNum(Integer cancelNum)
{ {
this.auditStatus = auditStatus; this.cancelNum = cancelNum;
} }
public String getAuditStatus() public Integer getCancelNum()
{ {
return auditStatus; return cancelNum;
} }
public void setDelFlag(String delFlag) public void setDelFlag(String delFlag)
{ {
this.delFlag = delFlag; this.delFlag = delFlag;
} }
public String getDelFlag() public String getDelFlag()
{ {
return delFlag; return delFlag;
} }
public List<PurchaseQuoteChild> parseSupplierMaterialCombinations(String combinations) {
if (combinations == null || combinations.isEmpty()) {
return Collections.emptyList();
}
//materialCode|purchaseQuoteCode|supplierCode|supplierName|materialName|materialNoRmb|materialRmb|purchasePlanCode|correlationCode
/* 1. 料号 | 2. 供应商报价编号 | 3. 供应商编号 | 4.供应商名称 | 5. 物料名称 | 6. 物料含税单价(RMB) | 7. 物料不含税单价(RMB) | 8关联采购计划单号 | 9关联相关订单号 */
List<PurchaseQuoteChild> purchaseSupplierList = new ArrayList<>();
String[] split = combinations.split(",");
for (int i = 0; i < split.length; i++) {
String[] split1 = split[i].split("\\|");
PurchaseQuoteChild purchaseQuoteChild = new PurchaseQuoteChild();
purchaseQuoteChild.setMaterialCode(split1[0]);
purchaseQuoteChild.setPurchaseQuoteCode(split1[1]);
purchaseQuoteChild.setSupplierCode(split1[2]);
purchaseQuoteChild.setSupplierName(split1[3]);
purchaseQuoteChild.setMaterialName(split1[4]);
purchaseQuoteChild.setMaterialNoRmb(BigDecimal.valueOf(Float.parseFloat(split1[5])));
purchaseQuoteChild.setMaterialRmb(BigDecimal.valueOf(Float.parseFloat(split1[6])));
purchaseQuoteChild.setPurchasePlanCode(split1[7]);
purchaseQuoteChild.setCorrelationCode(split1[8]);
purchaseSupplierList.add(purchaseQuoteChild);
}
return purchaseSupplierList;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("purchasePlanChildId", getPurchasePlanChildId()) .append("purchasePlanChildId", getPurchasePlanChildId())
.append("purchasePlanCode", getPurchasePlanCode()) .append("purchasePlanCode", getPurchasePlanCode())
.append("materialId", getMaterialId()) .append("purchasePlanStatus", getPurchasePlanStatus())
.append("materialCode", getMaterialCode()) .append("correlationCode", getCorrelationCode())
.append("materialName", getMaterialName()) .append("purchasePlanType", getPurchasePlanType())
.append("materialType", getMaterialType()) .append("materialNo", getMaterialNo())
.append("processMethod", getProcessMethod()) .append("materialName", getMaterialName())
.append("brand", getBrand()) .append("materialType", getMaterialType())
.append("photoUrl", getPhotoUrl()) .append("materialPhotourl", getMaterialPhotourl())
.append("describe", getDescribe()) .append("materialBrand", getMaterialBrand())
.append("materialNum", getMaterialNum()) .append("materialUnit", getMaterialUnit())
.append("materialSole", getMaterialSole()) .append("materialDescribe", getMaterialDescribe())
.append("materialRmb", getMaterialRmb()) .append("materialProcessMethod", getMaterialProcessMethod())
.append("materialNoRmb", getMaterialNoRmb()) .append("materialModel", getMaterialModel())
.append("createBy", getCreateBy()) .append("warehouseDept", getWarehouseDept())
.append("createTime", getCreateTime()) .append("materialNormbSum", getMaterialNormbSum())
.append("updateBy", getUpdateBy()) .append("materialRmbSum", getMaterialRmbSum())
.append("updateTime", getUpdateTime()) .append("planPurchaseNum", getPlanPurchaseNum())
.append("remark", getRemark()) .append("purchaseNum", getPurchaseNum())
.append("useStatus", getUseStatus()) .append("actualPurchaseNum", getActualPurchaseNum())
.append("auditStatus", getAuditStatus()) .append("sharedInventoryOccupancyNum", getSharedInventoryOccupancyNum())
.append("delFlag", getDelFlag()) .append("cancelNum", getCancelNum())
.toString(); .append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("delFlag", getDelFlag())
.toString();
} }
} }

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

@ -97,8 +97,6 @@ public class PurchasePlanServiceImpl implements IPurchasePlanService
String loginName = ShiroUtils.getLoginName(); String loginName = ShiroUtils.getLoginName();
purchasePlan.setCreateBy(loginName); purchasePlan.setCreateBy(loginName);
purchasePlan.setCreateTime(DateUtils.getNowDate()); purchasePlan.setCreateTime(DateUtils.getNowDate());
purchasePlan.setMaterialAmount(0L);
purchasePlan.setMaterialSum(0L);
return purchasePlanMapper.insertPurchasePlan(purchasePlan); return purchasePlanMapper.insertPurchasePlan(purchasePlan);
} }
@ -221,48 +219,43 @@ public class PurchasePlanServiceImpl implements IPurchasePlanService
salesOrderChildByMaterialNo.put(salesOrderMaterialNo, salesOrderChild); salesOrderChildByMaterialNo.put(salesOrderMaterialNo, salesOrderChild);
} }
double purchasePlanMaterialSum = 0L; Integer purchasePlanMaterialSum = 0;
// 第三步:计算purchasePlanNum // 第三步:计算purchasePlanNum
for (SysMakeorderBom filterSysMakeorderBom : filterSysMakeorderBoms) { for (SysMakeorderBom filterSysMakeorderBom : filterSysMakeorderBoms) {
String salesOrderMaterialNo = filterSysMakeorderBom.getSalesOrderMaterialNo(); String salesOrderMaterialNo = filterSysMakeorderBom.getSalesOrderMaterialNo();
SysSalesOrderChild sysSalesOrderChild = salesOrderChildByMaterialNo.get(salesOrderMaterialNo); SysSalesOrderChild sysSalesOrderChild = salesOrderChildByMaterialNo.get(salesOrderMaterialNo);
if (sysSalesOrderChild != null) { if (sysSalesOrderChild != null) {
//物料数量 //物料数量
long materialNum = sysSalesOrderChild.getMaterialNum(); Integer materialNum = sysSalesOrderChild.getMaterialNum();
//用量 //用量
Integer useNum = filterSysMakeorderBom.getUseNum(); Integer useNum = filterSysMakeorderBom.getUseNum();
//采购计划数 //采购计划数
double purchasePlanNum = materialNum * useNum; Integer purchasePlanNum = materialNum * useNum;
// 立即创建PurchasePlanChild对象 // 立即创建PurchasePlanChild对象
PurchasePlanChild purchasePlanChild = new PurchasePlanChild(); PurchasePlanChild purchasePlanChild = new PurchasePlanChild();
purchasePlanChild.setPurchasePlanCode(purchasePlanCode); purchasePlanChild.setPurchasePlanCode(purchasePlanCode);
purchasePlanChild.setMaterialCode(filterSysMakeorderBom.getMaterialNo()); purchasePlanChild.setMaterialNo(filterSysMakeorderBom.getMaterialNo());
PurchasePlanChild tempPurchasePlanChild = purchasePlanChildMapper.selectPurchasePlanChildByCodeAndNo(purchasePlanChild); PurchasePlanChild tempPurchasePlanChild = purchasePlanChildMapper.selectPurchasePlanChildByCodeAndNo(purchasePlanChild);
if (tempPurchasePlanChild != null){ if (tempPurchasePlanChild != null){
purchasePlanChild.setPurchasePlanChildId(tempPurchasePlanChild.getPurchasePlanChildId()); purchasePlanChild.setPurchasePlanChildId(tempPurchasePlanChild.getPurchasePlanChildId());
double addMaterialNum = tempPurchasePlanChild.getMaterialNum() + purchasePlanNum;
//设置计划采购数 //设置计划采购数
purchasePlanChild.setMaterialNum(addMaterialNum);
purchasePlanChildMapper.updatePurchasePlanChild(purchasePlanChild); purchasePlanChildMapper.updatePurchasePlanChild(purchasePlanChild);
}else { }else {
purchasePlanChild.setMaterialName(filterSysMakeorderBom.getMaterialName()); purchasePlanChild.setMaterialName(filterSysMakeorderBom.getMaterialName());
purchasePlanChild.setMaterialType(filterSysMakeorderBom.getMaterialType()); purchasePlanChild.setMaterialType(filterSysMakeorderBom.getMaterialType());
purchasePlanChild.setWarehouseDept(filterSysMakeorderBom.getWarehouseDept()); purchasePlanChild.setWarehouseDept(filterSysMakeorderBom.getWarehouseDept());
purchasePlanChild.setProcessMethod("0"); purchasePlanChild.setMaterialProcessMethod("0");
purchasePlanChild.setBrand(filterSysMakeorderBom.getBrand()); purchasePlanChild.setMaterialBrand(filterSysMakeorderBom.getBrand());
purchasePlanChild.setDescribe(filterSysMakeorderBom.getDescribe()); purchasePlanChild.setMaterialDescribe(filterSysMakeorderBom.getDescribe());
purchasePlanChild.setUnit(filterSysMakeorderBom.getUnit()); purchasePlanChild.setMaterialUnit(filterSysMakeorderBom.getUnit());
purchasePlanChild.setWarehouseDept(filterSysMakeorderBom.getWarehouseDept()); purchasePlanChild.setWarehouseDept(filterSysMakeorderBom.getWarehouseDept());
// 物料的计划采购数,使用计算出的purchasePlanNum // 物料的计划采购数,使用计算出的purchasePlanNum
purchasePlanChild.setMaterialNum(purchasePlanNum);
purchasePlanChild.setCreateBy(ShiroUtils.getLoginName()); purchasePlanChild.setCreateBy(ShiroUtils.getLoginName());
purchasePlanChild.setCreateTime(new Date()); purchasePlanChild.setCreateTime(new Date());
purchasePlanChild.setUnit(filterSysMakeorderBom.getUnit());
// 直接保存PurchasePlanChild对象 // 直接保存PurchasePlanChild对象
purchasePlanChildMapper.insertPurchasePlanChild(purchasePlanChild); purchasePlanChildMapper.insertPurchasePlanChild(purchasePlanChild);
} }
@ -328,7 +321,6 @@ public class PurchasePlanServiceImpl implements IPurchasePlanService
.collect(Collectors.toList()); .collect(Collectors.toList());
for (ErpBom subBom : filterSubBomList) { for (ErpBom subBom : filterSubBomList) {
PurchasePlanChild purchasePlanChild = createPurchasePlanChild(purchasePlanCode, subBom, loginName); PurchasePlanChild purchasePlanChild = createPurchasePlanChild(purchasePlanCode, subBom, loginName);
purchasePlanChild.setMaterialNum((double) (erpDevelopModifyorderDetail.getMaterialNum() * subBom.getUseNum()));
purchasePlanChildList.add(purchasePlanChild); purchasePlanChildList.add(purchasePlanChild);
} }
} }
@ -337,18 +329,15 @@ public class PurchasePlanServiceImpl implements IPurchasePlanService
// 合并相同materialCode的数据 // 合并相同materialCode的数据
List<PurchasePlanChild> mergedPurchasePlanChildList = mergePurchasePlanChildList(purchasePlanChildList); List<PurchasePlanChild> mergedPurchasePlanChildList = mergePurchasePlanChildList(purchasePlanChildList);
// 只需要加工方式为采购的 // 只需要加工方式为采购的
List<PurchasePlanChild> filterMergedPurchasePlanChildList = mergedPurchasePlanChildList.stream().filter(child -> "0".equals(child.getProcessMethod())).collect(Collectors.toList()); List<PurchasePlanChild> filterMergedPurchasePlanChildList = mergedPurchasePlanChildList.stream().filter(child -> "0".equals(child.getMaterialProcessMethod())).collect(Collectors.toList());
purchasePlan.setMaterialAmount(Long.valueOf(filterMergedPurchasePlanChildList.size())); purchasePlan.setEnterpriseSum(filterMergedPurchasePlanChildList.size());
// 计算所有 PurchasePlanChild 的 materialNum 总和 // 计算所有 PurchasePlanChild 的 materialNum 总和
// Long totalMaterialNum = filterMergedPurchasePlanChildList.stream() // Long totalMaterialNum = filterMergedPurchasePlanChildList.stream()
// .mapToLong(PurchasePlanChild::getMaterialNum) // .mapToLong(PurchasePlanChild::getMaterialNum)
// .sum(); // .sum();
double totalMaterialNum = filterMergedPurchasePlanChildList.stream().mapToDouble(purchasePlanChild -> purchasePlanChild.getMaterialNum()).sum();
purchasePlan.setMaterialSum((long) totalMaterialNum);
// 批量新增采购计划子表 // 批量新增采购计划子表
// purchasePlanChildMapper.batchInsertPurchasePlanChild(filterMergedPurchasePlanChildList); // purchasePlanChildMapper.batchInsertPurchasePlanChild(filterMergedPurchasePlanChildList);
@ -366,13 +355,12 @@ public class PurchasePlanServiceImpl implements IPurchasePlanService
purchasePlanChild.setPurchasePlanCode(purchasePlanCode); purchasePlanChild.setPurchasePlanCode(purchasePlanCode);
purchasePlanChild.setCreateTime(new Date()); purchasePlanChild.setCreateTime(new Date());
purchasePlanChild.setCreateBy(loginName); purchasePlanChild.setCreateBy(loginName);
purchasePlanChild.setMaterialCode(detail.getMaterialNo()); purchasePlanChild.setMaterialNo(detail.getMaterialNo());
purchasePlanChild.setMaterialName(detail.getMaterialName()); purchasePlanChild.setMaterialName(detail.getMaterialName());
purchasePlanChild.setMaterialType(detail.getMaterialType()); purchasePlanChild.setMaterialType(detail.getMaterialType());
purchasePlanChild.setBrand(detail.getMaterialBrand()); purchasePlanChild.setMaterialBrand(detail.getMaterialBrand());
purchasePlanChild.setUnit(detail.getMaterialUnit()); purchasePlanChild.setMaterialUnit(detail.getMaterialUnit());
purchasePlanChild.setDescribe(detail.getMaterialDescribe()); purchasePlanChild.setMaterialDescribe(detail.getMaterialDescribe());
purchasePlanChild.setMaterialNum(Double.valueOf(detail.getMaterialNum()));
purchasePlanChild.setWarehouseDept(detail.getWarehouseDept()); purchasePlanChild.setWarehouseDept(detail.getWarehouseDept());
return purchasePlanChild; return purchasePlanChild;
} }
@ -382,13 +370,14 @@ public class PurchasePlanServiceImpl implements IPurchasePlanService
purchasePlanChild.setPurchasePlanCode(purchasePlanCode); purchasePlanChild.setPurchasePlanCode(purchasePlanCode);
purchasePlanChild.setCreateTime(new Date()); purchasePlanChild.setCreateTime(new Date());
purchasePlanChild.setCreateBy(loginName); purchasePlanChild.setCreateBy(loginName);
purchasePlanChild.setMaterialCode(bom.getMaterialNo()); purchasePlanChild.setMaterialNo(bom.getMaterialNo());
purchasePlanChild.setMaterialName(bom.getMaterialName()); purchasePlanChild.setMaterialName(bom.getMaterialName());
purchasePlanChild.setMaterialType(bom.getMaterialType()); purchasePlanChild.setMaterialType(bom.getMaterialType());
purchasePlanChild.setProcessMethod(bom.getProcessMethod()); purchasePlanChild.setMaterialProcessMethod(bom.getProcessMethod());
purchasePlanChild.setBrand(bom.getBrand()); purchasePlanChild.setMaterialBrand(bom.getBrand());
purchasePlanChild.setUnit(bom.getUnit()); purchasePlanChild.setMaterialUnit(bom.getUnit());
purchasePlanChild.setDescribe(bom.getDescribe()); purchasePlanChild.setMaterialDescribe(bom.getDescribe());
purchasePlanChild.setMaterialModel(bom.getMaterialModel());
purchasePlanChild.setWarehouseDept(bom.getWarehouseDept()); purchasePlanChild.setWarehouseDept(bom.getWarehouseDept());
return purchasePlanChild; return purchasePlanChild;
} }
@ -397,12 +386,12 @@ public class PurchasePlanServiceImpl implements IPurchasePlanService
Map<String, PurchasePlanChild> aggregatedMap = new HashMap<>(); Map<String, PurchasePlanChild> aggregatedMap = new HashMap<>();
for (PurchasePlanChild purchasePlanChild : purchasePlanChildList) { for (PurchasePlanChild purchasePlanChild : purchasePlanChildList) {
String materialCode = purchasePlanChild.getMaterialCode(); String materialNo = purchasePlanChild.getMaterialNo();
if (aggregatedMap.containsKey(materialCode)) { if (aggregatedMap.containsKey(materialNo)) {
PurchasePlanChild existing = aggregatedMap.get(materialCode); PurchasePlanChild existing = aggregatedMap.get(materialNo);
existing.setMaterialNum(existing.getMaterialNum() + purchasePlanChild.getMaterialNum()); existing.setPlanPurchaseNum(existing.getPlanPurchaseNum() + purchasePlanChild.getPlanPurchaseNum());
} else { } else {
aggregatedMap.put(materialCode, purchasePlanChild); aggregatedMap.put(materialNo, purchasePlanChild);
} }
} }
@ -416,23 +405,21 @@ public class PurchasePlanServiceImpl implements IPurchasePlanService
return redisCache.generateBillNo("CGJH"); return redisCache.generateBillNo("CGJH");
} }
private PurchasePlan buildPurchasePlan(SysMakeOrder sysMakeOrder, String purchasePlanCode,Integer materialAmount,double purchasePlanMaterialSum) { private PurchasePlan buildPurchasePlan(SysMakeOrder sysMakeOrder, String purchasePlanCode,Integer materialAmount,Integer purchasePlanMaterialSum) {
PurchasePlan purchasePlan = new PurchasePlan(); PurchasePlan purchasePlan = new PurchasePlan();
purchasePlan.setCorrelationCode(sysMakeOrder.getMakeNo()); purchasePlan.setCorrelationCode(sysMakeOrder.getMakeNo());
purchasePlan.setPurchasePlanCode(purchasePlanCode); purchasePlan.setPurchasePlanCode(purchasePlanCode);
purchasePlan.setPurchasePlanType("1"); purchasePlan.setPurchasePlanType("1");
//添加物料合计 //添加物料合计
purchasePlan.setMaterialAmount((long) materialAmount); purchasePlan.setMaterialSum(materialAmount);
//添加数量合计 //添加数量合计
purchasePlan.setMaterialSum((long) purchasePlanMaterialSum); purchasePlan.setEnterpriseSum(purchasePlanMaterialSum);
purchasePlan.setNoRmbSum(sysMakeOrder.getNoRate()); purchasePlan.setNormbSum(sysMakeOrder.getNoRate());
purchasePlan.setRmbSum(sysMakeOrder.getRate()); purchasePlan.setRmbSum(sysMakeOrder.getRate());
purchasePlan.setApplyUser(sysMakeOrder.getSalesman()); purchasePlan.setApplyUser(sysMakeOrder.getSalesman());
purchasePlan.setCreateBy(ShiroUtils.getLoginName()); purchasePlan.setCreateBy(ShiroUtils.getLoginName());
purchasePlan.setCreateTime(DateUtils.getNowDate()); purchasePlan.setCreateTime(DateUtils.getNowDate());
purchasePlan.setAuditStatus("0");
purchasePlan.setUseStatus("0");
purchasePlan.setPurchasePlanStatus("0"); purchasePlan.setPurchasePlanStatus("0");
return purchasePlan; return purchasePlan;
} }

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

@ -597,37 +597,36 @@ public class BaseRequisitioningOrderServiceImpl implements IBaseRequisitioningOr
PurchasePlan purchasePlan = new PurchasePlan(); PurchasePlan purchasePlan = new PurchasePlan();
BigDecimal noRmbSum = BigDecimal.ZERO; BigDecimal noRmbSum = BigDecimal.ZERO;
BigDecimal rmbSum = BigDecimal.ZERO; BigDecimal rmbSum = BigDecimal.ZERO;
Long materialAmount = Long.valueOf(requisitioningOrderDetailList.size()); Integer materialAmount = requisitioningOrderDetailList.size();
Long materialSum = 0L; Long materialSum = 0L;
//采购计划关联单号 //采购计划关联单号
purchasePlan.setPurchasePlanCode(redisCache.generateBillNo("CGJH")); purchasePlan.setPurchasePlanCode(redisCache.generateBillNo("CGJH"));
purchasePlan.setPurchasePlanStatus("0"); purchasePlan.setPurchasePlanStatus("0");
purchasePlan.setCorrelationCode(requisitioningOrder.getRequisitioningCode()); purchasePlan.setCorrelationCode(requisitioningOrder.getRequisitioningCode());
purchasePlan.setPurchasePlanType("2"); purchasePlan.setPurchasePlanType("2");
purchasePlan.setMaterialAmount(materialAmount); purchasePlan.setMaterialSum(materialAmount);
for (BaseRequisitioningOrderChild requisitioningOrderDetail : requisitioningOrderDetailList) { for (BaseRequisitioningOrderChild requisitioningOrderDetail : requisitioningOrderDetailList) {
PurchasePlanChild purchasePlanChild = new PurchasePlanChild(); PurchasePlanChild purchasePlanChild = new PurchasePlanChild();
purchasePlanChild.setPurchasePlanCode(purchasePlan.getPurchasePlanCode()); purchasePlanChild.setPurchasePlanCode(purchasePlan.getPurchasePlanCode());
purchasePlanChild.setMaterialId(requisitioningOrderDetail.getMaterialId());
purchasePlanChild.setWarehouseDept(requisitioningOrderDetail.getWarehouseDept()); purchasePlanChild.setWarehouseDept(requisitioningOrderDetail.getWarehouseDept());
purchasePlanChild.setMaterialCode(requisitioningOrderDetail.getMaterialCode()); purchasePlanChild.setMaterialNo(requisitioningOrderDetail.getMaterialCode());
purchasePlanChild.setMaterialName(requisitioningOrderDetail.getMaterialName()); purchasePlanChild.setMaterialName(requisitioningOrderDetail.getMaterialName());
purchasePlanChild.setDescribe(requisitioningOrderDetail.getDescribe()); purchasePlanChild.setMaterialDescribe(requisitioningOrderDetail.getDescribe());
purchasePlanChild.setBrand(requisitioningOrderDetail.getBrand()); purchasePlanChild.setMaterialBrand(requisitioningOrderDetail.getBrand());
purchasePlanChild.setUnit(requisitioningOrderDetail.getUnit()); purchasePlanChild.setMaterialUnit(requisitioningOrderDetail.getUnit());
purchasePlanChild.setPhotoUrl(requisitioningOrderDetail.getPhotoUrl()); purchasePlanChild.setMaterialPhotourl(requisitioningOrderDetail.getPhotoUrl());
purchasePlanChild.setProcessMethod(requisitioningOrderDetail.getProcessMethod()); purchasePlanChild.setMaterialProcessMethod(requisitioningOrderDetail.getProcessMethod());
purchasePlanChild.setMaterialNum(Double.valueOf(requisitioningOrderDetail.getMaterialNum())); // purchasePlanChild.setMaterialNum(Double.valueOf(requisitioningOrderDetail.getMaterialNum()));
purchasePlanChild.setMaterialType(requisitioningOrderDetail.getMaterialType()); purchasePlanChild.setMaterialType(requisitioningOrderDetail.getMaterialType());
purchasePlanChild.setMaterialNoRmb(requisitioningOrderDetail.getMaterialNoRmb()); purchasePlanChild.setMaterialNormbSum(requisitioningOrderDetail.getMaterialNoRmb());
purchasePlanChild.setMaterialRmb(requisitioningOrderDetail.getMaterialRmb()); purchasePlanChild.setMaterialRmbSum(requisitioningOrderDetail.getMaterialRmb());
// noRmbSum = noRmbSum.add(requisitioningOrderDetail.getMaterialNoRmb()); // noRmbSum = noRmbSum.add(requisitioningOrderDetail.getMaterialNoRmb());
rmbSum = rmbSum.add(requisitioningOrderDetail.getMaterialRmbSum()); rmbSum = rmbSum.add(requisitioningOrderDetail.getMaterialRmbSum());
materialSum += requisitioningOrderDetail.getMaterialNum(); materialSum += requisitioningOrderDetail.getMaterialNum();
planChildMapper.insertPurchasePlanChild(purchasePlanChild); planChildMapper.insertPurchasePlanChild(purchasePlanChild);
purchasePlanChildList.add(purchasePlanChild); purchasePlanChildList.add(purchasePlanChild);
} }
purchasePlan.setMaterialSum(materialSum); purchasePlan.setMaterialSum(Math.toIntExact(materialSum));
purchasePlan.setCreateBy(requisitioningOrder.getCreateBy()); purchasePlan.setCreateBy(requisitioningOrder.getCreateBy());
purchasePlan.setApplyUser(requisitioningOrder.getApplyUser()); purchasePlan.setApplyUser(requisitioningOrder.getApplyUser());

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

@ -1,218 +1,147 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.purchase.mapper.PurchasePlanChildMapper"> <mapper namespace="com.ruoyi.purchase.mapper.PurchasePlanChildMapper">
<resultMap type="PurchasePlanChild" id="PurchasePlanChildResult">
<result property="purchasePlanChildId" column="purchase_plan_child_id" /> <resultMap type="PurchasePlanChild" id="PurchasePlanChildResult">
<result property="purchasePlanCode" column="purchase_plan_code" /> <result property="purchasePlanChildId" column="purchase_plan_child_id" />
<result property="materialId" column="material_id" /> <result property="purchasePlanCode" column="purchase_plan_code" />
<result property="materialCode" column="material_code" /> <result property="purchasePlanStatus" column="purchase_plan_status" />
<result property="materialName" column="material_name" /> <result property="correlationCode" column="correlation_code" />
<result property="materialType" column="material_type" /> <result property="purchasePlanType" column="purchase_plan_type" />
<result property="processMethod" column="process_method" /> <result property="materialNo" column="material_no" />
<result property="unit" column="unit" /> <result property="materialName" column="material_name" />
<result property="brand" column="brand" /> <result property="materialType" column="material_type" />
<result property="photoUrl" column="photoUrl" /> <result property="materialPhotourl" column="material_photoUrl" />
<result property="describe" column="describe" /> <result property="materialBrand" column="material_brand" />
<result property="warehouseDept" column="warehouseDept" /> <result property="materialUnit" column="material_unit" />
<result property="materialNum" column="material_num" /> <result property="materialDescribe" column="material_describe" />
<result property="materialSole" column="material_sole" /> <result property="materialProcessMethod" column="material_process_method" />
<result property="materialRmb" column="material_rmb" /> <result property="materialModel" column="material_model" />
<result property="materialNoRmb" column="material_noRmb" /> <result property="warehouseDept" column="warehouse_dept" />
<result property="supplierCode" column="supplier_code" /> <result property="materialNormbSum" column="material_noRmb_sum" />
<result property="supplierCodes" column="supplier_codes" /> <result property="materialRmbSum" column="material_rmb_sum" />
<result property="planCodes" column="purchase_plan_codes" /> <result property="planPurchaseNum" column="plan_purchase_num" />
<result property="correlationCodes" column="correlation_codes" /> <result property="purchaseNum" column="purchase_num" />
<result property="supplierName" column="supplier_name" /> <result property="actualPurchaseNum" column="actual_purchase_num" />
<result property="createBy" column="create_by" /> <result property="sharedInventoryOccupancyNum" column="shared_inventory_occupancy_num" />
<result property="createTime" column="create_time" /> <result property="cancelNum" column="cancel_num" />
<result property="updateBy" column="update_by" /> <result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" /> <result property="createTime" column="create_time" />
<result property="remark" column="remark" /> <result property="updateBy" column="update_by" />
<result property="useStatus" column="use_status" /> <result property="updateTime" column="update_time" />
<result property="auditStatus" column="audit_status" /> <result property="remark" column="remark" />
<result property="delFlag" column="del_flag" /> <result property="delFlag" column="del_flag" />
</resultMap> </resultMap>
<sql id="selectPurchasePlanChildVo"> <sql id="selectPurchasePlanChildVo">
select purchase_plan_child_id, purchase_plan_code, material_id, select purchase_plan_child_id, 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, create_by, create_time, update_by, update_time, remark, del_flag from purchase_plan_child
material_code, material_name, material_type, process_method, brand,unit,
photoUrl, `describe`, warehouseDept,material_num, material_sole, material_rmb,supplier_code,supplier_name,
material_noRmb, create_by, create_time, update_by, update_time, remark,
use_status, audit_status, del_flag from purchase_plan_child
</sql> </sql>
<select id="selectPurchasePlanChildList" parameterType="PurchasePlanChild" resultMap="PurchasePlanChildResult"> <select id="selectPurchasePlanChildList" parameterType="PurchasePlanChild" resultMap="PurchasePlanChildResult">
<include refid="selectPurchasePlanChildVo"/> <include refid="selectPurchasePlanChildVo"/>
<where> <where>
<if test="purchasePlanChildId != null "> and purchase_plan_child_id = #{purchasePlanChildId}</if> <if test="purchasePlanCode != null">and purchase_plan_code = #{purchasePlanCode}</if>
<if test="purchasePlanCode != null and purchasePlanCode != ''"> and purchase_plan_code = #{purchasePlanCode}</if>
<if test="materialId != null "> and material_id = #{materialId}</if>
<if test="materialCode != null and materialCode != ''"> and material_code = #{materialCode}</if>
<if test="materialName != null and materialName != ''"> and material_name = #{materialName}</if>
<if test="materialType != null and materialType != ''"> and material_type = #{materialType}</if>
<if test="processMethod != null and processMethod != ''"> and process_method = #{processMethod}</if>
<if test="brand != null and brand != ''"> and brand = #{brand}</if>
<if test="warehouseDept != null and warehouseDept != ''">and warehouseDept = #{warehouseDept}</if>
<if test="useStatus != null and useStatus != ''"> and use_status = #{useStatus}</if>
<if test="auditStatus != null and auditStatus != ''"> and audit_status = #{auditStatus}</if>
</where> </where>
order by create_time desc
</select> </select>
<select id="selectPurchasePlanChildById" parameterType="Long" resultMap="PurchasePlanChildResult"> <select id="selectPurchasePlanChildById" parameterType="Long" resultMap="PurchasePlanChildResult">
<include refid="selectPurchasePlanChildVo"/> <include refid="selectPurchasePlanChildVo"/>
where purchase_plan_child_id = #{purchasePlanChildId} where purchase_plan_child_id = #{purchasePlanChildId}
</select> </select>
<select id="selectPurchasePlanChildListByPlanCodes" resultMap="PurchasePlanChildResult">
<include refid="selectPurchasePlanChildVo"/>
where purchase_plan_code in
<foreach item="purchasePlanCode" collection="array" open="(" separator="," close=")">
#{purchasePlanCode}
</foreach>
</select>
<select id="selectPurchasePlanChildByCodeAndNo" parameterType="PurchasePlanChild" resultMap="PurchasePlanChildResult">
<include refid="selectPurchasePlanChildVo"/>
where purchase_plan_code = #{purchasePlanCode}
and material_code = #{materialCode}
</select>
<insert id="insertPurchasePlanChild" parameterType="PurchasePlanChild" useGeneratedKeys="true" keyProperty="purchasePlanChildId"> <insert id="insertPurchasePlanChild" parameterType="PurchasePlanChild" useGeneratedKeys="true" keyProperty="purchasePlanChildId">
insert into purchase_plan_child insert into purchase_plan_child
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="purchasePlanCode != null">purchase_plan_code,</if> <if test="purchasePlanCode != null">purchase_plan_code,</if>
<if test="materialId != null">material_id,</if> <if test="purchasePlanStatus != null">purchase_plan_status,</if>
<if test="materialCode != null">material_code,</if> <if test="correlationCode != null">correlation_code,</if>
<if test="purchasePlanType != null">purchase_plan_type,</if>
<if test="materialNo != null">material_no,</if>
<if test="materialName != null">material_name,</if> <if test="materialName != null">material_name,</if>
<if test="materialType != null">material_type,</if> <if test="materialType != null">material_type,</if>
<if test="processMethod != null">process_method,</if> <if test="materialPhotourl != null">material_photoUrl,</if>
<if test="brand != null">brand,</if> <if test="materialBrand != null">material_brand,</if>
<if test="photoUrl != null">photoUrl,</if> <if test="materialUnit != null">material_unit,</if>
<if test="describe != null">`describe`,</if> <if test="materialDescribe != null">material_describe,</if>
<if test="unit != null">unit,</if> <if test="materialProcessMethod != null">material_process_method,</if>
<if test="warehouseDept != null">warehouseDept,</if> <if test="materialModel != null">material_model,</if>
<if test="materialNum != null">material_num,</if> <if test="warehouseDept != null">warehouse_dept,</if>
<if test="materialSole != null">material_sole,</if> <if test="materialNormbSum != null">material_noRmb_sum,</if>
<if test="materialRmb != null">material_rmb,</if> <if test="materialRmbSum != null">material_rmb_sum,</if>
<if test="materialNoRmb != null">material_noRmb,</if> <if test="planPurchaseNum != null">plan_purchase_num,</if>
<if test="purchaseNum != null">purchase_num,</if>
<if test="actualPurchaseNum != null">actual_purchase_num,</if>
<if test="sharedInventoryOccupancyNum != null">shared_inventory_occupancy_num,</if>
<if test="cancelNum != null">cancel_num,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
<if test="useStatus != null">use_status,</if>
<if test="auditStatus != null">audit_status,</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=",">
<if test="purchasePlanCode != null">#{purchasePlanCode},</if> <if test="purchasePlanCode != null">#{purchasePlanCode},</if>
<if test="materialId != null">#{materialId},</if> <if test="purchasePlanStatus != null">#{purchasePlanStatus},</if>
<if test="materialCode != null">#{materialCode},</if> <if test="correlationCode != null">#{correlationCode},</if>
<if test="purchasePlanType != null">#{purchasePlanType},</if>
<if test="materialNo != null">#{materialNo},</if>
<if test="materialName != null">#{materialName},</if> <if test="materialName != null">#{materialName},</if>
<if test="materialType != null">#{materialType},</if> <if test="materialType != null">#{materialType},</if>
<if test="processMethod != null">#{processMethod},</if> <if test="materialPhotourl != null">#{materialPhotourl},</if>
<if test="brand != null">#{brand},</if> <if test="materialBrand != null">#{materialBrand},</if>
<if test="photoUrl != null">#{photoUrl},</if> <if test="materialUnit != null">#{materialUnit},</if>
<if test="describe != null">#{describe},</if> <if test="materialDescribe != null">#{materialDescribe},</if>
<if test="unit != null">#{unit},</if> <if test="materialProcessMethod != null">#{materialProcessMethod},</if>
<if test="materialModel != null">#{materialModel},</if>
<if test="warehouseDept != null">#{warehouseDept},</if> <if test="warehouseDept != null">#{warehouseDept},</if>
<if test="materialNum != null">#{materialNum},</if> <if test="materialNormbSum != null">#{materialNormbSum},</if>
<if test="materialSole != null">#{materialSole},</if> <if test="materialRmbSum != null">#{materialRmbSum},</if>
<if test="materialRmb != null">#{materialRmb},</if> <if test="planPurchaseNum != null">#{planPurchaseNum},</if>
<if test="materialNoRmb != null">#{materialNoRmb},</if> <if test="purchaseNum != null">#{purchaseNum},</if>
<if test="actualPurchaseNum != null">#{actualPurchaseNum},</if>
<if test="sharedInventoryOccupancyNum != null">#{sharedInventoryOccupancyNum},</if>
<if test="cancelNum != null">#{cancelNum},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if> <if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
<if test="useStatus != null">#{useStatus},</if>
<if test="auditStatus != null">#{auditStatus},</if>
<if test="delFlag != null">#{delFlag},</if> <if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
<insert id="batchInsertPurchasePlanChild" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="purchasePlanChildId">
insert into purchase_plan_child
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="item.purchasePlanCode != null">purchase_plan_code,</if>
<if test="item.materialCode != null">material_code,</if>
<if test="item.materialName != null">material_name,</if>
<if test="item.materialType != null">material_type,</if>
<if test="item.processMethod != null">process_method,</if>
<if test="item.brand != null">brand,</if>
<if test="item.describe != null">`describe`,</if>
<if test="item.unit != null">unit,</if>
<if test="item.warehouseDept != null">warehouse_dept,</if>
<if test="item.materialNum != null">material_num,</if>
<if test="item.createBy != null">create_by,</if>
<if test="item.createTime != null">create_time,</if>
<if test="item.updateBy != null">update_by,</if>
<if test="item.updateTime != null">update_time,</if>
<if test="item.remark != null">remark,</if>
<if test="item.useStatus != null">use_status,</if>
<if test="item.auditStatus != null">audit_status,</if>
<if test="item.delFlag != null">del_flag,</if>
</trim> </trim>
<foreach collection="list" item="item" index="index" separator=",">
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="item.purchasePlanCode != null">#{item.purchasePlanCode},</if>
<if test="item.materialCode != null">#{item.materialCode},</if>
<if test="item.materialName != null">#{item.materialName},</if>
<if test="item.materialType != null">#{item.materialType},</if>
<if test="item.processMethod != null">#{item.processMethod},</if>
<if test="item.brand != null">#{item.brand},</if>
<if test="item.describe != null">#{item.describe},</if>
<if test="item.unit != null">#{item.unit},</if>
<if test="item.warehouseDept != null">#{item.warehouseDept},</if>
<if test="item.materialNum != null">#{item.materialNum},</if>
<if test="item.createBy != null">#{item.createBy},</if>
<if test="item.createTime != null">#{item.createTime},</if>
<if test="item.updateBy != null">#{item.updateBy},</if>
<if test="item.updateTime != null">#{item.updateTime},</if>
<if test="item.remark != null">#{item.remark},</if>
<if test="item.useStatus != null">#{item.useStatus},</if>
<if test="item.auditStatus != null">#{item.auditStatus},</if>
<if test="item.delFlag != null">#{item.delFlag}</if>
</trim>
</foreach>
</insert> </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=",">
<if test="purchasePlanCode != null">purchase_plan_code = #{purchasePlanCode},</if> <if test="purchasePlanCode != null">purchase_plan_code = #{purchasePlanCode},</if>
<if test="materialId != null">material_id = #{materialId},</if> <if test="purchasePlanStatus != null">purchase_plan_status = #{purchasePlanStatus},</if>
<if test="materialCode != null">material_code = #{materialCode},</if> <if test="correlationCode != null">correlation_code = #{correlationCode},</if>
<if test="purchasePlanType != null">purchase_plan_type = #{purchasePlanType},</if>
<if test="materialNo != null">material_no = #{materialNo},</if>
<if test="materialName != null">material_name = #{materialName},</if> <if test="materialName != null">material_name = #{materialName},</if>
<if test="materialType != null">material_type = #{materialType},</if> <if test="materialType != null">material_type = #{materialType},</if>
<if test="processMethod != null">process_method = #{processMethod},</if> <if test="materialPhotourl != null">material_photoUrl = #{materialPhotourl},</if>
<if test="brand != null">brand = #{brand},</if> <if test="materialBrand != null">material_brand = #{materialBrand},</if>
<if test="photoUrl != null">photoUrl = #{photoUrl},</if> <if test="materialUnit != null">material_unit = #{materialUnit},</if>
<if test="describe != null">`describe` = #{describe},</if> <if test="materialDescribe != null">material_describe = #{materialDescribe},</if>
<if test="unit != null">unit = #{unit},</if> <if test="materialProcessMethod != null">material_process_method = #{materialProcessMethod},</if>
<if test="warehouseDept != null">warehouseDept = #{warehouseDept},</if> <if test="materialModel != null">material_model = #{materialModel},</if>
<if test="materialNum != null">material_num = #{materialNum},</if> <if test="warehouseDept != null">warehouse_dept = #{warehouseDept},</if>
<if test="materialSole != null">material_sole = #{materialSole},</if> <if test="materialNormbSum != null">material_noRmb_sum = #{materialNormbSum},</if>
<if test="materialRmb != null">material_rmb = #{materialRmb},</if> <if test="materialRmbSum != null">material_rmb_sum = #{materialRmbSum},</if>
<if test="materialNoRmb != null">material_noRmb = #{materialNoRmb},</if> <if test="planPurchaseNum != null">plan_purchase_num = #{planPurchaseNum},</if>
<if test="purchaseNum != null">purchase_num = #{purchaseNum},</if>
<if test="actualPurchaseNum != null">actual_purchase_num = #{actualPurchaseNum},</if>
<if test="sharedInventoryOccupancyNum != null">shared_inventory_occupancy_num = #{sharedInventoryOccupancyNum},</if>
<if test="cancelNum != null">cancel_num = #{cancelNum},</if>
<if test="createBy != null">create_by = #{createBy},</if> <if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if> <if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="useStatus != null">use_status = #{useStatus},</if>
<if test="auditStatus != null">audit_status = #{auditStatus},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if> <if test="delFlag != null">del_flag = #{delFlag},</if>
</trim> </trim>
where purchase_plan_child_id = #{purchasePlanChildId} where purchase_plan_child_id = #{purchasePlanChildId}
@ -223,7 +152,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<delete id="deletePurchasePlanChildByIds" parameterType="String"> <delete id="deletePurchasePlanChildByIds" parameterType="String">
delete from purchase_plan_child where purchase_plan_child_id in delete from purchase_plan_child where purchase_plan_child_id in
<foreach item="purchasePlanChildId" collection="array" open="(" separator="," close=")"> <foreach item="purchasePlanChildId" collection="array" open="(" separator="," close=")">
#{purchasePlanChildId} #{purchasePlanChildId}
</foreach> </foreach>
@ -236,63 +165,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="restorePurchasePlanChildById" parameterType="Long"> <update id="restorePurchasePlanChildById" parameterType="Long">
update purchase_plan_child set del_flag = '0' where purchase_plan_child_id = #{purchasePlanChildId} update purchase_plan_child set del_flag = '0' where purchase_plan_child_id = #{purchasePlanChildId}
</update> </update>
<select id="getPurchasePlanChildByPlanCodes" parameterType="String" resultMap="PurchasePlanChildResult">
<!-- SELECT-->
<!-- GROUP_CONCAT(DISTINCT plan.purchase_plan_code ORDER BY plan.purchase_plan_code) AS purchase_plan_codes,-->
<!-- GROUP_CONCAT(DISTINCT planOrder.correlation_code ORDER BY planOrder.correlation_code) AS correlation_codes,-->
<!-- GROUP_CONCAT(DISTINCT CONCAT(quote.material_code,'|',quote.purchase_quote_code , '|' ,quote.supplier_code,'|',-->
<!-- quote.supplier_name,'|',quote.material_name,'|',quote.material_noRmb,'|',quote.material_rmb, '|',-->
<!-- plan.purchase_plan_code,'|',planOrder.correlation_code)-->
<!-- ORDER BY quote.supplier_code) AS supplier_codes,-->
<!-- plan.material_code,-->
<!-- plan.material_name,-->
<!-- plan.material_type,-->
<!-- plan.process_method,-->
<!-- plan.brand,-->
<!-- plan.photoUrl,-->
<!-- plan.material_num-->
<!-- FROM-->
<!-- purchase_plan_child AS plan-->
<!-- LEFT JOIN purchase_plan AS planOrder-->
<!-- ON plan.purchase_plan_code = planOrder.purchase_plan_code-->
<!-- AND planOrder.del_flag = '0' and planOrder.use_status = '1' and planOrder.audit_status = '1'-->
<!-- LEFT JOIN (-->
<!-- SELECT material_code, MAX(create_time) AS max_create_time-->
<!-- FROM purchase_quote_child-->
<!-- WHERE del_flag = '0'-->
<!-- GROUP BY material_code-->
<!-- ) AS quoteLatestTime-->
<!-- ON quoteLatestTime.material_code = plan.material_code-->
<!-- LEFT JOIN purchase_quote_child AS quote-->
<!-- ON quoteLatestTime.material_code = quote.material_code-->
<!-- AND quote.create_time = quoteLatestTime.max_create_time-->
<!-- AND quote.del_flag = '0'-->
<!-- WHERE-->
<!-- plan.purchase_plan_code IN-->
<!-- <foreach item="purchasePlanCode" collection="array" open="(" separator="," close=")">-->
<!-- #{purchasePlanCode}-->
<!-- </foreach>-->
<!-- AND plan.del_flag = '0'-->
<!-- GROUP BY-->
<!-- plan.material_code;-->
select
planChild.material_code,
planChild.material_name,
planChild.material_type,
planChild.process_method,
planChild.brand,
planChild.photoUrl,
planChild.unit,
planChild.warehouseDept,
sum(planChild.material_num) as material_num,
GROUP_CONCAT(DISTINCT plan.correlation_code ORDER BY plan.correlation_code) AS correlation_codes,
GROUP_CONCAT(DISTINCT plan.purchase_plan_code ORDER BY plan.purchase_plan_code) AS purchase_plan_codes
from purchase_plan_child as planChild
left join purchase_plan as plan on plan.purchase_plan_code = planChild.purchase_plan_code
where plan.purchase_plan_code IN
<foreach item="purchasePlanCode" collection="array" open="(" separator="," close=")">
#{purchasePlanCode}
</foreach>
group by material_code
</select>
</mapper> </mapper>

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

@ -1,63 +1,53 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.purchase.mapper.PurchasePlanMapper"> <mapper namespace="com.ruoyi.purchase.mapper.PurchasePlanMapper">
<resultMap type="PurchasePlan" id="PurchasePlanResult"> <resultMap type="PurchasePlan" id="PurchasePlanResult">
<result property="purchasePlanId" column="purchase_plan_id" /> <result property="purchasePlanId" column="purchase_plan_id" />
<result property="purchasePlanCode" column="purchase_plan_code" /> <result property="purchasePlanCode" column="purchase_plan_code" />
<result property="purchasePlanStatus" column="purchase_plan_status" /> <result property="purchasePlanStatus" column="purchase_plan_status" />
<result property="correlationCode" column="correlation_code" /> <result property="correlationCode" column="correlation_code" />
<result property="purchasePlanType" column="purchase_plan_type" /> <result property="purchasePlanType" column="purchase_plan_type" />
<result property="materialAmount" column="material_amount" /> <result property="materialSum" column="material_sum" />
<result property="materialSum" column="materialSum" /> <result property="enterpriseSum" column="enterprise_sum" />
<result property="noRmbSum" column="noRmbSum" /> <result property="normbSum" column="noRmb_sum" />
<result property="rmbSum" column="rmbSum" /> <result property="rmbSum" column="rmb_sum" />
<result property="planPurchaseSum" column="plan_purchase_sum" />
<result property="purchaseSum" column="purchase_sum" />
<result property="actualPurchaseSum" column="actual_purchase_sum" />
<result property="sharedInventoryOccupancySum" column="shared_inventory_occupancy_sum" />
<result property="cancelSum" column="cancel_sum" />
<result property="applyUser" column="apply_user" /> <result property="applyUser" column="apply_user" />
<result property="firstAddTime" column="first_add_time" />
<result property="updateInfoTime" column="update_info_time" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="auditStatus" column="audit_status" />
<result property="useStatus" column="use_status" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
<result property="delFlag" column="del_flag" />
</resultMap> </resultMap>
<sql id="selectPurchasePlanVo"> <sql id="selectPurchasePlanVo">
select purchase_plan_id, purchase_plan_code, purchase_plan_status, correlation_code, purchase_plan_type, material_amount, materialSum, noRmbSum, rmbSum, apply_user, first_add_time, update_info_time, create_by, create_time, update_by, update_time, audit_status, use_status, remark from purchase_plan select purchase_plan_id, purchase_plan_code, purchase_plan_status, correlation_code, purchase_plan_type, material_sum, enterprise_sum, noRmb_sum, rmb_sum, plan_purchase_sum, purchase_sum, actual_purchase_sum, shared_inventory_occupancy_sum, cancel_sum, apply_user, create_by, create_time, update_by, update_time, remark, del_flag from purchase_plan
</sql> </sql>
<select id="selectPurchasePlanList" parameterType="PurchasePlan" resultMap="PurchasePlanResult"> <select id="selectPurchasePlanList" parameterType="PurchasePlan" resultMap="PurchasePlanResult">
<include refid="selectPurchasePlanVo"/> <include refid="selectPurchasePlanVo"/>
<where> <where>
<if test="purchasePlanCode != null and purchasePlanCode != ''"> and purchase_plan_code = #{purchasePlanCode}</if> <if test="purchasePlanCode != null and purchasePlanCode != ''"> and purchase_plan_code like concat('%', #{purchasePlanCode}, '%')</if>
<if test="purchasePlanStatus != null and purchasePlanStatus != ''"> and purchase_plan_status = #{purchasePlanStatus}</if> <if test="purchasePlanStatus != null and purchasePlanStatus != ''"> and purchase_plan_status = #{purchasePlanStatus}</if>
<if test="correlationCode != null and correlationCode != ''"> and correlation_code = #{correlationCode}</if> <if test="correlationCode != null and correlationCode != ''"> and correlation_code like concat('%', #{correlationCode}, '%')</if>
<if test="applyUser != null and applyUser != ''"> and apply_user like concat('%', #{applyUser}, '%')</if> <if test="purchasePlanType != null and purchasePlanType != ''"> and purchase_plan_type = #{purchasePlanType}</if>
<if test="firstAddTime != null and firstAddTime != ''"> and first_add_time = #{firstAddTime}</if>
<if test="updateInfoTime != null and updateInfoTime != ''"> and update_info_time = #{updateInfoTime}</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>
</select> </select>
<select id="selectPurchasePlanById" parameterType="Long" resultMap="PurchasePlanResult"> <select id="selectPurchasePlanById" parameterType="Long" resultMap="PurchasePlanResult">
<include refid="selectPurchasePlanVo"/> <include refid="selectPurchasePlanVo"/>
where purchase_plan_id = #{purchasePlanId} where purchase_plan_id = #{purchasePlanId}
</select> </select>
<select id="selectPurchasePlanByPlanCodes" parameterType="String" resultMap="PurchasePlanResult">
<include refid="selectPurchasePlanVo"/>
where purchase_plan_code in
<foreach item="purchasePlanCode" collection="array" open="(" separator="," close=")">
#{purchasePlanCode}
</foreach>
</select>
<select id="selectPurchasePlanByPlanCode" parameterType="String" resultMap="PurchasePlanResult">
<include refid="selectPurchasePlanVo"/>
where purchase_plan_code = #{purchasePlanCode}
</select>
<insert id="insertPurchasePlan" parameterType="PurchasePlan" useGeneratedKeys="true" keyProperty="purchasePlanId"> <insert id="insertPurchasePlan" parameterType="PurchasePlan" useGeneratedKeys="true" keyProperty="purchasePlanId">
insert into purchase_plan insert into purchase_plan
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
@ -65,41 +55,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="purchasePlanStatus != null">purchase_plan_status,</if> <if test="purchasePlanStatus != null">purchase_plan_status,</if>
<if test="correlationCode != null">correlation_code,</if> <if test="correlationCode != null">correlation_code,</if>
<if test="purchasePlanType != null">purchase_plan_type,</if> <if test="purchasePlanType != null">purchase_plan_type,</if>
<if test="materialAmount != null">material_amount,</if> <if test="materialSum != null">material_sum,</if>
<if test="materialSum != null">materialSum,</if> <if test="enterpriseSum != null">enterprise_sum,</if>
<if test="noRmbSum != null">noRmbSum,</if> <if test="normbSum != null">noRmb_sum,</if>
<if test="rmbSum != null">rmbSum,</if> <if test="rmbSum != null">rmb_sum,</if>
<if test="planPurchaseSum != null">plan_purchase_sum,</if>
<if test="purchaseSum != null">purchase_sum,</if>
<if test="actualPurchaseSum != null">actual_purchase_sum,</if>
<if test="sharedInventoryOccupancySum != null">shared_inventory_occupancy_sum,</if>
<if test="cancelSum != null">cancel_sum,</if>
<if test="applyUser != null">apply_user,</if> <if test="applyUser != null">apply_user,</if>
<if test="firstAddTime != null">first_add_time,</if>
<if test="updateInfoTime != null">update_info_time,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
<if test="auditStatus != null">audit_status,</if>
<if test="useStatus != null">use_status,</if>
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
</trim> <if test="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="purchasePlanCode != null">#{purchasePlanCode},</if> <if test="purchasePlanCode != null">#{purchasePlanCode},</if>
<if test="purchasePlanStatus != null">#{purchasePlanStatus},</if> <if test="purchasePlanStatus != null">#{purchasePlanStatus},</if>
<if test="correlationCode != null">#{correlationCode},</if> <if test="correlationCode != null">#{correlationCode},</if>
<if test="purchasePlanType != null">#{purchasePlanType},</if> <if test="purchasePlanType != null">#{purchasePlanType},</if>
<if test="materialAmount != null">#{materialAmount},</if>
<if test="materialSum != null">#{materialSum},</if> <if test="materialSum != null">#{materialSum},</if>
<if test="noRmbSum != null">#{noRmbSum},</if> <if test="enterpriseSum != null">#{enterpriseSum},</if>
<if test="normbSum != null">#{normbSum},</if>
<if test="rmbSum != null">#{rmbSum},</if> <if test="rmbSum != null">#{rmbSum},</if>
<if test="planPurchaseSum != null">#{planPurchaseSum},</if>
<if test="purchaseSum != null">#{purchaseSum},</if>
<if test="actualPurchaseSum != null">#{actualPurchaseSum},</if>
<if test="sharedInventoryOccupancySum != null">#{sharedInventoryOccupancySum},</if>
<if test="cancelSum != null">#{cancelSum},</if>
<if test="applyUser != null">#{applyUser},</if> <if test="applyUser != null">#{applyUser},</if>
<if test="firstAddTime != null">#{firstAddTime},</if>
<if test="updateInfoTime != null">#{updateInfoTime},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if> <if test="updateTime != null">#{updateTime},</if>
<if test="auditStatus != null">#{auditStatus},</if>
<if test="useStatus != null">#{useStatus},</if>
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
</trim> <if test="delFlag != null">#{delFlag},</if>
</trim>
</insert> </insert>
<update id="updatePurchasePlan" parameterType="PurchasePlan"> <update id="updatePurchasePlan" parameterType="PurchasePlan">
@ -109,20 +103,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="purchasePlanStatus != null">purchase_plan_status = #{purchasePlanStatus},</if> <if test="purchasePlanStatus != null">purchase_plan_status = #{purchasePlanStatus},</if>
<if test="correlationCode != null">correlation_code = #{correlationCode},</if> <if test="correlationCode != null">correlation_code = #{correlationCode},</if>
<if test="purchasePlanType != null">purchase_plan_type = #{purchasePlanType},</if> <if test="purchasePlanType != null">purchase_plan_type = #{purchasePlanType},</if>
<if test="materialAmount != null">material_amount = #{materialAmount},</if> <if test="materialSum != null">material_sum = #{materialSum},</if>
<if test="materialSum != null">materialSum = #{materialSum},</if> <if test="enterpriseSum != null">enterprise_sum = #{enterpriseSum},</if>
<if test="noRmbSum != null">noRmbSum = #{noRmbSum},</if> <if test="normbSum != null">noRmb_sum = #{normbSum},</if>
<if test="rmbSum != null">rmbSum = #{rmbSum},</if> <if test="rmbSum != null">rmb_sum = #{rmbSum},</if>
<if test="planPurchaseSum != null">plan_purchase_sum = #{planPurchaseSum},</if>
<if test="purchaseSum != null">purchase_sum = #{purchaseSum},</if>
<if test="actualPurchaseSum != null">actual_purchase_sum = #{actualPurchaseSum},</if>
<if test="sharedInventoryOccupancySum != null">shared_inventory_occupancy_sum = #{sharedInventoryOccupancySum},</if>
<if test="cancelSum != null">cancel_sum = #{cancelSum},</if>
<if test="applyUser != null">apply_user = #{applyUser},</if> <if test="applyUser != null">apply_user = #{applyUser},</if>
<if test="firstAddTime != null">first_add_time = #{firstAddTime},</if>
<if test="updateInfoTime != null">update_info_time = #{updateInfoTime},</if>
<if test="createBy != null">create_by = #{createBy},</if> <if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if> <if test="updateTime != null">update_time = #{updateTime},</if>
<if test="auditStatus != null">audit_status = #{auditStatus},</if>
<if test="useStatus != null">use_status = #{useStatus},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim> </trim>
where purchase_plan_id = #{purchasePlanId} where purchase_plan_id = #{purchasePlanId}
</update> </update>
@ -145,8 +141,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="restorePurchasePlanById" parameterType="Long"> <update id="restorePurchasePlanById" parameterType="Long">
update purchase_plan set del_flag = '0' where purchase_plan_id = #{purchasePlanId} update purchase_plan set del_flag = '0' where purchase_plan_id = #{purchasePlanId}
</update> </update>
<update id="restorePurchasePlanStatusByCode" parameterType="Long">
update purchase_plan set purchase_plan_status = #{purchasePlanStatus}
where purchase_plan_code = #{purchasePlanCode}
</update>
</mapper> </mapper>

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

@ -104,9 +104,13 @@
{title: '采购计划单号',field: 'purchasePlanCode'}, {title: '采购计划单号',field: 'purchasePlanCode'},
{title: '关联单号', field: 'correlationCode',}, {title: '关联单号', field: 'correlationCode',},
{title: '采购来源',field: 'purchasePlanType',formatter: function(value, row, index) {return $.table.selectDictLabel(purchasePlanTypeDatas, value);}}, {title: '采购来源',field: 'purchasePlanType',formatter: function(value, row, index) {return $.table.selectDictLabel(purchasePlanTypeDatas, value);}},
{title: '物料合计',field: 'materialAmount',}, {title: '物料合计',field: 'materialSum',},
{title: '数量总计', field: 'materialSum',}, {title: '计划采购总数',field: 'planPurchaseSum',},
{title: '不含税总价(RMB)',field: 'noRmbSum',}, {title: '待采购总数',field: 'purchaseSum',},
{title: '实际采购总数',field: 'actualPurchaseSum',},
{title: '共享库存占用总数',field: 'sharedInventoryOccupancySum',},
{title: '作废总数',field: 'cancelSum',},
{title: '不含税总价(RMB)',field: 'normbSum',},
{title: '含税总价(RMB)',field: 'rmbSum',}, {title: '含税总价(RMB)',field: 'rmbSum',},
{title: '申请人',field: 'applyUser',}, {title: '申请人',field: 'applyUser',},
{title: '录入时间',field: 'createTime',}, {title: '录入时间',field: 'createTime',},
@ -133,23 +137,33 @@
contentType: "application/x-www-form-urlencoded", contentType: "application/x-www-form-urlencoded",
queryParams : {purchasePlanCode: row.purchasePlanCode}, queryParams : {purchasePlanCode: row.purchasePlanCode},
columns: [ columns: [
{field: 'purchasePlanId',title: '主键id',visible: false}, {field: 'purchasePlanChildId',title: '主键id',visible: false},
{field: 'materialCode',title: '料号',}, {title: '采购计划状态',field: 'purchasePlanStatus',
{field: 'photoUrl',title: '图片', formatter: function(value, row, index) {return $.table.selectDictLabel(purchasePlanStatusDatas, value);}
},
{field: 'materialNo',title: '料号',},
{field: 'materialPhotourl',title: '图片',
formatter: function(value, row, index) {return $.table.imageView(value);} formatter: function(value, row, index) {return $.table.imageView(value);}
}, },
{field: 'materialName',title: '物料名称',}, {field: 'materialName',title: '物料名称',},
{field: 'materialType',title: '物料类型', {field: 'materialType',title: '物料类型',
formatter: function(value, row, index) {return $.table.selectCategoryLabel(materialTypeDatas, value);} formatter: function(value, row, index) {return $.table.selectCategoryLabel(materialTypeDatas, value);}
}, },
{field: 'describe',title: '描述',}, {field: 'materialDescribe',title: '描述',},
{field: 'brand',title: '品牌',}, {field: 'materialModel',title: '型号',},
{field: 'processMethod',title: '加工方式', {field: 'materialBrand',title: '品牌',},
{field: 'materialProcessMethod',title: '加工方式',
formatter: function(value, row, index) {return $.table.selectDictLabel(processMethodDatas, value);} formatter: function(value, row, index) {return $.table.selectDictLabel(processMethodDatas, value);}
}, },
{field: 'unit',title: '单位', }, {field: 'materialUnit',title: '单位', },
{title: '计划采购数',field: 'planPurchaseNum',},
{title: '待采购数',field: 'purchaseNum',},
{title: '实际采购数',field: 'actualPurchaseNum',},
{title: '共享库存占用数',field: 'sharedInventoryOccupancyNum',},
{title: '作废数',field: 'cancelNum',},
{title: '不含税总价(RMB)',field: 'materialNormbSum',},
{title: '含税总价(RMB)',field: 'materialRmbSum',},
{field: 'warehouseDept',title: '入库部门',visible: false}, {field: 'warehouseDept',title: '入库部门',visible: false},
{field: 'materialNum',title: '计划采购数',},
] ]
}); });
}; };

Loading…
Cancel
Save