From 44785f64ef9c07b0d7804fd869f77e0aa298cfe2 Mon Sep 17 00:00:00 2001 From: zhangsiqi <2825463979@qq.com> Date: Mon, 17 Jun 2024 20:31:28 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=E9=87=87=E8=B4=AD=E7=AE=A1=E7=90=86?= =?UTF-8?q?=EF=BC=9A=E4=BF=AE=E6=94=B9=E6=B7=BB=E5=8A=A0=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E6=8A=A5=E4=BB=B7=E5=AD=90=E8=A1=A8=E6=96=B9?= =?UTF-8?q?=E6=B3=95=EF=BC=8C=E4=BF=AE=E6=94=B9=E9=87=87=E8=B4=AD=E6=8A=A5?= =?UTF-8?q?=E4=BB=B7=E4=BF=A1=E6=81=AF=EF=BC=8C=E5=B0=86=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E6=8A=A5=E4=BB=B7=E7=BC=96=E5=8F=B7disable=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E6=94=B9=E4=B8=BAredeongly=EF=BC=8C=E4=BF=AE=E6=94=B9=E9=87=87?= =?UTF-8?q?=E8=B4=AD=E8=AE=A1=E5=88=92=EF=BC=8C=E6=B7=BB=E5=8A=A0=E9=87=87?= =?UTF-8?q?=E8=B4=AD=E8=AE=A1=E5=88=92=E6=8A=A5=E4=BB=B7=E5=AD=90=E8=A1=A8?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=EF=BC=8C=E6=B7=BB=E5=8A=A0=E4=BE=9B=E5=BA=94?= =?UTF-8?q?=E5=95=86=E5=AF=B9=E8=B1=A1=E7=BB=84=E4=BF=A1=E6=81=AF=EF=BC=8C?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E7=89=A9=E6=96=99=E5=AF=B9=E4=BE=9B=E5=BA=94?= =?UTF-8?q?=E5=95=86=E9=81=8D=E5=8E=86=E6=9F=A5=E8=AF=A2=E3=80=82=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E7=9A=84=E7=BB=93=E6=9E=9C=E6=94=BE=E5=85=A5=E9=87=87?= =?UTF-8?q?=E8=B4=AD=E6=8A=A5=E4=BB=B7=E7=89=A9=E6=96=99=E5=AD=90=E8=A1=A8?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E4=BE=9B=E5=BA=94=E5=95=86=E7=BB=84=E4=B8=AD?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/PurchasePlanController.java | 15 ++ .../mapper/PurchasePlanChildMapper.java | 2 + .../service/IPurchasePlanChildService.java | 7 + .../service/IPurchasePlanService.java | 4 +- .../impl/PurchasePlanChildServiceImpl.java | 6 + .../service/impl/PurchasePlanServiceImpl.java | 4 +- .../purchase/PurchasePlanChildMapper.xml | 12 +- .../purchasePlan/addPurchaseOrder.html | 212 ++++++++++-------- .../purchase/purchasePlan/purchasePlan.html | 17 +- .../purchase/purchaseQuote/edit.html | 2 +- 10 files changed, 172 insertions(+), 109 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchasePlanController.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchasePlanController.java index f703350d..81073f24 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchasePlanController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchasePlanController.java @@ -3,6 +3,10 @@ package com.ruoyi.purchase.controller; import java.util.List; import com.ruoyi.purchase.domain.PurchasePlan; +import com.ruoyi.purchase.domain.PurchasePlanChild; +import com.ruoyi.purchase.domain.PurchaseQuoteChild; +import com.ruoyi.purchase.service.IPurchasePlanChildService; +import com.ruoyi.purchase.service.IPurchaseQuoteChildService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -35,6 +39,11 @@ public class PurchasePlanController extends BaseController @Autowired private IPurchasePlanService purchasePlanService; + @Autowired + private IPurchasePlanChildService purchasePlanChildService; + + @Autowired + private IPurchaseQuoteChildService purchaseQuoteChildService; @RequiresPermissions("purchase:purchasePlan:view") @GetMapping() public String purchasePlan() @@ -102,8 +111,14 @@ public class PurchasePlanController extends BaseController } @GetMapping("/addPurchaseOrder/{purchasePlanCodes}") public String purChaseOrder(@PathVariable("purchasePlanCodes") String purchasePlanCodes,ModelMap mmap){ + //查询相关采购计划数据 List purchasePlanList = purchasePlanService.selectPurchasePlanByPlanCode(purchasePlanCodes); + //根据采购计划编号查询对应的采购报价数据 + List purchasePlanChildList = purchasePlanChildService.selectPurchasePlanChildListByPlanCodes(purchasePlanCodes); + //把物料根据供应商分组,然后根据供应商分组查询对应的供应商报价数据 + //再根据采购计划编号分组查询对应的采购报价数据 mmap.put("purchasePlanList", purchasePlanList); + mmap.put("purchasePlanChildList", purchasePlanChildList); return prefix + "/addPurchaseOrder"; } @GetMapping("/detail/{purchasePlanId}") diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchasePlanChildMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchasePlanChildMapper.java index ec86ae0f..10aee428 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchasePlanChildMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchasePlanChildMapper.java @@ -74,4 +74,6 @@ public interface PurchasePlanChildMapper * @return 结果 */ public int restorePurchasePlanChildById(Long purchasePlanChildId); + + List selectPurchasePlanChildListByPlanCodes(String[] purchasePlanCodes); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchasePlanChildService.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchasePlanChildService.java index 6f3e4629..9103e9ed 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchasePlanChildService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchasePlanChildService.java @@ -72,4 +72,11 @@ public interface IPurchasePlanChildService * @return */ int restorePurchasePlanChildById(Long purchasePlanChildId); + + /** + * 根据采购计划单号查询采购计划单物料信息 + * @param purchasePlanCodes + * @return + */ + List selectPurchasePlanChildListByPlanCodes(String purchasePlanCodes); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchasePlanService.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchasePlanService.java index 5a354584..eff62dfd 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchasePlanService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchasePlanService.java @@ -1,6 +1,7 @@ package com.ruoyi.purchase.service; import com.ruoyi.purchase.domain.PurchasePlan; +import com.ruoyi.purchase.domain.PurchasePlanChild; import java.util.List; @@ -74,5 +75,6 @@ public interface IPurchasePlanService */ int restorePurchasePlanById(Long purchasePlanId); - public List selectPurchasePlanByPlanCode(String planCode); + public List selectPurchasePlanByPlanCode(String purchasePlanCodes); + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanChildServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanChildServiceImpl.java index 254246e2..921eccf6 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanChildServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanChildServiceImpl.java @@ -123,4 +123,10 @@ public class PurchasePlanChildServiceImpl implements IPurchasePlanChildService { return purchasePlanChildMapper.restorePurchasePlanChildById(purchasePlanChildId); } + + @Override + public List selectPurchasePlanChildListByPlanCodes(String purchasePlanCodes) + { + return purchasePlanChildMapper.selectPurchasePlanChildListByPlanCodes(Convert.toStrArray(purchasePlanCodes)); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java index 9f1d29e4..df31ecec 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java @@ -125,8 +125,8 @@ public class PurchasePlanServiceImpl implements IPurchasePlanService } @Override - public List selectPurchasePlanByPlanCode(String planCodes) { - return purchasePlanMapper.selectPurchasePlanByPlanCode(Convert.toStrArray(planCodes)); + public List selectPurchasePlanByPlanCode(String purchasePlanCodes) { + return purchasePlanMapper.selectPurchasePlanByPlanCode(Convert.toStrArray(purchasePlanCodes)); } } diff --git a/ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml b/ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml index 4d598673..9f4ae98d 100644 --- a/ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml @@ -39,7 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + + + insert into purchase_plan_child diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html b/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html index bc181c3e..1486b7f6 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html @@ -6,51 +6,61 @@
-
- -
- +
+ +
+
-
-
- 公司收获地址: +
+
+
+
+
+ 物料信息1 +
+
+
+
+
+
+
+
-
+
+
+

公司地址

-
+
-
+
-
-
-
+
-
- +
+
-
- +
+
-
@@ -58,10 +68,9 @@ var prefix = ctx + "purchase/plan" $("#form-plan-add").validate({focusCleanup: true}); var purchasePlanList = [[${purchasePlanList}]]; - function submitHandler() { if ($.validate.form()) { - $.operate.save(prefix + "/add", $('#form-plan-add').serialize()); + $.operate.save(prefix + "/add", $(#form-plan-add).serialize()); } } //根据物料物料数量添加物料分类表,自动生成类似的表单对象 @@ -71,93 +80,98 @@ var formId = $("#form-plan-add").attr("id"); //获取采购计划单的物料信息 var materialList = []; + var purchasePlanList = $("#purchasePlanCodes").val(); //获取 - function addMaterial() { - //循环生成表 - //在表中正在循环生成表供应商相关信息 - var row = - '
' + - '物料 : '+ - '
'+ - '
'+ - '
'+ - '
' - } $(function() { - // 假设qualityOrderCode已经定义或者可以通过某种方式获取到 - var materialList = purchasePlanList; - for (var i = 0; i < materialList.length; i++) { - var material = materialList[i]; - var row = - '
' + - '物料 : '+ - '
'+ - '
'+ - '
'+ - '
' - var tableId = 'bootstrap-table-' + supplierCode.replace(/[^a-z0-9]/gi, '_').toLowerCase(); + var options = { + id: "bootstrap-table" + tableCounter, + // url: prefix + "/list", + modalName: "采购计划单", + search: false, + showExport: false, + showFooter: false, + showSearch: false, + showRefresh: false, + showColumns: false, + showToggle: false, + columns: [ + {checkbox: false}, + {title: '料号', field: 'materialNo'}, + {title: '图片', field: 'photoUrl'}, + {title: '物料名称', field: 'materialName'}, + {title: '物料类型', field: 'materialType'}, + {title: '物料描述', field: 'describe'}, + {title: '品牌', field: 'brand'}, + {title: '加工方式', field: 'processMethod',}, + {title: '单位', field: 'unit'}, + {title: '计划采购数', field: 'planPurchaseNum',}, + ] + } + $.table.init(options); + var materialList = purchasePlanList; // 假设这是获取到的物料列表 + var tableCounter = 0; // 计数器,用于生成唯一的表格ID + // 遍历物料列表,为每个物料生成表格 + materialList.forEach(function(material, index) { var $tableWrapper = $('
'); + var $table = $('
'); - } + // 初始化此表格的配置 + var tableOptions = Object.assign({}, options, { // 复制并修改options以适应当前物料 + id: uniqueTableId, + data: [material] // 假设options支持直接传入数据来渲染表格 + }); + $.table.init(tableOptions, $table); // 假设$.table.init可以接受jQuery对象来初始化表格 + + // 添加表头信息 + var supplierInfo = material.supplier || {}; // 假设物料对象中包含供应商信息 + addHead(uniqueTableId, material, supplierInfo); + + // 将表格加入到页面的某个容器中,这里假设存在一个容器div#materials-container + $('#materials-container').append($tableWrapper.append($table)); + }); }); - function addhead(tableId,data,supplierInfo) { - var headerTitle = - '供应商' + '
' + +' - ' + (supplierInfo.supplierName || 'N/A') + - '
' + (supplierInfo.customerContact || 'N/A') + - ' - ' + '最新不含税采购价' + '10' + 'RMB' + ' 最新含税采购价:' + '20' + 'RMB' + - '
' + - '' + - '
' + - '' + - '
' + - '
' + - '
' + - '' + - '
' + - '' + - '' + - '
' + - '
'; - '
' + - '' + - '
' + - '' + - '
' + - '
' + - '
' + - '' + - '
' + - '' + - '
' + - '
' + - '
' + - '' + - '
' + - '' + - '' + - '
' + - '
'; - var $header = $('

' + headerTitle + '

'); - var $table = $('
'); - } - function bootstrapTable(id,data) { - $('#'+ id).bootstrapTable({ - data: data, + // 假设qualityOrderCode已经定义或者可以通过某种方式获取到 + + $(function() { + var tableOptions = { + showExport: false, + showFooter: false, + showSearch: false, + showRefresh: false, + showColumns: false, + showToggle: false, columns: [ {checkbox: false}, - {title: '料号',field: 'materialNo'}, - {title: '图片',field: 'photoUrl'}, - {title: '物料名称',field: 'materialName'}, - {title: '物料类型',field: 'materialType'}, + {title: '料号', field: 'materialNo'}, + {title: '图片', field: 'photoUrl'}, + {title: '物料名称', field: 'materialName'}, + {title: '物料类型', field: 'materialType'}, {title: '物料描述', field: 'describe'}, - {title: '品牌',field: 'brand'}, - {title: '半成品类型',field: 'processMethod',}, - {title: '单位',field: 'unit'}, - {title: '计划采购数',field: 'planPurchaseNum', - },] - }); - //在行数据下添加采购供应商信息。 - } + {title: '品牌', field: 'brand'}, + {title: '加工方式', field: 'processMethod'}, + {title: '单位', field: 'unit'}, + {title: '计划采购数', field: 'planPurchaseNum'}, + ] + }; + purchasePlanList.forEach(function(material, index) { + // 创建一个新的表格容器 + var $tableWrapper = $('
'); + var tableId = 'bootstrap-table-' + index; + var $table = $('
'); + + // 在每个表格前添加关联销售订单号 + var $headerDiv = $('
关联销售订单号: ' + material.salesOrderCode + '
'); + $tableWrapper.append($headerDiv); + + // 使用物料数据初始化表格 + var materialData = [material]; // Bootstrap Table需要一个数组作为数据源 + var tableOpts = Object.assign({}, tableOptions, {data: materialData}); + $table.bootstrapTable(tableOpts); + + // 添加到DOM中 + $('#material').append($tableWrapper.append($table)); // 根据实际情况调整父容器选择器 + }) + }); \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/purchasePlan.html b/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/purchasePlan.html index f6e2f0d7..073ea231 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/purchasePlan.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/purchasePlan.html @@ -72,6 +72,7 @@ var useStatusDatas = [[${@dict.getType('useStatus')}]]; var processMethodDatas = [[${@dict.getType('processMethod')}]]; var sysUnitClassDatas = [[${@dict.getType('sysUnitClassDatas')}]]; + var materialTypeDatas = [[${@category.getChildByCode('materialType')}]]; var purchasePlanTypeDatas = [[${@dict.getType('purchase_plan_source')}]]; var prefix = ctx + "purchase/purchasePlan"; $(function() { @@ -137,7 +138,7 @@ }, columns: [ {field: 'purchasePlanId',title: '主键id',visible: false}, - {field: 'materialNo',title: '料号',}, + {field: 'materialCode',title: '料号',}, {field: 'photoUrl',title: '图片', formatter: function(value, row, index) {return $.table.imageView(value);} }, @@ -166,10 +167,18 @@ $.modal.alertWarning("请选择采购计划单"); return; }else{ - - for(var i=0;i 1 ){ + //·拼接采购计划单号 + for(var i=0;i