万材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.
 
 
 
 

713 lines
33 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-edit" th:object="${deliveryGoodsNotice}">
<input name="deliveryGoodsNoticeId" th:field="*{deliveryGoodsNoticeId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label is-required">通知单号:</label>
<div class="col-sm-8">
<input name="noticeOrderNumber" th:field="*{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" th:field="*{deliveryDate}" class="form-control" type="text">-->
<div class="input-group date">
<input name="deliveryDate" class="form-control" th:field="*{deliveryDate}" 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" th:field="*{enterpriseCode}" class="form-control" type="text" required>-->
<select name="enterpriseCode" th:field="*{enterpriseCode}" class="form-control m-b" required disabled>
<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" th:field="*{enterpriseName}" 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="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">
<!-- <input name="customerFactory" th:field="*{customerFactory}" class="form-control" type="text">-->
<select name="customerFactory" 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="deliveryAddress" th:field="*{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}" th:field="*{exportSales}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">仓库名称:</label>
<div class="col-sm-8">
<!-- <input name="stockName" th:field="*{stockName}" class="form-control" type="text">-->
<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="remarks" th:field="*{remarks}" 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="voucherPreparation" th:field="*{voucherPreparation}" class="form-control" type="text">-->
<select name="voucherPreparation" class="form-control m-b" th:field="*{voucherPreparation}">
<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}" th:field="*{deliveryGoodsFlag}"></option>
</select>
</div>
</div>
<!-- <div class="form-group">
<label class="col-sm-3 control-label">备用一:</label>
<div class="col-sm-8">
<input name="standbyOne" th:field="*{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" th:field="*{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>
<a class="btn btn-danger" onclick="removeOrderDetail()"><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 getData = [[${deliveryGoodsNotice}]]
var prefix = ctx + "manufacture/deliveryGoodsNotice"
var prefixDetail = ctx + "manufacture/deliveryGoodsDetail"
var commonCurrencyDatas = [[${@dict.getType('sys_common_currency')}]];
$("#form-deliveryGoodsNotice-edit").validate({
focusCleanup: true
});
function submitHandler() {
var getData = $("#addSalesFinishTable").bootstrapTable("getData");
if(getData.length > 0){
if ($.validate.form()) {
//确认添加选中的物料数据
confirmSalesFinish();
$.operate.save(prefix + "/edit", $('#form-deliveryGoodsNotice-edit').serialize());
}
} else {
$.modal.alertWarning("未选择订单,请选择!")
}
}
$("input[name='deliveryDate']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true,
todayBtn: true
});
//获取仓库信息
$.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-edit select[name='stockName']").append("<option value='" + stockData[i].stockname + "'>" + stockData[i].stockname + "</option>");
$("#form-deliveryGoodsNotice-edit select[name='stockName']").val(getData.stockName).trigger("change")
$("#form-deliveryGoodsNotice-edit select[name='stockName']").change(function () {
var stockName = $(this).val();
for (let i=0;i<stockData.length;i++) {
if (stockData[i].stockname == stockName) {
$("#form-deliveryGoodsNotice-edit 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-edit select[name='enterpriseCode']").append("<option value='" + customerData[i].enterpriseCode + "'>" + customerData[i].enterpriseCode + "</option>");
$("#form-deliveryGoodsNotice-edit select[name='enterpriseCode']").val(getData.enterpriseCode).trigger("change")
$("#form-deliveryGoodsNotice-edit select[name='exportSales']").val(getData.exportSales).trigger("change")
$("#form-deliveryGoodsNotice-edit select[name='customerFactory']").val(getData.customerFactory).trigger("change");
$("#form-deliveryGoodsNotice-edit select[name='enterpriseCode']").change(function () {
var enterpriseCode = $(this).val();
for (let i=0;i<customerData.length;i++) {
if (customerData[i].enterpriseCode == enterpriseCode) {
$("#form-deliveryGoodsNotice-edit input[name='enterpriseName']").val(customerData[i].enterpriseName);
$("#form-deliveryGoodsNotice-edit input[name='customerContact']").val(customerData[i].customerContact);
$("#form-deliveryGoodsNotice-edit input[name='deliveryAddress']").val(customerData[i].deliveryAddress);
$("#form-deliveryGoodsNotice-edit select[name='exportSales']").val(customerData[i].exportSales).trigger("change");
$.ajax({
url: ctx + "system/shippingaddress/list",
type: 'post',
data: {
enterpriseCode: enterpriseCode
},
success: function (res) {
$("select[name='customerFactory']").empty();
var data = res.rows;
$("select[name='customerFactory']").append("<option value=''>请选择客户厂区</option>");
for (let i in data) {
// console.log(data[i].plantArea)
if (data[i].plantArea!=="") {
// console.log(data[i].plantArea!=="")
$("select[name='customerFactory']").append("<option value='" + data[i].plantArea + "'>" + data[i].plantArea + "</option>");
}
}
$("select[name='customerFactory']").val(getData.customerFactory).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-edit select[name='voucherPreparation']").append("<option value='" + userData[i].userName + "'>" + userData[i].userName + "</option>");
}
$("#form-deliveryGoodsNotice-edit select[name='voucherPreparation']").val(getData.voucherPreparation).trigger("change")
} else {
$.modal.msgError(res.msg);
}
}
})
//初始化添加材料表
$('#addSalesFinishTable').bootstrapTable({
url: prefixDetail + '/list',
pagination: true,
pageNumber: 1,
pageSize: 10,
pageList: [10, 25, 50, 100],
showRefresh: false,
method: "post",
contentType: "application/x-www-form-urlencoded",
striped: true, // 是否显示行间隔色
cache: false, // 是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
sidePagination: "server", // 分页方式:client客户端分页,server服务端分页(*)
clickToSelect: true, // 是否启用点击选中行
showToggle: false, // 是否显示详细视图和列表视图的切换按钮
cardView: false, // 是否显示详细视图
detailView: false, // 是否显示父子表
smartDisplay: false, // 加了这个才显示每页显示的行数
showExport: false, // 是否显示导出按钮
// singleSelect: true,
paginationDetailHAlign: ' hiddenDetailInfo',
height: 250,
uniqueId: 'finishProductCode',
queryParams: function (params) {
//console.log("123");
var curParams = {
// 传递参数查询参数
pageSize: params.limit,
pageNum: params.offset / params.limit + 1,
noticeOrderNumber: getData.noticeOrderNumber
};
// console.log(data[0].enterpriseCode)
return curParams
},
columns: [
{
checkbox: true
},
{
field: 'deliveryGoodsDetailId',
title: '发货通知单详情id',
visible: false
},
{
field: 'noticeOrderNumber',
title: '通知单号',
visible: false
},
{
field: 'salesOrderNumber',
title: '订单号码'
},
{
field: 'enterpriseCode',
title: '客户代码',
visible: false
},
{
field: 'enterpriseName',
title: '客户名称',
visible: false
},
{
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: '订单项次',
editable: {
type: 'text',
title: '订单项次',
emptytext: '订单项次',
validate: function (value) {
}
}
},
{
field: 'versionNumber',
title: '版本号',
editable: {
type: 'text',
title: '版本号',
emptytext: '版本号',
validate: function (value) {
}
}
},
{
field: 'salesExplain',
title: '说明',
editable: {
type: 'text',
title: '说明',
emptytext: '说明',
validate: function (value) {
}
}
}]
})
//选择订单
function showOrderDetailModal() {
if ($.validate.form()) {
$("#salesFinishModal").modal("show");
var enterpriseCode = $("#form-deliveryGoodsNotice-edit select[name='enterpriseCode']").val()
// var enterpriseName = $("#form-deliveryGoodsNotice-add input[name='enterpriseName']").val()
$("#salesFinishTable").bootstrapTable("destroy")
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,
enterpriseCode: enterpriseCode
};
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 removeOrderDetail() {
var addSalesFinishTableData = $("#addSalesFinishTable").bootstrapTable("getSelections");
var ids = [];
var finishProductCodes=[];
for (let i = 0;i < addSalesFinishTableData.length;i++) {
ids.push(addSalesFinishTableData[i].deliveryGoodsDetailId)
finishProductCodes.push(addSalesFinishTableData[i].finishProductCode)
}
// console.log(ids)
if (addSalesFinishTableData.length > 0) {
$.modal.confirm("是否确认要删除选中的物料?", function (){
$.ajax({
url: prefixDetail + "/removeSalesFinish",
type: "POST",
data: {
ids: JSON.stringify(ids)
},
success: function (res) {
// console.log(ids)
// console.log(res)
$.modal.msgSuccess("删除成功")
// $("#addProductTable").bootstrapTable('refreshOptions', {pageNumber: 1}); // pageNumber:1, 指定页码为第1页
// $("#addProductTable").bootstrapTable('refresh');
$("#addSalesFinishTable").bootstrapTable ('remove', { field: 'finishProductCode', values: finishProductCodes })
}
})
})
} else {
alert("请选择需要删除的数据")
}
}
</script>
</body>
</html>