Browse Source

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

dev
zhangsiqi 4 months ago
parent
commit
b4c6ee579b
  1. 47
      ruoyi-admin/src/main/java/com/ruoyi/sales/controller/SalesEstimateController.java
  2. 17
      ruoyi-admin/src/main/java/com/ruoyi/sales/domain/SalesEstimate.java
  3. 9
      ruoyi-admin/src/main/java/com/ruoyi/sales/mapper/SalesEstimateDetailMapper.java
  4. 8
      ruoyi-admin/src/main/java/com/ruoyi/sales/mapper/SalesEstimateMapper.java
  5. 30
      ruoyi-admin/src/main/java/com/ruoyi/sales/service/impl/SalesEstimateServiceImpl.java
  6. 29
      ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomer.java
  7. 18
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java
  8. 81
      ruoyi-admin/src/main/resources/mapper/sales/SalesEstimateDetailMapper.xml
  9. 52
      ruoyi-admin/src/main/resources/mapper/sales/SalesEstimateMapper.xml
  10. 18
      ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml
  11. 412
      ruoyi-admin/src/main/resources/templates/sales/estimate/add.html
  12. 102
      ruoyi-admin/src/main/resources/templates/sales/estimate/estimateMaterialSelect.html
  13. 70
      ruoyi-admin/src/main/resources/templates/system/customer/add.html

47
ruoyi-admin/src/main/java/com/ruoyi/sales/controller/SalesEstimateController.java

@ -1,15 +1,16 @@
package com.ruoyi.sales.controller;
import java.util.List;
import com.ruoyi.erp.domain.ErpMaterialVo;
import com.ruoyi.erp.service.IErpMaterialService;
import com.ruoyi.system.domain.SysMakeOrder;
import com.ruoyi.system.domain.SysSalesOrderChild;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.sales.domain.SalesEstimate;
@ -34,6 +35,9 @@ public class SalesEstimateController extends BaseController
@Autowired
private ISalesEstimateService salesEstimateService;
@Autowired
private IErpMaterialService materialService;
@RequiresPermissions("sales:estimate:view")
@GetMapping()
public String estimate()
@ -69,7 +73,7 @@ public class SalesEstimateController extends BaseController
}
/**
* 新增销售估价
* 新增销售估价-业务
*/
@GetMapping("/add")
public String add()
@ -78,17 +82,44 @@ public class SalesEstimateController extends BaseController
}
/**
* 新增保存销售估价
* 新增保存销售估价-业务
*/
@RequiresPermissions("sales:estimate:add")
@Log(title = "销售估价", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(SalesEstimate salesEstimate)
public AjaxResult addSave(@RequestBody SalesEstimate salesEstimate)
{
return toAjax(salesEstimateService.insertSalesEstimate(salesEstimate));
}
/**
* 加载新增销售估价 物料选择弹窗
*/
@GetMapping("/estimateMaterialSelect")
public String estimateMaterialSelect()
{
return prefix + "/estimateMaterialSelect";
}
/**
* 新增销售估价 物料选择
*/
@ResponseBody
@PostMapping("/getEstimateMaterialList")
public TableDataInfo getEstimateMaterialList( )
{
startPage();
List<ErpMaterialVo> erpMaterialVos = materialService.selectAllErpMaterialList();
return getDataTable(erpMaterialVos);
}
/**
* 修改销售估价
*/

17
ruoyi-admin/src/main/java/com/ruoyi/sales/domain/SalesEstimate.java

@ -2,6 +2,8 @@ package com.ruoyi.sales.domain;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -88,8 +90,14 @@ public class SalesEstimate extends BaseEntity
private BigDecimal allNoTaxDollar;
/** 定价日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "定价日期")
private Date pricingDate;
/** 销售估价详情集合 */
private List<SalesEstimateDetail> salesEstimateDetailList;
public void setSalesEstimateId(Long salesEstimateId)
{
this.salesEstimateId = salesEstimateId;
@ -271,6 +279,14 @@ public class SalesEstimate extends BaseEntity
return pricingDate;
}
public List<SalesEstimateDetail> getSalesEstimateDetailList() {
return salesEstimateDetailList;
}
public void setSalesEstimateDetailList(List<SalesEstimateDetail> salesEstimateDetailList) {
this.salesEstimateDetailList = salesEstimateDetailList;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -299,6 +315,7 @@ public class SalesEstimate extends BaseEntity
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("salesEstimateDetailList", getSalesEstimateDetailList())
.toString();
}
}

