示例#1
0
        public void UD23Add(string epicorUserID, string epiorUserPassword, UriBuilder builder, Guid sessionId, List <UD23Rec> uD23Recs)
        {
            var it = uD23Recs.First();

            try
            {
                EndpointBindingType bindingType = EndpointBindingType.BasicHttp;

                builder.Path = $"{Conn.environment}/Ice/BO/UD23.svc";
                svcUD23.UD23SvcContractClient _svcUD23 = GetClient <svcUD23.UD23SvcContractClient, svcUD23.UD23SvcContract>(
                    builder.Uri.ToString(),
                    epicorUserID,
                    epiorUserPassword,
                    bindingType);

                _svcUD23.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID));

                svcUD23.UD23Tableset dsUD23 = new svcUD23.UD23Tableset();
                _svcUD23.GetaNewUD23(ref dsUD23);
                dsUD23.UD23[0].Key1 = it.Key1;
                dsUD23.UD23[0].Key2 = it.Key2;
                dsUD23.UD23[0].Key3 = it.Key3;
                dsUD23.UD23[0].UserDefinedColumns["Criteria_c"] = it.Criteria;
                dsUD23.UD23[0].UserDefinedColumns["Result_c"]   = it.Result;
                _svcUD23.Update(ref dsUD23);
            }
            catch (Exception ex)
            {
                throw new Exception($"Epicor Error : {ex.Message.ToString()}");
            }
        }
示例#2
0
        public void UD26Add(string epicorUserID, string epiorUserPassword, UriBuilder builder,
                            Guid sessionId, ICReceiveUD26 cReceive, string Key)
        {
            try
            {
                EndpointBindingType bindingType = EndpointBindingType.BasicHttp;

                builder.Path = $"{Conn.environment}/Ice/BO/UD26.svc";
                svcUD26.UD26SvcContractClient _svcUD26 = GetClient <svcUD26.UD26SvcContractClient, svcUD26.UD26SvcContract>(
                    builder.Uri.ToString(),
                    epicorUserID,
                    epiorUserPassword,
                    bindingType);

                _svcUD26.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID));

                svcUD26.UD26Tableset dsUD26 = new svcUD26.UD26Tableset();
                _svcUD26.GetaNewUD26(ref dsUD26);
                dsUD26.UD26[0].Key1 = Key;
                dsUD26.UD26[0].UserDefinedColumns["IntQueID_c"]     = cReceive.intQue;
                dsUD26.UD26[0].UserDefinedColumns["RejecComment_c"] = cReceive.RejComment;
                dsUD26.UD26[0].UserDefinedColumns["DateReported_c"] = DateTime.Today;
                dsUD26.UD26[0].UserDefinedColumns["PONum_c"]        = cReceive.PONum;
                dsUD26.UD26[0].UserDefinedColumns["DONum_c"]        = cReceive.DONum;
                _svcUD26.Update(ref dsUD26);
            }
            catch (Exception ex)
            {
                throw new Exception($"Epicor Error : {ex.Message.ToString()}");
            }
        }
示例#3
0
        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 InventoryTransfer(string epicorUserID, string epiorUserPassword, UriBuilder builder, Guid sessionId, List <InvTransfer> invTransfers)
        {
            var it = invTransfers.First();

            try
            {
                EndpointBindingType bindingType = EndpointBindingType.BasicHttp;

                builder.Path = $"{Conn.environment}/Erp/BO/InvTransfer.svc";
                svcInvTransfer.InvTransferSvcContractClient _svcInvTransfer = GetClient <svcInvTransfer.InvTransferSvcContractClient, svcInvTransfer.InvTransferSvcContract>(
                    builder.Uri.ToString(),
                    epicorUserID,
                    epiorUserPassword,
                    bindingType);

                _svcInvTransfer.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID));

                svcInvTransfer.InvTransferTableset dsInvTransfer = new svcInvTransfer.InvTransferTableset();

                dsInvTransfer = _svcInvTransfer.GetTransferRecord(it.partNum, "");
                dsInvTransfer.InvTrans[0].RowMod = "U";
                _svcInvTransfer.ChangeUOM(ref dsInvTransfer);

                dsInvTransfer.InvTrans[0].FromWarehouseCode = it.frmWarehouse;
                _svcInvTransfer.ChangeFromWhse(ref dsInvTransfer);

                dsInvTransfer.InvTrans[0].FromBinNum = it.frmBinNum;
                _svcInvTransfer.ChangeFromBin(ref dsInvTransfer);

                dsInvTransfer.InvTrans[0].ToWarehouseCode = it.toWarehouse;
                _svcInvTransfer.ChangeToWhse(ref dsInvTransfer);

                dsInvTransfer.InvTrans[0].ToBinNum = it.toBinNum;
                _svcInvTransfer.ChangeToBin(ref dsInvTransfer);

                if (!string.IsNullOrEmpty(it.frmLotNum))
                {
                    dsInvTransfer.InvTrans[0].FromLotNumber = it.frmLotNum;
                }

                if (!string.IsNullOrEmpty(it.toLotNum))
                {
                    dsInvTransfer.InvTrans[0].ToLotNumber = it.toLotNum;
                }

                _svcInvTransfer.ChangeLot(ref dsInvTransfer);
                dsInvTransfer.InvTrans[0].TransferQty = it.qty;
                //dsInvTransfer.InvTrans[0].TranReference = "_svcInvTransfer: " + it.id;
                dsInvTransfer.InvTrans[0].TranReference = "HH->" + it.id;

                string partTranPKs = "", result = "";
                result = _svcInvTransfer.CommitTransfer(ref dsInvTransfer, out partTranPKs);
            }
            catch (Exception ex)
            {
                throw new Exception($"Epicor Error : {ex.Message.ToString()}");
            }
        }
        public string InventoryTransfer_TranPK(string epicorUserID, string epiorUserPassword, UriBuilder builder, Guid sessionId, List <InvTransfer> invTransfers, out string sErrMsg)
        {
            string sMsg = string.Empty;

            sErrMsg = string.Empty;
            var it = invTransfers.First();

            try
            {
                EndpointBindingType bindingType = EndpointBindingType.BasicHttp;

                builder.Path = $"{Conn.environment}/Erp/BO/InvTransfer.svc";
                svcInvTransfer.InvTransferSvcContractClient _svcInvTransfer = GetClient <svcInvTransfer.InvTransferSvcContractClient, svcInvTransfer.InvTransferSvcContract>(
                    builder.Uri.ToString(),
                    epicorUserID,
                    epiorUserPassword,
                    bindingType);

                _svcInvTransfer.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID));

                svcInvTransfer.InvTransferTableset dsInvTransfer = new svcInvTransfer.InvTransferTableset();

                dsInvTransfer = _svcInvTransfer.GetTransferRecord(it.partNum, "");
                dsInvTransfer.InvTrans[0].RowMod = "U";
                _svcInvTransfer.ChangeUOM(ref dsInvTransfer);

                dsInvTransfer.InvTrans[0].FromWarehouseCode = it.frmWarehouse;
                _svcInvTransfer.ChangeFromWhse(ref dsInvTransfer);

                dsInvTransfer.InvTrans[0].FromBinNum = it.frmBinNum;
                _svcInvTransfer.ChangeFromBin(ref dsInvTransfer);

                dsInvTransfer.InvTrans[0].ToWarehouseCode = it.toWarehouse;
                _svcInvTransfer.ChangeToWhse(ref dsInvTransfer);

                dsInvTransfer.InvTrans[0].ToBinNum = it.toBinNum;
                _svcInvTransfer.ChangeToBin(ref dsInvTransfer);

                dsInvTransfer.InvTrans[0].FromLotNumber = it.frmLotNum;
                dsInvTransfer.InvTrans[0].ToLotNumber   = it.toLotNum;

                _svcInvTransfer.ChangeLot(ref dsInvTransfer);
                dsInvTransfer.InvTrans[0].TransferQty = it.qty;
                //dsInvTransfer.InvTrans[0].TranReference = "_svcInvTransfer: " + it.id;
                dsInvTransfer.InvTrans[0].TranReference = "HH->" + it.id; //need to extend id from int to string. Eg id = "FG Reduce"

                string partTranPKs = "";
                _svcInvTransfer.CommitTransfer(ref dsInvTransfer, out partTranPKs);
                sMsg = partTranPKs;
            }
            catch (Exception ex)
            {
                sErrMsg = ex.Message.ToString();
                //throw new Exception($"Epicor Error : {ex.Message.ToString()}");
            }
            return(sMsg);
        }
