using Kingdee.BOS.Orm.DataEntity; using Kingdee.BOS.Util; using Kingdee.K3.FIN.AP.ServiceHelper; using Kingdee.K3.FIN.Core; using Kingdee.K3.FIN.ServiceHelper; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; namespace CYG.AutoWriteOffWizardEditPlugInEx.FIN.AP.Business.PlugIn { [Description("转销处理"),HotUpdate] public class AutoWriteOffWizardEditEx : FIN.Business.PlugIn.Match.AutoWriteOffWizardEditEx { private List _startOrgIds = new List(); protected override Dictionary GetOrgStartDate(List settleOrgs, string matchType) { string cateGory = "AP"; string sKey = "APStartDate"; if (base.View.Model.DataObject["FBillList"].ToString() == "2") { cateGory = "CN"; sKey = "CNStartDate"; } else { switch (matchType) { case "1": cateGory = "AP"; sKey = "APStartDate"; break; case "3": cateGory = "AR"; sKey = "ARStartDate"; break; } } DynamicObjectCollection paramterByCtgOrgAcct = CommonServiceHelper.GetParamterByCtgOrgAcct(base.Context, cateGory, 0L, settleOrgs, sKey); Dictionary dictionary = new Dictionary(); foreach (DynamicObject item in paramterByCtgOrgAcct) { long num = Convert.ToInt64(item["FOrgID"]); _startOrgIds.Add(num); dictionary.AddWithoutExists(num, Convert.ToDateTime(item["FValue"])); } return dictionary; } protected override Dictionary GetOrgLastestCloseAccountDate(List settleOrgs, string matchType) { Dictionary dictionary = new Dictionary(); string text = "AP"; switch (matchType) { case "1": text = "AP"; break; case "3": text = "AR"; break; } DynamicObjectCollection lastestCloseAcctDate = ClosingAccountServiceHelper.GetLastestCloseAcctDate(base.Context, settleOrgs, text); if (base.View.Model.DataObject["FBillList"].ToString() == "2") { DynamicObjectCollection paramterByCtgOrgAcct = CommonServiceHelper.GetParamterByCtgOrgAcct(base.Context, "CN", 0L, settleOrgs, "CNCloseAcctEndDate"); foreach (DynamicObject item in paramterByCtgOrgAcct) { dictionary.AddWithoutExists(Convert.ToInt64(item["FOrgID"]), Convert.ToDateTime(item["FValue"])); } foreach (DynamicObject item2 in lastestCloseAcctDate) { long key = Convert.ToInt64(item2["FOrgID"]); if (dictionary.ContainsKey(key)) { DateTime value = Convert.ToDateTime(item2["FEndDate"]); if (value.CompareTo(dictionary[key]) > 0) { dictionary[key] = value; } } else { dictionary.Add(Convert.ToInt64(item2["FOrgID"]), Convert.ToDateTime(item2["FEndDate"])); } } } else { foreach (DynamicObject item3 in lastestCloseAcctDate) { dictionary.AddWithoutExists(Convert.ToInt64(item3["FOrgID"]), Convert.ToDateTime(item3["FEndDate"])); } } return dictionary; } } }