9
ruoyi-admin/src/main/java/com/ruoyi/sales/mapper/SalesEstimateDetailMapper.java

@ -35,6 +35,15 @@ public interface SalesEstimateDetailMapper
*/
public int insertSalesEstimateDetail(SalesEstimateDetail salesEstimateDetail);
/**
* 批量新增销售估价详情
*
* @param salesEstimateDetails 销售估价详情集合
* @return 结果
*/
public int batchInsertSalesEstimateDetails(List<SalesEstimateDetail> salesEstimateDetails);
/**
* 修改销售估价详情
*

8
ruoyi-admin/src/main/java/com/ruoyi/sales/mapper/SalesEstimateMapper.java

@ -35,6 +35,14 @@ public interface SalesEstimateMapper
*/
public int insertSalesEstimate(SalesEstimate salesEstimate);
/**
* 批量新增销售估价
*
* @param salesEstimates 销售估价集合
* @return 结果
*/
public int batchInsertSalesEstimates(List<SalesEstimate> salesEstimates);
/**
* 修改销售估价
*

30
ruoyi-admin/src/main/java/com/ruoyi/sales/service/impl/SalesEstimateServiceImpl.java

@ -1,8 +1,13 @@
package com.ruoyi.sales.service.impl;
import java.util.Date;
import java.util.List;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.sales.domain.SalesEstimateDetail;
import com.ruoyi.sales.mapper.SalesEstimateDetailMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.sales.mapper.SalesEstimateMapper;
@ -22,6 +27,12 @@ public class SalesEstimateServiceImpl implements ISalesEstimateService
@Autowired
private SalesEstimateMapper salesEstimateMapper;
@Autowired
private SalesEstimateDetailMapper salesEstimateDetailMapper;
@Autowired
private RedisCache redisCache;
/**
* 查询销售估价
*
@ -56,8 +67,25 @@ public class SalesEstimateServiceImpl implements ISalesEstimateService
public int insertSalesEstimate(SalesEstimate salesEstimate)
{
String loginName = ShiroUtils.getLoginName();
String salesEstimateCode = redisCache.generateBillNo("GJ");
salesEstimate.setCreateBy(loginName);
salesEstimate.setCreateTime(DateUtils.getNowDate());
salesEstimate.setCreateTime(new Date());
salesEstimate.setSalesEstimateCode(salesEstimateCode);
List<SalesEstimateDetail> salesEstimateDetailList = salesEstimate.getSalesEstimateDetailList();
if (salesEstimateDetailList != null && salesEstimateDetailList.size() > 0) {
for (SalesEstimateDetail salesEstimateDetail : salesEstimateDetailList) {
salesEstimateDetail.setSalesEstimateCode(salesEstimateCode);
salesEstimateDetail.setCreateBy(loginName);
salesEstimateDetail.setCreateTime(new Date());
}
salesEstimateDetailMapper.batchInsertSalesEstimateDetails(salesEstimateDetailList);
}
return salesEstimateMapper.insertSalesEstimate(salesEstimate);
}

29
ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomer.java

@ -169,6 +169,35 @@ public class SysCustomer extends BaseEntity
@Excel(name = "客户标识 0表示潜在客户(仅报价) 1表示 客户(已下单)")
private String customerSign;
private List<String> currency;
private String rmbFlag;
private String usdFlag;
public List<String> getCurrency() {
return currency;
}
public void setCurrency(List<String> currency) {
this.currency = currency;
}
public String getRmbFlag() {
return rmbFlag;
}
public void setRmbFlag(String rmbFlag) {
this.rmbFlag = rmbFlag;
}
public String getUsdFlag() {
return usdFlag;
}
public void setUsdFlag(String usdFlag) {
this.usdFlag = usdFlag;
}
/** 流程实例ID */
private String instanceId;

18
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java