示例#6
0
        public void MaterialIssue(string epicorUserID, string epiorUserPassword, UriBuilder builder, Guid sessionId, List <IssueMtl> issueMtls)
        {
            var it = issueMtls.First();

            try
            {
                EndpointBindingType bindingType = EndpointBindingType.BasicHttp;

                builder.Path = $"{Conn.environment}/Erp/BO/IssueReturn.svc";
                svcIssueReturn.IssueReturnSvcContractClient _svcIssueReturn = GetClient <svcIssueReturn.IssueReturnSvcContractClient, svcIssueReturn.IssueReturnSvcContract>(
                    builder.Uri.ToString(),
                    epicorUserID,
                    epiorUserPassword,
                    bindingType);

                _svcIssueReturn.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID));

                svcIssueReturn.IssueReturnTableset dsIssueReturn = new svcIssueReturn.IssueReturnTableset();

                string      OutString   = "";
                System.Guid refSysRowID = new Guid("00000000-0000-0000-0000-000000000000");

                _svcIssueReturn.GetNewIssueReturn("STK-MTL", refSysRowID, "IssueMaterial", ref dsIssueReturn);
                dsIssueReturn.IssueReturn[0].Company = it.Company;
                //dsIssueReturn.IssueReturn[0].Plant = it.Company;
                dsIssueReturn.IssueReturn[0].ToJobNum      = it.JobNum;
                dsIssueReturn.IssueReturn[0].ToAssemblySeq = it.AsmSeq;
                dsIssueReturn.IssueReturn[0].ToJobSeq      = it.MtlSeq;
                dsIssueReturn.IssueReturn[0].TranQty       = it.Qty;
                dsIssueReturn.IssueReturn[0].UM            = it.UM;

                _svcIssueReturn.OnChangingToJobSeq(it.MtlSeq, ref dsIssueReturn);
                _svcIssueReturn.OnChangeToJobSeq(ref dsIssueReturn, "IssueMaterial");
                _svcIssueReturn.OnChangeTranQty(it.Qty, ref dsIssueReturn);

                dsIssueReturn.IssueReturn[0].ToWarehouseCode   = it.ToWH;
                dsIssueReturn.IssueReturn[0].ToBinNum          = it.ToBin;
                dsIssueReturn.IssueReturn[0].FromWarehouseCode = it.FromWH;
                dsIssueReturn.IssueReturn[0].FromBinNum        = it.FromBin;
                //dsIssueReturn.IssueReturn[0].TranReference = it.ToWH;
                dsIssueReturn.IssueReturn[0].LotNum = it.LotNum;

                _svcIssueReturn.PrePerformMaterialMovement(ref dsIssueReturn);
                _svcIssueReturn.MasterInventoryBinTests(ref dsIssueReturn, out OutString, out OutString, out OutString, out OutString, out OutString);
                _svcIssueReturn.PerformMaterialMovement(false, ref dsIssueReturn, out OutString);
            }
            catch (Exception ex)
            {
                throw new Exception($"Epicor Error : {ex.Message.ToString()}");
            }
        }
        public UriBuilder EndpointBinding(out EndpointBindingType bindingType)
        {
            ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, errors) => { return(true); };

            bindingType = EndpointBindingType.BasicHttp;

            scheme = "http";
            if (bindingType == EndpointBindingType.BasicHttp)
            {
                scheme = "https";
            }

            UriBuilder builder = new UriBuilder(scheme, epiServer);

            return(builder);
        }
        public void updateShipped(string epicorUserID, string epiorUserPassword, UriBuilder builder, Guid sessionId, int packNum, string DPNo)
        {
            try
            {
                EndpointBindingType bindingType = EndpointBindingType.BasicHttp;

                builder.Path = $"{Conn.environment}/Erp/BO/CustShip.svc";

                svcCustShip.CustShipSvcContractClient _svcCustShip = GetClient <svcCustShip.CustShipSvcContractClient, svcCustShip.CustShipSvcContract>(

                    builder.Uri.ToString(),

                    epicorUserID,

                    epiorUserPassword,

                    bindingType);

                _svcCustShip.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID));

                bool cError = false;

                svcCustShip.UpdExtCustShipTableset dsExtCustShip = new svcCustShip.UpdExtCustShipTableset();

                svcCustShip.CustShipTableset dsCustShip = new svcCustShip.CustShipTableset();

                dsExtCustShip = new svcCustShip.UpdExtCustShipTableset();

                dsCustShip = _svcCustShip.GetByID(packNum);

                dsExtCustShip.ShipHead = dsCustShip.ShipHead;

                dsExtCustShip.ShipHead[0].UserDefinedColumns["FS_DPNum_c"] = DPNo;

                dsExtCustShip.ShipHead[0].ReadyToInvoice = true;

                dsExtCustShip.ShipHead[0].RowMod = "U";

                _svcCustShip.UpdateExt(ref dsExtCustShip, true, true, out cError);
            }

            catch (Exception ex)

            {
                throw new Exception($"Epicor Error : {ex.Message.ToString()}");
            }
        }
示例#9
0
        public bool CreateLotAttribute(string epicorUserID, string epiorUserPassword, UriBuilder builder, Guid sessionId, IEnumerable <PODetailSchedular> poDetail)
        {
            var  pd      = poDetail.First();
            bool rtnFlag = false;

            try
            {
                EndpointBindingType bindingType = EndpointBindingType.BasicHttp;

                builder.Path = $"{Conn.environment}/Erp/BO/LotSelectUpdate.svc";
                svcLotSelectUpdate.LotSelectUpdateSvcContractClient svcLotSelectUpdate = GetClient <svcLotSelectUpdate.LotSelectUpdateSvcContractClient, svcLotSelectUpdate.LotSelectUpdateSvcContract>(
                    builder.Uri.ToString(),
                    epicorUserID,
                    epiorUserPassword,
                    bindingType);

                svcLotSelectUpdate.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID));

                svcLotSelectUpdate.LotSelectUpdateTableset dsLotSelectUpdate = new svcLotSelectUpdate.LotSelectUpdateTableset();
                svcLotSelectUpdate.GetNewPartLot(ref dsLotSelectUpdate, pd.PartNum);

                dsLotSelectUpdate.PartLot[0].LotNum = pd.LotNum;

                dsLotSelectUpdate.PartLot[0].Batch          = pd.Batch;
                dsLotSelectUpdate.PartLot[0].MfgBatch       = pd.MBatch;
                dsLotSelectUpdate.PartLot[0].MfgLot         = pd.MLot;
                dsLotSelectUpdate.PartLot[0].HeatNum        = pd.Heat;
                dsLotSelectUpdate.PartLot[0].FirmWare       = pd.Firm;
                dsLotSelectUpdate.PartLot[0].BestBeforeDt   = pd.BestBeforeDate;
                dsLotSelectUpdate.PartLot[0].MfgDt          = pd.OrigMfgDate;
                dsLotSelectUpdate.PartLot[0].CureDt         = pd.CureDate;
                dsLotSelectUpdate.PartLot[0].ExpirationDate = pd.ExpireDate;

                svcLotSelectUpdate.Update(ref dsLotSelectUpdate);
                rtnFlag = true;
            }
            catch (Exception ex)
            {
                //throw new Exception($"Epicor Error : {ex.Message.ToString()}");
                rtnFlag = false;
                LogErrorDetails("LotAttributeTbl", pd.LA_Id, ex.Message.ToString(), "POReceipt->CreateLotAttribute");
                UpdateProcessStatus(pd.id, Constants.StatusCode.ERR, "", 0);
            }
            return(rtnFlag);
        }
        public bool CreateLotAttribute(string epicorUserID, string epiorUserPassword, UriBuilder builder, Guid sessionId, string LotNum, string Company, string Plant, string PartNum)
        {
            bool rtnFlag = false;

            try
            {
                EndpointBindingType bindingType = EndpointBindingType.BasicHttp;

                builder.Path = $"{Conn.environment}/Erp/BO/LotSelectUpdate.svc";
                svcLotSelectUpdate.LotSelectUpdateSvcContractClient svcLotSelectUpdate = GetClient <svcLotSelectUpdate.LotSelectUpdateSvcContractClient, svcLotSelectUpdate.LotSelectUpdateSvcContract>(
                    builder.Uri.ToString(),
                    epicorUserID,
                    epiorUserPassword,
                    bindingType);

                svcLotSelectUpdate.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID));

                svcLotSelectUpdate.LotSelectUpdateTableset dsLotSelectUpdate = new svcLotSelectUpdate.LotSelectUpdateTableset();
                svcLotSelectUpdate.GetNewPartLot(ref dsLotSelectUpdate, PartNum); // <<--

                dsLotSelectUpdate.PartLot[0].LotNum = LotNum;

                //dsLotSelectUpdate.PartLot[0].Batch = pd.Batch;

                //dsLotSelectUpdate.PartLot[0].MfgBatch = pd.MBatch;
                //dsLotSelectUpdate.PartLot[0].MfgLot = pd.MLot;
                //dsLotSelectUpdate.PartLot[0].HeatNum = pd.Heat;
                //dsLotSelectUpdate.PartLot[0].FirmWare = pd.Firm;
                //dsLotSelectUpdate.PartLot[0].BestBeforeDt = pd.BestBeforeDate;
                //dsLotSelectUpdate.PartLot[0].MfgDt = pd.OrigMfgDate;
                //dsLotSelectUpdate.PartLot[0].CureDt = pd.CureDate;
                //dsLotSelectUpdate.PartLot[0].ExpirationDate = pd.ExpireDate;

                svcLotSelectUpdate.Update(ref dsLotSelectUpdate);
                rtnFlag = true;
            }
            catch (Exception ex)
            {
                throw new Exception($"Epicor Error : {ex.Message.ToString()}");
            }
            return(rtnFlag);
        }
