From 899a9cc781fb76b74189c19e2882a052c0629e74 Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Fri, 5 Jul 2024 10:56:19 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20=E4=BB=93=E5=BA=93=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=93=E5=BA=93=E5=A7=94=E5=86=85=E5=85=A5?= =?UTF-8?q?=E5=BA=93=E5=89=8D=E7=AB=AF=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=B8=83=E5=B1=80=20=E4=BF=AE=E6=94=B9=20=E5=85=A5=E5=BA=93-?= =?UTF-8?q?=E7=94=9F=E4=BA=A7=E8=AE=A2=E5=8D=95(=E5=A7=94=E5=86=85?= =?UTF-8?q?=E5=85=A5=E5=BA=93)=20=E7=89=A9=E6=96=99=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3=E6=96=B9?= =?UTF-8?q?=E6=B3=95=20=E4=BF=AE=E6=94=B9=E5=A7=94=E5=86=85=E5=8A=A0?= =?UTF-8?q?=E5=B7=A5=E5=85=A5=E5=BA=93=E7=94=9F=E6=88=90=E5=93=81=E8=B4=A8?= =?UTF-8?q?=E5=8D=95=20=E4=BF=AE=E6=94=B9=E4=B8=80=E4=BA=9B=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E7=9A=84=E6=B7=BB=E5=8A=A0=20=E4=BF=AE=E6=94=B9=20?= =?UTF-8?q?=E4=BB=93=E5=BA=93=E5=A7=94=E5=86=85=E5=85=A5=E5=BA=93=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E9=A1=B5=E9=9D=A2=E5=B8=83=E5=B1=80=20=E7=94=9F?= =?UTF-8?q?=E4=BA=A7=E5=A7=94=E5=86=85=E5=8A=A0=E5=B7=A5=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99=E6=96=B0=E5=8A=A0=E7=89=A9=E6=96=99=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E9=83=A8=E9=97=A8=E5=AD=97=E6=AE=B5=20=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=96=B0=E5=A2=9E=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E5=85=A5=E5=BA=93-=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E8=AE=A2=E5=8D=95(=E5=A7=94=E5=86=85=E5=85=A5=E5=BA=93)?= =?UTF-8?q?=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3=20=E5=A7=94=E5=86=85?= =?UTF-8?q?=E5=8A=A0=E5=B7=A5=E5=93=81=E8=B4=A8=E5=8D=95=E5=BC=80=E5=A7=8B?= =?UTF-8?q?=E5=93=81=E8=B4=A8=20=E7=9A=84=E6=97=B6=E5=80=99=20=E7=94=9F?= =?UTF-8?q?=E6=88=90=20=E5=85=A5=E5=BA=93=E5=8D=95=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/ErpInboundOrderServiceImpl.java | 2 +- .../service/impl/QualityOrderServiceImpl.java | 4 + .../WarehouseStorageOrderController.java | 14 +- .../IWarehouseStorageOrderService.java | 5 + .../WarehouseStorageOrderServiceImpl.java | 81 ++++++++- .../warehouse/storageOrder/storageMakeIn.html | 146 +++++++---------- .../storageOrder/storageMakeInDetail.html | 155 ++++++++---------- .../warehouse/storageOrder/storageOrder.html | 4 +- 8 files changed, 229 insertions(+), 182 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpInboundOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpInboundOrderServiceImpl.java index cbb79d7e..f9830a12 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpInboundOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpInboundOrderServiceImpl.java @@ -215,7 +215,7 @@ public class ErpInboundOrderServiceImpl implements IErpInboundOrderService qualityOrderDetail.setMaterialBrand(sysMakeorderBom.getBrand()); qualityOrderDetail.setMaterialDescribe(sysMakeorderBom.getDescribe()); qualityOrderDetail.setMaterialProcessMethod(sysMakeorderBom.getProcessMethod()); - qualityOrderDetail.setMaterialDeptType(sysMakeorderBom.getMaterialType()); + qualityOrderDetail.setMaterialDeptType(sysMakeorderBom.getWarehouseDept()); qualityOrderDetail.setMaterialPhotourl(sysMakeorderBom.getPhotoUrl()); qualityOrderDetail.setMaterialUnit(sysMakeorderBom.getUnit()); qualityOrderDetail.setMaterialType(sysMakeorderBom.getMaterialType()); 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 aee1bd2a..647447aa 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 @@ -320,6 +320,10 @@ public class QualityOrderServiceImpl implements IQualityOrderService qualityOrder.setUpdateBy(loginName); qualityOrder.setUpdateTime(new Date()); qualityOrder.setQualityEmployee(loginName); + //生成入库单号 + String warehouseStorageCode = redisCache.generateBillNo("RK"); + qualityOrder.setInStorageCode(warehouseStorageCode); + List qualityOrderDetailList = qualityOrder.getQualityOrderDetailList(); if (CollectionUtils.isEmpty(qualityOrderDetailList)){ 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 a500e27d..871d0a8a 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 @@ -4,6 +4,7 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail; import com.ruoyi.warehouse.service.IWarehouseStorageOrderDetailService; import org.apache.shiro.authz.annotation.RequiresPermissions; @@ -564,7 +565,7 @@ public class WarehouseStorageOrderController extends BaseController @ResponseBody public AjaxResult storageMakeInSave(@RequestBody WarehouseStorageOrder warehouseStorageOrder) { - return toAjax(warehouseStorageOrderService.updateStorageMake(warehouseStorageOrder)); + return toAjax(warehouseStorageOrderService.updateStorageMakeIn(warehouseStorageOrder)); } /** @@ -591,14 +592,15 @@ public class WarehouseStorageOrderController extends BaseController } /** - * 入库-生产订单(委内入库) 客户物料详情列表 + * 入库-生产订单(委内入库) 物料详情列表 */ @ResponseBody @RequestMapping("/storageMakeInDetailList") - public Map> storageMakeInDetail(String warehouseStorageCode){ - List allDetails = storageOrderDetailService.selectStorageOrderDetailListByCode(warehouseStorageCode); - Map> groupedDetails = allDetails.stream().collect(Collectors.groupingBy(WarehouseStorageOrderDetail::getCustomerId)); - return groupedDetails; + public TableDataInfo storageMakeInDetailList(WarehouseStorageOrder warehouseStorageOrder){ + startPage(); + String warehouseStorageCode = warehouseStorageOrder.getWarehouseStorageCode(); + List list = storageOrderDetailService.selectStorageOrderDetailListByCode(warehouseStorageCode); + return getDataTable(list) ; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseStorageOrderService.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseStorageOrderService.java index 75567e13..506ecf85 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseStorageOrderService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseStorageOrderService.java @@ -113,4 +113,9 @@ public interface IWarehouseStorageOrderService * 通过委内加工入库单品质后生成入库单 * */ int insertWarehouseStorageOrderByMakeInQualityOrder(QualityOrder tempQualityOrder, List qualityOrderDetailList); + + /* + * 修改保存入库-生产订单(委内入库) + * */ + int updateStorageMakeIn(WarehouseStorageOrder warehouseStorageOrder); } 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 16590d0c..9051285b 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 @@ -403,6 +403,8 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS String warehouseStorageCode = redisCache.generateBillNo("RK"); warehouseStorageOrder.setWarehouseStorageCode(warehouseStorageCode); warehouseStorageOrder.setRelatedOrderCode(tempQualityOrder.getRelatedOrderCode()); + //暂收设置为全部品质 + warehouseStorageOrder.setWarehouseQualityStatus("2"); warehouseStorageOrder.setWarehouseStorageStatus("2"); warehouseStorageOrder.setWarehouseStorageType("2"); warehouseStorageOrder.setWarehouseOrderType("1"); @@ -418,9 +420,12 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS WarehouseStorageOrderDetail warehouseStorageOrderDetail = new WarehouseStorageOrderDetail(); warehouseStorageOrderDetail.setWarehouseStorageCode(warehouseStorageCode); warehouseStorageOrderDetail.setRelatedOrderCode(tempQualityOrder.getRelatedOrderCode()); - warehouseStorageOrderDetail.setWarehouseOrderType("2"); + warehouseStorageOrderDetail.setWarehouseQualityStatus("2"); + warehouseStorageOrderDetail.setWarehouseStorageStatus("2"); warehouseStorageOrderDetail.setWarehouseStorageType("2"); warehouseStorageOrderDetail.setWarehouseOrderType("1"); + //当作委内入库数 + warehouseStorageOrderDetail.setMakeStorageNum(qualityOrderDetail.getMakeInNum()); warehouseStorageOrderDetail.setMaterialNo(qualityOrderDetail.getMaterialNo()); warehouseStorageOrderDetail.setMaterialName(qualityOrderDetail.getMaterialName()); warehouseStorageOrderDetail.setMaterialBrand(qualityOrderDetail.getMaterialBrand()); @@ -437,6 +442,80 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS return warehouseStorageOrderMapper.insertWarehouseStorageOrder(warehouseStorageOrder); } + /* + * 修改保存入库-生产订单(委内入库) + * */ + @Transactional(rollbackFor = Exception.class) + @Override + public int updateStorageMakeIn(WarehouseStorageOrder warehouseStorageOrder) { + + String loginName = ShiroUtils.getLoginName(); + + //假设全部入库 + warehouseStorageOrder.setWarehouseStorageStatus("4"); + warehouseStorageOrder.setUpdateBy(loginName); + warehouseStorageOrder.setUpdateTime(new Date()); + //记录一下入库时间 + warehouseStorageOrder.setStorageTime(new Date()); + String warehouseCode = warehouseStorageOrder.getWarehouseCode(); + String warehouseName = warehouseStorageOrder.getWarehouseName(); + if (StringUtils.isNotEmpty(warehouseCode)){ + warehouseStorageOrder.setWarehouseCode(warehouseCode); + } + if (StringUtils.isNotEmpty(warehouseName)){ + warehouseStorageOrder.setWarehouseName(warehouseName); + } + + List warehouseStorageOrderDetailList = warehouseStorageOrder.getWarehouseStorageOrderDetailList(); + if (StringUtils.isEmpty(warehouseStorageOrderDetailList)){ + log.warn("入库单详情数据为空:{}",warehouseStorageOrderDetailList); + throw new BusinessException("入库单详情数据为空"); + } + + //入库数 + Integer storageNum = 0; + + // 检查storageNum是否含有null值 + boolean hasThisStorageNumNull = warehouseStorageOrderDetailList.stream() + .anyMatch(item -> item.getStorageNum() == null); + + if (hasThisStorageNumNull) { + throw new BusinessException("存在入库数为空,请检查!"); + } + // 计算各个字段的总和 + storageNum = warehouseStorageOrderDetailList.stream() + .mapToInt(WarehouseStorageOrderDetail::getStorageNum) + .sum(); + + //插入主表入库数量 + warehouseStorageOrder.setStorageNum(storageNum); +// //更新生产单数据 +// int updateMakeOrderResult = sysMakeOrderService.updateSysMakeOrderByWarehouseStorageOrder(warehouseStorageOrder, warehouseStorageOrderDetailList); +// if (updateMakeOrderResult <= 0){ +// throw new BusinessException("更新生产订单失败,未影响任何行"); +// } + + for (WarehouseStorageOrderDetail warehouseStorageOrderDetail : warehouseStorageOrderDetailList) { + //更新入库单详情的数据 + warehouseStorageOrderDetail.setUpdateBy(loginName); + warehouseStorageOrderDetail.setUpdateTime(new Date()); + //更新已入库数 + warehouseStorageOrderDetail.setHasStorageNum(warehouseStorageOrderDetail.getStorageNum()); + int updateWarehouseStorageOrderDetailResult = storageOrderDetailMapper.updateWarehouseStorageOrderDetail(warehouseStorageOrderDetail); + if (updateWarehouseStorageOrderDetailResult <= 0){ + throw new BusinessException("更新仓库入库单详情失败,未影响任何行"); + } + } + //更新入库单的数据 + int updateResult = warehouseStorageOrderMapper.updateWarehouseStorageOrder(warehouseStorageOrder); + + if (updateResult <= 0){ + log.warn("更新入库单失败,未影响任何行"); + } + return updateResult; + + } + /** * 修改保存暂收-采购单(采购入库) 子表数据 * */ diff --git a/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storageMakeIn.html b/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storageMakeIn.html index 4dcfa01a..776eb320 100644 --- a/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storageMakeIn.html +++ b/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storageMakeIn.html @@ -13,7 +13,7 @@
-
+
@@ -74,11 +74,11 @@
+
-
-
- +
+
@@ -92,61 +92,57 @@ var warehouseStorageCode = [[${warehouseStorageOrder.warehouseStorageCode}]] var warehouseCode = [[${warehouseStorageOrder.warehouseCode}]] var prefix = ctx + "warehouse/storageOrder"; - $("#form-temporaryPurchaseWarehouse-edit").validate({ + $("#form-storageMakeIn-edit").validate({ focusCleanup: true }); - //生成的不同table的id集合 - var tableDatas = []; + // 新增提交 function submitHandler() { - const storageOrderData = $("#form-temporaryPurchaseWarehouse-edit").serializeArray().reduce((obj, item) => { + // 获取表单数据 + const storageMakeInData = $("#form-storageMakeIn-edit").serializeArray().reduce((obj, item) => { obj[item.name] = item.value; return obj; }, {}); - // 初始化一个数组用于存放所有表格的数据 - 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 { - "customerId": item.customerId, - "materialNo": item.materialNo, - "materialName": item.materialName, - "materialType": item.materialType, - "materialPhotourl": item.materialPhotourl, - "materialDescribe": item.materialDescribe, - "materialBrand": item.materialBrand, - "materialUnit": item.materialUnit, - "materialProcessMethod": item.materialProcessMethod, - "qualityHasQualifiedNum": item.qualityHasQualifiedNum, - "hasStorageNum": item.hasStorageNum, - "makeStorageNum": item.makeStorageNum, - "storageNum": item.storageNum, - "storageLocation": item.storageLocation, - // ...其他字段 - }; - }); - allMaterialDataList = allMaterialDataList.concat(materialDataList); - }); - } + // 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据 + var table = $('#bootstrap-table').bootstrapTable('getData'); + + // 将表数据转换成与complaintNoticeData格式一致的数组 + var materialDataList = table.map(function(item) { + // 根据实际字段名调整 + return { + "warehouseStorageDetailId":item.warehouseStorageDetailId, + "materialNo": item.materialNo, + "materialName": item.materialName, + "materialType": item.materialType, + "materialPhotourl": item.materialPhotourl, + "materialDescribe": item.materialDescribe, + "materialBrand": item.materialBrand, + "materialUnit": item.materialUnit, + "materialProcessMethod": item.materialProcessMethod, + "qualityHasQualifiedNum": item.qualityHasQualifiedNum, + "hasStorageNum": item.hasStorageNum, + "makeStorageNum": item.makeStorageNum, + "storageNum": item.storageNum, + "storageLocation": item.storageLocation, + // ...其他字段 + }; + }); - const combinedData = Object.assign({}, storageOrderData, { - warehouseStorageOrderDetailList: allMaterialDataList + const combinedData = Object.assign({}, storageMakeInData, { + warehouseStorageOrderDetailList: materialDataList, }); // 合并表单数据和表格数据 - // const combinedData = Object.assign({}, ...complaintNoticeData.array(item => ({ [item.name]: item.value })), ...materialData); console.log(combinedData) // 使用 JSON.stringify() 序列化数据 const jsonData = JSON.stringify(combinedData); // 发送 AJAX 请求到后端接口 - $.operate.saveJson(prefix + "/storageMake", jsonData); + $.operate.saveJson(prefix + "/storageMakeIn", jsonData); } + + + $("input[name='arrivedTime']").datetimepicker({ format: "yyyy-mm-dd", minView: "month", @@ -159,44 +155,24 @@ autoclose: true }); - $(function() { - // 假设qualityOrderCode已经定义或者可以通过某种方式获取到 - var warehouseStorageCode = [[${warehouseStorageOrder.warehouseStorageCode}]]; // 这里需要实际赋值,比如从前端某个地方读取 - $.getJSON(prefix + "/storageMakeInDetailList?warehouseStorageCode=" + warehouseStorageCode, function(data) { - for (var customerId in data) { - if (data.hasOwnProperty(customerId)) { - var customerData = data[customerId]; - createTableForCustomer(customerId, customerData); - } - } - }); - }); - function createTableForCustomer(customerId, customerData) { - var tableId = 'bootstrap-table-' + customerId.replace(/[^a-z0-9]/gi, '_').toLowerCase(); - tableDatas.push(tableId); - var $tableWrapper = $('
'); - - // 确保customerData至少有一条记录,并从中提取客户详细信息 - var customerInfo = customerData.length > 0 ? customerData[0] : {}; // 默认为空对象,以防数据不存在 - - // 构建含有额外客户信息的标题字符串 - var headerTitle ='客户'+'
'+customerId + ' - ' + (customerInfo.customerName || 'N/A') + - '
' + (customerInfo.customerContactPeople || 'N/A') + - ' - ' + (customerInfo.customerContactNumber || 'N/A') + - ' - ' + (customerInfo.customerCompanyAddress || 'N/A'); - - var $header = $('

' + headerTitle + '

'); - var $table = $('
'); - - $table.bootstrapTable({ - data: customerData, + //物料信息展示列表 + $(function() { + var options = { + modalName: "选择物料", + url: prefix + "/storageMakeInDetailList", + queryParams: queryParams, + showSearch: false, + showRefresh: false, + showToggle: false, + showColumns: false, + pagination: false, // 设置不分页 columns: [{ checkbox: true }, { - title: '客户ID', - field: 'customerId', + title: '入库单详情Id', + field: 'warehouseStorageDetailId', visible: false }, { @@ -230,10 +206,6 @@ title: '物料加工方式', field: 'materialProcessMethod', }, - { - title: '订单数', - field: 'makeTotal', - }, { title: '品质已合格数', field: 'qualityHasQualifiedNum', @@ -243,7 +215,7 @@ field: 'hasStorageNum', }, { - title: '生产入库数', + title: '委内入库数', field: 'makeStorageNum', }, { @@ -265,14 +237,20 @@ field: 'storageLocation', editable: true }] - }); + }; + $.table.init(options); + }) - $tableWrapper.append($header).append($table); - $('#tablesContainer').append($tableWrapper); + function queryParams(params) { + var curParams = { + // 传递参数查询参数 + warehouseStorageCode: warehouseStorageCode + }; + console.log(curParams); + return curParams; } - //根据仓库ID查询仓库名称 $(document).ready(function() { // 初始化时默认加载仓库ID列表 diff --git a/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storageMakeInDetail.html b/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storageMakeInDetail.html index e05bbd11..9340e4be 100644 --- a/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storageMakeInDetail.html +++ b/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storageMakeInDetail.html @@ -13,7 +13,7 @@
- +
@@ -74,11 +74,11 @@
+
-
-
- +
+
@@ -92,61 +92,53 @@ var warehouseStorageCode = [[${warehouseStorageOrder.warehouseStorageCode}]] var warehouseCode = [[${warehouseStorageOrder.warehouseCode}]] var prefix = ctx + "warehouse/storageOrder"; - $("#form-temporaryPurchaseWarehouse-edit").validate({ + $("#form-storageMakeInDetail-edit").validate({ focusCleanup: true }); - //生成的不同table的id集合 - var tableDatas = []; - + // 新增提交 function submitHandler() { - const storageOrderData = $("#form-temporaryPurchaseWarehouse-edit").serializeArray().reduce((obj, item) => { + // 获取表单数据 + const storageMakeInData = $("#form-storageMakeInDetail-edit").serializeArray().reduce((obj, item) => { obj[item.name] = item.value; return obj; }, {}); - // 初始化一个数组用于存放所有表格的数据 - 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 { - "customerId": item.customerId, - "materialNo": item.materialNo, - "materialName": item.materialName, - "materialType": item.materialType, - "materialPhotourl": item.materialPhotourl, - "materialDescribe": item.materialDescribe, - "materialBrand": item.materialBrand, - "materialUnit": item.materialUnit, - "materialProcessMethod": item.materialProcessMethod, - "qualityHasQualifiedNum": item.qualityHasQualifiedNum, - "hasStorageNum": item.hasStorageNum, - "makeStorageNum": item.makeStorageNum, - "storageNum": item.storageNum, - "storageLocation": item.storageLocation, - // ...其他字段 - }; - }); - allMaterialDataList = allMaterialDataList.concat(materialDataList); - }); - } + // 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据 + var table = $('#bootstrap-table').bootstrapTable('getData'); - const combinedData = Object.assign({}, storageOrderData, { - warehouseStorageOrderDetailList: allMaterialDataList + // 将表数据转换成与complaintNoticeData格式一致的数组 + var materialDataList = table.map(function(item) { + // 根据实际字段名调整 + return { + "materialNo": item.materialNo, + "materialName": item.materialName, + "materialType": item.materialType, + "materialPhotourl": item.materialPhotourl, + "materialDescribe": item.materialDescribe, + "materialBrand": item.materialBrand, + "materialUnit": item.materialUnit, + "materialProcessMethod": item.materialProcessMethod, + "qualityHasQualifiedNum": item.qualityHasQualifiedNum, + "hasStorageNum": item.hasStorageNum, + "makeStorageNum": item.makeStorageNum, + "storageNum": item.storageNum, + "storageLocation": item.storageLocation, + // ...其他字段 + }; + }); + + const combinedData = Object.assign({}, storageMakeInData, { + warehouseStorageOrderDetailList: materialDataList, }); // 合并表单数据和表格数据 - // const combinedData = Object.assign({}, ...complaintNoticeData.array(item => ({ [item.name]: item.value })), ...materialData); console.log(combinedData) // 使用 JSON.stringify() 序列化数据 const jsonData = JSON.stringify(combinedData); // 发送 AJAX 请求到后端接口 - $.operate.saveJson(prefix + "/storageMake", jsonData); + $.operate.saveJson(prefix + "/storageMakeInDetail", jsonData); } + $("input[name='arrivedTime']").datetimepicker({ format: "yyyy-mm-dd", minView: "month", @@ -159,46 +151,20 @@ autoclose: true }); + //物料信息展示列表 $(function() { - // 假设qualityOrderCode已经定义或者可以通过某种方式获取到 - var warehouseStorageCode = [[${warehouseStorageOrder.warehouseStorageCode}]]; // 这里需要实际赋值,比如从前端某个地方读取 - - $.getJSON(prefix + "/storageMakeInDetailList?warehouseStorageCode=" + warehouseStorageCode, function(data) { - for (var customerId in data) { - if (data.hasOwnProperty(customerId)) { - var customerData = data[customerId]; - createTableForCustomer(customerId, customerData); - } - } - }); - }); - function createTableForCustomer(customerId, customerData) { - var tableId = 'bootstrap-table-' + customerId.replace(/[^a-z0-9]/gi, '_').toLowerCase(); - tableDatas.push(tableId); - var $tableWrapper = $('
'); - - // 确保customerData至少有一条记录,并从中提取客户详细信息 - var customerInfo = customerData.length > 0 ? customerData[0] : {}; // 默认为空对象,以防数据不存在 - - // 构建含有额外客户信息的标题字符串 - var headerTitle ='客户'+'
'+customerId + ' - ' + (customerInfo.customerName || 'N/A') + - '
' + (customerInfo.customerContactPeople || 'N/A') + - ' - ' + (customerInfo.customerContactNumber || 'N/A') + - ' - ' + (customerInfo.customerCompanyAddress || 'N/A'); - - var $header = $('

' + headerTitle + '

'); - var $table = $('
'); - - $table.bootstrapTable({ - data: customerData, + var options = { + modalName: "选择物料", + url: prefix + "/storageMakeInDetailList", + queryParams: queryParams, + showSearch: false, + showRefresh: false, + showToggle: false, + showColumns: false, + pagination: false, // 设置不分页 columns: [{ checkbox: true }, - { - title: '客户ID', - field: 'customerId', - visible: false - }, { title: '料号', field: 'materialNo' @@ -230,10 +196,6 @@ title: '物料加工方式', field: 'materialProcessMethod', }, - { - title: '订单数', - field: 'makeTotal', - }, { title: '品质已合格数', field: 'qualityHasQualifiedNum', @@ -243,25 +205,42 @@ field: 'hasStorageNum', }, { - title: '生产入库数', + title: '委内入库数', field: 'makeStorageNum', }, { title: '入库数', field: 'storageNum', + editable:{ + type: 'text', + mode:'inline', + validate: function (v) { + if (!v) return '数量不能为空'; + if (isNaN(v)) return '数量必须是数字'; + var processBadNum = parseInt(v); + if (processBadNum <= 0) return '数量必须是正整数'; + } + } }, { title: '存放位置', field: 'storageLocation', + editable: true }] - }); + }; + $.table.init(options); + }) - $tableWrapper.append($header).append($table); - $('#tablesContainer').append($tableWrapper); + function queryParams(params) { + var curParams = { + // 传递参数查询参数 + warehouseStorageCode: warehouseStorageCode + }; + console.log(curParams); + return curParams; } - //根据仓库ID查询仓库名称 $(document).ready(function() { // 初始化时默认加载仓库ID列表 diff --git a/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storageOrder.html b/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storageOrder.html index db710b59..363cfb1b 100644 --- a/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storageOrder.html +++ b/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storageOrder.html @@ -312,12 +312,12 @@ } /*入库-生产订单(委内入库)*/ - if ( row.warehouseStorageType == 2 && row.warehouseDeptType == 1 && row.warehouseOrderType == 1 && (row.warehouseStorageStatus == 2 || row.warehouseStorageStatus == 3) ){ + if ( row.warehouseStorageType == 2 && row.warehouseOrderType == 1 && (row.warehouseStorageStatus == 2 || row.warehouseStorageStatus == 3) ){ actions.push('入库 '); } /*入库-生产订单(委内入库) 详情*/ - if ( row.warehouseStorageType == 2 && row.warehouseDeptType == 1 && row.warehouseOrderType == 1 && (row.warehouseStorageStatus == 2 || row.warehouseStorageStatus == 3 || row.warehouseStorageStatus == 4)){ + if ( row.warehouseStorageType == 2 && row.warehouseOrderType == 1 && (row.warehouseStorageStatus == 2 || row.warehouseStorageStatus == 3 || row.warehouseStorageStatus == 4)){ actions.push('详情 '); }