Browse Source

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

dev
zhangsiqi 4 months ago
parent
commit
e714992525
  1. 75
      ruoyi-admin/src/main/java/com/ruoyi/sales/controller/SalesEstimateController.java
  2. 197
      ruoyi-admin/src/main/java/com/ruoyi/sales/domain/SalesEstimateTemplate.java
  3. 28
      ruoyi-admin/src/main/java/com/ruoyi/sales/domain/VO/SalesEstimateDetailVo.java
  4. 85
      ruoyi-admin/src/main/java/com/ruoyi/sales/mapper/SalesEstimateTemplateMapper.java
  5. 8
      ruoyi-admin/src/main/java/com/ruoyi/sales/service/ISalesEstimateService.java
  6. 82
      ruoyi-admin/src/main/java/com/ruoyi/sales/service/ISalesEstimateTemplateService.java
  7. 43
      ruoyi-admin/src/main/java/com/ruoyi/sales/service/impl/SalesEstimateServiceImpl.java
  8. 139
      ruoyi-admin/src/main/java/com/ruoyi/sales/service/impl/SalesEstimateTemplateServiceImpl.java
  9. 16
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerController.java
  10. 24
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java
  11. 128
      ruoyi-admin/src/main/resources/mapper/sales/SalesEstimateTemplateMapper.xml
  12. 194
      ruoyi-admin/src/main/resources/templates/sales/estimate/add.html
  13. 159
      ruoyi-admin/src/main/resources/templates/sales/estimate/addOperatingCostTemplate.html
  14. 518
      ruoyi-admin/src/main/resources/templates/sales/estimate/engineeringAdd.html
  15. 21
      ruoyi-admin/src/main/resources/templates/sales/estimate/estimate.html
  16. 52
      ruoyi-admin/src/main/resources/templates/system/customer/detail.html
  17. 80
      ruoyi-admin/src/main/resources/templates/system/customer/edit.html
  18. 71
      ruoyi-admin/src/main/resources/templates/system/empRequisiteOrder/add.html
  19. 89
      ruoyi-admin/src/main/resources/templates/system/salesOrder/edit.html
  20. 4
      ruoyi-admin/src/main/resources/templates/system/salesOrder/taskYwjlVerify.html
  21. 4
      ruoyi-admin/src/main/resources/templates/system/salesOrder/taskYwzgVerify.html
  22. 4
      ruoyi-admin/src/main/resources/templates/system/salesOrder/taskZozjVerify.html

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

@ -4,12 +4,16 @@ import java.util.List;
import com.ruoyi.erp.domain.ErpMaterialVo;
import com.ruoyi.erp.service.IErpMaterialService;
import com.ruoyi.sales.domain.SalesEstimateTemplate;
import com.ruoyi.sales.domain.VO.SalesEstimateDetailVo;
import com.ruoyi.sales.service.ISalesEstimateTemplateService;
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.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
@ -38,6 +42,9 @@ public class SalesEstimateController extends BaseController
@Autowired
private IErpMaterialService materialService;
@Autowired
private ISalesEstimateTemplateService estimateTemplateService;
@RequiresPermissions("sales:estimate:view")
@GetMapping()
public String estimate()
@ -76,8 +83,10 @@ public class SalesEstimateController extends BaseController
* 新增销售估价-业务
*/
@GetMapping("/add")
public String add()
public String add(ModelMap map)
{
SalesEstimateDetailVo salesEstimateDetailVo = salesEstimateService.getSalesEstimateDetailVo();
map.put("salesEstimateDetailVo",salesEstimateDetailVo);
return prefix + "/add";
}
@ -96,6 +105,32 @@ public class SalesEstimateController extends BaseController
/**
* 新增Bom销售估价-工程
*/
@GetMapping("/engineeringAdd/{salesEstimateId}")
public String engineeringAdd(@PathVariable("salesEstimateId") Long salesEstimateId, ModelMap map)
{
SalesEstimate salesEstimate = salesEstimateService.selectSalesEstimateById(salesEstimateId);
map.put("salesEstimate", salesEstimate);
SalesEstimateDetailVo salesEstimateDetailVo = salesEstimateService.getSalesEstimateDetailVo();
map.put("salesEstimateDetailVo",salesEstimateDetailVo);
return prefix + "/engineeringAdd";
}
/**
* 新增保存Bom销售估价-工程
*/
@RequiresPermissions("sales:estimate:engineeringAdd")
@Log(title = "销售估价", businessType = BusinessType.INSERT)
@PostMapping("/engineeringAdd")
@ResponseBody
public AjaxResult engineeringAddSave(@RequestBody SalesEstimate salesEstimate)
{
return toAjax(salesEstimateService.insertSalesEstimate(salesEstimate));
}
/**
* 加载新增销售估价 物料选择弹窗
@ -143,6 +178,44 @@ public class SalesEstimateController extends BaseController
return toAjax(salesEstimateService.updateSalesEstimate(salesEstimate));
}
/**
* 加载销售估价经营成本模板弹窗
*/
@GetMapping("/addOperatingCostTemplate")
public String addTemplate(ModelMap map)
{
SalesEstimateTemplate salesEstimateTemplate = new SalesEstimateTemplate();
List<SalesEstimateTemplate> estimateTemplates = estimateTemplateService.selectEstimateTemplateList();
if (CollectionUtils.isEmpty(estimateTemplates)){
estimateTemplateService.insertSalesEstimateTemplate(salesEstimateTemplate);
Long estimateTemplateId = salesEstimateTemplate.getEstimateTemplateId();
salesEstimateTemplate = estimateTemplateService.selectSalesEstimateTemplateById(estimateTemplateId);
}else {
salesEstimateTemplate = estimateTemplates.get(0);
}
map.put("salesEstimateTemplate",salesEstimateTemplate);
return prefix + "/addOperatingCostTemplate";
}
/**
* 修改保存销售估价经营成本模板
*/
@RequiresPermissions("sales:estimate:addOperatingCostTemplate")
@Log(title = "销售估价", businessType = BusinessType.UPDATE)
@ResponseBody
@PostMapping("/editOperatingCostTemplate")
public AjaxResult editOperatingCostTemplate(SalesEstimateTemplate salesEstimateTemplate)
{
return toAjax(estimateTemplateService.updateSalesEstimateTemplate(salesEstimateTemplate));
}
/**
* 删除销售估价
*/

197
ruoyi-admin/src/main/java/com/ruoyi/sales/domain/SalesEstimateTemplate.java

