Browse Source

[feat] 采购管理:采购计划新增采购单,根据采购单号,报价物料分组查询,新增字段供应商,供应商报价,新增采购单分组依据组合关联单号,查询供应商的报价。

dev
zhangsiqi 5 months ago
parent
commit
f3b3801cd7
  1. 17
      ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchasePlanController.java
  2. 47
      ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchasePlanChild.java
  3. 43
      ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseQuoteChild.java
  4. 5
      ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchasePlanChildMapper.java
  5. 2
      ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseQuoteChildMapper.java
  6. 2
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchasePlanChildService.java
  7. 7
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanChildServiceImpl.java
  8. 9
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java
  9. 4
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseQuoteServiceImpl.java
  10. 100
      ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml
  11. 22
      ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteChildMapper.xml
  12. 4
      ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/add.html
  13. 174
      ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html
  14. 6
      ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/add.html

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

@ -1,7 +1,9 @@
package com.ruoyi.purchase.controller; package com.ruoyi.purchase.controller;
import java.util.Arrays;
import java.util.List; import java.util.List;
import com.ruoyi.common.core.text.Convert;
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.PurchaseQuoteChild; import com.ruoyi.purchase.domain.PurchaseQuoteChild;
@ -111,13 +113,20 @@ public class PurchasePlanController extends BaseController
} }
@GetMapping("/addPurchaseOrder/{purchasePlanCodes}") @GetMapping("/addPurchaseOrder/{purchasePlanCodes}")
public String purChaseOrder(@PathVariable("purchasePlanCodes") String purchasePlanCodes,ModelMap mmap){ public String purChaseOrder(@PathVariable("purchasePlanCodes") String purchasePlanCodes,ModelMap mmap){
//purchasePlanCodes去除重复数据,purchasePlanCodeArray作为数组类型去除
String purchasePlanCode = purchasePlanCodes;
String[] purchasePlanCodeArray = purchasePlanCodes.split(",");
purchasePlanCodes = Arrays.toString(Arrays.stream(purchasePlanCodeArray).distinct().toArray());
//查询相关采购计划数据 //查询相关采购计划数据
List<PurchasePlan> purchasePlanList = purchasePlanService.selectPurchasePlanByPlanCode(purchasePlanCodes); List<PurchasePlan> purchasePlanList = purchasePlanService.selectPurchasePlanByPlanCode(purchasePlanCode);
//根据采购计划编号查询对应的采购报价数据 //根据采购计划编号查询对应的采购报价数据
List<PurchasePlanChild> purchasePlanChildList = purchasePlanChildService.selectPurchasePlanChildListByPlanCodes(purchasePlanCodes); List<PurchasePlanChild> purchasePlanChildList = purchasePlanChildService.getPurchasePlanChildByPlanCodes(purchasePlanCode);
//把物料根据供应商分组,然后根据供应商分组查询对应的供应商报价数据 //再根据采购计划编号分组查询对应的采购报价数据分组
//再根据采购计划编号分组查询对应的采购报价数据
purchasePlanCodes = purchasePlanCodes.replace("[","").replace("]","");
//查询物料报价中供应商
mmap.put("purchasePlanList", purchasePlanList); mmap.put("purchasePlanList", purchasePlanList);
mmap.put("purchasePlanCodes", purchasePlanCodes);
mmap.put("purchasePlanChildList", purchasePlanChildList); mmap.put("purchasePlanChildList", purchasePlanChildList);
return prefix + "/addPurchaseOrder"; return prefix + "/addPurchaseOrder";
} }

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

@ -1,6 +1,8 @@
package com.ruoyi.purchase.domain; package com.ruoyi.purchase.domain;
import java.math.BigDecimal; import java.math.BigDecimal;
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;
@ -66,7 +68,12 @@ public class PurchasePlanChild extends BaseEntity
private BigDecimal materialRmb; private BigDecimal materialRmb;
/** 物料的含税单价(RMB) */ /** 物料的含税单价(RMB) */
private BigDecimal materialNormb; private BigDecimal materialNoRmb;
/*供应商编号*/
private String supplierCode;
/** 物料供应商 */
private String supplierName;
/** 使用状态 */ /** 使用状态 */
private String useStatus; private String useStatus;
@ -77,6 +84,8 @@ public class PurchasePlanChild extends BaseEntity
/** 删除标志 */ /** 删除标志 */
private String delFlag; private String delFlag;
private List<PurchaseQuoteChild> purchaseQuoteChildList;
public void setPurchasePlanChildId(Long purchasePlanChildId) public void setPurchasePlanChildId(Long purchasePlanChildId)
{ {
this.purchasePlanChildId = purchasePlanChildId; this.purchasePlanChildId = purchasePlanChildId;
@ -194,21 +203,45 @@ public class PurchasePlanChild extends BaseEntity
{ {
return materialRmb; return materialRmb;
} }
public void setMaterialNormb(BigDecimal materialNormb) public void setMaterialNoRmb(BigDecimal materialNoRmb)
{ {
this.materialNormb = materialNormb; this.materialNoRmb = materialNoRmb;
} }
public BigDecimal getMaterialNormb() public BigDecimal getMaterialNoRmb()
{ {
return materialNormb; return materialNoRmb;
} }
public void setUseStatus(String useStatus) public void setUseStatus(String useStatus)
{ {
this.useStatus = useStatus; this.useStatus = useStatus;
} }
public String getUseStatus() public String getSupplierCode() {
return supplierCode;
}
public void setSupplierCode(String supplierCode) {
this.supplierCode = supplierCode;
}
public String getSupplierName() {
return supplierName;
}
public void setSupplierName(String supplierName) {
this.supplierName = supplierName;
}
public List<PurchaseQuoteChild> getPurchaseQuoteChildList() {
return purchaseQuoteChildList;
}
public void setPurchaseQuoteChildList(List<PurchaseQuoteChild> purchaseQuoteChildList) {
this.purchaseQuoteChildList = purchaseQuoteChildList;
}
public String getUseStatus()
{ {
return useStatus; return useStatus;
} }
@ -247,7 +280,7 @@ public class PurchasePlanChild extends BaseEntity
.append("materialNum", getMaterialNum()) .append("materialNum", getMaterialNum())
.append("materialSole", getMaterialSole()) .append("materialSole", getMaterialSole())
.append("materialRmb", getMaterialRmb()) .append("materialRmb", getMaterialRmb())
.append("materialNormb", getMaterialNormb()) .append("materialNoRmb", getMaterialNoRmb())
.append("createBy", getCreateBy()) .append("createBy", getCreateBy())
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())

43
ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseQuoteChild.java

@ -75,7 +75,11 @@ public class PurchaseQuoteChild extends BaseEntity
/** 物料的含税单价(RMB) */ /** 物料的含税单价(RMB) */
@Excel(name = "物料的含税单价(RMB)") @Excel(name = "物料的含税单价(RMB)")
private BigDecimal materialNormb; private BigDecimal materialNoRmb;
private String supplierCode;
private String supplierName;
/** 删除状态 */ /** 删除状态 */
@Excel(name = "删除状态") @Excel(name = "删除状态")
@ -223,21 +227,46 @@ public class PurchaseQuoteChild extends BaseEntity
{ {
return materialRmb; return materialRmb;
} }
public void setMaterialNormb(BigDecimal materialNormb) public void setMaterialNormb(BigDecimal materialNoRmb)
{ {
this.materialNormb = materialNormb; this.materialNoRmb = materialNoRmb;
} }
public BigDecimal getMaterialNormb() public BigDecimal getMaterialNormb()
{ {
return materialNormb; return materialNoRmb;
} }
public void setUseStatus(String useStatus) public void setUseStatus(String useStatus)
{ {
this.useStatus = useStatus; this.useStatus = useStatus;
} }
public String getUseStatus()
public BigDecimal getMaterialNoRmb() {
return materialNoRmb;
}
public void setMaterialNoRmb(BigDecimal materialNoRmb) {
this.materialNoRmb = materialNoRmb;
}
public String getSupplierCode() {
return supplierCode;
}
public void setSupplierCode(String supplierCode) {
this.supplierCode = supplierCode;
}
public String getSupplierName() {
return supplierName;
}
public void setSupplierName(String supplierName) {
this.supplierName = supplierName;
}
public String getUseStatus()
{ {
return useStatus; return useStatus;
} }
@ -278,7 +307,9 @@ public class PurchaseQuoteChild extends BaseEntity
.append("materialNum", getMaterialNum()) .append("materialNum", getMaterialNum())
.append("materialSole", getMaterialSole()) .append("materialSole", getMaterialSole())
.append("materialRmb", getMaterialRmb()) .append("materialRmb", getMaterialRmb())
.append("materialNormb", getMaterialNormb()) .append("materialNoRmb", getMaterialNormb())
.append("supplierCode", getSupplierCode())
.append("supplierName", getSupplierName())
.append("createBy", getCreateBy()) .append("createBy", getCreateBy())
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())

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