示例#11
0
        private static TClient GetClient <TClient, TInterface>(
            string url,
            string username,
            string password,
            EndpointBindingType bindingType
            )
            where TClient : ClientBase <TInterface>
            where TInterface : class
        {
            System.ServiceModel.Channels.Binding binding = null;
            TClient client;
            //DnsEndpointIdentity endpointIdentity = new DnsEndpointIdentity("mytp-eptstsrv01.spritzer.local");
            DnsEndpointIdentity endpointIdentity = new DnsEndpointIdentity(Conn.DnsIdentity);
            var endpointAddress = new EndpointAddress(new Uri(url), endpointIdentity);

            switch (bindingType)
            {
            case EndpointBindingType.BasicHttp:
                binding = GetBasicHttpBinding();
                break;

            case EndpointBindingType.SOAPHttp:
                binding = GetWsHttpBinding();
                break;
            }

            TimeSpan operationTimeout = new TimeSpan(0, 12, 0);

            binding.CloseTimeout   = operationTimeout;
            binding.ReceiveTimeout = operationTimeout;
            binding.SendTimeout    = operationTimeout;
            binding.OpenTimeout    = operationTimeout;

            client = (TClient)Activator.CreateInstance(typeof(TClient), binding, endpointAddress);
            if (!string.IsNullOrEmpty(username) && (client.ClientCredentials != null))
            {
                client.ClientCredentials.UserName.UserName = username;
                client.ClientCredentials.UserName.Password = password;
            }
            return(client);
        }
示例#12
0
        public void ICConfirm(string epicorUserID, string epiorUserPassword, UriBuilder builder, Guid sessionId, ICReceiveReceipt cReceive)
        {
            try
            {
                EndpointBindingType bindingType = EndpointBindingType.BasicHttp;

                builder.Path = $"{Conn.environment}/Erp/BO/Receipt.svc";
                svcReceipt.ReceiptSvcContractClient _svcReceipt = GetClient <svcReceipt.ReceiptSvcContractClient, svcReceipt.ReceiptSvcContract>(
                    builder.Uri.ToString(),
                    epicorUserID,
                    epiorUserPassword,
                    bindingType);

                _svcReceipt.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID));

                svcReceipt.ReceiptTableset dsReceipt = new svcReceipt.ReceiptTableset();

                string purPoint          = string.Empty;
                string packSlip          = string.Empty;
                bool   requiresUserInput = false;
                string legalNumMsg       = string.Empty;
                string closePO           = string.Empty;
                _svcReceipt.ImportReceipt(cReceive.intQue, false, ref dsReceipt, out purPoint,
                                          out packSlip, out requiresUserInput, out legalNumMsg, out closePO);
                _svcReceipt.GetByID(cReceive.VendorNum, "", cReceive.DONum);
                _svcReceipt.CreateMassReceipts(cReceive.VendorNum, "", cReceive.DONum, cReceive.intQue,
                                               cReceive.PONum, ref dsReceipt);
                int Count = dsReceipt.RcvDtl.Count();
                for (int i = 0; i < Count; i++)
                {
                    dsReceipt.RcvDtl[i].Received = true;
                }
                _svcReceipt.Update(ref dsReceipt);
                _svcReceipt.ProcessIM(cReceive.intQue, cReceive.DONum, ref dsReceipt);
            }
            catch (Exception ex)
            {
                throw new Exception($"Epicor Error : {ex.Message.ToString()}");
            }
        }
示例#13
0
        public void UD19Add(string epicorUserID, string epiorUserPassword, UriBuilder builder, Guid sessionId, UD19Model uD19Recs)
        {
            var it = uD19Recs;

            try
            {
                EndpointBindingType bindingType = EndpointBindingType.BasicHttp;

                builder.Path = $"{Conn.environment}/Ice/BO/UD19.svc";
                svcUD19.UD19SvcContractClient _svcUD19 = GetClient <svcUD19.UD19SvcContractClient, svcUD19.UD19SvcContract>(
                    builder.Uri.ToString(),
                    epicorUserID,
                    epiorUserPassword,
                    bindingType);

                _svcUD19.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID));

                svcUD19.UD19Tableset dsUD19 = new svcUD19.UD19Tableset();
                _svcUD19.GetaNewUD19(ref dsUD19);
                dsUD19.UD19[0].Key1        = it.RunningNo;
                dsUD19.UD19[0].Number01    = it.Qty;
                dsUD19.UD19[0].Number02    = it.Qty; //req by Tsen
                dsUD19.UD19[0].ShortChar01 = it.PartNum;
                dsUD19.UD19[0].ShortChar02 = it.Lot;
                dsUD19.UD19[0].ShortChar03 = it.ToWH;
                dsUD19.UD19[0].ShortChar04 = it.ToBin;
                dsUD19.UD19[0].ShortChar05 = it.UOM;
                //dsUD19.UD19[0].ShortChar05 = it.EnteredBy;
                DateTime dt = DateTime.Now;
                dsUD19.UD19[0].UserDefinedColumns["TransDate_c"] = dt;
                _svcUD19.Update(ref dsUD19);
            }
            catch (Exception ex)
            {
                throw new Exception($"Epicor Error : {ex.Message.ToString()}");
            }
        }
示例#14
0
        public void UD25Add(string epicorUserID, string epiorUserPassword, UriBuilder builder, Guid sessionId, List <UD25Params> UD25Recs)
        {
            var it = UD25Recs.First();

            try
            {
                EndpointBindingType bindingType = EndpointBindingType.BasicHttp;

                builder.Path = $"{Conn.environment}/Ice/BO/UD25.svc";
                svcUD25.UD25SvcContractClient _svcUD25 = GetClient <svcUD25.UD25SvcContractClient, svcUD25.UD25SvcContract>(
                    builder.Uri.ToString(),
                    epicorUserID,
                    epiorUserPassword,
                    bindingType);

                _svcUD25.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID));

                svcUD25.UD25Tableset dsUD25 = new svcUD25.UD25Tableset();
                _svcUD25.GetaNewUD25(ref dsUD25);
                dsUD25.UD25[0].Company = it.Company;
                dsUD25.UD25[0].Key1    = it.Key1;
                dsUD25.UD25[0].Key2    = it.Key2;
                dsUD25.UD25[0].Key3    = it.Key3;
                dsUD25.UD25[0].UserDefinedColumns["FS_TruckStatus_c"]        = it.FS_TruckStatus_c;
                dsUD25.UD25[0].UserDefinedColumns["FS_TruckActive_c"]        = it.FS_TruckActive_c;
                dsUD25.UD25[0].UserDefinedColumns["FS_PilotID_c"]            = it.FS_PilotID_c;
                dsUD25.UD25[0].UserDefinedColumns["FS_LoadingBay_c"]         = it.FS_LoadingBay_c;
                dsUD25.UD25[0].UserDefinedColumns["FS_SupervisorID_c"]       = it.FS_SupervisorID_c;
                dsUD25.UD25[0].UserDefinedColumns["FS_PilotAssigDateTime_c"] = it.FS_PilotAssigDateTime_c;
                _svcUD25.Update(ref dsUD25);
            }
            catch (Exception ex)
            {
                throw new Exception($"Epicor Error : {ex.Message.ToString()}");
            }
        }
示例#15
0
        public void GetSessionModClient(CustomSession session)
        {
            ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, errors) => { return(true); };

            bindingType = EndpointBindingType.BasicHttp;

            scheme = "http";
            if (bindingType == EndpointBindingType.BasicHttp)
            {
                scheme = "https";
            }
            UriBuilder builder = new UriBuilder(scheme, epiServer);

            builder.Path = epiSite + "/Ice/Lib/SessionMod.svc";
            SessionModSvcContractClient sessionModClient = GetClient <SessionModSvcContractClient, SessionModSvcContract>(builder.Uri.ToString(), session.UserId, session.Password, bindingType);

            builder.Path = epiSite + "/Erp/BO/Req.svc";
            ReqSvcContractClient reqClient = GetClient <ReqSvcContractClient, ReqSvcContract>(builder.Uri.ToString(), session.UserId, session.Password, bindingType);

            Guid sessionId = Guid.Empty;

            try
            {
                sessionId = sessionModClient.Login();
                sessionModClient.Endpoint.Behaviors.Add(new HookServiceBehavior(sessionId, epiSession.UserId));
                reqClient.Endpoint.Behaviors.Add(new HookServiceBehavior(sessionId, epiSession.UserId));
                var ts = new ReqTableset();
                ts = reqClient.GetByID(86);

                if (ts != null && ts.ReqHead.Any())
                {
                    ReqHeadRow backupRow = new ReqHeadRow();
                    var        fields    = backupRow.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public);
                    foreach (var field in fields)
                    {
                        if (field.PropertyType == typeof(System.Runtime.Serialization.ExtensionDataObject))
                        {
                            continue;
                        }

                        var fieldValue = field.GetValue(ts.ReqHead[0]);
                        field.SetValue(backupRow, fieldValue);
                    }
                    ts.ReqHead.Add(backupRow);
                }

                ts.ReqHead[0].NextActionID   = "03";
                ts.ReqHead[0].NextActionDesc = "Send to Procurement Dept";
                ts.ReqHead[0].ReplyOption    = "A";
                ts.ReqHead[0].ReqUserId      = "Manager";
                ts.ReqHead[0].Note           = "";
                ts.ReqHead[0].RowMod         = "U";

                try
                {
                    reqClient.Update(ref ts);
                }
                catch (FaultException <Epicor.ReqSvc.EpicorFaultDetail> ex)
                {
                    if (ex.Detail.ExceptionKindValue.Equals("RecordNotFound", StringComparison.InvariantCultureIgnoreCase))
                    {
                        Console.WriteLine("Record deleted.");
                    }
                    else
                    {
                        Console.WriteLine(ex.Message);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("ex" + ex.Message);
                sessionModClient.Logout();
            }

            if (sessionId != Guid.Empty)
            {
                sessionModClient.Logout();
            }

            sessionModClient.Logout();
        }