@ -0,0 +1,197 @@
package com.ruoyi.sales.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 销售估价经营成本模板对象 sales_estimate_template
*
* @author 刘晓旭
* @date 2024-08-06
*/
public class SalesEstimateTemplate extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 经营成本模板ID */
private Long estimateTemplateId;
/** A挡利润率 */
@Excel(name = "A挡利润率")
private BigDecimal aProfitRate;
/** B挡利润率 */
@Excel(name = "B挡利润率")
private BigDecimal bProfitRate;
/** C挡利润率 */
@Excel(name = "C挡利润率")
private BigDecimal cProfitRate;
/** D挡利润率 */
@Excel(name = "D挡利润率")
private BigDecimal dProfitRate;
/** E挡利润率 */
@Excel(name = "E挡利润率")
private BigDecimal eProfitRate;
/** F挡利润率 */
@Excel(name = "F挡利润率")
private BigDecimal fProfitRate;
/** 不含税人工成本(RMB) */
@Excel(name = "不含税人工成本", readConverterExp = "R=MB")
private BigDecimal noTaxLaborCosts;
/** 不含税推广成本(RMB) */
@Excel(name = "不含税推广成本", readConverterExp = "R=MB")
private BigDecimal noTaxPromotionalCosts;
/** 不含税业务成本(RMB) */
@Excel(name = "不含税业务成本", readConverterExp = "R=MB")
private BigDecimal noTaxBusinessCosts;
/** 不含税管理成本(RMB) */
@Excel(name = "不含税管理成本", readConverterExp = "R=MB")
private BigDecimal noTaxManagesCosts;
/** 不含税总物料成本(RMB) */
@Excel(name = "不含税总物料成本", readConverterExp = "R=MB")
private BigDecimal noTaxMaterialCosts;
public void setEstimateTemplateId(Long estimateTemplateId)
{
this.estimateTemplateId = estimateTemplateId;
}
public Long getEstimateTemplateId()
{
return estimateTemplateId;
}
public void setaProfitRate(BigDecimal aProfitRate)
{
this.aProfitRate = aProfitRate;
}
public BigDecimal getaProfitRate()
{
return aProfitRate;
}
public void setbProfitRate(BigDecimal bProfitRate)
{
this.bProfitRate = bProfitRate;
}
public BigDecimal getbProfitRate()
{
return bProfitRate;
}
public void setcProfitRate(BigDecimal cProfitRate)
{
this.cProfitRate = cProfitRate;
}
public BigDecimal getcProfitRate()
{
return cProfitRate;
}
public void setdProfitRate(BigDecimal dProfitRate)
{
this.dProfitRate = dProfitRate;
}
public BigDecimal getdProfitRate()
{
return dProfitRate;
}
public void seteProfitRate(BigDecimal eProfitRate)
{
this.eProfitRate = eProfitRate;
}
public BigDecimal geteProfitRate()
{
return eProfitRate;
}
public void setfProfitRate(BigDecimal fProfitRate)
{
this.fProfitRate = fProfitRate;
}
public BigDecimal getfProfitRate()
{
return fProfitRate;
}
public void setNoTaxLaborCosts(BigDecimal noTaxLaborCosts)
{
this.noTaxLaborCosts = noTaxLaborCosts;
}
public BigDecimal getNoTaxLaborCosts()
{
return noTaxLaborCosts;
}
public void setNoTaxPromotionalCosts(BigDecimal noTaxPromotionalCosts)
{
this.noTaxPromotionalCosts = noTaxPromotionalCosts;
}
public BigDecimal getNoTaxPromotionalCosts()
{
return noTaxPromotionalCosts;
}
public void setNoTaxBusinessCosts(BigDecimal noTaxBusinessCosts)
{
this.noTaxBusinessCosts = noTaxBusinessCosts;
}
public BigDecimal getNoTaxBusinessCosts()
{
return noTaxBusinessCosts;
}
public void setNoTaxManagesCosts(BigDecimal noTaxManagesCosts)
{
this.noTaxManagesCosts = noTaxManagesCosts;
}
public BigDecimal getNoTaxManagesCosts()
{
return noTaxManagesCosts;
}
public void setNoTaxMaterialCosts(BigDecimal noTaxMaterialCosts)
{
this.noTaxMaterialCosts = noTaxMaterialCosts;
}
public BigDecimal getNoTaxMaterialCosts()
{
return noTaxMaterialCosts;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("estimateTemplateId", getEstimateTemplateId())
.append("aProfitRate", getaProfitRate())
.append("bProfitRate", getbProfitRate())
.append("cProfitRate", getcProfitRate())
.append("dProfitRate", getdProfitRate())
.append("eProfitRate", geteProfitRate())
.append("fProfitRate", getfProfitRate())
.append("noTaxLaborCosts", getNoTaxLaborCosts())
.append("noTaxPromotionalCosts", getNoTaxPromotionalCosts())
.append("noTaxBusinessCosts", getNoTaxBusinessCosts())
.append("noTaxManagesCosts", getNoTaxManagesCosts())
.append("noTaxMaterialCosts", getNoTaxMaterialCosts())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

28
ruoyi-admin/src/main/java/com/ruoyi/sales/domain/VO/SalesEstimateDetailVo.java

@ -0,0 +1,28 @@
package com.ruoyi.sales.domain.VO;
import com.ruoyi.sales.domain.SalesEstimateDetail;
import lombok.Data;
import java.math.BigDecimal;
// 销售估价详情Vo类,结合模板类,计算利润率
@Data
public class SalesEstimateDetailVo extends SalesEstimateDetail {
/** A挡利润率 */
private BigDecimal aProfitRate;
/** B挡利润率 */
private BigDecimal bProfitRate;
/** C挡利润率 */
private BigDecimal cProfitRate;
/** D挡利润率 */
private BigDecimal dProfitRate;
/** E挡利润率 */
private BigDecimal eProfitRate;
/** F挡利润率 */
private BigDecimal fProfitRate;
}

85
ruoyi-admin/src/main/java/com/ruoyi/sales/mapper/SalesEstimateTemplateMapper.java

@ -0,0 +1,85 @@
package com.ruoyi.sales.mapper;
import java.util.List;
import com.ruoyi.sales.domain.SalesEstimateTemplate;
/**
* 销售估价经营成本模板Mapper接口
*
* @author 刘晓旭
* @date 2024-08-06
*/
public interface SalesEstimateTemplateMapper
{
/**
* 查询销售估价经营成本模板
*
* @param estimateTemplateId 销售估价经营成本模板ID
* @return 销售估价经营成本模板
*/
public SalesEstimateTemplate selectSalesEstimateTemplateById(Long estimateTemplateId);
/**
* 查询销售估价经营成本模板列表
*
* @param salesEstimateTemplate 销售估价经营成本模板
* @return 销售估价经营成本模板集合
*/
public List<SalesEstimateTemplate> selectSalesEstimateTemplateList(SalesEstimateTemplate salesEstimateTemplate);
/**
* 新增销售估价经营成本模板
*
* @param salesEstimateTemplate 销售估价经营成本模板
* @return 结果
*/
public int insertSalesEstimateTemplate(SalesEstimateTemplate salesEstimateTemplate);
/**
* 修改销售估价经营成本模板
*
* @param salesEstimateTemplate 销售估价经营成本模板
* @return 结果
*/
public int updateSalesEstimateTemplate(SalesEstimateTemplate salesEstimateTemplate);
/**
* 删除销售估价经营成本模板
*
* @param estimateTemplateId 销售估价经营成本模板ID
* @return 结果
*/
public int deleteSalesEstimateTemplateById(Long estimateTemplateId);
/**
* 批量删除销售估价经营成本模板
*
* @param estimateTemplateIds 需要删除的数据ID
* @return 结果
*/
public int deleteSalesEstimateTemplateByIds(String[] estimateTemplateIds);
/**
* 作废销售估价经营成本模板
*
* @param estimateTemplateId 销售估价经营成本模板ID
* @return 结果
*/
public int cancelSalesEstimateTemplateById(Long estimateTemplateId);
/**
* 恢复销售估价经营成本模板
*
* @param estimateTemplateId 销售估价经营成本模板ID
* @return 结果
*/
public int restoreSalesEstimateTemplateById(Long estimateTemplateId);
/**
* 查询销售估价经营成本模板列表
*
* @return 销售估价经营成本模板集合
*/
List<SalesEstimateTemplate> selectEstimateTemplateList();
}

8
ruoyi-admin/src/main/java/com/ruoyi/sales/service/ISalesEstimateService.java

@ -2,6 +2,7 @@ package com.ruoyi.sales.service;
import java.util.List;
import com.ruoyi.sales.domain.SalesEstimate;
import com.ruoyi.sales.domain.VO.SalesEstimateDetailVo;
/**
* 销售估价Service接口
@ -72,4 +73,11 @@ public interface ISalesEstimateService
* @return
*/
int restoreSalesEstimateById(Long salesEstimateId);
/**
* 获取销售估价Vo详情
* @return
*/
SalesEstimateDetailVo getSalesEstimateDetailVo();
}

82
ruoyi-admin/src/main/java/com/ruoyi/sales/service/ISalesEstimateTemplateService.java

@ -0,0 +1,82 @@
package com.ruoyi.sales.service;
import java.util.List;
import com.ruoyi.sales.domain.SalesEstimateTemplate;
/**
* 销售估价经营成本模板Service接口
*
* @author 刘晓旭
* @date 2024-08-06
*/
public interface ISalesEstimateTemplateService
{
/**
* 查询销售估价经营成本模板
*
* @param estimateTemplateId 销售估价经营成本模板ID
* @return 销售估价经营成本模板
*/
public SalesEstimateTemplate selectSalesEstimateTemplateById(Long estimateTemplateId);
/**
* 查询销售估价经营成本模板列表
*
* @param salesEstimateTemplate 销售估价经营成本模板
* @return 销售估价经营成本模板集合
*/
public List<SalesEstimateTemplate> selectSalesEstimateTemplateList(SalesEstimateTemplate salesEstimateTemplate);
/**
* 新增销售估价经营成本模板
*
* @param salesEstimateTemplate 销售估价经营成本模板
* @return 结果
*/
public int insertSalesEstimateTemplate(SalesEstimateTemplate salesEstimateTemplate);
/**
* 修改销售估价经营成本模板
*
* @param salesEstimateTemplate 销售估价经营成本模板
* @return 结果
*/
public int updateSalesEstimateTemplate(SalesEstimateTemplate salesEstimateTemplate);
/**
* 批量删除销售估价经营成本模板
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSalesEstimateTemplateByIds(String ids);
/**
* 删除销售估价经营成本模板信息
*
* @param estimateTemplateId 销售估价经营成本模板ID
* @return 结果
*/
public int deleteSalesEstimateTemplateById(Long estimateTemplateId);
/**
* 作废销售估价经营成本模板
* @param estimateTemplateId 销售估价经营成本模板ID
* @return
*/
int cancelSalesEstimateTemplateById(Long estimateTemplateId);
/**
* 恢复销售估价经营成本模板
* @param estimateTemplateId 销售估价经营成本模板ID
* @return
*/
int restoreSalesEstimateTemplateById(Long estimateTemplateId);
/**
* 查询销售估价经营成本模板列表
* @return
*/
List<SalesEstimateTemplate> selectEstimateTemplateList();
}

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

