From 044e1de5c88e9966eec99f0f241cdd84c1251dc1 Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Mon, 25 Nov 2024 17:03:18 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=E4=BB=93=E5=BA=93=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9A=82=E6=94=B6-=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E5=85=A5=E5=BA=93=E5=92=8C=E5=85=B6=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E9=A1=B5=E9=9D=A2=E5=8A=A0=E4=B8=8A=E7=89=A9=E6=96=99?= =?UTF-8?q?=E5=9E=8B=E5=8F=B7=E5=AD=97=E6=AE=B5=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=9A=82=E6=94=B6=E4=BB=93=E5=BA=93=E5=85=A5=E5=BA=93=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E5=92=8C=E5=85=B6=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=EF=BC=8C=E6=8C=89=E7=85=A7=E6=96=B0=E7=89=88prd=E8=B0=83?= =?UTF-8?q?=E6=95=B4=EF=BC=9A=E4=BE=9B=E5=BA=94=E5=95=86=E4=B8=8D=E5=9C=A8?= =?UTF-8?q?=E5=88=86=E7=BB=84=EF=BC=8C=E6=94=BE=E5=9C=A8from=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E4=B8=8A=EF=BC=8C=E6=9A=82=E6=94=B6=E5=90=88=E6=A0=BC?= =?UTF-8?q?=E6=95=B0=E5=92=8C=E5=AE=9E=E9=99=85=E5=88=B0=E8=B4=A7=E6=95=B0?= =?UTF-8?q?=E5=8A=A0=E4=B8=8A4=E4=B8=AA=E6=A0=A1=E9=AA=8C=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E4=BF=AE=E6=94=B9=E6=8F=90=E4=BA=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94=E5=95=86=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=95=B0=E6=8D=AE=E6=9D=A5=E8=87=AA=E4=BB=93=E5=BA=93?= =?UTF-8?q?=E5=85=A5=E5=BA=93=E5=8D=95=E4=B8=BB=E8=A1=A8=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/QualityOrderServiceImpl.java | 70 ++--- .../WarehouseStorageOrderController.java | 9 +- .../WarehouseStorageOrderServiceImpl.java | 14 +- .../storageOrder/temporaryPurchase.html | 5 + .../storageOrder/temporaryPurchaseDetail.html | 7 +- .../temporaryPurchaseWarehouse.html | 252 +++++++++++------- .../temporaryPurchaseWarehouseDetail.html | 176 ++++++------ 7 files changed, 310 insertions(+), 223 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderServiceImpl.java index 41627e35..2461bb94 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderServiceImpl.java @@ -489,34 +489,38 @@ public class QualityOrderServiceImpl implements IQualityOrderService @Override public void insertQualityOrderByWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder, List storageOrderDetailList) { - QualityOrder qualityOrder = new QualityOrder(); - qualityOrder.setCreateTime(new Date()); - qualityOrder.setCreateBy(warehouseStorageOrder.getCreateBy()); - //使用redis自动生成品质单号 - String qualityOrderCode = redisCache.generateBillNo("PZ"); - - qualityOrder.setQualityOrderCode(qualityOrderCode); - qualityOrder.setInStorageCode(warehouseStorageOrder.getWarehouseStorageCode()); - qualityOrder.setRelatedOrderCode(warehouseStorageOrder.getRelatedOrderCode()); - qualityOrder.setQualityStatus("0"); - qualityOrder.setQualityOrderType("0"); - qualityOrder.setQualityStorageStatus("0"); - //qualityOrder.setThisArrivedNum(warehouseStorageOrder.getActualArrivedNum()); - qualityOrder.setWarehouseCode(warehouseStorageOrder.getWarehouseCode()); - qualityOrder.setWarehouseName(warehouseStorageOrder.getWarehouseName()); - qualityOrder.setDeliveryInspectionTime(warehouseStorageOrder.getDeliveryInspectionTime()); - qualityOrder.setCreateBy(ShiroUtils.getLoginName()); - qualityOrder.setCreateTime(new Date()); - qualityOrderMapper.insertQualityOrder(qualityOrder); - //新增三个子表的数据 for (WarehouseStorageOrderDetail detail : storageOrderDetailList) { + + QualityOrder qualityOrder = new QualityOrder(); + //使用redis自动生成品质单号 + String qualityOrderCode = redisCache.generateBillNo("PZ"); + qualityOrder.setQualityOrderCode(qualityOrderCode); + qualityOrder.setInStorageCode(warehouseStorageOrder.getWarehouseStorageCode()); + qualityOrder.setRelatedOrderCode(warehouseStorageOrder.getRelatedOrderCode()); + qualityOrder.setQualityStatus("0"); + qualityOrder.setQualityOrderType("0"); + qualityOrder.setQualityStorageStatus("0"); + qualityOrder.setMaterialNo(detail.getMaterialNo()); + qualityOrder.setMaterialName(detail.getMaterialName()); + qualityOrder.setQualityQualifiedNum(0); + qualityOrder.setQualityUnqualifiedNum(0); + qualityOrder.setPendingReviewNum(0); + qualityOrder.setThisArrivedNum(detail.getTemporaryQualifiedNum()); + qualityOrder.setWarehouseCode(warehouseStorageOrder.getWarehouseCode()); + qualityOrder.setWarehouseName(warehouseStorageOrder.getWarehouseName()); + qualityOrder.setDeliveryInspectionTime(warehouseStorageOrder.getDeliveryInspectionTime()); + qualityOrder.setCreateBy(ShiroUtils.getLoginName()); + qualityOrder.setCreateTime(new Date()); + int insertQualityOrderResult = qualityOrderMapper.insertQualityOrder(qualityOrder); + if(insertQualityOrderResult<=0){ + throw new BusinessException("新增品质单失败"); + } + // 构建QualityOrderDetail,假设其他属性与QualityOrder相同,故不重复设置 insertQualityOrderDetailByWarehouseStorageOrder(warehouseStorageOrder, detail, qualityOrderCode); - insertQualityOrderReportByWarehouseStorageOrder(detail,qualityOrderCode); - insertQualityOrderUnqualifiedByWarehouseStorageOrder(detail); - // ... + } } @@ -980,19 +984,19 @@ public class QualityOrderServiceImpl implements IQualityOrderService qualityOrderDetail.setMaterialPhotourl(warehouseStorageOrderDetail.getMaterialPhotourl()); qualityOrderDetail.setMaterialUnit(warehouseStorageOrderDetail.getMaterialUnit()); qualityOrderDetail.setMaterialType(warehouseStorageOrderDetail.getMaterialType()); - //暂时生成品质单本来应该是实际到货数 prd有误暂时这样处理 - qualityOrderDetail.setCheckNum(warehouseStorageOrderDetail.getActualArriveNum()); - qualityOrderDetail.setSupplierCode(warehouseStorageOrderDetail.getSupplierCode()); - qualityOrderDetail.setSupplierName(warehouseStorageOrderDetail.getSupplierName()); - qualityOrderDetail.setSupplierAddress(warehouseStorageOrderDetail.getSupplierAddress()); - qualityOrderDetail.setCustomerContact(warehouseStorageOrderDetail.getCustomerContact()); - qualityOrderDetail.setContactNumber(warehouseStorageOrderDetail.getContactNumber()); - qualityOrderDetail.setQualityHasqualifiedNum(warehouseStorageOrderDetail.getQualityHasQualifiedNum()); + qualityOrderDetail.setMaterialModel(warehouseStorageOrderDetail.getMaterialModel()); + qualityOrderDetail.setCheckNum(warehouseStorageOrderDetail.getTemporaryQualifiedNum()); + qualityOrderDetail.setSupplierCode(warehouseStorageOrder.getSupplierCode()); + qualityOrderDetail.setSupplierName(warehouseStorageOrder.getSupplierName()); + qualityOrderDetail.setSupplierAddress(warehouseStorageOrder.getSupplierAddress()); + qualityOrderDetail.setCustomerContact(warehouseStorageOrder.getCustomerContact()); + qualityOrderDetail.setContactNumber(warehouseStorageOrder.getContactNumber()); + qualityOrderDetail.setDeliveryInspectionTime(warehouseStorageOrder.getDeliveryInspectionTime()); qualityOrderDetail.setCreateTime(new Date()); qualityOrderDetail.setCreateBy(warehouseStorageOrderDetail.getCreateBy()); int insertResult= orderDetailMapper.insertQualityOrderDetail(qualityOrderDetail); - if (insertResult <= 0){ - throw new BusinessException("插入品质单详情失败"); + if (insertResult <= 0){ + throw new BusinessException("新增品质单详情失败"); } } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java index ded0a48e..f0dc761b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java @@ -173,11 +173,10 @@ public class WarehouseStorageOrderController extends BaseController */ @ResponseBody @RequestMapping("/temporaryPurchaseWarehouseDetailList") - public Map> temporaryPurchaseWarehouseDetail(String warehouseStorageCode){ - List allDetails = storageOrderDetailService.selectStorageOrderDetailListByCode(warehouseStorageCode); - List filterAllDetails = allDetails.stream().filter(wso -> "0".equals(wso.getMaterialDeptType())).collect(Collectors.toList()); - Map> groupedDetails = filterAllDetails.stream().collect(Collectors.groupingBy(WarehouseStorageOrderDetail::getSupplierCode)); - return groupedDetails; + public TableDataInfo temporaryPurchaseWarehouseDetail(String warehouseStorageCode){ + startPage(); + List list = storageOrderDetailService.selectStorageOrderDetailListByCode(warehouseStorageCode); + return getDataTable(list); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java index 4cafa3ed..447eed69 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java @@ -368,8 +368,8 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS warehouseStorageOrder.setUpdateTime(DateUtils.getNowDate()); //改变状态为已暂收 warehouseStorageOrder.setWarehouseStorageStatus("2"); - //设置品质状态,为待品质 - //warehouseStorageOrder.setWarehouseQualityStatus("0"); + //设置品质状态,为全部品质 + warehouseStorageOrder.setWarehouseQualityStatus("2"); warehouseStorageOrder.setWarehouseEmployee(loginName); List warehouseStorageOrderDetailList = warehouseStorageOrder.getWarehouseStorageOrderDetailList(); @@ -1022,7 +1022,6 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS List warehouseStorageOrderDetailList = warehouseStorageOrder.getWarehouseStorageOrderDetailList(); - int actualArriveNum = 0; //检查填写的实际到货数是否有空值 boolean hasActualArriveNumNull = warehouseStorageOrderDetailList.stream() @@ -1035,21 +1034,16 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS actualArriveNum = warehouseStorageOrderDetailList.stream().mapToInt(WarehouseStorageOrderDetail::getActualArriveNum).sum(); int temporaryQualifiedNum = 0; - //检查填写的品质合格数是否有空值 + //检查填写的暂收合格数是否有空值 boolean hasTemporaryQualifiedNumNull = warehouseStorageOrderDetailList.stream() .anyMatch(item -> item.getTemporaryQualifiedNum() == null); if (hasTemporaryQualifiedNumNull) { - throw new BusinessException("存在品质合格数为空,请检查!"); + throw new BusinessException("存在暂收合格数为空,请检查!"); } //入库单主表的暂收合格数为子表的合计 temporaryQualifiedNum = warehouseStorageOrderDetailList.stream().mapToInt(WarehouseStorageOrderDetail::getTemporaryQualifiedNum).sum(); - - if (actualArriveNum < temporaryQualifiedNum) { - throw new BusinessException("暂收合格数不能大于实际到货数"); - } - //插入实际到货数 warehouseStorageOrder.setActualArrivedNum(actualArriveNum); //插入暂收合格数 diff --git a/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchase.html b/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchase.html index f97f8118..d129f157 100644 --- a/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchase.html +++ b/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchase.html @@ -173,6 +173,7 @@ "materialType": item.materialType, "materialPhotourl": item.materialPhotourl, "materialDescribe": item.materialDescribe, + "materialModel": item.materialModel, "materialBrand": item.materialBrand, "materialUnit": item.materialUnit, "materialProcessMethod": item.materialProcessMethod, @@ -240,6 +241,10 @@ title: '物料描述', field: 'materialDescribe', }, + { + title: '物料型号', + field: 'materialModel', + }, { title: '物料品牌', field: 'materialBrand', diff --git a/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchaseDetail.html b/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchaseDetail.html index e4362055..bf17f661 100644 --- a/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchaseDetail.html +++ b/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchaseDetail.html @@ -160,6 +160,7 @@ "materialType": item.materialType, "materialPhotourl": item.materialPhotourl, "materialDescribe": item.materialDescribe, + "materialModel": item.materialModel, "materialBrand": item.materialBrand, "materialUnit": item.materialUnit, "materialProcessMethod": item.materialProcessMethod, @@ -184,7 +185,7 @@ // 使用 JSON.stringify() 序列化数据 const jsonData = JSON.stringify(combinedData); // 发送 AJAX 请求到后端接口 - $.operate.saveJson(prefix + "/temporaryPurchase", jsonData); + $.operate.saveJson(prefix + "/temporaryPurchaseDetail", jsonData); } } @@ -239,6 +240,10 @@ title: '物料描述', field: 'materialDescribe', }, + { + title: '物料型号', + field: 'materialModel', + }, { title: '物料品牌', field: 'materialBrand', diff --git a/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchaseWarehouse.html b/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchaseWarehouse.html index 97486e9e..6fb67c11 100644 --- a/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchaseWarehouse.html +++ b/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchaseWarehouse.html @@ -35,6 +35,37 @@ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
@@ -74,11 +105,11 @@
+
-
-
- +
+
@@ -108,44 +139,42 @@ obj[item.name] = item.value; return obj; }, {}); + + var table = $('#bootstrap-table').bootstrapTable("getData"); + // 初始化一个数组用于存放所有表格的数据 - let allMaterialDataList = []; - for(let i in tableDatas){ - $('#' + tableDatas[i]).each(function() { - const tableData = $(this).bootstrapTable('getData'); - console.log(JSON.stringify(tableData)); - // 将表数据转换成与qualityReportData格式一致的数组 - var materialDataList = tableData.map(function (item) { - // 根据实际字段名调整 - return { - "supplierCode": item.supplierCode, - "materialNo": item.materialNo, - "materialName": item.materialName, - "materialType": item.materialType, - "materialPhotourl": item.materialPhotourl, - "materialDescribe": item.materialDescribe, - "materialBrand": item.materialBrand, - "materialUnit": item.materialUnit, - "materialProcessMethod": item.materialProcessMethod, - "notifyHasArrivedNum": item.notifyHasArrivedNum, - "actualHasArrivedNum": item.actualHasArrivedNum, - "temporaryHasQualifiedNum": item.temporaryHasQualifiedNum, - "qualityHasQualifiedNum": item.qualityHasQualifiedNum, - "hasStorageNum": item.hasStorageNum, - "notifyArriveNum": item.notifyArriveNum, - "actualArriveNum": item.actualArriveNum, - "temporaryQualifiedNum": item.temporaryQualifiedNum, - "temporaryRemark": item.temporaryRemark, - "temporaryReportUrl": item.temporaryReportUrl, - // ...其他字段 - }; - }); - allMaterialDataList = allMaterialDataList.concat(materialDataList); - }); - } + var materialDataList = table.map(function(item) { + // 根据实际字段名调整 + return { + "supplierCode": item.supplierCode, + "supplierName":item.supplierName, + "customerContact":item.customerContact, + "contactNumber":item.contactNumber, + "supplierAddress":item.supplierAddress, + "materialNo": item.materialNo, + "materialName": item.materialName, + "materialType": item.materialType, + "materialPhotourl": item.materialPhotourl, + "materialDescribe": item.materialDescribe, + "materialModel": item.materialModel, + "materialBrand": item.materialBrand, + "materialUnit": item.materialUnit, + "materialProcessMethod": item.materialProcessMethod, + "notifyHasArrivedNum": item.notifyHasArrivedNum, + "actualHasArrivedNum": item.actualHasArrivedNum, + "temporaryHasQualifiedNum": item.temporaryHasQualifiedNum, + "hasStorageNum": item.hasStorageNum, + "notifyArriveNum": item.notifyArriveNum, + "actualArriveNum": item.actualArriveNum, + "temporaryQualifiedNum": item.temporaryQualifiedNum, + "temporaryRemark": item.temporaryRemark, + "temporaryReportUrl": item.temporaryReportUrl, + // ...其他字段 + }; + }); const combinedData = Object.assign({}, storageOrderData, { - warehouseStorageOrderDetailList: allMaterialDataList + warehouseStorageOrderDetailList: materialDataList, }); // 合并表单数据和表格数据 // const combinedData = Object.assign({}, ...complaintNoticeData.array(item => ({ [item.name]: item.value })), ...materialData); @@ -168,38 +197,17 @@ autoclose: true }); + //物料信息展示列表 $(function() { - // 假设qualityOrderCode已经定义或者可以通过某种方式获取到 - var warehouseStorageCode = [[${warehouseStorageOrder.warehouseStorageCode}]]; // 这里需要实际赋值,比如从前端某个地方读取 - - $.getJSON(prefix + "/temporaryPurchaseWarehouseDetailList?warehouseStorageCode=" + warehouseStorageCode, function(data) { - for (var supplierCode in data) { - if (data.hasOwnProperty(supplierCode)) { - var supplierData = data[supplierCode]; - createTableForSupplier(supplierCode, supplierData); - } - } - }); - }); - function createTableForSupplier(supplierCode, supplierData) { - var tableId = 'bootstrap-table-' + supplierCode.replace(/[^a-z0-9]/gi, '_').toLowerCase(); - tableDatas.push(tableId); - var $tableWrapper = $('
'); - - // 确保supplierData至少有一条记录,并从中提取供应商详细信息 - var supplierInfo = supplierData.length > 0 ? supplierData[0] : {}; // 默认为空对象,以防数据不存在 - - // 构建含有额外供应商信息的标题字符串 - var headerTitle ='供应商'+'
'+supplierCode + ' - ' + (supplierInfo.supplierName || 'N/A') + - '
' + (supplierInfo.customerContact || 'N/A') + - ' - ' + (supplierInfo.contactNumber || 'N/A') + - ' - ' + (supplierInfo.supplierAddress || 'N/A'); - - var $header = $('

