コード例 #1
0
        /// <summary>
        /// COMT Add_Line_Text
        /// </summary>
        public List <FstiResult> ComtAddLineTexts(FstiToken token, ComtAddInput input)
        {
            List <FstiResult> resultList = new List <FstiResult>();

            using (var fstiService = this._fstiHelper.CreateFSTIService())
            {
                foreach (var line in input.ComtAddLines)
                {
                    if (line.IsNeedAddLineText())
                    {
                        string result = fstiService.COMT_ADDLineText(token.Token.ToString(),
                                                                     input.CoNumber,
                                                                     line.CoLineNumber.ToString(),
                                                                     line.TextLine1 ?? "",
                                                                     line.TextLine2 ?? "",
                                                                     line.TextLine3 ?? "",
                                                                     line.TextLine4 ?? "");
                        resultList.Add(FstiResult.Build(result));
                    }
                    else
                    {
                        //无需执行AddLineText接口
                        resultList.Add(FstiResult.Success);
                    }
                }
            }
            return(resultList);
        }
コード例 #2
0
        /// <summary>
        /// 登录FS系统
        /// </summary>
        public FstiToken FSLogin(string username, string password)
        {
            username = username?.Trim();
            password = password?.Trim();
            if (string.IsNullOrWhiteSpace(username))
            {
                throw new ArgumentNullException("username");
            }
            if (password == null)
            {
                throw new ArgumentNullException("password");
            }

            string    cackeKey       = FstiToken.GetCacheItemKey(username, password);
            FstiToken tokenCacheItem = _fstiTokenCache.GetOrDefault(cackeKey);    //从缓存获取token

            using (FSTI_GUID fstiService = this.CreateFSTIService())
            {
                if (tokenCacheItem != null)
                {
                    //验证Token是否有效
                    string validateResult = fstiService.logonPool(tokenCacheItem.Token.ToString());
                    if (FstiResultParser.IsLoginTokenValidate(validateResult))
                    {
                        return(tokenCacheItem);
                    }
                    else
                    {
                        _fstiTokenCache.Remove(tokenCacheItem.CacheItemKey);   //移除失效token的缓存
                    }
                }
                return(this.LoginCore(fstiService, username, password));
            }
        }
コード例 #3
0
        /// <summary>
        /// 登录并开始执行FSTI相关接口
        /// 通过using方式使用,自动注销FSTI
        /// </summary>
        public FstiContext BeginFsti()
        {
            FstiToken    token    = this.FSLogin();
            FstiDisposer disposer = new FstiDisposer(token, this);

            return(disposer);
        }
コード例 #4
0
 /// <summary>
 /// COMT Add_Header
 /// </summary>
 public FstiResult ComtAddHeader(FstiToken token, ComtAddInput input)
 {
     using (var fstiService = this._fstiHelper.CreateFSTIService())
     {
         string result = fstiService.COMT_ADDHeader(token.Token.ToString(),
                                                    input.CoNumber,
                                                    input.CustomerId);
         return(FstiResult.Build(result));
     }
 }
コード例 #5
0
            public FstiDisposer(FstiToken fstiToken, FSTIHelper fstiHelper)
                : base(fstiToken)
            {
                if (fstiHelper == null)
                {
                    throw new ArgumentNullException("fstiHelper");
                }

                this.FSTIHelper = fstiHelper;
            }
コード例 #6
0
 /// <summary>
 /// MOMT Add_Header
 /// </summary>
 public FstiResult MomtAddHeader(FstiToken token, MomtAddInput input)
 {
     using (var fstiService = this._fstiHelper.CreateFSTIService())
     {
         string result = fstiService.MOMT_ADDHeader(token.Token.ToString(),
                                                    input.MoNumber,
                                                    input.Planner,
                                                    input.WorkCenter,
                                                    input.DeliverTo);
         return(FstiResult.Build(result));
     }
 }
コード例 #7
0
 /// <summary>
 /// SHIP
 /// </summary>
 public FstiResult Ship(FstiToken token, ShipInput input)
 {
     using (var fstiService = this._fstiHelper.CreateFSTIService())
     {
         string result = fstiService.SHIPIByLot(token.Token.ToString(),
                                                input.CoNumber,
                                                input.CoLineNumber.ToString(),
                                                input.ShippedQuantity.ToString("0.000000"),
                                                input.Stockroom,
                                                input.Bin,
                                                input.InventoryCategory,
                                                input.LotNumber);
         return(FstiResult.Build(result));
     }
 }
コード例 #8
0
 /// <summary>
 /// PICK Add
 /// </summary>
 public FstiResult PickAdd(FstiToken token, PickInput input)
 {
     using (var fstiService = this._fstiHelper.CreateFSTIService())
     {
         string result = fstiService.PICK_ADD(token.Token.ToString(),
                                              input.OrderType,
                                              input.IssueType,
                                              input.OrderNumber,
                                              input.LineNumber.ToString(),
                                              input.ComponentLineType,
                                              input.PointOfUseId,
                                              input.OperationSequenceNumber,
                                              input.ItemNumber,
                                              input.RequiredQuantity.ToString("0.000000"));
         return(FstiResult.Build(result));
     }
 }
