Browse Source

[feat] 工程管理

新增 物料销售历史实体类
新增 展示 物料销售价格历史后端接口
新增 展示 物料销售价格历史的具体实现类
新增 根据物料号查询销售订单子表后端方法
物料详情前端页面去掉之前不符合的销售价历史,按照prd新增新的销售价历史列表,并把数量、价格相关字段进行前端合计操作
dev
liuxiaoxu 3 months ago
parent
commit
6273d595a7
  1. 15
      ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpMaterialController.java
  2. 42
      ruoyi-admin/src/main/java/com/ruoyi/erp/domain/vo/ErpMaterialSalesHistoryVo.java
  3. 6
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpMaterialService.java
  4. 69
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialServiceImpl.java
  5. 5
      ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesOrderChildMapper.java
  6. 7
      ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml
  7. 278
      ruoyi-admin/src/main/resources/templates/erp/material/detail.html

15
ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpMaterialController.java

@ -10,6 +10,7 @@ import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.erp.domain.ErpMaterial; import com.ruoyi.erp.domain.ErpMaterial;
import com.ruoyi.erp.domain.ErpMaterialVo; import com.ruoyi.erp.domain.ErpMaterialVo;
import com.ruoyi.erp.domain.vo.ErpMaterialSalesHistoryVo;
import com.ruoyi.erp.mapper.ErpMaterialMapper; import com.ruoyi.erp.mapper.ErpMaterialMapper;
import com.ruoyi.erp.service.IErpMaterialService; import com.ruoyi.erp.service.IErpMaterialService;
import com.ruoyi.process.general.service.IProcessService; import com.ruoyi.process.general.service.IProcessService;
@ -469,4 +470,18 @@ public class ErpMaterialController extends BaseController
List<SysUser> list = sysUserService.selectRoleToUserList("gcwyRole,gcjlRole,gczgRole,yfzjRole,"); List<SysUser> list = sysUserService.selectRoleToUserList("gcwyRole,gcjlRole,gczgRole,yfzjRole,");
return getDataTable(list); return getDataTable(list);
} }
/**
* 物料销售价格历史
* */
@PostMapping ("/getMaterialSalesHistoryList")
@ResponseBody
public TableDataInfo getMaterialSalesHistoryList(@RequestParam String materialNo){
startPage();
List<ErpMaterialSalesHistoryVo> list = erpMaterialService.selectErpMaterialSalesHistoryList(materialNo);
return getDataTable(list);
}
} }

42
ruoyi-admin/src/main/java/com/ruoyi/erp/domain/vo/ErpMaterialSalesHistoryVo.java

@ -0,0 +1,42 @@
package com.ruoyi.erp.domain.vo;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
//物料销售历史
@Data
public class ErpMaterialSalesHistoryVo {
//销售时间
private Date salesTime;
//物料数量
private Integer materialNum;
//币种
private String commonCurrency;
//含税价格
private double taxPrice;
//不含税价格
private double noTaxPrice;
//含税总价
private double taxSum;
//不含税总价
private double noTaxSum;
//业务员
private String salesUser;
//关联销售单号
private String salesOrderCode;
//合计
private double total;
}

6
ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpMaterialService.java

@ -2,6 +2,7 @@ package com.ruoyi.erp.service;
import com.ruoyi.erp.domain.ErpMaterial; import com.ruoyi.erp.domain.ErpMaterial;
import com.ruoyi.erp.domain.ErpMaterialVo; import com.ruoyi.erp.domain.ErpMaterialVo;
import com.ruoyi.erp.domain.vo.ErpMaterialSalesHistoryVo;
import org.activiti.engine.runtime.ProcessInstance; import org.activiti.engine.runtime.ProcessInstance;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -139,4 +140,9 @@ public interface IErpMaterialService
* 通过物料信息作废物料信息 * 通过物料信息作废物料信息
* */ * */
int cancelErpMaterialByObject(ErpMaterial erpMaterial); int cancelErpMaterialByObject(ErpMaterial erpMaterial);
/**
* 查询物料销售价历史
* */
List<ErpMaterialSalesHistoryVo> selectErpMaterialSalesHistoryList(String materialNo);
} }

69
ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialServiceImpl.java

