From 67d777aad5a06165918751145000196c534f83fb Mon Sep 17 00:00:00 2001 From: ddlucky Date: Thu, 18 Jul 2024 14:57:43 +0800 Subject: [PATCH] 20240718 --- DSWeb/Areas/CommMng/DAL/PubSysDAL.cs | 2 +- DSWeb/Areas/CommMng/Models/PubSysModel.cs | 147 ++++++++++++---------- 2 files changed, 85 insertions(+), 64 deletions(-) diff --git a/DSWeb/Areas/CommMng/DAL/PubSysDAL.cs b/DSWeb/Areas/CommMng/DAL/PubSysDAL.cs index ecb98a4..b77b816 100644 --- a/DSWeb/Areas/CommMng/DAL/PubSysDAL.cs +++ b/DSWeb/Areas/CommMng/DAL/PubSysDAL.cs @@ -2859,7 +2859,7 @@ namespace DSWeb.Areas.CommMng.DAL return; } - var cdc = new CommonDataContext(); + //var cdc = new CommonDataContext(); try { var result= hp.GetFee(); diff --git a/DSWeb/Areas/CommMng/Models/PubSysModel.cs b/DSWeb/Areas/CommMng/Models/PubSysModel.cs index c1ad64f..6766f61 100644 --- a/DSWeb/Areas/CommMng/Models/PubSysModel.cs +++ b/DSWeb/Areas/CommMng/Models/PubSysModel.cs @@ -465,10 +465,29 @@ namespace DSWeb.Areas.CommMng.Models return result; } - var 单证费 = Convert.ToDecimal( BillHead.bill_details.FirstOrDefault(x => x.cost_name == "单证费").cost_amount); - + var 单证费 = 0M; var 单证费原值 = 单证费; + if (BillHead.bill_details.Exists(x => x.cost_name == "单证费")) + { + 单证费=Convert.ToDecimal(BillHead.bill_details.FirstOrDefault(x => x.cost_name == "单证费").cost_amount); + + 单证费原值 = 单证费; + } + else + if (BillHead.bill_details.Exists(x => x.cost_name == "出口码头操作费--THC")) + { + 单证费=Convert.ToDecimal(BillHead.bill_details.FirstOrDefault(x => x.cost_name == "出口码头操作费--THC").cost_amount); + + 单证费原值 = 单证费; + } + else if (BillHead.bill_details.Exists(x => x.cost_name == "出口码头操作费")) + { + 单证费=Convert.ToDecimal(BillHead.bill_details.FirstOrDefault(x => x.cost_name == "出口码头操作费").cost_amount); + + 单证费原值 = 单证费; + } + var 单证费List = new List(); void add单证费(ch_fee_md newfee,op_ctn_md ctn) @@ -882,6 +901,9 @@ namespace DSWeb.Areas.CommMng.Models 《3》:是否区分大小柜?此类属于不符合规则,则按票回写" */ + + //2024-718 东南亚航线 没有单证费 没有码头操作费 只有出口码头操作费 + var 此模块需要对应的账单报文中费用名称List = GetBillFeeName("出口码头操作费"); if (!BillHead.bill_details.Exists(x => 此模块需要对应的账单报文中费用名称List.Contains( x.cost_name )) || !(ctnList != null && ctnList.Count > 0)) @@ -895,27 +917,27 @@ namespace DSWeb.Areas.CommMng.Models var 码头操作费List = new List(); - void 码头操作费Add(op_ctn_md ctn, decimal price) + void 码头操作费Add(op_ctn_md ctn, decimal price,string FEENAME= "码头操作费") { var ctnnum = ctn.CTNNUM == null ? 0 : (Int32)ctn.CTNNUM; var amount = price * ctnnum; if (总Amount >= price) { - if (码头操作费List.Exists(x => x.UNIT == ctn.CTNALL && x.UNITPRICE == price)) + if (码头操作费List.Exists(x => x.UNIT == ctn.CTNALL && x.UNITPRICE == price && x.FEENAME== FEENAME)) { - 码头操作费List.First(x => x.UNIT == ctn.CTNALL && x.UNITPRICE == price).QUANTITY += ctnnum; - 码头操作费List.First(x => x.UNIT == ctn.CTNALL && x.UNITPRICE == price).AMOUNT += amount; + 码头操作费List.First(x => x.UNIT == ctn.CTNALL && x.UNITPRICE == price && x.FEENAME == FEENAME).QUANTITY += ctnnum; + 码头操作费List.First(x => x.UNIT == ctn.CTNALL && x.UNITPRICE == price && x.FEENAME == FEENAME).AMOUNT += amount; - 码头操作费List.First(x => x.UNIT == ctn.CTNALL && x.UNITPRICE == price).REMARK += ";" + ctn.CNTRNO; - 码头操作费List.First(x => x.UNIT == ctn.CTNALL && x.UNITPRICE == price).setTax(); + 码头操作费List.First(x => x.UNIT == ctn.CTNALL && x.UNITPRICE == price && x.FEENAME == FEENAME).REMARK += ";" + ctn.CNTRNO; + 码头操作费List.First(x => x.UNIT == ctn.CTNALL && x.UNITPRICE == price && x.FEENAME == FEENAME).setTax(); } else { //var 码头操作费 = MsChFeeDAL.getChFee(OP.GID, head.BSNO, head.FORWARDER, 2, "码头操作费", price, ctn.CTNALL, 1, "", ctn.CNTRNO); - var 码头操作费 = MsChFeeDAL.getChFee(OP.GID, head.BSNO, head.FORWARDER, 2, "码头操作费", amount, ctn.CTNALL, ctnnum, "", ctn.CNTRNO); + var 码头操作费 = MsChFeeDAL.getChFee(OP.GID, head.BSNO, head.FORWARDER, 2, FEENAME, amount, ctn.CTNALL, ctnnum, "", ctn.CNTRNO); 码头操作费List.Add(码头操作费); } - 总Amount -= price; + 总Amount -= amount; } else { @@ -967,61 +989,9 @@ namespace DSWeb.Areas.CommMng.Models var newfee = MsChFeeDAL.getChFee(OP.GID, head.BSNO, head.FORWARDER, 2, feename, 单证费price, "单票", 1); 出口码头操作费Add(newfee); } - //var 高雄20 = GetPrice("高雄20"); - //var 高雄40 = GetPrice("高雄40"); - //var 高雄20RH = GetPrice("高雄20RH"); - //var 高雄40RH = GetPrice("高雄40RH"); - //var ctn20 = GetPrice("20"); - //var ctn40 = GetPrice("40"); - //var All40RH = GetPrice("40RH"); + - //if (head.PORTDISCHARGE == "KAOHSIUNG") - //if (台湾价格港口.Exists(x=>x.EnumValueName== head.PORTDISCHARGE)) - //{ - // foreach (var ctn in ctnList) - // { - // if (ctn.CTNALL == "20RH") - // { - // 码头操作费Add(ctn, 高雄20RH); - // } - // else - // if (ctn.CTNALL == "40RH") - // { - // 码头操作费Add(ctn, 高雄40RH); - // } - // else - // if (ctn.SIZE == "40") - // { - // 码头操作费Add(ctn, 高雄20); - // } - // else - // if (ctn.SIZE == "20") - // { - // 码头操作费Add(ctn, 高雄40); - // } - // } - //} - //else - //{ - // foreach (var ctn in ctnList) - // { - // if (ctn.CTNALL == "40RH") - // { - // 码头操作费Add(ctn, All40RH); - // } - // else - // if (ctn.SIZE == "40") - // { - // 码头操作费Add(ctn, ctn40); - // } - // else - // if (ctn.SIZE == "20") - // { - // 码头操作费Add(ctn, ctn20); - // } - // } - //} var price = 0M; @@ -1076,8 +1046,59 @@ namespace DSWeb.Areas.CommMng.Models } } + if (总Amount > 0) { + //代表存在剩余尾数 先尝试处理铅封费信息费 + + var 铅封费price = GetPrice("铅封费"); + var 信息费price = GetPrice("信息费"); + + if (总Amount < CtnNum * (铅封费price + 信息费price)) + { + foreach (var ctn in ctnList) + { + //var newfee = MsChFeeDAL.getChFee(OP.GID, head.BSNO, head.FORWARDER, 2, "海运费", 单价 * (decimal)ctn.CTNNUM, ctn.CTNALL, (decimal)ctn.CTNNUM); + + var 铅封费 = MsChFeeDAL.getChFee(OP.GID, head.BSNO, head.FORWARDER, 2, "铅封费", 铅封费price * (decimal)ctn.CTNNUM, ctn.CTNALL, (decimal)ctn.CTNNUM); + + //var 信息费 = MsChFeeDAL.getChFee(OP.GID, head.BSNO, head.FORWARDER, 2, "信息费", 信息费price * (decimal)ctn.CTNNUM, ctn.CTNALL, (decimal)ctn.CTNNUM); + + //SetUsd(ref 铅封费); + //SetUsd(ref 信息费); + + 码头操作费Add( ctn, 铅封费price, "铅封费"); + //add单证费(信息费, ctn); + } + } + else + { + + + foreach (var ctn in ctnList) + { + //var newfee = MsChFeeDAL.getChFee(OP.GID, head.BSNO, head.FORWARDER, 2, "海运费", 单价 * (decimal)ctn.CTNNUM, ctn.CTNALL, (decimal)ctn.CTNNUM); + + var 铅封费 = MsChFeeDAL.getChFee(OP.GID, head.BSNO, head.FORWARDER, 2, "铅封费", 铅封费price * (decimal)ctn.CTNNUM, ctn.CTNALL, (decimal)ctn.CTNNUM); + + var 信息费 = MsChFeeDAL.getChFee(OP.GID, head.BSNO, head.FORWARDER, 2, "信息费", 信息费price * (decimal)ctn.CTNNUM, ctn.CTNALL, (decimal)ctn.CTNNUM); + + //SetUsd(ref 铅封费); + //SetUsd(ref 信息费); + + 码头操作费Add(ctn, 铅封费price, "铅封费"); + 码头操作费Add(ctn, 信息费price, "信息费"); + } + } + } + + if (总Amount > 0) { + //var feename = GetFeeName("码头操作费"); + var newfee = MsChFeeDAL.getChFee(OP.GID, head.BSNO, head.FORWARDER, 2, "码头操作费", 总Amount, "单票", 1); + 出口码头操作费Add(newfee); + } + addfee(码头操作费List); + return result; }