@ -4,16 +4,21 @@ import java.util.Date;
import java.util.List;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.sales.domain.SalesEstimateDetail;
import com.ruoyi.sales.domain.SalesEstimateTemplate;
import com.ruoyi.sales.domain.VO.SalesEstimateDetailVo;
import com.ruoyi.sales.mapper.SalesEstimateDetailMapper;
import com.ruoyi.sales.mapper.SalesEstimateTemplateMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.sales.mapper.SalesEstimateMapper;
import com.ruoyi.sales.domain.SalesEstimate;
import com.ruoyi.sales.service.ISalesEstimateService;
import com.ruoyi.common.core.text.Convert;
import org.springframework.util.CollectionUtils;
/**
* 销售估价Service业务层处理
@ -33,6 +38,9 @@ public class SalesEstimateServiceImpl implements ISalesEstimateService
@Autowired
private RedisCache redisCache;
@Autowired
private SalesEstimateTemplateMapper estimateTemplateMapper;
/**
* 查询销售估价
*
@ -72,8 +80,10 @@ public class SalesEstimateServiceImpl implements ISalesEstimateService
salesEstimate.setCreateBy(loginName);
salesEstimate.setCreateTime(new Date());
salesEstimate.setSalesEstimateCode(salesEstimateCode);
//设置状态为待工程
salesEstimate.setEstimateStatus("0");
//设置默认值为RMB
salesEstimate.setCommonCurrency("1");
List<SalesEstimateDetail> salesEstimateDetailList = salesEstimate.getSalesEstimateDetailList();
if (salesEstimateDetailList != null && salesEstimateDetailList.size() > 0) {
for (SalesEstimateDetail salesEstimateDetail : salesEstimateDetailList) {
@ -151,4 +161,33 @@ public class SalesEstimateServiceImpl implements ISalesEstimateService
{
return salesEstimateMapper.restoreSalesEstimateById(salesEstimateId);
}
/**
* 查询销售估价Vo详情
*
* @return 销售估价Vo详情
*/
@Override
public SalesEstimateDetailVo getSalesEstimateDetailVo() {
SalesEstimateDetailVo salesEstimateDetailVo = new SalesEstimateDetailVo();
List<SalesEstimateTemplate> estimateTemplateList = estimateTemplateMapper.selectEstimateTemplateList();
if (CollectionUtils.isEmpty(estimateTemplateList)){
throw new BusinessException("总经理先添加经营成本模板");
}
SalesEstimateTemplate salesEstimateTemplate = estimateTemplateList.get(0);
salesEstimateDetailVo.setAProfitRate(salesEstimateTemplate.getaProfitRate());
salesEstimateDetailVo.setBProfitRate(salesEstimateTemplate.getbProfitRate());
salesEstimateDetailVo.setCProfitRate(salesEstimateTemplate.getcProfitRate());
salesEstimateDetailVo.setDProfitRate(salesEstimateTemplate.getdProfitRate());
salesEstimateDetailVo.setEProfitRate(salesEstimateTemplate.geteProfitRate());
salesEstimateDetailVo.setFProfitRate(salesEstimateTemplate.getfProfitRate());
salesEstimateDetailVo.setNoTaxLaborCosts(salesEstimateTemplate.getNoTaxLaborCosts());
salesEstimateDetailVo.setNoTaxBusinessCosts(salesEstimateTemplate.getNoTaxBusinessCosts());
salesEstimateDetailVo.setNoTaxManagesCosts(salesEstimateTemplate.getNoTaxManagesCosts());
salesEstimateDetailVo.setNoTaxPromotionalCosts(salesEstimateTemplate.getNoTaxPromotionalCosts());
salesEstimateDetailVo.setNoTaxMaterialCosts(salesEstimateTemplate.getNoTaxMaterialCosts());
return salesEstimateDetailVo;
}
}

139
ruoyi-admin/src/main/java/com/ruoyi/sales/service/impl/SalesEstimateTemplateServiceImpl.java

@ -0,0 +1,139 @@
package com.ruoyi.sales.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.sales.mapper.SalesEstimateTemplateMapper;
import com.ruoyi.sales.domain.SalesEstimateTemplate;
import com.ruoyi.sales.service.ISalesEstimateTemplateService;
import com.ruoyi.common.core.text.Convert;
/**
* 销售估价经营成本模板Service业务层处理
*
* @author 刘晓旭
* @date 2024-08-06
*/
@Service
public class SalesEstimateTemplateServiceImpl implements ISalesEstimateTemplateService
{
@Autowired
private SalesEstimateTemplateMapper salesEstimateTemplateMapper;
/**
* 查询销售估价经营成本模板
*
* @param estimateTemplateId 销售估价经营成本模板ID
* @return 销售估价经营成本模板
*/
@Override
public SalesEstimateTemplate selectSalesEstimateTemplateById(Long estimateTemplateId)
{
return salesEstimateTemplateMapper.selectSalesEstimateTemplateById(estimateTemplateId);
}
/**
* 查询销售估价经营成本模板列表
*
* @param salesEstimateTemplate 销售估价经营成本模板
* @return 销售估价经营成本模板
*/
@Override
public List<SalesEstimateTemplate> selectSalesEstimateTemplateList(SalesEstimateTemplate salesEstimateTemplate)
{
return salesEstimateTemplateMapper.selectSalesEstimateTemplateList(salesEstimateTemplate);
}
/**
* 新增销售估价经营成本模板
*
* @param salesEstimateTemplate 销售估价经营成本模板
* @return 结果
*/
@Override
public int insertSalesEstimateTemplate(SalesEstimateTemplate salesEstimateTemplate)
{
String loginName = ShiroUtils.getLoginName();
salesEstimateTemplate.setCreateBy(loginName);
salesEstimateTemplate.setCreateTime(DateUtils.getNowDate());
return salesEstimateTemplateMapper.insertSalesEstimateTemplate(salesEstimateTemplate);
}
/**
* 修改销售估价经营成本模板
*
* @param salesEstimateTemplate 销售估价经营成本模板
* @return 结果
*/
@Override
public int updateSalesEstimateTemplate(SalesEstimateTemplate salesEstimateTemplate)
{
String loginName = ShiroUtils.getLoginName();
salesEstimateTemplate.setUpdateBy(loginName);
salesEstimateTemplate.setUpdateTime(DateUtils.getNowDate());
return salesEstimateTemplateMapper.updateSalesEstimateTemplate(salesEstimateTemplate);
}
/**
* 删除销售估价经营成本模板对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteSalesEstimateTemplateByIds(String ids)
{
return salesEstimateTemplateMapper.deleteSalesEstimateTemplateByIds(Convert.toStrArray(ids));
}
/**
* 删除销售估价经营成本模板信息
*
* @param estimateTemplateId 销售估价经营成本模板ID
* @return 结果
*/
@Override
public int deleteSalesEstimateTemplateById(Long estimateTemplateId)
{
return salesEstimateTemplateMapper.deleteSalesEstimateTemplateById(estimateTemplateId);
}
/**
* 作废销售估价经营成本模板
*
* @param estimateTemplateId 销售估价经营成本模板ID
* @return 结果
*/
@Override
public int cancelSalesEstimateTemplateById(Long estimateTemplateId)
{
return salesEstimateTemplateMapper.cancelSalesEstimateTemplateById(estimateTemplateId);
}
/**
* 恢复销售估价经营成本模板信息
*
* @param estimateTemplateId 销售估价经营成本模板ID
* @return 结果
*/
@Override
public int restoreSalesEstimateTemplateById(Long estimateTemplateId)
{
return salesEstimateTemplateMapper.restoreSalesEstimateTemplateById(estimateTemplateId);
}
/**
* 查询销售估价经营成本模板列表
*
* @return 销售估价经营成本模板
*/
@Override
public List<SalesEstimateTemplate> selectEstimateTemplateList() {
return salesEstimateTemplateMapper.selectEstimateTemplateList();
}
}

16
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerController.java

@ -201,6 +201,14 @@ public class SysCustomerController extends BaseController
public String edit(@PathVariable("id")Long id, ModelMap mmap)
{
SysCustomer sysCustomer = sysCustomerService.selectSysCustomerById(id);
List<String> currency = new ArrayList<>();
if(sysCustomer.getRmbFlag().equals("1")){
currency.add("1");
}
if(sysCustomer.getUsdFlag().equals("1")){
currency.add("2");
}
sysCustomer.setCurrency(currency);
mmap.put("sysCustomer", sysCustomer);
return prefix + "/edit";
}
@ -212,6 +220,14 @@ public class SysCustomerController extends BaseController
public String detail(@PathVariable("id")Long id, ModelMap mmap)
{
SysCustomer sysCustomer = sysCustomerService.selectSysCustomerById(id);
List<String> currency = new ArrayList<>();
if(sysCustomer.getRmbFlag().equals("1")){
currency.add("1");
}
if(sysCustomer.getUsdFlag().equals("1")){
currency.add("2");
}
sysCustomer.setCurrency(currency);
String enterpriseCode = sysCustomer.getEnterpriseCode();
List<SysContacts> sysContacts = sysContactsService.selectSysContactsByCode(enterpriseCode);
List<SysInvoice> sysInvoices = sysInvoiceService.selectSysInvoiceByCode(enterpriseCode);

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

@ -215,17 +215,6 @@ 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);
}
@ -239,6 +228,17 @@ public class SysCustomerServiceImpl implements ISysCustomerService
sysCustomer.setApplyTime(DateUtils.getNowDate());
sysCustomer.setUpdateBy(user.getLoginName());
sysCustomer.setUpdateTime(DateUtils.getNowDate());
List<String> currency = sysCustomer.getCurrency();
if(currency.contains("1")){
sysCustomer.setRmbFlag("1");
}else {
sysCustomer.setRmbFlag("0");
}
if(currency.contains("2")){
sysCustomer.setUsdFlag("1");
}else {
sysCustomer.setUsdFlag("0");
}
// 启动流程
return sysCustomerMapper.updateSysCustomer(sysCustomer);
}
@ -404,6 +404,8 @@ public class SysCustomerServiceImpl implements ISysCustomerService
sysCustomer.setApplyTime(DateUtils.getNowDate());
if (sysCustomer.getId() == null){
insertSysCustomer(sysCustomer);
}else {
updateSysCustomerVo(sysCustomer);
}
// 启动流程
String applyTitle = user.getUserName()+"发起了客户信息提交审批-"+DateUtils.dateTimeNow();

128
ruoyi-admin/src/main/resources/mapper/sales/SalesEstimateTemplateMapper.xml

