Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/sparepart/inStockRecordEdit.jsp
2026-01-16 14:13:44 +08:00

1072 lines
53 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page import="com.sipai.entity.sparepart.SparePartCommString"%>
<%@ page language="java" pageEncoding="UTF-8"%>
<%request.setAttribute("AUDIT", SparePartCommString.STATUS_STOCK_AUDIT); %>
<%request.setAttribute("START", SparePartCommString.STATUS_STOCK_START); %>
<%request.setAttribute("FINSH", SparePartCommString.STATUS_STOCK_FINISH); %>
<%request.setAttribute("INSTOCK_OTHER", SparePartCommString.INSTOCK_OTHER); %>
<%request.setAttribute("INSTOCK_PURCHASE", SparePartCommString.INSTOCK_PURCHASE); %>
<style type="text/css">
.select2-container .select2-selection--single{
height:34px;
line-height: 34px;
}
.select2-selection__arrow{
margin-top:3px;
}
</style>
<script type="text/javascript">
//流程审核文件上传所需参数
var masterId_process = '${inStockRecord.id}';//业务Id
var tbName_process = 'TB_Process_UploadFile'; //数据表
var nameSpace_process ='ProcessUploadFile';//保存文件夹
var status = 'delete';//有删除权限
function doupdate() {
$.post(ext.contextPath + "/sparepart/stockCheck/getCheck.do", {warehouseId: $("#warehouseId").val()}, function(res) {
if (res.data == 0) {
$('#subForm').data('bootstrapValidator')
.updateStatus('instockManName', 'NOT_VALIDATED', null)
.validateField('instockManName');
$("#subForm").bootstrapValidator('validate');//提交验证
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
$.post(ext.contextPath + "/sparepart/inStockRecord/update.do", $("#subForm").serialize(), function (data) {
if (data.res == 1) {
closeModal('subModal');
$("#table").bootstrapTable('refresh');
} else if (data.res == 0) {
showAlert('d', '保存失败');
} else {
showAlert('d', data.res);
}
}, 'json');
}
} else {
showAlert('d',res.res);
}
}, 'json');
}
function dosubmit(){
if($('#fareAdjustment').val() == 0){
//新增的输入框添加验证
$("#subForm").data('bootstrapValidator').addField('invoiceNumber',{
validators: {
notEmpty: {
message: '不是后期补票时,需填写发票号提交!'
},
}
});
}
$.post(ext.contextPath + "/sparepart/stockCheck/getCheck.do", {warehouseId: $("#warehouseId").val()}, function(res) {
if (res.data == 0) {
$("#status").val('${AUDIT}');
$('#subForm').data('bootstrapValidator')
.updateStatus('auditManName', 'NOT_VALIDATED',null)
.validateField('auditManName');
$("#subForm").bootstrapValidator('validate');//提交验证
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
$.post(ext.contextPath +"/sparepart/inStockRecord/startProcess.do", $("#subForm").serialize(), function(data) {
if (data.res == 1) {
$("#table").bootstrapTable('refresh');
closeModal('subModal');
}else if(data.res == 0){
showAlert('d','保存失败');
}else if(data.res == 2){
showAlert('d','未检测到入库审核流程,请先部署入库审核流程!');
}else{
showAlert('d',data.res);
}
},'json');
}
} else {
showAlert('d',res.res);
}
}, 'json');
}
//提交时先验证审核人不能为空,保存时审核人可以为空
function submitFun(){
if ($("#fareAdjustment").val() == 1) {
swal({
text: "后期补票机会只有一次,是否继续?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function(willDelete) {
// document.getElementById('btn_submit').disabled = 'true';
//没有入库明细不能发起审核
var TableData = $("#table_Detail").bootstrapTable('getData');
if(TableData.length == 0){
showAlert('d','请先添加入库的明细信息!','alertDiv');
}else {
//新增的输入框添加验证
$("#subForm").data('bootstrapValidator').addField('auditManName', {
validators: {
notEmpty: {
message: '审核人不能为空'
},
}
});
var number = 0;
for (var i = 0; i < TableData.length; i++) {
if (TableData[i].instockNumber == 0) {
number = 1;
}
if (number == 1) {
showAlert('d','当前入库数量存在0请检查数据','alertDiv');
break;
} else if (i + 1 == TableData.length) {
dosubmit();
break;
}
}
}
});
} else {
// document.getElementById('btn_submit').disabled = 'true';
//没有入库明细不能发起审核
var TableData = $("#table_Detail").bootstrapTable('getData');
if(TableData.length == 0){
showAlert('d','请先添加入库的明细信息!','alertDiv');
}else{
//新增的输入框添加验证
$("#subForm").data('bootstrapValidator').addField('auditManName',{
validators: {
notEmpty: {
message: '审核人不能为空'
},
}
});
var number = 0;
for (var i = 0; i < TableData.length; i++) {
if (TableData[i].instockNumber == 0) {
number = 1;
}
if (number == 1) {
showAlert('d','当前入库数量存在0请检查数据','alertDiv');
break;
} else if (i + 1 == TableData.length) {
dosubmit();
break;
}
}
}
}
}
//关闭模态框时刷新表格数据
function closeModel(){
closeModal('subModal');
$("#table").bootstrapTable('refresh');
}
//新增采购入库明细
var addInStockDetailFun = function() {
var allTableData = $("#table_Detail").bootstrapTable('getData');
var PRDetailIds="";//PRDetail是purchaseRecordDetail的简写
$.each(allTableData,function(index,item){
if(PRDetailIds!=""){
PRDetailIds+=",";
}
if (item.type == "${INSTOCK_PURCHASE}") {
PRDetailIds += item.purchaseRecordDetailId;
}
})
$.post(ext.contextPath + '/sparepart/inStockRecord/selectPRDetailForInStockDetails.do', {PRDetailIds:PRDetailIds,companyId:'${inStockRecord.bizId}'},
function(data) {
$("#PRDetail4SelectsDiv").html(data);
openModal('subPDetailModal');
});
};
var doFinishSelects = function(data) {
$.post(ext.contextPath + '/sparepart/inStockRecord/saveInStockRecordDetails.do', {instockRecordId:'${inStockRecord.id}',
PRDetailIds:data} , function(data) {
if(data.res){
$("#table_Detail").bootstrapTable('refresh');
}
},'json');
};
//新增其他入库明细
var addOtherDetailFun = function() {
var allTableData = $("#table_Detail").bootstrapTable('getData');
var goodsIds="";
$.each(allTableData,function(index,item){
if(goodsIds!=""){
goodsIds+=",";
}
if (item.type == '${INSTOCK_OTHER}') {
goodsIds += item.goods.id;
}
})
$.post(ext.contextPath + '/sparepart/subscribe/selectGoodsForSubscribeDetail.do', {goodsIds:goodsIds},
function(data) {
$("#Goods4SelectsDiv").html(data);
openModal('subDetailModal');
});
};
var doFinishSelectSubscribeDetail = function(data) {
$.post(ext.contextPath + '/sparepart/inStockRecord/saveOtherDetails.do', {instockRecordId:'${inStockRecord.id}',goodsIds:data} , function(data) {
if(data.res){
$("#table_Detail").bootstrapTable('refresh');
}
},'json');
};
var deletesOtherDetailFun = function() {
var checkedItems = $("#table_Detail").bootstrapTable('getSelections');
var datas="";
$.each(checkedItems, function(index, item){
datas+=item.id+",";
});
if(datas==""){
showAlert('d','请先选择记录','alertDiv');
}else{
swal({
text: "您确定要删除此记录?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function(willDelete) {
if (willDelete) {
$.post(ext.contextPath + '/sparepart/inStockRecord/deletesInStockRecordDetail.do', {ids:datas} , function(data) {
if(data>0){
$("#table_Detail").bootstrapTable('refresh');
}else{
showAlert('d','删除失败','alertDiv');
}
});
}
});
}
};
//输入框验证
$("#subForm").bootstrapValidator({
live: 'disabled',//验证时机enabled是内容有变化就验证默认disabled和submitted是提交再验证
fields: {
instockDate: {
validators: {
notEmpty: {
message: '入库日期不能为空'
}
}
},
warehouseId: {
validators: {
notEmpty: {
message: '所属仓库不能为空'
}
}
},
instockManName: {
validators: {
notEmpty: {
message: '入库负责人不能为空'
}
}
},
}
});
$(function(){
//初始化文件显示
getFileList_process();
viewFun();
//选择仓库
$.post(ext.contextPath + "/sparepart/warehouse/getWarehouseForSelectByCompanyId.do", {companyId:"${inStockRecord.bizId}"}, function(data) {
var selelct =$("#warehouseId").select2({
data: data,
placeholder:'请选择',//默认文字提示
allowClear: false,//允许清空
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
language: "zh-CN",
minimumInputLength: 0,
minimumResultsForSearch: 10,//数据超过十个启用搜索框
formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
});
selelct.val('${inStockRecord.warehouseId}').trigger("change");
},'json');
//采购时间
$("#instockDate").datepicker({
language: 'zh-CN',
autoclose: true,
todayHighlight: true,
format:'yyyy-mm-dd',
});
$.post(ext.contextPath + "/sparepart/contractTaxRate/getContractTaxRate4Selecttext.do", {}, function (data) {
var selelct = $("#taxrate").select2({
data: data,
placeholder: '请选择',//默认文字提示
allowClear: false,//允许清空
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
language: "zh-CN",
minimumInputLength: 0,
minimumResultsForSearch: 10,//数据超过十个启用搜索框
formatResult: function formatRepo(repo) { return repo.text; }, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo) { return repo.text; } // 函数用于呈现当前的选择
});
selelct.val(${inStockRecord.taxrate}).trigger("change");
selelct.on("change",function(e){
swal({
text: "您已更改税率明细是否自动计算明细?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function(willDelete) {
if (willDelete) {
var totalNum = $('#table_Detail').bootstrapTable('getOptions').data
for (let i = 0 ; i < totalNum.length; i++) {
var row = totalNum[i];
$.post(ext.contextPath + "/sparepart/inStockRecord/updateInStockDetail.do", {id:row.id,price:row.price,number:row.instockNumber,totalMoney:row.totalMoney,
includeTaxratePrice:row.includeTaxratePrice,includeTaxrateTotalMoney:row.includeTaxrateTotalMoney, sum: $('#taxrate').val(),
v: $('#vatInvoice').val(),
}, function(data) {
if (data.res == 1){
$("#table_Detail").bootstrapTable('refresh');
// 更新入库记录
$.post(ext.contextPath + "/sparepart/inStockRecord/update.do", $("#subForm").serialize(), function (data) {
if (data.res == 1) {
$("#table").bootstrapTable('refresh');
} else if (data.res == 0) {
showAlert('d', '保存失败');
} else {
showAlert('d', data.res);
}
}, 'json');
// 如果审核完成的则可以进行入库价格整体
if ('${inStockRecord.status}' == '2'){
$.post(ext.contextPath + '/sparepart/inStockRecord/deferredResult.do', {id: row.id}, function (data) {
console.log("=====================")
console.log(data)
console.log("=====================")
});
}
}else if(data.res == 0){
showAlert('d','编辑失败');
}else{
showAlert('d',data.res);
}
},'json');
}
}
});
});
}, 'json');
var vatInvoiceData = [{
"id": "0",
"text": "否"
},
{
"id": "1",
"text": "是"
}]
var selelct = $("#vatInvoice").select2({
data: vatInvoiceData,
placeholder: '请选择',//默认文字提示
allowClear: false,//允许清空
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
language: "zh-CN",
minimumInputLength: 0,
minimumResultsForSearch: 10,//数据超过十个启用搜索框
formatResult: function formatRepo(repo) { return repo.text; }, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo) { return repo.text; } // 函数用于呈现当前的选择
});
selelct.val(${inStockRecord.vatInvoice}).trigger("change");
selelct.on("change",function(e){
var totalNum = $('#table_Detail').bootstrapTable('getOptions').data
for (let i = 0 ; i < totalNum.length; i++) {
var row = totalNum[i];
if ($("#vatInvoice").val() == 0) {
$.post(ext.contextPath + "/sparepart/inStockRecord/updateInStockDetail_ITP_total.do", {
id: row.id,
price: row.includeTaxratePrice,
number: row.instockNumber,
totalMoney: row.totalMoney,
includeTaxratePrice: row.includeTaxratePrice,
includeTaxrateTotalMoney: row.includeTaxrateTotalMoney
}, function (data) {
if (data.res == 1) {
$("#table_Detail").bootstrapTable('refresh');
} else if (data.res == 0) {
showAlert('d', '编辑失败');
} else {
showAlert('d', data.res);
}
}, 'json');
} else {
$.post(ext.contextPath + "/sparepart/inStockRecord/updateInStockDetail.do", {
id: row.id,
price: row.price,
number: row.instockNumber,
totalMoney: row.totalMoney,
includeTaxratePrice: row.includeTaxratePrice,
includeTaxrateTotalMoney: row.includeTaxrateTotalMoney,
sum: $('#taxrate').val(),
v: $('#vatInvoice').val(),
}, function (data) {
if (data.res == 1) {
$("#table_Detail").bootstrapTable('refresh');
// 进行更新
$.post(ext.contextPath + "/sparepart/inStockRecord/update.do", $("#subForm").serialize(), function (data) {
if (data.res == 1) {
$("#table").bootstrapTable('refresh');
} else if (data.res == 0) {
showAlert('d', '保存失败');
} else {
showAlert('d', data.res);
}
}, 'json');
// 如果为审核完成的则可进行数据整理
if ('${inStockRecord.status}' == '2'){
$.post(ext.contextPath + '/sparepart/inStockRecord/deferredResult.do', {id: row.id}, function (data) {
});
}
} else if (data.res == 0) {
showAlert('d', '编辑失败');
} else {
showAlert('d', data.res);
}
}, 'json');
}
}
});
});
//选择入库负责人
var showUser4SelectsFun = function() {
var userIds= $("#instockManId").val();
$.post(ext.contextPath + '/user/userForSelectByStructure.do', {formId:"subForm",hiddenId:"instockManId",textId:"instockManName",userIds:userIds} , function(data) {
$("#user4SelectDiv").html(data);
openModal("user4SelectModal");
});
};
//选择入库审核人
var showUser4AuditSelectsFun = function() {
var userIds= $("#auditManId").val();
$.post(ext.contextPath + '/user/userForSelectByStructure.do', {formId:"subForm",hiddenId:"auditManId",textId:"auditManName",userIds:userIds} , function(data) {
$("#user4SelectDiv").html(data);
openModal("user4SelectModal");
});
};
function viewFun() {
<%--if (1 == ${inStockRecord.fareAdjustment}) {--%>
<%-- document.getElementById('iDiv').style.display = 'block';--%>
<%--}--%>
if (1 == ${inStockRecord.vatInvoice}) {
document.getElementById('tDiv').style.display = 'block';
}
// $("#fareAdjustment").change(function () {
// let fareAdjustment = $("#fareAdjustment").val();
//
// if (fareAdjustment == 1) {
// document.getElementById('iDiv').style.display = 'block';
// $("#invoiceNumber").val("")
// } else {
// document.getElementById('iDiv').style.display = 'none';
// document.getElementById('vDiv').style.display = 'none';
// }
// });
$("#vatInvoice").change(function () {
console.log($('#taxrate').val())
let vatInvoice = $("#vatInvoice").val();
if (vatInvoice == 1) {
document.getElementById('tDiv').style.display = 'block';
} else {
document.getElementById('tDiv').style.display = 'none';
}
});
// 初始化表单 根据status状态表示是否关闭该属性编辑
if ("${inStockRecord.status}" != 0 && "${inStockRecord.fareAdjustment}" == 1 && "${inStockRecord.invoiceNumber}" == "") {
const form = document.querySelector('form');
const formElements = form.querySelectorAll('input, select, textarea');
for(let i=0; i < formElements.length; i++){
console.log(formElements[i].id)
if (formElements[i].id != "invoiceNumber" && formElements[i].id != "vatInvoice" && formElements[i].id != "taxrate") {
formElements[i].setAttribute('readonly', true);
if (formElements[i].id == 'warehouseId') {
formElements[i].setAttribute('disabled', true);
}
// formElements[i].setAttribute('disabled', true);
}
}
document.getElementById('all_btn').style.display = 'none';
$('#table_Detail').bootstrapTable({ // 对应table标签的id
url: ext.contextPath + '/sparepart/inStockRecord/getInStockDetailList.do', // 获取表格数据的url
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
striped: true, //表格显示条纹默认为false
pagination: true, // 在表格底部显示分页组件默认false
pageList: [10, 20,50], // 设置页面可以显示的数据条数
pageSize: 10, // 页面数据条数
pageNumber: 1, // 首页页码
showFooter:true,//添加页脚
sidePagination: 'server', // 设置为服务器端分页
showFooter:true,//添加页脚
queryParams: function (params) { // 请求服务器数据时发送的参数可以在这里添加额外的查询参数返回false则终止请求
return {
rows: params.limit, // 每页要显示的数据条数
page: params.offset/params.limit+1, // 每页显示数据的开始页码
sort: params.sort, // 要排序的字段
order: params.order,
pid:'${inStockRecord.id}',
<%--type:'${INSTOCK_OTHER}'--%>
<%--type:'${INSTOCK_PURCHASE}'--%>
}
},
sortName: 'id', // 要排序的字段
sortOrder: 'desc', // 排序规则
columns: [
{
checkbox: true, // 显示一个勾选框
},{
field: 'type', // 返回json数据中的name
title: '入库类型', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
formatter:function(value, row, index){
console.log(value)
if (value == ${INSTOCK_PURCHASE}) {
return '采购入库';
}
if (value == ${INSTOCK_OTHER}) {
return '其他入库';
}
},
},{
field: 'goods.name', // 返回json数据中的name
title: '物品名称', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
},{
field: 'goods.model', // 返回json数据中的name
title: '规格型号', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
},{
field: 'goods.brand', // 返回json数据中的name
title: '品牌', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' // 上下居中
},{
field: 'goods.unit', // 返回json数据中的name
title: '单位', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' // 上下居中
},{
field: 'instockNumber', // 返回json数据中的name
title: '入库数量', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
},{
field: 'includeTaxratePrice', // 返回json数据中的name
title: '含税单价/元', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中,
footerFormatter:"含税总计"
},{
field: 'includeTaxrateTotalMoney', // 返回json数据中的name
title: '含税合计/元', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中,
footerFormatter:function(value){
if(value==""){
return"";
}else{
var count = 0;
for(var i in value){
count += value[i].includeTaxrateTotalMoney;
}
return count.toFixed(2);
}
},
formatter:function(value, row, index){
return value.toFixed(2);
},
},{
field: 'price', // 返回json数据中的name
title: '不含税单价/元', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
editable: { //编辑列元素
type: 'text',
title: '单价',
validate: function (v) {
if (!v) return '单价不能为空';
}
},
footerFormatter:"不含税总计",
},{
field: 'totalMoney', // 返回json数据中的name
title: '不含税合计/元', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
editable: { //编辑列元素
type: 'text',
title: '不含税合计',
validate: function (v) {
if (!v) return '不含税合计不能为空';
}
},
footerFormatter:function(value){
if(value==""){
return"";
}else{
var count = 0;
for(var i in value){
count += value[i].totalMoney;
}
return count.toFixed(2);
}
},
formatter:function(value, row, index){
return value.toFixed(2);
},
},
],
//保存列修改后的数据
onEditableSave: function (field, row, oldValue, $el) {
var url = ext.contextPath + "/sparepart/inStockRecord/updateInStockDetail.do";
// 含税合计 或 合计
if(field=='includeTaxrateTotalMoney' || field=='totalMoney' ){
url = ext.contextPath + "/sparepart/inStockRecord/updateInStockDetail_total.do";
}
if(field=='price'){
url = ext.contextPath + "/sparepart/inStockRecord/updateInStockDetail_ITP_total.do";
}
$.post(url, {id:row.id,price:row.price,number:row.instockNumber,totalMoney:row.totalMoney,
includeTaxratePrice:row.includeTaxratePrice,includeTaxrateTotalMoney:row.includeTaxrateTotalMoney
}, function(data) {
if (data.res == 1){
$("#table_Detail").bootstrapTable('refresh');
}else if(data.res == 0){
showAlert('d','编辑失败');
}else{
showAlert('d',data.res);
}
},'json');
if (url.indexOf("/updateInStockDetail.do")>-1) {
$.post(ext.contextPath + "/sparepart/inStockRecord/update.do", $("#subForm").serialize(), function (data) {
if (data.res == 1) {
$("#table").bootstrapTable('refresh');
} else if (data.res == 0) {
showAlert('d', '保存失败');
} else {
showAlert('d', data.res);
}
}, 'json');
if ('${inStockRecord.status}' == '2'){
$.post(ext.contextPath + '/sparepart/inStockRecord/deferredResult.do', {id: row.id}, function (data) {
});
}
}
},
onLoadSuccess: function(){ //加载成功时执行
adjustBootstrapTableView("table_Detail");
},
onLoadError: function(){ //加载失败时执行
console.info("加载数据失败");
}
});
} else {
$('#table_Detail').bootstrapTable({ // 对应table标签的id
url: ext.contextPath + '/sparepart/inStockRecord/getInStockDetailList.do', // 获取表格数据的url
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
striped: true, //表格显示条纹默认为false
pagination: true, // 在表格底部显示分页组件默认false
pageList: [10, 20,50], // 设置页面可以显示的数据条数
pageSize: 10, // 页面数据条数
pageNumber: 1, // 首页页码
showFooter:true,//添加页脚
sidePagination: 'server', // 设置为服务器端分页
showFooter:true,//添加页脚
queryParams: function (params) { // 请求服务器数据时发送的参数可以在这里添加额外的查询参数返回false则终止请求
return {
rows: params.limit, // 每页要显示的数据条数
page: params.offset/params.limit+1, // 每页显示数据的开始页码
sort: params.sort, // 要排序的字段
order: params.order,
pid:'${inStockRecord.id}',
<%--type:'${INSTOCK_OTHER}'--%>
<%--type:'${INSTOCK_PURCHASE}'--%>
}
},
sortName: 'id', // 要排序的字段
sortOrder: 'desc', // 排序规则
columns: [
{
checkbox: true, // 显示一个勾选框
},{
field: 'type', // 返回json数据中的name
title: '入库类型', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
formatter:function(value, row, index){
console.log(value)
if (value == ${INSTOCK_PURCHASE}) {
return '采购入库';
}
if (value == ${INSTOCK_OTHER}) {
return '其他入库';
}
},
},{
field: 'goods.name', // 返回json数据中的name
title: '物品名称', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
},{
field: 'goods.model', // 返回json数据中的name
title: '规格型号', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
},{
field: 'goods.brand', // 返回json数据中的name
title: '品牌', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' // 上下居中
},{
field: 'goods.unit', // 返回json数据中的name
title: '单位', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' // 上下居中
},{
field: 'instockNumber', // 返回json数据中的name
title: '入库数量', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
editable: { //编辑列元素
type: 'text',
title: '数量',
validate: function (v) {
if (!v) return '数量不能为空';
}
}
},{
field: 'includeTaxratePrice', // 返回json数据中的name
title: '含税单价/元', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
editable: { //编辑列元素
type: 'text',
title: '单价',
validate: function (v) {
if (!v) return '单价不能为空';
}
},
footerFormatter:"含税总计"
},{
field: 'includeTaxrateTotalMoney', // 返回json数据中的name
title: '含税合计/元', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
editable: { //编辑列元素
type: 'text',
title: '含税合计',
validate: function (v) {
if (!v) return '含税合计不能为空';
}
} ,
footerFormatter:function(value){
if(value==""){
return"";
}else{
var count = 0;
for(var i in value){
count += value[i].includeTaxrateTotalMoney;
}
return count.toFixed(2);
}
},
formatter:function(value, row, index){
return value.toFixed(2);
},
},{
field: 'price', // 返回json数据中的name
title: '不含税单价/元', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
editable: { //编辑列元素
type: 'text',
title: '单价',
validate: function (v) {
if (!v) return '单价不能为空';
}
},
footerFormatter:"不含税总计",
},{
field: 'totalMoney', // 返回json数据中的name
title: '不含税合计/元', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle', // 上下居中
editable: { //编辑列元素
type: 'text',
title: '不含税合计',
validate: function (v) {
if (!v) return '不含税合计不能为空';
}
},
footerFormatter:function(value){
if(value==""){
return"";
}else{
var count = 0;
for(var i in value){
count += value[i].totalMoney;
}
return count.toFixed(2);
}
},
formatter:function(value, row, index){
return value.toFixed(2);
},
},
],
//保存列修改后的数据
onEditableSave: function (field, row, oldValue, $el) {
var url = ext.contextPath + "/sparepart/inStockRecord/updateInStockDetail.do";
// 含税合计 或 合计
if(field=='includeTaxrateTotalMoney' || field=='totalMoney' ){
url = ext.contextPath + "/sparepart/inStockRecord/updateInStockDetail_total.do";
}
if(field=='price'){
url = ext.contextPath + "/sparepart/inStockRecord/updateInStockDetail_ITP_total.do";
}
$.post(url, {id:row.id,price:row.price,number:row.instockNumber,totalMoney:row.totalMoney,
includeTaxratePrice:row.includeTaxratePrice,includeTaxrateTotalMoney:row.includeTaxrateTotalMoney
}, function(data) {
if (data.res == 1){
$("#table_Detail").bootstrapTable('refresh');
}else if(data.res == 0){
showAlert('d','编辑失败');
}else{
showAlert('d',data.res);
}
},'json');
},
onLoadSuccess: function(){ //加载成功时执行
adjustBootstrapTableView("table_Detail");
},
onLoadError: function(){ //加载失败时执行
console.info("加载数据失败");
}
});
}
if ("${inStockRecord.status}" == 0) {
document.getElementById('btn_submit').style.visibility = 'visible';
document.getElementById('fareAdjustment2').style.display = 'none';
} else {
document.getElementById('btn_submit').style.visibility = 'hidden';
// document.getElementById('fareAdjustment1').style.visibility = 'hidden';
document.getElementById('fareAdjustment2').style.display = 'block';
document.getElementById('fareAdjustment1').style.display = 'none';
}
if ($('#invoiceNumber').val() != '') {
document.getElementById('vDiv').style.display = 'block';
} else {
document.getElementById('vDiv').style.display = 'none';
$("#vatInvoice").val(0).trigger("change");
}
}
var vDivFun = function () {
if ($('#invoiceNumber').val() != '') {
document.getElementById('vDiv').style.display = 'block';
} else {
document.getElementById('vDiv').style.display = 'none';
$("#vatInvoice").val(0).trigger("change");
}
}
</script>
<div class="modal fade" id="subModal">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">编辑入库记录</h4>
</div>
<div class="modal-body">
<!-- 新增界面formid强制为subForm -->
<form class="form-horizontal" id="subForm">
<!-- 界面提醒div强制id为alertDiv -->
<div id="alertDiv"></div>
<input id="status" name="status" type="hidden" value="${inStockRecord.status}"/>
<input id="bizId" name="bizId" type="hidden" value="${inStockRecord.bizId}"/>
<div class="form-group">
<label class="col-sm-2 control-label">所属厂区</label>
<div class="col-sm-4" >
<p class="form-control-static" >${inStockRecord.company.name}</p>
</div>
<label class="col-sm-2 control-label">*所属仓库</label>
<div class="col-sm-4">
<select class="form-control select2" id="warehouseId" name="warehouseId" style="width: 270px;" ></select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">*入库单号</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="id" name ="id" placeholder="名称" value="${inStockRecord.id}" readonly>
</div>
<label class="col-sm-2 control-label">*入库日期</label>
<div class="col-sm-4">
<div class="input-group date">
<div class="input-group-addon">
<i class="fa fa-calendar"></i>
</div>
<input type="text" class="form-control" id="instockDate" name="instockDate" style="width: 230px;" value="${inStockRecord.instockDate.substring(0,10)}" placeholder="请选择"/>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">票据单号</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="billNumber" name ="billNumber" placeholder="票据单号" value="${inStockRecord.billNumber}">
</div>
<label class="col-sm-2 control-label">*入库人</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="instockManName" name="instockManName" placeholder="点击选择" value="${inStockRecord.instockManName}" onclick="showUser4SelectsFun();">
<input id="instockManId" name="instockManId" type="hidden" value="${inStockRecord.instockManId}" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">是否后期补票</label>
<div class="col-sm-4">
<div id="fareAdjustment1">
<select type="text" id="fareAdjustment" class="form-control pull-right" name="fareAdjustment" >
<option value=1 <c:if test="${inStockRecord.fareAdjustment==1}">selected</c:if>>是</option>
<option value=0 <c:if test="${inStockRecord.fareAdjustment==0}">selected</c:if> >否</option>
</select>
</div>
<div id="fareAdjustment2" style="display: none">
<p class="form-control-static" >${inStockRecord.fareAdjustmentText}</p>
</div>
</div>
<label class="col-sm-2 control-label">发票号</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="invoiceNumber" name ="invoiceNumber" placeholder="发票号" value="${inStockRecord.invoiceNumber}" onchange="vDivFun()">
</div>
</div>
<div class="form-group">
<div id="vDiv" style="display: none;">
<label class="col-sm-2 control-label">是否专票</label>
<div class="col-sm-4">
<select type="text" id="vatInvoice" class="form-control pull-right" name="vatInvoice" style="width: 270px;">
<option value=1 <c:if test="${inStockRecord.vatInvoice==1}">selected</c:if> >是</option>
<option value=0 <c:if test="${inStockRecord.vatInvoice==0}">selected</c:if> >否</option>
</select>
</div>
</div>
<div id="tDiv" style="display: none;">
<label class="col-sm-2 control-label">税率(%)</label>
<div class="col-sm-4">
<select class="form-control select2" id="taxrate"
name="taxrate"
style="width: 270px;">
</select>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">审核人</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="auditManName" name="auditManName" placeholder="点击选择" value="${inStockRecord.auditManName}" onclick="showUser4AuditSelectsFun();">
<input id="auditManId" name="auditManId" type="hidden" value="${inStockRecord.auditManId}" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">备注</label>
<div class="col-sm-10">
<textarea class="form-control" rows="2" id ="remark" name ="remark" placeholder="备注...">${inStockRecord.remark}</textarea>
</div>
</div>
<!-- 文件上传,显示 -->
<div class="form-group" style="margin:8px">
<label class="col-sm-2 control-label"></label>
<button type="button" class="btn btn-default btn-file" onclick="fileinput_process()"><i class="fa fa-paperclip"></i>上传文件</button>
</div>
<div id="fileArea">
</div>
</form>
<div class="box box-primary" >
<div class="box-header with-border">
<h3 class="box-title">入库明细</h3>
<div class="box-tools pull-right" id="all_btn">
<a onclick="addInStockDetailFun()" class="btn btn-box-tool" data-toggle="tooltip" title="采购导入"><i class="fa fa-folder"></i></a>
<a onclick="addOtherDetailFun()" class="btn btn-box-tool" data-toggle="tooltip" title="新增"><i class="glyphicon glyphicon-plus"></i></a>
<a onclick="deletesOtherDetailFun()" class="btn btn-box-tool" data-toggle="tooltip" title="删除"><i class="glyphicon glyphicon-minus"></i></a>
</div>
</div>
<!-- /.box-header -->
<div class="box-body ">
<table id="table_Detail"></table>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" onclick="closeModel()">关闭</button>
<button type="button" class="btn btn-primary" onclick="doupdate()" id="btn_save">保存</button>
<button type="submit" class="btn btn-primary" onclick="submitFun()" id="btn_submit">提交</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>