コード例 #1
0
        /// <summary>
        /// 添加库存物料
        /// </summary>
        /// <param name="PartNum"></param>
        /// <param name="UserID"></param>
        /// <returns>返回0失败</returns>
        public int AddStockPart(string PartNum, string UserID)
        {
            int result = 0;

            try
            {
                int count = ConstDB.StockPart.Where(o => o.PartNum == PartNum).Count();
                if (count <= 0)
                {
                    StockPart model = new StockPart();
                    model.PartNum = PartNum;
                    model.UserID  = UserID;
                    ConstDB.StockPart.Add(model);
                    result = ConstDB.SaveChanges();
                }
            }
            catch { }
            return(result);
        }
コード例 #2
0
        public int UpdateLastGetPLMTime(DateTime LastGetTime)
        {
            int result = 0;

            try
            {
                using (ERP.ERPDbContext ERPDB = new ERP.ERPDbContext(Connection))
                {
                    var CompanyUD = ERPDB.Company_UD.FirstOrDefault();
                    CompanyUD.LastGetPLMTime_c   = LastGetTime;
                    ERPDB.Entry(CompanyUD).State = EntityState.Modified;
                    result = ERPDB.SaveChanges();
                }
            }
            catch { }
            return(result);
        }
コード例 #3
0
        public int GetRevId(string PartNum, string UserID)
        {
            int result = 0;

            try
            {
                using (ERP.ERPDbContext ERPDB = new ERP.ERPDbContext(Connection))
                {
                    SyncHistory model = new SyncHistory();
                    model.Company  = "001";
                    model.PartNum  = PartNum;
                    model.SyncTime = DateTime.Now;
                    model.UserID   = UserID;
                    model.RevName  = "R";
                    ERPDB.SyncHistory.Add(model);
                    ERPDB.SaveChanges();
                    result = model.ID;
                }
            }
            catch (Exception e) { }
            return(result);
        }
コード例 #4
0
        public bool DelRev(string PartNum, string UserID, int RevNum)
        {
            bool result = false;

            try
            {
                using (ERP.ERPDbContext ERPDB = new ERP.ERPDbContext(Connection))
                {
                    var model = ERPDB.SyncHistory.Where(o => o.PartNum == PartNum && o.UserID == UserID && o.RevNum == RevNum).FirstOrDefault();
                    if (model != null)
                    {
                        ERPDB.Entry(model).State = EntityState.Deleted;
                        ERPDB.SaveChanges();
                        result = true;
                    }
                }
            }
            catch
            {
                result = false;
            }
            return(result);
        }