コード例 #1
0
        public Result InsertFunctionalRework(tblRework rework)
        {
            try
            {
                IProduction iProductionInsert = new WCMS_DAL_Production();
                using (
                    var transaction = new TransactionScope(TransactionScopeOption.Required,
                                                           ApplicationState.TransactionOptions))
                {
                    var result = new Result {
                        IsSuccess = iProductionInsert.InsertFunctionalRework(rework)
                    };

                    if (result.IsSuccess)
                    {
                        transaction.Complete();
                    }
                    return(result);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
        public List <tblRework> GetIssueResult(tblRework rework)
        {
            IProduction iProductionSelect = new WCMS_DAL_Production();

            try
            {
                return(iProductionSelect.GetIssueResult(rework));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #3
0
        public List <tblRework> GetQcStatusHistory(tblRework _Entity)
        {
            IProduction iProductionSelect = new WCMS_DAL_Production();

            try
            {
                return(iProductionSelect.GetQcStatusHistory(_Entity));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #4
0
 public bool InsertFunctionalRework(tblRework tblRework)
 {
     try
     {
         _entity.tblRework.Add(tblRework);
         _entity.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return(true);
 }
コード例 #5
0
 public Result InsertFunctionalRework(tblRework rework)
 {
     try
     {
         return(productionManager.InsertFunctionalRework(rework));
     }
     catch (Exception ex)
     {
         return(new Result {
             IsSuccess = false, Message = ex.Message
         });
     }
 }
コード例 #6
0
 public Result UpdateReworkTask(tblRework reworks)
 {
     try
     {
         return(productionManager.UpdateReworkTask(reworks));
     }
     catch (Exception ex)
     {
         return(new Result {
             IsSuccess = false, Message = ex.Message
         });
     }
 }
コード例 #7
0
        public bool UpdateReworkTask(tblRework reworks)
        {
            _entity.Configuration.LazyLoadingEnabled = false;
            tblRework rework = _entity.tblRework.FirstOrDefault(x => x.ReworkId == reworks.ReworkId);


            if (rework != null)
            {
                if (reworks.Status != "")
                {
                    rework.Status = reworks.Status;
                }
                if (reworks.StartDate != null)
                {
                    rework.StartDate = reworks.StartDate;
                }
                if (reworks.StartedBy != null)
                {
                    rework.StartedBy = reworks.StartedBy;
                }
                if (reworks.FinishedDate != null)
                {
                    rework.FinishedDate = reworks.FinishedDate;
                }
                if (reworks.FinishedBy != null)
                {
                    rework.FinishedBy = reworks.FinishedBy;
                }
                if (reworks.UpdatedBy != null)
                {
                    rework.UpdatedBy = reworks.UpdatedBy;
                }
                if (reworks.UpdatedDate != null)
                {
                    rework.UpdatedDate = reworks.UpdatedDate;
                }

                _entity.Entry(rework).State = EntityState.Modified;
                _entity.SaveChanges();
            }
            else
            {
                return(false);
            }


            return(true);
        }
コード例 #8
0
        public List <tblRework> GetIssueResult(tblRework rework)
        {
            var list     = new List <tblRework>();
            var fullList = new List <tblRework>();

            try
            {
                list = _entity.tblRework.WhereIf(rework.MobileCode != null, x => x.MobileCode == rework.MobileCode)
                       .WhereIf(rework.Imei1 != null, x => x.Imei1 == rework.Imei1)
                       .WhereIf(rework.Imei2 != null, x => x.Imei2 == rework.Imei2)
                       .WhereIf(rework.Status != null, x => x.Status == rework.Status)
                       .WhereIf(rework.ReworkId != 0, x => x.ReworkId == rework.ReworkId)
                       .WhereIf(rework.AddedBy != null, x => x.AddedBy == rework.AddedBy)
                       .WhereIf(rework.FailedStation != null, x => x.FailedStation == rework.FailedStation)
                       .WhereIf(rework.ProjectId != null, x => x.ProjectId == rework.ProjectId)
                       .ToList();


                var projectname = _wcmsCellPhoneProjectEntities.ProjectMasters.ToList();



                fullList = (from li in list
                            join proj in projectname on li.ProjectId equals proj.ProjectMasterId

                            select new tblRework
                {
                    ProjectId = li.ProjectId,
                    ProjectName = proj.ProjectName + "-" + CommonConversion.AddOrdinal(proj.OrderNuber) + " Order",
                    LineId = li.LineId,
                    FailedStation = li.FailedStation,
                    Issues = li.Issues,
                    ReworkId = li.ReworkId,
                    MobileCode = li.MobileCode,
                    AddedDate = li.AddedDate
                }).ToList();
            }

            catch (Exception ex)
            {
                throw ex;
            }

            return(fullList);
        }
コード例 #9
0
        public List <tblRework> GetQcStatusHistory(tblRework _Entity)
        {
            List <tblRework> reworksHisReworks = new List <tblRework>();

            try
            {
                reworksHisReworks = productionManager.GetQcStatusHistory(_Entity);
            }
            catch (Exception ex)
            {
                //if (log.IsErrorEnabled)
                //{
                //    log.Error("Select Communication : " + ex.Message);
                //}
            }

            return(reworksHisReworks);
        }
コード例 #10
0
        public List <tblRework> GetIssueResult(tblRework rework)
        {
            List <tblRework> reworks = new List <tblRework>();

            try
            {
                reworks = productionManager.GetIssueResult(rework);
            }
            catch (Exception ex)
            {
                //if (log.IsErrorEnabled)
                //{
                //    log.Error("Select Communication : " + ex.Message);
                //}
            }

            return(reworks);
        }
コード例 #11
0
        public bool UpdateRework(List <tblRework> reworks)
        {
            foreach (var item in reworks)
            {
                _entity.Configuration.LazyLoadingEnabled = false;
                tblRework rework =
                    _entity.tblRework.Where(x => x.MobileCode == item.MobileCode)
                    .OrderByDescending(y => y.AddedDate)
                    .FirstOrDefault();


                if (rework != null)
                {
                    if (item.Status != "")
                    {
                        rework.Status = item.Status;
                    }
                    if (item.FailedStation != "")
                    {
                        rework.FailedStation = item.FailedStation;
                    }
                    if (item.AddedBy != 0)
                    {
                        rework.AddedBy = item.AddedBy;
                    }
                    if (item.AddedDate != null)
                    {
                        rework.AddedDate = item.AddedDate;
                    }

                    _entity.Entry(rework).State = EntityState.Modified;
                    _entity.SaveChanges();
                }
                else
                {
                    return(false);
                }

                //DB.SalesDeliveryPlans.Add(item);
            }


            return(true);
        }
コード例 #12
0
        //get history from rework table
        public List <tblRework> GetQcStatusHistory(tblRework _Entity)
        {
            List <tblRework> list = new List <tblRework>();

            try
            {
                list = _entity.tblRework
                       .WhereIf(_Entity.MobileCode != "", x => x.MobileCode == _Entity.MobileCode)
                       .OrderByDescending(y => y.AddedDate)
                       .Take(1)
                       .ToList();
            }

            catch (Exception ex)
            {
                throw ex;
            }

            return(list);
        }
コード例 #13
0
        public Result UpdateReworkTask(tblRework reworks)
        {
            IProduction iProductionSelect = new WCMS_DAL_Production();

            Result _Result = new Result();

            try
            {
                if (reworks.Status == "S")
                {
                    reworks.StartDate = DateTime.Now;
                }


                _Result.IsSuccess = iProductionSelect.UpdateReworkTask(reworks);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(_Result);
        }
コード例 #14
0
        public Result InsertAgingBatchQcInfo(List <ProductionMaster> productionAgingQc, string batchStatus, long userId, long lineId, long projectId)
        {
            IProduction iProductionSelect = new WCMS_DAL_Production();
            IProduction iProductionInsert = new WCMS_DAL_Production();
            var         result            = new Result();

            var batchnumber = "";

            try
            {
                //logic

                var productionList = new List <ProductionMaster>();
                foreach (var items in productionAgingQc)
                {
                    var production = new ProductionMaster();


                    var isExists = _isSelectingCommon.ProductionMasterInfo(new ProductionMaster {
                        MobileCode = items.MobileCode
                    }).Any();

                    //check if previously passed
                    var previousStatus = _isSelectingCommon.ProductionMasterInfo(new ProductionMaster {
                        MobileCode = items.MobileCode
                    }).FirstOrDefault();

                    //var previousStation = entities.ProductionMaster.FirstOrDefault(a => a.MobileCode == items.MobileCode);
                    //if (previousStatus != null && (isExists && previousStatus.Passed.ToUpper() == "N"))


                    if (previousStatus != null && (isExists && previousStatus.Passed.ToUpper() == "N") && previousStatus.QcStation != "AGQC")
                    {
                        result.Message = " Item Not Passed From Aesthetic QC Station. Item No:" + items.MobileCode + "";
                        return(result);
                    }
                    //if (previousStatus != null && (isExists && previousStatus.QcStation.Trim() != "ASTQC"))

                    if (previousStatus != null && (isExists) && (previousStatus.QcStation.Trim() != "ASTQC" && previousStatus.QcStation.Trim() != "AGQC") && items.QcStation.Trim() == "AGQC")


                    {
                        result.Message = "Item Not Checked In Aesthetic QC Station. Item No:" + items.MobileCode + "";
                        return(result);
                    }
                    if (previousStatus == null || !isExists)
                    {
                        result.Message = "Item Not Checked In Aesthetic QC Station. Item No:" + items.MobileCode + "";
                        return(result);
                    }

                    if (items.QcStation == "AGQC")

                    {
                        production.MobileCode = items.MobileCode;
                        production.QcStation  = items.QcStation;
                        production.Passed     = items.Passed.ToUpper();

                        if (items.Passed.ToUpper() == "Y")
                        {
                            production.AgingBatchNumber = items.AgingBatchNumber;
                        }
                        production.AgingBy = userId;
                        production.AgingAD = DateTime.Now;
                        production.Remarks = items.Remarks;
                        batchnumber        = items.AgingBatchNumber;
                        productionList.Add(production);
                    }


                    if (productionList.Count == productionAgingQc.Count)
                    {
                        result.IsSuccess = iProductionSelect.InsertAgingBatchQcInfo(productionList);


                        if (result.IsSuccess)

                        {
                            //insert into rework


                            foreach (var failItems in productionList)
                            {
                                if (failItems.Passed.ToUpper() == "N")
                                {
                                    production.AgingBatchNumber = "";
                                    var reresult = new Result();
                                    var rework   = new tblRework();
                                    rework.ProjectId     = projectId;
                                    rework.MobileCode    = failItems.MobileCode;
                                    rework.Issues        = failItems.Remarks;
                                    rework.FailedStation = failItems.QcStation;
                                    rework.Status        = "P";
                                    rework.AddedBy       = userId;
                                    rework.AddedDate     = DateTime.Now;

                                    reresult.IsSuccess = iProductionInsert.InsertFunctionalRework(rework);
                                }
                            }


                            var batchResults = new Result();
                            if (result.IsSuccess)
                            {
                                var batchInfo = new AgingBatchInfo();
                                batchInfo.BatchNo = batchnumber;

                                if (batchStatus.ToUpper() == "N")
                                {
                                    batchInfo.Status = "F";
                                }

                                if (batchStatus.ToUpper() == "Y")
                                {
                                    batchInfo.Status = "P";
                                }

                                batchResults.IsSuccess = iProductionInsert.UpdateBatchInfo(batchInfo);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }