Browse Source

[feat]采购管理:修改添加获取采购报价子表方法,修改采购报价子表子表供应商下拉

dev
zhangsiqi 5 months ago
parent
commit
437f12e06f
  1. 8
      ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseQuoteController.java
  2. 4
      ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseQuoteChildMapper.java
  3. 5
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseQuoteChildServiceImpl.java
  4. 22
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseQuoteServiceImpl.java
  5. 27
      ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteChildMapper.xml
  6. 63
      ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteMapper.xml
  7. 252
      ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/add.html
  8. 94
      ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/edit.html

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

@ -1,6 +1,8 @@
package com.ruoyi.purchase.controller; package com.ruoyi.purchase.controller;
import java.util.List; import java.util.List;
import com.ruoyi.ck.utils.Result;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -145,5 +147,9 @@ public class PurchaseQuoteController extends BaseController
return toAjax(purchaseQuoteService.restorePurchaseQuoteById(id)); return toAjax(purchaseQuoteService.restorePurchaseQuoteById(id));
} }
@PostMapping( "/getId")
@ResponseBody
public Result getPurchaseQuoteById() throws Exception {
return Result.getSuccessResult(purchaseQuoteService.getId());
}
} }

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

@ -51,6 +51,10 @@ public interface PurchaseQuoteChildMapper
*/ */
public int deletePurchaseQuoteChildById(Long purchaseQuoteChildId); public int deletePurchaseQuoteChildById(Long purchaseQuoteChildId);
/**
* 根据报价单号逻辑删除采购报价单物料信息
*/
public int deletePurchaseQuoteChildByQuoteCode(String purchaseQuoteCode);
/** /**
* 批量删除采购报价单物料信息 * 批量删除采购报价单物料信息
* *

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

@ -100,6 +100,11 @@ public class PurchaseQuoteChildServiceImpl implements IPurchaseQuoteChildService
return purchaseQuoteChildMapper.deletePurchaseQuoteChildById(purchaseQuoteChildId); return purchaseQuoteChildMapper.deletePurchaseQuoteChildById(purchaseQuoteChildId);
} }
@Override
public int deletePurchaseQuoteChildByQuoteCode(String purchaseQuoteCode) {
return purchaseQuoteChildMapper.deletePurchaseQuoteChildByQuoteCode(purchaseQuoteCode);
}
/** /**
* 作废采购报价单物料信息 * 作废采购报价单物料信息
* *

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

@ -3,6 +3,7 @@ package com.ruoyi.purchase.service.impl;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.service.ICommonService; import com.ruoyi.common.service.ICommonService;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
@ -46,6 +47,8 @@ public class PurchaseQuoteServiceImpl implements IPurchaseQuoteService
@Autowired @Autowired
private ICommonService commonService; private ICommonService commonService;
@Autowired
private RedisCache redisCache;
@Autowired @Autowired
private SysUserMapper userMapper; private SysUserMapper userMapper;
@ -94,7 +97,6 @@ public class PurchaseQuoteServiceImpl implements IPurchaseQuoteService
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class)
public int insertPurchaseQuote(PurchaseQuote purchaseQuote) public int insertPurchaseQuote(PurchaseQuote purchaseQuote)
{ {
String loginName = ShiroUtils.getLoginName(); String loginName = ShiroUtils.getLoginName();
@ -119,7 +121,7 @@ public class PurchaseQuoteServiceImpl implements IPurchaseQuoteService
} }
List<PurchaseQuoteChild> childList = purchaseQuote.getPurchaseQuoteChildList(); List<PurchaseQuoteChild> childList = purchaseQuote.getPurchaseQuoteChildList();
int childResult = childList.size(); int childResult = childList.size();
if(childResult >= 1){ if(childResult > 0){
for(PurchaseQuoteChild child : purchaseQuote.getPurchaseQuoteChildList()){ for(PurchaseQuoteChild child : purchaseQuote.getPurchaseQuoteChildList()){
child.setPurchaseQuoteCode(purchaseQuote.getPurchaseQuoteCode()); child.setPurchaseQuoteCode(purchaseQuote.getPurchaseQuoteCode());
child.setCreateBy(loginName); child.setCreateBy(loginName);
@ -138,7 +140,6 @@ public class PurchaseQuoteServiceImpl implements IPurchaseQuoteService
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class)
public int updatePurchaseQuote(PurchaseQuote purchaseQuote) public int updatePurchaseQuote(PurchaseQuote purchaseQuote)
{ {
String loginName = ShiroUtils.getLoginName(); String loginName = ShiroUtils.getLoginName();
@ -148,8 +149,6 @@ public class PurchaseQuoteServiceImpl implements IPurchaseQuoteService
String fileIdStr = purchaseQuote.getFileIdStr(); String fileIdStr = purchaseQuote.getFileIdStr();
Long photoAttachId = purchaseQuote.getPhotoAttachId(); Long photoAttachId = purchaseQuote.getPhotoAttachId();
String removeFileIdStr = purchaseQuote.getRemoveFileIdStr(); String removeFileIdStr = purchaseQuote.getRemoveFileIdStr();
if(StringUtils.isNotBlank(removeFileIdStr)){ if(StringUtils.isNotBlank(removeFileIdStr)){
List<String> removeFileIdList = Arrays.asList(removeFileIdStr.split(";")); List<String> removeFileIdList = Arrays.asList(removeFileIdStr.split(";"));
commonService.deleteByIds(removeFileIdList); commonService.deleteByIds(removeFileIdList);
@ -169,18 +168,20 @@ public class PurchaseQuoteServiceImpl implements IPurchaseQuoteService
attachFileService.updateAttachIdByIdList(photoAttachId, fileIdList); attachFileService.updateAttachIdByIdList(photoAttachId, fileIdList);
} }
List<PurchaseQuoteChild> childList = purchaseQuote.getPurchaseQuoteChildList(); List<PurchaseQuoteChild> childList = purchaseQuote.getPurchaseQuoteChildList();
//逻辑删除采购报价单子表
purchaseQuoteChildService.deletePurchaseQuoteChildByQuoteCode(purchaseQuote.getPurchaseQuoteCode());
//重新录入子表
int childResult = childList.size(); int childResult = childList.size();
if(childResult >= 1){ if(childResult > 0){
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.setCreateTime(DateUtils.getNowDate()); child.setCreateTime(DateUtils.getNowDate());
child.setTaxRate(purchaseQuote.getTaxRate()); child.setTaxRate(purchaseQuote.getTaxRate());
purchaseQuoteChildService.updatePurchaseQuoteChild(child); purchaseQuoteChildService.insertPurchaseQuoteChild(child);
} }
} }
return purchaseQuoteMapper.updatePurchaseQuote(purchaseQuote); return purchaseQuoteMapper.updatePurchaseQuote(purchaseQuote);
} }
/** /**
@ -231,4 +232,9 @@ public class PurchaseQuoteServiceImpl implements IPurchaseQuoteService
{ {
return purchaseQuoteMapper.restorePurchaseQuoteById(purchaseQuoteId); return purchaseQuoteMapper.restorePurchaseQuoteById(purchaseQuoteId);
} }
@Override
public Object getId(){
return redisCache.generateBillNo("CGBJ");
}
} }

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

@ -39,7 +39,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql> </sql>
<select id="selectPurchaseQuoteChildList" parameterType="PurchaseQuoteChild" resultMap="PurchaseQuoteChildResult"> <select id="selectPurchaseQuoteChildList" parameterType="PurchaseQuoteChild" resultMap="PurchaseQuoteChildResult">
<include refid="selectPurchaseQuoteChildVo"/> select purchase_quote_child_id, purchase_quote_code, material_id, material_code,
material_name, material_type, processMethod, brand, photoUrl, `describe`, tax_rate, usd_rate,
material_num, material_sole, material_rmb, material_noRmb,
create_by, create_time, update_by, update_time, remark, use_status, audit_status,
del_flag from purchase_quote_child
<where> <where>
<if test="purchaseQuoteCode != null and purchaseQuoteCode != ''"> and purchase_quote_code = #{purchaseQuoteCode}</if> <if test="purchaseQuoteCode != null and purchaseQuoteCode != ''"> and purchase_quote_code = #{purchaseQuoteCode}</if>
<if test="materialId != null "> and material_id = #{materialId}</if> <if test="materialId != null "> and material_id = #{materialId}</if>
@ -49,7 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="processMethod != null and processMethod != ''"> and processMethod = #{processMethod}</if> <if test="processMethod != null and processMethod != ''"> and processMethod = #{processMethod}</if>
<if test="brand != null and brand != ''"> and brand = #{brand}</if> <if test="brand != null and brand != ''"> and brand = #{brand}</if>
<if test="photoUrl != null and photoUrl != ''"> and photoUrl = #{photoUrl}</if> <if test="photoUrl != null and photoUrl != ''"> and photoUrl = #{photoUrl}</if>
<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="materialRmb != null "> and material_rmb = #{materialRmb}</if>
@ -75,7 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="processMethod != null">processMethod,</if> <if test="processMethod != null">processMethod,</if>
<if test="brand != null">brand,</if> <if test="brand != null">brand,</if>
<if test="photoUrl != null">photoUrl,</if> <if test="photoUrl != null">photoUrl,</if>
<if test="describe != null">describe,</if> <if test="describe != null">`describe`,</if>
<if test="taxRate != null">tax_rate,</if> <if test="taxRate != null">tax_rate,</if>
<if test="usdRate != null">usd_rate,</if> <if test="usdRate != null">usd_rate,</if>
<if test="materialNum != null">material_num,</if> <if test="materialNum != null">material_num,</if>
@ -148,16 +152,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where purchase_quote_child_id = #{purchaseQuoteChildId} where purchase_quote_child_id = #{purchaseQuoteChildId}
</update> </update>
<delete id="deletePurchaseQuoteChildById" parameterType="Long"> <update id="deletePurchaseQuoteChildById" parameterType="Long">
delete from purchase_quote_child where purchase_quote_child_id = #{purchaseQuoteChildId} update purchase_quote_child set del_flag = '1' where purchase_quote_child_id = #{purchaseQuoteChildId}
</delete> </update>
<update id="deletePurchaseQuoteChildByQuoteCode" parameterType="String">
update purchase_quote_child
set del_flag = '1' where purchase_quote_code = #{purchaseQuoteCode}
</update>
<delete id="deletePurchaseQuoteChildByIds" parameterType="String"> <update id="deletePurchaseQuoteChildByIds" parameterType="String">
delete from purchase_quote_child where purchase_quote_child_id in update purchase_quote_child set del_flag = '1' where purchase_quote_child_id in
<foreach item="purchaseQuoteChildId" collection="array" open="(" separator="," close=")"> <foreach item="purchaseQuoteChildId" collection="array" open="(" separator="," close=")">
#{purchaseQuoteChildId} #{purchaseQuoteChildId}
</foreach> </foreach>
</delete> </update>
<update id="cancelPurchaseQuoteChildById" parameterType="Long"> <update id="cancelPurchaseQuoteChildById" parameterType="Long">
update purchase_quote_child set del_flag = '1' where purchase_quote_child_id = #{purchaseQuoteChildId} update purchase_quote_child set del_flag = '1' where purchase_quote_child_id = #{purchaseQuoteChildId}

63
ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteMapper.xml

@ -3,7 +3,6 @@
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.PurchaseQuoteMapper"> <mapper namespace="com.ruoyi.purchase.mapper.PurchaseQuoteMapper">
<resultMap type="PurchaseQuote" id="PurchaseQuoteResult"> <resultMap type="PurchaseQuote" id="PurchaseQuoteResult">
<result property="purchaseQuoteId" column="purchase_quote_id" /> <result property="purchaseQuoteId" column="purchase_quote_id" />
<result property="purchaseQuoteCode" column="purchase_quote_code" /> <result property="purchaseQuoteCode" column="purchase_quote_code" />
@ -14,8 +13,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="materialAmount" column="material_amount" /> <result property="materialAmount" column="material_amount" />
<result property="pricingDate" column="pricingDate" /> <result property="pricingDate" column="pricingDate" />
<result property="materialNo" column="material_no" /> <result property="materialNo" column="material_no" />
<result property="firstAddTime" column="first_add_time" />
<result property="updateInfoTime" column="update_info_time" />
<result property="materialName" column="material_name" /> <result property="materialName" column="material_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" />
@ -31,17 +28,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectPurchaseQuoteVo"> <sql id="selectPurchaseQuoteVo">
select purchase_quote_id, purchase_quote_code, purchaseBuyer, select purchase_quote_id, purchase_quote_code, purchaseBuyer,
supplier_quote_code, supplier_name, tax_rate, material_amount, supplier_quote_code, supplier_name, tax_rate, material_amount,
pricingDate, material_no, first_add_time, update_info_time, pricingDate, material_no,material_name, create_by, create_time, update_by, update_time,
material_name, create_by, create_time, update_by, update_time,
audit_status, use_status, remark from purchase_quote audit_status, use_status, remark from purchase_quote
</sql> </sql>
<select id="selectPurchaseQuoteList" parameterType="PurchaseQuote" resultMap="PurchaseQuoteResult"> <select id="selectPurchaseQuoteList" parameterType="PurchaseQuote" resultMap="PurchaseQuoteResult">
select purchase.purchase_quote_id, purchase.purchase_quote_code, purchase.purchaseBuyer, select p.purchase_quote_id, p.purchase_quote_code, p.purchaseBuyer,
purchase.supplier_quote_code, purchase.supplier_name, purchase.tax_rate, purchase.material_amount, p.supplier_quote_code, p.supplier_name, p.tax_rate, p.material_amount,
purchase.pricingDate, purchase.material_no, purchase.first_add_time, purchase.update_info_time, p.pricingDate, p.material_no,p.material_name, p.create_by, p.create_time, p.update_by,
purchase.material_name, purchase.create_by, purchase.create_time, purchase.update_by, purchase.update_time, p.update_time,p.audit_status, p.use_status,
purchase.audit_status, purchase.use_status, purchase.remark,file.url as photo_url from purchase_quote as purchase p.remark,file.url as photo_url from purchase_quote as p
left join ( left join (
select select
att.rel_id att.rel_id
@ -53,31 +49,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where att.source_type = 'purchaseQuote' and att.source_sub_type = 'photo' where att.source_type = 'purchaseQuote' and att.source_sub_type = 'photo'
group by att.rel_id group by att.rel_id
)file )file
on purchase.purchase_quote_id = file.rel_id on p.purchase_quote_id = file.rel_id
<where> <where>
<if test="purchaseQuoteCode != null and purchaseQuoteCode != ''"> and purchase.purchase_quote_code = #{purchaseQuoteCode}</if> <if test="purchaseQuoteCode != null and purchaseQuoteCode != ''"> and p.purchase_quote_code = #{purchaseQuoteCode}</if>
<if test="purchaseBuyer != null and purchaseBuyer != ''"> and purchase.purchaseBuyer = #{purchaseBuyer}</if> <if test="purchaseBuyer != null and purchaseBuyer != ''"> and p.purchaseBuyer = #{purchaseBuyer}</if>
<if test="supplierQuoteCode != null and supplierQuoteCode != ''"> and purchase.supplier_quote_code = #{supplierQuoteCode}</if> <if test="supplierQuoteCode != null and supplierQuoteCode != ''"> and p.supplier_quote_code = #{supplierQuoteCode}</if>
<if test="supplierName != null and supplierName != ''"> and purchase.supplier_name like concat('%', #{supplierName}, '%')</if> <if test="supplierName != null and supplierName != ''"> and p.supplier_name like concat('%', #{supplierName}, '%')</if>
<if test="materialAmount != null and materialAmount != ''"> and purchase.material_amount = #{materialAmount}</if> <if test="materialAmount != null and materialAmount != ''"> and p.material_amount = #{materialAmount}</if>
<if test="params.beginPricingDate != null and params.beginPricingDate != '' and params.endPricingDate != null and params.endPricingDate != ''"> and purchase.pricingDate between #{params.beginPricingDate} and #{params.endPricingDate}</if> <if test="params.beginPricingDate != null and params.beginPricingDate != '' and params.endPricingDate != null and params.endPricingDate != ''"> and p.pricingDate between #{params.beginPricingDate} and #{params.endPricingDate}</if>
<if test="materialNo != null and materialNo != ''"> and purchase.material_no = #{materialNo}</if> <if test="materialNo != null and materialNo != ''"> and p.material_no = #{materialNo}</if>
<if test="params.beginFirstAddTime != null and params.beginFirstAddTime != '' and params.endFirstAddTime != null and params.endFirstAddTime != ''"> and purchase.first_add_time between #{params.beginFirstAddTime} and #{params.endFirstAddTime}</if> <if test="materialName != null and materialName != ''"> and p.material_name like concat('%', #{materialName}, '%')</if>
<if test="updateInfoTime != null and updateInfoTime != ''"> and purchase.update_info_time = #{updateInfoTime}</if> <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and p.create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
<if test="materialName != null and materialName != ''"> and purchase.material_name like concat('%', #{materialName}, '%')</if> <if test="auditStatus != null and auditStatus != ''"> and p.audit_status = #{auditStatus}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and purchase.create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if> <if test="useStatus != null and useStatus != ''"> and p.use_status = #{useStatus}</if>
<if test="auditStatus != null and auditStatus != ''"> and purchase.audit_status = #{auditStatus}</if>
<if test="useStatus != null and useStatus != ''"> and purchase.use_status = #{useStatus}</if>
</where> </where>
order by p.create_time desc
</select> </select>
<select id="selectPurchaseQuoteById" parameterType="Long" resultMap="PurchaseQuoteResult"> <select id="selectPurchaseQuoteById" parameterType="Long" resultMap="PurchaseQuoteResult">
select purchase.purchase_quote_id, purchase.purchase_quote_code, purchase.purchaseBuyer, select p.purchase_quote_id, p.purchase_quote_code, p.purchaseBuyer,
purchase.supplier_quote_code, purchase.supplier_name, purchase.tax_rate, purchase.material_amount, p.supplier_quote_code, p.supplier_name, p.tax_rate, p.material_amount,
purchase.pricingDate, purchase.material_no, purchase.first_add_time, purchase.update_info_time, p.pricingDate, p.material_no, p.material_name, p.create_by, p.create_time, p.update_by, p.update_time,
purchase.material_name, purchase.create_by, purchase.create_time, purchase.update_by, purchase.update_time, p.audit_status, p.use_status, p.remark,file.url as photo_url from purchase_quote as p
purchase.audit_status, purchase.use_status, purchase.remark,file.url as photo_url from purchase_quote as purchase
left join ( left join (
select att.rel_id,file.url,min(file.create_time) as create_time select att.rel_id,file.url,min(file.create_time) as create_time
from sys_attach as att from sys_attach as att
@ -86,8 +79,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where att.source_type = 'purchaseQuote' and att.source_sub_type = 'photo' where att.source_type = 'purchaseQuote' and att.source_sub_type = 'photo'
group by att.rel_id group by att.rel_id
)file )file
on purchase.purchase_quote_id = file.rel_id on p.purchase_quote_id = file.rel_id
where purchase.purchase_quote_id = #{purchaseQuoteId} where p.purchase_quote_id = #{purchaseQuoteId}
</select> </select>
<insert id="insertPurchaseQuote" parameterType="PurchaseQuote" useGeneratedKeys="true" keyProperty="purchaseQuoteId"> <insert id="insertPurchaseQuote" parameterType="PurchaseQuote" useGeneratedKeys="true" keyProperty="purchaseQuoteId">
@ -101,8 +94,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialAmount != null">material_amount,</if> <if test="materialAmount != null">material_amount,</if>
<if test="pricingDate != null">pricingDate,</if> <if test="pricingDate != null">pricingDate,</if>
<if test="materialNo != null">material_no,</if> <if test="materialNo != null">material_no,</if>
<if test="firstAddTime != null">first_add_time,</if>
<if test="updateInfoTime != null">update_info_time,</if>
<if test="materialName != null">material_name,</if> <if test="materialName != null">material_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>
@ -121,8 +112,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialAmount != null">#{materialAmount},</if> <if test="materialAmount != null">#{materialAmount},</if>
<if test="pricingDate != null">#{pricingDate},</if> <if test="pricingDate != null">#{pricingDate},</if>
<if test="materialNo != null">#{materialNo},</if> <if test="materialNo != null">#{materialNo},</if>
<if test="firstAddTime != null">#{firstAddTime},</if>
<if test="updateInfoTime != null">#{updateInfoTime},</if>
<if test="materialName != null">#{materialName},</if> <if test="materialName != null">#{materialName},</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>
@ -145,8 +134,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialAmount != null">material_amount = #{materialAmount},</if> <if test="materialAmount != null">material_amount = #{materialAmount},</if>
<if test="pricingDate != null">pricingDate = #{pricingDate},</if> <if test="pricingDate != null">pricingDate = #{pricingDate},</if>
<if test="materialNo != null">material_no = #{materialNo},</if> <if test="materialNo != null">material_no = #{materialNo},</if>
<if test="firstAddTime != null">first_add_time = #{firstAddTime},</if>
<if test="updateInfoTime != null">update_info_time = #{updateInfoTime},</if>
<if test="materialName != null">material_name = #{materialName},</if> <if test="materialName != null">material_name = #{materialName},</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>

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

@ -13,13 +13,13 @@
<div class="form-group" > <div class="form-group" >
<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> <input name="purchaseQuoteCode" class="form-control" type="text" required disabled>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">供应商ID:</label> <label class="col-sm-3 control-label is-required">供应商ID:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select name="supplierQuoteCode" class="form-control" required> <select id="selectSupplierQuoteCode" name="supplierQuoteCode" class="form-control" required>
<option value="">请选择供应商</option> <option value="">请选择供应商</option>
</select> </select>
</div> </div>
@ -27,15 +27,13 @@
<div class="form-group"> <div class="form-group">
<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">
<select name="supplierName" class="form-control" required> <input name="supplierName" class="form-control select2" required />
<option value="">请选择供应商</option>
</select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">定价日期:</label> <label class="col-sm-3 control-label">定价日期:</label>
<div class="input-group date"> <div class="input-group date">
<input name="pricingDate" class="form-control" placeholder="yyyy-MM-dd" type="text"> <input name="pricingDate" class="form-control" type="text" />
<span class="input-group-addon"><i class="fa fa-calendar"></i></span> <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div> </div>
</div> </div>
@ -73,7 +71,7 @@
<label class="col-sm-3 control-label">税率:</label> <label class="col-sm-3 control-label">税率:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<div class="input-group"> <div class="input-group">
<input name="taxRate" id="taxRate" class="form-control" placeholder="13" /> <input name="taxRate" id="taxRate" class="form-control" placeholder="13" type="number"/>
<span class="input-group-addon">%</span> <span class="input-group-addon">%</span>
</div> </div>
</div> </div>
@ -102,73 +100,29 @@
<script th:src="@{/ajax/libs/vue/vue.js}"></script> <script th:src="@{/ajax/libs/vue/vue.js}"></script>
<script th:src="@{/ajax/libs/element-ui/element-ui.js}"></script> <script th:src="@{/ajax/libs/element-ui/element-ui.js}"></script>
<script th:inline="javascript"> <script th:inline="javascript">
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]]; var materialTypeData = [[${@category.getChildByCode('materialType')}]];
var auditStatusDatas = [[${@dict.getType('auditStatus')}]]; var sysUnitClassData = [[${@dict.getType('sys_unit_class')}]];
var sysUnitClassDatas = [[${@dict.getType('sys_unit_class')}]]; var processMethodData = [[${@dict.getType('processMethod')}]];
var processMethodDatas = [[${@dict.getType('processMethod')}]];
var userName = [[${@permission.getPrincipalProperty('userName')}]]; var userName = [[${@permission.getPrincipalProperty('userName')}]];
var prefix = ctx + "purchase/purchaseQuote"; var prefix = ctx + "purchase/purchaseQuote";
$("#form-purchaseOrder-add").validate({focusCleanup: true});
new Vue({ function getPurchaseQuoteCode(){
el: '#app',
data: function() {
return {
fileList: [],
fileUploadUrl: ctx + "common/uploadSingleFile",
fileDeleteUrl: ctx + "common/deleteFile",
fileIdList:[],
dialogImageUrl: '',
dialogVisible: false
}
},
methods: {
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url;
this.dialogVisible = true;
},
uploadSuccess(response, file, fileList) {
console.log(response);
if(response.code == web_status.SUCCESS){
var attachFileId = response.data.id;
file.attachFileId = attachFileId;
this.fileIdList.push(attachFileId);
$("#fileIdStr").val(this.fileIdList.join(";"));
$.modal.msgSuccess("上传成功");
}else{
$.modal.alertError(response.msg);
}
},
uploadRemove(file, fileList) {
console.log(file, fileList);
var attachFileId = file.attachFileId;
$.ajax({ $.ajax({
type: "get", url: prefix + "/getId",
url: this.fileDeleteUrl, type: "post",
data: {id:attachFileId}, dateType: "json",
cache: false, success: function (resp) {
async: false, // 设置成同步 if (resp.code === 0) {
dataType: 'json', $("input[name='purchaseQuoteCode']").val(resp.data);
success: function(result) {
if (result.code == web_status.SUCCESS) {
var index = this.fileIdList.indexOf(attachFileId);
if(index!=-1){
this.fileIdList.splice(index,1);
$("#fileIdStr").val(this.fileIdList.join(";"));
}
$.modal.msgSuccess("删除附件成功。");
} else { } else {
$.modal.alertError(result.msg); $.modal.msgError("失败啦");
} }
}, },
error: function(error) { error: function () {
$.modal.alertError("删除附件失败。"); $.modal.msgError("后台出错啦!");
} }
}); });
},
} }
})
$("#form-purchaseQuote-add").validate({focusCleanup: true});
$(function() { $(function() {
var options = { var options = {
id:'bootstrap-sub-table-purchaseQuoteChild', id:'bootstrap-sub-table-purchaseQuoteChild',
@ -178,12 +132,6 @@
model: "物料报价信息", model: "物料报价信息",
columns: [ columns: [
{checkbox: true}, {checkbox: true},
{field: 'index',align: 'center', title: "序号",
formatter: function (value, row, index) {
var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
return columnIndex + $.table.serialNumber(index);
}
},
{title: '物料索引id',field: 'materialId',align: 'center',visible: false}, {title: '物料索引id',field: 'materialId',align: 'center',visible: false},
{title: '料号',field: 'materialCode',align: 'center'}, {title: '料号',field: 'materialCode',align: 'center'},
{title: '物料名称',field: 'materialName',align: 'center'}, {title: '物料名称',field: 'materialName',align: 'center'},
@ -194,19 +142,19 @@
}, },
{title: '物料类型',field: 'materialType',align: 'center', {title: '物料类型',field: 'materialType',align: 'center',
formatter: function(value, row, index) { formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value); return $.table.selectCategoryLabel(materialTypeData, value);
} }
}, },
{ title: '描述',field: 'describe',align: 'center'}, { title: '描述',field: 'describe',align: 'center'},
{title: '品牌',field: 'brand',align: 'center'}, {title: '品牌',field: 'brand',align: 'center'},
{ title: '单位',field: 'unit',align: 'center', { title: '单位',field: 'unit',align: 'center',
formatter: function(value, row, index) { formatter: function(value, row, index) {
return $.table.selectDictLabel(sysUnitClassDatas, value); return $.table.selectDictLabel(sysUnitClassData, value);
} }
}, },
{title: '半成品类型',field: 'processMethod',align: 'center', {title: '半成品类型',field: 'processMethod',align: 'center',
formatter: function(value, row, index) { formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value); return $.table.selectDictLabel(processMethodData, value);
} }
}, },
{title: '最新报价',field: 'materialSole',align: 'center',}, {title: '最新报价',field: 'materialSole',align: 'center',},
@ -221,19 +169,35 @@
{title: '操作', align: 'center', {title: '操作', align: 'center',
formatter: function (value, row, index) { formatter: function (value, row, index) {
var actions = []; var actions = [];
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a> '); actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.materialCode + '\')"><i class="fa fa-remove"></i>删除</a> ');
return actions.join(''); return actions.join('');
} }
},
],
onEditableSave: function(field, row, oldValue, $el) {
var rmbRateInput = parseFloat($("#taxRate").val()) || 0;
var rmbRate = rmbRateInput / 100; // 将输入的百分比转换为小数
rmbRate = parseFloat(rmbRate.toFixed(2)); // 确保rmbRate转换为两位小数的浮点数
// 根据选择的货币类型计算其他值
// RMB为基准货币
row.materialRmb = (parseFloat(row.materialNoRmb) * (1 + rmbRate)).toFixed(2);
} }
]
}; };
$.table.init(options); $.table.init(options);
selectSupplier(); selectSupplier();
getPurchaseQuoteCode();
}); });
function doSubmit(index, layero,uniqueId){ function doSubmit(index, layero,uniqueId){
console.log(uniqueId);
var iframeWin = window[layero.find('iframe')[0]['name']]; var iframeWin = window[layero.find('iframe')[0]['name']];
var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections')[0]; var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections')[0];
var rows = $("#bootstrap-sub-table-1").bootstrapTable('getData').length;
for(var i=0;i<rows;i++){
var data = $("#bootstrap-sub-table-1").bootstrapTable('getData')[i];
if(data.materialNo==rowData.materialNo){
$.modal.alertError("不能选择已添加过的相同料号");
return;
}
}
console.log("rowData: "+rowData); console.log("rowData: "+rowData);
$("#bootstrap-sub-table-purchaseQuoteChild").bootstrapTable('insertRow', { $("#bootstrap-sub-table-purchaseQuoteChild").bootstrapTable('insertRow', {
index:1, index:1,
@ -267,31 +231,68 @@
}; };
$.modal.openOptions(options); $.modal.openOptions(options);
} }
/* 删除指定表格行 */ new Vue({
function removeRow(id){ el: '#app',
$("#bootstrap-sub-table-requisitionChild").bootstrapTable('RemoveByUniqueId', { data: function() {
field: 'index', return {
values: id fileList: [],
}) fileUploadUrl: ctx + "common/uploadSingleFile",
fileDeleteUrl: ctx + "common/deleteFile",
fileIdList:[],
dialogImageUrl: '',
dialogVisible: false
} }
function submitHandler() { },
if ($.validate.form()) { methods: {
var formData = $("#form-purchaseQuote-add").serializeArray(); handlePictureCardPreview(file) {
console.log("formData",formData); this.dialogImageUrl = file.url;
var tableData = $("#bootstrap-sub-table-purchaseQuoteChild").bootstrapTable('getData'); this.dialogVisible = true;
var rows = tableData.length; },
if(rows==0){ uploadSuccess(response, file, fileList) {
$.modal.msgError("子表数据不能为空!"); console.log(response);
if(response.code === web_status.SUCCESS){
var attachFileId = response.data.id;
file.attachFileId = attachFileId;
this.fileIdList.push(attachFileId);
$("#fileIdStr").val(this.fileIdList.join(";"));
$.modal.msgSuccess("上传成功");
}else{ }else{
formData.push({"name": "purchaseQuoteChildList", "value": tableData}); $.modal.alertError(response.msg);
var jsonData = $.common.formDataToJson(formData);
$.operate.saveJson(prefix + "/add", jsonData);
} }
},
uploadRemove(file, fileList) {
console.log(file, fileList);
var attachFileId = file.attachFileId;
$.ajax({
type: "get",
url: this.fileDeleteUrl,
data: {id:attachFileId},
cache: false,
async: false, // 设置成同步
dataType: 'json',
success: function(result) {
if (result.code === web_status.SUCCESS) {
var index = this.fileIdList.indexOf(attachFileId);
if(index!==-1){
this.fileIdList.splice(index,1);
$("#fileIdStr").val(this.fileIdList.join(";"));
}
$.modal.msgSuccess("删除附件成功。");
} else {
$.modal.alertError(result.msg);
}
},
error: function(error) {
$.modal.alertError("删除附件失败。");
} }
});
},
} }
});
//获取供应商 //获取供应商
function selectSupplier(){ function selectSupplier(){
$("select[name='supplierQuoteCode']").select2({ $('#selectSupplierQuoteCode').select2({
theme: "bootstrap", theme: "bootstrap",
allowClear: true, allowClear: true,
placeholder: "请选择供应商", placeholder: "请选择供应商",
@ -315,46 +316,41 @@
escapeMarkup: function (markup) {return markup;}, escapeMarkup: function (markup) {return markup;},
} }
}); });
$("select[name='supplierName']").select2({
theme: "bootstrap",
allowClear: true,
placeholder: "请选择供应商",
ajax: {
url: ctx + "system/supplier/getSupplier",
type: "post",
dataType: "json",
delay: 250,
processResults: function (res, params) {
var resultList = res.rows;
var options = [];
for (let i in resultList) {
var option = resultList[i];
option.id = resultList[i]["supplierName"];
option.text = resultList[i]["supplierName"];
options.push(option);
}
return {results: options,}
},
escapeMarkup: function (markup) {return markup;},
} }
}); $("#selectSupplierQuoteCode").on("select2:select",function (e) {
}
$("#form-purchaseQuote-add select[name='supplierQuoteCode']").on("select2:select",function (e) {
var dataObj = e.params.data;
console.log("codeData",dataObj);
$("#form-purchaseQuote-add select[name='supplierName']").val(dataObj.supplierName).trigger("change");
});
$("#form-purchaseQuote-add select[name='supplierName']").on("select2:select",function (e) {
var dataObj = e.params.data; var dataObj = e.params.data;
console.log("nameData",dataObj); console.log("dataObj",dataObj);
$("#form-purchaseQuote-add select[name='supplierQuoteCode']").val(dataObj.supplierCode).trigger("change"); $("input[name='supplierName']").val(dataObj.supplierName);
}); });
function submitHandler() {
if ($.validate.form()) {
var formData = $("#form-purchaseQuote-add").serializeArray();
console.log("formData",formData);
var tableData = $("#bootstrap-sub-table-purchaseQuoteChild").bootstrapTable('getData');
var rows = tableData.length;
if(rows === 0){
$.modal.msgError("子表数据不能为空!");
}else{
formData.push({"name": "purchaseQuoteChildList", "value": tableData});
var jsonData = $.common.formDataToJson(formData);
$.operate.saveJson(prefix + "/add", jsonData);
}
}
}
//获取供应商
$("input[name='pricingDate']").datetimepicker({ $("input[name='pricingDate']").datetimepicker({
format: "yyyy-mm-dd", format: "yyyy-mm-dd",
minView: "month", minView: "month",
autoclose: true todayBtn: true,
autoClose: true
}); });
/* 删除指定表格行 */
function removeRow(materialCode){
$("#bootstrap-sub-table-requisitionChild").bootstrapTable('remove', {
field: 'materialCode',
values: materialCode
})
}
</script> </script>
</body> </body>
</html> </html>

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

