public string UD108A_Add(List <UD108A> objLots) { string epicorUserID, epiorUserPassword, company, plant, msg = ""; UriBuilder builder = null; Guid sessionId = Guid.Empty; company = objLots.First().Company; plant = objLots.First().Plant; svcSessionMod.SessionModSvcContractClient sessionModClient = null; getSession(out epicorUserID, out epiorUserPassword, company, plant, out builder, ref sessionModClient); try { EndpointBindingType bindingType = EndpointBindingType.BasicHttp; sessionId = sessionModClient.Login(); builder.Path = $"{Conn.environment}/Ice/BO/UD108.svc"; svcUD108.UD108SvcContractClient _svcUD108 = GetClient <svcUD108.UD108SvcContractClient, svcUD108.UD108SvcContract>( builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType); _svcUD108.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID)); svcUD108.UD108Tableset dsUD108 = new svcUD108.UD108Tableset(); for (var i = 0; i < objLots.Count; i++) { _svcUD108.GetaNewUD108A(ref dsUD108, objLots[i].RunningNo_Key1, objLots[i].DPNum_Key2, objLots[i].SONum_Key3, "", ""); dsUD108.UD108A[i].Key1 = objLots[i].RunningNo_Key1; dsUD108.UD108A[i].Key2 = objLots[i].DPNum_Key2; dsUD108.UD108A[i].Key3 = objLots[i].SONum_Key3; dsUD108.UD108A[i].ChildKey1 = DateTime.Now.ToString("yyyyMMddHHmmssffff"); dsUD108.UD108A[i].ChildKey2 = (i + 1).ToString(); dsUD108.UD108A[i].UserDefinedColumns["FS_Qty_c"] = objLots[i].Qty; dsUD108.UD108A[i].UserDefinedColumns["FS_LotNum_c"] = objLots[i].LotNum; dsUD108.UD108A[i].UserDefinedColumns["FS_PalletLblNum_c"] = objLots[i].PalletLblNum; dsUD108.UD108A[i].UserDefinedColumns["FS_PalletLblId_c"] = objLots[i].PalletLblId; dsUD108.UD108A[i].UserDefinedColumns["FS_LPStatus_c"] = objLots[i].Status; _svcUD108.Update(ref dsUD108); } } catch (Exception ex) { msg = $"Epicor Error : {ex.Message.ToString()}"; throw new Exception($"Epicor Error : {ex.Message.ToString()}"); } finally { if (sessionId != Guid.Empty) { sessionModClient.Logout(); } } return(msg); }
public void Begin(UD19Model objUD19) { // assign which company BO to fire configCompany = objUD19.Company; EndpointBindingType bindingType = EndpointBindingType.BasicHttp; string epicorUserID = userName; string epiorUserPassword = password; Guid sessionId = Guid.Empty; svcSessionMod.SessionModSvcContractClient sessionModClient = null; string scheme = "https"; if (bindingType == EndpointBindingType.SOAPHttp) { scheme = "http"; } UriBuilder builder = new UriBuilder(scheme, Conn.hostName); builder.Path = $"{Conn.environment}/Ice/Lib/SessionMod.svc"; try { sessionModClient = GetClient <svcSessionMod.SessionModSvcContractClient, svcSessionMod.SessionModSvcContract> ( builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType ); string siteID = "", siteName = "", workstationID = "", workstationDesc = ""; string employeeID = "", countryGroupCode = "", countryCode = "", tenantID = ""; sessionId = sessionModClient.Login(); builder.Path = $"{Conn.environment}/Ice/Lib/SessionMod.svc"; sessionModClient = GetClient <svcSessionMod.SessionModSvcContractClient, svcSessionMod.SessionModSvcContract>(builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType); sessionModClient.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID)); //** CHANGE configCompany & configPlant to read from input **// sessionModClient.SetCompany(objUD19.Company, out siteID, out siteName, out workstationID, out workstationDesc, out employeeID, out countryGroupCode, out countryCode, out tenantID); sessionModClient.SetPlant(configPlant); if (sessionId != Guid.Empty) { UD19Add(epicorUserID, epiorUserPassword, builder, sessionId, objUD19); } else { //Sessionid is Empty! } } catch (Exception ex) { throw new Exception($"Epicor Error : {ex.Message.ToString()}"); } finally { if (sessionId != Guid.Empty) { sessionModClient.Logout(); } } }
public void Begin(IEnumerable <PODetailSchedular> poDetail) { EndpointBindingType bindingType = EndpointBindingType.BasicHttp; //EndpointBindingType bindingType = EndpointBindingType.SOAPHttp; //string epicorUserID = userName; //string epiorUserPassword = password; string epicorUserID = Conn.epicorUserID; string epiorUserPassword = Conn.epiorUserPassword; Guid sessionId = Guid.Empty; svcSessionMod.SessionModSvcContractClient sessionModClient = null; //Set company and plant string comp = "", plant = ""; var pd = poDetail.First(); comp = string.IsNullOrEmpty(pd.company) ? Conn.Company : pd.company; plant = string.IsNullOrEmpty(pd.plant) ? Conn.Plant : pd.plant; string scheme = "https"; if (bindingType == EndpointBindingType.SOAPHttp) { scheme = "http"; } //UriBuilder builder = new UriBuilder(scheme, "serverdemo"); //UriBuilder builder = new UriBuilder(scheme, "mytp-eptstsrv01.spritzer.local"); UriBuilder builder = new UriBuilder(scheme, Conn.hostName); //builder.Path = "DEMODB/Ice/Lib/SessionMod.svc"; builder.Path = $"{Conn.environment}/Ice/Lib/SessionMod.svc"; //??? try { sessionModClient = GetClient <svcSessionMod.SessionModSvcContractClient, svcSessionMod.SessionModSvcContract> ( builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType ); string siteID = "", siteName = "", workstationID = "", workstationDesc = ""; string employeeID = "", countryGroupCode = "", countryCode = "", tenantID = ""; sessionId = sessionModClient.Login(); //builder.Path = "DEMODB/Ice/Lib/SessionMod.svc"; builder.Path = $"{Conn.environment}/Ice/Lib/SessionMod.svc"; sessionModClient = GetClient <svcSessionMod.SessionModSvcContractClient, svcSessionMod.SessionModSvcContract>(builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType); sessionModClient.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID)); //var pd = poDetail.First(); sessionModClient.SetCompany(comp, out siteID, out siteName, out workstationID, out workstationDesc, out employeeID, out countryGroupCode, out countryCode, out tenantID); //sessionModClient.SetPlant(pd.plant); //sessionModClient.SetPlant(configPlant); sessionModClient.SetPlant(plant); if (sessionId != Guid.Empty) { bool successFlg = true; if (pd.LANotExist && pd.LAPresent) { successFlg = CreateLotAttribute(epicorUserID, epiorUserPassword, builder, sessionId, poDetail); } if (successFlg) { ReceiptUpdate(epicorUserID, epiorUserPassword, builder, sessionId, poDetail); } } else { LogErrorDetails("Begin", 0, "", "Sessionid is Empty!"); } } catch (Exception ex) { LogErrorDetails("Begin", 0, ex.Message.ToString(), "POReceipt->Begin"); } finally { if (sessionId != Guid.Empty) { sessionModClient.Logout(); } } }
public void Begin(string Company, string DPNo, List <CustShipment> customerShipment, int custNum, int existingPackNum) { //configCompany = Conn.Company; EndpointBindingType bindingType = EndpointBindingType.BasicHttp; string epicorUserID = Conn.epicorUserID; string epiorUserPassword = Conn.epiorUserPassword; Guid sessionId = Guid.Empty; svcSessionMod.SessionModSvcContractClient sessionModClient = null; string comp = "", plant = ""; comp = string.IsNullOrEmpty(customerShipment.First().Company) ? Conn.Company : customerShipment.First().Company; //plant = string.IsNullOrEmpty(customerShipment.First().Plant) ? Conn.Plant : customerShipment.First().Plant; string scheme = "https"; if (bindingType == EndpointBindingType.SOAPHttp) { scheme = "http"; } UriBuilder builder = new UriBuilder(scheme, Conn.hostName); builder.Path = $"{Conn.environment}/Ice/Lib/SessionMod.svc"; try { sessionModClient = GetClient <svcSessionMod.SessionModSvcContractClient, svcSessionMod.SessionModSvcContract> ( builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType ); string siteID = "", siteName = "", workstationID = "", workstationDesc = ""; string employeeID = "", countryGroupCode = "", countryCode = "", tenantID = ""; sessionId = sessionModClient.Login(); builder.Path = $"{Conn.environment}/Ice/Lib/SessionMod.svc"; sessionModClient = GetClient <svcSessionMod.SessionModSvcContractClient, svcSessionMod.SessionModSvcContract>(builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType); sessionModClient.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID)); //** CHANGE configCompany & configPlant to read from input **// sessionModClient.SetCompany(comp, out siteID, out siteName, out workstationID, out workstationDesc, out employeeID, out countryGroupCode, out countryCode, out tenantID); sessionModClient.SetPlant(Conn.Plant); if (sessionId != Guid.Empty) { // ##### TEST DATA ##### // performCustShipment(epicorUserID, epiorUserPassword, builder, sessionId, customerShipment, DPNo, custNum, existingPackNum); } else { //Sessionid is Empty! } } catch (Exception ex) { throw new Exception($"Epicor Error : {ex.Message.ToString()}"); } finally { if (sessionId != Guid.Empty) { sessionModClient.Logout(); } } }
public void UD108Add(UD108Rec uD108Recs) { string epicorUserID, epiorUserPassword, company, plant; UriBuilder builder = null; Guid sessionId = Guid.Empty; company = uD108Recs.Company; plant = uD108Recs.Plant; svcSessionMod.SessionModSvcContractClient sessionModClient = null; getSession(out epicorUserID, out epiorUserPassword, company, plant, out builder, ref sessionModClient); //var it = uD108Recs.First(); try { EndpointBindingType bindingType = EndpointBindingType.BasicHttp; sessionId = sessionModClient.Login(); builder.Path = $"{Conn.environment}/Ice/BO/UD108.svc"; svcUD108.UD108SvcContractClient _svcUD108 = GetClient <svcUD108.UD108SvcContractClient, svcUD108.UD108SvcContract>( builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType); _svcUD108.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID)); svcUD108.UD108Tableset dsUD108 = new svcUD108.UD108Tableset(); _svcUD108.GetaNewUD108(ref dsUD108); dsUD108.UD108[0].Key1 = uD108Recs.RunningNo; dsUD108.UD108[0].Key3 = uD108Recs.Key3; dsUD108.UD108[0].Key2 = uD108Recs.DPNo; dsUD108.UD108[0].Key4 = ""; dsUD108.UD108[0].Key5 = ""; dsUD108.UD108[0].Date01 = uD108Recs.ShipByDate; //dsUD108.UD108[0].UserDefinedColumns["FS_PalletQty_c"] = 1; dsUD108.UD108[0].UserDefinedColumns["FS_PalletQty_c"] = (int)uD108Recs.Qty; dsUD108.UD108[0].UserDefinedColumns["FS_PartDesc_c"] = uD108Recs.PartDesc; dsUD108.UD108[0].UserDefinedColumns["FS_PartNo_c"] = uD108Recs.PartNo; dsUD108.UD108[0].UserDefinedColumns["FS_PalletType_c"] = uD108Recs.PalletType; dsUD108.UD108[0].UserDefinedColumns["FS_UOM_c"] = uD108Recs.UOM; //dsUD108.UD108[0].UserDefinedColumns["FS_Qty_c"] = uD108Recs.Qty; dsUD108.UD108[0].UserDefinedColumns["FS_Qty_c"] = uD108Recs.QtyCtn;// _svcUD108.Update(ref dsUD108); // _svcUD108.GetaNewUD108A(ref dsUD108, it.RunningNo, it.DPNo, "1","",""); // dsUD108.UD108A[0].ChildKey1 = "1"; //dsUD108.UD108A[0].ChildKey2 = ""; //dsUD108.UD108A[0].ChildKey3 = ""; //dsUD108.UD108A[0].UserDefinedColumns["FS_Qty_c"] = it.Qty; //dsUD108.UD108A[0].UserDefinedColumns["FS_LotNum_c"] = ""; //_svcUD108.Update(ref dsUD108); } catch (Exception ex) { throw new Exception($"Epicor Error : {ex.Message.ToString()}"); } finally { if (sessionId != Guid.Empty) { sessionModClient.Logout(); } } }
public void Begin(NonConf objNonConformance) { EndpointBindingType bindingType = EndpointBindingType.BasicHttp; string epicorUserID = userName; string epiorUserPassword = password; Guid sessionId = Guid.Empty; svcSessionMod.SessionModSvcContractClient sessionModClient = null; //AMIN Start string comp = "", plant = ""; comp = string.IsNullOrEmpty(objNonConformance.Company) ? Conn.Company : objNonConformance.Company; plant = string.IsNullOrEmpty(objNonConformance.Plant) ? Conn.Plant : objNonConformance.Plant; //AMIN End string scheme = "https"; if (bindingType == EndpointBindingType.SOAPHttp) { scheme = "http"; } UriBuilder builder = new UriBuilder(scheme, Conn.hostName); builder.Path = $"{Conn.environment}/Ice/Lib/SessionMod.svc"; try { sessionModClient = GetClient <svcSessionMod.SessionModSvcContractClient, svcSessionMod.SessionModSvcContract> ( builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType ); string siteID = "", siteName = "", workstationID = "", workstationDesc = ""; string employeeID = "", countryGroupCode = "", countryCode = "", tenantID = ""; sessionId = sessionModClient.Login(); builder.Path = $"{Conn.environment}/Ice/Lib/SessionMod.svc"; sessionModClient = GetClient <svcSessionMod.SessionModSvcContractClient, svcSessionMod.SessionModSvcContract>(builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType); sessionModClient.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID)); //** CHANGE configCompany & configPlant to read from input **// sessionModClient.SetCompany(comp, out siteID, out siteName, out workstationID, out workstationDesc, out employeeID, out countryGroupCode, out countryCode, out tenantID); sessionModClient.SetPlant(plant); if (sessionId != Guid.Empty) { List <NonConf> nonConfs = new List <NonConf>(); nonConfs.Add(objNonConformance); // ##### TEST DATA ##### // //List<InvTransfer> invTransfers = new List<InvTransfer>(); //invTransfers.Add(objInvTransfer); //invTransfers.Add(new InvTransfer //{ // company = configCompany, // plant = configPlant, // id = 1, // partNum = "1-BAG-GEN-000000-002", // qty = 1, // uom = "KG", // frmWarehouse = "L05", // frmBinNum = "RS_BTL", // frmLotNum = "Lot 04", // All from details i can get from PartBin - LotNum // toWarehouse = "L09", // Default boolean value in Warehse // toBinNum = "L09", // Default boolean value in WarehseBin // toLotNum = "Lot 01" // Same as fromLotNum //}); NonConformance(epicorUserID, epiorUserPassword, builder, sessionId, nonConfs); } else { //Sessionid is Empty! } } catch (Exception ex) { throw new Exception($"Epicor Error : {ex.Message.ToString()}"); } finally { if (sessionId != Guid.Empty) { sessionModClient.Logout(); } } }
//public void Begin(IEnumerable<PODetail> poDetail) //{ // EndpointBindingType bindingType = EndpointBindingType.BasicHttp; // //EndpointBindingType bindingType = EndpointBindingType.SOAPHttp; // string epicorUserID = userName; // string epiorUserPassword = password; // Guid sessionId = Guid.Empty; // svcSessionMod.SessionModSvcContractClient sessionModClient = null; // string scheme = "https"; // if (bindingType == EndpointBindingType.SOAPHttp) // { // scheme = "http"; // } // //UriBuilder builder = new UriBuilder(scheme, "serverdemo"); // UriBuilder builder = new UriBuilder(scheme, "mytp-eptstsrv01.spritzer.local"); // //builder.Path = "DEMODB/Ice/Lib/SessionMod.svc"; // builder.Path = "E101Test/Ice/Lib/SessionMod.svc"; // try // { // sessionModClient = GetClient<svcSessionMod.SessionModSvcContractClient, svcSessionMod.SessionModSvcContract> // ( // builder.Uri.ToString(), // epicorUserID, // epiorUserPassword, // bindingType // ); // string siteID = "", siteName = "", workstationID = "", workstationDesc = ""; // string employeeID = "", countryGroupCode = "", countryCode = "", tenantID = ""; // sessionId = sessionModClient.Login(); // //builder.Path = "DEMODB/Ice/Lib/SessionMod.svc"; // builder.Path = "E101Test/Ice/Lib/SessionMod.svc"; // sessionModClient = GetClient<svcSessionMod.SessionModSvcContractClient, svcSessionMod.SessionModSvcContract>(builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType); // sessionModClient.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID)); // var pd = poDetail.First(); // sessionModClient.SetCompany(pd.company, out siteID, out siteName, out workstationID, // out workstationDesc, out employeeID, out countryGroupCode, // out countryCode, out tenantID); // //sessionModClient.SetPlant(pd.plant); // sessionModClient.SetPlant(configPlant); // if (sessionId != Guid.Empty) // { // CreateLotAttribute(epicorUserID, epiorUserPassword, builder, sessionId, poDetail); // } // else // { // throw new Exception("Begin | Sessionid is Empty!"); // } // } // catch (Exception ex) // { // throw new Exception("Begin | " + ex.Message.ToString() + " | LotCreation->Begin"); // } // finally // { // if (sessionId != Guid.Empty) // { // sessionModClient.Logout(); // } // } //} public void Begin(string LotNum, string Company, string Plant, string PartNum) { EndpointBindingType bindingType = EndpointBindingType.BasicHttp; //EndpointBindingType bindingType = EndpointBindingType.SOAPHttp; string epicorUserID = userName; string epiorUserPassword = password; Guid sessionId = Guid.Empty; svcSessionMod.SessionModSvcContractClient sessionModClient = null; string scheme = "https"; if (bindingType == EndpointBindingType.SOAPHttp) { scheme = "http"; } //UriBuilder builder = new UriBuilder(scheme, "serverdemo"); UriBuilder builder = new UriBuilder(scheme, Conn.hostName); //builder.Path = "DEMODB/Ice/Lib/SessionMod.svc"; builder.Path = $"{Conn.environment}/Ice/Lib/SessionMod.svc"; try { sessionModClient = GetClient <svcSessionMod.SessionModSvcContractClient, svcSessionMod.SessionModSvcContract> ( builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType ); string siteID = "", siteName = "", workstationID = "", workstationDesc = ""; string employeeID = "", countryGroupCode = "", countryCode = "", tenantID = ""; sessionId = sessionModClient.Login(); //builder.Path = "DEMODB/Ice/Lib/SessionMod.svc"; builder.Path = $"{Conn.environment}/Ice/Lib/SessionMod.svc"; sessionModClient = GetClient <svcSessionMod.SessionModSvcContractClient, svcSessionMod.SessionModSvcContract>(builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType); sessionModClient.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID)); sessionModClient.SetCompany(Company, out siteID, out siteName, out workstationID, out workstationDesc, out employeeID, out countryGroupCode, out countryCode, out tenantID); //sessionModClient.SetPlant(Plant); sessionModClient.SetPlant(configPlant); if (sessionId != Guid.Empty) { //CreateLotAttribute(epicorUserID, epiorUserPassword, builder, sessionId, LotNum, Company, Plant, PartNum); CreateLotAttribute(epicorUserID, epiorUserPassword, builder, sessionId, LotNum, Company, configPlant, PartNum); } else { throw new Exception("Begin | Sessionid is Empty!"); } } catch (Exception ex) { throw new Exception("Begin | " + ex.Message.ToString() + " | LotCreation->Begin"); } finally { if (sessionId != Guid.Empty) { sessionModClient.Logout(); } } }