@ -0,0 +1,128 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.sales.mapper.SalesEstimateTemplateMapper">
<resultMap type="SalesEstimateTemplate" id="SalesEstimateTemplateResult">
<result property="estimateTemplateId" column="estimate_template_id" />
<result property="aProfitRate" column="A_profit_rate" />
<result property="bProfitRate" column="B_profit_rate" />
<result property="cProfitRate" column="C_profit_rate" />
<result property="dProfitRate" column="D_profit_rate" />
<result property="eProfitRate" column="E_profit_rate" />
<result property="fProfitRate" column="F_profit_rate" />
<result property="noTaxLaborCosts" column="no_tax_labor_costs" />
<result property="noTaxPromotionalCosts" column="no_tax_promotional_costs" />
<result property="noTaxBusinessCosts" column="no_tax_business_costs" />
<result property="noTaxManagesCosts" column="no_tax_manages_costs" />
<result property="noTaxMaterialCosts" column="no_tax_material_costs" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectSalesEstimateTemplateVo">
select estimate_template_id, A_profit_rate, B_profit_rate, C_profit_rate, D_profit_rate, E_profit_rate, F_profit_rate, no_tax_labor_costs, no_tax_promotional_costs, no_tax_business_costs, no_tax_manages_costs, no_tax_material_costs, create_by, create_time, update_by, update_time, remark from sales_estimate_template
</sql>
<select id="selectSalesEstimateTemplateList" parameterType="SalesEstimateTemplate" resultMap="SalesEstimateTemplateResult">
<include refid="selectSalesEstimateTemplateVo"/>
<where>
</where>
</select>
<select id="selectSalesEstimateTemplateById" parameterType="Long" resultMap="SalesEstimateTemplateResult">
<include refid="selectSalesEstimateTemplateVo"/>
where estimate_template_id = #{estimateTemplateId}
</select>
<select id="selectEstimateTemplateList" resultMap="SalesEstimateTemplateResult">
<include refid="selectSalesEstimateTemplateVo"/>
</select>
<insert id="insertSalesEstimateTemplate" parameterType="SalesEstimateTemplate" useGeneratedKeys="true" keyProperty="estimateTemplateId">
insert into sales_estimate_template
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="aProfitRate != null">A_profit_rate,</if>
<if test="bProfitRate != null">B_profit_rate,</if>
<if test="cProfitRate != null">C_profit_rate,</if>
<if test="dProfitRate != null">D_profit_rate,</if>
<if test="eProfitRate != null">E_profit_rate,</if>
<if test="fProfitRate != null">F_profit_rate,</if>
<if test="noTaxLaborCosts != null">no_tax_labor_costs,</if>
<if test="noTaxPromotionalCosts != null">no_tax_promotional_costs,</if>
<if test="noTaxBusinessCosts != null">no_tax_business_costs,</if>
<if test="noTaxManagesCosts != null">no_tax_manages_costs,</if>
<if test="noTaxMaterialCosts != null">no_tax_material_costs,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="aProfitRate != null">#{aProfitRate},</if>
<if test="bProfitRate != null">#{bProfitRate},</if>
<if test="cProfitRate != null">#{cProfitRate},</if>
<if test="dProfitRate != null">#{dProfitRate},</if>
<if test="eProfitRate != null">#{eProfitRate},</if>
<if test="fProfitRate != null">#{fProfitRate},</if>
<if test="noTaxLaborCosts != null">#{noTaxLaborCosts},</if>
<if test="noTaxPromotionalCosts != null">#{noTaxPromotionalCosts},</if>
<if test="noTaxBusinessCosts != null">#{noTaxBusinessCosts},</if>
<if test="noTaxManagesCosts != null">#{noTaxManagesCosts},</if>
<if test="noTaxMaterialCosts != null">#{noTaxMaterialCosts},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateSalesEstimateTemplate" parameterType="SalesEstimateTemplate">
update sales_estimate_template
<trim prefix="SET" suffixOverrides=",">
<if test="aProfitRate != null">A_profit_rate = #{aProfitRate},</if>
<if test="bProfitRate != null">B_profit_rate = #{bProfitRate},</if>
<if test="cProfitRate != null">C_profit_rate = #{cProfitRate},</if>
<if test="dProfitRate != null">D_profit_rate = #{dProfitRate},</if>
<if test="eProfitRate != null">E_profit_rate = #{eProfitRate},</if>
<if test="fProfitRate != null">F_profit_rate = #{fProfitRate},</if>
<if test="noTaxLaborCosts != null">no_tax_labor_costs = #{noTaxLaborCosts},</if>
<if test="noTaxPromotionalCosts != null">no_tax_promotional_costs = #{noTaxPromotionalCosts},</if>
<if test="noTaxBusinessCosts != null">no_tax_business_costs = #{noTaxBusinessCosts},</if>
<if test="noTaxManagesCosts != null">no_tax_manages_costs = #{noTaxManagesCosts},</if>
<if test="noTaxMaterialCosts != null">no_tax_material_costs = #{noTaxMaterialCosts},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where estimate_template_id = #{estimateTemplateId}
</update>
<delete id="deleteSalesEstimateTemplateById" parameterType="Long">
delete from sales_estimate_template where estimate_template_id = #{estimateTemplateId}
</delete>
<delete id="deleteSalesEstimateTemplateByIds" parameterType="String">
delete from sales_estimate_template where estimate_template_id in
<foreach item="estimateTemplateId" collection="array" open="(" separator="," close=")">
#{estimateTemplateId}
</foreach>
</delete>
<update id="cancelSalesEstimateTemplateById" parameterType="Long">
update sales_estimate_template set del_flag = '1' where estimate_template_id = #{estimateTemplateId}
</update>
<update id="restoreSalesEstimateTemplateById" parameterType="Long">
update sales_estimate_template set del_flag = '0' where estimate_template_id = #{estimateTemplateId}
</update>
</mapper>

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