示例#16
0
        public void ReceiptUpdate(string epicorUserID, string epiorUserPassword, UriBuilder builder, Guid sessionId, IEnumerable <PODetailSchedular> poDetail)
        {
            var  pd = poDetail.First();
            int  packLn = 0, ln = 0;
            bool errFlg = false;

            //Set company and plant
            string comp = "", plant = "";

            comp  = string.IsNullOrEmpty(pd.company) ? Conn.Company : pd.company;
            plant = string.IsNullOrEmpty(pd.plant) ? Conn.Plant : pd.plant;

            try
            {
                EndpointBindingType bindingType = EndpointBindingType.BasicHttp;

                builder.Path = $"{Conn.environment}/Erp/BO/Receipt.svc";
                svcReceipt.ReceiptSvcContractClient svcReceipt = GetClient <svcReceipt.ReceiptSvcContractClient, svcReceipt.ReceiptSvcContract>(
                    builder.Uri.ToString(),
                    epicorUserID,
                    epiorUserPassword,
                    bindingType);

                svcReceipt.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID));

                string questionMsg = "", warnMsg = "", pPoint = "";
                svcReceipt.ReceiptTableset dsReceipt = new svcReceipt.ReceiptTableset();

                if (pd.isExist)
                {
                    dsReceipt = svcReceipt.GetByID(pd.vendorNum, pd.purPoint, pd.RH_PackSlip);
                }
                else
                {
                    svcReceipt.GetNewRcvHead(ref dsReceipt, 0, pd.purPoint);
                    svcReceipt.GetPOInfo(ref dsReceipt, pd.poNum, true, out pPoint);
                }

                dsReceipt.RcvHead[0].PackSlip = pd.packSlip;
                svcReceipt.Update(ref dsReceipt);

                //IEnumerable<PORelease> pr = GetPORelList(pd.company, pd.plant, pd.poNum, pd.poLine, pd.qty).AsEnumerable();
                IEnumerable <PORelease> pr           = GetPORelList(comp, plant, pd.poNum, pd.poLine, pd.qty).AsEnumerable();
                foreach (var prRow in pr)
                {
                    svcReceipt.GetNewRcvDtl(ref dsReceipt, pd.vendorNum, pd.purPoint, pd.packSlip);
                    svcReceipt.CheckDtlJobStatus(pd.poNum, pd.poLine, prRow.poRelNum, pd.jobNum, out questionMsg, out warnMsg);
                    ln = dsReceipt.RcvDtl.Count() - 1;
                    dsReceipt.RcvDtl[ln].VendorNum = pd.vendorNum;
                    dsReceipt.RcvDtl[ln].PurPoint  = pd.purPoint;
                    dsReceipt.RcvDtl[ln].PackSlip  = pd.packSlip;
                    dsReceipt.RcvDtl[ln].PONum     = pd.poNum;
                    dsReceipt.RcvDtl[ln].POLine    = pd.poLine;
                    dsReceipt.RcvDtl[ln].PORelNum  = prRow.poRelNum;
                    dsReceipt.RcvDtl[ln].OurQty    = prRow.qty;
                    dsReceipt.RcvDtl[ln].VendorQty = prRow.qty;
                    dsReceipt.RcvDtl[ln].SupplierUnInvcReceiptQty = prRow.qty;
                    dsReceipt.RcvDtl[ln].PUM    = pd.uom;
                    dsReceipt.RcvDtl[ln].LotNum = pd.LotNum;

                    if (!String.IsNullOrEmpty(pd.warehouse))
                    {
                        dsReceipt.RcvDtl[ln].WareHouseCode = pd.warehouse;
                        dsReceipt.RcvDtl[ln].BinNum        = pd.binNum;
                    }

                    dsReceipt.RcvDtl[ln].JobNum      = pd.jobNum;
                    dsReceipt.RcvDtl[ln].AssemblySeq = pd.assembly;
                    dsReceipt.RcvDtl[ln].JobSeq      = pd.seq;
                    dsReceipt.RcvDtl[ln].Received    = true;

                    svcReceipt.GetDtlPOLineInfo(ref dsReceipt, pd.vendorNum, pd.purPoint, pd.packSlip, packLn, pd.poLine);
                    //packLn = dsReceipt.RcvDtl[ln].PackLine;
                    svcReceipt.GetDtlPORelInfo(ref dsReceipt, pd.vendorNum, pd.purPoint, pd.packSlip, packLn, prRow.poRelNum);
                    //packLn = dsReceipt.RcvDtl[ln].PackLine;
                    svcReceipt.GetDtlQtyInfo(ref dsReceipt, pd.vendorNum, pd.purPoint, pd.packSlip, packLn, prRow.qty, pd.uom, "QTY");
                    svcReceipt.GetDtlVenQtyInfo(ref dsReceipt, pd.vendorNum, pd.purPoint, pd.packSlip, packLn, prRow.qty);

                    if (!String.IsNullOrEmpty(pd.warehouse))
                    {
                        dsReceipt.RcvDtl[ln].WareHouseCode = pd.warehouse;
                        dsReceipt.RcvDtl[ln].BinNum        = pd.binNum;
                    }

                    svcReceipt.Update(ref dsReceipt);
                    //packLn = dsReceipt.RcvDtl[ln].PackLine;
                }
            }
            catch (Exception ex)
            {
                //throw new Exception($"Epicor Error : {ex.Message.ToString()}");
                errFlg = true;
                LogErrorDetails("PODetailTbl", pd.id, ex.Message.ToString(), "POReceipt->ReceiptUpdate");
                UpdateProcessStatus(pd.id, Constants.StatusCode.ERR, pd.packSlip, packLn);
            }
            finally{
                if (!errFlg)
                {
                    UpdateProcessStatus(pd.id, Constants.StatusCode.COMP, pd.packSlip, packLn);
                }
            }
        }
示例#17
0
        public TClient GetClient <TClient, TInterface>(string url, string user, string pass, EndpointBindingType bindingType)
            where TClient : ClientBase <TInterface>
            where TInterface : class
        {
            System.ServiceModel.Channels.Binding binding = null;
            TClient client;
            var     endpointAddress = new EndpointAddress(url);

            switch (bindingType)
            {
            case EndpointBindingType.BasicHttp:
                binding = GetBasicHttpBinding();
                break;

            case EndpointBindingType.SOAPHttp:
                binding = GetWsHttpBinding();
                break;
            }
            TimeSpan operationTimeout = new TimeSpan(0, 12, 0);

            binding.CloseTimeout   = operationTimeout;
            binding.ReceiveTimeout = operationTimeout;
            binding.SendTimeout    = operationTimeout;
            binding.OpenTimeout    = operationTimeout;

            client = (TClient)Activator.CreateInstance(typeof(TClient), binding, endpointAddress);
            if (!string.IsNullOrEmpty(user) && (client.ClientCredentials != null))
            {
                client.ClientCredentials.UserName.UserName = user;
                client.ClientCredentials.UserName.Password = pass;
            }
            return(client);
        }
示例#18
0
        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();
                }
            }
        }
