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

688 lines
26 KiB

2 years ago
<!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"/>
</head>
<body class="white-bg">
<div class="container-div">
<div class="row">
<form class="form-horizontal m" id="form-saleorderhead-add">
<div class="form-group">
<label class="col-sm-3 control-label is-required">订单编号:</label>
<div class="col-sm-8">
<input name="SaleorderID" 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="SaleorderNO" 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="pCode" 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="pName" 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="pLinkman" 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="pTel" 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="pFax" 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="sendAddress" 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="GetMoneyMemo" class="form-control" type="text">
</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 id="Plandate" name="Plandate" class="form-control" placeholder="请输入开单日期" 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">
<input name="Saler" 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="bzMemo" class="form-control"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">结案:</label>
<div class="col-sm-8">
<input name="endFlag" 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="NWX" 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="comfirmFlag" class="form-control" type="text">-->
<!--</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 id="writeDatetime" name="writeDatetime" 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 id="editDate" name="editDate" disabled="" 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 id="comfirmDate" name="comfirmDate" disabled="" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<!--<h4 class="form-header h4">订单产品明细信息</h4>-->
<!--<div class="row">-->
<!--<div class="col-sm-12">-->
<!--<button type="button" class="btn btn-white btn-sm" onclick="addColumn()"><i class="fa fa-plus"> 增加</i></button>-->
<!--<button type="button" class="btn btn-white btn-sm" onclick="sub.delColumn()"><i class="fa fa-minus"> 删除</i></button>-->
<!--<div class="col-sm-12 select-table table-striped">-->
<!--<table id="bootstrap-table"></table>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
</form>
<!--销售订单明细添加-->
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="addBom()" shiro:hasPermission="finance:lsalesOrder:add">
<i class="fa fa-plus"></i> 添加成品
</a>
</div>
<div class="col-sm-12 select-table table-striped ">
<table id="bootstrapTable-body" style="overflow : hidden; text-overflow : ellipsis ; white-space:nowrap ;"></table>
</div>
<!--成品选择弹框-->
<div class="modal inmodal" id="bomModal" tabindex="-1"
role="dilog" aria-hidden="true" style="padding-bottom: 100px;">
<div class="modal-dialog" style="width: 800px">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">物料选择</h4>
</div>
<div class="modal-body" style="text-align: center;">
<div class="row">
<div class="col-sm-10">
<form id="bomForm" class="form-group">
<div class="col-sm-4">
<label class="control-label col-md-4">成品代码:</label>
<div class=" col-md-8">
<input type="text" class="form-control" name="wlCode" id="wlCode">
</div>
</div>
<div class="col-sm-4">
<label class="control-label col-md-4">成品名称:</label>
<div class=" col-md-8">
<input type="text" class="form-control col-md-6" name="itemname"
id="itemname">
</div>
</div>
</form>
</div>
<div class="col-md-2">
<button type="button" class="btn btn-success" id="bomCodeSearch">搜索</button>
<button type="button" class="btn btn-success" id="bomEmpty">清空</button>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table id="bomTable"
class="table table-striped table-responsive" style="padding-bottom: 50px;">
</table>
</div>
</div>
</div>
<button class="btn btn-success" id="btn_addWaitTable" onclick="addBom2()">添加</button>
<div class="row">
<div class="col-md-12">
<div class="table-responsive" style="padding-bottom:30px; ">
<table id="bomTable2"
class="table table-striped table-responsive">
</table>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary"
onClick="confirm();">确定
</button>
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
</div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-css"/>
<th:block th:include="include :: datetimepicker-js"/>
<th:block th:include="include :: bootstrap-editable-css"/>
<th:block th:include="include :: bootstrap-table-editable-js"/>
<script th:inline="javascript">
var prefix = ctx + "finance/saleorderhead"
$("#form-saleorderhead-add").validate({
focusCleanup: true
});
var today = new Date();
today.setTime(today.getTime());
var time = today.getFullYear() + "-" + (today.getMonth() + 1) + "-" + today.getDate();
Date.prototype.Format = function (fmt) {
var o = {
"M+": this.getMonth() + 1, //月份
"d+": this.getDate(), //日
"H+": this.getHours(), //小时
"m+": this.getMinutes(), //分
"s+": this.getSeconds(), //秒
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
"S": this.getMilliseconds() //毫秒
};
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
}
//提交
function submit() {
let bootstrapTable = $("#bootstrapTable-body").bootstrapTable("getData", true);
let formData = new FormData($("#form-saleorderhead-add")[0]);
formData.append("saleorderlistList", JSON.stringify(bootstrapTable));
let data = {};
formData.forEach((value, key) => data[key] = value);
console.log();
$.ajax({
url: prefix + "/add",
type: "post",
resultType: "json",
data: {"jsonStr": JSON.stringify(data)},
success: function (resp) {
if (resp.code === 0) {
alert("添加成功!");
// window.location.href = prefix;
var index = parent.layer.getFrameIndex(window.name);
var parent2 = window.parent;
parent2.$.table.refresh();
parent.layer.close(index);//关闭当前页
} else {
$.modal.msgError(resp.msg);
}
},
error: function () {
$.modal.msgError("出错了!");
}
});
}
function submitHandler() {
// if ($.validate.form()) {
// $.operate.save(prefix + "/add", $('#form-saleorderhead-add').serialize());
// }
submit()
}
// 打开成品选择框
function addBom() {
$("#bomModal").modal("show");
}
// 从全部物料表选择的
function addBom2() {
var row = $("#bomTable").bootstrapTable("getSelections");
var count = $('#bomTable2').bootstrapTable('getData').length;
for (var i = 0; i < row.length; i++) {
$("#bomTable2").bootstrapTable('insertRow', {
index: count + i,
row: {
wldm: row[i].wldm,
wlCode: row[i].wlCode,
hsCode: row[i].hsCode,
itemname: row[i].itemname,
itemstandard: row[i].itemstandard,
machineNo: row[i].machineNo,
stockDw: row[i].stockDw,
intakeorchina: row[i].intakeorchina,
weight: row[i].weight,
pWldm: row[i].pWldm,
pCode: row[i].pCode,
pName: row[i].pName,
rmbPrice: row[i].rmbPrice
}
});
}
}
// 选择的物料单 即将添加为订单下的物料单
$('#bootstrapTable-body').bootstrapTable({
striped: true, // 是否显示行间隔色
cache: false, // 是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
// contentType :"application/x-www-form-urlencoded",
// pageNumber : 1, // 初始化加载第一页,默认第一页
// pageSize : 10, // 每页的记录行数(*)
// pageList : [ 5, 10,50], // 可供选择的每页的行数(*)
// clickToSelect : true, // 是否启用点击选中行
showToggle: false, // 是否显示详细视图和列表视图的切换按钮
cardView: false, // 是否显示详细视图
detailView: false, // 是否显示父子表
smartDisplay: false, // 加了这个才显示每页显示的行数
showExport: false, // 是否显示导出按钮
singleSelect: true,
uniqueId:"wlCode",
height: 400,
// onClickRow:function(row, $element, field)
// {
// console.log(JSON.stringify(row))
// console.log(field)
// },
onEditableSave:onEditableSave,
columns: [
{
checkbox: true
},
{
field: 'wlCode',
title: '成品代码'
},
{
field: 'itemname',
title: '成品名称',
formatter: function (value, row, index) {
return $.table.tooltip(value, 10, "open");
}
},
{
field: 'itemstandard',
title: '规格型号',
formatter: function (value, row, index) {
return $.table.tooltip(value, 10, "open");
}
},
{
field: 'machineNo',
title: '机种',
},
{
field: 'stockDw',
title: '单位'
},
{
field: 'qty',
title: '数量',
// visible: false
editable: {
type: 'text',
title: '数量',
validate: function (value) {
if (isNaN(value)) return '使用量必须是数字';
var price = parseFloat(value);
if (price <= 0) return '使用量必须大于0';
}
}
},
{
field: 'crlName',
title: '币别'
},
{
field: 'rmbPrice',
title: '单价'
},
{
field: 'amt',
title: '金额'
},
{
field: 'sendDate',
title: '交期',
editable: {
type: 'date',
title: '交期',
emptytext: time,
validate: function (value) {
var now = new Date();
if (value.getTime() < now.getTime()) {
return "交期至少是今天!";
}
}
}
},
{
field: 'piNo',
title: 'Line#'
},
{
field: '',
title: '版本号'
},
{
field: '',
title: '说明'
},
{
title: '操作',
align: 'center',
formatter: function (value, row, index) {
var actions = [];
actions.push('<a class="btn btn-danger btn-xs ' + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.versionNo + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
});
function onEditableSave(field, row, oldValue, $el){
$('#bootstrapTable-body').bootstrapTable('updateByUniqueId', {
id: row.wlCode,
row: {
amt: row.qty*row.rmbPrice,
}
});
}
// 全部物料
$('#bomTable').bootstrapTable({
url: ctx + "finance/productprice/list",
method: 'post',
striped: true, // 是否显示行间隔色
cache: false, // 是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
pagination: true, // 是否显示分页(*)
contentType: "application/x-www-form-urlencoded",
queryParams: function (params) {
var curParams = {
// 传递参数查询参数
pageSize: params.limit,
pageNum: params.offset / params.limit + 1,
// searchValue: params.search,
// orderByColumn: params.sort,
// isAsc: params.order
};
var wlCode = $("#wlCode").val();
var itemnamee = $("#itemname").val();
// var json = $.extend(curParams, $.common.formToJSON("bomForm"));
var json = $.extend(curParams, {"wlCode": wlCode}, {"Itemname": itemnamee});
return json;
},
sidePagination: "server", // 分页方式:client客户端分页,server服务端分页(*)
pageNumber: 1, // 初始化加载第一页,默认第一页
pageSize: 5, // 每页的记录行数(*)
pageList: [5, 10, 50], // 可供选择的每页的行数(*)
clickToSelect: true, // 是否启用点击选中行
showToggle: false, // 是否显示详细视图和列表视图的切换按钮
cardView: false, // 是否显示详细视图
detailView: false, // 是否显示父子表
smartDisplay: false, // 加了这个才显示每页显示的行数
showExport: false, // 是否显示导出按钮
// singleSelect : true,
height: 350,
columns: [
{
checkbox: true
},
{
field: 'wlCode',
title: '物料代码'
},
{
field: 'itemname',
title: '名称'
},
{
field: 'itemstandard',
title: '规格型号'
},
{
field: 'machineNo',
title: '机种',
},
{
field: 'stockDw',
title: '库存单位'
},
{
field: 'rmbPrice',
title: '单价'
},
{
field: 'pCode',
title: '客户号'
},
{
field: 'pName',
title: '客户名'
}
]
});
//点击搜索,刷新表格
$("#bomCodeSearch").click(function () {
$('#bomTable').bootstrapTable('refresh');
});
//重置
$("#bomEmpty").on("click", function () {
$("#wlCode").val("");
$("#itemname").val("");
$("#bomTable").bootstrapTable("refresh");
});
// //查询参数
// function queryParams(params) {
// var search = $.table.queryParams(params);
// search.wlCode = $("#wlCode").val();
// search.itemname = $("#itemname").val();
// return search;
// }
//要选择的物料
$('#bomTable2').bootstrapTable({
striped: true, // 是否显示行间隔色
cache: false, // 是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
// contentType :"application/x-www-form-urlencoded",
// pageNumber : 1, // 初始化加载第一页,默认第一页
// pageSize : 10, // 每页的记录行数(*)
// pageList : [ 5, 10,50], // 可供选择的每页的行数(*)
// clickToSelect : true, // 是否启用点击选中行
showToggle: false, // 是否显示详细视图和列表视图的切换按钮
cardView: false, // 是否显示详细视图
detailView: false, // 是否显示父子表
smartDisplay: false, // 加了这个才显示每页显示的行数
showExport: false, // 是否显示导出按钮
singleSelect: true,
height: 400,
columns: [
{
checkbox: true
},
{
field: 'wldm',
title: '',
visible: false
},
{
field: 'wlCode',
title: '物料代码'
},
{
field: 'itemname',
title: '名称'
},
{
field: 'itemstandard',
title: '规格型号'
},
{
field: 'machineNo',
title: '机种',
},
{
field: 'stockDw',
title: '库存单位'
},
{
field: 'rmbPrice',
title: '单价'
},
{
field: 'pCode',
title: '客户号'
},
{
field: 'pName',
title: '客户名'
},
{
title: '操作',
align: 'center',
formatter: function (value, row, index) {
var actions = [];
// actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="edit()"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + '" href="javascript:void(0)" onclick="remove(\'' + row.wlCode + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}
]
});
//移除bomtable2的对应行数据
function remove(wlCode) {
$("#bomTable2").bootstrapTable("remove", {
field: 'wlCode',
values: wlCode
});
}
//添加到订单下确认
function confirm() {
var row = $("#bomTable2").bootstrapTable("getData", true);
var count = $('#bootstrapTable-body').bootstrapTable('getData').length;
//append方法
for (var i = 0; i < row.length; i++) {
$("#bootstrapTable-body").bootstrapTable('insertRow', {
index: count + i,
row: {
wldm: row[i].wldm,
wlCode: row[i].wlCode,
hsCode: row[i].hsCode,
itemname: row[i].itemname,
itemstandard: row[i].itemstandard,
machineNo: row[i].machineNo,
stockDw: row[i].stockDw,
intakeorchina: row[i].intakeorchina,
weight: row[i].weight,
crlName: 'RMB',
rmbPrice: row[i].rmbPrice,
qty: 0,
amt: 0,
}
});
}
$("#bomModal").modal("hide");
}
$("input[name='Plandate']").datetimepicker({
format: "yyyy-mm-dd HH:mm",
minView: "month",
autoclose: true,
});
$("input[name='writeDatetime']").datetimepicker({
format: "yyyy-mm-dd HH:mm",
minView: "month",
autoclose: true,
});
$("input[name='editDate']").datetimepicker({
format: "yyyy-mm-dd HH:mm",
minView: "month",
autoclose: true,
});
$("input[name='comfirmDate']").datetimepicker({
format: "yyyy-mm-dd HH:mm",
minView: "month",
autoclose: true,
});
var date = new Date().Format("yyyy-MM-dd HH:mm");
$("#Plandate").val(date)
$("#writeDatetime").val(date)
</script>
</body>
</html>