Browse Source

[feat]仓库管理:

库存盘点
新增库存盘点详情页面detail.html
新增库存盘点详情后端接口
新增库存盘点详情按钮
dev
liuxiaoxu 5 months ago
parent
commit
3e49746d96
  1. 25
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseInventoryCheckController.java
  2. 5
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseInventoryCheckService.java
  3. 9
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseInventoryCheckServiceImpl.java
  4. 242
      ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/detail.html
  5. 13
      ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/inventoryCheck.html

25
ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseInventoryCheckController.java

@ -124,6 +124,31 @@ public class WarehouseInventoryCheckController extends BaseController
}
/**
* 仓库库存盘点详情页面
*/
@GetMapping("/detail/{inventoryCheckId}")
public String detail(@PathVariable("inventoryCheckId") Long inventoryCheckId, ModelMap mmap)
{
WarehouseInventoryCheck warehouseInventoryCheck = warehouseInventoryCheckService.selectWarehouseInventoryCheckById(inventoryCheckId);
mmap.put("warehouseInventoryCheck", warehouseInventoryCheck);
return prefix + "/detail";
}
/**
* 仓库库存盘点详情
*/
@RequiresPermissions("warehouse:inventoryCheck:edit")
@Log(title = "仓库库存盘点", businessType = BusinessType.UPDATE)
@PostMapping("/detail")
@ResponseBody
public AjaxResult detailSave(@RequestBody WarehouseInventoryCheck warehouseInventoryCheck)
{
return toAjax(warehouseInventoryCheckService.detailWarehouseInventoryCheck(warehouseInventoryCheck));
}
/**
* 物料信息弹出页面
*/

5
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseInventoryCheckService.java

@ -55,4 +55,9 @@ public interface IWarehouseInventoryCheckService
* 根据盘点单号查找盘点详情信息
* */
List<WarehouseInventoryCheckDetail> selectInventoryCheckDetailListByCode(String inventoryCheckCode);
/*
* 库存盘点详情
* */
int detailWarehouseInventoryCheck(WarehouseInventoryCheck warehouseInventoryCheck);
}

9
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseInventoryCheckServiceImpl.java

