diff --git a/DSWeb/Areas/MvcShipping/Controllers/MsChFeeController.cs b/DSWeb/Areas/MvcShipping/Controllers/MsChFeeController.cs index 1b662bd6..6d56deb0 100644 --- a/DSWeb/Areas/MvcShipping/Controllers/MsChFeeController.cs +++ b/DSWeb/Areas/MvcShipping/Controllers/MsChFeeController.cs @@ -389,66 +389,66 @@ namespace DSWeb.MvcShipping.Controllers return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) }; } - var FEESAVENOTSAMEAMOUNT = MsSysParamSetDAL.GetData("PARAMNAME='FEESAVENOTSAMEAMOUNT'"); - if (FEESAVENOTSAMEAMOUNT.PARAMVALUE == "1"&& feetype==2) - { - var oldfeelist = MsChFeeDAL.GetAllDataList("BSNO='" + bsno + "' AND FEETYPE=2"); - var findlist = new List(); - foreach (var fee in oldfeelist) - { - var newfee = bodyList.Find(X => X.GId == fee.GId); - if (newfee == null&&fee.FeeType == 2) - { - var newinvlink = findlist.Find(X => X.Currency == fee.Currency && X.CustomerName == fee.CustomerName && X.Amount == fee.Amount); - if (newinvlink == null) - { - var InvLink = new MsChFee(); - InvLink.Currency = fee.Currency; - InvLink.CustomerName = fee.CustomerName; - InvLink.Amount = fee.Amount; - findlist.Add(InvLink); - } - else - { - var jsonRespose3 = new JsonResponse - { - Success = false, - Message = "客户名称,金额,币别 ,相同,不允许保存,请调整!", - }; - return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose3) }; - - } - } - } + // var FEESAVENOTSAMEAMOUNT = MsSysParamSetDAL.GetData("PARAMNAME='FEESAVENOTSAMEAMOUNT'"); + // if (FEESAVENOTSAMEAMOUNT.PARAMVALUE == "1"&& feetype==2) + // { + // var oldfeelist = MsChFeeDAL.GetAllDataList("BSNO='" + bsno + "' AND FEETYPE=2"); + // var findlist = new List(); + // foreach (var fee in oldfeelist) + // { + // var newfee = bodyList.Find(X => X.GId == fee.GId); + // if (newfee == null&&fee.FeeType == 2) + // { + // var newinvlink = findlist.Find(X => X.Currency == fee.Currency && X.CustomerName == fee.CustomerName && X.Amount == fee.Amount); + // if (newinvlink == null) + // { + // var InvLink = new MsChFee(); + // InvLink.Currency = fee.Currency; + // InvLink.CustomerName = fee.CustomerName; + // InvLink.Amount = fee.Amount; + // findlist.Add(InvLink); + // } + // else + // { + // var jsonRespose3 = new JsonResponse + // { + // Success = false, + // Message = "客户名称,金额,币别 ,相同,不允许保存,请调整!", + // }; + // return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose3) }; + + // } + // } + // } - foreach (var fee in bodyList) - { - if (fee.FeeType == 2) - { - var newinvlink = findlist.Find(X => X.Currency == fee.Currency && X.CustomerName == fee.CustomerName && X.Amount == fee.Amount); - if (newinvlink == null) - { - var InvLink = new MsChFee(); - InvLink.Currency = fee.Currency; - InvLink.CustomerName = fee.CustomerName; - InvLink.Amount = fee.Amount; - findlist.Add(InvLink); - } - else - { - var jsonRespose3 = new JsonResponse - { - Success = false, - Message = "客户名称,金额,币别 ,相同,不允许保存,请调整!", - }; - return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose3) }; - - } - } - } - - - } + // foreach (var fee in bodyList) + // { + // if (fee.FeeType == 2) + // { + // var newinvlink = findlist.Find(X => X.Currency == fee.Currency && X.CustomerName == fee.CustomerName && X.Amount == fee.Amount); + // if (newinvlink == null) + // { + // var InvLink = new MsChFee(); + // InvLink.Currency = fee.Currency; + // InvLink.CustomerName = fee.CustomerName; + // InvLink.Amount = fee.Amount; + // findlist.Add(InvLink); + // } + // else + // { + // var jsonRespose3 = new JsonResponse + // { + // Success = false, + // Message = "客户名称,金额,币别 ,相同,不允许保存,请调整!", + // }; + // return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose3) }; + + // } + // } + // } + + + //} if (isyj == "1") diff --git a/DSWeb/Areas/MvcShipping/Viewsjs/MsChFee/FeeDrCrGrid.js b/DSWeb/Areas/MvcShipping/Viewsjs/MsChFee/FeeDrCrGrid.js index 5a4f561a..c337665d 100644 --- a/DSWeb/Areas/MvcShipping/Viewsjs/MsChFee/FeeDrCrGrid.js +++ b/DSWeb/Areas/MvcShipping/Viewsjs/MsChFee/FeeDrCrGrid.js @@ -48,7 +48,8 @@ Ext.extend(Shipping.FeeEditGrid, Ext.Panel, { this.AMENDSELFWORKFLOW = 0; this.FEENOTPR=false; this.ISWACC=0; - this.FEEMANGERMUSTBE=0; + this.FEEMANGERMUSTBE = 0; + this.FEESAVENOTSAMEAMOUNT = 0; this.MODIFYCUSTBFFEELOCK=0; this.DrRangDaStr=" 1=1 "; this.CrRangDaStr=" 1=1 "; @@ -5673,6 +5674,33 @@ Ext.extend(Shipping.FeeEditGrid, Ext.Panel, { }, scope: this }); + Ext.Ajax.request({ + waitMsg: '', + url: '/MvcShipping/MsSysParamSet/GetData', + params: { + condition: "PARAMNAME='FEESAVENOTSAMEAMOUNT'" + }, + callback: function (options, success, response) { + if (success) { + var result = Ext.JSON.decode(response.responseText); + if (result.Success != true) { + + } else { + var data = result.data; + if (data.PARAMVALUE == '1') { + this.FEESAVENOTSAMEAMOUNT = 1; + } else { + + } + + } + } else { + + } + }, + scope: this + }); + Ext.Ajax.request({ waitMsg: '', url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable', @@ -7274,7 +7302,7 @@ Ext.extend(Shipping.FeeEditGrid, Ext.Panel, { var bodyDrChFeeDatas = []; var i; - + this.isrepeatfee = 0; if (type == '1') { for (i = 0; i < this.storeDrChFee.getCount(); i += 1) { var memberyf = this.storeDrChFee.getAt(i); @@ -7291,7 +7319,10 @@ Ext.extend(Shipping.FeeEditGrid, Ext.Panel, { }; var jsonChFeeBody = ConvertFeeRecordsToJson(bodyDrChFeeDatas); } else if (type == '2') { - + this.TMPstoreDrChFee = Ext.create('Ext.data.Store', { + model: 'MsChFee', + remoteSort: false + }); for (i = 0; i < this.storeCrChFee.getCount(); i += 1) { var memberyf = this.storeCrChFee.getAt(i); if (memberyf.data.Currency ==LOCALCURR&&memberyf.data.ExChangerate!=1) { @@ -7304,11 +7335,27 @@ Ext.extend(Shipping.FeeEditGrid, Ext.Panel, { bodyDrChFeeDatas.push(memberyf); var amount = memberyf.data.Amount; var ExChangerate = memberyf.data.ExChangerate; + if (this.FEESAVENOTSAMEAMOUNT == 1) { + for (var j = 0; j < this.TMPstoreDrChFee.getCount(); j += 1) { + var memberbody = this.TMPstoreDrChFee.getAt(j); + if (memberbody.data.CustomerName == memberyf.data.CustomerName && memberbody.data.FeeName == memberyf.data.FeeName + && memberbody.data.Amount == memberyf.data.Amount && memberbody.data.Currency == memberyf.data.Currency) + { + this.isrepeatfee = 1 + } + } + if (this.isrepeatfee == 0) { + this.TMPstoreDrChFee.add(memberyf); + } + } }; var jsonChFeeBody = ConvertFeeRecordsToJson(bodyDrChFeeDatas); }else if (type == '3') { - + this.TMPstoreDrChFee = Ext.create('Ext.data.Store', { + model: 'MsChFee', + remoteSort: false + }); for (i = 0; i < this.storeDrChFee.getCount(); i += 1) { var memberyf = this.storeDrChFee.getAt(i); if (memberyf.data.Currency ==LOCALCURR&&memberyf.data.ExChangerate!=1) { @@ -7333,6 +7380,18 @@ Ext.extend(Shipping.FeeEditGrid, Ext.Panel, { bodyDrChFeeDatas.push(memberyf); var amount = memberyf.data.Amount; var ExChangerate = memberyf.data.ExChangerate; + if (this.FEESAVENOTSAMEAMOUNT == 1) { + for (var j = 0; j < this.TMPstoreDrChFee.getCount(); j += 1) { + var memberbody = this.TMPstoreDrChFee.getAt(j); + if (memberbody.data.CustomerName == memberyf.data.CustomerName && memberbody.data.FeeName == memberyf.data.FeeName + && memberbody.data.Amount == memberyf.data.Amount && memberbody.data.Currency == memberyf.data.Currency) { + this.isrepeatfee = 1 + } + } + if (this.isrepeatfee == 0) { + this.TMPstoreDrChFee.add(memberyf); + } + } }; var jsonChFeeBody = ConvertFeeRecordsToJson(bodyDrChFeeDatas); @@ -7343,69 +7402,96 @@ Ext.extend(Shipping.FeeEditGrid, Ext.Panel, { Ext.Msg.show({ title: Zi.LAN.FEE.ChuoWu, msg: '请先保存业务信息!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } - Ext.Msg.wait(Zi.LAN.FEE.ZhengZaiCaoZuoShuJu); - Ext.Ajax.request({ - waitMsg: Zi.LAN.FEE.ZhengZaiCaoZuoShuJu, //'正在保存数据...', - url: '/MvcShipping/MsChFee/Save', - scope: this, - params: { - bsno: _thisfee.strBSNO, - type: type, - chfeebody: jsonChFeeBody - }, - callback: function (options, success, response) { - if (success) { - Ext.MessageBox.hide(); - var jsonresult = Ext.JSON.decode(response.responseText); - if (jsonresult.Success) { - // if (type == '1') { - // for (var i = 0; i < this.storeDrChFee.getCount(); i += 1) { - // var member = this.storeDrChFee.getAt(i); - // member.set("BsNo", _thisfee.strBSNO); - // member.commit(); - // } - //// this.gridDrChFee.unSelectAll(); - // } else if (type == '2') { - // for (var i = 0; i < this.storeCrChFee.getCount(); i += 1) { - // var member = this.storeCrChFee.getAt(i); - // member.set("BsNo", _thisfee.strBSNO); - // member.commit(); - // } - //// this.gridCrChFee.unSelectAll(); - - // } + if (this.FEESAVENOTSAMEAMOUNT == 1 && this.isrepeatfee == 1) { + Ext.MessageBox.confirm('提示', '结算对象,金额,币别,费用名称,相同,确定保存?', function (btn) { + if (btn == 'yes') { + Ext.Msg.wait(Zi.LAN.FEE.ZhengZaiCaoZuoShuJu); + Ext.Ajax.request({ + waitMsg: Zi.LAN.FEE.ZhengZaiCaoZuoShuJu, //'正在保存数据...', + url: '/MvcShipping/MsChFee/Save', + scope: this, + params: { + bsno: _thisfee.strBSNO, + type: type, + chfeebody: jsonChFeeBody + }, + callback: function (options, success, response) { + if (success) { + Ext.MessageBox.hide(); + var jsonresult = Ext.JSON.decode(response.responseText); + if (jsonresult.Success) { - if (type == 1) { - _thisfee.LoadDrChFee(); - } else if (type == 2) { - _thisfee.LoadCrChFee(); - } else { - _thisfee.LoadDrChFee(); - _thisfee.LoadCrChFee(); + if (type == 1) { + _thisfee.LoadDrChFee(); + } else if (type == 2) { + _thisfee.LoadCrChFee(); + } else { + _thisfee.LoadDrChFee(); + _thisfee.LoadCrChFee(); + } + } else { + Ext.Msg.show({ title: Zi.LAN.FEE.ChuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); + } + } else { + Ext.Msg.show({ + title: Zi.LAN.FEE.TiShi, + msg: Zi.LAN.FEE.FuWuQiXiangYingChuCuo, + icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK + }); + } + } + }); + } else { + return false; + } + }) + } else { + Ext.Msg.wait(Zi.LAN.FEE.ZhengZaiCaoZuoShuJu); + Ext.Ajax.request({ + waitMsg: Zi.LAN.FEE.ZhengZaiCaoZuoShuJu, //'正在保存数据...', + url: '/MvcShipping/MsChFee/Save', + scope: this, + params: { + bsno: _thisfee.strBSNO, + type: type, + chfeebody: jsonChFeeBody + }, + callback: function (options, success, response) { + if (success) { + Ext.MessageBox.hide(); + var jsonresult = Ext.JSON.decode(response.responseText); + if (jsonresult.Success) { + + if (type == 1) { + _thisfee.LoadDrChFee(); + } else if (type == 2) { + _thisfee.LoadCrChFee(); + } else { + _thisfee.LoadDrChFee(); + _thisfee.LoadCrChFee(); + + } + } else { + Ext.Msg.show({ title: Zi.LAN.FEE.ChuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } - //this.storeChFeeGain.load({ params: { bsno: _thisfee.strBSNO, optype: _thisfee.stroplb } }); - //this.storeChFeeMasterGain.load({ params: { bsno: _thisfee.strBSNO, optype: _thisfee.stroplb } }); - //this.storeBodySum.load({ params: { bsno: _thisfee.strBSNO, optype: _thisfee.stroplb }, - // callback: function (r, options, success) { - // if (success) { - // _thisfee.setTotalHead(); - // } - // } - //}); } else { - Ext.Msg.show({ title: Zi.LAN.FEE.ChuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); + Ext.Msg.show({ + title: Zi.LAN.FEE.TiShi, + msg: Zi.LAN.FEE.FuWuQiXiangYingChuCuo, + icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK + }); } - } else { - Ext.Msg.show({ title: Zi.LAN.FEE.TiShi, - msg: Zi.LAN.FEE.FuWuQiXiangYingChuCuo, - icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK - }); } - } - }); + }); + } + + + }, //end save + + onShenModifyClick: function (button, event, type) { var allow = this.getAllowOperationDetail();