Browse Source

[fix]

仓库管理 库存报损
修改库存报损表格列显示顺序;
修改新增库存报损页面,修改表单结构;
修改物料表格列顺序,添加列编辑功能、字典注解;
修改删除按钮绑定方法;
修改生成订单关联单选按钮和仓库名称下拉框监听函数;
修改仓库名称下拉框初始化函数,补全仓库编号、地址字段;
修改选择物料方法,根据是否关联生产单跳转不同接口,添加生产单号为空判断;
修改库存物料回调函数,补全字段定义,添加物料添加重复性判断;
新增部门名称后台动态获取赋值方法;
修改页面提交函数,拼接表单和子表数据提交后台;
修改库存报损详情页面表单结构、物料表显示结构;
dev
王晓迪 3 weeks ago
parent
commit
aeb4de7592
  1. 281
      ruoyi-admin/src/main/resources/templates/warehouse/inventoryReportDamage/add.html
  2. 125
      ruoyi-admin/src/main/resources/templates/warehouse/inventoryReportDamage/detail.html
  3. 6
      ruoyi-admin/src/main/resources/templates/warehouse/inventoryReportDamage/inventoryReportDamage.html

281
ruoyi-admin/src/main/resources/templates/warehouse/inventoryReportDamage/add.html

@ -21,7 +21,7 @@
<div class="form-group">
<label class="col-sm-3 control-label is-required">申请部门:</label>
<div class="col-sm-8">
<input name="applyDept" class="form-control" type="text" required>
<select id="applyDept" name="applyDept" class="form-control" type="text" required disabled></select>
</div>
</div>
<div class="form-group">
@ -34,11 +34,17 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">是否关联生产单号:</label>
<label class="col-sm-3 control-label is-required">是否关联生产单号:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('yes_or_no')}">
<input type="radio" th:id="${'whetherMakeNo_' + dict.dictCode}" name="whetherMakeNo" th:value="${dict.dictValue}" th:checked="${dict.default}">
<label th:for="${'whetherMakeNo_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
<!-- <div class="radio-box" th:each="dict : ${@dict.getType('yes_or_no')}">-->
<!-- <input type="radio" th:id="${'whetherMakeNo_' + dict.dictCode}" name="whetherMakeNo" th:value="${dict.dictValue}" th:checked="${dict.default}">-->
<!-- <label th:for="${'whetherMakeNo_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>-->
<!-- </div>-->
<div class="radio-inline">
<label><input type="radio" name="whetherMakeNo" value="0" checked></label>
</div>
<div class="radio-inline">
<label><input type="radio" name="whetherMakeNo" value="1"></label>
</div>
</div>
</div>
@ -48,30 +54,6 @@
<input name="makeNo" class="form-control" type="text" required>
</div>
</div>
<!-- <div class="form-group">
<label class="col-sm-3 control-label">料号:</label>
<div class="col-sm-8">
<input name="materialNo" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">物料名称:</label>
<div class="col-sm-8">
<input name="materialName" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">物料数合计:</label>
<div class="col-sm-8">
<input name="materialTotal" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">数量合计:</label>
<div class="col-sm-8">
<input name="numTotal" class="form-control" type="text">
</div>
</div> -->
<div class="form-group">
<label class="col-sm-3 control-label is-required">仓库名称:</label>
<div class="col-sm-8">
@ -81,16 +63,16 @@
</div>
</div>
<div class="form-group is-required">
<label class="col-sm-3 control-label">仓库ID:</label>
<label class="col-sm-3 control-label is-required">仓库ID:</label>
<div class="col-sm-8">
<input name="warehouseCode" class="form-control" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">仓库存放地址:</label>
<label class="col-sm-3 control-label is-required">仓库存放地址:</label>
<div class="col-sm-8">
<input name="warehouseStoreAddress" class="form-control" type="text">
<input name="warehouseStoreAddress" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
@ -133,47 +115,72 @@
var warehouseDeptDatas = [[${@dict.getType('warehouseDept')}]];
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-inventoryReportDamage-add').serialize());
var warehouseInventoryReportDamage = {
warehouseInventoryReportDamageChildList: []
};
$("select[name='applyDept']").removeAttr("disabled");
warehouseInventoryReportDamage.applyDept = $("select[name='applyDept']").val();
warehouseInventoryReportDamage.applyTime = $("input[name='applyTime']").val();
var whetherMakeNo = $("input[name='whetherMakeNo']:checked").val();
warehouseInventoryReportDamage.whetherMakeNo = whetherMakeNo;
if(whetherMakeNo === "1"){
var makeNo = $("input[name='makeNo']").val();
warehouseInventoryReportDamage.makeNo = makeNo;
}
warehouseInventoryReportDamage.warehouseName = $("select[name='warehouseName']").val();
warehouseInventoryReportDamage.warehouseCode = $("input[name='warehouseCode']").val();
warehouseInventoryReportDamage.warehouseStoreAddress = $("input[name='warehouseStoreAddress']").val();
warehouseInventoryReportDamage.remark = $("area[name='remark']").val();
var rows = $('#bootstrap-table-reportDamage-child').bootstrapTable('getData');
// 检查表格数据是否为空
if (rows.length === 0) {
$.modal.alertWarning("请至少添加一条物料信息再保存!");
return;
} else {
warehouseInventoryReportDamage.materialTotal = rows.length;
for (var i = 0; i < rows.length; i++) {
var DamageChild = {
materialNo: rows[i].materialNo,
materialName: rows[i].materialName,
materialType: rows[i].materialType,
materialDescribe: rows[i].materialDescribe,
materialBrand: rows[i].materialBrand,
materialUnit: rows[i].materialUnit,
materialPhotourl: rows[i].materialPhotourl,
actualScrapQuantity: rows[i].actualScrapQuantity,
scrapType: rows[i].scrapType,
scrapDetail: rows[i].scrapDetail,
qualityAssessment: rows[i].qualityAssessment,
estimatedValueRmb: rows[i].estimatedValueRmb,
responsibleUnit: rows[i].responsibleUnit,
remark: rows[i].remark,
};
// console.log(DamageChild);
warehouseInventoryReportDamage.warehouseInventoryReportDamageChildList.push(DamageChild);
}
var options = {
id : 'bootstrap-table-reportDamage-child',
modalName: "仓库库存报损物料信息",
columns: [
{checkbox: true},
{title: '库存报损id', field: 'reportDamageChildId', visible: false},
{title: '报损单号', field: 'reportDamageCode',},
{title: '料号', field: 'materialNo',},
{title: '图片', field: 'materialPhotourl',},
{title: '物料名称', field: 'materialName',},
{title: '物料类型', field: 'materialType',},
{title: '描述', field: 'materialDescribe',},
{title: '品牌', field: 'materialBrand',},
{title: '实际报废数量', field: 'actualScrapQuantity',},
{title: '报废类型', field: 'scrapType',},
{title: '报废明细', field: 'scrapDetail',},
{title: '品质判定', field: 'qualityAssessment',},
{title: '预估价值(RMB)', field: 'estimatedValueRmb',},
{title: '责任单位', field: 'responsibleUnit',},
{title: '备注', field: 'remark',},
{title: '关联生产单号', field: 'makeNo',},
{title: '仓库ID', field: 'warehouseCode',},
{title: '仓库名称', field: 'warehouseName',},
{title: '仓库存放地址', field: 'warehouseStoreAddress',},
{title: '申请部门ID', field: 'applyDeptId',},
{title: '申请部门', field: 'applyDept',},
{title: '操作', align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.materialNo + '\')"><i class="fa fa-edit"></i>删除</a> ');
return actions.join('');
}
console.log(warehouseInventoryReportDamage);
$.operate.saveJson(prefix+"/add",JSON.stringify(warehouseInventoryReportDamage));
}
}
]
};
$.table.init(options);
function insertRow() {
var ifMakeNo = $("input[name='whetherMakeNo']:checked").val();
if(ifMakeNo === "1"){
var makeNo = $("input[name='makeNo']").val();
if(!makeNo){
$.modal.alertWarning("请输入生产单号!")
}else{
var url = prefix + '/materialInMakeOrderSelect/' + makeNo;
var options = {
title: '选择物料',
url: url,
callBack: doSubmit
};
$.modal.openOptions(options);
}
}else{
var url = ctx + 'warehouse/inventoryCheck/materialSelect';
var options = {
title: '选择物料',
@ -182,11 +189,27 @@
};
$.modal.openOptions(options);
}
}
function doSubmit(index, layero,uniqueId){
console.log(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);
var rows = $("#bootstrap-table-reportDamage-child").bootstrapTable('getData');
if(rows.length > 0){
for(var i=0;i<rows.length;i++){
var data = rows[i];
if(data.materialNo == rowData.materialNo){
$.modal.alertError("不能选择已添加过的相同物料");
return;
}
};
insertTable(rowData);
}else{
insertTable(rowData);
}
layer.close(index);
}
function insertTable(rowData){
$("#bootstrap-table-reportDamage-child").bootstrapTable('insertRow', {
index:1,
row: {
@ -197,40 +220,123 @@
materialPhotourl: rowData.materialPhotourl,
materialDescribe: rowData.materialDescribe,
materialUnit: rowData.materialUnit,
inventoryCheckNum : "",
inventoryAccountNum : "",
warehouseStoreAddress : "",
batchNumber : "",
actualScrapQuantity: "",
scrapType: "",
scrapDetail: "",
qualityAssessment: "",
estimatedValueRmb: "",
responsibleUnit: "",
remark : ""
}
})
layer.close(index);
}
// 逻辑删除前端的一行数据
function removeRow(materialNo){
$("#bootstrap-table").bootstrapTable('remove', {field: 'materialNo', values: materialNo})
$("#bootstrap-table-reportDamage-child").bootstrapTable('remove', {field: 'materialNo', values: materialNo})
}
$(function () {
var options = {
id : 'bootstrap-table-reportDamage-child',
modalName: "仓库库存报损物料信息",
columns: [
{title: '库存报损id', field: 'reportDamageChildId', visible: false},
{title: '报损单号', field: 'reportDamageCode',visible: false},
{title: '料号', field: 'materialNo',},
{title: '图片', field: 'materialPhotourl',},
{title: '物料名称', field: 'materialName',},
{title: '物料类型', field: 'materialType',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
},
{title: '描述', field: 'materialDescribe',},
{title: '品牌', field: 'materialBrand',},
{title: '单位', field: 'materialUnit',},
{title: '实际报废数量', field: 'actualScrapQuantity',
editable:{
type: 'text',
validate: function(v) {
if (!v) return '输入不能为空';
if (isNaN(v)) return '输入错误';
}
}
},
{title: '报废类型', field: 'scrapType',
editable:{
type: 'text',
}
},
{title: '报废明细', field: 'scrapDetail',
editable:{
type: 'text',
}
},
{title: '品质判定', field: 'qualityAssessment',
editable:{
type: 'text',
}
},
{title: '预估价值(RMB)', field: 'estimatedValueRmb',
editable:{
type: 'text',
}
},
{title: '责任单位', field: 'responsibleUnit',
editable:{
type: 'text',
}
},
{title: '备注', field: 'remark',
editable:{
type: 'text',
}
},
{
title: '报损报告',
field: 'damageReportUrl',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" ><i class="fa fa-plus"></i>上传</a> ');
return actions.join('');
}
},
{title: '操作', align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.materialNo + '\')"><i class="fa fa-edit"></i>删除</a> ');
return actions.join('');
}
}
]
};
$.table.init(options);
loadWarehouseCodes();
changeWhetherMakeNo();
});
getDeptName();
//单选改变是否关联生产单号显示关联生产单号输入框
$("input[name='whetherMakeNo']").change(function () {
changeWhetherMakeNo();
});
$('#stockNameSelct').on('select2:select', function(e) {
var data = e.params.data;
$("input[name='warehouseCode']").val(data.stockNo);
$("input[name='warehouseStoreAddress']").val(data.stockAddress);
});
});
//根据是否关联生产单号显示关联生产单号输入框
function changeWhetherMakeNo() {
$("#makeNoInput").display = function () {
var whetherMakeNo = $("input[name='whetherMakeNo']:checked").val();
if (whetherMakeNo == 1) {
// console.log(whetherMakeNo);
if (whetherMakeNo === "1") {
$("#makeNoInput").show();
} else {
$("#makeNoInput").hide();
}
};
}
$("input[name='applyTime']").datetimepicker({
format: "yyyy-mm-dd",
@ -261,7 +367,7 @@
params.page = params.page || 1;
var options = [];
for (var i = 0; i < data.length; i++) {
var option = {id: data[i].stockName, text: data[i].stockName,};
var option = {id: data[i].stockName, text: data[i].stockName,stockNo: data[i].stockNO,stockAddress: data[i].stockAddr};
options.push(option);
}
var moreDataAvaliable = (params.page * 30) < data.total_count;
@ -276,11 +382,18 @@
}
});
}
$('#stockNameSelct').on('select2:select', function(e) {
var data = e.params.data;
$("input[name='warehouseCode']").val(data.stockNO);
$("input[name='warehouseStoreAddress']").val(data.stockAddress);
function getDeptName(){
$.ajax({
url: prefix + "/getUserDeptName",
type: "get",
dataType: "json",
success: function (result) {
console.log(result.data);
$("select[name='applyDept']").append($('<option></option>').val(result.data).html(result.data));
}
});
}
</script>
</body>
</html>

125
ruoyi-admin/src/main/resources/templates/warehouse/inventoryReportDamage/detail.html

@ -14,14 +14,14 @@
<input name="reportDamageCode" th:field="*{reportDamageCode}" 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="warehousScrapType" class="form-control m-b" th:with="type=${@dict.getType('warehous_scrap_type')}" disabled>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{warehousScrapType}"></option>
</select>
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="col-sm-3 control-label">报废类型:</label>-->
<!-- <div class="col-sm-8">-->
<!-- <select name="warehousScrapType" class="form-control m-b" th:with="type=${@dict.getType('warehous_scrap_type')}" disabled>-->
<!-- <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{warehousScrapType}"></option>-->
<!-- </select>-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="col-sm-3 control-label">关联生产单号:</label>
<div class="col-sm-8">
@ -52,18 +52,6 @@
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">料号:</label>
<div class="col-sm-8">
<input name="materialNo" th:field="*{materialNo}" 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="materialName" th:field="*{materialName}" 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">
@ -105,10 +93,7 @@
<div class="container">
<div class="form-row">
<div class="btn-group-sm" id="toolbar" role="group">
<span>选择物料</span>
<a class="btn btn-success" onclick="insertRow()">
<i class="fa fa-plus"></i> 选择物料
</a>
<span>报损物料信息</span>
</div>
</div>
<div class="row">
@ -129,84 +114,56 @@
var warehouseDeptDatas = [[${@dict.getType('warehouseDept')}]];
var warehousScrapTypeDatas = [[${@dict.getType('warehous_scrap_type')}]];
var prefix = ctx + "warehouse/inventoryReportDamage";
$("#form-inventoryReportDamage-edit").validate({focusCleanup: true});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-inventoryReportDamage-edit').serialize());
}
}
$(function () {
var options = {
id : 'bootstrap-table-reportDamage-child',
modalName: "仓库库存报损物料信息",
data: [[${warehouseInventoryReportDamage.warehouseInventoryReportDamageChildList}]],
columns: [
{checkbox: true},
{title: '库存报损id', field: 'reportDamageChildId', visible: false},
{title: '报损单号', field: 'reportDamageCode',},
{title: '报损单号', field: 'reportDamageCode',visible: false},
{title: '料号', field: 'materialNo',},
{title: '图片', field: 'materialPhotourl',},
{title: '物料名称', field: 'materialName',},
{title: '物料类型', field: 'materialType',},
{title: '物料类型', field: 'materialType',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
},
{title: '描述', field: 'materialDescribe',},
{title: '品牌', field: 'materialBrand',},
{title: '实际报废数量', field: 'actualScrapQuantity',},
{title: '报废类型', field: 'scrapType',},
{title: '报废明细', field: 'scrapDetail',},
{title: '品质判定', field: 'qualityAssessment',},
{title: '预估价值(RMB)', field: 'estimatedValueRmb',},
{title: '责任单位', field: 'responsibleUnit',},
{title: '备注', field: 'remark',},
{title: '关联生产单号', field: 'makeNo',},
{title: '仓库ID', field: 'warehouseCode',},
{title: '仓库名称', field: 'warehouseName',},
{title: '仓库存放地址', field: 'warehouseStoreAddress',},
{title: '申请部门ID', field: 'applyDeptId',},
{title: '申请部门', field: 'applyDept',},
{title: '操作', align: 'center',
{title: '单位', field: 'materialUnit',},
{title: '实际报废数量', field: 'actualScrapQuantity',
},
{title: '报废类型', field: 'scrapType',
},
{title: '报废明细', field: 'scrapDetail',
},
{title: '品质判定', field: 'qualityAssessment',
},
{title: '预估价值(RMB)', field: 'estimatedValueRmb',
},
{title: '责任单位', field: 'responsibleUnit',
},
{title: '备注', field: 'remark',
},
{
title: '报损报告',
field: 'damageReportUrl',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.materialNo + '\')"><i class="fa fa-edit"></i>删除</a> ');
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" ><i class="fa fa-plus"></i>报告</a> ');
return actions.join('');
}
}
},
]
};
$.table.init(options);
function insertRow() {
var url = ctx + 'warehouse/inventoryCheck/materialSelect';
var options = {
title: '选择物料',
url: url,
callBack: doSubmit
};
$.modal.openOptions(options);
}
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-reportDamage-child").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})
}
$("input[name='applyTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",

6
ruoyi-admin/src/main/resources/templates/warehouse/inventoryReportDamage/inventoryReportDamage.html

@ -102,23 +102,21 @@
{title: '报损单号', field: 'reportDamageCode',},
{title: '申请部门', field: 'applyDept',},
{title: '申请时间', field: 'applyTime',},
{title: '报废类型', field: 'warehousScrapType',
{title: '报废类型', field: 'warehousScrapType',visible: false,
formatter: function(value, row, index) {return $.table.selectDictLabel(warehousScrapTypeDatas, value);}
},
{title: '是否关联生产单号', field: 'whetherMakeNo',
formatter: function(value, row, index) {return $.table.selectDictLabel(whetherMakeNoDatas, value);}
},
{title: '生产单号', field: 'makeNo',},
{title: '料号', field: 'materialNo',},
{title: '物料名称', field: 'materialName',},
{title: '物料数合计', field: 'materialTotal',},
{title: '数量合计', field: 'numTotal',},
{title: '仓库ID', field: 'warehouseCode',},
{title: '仓库名称', field: 'warehouseName',},
{title: '仓库存放地址', field: 'warehouseStoreAddress',},
{title: '备注', field: 'remark',},
{title: '录入时间', field: 'createTime',},
{title: '录入人', field: 'createBy',},
{title: '录入时间', field: 'createTime',},
{title: '更新人', field: 'updateBy',},
{title: '操作', align: 'center',
formatter: function(value, row, index) {

Loading…
Cancel
Save