@ -76,4 +76,9 @@ public interface PurchasePlanChildMapper
public int restorePurchasePlanChildById(Long purchasePlanChildId); public int restorePurchasePlanChildById(Long purchasePlanChildId);
List<PurchasePlanChild> selectPurchasePlanChildListByPlanCodes(String[] purchasePlanCodes); List<PurchasePlanChild> selectPurchasePlanChildListByPlanCodes(String[] purchasePlanCodes);
List<PurchasePlanChild> getPurchasePlanChildByPlanCodes(String[] purchasePlanCodes);
} }

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

@ -22,7 +22,7 @@ public interface PurchaseQuoteChildMapper
/** /**
* 查询采购报价单物料信息列表 * 查询采购报价单物料信息列表
* *
* @param sysPurchaseQuoteChild 采购报价单物料信息 * @param purchaseQuoteChild 采购报价单物料信息
* @return 采购报价单物料信息集合 * @return 采购报价单物料信息集合
*/ */
public List<PurchaseQuoteChild> selectPurchaseQuoteChildList(PurchaseQuoteChild purchaseQuoteChild); public List<PurchaseQuoteChild> selectPurchaseQuoteChildList(PurchaseQuoteChild purchaseQuoteChild);

2
ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchasePlanChildService.java

@ -79,4 +79,6 @@ public interface IPurchasePlanChildService
* @return * @return
*/ */
List<PurchasePlanChild> selectPurchasePlanChildListByPlanCodes(String purchasePlanCodes); List<PurchasePlanChild> selectPurchasePlanChildListByPlanCodes(String purchasePlanCodes);
List<PurchasePlanChild> getPurchasePlanChildByPlanCodes(String purchaseplanCodes);
} }

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

@ -129,4 +129,11 @@ public class PurchasePlanChildServiceImpl implements IPurchasePlanChildService
{ {
return purchasePlanChildMapper.selectPurchasePlanChildListByPlanCodes(Convert.toStrArray(purchasePlanCodes)); return purchasePlanChildMapper.selectPurchasePlanChildListByPlanCodes(Convert.toStrArray(purchasePlanCodes));
} }
@Override
public List<PurchasePlanChild> getPurchasePlanChildByPlanCodes(String purchaseplanCodes)
{
return purchasePlanChildMapper.getPurchasePlanChildByPlanCodes(Convert.toStrArray(purchaseplanCodes));
}
} }

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

