diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpMaterialController.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpMaterialController.java index 260bf4ce..d214581d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpMaterialController.java +++ b/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.erp.domain.ErpMaterial; import com.ruoyi.erp.domain.ErpMaterialVo; +import com.ruoyi.erp.domain.vo.ErpMaterialSalesHistoryVo; import com.ruoyi.erp.mapper.ErpMaterialMapper; import com.ruoyi.erp.service.IErpMaterialService; import com.ruoyi.process.general.service.IProcessService; @@ -469,4 +470,18 @@ public class ErpMaterialController extends BaseController List list = sysUserService.selectRoleToUserList("gcwyRole,gcjlRole,gczgRole,yfzjRole,"); return getDataTable(list); } + + + + /** + * 物料销售价格历史 + * */ + @PostMapping ("/getMaterialSalesHistoryList") + @ResponseBody + public TableDataInfo getMaterialSalesHistoryList(@RequestParam String materialNo){ + startPage(); + List list = erpMaterialService.selectErpMaterialSalesHistoryList(materialNo); + return getDataTable(list); + } + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/domain/vo/ErpMaterialSalesHistoryVo.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/domain/vo/ErpMaterialSalesHistoryVo.java new file mode 100644 index 00000000..c5cb30da --- /dev/null +++ b/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; + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpMaterialService.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpMaterialService.java index e1da1c04..10f5aaa0 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpMaterialService.java +++ b/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.ErpMaterialVo; +import com.ruoyi.erp.domain.vo.ErpMaterialSalesHistoryVo; import org.activiti.engine.runtime.ProcessInstance; import org.springframework.transaction.annotation.Transactional; @@ -139,4 +140,9 @@ public interface IErpMaterialService * 通过物料信息作废物料信息 * */ int cancelErpMaterialByObject(ErpMaterial erpMaterial); + + /** + * 查询物料销售价历史 + * */ + List selectErpMaterialSalesHistoryList(String materialNo); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialServiceImpl.java index cacfc25f..5d69e420 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialServiceImpl.java +++ b/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.erp.domain.ErpMaterial; import com.ruoyi.erp.domain.ErpMaterialVo; +import com.ruoyi.erp.domain.vo.ErpMaterialSalesHistoryVo; import com.ruoyi.erp.mapper.ErpMaterialMapper; import com.ruoyi.erp.service.IErpMaterialService; import com.ruoyi.process.general.service.IProcessService; 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.service.ISysAttachFileService; import com.ruoyi.system.service.ISysAttachService; @@ -34,6 +38,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; +import java.math.BigDecimal; import java.util.*; /** @@ -75,6 +80,14 @@ public class ErpMaterialServiceImpl implements IErpMaterialService 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 selectAllErpMaterialListByMaterialVo(ErpMaterialVo erpMaterialVo) { return erpMaterialMapper.selectAllErpMaterialListByMaterialVo(erpMaterialVo); } + + + /** + * 查询物料销售价历史 + * */ + @Override + public List selectErpMaterialSalesHistoryList(String materialNo) { + + List erpMaterialSalesHistoryVos = new ArrayList<>(); + + List 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); + + } + + + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesOrderChildMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesOrderChildMapper.java index 9f18d8f7..262a4d0d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesOrderChildMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesOrderChildMapper.java @@ -47,4 +47,9 @@ public interface SysSalesOrderChildMapper { */ Integer deleteSysSalesOrderChildByQuoteId(String salesOrderCode); + + /** + * 根据物料号查询销售订单子表 + * */ + List selectOrderChildListByMaterialNo(String materialNo); } diff --git a/ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml index 0218c523..d3db5a17 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml +++ b/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 on a.materialCode = b.material_no + + + + insert into sys_sales_order_child diff --git a/ruoyi-admin/src/main/resources/templates/erp/material/detail.html b/ruoyi-admin/src/main/resources/templates/erp/material/detail.html index 3e35a698..609f6c89 100644 --- a/ruoyi-admin/src/main/resources/templates/erp/material/detail.html +++ b/ruoyi-admin/src/main/resources/templates/erp/material/detail.html @@ -335,245 +335,119 @@ $('#xiaoshou-table').bootstrapTable('destroy'); var option2 ={ id: "xiaoshou-table", + url: prefix + "/getMaterialSalesHistoryList", showSearch: false, showRefresh: false, showToggle: false, showColumns: false, uniqueId: "id", + pageNumber:5, pagination: false, // 设置不分页 sidePagination: "client", + showFooter: true, queryParams: function (params) { //console.log("123"); var curParams = { - // 传递参数查询参数 - pageSize: params.limit, - pageNum: params.offset / params.limit + 1, - finishProductCode: materialNo + materialNo: materialNo }; return curParams }, 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', - title: '确认日期', + field: 'index', + title: '索引', visible: false }, { - field: 'fileUpload', - title: '文件存储', - visible: false + field: 'salesTime', + title: '销售时间' }, { - field: 'confirmNo', - title: '确认否', - formatter: function(value, row, index) { - return $.table.selectDictLabel(whetherDatas, value); - }, - visible: false - }, - { - 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: 'materialNum', + title: '数量', + footerFormatter: function (value) { + var sum = 0; + for (var i in value) { + sum += parseFloat(value[i].materialNum); + } + return sum; } }, { - field: 'processPrice', - title: '单价' - }, - { - field: 'productQuantity', - title: '数量' - }, - { - field: 'amountMoney', - title: '金额' - }, - { - field: 'deliveryTime', - title: '交期' - }, - { - field: 'salesExplain', - title: '说明' + field: 'commonCurrency', + title: '币种' }, { - field: 'customerUseOrNot', - title: '客户使用否', - formatter: function(value, row, index) { - return $.table.selectDictLabel(whetherDatas, value); - }, - visible: false + field: 'taxPrice', + title: '含税价格', + footerFormatter: function (value) { + var sum = 0; + for (var i in value) { + sum += parseFloat(value[i].taxPrice); + } + return sum; + } }, { - field: 'customerUseQuantity', - title: '客户使用数量', - visible: false + field: 'noTaxPrice', + title: '不含税价格', + footerFormatter: function (value) { + var sum = 0; + for (var i in value) { + sum += parseFloat(value[i].noTaxPrice); + } + return sum; + } }, { - field: 'customerUseRemarks', - title: '客户使用备注说明', - visible: false + field: 'taxSum', + title: '含税总价', + footerFormatter: function (value) { + var sum = 0; + for (var i in value) { + sum += parseFloat(value[i].taxSum); + } + return sum; + } }, { - field: 'accountReconciliationOrNot', - title: '对账否', - formatter: function(value, row, index) { - return $.table.selectDictLabel(whetherDatas, value); - }, - visible: false + field: 'noTaxSum', + title: '不含税总价', + footerFormatter: function (value) { + var sum = 0; + for (var i in value) { + sum += parseFloat(value[i].noTaxSum); + } + return sum; + } }, { - field: 'accountReconciliationPerson', - title: '对账人', - visible: false + field: 'salesUser', + title: '业务员', }, { - field: 'accountReconciliationTime', - title: '对账时间', - visible: false - }] + field: 'salesOrderCode', + title: '关联单号' + }, + // { + // field: 'total', + // title: '合计', + // footerFormatter: function() { + // //统计总分数 + // var count = 0; + // $.each(data.rows, function (index, item) { + // count += item.materialNum; + // }); + // return count; + // } + // } + ] }; $.table.init(option2); + + + + //采购价历史 $('#purser-table').bootstrapTable('destroy'); var option3 = {