예제 #1
0
        public void CPSocketSaveLot(Lot_Transformed lot)
        {
            Conditions conditions = new Conditions
            {
                ConditionExpressions = { new Condition("LotId", Operator.EqualTo, lot.LotId) }
            };

            conditions.ConditionExpressions.Add(new Condition("RecordType", Operator.EqualTo, "Record"));
            conditions.ConditionExpressions.Add(new Condition("Stage", Operator.EqualTo, lot.Stage));
            conditions.Connector = Connector.AND;
            Lot_Transformed currentEntity = this.dbGateway.getRecord(conditions);

            if (currentEntity != null)
            {
                lot.Status    = (int)WaferStatus.WaitPE;
                lot.VersionID = currentEntity.VersionID + 1;
                this.dbGateway.AddNew(lot);
                currentEntity.RecordType = "History";
                this.dbGateway.UpdateByFieldValue("ID", currentEntity.ID, currentEntity);
            }
            else
            {
                this.SaveLot(lot);
            }
        }
예제 #2
0
        public int UpdateWaferStatus(HttpRequestBase req, int type, string userName)
        {
            bool isWaferOperation           = string.IsNullOrEmpty(req.QueryString["TransformID"]);
            Dictionary <int, ArrayList> dic = this.way.UpdateWaferStatus(req, type, userName);
            int suc     = 0;
            int dispose = StringHelper.isNullOrEmpty(req.QueryString["HidStatus"]) ? 0 : int.Parse(req.QueryString["HidStatus"]);

            if (dic != null)
            {
                foreach (KeyValuePair <int, ArrayList> kvp in dic)
                {
                    suc = kvp.Key;
                    ArrayList array = kvp.Value;
                    if (array != null)
                    {
                        foreach (string s in array)
                        {
                            Lot_Transformed lot = this.lotWay.GetTransformById(s);
                            if (type != 3 && lot != null && !isWaferOperation)
                            {
                                //发邮件
                                NotificationService.CreateCpOSATConfirmNotificationsWhilePeDispose(lot.Vendor, lot, "test", dispose);
                            }
                        }
                    }
                }
            }

            return(suc);
        }
예제 #3
0
        public int DisposeByLot(string lotids, int type, int dispose, HttpRequestBase req, string userName)
        {
            Dictionary <int, ArrayList> dic = this.way.DisposeByLot(lotids, type, dispose, req, userName);
            int suc = 0;

            if (dic != null)
            {
                foreach (KeyValuePair <int, ArrayList> kvp in dic)
                {
                    suc = kvp.Key;
                    ArrayList array = kvp.Value;
                    if (array != null)
                    {
                        foreach (string s in array)
                        {
                            Lot_Transformed lot = this.lotWay.GetTransformById(s);
                            if (type != 3 && lot != null)
                            {
                                //发邮件
                                NotificationService.CreateCpOSATConfirmNotificationsWhilePeDispose(lot.Vendor, lot, "test", dispose);
                            }
                        }
                    }
                }
            }
            return(suc);
        }
        private void SaveWaferSbin(Lot_Transformed lot, string waferid, ref int waferIndex)
        {
            int           waferidcount      = lot.WaferidCount;
            List <string> allBinPercentList = lot.AllBinPercentList;
            List <string> allBinList        = lot.AllBinList;
            List <string> allBinLimtList    = lot.AllBinLimtList;
            Wafer_Sbin    sbin = null;

            for (int i = 0; i < waferidcount; i++)
            {
                waferIndex++;
                if (waferIndex == 2 && i == 1)
                {
                    waferIndex = 1;
                }
                if (i > 0)
                {
                    sbin             = new Wafer_Sbin();
                    sbin.ID          = Guid.NewGuid().ToString().Replace("-", "");
                    sbin.WaferID     = waferid;
                    sbin.LotID       = lot.ID;
                    sbin.SbinValue   = !string.IsNullOrEmpty(allBinPercentList[waferIndex]) ? Math.Round(Convert.ToDouble(allBinPercentList[waferIndex]), 2, MidpointRounding.AwayFromZero).ToString("f2") : "0";
                    sbin.IsTriggered = false;
                    sbin.SbinText    = allBinList[i];
                    sbin.SbinLimit   = !string.IsNullOrEmpty(allBinLimtList[i]) ? Math.Round(Convert.ToDouble(allBinLimtList[i]), 2, MidpointRounding.AwayFromZero).ToString("f2") : "0";
                    sbin.Sort        = i;
                    sbin.CreatedTime = DateTime.Now.ToLocalTime();
                    sbinWay.SaveSBin(sbin);
                }
            }
        }
 public void SaveCPJsonlot(Lot_Transformed lot)
 {
     this.way.CPSocketSaveLot(lot);
     this.SaveWafer(lot);
     //jingying liu apply to colse email notification
     //if (lot.AutoJudeResult.ToUpper() != "NORMAL")
     //{
     //    NotificationService.CreateCpSPRDDisposeNotificationByUserRoleWhileNewLotArrived(lot, Entity.Users.UserRoles.PE, "New lot arrived, is pending your disposition.");
     //}
 }