@ -4,6 +4,8 @@ import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import com.ruoyi.common.core.redis.RedisCache;
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;
@ -37,6 +39,9 @@ public class PurchasePlanServiceImpl implements IPurchasePlanService
@Autowired @Autowired
private PurchasePlanChildMapper purchasePlanChildMapper; private PurchasePlanChildMapper purchasePlanChildMapper;
@Autowired
private RedisCache redisCache;
/** /**
* 查询采购计划单 * 查询采购计划单
* *
@ -168,7 +173,7 @@ public class PurchasePlanServiceImpl implements IPurchasePlanService
private String generateUniquePurchasePlanCode() { private String generateUniquePurchasePlanCode() {
// 实现生成唯一采购计划单号的逻辑 // 实现生成唯一采购计划单号的逻辑
// 示例代码,实际情况可能依赖于日期、序列号等 // 示例代码,实际情况可能依赖于日期、序列号等
return "PP-" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")); return redisCache.generateBillNo("CGJH");
} }
private PurchasePlan buildPurchasePlan(SysMakeOrder sysMakeOrder, String purchasePlanCode) { private PurchasePlan buildPurchasePlan(SysMakeOrder sysMakeOrder, String purchasePlanCode) {
@ -188,6 +193,8 @@ public class PurchasePlanServiceImpl implements IPurchasePlanService
purchasePlan.setApplyUser(sysMakeOrder.getSalesman()); purchasePlan.setApplyUser(sysMakeOrder.getSalesman());
purchasePlan.setCreateBy(ShiroUtils.getLoginName()); purchasePlan.setCreateBy(ShiroUtils.getLoginName());
purchasePlan.setCreateTime(new Date()); purchasePlan.setCreateTime(new Date());
purchasePlan.setAuditStatus("0");
purchasePlan.setUseStatus("0");
purchasePlan.setPurchasePlanStatus("0"); purchasePlan.setPurchasePlanStatus("0");
return purchasePlan; return purchasePlan;
} }

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

@ -125,6 +125,8 @@ public class PurchaseQuoteServiceImpl implements IPurchaseQuoteService
for(PurchaseQuoteChild child : purchaseQuote.getPurchaseQuoteChildList()){ for(PurchaseQuoteChild child : purchaseQuote.getPurchaseQuoteChildList()){
child.setPurchaseQuoteCode(purchaseQuote.getPurchaseQuoteCode()); child.setPurchaseQuoteCode(purchaseQuote.getPurchaseQuoteCode());
child.setCreateBy(loginName); child.setCreateBy(loginName);
child.setSupplierCode(purchaseQuote.getPurchaseQuoteCode());
child.setSupplierName(purchaseQuote.getSupplierName());
child.setCreateTime(DateUtils.getNowDate()); child.setCreateTime(DateUtils.getNowDate());
child.setTaxRate(purchaseQuote.getTaxRate()); child.setTaxRate(purchaseQuote.getTaxRate());
purchaseQuoteChildService.insertPurchaseQuoteChild(child); purchaseQuoteChildService.insertPurchaseQuoteChild(child);
@ -175,6 +177,8 @@ public class PurchaseQuoteServiceImpl implements IPurchaseQuoteService
if(childResult > 0){ if(childResult > 0){
for(PurchaseQuoteChild child : purchaseQuote.getPurchaseQuoteChildList()){ for(PurchaseQuoteChild child : purchaseQuote.getPurchaseQuoteChildList()){
child.setPurchaseQuoteCode(purchaseQuote.getPurchaseQuoteCode()); child.setPurchaseQuoteCode(purchaseQuote.getPurchaseQuoteCode());
child.setSupplierCode(purchaseQuote.getPurchaseQuoteCode());
child.setSupplierName(purchaseQuote.getSupplierName());
child.setCreateBy(loginName); child.setCreateBy(loginName);
child.setCreateTime(DateUtils.getNowDate()); child.setCreateTime(DateUtils.getNowDate());
child.setTaxRate(purchaseQuote.getTaxRate()); child.setTaxRate(purchaseQuote.getTaxRate());

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

@ -3,36 +3,46 @@
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"> <resultMap type="PurchasePlanChild" id="PurchasePlanChildResult">
<result property="purchasePlanChildId" column="purchase_plan_child_id" /> <result property="purchasePlanChildId" column="purchase_plan_child_id" />
<result property="purchasePlanCode" column="purchase_plan_code" /> <result property="purchasePlanCode" column="purchase_plan_code" />
<result property="materialId" column="material_id" /> <result property="materialId" column="material_id" />
<result property="materialCode" column="material_code" /> <result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" /> <result property="materialName" column="material_name" />
<result property="materialType" column="material_type" /> <result property="materialType" column="material_type" />
<result property="processMethod" column="process_method" /> <result property="processMethod" column="process_method" />
<result property="brand" column="brand" /> <result property="brand" column="brand" />
<result property="photoUrl" column="photoUrl" /> <result property="photoUrl" column="photoUrl" />
<result property="describe" column="describe" /> <result property="describe" column="describe" />
<result property="materialNum" column="material_num" /> <result property="materialNum" column="material_num" />
<result property="materialSole" column="material_sole" /> <result property="materialSole" column="material_sole" />
<result property="materialRmb" column="material_rmb" /> <result property="materialRmb" column="material_rmb" />
<result property="materialNormb" column="material_noRmb" /> <result property="materialNoRmb" column="material_noRmb" />
<result property="createBy" column="create_by" /> <result property="supplierCode" column="supplier_code" />
<result property="createTime" column="create_time" /> <result property="supplierName" column="supplier_name" />
<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="useStatus" column="use_status" />
<result property="auditStatus" column="audit_status" />
<result property="delFlag" column="del_flag" />
</resultMap>
<resultMap id="supplier" type="PurchaseQuoteChild">
<result property="supplierCode" column="supplier_code"/>
<result property="supplierName" column="supplier_name"/>
<result property="materialCode" column="material_code"/>
<result property="materialName" column="material_name"/>
<result property="materialNum" column="material_num"/>
<result property="materialSole" column="material_sole"/>
<result property="materialRmb" column="material_rmb"/>
<result property="materialNoRmb" column="material_noRmb"/>
</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, material_id,
material_code, material_name, material_type, process_method, brand, material_code, material_name, material_type, process_method, brand,
photoUrl, `describe`, material_num, material_sole, material_rmb, photoUrl, `describe`, material_num, material_sole, material_rmb,supplier_code,supplier_name,
material_noRmb, create_by, create_time, update_by, update_time, remark, material_noRmb, create_by, create_time, update_by, update_time, remark,
use_status, audit_status, del_flag from purchase_plan_child use_status, audit_status, del_flag from purchase_plan_child
</sql> </sql>
@ -81,7 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialNum != null">material_num,</if> <if test="materialNum != null">material_num,</if>
<if test="materialSole != null">material_sole,</if> <if test="materialSole != null">material_sole,</if>
<if test="materialRmb != null">material_rmb,</if> <if test="materialRmb != null">material_rmb,</if>
<if test="materialNormb != null">material_noRmb,</if> <if test="materialNoRmb != null">material_noRmb,</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>
@ -104,7 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialNum != null">#{materialNum},</if> <if test="materialNum != null">#{materialNum},</if>
<if test="materialSole != null">#{materialSole},</if> <if test="materialSole != null">#{materialSole},</if>
<if test="materialRmb != null">#{materialRmb},</if> <if test="materialRmb != null">#{materialRmb},</if>
<if test="materialNormb != null">#{materialNormb},</if> <if test="materialNoRmb != null">#{materialNormb},</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>
@ -131,7 +141,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialNum != null">material_num = #{materialNum},</if> <if test="materialNum != null">material_num = #{materialNum},</if>
<if test="materialSole != null">material_sole = #{materialSole},</if> <if test="materialSole != null">material_sole = #{materialSole},</if>
<if test="materialRmb != null">material_rmb = #{materialRmb},</if> <if test="materialRmb != null">material_rmb = #{materialRmb},</if>
<if test="materialNormb != null">material_noRmb = #{materialNormb},</if> <if test="materialNoRmb != null">material_noRmb = #{materialNoRmb},</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>
@ -162,5 +172,37 @@ 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
plan.material_code,
GROUP_CONCAT(DISTINCT planOrder.correlation_code ORDER BY planOrder.correlation_code) AS combined_correlation_codes,
GROUP_CONCAT(DISTINCT quote.supplier_code ORDER BY quote.supplier_code) AS combined_supplier_codes,
plan.material_code,
plan.material_name,
plan.material_type,
plan.process_method,
plan.brand,
plan.photoUrl,
plan.material_num,
quote.material_noRmb,
quote.material_rmb,
quote.supplier_code,
quote.supplier_name
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'
LEFT JOIN purchase_quote_child AS quote
ON plan.material_code = quote.material_code
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>
</mapper> </mapper>

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

@ -19,7 +19,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="materialNum" column="material_num" /> <result property="materialNum" column="material_num" />
<result property="materialSole" column="material_sole" /> <result property="materialSole" column="material_sole" />
<result property="materialRmb" column="material_rmb" /> <result property="materialRmb" column="material_rmb" />
<result property="materialNormb" column="material_noRmb" /> <result property="materialNoRmb" column="material_noRmb" />
<result property="supplierCode" column="supplier_code" />
<result property="supplierName" column="supplier_name" />
<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" />
@ -33,7 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectPurchaseQuoteChildVo"> <sql id="selectPurchaseQuoteChildVo">
select purchase_quote_child_id, purchase_quote_code, material_id, material_code, 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_name, material_type, processMethod, brand, photoUrl, `describe`, tax_rate, usd_rate,
material_num, material_sole, material_rmb, material_noRmb, 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, create_by, create_time, update_by, update_time, remark, use_status, audit_status,
del_flag from purchase_quote_child del_flag from purchase_quote_child
</sql> </sql>
@ -41,7 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectPurchaseQuoteChildList" parameterType="PurchaseQuoteChild" resultMap="PurchaseQuoteChildResult"> <select id="selectPurchaseQuoteChildList" parameterType="PurchaseQuoteChild" resultMap="PurchaseQuoteChildResult">
select purchase_quote_child_id, purchase_quote_code, material_id, material_code, 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_name, material_type, processMethod, brand, photoUrl, `describe`, tax_rate, usd_rate,
material_num, material_sole, material_rmb, material_noRmb, 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, create_by, create_time, update_by, update_time, remark, use_status, audit_status,
del_flag from purchase_quote_child del_flag from purchase_quote_child
<where> <where>
@ -56,8 +58,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="describe != null and describe != ''"> and `describe` = #{describe}</if> <if test="describe != null and describe != ''"> and `describe` = #{describe}</if>
<if test="materialNum != null "> and material_num = #{materialNum}</if> <if test="materialNum != null "> and material_num = #{materialNum}</if>
<if test="materialSole != null "> and material_sole = #{materialSole}</if> <if test="materialSole != null "> and material_sole = #{materialSole}</if>
<if test="materialRmb != null "> and material_rmb = #{materialRmb}</if>
<if test="materialNormb != null "> and material_noRmb = #{materialNormb}</if>
<if test="useStatus != null and useStatus != ''"> and use_status = #{useStatus}</if> <if test="useStatus != null and useStatus != ''"> and use_status = #{useStatus}</if>
<if test="auditStatus != null and auditStatus != ''"> and audit_status = #{auditStatus}</if> <if test="auditStatus != null and auditStatus != ''"> and audit_status = #{auditStatus}</if>
</where> </where>
@ -85,7 +85,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialNum != null">material_num,</if> <if test="materialNum != null">material_num,</if>
<if test="materialSole != null">material_sole,</if> <if test="materialSole != null">material_sole,</if>
<if test="materialRmb != null">material_rmb,</if> <if test="materialRmb != null">material_rmb,</if>
<if test="materialNormb != null">material_noRmb,</if> <if test="materialNoRmb != null">material_noRmb,</if>
<if test="supplierCode != null">supplier_code,</if>
<if test="supplierName != null">supplier_name,</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>
@ -110,7 +112,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialNum != null">#{materialNum},</if> <if test="materialNum != null">#{materialNum},</if>
<if test="materialSole != null">#{materialSole},</if> <if test="materialSole != null">#{materialSole},</if>
<if test="materialRmb != null">#{materialRmb},</if> <if test="materialRmb != null">#{materialRmb},</if>
<if test="materialNormb != null">#{materialNormb},</if> <if test="materialNoRmb != null">#{materialNormb},</if>
<if test="supplierCode != null">#{supplierCode},</if>
<if test="supplierName != null">#{supplierName},</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>
@ -139,7 +143,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialNum != null">material_num = #{materialNum},</if> <if test="materialNum != null">material_num = #{materialNum},</if>
<if test="materialSole != null">material_sole = #{materialSole},</if> <if test="materialSole != null">material_sole = #{materialSole},</if>
<if test="materialRmb != null">material_rmb = #{materialRmb},</if> <if test="materialRmb != null">material_rmb = #{materialRmb},</if>
<if test="materialNormb != null">material_noRmb = #{materialNormb},</if> <if test="materialNoRmb != null">material_noRmb = #{materialNoRmb},</if>
<if test="supplierCode != null">supplier_code = #{supplierCode},</if>
<if test="supplierName != null">supplier_name = #{supplierName},</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>

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

@ -95,10 +95,8 @@
formatter: function(value, row, index) {return $.table.selectDictLabel(sysUnitClassDatas, value);} formatter: function(value, row, index) {return $.table.selectDictLabel(sysUnitClassDatas, value);}
}, },
] ]
}); };
}
}) })
$("")
function submitHandler() { function submitHandler() {
if ($.validate.form()) { if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-plan-add').serialize()); $.operate.save(prefix + "/add", $('#form-plan-add').serialize());

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

@ -6,25 +6,16 @@
<body class="white-bg"> <body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> <div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-plan-add" th:object="${purchasePlanList}"> <form class="form-horizontal m" id="form-plan-add" th:object="${purchasePlanList}">
<div class="form-header"> <div class="col-xs-12">
<label class="col-sm-5 control-label">已选择采购计划:</label> <label class="col-sm-4 control-label">已选择采购计划:</label>
<div class="col-sm-7"> <div class="col-sm-7">
<input id="purchasePlanCodes" name="purchasePlanCode" class="form-control" type="text"> <input id="purchasePlanCodes" th:value="${purchasePlanCodes}" name="purchasePlanCode" class="form-control" type="text">
</div> </div>
</div> </div>
<div class="container-div" id="material"> <div class="container-div">
<div class="col-sm-12 select-table table-striped"> <div class="col-sm-12 select-table table-striped">
<div class="other container"> <div class="other container" id="material">
<div class="form-row">
<div class="btn-group-sm" id="toolbar" role="group">
<span>物料信息1</span>
</div>
</div>
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-sub-table-order"></table>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -67,72 +58,85 @@
<script th:inline="javascript"> <script th:inline="javascript">
var prefix = ctx + "purchase/plan" var prefix = ctx + "purchase/plan"
$("#form-plan-add").validate({focusCleanup: true}); $("#form-plan-add").validate({focusCleanup: true});
var purchasePlanList = [[${purchasePlanList}]]; var purchasePlanChildList = [[${purchasePlanChildList}]];
function submitHandler() { var formId = $("#form-plan-add").attr("id");
if ($.validate.form()) {
$.operate.save(prefix + "/add", $(#form-plan-add).serialize());
}
}
//根据物料物料数量添加物料分类表,自动生成类似的表单对象 //根据物料物料数量添加物料分类表,自动生成类似的表单对象
//初始根据采购计划单,涉及到物料做分类表 //初始根据采购计划单,涉及到物料做分类表
//根据采购计划单,获取物料信息,自动生成物料的供应商分类表 //根据采购计划单,获取物料信息,自动生成物料的供应商分类表
//获取表单的id; //获取表单的id;
var formId = $("#form-plan-add").attr("id");
//获取采购计划单的物料信息
var materialList = []; var materialList = [];
var purchasePlanList = $("#purchasePlanCodes").val(); //获取采购计划单的物料信息
//获取 //获取
// 假设qualityOrderCode已经定义或者可以通过某种方式获取到
$(function() { $(function() {
var options = { purchasePlanChildList.forEach(function(material, index) {
id: "bootstrap-table" + tableCounter, // 创建一个新的表格容器
// url: prefix + "/list", var $tableWrapper = $('<div id="material"></div>');
modalName: "采购计划单", var tableId = 'bootstrap-table-' + (index + 1);
search: false, // 在每个表格前添加关联销售订单号
showExport: false, var $headerDiv =
showFooter: false, $('<div class="form-row">' +
showSearch: false, '<div class="btn-group-sm" id="toolbar'+ index + '" role="group">' +
showRefresh: false, '<span>物料信息 + ' + index + 1 + ': </span>' +
showColumns: false, '<div class="header-div text-center mb-3">' +
showToggle: false, '<strong>关联订单号:</strong> ' + material.correlationCode +
columns: [ '</div>' +
{checkbox: false}, '</div>' +
{title: '料号', field: 'materialNo'}, '</div>'
{title: '图片', field: 'photoUrl'}, );
{title: '物料名称', field: 'materialName'}, $tableWrapper.append($headerDiv);
{title: '物料类型', field: 'materialType'}, var $table = $(
{title: '物料描述', field: 'describe'}, '<div class="row">'+
{title: '品牌', field: 'brand'}, '<div class="col-sm-12 select-table table-striped">'+
{title: '加工方式', field: 'processMethod',}, ' <table id="'+ tableId + '"></table>'+
{title: '单位', field: 'unit'}, '</div id="supplierCode' + tableId + ' " ></div>'+
{title: '计划采购数', field: 'planPurchaseNum',}, '</div>'+
] '</div>'
} );
$.table.init(options); var $formGroup = $('<div class="form-group"></div>');
var materialList = purchasePlanList; // 假设这是获取到的物料列表 var supplierName =
var tableCounter = 0; // 计数器,用于生成唯一的表格ID '<div class="form-row">' +
// 遍历物料列表,为每个物料生成表格 '<label class="col-sm-4 col-form-label is-required">实际采购数:</label>' +
materialList.forEach(function(material, index) { '<div class="col-sm-4">' +
var $tableWrapper = $('<div class="table-responsive mt-3"></div>'); '<input type="text" class="form-control" placeholder="请输入仓库ID" required="required">' +
var $table = $('<table id="' + uniqueTableId + '" class="table table-striped table-bordered"></table>'); '</div>' +
'</div>' +
// 初始化此表格的配置 '<div class="form-row">' +
var tableOptions = Object.assign({}, options, { // 复制并修改options以适应当前物料 '<label class="col-sm-2 col-form-label">交付时间:</label>' +
id: uniqueTableId, '<div class="input-group date">' +
data: [material] // 假设options支持直接传入数据来渲染表格 '<input name="pricingDate" class="form-control" placeholder="yyyy-MM-dd" type="text">' +
}); '<span class="input-group-addon"><i class="fa fa-calendar"></i></span>' +
$.table.init(tableOptions, $table); // 假设$.table.init可以接受jQuery对象来初始化表格 '</div>' +
'</div>'+
'<div class="form-row">' +
'<label class="col-sm-2 col-form-label">实际采购合计:</label>' +
'<div class="input-group date">' +
'<input name="pricingDate" class="form-control" placeholder="yyyy-MM-dd" type="text">' +
'</div>' +
'</div>' +
'<div class="form-row">' +
'<label class="col-sm-2 col-form-label">不含税采购总价:</label>' +
'<div class="input-group date">' +
'<input name="pricingDate" class="form-control" type="text">' +
'</div>' +
'</div>' +
'<div class="form-row">' +
'<label class="col-sm-2 col-form-label">含税采购总价:</label>' +
'<div class="input-group date">' +
'<input name="pricingDate" class="form-control" type="text">' +
'<span class="input-group-addon"><i class="fa fa-calendar"></i></span>' +
'</div>' +
'</div>';
// 添加表头信息
var supplierInfo = material.supplier || {}; // 假设物料对象中包含供应商信息
addHead(uniqueTableId, material, supplierInfo);
// 将表格加入到页面的某个容器中,这里假设存在一个容器div#materials-container // 使用物料数据初始化表格
$('#materials-container').append($tableWrapper.append($table)); var materialData = [material]; // Bootstrap Table需要一个数组作为数据源
}); tables(tableId,materialData);
// 添加到DOM中
$('#material').append($tableWrapper.append($table)); // 根据实际情况调整父容器选择器
})
}); });
// 假设qualityOrderCode已经定义或者可以通过某种方式获取到 function tables(tableId,data){
$(function() {
var tableOptions = { var tableOptions = {
showExport: false, showExport: false,
showFooter: false, showFooter: false,
@ -151,27 +155,15 @@
{title: '加工方式', field: 'processMethod'}, {title: '加工方式', field: 'processMethod'},
{title: '单位', field: 'unit'}, {title: '单位', field: 'unit'},
{title: '计划采购数', field: 'planPurchaseNum'}, {title: '计划采购数', field: 'planPurchaseNum'},
] ],
}; };
purchasePlanList.forEach(function(material, index) { $.table.init(tableId, tableOptions, data);
// 创建一个新的表格容器 }
var $tableWrapper = $('<div class="table-responsive mt-3"></div>'); function submitHandler() {
var tableId = 'bootstrap-table-' + index; if ($.validate.form()) {
var $table = $('<table id="' + tableId + '" class="table table-striped table-bordered"></table>'); $.operate.save(prefix + "/add", $("#form-plan-add").serialize());
}
// 在每个表格前添加关联销售订单号 }
var $headerDiv = $('<div class="header-div text-center mb-3"><strong>关联销售订单号:</strong> ' + material.salesOrderCode + '</div>');
$tableWrapper.append($headerDiv);
// 使用物料数据初始化表格
var materialData = [material]; // Bootstrap Table需要一个数组作为数据源
var tableOpts = Object.assign({}, tableOptions, {data: materialData});
$table.bootstrapTable(tableOpts);
// 添加到DOM中
$('#material').append($tableWrapper.append($table)); // 根据实际情况调整父容器选择器
})
});
</script> </script>
</body> </body>
</html> </html>

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

@ -10,10 +10,10 @@
<body class="white-bg"> <body class="white-bg">
<div id="app" class="wrapper wrapper-content animated fadeInRight ibox-content"> <div id="app" class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-purchaseQuote-add"> <form class="form-horizontal m" id="form-purchaseQuote-add">
<div class="form-group" > <div class="form-group" hidden="hidden">
<label class="col-sm-3 control-label is-required">采购报价单号:</label> <label class="col-sm-3 control-label is-required" >采购报价单号:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="purchaseQuoteCode" class="form-control" type="text" required disabled> <input name="purchaseQuoteCode" class="form-control" type="text" required>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">

Loading…
Cancel
Save