@ -161,6 +161,13 @@ public class SysCustomerServiceImpl implements ISysCustomerService
sysCustomer.setCreateBy(loginName);
sysCustomer.setCreateTime(DateUtils.getNowDate());
SysContacts sysContacts = new SysContacts();
List<String> currency = sysCustomer.getCurrency();
if(currency.contains("1")){
sysCustomer.setRmbFlag("1");
}
if(currency.contains("2")){
sysCustomer.setUsdFlag("1");
}
//添加联系人
// sysContacts.setCustomerName(sysCustomer.getCustomerContact());
// sysContacts.setCellPhone(sysCustomer.getContactNumber());
@ -208,6 +215,17 @@ public class SysCustomerServiceImpl implements ISysCustomerService
String loginName = ShiroUtils.getLoginName();
sysCustomerVo.setUpdateBy(loginName);
sysCustomerVo.setUpdateTime(DateUtils.getNowDate());
// List<String> currency = sysCustomerVo.getCurrency();
// if(currency.contains("1")){
// sysCustomerVo.setRmbFlag("1");
// }else {
// sysCustomerVo.setRmbFlag("0");
// }
// if(currency.contains("2")){
// sysCustomerVo.setUsdFlag("1");
// }else {
// sysCustomerVo.setUsdFlag("0");
// }
return sysCustomerMapper.updateSysCustomer(sysCustomerVo);
}

81
ruoyi-admin/src/main/resources/mapper/sales/SalesEstimateDetailMapper.xml

@ -139,6 +139,87 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
</insert>
<insert id="batchInsertSalesEstimateDetails" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="estimateDetailId">
INSERT INTO sales_estimate_detail
(
sales_estimate_code,
material_gear_position,
usd_rate,
profit_rate,
material_no,
material_name,
material_type,
material_photo_url,
material_unit,
material_brand,
material_describe,
material_process_method,
material_num,
no_tax_rmb,
tax_rmb,
all_no_tax_rmb,
all_tax_rmb,
tax_dollar,
no_tax_dollar,
all_tax_dollar,
all_no_tax_dollar,
no_tax_shipping_costs,
no_tax_service_costs,
no_tax_develop_costs,
no_tax_labor_costs,
no_tax_promotional_costs,
no_tax_business_costs,
no_tax_manages_costs,
no_tax_material_costs,
no_tax_operating_costs,
tax_operating_costs,
create_by,
create_time
)
VALUES
<foreach collection="list" item="item" index="index" open="(" close=")" separator="),(">
#{item.salesEstimateCode},
#{item.materialGearPosition},
#{item.usdRate},
#{item.profitRate},
#{item.materialNo},
#{item.materialName},
#{item.materialType},
#{item.materialPhotoUrl},
#{item.materialUnit},
#{item.materialBrand},
#{item.materialDescribe},
#{item.materialProcessMethod},
#{item.materialNum},
#{item.noTaxRmb},
#{item.taxRmb},
#{item.allNoTaxRmb},
#{item.allTaxRmb},
#{item.taxDollar},
#{item.noTaxDollar},
#{item.allTaxDollar},
#{item.allNoTaxDollar},
#{item.noTaxShippingCosts},
#{item.noTaxServiceCosts},
#{item.noTaxDevelopCosts},
#{item.noTaxLaborCosts},
#{item.noTaxPromotionalCosts},
#{item.noTaxBusinessCosts},
#{item.noTaxManagesCosts},
#{item.noTaxMaterialCosts},
#{item.noTaxOperatingCosts},
#{item.taxOperatingCosts},
#{item.createBy},
#{item.createTime}
</foreach>
</insert>
<update id="updateSalesEstimateDetail" parameterType="SalesEstimateDetail">
update sales_estimate_detail
<trim prefix="SET" suffixOverrides=",">

52
ruoyi-admin/src/main/resources/mapper/sales/SalesEstimateMapper.xml