@ -10,7 +10,7 @@
<div class="form-group">
<label class="col-sm-4 control-label">业务员:</label>
<div class="col-sm-8">
<input name="businessMembers" class="form-control" type="text">
<input name="businessMembers" id="businessMembers" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
@ -37,10 +37,10 @@
</div>
</div>
<div class="form-group">
<div class="form-group">
<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')}">
<select name="commonCurrency" id="commonCurrency_add" class="form-control m-b" th:with="type=${@dict.getType('sys_common_currency')}" disabled>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" required></option>
</select>
</div>
@ -49,7 +49,7 @@
<label class="col-sm-4 control-label is-required">美元汇率:</label>
<div class="col-sm-8">
<div class="input-group">
<input name="usdRate" class="form-control" type="text" required>
<input name="usdRate" id="usdRate_add" class="form-control" type="text" required>
<span class="input-group-addon">%</span>
</div>
</div>
@ -65,7 +65,7 @@
<div class="container">
<h4 class="form-header h4">计算</h4>
<div class="col-xs-12 form-row">
<label class=" col-sm-2">物料合计:</label><input class="col-sm-4" name="materialSum" id="materialSum_add" type="text" readonly/>
<label class=" col-sm-2">物料合计:</label><input class="col-sm-4" name="materialSum" id="materialSum_add" type="number" readonly/>
<label class=" col-sm-2">数量合计:</label><input class="col-sm-4" name="enterpriseSum" id="enterpriseSum_add" type="number" readonly/>
</div>
<div class="col-xs-12 form-row">
@ -116,6 +116,9 @@
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
var processMethodDatas = [[${@dict.getType('processMethod')}]];
var loginName = [[${@permission.getPrincipalProperty('loginName')}]];
var salesEstimateDetailVo = [[${salesEstimateDetailVo}]];
$("#form-estimate-add").validate({
focusCleanup: true
@ -130,11 +133,14 @@
}, {});
// 销售估价物料
var estimateMaterialTable = $('#bootstrap-table').bootstrapTable('getData');
if (estimateMaterialTable.length === 0){
$.modal.alertWarning("请至少添加一条物料信息");
return;
}
// 将表数据转换成与estimateData格式一致的数组
var estimateMaterialDataList = estimateMaterialTable.map(function(item) {
@ -163,6 +169,13 @@
};
});
// 获取料号档位的最新值
$('.form-control[id^="materialGearPosition_"]').each(function() {
const index = $(this).attr('id').match(/materialGearPosition_(\d+)/)[1]; // 提取索引
const value = $(this).val(); // 获取下拉框的值
estimateMaterialDataList[index].materialGearPosition = value; // 更新料号档位
});
const combinedData = Object.assign({}, estimateData, {
salesEstimateDetailList: estimateMaterialDataList,
});
@ -191,13 +204,23 @@
url: url,
callBack: estimateDoSubmit
};
$.modal.openOptions(options);
}
$(function() {
$("#businessMembers").val(loginName);
var options = {
id:'bootstrap-table',
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
modalName: "销售估价详情",
columns: [{
editFiled:"noTaxRmb",
columns: [
{
checkbox: true
},
{
@ -245,9 +268,32 @@
},
{
title: '料号档位',
width: 100,
field: 'materialGearPosition',
formatter: function(value, row, index) {
return $.table.selectDictLabel(materialGearPositionDatas, value);
// 为每个下拉框添加唯一的 id 和 name
var selectId = 'materialGearPosition_' + index;
var selectName = 'salesEstimateDetailList[' + index + '].materialGearPosition';
// 创建下拉框 HTML
var html = $.common.sprintf(
"<select class='form-control' id='%s' name='%s' required>" +
" <option value='0' %s>A</option>" +
" <option value='1' %s>B</option>" +
" <option value='2' %s>C</option>" +
" <option value='3' %s>D</option>" +
" <option value='4' %s>E</option>" +
" <option value='5' %s>F</option>" +
"</select>",
selectId, selectName,
value === '0' ? 'selected' : '',
value === '1' ? 'selected' : '',
value === '2' ? 'selected' : '',
value === '3' ? 'selected' : '',
value === '4' ? 'selected' : '',
value === '5' ? 'selected' : ''
);
return html;
}
},
{
@ -300,7 +346,12 @@
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('');
}
}]
}],
onEditableSave:function(field, row, oldValue, $el){
// 确保getTotalAmount函数存在且正确引用
getTotalAmount();
},
};
$.table.init(options);
});
@ -316,7 +367,7 @@
for(var i=0;i<rows;i++){
var data = $("#bootstrap-table").bootstrapTable('getData')[i];
if(data.materialNo == rowData.materialCode){
if(data.materialNo == rowData.materialNo){
$.modal.alertError("不能选择已添加过的相同物料");
return;
}
@ -326,7 +377,7 @@
$("#bootstrap-table").bootstrapTable('insertRow', {
index:1,
row: {
materialNo:rowData.materialCode,
materialNo:rowData.materialNo,
materialPhotourl:rowData.photoUrl,
materialName: rowData.materialName,
materialType: rowData.materialType,
@ -335,8 +386,10 @@
materialUnit: rowData.unit,
materialProcessMethod: rowData.processMethod,
materialDeptType: rowData.warehouseDept,
materialNum: 0
}
})
getTotalAmount();
layer.close(index);
}
@ -346,6 +399,7 @@
field: 'materialNo',
values: materialNo
})
getTotalAmount();
}
@ -419,6 +473,122 @@
});
});
// $(document).ready(function() {
// // 监听表格中的物料数量输入框的变化
// $('#bootstrap-table').on('input', '.material-num-input', function() {
// getTotalAmount();
// });
//
// // 初始加载时也计算一次
// getTotalAmount();
// });
//
// function getTotalAmount() {
// let getData = $('#bootstrap-table').bootstrapTable('getData');
// let enterpriseSum = 0;
//
// // 计算物料数量总和
// enterpriseSum = getData.reduce((sum, item) => sum + (parseInt(item.materialNum) || 0), 0);
//
// // 更新页面上的输入框
// $("#enterpriseSum_add").val(enterpriseSum);
// }
//form计算模块
function getTotalAmount(){
let getData = $('#bootstrap-table').bootstrapTable('getData');
var materialSum = 0;
var enterpriseSum = 0;
var noTaxRmb = 0;
var taxRmb = 0;
var allNoTaxRmb = 0;
var allTaxRmb = 0;
var noTaxDollar = 0;
var taxDollar = 0;
var allNoTaxDollar = 0;
var allTaxDollar = 0;
materialSum = getData.length;
enterpriseSum = getData.reduce((sum, item) => sum + (parseInt(item.materialNum) || 0), 0);
for(var i=0;i<getData.length;i++){
noTaxRmb += parseFloat(getData[i].noTaxRmb) || 0;
taxRmb += parseFloat(getData[i].taxRmb) || 0;
allNoTaxRmb += parseFloat(getData[i].allNoTaxRmb) || 0;
allTaxRmb += parseFloat(getData[i].allTaxRmb) || 0;
noTaxDollar += parseFloat(getData[i].noTaxDollar) || 0;
taxDollar += parseFloat(getData[i].taxDollar) || 0;
allNoTaxDollar += parseFloat(getData[i].allNoTaxDollar) || 0;
allTaxDollar += parseFloat(getData[i].allTaxDollar) || 0;
}
noTaxRmb = noTaxRmb.toFixed(2);
taxRmb = taxRmb.toFixed(2);
allNoTaxRmb = allNoTaxRmb.toFixed(2);
allTaxRmb = allTaxRmb.toFixed(2);
noTaxDollar = noTaxDollar.toFixed(2);
taxDollar = taxDollar.toFixed(2);
allNoTaxDollar = allNoTaxDollar.toFixed(2);
allTaxDollar = allTaxDollar.toFixed(2);
$("input[name='materialSum']").val(materialSum);
$("input[name='enterpriseSum']").val(enterpriseSum);
$("input[name='noTaxRmb']").val(noTaxRmb);
$("input[name='taxRmb']").val(taxRmb);
$("input[name='allNoTaxRmb']").val(allNoTaxRmb);
$("input[name='allTaxRmb']").val(allTaxRmb);
$("input[name='noTaxDollar']").val(noTaxDollar);
$("input[name='taxDollar']").val(taxDollar);
$("input[name='allNoTaxDollar']").val(allNoTaxDollar);
$("input[name='allTaxDollar']").val(allTaxDollar);
}
// 计算并更新所有其他总和
// function updateAllSums() {
// let getData = $('#bootstrap-table').bootstrapTable('getData');
// let noTaxRmb = 0;
// let taxRmb = 0;
// let allNoTaxRmb = 0;
// let allTaxRmb = 0;
// let noTaxDollar = 0;
// let taxDollar = 0;
// let allNoTaxDollar = 0;
// let allTaxDollar = 0;
//
// getData.forEach(item => {
// noTaxRmb += parseFloat(item.noTaxRmb) || 0;
// taxRmb += parseFloat(item.taxRmb) || 0;
// allNoTaxRmb += parseFloat(item.allNoTaxRmb) || 0;
// allTaxRmb += parseFloat(item.allTaxRmb) || 0;
// noTaxDollar += parseFloat(item.noTaxDollar) || 0;
// taxDollar += parseFloat(item.taxDollar) || 0;
// allNoTaxDollar += parseFloat(item.allNoTaxDollar) || 0;
// allTaxDollar += parseFloat(item.allTaxDollar) || 0;
// });
//
// noTaxRmb = noTaxRmb.toFixed(2);
// taxRmb = taxRmb.toFixed(2);
// allNoTaxRmb = allNoTaxRmb.toFixed(2);
// allTaxRmb = allTaxRmb.toFixed(2);
// noTaxDollar = noTaxDollar.toFixed(2);
// taxDollar = taxDollar.toFixed(2);
// allNoTaxDollar = allNoTaxDollar.toFixed(2);
// allTaxDollar = allTaxDollar.toFixed(2);
//
// $("input[name='noTaxRmb']").val(noTaxRmb);
// $("input[name='taxRmb']").val(taxRmb);
// $("input[name='allNoTaxRmb']").val(allNoTaxRmb);
// $("input[name='allTaxRmb']").val(allTaxRmb);
// $("input[name='noTaxDollar']").val(noTaxDollar);
// $("input[name='taxDollar']").val(taxDollar);
// $("input[name='allNoTaxDollar']").val(allNoTaxDollar);
// $("input[name='allTaxDollar']").val(allTaxDollar);
// }
</script>
</body>
</html>

159
ruoyi-admin/src/main/resources/templates/sales/estimate/addOperatingCostTemplate.html

@ -0,0 +1,159 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('销售估价经营成本模板')" />
</head>
<style>
.underline {
margin-top: 10px;
margin-bottom: 10px;
}
.underline::after {
content: "";
display: block;
height: 3px;
background-color: black;
margin-top: 3px; /* 调整这个值来改变标题与下划线之间的间距 */
}
.underline hr.underline {
border: none;
height: 3px;
background-color: black;
margin-top: 3px; /* 调整这个值来改变标题与下划线之间的间距 */
}
</style>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-template-edit" th:object="${salesEstimateTemplate}">
<input name="estimateTemplateId" th:field="*{estimateTemplateId}" type="hidden">
<div class="container">
<div class="row">
<h4 class="font-weight-bold">总经营成本</h4>
</div>
<hr class="underline">
<br>
</div>
<div class="form-group">
<label class="col-sm-7 control-label is-required">不含税人工成本(RMB):</label>
<div class="col-sm-5">
<input name="noTaxLaborCosts" th:field="*{noTaxLaborCosts}" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-7 control-label is-required">不含税推广成本(RMB):</label>
<div class="col-sm-5">
<input name="noTaxPromotionalCosts" th:field="*{noTaxPromotionalCosts}" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-7 control-label is-required">不含税业务成本(RMB):</label>
<div class="col-sm-5">
<input name="noTaxBusinessCosts" th:field="*{noTaxBusinessCosts}" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-7 control-label is-required">不含税管理成本(RMB):</label>
<div class="col-sm-5">
<input name="noTaxManagesCosts" th:field="*{noTaxManagesCosts}" class="form-control" type="text" required>
</div>
</div>
<div class="container">
<div class="row">
<h4 class="font-weight-bold">总物料成本</h4>
</div>
<hr class="underline">
<br>
</div>
<div class="form-group">
<label class="col-sm-7 control-label is-required">不含税总物料成本(RMB):</label>
<div class="col-sm-5">
<input name="noTaxMaterialCosts" th:field="*{noTaxMaterialCosts}" class="form-control" type="text" required>
</div>
</div>
<div class="container">
<div class="row">
<h4 class="font-weight-bold">料号挡位及利润率</h4>
</div>
<hr class="underline">
<br>
</div>
<div class="container">
<div class="form-group">
<label class="col-sm-7 control-label is-required">A挡利润率:</label>
<div class="col-sm-5">
<div class="input-group">
<input name="aProfitRate" th:field="*{aProfitRate}" class="form-control" type="text" required>
<span class="input-group-addon">%</span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-7 control-label is-required">B挡利润率:</label>
<div class="col-sm-5">
<div class="input-group">
<input name="bProfitRate" th:field="*{bProfitRate}" class="form-control" type="text" required>
<span class="input-group-addon">%</span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-7 control-label is-required">C挡利润率:</label>
<div class="col-sm-5">
<div class="input-group">
<input name="cProfitRate" th:field="*{cProfitRate}" class="form-control" type="text" required>
<span class="input-group-addon">%</span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-7 control-label is-required">D挡利润率:</label>
<div class="col-sm-5">
<div class="input-group">
<input name="dProfitRate" th:field="*{dProfitRate}" class="form-control" type="text" required>
<span class="input-group-addon">%</span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-7 control-label is-required">E挡利润率:</label>
<div class="col-sm-5">
<div class="input-group">
<input name="eProfitRate" th:field="*{eProfitRate}" class="form-control" type="text" required>
<span class="input-group-addon">%</span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-7 control-label is-required">F挡利润率:</label>
<div class="col-sm-5">
<div class="input-group">
<input name="fProfitRate" th:field="*{fProfitRate}" class="form-control" type="text" required>
<span class="input-group-addon">%</span>
</div>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "sales/estimate";
$("#form-template-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/editOperatingCostTemplate", $('#form-template-edit').serialize());
}
}
</script>
</body>
</html>

518
ruoyi-admin/src/main/resources/templates/sales/estimate/engineeringAdd.html