@ -11,11 +11,15 @@ import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.erp.domain.ErpMaterial; import com.ruoyi.erp.domain.ErpMaterial;
import com.ruoyi.erp.domain.ErpMaterialVo; import com.ruoyi.erp.domain.ErpMaterialVo;
import com.ruoyi.erp.domain.vo.ErpMaterialSalesHistoryVo;
import com.ruoyi.erp.mapper.ErpMaterialMapper; import com.ruoyi.erp.mapper.ErpMaterialMapper;
import com.ruoyi.erp.service.IErpMaterialService; import com.ruoyi.erp.service.IErpMaterialService;
import com.ruoyi.process.general.service.IProcessService; import com.ruoyi.process.general.service.IProcessService;
import com.ruoyi.process.todoitem.mapper.BizTodoItemMapper; import com.ruoyi.process.todoitem.mapper.BizTodoItemMapper;
import com.ruoyi.system.domain.SysAttach; import com.ruoyi.system.domain.*;
import com.ruoyi.system.domain.Vo.ExportCustomerQuoteChildVo;
import com.ruoyi.system.mapper.SysSalesOrderChildMapper;
import com.ruoyi.system.mapper.SysSalesOrderMapper;
import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.service.ISysAttachFileService; import com.ruoyi.system.service.ISysAttachFileService;
import com.ruoyi.system.service.ISysAttachService; import com.ruoyi.system.service.ISysAttachService;
@ -34,6 +38,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
/** /**
@ -75,6 +80,14 @@ public class ErpMaterialServiceImpl implements IErpMaterialService
private ISysRoleService roleService; private ISysRoleService roleService;
@Autowired
private SysSalesOrderChildMapper sysSalesOrderChildMapper;
@Autowired
private SysSalesOrderMapper sysSalesOrderMapper;
private final static String RMB = "1"; //RMB
/** /**
* 查询物料信息 * 查询物料信息
* *
@ -507,4 +520,58 @@ public class ErpMaterialServiceImpl implements IErpMaterialService
public List<ErpMaterialVo> selectAllErpMaterialListByMaterialVo(ErpMaterialVo erpMaterialVo) { public List<ErpMaterialVo> selectAllErpMaterialListByMaterialVo(ErpMaterialVo erpMaterialVo) {
return erpMaterialMapper.selectAllErpMaterialListByMaterialVo(erpMaterialVo); return erpMaterialMapper.selectAllErpMaterialListByMaterialVo(erpMaterialVo);
} }
/**
* 查询物料销售价历史
* */
@Override
public List<ErpMaterialSalesHistoryVo> selectErpMaterialSalesHistoryList(String materialNo) {
List<ErpMaterialSalesHistoryVo> erpMaterialSalesHistoryVos = new ArrayList<>();
List<SysSalesOrderChild> salesOrderChildList = sysSalesOrderChildMapper.selectOrderChildListByMaterialNo(materialNo);
for (SysSalesOrderChild sysSalesOrderChild : salesOrderChildList) {
ErpMaterialSalesHistoryVo erpMaterialSalesHistoryVo = new ErpMaterialSalesHistoryVo();
String quoteId = sysSalesOrderChild.getQuoteId();
SysSalesOrderVo sysSalesOrderVo = sysSalesOrderMapper.selectSysSalesOrderBySalesOrderCode(quoteId);
setMaterialPrice(erpMaterialSalesHistoryVo, sysSalesOrderVo, sysSalesOrderChild);
erpMaterialSalesHistoryVo.setMaterialNum(sysSalesOrderChild.getMaterialNum());
erpMaterialSalesHistoryVo.setCommonCurrency(sysSalesOrderVo.getCommonCurrency());
erpMaterialSalesHistoryVo.setSalesTime(sysSalesOrderChild.getCreateTime());
erpMaterialSalesHistoryVo.setSalesUser(sysSalesOrderChild.getBusinessMembers());
erpMaterialSalesHistoryVo.setSalesOrderCode(sysSalesOrderChild.getQuoteId());
erpMaterialSalesHistoryVos.add(erpMaterialSalesHistoryVo);
}
return erpMaterialSalesHistoryVos;
}
//区分不同币种的金额
private void setMaterialPrice(ErpMaterialSalesHistoryVo vo, SysSalesOrderVo sysSalesOrderVo, SysSalesOrderChild child) {
if (RMB.equals(sysSalesOrderVo.getCommonCurrency())) {
// RMB
Double materialRmb = child.getMaterialRmb();
Double materialNoRmb = child.getMaterialNoRmb();
Double materialNoRmbSum = child.getMaterialNoRmbSum();
Double materialRmbSum = child.getMaterialRmbSum();
vo.setNoTaxPrice(materialNoRmb);
vo.setTaxPrice(materialRmb);
vo.setNoTaxSum(materialNoRmbSum);
vo.setTaxSum(materialRmbSum);
} else {
//美元
Double materialUsd = child.getMaterialUsd();
Double materialNoUsd = child.getMaterialNoUsd();
Double materialNoUsdSum = child.getMaterialNoUsdSum();
Double materialUsdSum = child.getMaterialUsdSum();
vo.setNoTaxPrice(materialNoUsd);
vo.setTaxPrice(materialUsd);
vo.setNoTaxSum(materialNoUsdSum);
vo.setTaxSum(materialUsdSum);
}
}
} }