@ -20,13 +20,13 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">供应商ID:</label> <label class="col-sm-3 control-label">供应商ID:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select id="supplierCode" name="supplierQuoteCode" th:field="*{supplierQuoteCode}" class="form-control"></select> <input name="supplierQuoteCode" th:field="*{supplierQuoteCode}" class="form-control" />
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">供应商名称:</label> <label class="col-sm-3 control-label">供应商名称:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select name="supplierName" th:field="*{supplierName}" class="form-control"></select> <input name="supplierName" th:field="*{supplierName}" class="form-control">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -175,7 +175,7 @@
pageNum: params.offset / params.limit + 1, pageNum: params.offset / params.limit + 1,
sortName: params.sort, sortName: params.sort,
sortOrder: params.order, sortOrder: params.order,
purchaseQuoteCode: $("#purchaseQuoteCode_edit").val(), purchaseQuoteCode: purchaseQuote.purchaseQuoteCode,
} }
return temp; return temp;
}, },
@ -183,12 +183,6 @@
model: "物料报价信息", model: "物料报价信息",
columns: [ columns: [
{checkbox: true}, {checkbox: true},
{field: 'index',align: 'center', title: "序号",
formatter: function (value, row, index) {
var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
return columnIndex + $.table.serialNumber(index);
}
},
{title: '物料索引id',field: 'materialId',align: 'center',visible: false}, {title: '物料索引id',field: 'materialId',align: 'center',visible: false},
{title: '料号',field: 'materialCode',align: 'center'}, {title: '料号',field: 'materialCode',align: 'center'},
{title: '物料名称',field: 'materialName',align: 'center'}, {title: '物料名称',field: 'materialName',align: 'center'},
@ -226,16 +220,13 @@
{title: '操作', align: 'center', {title: '操作', align: 'center',
formatter: function (value, row, index) { formatter: function (value, row, index) {
var actions = []; var actions = [];
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.index + '\')"><i class="fa fa-remove"></i>删除</a> '); actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.materialCode + '\')"><i class="fa fa-remove"></i>删除</a> ');
return actions.join(''); return actions.join('');
} }
} }
], ],
}; };
$.table.init(options); $.table.init(options);
selectSupplier();
$("#form-purchaseQuote-edit select[name='supplierQuoteCode']").val(purchaseQuote.supplierQuoteCode).trigger("change");
$("#form-purchaseQuote-edit select[name='supplierName']").val(purchaseQuote.supplierName).trigger("change");
}); });
function doSubmit(index, layero,uniqueId){ function doSubmit(index, layero,uniqueId){
console.log(uniqueId); console.log(uniqueId);
@ -275,10 +266,10 @@
$.modal.openOptions(options); $.modal.openOptions(options);
} }
/* 删除指定表格行 */ /* 删除指定表格行 */
function removeRow(index){ function removeRow(materialCode){
$("#bootstrap-sub-table-purchaseQuoteChild").bootstrapTable('removeByUniqueId', { $("#bootstrap-sub-table-purchaseQuoteChild").bootstrapTable('remove', {
field: 'index', field: 'materialCode',
values: index values: materialCode
}) })
} }
function submitHandler() { function submitHandler() {
@ -296,75 +287,6 @@
} }
} }
} }
function selectSupplier(){
$("select[name='supplierQuoteCode']").select2({
theme: "bootstrap",
allowClear: true,
placeholder: "请选择供应商",
ajax: {
url: ctx + "system/supplier/getSupplier",
type: "post",
dataType: "json",
delay: 250,
processResults: function (res, params) {
var resultList = res.rows;
var options = [];
for (let i in resultList) {
var option = resultList[i];
option.id = resultList[i]["supplierCode"];
option.text = resultList[i]["supplierCode"];
option.title = resultList[i]["supplierName"];
options.push(option);
}
return {results: options,}
},
escapeMarkup: function (markup) {return markup;},
}
});
$("select[name='supplierName']").select2({
theme: "bootstrap",
allowClear: true,
placeholder: "请选择供应商",
ajax: {
url: ctx + "system/supplier/getSupplier",
type: "post",
dataType: "json",
delay: 250,
processResults: function (res, params) {
var resultList = res.rows;
var options = [];
for (let i in resultList) {
var option = resultList[i];
option.id = resultList[i]["supplierName"];
option.text = resultList[i]["supplierName"];
options.push(option);
}
return {results: options,}
},
escapeMarkup: function (markup) {return markup;},
}
});
}
$("#form-purchaseQuote-edit select[name='supplierQuoteCode']").on("select2:select",function (e) {
var dataObj = e.params.data;
console.log("codeData",dataObj);
$("#form-purchaseQuote-edit select[name='supplierName']").val(dataObj.supplierName).trigger("change");
});
$("#form-purchaseQuote-edit select[name='supplierName']").on("select2:select",function (e) {
var dataObj = e.params.data;
console.log("nameData",dataObj);
$("#form-purchaseQuote-edit select[name='supplierQuoteCode']").val(dataObj.supplierCode).trigger("change");
});
$("#form-purchaseQuote-edit select[name='supplierQuoteCode']").on("select2:select",function (e) {
var dataObj = e.params.data;
console.log("codeData",dataObj);
$("#form-purchaseQuote-edit select[name='supplierName']").val(dataObj.supplierName).trigger("change");
});
$("#form-purchaseQuote-edit select[name='supplierName']").on("select2:select",function (e) {
var dataObj = e.params.data;
console.log("nameData",dataObj);
$("#form-purchaseQuote-edit select[name='supplierQuoteCode']").val(dataObj.supplierCode).trigger("change");
});
$("input[name='pricingDate']").datetimepicker({ $("input[name='pricingDate']").datetimepicker({
format: "yyyy-mm-dd", format: "yyyy-mm-dd",
minView: "month", minView: "month",

Loading…
Cancel
Save