@ -0,0 +1,518 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('工程新增销售估价')" />
<th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-estimate-add" th:object="${salesEstimate}">
<div class="form-group">
<label class="col-sm-4 control-label">业务员:</label>
<div class="col-sm-8">
<input name="businessMembers" id="businessMembers" th:field="*{businessMembers}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">定价日期:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="pricingDate" th:value="${#dates.format(salesEstimate.pricingDate, 'yyyy-MM-dd')}" 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-4 control-label">客户ID:</label>
<div class="col-sm-8">
<input name="enterpriseCode" th:field="*{enterpriseCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">客户名称:</label>
<div class="col-sm-8">
<input name="enterpriseName" th:field="*{enterpriseName}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label is-required">估价币种:</label>
<div class="col-sm-8">
<select name="commonCurrency" id="commonCurrency_add" class="form-control m-b" th:with="type=${@dict.getType('sys_common_currency')}" disabled>
<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-4 control-label is-required">美元汇率:</label>
<div class="col-sm-8">
<div class="input-group">
<input name="usdRate" th:field="*{usdRate}" id="usdRate_add" class="form-control" type="text" required readonly>
<span class="input-group-addon">%</span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">备注信息:</label>
<div class="col-sm-8">
<input name="remark" th:field="*{remark}" class="form-control" type="text">
</div>
</div>
<div class="container">
<h4 class="form-header h4">计算</h4>
<div class="col-xs-12 form-row">
<label class=" col-sm-2">物料合计:</label><input class="col-sm-4" name="materialSum" id="materialSum_add" type="number" readonly/>
<label class=" col-sm-2">数量合计:</label><input class="col-sm-4" name="enterpriseSum" id="enterpriseSum_add" type="number" readonly/>
</div>
<div class="col-xs-12 form-row">
<label class="col-sm-2"> 不含税单价(RMB):</label><input placeholder="RMB" class="col-sm-4" name="noTaxRmb" id="noTaxRmb_add" type="number" readonly/>
<label class="col-sm-2"> 不含税总价(RMB):</label><input placeholder="RMB" class="col-sm-4" name="allNoTaxRmb" id="allNoTaxRmb_add" type="number" readonly/>
</div>
<div class="col-xs-12 form-row">
<label class="col-sm-2"> 含税单价(RMB):</label><input placeholder="RMB" class="col-sm-4" name="taxRmb" id="taxRmb_add" type="number" readonly/>
<label class="col-sm-2"> 含税总价(RMB):</label><input placeholder="RMB" class="col-sm-4" name="allTaxRmb" id="allTaxRmb_add" type="number" readonly/>
</div>
<div class="col-xs-12">
<label class="col-sm-2">不含税单价(USD):</label><input placeholder="美元" class="col-sm-4" name="noTaxDollar" id="noTaxDollar_add" type="number" readonly/>
<label class="col-sm-2">不含税总价(USD):</label><input placeholder="美元" class="col-sm-4" name="allNoTaxDollar" id="allNoTaxDollar_add" type="number" readonly/>
</div>
<div class="col-xs-12 form-row">
<label class="col-sm-2">含税单价(USD):</label><input placeholder="美元" class="col-sm-4" name="taxDollar" id="taxDollar_add" type="number" readonly/>
<label class="col-sm-2">含税总价(USD):</label><input placeholder="美元" class="col-sm-4" name="allTaxDollar" id="allTaxDollar_add" type="number" readonly/>
</div>
</div>
</form>
<div class="container">
<div class="form-row">
<div class="btn-group-sm">
<span>选择报价信息</span>
<a class="btn btn-success" onclick="insertMaterialRow()">
<i class="fa fa-plus"></i> 添加物料
</a>
<a class="btn btn-success" onclick="insertNoMaterialRow()">
<i class="fa fa-plus"></i> 添加无料号物料
</a>
</div>
</div>
<div class="row">
<div class="col-sm-12 select-table table-striped">
<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')}]];
var salesEstimateDetailVo = [[${salesEstimateDetailVo}]];
$("#form-estimate-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
// 获取表单数据
const estimateData = $("#form-estimate-add").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
// 销售估价物料
var estimateMaterialTable = $('#bootstrap-table').bootstrapTable('getData');
if (estimateMaterialTable.length === 0){
$.modal.alertWarning("请至少添加一条物料信息");
return;
}
// 将表数据转换成与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,
// ...其他字段
};
});
// 获取料号档位的最新值
$('.form-control[id^="materialGearPosition_"]').each(function() {
const index = $(this).attr('id').match(/materialGearPosition_(\d+)/)[1]; // 提取索引
const value = $(this).val(); // 获取下拉框的值
estimateMaterialDataList[index].materialGearPosition = value; // 更新料号档位
});
const combinedData = Object.assign({}, estimateData, {
salesEstimateDetailList: estimateMaterialDataList,
});
// 合并表单数据和表格数据
console.log(combinedData)
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/add", jsonData);
}
}
$("input[name='pricingDate']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
// 点击选择物料按钮
function insertMaterialRow() {
var url = prefix + '/estimateMaterialSelect';
var options = {
title: '选择物料',
url: url,
callBack: estimateDoSubmit
};
$.modal.openOptions(options);
}
$(function() {
var options = {
id:'bootstrap-table',
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
modalName: "销售估价详情",
editFiled:"noTaxRmb",
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: '料号档位',
width: 100,
field: 'materialGearPosition',
formatter: function(value, row, index) {
// 为每个下拉框添加唯一的 id 和 name
var selectId = 'materialGearPosition_' + index;
var selectName = 'salesEstimateDetailList[' + index + '].materialGearPosition';
// 创建下拉框 HTML
var html = $.common.sprintf(
"<select class='form-control' id='%s' name='%s' required>" +
" <option value='0' %s>A</option>" +
" <option value='1' %s>B</option>" +
" <option value='2' %s>C</option>" +
" <option value='3' %s>D</option>" +
" <option value='4' %s>E</option>" +
" <option value='5' %s>F</option>" +
"</select>",
selectId, selectName,
value === '0' ? 'selected' : '',
value === '1' ? 'selected' : '',
value === '2' ? 'selected' : '',
value === '3' ? 'selected' : '',
value === '4' ? 'selected' : '',
value === '5' ? 'selected' : ''
);
return html;
}
},
{
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('');
}
}],
onEditableSave:function(field, row, oldValue, $el){
// 确保getTotalAmount函数存在且正确引用
getTotalAmount();
},
};
$.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.materialNo){
$.modal.alertError("不能选择已添加过的相同物料");
return;
}
}
console.log("rowData: "+rowData);
$("#bootstrap-table").bootstrapTable('insertRow', {
index:1,
row: {
materialNo:rowData.materialNo,
materialPhotourl:rowData.photoUrl,
materialName: rowData.materialName,
materialType: rowData.materialType,
materialDescribe: rowData.describe,
materialBrand: rowData.brand,
materialUnit: rowData.unit,
materialProcessMethod: rowData.processMethod,
materialDeptType: rowData.warehouseDept,
materialNum: 0
}
})
getTotalAmount();
layer.close(index);
}
// 逻辑删除前端的一行数据
function removeMaterialRow(materialNo){
$("#bootstrap-table").bootstrapTable('remove', {
field: 'materialNo',
values: materialNo
})
getTotalAmount();
}
// $(document).ready(function() {
// // 监听表格中的物料数量输入框的变化
// $('#bootstrap-table').on('input', '.material-num-input', function() {
// getTotalAmount();
// });
//
// // 初始加载时也计算一次
// getTotalAmount();
// });
//
// function getTotalAmount() {
// let getData = $('#bootstrap-table').bootstrapTable('getData');
// let enterpriseSum = 0;
//
// // 计算物料数量总和
// enterpriseSum = getData.reduce((sum, item) => sum + (parseInt(item.materialNum) || 0), 0);
//
// // 更新页面上的输入框
// $("#enterpriseSum_add").val(enterpriseSum);
// }
//form计算模块
function getTotalAmount(){
let getData = $('#bootstrap-table').bootstrapTable('getData');
var materialSum = 0;
var enterpriseSum = 0;
var noTaxRmb = 0;
var taxRmb = 0;
var allNoTaxRmb = 0;
var allTaxRmb = 0;
var noTaxDollar = 0;
var taxDollar = 0;
var allNoTaxDollar = 0;
var allTaxDollar = 0;
materialSum = getData.length;
enterpriseSum = getData.reduce((sum, item) => sum + (parseInt(item.materialNum) || 0), 0);
for(var i=0;i<getData.length;i++){
noTaxRmb += parseFloat(getData[i].noTaxRmb) || 0;
taxRmb += parseFloat(getData[i].taxRmb) || 0;
allNoTaxRmb += parseFloat(getData[i].allNoTaxRmb) || 0;
allTaxRmb += parseFloat(getData[i].allTaxRmb) || 0;
noTaxDollar += parseFloat(getData[i].noTaxDollar) || 0;
taxDollar += parseFloat(getData[i].taxDollar) || 0;
allNoTaxDollar += parseFloat(getData[i].allNoTaxDollar) || 0;
allTaxDollar += parseFloat(getData[i].allTaxDollar) || 0;
}
noTaxRmb = noTaxRmb.toFixed(2);
taxRmb = taxRmb.toFixed(2);
allNoTaxRmb = allNoTaxRmb.toFixed(2);
allTaxRmb = allTaxRmb.toFixed(2);
noTaxDollar = noTaxDollar.toFixed(2);
taxDollar = taxDollar.toFixed(2);
allNoTaxDollar = allNoTaxDollar.toFixed(2);
allTaxDollar = allTaxDollar.toFixed(2);
$("input[name='materialSum']").val(materialSum);
$("input[name='enterpriseSum']").val(enterpriseSum);
$("input[name='noTaxRmb']").val(noTaxRmb);
$("input[name='taxRmb']").val(taxRmb);
$("input[name='allNoTaxRmb']").val(allNoTaxRmb);
$("input[name='allTaxRmb']").val(allTaxRmb);
$("input[name='noTaxDollar']").val(noTaxDollar);
$("input[name='taxDollar']").val(taxDollar);
$("input[name='allNoTaxDollar']").val(allNoTaxDollar);
$("input[name='allTaxDollar']").val(allTaxDollar);
}
// 计算并更新所有其他总和
// function updateAllSums() {
// let getData = $('#bootstrap-table').bootstrapTable('getData');
// let noTaxRmb = 0;
// let taxRmb = 0;
// let allNoTaxRmb = 0;
// let allTaxRmb = 0;
// let noTaxDollar = 0;
// let taxDollar = 0;
// let allNoTaxDollar = 0;
// let allTaxDollar = 0;
//
// getData.forEach(item => {
// noTaxRmb += parseFloat(item.noTaxRmb) || 0;
// taxRmb += parseFloat(item.taxRmb) || 0;
// allNoTaxRmb += parseFloat(item.allNoTaxRmb) || 0;
// allTaxRmb += parseFloat(item.allTaxRmb) || 0;
// noTaxDollar += parseFloat(item.noTaxDollar) || 0;
// taxDollar += parseFloat(item.taxDollar) || 0;
// allNoTaxDollar += parseFloat(item.allNoTaxDollar) || 0;
// allTaxDollar += parseFloat(item.allTaxDollar) || 0;
// });
//
// noTaxRmb = noTaxRmb.toFixed(2);
// taxRmb = taxRmb.toFixed(2);
// allNoTaxRmb = allNoTaxRmb.toFixed(2);
// allTaxRmb = allTaxRmb.toFixed(2);
// noTaxDollar = noTaxDollar.toFixed(2);
// taxDollar = taxDollar.toFixed(2);
// allNoTaxDollar = allNoTaxDollar.toFixed(2);
// allTaxDollar = allTaxDollar.toFixed(2);
//
// $("input[name='noTaxRmb']").val(noTaxRmb);
// $("input[name='taxRmb']").val(taxRmb);
// $("input[name='allNoTaxRmb']").val(allNoTaxRmb);
// $("input[name='allTaxRmb']").val(allTaxRmb);
// $("input[name='noTaxDollar']").val(noTaxDollar);
// $("input[name='taxDollar']").val(taxDollar);
// $("input[name='allNoTaxDollar']").val(allNoTaxDollar);
// $("input[name='allTaxDollar']").val(allTaxDollar);
// }
</script>
</body>
</html>

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