@ -109,6 +109,58 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
</insert>
<insert id="batchInsertSalesEstimates" parameterType="SalesEstimate" useGeneratedKeys="true" keyProperty="salesEstimateId">
INSERT INTO sales_estimate
(
sales_estimate_code,
business_members,
estimate_status,
enterprise_code,
enterprise_name,
material_sum,
enterprise_sum,
common_currency,
usd_rate,
no_tax_rmb,
tax_rmb,
all_no_tax_rmb,
all_tax_rmb,
tax_dollar,
no_tax_dollar,
all_tax_dollar,
all_no_tax_dollar,
pricing_date,
create_by,
create_time,
remark
)
VALUES
<foreach collection="list" item="item" index="index" open="(" close=")" separator="),(">
#{item.salesEstimateCode},
#{item.businessMembers},
#{item.estimateStatus},
#{item.enterpriseCode},
#{item.enterpriseName},
#{item.materialSum},
#{item.enterpriseSum},
#{item.commonCurrency},
#{item.usdRate},
#{item.noTaxRmb},
#{item.taxRmb},
#{item.allNoTaxRmb},
#{item.allTaxRmb},
#{item.taxDollar},
#{item.noTaxDollar},
#{item.allTaxDollar},
#{item.allNoTaxDollar},
#{item.pricingDate},
#{item.createBy},
#{item.createTime},
#{item.remark}
</foreach>
</insert>
<update id="updateSalesEstimate" parameterType="SalesEstimate">
update sales_estimate
<trim prefix="SET" suffixOverrides=",">

18
ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml

@ -60,6 +60,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="applyUser" column="apply_user" />
<result property="applyTime" column="apply_time" />
<result property="createTime" column="create_time" />
<result property="rmbFlag" column="rmb_flag" />
<result property="usdFlag" column="usd_flag" />
</resultMap>
<sql id="selectSysCustomerVo">
select id,enterprise_code,enterprise_name,english_name,customer_abbreviation ,customer_purser ,
@ -69,7 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
customer_contact_id,customer_contact,customer_office,contact_number,customer_email,customer_fax,
delivery_address_id,delivery_customer_person,delivery_customer_phone,
delivery_address,delivery_customer_postal,delivery_customer_fax,business_members,
identifying_people,first_add_time,update_info_time, create_time ,audit_status,use_status,update_by,
identifying_people,first_add_time,update_info_time, create_time ,audit_status,use_status,update_by,rmb_flag,usd_flag,
apply_user,apply_time , instance_id , instance_type from sys_customer
</sql>
@ -80,7 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
common_currency,confirm_tax,tax_rate,integrity_rating,rmb_registered_capital,registered_capital,payment_terms,customs_code,
customer_contact_id,customer_contact,customer_office,contact_number,customer_email,customer_fax,
delivery_address_id,delivery_customer_person,delivery_customer_phone,
delivery_address,delivery_customer_postal,delivery_customer_fax,business_members,
delivery_address,delivery_customer_postal,delivery_customer_fax,business_members,rmb_flag,usd_flag,
identifying_people,first_add_time,update_info_time,audit_status,use_status, create_time from
sys_customer
<where>
@ -98,7 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
s.customer_fax,s.delivery_address_id,s.delivery_customer_person,s.delivery_customer_phone,s.delivery_address,
s.delivery_customer_postal,s.delivery_customer_fax,s.business_members,s.identifying_people,s.first_add_time,
s.update_info_time,s.audit_status,s.use_status,s.update_by,s.instance_id, s.instance_type,p.dict_value as instance_type_name,
s.submit_instance_id, s.cancel_instance_id, s.restore_instance_id, s.apply_title, s.apply_user, s.apply_time ,s.create_time
s.submit_instance_id, s.cancel_instance_id, s.restore_instance_id, s.apply_title, s.apply_user, s.apply_time ,s.create_time,s.rmb_flag,s.usd_flag
from sys_customer as s
left join(
select dict_value,dict_label from sys_dict_data where dict_type = 'processType'
@ -205,7 +207,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="applyTime != null">apply_time,</if>
<if test="useStatus != null">use_status,</if>
<if test="auditStatus != null">audit_status,</if>
<if test="createTime != null">create_time</if>
<if test="createTime != null">create_time,</if>
<if test="rmbFlag != null">rmb_flag,</if>
<if test="usdFlag != null">usd_flag</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="enterpriseCode!=null and enterpriseCode != ''">#{enterpriseCode},</if>
@ -257,7 +261,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="applyTime != null">#{applyTime},</if>
<if test="useStatus != null"> #{useStatus},</if>
<if test="auditStatus != null"> #{auditStatus},</if>
<if test="createTime != null"> #{createTime} </if>
<if test="createTime != null"> #{createTime},</if>
<if test="rmbFlag != null"> #{rmbFlag},</if>
<if test="usdFlag != null"> #{usdFlag} </if>
</trim>
</insert>
@ -315,6 +321,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="applyTitle != null">apply_title = #{applyTitle},</if>
<if test="applyUser != null">apply_user = #{applyUser},</if>
<if test="applyTime != null">apply_time = #{applyTime},</if>
<if test="rmbFlag != null">rmb_flag = #{rmbFlag},</if>
<if test="usdFlag != null">usd_flag = #{usdFlag} </if>
</trim>
where id = #{id}
</update>

412
ruoyi-admin/src/main/resources/templates/sales/estimate/add.html

@ -8,128 +8,55 @@
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-estimate-add">
<div class="form-group">
<label class="col-sm-3 control-label">估价单号:</label>
<div class="col-sm-8">
<input name="salesEstimateCode" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">用户ID:</label>
<div class="col-sm-8">
<input name="userId" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">业务人员:</label>
<label class="col-sm-4 control-label">业务员:</label>
<div class="col-sm-8">
<input name="businessMembers" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">估价状态</label>
<div class="form-group">
<label class="col-sm-4 control-label">定价日期:</label>
<div class="col-sm-8">
<select name="estimateStatus" class="form-control m-b" th:with="type=${@dict.getType('estimate_status')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">客户代码id:</label>
<div class="col-sm-8">
<input name="enterpriseCode" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">客户名称:</label>
<div class="col-sm-8">
<input name="enterpriseName" class="form-control" type="text">
<div class="input-group date">
<input name="pricingDate" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">物料合计</label>
<div class="form-group">
<label class="col-sm-4 control-label is-required">客户ID:</label>
<div class="col-sm-8">
<input name="materialSum" class="form-control" type="text">
<select class="form-control" id="enterpriseCode" name="enterpriseCode" required>
<!-- 这里动态生成客户编号选项 -->
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">数量合计</label>
<div class="form-group">
<label class="col-sm-4 control-label is-required">客户名称</label>
<div class="col-sm-8">
<input name="enterpriseSum" class="form-control" type="text">
<input name="enterpriseName" class="form-control" type="text" readonly required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">估价币种:</label>
<label class="col-sm-4 control-label is-required">估价币种:</label>
<div class="col-sm-8">
<select name="commonCurrency" class="form-control m-b" th:with="type=${@dict.getType('sys_common_currency')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" required></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">美元汇率:</label>
<div class="col-sm-8">
<input name="usdRate" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">不含税单价:</label>
<div class="col-sm-8">
<input name="noTaxRmb" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">含税单价:</label>
<div class="col-sm-8">
<input name="taxRmb" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">不含税总价:</label>
<div class="col-sm-8">
<input name="allNoTaxRmb" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">含税总价:</label>
<div class="col-sm-8">
<input name="allTaxRmb" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">含税单价:</label>
<label class="col-sm-4 control-label is-required">美元汇率:</label>
<div class="col-sm-8">
<input name="taxDollar" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">不含税单价:</label>
<div class="col-sm-8">
<input name="noTaxDollar" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">含税总价:</label>
<div class="col-sm-8">
<input name="allTaxDollar" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">不含税总价:</label>
<div class="col-sm-8">
<input name="allNoTaxDollar" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">定价日期:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="pricingDate" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<div class="input-group">
<input name="usdRate" class="form-control" type="text" required>
<span class="input-group-addon">%</span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注信息:</label>
<label class="col-sm-4 control-label">备注信息:</label>
<div class="col-sm-8">
<input name="remark" class="form-control" type="text">
</div>
@ -175,22 +102,76 @@
</div>
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-sub-table-order"></table>
<table id="bootstrap-table"></table>
</div>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include::bootstrap-table-editable-js"/>
<script th:inline="javascript">
var prefix = ctx + "sales/estimate"
var materialGearPositionDatas = [[${@dict.getType('material_gear_position')}]];
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
var processMethodDatas = [[${@dict.getType('processMethod')}]];
$("#form-estimate-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-estimate-add').serialize());
// 获取表单数据
const estimateData = $("#form-estimate-add").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
// 销售估价物料
var estimateMaterialTable = $('#bootstrap-table').bootstrapTable('getData');
// 将表数据转换成与estimateData格式一致的数组
var estimateMaterialDataList = estimateMaterialTable.map(function(item) {
// 根据实际字段名调整
return {
"materialNo": item.materialNo,
"materialName": item.materialName,
"materialType": item.materialType,
"materialPhotourl": item.materialPhotourl,
"materialDescribe": item.materialDescribe,
"materialBrand": item.materialBrand,
"materialUnit": item.materialUnit,
"materialProcessMethod": item.materialProcessMethod,
"materialGearPosition": item.materialGearPosition,
"materialNum":item.materialNum,
"noTaxRmb": item.noTaxRmb,
"taxRmb": item.taxRmb,
"allNoTaxRmb": item.allNoTaxRmb,
"allTaxRmb": item.allTaxRmb,
"noTaxDollar": item.noTaxDollar,
"taxDollar": item.taxDollar,
"allNoTaxDollar": item.allNoTaxDollar,
"allTaxDollar": item.allTaxDollar,
"warehouseDept": item.warehouseDept,
// ...其他字段
};
});
const combinedData = Object.assign({}, estimateData, {
salesEstimateDetailList: estimateMaterialDataList,
});
// 合并表单数据和表格数据
console.log(combinedData)
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/add", jsonData);
}
}
@ -202,8 +183,241 @@
// 点击选择物料按钮
function insertMaterialRow() {
var url = prefix + '/estimateMaterialSelect';
var options = {
title: '选择物料',
url: url,
callBack: estimateDoSubmit
};
$.modal.openOptions(options);
}
$(function() {
var options = {
modalName: "销售估价详情",
columns: [{
checkbox: true
},
{
title: '销售估价详情ID',
field: 'estimateDetailId',
visible: false
},
{
title: '料号',
field: 'materialNo',
},
{
title: '物料名称',
field: 'materialName',
},
{
title: '物料类型',
field: 'materialType',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
},
{
title: '图片地址',
field: 'materialPhotoUrl',
},
{
title: '物料单位',
field: 'materialUnit',
},
{
title: '物料品牌',
field: 'materialBrand',
},
{
title: '物料描述',
field: 'materialDescribe',
},
{
title: '加工方式',
field: 'materialProcessMethod',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
},
{
title: '料号档位',
field: 'materialGearPosition',
formatter: function(value, row, index) {
return $.table.selectDictLabel(materialGearPositionDatas, value);
}
},
{
title: '物料数量',
field: 'materialNum',
editable: true,
},
{
title: '不含税单价',
field: 'noTaxRmb',
},
{
title: '含税单价',
field: 'taxRmb',
},
{
title: '不含税总价',
field: 'allNoTaxRmb',
},
{
title: '含税总价',
field: 'allTaxRmb',
},
{
title: '含税单价',
field: 'taxDollar',
},
{
title: '不含税单价',
field: 'noTaxDollar',
},
{
title: '含税总价',
field: 'allTaxDollar',
},
{
title: '不含税总价',
field: 'allNoTaxDollar',
},
{
title: '入库部门',
field: 'warehouseDept',
visible:false
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeMaterialRow(\'' + row.materialNo + '\')"><i class="fa fa-remove"></i>删除</a> ');
return actions.join('');
}
}]
};
$.table.init(options);
});
function estimateDoSubmit(index, layero,uniqueId){
console.log(uniqueId);
var iframeWin = window[layero.find('iframe')[0]['name']];
var rowData = iframeWin.$('#bootstrap-estimateMaterialSelect-table').bootstrapTable('getSelections')[0];
//判断是否重复
var rows = $("#bootstrap-table").bootstrapTable('getData').length;
for(var i=0;i<rows;i++){
var data = $("#bootstrap-table").bootstrapTable('getData')[i];
if(data.materialNo == rowData.materialCode){
$.modal.alertError("不能选择已添加过的相同物料");
return;
}
}
console.log("rowData: "+rowData);
$("#bootstrap-table").bootstrapTable('insertRow', {
index:1,
row: {
materialNo:rowData.materialCode,
materialPhotourl:rowData.photoUrl,
materialName: rowData.materialName,
materialType: rowData.materialType,
materialDescribe: rowData.describe,
materialBrand: rowData.brand,
materialUnit: rowData.unit,
materialProcessMethod: rowData.processMethod,
materialDeptType: rowData.warehouseDept,
}
})
layer.close(index);
}
// 逻辑删除前端的一行数据
function removeMaterialRow(materialNo){
$("#bootstrap-table").bootstrapTable('remove', {
field: 'materialNo',
values: materialNo
})
}
// 假设的加载客户编号列表函数
function loadCustomerIds() {
var url = ctx + 'system/customer/getCustomers';
$.ajax({
type: 'GET', // 请求类型
url: url, // 后端接口URL
dataType: 'json', // 预期服务器返回的数据类型
success: function(data) {
if (data && Array.isArray(data)) {
var selectElement = $('#enterpriseCode'); // 获取客户编号下拉框元素
// 清空下拉框现有选项
selectElement.empty();
// 添加默认选项(如果需要)
selectElement.append('<option value="">请选择客户编号</option>');
// 遍历返回的数据,添加为下拉框的选项
$.each(data, function(index, item) {
// 假设item有id和name两个属性,分别代表客户ID和客户编号
selectElement.append('<option value="' + item.customerId + '">' + item.customerId + '</option>');
});
} else {
$.modal.errMsg("数据为空");
}
},
// error: function(jqXHR, textStatus, errorThrown) {
// console.error('Failed to fetch customer IDs: ' + textStatus + ', ' + errorThrown);
// }
});
}
//获取客户信息
$(document).ready(function() {
// 初始化时默认加载客户编号列表
loadCustomerIds();
// 监听客户编号下拉框的变化
$('#enterpriseCode').on('change', function() {
var selectedEnterpriseCode = $(this).val(); // 获取选中的客户ID
if (selectedEnterpriseCode) {
// 发起Ajax请求获取客户名称
$.ajax({
type: 'GET',
url: ctx +'system/customer/getCustomerNameByEnterpriseCode/' + selectedEnterpriseCode, // 替换为你的实际API路径
dataType: 'json', // 假设返回的数据格式是JSON
success: function(data) {
console.log(data);
// 将获取到的客户名称填充到输入框
if(data.data == null){
// 如果返回的数据有问题,可以给出提示或处理
$.modal.msgError("未能获取到客户名称!");
}
$('input[name="enterpriseName"]').val(data.data.customerName);
},
error: function(jqXHR, textStatus, errorThrown) {
console.error('Error:', textStatus, errorThrown);
$.modal.msgError("查询客户名称时发生错误!");
}
});
} else {
// 如果没有选择客户ID,清空客户名称输入框
$('input[name="enterpriseName"]').val('');
}
});
});
</script>
</body>

