万材erp项目
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.
 
 
 
 

642 lines
28 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"/>
<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-deliveryGoodsNotice-add">
<div class="form-group">
<label class="col-sm-3 control-label is-required">通知单号:</label>
<div class="col-sm-8">
<input name="noticeOrderNumber" 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">
<!-- <input name="deliveryDate" class="form-control" type="text">-->
<div class="input-group date">
<input name="deliveryDate" 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 is-required">客户代码:</label>
<div class="col-sm-8">
<!-- <input name="enterpriseCode" class="form-control" type="text" required>-->
<select name="enterpriseCode" class="form-control m-b" required>
<option value="">请选择客户代码</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">客户名称:</label>
<div class="col-sm-8">
<input name="enterpriseName" 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="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">
<input name="customerFactory" 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="deliveryAddress" class="form-control" type="text">
</div>
</div>
<div class="form-group" style="display: none">
<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}"></option>
</select>
</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">
<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" class="form-control" type="text">
</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" type="text"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">制单人:</label>
<div class="col-sm-8">
<!-- <input name="voucherPreparation" class="form-control" type="text">-->
<select name="voucherPreparation" class="form-control m-b">
<option value="">请选择制单人</option>
</select>
</div>
</div>
<div class="form-group" style="display: none">
<label class="col-sm-3 control-label">发货否:</label>
<div class="col-sm-8">
<select name="deliveryGoodsFlag" class="form-control m-b" th:with="type=${@dict.getType('sys_whether')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
<!--<div class="form-group">
<label class="col-sm-3 control-label">备用一:</label>
<div class="col-sm-8">
<input name="standbyOne" 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="standbyTwo" class="form-control" type="text">
</div>
</div>-->
</form>
</div>
<div class="other-container">
<div class="other">
<br><hr>
<h4>订单信息</h4>
<a class="btn btn-primary" onclick="showOrderDetailModal()"><i class="fa fa-plus"></i>&nbsp;订单信息</a>
<div class="col-sm-12 select-table table-striped">
<table id="addSalesFinishTable" style="white-space:nowrap"></table>
</div>
</div>
<div class="modal inmodal" id="salesFinishModal"
role="dilog" aria-hidden="true">
<!-- 查询订单成品资料-->
<div class="modal-dialog" style="width: 1000px;background-color: #FFFFFF">
<div class="modal-content" style="background-color: #FFFFFF">
<div class="modal-body">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="salesFinishFormId">
<div class="select-list">
<ul>
<li>
<label>订单号码:</label>
<input type="text" name="salesOrderNumber"/>
</li>
<li>
<label>成品代码:</label>
<input type="text" name="finishProductCode"/>
</li>
<li>
<label>成品名称:</label>
<input type="text" name="finishProductName"/>
</li>
<li>
<label>客户代码:</label>
<input type="text" name="enterpriseCode"/>
</li>
<li>
<label>客户名称:</label>
<input type="text" name="enterpriseName"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search('salesFinishFormId','salesFinishTable')"><i
class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('salesFinishFormId','salesFinishTable')"><i
class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="salesFinishTable" style="white-space:nowrap"></table>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<a class="btn btn-warning btn-rounded" onclick="addSalesFinishToTable()">确认添加</a>
<a class="btn btn-primary btn-rounded" onclick="closeSalesFinishModal()">关闭</a>
</div>
</div>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js"/>
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: bootstrap-table-editable-js"/>
<script th:inline="javascript">
var prefix = ctx + "manufacture/deliveryGoodsNotice"
var prefixDetail = ctx + "manufacture/deliveryGoodsDetail"
var commonCurrencyDatas = [[${@dict.getType('sys_common_currency')}]];
$("#form-deliveryGoodsNotice-add").validate({
focusCleanup: true
});
function submitHandler() {
var getData = $("#addSalesFinishTable").bootstrapTable("getData");
if(getData.length > 0){
if ($.validate.form()) {
//确认添加选中的物料数据
confirmSalesFinish();
$.operate.save(prefix + "/add", $('#form-deliveryGoodsNotice-add').serialize());
}
} else {
$.modal.alertWarning("未选择订单,请选择!")
}
}
$("input[name='deliveryDate']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true,
todayBtn: true
});
$("input[name='deliveryDate']").datetimepicker("setDate", new Date())
//获取单号
$.ajax({
url: prefix + "/id",
type: "post",
dateType: "json",
success: function (resp) {
if (resp.code === 0) {
$("input[name='noticeOrderNumber']").val(resp.data);
} else {
$.modal.msgError("失败啦");
}
},
error: function () {
$.modal.msgError("后台出错啦!");
}
});
//获取仓库信息
$.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-deliveryGoodsNotice-add select[name='stockName']").append("<option value='" + stockData[i].stockname + "'>" + stockData[i].stockname + "</option>");
$("#form-deliveryGoodsNotice-add select[name='stockName']").change(function () {
var stockName = $(this).val();
for (let i=0;i<stockData.length;i++) {
if (stockData[i].stockname == stockName) {
$("#form-deliveryGoodsNotice-add input[name='stockNumber']").val(stockData[i].stockNO);
}
}
})
}
}
}
})
//获取客户信息
$.ajax({
url: ctx + 'system/customer/list',
type: "post",
success: function (res) {
// console.log(res)
if (res.rows.length > 0) {
let customerData = res.rows;
for (let i in customerData) {
// console.log(finishProductData[i].finishProductCode)
$("#form-deliveryGoodsNotice-add select[name='enterpriseCode']").append("<option value='" + customerData[i].enterpriseCode + "'>" + customerData[i].enterpriseCode + "</option>");
$("#form-deliveryGoodsNotice-add select[name='enterpriseCode']").change(function () {
var enterpriseCode = $(this).val();
for (let i=0;i<customerData.length;i++) {
if (customerData[i].enterpriseCode == enterpriseCode) {
$("#form-deliveryGoodsNotice-add input[name='enterpriseName']").val(customerData[i].enterpriseName);
$("#form-deliveryGoodsNotice-add input[name='customerContact']").val(customerData[i].customerContact);
$("#form-deliveryGoodsNotice-add input[name='deliveryAddress']").val(customerData[i].deliveryAddress);
$("#form-deliveryGoodsNotice-add select[name='exportSales']").val(customerData[i].exportSales).trigger("change");
}
}
})
}
}
}
})
//获取制单人
$.ajax({
url: ctx + "system/user/list",
type: "post",
success: function (res) {
// console.log(res)
if (res.rows.length > 0) {
let userData = res.rows;
for (let i in userData) {
// console.log(finishProductData[i].finishProductCode)
$("#form-deliveryGoodsNotice-add select[name='voucherPreparation']").append("<option value='" + userData[i].userName + "'>" + userData[i].userName + "</option>");
}
}
}
})
//初始化添加材料表
$('#addSalesFinishTable').bootstrapTable({
pagination: true,
pageNumber: 1,
pageSize: 10,
showToggle: false, // 是否显示详细视图和列表视图的切换按钮
cardView: false, // 是否显示详细视图
detailView: false, // 是否显示父子表
smartDisplay: false, // 加了这个才显示每页显示的行数
showExport: false, // 是否显示导出按钮
clickToSelect: true,//点击行选中
paginationDetailHAlign: ' hiddenDetailInfo',
height: 250,
uniqueId: 'finishProductCode',
queryParams: function (params) {
//console.log("123");
var curParams = {
// 传递参数查询参数
pageSize: params.limit,
pageNum: params.offset / params.limit + 1,
// 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="removeSalesFinish(\'' + row.finishProductCode + '\')" ><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
},
{
field: 'deliveryGoodsDetailId',
title: '发货通知单详情id',
visible: false
},
{
field: 'noticeOrderNumber',
title: '通知单号',
visible: false
},
{
field: 'salesOrderNumber',
title: '订单号码'
},
{
field: 'enterpriseCode',
title: '客户代码'
},
{
field: 'enterpriseName',
title: '客户名称'
},
{
field: 'finishProductCode',
title: '成品代码'
},
{
field: 'finishProductName',
title: '成品名称'
},
{
field: 'specificationModel',
title: '规格型号'
},
{
field: 'customerNumber',
title: '客户料号'
},
{
field: 'typeMachine',
title: '机种'
},
{
field: 'inventoryUnit',
title: '单位'
},
{
field: 'commonCurrency',
title: '币别',
formatter: function (value, row, index) {
return $.table.selectDictLabel(commonCurrencyDatas, value);
}
},
{
field: 'processPrice',
title: '单价'
},
{
field: 'productQuantity',
title: '数量'
},
{
field: 'amountMoney',
title: '金额'
},
{
field: 'line',
title: 'Line#'
},
{
field: 'versionNumber',
title: '版本号'
},
{
field: 'salesExplain',
title: '说明'
}]
})
//选择订单
function showOrderDetailModal() {
if ($.validate.form()) {
$("#salesFinishModal").modal("show");
// var enterpriseCode = $("#form-deliveryGoodsNotice-add select[name='enterpriseCode']").val()
// var enterpriseName = $("#form-deliveryGoodsNotice-add input[name='enterpriseName']").val()
var options = {
id: 'salesFinishTable',
url: ctx + "system/salesFinish/list",
modalName: "销售产品",
showToggle: false, // 是否显示详细视图和列表视图的切换按钮
cardView: false, // 是否显示详细视图
detailView: false, // 是否显示父子表
smartDisplay: false, // 加了这个才显示每页显示的行数
showExport: false, // 是否显示导出按钮
clickToSelect: true,//点击行选中
queryParams: function (params) {
var curParams = {
// 传递参数查询参数
pageSize: params.limit,
pageNum: params.offset / params.limit + 1
};
let json = $.extend(curParams, $.common.formToJSON("salesFinishFormId"));
return json;
},
columns: [{
checkbox: true
},
{
field: 'salesFinishId',
title: '订单id',
visible: false
},
{
field: 'salesOrderCode',
title: '订单编号'
},
{
field: 'salesOrderNumber',
title: '订单号码'
},
{
field: 'enterpriseCode',
title: '客户代码'
},
{
field: 'enterpriseName',
title: '客户名称'
},
{
field: 'finishProductCode',
title: '成品代码'
},
{
field: 'finishProductName',
title: '成品名称'
},
{
field: 'customerNumber',
title: '客户料号'
},
{
field: 'specificationModel',
title: '规格型号'
},
{
field: 'typeMachine',
title: '机种'
},
{
field: 'inventoryUnit',
title: '单位'
},
{
field: 'stockUnitWeight',
title: '重量'
},
{
field: 'commonCurrency',
title: '币别',
formatter: function (value, row, index) {
return $.table.selectDictLabel(commonCurrencyDatas, value);
}
},
{
field: 'processPrice',
title: '单价'
},
{
field: 'productQuantity',
title: '数量'
},
{
field: 'amountMoney',
title: '金额'
},
{
field: 'deliveryTime',
title: '交期'
},
{
field: 'line',
title: 'Line#'
},
{
field: 'versionNumber',
title: '版本号'
},
{
field: 'salesExplain',
title: '说明'
}]
};
$.table.init(options);
} else {
$.modal.alertWarning("请先填写必填项!")
}
}
//关闭订单框
function closeSalesFinishModal() {
$("#salesFinishModal").modal("hide");
}
//表中添加选中的订单信息
function addSalesFinishToTable() {
var data = $("#salesFinishTable").bootstrapTable("getSelections");
var count = $('#addSalesFinishTable').bootstrapTable('getData').length;
var noticeOrderNumber = $("input[name='noticeOrderNumber']").val();
// console.log(materialType)
for (i = 0; i < data.length; i++) {
let finishProduct = $('#addSalesFinishTable').bootstrapTable('getRowByUniqueId', data[i].finishProductCode);
if (finishProduct != null) {
alert(finishProduct.finishProductName + "已存在,不可重复添加!");
continue;
}
$("#addSalesFinishTable").bootstrapTable('insertRow', {
index: count + i,
row: {
noticeOrderNumber: noticeOrderNumber,
salesOrderNumber: data[i].salesOrderNumber,
enterpriseCode: data[i].enterpriseCode,
enterpriseName: data[i].enterpriseName,
finishProductCode: data[i].finishProductCode,
finishProductName: data[i].finishProductName,
specificationModel: data[i].specificationModel,
customerNumber: data[i].customerNumber,
typeMachine: data[i].typeMachine,
inventoryUnit: data[i].inventoryUnit,
commonCurrency: data[i].commonCurrency,
processPrice: data[i].processPrice,
productQuantity: data[i].productQuantity,
amountMoney: data[i].amountMoney,
line: data[i].line,
versionNumber: data[i].versionNumber,
salesExplain: data[i].salesExplain
}
});
}
$("#salesFinishTable").bootstrapTable("uncheckAll");
closeSalesFinishModal();
}
//确认材料信息
function confirmSalesFinish() {
var data = $("#addSalesFinishTable").bootstrapTable("getData");
// 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)
},
})
}
//删除表内材料信息
function removeSalesFinish(finishProductCode) {
var ids = [];
ids.push(finishProductCode);
$('#addSalesFinishTable').bootstrapTable("remove",{
field:'finishProductCode',
values:ids
})
$("#addSalesFinishTable").bootstrapTable('refresh');
}
</script>
</body>
</html>