5
ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesOrderChildMapper.java

@ -47,4 +47,9 @@ public interface SysSalesOrderChildMapper {
*/ */
Integer deleteSysSalesOrderChildByQuoteId(String salesOrderCode); Integer deleteSysSalesOrderChildByQuoteId(String salesOrderCode);
/**
* 根据物料号查询销售订单子表
* */
List<SysSalesOrderChild> selectOrderChildListByMaterialNo(String materialNo);
} }

7
ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml

@ -58,6 +58,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join erp_bom b left join erp_bom b
on a.materialCode = b.material_no on a.materialCode = b.material_no
</sql> </sql>
<select id="selectSysSalesOrderChildList" parameterType="SysSalesOrderChild" resultMap="SysSalesOrderChildResult"> <select id="selectSysSalesOrderChildList" parameterType="SysSalesOrderChild" resultMap="SysSalesOrderChildResult">
<include refid="selectSysSalesOrderChild"/> <include refid="selectSysSalesOrderChild"/>
<where> <where>
@ -113,6 +115,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where quoteId = #{quoteId} where quoteId = #{quoteId}
</select> </select>
<select id="selectOrderChildListByMaterialNo" parameterType="String" resultMap="SysSalesOrderChildResult">
<include refid="selectSysSalesOrderChild"/>
where a.materialCode = #{materialCode}
</select>
<insert id="insertSysSalesOrderChild" parameterType="SysSalesOrderChild" useGeneratedKeys="true" keyProperty="id"> <insert id="insertSysSalesOrderChild" parameterType="SysSalesOrderChild" useGeneratedKeys="true" keyProperty="id">
insert into sys_sales_order_child insert into sys_sales_order_child

278
ruoyi-admin/src/main/resources/templates/erp/material/detail.html

