public async Task <IActionResult> GetCRMID(string id) { SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.BusinessPartners items = (SAPbobsCOM.BusinessPartners)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartners); SAPbobsCOM.SalesPersons seller = (SAPbobsCOM.SalesPersons)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oSalesPersons); SAPbobsCOM.PaymentTermsTypes payment = (SAPbobsCOM.PaymentTermsTypes)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPaymentTermsTypes); SAPbobsCOM.UserTable sboTable = (SAPbobsCOM.UserTable)context.oCompany.UserTables.Item("SO1_01FORMAPAGO"); JToken pagos = context.XMLTOJSON(sboTable.GetAsXML())["OCRD"]; if (items.GetByKey(id)) { JToken temp = context.XMLTOJSON(items.GetAsXML()); temp["OCRD"] = temp["OCRD"][0]; if (seller.GetByKey(temp["OCRD"]["SlpCode"].ToObject <int>())) { JToken temp2 = context.XMLTOJSON(seller.GetAsXML()); temp["OSLP"] = temp2["OSLP"][0]; } if (payment.GetByKey(temp["OCRD"]["GroupNum"].ToObject <int>())) { JToken temp3 = context.XMLTOJSON(payment.GetAsXML()); temp["OCTG"] = temp3["OCTG"][0]; } temp["PAGO"] = pagos; return(Ok(temp)); } return(NotFound("No Existe Contacto")); }
public async Task <IActionResult> Get(uint DocEntry) { SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); oRecSet.DoQuery($@" SELECT document.""DocEntry"", document.""DocNum"", to_char(to_date(SUBSTRING(document.""DocDate"", 0, 10), 'YYYY-MM-DD'), 'DD-MM-YYYY') as ""DocDate"", (case when document.""CANCELED"" = 'Y' then 'Cancelado' when document.""DocStatus"" = 'O' then 'Abierto' when document.""DocStatus"" = 'C' then 'Cerrado' else document.""DocStatus"" end) AS ""DocStatus"", warehouse.""WhsName"" FROM OIGN document LEFT JOIN NNM1 series ON series.""Series"" = document.""Series"" LEFT JOIN OWHS warehouse ON warehouse.""WhsCode"" = series.""SeriesName"" WHERE document.""DocEntry"" = '{DocEntry}';"); int rc = oRecSet.RecordCount; if (rc == 0) { return(NoContent()); } JToken temp = context.XMLTOJSON(oRecSet.GetAsXML())["OIGN"][0]; oRecSet.DoQuery($@" Select ""ItemCode"", ""Dscription"", ""Quantity"", ""UomCode"", ""InvQty"", ""UomCode2"" From IGN1 Where ""DocEntry"" = '{DocEntry}';"); oRecSet.MoveFirst(); temp["Lines"] = context.XMLTOJSON(oRecSet.GetAsXML())["IGN1"]; GoodsReceiptDetail output = temp.ToObject <GoodsReceiptDetail>(); //Force Garbage Collector. Recommendation by InterLatin Dude. SDK Problem with memory. GC.Collect(); GC.WaitForPendingFinalizers(); //var s1 = Stopwatch.StartNew(); //s1.Stop(); //const int _max = 1000000; //Console.WriteLine(((double)(s1.Elapsed.TotalMilliseconds * 1000 * 1000) / _max).ToString("0.00 ns")); return(Ok(output)); }
public async Task <IActionResult> GetDetail(int id) { SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); oRecSet.DoQuery(@" Select ord.""DocEntry"", ord.""DocNum"", ord.""DocCur"", ord.""DocTotal"", ord.""DocTotalFC"", to_char(to_date(SUBSTRING(ord.""DocDate"", 0, 10), 'YYYY-MM-DD'), 'DD-MM-YYYY') as ""DocDate"", to_char(to_date(SUBSTRING(ord.""DocDueDate"", 0, 10), 'YYYY-MM-DD'), 'DD-MM-YYYY') as ""DocDueDate"", to_char(to_date(SUBSTRING(ord.""CancelDate"", 0, 10), 'YYYY-MM-DD'), 'DD-MM-YYYY') as ""CancelDate"", (case when ord.""CANCELED"" = 'Y' then 'Cancelado' when ord.""DocStatus"" = 'O' then 'Abierto' when ord.""DocStatus"" = 'C' then 'Cerrado' else ord.""DocStatus"" end) AS ""DocStatus"", ord.""Comments"", contact.""CardCode"", contact.""CardName"", contact.""CardFName"", warehouse.""WhsName"" From OPDN ord LEFT JOIN NNM1 serie ON ord.""Series"" = serie.""Series"" LEFT JOIN OWHS warehouse ON serie.""SeriesName"" = warehouse.""WhsCode"" LEFT JOIN OCRD contact ON ord.""CardCode"" = contact.""CardCode"" WHERE ord.""DocEntry"" = '" + id + "'"); oRecSet.MoveFirst(); JToken purchaseOrder = context.XMLTOJSON(oRecSet.GetAsXML())["OPDN"][0]; oRecSet.DoQuery(@" Select ""ItemCode"", ""Dscription"", ""Price"", ""Currency"", ""Quantity"", ""UomCode"", ""InvQty"", ""UomCode2"", ""LineTotal"", ""TotalFrgn"" From PDN1 WHERE ""DocEntry"" = '" + id + "'"); oRecSet.MoveFirst(); purchaseOrder["rows"] = context.XMLTOJSON(oRecSet.GetAsXML())["PDN1"]; return(Ok(purchaseOrder)); }
public async Task <IActionResult> GetCRMClientToSell(string CardCode) { SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); oRecSet.DoQuery(@" Select ""CardCode"", ""CardName"", ""CardFName"", contact.""ListNum"", paymentTerm.""GroupNum"", paymentTerm.""PymntGroup"", paymentMethod.""PayMethCod"", paymentMethod.""Descript"", ""SlpName"", ""Balance"", ""ListName"" From OCRD contact JOIN OSLP seller ON contact.""SlpCode"" = seller.""SlpCode"" JOIN OCTG paymentTerm ON paymentTerm.""GroupNum"" = contact.""GroupNum"" JOIN OPLN priceList ON priceList.""ListNum"" = contact.""ListNum"" LEFT JOIN OPYM paymentMethod ON paymentMethod.""PayMethCod"" = contact.""PymCode"" Where ""CardCode"" = '" + CardCode + "'"); if (oRecSet.RecordCount == 0) { return(NoContent()); } JToken temp = context.XMLTOJSON(oRecSet.GetAsXML())["OCRD"][0]; oRecSet.DoQuery(@" Select paymentMethodCardCode.""PymCode"", paymentMethod.""Descript"" From CRD2 paymentMethodCardCode JOIN OPYM paymentMethod ON paymentMethod.""PayMethCod"" = paymentMethodCardCode.""PymCode"" Where ""CardCode"" = '" + CardCode + "'"); temp["PaymentMethods"] = context.XMLTOJSON(oRecSet.GetAsXML())["CRD2"]; ContactToSell ContactOutput = temp.ToObject <ContactToSell>(); //Force Garbage Collector. Recommendation by InterLatin Dude. SDK Problem with memory. GC.Collect(); GC.WaitForPendingFinalizers(); return(Ok(ContactOutput)); }
public async Task <IActionResult> Get(string WhsCode, string ItemCode) { SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); oRecSet.DoQuery($@" Select ""ManBtchNum"" From OITM Where ""ItemCode"" = '{ItemCode}';"); if (oRecSet.RecordCount == 0) { return(NoContent()); } string ManBtnNum = context.XMLTOJSON(oRecSet.GetAsXML())["OITM"][0]["ManBtchNum"].ToString(); if (ManBtnNum == "N") { oRecSet.DoQuery($@" Select ""OnHand"" From OITW Where ""WhsCode"" = '{WhsCode}' AND ""ItemCode"" = '{ItemCode}';"); double stock = context.XMLTOJSON(oRecSet.GetAsXML())["OITW"][0]["OnHand"].ToObject <double>(); return(Ok(new { value = "No Maneja Lote", stock })); } oRecSet.DoQuery($@" Select ""ItemCode"", ""BatchNum"", ""Quantity"", ""U_IL_CodBar"", ""CreateDate"" From OIBT Where ""Quantity"" != 0 AND ""ItemCode"" = '{ItemCode}' AND ""WhsCode"" = '{WhsCode}';"); oRecSet.MoveFirst(); JToken batchList = context.XMLTOJSON(oRecSet.GetAsXML())["OIBT"]; //Force Garbage Collector. Recommendation by InterLatin Dude. SDK Problem with memory. GC.Collect(); GC.WaitForPendingFinalizers(); return(Ok(batchList)); }
public async Task <IActionResult> Get(int id) { SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.StockTransfer transfer = (SAPbobsCOM.StockTransfer)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oStockTransfer); SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); oRecSet.DoQuery("Select * From OWTR WHERE \"DocNum\" = " + id); int rc = oRecSet.RecordCount; if (rc == 0) { return(NotFound()); } transfer.Browser.Recordset = oRecSet; transfer.Browser.MoveFirst(); JToken temp = context.XMLTOJSON(transfer.GetAsXML()); temp["OWTR"] = temp["OWTR"][0]; temp["AdmInfo"]?.Parent.Remove(); temp["WTR12"]?.Parent.Remove(); temp["BTNT"]?.Parent.Remove(); return(Ok(temp)); }
public async Task <IActionResult> GetTSRList() { SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); // Release WMS //oRecSet.DoQuery(@" // Select // warehouse.""WhsCode"" as ""WhsCodeTSR"", // warehouse2.""WhsCode"" as ""WhsCode"", // warehouse.""WhsName"" // From OWHS warehouse // JOIN OWHS warehouse2 ON warehouse.""WhsName"" = warehouse2.""WhsName"" AND warehouse.""WhsCode"" != warehouse2.""WhsCode"" // Where warehouse.""WhsCode"" LIKE 'TSR%'"); oRecSet.DoQuery(@" Select warehouse.""WhsCode"" as WhsTSRCode, warehouse2.""WhsCode"" as WhsCode, warehouse.""WhsName"" From OWHS warehouse JOIN OWHS warehouse2 ON warehouse.""WhsName"" = warehouse2.""WhsName"" AND warehouse.""WhsCode"" != warehouse2.""WhsCode"" Where warehouse.""WhsCode"" LIKE 'TSR%'"); oRecSet.MoveFirst(); JToken warehouseList = context.XMLTOJSON(oRecSet.GetAsXML())["OWHS"]; return(Ok(warehouseList)); }
public async Task <IActionResult> GetAPPCRM(int id) { SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); oRecSet.DoQuery($@" Select ""CardCode"", ""CardName"", ""CardFName"", ""Address"", ""ZipCode"", ""Country"", ""Block"", ""GroupNum"", ""ListNum"" From OCRD employeeSales JOIN OHEM employee ON ""SlpCode"" = ""salesPrson"" Where ""CardType"" = 'C' AND ""empID"" = {id} AND ""CardCode"" NOT LIKE '%-D'"); if (oRecSet.RecordCount == 0) { return(Ok(new List <string>())); } JToken contacts = context.XMLTOJSON(oRecSet.GetAsXML())["OCRD"]; GC.Collect(); GC.WaitForPendingFinalizers(); return(Ok(contacts)); }
public async Task <IActionResult> GetCRMProviderToBuy(string CardCode) { SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); oRecSet.DoQuery(@" Select ""CardCode"", ""CardName"", ""CardFName"", ""Currency"" From OCRD Where ""CardCode"" = '" + CardCode + "'"); if (oRecSet.RecordCount == 0) { return(NoContent()); } JToken contact = context.XMLTOJSON(oRecSet.GetAsXML())["OCRD"][0]; //Force Garbage Collector. Recommendation by InterLatin Dude. SDK Problem with memory. GC.Collect(); GC.WaitForPendingFinalizers(); return(Ok(contact)); }
//[Authorize] public async Task <IActionResult> Post([FromBody] Codebar codebar) { SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.CompanyService services = context.oCompany.GetCompanyService(); SAPbobsCOM.BarCodesService barCodesService = (SAPbobsCOM.BarCodesService)services.GetBusinessService(SAPbobsCOM.ServiceTypes.BarCodesService); SAPbobsCOM.BarCode barCode = (SAPbobsCOM.BarCode)barCodesService.GetDataInterface(SAPbobsCOM.BarCodesServiceDataInterfaces.bsBarCode); SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); oRecSet.DoQuery($@" Select ""BcdEntry"", ""BcdCode"", ""BcdName"", ""ItemCode"", ""UomEntry"" From OBCD Where ""BcdCode"" = '{codebar.Barcode}';"); if (oRecSet.RecordCount != 0) { string itemcode = context.XMLTOJSON(oRecSet.GetAsXML())["OBCD"][0]["ItemCode"].ToString(); return(BadRequest("Ya Existe Codigo de Barra Registrado. Producto: " + itemcode)); } barCode.ItemNo = codebar.ItemCode; barCode.BarCode = codebar.Barcode; barCode.UoMEntry = codebar.UOMEntry; try { SAPbobsCOM.BarCodeParams result = barCodesService.Add(barCode); return(Ok(result.AbsEntry)); } catch (Exception x) { return(BadRequest(x.Message)); } }
public async Task <IActionResult> GetList(string date) { SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); oRecSet.DoQuery(@" Select ""DocEntry"", ""DocNum"", ""DocDate"", ""CANCELED"", ""DocStatus"" From OWTQ Where ""DocDate"" = '" + date + "'"); int rc = oRecSet.RecordCount; if (rc == 0) { return(NotFound()); } JToken request = context.XMLTOJSON(oRecSet.GetAsXML())["OWTQ"]; return(Ok(request)); }
public IActionResult GetInvoiceCodeBar(string Codebar) { int FinalDocNum = Codebar.IndexOf("C"); string DocEntry = Codebar.Substring(0, FinalDocNum); SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); JToken invoice; oRecSet.DoQuery(@" Select Invoice.""DocEntry"", Invoice.""DocNum"", Invoice.""DocDate"", Invoice.""CardCode"", Client.""CardName"", Client.""CardFName"", Invoice.""DocCur"", Invoice.""DocRate"", Invoice.""DocNum""|| Invoice.""CardCode"" || to_char(Invoice.""DocDate"", 'YYYYMMDD') as ""CodBar"", Invoice.""DocTotalSy"", Invoice.""Series"" From OINV Invoice JOIN OCRD Client ON Client.""CardCode""= Invoice.""CardCode"" Where Invoice.""DocNum""|| Invoice.""CardCode"" || to_char(Invoice.""DocDate"", 'YYYYMMDD') = '" + Codebar + "'" + @"and Invoice.""CANCELED""='N'"); if (oRecSet.RecordCount == 0) { // Handle no Existing Invoice return(NotFound(@"La factura con el numero " + DocEntry + " No existe")); } invoice = context.XMLTOJSON(oRecSet.GetAsXML())["OINV"][0]; return(Ok(invoice)); }
public async Task <IActionResult> GetList(string date) { SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.Documents items = (SAPbobsCOM.Documents)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseDeliveryNotes); SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); List <Object> list = new List <Object>(); oRecSet.DoQuery("Select * From OPDN Where \"DocDate\" = '" + date + "'"); int rc = oRecSet.RecordCount; if (rc == 0) { return(NotFound()); } items.Browser.Recordset = oRecSet; items.Browser.MoveFirst(); while (items.Browser.EoF == false) { JToken temp = context.XMLTOJSON(items.GetAsXML()); temp["OPDN"] = temp["OPDN"][0]; temp["PDN4"]?.Parent.Remove(); temp["PDN12"]?.Parent.Remove(); temp["BTNT"]?.Parent.Remove(); list.Add(temp); items.Browser.MoveNext(); } return(Ok(list)); }
public async Task <IActionResult> GetAPPCRMs() { SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); oRecSet.DoQuery(@" Select ""CardCode"", ""CardName"", ""CardFName"", ""Address"", ""ZipCode"", ""Country"", ""Block"", ""GroupNum"", ""ListNum"" From OCRD Where ""CardType"" = 'C' AND ""CardCode"" NOT LIKE '%-D'"); JToken contacts = context.XMLTOJSON(oRecSet.GetAsXML())["OCRD"]; GC.Collect(); GC.WaitForPendingFinalizers(); return(Ok(contacts)); }
public async Task <IActionResult> GetWMSDetail(uint DocEntry) { SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); oRecSet.DoQuery($@" Select ""DocEntry"", ""DocNum"", to_char(to_date(SUBSTRING(""DocDate"", 0, 10), 'YYYY-MM-DD'), 'DD-MM-YYYY') as ""DocDate"", to_char(to_date(SUBSTRING(""DocDueDate"", 0, 10), 'YYYY-MM-DD'), 'DD-MM-YYYY') as ""DocDueDate"", to_char(to_date(SUBSTRING(""CancelDate"", 0, 10), 'YYYY-MM-DD'), 'DD-MM-YYYY') as ""CancelDate"", ""Comments"", ""ToWhsCode"", ""Filler"" From OWTR WHERE ""DocEntry"" = '{DocEntry}';"); if (oRecSet.RecordCount == 0) { return(NoContent()); } JToken temp = context.XMLTOJSON(oRecSet.GetAsXML())["OWTR"][0]; oRecSet.DoQuery($@" Select ""ItemCode"", ""Dscription"", ""Quantity"", ""UomCode"", ""InvQty"", ""UomCode2"" From WTR1 WHERE ""DocEntry"" = '{DocEntry}';"); temp["TransferRows"] = context.XMLTOJSON(oRecSet.GetAsXML())["WTR1"]; TransferDetail output = temp.ToObject <TransferDetail>(); //Force Garbage Collector. Recommendation by InterLatin Dude. SDK Problem with memory. GC.Collect(); GC.WaitForPendingFinalizers(); return(Ok(output)); }
public async Task <IActionResult> Post([FromBody] TransferRequest value) { SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.StockTransfer newRequest = (SAPbobsCOM.StockTransfer)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInventoryTransferRequest); SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); oRecSet.DoQuery(@" Select warehouse.""WhsCode"", warehouse.""WhsName"", serie.""Series"" From OWHS warehouse LEFT JOIN NNM1 serie ON serie.""SeriesName"" = warehouse.""WhsCode"" Where serie.""ObjectCode"" = 1250000001 AND warehouse.""WhsCode"" = '" + value.towhs.whscode + "'"); oRecSet.MoveFirst(); JToken warehouseList = context.XMLTOJSON(oRecSet.GetAsXML())["OWHS"]; int warehouseSerie = warehouseList[0]["Series"].ToObject <int>(); newRequest.Series = warehouseSerie; newRequest.FromWarehouse = value.fromwhs.whscode; newRequest.ToWarehouse = value.towhs.whscode; for (int i = 0; i < value.rows.Count; i++) { newRequest.Lines.ItemCode = value.rows[i].code; if (value.rows[i].uom == -2) { newRequest.Lines.UoMEntry = 185; newRequest.Lines.UserFields.Fields.Item("U_CjsPsVr").Value = value.rows[i].quantity; newRequest.Lines.Quantity = value.rows[i].quantity * value.rows[i].equivalentePV; newRequest.Lines.UseBaseUnits = SAPbobsCOM.BoYesNoEnum.tYES; } else { newRequest.Lines.Quantity = value.rows[i].quantity; newRequest.Lines.UoMEntry = value.rows[i].uom; newRequest.Lines.UseBaseUnits = (SAPbobsCOM.BoYesNoEnum)value.rows[i].uomBase; } newRequest.Lines.FromWarehouseCode = value.fromwhs.whscode; newRequest.Lines.WarehouseCode = value.towhs.whstsrcode; newRequest.Lines.Add(); } int result = newRequest.Add(); if (result != 0) { string error = context.oCompany.GetLastErrorDescription(); return(BadRequest(error)); } return(Ok(context.oCompany.GetNewObjectKey())); }
public async Task<IActionResult> GetCRMList() { SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); oRecSet.DoQuery("Select \"GroupNum\", \"PymntGroup\" From OCTG"); oRecSet.MoveFirst(); JToken paymentTermsList = context.XMLTOJSON(oRecSet.GetAsXML())["OCTG"]; return Ok(paymentTermsList); }
public async Task <IActionResult> GetByWarehouseGroupDate(string warehouseCode, int group, string fromDate, string toDate) { SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); oRecSet.DoQuery(@" (Select ""ItemCode"", ""Dscription"", SUM(""Quantity"") as Quantity, ""UomCode"", SUM(""LineTotal"") as LineTotal, ""Currency"" From INV1 Where ""Currency"" = 'MXN' AND ""ItemCode"" in ( Select ""ItemCode"" From OITM Where ""QryGroup" + group + @""" = 'Y') AND ""DocEntry"" in ( Select ""DocEntry"" From OINV Where ""DocStatus"" = 'C' AND ""CANCELED"" = 'N' AND ""DocDate"" >= to_timestamp('" + fromDate + @"', 'yyyy-mm-dd') AND ""DocDate"" <= to_timestamp('" + toDate + @"', 'yyyy-mm-dd') AND ""Series"" = (Select ""Series"" From NNM1 Where ""ObjectCode"" = 13 AND ""SeriesName"" = '" + warehouseCode + @"')) GROUP BY ""ItemCode"", ""Dscription"", ""UomCode"", ""Currency"") UNION ( Select ""ItemCode"", ""Dscription"", SUM(""Quantity"") as Quantity, ""UomCode"", SUM(""TotalFrgn"") as LineTotal, ""Currency"" From INV1 Where ""Currency"" = 'USD' AND ""ItemCode"" in ( Select ""ItemCode"" From OITM Where ""QryGroup" + group + @""" = 'Y') AND ""DocEntry"" in ( Select ""DocEntry"" From OINV Where ""DocStatus"" = 'C' AND ""CANCELED"" = 'N' AND ""DocDate"" >= to_timestamp('" + fromDate + @"', 'yyyy-mm-dd') AND ""DocDate"" <= to_timestamp('" + toDate + @"', 'yyyy-mm-dd') AND ""Series"" = (Select ""Series"" From NNM1 Where ""ObjectCode"" = 13 AND ""SeriesName"" = '" + warehouseCode + @"')) GROUP BY ""ItemCode"", ""Dscription"", ""UomCode"", ""Currency"");"); oRecSet.MoveFirst(); JToken result = context.XMLTOJSON(oRecSet.GetAsXML())["INV1"]; return(Ok(result)); }
public async Task <IActionResult> GetCRMList() { SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); oRecSet.DoQuery("Select \"ListName\", \"ListNum\" From OPLN"); oRecSet.MoveFirst(); JToken temp = context.XMLTOJSON(oRecSet.GetAsXML())["OPLN"]; List <PriceListOutput> output = temp.ToObject <List <PriceListOutput> >(); return(Ok(output)); }
//[Authorize] public async Task <IActionResult> GetPriceListProductsWms() { SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); oRecSet.DoQuery("Select \"ListName\", \"ListNum\" From OPLN"); JToken pricelists = context.XMLTOJSON(oRecSet.GetAsXML())["OPLN"]; List <PriceListOutput> priceListOuput = pricelists.ToObject <List <PriceListOutput> >(); GC.Collect(); GC.WaitForPendingFinalizers(); return(Ok(priceListOuput)); }
public async Task<IActionResult> GetList() { SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); oRecSet.DoQuery("Select \"GroupNum\", \"PymntGroup\" From OCTG"); JToken paymentTermsList = context.XMLTOJSON(oRecSet.GetAsXML())["OCTG"]; List<PaymentTermDetail> paymentTermDetails = paymentTermsList.ToObject<List<PaymentTermDetail>>(); oRecSet = null; paymentTermsList = null; GC.Collect(); GC.WaitForPendingFinalizers(); return Ok(paymentTermDetails); }
public async Task <IActionResult> Get(string CardCode) { SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.BusinessPartners Bp = (SAPbobsCOM.BusinessPartners)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartners); if (!Bp.GetByKey(CardCode)) { return(NoContent()); } JToken output = context.XMLTOJSON(Bp.GetAsXML()); return(Ok(output)); }
public async Task <IActionResult> GetList(int id) { SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); oRecSet.DoQuery($"Select \"Fax\" From OSLP Where \"SlpCode\" = {id}"); oRecSet.MoveFirst(); string warehouses = context.XMLTOJSON(oRecSet.GetAsXML())["OSLP"][0]["Fax"].ToString(); warehouses = warehouses.Trim(); if (warehouses.Equals("")) { warehouses = "'S01', 'S06', 'S07', 'S10', 'S12', 'S13', 'S15', 'S24', 'S36', 'S47', 'S55', 'S59', 'S62','S63'"; } else { warehouses = warehouses.ToUpper(); warehouses = "'" + warehouses + "'"; warehouses = warehouses.Replace(" ", ""); warehouses = warehouses.Replace(",", "','"); } oRecSet.DoQuery(@" Select warehouse.""WhsCode"", warehouse.""WhsName"", serie.""Series"" From OWHS warehouse LEFT JOIN NNM1 serie ON serie.""SeriesName"" = warehouse.""WhsCode"" Where serie.""ObjectCode"" = 17 AND warehouse.""WhsCode"" in (" + warehouses + ") "); oRecSet.MoveFirst(); JToken warehouseList = context.XMLTOJSON(oRecSet.GetAsXML())["OWHS"]; return(Ok(warehouseList)); }
public async Task <IActionResult> Get() { SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); oRecSet.DoQuery(@" Select ""WhsCode"", ""WhsName"" From OWHS"); oRecSet.MoveFirst(); JToken warehouseList = context.XMLTOJSON(oRecSet.GetAsXML())["OWHS"]; return(Ok(warehouseList)); }
public async Task <IActionResult> Get() { SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.SBObob SBO = (SAPbobsCOM.SBObob)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoBridge); try { SAPbobsCOM.Recordset oRecSet = SBO.GetCurrencyRate("USD", DateTime.Today); JToken temp = context.XMLTOJSON(oRecSet.GetAsXML())["Recordset"][0]; CurrencyRateDetail CurrencyOutput = temp.ToObject <CurrencyRateDetail>(); GC.Collect(); GC.WaitForPendingFinalizers(); return(Ok(CurrencyOutput)); } catch (Exception ex) { return(Conflict(ex.Message)); } }
public async Task <IActionResult> Get(int id) { SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.StockTransfer request = (SAPbobsCOM.StockTransfer)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInventoryTransferRequest); SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); if (request.GetByKey(id)) { JToken temp = context.XMLTOJSON(request.GetAsXML()); temp["OWTQ"] = temp["OWTQ"][0]; temp["AdmInfo"]?.Parent.Remove(); temp["WTQ12"]?.Parent.Remove(); return(Ok(temp)); } return(NotFound("No Existe Documento")); }
public async Task <IActionResult> GetList() { SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); oRecSet.DoQuery(@" Select warehouse.""WhsCode"", warehouse.""WhsName"", serie.""Series"" From OWHS warehouse LEFT JOIN NNM1 serie ON serie.""SeriesName"" = warehouse.""WhsCode"" Where serie.""ObjectCode"" = 17 AND warehouse.""WhsCode"" in ('S01', 'S06', 'S07', 'S10', 'S12', 'S13', 'S15', 'S24', 'S36','S47', 'S55', 'S59', 'S62','S63') "); oRecSet.MoveFirst(); JToken warehouseList = context.XMLTOJSON(oRecSet.GetAsXML())["OWHS"]; return(Ok(warehouseList)); }
public async Task<IActionResult> Get() { SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.PaymentTermsTypes payment = (SAPbobsCOM.PaymentTermsTypes)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPaymentTermsTypes); SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); List<Object> list = new List<Object>(); JToken temp; oRecSet.DoQuery("Select * From OCTG"); payment.Browser.Recordset = oRecSet; payment.Browser.MoveFirst(); while (payment.Browser.EoF == false) { temp = context.XMLTOJSON(payment.GetAsXML()); temp = temp["OCTG"][0]; list.Add(temp); payment.Browser.MoveNext(); } return Ok(list); }
public async Task <IActionResult> Get() { SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.PriceLists items = (SAPbobsCOM.PriceLists)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPriceLists); SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); List <Object> list = new List <Object>(); oRecSet.DoQuery("Select * From OPLN"); items.Browser.Recordset = oRecSet; items.Browser.MoveFirst(); while (items.Browser.EoF == false) { JToken temp = context.XMLTOJSON(items.GetAsXML()); list.Add(temp["OPLN"][0]); items.Browser.MoveNext(); } return(Ok(list)); }
public async Task <IActionResult> GetListToSellRetail() { SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext; SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); oRecSet.DoQuery(@" Select warehouse.""WhsCode"", warehouse.""WhsName"", serie.""Series"" From OWHS warehouse LEFT JOIN NNM1 serie ON serie.""SeriesName"" = warehouse.""WhsCode"" Where serie.""ObjectCode"" = 17"); // AND warehouse.""WhsCode"" in ('S01', 'S06', 'S07', 'S10', 'S12', 'S13', 'S15', 'S24', 'S36', 'S55') "); JToken warehouseList = context.XMLTOJSON(oRecSet.GetAsXML())["OWHS"]; List <WarehouseWithSerie> warehouseWithSeries = warehouseList.ToObject <List <WarehouseWithSerie> >(); oRecSet = null; warehouseList = null; GC.Collect(); GC.WaitForPendingFinalizers(); return(Ok(warehouseWithSeries)); }