diff --git a/DSWeb/Areas/MvcShipping/Controllers/MsCodeFeeTemplateAgentController.cs b/DSWeb/Areas/MvcShipping/Controllers/MsCodeFeeTemplateAgentController.cs index 0083f7dc..a4d7d3d5 100644 --- a/DSWeb/Areas/MvcShipping/Controllers/MsCodeFeeTemplateAgentController.cs +++ b/DSWeb/Areas/MvcShipping/Controllers/MsCodeFeeTemplateAgentController.cs @@ -132,6 +132,15 @@ namespace DSWeb.MvcShipping.Controllers return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } + public ContentResult DeleteDetail(string GID) + { + + DBResult result = MsCodeFeeTempldateAgentDAL.DeleteTemplateDetail(GID); + + var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; + return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; + } + public ContentResult GetFeeUnit(string condition) { var dataList = MsCodeFeeTempldateAgentDAL.GetFeeUnit(condition); diff --git a/DSWeb/Areas/MvcShipping/DAL/MsChFee/MsChFeeDAL.cs b/DSWeb/Areas/MvcShipping/DAL/MsChFee/MsChFeeDAL.cs index 5b725355..46cb4f2c 100644 --- a/DSWeb/Areas/MvcShipping/DAL/MsChFee/MsChFeeDAL.cs +++ b/DSWeb/Areas/MvcShipping/DAL/MsChFee/MsChFeeDAL.cs @@ -2911,6 +2911,26 @@ namespace DSWeb.MvcShipping.DAL.MsChFeeDAL feejztondata.QUANTITY = jzton; bodyList.Add(feejztondata); + decimal JFton = Math.Round(KGS * Convert.ToDecimal(0.0025), 3, MidpointRounding.AwayFromZero); + if (ton > CBM) + { + + var feetondata = new MsFeeUnit(); + feetondata.SUNIT = "PXJF-拼箱JF"; + feetondata.UNIT = "拼箱JF"; + feetondata.QUANTITY = JFton; + bodyList.Add(feetondata); + } + else + { + + var feetondata = new MsFeeUnit(); + feetondata.SUNIT = "PXJF-拼箱JF"; + feetondata.UNIT = "拼箱JF"; + feetondata.QUANTITY = CBM; + bodyList.Add(feetondata); + } + } if (Convert.ToString(reader["CTNALL"]) != "") { diff --git a/DSWeb/Areas/MvcShipping/DAL/MsCodeFeeTemplateAgent/MsCodeFeeTemplateAgentDAL.cs b/DSWeb/Areas/MvcShipping/DAL/MsCodeFeeTemplateAgent/MsCodeFeeTemplateAgentDAL.cs index 4df918a2..eca0b59b 100644 --- a/DSWeb/Areas/MvcShipping/DAL/MsCodeFeeTemplateAgent/MsCodeFeeTemplateAgentDAL.cs +++ b/DSWeb/Areas/MvcShipping/DAL/MsCodeFeeTemplateAgent/MsCodeFeeTemplateAgentDAL.cs @@ -290,7 +290,41 @@ namespace DSWeb.MvcShipping.DAL.MsCodeFeeTemplateAgent return result; } + public static DBResult DeleteTemplateDetail(string GID) + { + var result = new DBResult(); + + Database db = DatabaseFactory.CreateDatabase(); + using (var conn = db.CreateConnection()) + { + conn.Open(); + var tran = conn.BeginTransaction(); + + try + { + + var cmdDelete = db.GetSqlStringCommand("delete from code_fee_template_agentdetail where GID='" + GID + "'"); + db.ExecuteNonQuery(cmdDelete, tran); + + + tran.Commit(); + } + catch (Exception) + { + tran.Rollback(); + + result.Success = false; + result.Message = "保存出现错误,请重试或联系系统管理员"; + + return result; + } + } + + result.Success = true; + result.Message = "保存成功"; + return result; + } public static DBResult DeleteDetail(CodeFeeTemplateAgent headData) { diff --git a/DSWeb/Areas/MvcShipping/Viewsjs/MsCodeFeeTemplateAgent/MsCodeFeeTemplateAgentEdit.js b/DSWeb/Areas/MvcShipping/Viewsjs/MsCodeFeeTemplateAgent/MsCodeFeeTemplateAgentEdit.js index 870de1db..f092532e 100644 --- a/DSWeb/Areas/MvcShipping/Viewsjs/MsCodeFeeTemplateAgent/MsCodeFeeTemplateAgentEdit.js +++ b/DSWeb/Areas/MvcShipping/Viewsjs/MsCodeFeeTemplateAgent/MsCodeFeeTemplateAgentEdit.js @@ -837,14 +837,46 @@ Ext.extend(Shipping.MsCodeFeeTemplateAgentEdit, Ext.Panel, { deleteDetail: function (type) { - var selectedRecords = this.gridList.selModel.getSelection(); - - for (var i = 0; i < selectedRecords.length; i++) { - var rec = selectedRecords[i]; - - this.storeBodyList.remove(rec); + + var selections = this.gridList.getSelectionModel().getSelection(); + if (selections.length == 0) { + Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; } + var record = selections[0]; + var GID = record.data.GID; + Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) { + if (btn == 'yes') { + Ext.Msg.wait('正在删除数据...'); + Ext.Ajax.request({ + waitMsg: '正在删除数据...', + url: '/MvcShipping/MsCodeFeeTemplateAgent/DeleteDetail', + params: { + GID: GID + }, + callback: function (options, success, response) { + if (success) { + var jsonresult = Ext.JSON.decode(response.responseText); + if (jsonresult.Success) { + this.storeBodyList.remove(record); + Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + } + else { + Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); + } + } + }, + failure: function (response, options) { + Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + }, + success: function (response, options) { + }, + scope: this + }); //end Ext.Ajax.request + } + }, this); + } });