@ -170,6 +170,15 @@ public class WarehouseInventoryCheckServiceImpl implements IWarehouseInventoryCh
return inventoryCheckDetailMapper.selectInventoryCheckDetailListByCode(inventoryCheckCode);
}
/*
* 库存盘点详情
* */
@Override
public int detailWarehouseInventoryCheck(WarehouseInventoryCheck warehouseInventoryCheck) {
return 1;
}
/**
*库存盘点单号生成规则

242
ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/detail.html

@ -0,0 +1,242 @@
<!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" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-inventoryCheck-edit" th:object="${warehouseInventoryCheck}">
<input name="inventoryCheckId" th:field="*{inventoryCheckId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">盘点单号:</label>
<div class="col-sm-8">
<input name="inventoryCheckCode" th:field="*{inventoryCheckCode}" 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="inventoryCheckName" th:field="*{inventoryCheckName}" 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="warehouseCode" th:field="*{warehouseCode}" 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="warehouseName" th:field="*{warehouseName}" 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">
<div class="input-group date">
<input name="inventoryCheckDate" th:value="${#dates.format(warehouseInventoryCheck.inventoryCheckDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" disabled>
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注内容:</label>
<div class="col-sm-8">
<textarea name="remark" class="form-control" disabled>[[*{remark}]]</textarea>
</div>
</div>
</form>
<!-- 物料信息 -->
<div class="container">
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
</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 prefix = ctx + "warehouse/inventoryCheck";
var warehouseInventoryCheck = [[${warehouseInventoryCheck}]];
$("#form-inventoryCheck-edit").validate({
focusCleanup: true
});
$("input[name='inventoryCheckDate']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
// 新增提交
function submitHandler() {
// 获取表单数据
const inventoryCheckData = $("#form-inventoryCheck-edit").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
// 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据
var table = $('#bootstrap-table').bootstrapTable('getData');
// 检查表格数据是否为空
if (table.length===0){
$.modal.alertWarning("请至少添加一条物料数据后再保存!");
return;
}
console.log(table);
// 将表数据转换成与complaintNoticeData格式一致的数组
var materialDataList = table.map(function(item) {
// 根据实际字段名调整
return {
"inventoryCheckDetailId":item.inventoryCheckDetailId,
"materialNo": item.materialNo, // 假设id对应materialId
"materialName": item.materialName,
"materialUnit": item.materialUnit,
"materialDescribe": item.materialDescribe,
"inventoryCheckNum": item.inventoryCheckNum,
"inventoryAccountNum": item.inventoryAccountNum,
"warehouseStoreAddress": item.warehouseStoreAddress,
"batchNumber": item.batchNumber,
"remark": item.remark,
// ...其他字段
};
});
const combinedData = Object.assign({}, inventoryCheckData, { inventoryCheckDetails: 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 + "/detail", jsonData);
}
//添加物料信息
function insertRow() {
var url = ctx + 'warehouse/inventoryCheck/materialSelect';
var options = {
title: '选择物料',
url: url,
callBack: doSubmit
};
$.modal.openOptions(options);
}
//收款凭证table列表
$(function() {
var options = {
modalName: "收款凭证",
url: prefix + '/getInventoryCheckDetailList',
queryParams: queryParams,
showColumns: false,
pagination: false,
showToggle: false,
showRefresh:false,
showSearch:false,
singleSelect:true,
columns: [{
checkbox: false
},
{
title: '库存盘点详情ID',
field: 'inventoryCheckDetailId',
visible: false
},
{
title: '料号',
field: 'materialNo',
},
{
title: '物料名称',
field: 'materialName',
},
{
title: '物料单位',
field: 'materialUnit',
},
{
title: '物料描述',
field: 'materialDescribe',
},
{
title: '盘点数量',
field: 'inventoryCheckNum',
},
{
title: '当时库存账上数量',
field: 'inventoryAccountNum',
},
{
title: '存放地址',
field: 'warehouseStoreAddress',
},
{
title: '批号',
field: 'batchNumber',
},
{
title: '说明',
field: 'remark',
},
]
};
$.table.init(options);
})
function queryParams(params) {
var curParams = {
// 传递参数查询参数
inventoryCheckCode: warehouseInventoryCheck.inventoryCheckCode
};
console.log(curParams);
return curParams;
}
function doSubmit(index, layero,uniqueId){
console.log(uniqueId);
var iframeWin = window[layero.find('iframe')[0]['name']];
var rowData = iframeWin.$('#bootstrap-materialSelect-table').bootstrapTable('getSelections')[0];
console.log("rowData: "+rowData);
$("#bootstrap-table").bootstrapTable('insertRow', {
index:1,
row: {
materialNo:rowData.materialNo,
materialName: rowData.materialName,
materialDescribe: rowData.materialDescribe,
materialUnit: rowData.materialUnit,
inventoryCheckNum : "",
inventoryAccountNum : "",
warehouseStoreAddress : "",
batchNumber : "",
remark : ""
}
})
layer.close(index);
}
// 逻辑删除前端的一行数据
function removeRow(materialNo){
$("#bootstrap-table").bootstrapTable('remove', {
field: 'materialNo',
values: materialNo
})
}
</script>
</body>
</html>

13
ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/inventoryCheck.html

@ -61,6 +61,9 @@
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('warehouse:inventoryCheck:edit')}]];
var detailFlag = [[${@permission.hasPermi('warehouse:inventoryCheck:detail')}]];
var prefix = ctx + "warehouse/inventoryCheck";
$(function() {
@ -140,12 +143,22 @@
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.inventoryCheckId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-success btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="detail(\'' + row.inventoryCheckId + '\')"><i class="fa fa-edit"></i>详情</a> ');
return actions.join('');
}
}]
};
$.table.init(options);
});
/*详情*/
function detail(inventoryCheckId) {
var url = ctx + 'warehouse/inventoryCheck/detail/'+inventoryCheckId;
console.log(url);
$.modal.open("库存盘点详情",url);
}
</script>
</body>
</html>
Loading…
Cancel
Save