|
|
@ -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,60 +115,101 @@ |
|
|
|
var warehouseDeptDatas = [[${@dict.getType('warehouseDept')}]]; |
|
|
|
function submitHandler() { |
|
|
|
if ($.validate.form()) { |
|
|
|
$.operate.save(prefix + "/add", $('#form-inventoryReportDamage-add').serialize()); |
|
|
|
} |
|
|
|
} |
|
|
|
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(''); |
|
|
|
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); |
|
|
|
} |
|
|
|
} |
|
|
|
] |
|
|
|
}; |
|
|
|
$.table.init(options); |
|
|
|
console.log(warehouseInventoryReportDamage); |
|
|
|
$.operate.saveJson(prefix+"/add",JSON.stringify(warehouseInventoryReportDamage)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function insertRow() { |
|
|
|
var url = ctx + 'warehouse/inventoryCheck/materialSelect'; |
|
|
|
var options = { |
|
|
|
title: '选择物料', |
|
|
|
url: url, |
|
|
|
callBack: doSubmit |
|
|
|
}; |
|
|
|
$.modal.openOptions(options); |
|
|
|
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: '选择物料', |
|
|
|
url: url, |
|
|
|
callBack: doSubmit |
|
|
|
}; |
|
|
|
$.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(); |
|
|
|
}); |
|
|
|
//单选改变是否关联生产单号显示关联生产单号输入框 |
|
|
|
$("input[name='whetherMakeNo']").change(function () { |
|
|
|
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) { |
|
|
|
$("#makeNoInput").show(); |
|
|
|
} else { |
|
|
|
$("#makeNoInput").hide(); |
|
|
|
} |
|
|
|
}; |
|
|
|
var whetherMakeNo = $("input[name='whetherMakeNo']:checked").val(); |
|
|
|
// 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> |