102
ruoyi-admin/src/main/resources/templates/sales/estimate/estimateMaterialSelect.html

@ -0,0 +1,102 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('选择物料信息列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>料号:</label>
<input type="text" name="materialNo"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-estimateMaterialSelect-table"></table>
</div>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "sales/estimate";
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
var processMethodDatas = [[${@dict.getType('processMethod')}]];
$(function() {
var options = {
id: 'bootstrap-estimateMaterialSelect-table',
showSearch: false,
showRefresh: false,
showToggle: false,
clickToSelect: true, // 点击选中行
singleSelect: true, // 单选
url: prefix + "/getEstimateMaterialList",
modalName: "物料信息",
columns: [{
checkbox: true
},
{
title: '料号',
field: 'materialNo',
},
{
title: '图片',
field: 'materialPhotourl',
},
{
title: '物料名称',
field: 'materialName',
},
{
title: '物料类型',
field: 'materialType',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
},
{
title: '描述',
field: 'describe',
},
{
title: '品牌',
field: 'brand',
},
{
title: '单位',
field: 'unit',
},
{
title: '加工方式',
field: 'processMethod',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
},
{
title: '入库部门',
field: 'warehouseDept',
visible:false
}
]
};
$.table.init(options);
});
</script>
</body>
</html>

70
ruoyi-admin/src/main/resources/templates/system/customer/add.html

@ -117,9 +117,19 @@
<div class="form-group">
<label class="col-sm-6 control-label is-required">报价币种:</label>
<div class="col-sm-6">
<div class="radio-box" th:each="dict : ${@dict.getType('sys_common_currency')}">
<input required type="radio" th:id="${'commonCurrency_' + dict.dictCode}" name="commonCurrency" th:value="${dict.dictValue}" th:checked="${dict.default}">
<label th:for="${'commonCurrency_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
<!-- <div class="radio-box" th:each="dict : ${@dict.getType('sys_common_currency')}">-->
<!-- <input required type="radio" th:id="${'commonCurrency_' + dict.dictCode}" name="commonCurrency" th:value="${dict.dictValue}" th:checked="${dict.default}">-->
<!-- <label th:for="${'commonCurrency_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>-->
<!-- </div>-->
<div class="checkbox">
<label>
<input type="checkbox" id="rmb" name="currency" value="1" /> rmb/含税
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="usd" name="currency" value="2" /> 美元/不含税
</label>
</div>
</div>
</div>
@ -133,17 +143,17 @@
</div>
<!-- <div class="form-group">-->
<!-- <label class="col-sm-6 control-label is-required">是否含税:</label>-->
<!-- <div class="col-sm-6">-->
<!-- <div class="radio-box" th:each="dict : ${@dict.getType('sys_confirm_tax')}">-->
<!-- <input required type="radio" th:id="${'confirmTax_' + dict.dictCode}" name="confirmTax" th:value="${dict.dictValue}" th:checked="${dict.default}">-->
<!-- <label th:for="${'confirmTax_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="col-sm-6 control-label is-required">是否含税:</label>
<div class="col-sm-6">
<div class="radio-box" th:each="dict : ${@dict.getType('sys_confirm_tax')}">
<input required type="radio" th:id="${'confirmTax_' + dict.dictCode}" name="confirmTax" th:value="${dict.dictValue}" th:checked="${dict.default}">
<label th:for="${'confirmTax_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-6 control-label is-required" >国内税率:</label>
<label class="col-sm-6 control-label is-required" id="taxLable">国内税率:</label>
<div class="col-sm-6">
<input name="taxRate" class="form-control" placeholder="%" type="text" required/>
</div>
@ -282,12 +292,31 @@
$("select[name='businessMembers']").append("<option value='" + loginName + "'>" + userName + "</option>");
//验证是否含税,含税的话税率要填写。
function isTaxRate() {
if ($("#confirmTax").val() == 1) {
if ($('input[value=1]:checked').length > 0) {
console.log('选框 1 已经被选中');
return true;
} else {
} else {
return false;
}
}
// 监听 change 事件
$('input[name=currency]').on('change', function() {
var taxLable = $('#taxLable')[0];
var oldClass = taxLable.className.split(' ');
if ($('input[value=1]:checked').length > 0){
// $('input[name=taxRate]').prop('required',true);
if (!oldClass.includes('is-required')) {
taxLable.classList.add('is-required');
}
}else{
// $('input[name=taxRate]').prop('required',false);
for (var i = 0; i < oldClass.length; i++) {
if (oldClass[i].includes('is-required')) {
taxLable.classList.remove(oldClass[i]);
}
}
}
});
$("input[name='establishedTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
@ -304,9 +333,15 @@
required: true,
},
taxRate: {
required: isTaxRate(),
required: function () {
if ($('input[value=1]:checked').length > 0) {
console.log('选框 1 已经被选中');
return true;
} else {
return false;
}
},
}
},
// 验证失败的提示信息
messages: {
@ -322,6 +357,7 @@
function submitHandler() {
if ($.validate.form()) {
$("select[name='businessMembers']").removeAttr("disabled");
console.log( $('#form-customer-add').serialize());
$.operate.save(prefix + "/add", $('#form-customer-add').serialize());
}
}

Loading…
Cancel
Save