@ -52,6 +52,9 @@
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="sales:estimate:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-success" onclick="addTemplate()" shiro:hasPermission="sales:estimate:addOperatingCostTemplate">
<i class="fa fa-plus"></i> 经营成本模板
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
@ -64,6 +67,8 @@
var removeFlag = [[${@permission.hasPermi('sales:estimate:remove')}]];
var cancelFlag = [[${@permission.hasPermi('sales:estimate:cancel')}]];
var restoreFlag = [[${@permission.hasPermi('sales:estimate:restore')}]];
var engineeringAddFlag = [[${@permission.hasPermi('sales:estimate:engineeringAdd')}]];
var estimateStatusDatas = [[${@dict.getType('estimate_status')}]];
var commonCurrencyDatas = [[${@dict.getType('sys_common_currency')}]];
var prefix = ctx + "sales/estimate";
@ -163,6 +168,9 @@
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.salesEstimateId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.salesEstimateId + '\')"><i class="fa fa-remove"></i>删除</a> ');
if(row.estimateStatus == '0'){
actions.push('<a class="btn btn-success btn-xs ' + engineeringAddFlag + '" href="javascript:void(0)" onclick="engineeringAdd(\'' + row.salesEstimateId + '\')"><i class="fa fa-edit"></i>添加BOM</a> ');
}
if(row.delFlag == '0'){
actions.push('<a class="btn btn-danger btn-xs ' + cancelFlag + '" href="javascript:void(0)" onclick="$.operate.cancel(\'' + row.id + '\')"><i class="fa fa-remove"></i>作废</a> ');
}else{
@ -174,6 +182,19 @@
};
$.table.init(options);
});
//总经理添加经营成本模板
function addTemplate(){
var url = prefix + "/addOperatingCostTemplate";
$.modal.open("添加经营成本模板", url);
}
//工程 添加BOM
function engineeringAdd(salesEstimateId){
var url = prefix + "/engineeringAdd/" + salesEstimateId;
$.modal.open("添加BOM", url);
}
</script>
</body>
</html>

52
ruoyi-admin/src/main/resources/templates/system/customer/detail.html

