public List <tblPackagingBatch> GetOQCBatchInfo(tblPackagingBatch oQcBatchInfo)
        {
            List <tblPackagingBatch> list;

            try
            {
                list = _wcmsEntities.tblPackagingBatch
                       .WhereIf(oQcBatchInfo.MasterBatch != null, x => x.MasterBatch == oQcBatchInfo.MasterBatch)
                       .WhereIf(oQcBatchInfo.Imei1 != null, x => x.Imei1 == oQcBatchInfo.Imei1)
                       //.WhereIf(oQcBatchInfo.Imei2 != null, x => x.Imei2 == oQcBatchInfo.Imei2)
                       .WhereIf(oQcBatchInfo.AddedBy != null, x => x.AddedBy == oQcBatchInfo.AddedBy)
                       //.WhereIf(oQcBatchInfo.ProjectId != null, x => x.ProjectId == oQcBatchInfo.ProjectId)
                       //.WhereIf(oQcBatchInfo.SystemBatch != null, x => x.SystemBatch == oQcBatchInfo.SystemBatch)



                       .AsNoTracking().ToList();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(list);
        }
예제 #2
0
 public List <tblPackagingBatch> GetOQCBatchInfo(tblPackagingBatch oQcBatchInfo)
 {
     try
     {
         ISelectingCommon iDataAccessSelect = new DALGetCommonSelecting();
         return(iDataAccessSelect.GetOQCBatchInfo(oQcBatchInfo));
     }
     catch (Exception ex) { throw ex; }
 }
예제 #3
0
 public bool GenerateImeiBatch(tblPackagingBatch packaginBatch)
 {
     try
     {
         _entity.tblPackagingBatch.Add(packaginBatch);
         _entity.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return(true);
 }
예제 #4
0
        public List <tblPackagingBatch> GetOQCBatchInfo(tblPackagingBatch oQcBatchInfo)
        {
            var list = new List <tblPackagingBatch>();

            try
            {
                list = _CommonManager.GetOQCBatchInfo(oQcBatchInfo);
            }
            catch (Exception ex)
            {
            }

            return(list);
        }
예제 #5
0
        public List <tblPackagingBatch> GetPackagingBatchInfo(tblPackagingBatch tblPackagingBatch)
        {
            var list = new List <tblPackagingBatch>();

            try
            {
                list =
                    _entity.tblPackagingBatch.WhereIf(tblPackagingBatch.MobileCode != null,
                                                      x => x.MobileCode == tblPackagingBatch.MobileCode)
                    .WhereIf(tblPackagingBatch.Imei1 != null, x => x.Imei1 == tblPackagingBatch.Imei1)
                    .WhereIf(tblPackagingBatch.Imei2 != null, x => x.Imei2 == tblPackagingBatch.Imei2)

                    .ToList();
            }

            catch (Exception ex)
            {
                throw ex;
            }

            return(list);
        }
예제 #6
0
        public Result GenerateImeiBatch(long userId, long projectId, string imeiCode)
        {
            IProduction iProductionSelect = new WCMS_DAL_Production();
            var         result            = new Result();

            try
            {
                var productionMasterInfo = _isSelectingCommon.ProductionMasterInfoByImei(imeiCode).FirstOrDefault();
                if (productionMasterInfo != null && productionMasterInfo.Passed == "Y")
                {
                    var isExists =
                        iProductionSelect.GetPackagingBatchInfo(new tblPackagingBatch()
                    {
                        MobileCode = productionMasterInfo.MobileCode
                    }).Any();


                    if (!isExists)
                    {
                        var packaginBatch = new tblPackagingBatch();

                        packaginBatch.ProjectId  = productionMasterInfo.ProjectId;
                        packaginBatch.LineId     = productionMasterInfo.LineId;
                        packaginBatch.MobileCode = productionMasterInfo.MobileCode;
                        packaginBatch.Imei1      = productionMasterInfo.Imei1;
                        packaginBatch.Imei2      = productionMasterInfo.Imei2;
                        packaginBatch.AddedBy    = userId;
                        packaginBatch.AddedDate  = DateTime.Now;
                        result.IsSuccess         = iProductionSelect.GenerateImeiBatch(packaginBatch);
                        if (result.IsSuccess)
                        {
                            var packagingBatchList = iProductionSelect.CountPackagingBatch(projectId, userId).ToList();

                            if (packagingBatchList.Count == 100)
                            {
                                var pckResult            = new Result();
                                var packageBatchList     = new List <tblPackagingBatch>();
                                var productionList       = new List <ProductionMaster>();
                                var packagingBatchNumber = PackagingRandomString();

                                foreach (var items in packagingBatchList)
                                {
                                    var packagingBatch   = new tblPackagingBatch();
                                    var productionMaster = new ProductionMaster();

                                    packagingBatch.MobileCode  = items.MobileCode;
                                    packagingBatch.Imei1       = items.Imei1;
                                    packagingBatch.Imei2       = items.Imei2;
                                    packagingBatch.SystemBatch = "PKG-" + packagingBatchNumber.Trim();

                                    packagingBatch.BatchCreatedBy   = userId;
                                    packagingBatch.BatchCreatedDate = DateTime.Now;

                                    packageBatchList.Add(packagingBatch);   //packBatchList

                                    //adding productonMaster
                                    productionMaster.MobileCode     = items.MobileCode;
                                    productionMaster.Imei1          = items.Imei1;
                                    productionMaster.Imei2          = items.Imei2;
                                    productionMaster.OQCBatchNumber = "PKG-" + packagingBatchNumber.Trim();
                                    productionList.Add(productionMaster);
                                }


                                pckResult.IsSuccess = iProductionSelect.UpdatePackagingBatchStatus(packageBatchList);


                                if (pckResult.IsSuccess)

                                {
                                    var rslt = new Result
                                    {
                                        IsSuccess = _iProductionInsert.UpdateQcStatusHistory(productionList)
                                    };
                                }
                            }
                        }
                    }
                    else
                    {
                        result.Message = "Already Exists ! duplicate IMEI ";
                        return(result);
                    }
                }


                else
                {
                    result.Message = "No data found with this IMEI / Not Passed ";
                    return(result);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }