You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
516 lines
23 KiB
516 lines
23 KiB
<!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" />
|
|
<th:block th:include="include :: bootstrap-fileinput-css"/>
|
|
<link th:href="@{/ajax/libs/select2/select2.css}" rel="stylesheet">
|
|
<link th:href="@{/ajax/libs/select2/select2-bootstrap.css}" rel="stylesheet">
|
|
<th:block th:include="include :: bootstrap-editable-css"/>
|
|
<style>
|
|
.other-container {
|
|
width: 90%;
|
|
height: 200px;
|
|
margin: auto;
|
|
}
|
|
.other {
|
|
margin-top: 20px;
|
|
}
|
|
h4 {
|
|
display: inline-block;
|
|
margin-right: 20px;
|
|
}
|
|
.modal-body{
|
|
height: 550px;
|
|
}
|
|
iframe{
|
|
width: 100%;
|
|
height: 500px;
|
|
frameborder: 0;
|
|
border: 0;
|
|
display: inline-block;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body class="white-bg">
|
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
|
<form class="form-horizontal m" id="form-warehousingInspectionNotice-edit" th:object="${warehousingInspectionNotice}">
|
|
<input name="warehousingInspectionNoticeId" th:field="*{warehousingInspectionNoticeId}" type="hidden">
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label is-required">入通知单号:</label>
|
|
<div class="col-sm-8">
|
|
<input name="inNoticeNumber" th:field="*{inNoticeNumber}" class="form-control" type="text" required readonly>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">订购单号:</label>
|
|
<div class="col-sm-8">
|
|
<select name="purchaseOrderNumber" class="form-control m-b" th:field="*{purchaseOrderNumber}" readonly>
|
|
<option value="">所有</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">供应商代码:</label>
|
|
<div class="col-sm-8">
|
|
<input name="supplierCode" th:field="*{supplierCode}" 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="supplierName" th:field="*{supplierName}" 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="customerContact" th:field="*{customerContact}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">仓库名称:</label>
|
|
<div class="col-sm-8">
|
|
<select name="stockName" class="form-control m-b" th:field="*{stockName}">
|
|
<option value="">请选择仓库名称</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">仓库编号:</label>
|
|
<div class="col-sm-8">
|
|
<input name="stockNumber" th:field="*{stockNumber}" 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="stockManager" th:field="*{stockManager}" class="form-control" type="text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">内外销:</label>
|
|
<div class="col-sm-8">
|
|
<select name="exportSales" class="form-control m-b" th:with="type=${@dict.getType('sys_export_sales')}">
|
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{exportSales}"></option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">入库类别:</label>
|
|
<div class="col-sm-8">
|
|
<select name="warehousingCategory" class="form-control m-b" th:with="type=${@dict.getType('warehousing_category')}">
|
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{warehousingCategory}"></option>
|
|
</select>
|
|
</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="inspectionDate" th:field="*{inspectionDate}" class="form-control" placeholder="yyyy-MM-dd" type="text">
|
|
<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">
|
|
<div class="input-group date">
|
|
<input name="warehousingDate" th:field="*{warehousingDate}" class="form-control" placeholder="yyyy-MM-dd" type="text">
|
|
<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="remarks" class="form-control">[[*{remarks}]]</textarea>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-3 control-label">检验报告:</label>
|
|
<div class="col-sm-8">
|
|
<input type="hidden" name="inspectionReport" th:field="*{inspectionReport}">
|
|
<div class="file-loading">
|
|
<input class="form-control file-upload" id="inspectionReport" name="file" type="file">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="other-container">
|
|
<div class="other">
|
|
<br><hr>
|
|
<h4>订单材料信息</h4>
|
|
<div class="col-sm-12 select-table table-striped">
|
|
<table id="addDetailTable" style="white-space:nowrap"></table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<th:block th:include="include :: footer" />
|
|
<th:block th:include="include :: datetimepicker-js" />
|
|
<th:block th:include="include :: bootstrap-fileinput-js"/>
|
|
<th:block th:include="include :: select2-js"/>
|
|
<th:block th:include="include :: bootstrap-table-editable-js"/>
|
|
<script th:inline="javascript">
|
|
|
|
var getData = [[${warehousingInspectionNotice}]];
|
|
var prefix = ctx + "storehouse/warehousingInspectionNotice";
|
|
var prefixDetail = ctx + "storehouse/warehousingInspectionDetail";
|
|
var prefixPurchaseOrder = ctx + "purchase/purchaseOrder"
|
|
var prefixPurchaseMaterial = ctx + "purchase/purchaseMaterial"
|
|
|
|
var purchasingUnitDatas = [[${@dict.getType('sys_unit_class')}]];
|
|
var judgmentResultsDatas = [[${@dict.getType('judgment_results')}]];
|
|
var materialTypeDatas = [[${@dict.getType('ck_meterialt_type')}]];
|
|
|
|
$("#form-warehousingInspectionNotice-edit").validate({
|
|
focusCleanup: true
|
|
});
|
|
|
|
function submitHandler() {
|
|
let getData=$('#addDetailTable').bootstrapTable('getData', true)
|
|
if(getData.length > 0){
|
|
//确认添加选中的物料数据
|
|
confirmDetailMaterial();
|
|
if ($.validate.form()) {
|
|
$.operate.save(prefix + "/edit", $('#form-warehousingInspectionNotice-edit').serialize());
|
|
}
|
|
} else {
|
|
$.modal.alertWarning("未选择物料,请添加!")
|
|
}
|
|
}
|
|
|
|
$("input[name='inspectionDate']").datetimepicker({
|
|
format: "yyyy-mm-dd hh:ii:ss",
|
|
minView: "month",
|
|
autoclose: true
|
|
});
|
|
|
|
$("input[name='warehousingDate']").datetimepicker({
|
|
format: "yyyy-mm-dd",
|
|
minView: "month",
|
|
autoclose: true
|
|
});
|
|
|
|
$(".file-upload").each(function (i) {
|
|
var val = $("input[name='" + this.id + "']").val()
|
|
$(this).fileinput({
|
|
'uploadUrl': prefix + '/upload',
|
|
initialPreviewAsData: true,
|
|
initialPreview: [val],
|
|
maxFileCount: 1,
|
|
autoReplace: true
|
|
}).on('fileuploaded', function (event, data, previewId, index) {
|
|
$("input[name='" + event.currentTarget.id + "']").val(data.response.url)
|
|
}).on('fileremoved', function (event, id, index) {
|
|
$("input[name='" + event.currentTarget.id + "']").val('')
|
|
})
|
|
$(this).fileinput('_initFileActions');
|
|
});
|
|
|
|
|
|
//初始化添加材料表
|
|
$('#addDetailTable').bootstrapTable({
|
|
url: prefixDetail + '/list',
|
|
pagination: true,
|
|
pageNumber: 1,
|
|
pageSize: 10,
|
|
method: "post",
|
|
contentType: "application/x-www-form-urlencoded",
|
|
striped: true, // 是否显示行间隔色
|
|
cache: false, // 是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
|
|
showToggle: false, // 是否显示详细视图和列表视图的切换按钮
|
|
cardView: false, // 是否显示详细视图
|
|
detailView: false, // 是否显示父子表
|
|
smartDisplay: false, // 加了这个才显示每页显示的行数
|
|
showExport: false, // 是否显示导出按钮
|
|
clickToSelect: true,
|
|
paginationDetailHAlign: ' hiddenDetailInfo',
|
|
height: 250,
|
|
uniqueId: 'materialCode',
|
|
queryParams: function (params) {
|
|
//console.log("123");
|
|
var curParams = {
|
|
// 传递参数查询参数
|
|
pageSize: params.limit,
|
|
pageNum: params.offset / params.limit + 1,
|
|
inNoticeNumber: getData.inNoticeNumber
|
|
// enterpriseCode: data[0].enterpriseCode
|
|
};
|
|
// console.log(data[0].enterpriseCode)
|
|
return curParams
|
|
},
|
|
columns: [
|
|
// {
|
|
// title: '操作',
|
|
// align: 'center',
|
|
// formatter: function (value, row, index) {
|
|
// var actions = [];
|
|
// actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeProductData(\'' + row.rawSubsidiaryCode + '\')" ><i class="fa fa-remove"></i>删除</a>');
|
|
// return actions.join('');
|
|
// }
|
|
// },
|
|
{
|
|
field: 'warehousingInspectionDetailId',
|
|
title: '入库检验通知物料id',
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'inNoticeNumber',
|
|
title: '入通知单号',
|
|
visible: false
|
|
},
|
|
{
|
|
field: 'materialCode',
|
|
title: '物料代码'
|
|
},
|
|
{
|
|
field: 'materialName',
|
|
title: '物料名称'
|
|
},
|
|
{
|
|
field: 'specificationModel',
|
|
title: '规格型号'
|
|
},
|
|
{
|
|
field: 'materialType',
|
|
title: '物料类别',
|
|
formatter: function(value, row, index) {
|
|
return $.table.selectDictLabel(materialTypeDatas, value);
|
|
}
|
|
},
|
|
{
|
|
field: 'purchasingUnit',
|
|
title: '单位',
|
|
formatter: function(value, row, index) {
|
|
return $.table.selectDictLabel(purchasingUnitDatas, value);
|
|
}
|
|
},
|
|
{
|
|
field: 'materialQuantity',
|
|
title: '送货数量'
|
|
},
|
|
{
|
|
field: 'qualifiedQuantity',
|
|
title: '合格数量',
|
|
editable: {
|
|
type: 'text',
|
|
title: '合格数量',
|
|
emptytext: '合格数量',
|
|
validate: function (v) {
|
|
if (isNaN(v)) return '数量必须是数字';
|
|
var ex = /^[1-9]\d*$/;
|
|
if (!ex.test(v)) return '数量必须是正整数';
|
|
}
|
|
}
|
|
},
|
|
{
|
|
field: 'unqualifiedQuantity',
|
|
title: '不合格数量',
|
|
editable: {
|
|
type: 'text',
|
|
title: '不合格数量',
|
|
emptytext: '不合格数量',
|
|
validate: function (v) {
|
|
if (isNaN(v)) return '数量必须是数字';
|
|
var ex = /^[1-9]\d*$/;
|
|
if (!ex.test(v)) return '数量必须是正整数';
|
|
}
|
|
},
|
|
formatter:function(value, row, index) {
|
|
let unqualifiedQuantity = row.materialQuantity - row.qualifiedQuantity;
|
|
row.unqualifiedQuantity = row.materialQuantity - row.qualifiedQuantity;
|
|
return unqualifiedQuantity.toFixed(0);
|
|
}
|
|
},
|
|
{
|
|
field: 'qualificationRate',
|
|
title: '合格率',
|
|
editable: {
|
|
type: 'text',
|
|
title: '合格率',
|
|
emptytext: '合格率',
|
|
validate: function (v) {
|
|
|
|
}
|
|
},
|
|
formatter:function(value, row, index) {
|
|
let total = row.qualifiedQuantity / row.materialQuantity;
|
|
row.qualificationRate = row.qualifiedQuantity / row.materialQuantity;
|
|
return (total*100).toFixed(2) + '%';
|
|
}
|
|
},
|
|
{
|
|
field: 'purchaseExplain',
|
|
title: '说明'
|
|
},
|
|
{
|
|
field: 'judgmentResults',
|
|
title: '判定结果',
|
|
editable: {
|
|
type: 'select',
|
|
title: '判定结果',
|
|
emptytext: '判定结果',
|
|
source: function() {
|
|
let result = [];
|
|
for (let i = 0;i<judgmentResultsDatas.length;i++) {
|
|
result.push({value: judgmentResultsDatas[i].dictValue,text: judgmentResultsDatas[i].dictLabel})
|
|
}
|
|
return result;
|
|
},
|
|
validate: function (value) {
|
|
|
|
}
|
|
}
|
|
},
|
|
{
|
|
field: 'receiptBatchNumber',
|
|
title: '收货批号',
|
|
editable: {
|
|
type: 'text',
|
|
title: '收货批号',
|
|
emptytext: '收货批号',
|
|
validate: function (v) {
|
|
|
|
}
|
|
}
|
|
},
|
|
{
|
|
field: 'manufacturerBatchNumber',
|
|
title: '厂商批号',
|
|
editable: {
|
|
type: 'text',
|
|
title: '厂商批号',
|
|
emptytext: '厂商批号',
|
|
validate: function (v) {
|
|
|
|
}
|
|
}
|
|
}]
|
|
})
|
|
|
|
//获取订单号
|
|
$.ajax({
|
|
url: prefixPurchaseOrder + '/list',
|
|
type: "post",
|
|
success: function (res) {
|
|
// console.log(res)
|
|
if (res.rows.length > 0) {
|
|
var orderData = res.rows;
|
|
//alert(JSON.stringify(data));
|
|
for (let i in orderData) {
|
|
// console.log(finishProductData[i].finishProductCode)
|
|
$("#form-warehousingInspectionNotice-edit select[name='purchaseOrderNumber']").append("<option value='" + orderData[i].purchaseOrderNumber + "'>" + orderData[i].purchaseOrderNumber + "</option>");
|
|
}
|
|
$("#form-warehousingInspectionNotice-edit select[name='purchaseOrderNumber']").val(getData.purchaseOrderNumber).trigger("change");
|
|
$("#form-warehousingInspectionNotice-edit select[name='purchaseOrderNumber']").change(function () {
|
|
var purchaseOrderNumber = $(this).val();
|
|
for (let i=0;i<orderData.length;i++) {
|
|
if (orderData[i].purchaseOrderNumber == purchaseOrderNumber) {
|
|
$("#form-warehousingInspectionNotice-edit input[name='supplierCode']").val(orderData[i].supplierCode);
|
|
$("#form-warehousingInspectionNotice-edit input[name='supplierName']").val(orderData[i].supplierName);
|
|
$("#form-warehousingInspectionNotice-edit input[name='customerContact']").val(orderData[i].customerContact);
|
|
//选择订单号显示表内订单信息
|
|
showDetailMaterial();
|
|
}
|
|
}
|
|
})
|
|
|
|
} else {
|
|
$.modal.msgError(res.msg);
|
|
}
|
|
}
|
|
})
|
|
|
|
//获取仓库信息
|
|
$.ajax({
|
|
url: ctx + "stock/stockInfo/list",
|
|
type: "post",
|
|
success: function (res) {
|
|
// console.log(res)
|
|
if (res.rows.length > 0) {
|
|
let stockData = res.rows;
|
|
for (let i in stockData) {
|
|
// console.log(finishProductData[i].finishProductCode)
|
|
$("#form-warehousingInspectionNotice-edit select[name='stockName']").append("<option value='" + stockData[i].stockname + "'>" + stockData[i].stockname + "</option>");
|
|
}
|
|
$("#form-warehousingInspectionNotice-edit select[name='stockName']").val(getData.stockName).trigger("change");
|
|
$("#form-warehousingInspectionNotice-edit select[name='stockName']").change(function () {
|
|
var stockName = $(this).val();
|
|
for (let i=0;i<stockData.length;i++) {
|
|
if (stockData[i].stockname == stockName) {
|
|
$("#form-warehousingInspectionNotice-edit input[name='stockNumber']").val(stockData[i].stockNO);
|
|
$("#form-warehousingInspectionNotice-edit input[name='stockManager']").val(stockData[i].stockmanager);
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
}
|
|
})
|
|
|
|
//选择订单号显示表内订单信息
|
|
function showDetailMaterial() {
|
|
$('#addDetailTable').bootstrapTable("removeAll")
|
|
var purchaseOrderNumber = $("select[name='purchaseOrderNumber']").val();
|
|
$.ajax({
|
|
url: prefixPurchaseMaterial + '/list',
|
|
type: 'post',
|
|
data: {
|
|
purchaseOrderNumber: purchaseOrderNumber
|
|
},
|
|
success: function (res) {
|
|
console.log(res)
|
|
var count = res.rows.length;
|
|
var data = res.rows;
|
|
var inNoticeNumber = $("input[name='inNoticeNumber']").val();
|
|
for (i = 0; i < res.rows.length; i++) {
|
|
$("#addDetailTable").bootstrapTable('insertRow', {
|
|
index: count + i,
|
|
row: {
|
|
inNoticeNumber: inNoticeNumber,
|
|
materialCode: data[i].rawSubsidiaryCode,
|
|
materialName: data[i].rawSubsidiaryName,
|
|
specificationModel: data[i].specificationModel,
|
|
materialType: data[i].materialType,
|
|
purchasingUnit: data[i].purchasingUnit,
|
|
materialQuantity: data[i].materialQuantity,
|
|
qualifiedQuantity: '',
|
|
unqualifiedQuantity: '',
|
|
qualificationRate: '',
|
|
purchaseExplain: data[i].purchaseExplain,
|
|
judgmentResults: '',
|
|
receiptBatchNumber: '',
|
|
manufacturerBatchNumber: '',
|
|
}
|
|
});
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
//确认添加选中的物料数据
|
|
function confirmDetailMaterial() {
|
|
$("#addDetailTable").bootstrapTable('refresh');
|
|
let data = $('#addDetailTable').bootstrapTable('getData', true);
|
|
// let getData=$('#addProductTable').bootstrapTable('getData', true)
|
|
// console.log(data)
|
|
$.ajax({
|
|
url: prefixDetail + '/addEditSave',
|
|
type: "POST",
|
|
data: {
|
|
data: JSON.stringify(data)
|
|
},
|
|
dataType: "json",
|
|
success: function (resp) {
|
|
// console.log(data)
|
|
console.log(resp)
|
|
},
|
|
|
|
})
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|