Beispiel #1
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);
        }
Beispiel #2
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();
                }
            }
        }