Browse Source

[feat]仓库管理:

出库单
新增退换货-出库详情 按钮
新增退换货-出库详情页面refundsExchangesOutWarehouseDetail.html
新增退换货-出库详情后端查询页面接口
新增退换货-出库详情后端修改保存接口
dev
liuxiaoxu 5 months ago
parent
commit
11394040ea
  1. 24
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseOutOrderController.java
  2. 215
      ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/refundsExchangesOutWarehouseDetail.html
  3. 9
      ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/warehouseOutOrder.html

24
ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseOutOrderController.java

@ -361,6 +361,30 @@ public class WarehouseOutOrderController extends BaseController
return toAjax(warehouseOutOrderService.updateRefundsExchangesOutWarehouse(warehouseOutOrder)); return toAjax(warehouseOutOrderService.updateRefundsExchangesOutWarehouse(warehouseOutOrder));
} }
/**
* 退换货-出库详情
*/
@GetMapping("/refundsExchangesOutWarehouseDetail/{outOrderId}")
public String refundsExchangesOutWarehouseDetail(@PathVariable("outOrderId") Long outOrderId, ModelMap mmap)
{
WarehouseOutOrder warehouseOutOrder = warehouseOutOrderService.selectWarehouseOutOrderById(outOrderId);
mmap.put("warehouseOutOrder", warehouseOutOrder);
return prefix + "/refundsExchangesOutWarehouseDetail";
}
/**
* 修改保存退换货-出库详情
*/
@RequiresPermissions("warehouse:warehouseOutOrder:refundsExchangesOutWarehouseDetail")
@Log(title = "仓库出库单", businessType = BusinessType.UPDATE)
@PostMapping("/refundsExchangesOutWarehouseDetail")
@ResponseBody
public AjaxResult refundsExchangesOutWarehouseDetailSave(@RequestBody WarehouseOutOrder warehouseOutOrder)
{
return toAjax(warehouseOutOrderService.updateRefundsExchangesOutWarehouse(warehouseOutOrder));
}
/** /**
* 退换货-出库 供应商物料详情列表 * 退换货-出库 供应商物料详情列表
*/ */

215
ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/refundsExchangesOutWarehouseDetail.html