示例#19
0
        public void performAddOrder(string epicorUserID, string epiorUserPassword, UriBuilder builder, Guid sessionId,
                                    string Company, Int64 OrderNum, string PalletPart, decimal Qty)
        {
            try
            {
                EndpointBindingType bindingType = EndpointBindingType.BasicHttp;

                builder.Path = $"{Conn.environment}/Erp/BO/SalesOrder.svc";
                svcSalesOrder.SalesOrderSvcContractClient _svcSalesOrder = GetClient <svcSalesOrder.SalesOrderSvcContractClient, svcSalesOrder.SalesOrderSvcContract>(
                    builder.Uri.ToString(),
                    epicorUserID,
                    epiorUserPassword,
                    bindingType);

                _svcSalesOrder.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID));

                svcSalesOrder.SalesOrderTableset dsSalesOrder = new svcSalesOrder.SalesOrderTableset();


                int ExistingOrder = (int)OrderNum;
                dsSalesOrder = _svcSalesOrder.GetByID(ExistingOrder);
                _svcSalesOrder.GetNewOrderDtl(ref dsSalesOrder, ExistingOrder);
                bool   Sub1                 = false;
                bool   Phantom              = false;
                string UOMCode              = string.Empty;
                string rowType              = string.Empty;
                bool   KitType              = false;
                Guid   guid                 = new Guid("00000000-0000-0000-0000-000000000000");
                bool   removekitcomponent   = false;
                bool   suppressprompt       = false;
                bool   getPartXInfo         = true;
                bool   checkPartRev         = true;
                bool   checkChangeKitParent = true;
                string questionstring       = string.Empty;
                string warningmsg           = string.Empty;
                bool   multiplematch        = false;
                bool   promttoexplode       = false;
                string configpartmessage    = string.Empty;
                string subPartMessage       = string.Empty;
                string explodeBOMErrMsg     = string.Empty;
                string msgType              = string.Empty;
                bool   multiSubAvail        = false;
                bool   runQtyAvail          = false;
                _svcSalesOrder.ChangePartNumMaster(ref PalletPart, ref Sub1, ref Phantom, ref UOMCode,
                                                   guid, rowType, KitType, removekitcomponent, suppressprompt, getPartXInfo, checkPartRev,
                                                   checkChangeKitParent, ref dsSalesOrder, out questionstring, out warningmsg,
                                                   out multiplematch, out promttoexplode, out configpartmessage, out subPartMessage,
                                                   out explodeBOMErrMsg, out msgType, out multiSubAvail, out runQtyAvail);
                string UOM                 = "PC";
                int    pdDimConvFac        = 1;
                string pcNegQtyAction      = string.Empty;
                string opWarningMsg        = string.Empty;
                string sellingQtyChangeMsg = string.Empty;
                _svcSalesOrder.ChangeSellingQtyMaster(ref dsSalesOrder, Qty, false, false, true, true, false,
                                                      true, PalletPart, "", "", "", UOM, pdDimConvFac, out pcNegQtyAction, out opWarningMsg,
                                                      out sellingQtyChangeMsg);

                int    custNum           = dsSalesOrder.OrderHed[0].CustNum;
                string cRepMsg           = string.Empty;
                string cCreditShipAction = string.Empty;
                string cDisplayMsg       = string.Empty;
                string cCompliantMsg     = string.Empty;
                string cRespMsgOrdRel    = string.Empty;
                _svcSalesOrder.MasterUpdate(true, true, "OrderDtl", custNum, ExistingOrder, false, ref dsSalesOrder,
                                            out cRepMsg, out cCreditShipAction, out cDisplayMsg, out cCompliantMsg,
                                            out cRespMsgOrdRel);
            }
            catch (Exception ex)
            {
                throw new Exception($"Epicor Error : {ex.Message.ToString()}");
            }
        }
        public void performCustShipment(string epicorUserID, string epiorUserPassword, UriBuilder builder,
                                        Guid sessionId, List <CustShipment> custShipment,
                                        string DPNo, int custNum, int existingPackNum)
        {
            var cs = custShipment.First();

            try
            {
                EndpointBindingType bindingType = EndpointBindingType.BasicHttp;

                builder.Path = $"{Conn.environment}/Erp/BO/CustShip.svc";
                svcCustShip.CustShipSvcContractClient _svcCustShip = GetClient <svcCustShip.CustShipSvcContractClient, svcCustShip.CustShipSvcContract>(
                    builder.Uri.ToString(),
                    epicorUserID,
                    epiorUserPassword,
                    bindingType);

                _svcCustShip.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID));

                svcCustShip.CustShipTableset dsCustShip = new svcCustShip.CustShipTableset();

                bool    belongToAnotherPC   = false;
                bool    vSubAvail           = false;
                string  pcOutsideMessage    = "";
                string  opShippingMessage   = "";
                string  partNum             = "";
                string  vMsgType            = "";
                string  origPartNum         = "";
                string  wareHouse           = "";
                string  binNum              = "";
                string  LotNum              = "";
                string  opCompleteMessage   = "";
                string  opLotMessage        = "";
                string  opInventoryMessage  = "";
                string  opLockQtyMessage    = "";
                string  opAllocationMessage = "";
                string  opPartList          = "";
                string  opLot = "";
                string  shipCredMsg = "";
                bool    cError = false;
                bool    compError = false;
                string  msg2 = "";
                string  opPostUpdMsg = "";
                bool    updComplete = false;
                bool    checkCompError = false;
                bool    chgStatErr = false;
                bool    chkShipDtl = false;
                decimal Qty = 0;
                int     packNum = 0, orderNum = 0, orderLine = 0, orderRelNum = 0;
                orderNum = (int)custShipment[0].OrderNum;
                // ## Cust Shipment Header ## //
                if (existingPackNum == 0)
                {
                    _svcCustShip.GetNewShipHead(ref dsCustShip);
                    _svcCustShip.GetHeadOrderInfo(orderNum, ref dsCustShip);
                    _svcCustShip.BuildShipToCustomerList(orderNum);
                    _svcCustShip.GetLegalNumGenOpts(0, ref dsCustShip);
                    _svcCustShip.CheckPCBinOutLocation(ref dsCustShip, out belongToAnotherPC, out pcOutsideMessage);
                    dsCustShip.ShipHead[0].UserDefinedColumns["FS_DPNum_c"] = DPNo;
                    //_svcCustShip.Update(ref dsCustShip);
                    _svcCustShip.UpdateMaster(ref dsCustShip, false, true, false, false, false, false, false, packNum,
                                              custNum, out opCompleteMessage, out opShippingMessage, out opLotMessage, out opInventoryMessage,
                                              out opLockQtyMessage, out opAllocationMessage, out opPartList, out opLot,
                                              out shipCredMsg, out cError, out compError, out msg2, out opPostUpdMsg, out updComplete,
                                              out checkCompError, out chgStatErr, out chkShipDtl);
                    packNum = dsCustShip.ShipHead[0].PackNum;
                }
                else
                {
                    packNum = existingPackNum;
                }

                int ttlrec  = custShipment.Count();
                int currRow = 0;
                // ## Cust Shipment Details ## //
                foreach (CustShipment custShipmentRec in custShipment)
                {
                    orderNum    = (int)custShipmentRec.OrderNum;
                    orderLine   = (int)custShipmentRec.OrderLine;
                    orderRelNum = (int)custShipmentRec.OrderRel;
                    Qty         = (decimal)custShipmentRec.ShipQty;

                    if (custShipmentRec.PalletLine)
                    {
                        LotNum = "";
                    }
                    else
                    {
                        LotNum = custShipmentRec.LotNum;
                    }
                    dsCustShip = new svcCustShip.CustShipTableset();
                    _svcCustShip.GetNewShipDtl(ref dsCustShip, packNum);
                    currRow++;
                    int dtlLastRowIndex = dsCustShip.ShipDtl.Count - 1;
                    if (dsCustShip.ShipHead.Count > 0)
                    {
                        // dsCustShip.ShipHead[0].RowMod = "U";
                    }
                    _svcCustShip.GetOrderInfo(orderNum, ref dsCustShip);
                    _svcCustShip.CheckPrePartInfo(ref partNum, orderNum, orderLine, out vSubAvail, out vMsgType, out origPartNum);
                    _svcCustShip.GetOrderLineInfo(ref dsCustShip, 0, orderLine, "");
                    _svcCustShip.GetOrderRelInfo(ref dsCustShip, 0, orderRelNum, true);
                    _svcCustShip.GetQtyInfo(ref dsCustShip, 0, Qty, 0);
                    // need to identify the warehouse and bin to use
                    //wareHouse = "WO-A"; binNum = "A10111";

                    _svcCustShip.GetWhseInfo(ref dsCustShip, 0, custShipmentRec.WH, "WarehouseCode");
                    _svcCustShip.ValidateBinCode(custShipmentRec.WH, custShipmentRec.Bin);
                    dsCustShip.ShipDtl[dtlLastRowIndex].WarehouseCode = custShipmentRec.WH;
                    dsCustShip.ShipDtl[dtlLastRowIndex].BinNum        = custShipmentRec.Bin;
                    _svcCustShip.GetLegalNumGenOpts(packNum, ref dsCustShip);
                    _svcCustShip.CheckPCBinOutLocation(ref dsCustShip, out belongToAnotherPC, out pcOutsideMessage);
                    dsCustShip.ShipDtl[dtlLastRowIndex].LotNum = LotNum;
                    //dsCustShip.ShipDtl[dtlLastRowIndex].ReadyToInvoice = true;
                    if (ttlrec == currRow)
                    {
                        //dsCustShip.ShipHead[0].ReadyToInvoice = true;
                        //dsCustShip.ShipHead[0].RowMod = "U";
                        //dsCustShip.ShipHead[0].UserDefinedColumns["FS_DPNum_c"] = DPNo;
                        dsCustShip.ShipDtl[dtlLastRowIndex].ShipComment = "D";
                    }
                    _svcCustShip.Update(ref dsCustShip);
                }

                //updateShipped(epicorUserID, epiorUserPassword, builder, sessionId, custNum, packNum, DPNo);
                updateShipped(epicorUserID, epiorUserPassword, builder, sessionId, packNum, DPNo);
            }
            catch (Exception ex)
            {
                throw new Exception($"Epicor Error : {ex.Message.ToString()}");
            }
        }