' + headerTitle + '

'); - var $table = $('
'); - - $table.bootstrapTable({ - data: supplierData, + var options = { + modalName: "选择物料", + url: prefix + "/temporaryPurchaseWarehouseDetailList", + queryParams: queryParams, + showSearch: false, + showRefresh: false, + showToggle: false, + showColumns: false, + pagination: false, // 设置不分页 columns: [{ checkbox: true }, @@ -227,6 +235,10 @@ title: '物料描述', field: 'materialDescribe', }, + { + title: '物料型号', + field: 'materialModel', + }, { title: '物料品牌', field: 'materialBrand', @@ -242,6 +254,7 @@ return $.table.selectDictLabel(processMethodDatas, value); } }, + { title: '入库部门', field: 'materialDeptType', @@ -260,11 +273,6 @@ { title: '暂收已合格数', field: 'temporaryHasQualifiedNum', - visible: false, - }, - { - title: '品质已合格数', - field: 'qualityHasQualifiedNum', }, { title: '已入库数', @@ -278,29 +286,79 @@ { title: '实际到货数', field: 'actualArriveNum', - editable:{ - type: 'text', - mode:'inline', - validate: function (v) { - if (!v) return '数量不能为空'; - if (isNaN(v)) return '数量必须是数字'; - var processBadNum = parseInt(v); - if (processBadNum < 0) return '数量必须是整数'; + editable: { + validate: function(value) { + if ($.trim(value) === '') { + return '实际到货数不能为空'; + } + if (isNaN(value)) { + return '请输入有效的数字'; + } + if (value < 0) { + return '实际到货数不能小于0'; + } + //不能为小数 + if (value % 1 !== 0) { + return '实际到货数不能为小数'; + } + }, + }, + formatter: function (value, row) { + // 检查 row 是否存在 + if (!row) { + return ""; + } + + // 检查 actualArriveNum 是否存在 + if (row.actualArriveNum === undefined || row.actualArriveNum === null) { + return ""; + } + + // 根据 actualArriveNum 的值决定返回值 + if (row.actualArriveNum) { + return row.actualArriveNum; + } else { + return value; } } }, { - title: '暂收数量', + title: '暂收合格数量', field: 'temporaryQualifiedNum', - editable:{ - type: 'text', - mode:'inline', - validate: function (v) { - if (!v) return '数量不能为空'; - if (isNaN(v)) return '数量必须是数字'; - var processBadNum = parseInt(v); - if (processBadNum < 0) return '数量必须是整数'; + editable: { + validate: function(value) { + if ($.trim(value) === '') { + return '暂收数不能为空'; + } + if (isNaN(value)) { + return '请输入有效的数字'; + } + if (value < 0) { + return '暂收数不能小于0'; + } + //不能为小数 + if (value % 1 !== 0) { + return '暂收数不能为小数'; + } + }, + }, + formatter: function (value, row) { + // 检查 row 是否存在 + if (!row) { + return ""; + } + + // 检查 temporaryQualifiedNum 是否存在 + if (row.temporaryQualifiedNum === undefined || row.temporaryQualifiedNum === null) { + return ""; + } + + // 根据 temporaryQualifiedNum 的值决定返回值 + if (row.temporaryQualifiedNum) { + return row.temporaryQualifiedNum; + } else { + return value; } } }, @@ -315,10 +373,16 @@ field: 'temporaryReportUrl', visible: false, }] - }); + }; + $.table.init(options); + }) - $tableWrapper.append($header).append($table); - $('#tablesContainer').append($tableWrapper); + function queryParams(params) { + var curParams = { + // 传递参数查询参数 + warehouseStorageCode: warehouseStorageCode + }; + return curParams; } diff --git a/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchaseWarehouseDetail.html b/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchaseWarehouseDetail.html index b99437e9..b4be4347 100644 --- a/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchaseWarehouseDetail.html +++ b/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchaseWarehouseDetail.html @@ -35,6 +35,38 @@
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
@@ -74,11 +106,11 @@
+
-
-
- +
+
@@ -108,44 +140,42 @@ obj[item.name] = item.value; return obj; }, {}); + + var table = $('#bootstrap-table').bootstrapTable("getData"); + // 初始化一个数组用于存放所有表格的数据 - let allMaterialDataList = []; - for(let i in tableDatas){ - $('#' + tableDatas[i]).each(function() { - const tableData = $(this).bootstrapTable('getData'); - console.log(JSON.stringify(tableData)); - // 将表数据转换成与qualityReportData格式一致的数组 - var materialDataList = tableData.map(function (item) { - // 根据实际字段名调整 - return { - "supplierCode": item.supplierCode, - "materialNo": item.materialNo, - "materialName": item.materialName, - "materialType": item.materialType, - "materialPhotourl": item.materialPhotourl, - "materialDescribe": item.materialDescribe, - "materialBrand": item.materialBrand, - "materialUnit": item.materialUnit, - "materialProcessMethod": item.materialProcessMethod, - "notifyHasArrivedNum": item.notifyHasArrivedNum, - "actualHasArrivedNum": item.actualHasArrivedNum, - "temporaryHasQualifiedNum": item.temporaryHasQualifiedNum, - "qualityHasQualifiedNum": item.qualityHasQualifiedNum, - "hasStorageNum": item.hasStorageNum, - "notifyArriveNum": item.notifyArriveNum, - "actualArriveNum": item.actualArriveNum, - "temporaryQualifiedNum": item.temporaryQualifiedNum, - "temporaryRemark": item.temporaryRemark, - "temporaryReportUrl": item.temporaryReportUrl, - // ...其他字段 - }; - }); - allMaterialDataList = allMaterialDataList.concat(materialDataList); - }); - } + var materialDataList = table.map(function(item) { + // 根据实际字段名调整 + return { + "supplierCode": item.supplierCode, + "supplierName":item.supplierName, + "customerContact":item.customerContact, + "contactNumber":item.contactNumber, + "supplierAddress":item.supplierAddress, + "materialNo": item.materialNo, + "materialName": item.materialName, + "materialType": item.materialType, + "materialPhotourl": item.materialPhotourl, + "materialDescribe": item.materialDescribe, + "materialModel": item.materialModel, + "materialBrand": item.materialBrand, + "materialUnit": item.materialUnit, + "materialProcessMethod": item.materialProcessMethod, + "notifyHasArrivedNum": item.notifyHasArrivedNum, + "actualHasArrivedNum": item.actualHasArrivedNum, + "temporaryHasQualifiedNum": item.temporaryHasQualifiedNum, + "hasStorageNum": item.hasStorageNum, + "notifyArriveNum": item.notifyArriveNum, + "actualArriveNum": item.actualArriveNum, + "temporaryQualifiedNum": item.temporaryQualifiedNum, + "temporaryRemark": item.temporaryRemark, + "temporaryReportUrl": item.temporaryReportUrl, + // ...其他字段 + }; + }); const combinedData = Object.assign({}, storageOrderData, { - warehouseStorageOrderDetailList: allMaterialDataList + warehouseStorageOrderDetailList: materialDataList, }); // 合并表单数据和表格数据 // const combinedData = Object.assign({}, ...complaintNoticeData.array(item => ({ [item.name]: item.value })), ...materialData); @@ -153,7 +183,7 @@ // 使用 JSON.stringify() 序列化数据 const jsonData = JSON.stringify(combinedData); // 发送 AJAX 请求到后端接口 - $.operate.saveJson(prefix + "/temporaryPurchaseWarehouse", jsonData); + $.operate.saveJson(prefix + "/temporaryPurchaseWarehouseDetail", jsonData); } $("input[name='arrivedTime']").datetimepicker({ @@ -168,38 +198,18 @@ autoclose: true }); - $(function() { - // 假设qualityOrderCode已经定义或者可以通过某种方式获取到 - var warehouseStorageCode = [[${warehouseStorageOrder.warehouseStorageCode}]]; // 这里需要实际赋值,比如从前端某个地方读取 - - $.getJSON(prefix + "/temporaryPurchaseWarehouseDetailList?warehouseStorageCode=" + warehouseStorageCode, function(data) { - for (var supplierCode in data) { - if (data.hasOwnProperty(supplierCode)) { - var supplierData = data[supplierCode]; - createTableForSupplier(supplierCode, supplierData); - } - } - }); - }); - function createTableForSupplier(supplierCode, supplierData) { - var tableId = 'bootstrap-table-' + supplierCode.replace(/[^a-z0-9]/gi, '_').toLowerCase(); - tableDatas.push(tableId); - var $tableWrapper = $('
'); - - // 确保supplierData至少有一条记录,并从中提取供应商详细信息 - var supplierInfo = supplierData.length > 0 ? supplierData[0] : {}; // 默认为空对象,以防数据不存在 - // 构建含有额外供应商信息的标题字符串 - var headerTitle ='供应商'+'
'+supplierCode + ' - ' + (supplierInfo.supplierName || 'N/A') + - '
' + (supplierInfo.customerContact || 'N/A') + - ' - ' + (supplierInfo.contactNumber || 'N/A') + - ' - ' + (supplierInfo.supplierAddress || 'N/A'); - - var $header = $('