@ -0,0 +1,215 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('退换货-出库详情')" />
<th:block th:include="include :: datetimepicker-css" />
<style>
.supplier-value span {
margin-right: 10px;
}
</style>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-refundsExchangesOutWarehouse-edit" th:object="${warehouseOutOrder}">
<input name="outOrderId" th:field="*{outOrderId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">出库单号:</label>
<div class="col-sm-8">
<input name="outOrderCode" th:field="*{outOrderCode}" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">订单类型:</label>
<div class="col-sm-8">
<select name="warehouseOrderType" class="form-control m-b" th:with="type=${@dict.getType('warehouse_order_type')}" disabled>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{warehouseOrderType}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">关联单号:</label>
<div class="col-sm-8">
<input name="relatedOrderCode" th:field="*{relatedOrderCode}" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">申请人员:</label>
<div class="col-sm-8">
<input name="applyName" th:field="*{applyName}" class="form-control" type="text" disabled>
</div>
</div>
<div class="container">
<!--供应商物料相关-->
<div class="row">
<div class="col-sm-12" id="tablesContainer">
<!-- 表格将在这里动态生成 -->
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: bootstrap-table-editable-js" />
<script th:inline="javascript">
var outOrderCode = [[${warehouseOutOrder.outOrderCode}]]
var prefix = ctx + "warehouse/warehouseOutOrder";
$("#form-refundsExchangesOutWarehouse-edit").validate({
focusCleanup: true
});
//生成的不同table的id集合
var tableDatas = [];
function submitHandler() {
const warehouseStorageOrderData = $("#form-refundsExchangesOutWarehouse-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 {
"supplierCode": item.supplierCode,
"materialNo": item.materialNo,
"actualOutOrderSum":item.actualOutOrderSum,
"outOrderDetailId":item.outOrderDetailId,
"outOrderCode":item.outOrderCode,
// ...其他字段
};
});
allMaterialDataList = allMaterialDataList.concat(materialDataList);
});
}
const combinedData = Object.assign({}, warehouseStorageOrderData, {
warehouseOutOrderDetailList: allMaterialDataList
});
// 合并表单数据和表格数据
// 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 + "/refundsExchangesOutWarehouseDetail", jsonData);
}
$(function() {
// 假设qualityOrderCode已经定义或者可以通过某种方式获取到
var outOrderCode = [[${warehouseOutOrder.outOrderCode}]]; // 这里需要实际赋值,比如从前端某个地方读取
$.getJSON(prefix + "/refundsExchangesDetailList?outOrderCode=" + outOrderCode, 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 = $('<div class="table-responsive mt-3"></div>');
// 确保supplierData至少有一条记录,并从中提取供应商详细信息
var supplierInfo = supplierData.length > 0 ? supplierData[0] : {}; // 默认为空对象,以防数据不存在
// 构建含有额外供应商信息的标题字符串
var headerTitle ='供应商'+'</br>'+supplierCode + ' - ' + (supplierInfo.supplierName || 'N/A') +
' </br> ' + (supplierInfo.deliveryName || 'N/A') +
' - ' + (supplierInfo.deliveryNumber || 'N/A') +
' - ' + (supplierInfo.deliveryAddress || 'N/A');
var $header = $('<h4>' + headerTitle + '</h4>');
var $table = $('<table id="' + tableId + '" class="table table-striped table-bordered"></table>');
$table.bootstrapTable({
data: supplierData,
columns: [{
checkbox: true
},
{
title: '出库单详情ID',
field: 'outOrderDetailId',
visible: false
},
{
title: '出库单号',
field: 'outOrderCode',
visible: false
},
{
title: '料号',
field: 'materialNo',
},
{
title: '图片',
field: 'materialPhotourl',
},
{
title: '物料名称',
field: 'materialName',
},
{
title: '物料类型',
field: 'materialType',
},
{
title: '描述',
field: 'materialDescribe',
},
{
title: '品牌',
field: 'materialBrand',
},
{
title: '单位',
field: 'materialUnit',
},
{
title: '加工方式',
field: 'materialProcessMethod',
},
{
title: '订单数量',
field: 'makeNum',
},
{
title: '已出库数',
field: 'hasOutOrderSum',
},
{
title: '申请出库数',
field: 'applyOutOrderSum',
},
{
title: '实际出库数',
field: 'actualOutOrderSum',
}
]
});
$tableWrapper.append($header).append($table);
$('#tablesContainer').append($tableWrapper);
}
</script>
</body>
</html>

9
ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/warehouseOutOrder.html

@ -80,6 +80,8 @@
var salesOutWarehouseDetailFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:salesOutWarehouseDetail')}]]; var salesOutWarehouseDetailFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:salesOutWarehouseDetail')}]];
var makeOutWarehouseDetailFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:makeOutWarehouseDetail')}]]; var makeOutWarehouseDetailFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:makeOutWarehouseDetail')}]];
var requisitioningOutWarehouseDetailFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:requisitioningOutWarehouseDetail')}]]; var requisitioningOutWarehouseDetailFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:requisitioningOutWarehouseDetail')}]];
var refundsExchangesOutWarehouseDetailFlag = [[${@permission.hasPermi('warehouse:warehouseOutOrder:refundsExchangesOutWarehouseDetail')}]];
var warehouseOutStatusDatas = [[${@dict.getType('warehouse_out_status')}]]; var warehouseOutStatusDatas = [[${@dict.getType('warehouse_out_status')}]];
var warehouseOrderTypeDatas = [[${@dict.getType('warehouse_order_type')}]]; var warehouseOrderTypeDatas = [[${@dict.getType('warehouse_order_type')}]];
@ -206,6 +208,7 @@
/*退换货-出库*/ /*退换货-出库*/
if (row.warehouseOutStatus == 4 && row.warehouseOrderType == 4 && row.warehouseOutType == 4){ if (row.warehouseOutStatus == 4 && row.warehouseOrderType == 4 && row.warehouseOutType == 4){
actions.push('<a class="btn btn-success btn-xs ' + refundsExchangesOutWarehouseFlag + '" href="javascript:void(0)" onclick="refundsExchangesOutWarehouse(\'' + row.outOrderId + '\')"><i class="fa fa-edit"></i>出库</a> '); actions.push('<a class="btn btn-success btn-xs ' + refundsExchangesOutWarehouseFlag + '" href="javascript:void(0)" onclick="refundsExchangesOutWarehouse(\'' + row.outOrderId + '\')"><i class="fa fa-edit"></i>出库</a> ');
actions.push('<a class="btn btn-success btn-xs ' + refundsExchangesOutWarehouseDetailFlag + '" href="javascript:void(0)" onclick="refundsExchangesOutWarehouseDetail(\'' + row.outOrderId + '\')"><i class="fa fa-edit"></i>详情</a> ');
} }
return actions.join(''); return actions.join('');
} }
@ -268,6 +271,12 @@
var url = ctx + 'warehouse/warehouseOutOrder/refundsExchangesOutWarehouse/' + outOrderId; var url = ctx + 'warehouse/warehouseOutOrder/refundsExchangesOutWarehouse/' + outOrderId;
$.modal.open("出库",url); $.modal.open("出库",url);
} }
/*退换货-出库详情*/
function refundsExchangesOutWarehouseDetail(outOrderId){
var url = ctx + 'warehouse/warehouseOutOrder/refundsExchangesOutWarehouseDetail/' + outOrderId;
$.modal.open("出库详情",url);
}
</script> </script>
</body> </body>
</html> </html>
Loading…
Cancel
Save