/// <summary>МЕТОД Формирование Запроса</summary> protected override string MET_SelectQuery() { return(MyQuery.MET_ListShablon_Select_2("", "par")); }
/// <summary>МЕТОД Формирование Запроса</summary> protected override string MET_SelectQuery() { return(MyQuery.MET_varFindPac_Select_1(PRI_FIO, PRI_Cod, PRI_Tip, PRI_D1, PRI_D2)); }
/// <summary> /// Retorna as entidades de transações não lida pelo SAP. /// </summary> /// <param name="JOMAR_OrderNum">Número de Ordem Jomar (0 todos)</param> /// <returns></returns> public static List <T38Entity> GetDados(int JOMAR_OrderNum = 0) { var transacoes = new List <T38Entity>(); using (var conn = new MyRecordSet()) { if (JOMAR_OrderNum > 0) { conn.DoQuery("SELECT * FROM [Sage_Transaction38] WITH (NOLOCK) WHERE TransactionType = '38' AND [JOMAR_OrderNum] = '{0}' AND (WOR1_DocNum IS NULL OR WOR1_DocNum = 0)", JOMAR_OrderNum); } else { conn.DoQuery("SELECT * FROM [Sage_Transaction38] T0 WITH (NOLOCK) inner join OITM T1 on T1.CodeBars = T0.oitm_Codebars inner join OWOR T3 on T3.U_ORDER_JOMAR = T0.Jomar_OrderNum inner join WOR1 T2 on T2.DocEntry = T3.DocEntry and T2.itemcode = T1.ItemCode WHERE TransactionType = '38' AND [ReadBySAP] <> 'Y' AND (OIGE_DocNum IS NULL OR OIGE_DocNum = 0) order by T0.Jomar_OrderNum "); //(WOR1_DocNum IS NULL OR WOR1_DocNum = 0) AND } principal.GravaAudit("Inicio While "); while (conn.HasNext()) { var t38 = new T38Entity(); try { principal.GravaAudit(conn.GetFieldValue("JOMAR_OrderNum").ToString()); t38.Id = conn.GetFieldValue("Id").ToInt(); t38.AddDate = conn.GetFieldValue("AddDate").ToDate(); t38.Update_CodeBars = conn.GetFieldValue("Update_CodeBars").ToChar(); t38.TransactionType = conn.GetFieldValue("TransactionType").ToInt(); t38.ReadBySAP = conn.GetFieldValue("ReadBySAP").ToChar(); t38.JOMAR_OrderNum = conn.GetFieldValue("JOMAR_OrderNum").ToString(); t38.WOR1_DocNum = conn.GetFieldValue("WOR1_DocNum").ToInt(); t38.To_WareHouse = "PP"; t38.From_WareHouse = conn.GetFieldValue("WOR1_WareHouse").ToString(); t38.OITM_CodeBars = conn.GetFieldValue("OITM_CodeBars").ToString(); t38.JOMAR_LineNum = conn.GetFieldValue("JOMAR_LineNum").ToInt(); t38.WOR1_BaseQty = conn.GetFieldValue("WOR1_BaseQty").ToDouble(); t38.WOR1_PlannedQty = conn.GetFieldValue("WOR1_PlannedQty").ToDouble(); t38.IGE1_Quantity = conn.GetFieldValue("IGE1_Quantity").ToDouble(); t38.OWOR_DocNum = MyQuery.GetValue("OWOR", t38.JOMAR_OrderNum, "U_ORDER_JOMAR", "DocNum").ToInt(); principal.GravaAudit("Existe OPs " + t38.OWOR_DocNum); if ((Program.contador % 2) == 0) { //if (t38.ReadBySAP != 'E') transacoes.Add(t38); } else { transacoes.Add(t38); } } catch (Exception ex) { t38.ReadBySAP = 'E'; t38.MSG_SAP = ex.Message; UpdateStatus(t38); principal.GravaAudit("Transação 38 - " + t38.Id.ToString() + " " + ex.Message.ToString()); } } principal.GravaAudit("Termino While"); return(transacoes); } }