"conf/devCommons/vscode:/vscode.git/clone" did not exist on "b86ac87ed372120ddc24943ca44db3d0442c5a58"
Commit e06435ec authored by 季圣华's avatar 季圣华
Browse files

修改单据明细的展示逻辑

parent 3534c26a
...@@ -83,7 +83,7 @@ ...@@ -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
......
This diff is collapsed.
...@@ -454,8 +454,6 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment