public static Dictionary <string, DataTable> SetBusinessDataTable <T>(T t, string TableName, string objectName, string Upstream, out string DJBH) where T : class { var sql = string.Empty; DataTable tb = null; Dictionary <string, object> ListName = null; DJBH = string.Empty; switch (objectName) { #region //库存调整单 case "Regulation": //库存 { Regulation retail = t as Regulation; if (string.IsNullOrWhiteSpace(retail.DM2_1)) { retail.DM2_1 = InvoicesManage.GetCKKW(retail.DM2); //仓库库位 } if (string.IsNullOrEmpty(retail.BYZD12)) { retail.BYZD12 = "0.0000"; } if (string.IsNullOrEmpty(retail.QDDM)) { retail.QDDM = InvoicesManage.GetCANGKUValue("QDDM", retail.DM2); } if (string.IsNullOrWhiteSpace(retail.DJBH)) { retail.DJBH = InvoicesManage.GetNewDJBH(TableName, retail.QDDM, retail.DM2, retail.YDJH); } retail.BYZD1 = InvoicesManage.GetJGSD(InvoicesManage.GetCANGKUValue("JGSD", retail.DM2)).ToString(); retail.DM1 = "000"; retail.DJXZ = "0"; retail.YGDM = InvoicesManage.GetCANGKUValue("YGDM", retail.DM2); retail.BYZD5 = retail.BYZD1; retail.JZ = "0"; retail.RQ_4 = DateTime.Now; retail.SHRQ = retail.RQ.ToString(); retail.YSRQ = retail.RQ.ToString(); retail.YGDM = InvoicesManage.GetCANGKUValue("YGDM", retail.DM2); DJBH = retail.DJBH; ListName = RequestBuilder.getProperties <Regulation>(retail, objectName); break; } #endregion } tb = InvoicesManage.SetDataTable(ListName, TableName); if ("SG_Gathering".Equals(objectName)) { tb.PrimaryKey = new DataColumn[] { tb.Columns["vMBillID"] } } ; else { tb.PrimaryKey = new DataColumn[] { tb.Columns["DJBH"] } }; sql = InvoicesManage.SetSQLValue(ListName, TableName, "", objectName); Dictionary <string, DataTable> dic = new Dictionary <string, DataTable>(); dic.Add(sql, tb); return(dic); }
public static string SetInvoicesBusiness <T>(T t, string TableName, string objectName, string DJBH) where T : class { var sql = string.Empty; Dictionary <string, object> ListName = null; switch (objectName) { case "PurchaseDetail": { PurchaseDetail sggatherings = t as PurchaseDetail; ListName = RequestBuilder.getProperties <PurchaseDetail>(sggatherings, objectName); break; } } sql = InvoicesManage.SetSQLValue(ListName, TableName, DJBH, ""); return(sql); }