예제 #6
0
        public ActionResult mDetail(string id)
        {
            Lot_Transformed lot = service.GetTransformById(id);

            if (lot != null)
            {
                lot.StatusText = WaferHelper.waferStatusDes(lot.Status);
            }
            IList <Wafer_Sbin> list  = sbinService.GetSbinTextByLotId(id);
            LotDetailModel     model = new LotDetailModel();

            model.LotTransformed = lot;
            model.ListSbin       = list;
            return(base.View(model));
        }
예제 #7
0
        public void UpdateLotStatus(string lotid, int type)
        {
            Lot_TransformedGateway lotGateway = new Lot_TransformedGateway();
            Lot_Transformed        lot        = lotGateway.GetTransformById(lotid);

            if (lot != null)
            {
                int status = GetLotStatus(lotid);
                lot.Status = status;
                if (type != 3)
                {
                    lot.OperatorStatus = GetLotOperatorStatus(lotid);
                    //string sql = "select ID from vw_Wafers where TransformID='" + lotid+ "' and SPRDDecision!="+(int)WaferSelection.Split;
                    //int count = this.dbGateway.GetRecordCountBySQLStatement(sql);
                    lot.WfCount = GetWaferCountNoSplitByLotId(lotid);
                }
                lotGateway.UpdateLot(lot);
            }
        }
        private void SaveWafer(Lot_Transformed lot)
        {
            List <string> waferList = lot.WaferList;

            if (waferList != null && waferList.Count > 0)
            {
                SqlWafer      wafer             = null;
                int           index             = 0;
                string        waferid           = "";
                int           waferIndex        = 0;
                List <string> allBinPercentList = lot.AllBinPercentList;
                int           waferidcount      = lot.WaferidCount;
                foreach (string s in waferList)
                {
                    waferid           = Guid.NewGuid().ToString().Replace("-", "");
                    wafer             = new SqlWafer();
                    wafer.ID          = waferid;
                    wafer.TransformID = lot.ID;
                    wafer.WaferID     = s.Substring(lot.LotId.Length, s.Length - lot.LotId.Length);
                    wafer.Status      = lot.Status;
                    wafer.HoldReason  = lot.HoldReason;
                    // stryield=allBinPercentList[index * waferidcount] != null ? Math.Round(Convert.ToDouble(allBinPercentList[index * waferidcount].ToString()), 2, MidpointRounding.AwayFromZero).ToString("f2") : "0";
                    wafer.Yield = allBinPercentList[index * waferidcount] != null?decimal.Parse(Math.Round(Convert.ToDouble(allBinPercentList[index *waferidcount].ToString()), 2, MidpointRounding.AwayFromZero).ToString("f2")) : 0;

                    wafer.CompletionDate = lot.CompletionDate;
                    wafer.PEDispose      = 0;
                    wafer.QADispose      = 0;
                    wafer.SPRDDecision   = 0;
                    wafer.CreateDate     = DateTime.Now.ToLocalTime();
                    wafer.VendorConfirm  = 0;
                    wafer.Program        = lot.Program;
                    wafer.StartTime      = lot.StartTime;
                    waferWay2.SaveWafer(wafer);
                    SaveWaferSbin(lot, waferid, ref waferIndex);
                    index++;
                }
            }
        }
