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列表