/// <summary> /// 批量调价单和销售价目表的对照表 /// </summary> /// <param name="entry"></param> /// <returns></returns> private Dictionary <string, string> Match(K3BatchAdjustEntry entry) { Dictionary <string, string> dict = new Dictionary <string, string>(); dict.Add(entry.F_HS_AfterUSPrice, "F_HS_USPrice"); dict.Add(entry.F_HS_AfterUSNoPostagePrice, "F_HS_USNoPostagePrice"); dict.Add(entry.F_HS_AfterAUPrice, "F_HS_AUPrice"); dict.Add(entry.F_HS_AfterAUNoPostagePrice, "F_HS_AUNoPostagePrice"); dict.Add(entry.F_HS_AfterEUPrice, "F_HS_EUPrice"); return(dict); }
/// <summary> /// 调价单明细 /// </summary> /// <param name="ctx"></param> /// <param name="obj"></param> /// <returns></returns> private List <K3BatchAdjustEntry> GetK3BatchAdjustEntry(Context ctx, DynamicObject obj) { DynamicObjectCollection coll = obj["SAL_BATCHADJUSTENTRY"] as DynamicObjectCollection; K3BatchAdjustEntry entry = null; List <K3BatchAdjustEntry> entrys = null; if (entrys == null || entrys.Count == 0) { if (coll != null && coll.Count > 0) { entrys = new List <K3BatchAdjustEntry>(); foreach (var item in coll) { if (item != null) { bool entryInSync = Convert.ToBoolean(SQLUtils.GetFieldValue(item, "F_HS_YNEntryInSync")); if (!entryInSync) { entry = new K3BatchAdjustEntry(); entry.FEntryId = Convert.ToInt32(SQLUtils.GetFieldValue(item, "Id")); entry.FAdjustType = SQLUtils.GetFieldValue(item, "AdjustType"); entry.FAfterPrice = SQLUtils.GetFieldValue(item, "AfterPrice").Equals("0") ? "" : SQLUtils.GetFieldValue(item, "AfterPrice"); DynamicObject price = item["PriceListId"] as DynamicObject; entry.FPriceListId = SQLUtils.GetFieldValue(price, "Number"); entry.FPriceLevel = SQLUtils.GetFieldValue(price, "Name"); DynamicObject currency = price["CurrencyId"] as DynamicObject; entry.FCurrencyId = SQLUtils.GetFieldValue(currency, "Number"); DynamicObject material = item["MaterialId"] as DynamicObject; entry.FMaterialId = SQLUtils.GetFieldValue(material, "Number"); if (this.Direction == SynchroDirection.ToB2B) { Material mat = SQLUtils.GetMaterial(ctx, entry.FMaterialId); if (mat != null) { entry.F_HS_IsOil = mat.F_HS_IsOil; entry.F_HS_PRODUCTSTATUS = mat.F_HS_PRODUCTSTATUS; entry.F_HS_DropShipOrderPrefix = mat.F_HS_DropShipOrderPrefix; } } entry.FAfterEffDate = Convert.ToDateTime(SQLUtils.GetFieldValue(item, "AfterEffDate")).ToString("yyyy-MM-dd"); entry.FAfterUnEffDate = Convert.ToDateTime(SQLUtils.GetFieldValue(item, "AfterUnEffDate")).ToString("yyyy-MM-dd");; DynamicObject plst = item["PriceListId"] as DynamicObject; entry.F_HS_YNSpecialPrice = Convert.ToBoolean(SQLUtils.GetFieldValue(plst, "F_HS_YNSpecialPrice")); entry.F_HS_YNEntryInSync = entryInSync; if (!entry.F_HS_YNSpecialPrice) { //如果批量调价单调的特价价目表,则忽略调后美国包邮单价、调后澳洲包邮单价、调后美国不包邮单价、调后澳洲不包邮单价、调后欧洲单价的同步 entry.F_HS_AfterUSPrice = SQLUtils.GetFieldValue(item, "F_HS_AfterUSPrice").Equals("0") ? "" : SQLUtils.GetFieldValue(item, "F_HS_AfterUSPrice"); entry.F_HS_AfterAUPrice = SQLUtils.GetFieldValue(item, "F_HS_AfterAUPrice").Equals("0") ? "" : SQLUtils.GetFieldValue(item, "F_HS_AfterAUPrice"); entry.F_HS_AfterEUPrice = SQLUtils.GetFieldValue(item, "F_HS_AfterEUPrice").Equals("0") ? "" : SQLUtils.GetFieldValue(item, "F_HS_AfterEUPrice"); entry.F_HS_AfterUSNoPostagePrice = SQLUtils.GetFieldValue(item, "F_HS_AfterUSNoPostagePrice").Equals("0") ? "" : SQLUtils.GetFieldValue(item, "F_HS_AfterUSNoPostagePrice"); entry.F_HS_AfterAUNoPostagePrice = SQLUtils.GetFieldValue(item, "F_HS_AfterAUNoPostagePrice").Equals("0") ? "" : SQLUtils.GetFieldValue(item, "F_HS_AfterAUNoPostagePrice"); entry.F_HS_AfterJPNoPostagePrice = SQLUtils.GetFieldValue(item, "F_HS_AfterJPNoPostagePrice").Equals("0") ? "" : SQLUtils.GetFieldValue(item, "F_HS_AfterJPNoPostagePrice"); entry.F_HS_AfterKRNoPostagePrice = SQLUtils.GetFieldValue(item, "F_HS_AfterKRNoPostagePrice").Equals("0") ? "" : SQLUtils.GetFieldValue(item, "F_HS_AfterKRNoPostagePrice"); entry.F_HS_AfterUKNoPostagePrice = SQLUtils.GetFieldValue(item, "F_HS_AfterUKNoPostagePrice").Equals("0") ? "" : SQLUtils.GetFieldValue(item, "F_HS_AfterUKNoPostagePrice"); entry.F_HS_AfterDENoPostagePrice = SQLUtils.GetFieldValue(item, "F_HS_AfterDENoPostagePrice").Equals("0") ? "" : SQLUtils.GetFieldValue(item, "F_HS_AfterDENoPostagePrice"); entry.F_HS_AfterFRNoPostagePrice = SQLUtils.GetFieldValue(item, "F_HS_AfterFRNoPostagePrice").Equals("0") ? "" : SQLUtils.GetFieldValue(item, "F_HS_AfterFRNoPostagePrice"); entry.F_HS_AfterEUNoPostagePrice = SQLUtils.GetFieldValue(item, "F_HS_AfterEUNoPostagePrice").Equals("0") ? "" : SQLUtils.GetFieldValue(item, "F_HS_AfterEUNoPostagePrice"); double diffDate = GetDiffDate(DateTime.Now, Convert.ToDateTime(entry.FAfterUnEffDate)); if (diffDate >= 50) { entrys.Add(entry); } } else { entrys.Add(entry); } } } } } } if (entrys != null && entrys.Count > 0) { string prefix = SQLUtils.GetAUB2BDropShipOrderPrefix(ctx); if (this.Direction == SynchroDirection.ToB2B) { return(entrys.Where(m => m != null && !string.IsNullOrWhiteSpace(m.F_HS_IsOil) && ((!m.F_HS_PRODUCTSTATUS.Equals("SPTC") && m.F_HS_IsOil.Equals("3")) || (m.FMaterialId.Length == 13 && m.FMaterialId.Substring(m.FMaterialId.Length - 3, 3).Equals(prefix))) ).ToList()); } else { return(entrys.Where(m => m != null && !m.FMaterialId.Substring(m.FMaterialId.Length - 3, 3).Equals(prefix) ).ToList()); } } return(null); }