예제 #9
0
        static void Main(string[] args)
        {
            string osatID = "Ardentec";

            FileInfo[] files = new DirectoryInfo(@"C:\LHD_APPLICATION\MessageCenter\Messages\" + osatID + @"\In\").GetFiles();
            int        num   = 0;

            for (int i = 0; i <= (files.Length - 1); i++)
            {
                IList <string> messages = new List <string>();
                num++;
                FileInfo info2   = files[i];
                string   str2    = FileService.ReadTextFile(info2.FullName);
                int      index   = str2.IndexOf("{\"LOT_JUDGEMENT");
                string   jsonStr = str2.Substring(index, (str2.Length - index) - 1);
                //Lot lot = LotService.ReadLotFromJson(osatID, jsonStr, messages);
                //Console.WriteLine(osatID + messages);
                //if (lot != null)
                //{
                //    LotService.SaveLotAndInformQA_AND_PE(lot);
                //    //this.lblPrompt.Text = string.Format("{0} lots loaded", i + 1);
                //}

                Lot_TransformService lts = new Lot_TransformService();
                Lot_Transformed      lt  = lts.ReadJson(jsonStr, messages);

                if (lt != null)
                {
                    lts.SaveCPJsonlot(lt);
                }


                //Application.DoEvents();
            }
            Console.WriteLine(string.Format("Import from file successed. {0} lots imported.", num));
            Console.Read();
        }
예제 #10
0
        public static void CreateCPDisposeNotification(Lot_Transformed lot, string message, User user)
        {
            //Notification newNotification = new Notification
            //{
            //    CreateTime = DateTime.Now,
            //    EmailID = Guid.NewGuid().ToString(),
            //    LotID = lot.ID,
            //    Message = message,
            //    MessageID = Guid.NewGuid().ToString(),
            //    NotificationType = NotificationTypes.LotDispose,
            //    Opened = false,
            //    ReadTime = Convert.ToDateTime("1999-12-31"),
            //    RecipientID = user.UserID,
            //    RecordState = 0,
            //    UpdateTime = DateTime.Now
            //};
            //notificationGateway.AddNew(newNotification);
            string str = emailGateway.GetEmailByID("SPRDDecisionCP").Body.Replace("InsertFullNameHere", user.FullName).Replace("insertLotNoHere", lot.LotId).Replace("InsertUrlHere", string.Format("https://lhd.unisoc.com/Lots/Transform/Detail?id={0}", lot.ID)).Replace("InsertTimeHere", DateTime.Now.ToString("yyyy-MM-dd hh:MM:ss")).Replace("InsertHoldReasonHere", lot.HoldReason);

            object[] args    = new object[] { lot.Vendor, lot.WaferCode, lot.ProductName, lot.LotId, lot.Stage };
            string   subject = string.Format("[LHD] {0}/{1}/{2}/{3}/{4}", args);

            CreateEmail(Guid.NewGuid().ToString(), user.UserID, user.Email, subject, str, lot.ID);
        }
예제 #11
0
 public int SaveLot(Lot_Transformed lot)
 {
     return(this.dbGateway.AddNew(lot));
 }
예제 #12
0
 public void UpdateLot(Lot_Transformed lot)
 {
     this.dbGateway.UpdateByFieldValue("ID", lot.ID, lot);
 }
        private Lot_Transformed BindLotInfo(JObject obj)
        {
            Lot_Transformed lot   = ReadMeta(obj);
            string          lotid = Guid.NewGuid().ToString().Replace("-", "");

            lot.ID = lotid;
            // lot.WaferCode = lot.WaferCode;
            //lot.Vendor = lot.Vendor;
            lot.ProductName = obj["product"] != null ? obj["product"].ToString() : "";
            lot.LotId       = obj["lotId"] != null ? obj["lotId"].ToString() : "";
            string dicision = obj["decision"] != null ? obj["decision"].ToString() : "";

            lot.AutoJudeResult = dicision;
            int status = lot.AutoJudeResult.ToLower() == LotAutoJudgement.hold.ToString() ? (int)WaferStatus.WaitPE : (int)WaferStatus.Close;

            lot.Status  = status;
            lot.WfCount = lot.WaferList.Count;
            if (obj["stats"] != null)
            {
                Dictionary <string, string> dicstats = JsonConvert.DeserializeObject <Dictionary <string, string> >(obj["stats"].ToString());
                decimal yield = dicstats["passPercent"] != null?decimal.Parse(Math.Round(Convert.ToDouble(dicstats["passPercent"].ToString()), 2, MidpointRounding.AwayFromZero).ToString("f2")) : 0;

                lot.Yield = yield;// (dicstats["passPercent"] != null) ? Math.Round(Convert.ToDouble(dicstats["passPercent"].ToString()), 2, MidpointRounding.AwayFromZero) : 0.00;
            }
            if (obj["lotFinishTime"] != null)
            {
                lot.CompletionDate = DateTime.ParseExact(obj["lotFinishTime"].ToString(), "yyyyMMdd-HHmmss.fff", CultureInfo.CurrentCulture);
            }
            if (obj["creationDate"] != null)
            {
                lot.UploadDate = DateTime.ParseExact(obj["creationDate"].ToString(), "yyyyMMdd-HHmmss.fff", CultureInfo.CurrentCulture);
            }
            else
            {
                lot.UploadDate = DateTime.Now.ToLocalTime();
            }
            if (obj["decisionReason"] != null)
            {
                lot.HoldReason = obj["decisionReason"].ToString();
            }
            lot.Stage       = obj["stage"] != null ? obj["stage"].ToString() : "";
            lot.TestProgram = obj["programName"] != null ? obj["programName"].ToString() : "";//obj["temperature"] != null ? obj["temperature"].ToString() : "";
            lot.TesterID    = obj["tester"] != null ? obj["tester"].ToString() : "";
            lot.Platform    = obj["testerType"] != null ? obj["testerType"].ToString() : "";
            lot.LBNO        = obj["probecard"] != null ? obj["probecard"].ToString() : "";
            lot.Url         = obj["url"] != null ? obj["url"].ToString() : "";
            lot.CreateDate  = DateTime.Now.ToLocalTime();
            if (dicision.ToUpper().Equals("NORMAL"))
            {
                lot.OperatorStatus = (int)OperationStatus.Release;
            }
            else
            {
                lot.OperatorStatus = (int)OperationStatus.Hold;
            }
            lot.RecordType = "Record";
            lot.VersionID  = 0;
            lot.Program    = obj["programName"] != null ? obj["programName"].ToString() : "";
            if (obj["startTime"] != null)
            {
                lot.StartTime = DateTime.ParseExact(obj["startTime"].ToString(), "yyyyMMdd-HHmmss.fff", CultureInfo.CurrentCulture);;
            }
            return(lot);
        }
예제 #14
0
        public static void CreateCpSPRDDisposeNotificationByUserRoleWhileNewLotArrived(Lot_Transformed lot, UserRoles role, string message)
        {
            int recordCount = 0;

            foreach (User user in UserService.GetUsersByRole(role, 0, 0x270f, out recordCount, "CP"))
            {
                CreateCPDisposeNotification(lot, message, user);
            }
        }
예제 #15
0
 public static void CreateCpOSATConfirmNotificationsWhilePeDispose(string osatID, Lot_Transformed lot, string message, int dispose)
 {
     new Dictionary <string, string>();
     foreach (OSATUser user in UserService.GetCPOSATUsersByOSATID(osatID))
     {
         //Notification newNotification = new Notification
         //{
         //    CreateTime = DateTime.Now,
         //    EmailID = Guid.NewGuid().ToString(),
         //    LotID = lot.ID,
         //    Message = message,
         //    MessageID = Guid.NewGuid().ToString(),
         //    NotificationType = NotificationTypes.Confirm,
         //    Opened = false,
         //    ReadTime = Convert.ToDateTime("1999-12-31"),
         //    RecipientID = user.MD5CID,
         //    RecordState = 0,
         //    UpdateTime = DateTime.Now
         //};
         //notificationGateway.AddNew(newNotification);
         string newvalue = WaferHelper.WaferSelectionDes(dispose);
         string str      = emailGateway.GetEmailByID("OSATNotificationCP").Body.Replace("InsertFullNameHere", user.SupUserName).Replace("insertLotNoHere", lot.LotId).Replace("InsertUrlHere", string.Format("https://lhd.unisoc.com/Lots/wafer/list?transformID={0}", lot.ID)).Replace("InsertTimeHere", DateTime.Now.ToString("yyyy-MM-dd hh:MM:ss")).Replace("insertDisposeTextHere", newvalue);
         string subject  = string.Format("Please confirm Lot {0} dispose", lot.LotId);
         CreateEmail(Guid.NewGuid().ToString(), user.MD5CID, user.SupMail, subject, str, lot.ID);
     }
 }
예제 #16
0
        public static string AdminAddress = Convert.ToString(ConfigurationManager.AppSettings["AdminAddress"]);//账号

        public void Execute(JobExecutionContext context)
        {
            Log.Instance.Info("LHD Import Service Execute Start--------------------------------------------" + DateTime.Now.ToString());
            try
            {
                SpreadtrumLHDEntities Db = new SpreadtrumLHDEntities();
                //List<LOTSImportLogs> lot = new List<LOTSImportLogs>();
                DateTime now    = DateTime.Now.AddMinutes(-2);
                var      tbList = Db.LOTSImportLogs.Where(x => x.FormatStatus == "Pending" && x.CreateTime < now).ToList();
                if (tbList.Count > 0)
                {
                    foreach (var m in tbList)
                    {
                        Lot                  lot = new Lot();
                        Lot_Transformed      lt  = new Lot_Transformed();
                        Lot_TransformService lts = new Lot_TransformService();
                        try
                        {
                            if (m.Type.ToUpper() == "FT")
                            {
                                IList <string> messages = new List <string>();
                                string         str2     = FileService.ReadTextFile(m.FilePath);
                                int            index    = str2.IndexOf("{\"LOT_JUDGEMENT");
                                string         jsonStr  = str2.Substring(index, (str2.Length - index) - 1);
                                lot      = LotService.ReadLotFromJson(m.osatID, jsonStr, messages);
                                m.LotNO  = lot.SubconLot;
                                m.Device = lot.DeviceCode + "(" + lot.DeviceName + ")";
                                m.Stage  = lot.Stage;
                            }
                            else if (m.Type.ToUpper() == "CP")
                            {
                                IList <string> messages = new List <string>();
                                string         str2     = FileService.ReadTextFile(m.FilePath);
                                int            index    = str2.IndexOf("{\"LOT_JUDGEMENT");
                                string         jsonStr  = str2.Substring(index, (str2.Length - index) - 1);
                                lt = lts.ReadJson(jsonStr, messages);
                            }
                            m.FormatStatus = "Success";
                            m.FormatTime   = DateTime.Now;
                        }
                        catch (Exception fex)
                        {
                            m.FormatStatus = "Error";
                            m.Logs        += DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "--" + fex.Message + "<br/>";
                            Db.Set <LOTSImportLogs>().Attach(m);
                            Db.Entry(m).State = EntityState.Modified;

                            continue;
                        }

                        try
                        {
                            if (m.Type.ToUpper() == "FT")
                            {
                                if (lot != null)
                                {
                                    LotService.SaveLotAndInformQA_AND_PE(lot);
                                }
                            }
                            else if (m.Type.ToUpper() == "CP")
                            {
                                if (lt != null)
                                {
                                    lts.SaveCPJsonlot(lt);
                                }
                            }
                            m.ImportLHDStatus = "Success";
                            m.ImportLHDTime   = DateTime.Now;
                        }
                        catch (Exception iex)
                        {
                            m.Logs           += DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "--" + iex.Message + "<br/>";
                            m.ImportLHDStatus = "Error";
                        }
                        Db.Set <LOTSImportLogs>().Attach(m);
                        Db.Entry(m).State = EntityState.Modified;
                    }
                }
                Db.SaveChanges();


                #region Template
                //    CVMSEntities Db = new CVMSEntities();

                //    List<T_Sys_MailQueue> MailsList = new List<T_Sys_MailQueue>();
                //    //Log.Instance.Info("Load Mail Data Begin-------------------------------------------" + DateTime.Now.ToString());
                //    var tbList = Db.T_Sys_MailQueue.Where(x => x.Status == "Pending").ToList();
                //    //Log.Instance.Info("Load Mail Data End-------------------------------------------" + DateTime.Now.ToString());

                //    if (tbList.Count > 0)
                //    {
                //        foreach (var m in tbList)
                //        {
                //            try
                //            {
                //                List<string> tolist = new List<string>();
                //                List<string> cclist = new List<string>();
                //                List<string> bcclist = new List<string>();
                //                //Log.Instance.Info("Load To Data Begin-------------------------------------------" + DateTime.Now.ToString());
                //                //Log.Instance.Info("Load To Data Begin-------------------------------------------" + m.To);

                //                if (!string.IsNullOrEmpty(m.To))
                //                {
                //                    string[] tos = m.To.Split(new char[1] { ';' });
                //                    foreach (var to in tos)
                //                    {
                //                        tolist.Add(to);
                //                    }

                //                }
                //                //Log.Instance.Info("Load CC Data Begin-------------------------------------------" + DateTime.Now.ToString());

                //                if (!string.IsNullOrEmpty(m.CC))
                //                {
                //                    string[] ccs = m.CC.Split(new char[1] { ';' });
                //                    foreach (var cc in ccs)
                //                    {
                //                        cclist.Add(cc);
                //                    }

                //                }
                //                //Log.Instance.Info("Load BCC Data Begin-------------------------------------------" + DateTime.Now.ToString());

                //                if (!string.IsNullOrEmpty(m.BCC))
                //                {
                //                    string[] bccs = m.BCC.Split(new char[1] { ';' });
                //                    foreach (var bcc in bccs)
                //                    {
                //                        bcclist.Add(bcc);
                //                    }
                //                }
                //                //Log.Instance.Info("Load Priority Data Begin-------------------------------------------" + DateTime.Now.ToString());

                //                MailPriority Priority;
                //                if (string.IsNullOrEmpty(m.Priority))
                //                {
                //                    Priority = MailPriority.Normal;
                //                }
                //                else
                //                {
                //                    Priority = (MailPriority)Enum.Parse(typeof(MailPriority), m.Priority);
                //                }


                //                //Log.Instance.Info("Send Mail Begin--------------------------------------------" + DateTime.Now.ToString());
                //                MailHelp.SendMail(tolist, cclist, bcclist, m.Subject, m.Boday, Priority);
                //                m.Status = "Sent";
                //                m.SendTime = DateTime.Now;
                //                //Log.Instance.Info("Send Mail End--------------------------------------------" + DateTime.Now.ToString());
                //            }
                //            catch (Exception ex)
                //            {
                //                Log.Instance.Error(ex);
                //                List<string> tolist = new List<string>();
                //                tolist.Add(AdminAddress);
                //                MailHelp.SendMail(tolist, null, null, "CVMS Mail Send Error", ex.Message, MailPriority.High);
                //                m.Status = "Error";
                //            }
                //            Db.Set<T_Sys_MailQueue>().Attach(m);
                //            Db.Entry(m).State = EntityState.Modified;

                //        }
                //        Db.SaveChanges();
                //    }
                #endregion
            }
            catch (Exception e)
            {
                Log.Instance.Error(e);
            }
            Log.Instance.Info("LHD Import Service Execute End--------------------------------------------" + DateTime.Now.ToString());
        }
예제 #17
0
        public ActionResult test()
        {
            string          jsonStr = service.GetTransformById("test1").TestStr;
            IList <string>  message = new List <string>();
            Lot_Transformed lot     = service.ReadJson(jsonStr, message);

            service.SaveCPJsonlot(lot);
            #region
            //JObject obj = (JObject)JsonConvert.DeserializeObject(jsonStr);
            //Lot_Transformed lot = new Lot_Transformed();
            //lot.ProductName = obj["product"].ToString();
            //lot.LotId = obj["lotId"].ToString();
            //string str_completiondate = obj["lotFinishTime"].ToString();
            //DateTime dt = Convert.ToDateTime(str_completiondate.Substring(0, 4) + "-" + str_completiondate.Substring(4, 2) + "-" + str_completiondate.Substring(6, 2) + " " + str_completiondate.Substring(9, 2) + ":" + str_completiondate.Substring(11, 2) + ":" + str_completiondate.Substring(13, 2) + "." + str_completiondate.Substring(16, 3));
            //lot.CompletionDate = dt;
            //lot.AutoJudeResult = obj["decision"].ToString();
            //Dictionary<string, string> dicstats = JsonConvert.DeserializeObject<Dictionary<string, string>>(obj["stats"].ToString());
            //lot.Yield = (dicstats["passPercent"] != null) ? Math.Round(Convert.ToDouble(dicstats["passPercent"].ToString()), 2, MidpointRounding.AwayFromZero) : 0.0;
            //lot.Stage = obj["stage"].ToString();
            //lot.TestProgram = obj["temperature"].ToString();
            //lot.TesterID = obj["tester"].ToString();
            //lot.Platform = obj["testerType"].ToString();
            //lot.LBNO = obj["probecard"].ToString();
            //List<LotMeteModel> metaList = JsonConvert.DeserializeObject<List<LotMeteModel>>(obj["metadata"].ToString());
            //List<string> waferList = new List<string>();
            //int waferidcount = 0;
            //List<string> allBinList = new List<string>();
            //List<string> allBinLimtList = new List<string>();
            //List<string> allBinPercentList = new List<string>();
            //foreach (LotMeteModel item in metaList)
            //{
            //    if (item.key == EnumLotMeta.osat.ToString())
            //    {
            //        lot.Vendor = item.values[0];
            //    }
            //    if (item.key == EnumLotMeta.allItem.ToString())
            //    {
            //        int index = 0;
            //        string waferid = "";
            //        foreach (string s in item.values)
            //        {
            //            index++;
            //            if (index > 1)
            //            {
            //                if (!waferid.Equals(s))
            //                {
            //                    waferList.Add(s);
            //                    waferidcount = 0;
            //                }
            //                waferidcount++;
            //            }
            //            else
            //            {
            //                lot.WaferCode = s;
            //            }
            //            waferid = s;
            //        }
            //    }
            //    if (item.key == EnumLotMeta.allBin.ToString())
            //    {
            //        allBinList = item.values;
            //        allBinList.RemoveAt(0);
            //    }
            //    if (item.key == EnumLotMeta.allBinLimit.ToString())
            //    {
            //        allBinLimtList = item.values;
            //        allBinLimtList.RemoveAt(0);
            //    }
            //    if (item.key == EnumLotMeta.allBinPercent.ToString())
            //    {
            //        allBinPercentList = item.values;
            //        allBinPercentList.RemoveAt(0);
            //    }
            //}
            //lot.WfCount = waferList.Count;
            ////  lot.UploadDate = DateTime.Now.ToLocalTime();
            //lot.Url = obj["url"].ToString();
            //int status = lot.AutoJudeResult.ToLower() == LotAutoJudgement.hold.ToString() ? (int)WaferStatus.WaitPE : (int)WaferStatus.Close;
            //lot.Status = status;
            //string lotid = Guid.NewGuid().ToString().Replace("-", "");
            //lot.ID = lotid;
            //lot.CreateDate = DateTime.Now.ToLocalTime();
            //string holdReason = "";
            //if (obj["decisionReason"] != null)
            //{
            //    holdReason = obj["decisionReason"].ToString();
            //}
            //lot.HoldReason = holdReason;
            //int suc = service.SaveLot(lot);
            //if (suc >= 0)
            //{//添加wafer
            //    Response.Write("添加lot成功");
            //    SqlWafer wafer = null;
            //    int index = 0;
            //    int waferIndex = 0;
            //    foreach (string s in waferList)
            //    {
            //        string waferid = Guid.NewGuid().ToString().Replace("-", "");
            //        wafer = new SqlWafer();
            //        wafer.ID = waferid;
            //        wafer.TransformID = lotid;
            //        wafer.WaferID = s;
            //        wafer.Status = status;
            //        wafer.HoldReason = holdReason;
            //        wafer.Yield = allBinPercentList[index * waferidcount] != null ? float.Parse(Math.Round(Convert.ToDouble(allBinPercentList[index * waferidcount].ToString()), 2, MidpointRounding.AwayFromZero).ToString()) : 0;
            //        wafer.CompletionDate = dt;
            //        wafer.PEDispose = 0;
            //        wafer.QADispose = 0;
            //        wafer.SPRDDecision = 0;
            //        wafer.CreateDate = DateTime.Now.ToLocalTime();
            //        wafer.VendorConfirm = 0;
            //        wafer.Program = obj["Program"] != null ? obj["Program"].ToString() : "";
            //        if (obj["startTime"] != null)
            //        {
            //            string str_starttime = obj["startTime"].ToString();
            //            DateTime startdt = DateTime.Parse(str_starttime.Substring(0, 4) + "-" + str_starttime.Substring(4, 2) + "-" + str_starttime.Substring(6, 2) + " " + str_starttime.Substring(9, 2) + ":" + str_starttime.Substring(11, 2) + ":" + str_starttime.Substring(13, 2) + "." + str_starttime.Substring(16, 3));
            //            wafer.StartTime = startdt;
            //        }
            //        else
            //        {
            //            wafer.StartTime = DateTime.Now.ToLocalTime();
            //        }
            //        if (waferService.SaveWafer(wafer) >= 0)//保存sbin
            //        {
            //            Response.Write("添加wafer成功");
            //            for (int i = 0; i < waferidcount; i++)
            //            {
            //                waferIndex++;
            //                if (waferIndex == 2 && i == 1)
            //                {
            //                    waferIndex = 1;
            //                }
            //                if (i > 0)
            //                {

            //                    try
            //                    {
            //                        Wafer_Sbin sbin = new Wafer_Sbin();
            //                        sbin.ID = Guid.NewGuid().ToString().Replace("-", "");
            //                        sbin.WaferID = waferid;
            //                        sbin.LotID = lotid;
            //                        sbin.SbinValue = !string.IsNullOrEmpty(allBinPercentList[waferIndex]) ? Math.Round(Convert.ToDouble(allBinPercentList[waferIndex]), 2, MidpointRounding.AwayFromZero).ToString() : "0";
            //                        sbin.IsTriggered = false;
            //                        sbin.SbinText = allBinList[i];
            //                        sbin.SbinLimit = !string.IsNullOrEmpty(allBinLimtList[i]) ? Math.Round(Convert.ToDouble(allBinLimtList[i]), 2, MidpointRounding.AwayFromZero).ToString() : "0";
            //                        sbin.Sort = i;
            //                        sbin.CreatedTime = DateTime.Now.ToLocalTime();
            //                        sbinService.SaveSBin(sbin);
            //                        Response.Write("添加sbin成功");
            //                    }
            //                    catch (Exception e)
            //                    {
            //                        throw;
            //                    }
            //                }
            //            }
            //        }

            //        index++;
            //    }
            //}
            #endregion
            return(View());
        }
 public int SaveLot(Lot_Transformed lot)
 {
     return(way.SaveLot(lot));
 }
 private Lot_Transformed ReadMeta(JObject metaObj)
 {
     try
     {
         if (metaObj["metadata"] != null)
         {
             List <LotMeteModel> metaList = JsonConvert.DeserializeObject <List <LotMeteModel> >(metaObj["metadata"].ToString());
             if (metaList != null && metaList.Count > 0)
             {
                 Lot_Transformed mata              = new Lot_Transformed();
                 List <string>   waferList         = new List <string>();
                 int             waferidcount      = 0;
                 List <string>   allBinList        = new List <string>();
                 List <string>   allBinLimtList    = new List <string>();
                 List <string>   allBinPercentList = new List <string>();
                 int             index             = 0;
                 string          waferid           = "";
                 foreach (LotMeteModel item in metaList)
                 {
                     if (item.key == EnumLotMeta.osat.ToString())
                     {
                         mata.Vendor = item.values[0];
                     }
                     #region allitem
                     if (item.key == EnumLotMeta.allItem.ToString())
                     {
                         index   = 0;
                         waferid = "";
                         foreach (string s in item.values)
                         {
                             index++;
                             if (index > 1)
                             {
                                 if (!waferid.Equals(s))
                                 {
                                     waferList.Add(s);
                                     waferidcount = 0;
                                 }
                                 waferidcount++;
                             }
                             else
                             {
                                 mata.WaferCode = s;
                             }
                             waferid = s;
                         }
                     }
                     #endregion
                     if (item.key == EnumLotMeta.allBin.ToString())
                     {
                         allBinList = item.values;
                         allBinList.RemoveAt(0);
                     }
                     if (item.key == EnumLotMeta.allBinLimit.ToString())
                     {
                         allBinLimtList = item.values;
                         allBinLimtList.RemoveAt(0);
                     }
                     if (item.key == EnumLotMeta.allBinPercent.ToString())
                     {
                         allBinPercentList = item.values;
                         allBinPercentList.RemoveAt(0);
                     }
                 }
                 mata.WaferList         = waferList;
                 mata.WaferidCount      = waferidcount;
                 mata.AllBinList        = allBinList;
                 mata.AllBinLimtList    = allBinLimtList;
                 mata.AllBinPercentList = allBinPercentList;
                 return(mata);
             }
         }
         return(null);
     }
     catch
     {
         return(null);
     }
 }
예제 #20
0
        private Lot_Transformed ReadMeta(JObject metaObj)
        {
            try
            {
                if (metaObj["metadata"] != null)
                {
                    List <LotMeteModel> metaList = JsonConvert.DeserializeObject <List <LotMeteModel> >(metaObj["metadata"].ToString());
                    if (metaList != null && metaList.Count > 0)
                    {
                        Lot_Transformed mata              = new Lot_Transformed();
                        List <string>   waferList         = new List <string>();
                        int             waferidcount      = 0;
                        List <string>   allBinList        = new List <string>();
                        List <string>   allBinLimtList    = new List <string>();
                        List <string>   allBinPercentList = new List <string>();
                        int             index             = 0;
                        string          waferid           = "";
                        bool            withHlimit        = false;
                        LotMeteModel    allbin            = metaList.Where(p => p.key == "allBin").FirstOrDefault <LotMeteModel>();

                        if (allbin.values[1] != "yield")
                        {
                            withHlimit = true;
                        }

                        foreach (LotMeteModel item in metaList)
                        {
                            if (item.key == EnumLotMeta.osat.ToString())
                            {
                                mata.Vendor = item.values[0];
                            }
                            #region allitem
                            if (item.key == EnumLotMeta.allItem.ToString())
                            {
                                if (withHlimit)
                                {
                                    index = 1;
                                }
                                else
                                {
                                    index = 0;
                                }
                                waferid = "";
                                foreach (string s in item.values)
                                {
                                    index++;
                                    int startIndex = withHlimit ? 2 : 1;
                                    if (index > startIndex)
                                    {
                                        if (!waferid.Equals(s))
                                        {
                                            waferList.Add(s);
                                            waferidcount = 0;
                                        }
                                        waferidcount++;
                                    }
                                    else
                                    {
                                        mata.WaferCode = s;
                                    }
                                    waferid = s;
                                }
                            }
                            #endregion
                            if (item.key == EnumLotMeta.allBin.ToString())
                            {
                                allBinList = item.values;
                                allBinList.RemoveAt(0);
                            }
                            if (item.key == EnumLotMeta.allBinLimit.ToString())
                            {
                                allBinLimtList = item.values;
                                allBinLimtList.RemoveAt(0);
                            }
                            if (item.key == EnumLotMeta.allBinPercent.ToString())
                            {
                                allBinPercentList = item.values;
                                allBinPercentList.RemoveAt(0);
                            }
                        }
                        if (withHlimit)
                        {
                            allBinList.RemoveAt(0);
                            allBinLimtList.RemoveAt(0);
                            allBinPercentList.RemoveAt(0);
                        }
                        mata.WaferList         = waferList;
                        mata.WaferidCount      = waferidcount;
                        mata.AllBinList        = allBinList;
                        mata.AllBinLimtList    = allBinLimtList;
                        mata.AllBinPercentList = allBinPercentList;
                        return(mata);
                    }
                }
                return(null);
            }
            catch
            {
                return(null);
            }
        }