示例#21
0
        public EpiResponse SOUpdate(string epicorUserID, string epiorUserPassword, UriBuilder builder, Guid sessionId, SOHd objSOHd)
        {
            EndpointBindingType bindingType = EndpointBindingType.BasicHttp;
            EpiResponse         objEpiRes   = new EpiResponse()
            {
                Company       = objSOHd.Company
                , COTOrderNum = objSOHd.COTOrderNum
                , CustId      = objSOHd.CustId
            };

            try
            {
                builder.Path = $"{Config.environment}/Erp/BO/SalesOrder.svc";
                svcSalesOrder.SalesOrderSvcContractClient SOClient = GetClient <svcSalesOrder.SalesOrderSvcContractClient, svcSalesOrder.SalesOrderSvcContract>(
                    builder.Uri.ToString(),
                    epicorUserID,
                    epiorUserPassword,
                    bindingType);

                SOClient.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID));


                var ds = new svcSalesOrder.SalesOrderTableset();
                if (objSOHd.EpiOrderNum > 0)
                {
                    ds = SOClient.GetByID(objSOHd.EpiOrderNum);

                    ds.OrderDtl.ForEach(f => f.RowMod = "D");

                    SOClient.Update(ref ds);
                }
                else
                {
                    SOClient.GetNewOrderHed(ref ds);
                    bool IContinue;
                    SOClient.OnChangeofSoldToCreditCheck(0, objSOHd.CustId, ref ds, out IContinue);
                    SOClient.ChangeSoldToID(ref ds);
                    SOClient.ChangeCustomer(ref ds);

                    int custNum = ds.OrderHed[0].CustNum;
                    if (!string.IsNullOrEmpty(objSOHd.ShipToNum))
                    {
                        ds.OrderHed[0].ShipToNum = objSOHd.ShipToNum;
                        SOClient.ChangeShipToID(ref ds);
                    }
                    ds.OrderHed[0].OrderDate      = objSOHd.OrderDate;
                    ds.OrderHed[0].NeedByDate     = objSOHd.ReqShipDate;
                    ds.OrderHed[0].OrderComment   = objSOHd.OrderComments == null ? "" : objSOHd.OrderComments;
                    ds.OrderHed[0].ShipComment    = objSOHd.OrderComments == null ? "" : objSOHd.OrderComments;
                    ds.OrderHed[0].InvoiceComment = objSOHd.OrderComments == null ? "" : objSOHd.OrderComments;
                    ds.OrderHed[0].PONum          = objSOHd.PONum == "P" ? "P" : "";
                    ds.OrderHed[0].OrderHeld      = true;

                    ds.OrderHed[0].UserDefinedColumns["WEMOrdNum_c"] = objSOHd.COTOrderNum;
                    ds.OrderHed[0].UserDefinedColumns["IntenalInstructionRemarks_c"] = objSOHd.InternalRemarks == null ? "" : objSOHd.InternalRemarks;
                    ds.OrderHed[0].UserDefinedColumns["InvRemarks_c"]       = objSOHd.OrderComments == null ? "" : objSOHd.OrderComments;
                    ds.OrderHed[0].UserDefinedColumns["PromotionRemarks_c"] = objSOHd.PromotionRemarks == null ? "" : objSOHd.PromotionRemarks;
                    ds.OrderHed[0].UserDefinedColumns["ManualSONum_c"]      = objSOHd.ManualSO;
                    ds.OrderHed[0].UserDefinedColumns["Promotion_c"]        = objSOHd.Promotion;

                    ds.OrderHed[0].UserDefinedColumns["CheckBox02"] = objSOHd.BulkOrder; // BulkOrder

                    ds.OrderHed[0].UserDefinedColumns["ShortChar10"] = objSOHd.COTOrderNum.ToString();
                    ds.OrderHed[0].UserDefinedColumns["Character01"] = objSOHd.InternalRemarks == null ? "" : objSOHd.InternalRemarks;

                    SOClient.Update(ref ds);
                }

                int iOrderNum = ds.OrderHed[0].OrderNum;
                objEpiRes.EpiOrderNum = iOrderNum;
                string PartNum = ""; decimal Qty = 0; string UOM = ""; decimal UnitPrice = 0;
                int    totLnRows = objSOHd.SODtl.Count();
                int    currLnRow = 0;
                foreach (var rowSODtl in objSOHd.SODtl)
                {
                    int loopCnt = 1;
                    int rowFOC  = 0;
                    if (rowSODtl.OrderQty > 0 && rowSODtl.FOCQty > 0)
                    {
                        loopCnt = 2;
                    }

                    if (loopCnt == 2)
                    {
                        totLnRows++;
                    }
                    while (rowFOC < loopCnt)
                    {
                        SOClient.GetNewOrderDtl(ref ds, iOrderNum);
                        int currentIndex = ds.OrderDtl.Count - 1;
                        currLnRow++;
                        //Not require as per Chuah's mail
                        if (currLnRow == totLnRows)
                        {
                            ds.OrderDtl[currentIndex].OrderComment = objSOHd.OrderComments == null ? "" : objSOHd.OrderComments;
                        }
                        bool   Sub1                 = false;
                        bool   Phantom              = false;
                        string UOMCode              = string.Empty;
                        string rowType              = string.Empty;
                        bool   KitType              = false;
                        Guid   guid                 = new Guid("00000000-0000-0000-0000-000000000000");
                        bool   removekitcomponent   = false;
                        bool   suppressprompt       = false;
                        bool   getPartXInfo         = true;
                        bool   checkPartRev         = true;
                        bool   checkChangeKitParent = true;
                        string questionstring       = string.Empty;
                        string warningmsg           = string.Empty;
                        bool   multiplematch        = false;
                        bool   promttoexplode       = false;
                        string configpartmessage    = string.Empty;
                        string subPartMessage       = string.Empty;
                        string explodeBOMErrMsg     = string.Empty;
                        string msgType              = string.Empty;
                        bool   multiSubAvail        = false;
                        bool   runQtyAvail          = false;
                        PartNum = rowSODtl.PartNum;

                        SOClient.ChangePartNumMaster(ref PartNum, ref Sub1, ref Phantom, ref UOMCode,
                                                     guid, rowType, KitType, removekitcomponent, suppressprompt, getPartXInfo, checkPartRev,
                                                     checkChangeKitParent, ref ds, out questionstring, out warningmsg,
                                                     out multiplematch, out promttoexplode, out configpartmessage, out subPartMessage,
                                                     out explodeBOMErrMsg, out msgType, out multiSubAvail, out runQtyAvail);

                        if (string.IsNullOrEmpty(rowSODtl.UOM))
                        {
                            UOM = ds.OrderDtl[currentIndex].SalesUM;
                        }
                        else
                        {
                            UOM = rowSODtl.UOM;
                        }

                        int    pdDimConvFac        = 1;
                        string pcNegQtyAction      = string.Empty;
                        string opWarningMsg        = string.Empty;
                        string sellingQtyChangeMsg = string.Empty;
                        bool   IsFOCItem           = false;
                        if (loopCnt == 2)
                        {
                            if (rowFOC == 0)
                            {
                                Qty = rowSODtl.OrderQty;
                            }
                            else
                            {
                                Qty       = rowSODtl.FOCQty;
                                IsFOCItem = true;
                            }
                        }
                        else
                        {
                            if (rowSODtl.OrderQty > 0)
                            {
                                Qty = rowSODtl.OrderQty;
                            }
                            else if (rowSODtl.FOCQty > 0)
                            {
                                Qty       = rowSODtl.FOCQty;
                                IsFOCItem = true;
                            }
                            else
                            {
                                //Something not right
                            }
                        }



                        SOClient.ChangeSellingQtyMaster(ref ds, Qty, false, false, true, true, false,
                                                        true, PartNum, "", "", "", UOM, pdDimConvFac, out pcNegQtyAction, out opWarningMsg,
                                                        out sellingQtyChangeMsg);

                        if (rowSODtl.SellingPrice > 0)
                        {
                            //ds.OrderDtl[currentIndex].UnitPrice = rowSODtl.SellingPrice;
                            //ds.OrderDtl[currentIndex].DocUnitPrice = rowSODtl.SellingPrice;
                            //ds.OrderDtl[currentIndex].DspUnitPrice = rowSODtl.SellingPrice;
                            //ds.OrderDtl[currentIndex].DocDspUnitPrice = rowSODtl.SellingPrice;
                            //SOClient.ChangeUnitPrice(ref ds);
                        }

                        //ds.OrderDtl[currentIndex].LockQty = true;
                        if (objSOHd.BulkOrder)
                        {
                            ds.OrderDtl[currentIndex].UserDefinedColumns["Number14"] = Qty;
                        }
                        else
                        {
                            ds.OrderDtl[currentIndex].UserDefinedColumns["Number01"] = Qty;
                        }



                        //saras
                        if (!IsFOCItem)
                        {
                            ds.OrderDtl[currentIndex].UserDefinedColumns["Number03"] = rowSODtl.SellingPrice;

                            ds.OrderDtl[currentIndex].UserDefinedColumns["Number04"] = rowSODtl.ProposedSellingPrice > 0 ? rowSODtl.ProposedSellingPrice : rowSODtl.SellingPrice; // PropposeSellingPrice

                            ds.OrderDtl[currentIndex].UserDefinedColumns["Number13"] = rowSODtl.BasePrice;
                            ds.OrderDtl[currentIndex].UserDefinedColumns["Number05"] = rowSODtl.ProposedBasePrice > 0 ? rowSODtl.ProposedBasePrice : rowSODtl.BasePrice; // ProposeBasePrice
                        }
                        else
                        {
                            //if (IsFOCItem)
                            //{
                            // //ds.OrderDtl[currentIndex].UserDefinedColumns["UnitPrice"] = 0.0000m.ToString();
                            // ds.OrderDtl[currentIndex].UserDefinedColumns["UnitPrice"] = decimal.Zero;
                            // ds.OrderDtl[currentIndex].UserDefinedColumns["Number03"] = decimal.Zero;
                            // }
                            ds.OrderDtl[currentIndex].UserDefinedColumns["Number03"] = rowSODtl.SellingPrice;

                            ds.OrderDtl[currentIndex].UserDefinedColumns["Number04"] = decimal.Zero;;  // PropposeSellingPrice

                            //ds.OrderDtl[currentIndex].UserDefinedColumns["UnitPrice"] = decimal.Zero;  // UnitPrice

                            //ds.OrderDtl[currentIndex].UserDefinedColumns["Number13"] = 0;
                            ds.OrderDtl[currentIndex].UserDefinedColumns["Number05"] = decimal.Zero; // ProposeBasePrice

                            ds.OrderDtl[currentIndex].UnitPrice       = decimal.Zero;
                            ds.OrderDtl[currentIndex].DocUnitPrice    = decimal.Zero;
                            ds.OrderDtl[currentIndex].DspUnitPrice    = decimal.Zero;
                            ds.OrderDtl[currentIndex].DocDspUnitPrice = decimal.Zero;
                            SOClient.ChangeUnitPrice(ref ds);
                        }

                        string cRepMsg                 = string.Empty;
                        string cRespMsgOrdRel          = string.Empty;
                        bool   lCheckForOrderChangedMs = false;
                        bool   lcheckForResponse       = false;
                        string cTableName              = "OrderDtl";
                        int    iCustNum                = ds.OrderHed[0].CustNum;
                        bool   lweLicensed             = false;
                        string cResponseMsg            = "";
                        string cCreditShipAction       = "";
                        string cDisplayMsg             = "";
                        string cCompliantMsg           = "";
                        string cResponseMsgOrdRel      = "";


                        SOClient.MasterUpdate(lCheckForOrderChangedMs, lcheckForResponse, cTableName, iCustNum, iOrderNum, lweLicensed, ref ds, out cResponseMsg, out cCreditShipAction, out cDisplayMsg, out cCompliantMsg, out cResponseMsgOrdRel);


                        int iOrderLine = ds.OrderDtl.Max(m => m.OrderLine);

                        if (!IsFOCItem)
                        {
                            int relRowCnt = 0;
                            foreach (var rowSORel in rowSODtl.SORel.Where(w => w.OrderRelQty > 0))
                            {
                                if (relRowCnt > 0)
                                {
                                    SOClient.GetNewOrderRel(ref ds, iOrderNum, iOrderLine);
                                    int relIndex = ds.OrderRel.Count - 1;
                                    if (ds.OrderRel[relIndex].SellingReqQty != rowSORel.OrderRelQty)
                                    {
                                        ds.OrderRel[relIndex].SellingReqQty = rowSORel.OrderRelQty;
                                        ds.OrderRel[relIndex].OurReqQty     = rowSORel.OrderRelQty;
                                        //_svcSalesOrder.ChangeSellingReqQty(ref dsSalesOrder, rowSORel.RelQty);
                                    }

                                    if (ds.OrderRel[relIndex].ShipToNum != rowSORel.ShipToNum)
                                    {
                                        ds.OrderRel[relIndex].ShipToNum = rowSORel.ShipToNum;
                                    }
                                    if (ds.OrderRel[relIndex].NeedByDate != rowSORel.ShipByDate)
                                    {
                                        ds.OrderRel[relIndex].NeedByDate = rowSORel.ShipByDate;
                                    }
                                    SOClient.ChangeOrderRelShipTo(ref ds);
                                }
                                else
                                {
                                    int relIndex = ds.OrderRel.Count - 1;
                                    if (ds.OrderRel[relIndex].SellingReqQty != rowSORel.OrderRelQty)
                                    {
                                        ds.OrderRel[relIndex].SellingReqQty = rowSORel.OrderRelQty;
                                        ds.OrderRel[relIndex].OurReqQty     = rowSORel.OrderRelQty;
                                        //_svcSalesOrder.ChangeSellingReqQty(ref dsSalesOrder, rowSORel.RelQty);
                                    }
                                    if (ds.OrderRel[relIndex].ShipToNum != rowSORel.ShipToNum)
                                    {
                                        ds.OrderRel[relIndex].ShipToNum = rowSORel.ShipToNum;
                                    }
                                    if (ds.OrderRel[relIndex].NeedByDate != rowSORel.ShipByDate)
                                    {
                                        ds.OrderRel[relIndex].NeedByDate = rowSORel.ShipByDate;
                                    }
                                    ds.OrderRel[relIndex].RowMod = "U";
                                    SOClient.ChangeOrderRelShipTo(ref ds);
                                }

                                SOClient.Update(ref ds);


                                relRowCnt++;
                            }
                        }
                        else
                        {
                            int relRowCnt = 0;
                            foreach (var rowSORel in rowSODtl.SORel.Where(w => w.FOCRelQty > 0))
                            {
                                if (relRowCnt > 0)
                                {
                                    SOClient.GetNewOrderRel(ref ds, iOrderNum, iOrderLine);
                                    int relIndex = ds.OrderRel.Count - 1;
                                    if (ds.OrderRel[relIndex].SellingReqQty != rowSORel.FOCRelQty)
                                    {
                                        ds.OrderRel[relIndex].SellingReqQty = rowSORel.FOCRelQty;
                                        ds.OrderRel[relIndex].OurReqQty     = rowSORel.FOCRelQty;
                                        //_svcSalesOrder.ChangeSellingReqQty(ref dsSalesOrder, rowSORel.RelQty);
                                    }

                                    if (ds.OrderRel[relIndex].ShipToNum != rowSORel.ShipToNum)
                                    {
                                        ds.OrderRel[relIndex].ShipToNum = rowSORel.ShipToNum;
                                    }
                                    if (ds.OrderRel[relIndex].NeedByDate != rowSORel.ShipByDate)
                                    {
                                        ds.OrderRel[relIndex].NeedByDate = rowSORel.ShipByDate;
                                    }
                                    SOClient.ChangeOrderRelShipTo(ref ds);
                                }
                                else
                                {
                                    int relIndex = ds.OrderRel.Count - 1;
                                    if (ds.OrderRel[relIndex].SellingReqQty != rowSORel.FOCRelQty)
                                    {
                                        ds.OrderRel[relIndex].SellingReqQty = rowSORel.FOCRelQty;
                                        ds.OrderRel[relIndex].OurReqQty     = rowSORel.FOCRelQty;
                                        //_svcSalesOrder.ChangeSellingReqQty(ref dsSalesOrder, rowSORel.RelQty);
                                    }
                                    if (ds.OrderRel[relIndex].ShipToNum != rowSORel.ShipToNum)
                                    {
                                        ds.OrderRel[relIndex].ShipToNum = rowSORel.ShipToNum;
                                    }
                                    if (ds.OrderRel[relIndex].NeedByDate != rowSORel.ShipByDate)
                                    {
                                        ds.OrderRel[relIndex].NeedByDate = rowSORel.ShipByDate;
                                    }
                                    ds.OrderRel[relIndex].RowMod = "U";
                                    SOClient.ChangeOrderRelShipTo(ref ds);
                                }

                                SOClient.Update(ref ds);

                                relRowCnt++;
                            }
                        }

                        rowFOC++;
                    }
                }

                //ds.OrderHed[0].UserDefinedColumns["CheckBox01"] = true;//Approved
                ds.OrderHed[0].UserDefinedColumns["CheckBox04"] = true; //Submit Order
                ds.OrderHed[0].RowMod = "U";                            //Submit Order
                SOClient.Update(ref ds);
            }
            catch (Exception ex)
            {
                objEpiRes.ErrMsg = ex.Message.ToString();
            }

            return(objEpiRes);
        }