' + headerTitle + '

'); - var $table = $('
'); - - $table.bootstrapTable({ - data: supplierData, + //物料信息展示列表 + $(function() { + var options = { + modalName: "选择物料", + url: prefix + "/temporaryPurchaseWarehouseDetailList", + queryParams: queryParams, + showSearch: false, + showRefresh: false, + showToggle: false, + showColumns: false, + pagination: false, // 设置不分页 columns: [{ checkbox: true }, @@ -227,6 +237,10 @@ title: '物料描述', field: 'materialDescribe', }, + { + title: '物料型号', + field: 'materialModel', + }, { title: '物料品牌', field: 'materialBrand', @@ -242,6 +256,7 @@ return $.table.selectDictLabel(processMethodDatas, value); } }, + { title: '入库部门', field: 'materialDeptType', @@ -260,11 +275,6 @@ { title: '暂收已合格数', field: 'temporaryHasQualifiedNum', - visible: false, - }, - { - title: '品质已合格数', - field: 'qualityHasQualifiedNum', }, { title: '已入库数', @@ -281,12 +291,13 @@ }, { - title: '暂收数量', + title: '暂收合格数量', field: 'temporaryQualifiedNum', }, { title: '暂收备注', field: 'temporaryRemark', + editable: true, visible: false, }, { @@ -294,14 +305,19 @@ field: 'temporaryReportUrl', visible: false, }] - }); + }; + $.table.init(options); + }) - $tableWrapper.append($header).append($table); - $('#tablesContainer').append($tableWrapper); + function queryParams(params) { + var curParams = { + // 传递参数查询参数 + warehouseStorageCode: warehouseStorageCode + }; + return curParams; } - //根据仓库ID查询仓库名称 $(document).ready(function() { // 初始化时默认加载仓库ID列表