コード例 #9
0
        protected virtual FstiToken LoginCore(FSTI_GUID fstiService, string username, string password)
        {
            if (fstiService == null)
            {
                throw new ArgumentNullException("fstiService");
            }

            //登录ERP并获得登录GUID
            string loginResult = fstiService.logon(username, password);
            Guid   token       = new Guid(loginResult);

            //更新缓存
            FstiToken cacheItem = new FstiToken(username, password, token);

            _fstiTokenCache.Set(cacheItem.CacheItemKey, cacheItem);
            return(cacheItem);
        }
コード例 #10
0
        /// <summary>
        /// COMT Add_Line
        /// </summary>
        public List <FstiResult> ComtAddLines(FstiToken token, ComtAddInput input)
        {
            List <FstiResult> resultList = new List <FstiResult>();

            using (var fstiService = this._fstiHelper.CreateFSTIService())
            {
                foreach (var line in input.ComtAddLines)
                {
                    string result = fstiService.COMT_ADDLine(token.Token.ToString(),
                                                             input.CoNumber,
                                                             line.CoLineNumber.ToString(),
                                                             line.ItemNumber,
                                                             line.ItemOrderedQuantity.ToString("0.000000"),
                                                             line.PromisedShipDate.ToString("yyMMdd"),
                                                             line.CoLineStatus.ToString(),
                                                             line.ItemControllingNetUnitPrice.ToString("0.000000"));
                    resultList.Add(FstiResult.Build(result));
                }
            }
            return(resultList);
        }
コード例 #11
0
 /// <summary>
 /// IMTR
 /// </summary>
 public FstiResult Imtr(FstiToken token, ImtrInput input)
 {
     using (var fstiService = this._fstiHelper.CreateFSTIService())
     {
         string result = fstiService.IMTRByLot(token.Token.ToString(),
                                               input.ItemNumber,
                                               input.StockroomFrom,
                                               input.BinFrom,
                                               input.InventoryCategoryFrom,
                                               input.InventoryQuantity.ToString("0.000000"),
                                               input.StockroomTo,
                                               input.BinTo,
                                               input.InventoryCategoryTo,
                                               input.LotNumber,
                                               input.OrderType,
                                               input.OrderNumber,
                                               input.LineNumber.ToString(),
                                               input.DocumentNumber);
         return(FstiResult.Build(result));
     }
 }
コード例 #12
0
        /// <summary>
        /// MOMT Add_Line
        /// </summary>
        public List <FstiResult> MomtAddLines(FstiToken token, MomtAddInput input)
        {
            List <FstiResult> resultList = new List <FstiResult>();

            using (var fstiService = this._fstiHelper.CreateFSTIService())
            {
                foreach (var line in input.MomtAddLines)
                {
                    string result = fstiService.MOMT_ADDLine(token.Token.ToString(),
                                                             input.MoNumber,
                                                             line.ItemNumber,
                                                             line.MoLineType,
                                                             line.ItemOrderedQuantity.ToString("0.000000"),
                                                             line.MoLineStatus.ToString(),
                                                             line.StartDate.ToString("yyMMdd"),
                                                             line.ScheduledDate.ToString("yyMMdd"));
                    resultList.Add(FstiResult.Build(result));
                }
            }
            return(resultList);
        }
コード例 #13
0
        /// <summary>
        /// MORV
        /// 返回LotNumber
        /// </summary>
        public FstiResult <string> Morv(FstiToken token, MorvInput input)
        {
            using (var fstiService = this._fstiHelper.CreateFSTIService())
            {
                string result = fstiService.MORVRByLot(token.Token.ToString(),
                                                       input.MoNumber,
                                                       input.MoLineNumber.ToString(),
                                                       input.ItemNumber,
                                                       input.ReceiptQuantity.ToString("0.000000"),
                                                       input.StockRoom,
                                                       input.Bin,
                                                       input.InventoryCategory,
                                                       input.LotNumber);

                //取得lotNumber
                string lotNumber = this._fsRepository.GetLotNumber(input.MoNumber, input.MoLineNumber, input.ItemNumber);

                var fstiResult = FstiResult <string> .Build(result);

                fstiResult.ExtensionData = (lotNumber ?? "");
                return(fstiResult);
            }
        }
コード例 #14
0
 /// <summary>
 /// 注销FS系统
 /// </summary>
 public void FSLogout(FstiToken fstiToken)
 {
     this.FSLogout(fstiToken.Token);
     _fstiTokenCache.Remove(fstiToken.CacheItemKey);   //移除缓存
 }