示例#22
0
        static void Main()
        {
            ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, errors) => { return true; };

            EndpointBindingType bindingType = EndpointBindingType.BasicHttp;

            string epicorUserID = epiUser;
            string epiorUserPassword = epiPassword;

            string scheme = "http";
            if (bindingType == EndpointBindingType.BasicHttp)
            {
                scheme = "https";
            }
            UriBuilder builder = new UriBuilder(scheme, epiServer);

            builder.Path = epiSite + "/Ice/Lib/SessionMod.svc";

            SessionModSvcContractClient sessionModClient = GetClient<SessionModSvcContractClient, SessionModSvcContract>(builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType);

            builder.Path = epiSite + "/Erp/BO/SalesOrder.svc";
            SalesOrderSvcContractClient salesOrderClient = GetClient<SalesOrderSvcContractClient, SalesOrderSvcContract>(builder.Uri.ToString(), epiorUserPassword, epicorUserID, bindingType);

            Guid sessionId = Guid.Empty;
#if NORMAL
            try
            {
                sessionId = sessionModClient.Login();
                sessionModClient.Endpoint.Behaviors.Add(new HookServiceBehavior(sessionId, epicorUserID));
                salesOrderClient.Endpoint.Behaviors.Add(new HookServiceBehavior(sessionId, epicorUserID));


                string dirName = @"Z:\e10\EDI_Data\IN_XML";
                string[] filePaths = Directory.GetFiles(dirName);
                string message = "";
                bool AllOk = true;
                TestData testData = new TestData();
                string result = "";
                foreach (string fileName in filePaths)
                {
                    try
                    {
                        XmlReader reader = new XmlReader(fileName);
                        SalesOrder salesOrder = reader.GetSalesOrder();
                        result = "";
                        LoadSalesOrder(salesOrderClient, salesOrder, out result);
                    }
                    catch (Exception e)
                    {
                        message = e.Message;
                        AllOk = false;
                    }
                    if (AllOk)
                    {
                        testData.MoveFile(fileName, result);
                    }
                    else
                    {
                        testData.MoveFile(fileName, result);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("ex" + ex.Message);
                sessionModClient.Logout();
            }
            if (sessionId != Guid.Empty)
            {
                sessionModClient.Logout();
            }
        }
示例#23
0
        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();
                }
            }
        }
