107 lines
3.9 KiB
C#
107 lines
3.9 KiB
C#
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<long> _startOrgIds = new List<long>();
|
|
|
|
protected override Dictionary<long, DateTime> GetOrgStartDate(List<long> 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<long, DateTime> dictionary = new Dictionary<long, DateTime>();
|
|
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<long, DateTime> GetOrgLastestCloseAccountDate(List<long> settleOrgs, string matchType)
|
|
{
|
|
Dictionary<long, DateTime> dictionary = new Dictionary<long, DateTime>();
|
|
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;
|
|
}
|
|
}
|
|
}
|