@ -335,245 +335,119 @@
$('#xiaoshou-table').bootstrapTable('destroy'); $('#xiaoshou-table').bootstrapTable('destroy');
var option2 ={ var option2 ={
id: "xiaoshou-table", id: "xiaoshou-table",
url: prefix + "/getMaterialSalesHistoryList",
showSearch: false, showSearch: false,
showRefresh: false, showRefresh: false,
showToggle: false, showToggle: false,
showColumns: false, showColumns: false,
uniqueId: "id", uniqueId: "id",
pageNumber:5,
pagination: false, // 设置不分页 pagination: false, // 设置不分页
sidePagination: "client", sidePagination: "client",
showFooter: true,
queryParams: function (params) { queryParams: function (params) {
//console.log("123"); //console.log("123");
var curParams = { var curParams = {
// 传递参数查询参数 materialNo: materialNo
pageSize: params.limit,
pageNum: params.offset / params.limit + 1,
finishProductCode: materialNo
}; };
return curParams return curParams
}, },
columns: [ columns: [
// {
// checkbox: true
// },
{
field: 'salesFinishId',
title: '订单id',
visible: false
},
{
field: 'salesOrderCode',
title: '订单编号'
},
{
field: 'salesOrderNumber',
title: '订单号码'
},
{
field: 'enterpriseCode',
title: '客户代码'
},
{
field: 'enterpriseName',
title: '客户名称'
},
{
field: 'paymentTerms',
title: '付款条件'
},
{
field: 'deliveryConditions',
title: '交货条件'
},
{
field: 'deliveryMethod',
title: '交货方式'
},
{
field: 'orderReceivingMode',
title: '接单方式'
},
{
field: 'customerContact',
title: '联系人'
},
{
field: 'customerFactory',
title: '客户厂区'
},
{
field: 'contactNumber',
title: '联系电话'
},
{
field: 'businessMembers',
title: '业务人员'
},
{
field: 'customerFax',
title: '传真号码'
},
{
field: 'deliveryAddress',
title: '交货地点'
},
{
field: 'orderReceivingTime',
title: '接单日期'
},
{
field: 'billingTime',
title: '开单日期时间'
},
{
field: 'customerRemarks',
title: '备注内容'
},
{
field: 'currentInventory',
title: '当前库存数',
visible: false
},
{
field: 'creditLimit',
title: '信用额度',
visible: false
},
{
field: 'unpaidAmount',
title: '未付款数',
visible: false
},
{
field: 'availableCredit',
title: '可用额度',
visible: false
},
{
field: 'confirmTax',
title: '是否含税',
visible: false
},
{
field: 'taxRate',
title: '税率',
visible: false
},
{
field: 'totalAmount',
title: '合计金额',
visible: false
},
{
field: 'modificationTime',
title: '修改日期',
visible: false
},
{ {
field: 'confirmTime', field: 'index',
title: '确认日期', title: '索引',
visible: false visible: false
}, },
{ {
field: 'fileUpload', field: 'salesTime',
title: '文件存储', title: '销售时间'
visible: false
}, },
{ {
field: 'confirmNo', field: 'materialNum',
title: '确认否', title: '数量',
formatter: function(value, row, index) { footerFormatter: function (value) {
return $.table.selectDictLabel(whetherDatas, value); var sum = 0;
}, for (var i in value) {
visible: false sum += parseFloat(value[i].materialNum);
}, }
{ return sum;
field: 'confirmName',
title: '确认人',
visible: false
},
{
field: 'auditNo',
title: '结案否',
formatter: function(value, row, index) {
return $.table.selectDictLabel(whetherDatas, value);
},
visible: false
},
{
field: 'nationalTaxBill',
title: '是否开国税发票',
visible: false
},
{
field: 'inventoryUnit',
title: '单位'
},
{
field: 'commonCurrency',
title: '币别',
formatter: function(value, row, index) {
return $.table.selectDictLabel(commonCurrencyDatas, value);
} }
}, },
{ {
field: 'processPrice', field: 'commonCurrency',
title: '单价' title: '币种'
},
{
field: 'productQuantity',
title: '数量'
},
{
field: 'amountMoney',
title: '金额'
},
{
field: 'deliveryTime',
title: '交期'
},
{
field: 'salesExplain',
title: '说明'
}, },
{ {
field: 'customerUseOrNot', field: 'taxPrice',
title: '客户使用否', title: '含税价格',
formatter: function(value, row, index) { footerFormatter: function (value) {
return $.table.selectDictLabel(whetherDatas, value); var sum = 0;
}, for (var i in value) {
visible: false sum += parseFloat(value[i].taxPrice);
}
return sum;
}
}, },
{ {
field: 'customerUseQuantity', field: 'noTaxPrice',
title: '客户使用数量', title: '不含税价格',
visible: false footerFormatter: function (value) {
var sum = 0;
for (var i in value) {
sum += parseFloat(value[i].noTaxPrice);
}
return sum;
}
}, },
{ {
field: 'customerUseRemarks', field: 'taxSum',
title: '客户使用备注说明', title: '含税总价',
visible: false footerFormatter: function (value) {
var sum = 0;
for (var i in value) {
sum += parseFloat(value[i].taxSum);
}
return sum;
}
}, },
{ {
field: 'accountReconciliationOrNot', field: 'noTaxSum',
title: '对账否', title: '不含税总价',
formatter: function(value, row, index) { footerFormatter: function (value) {
return $.table.selectDictLabel(whetherDatas, value); var sum = 0;
}, for (var i in value) {
visible: false sum += parseFloat(value[i].noTaxSum);
}
return sum;
}
}, },
{ {
field: 'accountReconciliationPerson', field: 'salesUser',
title: '对账人', title: '业务员',
visible: false
}, },
{ {
field: 'accountReconciliationTime', field: 'salesOrderCode',
title: '对账时间', title: '关联单号'
visible: false },
}] // {
// field: 'total',
// title: '合计',
// footerFormatter: function() {
// //统计总分数
// var count = 0;
// $.each(data.rows, function (index, item) {
// count += item.materialNum;
// });
// return count;
// }
// }
]
}; };
$.table.init(option2); $.table.init(option2);
//采购价历史 //采购价历史
$('#purser-table').bootstrapTable('destroy'); $('#purser-table').bootstrapTable('destroy');
var option3 = { var option3 = {

Loading…
Cancel
Save