示例#24
0
        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();
                }
            }
        }
示例#25
0
        public void getSession(out string epicorUserID, out string epiorUserPassword,
                               string comp, string plant, out UriBuilder builder,
                               ref svcSessionMod.SessionModSvcContractClient sessionModClient)
        {
            comp  = string.IsNullOrEmpty(comp) ? configCompany : comp;
            plant = string.IsNullOrEmpty(plant) ? configPlant : plant;

            EndpointBindingType bindingType = EndpointBindingType.BasicHttp;

            epicorUserID      = userName;
            epiorUserPassword = password;
            Guid sessionId = Guid.Empty;

            sessionModClient = null;

            string scheme = "https";

            if (bindingType == EndpointBindingType.SOAPHttp)
            {
                scheme = "http";
            }
            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)
                {
                    throw new Exception($"Epicor Error : Sessionid is Empty!");
                }
            }
            catch (Exception ex)
            {
                throw new Exception($"Epicor Error : {ex.Message.ToString()}");
            }
        }
        public bool Login(User objUser)
        {
            //configCompany = Conn.Company;
            bool isValidUser = false;
            EndpointBindingType bindingType = EndpointBindingType.BasicHttp;
            string epicorUserID             = objUser.UserId;   //Conn.epicorUserID;
            string epiorUserPassword        = objUser.Password; //Conn.epiorUserPassword;
            Guid   sessionId = Guid.Empty;

            svcSession.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 <svcSession.SessionModSvcContractClient, svcSession.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 <svcSession.SessionModSvcContractClient, svcSession.SessionModSvcContract>(builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType);

                sessionModClient.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID));

                //** CHANGE configCompany & configPlant to read from input **//
                sessionModClient.SetCompany(string.IsNullOrEmpty(objUser.Company) ? Conn.Company : objUser.Company, out siteID, out siteName, out workstationID,
                                            out workstationDesc, out employeeID, out countryGroupCode,
                                            out countryCode, out tenantID);
                sessionModClient.SetPlant(string.IsNullOrEmpty(objUser.Plant) ?Conn.Plant: objUser.Plant);


                if (sessionId != Guid.Empty)
                {
                    isValidUser = true;
                }


                return(isValidUser);
            }
            catch (Exception ex)
            {
                if (ex.InnerException != null)
                {
                    throw new Exception($"Epicor Error : {ex.InnerException.Message.ToString()}");
                }
                else
                {
                    throw new Exception($"Epicor Error : {ex.Message.ToString()}");
                }
            }
            finally
            {
                if (sessionId != Guid.Empty)
                {
                    sessionModClient.Logout();
                }
            }
        }
示例#27
0
        public void NonConformance(string epicorUserID, string epiorUserPassword, UriBuilder builder, Guid sessionId, List <NonConf> nonConfs)
        {
            string sEmpty = "";
            var    it     = nonConfs.First();

            try
            {
                EndpointBindingType bindingType = EndpointBindingType.BasicHttp;

                builder.Path = $"{Conn.environment}/Erp/BO/nonconf.svc";
                svcNonConf.NonConfSvcContractClient _svcNonConf = GetClient <svcNonConf.NonConfSvcContractClient, svcNonConf.NonConfSvcContract>(
                    builder.Uri.ToString(),
                    epicorUserID,
                    epiorUserPassword,
                    bindingType);

                _svcNonConf.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID));

                svcNonConf.NonConfTableset dsNonConf = new svcNonConf.NonConfTableset();
                dsNonConf = _svcNonConf.AddNonConf("Inventory");
                //dsNonConf.NonConf[0].Company = it.Company;
                dsNonConf.NonConf[0].PartNum     = it.PartNum;
                dsNonConf.NonConf[0].RevisionNum = it.RevisionNum;
                dsNonConf.NonConf[0].LotNum      = it.LotNum;

                dsNonConf.NonConf[0].Quantity      = it.Quantity;
                dsNonConf.NonConf[0].DimConvFactor = 1;
                dsNonConf.NonConf[0].TranQty       = it.Quantity;
                dsNonConf.NonConf[0].TranUOM       = it.ScrapUM;
                dsNonConf.NonConf[0].ScrapUM       = it.ScrapUM;
                dsNonConf.NonConf[0].ReasonCode    = it.ReasonCode;
                dsNonConf.NonConf[0].WarehouseCode = it.WarehouseCode;
                dsNonConf.NonConf[0].BinNum        = it.BinNum;


                bool   plLotTracked = false, plDimTracked = false;
                string pcUM = "", pcWarehouseCode = "", pcWareHseCodeDesc = "", pcBinNum = "";

                _svcNonConf.GetPartInfo(it.PartNum, out pcUM, out pcWarehouseCode, out plLotTracked, out plDimTracked, out pcWareHseCodeDesc, out pcBinNum);

                _svcNonConf.GetAvailableQty(ref dsNonConf);
                _svcNonConf.OnChangeTranQty(it.Quantity, ref dsNonConf);
                //_svcNonConf.GetAvailableQty(ref dsNonConf);
                //_svcNonConf.OnChangeWarehouseCode(it.WarehouseCode, true, ref dsNonConf);
                //_svcNonConf.OnChangeBinNum(it.BinNum, true,ref dsNonConf);
                //_svcNonConf.OnChangeUM(it.ScrapUM, ref dsNonConf);
                string pcMessage = "";
                _svcNonConf.ValidateQtyInventoryTest(it.PartNum, it.WarehouseCode, it.BinNum, it.LotNum, it.ScrapUM, 1, it.Quantity, 0, out pcMessage);
                //
                //



                //dsNonConf.NonConf[0].ToWarehouseCode = "WQA";
                //dsNonConf.NonConf[0].ToBinNum = "QA-INSP";

                _svcNonConf.PreUpdate(ref dsNonConf, out sEmpty);
                _svcNonConf.Update(ref dsNonConf);
            }
            catch (Exception ex)
            {
                throw new Exception($"Epicor Error : {ex.Message.ToString()}");
            }
        }
示例#28
0
        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();
                }
            }
        }
示例#29
0
        public EpiResponse Process(SOHd objSOHd)
        {
            EndpointBindingType bindingType = EndpointBindingType.BasicHttp;
            string epicorUserID             = Config.epicorUserID;      //"manager";
            string epiorUserPassword        = Config.epiorUserPassword; //"finlucky08";
            Guid   sessionId = Guid.Empty;

            svcSession.SessionModSvcContractClient sessionModClient = null;

            string scheme = "https";

            if (bindingType == EndpointBindingType.SOAPHttp)
            {
                scheme = "http";
            }
            UriBuilder builder = new UriBuilder(scheme, Config.hostName);

            builder.Path = $"{Config.environment}/Ice/Lib/SessionMod.svc";

            EpiResponse objEpiRes = null;

            try
            {
                sessionModClient = GetClient <svcSession.SessionModSvcContractClient, svcSession.SessionModSvcContract>
                                   (
                    builder.Uri.ToString(),
                    epicorUserID,
                    epiorUserPassword,
                    bindingType
                                   );



                sessionId = sessionModClient.Login();

                builder.Path     = $"{Config.environment}/Ice/Lib/SessionMod.svc";
                sessionModClient = GetClient <svcSession.SessionModSvcContractClient, svcSession.SessionModSvcContract>(builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType);

                sessionModClient.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID));



                string newCompany             = string.Empty;
                string plant                  = string.Empty;
                string siteID                 = string.Empty;
                string siteName               = string.Empty;
                string workstationID          = string.Empty;
                string workstationDescription = string.Empty;
                string employeeID             = string.Empty;
                string countryGroupCode       = string.Empty;
                string countryCode            = string.Empty;
                string tenantID               = string.Empty;


                sessionModClient.SetCompany(objSOHd.Company, out siteID, out siteName, out workstationID, out workstationDescription, out employeeID, out countryGroupCode, out countryCode, out tenantID);
                sessionModClient.SetPlant(Config.Plant);

                if (sessionId != Guid.Empty)
                {
                    //Call the Require function
                    objEpiRes = SOUpdate(epicorUserID, epiorUserPassword, builder, sessionId, objSOHd);
                }
                else
                {
                    throw new Exception($"Error : Sessionid is Empty!");
                }
            }
            catch (Exception ex)
            {
                objEpiRes        = new EpiResponse();
                objEpiRes.ErrMsg = $"Epicor (SalesOrderEntry) Error : {ex.Message.ToString()}";
            }
            finally
            {
                if (sessionId != Guid.Empty)
                {
                    sessionModClient.Logout();
                }
            }
            return(objEpiRes);
        }
        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();
                }
            }
        }