@ -107,15 +107,30 @@
<input name="bankAccount" th:field="*{bankAccount}" class="form-control" type="text" disabled/>
</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_common_currency')}">
<input type="radio" th:id="${'commonCurrency_' + dict.dictCode}"
name="commonCurrency" th:value="${dict.dictValue}" th:checked="${dict.default}" th:field="*{commonCurrency}" required disabled>
<label th:for="${'commonCurrency_' + dict.dictCode}" th:text="${dict.dictLabel}" ></label>
<!-- <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 type="radio" th:id="${'commonCurrency_' + dict.dictCode}"-->
<!-- name="commonCurrency" th:value="${dict.dictValue}" th:checked="${dict.default}" th:field="*{commonCurrency}" required disabled>-->
<!-- <label th:for="${'commonCurrency_' + 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="checkbox">
<label>
<input disabled type="checkbox" id="rmb" name="currency" value="1" th:field="*{currency}" th:checked="${currency != null and #lists.contains(currency, '1')}"/> rmb/含税
</label>
</div>
<div class="checkbox">
<label>
<input disabled type="checkbox" id="usd" name="currency" value="2" th:field="*{currency}" th:checked="${currency != null and #lists.contains(currency, '2')}"/> 美元/不含税
</label>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-6 control-label">诚信评级:</label>
@ -126,16 +141,16 @@
</select>
</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 type="radio" th:id="${'confirmTax_' + dict.dictCode}" name="confirmTax" th:value="${dict.dictValue}" disabled
th:checked="${dict.default}" th:field="*{confirmTax}">
<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 type="radio" th:id="${'confirmTax_' + dict.dictCode}" name="confirmTax" th:value="${dict.dictValue}" disabled-->
<!-- th:checked="${dict.default}" th:field="*{confirmTax}">-->
<!-- <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">
@ -297,6 +312,7 @@
var prefixContacts = ctx + "system/contacts";
var customer = [[${sysCustomer}]];
$(function(){
console.log(customer);
//获取单号
$.ajax({
url: prefix + "/getId",

80
ruoyi-admin/src/main/resources/templates/system/customer/edit.html

@ -116,10 +116,15 @@
<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}" th:field="*{commonCurrency}">
<label th:for="${'commonCurrency_' + dict.dictCode}" th:text="${dict.dictLabel}" ></label>
<div class="checkbox">
<label>
<input type="checkbox" id="rmb" name="currency" value="1" th:field="*{currency}" th:checked="${currency != null and #lists.contains(currency, '1')}"/> rmb/含税
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="usd" name="currency" value="2" th:field="*{currency}" th:checked="${currency != null and #lists.contains(currency, '2')}"/> 美元/不含税
</label>
</div>
</div>
</div>
@ -132,18 +137,8 @@
</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}" th:field="*{confirmTax}"></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="taxLabel">国内税率:</label>
<div class="col-sm-6">
<div class="input-group">
<input name="taxRate" th:field="*{taxRate}" class="form-control" type="text" required />
@ -281,6 +276,59 @@
}
}
$(function(){
// 监听 change 事件
$('input[name=currency]').on('change', function() {
var taxLable = $('#taxLabel')[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",
autoclose: true
});
$("#form-customer-edit").validate({
focusCleanup: true,
//配置验证规则,key就是被验证的dom对象,value就是调用验证的方法(也是json格式)
rules: {
//这里的customerPurser 指的是上面标签的name属性
customerPurser: {
required: true,
},
taxRate: {
required: function () {
if ($('input[value=1]:checked').length > 0) {
console.log('选框 1 已经被选中');
return true;
} else {
return false;
}
},
}
},
// 验证失败的提示信息
messages: {
customerPurser: {
required: "必填" //自定义required的错误信息内容
},
taxRate: {
required: "必填",
}
},
});
$.ajax({
url: ctx + 'system/salesOrder/getBinessMembers',
type: 'get',
@ -298,7 +346,7 @@
}
}
});
})
});
$("input[name='establishedTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",

71
ruoyi-admin/src/main/resources/templates/system/empRequisiteOrder/add.html

@ -2,6 +2,8 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增员工领料单')" />
<th:block th:include="include :: bootstrap-editable-css"/>
<th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
@ -13,11 +15,9 @@
</div>
</div>
<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">
<select name="correlationCode" class="form-control" >
<option value="">请选择</option>
</select>
<input name="correlationCode" class="form-control" type="text">
</div>
</div>
@ -45,6 +45,8 @@
</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: bootstrap-table-editable-js"/>
<th:block th:include="include :: bootstrap-fileinput-js"/>
<script th:inline="javascript">
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
var auditStatusDatas = [[${@dict.getType('auditStatus')}]];
@ -55,7 +57,7 @@
//获取子表信息
$(function() {
getRequisitieCode();
selectSaleOrder();
// selectSaleOrder();
getSelections();
var options = {
id:'bootstrap-sub-table-empRequisitionChild',
@ -72,41 +74,62 @@
},
{title: '物料索引id',field: 'materialId',align: 'center',visible: false},
{title: '料号',field: 'materialCode',align: 'center'},
{title: '物料名称',field: 'materialName',align: 'center'},
{title: '图片',field: 'photoUrl',
formatter: function(value, row, index) {
return $.table.imageView(value);
}
},
{title: '物料名称',field: 'materialName',align: 'center'},
{title: '物料类型',field: 'materialType',align: 'center',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
},
{title: '型号',field: 'materialModel',align: 'center'},
{title: '规格',field: 'specification',align: 'center'},
{ title: '描述',field: 'describe',align: 'center'},
{title: '型号',field: 'materialModel',align: 'center',visible: false},
{title: '规格',field: 'specification',align: 'center',visible: false},
{ title: '描述',field: 'describe',align: 'center',visible: false},
{title: '品牌',field: 'brand',align: 'center'},
{ title: '单位',field: 'unit',align: 'center',
formatter: function(value, row, index) {
return $.table.selectDictLabel(sysUnitClassDatas, value);
}
},
{title: '半成品类型',field: 'processMethod',align: 'center',
{title: '半成品类型',field: 'processMethod',align: 'center',visible: false,
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
},
{title: '物料的数量', field: 'materialNum',align: 'center',editable: true,},
{title: '物料的不含税单价(RMB)',field: 'materialNoRmb',align: 'center',},
{title: '物料的含税单价(RMB)',field: 'materialRmb',align: 'center',},
{title: '物料的含税总价(RMB)',field: 'materialNoRmbSum',align: 'center',},
{title: '物料的不含税总价(RMB)',field: 'materialRmbSum',align: 'center',},
{title: '不含税单价(RMB)',field: 'materialNoRmb',align: 'center',},
{title: '含税单价(RMB)',field: 'materialRmb',align: 'center',},
{title: '物料的数量', field: 'materialNum',align: 'center',
editable:{
type : 'text',
mode: 'inline',
title : '物料的数量',
validate : function(value) {
if (!value) {
return '用量不能为空';
}
if (isNaN(value)) {
return '用量必须为数字';
}
}
},
},
{title: '不含税总价(RMB)',field: 'materialRmbSum',align: 'center',},
{title: '含税总价(RMB)',field: 'materialNoRmbSum',align: 'center',},
{title: '录入人',field: 'createBy',align: 'center',visible: false},
{title: '录入时间',field: 'createTime',align: 'center',visible: false },
{title: '更新人',field: 'updateBy',align: 'center',visible: false},
{title: '上次更新时间',field: 'updateTime',align: 'center',visible: false},
{title: '备注',field: 'remark',align: 'center',editable: true},
{title: '备注',field: 'remark',align: 'center',
editable:{
type : 'text',
mode: 'inline',
title : '备注',
},
},
{title: '操作', align: 'center',
formatter: function (value, row, index) {
var actions = [];
@ -126,11 +149,11 @@
console.log(uniqueId);
var iframeWin = window[layero.find('iframe')[0]['name']];
var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections')[0];
console.log("rowData: "+rowData);
console.log("rowData: "+JSON.stringify(rowData));
$("#bootstrap-sub-table-empRequisitionChild").bootstrapTable('insertRow', {
index:1,
row: {
materialId:rowData.materialId,
materialId:rowData.id,
materialCode: rowData.materialNo,
materialName: rowData.materialName,
materialType: rowData.materialType,
@ -139,7 +162,9 @@
unit: rowData.unit,
processMethod: rowData.processMethod,
photoUrl: rowData.photoUrl,
materialNum: 0,
materialModel: rowData.materialModel,
specification: rowData.specification,
materialNum: "",
materialRmb: 0,
materialNoRmb: 0,
materialNoRmbSum: 0,
@ -193,8 +218,8 @@
baseEmpRequisiteOrderVO.materialAmount = rows.length;
for (var i = 0; i < rows.length; i++) {
var requisiteChild = {
materialId: rows[i].id,
materialCode: rows[i].materialNo,
materialId: rows[i].materialId,
materialCode: rows[i].materialCode,
materialName: rows[i].materialName,
materialType: rows[i].materialType,
describe: rows[i].describe,
@ -202,6 +227,8 @@
unit: rows[i].unit,
processMethod: rows[i].processMethod,
photoUrl: rows[i].photoUrl,
materialModel: rows[i].materialModel,
specification: rows[i].specification,
materialNum: rows[i].materialNum,
materialRmb: rows[i].materialRmb,
materialNoRmb: rows[i].materialNoRmb,
@ -209,10 +236,10 @@
materialRmbSum: rows[i].materialRmbSum,
remark: rows[i].remark
};
console.log(requisiteChild);
baseEmpRequisiteOrderVO.baseEmpRequisiteOrderChildList.push(requisiteChild);
}
}
console.log(JSON.stringify(baseEmpRequisiteOrderVO));
$.operate.saveJson(prefix + "/add", JSON.stringify(baseEmpRequisiteOrderVO));
// $.operate.save(prefix + "/add", $('#form-empRequisiteOrder-add').serialize());
}

89
ruoyi-admin/src/main/resources/templates/system/salesOrder/edit.html

@ -189,7 +189,7 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">美元汇率:</label>
<label class="col-sm-3 control-label is-required" id="usdLabel">美元汇率:</label>
<div class="col-sm-8">
<input name="usdTax" id="usdTax_edit" class="form-control" th:field="*{usdTax}" type="number" required />
</div>
@ -205,7 +205,7 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">国内税率:</label>
<label class="col-sm-3 control-label is-required" id="rmbLabel">国内税率:</label>
<div class="col-sm-8">
<input name="taxRate" id="taxRate_edit" th:field="*{taxRate}" class="form-control" type="number" required>
</div>
@ -332,7 +332,7 @@
var processMethodDatas = [[${@dict.getType('processMethod')}]];
var sysSalesOrder = [[${sysSalesOrder}]];
var warehouseDeptDatas = [[${@dict.getType('warehouseDept')}]];
$("#form-salesOrder-edit").validate({focusCleanup: true});
// $("#form-salesOrder-edit").validate({focusCleanup: true});
$(function() {
var options = {
id:'bootstrap-table-editOrder',
@ -598,7 +598,53 @@
}
}
});
var rmbLabel = $('#rmbLabel')[0];
var rmbClass = rmbLabel.className.split(' ');
var usdLabel = $('#usdLabel')[0];
var usdClass = usdLabel.className.split(' ');
var commonCurrency = [[${sysSalesOrder.commonCurrency}]];
if(commonCurrency==="1"){
for (var i = 0; i < usdClass.length; i++) {
if (usdClass[i].includes('is-required')) {
usdLabel.classList.remove(usdClass[i]);
}
}
}else if(commonCurrency==="2"){
for (var i = 0; i < rmbClass.length; i++) {
if (rmbClass[i].includes('is-required')) {
rmbLabel.classList.remove(rmbClass[i]);
}
}
}
});
// 选择币种
$("#commonCurrency_edit").on('change', function() {
var selectedValue = $(this).val();
var rmbLabel = $('#rmbLabel')[0];
var rmbClass = rmbLabel.className.split(' ');
var usdLabel = $('#usdLabel')[0];
var usdClass = usdLabel.className.split(' ');
console.log(usdLabel);
console.log(usdClass);
if(selectedValue ==="1"){
if (!rmbClass.includes('is-required')) {
rmbLabel.classList.add('is-required');
}
for (var i = 0; i < usdClass.length; i++) {
if (usdClass[i].includes('is-required')) {
usdLabel.classList.remove(usdClass[i]);
}
}
}else if(selectedValue ==="2"){
if (!usdClass.includes('is-required')) {
usdLabel.classList.add('is-required');
}
for (var i = 0; i < rmbClass.length; i++) {
if (rmbClass[i].includes('is-required')) {
rmbLabel.classList.remove(rmbClass[i]);
}
}
}
});
$('#customerContact_edit').on('select2:select', function (e) {
var data = e.params.data;
@ -706,6 +752,41 @@
})
}
$("#form-salesOrder-edit").validate({
focusCleanup: true,
//配置验证规则,key就是被验证的dom对象,value就是调用验证的方法(也是json格式)
rules: {
//这里的customerPurser 指的是上面标签的name属性
taxRate: {
required: function () {
if ($("#commonCurrency_edit").val() === "1") {
return true;
} else {
return false;
}
},
},
usdTax: {
required: function () {
if ($("#commonCurrency_edit").val() === "2") {
return true;
} else {
return false;
}
},
}
},
// 验证失败的提示信息
messages: {
taxRate: {
required: "必填",
},
usdTax: {
required: "必填",
}
},
});
function submitHandler() {
if ($.validate.form()) {
var formData = $("#form-salesOrder-edit").serializeArray();

4
ruoyi-admin/src/main/resources/templates/system/salesOrder/taskYwjlVerify.html

@ -151,9 +151,9 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">美元汇率:</label>
<label class="col-sm-3 control-label">美元汇率:</label>
<div class="col-sm-8">
<input name="usdTax" id="usdTax_edit" class="form-control" th:field="*{usdTax}" type="number" required readonly/>
<input name="usdTax" id="usdTax_edit" class="form-control" th:field="*{usdTax}" type="number" readonly/>
</div>
</div>
<div class="form-group">

4
ruoyi-admin/src/main/resources/templates/system/salesOrder/taskYwzgVerify.html

@ -151,9 +151,9 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">美元汇率:</label>
<label class="col-sm-3 control-label">美元汇率:</label>
<div class="col-sm-8">
<input name="usdTax" id="usdTax_edit" class="form-control" th:field="*{usdTax}" type="number" required readonly/>
<input name="usdTax" id="usdTax_edit" class="form-control" th:field="*{usdTax}" type="number" readonly/>
</div>
</div>
<div class="form-group">

4
ruoyi-admin/src/main/resources/templates/system/salesOrder/taskZozjVerify.html

@ -151,9 +151,9 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">美元汇率:</label>
<label class="col-sm-3 control-label">美元汇率:</label>
<div class="col-sm-8">
<input name="usdTax" id="usdTax_edit" class="form-control" th:field="*{usdTax}" type="number" required readonly/>
<input name="usdTax" id="usdTax_edit" class="form-control" th:field="*{usdTax}" type="number" readonly/>
</div>
</div>
<div class="form-group">

Loading…
Cancel
Save