From 6273d595a7139b790b5fdc7a7d18c3ced54826c9 Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Tue, 10 Sep 2024 13:22:40 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=20=E5=B7=A5=E7=A8=8B=E7=AE=A1=E7=90=86?= =?UTF-8?q?=20=E6=96=B0=E5=A2=9E=20=E7=89=A9=E6=96=99=E9=94=80=E5=94=AE?= =?UTF-8?q?=E5=8E=86=E5=8F=B2=E5=AE=9E=E4=BD=93=E7=B1=BB=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=20=E5=B1=95=E7=A4=BA=20=E7=89=A9=E6=96=99=E9=94=80?= =?UTF-8?q?=E5=94=AE=E4=BB=B7=E6=A0=BC=E5=8E=86=E5=8F=B2=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=20=E6=96=B0=E5=A2=9E=20=E5=B1=95=E7=A4=BA=20?= =?UTF-8?q?=E7=89=A9=E6=96=99=E9=94=80=E5=94=AE=E4=BB=B7=E6=A0=BC=E5=8E=86?= =?UTF-8?q?=E5=8F=B2=E7=9A=84=E5=85=B7=E4=BD=93=E5=AE=9E=E7=8E=B0=E7=B1=BB?= =?UTF-8?q?=20=E6=96=B0=E5=A2=9E=20=E6=A0=B9=E6=8D=AE=E7=89=A9=E6=96=99?= =?UTF-8?q?=E5=8F=B7=E6=9F=A5=E8=AF=A2=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=AD=90=E8=A1=A8=E5=90=8E=E7=AB=AF=E6=96=B9=E6=B3=95=20?= =?UTF-8?q?=E7=89=A9=E6=96=99=E8=AF=A6=E6=83=85=E5=89=8D=E7=AB=AF=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=8E=BB=E6=8E=89=E4=B9=8B=E5=89=8D=E4=B8=8D=E7=AC=A6?= =?UTF-8?q?=E5=90=88=E7=9A=84=E9=94=80=E5=94=AE=E4=BB=B7=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=EF=BC=8C=E6=8C=89=E7=85=A7prd=E6=96=B0=E5=A2=9E=E6=96=B0?= =?UTF-8?q?=E7=9A=84=E9=94=80=E5=94=AE=E4=BB=B7=E5=8E=86=E5=8F=B2=E5=88=97?= =?UTF-8?q?=E8=A1=A8=EF=BC=8C=E5=B9=B6=E6=8A=8A=E6=95=B0=E9=87=8F=E3=80=81?= =?UTF-8?q?=E4=BB=B7=E6=A0=BC=E7=9B=B8=E5=85=B3=E5=AD=97=E6=AE=B5=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E5=89=8D=E7=AB=AF=E5=90=88=E8=AE=A1=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../erp/controller/ErpMaterialController.java | 15 + .../domain/vo/ErpMaterialSalesHistoryVo.java | 42 +++ .../erp/service/IErpMaterialService.java | 6 + .../service/impl/ErpMaterialServiceImpl.java | 69 ++++- .../mapper/SysSalesOrderChildMapper.java | 5 + .../system/SysSalesOrderChildMapper.xml | 7 + .../templates/erp/material/detail.html | 278 +++++------------- 7 files changed, 219 insertions(+), 203 deletions(-) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/erp/domain/vo/ErpMaterialSalesHistoryVo.java 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 = {