修改单据明细的展示逻辑
This commit is contained in:
@@ -83,7 +83,7 @@
|
|||||||
}
|
}
|
||||||
function dgResize() {
|
function dgResize() {
|
||||||
var searchTabHeight = $('.box-body').height();
|
var searchTabHeight = $('.box-body').height();
|
||||||
if($('#tableData').length) {
|
if($('#tableData') && $('#tableData').length && $('#tableData').datagrid()) {
|
||||||
$('#tableData').datagrid('resize', {
|
$('#tableData').datagrid('resize', {
|
||||||
width: $(window).width() - 6,
|
width: $(window).width() - 6,
|
||||||
height: $(window).height() - searchTabHeight -43
|
height: $(window).height() - searchTabHeight -43
|
||||||
|
|||||||
@@ -6,9 +6,9 @@
|
|||||||
var userBusinessList=null;
|
var userBusinessList=null;
|
||||||
var userdepot=null;
|
var userdepot=null;
|
||||||
var url;
|
var url;
|
||||||
|
var editIndex = undefined;
|
||||||
var depotHeadID = 0;
|
var depotHeadID = 0;
|
||||||
var preTotalPrice = 0; //前一次加载的金额
|
var preTotalPrice = 0; //前一次加载的金额
|
||||||
var editIndex = undefined;
|
|
||||||
var listTitle = ""; //单据标题
|
var listTitle = ""; //单据标题
|
||||||
var listType = ""; //入库 出库
|
var listType = ""; //入库 出库
|
||||||
var listSubType = ""; //采购 销售等
|
var listSubType = ""; //采购 销售等
|
||||||
@@ -233,7 +233,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
//查找库存的方法
|
//查找库存的方法
|
||||||
findStockNumById: function (depotId, meId, monthTime, body, input, ratio, type) {
|
findStockNumById: function (depotId, meId, monthTime, currentRowDom, input, ratio, type) {
|
||||||
var thisRatio = 1; //比例
|
var thisRatio = 1; //比例
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/material/findByIdWithBarCode",
|
url: "/material/findByIdWithBarCode",
|
||||||
@@ -290,12 +290,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
thisStock = (thisStock / loadRatio).toFixed(2);
|
thisStock = (thisStock / loadRatio).toFixed(2);
|
||||||
body.find("[field='Stock']").find(input).val(thisStock).attr("data-stock", thisStock); //加载库存数据
|
currentRowDom.find("[field='Stock']").find(input).val(thisStock).attr("data-stock", thisStock); //加载库存数据
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
body.find("[field='Stock']").find(input).val(0).attr("data-stock", 0); //加载库存数据
|
currentRowDom.find("[field='Stock']").find(input).val(0).attr("data-stock", 0); //加载库存数据
|
||||||
}
|
}
|
||||||
body.find("[field='Stock']").find(input).prop("readonly", "readonly"); //设置库存数据为只读
|
currentRowDom.find("[field='Stock']").find(input).prop("readonly", "readonly"); //设置库存数据为只读
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error:function() {
|
error:function() {
|
||||||
@@ -315,19 +315,17 @@
|
|||||||
var taxLastMoneyTotal = 0;
|
var taxLastMoneyTotal = 0;
|
||||||
//金额的合计
|
//金额的合计
|
||||||
body.find("[field='AllPrice']").each(function(){
|
body.find("[field='AllPrice']").each(function(){
|
||||||
if($(this).find("div").text()!==""){
|
if($(this).find("input").val()!==""){
|
||||||
TotalPrice = TotalPrice + parseFloat($(this).find("div").text().toString());
|
TotalPrice = TotalPrice + parseFloat($(this).find("input").val().toString());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
TotalPrice = TotalPrice + UnitPrice*OperNumber;
|
|
||||||
footer.find("[field='AllPrice']").find("div").text((TotalPrice).toFixed(2)); //金额的合计
|
footer.find("[field='AllPrice']").find("div").text((TotalPrice).toFixed(2)); //金额的合计
|
||||||
//价税合计的总计
|
//价税合计的总计
|
||||||
body.find("[field='TaxLastMoney']").each(function(){
|
body.find("[field='TaxLastMoney']").each(function(){
|
||||||
if($(this).find("div").text()!==""){
|
if($(this).find("input").val()!==""){
|
||||||
taxLastMoneyTotal = taxLastMoneyTotal + (parseFloat($(this).find("div").text().toString())-0);
|
taxLastMoneyTotal = taxLastMoneyTotal + (parseFloat($(this).find("input").val().toString())-0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
taxLastMoneyTotal = taxLastMoneyTotal + (UnitPrice*OperNumber*(1+taxRate/100));
|
|
||||||
footer.find("[field='TaxLastMoney']").find("div").text((taxLastMoneyTotal).toFixed(2)); //价税合计的页脚总计
|
footer.find("[field='TaxLastMoney']").find("div").text((taxLastMoneyTotal).toFixed(2)); //价税合计的页脚总计
|
||||||
var discount = $("#Discount").val(); //优惠率
|
var discount = $("#Discount").val(); //优惠率
|
||||||
var discountMoney = (taxLastMoneyTotal*discount/100).toFixed(2);
|
var discountMoney = (taxLastMoneyTotal*discount/100).toFixed(2);
|
||||||
@@ -1052,9 +1050,13 @@
|
|||||||
var inputDom = $("#depotHeadFM .panel.datagrid .datagrid-view2 .datagrid-body");
|
var inputDom = $("#depotHeadFM .panel.datagrid .datagrid-view2 .datagrid-body");
|
||||||
var appendDom = $("#depotHeadDlg #append");
|
var appendDom = $("#depotHeadDlg #append");
|
||||||
autoJumpNextInput(inputDom, appendDom); //敲回车键自动跳转到下一个文本框
|
autoJumpNextInput(inputDom, appendDom); //敲回车键自动跳转到下一个文本框
|
||||||
var body =$("#depotHeadFM .datagrid-body");
|
var body =$("#depotHeadFM .datagrid-view2 .datagrid-body");
|
||||||
var footer =$("#depotHeadFM .datagrid-footer");
|
var rowDom = body.find(".datagrid-row");
|
||||||
var input = ".datagrid-editable-input";
|
var footer =$("#depotHeadFM .datagrid-view2 .datagrid-footer");
|
||||||
|
var input = "input[type=text]";
|
||||||
|
body.find(".datagrid-row").find("input").off("keyup").on("keyup",function(){
|
||||||
|
editIndex = $(this).closest(".datagrid-row").attr("datagrid-row-index");
|
||||||
|
});
|
||||||
body.find("[field='MaterialExtendId']").find(".textbox-text").focus().select(); //默认选择商品框
|
body.find("[field='MaterialExtendId']").find(".textbox-text").focus().select(); //默认选择商品框
|
||||||
//点击商品下拉框,自动加载数量、单价、金额
|
//点击商品下拉框,自动加载数量、单价、金额
|
||||||
body.find("[field='Stock']").find(input).prop("readonly","readonly");
|
body.find("[field='Stock']").find(input).prop("readonly","readonly");
|
||||||
@@ -1083,82 +1085,89 @@
|
|||||||
});
|
});
|
||||||
//修改数量,自动计算金额和合计,另外计算含税单价、税额、价税合计
|
//修改数量,自动计算金额和合计,另外计算含税单价、税额、价税合计
|
||||||
body.find("[field='OperNumber']").find(input).off("keyup").on("keyup",function(){
|
body.find("[field='OperNumber']").find(input).off("keyup").on("keyup",function(){
|
||||||
var UnitPrice = body.find("[field='UnitPrice']").find(input).val(); //单价
|
editIndex = $(this).closest(".datagrid-row").attr("datagrid-row-index");
|
||||||
var taxRate = body.find("[field='TaxRate']").find(input).val(); //税率
|
var UnitPrice = rowDom.eq(editIndex).find("[field='UnitPrice']").find(input).val(); //单价
|
||||||
|
var taxRate = rowDom.eq(editIndex).find("[field='TaxRate']").find(input).val(); //税率
|
||||||
var OperNumber =$(this).val()-0; //数量
|
var OperNumber =$(this).val()-0; //数量
|
||||||
body.find("[field='AllPrice']").find(input).val((UnitPrice*OperNumber).toFixed(2)); //金额
|
rowDom.eq(editIndex).find("[field='AllPrice']").find(input).val((UnitPrice*OperNumber).toFixed(2)); //金额
|
||||||
body.find("[field='TaxUnitPrice']").find(input).val((UnitPrice*(1+taxRate/100)).toFixed(2)); //含税单价
|
rowDom.eq(editIndex).find("[field='TaxUnitPrice']").find(input).val((UnitPrice*(1+taxRate/100)).toFixed(2)); //含税单价
|
||||||
body.find("[field='TaxMoney']").find(input).val((UnitPrice*OperNumber*(taxRate/100)).toFixed(2)); //税额
|
rowDom.eq(editIndex).find("[field='TaxMoney']").find(input).val((UnitPrice*OperNumber*(taxRate/100)).toFixed(2)); //税额
|
||||||
body.find("[field='TaxLastMoney']").find(input).val((UnitPrice*OperNumber*(1+taxRate/100)).toFixed(2)); //价税合计
|
rowDom.eq(editIndex).find("[field='TaxLastMoney']").find(input).val((UnitPrice*OperNumber*(1+taxRate/100)).toFixed(2)); //价税合计
|
||||||
self.statisticsFun(body,UnitPrice,OperNumber,footer,taxRate);
|
self.statisticsFun(body,UnitPrice,OperNumber,footer,taxRate);
|
||||||
});
|
});
|
||||||
//修改单价,自动计算金额和合计
|
//修改单价,自动计算金额和合计
|
||||||
body.find("[field='UnitPrice']").find(input).off("keyup").on("keyup",function(){
|
body.find("[field='UnitPrice']").find(input).off("keyup").on("keyup",function(){
|
||||||
|
editIndex = $(this).closest(".datagrid-row").attr("datagrid-row-index");
|
||||||
var UnitPrice =$(this).val()-0; //单价
|
var UnitPrice =$(this).val()-0; //单价
|
||||||
var taxRate = body.find("[field='TaxRate']").find(input).val(); //税率
|
var taxRate = rowDom.eq(editIndex).find("[field='TaxRate']").find(input).val(); //税率
|
||||||
var OperNumber = body.find("[field='OperNumber']").find(input).val(); //数量
|
var OperNumber = rowDom.eq(editIndex).find("[field='OperNumber']").find(input).val(); //数量
|
||||||
body.find("[field='AllPrice']").find(input).val((UnitPrice*OperNumber).toFixed(2)); //金额
|
rowDom.eq(editIndex).find("[field='AllPrice']").find(input).val((UnitPrice*OperNumber).toFixed(2)); //金额
|
||||||
body.find("[field='TaxUnitPrice']").find(input).val((UnitPrice*(1+taxRate/100)).toFixed(2)); //含税单价
|
rowDom.eq(editIndex).find("[field='TaxUnitPrice']").find(input).val((UnitPrice*(1+taxRate/100)).toFixed(2)); //含税单价
|
||||||
body.find("[field='TaxMoney']").find(input).val((UnitPrice*OperNumber*(taxRate/100)).toFixed(2)); //税额
|
rowDom.eq(editIndex).find("[field='TaxMoney']").find(input).val((UnitPrice*OperNumber*(taxRate/100)).toFixed(2)); //税额
|
||||||
body.find("[field='TaxLastMoney']").find(input).val((UnitPrice*OperNumber*(1+taxRate/100)).toFixed(2)); //价税合计
|
rowDom.eq(editIndex).find("[field='TaxLastMoney']").find(input).val((UnitPrice*OperNumber*(1+taxRate/100)).toFixed(2)); //价税合计
|
||||||
self.statisticsFun(body,UnitPrice,OperNumber,footer,taxRate);
|
self.statisticsFun(body,UnitPrice,OperNumber,footer,taxRate);
|
||||||
});
|
});
|
||||||
//修改含税单价,自动计算单价、金额、税额、价税合计和合计
|
//修改含税单价,自动计算单价、金额、税额、价税合计和合计
|
||||||
body.find("[field='TaxUnitPrice']").find(input).off("keyup").on("keyup",function(){
|
body.find("[field='TaxUnitPrice']").find(input).off("keyup").on("keyup",function(){
|
||||||
|
editIndex = $(this).closest(".datagrid-row").attr("datagrid-row-index");
|
||||||
var TaxUnitPrice =$(this).val()-0; //含税单价
|
var TaxUnitPrice =$(this).val()-0; //含税单价
|
||||||
var taxRate = body.find("[field='TaxRate']").find(input).val(); //税率
|
var taxRate = rowDom.eq(editIndex).find("[field='TaxRate']").find(input).val(); //税率
|
||||||
var UnitPrice = TaxUnitPrice/(1+taxRate/100); //计算单价
|
var UnitPrice = TaxUnitPrice/(1+taxRate/100); //计算单价
|
||||||
body.find("[field='UnitPrice']").find(input).val((UnitPrice).toFixed(2)); //单价
|
rowDom.eq(editIndex).find("[field='UnitPrice']").find(input).val((UnitPrice).toFixed(2)); //单价
|
||||||
var OperNumber = body.find("[field='OperNumber']").find(input).val(); //数量
|
var OperNumber = currentRowDom.find("[field='OperNumber']").find(input).val(); //数量
|
||||||
body.find("[field='AllPrice']").find(input).val((UnitPrice*OperNumber).toFixed(2)); //金额
|
rowDom.eq(editIndex).find("[field='AllPrice']").find(input).val((UnitPrice*OperNumber).toFixed(2)); //金额
|
||||||
body.find("[field='TaxMoney']").find(input).val((UnitPrice*OperNumber*(taxRate/100)).toFixed(2)); //税额
|
rowDom.eq(editIndex).find("[field='TaxMoney']").find(input).val((UnitPrice*OperNumber*(taxRate/100)).toFixed(2)); //税额
|
||||||
body.find("[field='TaxLastMoney']").find(input).val((UnitPrice*OperNumber*(1+taxRate/100)).toFixed(2)); //价税合计
|
rowDom.eq(editIndex).find("[field='TaxLastMoney']").find(input).val((UnitPrice*OperNumber*(1+taxRate/100)).toFixed(2)); //价税合计
|
||||||
self.statisticsFun(body,UnitPrice,OperNumber,footer,taxRate);
|
self.statisticsFun(body,UnitPrice,OperNumber,footer,taxRate);
|
||||||
});
|
});
|
||||||
//修改金额,自动计算单价、税额、价税合计和合计
|
//修改金额,自动计算单价、税额、价税合计和合计
|
||||||
body.find("[field='AllPrice']").find(input).off("keyup").on("keyup",function(){
|
body.find("[field='AllPrice']").find(input).off("keyup").on("keyup",function(){
|
||||||
var OperNumber = body.find("[field='OperNumber']").find(input).val(); //数量
|
editIndex = $(this).closest(".datagrid-row").attr("datagrid-row-index");
|
||||||
var taxRate = body.find("[field='TaxRate']").find(input).val(); //税率
|
var OperNumber = rowDom.eq(editIndex).find("[field='OperNumber']").find(input).val(); //数量
|
||||||
|
var taxRate = rowDom.eq(editIndex).find("[field='TaxRate']").find(input).val(); //税率
|
||||||
var AllPrice =$(this).val()-0; //金额
|
var AllPrice =$(this).val()-0; //金额
|
||||||
var UnitPrice = (AllPrice/OperNumber).toFixed(2);
|
var UnitPrice = (AllPrice/OperNumber).toFixed(2);
|
||||||
body.find("[field='UnitPrice']").find(input).val(UnitPrice); //单价
|
rowDom.eq(editIndex).find("[field='UnitPrice']").find(input).val(UnitPrice); //单价
|
||||||
body.find("[field='TaxUnitPrice']").find(input).val((UnitPrice*(1+taxRate/100)).toFixed(2)); //含税单价
|
rowDom.eq(editIndex).find("[field='TaxUnitPrice']").find(input).val((UnitPrice*(1+taxRate/100)).toFixed(2)); //含税单价
|
||||||
body.find("[field='TaxMoney']").find(input).val((UnitPrice*OperNumber*(taxRate/100)).toFixed(2)); //税额
|
rowDom.eq(editIndex).find("[field='TaxMoney']").find(input).val((UnitPrice*OperNumber*(taxRate/100)).toFixed(2)); //税额
|
||||||
body.find("[field='TaxLastMoney']").find(input).val((UnitPrice*OperNumber*(1+taxRate/100)).toFixed(2)); //价税合计
|
rowDom.eq(editIndex).find("[field='TaxLastMoney']").find(input).val((UnitPrice*OperNumber*(1+taxRate/100)).toFixed(2)); //价税合计
|
||||||
self.statisticsFun(body,UnitPrice,OperNumber,footer,taxRate);
|
self.statisticsFun(body,UnitPrice,OperNumber,footer,taxRate);
|
||||||
});
|
});
|
||||||
//修改税率,自动计算含税单价、税额、价税合计和合计
|
//修改税率,自动计算含税单价、税额、价税合计和合计
|
||||||
body.find("[field='TaxRate']").find(input).off("keyup").on("keyup",function(){
|
body.find("[field='TaxRate']").find(input).off("keyup").on("keyup",function(){
|
||||||
|
editIndex = $(this).closest(".datagrid-row").attr("datagrid-row-index");
|
||||||
var taxRate =$(this).val()-0; //税率
|
var taxRate =$(this).val()-0; //税率
|
||||||
var OperNumber = body.find("[field='OperNumber']").find(input).val(); //数量
|
var OperNumber = rowDom.eq(editIndex).find("[field='OperNumber']").find(input).val(); //数量
|
||||||
var UnitPrice = body.find("[field='UnitPrice']").find(input).val(); //单价
|
var UnitPrice = rowDom.eq(editIndex).find("[field='UnitPrice']").find(input).val(); //单价
|
||||||
body.find("[field='TaxUnitPrice']").find(input).val((UnitPrice*(1+taxRate/100)).toFixed(2)); //含税单价
|
rowDom.eq(editIndex).find("[field='TaxUnitPrice']").find(input).val((UnitPrice*(1+taxRate/100)).toFixed(2)); //含税单价
|
||||||
body.find("[field='TaxMoney']").find(input).val((UnitPrice*OperNumber*(taxRate/100)).toFixed(2)); //税额
|
rowDom.eq(editIndex).find("[field='TaxMoney']").find(input).val((UnitPrice*OperNumber*(taxRate/100)).toFixed(2)); //税额
|
||||||
body.find("[field='TaxLastMoney']").find(input).val((UnitPrice*OperNumber*(1+taxRate/100)).toFixed(2)); //价税合计
|
rowDom.eq(editIndex).find("[field='TaxLastMoney']").find(input).val((UnitPrice*OperNumber*(1+taxRate/100)).toFixed(2)); //价税合计
|
||||||
self.statisticsFun(body,UnitPrice,OperNumber,footer,taxRate);
|
self.statisticsFun(body,UnitPrice,OperNumber,footer,taxRate);
|
||||||
});
|
});
|
||||||
//修改税额,自动计算税率、含税单价、价税合计和合计
|
//修改税额,自动计算税率、含税单价、价税合计和合计
|
||||||
body.find("[field='TaxMoney']").find(input).off("keyup").on("keyup",function(){
|
body.find("[field='TaxMoney']").find(input).off("keyup").on("keyup",function(){
|
||||||
|
editIndex = $(this).closest(".datagrid-row").attr("datagrid-row-index");
|
||||||
var taxMoney =$(this).val()-0; //税额
|
var taxMoney =$(this).val()-0; //税额
|
||||||
var AllPrice = body.find("[field='AllPrice']").find(input).val(); //金额
|
var AllPrice = rowDom.eq(editIndex).find("[field='AllPrice']").find(input).val(); //金额
|
||||||
var taxRate = taxMoney/AllPrice*100; //税率
|
var taxRate = taxMoney/AllPrice*100; //税率
|
||||||
var OperNumber = body.find("[field='OperNumber']").find(input).val(); //数量
|
var OperNumber = rowDom.eq(editIndex).find("[field='OperNumber']").find(input).val(); //数量
|
||||||
var UnitPrice = body.find("[field='UnitPrice']").find(input).val(); //单价
|
var UnitPrice = rowDom.eq(editIndex).find("[field='UnitPrice']").find(input).val(); //单价
|
||||||
body.find("[field='TaxUnitPrice']").find(input).val((UnitPrice*(1+taxRate/100)).toFixed(2)); //含税单价
|
rowDom.eq(editIndex).find("[field='TaxUnitPrice']").find(input).val((UnitPrice*(1+taxRate/100)).toFixed(2)); //含税单价
|
||||||
body.find("[field='TaxRate']").find(input).val((taxRate).toFixed(2)); //税率
|
rowDom.eq(editIndex).find("[field='TaxRate']").find(input).val((taxRate).toFixed(2)); //税率
|
||||||
body.find("[field='TaxLastMoney']").find(input).val((UnitPrice*OperNumber*(1+taxRate/100)).toFixed(2)); //价税合计
|
rowDom.eq(editIndex).find("[field='TaxLastMoney']").find(input).val((UnitPrice*OperNumber*(1+taxRate/100)).toFixed(2)); //价税合计
|
||||||
self.statisticsFun(body,UnitPrice,OperNumber,footer,taxRate);
|
self.statisticsFun(body,UnitPrice,OperNumber,footer,taxRate);
|
||||||
});
|
});
|
||||||
//修改价税合计,自动计算税率、含税单价、税额和合计
|
//修改价税合计,自动计算税率、含税单价、税额和合计
|
||||||
body.find("[field='TaxLastMoney']").find(input).off("keyup").on("keyup",function(){
|
body.find("[field='TaxLastMoney']").find(input).off("keyup").on("keyup",function(){
|
||||||
|
editIndex = $(this).closest(".datagrid-row").attr("datagrid-row-index");
|
||||||
var taxLastMoney =$(this).val()-0; //价税合计
|
var taxLastMoney =$(this).val()-0; //价税合计
|
||||||
var AllPrice = body.find("[field='AllPrice']").find(input).val(); //金额
|
var AllPrice = rowDom.eq(editIndex).find("[field='AllPrice']").find(input).val(); //金额
|
||||||
var taxRate = (taxLastMoney-AllPrice)/AllPrice*100; //税率
|
var taxRate = (taxLastMoney-AllPrice)/AllPrice*100; //税率
|
||||||
var OperNumber = body.find("[field='OperNumber']").find(input).val(); //数量
|
var OperNumber = rowDom.eq(editIndex).find("[field='OperNumber']").find(input).val(); //数量
|
||||||
var UnitPrice = body.find("[field='UnitPrice']").find(input).val(); //单价
|
var UnitPrice = rowDom.eq(editIndex).find("[field='UnitPrice']").find(input).val(); //单价
|
||||||
body.find("[field='TaxUnitPrice']").find(input).val((UnitPrice*(1+taxRate/100)).toFixed(2)); //含税单价
|
rowDom.eq(editIndex).find("[field='TaxUnitPrice']").find(input).val((UnitPrice*(1+taxRate/100)).toFixed(2)); //含税单价
|
||||||
body.find("[field='TaxRate']").find(input).val((taxRate).toFixed(2)); //税率
|
rowDom.eq(editIndex).find("[field='TaxRate']").find(input).val((taxRate).toFixed(2)); //税率
|
||||||
body.find("[field='TaxMoney']").find(input).val((UnitPrice*OperNumber*(taxRate/100)).toFixed(2)); //税额
|
rowDom.eq(editIndex).find("[field='TaxMoney']").find(input).val((UnitPrice*OperNumber*(taxRate/100)).toFixed(2)); //税额
|
||||||
self.statisticsFun(body,UnitPrice,OperNumber,footer,taxRate);
|
self.statisticsFun(body,UnitPrice,OperNumber,footer,taxRate);
|
||||||
});
|
});
|
||||||
//默认税率为0
|
//默认税率为0
|
||||||
@@ -1167,7 +1176,7 @@
|
|||||||
taxRateDom.val(0);
|
taxRateDom.val(0);
|
||||||
}
|
}
|
||||||
//在商品类型加载 组装件、普通子件
|
//在商品类型加载 组装件、普通子件
|
||||||
var mType = body.find("[field='MType']");
|
var mType = rowDom.eq(editIndex).find("[field='MType']");
|
||||||
var rowListLength = mType.find(input).closest(".datagrid-row").attr("datagrid-row-index");
|
var rowListLength = mType.find(input).closest(".datagrid-row").attr("datagrid-row-index");
|
||||||
var mTypeValue = "组合件";
|
var mTypeValue = "组合件";
|
||||||
if(rowListLength > 0){
|
if(rowListLength > 0){
|
||||||
@@ -1180,39 +1189,30 @@
|
|||||||
},
|
},
|
||||||
//新增明细
|
//新增明细
|
||||||
append: function () {
|
append: function () {
|
||||||
if (endEditing()) {
|
$('#materialData').datagrid('appendRow', {DepotId:defDepotId});
|
||||||
$('#materialData').datagrid('appendRow', {DepotId:defDepotId});
|
editIndex = $('#materialData').datagrid('getRows').length - 1;
|
||||||
editIndex = $('#materialData').datagrid('getRows').length - 1;
|
$('#materialData').datagrid('selectRow', editIndex).datagrid('beginEdit', editIndex);
|
||||||
$('#materialData').datagrid('selectRow', editIndex).datagrid('beginEdit', editIndex);
|
this.autoReckon();
|
||||||
this.autoReckon();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
//批量删除明细
|
//批量删除明细
|
||||||
batchDel: function () {
|
batchDel: function () {
|
||||||
/**
|
|
||||||
* 1、删除之前必须先调用endEditing结束编辑
|
|
||||||
* 2、如果只是调用endEditing结束编辑那么正在编辑行的被选中状态会被去掉
|
|
||||||
* 所以要在调用endEditing先获取选中的行
|
|
||||||
*/
|
|
||||||
var self = this;
|
var self = this;
|
||||||
var row = $('#materialData').datagrid('getChecked');
|
var row = $('#materialData').datagrid('getChecked');
|
||||||
if (endEditing()) {
|
if (row.length == 0) {
|
||||||
if (row.length == 0) {
|
$.messager.alert('删除提示', '没有记录被选中!', 'info');
|
||||||
$.messager.alert('删除提示', '没有记录被选中!', 'info');
|
return;
|
||||||
return;
|
}
|
||||||
}
|
if (row.length > 0) {
|
||||||
if (row.length > 0) {
|
$.messager.confirm('删除确认', '确定要删除选中的' + row.length + '条单据信息吗?', function (r) {
|
||||||
$.messager.confirm('删除确认', '确定要删除选中的' + row.length + '条单据信息吗?', function (r) {
|
if (r) {
|
||||||
if (r) {
|
var body =$("#depotHeadFM .datagrid-body");
|
||||||
var body =$("#depotHeadFM .datagrid-body");
|
var footer =$("#depotHeadFM .datagrid-footer");
|
||||||
var footer =$("#depotHeadFM .datagrid-footer");
|
for (var i = 0; i < row.length; i++) {
|
||||||
for (var i = 0; i < row.length; i++) {
|
$('#materialData').datagrid('deleteRow', $('#materialData').datagrid("getRowIndex", row[i]));
|
||||||
$('#materialData').datagrid('deleteRow', $('#materialData').datagrid("getRowIndex", row[i]));
|
self.statisticsFun(body,0,0,footer,0);
|
||||||
self.statisticsFun(body,0,0,footer,0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//单行删除明细
|
//单行删除明细
|
||||||
@@ -1240,8 +1240,6 @@
|
|||||||
},
|
},
|
||||||
//判断明细
|
//判断明细
|
||||||
CheckData: function (type) {
|
CheckData: function (type) {
|
||||||
this.append();
|
|
||||||
this.removeit();
|
|
||||||
var change = $('#materialData').datagrid('getChanges').length;
|
var change = $('#materialData').datagrid('getChanges').length;
|
||||||
if(type =="add" && !change) {
|
if(type =="add" && !change) {
|
||||||
$.messager.alert('提示','请输入明细信息!','warning');
|
$.messager.alert('提示','请输入明细信息!','warning');
|
||||||
@@ -1288,11 +1286,12 @@
|
|||||||
var wholesaleDecimal = info.wholesaleDecimal-0; //销售价
|
var wholesaleDecimal = info.wholesaleDecimal-0; //销售价
|
||||||
var lowDecimal = info.lowDecimal-0; //最低售价
|
var lowDecimal = info.lowDecimal-0; //最低售价
|
||||||
var commodityUnit = info.commodityUnit; //商品单位
|
var commodityUnit = info.commodityUnit; //商品单位
|
||||||
body =$("#depotHeadFM .datagrid-body");
|
body =$("#depotHeadFM .datagrid-view2 .datagrid-body");
|
||||||
footer =$("#depotHeadFM .datagrid-footer");
|
footer =$("#depotHeadFM .datagrid-view2 .datagrid-footer");
|
||||||
input = ".datagrid-editable-input";
|
input = "input[type=text]";
|
||||||
body.find("[field='Unit']").find(input).prop("readonly","readonly"); //设置计量单位为只读
|
var currentRowDom = body.find(".datagrid-row").eq(editIndex);
|
||||||
body.find("[field='Unit']").find(input).val(commodityUnit); //设置单位
|
currentRowDom.find("[field='Unit']").find(input).prop("readonly","readonly"); //设置计量单位为只读
|
||||||
|
currentRowDom.find("[field='Unit']").find(input).val(commodityUnit); //设置单位
|
||||||
if(info.unit){ //如果存在计量单位信息
|
if(info.unit){ //如果存在计量单位信息
|
||||||
ratio = 1; //重置比例为1
|
ratio = 1; //重置比例为1
|
||||||
loadRatio = ratio;
|
loadRatio = ratio;
|
||||||
@@ -1328,20 +1327,20 @@
|
|||||||
detailPrice = 0;
|
detailPrice = 0;
|
||||||
}
|
}
|
||||||
var operNumber = 1;
|
var operNumber = 1;
|
||||||
body.find("[field='OperNumber']").find(input).val(operNumber); //数量初始化
|
currentRowDom.find("[field='OperNumber']").find(input).val(operNumber).focus().select(); //数量初始化
|
||||||
body.find("[field='UnitPrice']").find(input).val(detailPrice);
|
currentRowDom.find("[field='UnitPrice']").find(input).val(detailPrice);
|
||||||
body.find("[field='AllPrice']").find(input).val(detailPrice);
|
currentRowDom.find("[field='AllPrice']").find(input).val(detailPrice);
|
||||||
var taxRate = body.find("[field='TaxRate']").find(input).val()-0; //获取税率
|
var taxRate = currentRowDom.find("[field='TaxRate']").find(input).val()-0; //获取税率
|
||||||
body.find("[field='TaxUnitPrice']").find(input).val((detailPrice*(1+taxRate/100)).toFixed(2)); //含税单价
|
currentRowDom.find("[field='TaxUnitPrice']").find(input).val((detailPrice*(1+taxRate/100)).toFixed(2)); //含税单价
|
||||||
body.find("[field='TaxMoney']").find(input).val((detailPrice*(taxRate/100)).toFixed(2)); //税额
|
currentRowDom.find("[field='TaxMoney']").find(input).val((detailPrice*(taxRate/100)).toFixed(2)); //税额
|
||||||
body.find("[field='TaxLastMoney']").find(input).val((detailPrice*(1+taxRate/100)).toFixed(2)); //价税合计
|
currentRowDom.find("[field='TaxLastMoney']").find(input).val((detailPrice*(1+taxRate/100)).toFixed(2)); //价税合计
|
||||||
self.statisticsFun(body,detailPrice,1,footer,taxRate);
|
self.statisticsFun(body,detailPrice,1,footer,taxRate);
|
||||||
|
|
||||||
//查询库存信息
|
//查询库存信息
|
||||||
var depotId = body.find("[field='DepotId']").find(".textbox-value").val();
|
var depotId = currentRowDom.find("[field='DepotId']").find(".textbox-value").val();
|
||||||
if(depotId) {
|
if(depotId) {
|
||||||
var type = "select"; //type 类型:点击 click,选择 select
|
var type = "select"; //type 类型:点击 click,选择 select
|
||||||
self.findStockNumById(depotId, meId, monthTime, body, input, loadRatio, type);
|
self.findStockNumById(depotId, meId, monthTime, currentRowDom, input, loadRatio, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -1351,12 +1350,20 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
//结束全部的编辑
|
||||||
|
endAllEdit: function(){
|
||||||
|
var rowLen = $("#materialData").datagrid('getRows').length;
|
||||||
|
for(var i=0; i<rowLen; i++){
|
||||||
|
$('#materialData').datagrid('endEdit', i);
|
||||||
|
}
|
||||||
|
},
|
||||||
//新增单据主表及单据子表
|
//新增单据主表及单据子表
|
||||||
addDepotHeadAndDetail: function (url,infoStr) {
|
addDepotHeadAndDetail: function (url,infoStr) {
|
||||||
var self = this;
|
var self = this;
|
||||||
if(pageType=="skip") {
|
if(pageType=="skip") {
|
||||||
sessionStorage.removeItem("rowInfo");
|
sessionStorage.removeItem("rowInfo");
|
||||||
}
|
}
|
||||||
|
this.endAllEdit();
|
||||||
var inserted = $("#materialData").datagrid('getRows');
|
var inserted = $("#materialData").datagrid('getRows');
|
||||||
var deleted = [];
|
var deleted = [];
|
||||||
var updated = [];
|
var updated = [];
|
||||||
@@ -1399,9 +1406,10 @@
|
|||||||
//修改单据主表及单据子表
|
//修改单据主表及单据子表
|
||||||
updateDepotHeadAndDetail: function (url,infoStr,preTotalPrice) {
|
updateDepotHeadAndDetail: function (url,infoStr,preTotalPrice) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var inserted = $("#materialData").datagrid('getChanges', "inserted");
|
this.endAllEdit();
|
||||||
var deleted = $("#materialData").datagrid('getChanges', "deleted");
|
var inserted = $("#materialData").datagrid('getRows');
|
||||||
var updated = $("#materialData").datagrid('getChanges', "updated");
|
var deleted = [];
|
||||||
|
var updated = [];
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"post",
|
type:"post",
|
||||||
url: url,
|
url: url,
|
||||||
@@ -1426,9 +1434,7 @@
|
|||||||
$('#depotHeadDlg').dialog('close');
|
$('#depotHeadDlg').dialog('close');
|
||||||
var opts = $("#tableData").datagrid('options');
|
var opts = $("#tableData").datagrid('options');
|
||||||
self.showDepotHeadDetails(opts.pageNumber,opts.pageSize);
|
self.showDepotHeadDetails(opts.pageNumber,opts.pageSize);
|
||||||
if (endEditing()) {
|
$('#materialData').datagrid('acceptChanges');
|
||||||
$('#materialData').datagrid('acceptChanges');
|
|
||||||
}
|
|
||||||
}else {
|
}else {
|
||||||
$.messager.show({
|
$.messager.show({
|
||||||
title: '错误提示',
|
title: '错误提示',
|
||||||
@@ -1443,44 +1449,4 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//结束编辑明细
|
|
||||||
function endEditing() {
|
|
||||||
if (editIndex == undefined) { return true }
|
|
||||||
if ($('#materialData').datagrid('validateRow', editIndex)) {
|
|
||||||
//仓库信息
|
|
||||||
var edDepot = $('#materialData').datagrid('getEditor', {index:editIndex,field:'DepotId'});
|
|
||||||
if(edDepot) {
|
|
||||||
var DepotName = $(edDepot.target).combobox('getText');
|
|
||||||
$('#materialData').datagrid('getRows')[editIndex]['DepotName'] = DepotName;
|
|
||||||
}
|
|
||||||
//商品信息
|
|
||||||
var edMaterial = $('#materialData').datagrid('getEditor', {index:editIndex,field:'MaterialExtendId'});
|
|
||||||
if(edMaterial) {
|
|
||||||
var MaterialName = $(edMaterial.target).next().find('input.textbox-text').val();
|
|
||||||
$('#materialData').datagrid('getRows')[editIndex]['MaterialName'] = MaterialName;
|
|
||||||
}
|
|
||||||
//其它信息
|
|
||||||
$('#materialData').datagrid('endEdit', editIndex);
|
|
||||||
editIndex = undefined;
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//单击明细
|
|
||||||
function onClickRow(index) {
|
|
||||||
if (editIndex != index) {
|
|
||||||
if (endEditing()) {
|
|
||||||
$('#materialData').datagrid('selectRow', index).datagrid('beginEdit', index);
|
|
||||||
editIndex = index;
|
|
||||||
inOutService.autoReckon();
|
|
||||||
setTimeout(function() {
|
|
||||||
var edMaterial = $('#materialData').datagrid('getEditor', {index:editIndex,field:'MaterialExtendId'});
|
|
||||||
$(edMaterial.target).next().find('input.textbox-text').mouseup();
|
|
||||||
},550);
|
|
||||||
} else {
|
|
||||||
$('#materialData').datagrid('selectRow', editIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -454,8 +454,6 @@
|
|||||||
//交替出现背景
|
//交替出现背景
|
||||||
striped : true,
|
striped : true,
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
onClickRow: onClickRow,
|
|
||||||
columns:[[
|
columns:[[
|
||||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||||
{ title: '仓库名称', field: 'DepotId', editor: 'validatebox', width: 90,
|
{ title: '仓库名称', field: 'DepotId', editor: 'validatebox', width: 90,
|
||||||
@@ -468,16 +466,18 @@
|
|||||||
valueField: 'id',
|
valueField: 'id',
|
||||||
textField: 'depotName',
|
textField: 'depotName',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
hasDownArrow: false,
|
||||||
url: '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid,
|
url: '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid,
|
||||||
onSelect:function(rec){
|
onSelect:function(rec){
|
||||||
var depotId = rec.id;
|
var depotId = rec.id;
|
||||||
body =$("#depotHeadFM .datagrid-body");
|
body =$("#depotHeadFM .datagrid-view2 .datagrid-body");
|
||||||
footer =$("#depotHeadFM .datagrid-footer");
|
footer =$("#depotHeadFM .datagrid-view2 .datagrid-footer");
|
||||||
input = ".datagrid-editable-input";
|
input = "input[type=text]";
|
||||||
var mId = body.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
var currentRowDom = body.find(".datagrid-row").eq(editIndex);
|
||||||
|
var mId = currentRowDom.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
||||||
if(mId){
|
if(mId){
|
||||||
var type = "select"; //type 类型:点击 click,选择 select
|
var type = "select"; //type 类型:点击 click,选择 select
|
||||||
inOutService.findStockNumById(depotId, mId, monthTime, body, input, ratioDepot, type);
|
inOutService.findStockNumById(depotId, mId, monthTime, currentRowDom, input, ratioDepot, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -518,7 +518,10 @@
|
|||||||
onLoadSuccess: function (rec) {
|
onLoadSuccess: function (rec) {
|
||||||
if(rec && rec.total==1) {
|
if(rec && rec.total==1) {
|
||||||
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
||||||
$("#depotHeadFM .datagrid-body").find("[field='OperNumber']").find(".datagrid-editable-input").focus().select();
|
var body =$("#depotHeadFM .datagrid-view2 .datagrid-body");
|
||||||
|
input = "input[type=text]";
|
||||||
|
var currentRowDom = body.find(".datagrid-row").eq(editIndex);
|
||||||
|
currentRowDom.find("[field='OperNumber']").find(input).focus().select();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onSelect:function(index, rowData){
|
onSelect:function(index, rowData){
|
||||||
@@ -623,6 +626,11 @@
|
|||||||
$("#materialData").datagrid('loadData',data);
|
$("#materialData").datagrid('loadData',data);
|
||||||
if(type === "add") {
|
if(type === "add") {
|
||||||
$("#depotHeadDlg #append").click(); //新增行
|
$("#depotHeadDlg #append").click(); //新增行
|
||||||
|
} else if(type === "edit") {
|
||||||
|
for(var i=0;i<data.rows.length;i++){
|
||||||
|
$('#materialData').datagrid('selectRow', i).datagrid('beginEdit', i);
|
||||||
|
inOutService.autoReckon();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -451,8 +451,6 @@
|
|||||||
//交替出现背景
|
//交替出现背景
|
||||||
striped : true,
|
striped : true,
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
onClickRow: onClickRow,
|
|
||||||
columns:[[
|
columns:[[
|
||||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||||
{ title: '商品类型',field: 'MType',editor:'validatebox',width:80},
|
{ title: '商品类型',field: 'MType',editor:'validatebox',width:80},
|
||||||
@@ -466,16 +464,18 @@
|
|||||||
valueField: 'id',
|
valueField: 'id',
|
||||||
textField: 'depotName',
|
textField: 'depotName',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
hasDownArrow: false,
|
||||||
url: '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid,
|
url: '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid,
|
||||||
onSelect:function(rec){
|
onSelect:function(rec){
|
||||||
var depotId = rec.id;
|
var depotId = rec.id;
|
||||||
body =$("#depotHeadFM .datagrid-body");
|
body =$("#depotHeadFM .datagrid-view2 .datagrid-body");
|
||||||
footer =$("#depotHeadFM .datagrid-footer");
|
footer =$("#depotHeadFM .datagrid-view2 .datagrid-footer");
|
||||||
input = ".datagrid-editable-input";
|
input = "input[type=text]";
|
||||||
var mId = body.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
var currentRowDom = body.find(".datagrid-row").eq(editIndex);
|
||||||
|
var mId = currentRowDom.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
||||||
if(mId){
|
if(mId){
|
||||||
var type = "select"; //type 类型:点击 click,选择 select
|
var type = "select"; //type 类型:点击 click,选择 select
|
||||||
inOutService.findStockNumById(depotId, mId, monthTime, body, input, ratioDepot, type);
|
inOutService.findStockNumById(depotId, mId, monthTime, currentRowDom, input, ratioDepot, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -516,7 +516,10 @@
|
|||||||
onLoadSuccess: function (rec) {
|
onLoadSuccess: function (rec) {
|
||||||
if(rec && rec.total==1) {
|
if(rec && rec.total==1) {
|
||||||
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
||||||
$("#depotHeadFM .datagrid-body").find("[field='OperNumber']").find(".datagrid-editable-input").focus().select();
|
var body =$("#depotHeadFM .datagrid-view2 .datagrid-body");
|
||||||
|
input = "input[type=text]";
|
||||||
|
var currentRowDom = body.find(".datagrid-row").eq(editIndex);
|
||||||
|
currentRowDom.find("[field='OperNumber']").find(input).focus().select();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onSelect:function(index, rowData){
|
onSelect:function(index, rowData){
|
||||||
@@ -607,6 +610,11 @@
|
|||||||
$("#materialData").datagrid('loadData',data);
|
$("#materialData").datagrid('loadData',data);
|
||||||
if(type === "add") {
|
if(type === "add") {
|
||||||
$("#depotHeadDlg #append").click(); //新增行
|
$("#depotHeadDlg #append").click(); //新增行
|
||||||
|
} else if(type === "edit") {
|
||||||
|
for(var i=0;i<data.rows.length;i++){
|
||||||
|
$('#materialData').datagrid('selectRow', i).datagrid('beginEdit', i);
|
||||||
|
inOutService.autoReckon();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -452,8 +452,6 @@
|
|||||||
//交替出现背景
|
//交替出现背景
|
||||||
striped : true,
|
striped : true,
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
onClickRow: onClickRow,
|
|
||||||
columns:[[
|
columns:[[
|
||||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||||
{ title: '商品类型',field: 'MType',editor:'validatebox',width:80},
|
{ title: '商品类型',field: 'MType',editor:'validatebox',width:80},
|
||||||
@@ -467,16 +465,18 @@
|
|||||||
valueField: 'id',
|
valueField: 'id',
|
||||||
textField: 'depotName',
|
textField: 'depotName',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
hasDownArrow: false,
|
||||||
url: '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid,
|
url: '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid,
|
||||||
onSelect:function(rec){
|
onSelect:function(rec){
|
||||||
var depotId = rec.id;
|
var depotId = rec.id;
|
||||||
body =$("#depotHeadFM .datagrid-body");
|
body =$("#depotHeadFM .datagrid-view2 .datagrid-body");
|
||||||
footer =$("#depotHeadFM .datagrid-footer");
|
footer =$("#depotHeadFM .datagrid-view2 .datagrid-footer");
|
||||||
input = ".datagrid-editable-input";
|
input = "input[type=text]";
|
||||||
var mId = body.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
var currentRowDom = body.find(".datagrid-row").eq(editIndex);
|
||||||
|
var mId = currentRowDom.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
||||||
if(mId){
|
if(mId){
|
||||||
var type = "select"; //type 类型:点击 click,选择 select
|
var type = "select"; //type 类型:点击 click,选择 select
|
||||||
inOutService.findStockNumById(depotId, mId, monthTime, body, input, ratioDepot, type);
|
inOutService.findStockNumById(depotId, mId, monthTime, currentRowDom, input, ratioDepot, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -517,7 +517,10 @@
|
|||||||
onLoadSuccess: function (rec) {
|
onLoadSuccess: function (rec) {
|
||||||
if(rec && rec.total==1) {
|
if(rec && rec.total==1) {
|
||||||
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
||||||
$("#depotHeadFM .datagrid-body").find("[field='OperNumber']").find(".datagrid-editable-input").focus().select();
|
var body =$("#depotHeadFM .datagrid-view2 .datagrid-body");
|
||||||
|
input = "input[type=text]";
|
||||||
|
var currentRowDom = body.find(".datagrid-row").eq(editIndex);
|
||||||
|
currentRowDom.find("[field='OperNumber']").find(input).focus().select();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onSelect:function(index, rowData){
|
onSelect:function(index, rowData){
|
||||||
@@ -608,6 +611,11 @@
|
|||||||
$("#materialData").datagrid('loadData',data);
|
$("#materialData").datagrid('loadData',data);
|
||||||
if(type === "add") {
|
if(type === "add") {
|
||||||
$("#depotHeadDlg #append").click(); //新增行
|
$("#depotHeadDlg #append").click(); //新增行
|
||||||
|
} else if(type === "edit") {
|
||||||
|
for(var i=0;i<data.rows.length;i++){
|
||||||
|
$('#materialData').datagrid('selectRow', i).datagrid('beginEdit', i);
|
||||||
|
inOutService.autoReckon();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -464,8 +464,6 @@
|
|||||||
//交替出现背景
|
//交替出现背景
|
||||||
striped : true,
|
striped : true,
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
onClickRow: onClickRow,
|
|
||||||
columns:[[
|
columns:[[
|
||||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||||
{ title: '仓库名称', field: 'DepotId', editor: 'validatebox', width: 90,
|
{ title: '仓库名称', field: 'DepotId', editor: 'validatebox', width: 90,
|
||||||
@@ -478,16 +476,18 @@
|
|||||||
valueField: 'id',
|
valueField: 'id',
|
||||||
textField: 'depotName',
|
textField: 'depotName',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
hasDownArrow: false,
|
||||||
url: '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid,
|
url: '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid,
|
||||||
onSelect:function(rec){
|
onSelect:function(rec){
|
||||||
var depotId = rec.id;
|
var depotId = rec.id;
|
||||||
body =$("#depotHeadFM .datagrid-body");
|
body =$("#depotHeadFM .datagrid-view2 .datagrid-body");
|
||||||
footer =$("#depotHeadFM .datagrid-footer");
|
footer =$("#depotHeadFM .datagrid-view2 .datagrid-footer");
|
||||||
input = ".datagrid-editable-input";
|
input = "input[type=text]";
|
||||||
var mId = body.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
var currentRowDom = body.find(".datagrid-row").eq(editIndex);
|
||||||
|
var mId = currentRowDom.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
||||||
if(mId){
|
if(mId){
|
||||||
var type = "select"; //type 类型:点击 click,选择 select
|
var type = "select"; //type 类型:点击 click,选择 select
|
||||||
inOutService.findStockNumById(depotId, mId, monthTime, body, input, ratioDepot, type);
|
inOutService.findStockNumById(depotId, mId, monthTime, currentRowDom, input, ratioDepot, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -528,7 +528,10 @@
|
|||||||
onLoadSuccess: function (rec) {
|
onLoadSuccess: function (rec) {
|
||||||
if(rec && rec.total==1) {
|
if(rec && rec.total==1) {
|
||||||
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
||||||
$("#depotHeadFM .datagrid-body").find("[field='OperNumber']").find(".datagrid-editable-input").focus().select();
|
var body =$("#depotHeadFM .datagrid-view2 .datagrid-body");
|
||||||
|
input = "input[type=text]";
|
||||||
|
var currentRowDom = body.find(".datagrid-row").eq(editIndex);
|
||||||
|
currentRowDom.find("[field='OperNumber']").find(input).focus().select();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onSelect:function(index, rowData){
|
onSelect:function(index, rowData){
|
||||||
@@ -619,6 +622,11 @@
|
|||||||
$("#materialData").datagrid('loadData',data);
|
$("#materialData").datagrid('loadData',data);
|
||||||
if(type === "add") {
|
if(type === "add") {
|
||||||
$("#depotHeadDlg #append").click(); //新增行
|
$("#depotHeadDlg #append").click(); //新增行
|
||||||
|
} else if(type === "edit") {
|
||||||
|
for(var i=0;i<data.rows.length;i++){
|
||||||
|
$('#materialData').datagrid('selectRow', i).datagrid('beginEdit', i);
|
||||||
|
inOutService.autoReckon();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -457,8 +457,6 @@
|
|||||||
//交替出现背景
|
//交替出现背景
|
||||||
striped : true,
|
striped : true,
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
onClickRow: onClickRow,
|
|
||||||
columns:[[
|
columns:[[
|
||||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||||
{ title: '仓库名称', field: 'DepotId', editor: 'validatebox', width: 90,
|
{ title: '仓库名称', field: 'DepotId', editor: 'validatebox', width: 90,
|
||||||
@@ -471,16 +469,18 @@
|
|||||||
valueField: 'id',
|
valueField: 'id',
|
||||||
textField: 'depotName',
|
textField: 'depotName',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
hasDownArrow: false,
|
||||||
url: '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid,
|
url: '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid,
|
||||||
onSelect:function(rec){
|
onSelect:function(rec){
|
||||||
var depotId = rec.id;
|
var depotId = rec.id;
|
||||||
body =$("#depotHeadFM .datagrid-body");
|
body =$("#depotHeadFM .datagrid-view2 .datagrid-body");
|
||||||
footer =$("#depotHeadFM .datagrid-footer");
|
footer =$("#depotHeadFM .datagrid-view2 .datagrid-footer");
|
||||||
input = ".datagrid-editable-input";
|
input = "input[type=text]";
|
||||||
var mId = body.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
var currentRowDom = body.find(".datagrid-row").eq(editIndex);
|
||||||
|
var mId = currentRowDom.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
||||||
if(mId){
|
if(mId){
|
||||||
var type = "select"; //type 类型:点击 click,选择 select
|
var type = "select"; //type 类型:点击 click,选择 select
|
||||||
inOutService.findStockNumById(depotId, mId, monthTime, body, input, ratioDepot, type);
|
inOutService.findStockNumById(depotId, mId, monthTime, currentRowDom, input, ratioDepot, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -521,7 +521,10 @@
|
|||||||
onLoadSuccess: function (rec) {
|
onLoadSuccess: function (rec) {
|
||||||
if(rec && rec.total==1) {
|
if(rec && rec.total==1) {
|
||||||
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
||||||
$("#depotHeadFM .datagrid-body").find("[field='OperNumber']").find(".datagrid-editable-input").focus().select();
|
var body =$("#depotHeadFM .datagrid-view2 .datagrid-body");
|
||||||
|
input = "input[type=text]";
|
||||||
|
var currentRowDom = body.find(".datagrid-row").eq(editIndex);
|
||||||
|
currentRowDom.find("[field='OperNumber']").find(input).focus().select();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onSelect:function(index, rowData){
|
onSelect:function(index, rowData){
|
||||||
@@ -612,6 +615,11 @@
|
|||||||
$("#materialData").datagrid('loadData',data);
|
$("#materialData").datagrid('loadData',data);
|
||||||
if(type === "add") {
|
if(type === "add") {
|
||||||
$("#depotHeadDlg #append").click(); //新增行
|
$("#depotHeadDlg #append").click(); //新增行
|
||||||
|
} else if(type === "edit") {
|
||||||
|
for(var i=0;i<data.rows.length;i++){
|
||||||
|
$('#materialData').datagrid('selectRow', i).datagrid('beginEdit', i);
|
||||||
|
inOutService.autoReckon();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -595,8 +595,6 @@
|
|||||||
//交替出现背景
|
//交替出现背景
|
||||||
striped : true,
|
striped : true,
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
onClickRow: onClickRow,
|
|
||||||
columns:[[
|
columns:[[
|
||||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||||
{ title: '仓库名称', field: 'DepotId', editor: 'validatebox', width: 90,
|
{ title: '仓库名称', field: 'DepotId', editor: 'validatebox', width: 90,
|
||||||
@@ -609,16 +607,18 @@
|
|||||||
valueField: 'id',
|
valueField: 'id',
|
||||||
textField: 'depotName',
|
textField: 'depotName',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
hasDownArrow: false,
|
||||||
url: '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid,
|
url: '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid,
|
||||||
onSelect:function(rec){
|
onSelect:function(rec){
|
||||||
var depotId = rec.id;
|
var depotId = rec.id;
|
||||||
body =$("#depotHeadFM .datagrid-body");
|
body =$("#depotHeadFM .datagrid-view2 .datagrid-body");
|
||||||
footer =$("#depotHeadFM .datagrid-footer");
|
footer =$("#depotHeadFM .datagrid-view2 .datagrid-footer");
|
||||||
input = ".datagrid-editable-input";
|
input = "input[type=text]";
|
||||||
var mId = body.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
var currentRowDom = body.find(".datagrid-row").eq(editIndex);
|
||||||
|
var mId = currentRowDom.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
||||||
if(mId){
|
if(mId){
|
||||||
var type = "select"; //type 类型:点击 click,选择 select
|
var type = "select"; //type 类型:点击 click,选择 select
|
||||||
inOutService.findStockNumById(depotId, mId, monthTime, body, input, ratioDepot, type);
|
inOutService.findStockNumById(depotId, mId, monthTime, currentRowDom, input, ratioDepot, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -659,7 +659,10 @@
|
|||||||
onLoadSuccess: function (rec) {
|
onLoadSuccess: function (rec) {
|
||||||
if(rec && rec.total==1) {
|
if(rec && rec.total==1) {
|
||||||
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
||||||
$("#depotHeadFM .datagrid-body").find("[field='OperNumber']").find(".datagrid-editable-input").focus().select();
|
var body =$("#depotHeadFM .datagrid-view2 .datagrid-body");
|
||||||
|
input = "input[type=text]";
|
||||||
|
var currentRowDom = body.find(".datagrid-row").eq(editIndex);
|
||||||
|
currentRowDom.find("[field='OperNumber']").find(input).focus().select();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onSelect:function(index, rowData){
|
onSelect:function(index, rowData){
|
||||||
@@ -754,6 +757,11 @@
|
|||||||
$("#materialData").datagrid('loadData',data);
|
$("#materialData").datagrid('loadData',data);
|
||||||
if(type === "add") {
|
if(type === "add") {
|
||||||
$("#depotHeadDlg #append").click(); //新增行
|
$("#depotHeadDlg #append").click(); //新增行
|
||||||
|
} else if(type === "edit") {
|
||||||
|
for(var i=0;i<data.rows.length;i++){
|
||||||
|
$('#materialData').datagrid('selectRow', i).datagrid('beginEdit', i);
|
||||||
|
inOutService.autoReckon();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -613,8 +613,6 @@
|
|||||||
//交替出现背景
|
//交替出现背景
|
||||||
striped : true,
|
striped : true,
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
onClickRow: onClickRow,
|
|
||||||
columns:[[
|
columns:[[
|
||||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||||
{ title: '仓库名称', field: 'DepotId', editor: 'validatebox', width: 90,
|
{ title: '仓库名称', field: 'DepotId', editor: 'validatebox', width: 90,
|
||||||
@@ -627,16 +625,18 @@
|
|||||||
valueField: 'id',
|
valueField: 'id',
|
||||||
textField: 'depotName',
|
textField: 'depotName',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
hasDownArrow: false,
|
||||||
url: '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid,
|
url: '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid,
|
||||||
onSelect:function(rec){
|
onSelect:function(rec){
|
||||||
var depotId = rec.id;
|
var depotId = rec.id;
|
||||||
body =$("#depotHeadFM .datagrid-body");
|
body =$("#depotHeadFM .datagrid-view2 .datagrid-body");
|
||||||
footer =$("#depotHeadFM .datagrid-footer");
|
footer =$("#depotHeadFM .datagrid-view2 .datagrid-footer");
|
||||||
input = ".datagrid-editable-input";
|
input = "input[type=text]";
|
||||||
var mId = body.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
var currentRowDom = body.find(".datagrid-row").eq(editIndex);
|
||||||
|
var mId = currentRowDom.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
||||||
if(mId){
|
if(mId){
|
||||||
var type = "select"; //type 类型:点击 click,选择 select
|
var type = "select"; //type 类型:点击 click,选择 select
|
||||||
inOutService.findStockNumById(depotId, mId, monthTime, body, input, ratioDepot, type);
|
inOutService.findStockNumById(depotId, mId, monthTime, currentRowDom, input, ratioDepot, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -677,7 +677,10 @@
|
|||||||
onLoadSuccess: function (rec) {
|
onLoadSuccess: function (rec) {
|
||||||
if(rec && rec.total==1) {
|
if(rec && rec.total==1) {
|
||||||
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
||||||
$("#depotHeadFM .datagrid-body").find("[field='OperNumber']").find(".datagrid-editable-input").focus().select();
|
var body =$("#depotHeadFM .datagrid-view2 .datagrid-body");
|
||||||
|
input = "input[type=text]";
|
||||||
|
var currentRowDom = body.find(".datagrid-row").eq(editIndex);
|
||||||
|
currentRowDom.find("[field='OperNumber']").find(input).focus().select();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onSelect:function(index, rowData){
|
onSelect:function(index, rowData){
|
||||||
@@ -772,6 +775,11 @@
|
|||||||
$("#materialData").datagrid('loadData',data);
|
$("#materialData").datagrid('loadData',data);
|
||||||
if(type === "add") {
|
if(type === "add") {
|
||||||
$("#depotHeadDlg #append").click(); //新增行
|
$("#depotHeadDlg #append").click(); //新增行
|
||||||
|
} else if(type === "edit") {
|
||||||
|
for(var i=0;i<data.rows.length;i++){
|
||||||
|
$('#materialData').datagrid('selectRow', i).datagrid('beginEdit', i);
|
||||||
|
inOutService.autoReckon();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -551,8 +551,6 @@
|
|||||||
//交替出现背景
|
//交替出现背景
|
||||||
striped : true,
|
striped : true,
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
onClickRow: onClickRow,
|
|
||||||
columns:[[
|
columns:[[
|
||||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||||
{ title: '仓库名称', field: 'DepotId', editor: 'validatebox', width: 90,
|
{ title: '仓库名称', field: 'DepotId', editor: 'validatebox', width: 90,
|
||||||
@@ -565,16 +563,18 @@
|
|||||||
valueField: 'id',
|
valueField: 'id',
|
||||||
textField: 'depotName',
|
textField: 'depotName',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
hasDownArrow: false,
|
||||||
url: '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid,
|
url: '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid,
|
||||||
onSelect:function(rec){
|
onSelect:function(rec){
|
||||||
var depotId = rec.id;
|
var depotId = rec.id;
|
||||||
body =$("#depotHeadFM .datagrid-body");
|
body =$("#depotHeadFM .datagrid-view2 .datagrid-body");
|
||||||
footer =$("#depotHeadFM .datagrid-footer");
|
footer =$("#depotHeadFM .datagrid-view2 .datagrid-footer");
|
||||||
input = ".datagrid-editable-input";
|
input = "input[type=text]";
|
||||||
var mId = body.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
var currentRowDom = body.find(".datagrid-row").eq(editIndex);
|
||||||
|
var mId = currentRowDom.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
||||||
if(mId){
|
if(mId){
|
||||||
var type = "select"; //type 类型:点击 click,选择 select
|
var type = "select"; //type 类型:点击 click,选择 select
|
||||||
inOutService.findStockNumById(depotId, mId, monthTime, body, input, ratioDepot, type);
|
inOutService.findStockNumById(depotId, mId, monthTime, currentRowDom, input, ratioDepot, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -615,11 +615,14 @@
|
|||||||
onLoadSuccess: function (rec) {
|
onLoadSuccess: function (rec) {
|
||||||
if(rec && rec.total==1) {
|
if(rec && rec.total==1) {
|
||||||
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
||||||
$("#depotHeadFM .datagrid-body").find("[field='OperNumber']").find(".datagrid-editable-input").focus().select();
|
var body =$("#depotHeadFM .datagrid-view2 .datagrid-body");
|
||||||
|
input = "input[type=text]";
|
||||||
|
var currentRowDom = body.find(".datagrid-row").eq(editIndex);
|
||||||
|
currentRowDom.find("[field='OperNumber']").find(input).focus().select();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onSelect:function(index, rowData){
|
onSelect:function(index, rowData){
|
||||||
inOutService.materialSelect(rowData,monthTime);
|
inOutService.materialSelect(rowData, monthTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -710,6 +713,11 @@
|
|||||||
$("#materialData").datagrid('loadData',data);
|
$("#materialData").datagrid('loadData',data);
|
||||||
if(type === "add") {
|
if(type === "add") {
|
||||||
$("#depotHeadDlg #append").click(); //新增行
|
$("#depotHeadDlg #append").click(); //新增行
|
||||||
|
} else if(type === "edit") {
|
||||||
|
for(var i=0;i<data.rows.length;i++){
|
||||||
|
$('#materialData').datagrid('selectRow', i).datagrid('beginEdit', i);
|
||||||
|
inOutService.autoReckon();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -612,8 +612,6 @@
|
|||||||
//交替出现背景
|
//交替出现背景
|
||||||
striped : true,
|
striped : true,
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
onClickRow: onClickRow,
|
|
||||||
columns:[[
|
columns:[[
|
||||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||||
{ title: '仓库名称', field: 'DepotId', editor: 'validatebox', width: 90,
|
{ title: '仓库名称', field: 'DepotId', editor: 'validatebox', width: 90,
|
||||||
@@ -626,16 +624,18 @@
|
|||||||
valueField: 'id',
|
valueField: 'id',
|
||||||
textField: 'depotName',
|
textField: 'depotName',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
hasDownArrow: false,
|
||||||
url: '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid,
|
url: '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid,
|
||||||
onSelect:function(rec){
|
onSelect:function(rec){
|
||||||
var depotId = rec.id;
|
var depotId = rec.id;
|
||||||
body =$("#depotHeadFM .datagrid-body");
|
body =$("#depotHeadFM .datagrid-view2 .datagrid-body");
|
||||||
footer =$("#depotHeadFM .datagrid-footer");
|
footer =$("#depotHeadFM .datagrid-view2 .datagrid-footer");
|
||||||
input = ".datagrid-editable-input";
|
input = "input[type=text]";
|
||||||
var mId = body.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
var currentRowDom = body.find(".datagrid-row").eq(editIndex);
|
||||||
|
var mId = currentRowDom.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
||||||
if(mId){
|
if(mId){
|
||||||
var type = "select"; //type 类型:点击 click,选择 select
|
var type = "select"; //type 类型:点击 click,选择 select
|
||||||
inOutService.findStockNumById(depotId, mId, monthTime, body, input, ratioDepot, type);
|
inOutService.findStockNumById(depotId, mId, monthTime, currentRowDom, input, ratioDepot, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -676,7 +676,10 @@
|
|||||||
onLoadSuccess: function (rec) {
|
onLoadSuccess: function (rec) {
|
||||||
if(rec && rec.total==1) {
|
if(rec && rec.total==1) {
|
||||||
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
||||||
$("#depotHeadFM .datagrid-body").find("[field='OperNumber']").find(".datagrid-editable-input").focus().select();
|
var body =$("#depotHeadFM .datagrid-view2 .datagrid-body");
|
||||||
|
input = "input[type=text]";
|
||||||
|
var currentRowDom = body.find(".datagrid-row").eq(editIndex);
|
||||||
|
currentRowDom.find("[field='OperNumber']").find(input).focus().select();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onSelect:function(index, rowData){
|
onSelect:function(index, rowData){
|
||||||
@@ -767,6 +770,11 @@
|
|||||||
$("#materialData").datagrid('loadData',data);
|
$("#materialData").datagrid('loadData',data);
|
||||||
if(type === "add") {
|
if(type === "add") {
|
||||||
$("#depotHeadDlg #append").click(); //新增行
|
$("#depotHeadDlg #append").click(); //新增行
|
||||||
|
} else if(type === "edit") {
|
||||||
|
for(var i=0;i<data.rows.length;i++){
|
||||||
|
$('#materialData').datagrid('selectRow', i).datagrid('beginEdit', i);
|
||||||
|
inOutService.autoReckon();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -648,8 +648,6 @@
|
|||||||
//交替出现背景
|
//交替出现背景
|
||||||
striped : true,
|
striped : true,
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
onClickRow: onClickRow,
|
|
||||||
columns:[[
|
columns:[[
|
||||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||||
{ title: '仓库名称', field: 'DepotId', editor: 'validatebox', width: 90,
|
{ title: '仓库名称', field: 'DepotId', editor: 'validatebox', width: 90,
|
||||||
@@ -662,16 +660,18 @@
|
|||||||
valueField: 'id',
|
valueField: 'id',
|
||||||
textField: 'depotName',
|
textField: 'depotName',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
hasDownArrow: false,
|
||||||
url: '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid,
|
url: '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid,
|
||||||
onSelect:function(rec){
|
onSelect:function(rec){
|
||||||
var depotId = rec.id;
|
var depotId = rec.id;
|
||||||
body =$("#depotHeadFM .datagrid-body");
|
body =$("#depotHeadFM .datagrid-view2 .datagrid-body");
|
||||||
footer =$("#depotHeadFM .datagrid-footer");
|
footer =$("#depotHeadFM .datagrid-view2 .datagrid-footer");
|
||||||
input = ".datagrid-editable-input";
|
input = "input[type=text]";
|
||||||
var mId = body.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
var currentRowDom = body.find(".datagrid-row").eq(editIndex);
|
||||||
|
var mId = currentRowDom.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
||||||
if(mId){
|
if(mId){
|
||||||
var type = "select"; //type 类型:点击 click,选择 select
|
var type = "select"; //type 类型:点击 click,选择 select
|
||||||
inOutService.findStockNumById(depotId, mId, monthTime, body, input, ratioDepot, type);
|
inOutService.findStockNumById(depotId, mId, monthTime, currentRowDom, input, ratioDepot, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -712,7 +712,10 @@
|
|||||||
onLoadSuccess: function (rec) {
|
onLoadSuccess: function (rec) {
|
||||||
if(rec && rec.total==1) {
|
if(rec && rec.total==1) {
|
||||||
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
||||||
$("#depotHeadFM .datagrid-body").find("[field='OperNumber']").find(".datagrid-editable-input").focus().select();
|
var body =$("#depotHeadFM .datagrid-view2 .datagrid-body");
|
||||||
|
input = "input[type=text]";
|
||||||
|
var currentRowDom = body.find(".datagrid-row").eq(editIndex);
|
||||||
|
currentRowDom.find("[field='OperNumber']").find(input).focus().select();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onSelect:function(index, rowData){
|
onSelect:function(index, rowData){
|
||||||
@@ -803,6 +806,11 @@
|
|||||||
$("#materialData").datagrid('loadData',data);
|
$("#materialData").datagrid('loadData',data);
|
||||||
if(type === "add") {
|
if(type === "add") {
|
||||||
$("#depotHeadDlg #append").click(); //新增行
|
$("#depotHeadDlg #append").click(); //新增行
|
||||||
|
} else if(type === "edit") {
|
||||||
|
for(var i=0;i<data.rows.length;i++){
|
||||||
|
$('#materialData').datagrid('selectRow', i).datagrid('beginEdit', i);
|
||||||
|
inOutService.autoReckon();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -636,8 +636,6 @@
|
|||||||
//交替出现背景
|
//交替出现背景
|
||||||
striped : true,
|
striped : true,
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
onClickRow: onClickRow,
|
|
||||||
columns:[[
|
columns:[[
|
||||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||||
{ title: '仓库名称', field: 'DepotId', editor: 'validatebox', width: 90,
|
{ title: '仓库名称', field: 'DepotId', editor: 'validatebox', width: 90,
|
||||||
@@ -650,16 +648,18 @@
|
|||||||
valueField: 'id',
|
valueField: 'id',
|
||||||
textField: 'depotName',
|
textField: 'depotName',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
hasDownArrow: false,
|
||||||
url: '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid,
|
url: '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid,
|
||||||
onSelect:function(rec){
|
onSelect:function(rec){
|
||||||
var depotId = rec.id;
|
var depotId = rec.id;
|
||||||
body =$("#depotHeadFM .datagrid-body");
|
body =$("#depotHeadFM .datagrid-view2 .datagrid-body");
|
||||||
footer =$("#depotHeadFM .datagrid-footer");
|
footer =$("#depotHeadFM .datagrid-view2 .datagrid-footer");
|
||||||
input = ".datagrid-editable-input";
|
input = "input[type=text]";
|
||||||
var mId = body.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
var currentRowDom = body.find(".datagrid-row").eq(editIndex);
|
||||||
|
var mId = currentRowDom.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
||||||
if(mId){
|
if(mId){
|
||||||
var type = "select"; //type 类型:点击 click,选择 select
|
var type = "select"; //type 类型:点击 click,选择 select
|
||||||
inOutService.findStockNumById(depotId, mId, monthTime, body, input, ratioDepot, type);
|
inOutService.findStockNumById(depotId, mId, monthTime, currentRowDom, input, ratioDepot, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -700,7 +700,10 @@
|
|||||||
onLoadSuccess: function (rec) {
|
onLoadSuccess: function (rec) {
|
||||||
if(rec && rec.total==1) {
|
if(rec && rec.total==1) {
|
||||||
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
||||||
$("#depotHeadFM .datagrid-body").find("[field='OperNumber']").find(".datagrid-editable-input").focus().select();
|
var body =$("#depotHeadFM .datagrid-view2 .datagrid-body");
|
||||||
|
input = "input[type=text]";
|
||||||
|
var currentRowDom = body.find(".datagrid-row").eq(editIndex);
|
||||||
|
currentRowDom.find("[field='OperNumber']").find(input).focus().select();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onSelect:function(index, rowData){
|
onSelect:function(index, rowData){
|
||||||
@@ -795,6 +798,11 @@
|
|||||||
$("#materialData").datagrid('loadData',data);
|
$("#materialData").datagrid('loadData',data);
|
||||||
if(type === "add") {
|
if(type === "add") {
|
||||||
$("#depotHeadDlg #append").click(); //新增行
|
$("#depotHeadDlg #append").click(); //新增行
|
||||||
|
} else if(type === "edit") {
|
||||||
|
for(var i=0;i<data.rows.length;i++){
|
||||||
|
$('#materialData').datagrid('selectRow', i).datagrid('beginEdit', i);
|
||||||
|
inOutService.autoReckon();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -595,8 +595,6 @@
|
|||||||
//交替出现背景
|
//交替出现背景
|
||||||
striped : true,
|
striped : true,
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
onClickRow: onClickRow,
|
|
||||||
columns:[[
|
columns:[[
|
||||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||||
{ title: '仓库名称', field: 'DepotId', editor: 'validatebox', width: 90,
|
{ title: '仓库名称', field: 'DepotId', editor: 'validatebox', width: 90,
|
||||||
@@ -609,16 +607,18 @@
|
|||||||
valueField: 'id',
|
valueField: 'id',
|
||||||
textField: 'depotName',
|
textField: 'depotName',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
hasDownArrow: false,
|
||||||
url: '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid,
|
url: '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid,
|
||||||
onSelect:function(rec){
|
onSelect:function(rec){
|
||||||
var depotId = rec.id;
|
var depotId = rec.id;
|
||||||
body =$("#depotHeadFM .datagrid-body");
|
body =$("#depotHeadFM .datagrid-view2 .datagrid-body");
|
||||||
footer =$("#depotHeadFM .datagrid-footer");
|
footer =$("#depotHeadFM .datagrid-view2 .datagrid-footer");
|
||||||
input = ".datagrid-editable-input";
|
input = "input[type=text]";
|
||||||
var mId = body.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
var currentRowDom = body.find(".datagrid-row").eq(editIndex);
|
||||||
|
var mId = currentRowDom.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
||||||
if(mId){
|
if(mId){
|
||||||
var type = "select"; //type 类型:点击 click,选择 select
|
var type = "select"; //type 类型:点击 click,选择 select
|
||||||
inOutService.findStockNumById(depotId, mId, monthTime, body, input, ratioDepot, type);
|
inOutService.findStockNumById(depotId, mId, monthTime, currentRowDom, input, ratioDepot, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -659,7 +659,10 @@
|
|||||||
onLoadSuccess: function (rec) {
|
onLoadSuccess: function (rec) {
|
||||||
if(rec && rec.total==1) {
|
if(rec && rec.total==1) {
|
||||||
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
||||||
$("#depotHeadFM .datagrid-body").find("[field='OperNumber']").find(".datagrid-editable-input").focus().select();
|
var body =$("#depotHeadFM .datagrid-view2 .datagrid-body");
|
||||||
|
input = "input[type=text]";
|
||||||
|
var currentRowDom = body.find(".datagrid-row").eq(editIndex);
|
||||||
|
currentRowDom.find("[field='OperNumber']").find(input).focus().select();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onSelect:function(index, rowData){
|
onSelect:function(index, rowData){
|
||||||
@@ -754,6 +757,11 @@
|
|||||||
$("#materialData").datagrid('loadData',data);
|
$("#materialData").datagrid('loadData',data);
|
||||||
if(type === "add") {
|
if(type === "add") {
|
||||||
$("#depotHeadDlg #append").click(); //新增行
|
$("#depotHeadDlg #append").click(); //新增行
|
||||||
|
} else if(type === "edit") {
|
||||||
|
for(var i=0;i<data.rows.length;i++){
|
||||||
|
$('#materialData').datagrid('selectRow', i).datagrid('beginEdit', i);
|
||||||
|
inOutService.autoReckon();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -672,8 +672,6 @@
|
|||||||
//交替出现背景
|
//交替出现背景
|
||||||
striped : true,
|
striped : true,
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
//loadFilter: pagerFilter,
|
|
||||||
onClickRow: onClickRow,
|
|
||||||
columns:[[
|
columns:[[
|
||||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||||
{ title: '仓库名称', field: 'DepotId', editor: 'validatebox', width: 90,
|
{ title: '仓库名称', field: 'DepotId', editor: 'validatebox', width: 90,
|
||||||
@@ -686,16 +684,18 @@
|
|||||||
valueField: 'id',
|
valueField: 'id',
|
||||||
textField: 'depotName',
|
textField: 'depotName',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
hasDownArrow: false,
|
||||||
url: '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid,
|
url: '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid,
|
||||||
onSelect:function(rec){
|
onSelect:function(rec){
|
||||||
var depotId = rec.id;
|
var depotId = rec.id;
|
||||||
body =$("#depotHeadFM .datagrid-body");
|
body =$("#depotHeadFM .datagrid-view2 .datagrid-body");
|
||||||
footer =$("#depotHeadFM .datagrid-footer");
|
footer =$("#depotHeadFM .datagrid-view2 .datagrid-footer");
|
||||||
input = ".datagrid-editable-input";
|
input = "input[type=text]";
|
||||||
var mId = body.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
var currentRowDom = body.find(".datagrid-row").eq(editIndex);
|
||||||
|
var mId = currentRowDom.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
||||||
if(mId){
|
if(mId){
|
||||||
var type = "select"; //type 类型:点击 click,选择 select
|
var type = "select"; //type 类型:点击 click,选择 select
|
||||||
inOutService.findStockNumById(depotId, mId, monthTime, body, input, ratioDepot, type);
|
inOutService.findStockNumById(depotId, mId, monthTime, currentRowDom, input, ratioDepot, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -736,7 +736,10 @@
|
|||||||
onLoadSuccess: function (rec) {
|
onLoadSuccess: function (rec) {
|
||||||
if(rec && rec.total==1) {
|
if(rec && rec.total==1) {
|
||||||
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
||||||
$("#depotHeadFM .datagrid-body").find("[field='OperNumber']").find(".datagrid-editable-input").focus().select();
|
var body =$("#depotHeadFM .datagrid-view2 .datagrid-body");
|
||||||
|
input = "input[type=text]";
|
||||||
|
var currentRowDom = body.find(".datagrid-row").eq(editIndex);
|
||||||
|
currentRowDom.find("[field='OperNumber']").find(input).focus().select();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onSelect:function(index, rowData){
|
onSelect:function(index, rowData){
|
||||||
@@ -831,6 +834,11 @@
|
|||||||
$("#materialData").datagrid('loadData',data);
|
$("#materialData").datagrid('loadData',data);
|
||||||
if(type === "add") {
|
if(type === "add") {
|
||||||
$("#depotHeadDlg #append").click(); //新增行
|
$("#depotHeadDlg #append").click(); //新增行
|
||||||
|
} else if(type === "edit") {
|
||||||
|
for(var i=0;i<data.rows.length;i++){
|
||||||
|
$('#materialData').datagrid('selectRow', i).datagrid('beginEdit', i);
|
||||||
|
inOutService.autoReckon();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -295,11 +295,6 @@ public class DepotItemService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 2019-02-02修改
|
|
||||||
* 我之前对操作数量的理解有偏差
|
|
||||||
* 这里重点重申一下:BasicNumber=OperNumber*ratio
|
|
||||||
* */
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public String saveDetials(String inserted, String deleted, String updated, Long headerId, Long tenantId, HttpServletRequest request) throws Exception{
|
public String saveDetials(String inserted, String deleted, String updated, Long headerId, Long tenantId, HttpServletRequest request) throws Exception{
|
||||||
//查询单据主表信息
|
//查询单据主表信息
|
||||||
@@ -314,49 +309,47 @@ public class DepotItemService {
|
|||||||
//转为json
|
//转为json
|
||||||
JSONArray insertedJson = JSONArray.parseArray(inserted);
|
JSONArray insertedJson = JSONArray.parseArray(inserted);
|
||||||
JSONArray deletedJson = JSONArray.parseArray(deleted);
|
JSONArray deletedJson = JSONArray.parseArray(deleted);
|
||||||
JSONArray updatedJson = JSONArray.parseArray(updated);
|
|
||||||
/**
|
//删除单据的明细
|
||||||
* 2019-01-28优先处理删除的
|
deleteDepotItemHeadId(headerId);
|
||||||
* 删除的可以继续卖,删除的需要将使用的序列号回收
|
|
||||||
* 插入的需要判断当前货源是否充足
|
// if (null != deletedJson) {
|
||||||
* 更新的需要判断货源是否充足
|
// StringBuffer bf=new StringBuffer();
|
||||||
* */
|
// for (int i = 0; i < deletedJson.size(); i++) {
|
||||||
if (null != deletedJson) {
|
// //首先回收序列号,如果是调拨,不用处理序列号
|
||||||
StringBuffer bf=new StringBuffer();
|
// JSONObject tempDeletedJson = JSONObject.parseObject(deletedJson.getString(i));
|
||||||
for (int i = 0; i < deletedJson.size(); i++) {
|
// if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
|
||||||
//首先回收序列号,如果是调拨,不用处理序列号
|
// &&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubType())){
|
||||||
JSONObject tempDeletedJson = JSONObject.parseObject(deletedJson.getString(i));
|
// DepotItem depotItem = getDepotItem(tempDeletedJson.getLong("Id"));
|
||||||
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
|
// if(depotItem==null){
|
||||||
&&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubType())){
|
// continue;
|
||||||
DepotItem depotItem = getDepotItem(tempDeletedJson.getLong("Id"));
|
// }
|
||||||
if(depotItem==null){
|
// /**
|
||||||
continue;
|
// * 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
|
||||||
}
|
// * */
|
||||||
/**
|
// Material material= materialService.getMaterial(depotItem.getMaterialId());
|
||||||
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
|
// if(material==null){
|
||||||
* */
|
// continue;
|
||||||
Material material= materialService.getMaterial(depotItem.getMaterialId());
|
// }
|
||||||
if(material==null){
|
// if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableSerialNumber())){
|
||||||
continue;
|
// serialNumberService.cancelSerialNumber(depotItem.getMaterialId(),depotItem.getHeaderId(),(depotItem.getBasicNumber()==null?0:depotItem.getBasicNumber()).intValue(),
|
||||||
}
|
// userInfo);
|
||||||
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableSerialNumber())){
|
// }
|
||||||
serialNumberService.cancelSerialNumber(depotItem.getMaterialId(),depotItem.getHeaderId(),(depotItem.getBasicNumber()==null?0:depotItem.getBasicNumber()).intValue(),
|
// }
|
||||||
userInfo);
|
// bf.append(tempDeletedJson.getLong("Id"));
|
||||||
}
|
// if(i<(deletedJson.size()-1)){
|
||||||
}
|
// bf.append(",");
|
||||||
bf.append(tempDeletedJson.getLong("Id"));
|
// }
|
||||||
if(i<(deletedJson.size()-1)){
|
// }
|
||||||
bf.append(",");
|
// this.batchDeleteDepotItemByIds(bf.toString());
|
||||||
}
|
// //更新当前库存
|
||||||
}
|
// for (int i = 0; i < deletedJson.size(); i++) {
|
||||||
this.batchDeleteDepotItemByIds(bf.toString());
|
// JSONObject tempDeletedJson = JSONObject.parseObject(deletedJson.getString(i));
|
||||||
//更新当前库存
|
// DepotItem depotItem = getDepotItem(tempDeletedJson.getLong("Id"));
|
||||||
for (int i = 0; i < deletedJson.size(); i++) {
|
// updateCurrentStock(depotItem,tenantId);
|
||||||
JSONObject tempDeletedJson = JSONObject.parseObject(deletedJson.getString(i));
|
// }
|
||||||
DepotItem depotItem = getDepotItem(tempDeletedJson.getLong("Id"));
|
// }
|
||||||
updateCurrentStock(depotItem,tenantId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (null != insertedJson) {
|
if (null != insertedJson) {
|
||||||
for (int i = 0; i < insertedJson.size(); i++) {
|
for (int i = 0; i < insertedJson.size(); i++) {
|
||||||
DepotItem depotItem = new DepotItem();
|
DepotItem depotItem = new DepotItem();
|
||||||
@@ -417,27 +410,13 @@ public class DepotItemService {
|
|||||||
if (StringUtil.isExist(tempInsertedJson.get("TaxLastMoney"))) {
|
if (StringUtil.isExist(tempInsertedJson.get("TaxLastMoney"))) {
|
||||||
depotItem.setTaxLastMoney(tempInsertedJson.getBigDecimal("TaxLastMoney"));
|
depotItem.setTaxLastMoney(tempInsertedJson.getBigDecimal("TaxLastMoney"));
|
||||||
}
|
}
|
||||||
if (tempInsertedJson.get("OtherField1") != null) {
|
|
||||||
depotItem.setOtherField1(tempInsertedJson.getString("OtherField1"));
|
|
||||||
}
|
|
||||||
if (tempInsertedJson.get("OtherField2") != null) {
|
|
||||||
depotItem.setOtherField2(tempInsertedJson.getString("OtherField2"));
|
|
||||||
}
|
|
||||||
if (tempInsertedJson.get("OtherField3") != null) {
|
|
||||||
depotItem.setOtherField3(tempInsertedJson.getString("OtherField3"));
|
|
||||||
}
|
|
||||||
if (tempInsertedJson.get("OtherField4") != null) {
|
|
||||||
depotItem.setOtherField4(tempInsertedJson.getString("OtherField4"));
|
|
||||||
}
|
|
||||||
if (tempInsertedJson.get("OtherField5") != null) {
|
|
||||||
depotItem.setOtherField5(tempInsertedJson.getString("OtherField5"));
|
|
||||||
}
|
|
||||||
if (tempInsertedJson.get("MType") != null) {
|
if (tempInsertedJson.get("MType") != null) {
|
||||||
depotItem.setMaterialType(tempInsertedJson.getString("MType"));
|
depotItem.setMaterialType(tempInsertedJson.getString("MType"));
|
||||||
}
|
}
|
||||||
/**
|
if (tempInsertedJson.get("Remark") != null) {
|
||||||
* 出库时判断库存是否充足
|
depotItem.setRemark(tempInsertedJson.getString("Remark"));
|
||||||
* */
|
}
|
||||||
|
//出库时判断库存是否充足
|
||||||
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
|
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
|
||||||
if(depotItem==null){
|
if(depotItem==null){
|
||||||
continue;
|
continue;
|
||||||
@@ -452,12 +431,9 @@ public class DepotItemService {
|
|||||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
|
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
|
||||||
String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName()));
|
String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName()));
|
||||||
}
|
}
|
||||||
|
//出库时处理序列号
|
||||||
/**出库时处理序列号*/
|
|
||||||
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubType())) {
|
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubType())) {
|
||||||
/**
|
//判断商品是否开启序列号,开启的收回序列号,未开启的跳过
|
||||||
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
|
|
||||||
* */
|
|
||||||
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableSerialNumber())) {
|
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableSerialNumber())) {
|
||||||
//查询单据子表中开启序列号的数据列表
|
//查询单据子表中开启序列号的数据列表
|
||||||
serialNumberService.checkAndUpdateSerialNumber(depotItem, userInfo);
|
serialNumberService.checkAndUpdateSerialNumber(depotItem, userInfo);
|
||||||
@@ -469,135 +445,6 @@ public class DepotItemService {
|
|||||||
updateCurrentStock(depotItem,tenantId);
|
updateCurrentStock(depotItem,tenantId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null != updatedJson) {
|
|
||||||
for (int i = 0; i < updatedJson.size(); i++) {
|
|
||||||
JSONObject tempUpdatedJson = JSONObject.parseObject(updatedJson.getString(i));
|
|
||||||
DepotItem depotItem = this.getDepotItem(tempUpdatedJson.getLong("Id"));
|
|
||||||
if(depotItem==null){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
Material material= materialService.getMaterial(depotItem.getMaterialId());
|
|
||||||
if(material==null){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//首先回收序列号
|
|
||||||
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
|
|
||||||
&&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubType())) {
|
|
||||||
/**
|
|
||||||
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
|
|
||||||
* */
|
|
||||||
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableSerialNumber())) {
|
|
||||||
serialNumberService.cancelSerialNumber(depotItem.getMaterialId(), depotItem.getHeaderId(), (depotItem.getBasicNumber()==null?0:depotItem.getBasicNumber()).intValue(),
|
|
||||||
userInfo);
|
|
||||||
}
|
|
||||||
/**收回序列号的时候释放库存*/
|
|
||||||
depotItem.setOperNumber(BigDecimal.ZERO);
|
|
||||||
depotItem.setBasicNumber(BigDecimal.ZERO);
|
|
||||||
this.updateDepotItemWithObj(depotItem);
|
|
||||||
}
|
|
||||||
depotItem.setId(tempUpdatedJson.getLong("Id"));
|
|
||||||
Long materialId = null;
|
|
||||||
if (StringUtil.isExist(tempUpdatedJson.get("MaterialExtendId"))) {
|
|
||||||
Long materialExtendId = tempUpdatedJson.getLong("MaterialExtendId");
|
|
||||||
materialId = materialExtendService.getMaterialExtend(materialExtendId).getMaterialId();
|
|
||||||
depotItem.setMaterialId(materialId);
|
|
||||||
depotItem.setMaterialExtendId(tempUpdatedJson.getLong("MaterialExtendId"));
|
|
||||||
}
|
|
||||||
depotItem.setMaterialUnit(tempUpdatedJson.getString("Unit"));
|
|
||||||
if (StringUtil.isExist(tempUpdatedJson.get("OperNumber"))) {
|
|
||||||
depotItem.setOperNumber(tempUpdatedJson.getBigDecimal("OperNumber"));
|
|
||||||
try {
|
|
||||||
String Unit = tempUpdatedJson.get("Unit").toString();
|
|
||||||
BigDecimal oNumber = tempUpdatedJson.getBigDecimal("OperNumber");
|
|
||||||
//以下进行单位换算
|
|
||||||
String unitName = materialService.findUnitName(materialId); //查询计量单位名称
|
|
||||||
if (!StringUtil.isEmpty(unitName)) {
|
|
||||||
String unitList = unitName.substring(0, unitName.indexOf("("));
|
|
||||||
String ratioList = unitName.substring(unitName.indexOf("("));
|
|
||||||
String basicUnit = unitList.substring(0, unitList.indexOf(",")); //基本单位
|
|
||||||
String otherUnit = unitList.substring(unitList.indexOf(",") + 1); //副单位
|
|
||||||
Integer ratio = Integer.parseInt(ratioList.substring(ratioList.indexOf(":") + 1).replace(")", "")); //比例
|
|
||||||
if (Unit.equals(basicUnit)) { //如果等于基础单位
|
|
||||||
depotItem.setBasicNumber(oNumber); //数量一致
|
|
||||||
} else if (Unit.equals(otherUnit)) { //如果等于副单位
|
|
||||||
depotItem.setBasicNumber(oNumber.multiply(new BigDecimal(ratio))); //数量乘以比例
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
depotItem.setBasicNumber(oNumber); //其他情况
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error(">>>>>>>>>>>>>>>>>>>设置基础数量异常", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (StringUtil.isExist(tempUpdatedJson.get("UnitPrice"))) {
|
|
||||||
depotItem.setUnitPrice(tempUpdatedJson.getBigDecimal("UnitPrice"));
|
|
||||||
}
|
|
||||||
if (StringUtil.isExist(tempUpdatedJson.get("TaxUnitPrice"))) {
|
|
||||||
depotItem.setTaxUnitPrice(tempUpdatedJson.getBigDecimal("TaxUnitPrice"));
|
|
||||||
}
|
|
||||||
if (StringUtil.isExist(tempUpdatedJson.get("AllPrice"))) {
|
|
||||||
depotItem.setAllPrice(tempUpdatedJson.getBigDecimal("AllPrice"));
|
|
||||||
}
|
|
||||||
depotItem.setRemark(tempUpdatedJson.getString("Remark"));
|
|
||||||
if (tempUpdatedJson.get("DepotId") != null && StringUtil.isExist(tempUpdatedJson.get("DepotId"))) {
|
|
||||||
depotItem.setDepotId(tempUpdatedJson.getLong("DepotId"));
|
|
||||||
}
|
|
||||||
if (tempUpdatedJson.get("AnotherDepotId") != null && StringUtil.isExist(tempUpdatedJson.get("AnotherDepotId"))) {
|
|
||||||
depotItem.setAnotherDepotId(tempUpdatedJson.getLong("AnotherDepotId"));
|
|
||||||
}
|
|
||||||
if (StringUtil.isExist(tempUpdatedJson.get("TaxRate"))) {
|
|
||||||
depotItem.setTaxRate(tempUpdatedJson.getBigDecimal("TaxRate"));
|
|
||||||
}
|
|
||||||
if (StringUtil.isExist(tempUpdatedJson.get("TaxMoney"))) {
|
|
||||||
depotItem.setTaxMoney(tempUpdatedJson.getBigDecimal("TaxMoney"));
|
|
||||||
}
|
|
||||||
if (StringUtil.isExist(tempUpdatedJson.get("TaxLastMoney"))) {
|
|
||||||
depotItem.setTaxLastMoney(tempUpdatedJson.getBigDecimal("TaxLastMoney"));
|
|
||||||
}
|
|
||||||
depotItem.setOtherField1(tempUpdatedJson.getString("OtherField1"));
|
|
||||||
depotItem.setOtherField2(tempUpdatedJson.getString("OtherField2"));
|
|
||||||
depotItem.setOtherField3(tempUpdatedJson.getString("OtherField3"));
|
|
||||||
depotItem.setOtherField4(tempUpdatedJson.getString("OtherField4"));
|
|
||||||
depotItem.setOtherField5(tempUpdatedJson.getString("OtherField5"));
|
|
||||||
depotItem.setMaterialType(tempUpdatedJson.getString("MType"));
|
|
||||||
/**
|
|
||||||
* create by: qiankunpingtai
|
|
||||||
* create time: 2019/3/25 15:18
|
|
||||||
* website:https://qiankunpingtai.cn
|
|
||||||
* description:
|
|
||||||
* 修改了商品类型时,库中的商品和页面传递的不同
|
|
||||||
* 这里需要重新获取页面传递的商品信息
|
|
||||||
*/
|
|
||||||
if(!material.getId().equals(depotItem.getMaterialId())){
|
|
||||||
material= materialService.getMaterial(depotItem.getMaterialId());
|
|
||||||
if(material==null){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**出库时处理序列号*/
|
|
||||||
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
|
|
||||||
BigDecimal stock = getStockByParam(depotItem.getDepotId(),depotItem.getMaterialId(),null,null,tenantId);
|
|
||||||
BigDecimal thisBasicNumber = depotItem.getBasicNumber()==null?BigDecimal.ZERO:depotItem.getBasicNumber();
|
|
||||||
if(systemConfigService.getMinusStockFlag() == false && stock.compareTo(thisBasicNumber)<0){
|
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
|
|
||||||
String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName()));
|
|
||||||
}
|
|
||||||
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubType())) {
|
|
||||||
/**
|
|
||||||
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
|
|
||||||
* */
|
|
||||||
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableSerialNumber())) {
|
|
||||||
//查询单据子表中开启序列号的数据列表
|
|
||||||
serialNumberService.checkAndUpdateSerialNumber(depotItem, userInfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.updateDepotItemWithObj(depotItem);
|
|
||||||
//更新当前库存
|
|
||||||
updateCurrentStock(depotItem,tenantId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -621,6 +468,17 @@ public class DepotItemService {
|
|||||||
return unitName;
|
return unitName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
|
public void deleteDepotItemHeadId(Long headerId)throws Exception {
|
||||||
|
DepotItemExample example = new DepotItemExample();
|
||||||
|
example.createCriteria().andHeaderIdEqualTo(headerId);
|
||||||
|
try{
|
||||||
|
depotItemMapper.deleteByExample(example);
|
||||||
|
}catch(Exception e){
|
||||||
|
JshException.writeFail(logger, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int batchDeleteDepotItemByIds(String ids)throws Exception {
|
public int batchDeleteDepotItemByIds(String ids)throws Exception {
|
||||||
User userInfo=userService.getCurrentUser();
|
User userInfo=userService.getCurrentUser();
|
||||||
|
|||||||
Reference in New Issue
Block a user