public static void WoInputCountDataloader(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count == 0)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            MESStationSession count = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (count == null)
            {
                count = new MESStationSession()
                {
                    MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(count);
            }
            MESStationSession wo = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY);

            if (wo == null)
            {
                wo = new MESStationSession()
                {
                    MESDataType = Paras[1].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[1].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(wo);
            }
            string workorder = Station.StationSession[1].InputValue.ToString();

            MESStation.LogicObject.WorkOrder   worder = new LogicObject.WorkOrder();
            MESDataObject.Module.T_R_WO_BASE   trwb   = new MESDataObject.Module.T_R_WO_BASE(Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
            MESDataObject.Module.Row_R_WO_BASE rrwb   = (MESDataObject.Module.Row_R_WO_BASE)trwb.NewRow();
            rrwb = worder.GetWoMode(workorder, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
            Station.AddMessage("MES00000029", new string[] { "Workorder", wo.ToString() }, MESReturnView.Station.StationMessageState.Message);
        }
Exemple #2
0
        public void addWOByWOHeader(string BU, string user, string routeid, Row_R_WO_HEADER_TJ r_WO_HEADER_TJ, OleExec DB)
        {
            T_R_WO_BASE   t_R_WO_BASE   = new T_R_WO_BASE(DB, this.DBType);
            Row_R_WO_BASE row_r_wo_base = (Row_R_WO_BASE)t_R_WO_BASE.NewRow();

            row_r_wo_base.ID              = t_R_WO_BASE.GetNewID(BU, DB);
            row_r_wo_base.WORKORDERNO     = r_WO_HEADER_TJ.AUFNR;
            row_r_wo_base.PLANT           = r_WO_HEADER_TJ.WERKS;
            row_r_wo_base.RELEASE_DATE    = DateTime.Now;
            row_r_wo_base.DOWNLOAD_DATE   = DateTime.Now;
            row_r_wo_base.PRODUCTION_TYPE = "";
            row_r_wo_base.WO_TYPE         = "";
            row_r_wo_base.SKUNO           = r_WO_HEADER_TJ.MATNR;
            row_r_wo_base.SKU_VER         = r_WO_HEADER_TJ.REVLV;
            row_r_wo_base.SKU_SERIES      = "";
            row_r_wo_base.SKU_NAME        = "";
            row_r_wo_base.SKU_DESC        = r_WO_HEADER_TJ.MAKTX;
            row_r_wo_base.CUST_PN         = "";
            row_r_wo_base.CUST_PN_VER     = "";
            row_r_wo_base.CUSTOMER_NAME   = "";
            row_r_wo_base.ROUTE_ID        = routeid;
            row_r_wo_base.START_STATION   = "";
            row_r_wo_base.KP_LIST_ID      = "";
            row_r_wo_base.CLOSED_FLAG     = "0";
            row_r_wo_base.CLOSE_DATE      = DateTime.Parse("1990-01-01 00:00:00.000");
            row_r_wo_base.WORKORDER_QTY   = double.Parse(r_WO_HEADER_TJ.GAMNG);
            row_r_wo_base.INPUT_QTY       = 0;
            row_r_wo_base.FINISHED_QTY    = 0;
            row_r_wo_base.SCRAPED_QTY     = 0;
            row_r_wo_base.STOCK_LOCATION  = "";
            row_r_wo_base.PO_NO           = "";
            row_r_wo_base.CUST_ORDER_NO   = "";
            row_r_wo_base.ROHS            = "";
            row_r_wo_base.EDIT_EMP        = user;
            row_r_wo_base.EDIT_TIME       = DateTime.Now;
            string sql    = row_r_wo_base.GetInsertString(this.DBType);
            string result = DB.ExecSQL(sql);
        }
Exemple #3
0
        //處理SN狀態/記錄過站記錄/統計良率
        public R_TCQS_YIELD_RATE_DETAIL CheckTCQSTest(string SerialNo, string SkuNo, string WorkorderNo, string Line, string StationName, string DeviceName, string Bu, string PassOrFail, string EmpNo, DateTime DT, OleExec DB)
        {
            DataTable dataTable = new DataTable();
            string    sql = string.Empty;
            string    RepassModel = "", RetestModel = "", Device_Name = "";
            int       PassLimit = 1, RetestLimit = 1; //所有未設定的機種,默認以該參數統計TCQS
            int       PassCount = 0, RetestCount = 0; //臨時表記錄的Pass/Retest測試次數
            int       PassCountFlag   = 0;            //標識是否有過站記錄,在Total統計時以確定Fresh/Rework狀態
            int       RetestCountFlag = 0,            //標識是否有測試記錄,在TCQS統計時以確定Fresh/Rework狀態
                      RepairFlag      = 0;            //標識是否做過站處理
            T_R_WO_BASE   WoTable     = null;
            Row_R_WO_BASE WoRow       = null;

            WoTable = new T_R_WO_BASE(DB, this.DBType);
            WoRow   = WoTable.GetWo(WorkorderNo, DB);
            //初使化R_TCQS_YIELD_RATE_DETAIL
            R_TCQS_YIELD_RATE_DETAIL RTYRD = new R_TCQS_YIELD_RATE_DETAIL()
            {
                WORK_DATE              = DT.ToString("yyyy-MM-dd"),
                WORK_TIME              = DT.ToString("HH"),
                PRODUCTION_LINE        = Line,
                CLASS_NAME             = GetWorkClass(DT.ToString("HH:mm:ss"), DB),
                STATION_NAME           = StationName,
                DEVICE_NAME            = DeviceName,
                WORKORDERNO            = WorkorderNo,
                SKUNO                  = SkuNo,
                SKU_NAME               = WoRow.SKU_NAME,
                SKU_SERIES             = WoRow.SKU_SERIES,
                TOTAL_REWORK_BUILD_QTY = 0,
                TOTAL_REWORK_PASS_QTY  = 0,
                TOTAL_REWORK_FAIL_QTY  = 0,
                TOTAL_FRESH_BUILD_QTY  = 0,
                TOTAL_FRESH_PASS_QTY   = 0,
                TOTAL_FRESH_FAIL_QTY   = 0,
                TCQS_REWORK_BUILD_QTY  = 0,
                TCQS_REWORK_PASS_QTY   = 0,
                TCQS_REWORK_FAIL_QTY   = 0,
                TCQS_FRESH_BUILD_QTY   = 0,
                TCQS_FRESH_PASS_QTY    = 0,
                TCQS_FRESH_FAIL_QTY    = 0,
                EDIT_EMP               = EmpNo,
                EDIT_TIME              = DT
            };


            sql       = $@"Select PASS_LIMIT,RETEST_LIMIT,REPASS_MODEL,RETEST_MODEL from C_MODEL_ATE_SET_T 
                   Where skuno='{SkuNo}' and station_name='{StationName}' ";
            dataTable = DB.ExecSelect(sql).Tables[0];
            //如果有設定則取設定值,否則取默認值
            if (dataTable.Rows.Count > 0)
            {
                PassLimit   = Int32.Parse(dataTable.Rows[0]["PASS_LIMIT"].ToString());
                RetestLimit = Int32.Parse(dataTable.Rows[0]["RETEST_MODEL"].ToString());
                RepassModel = dataTable.Rows[0]["REPASS_MODEL"].ToString();
                RetestModel = dataTable.Rows[0]["RETEST_MODEL"].ToString();
            }
            //獲取臨時表的測試記錄中Pass次數/Fail次數/測試機臺名稱
            sql       = $@"select PASS_COUNT,RETEST_COUNT,DEVICE_NAME from  R_TMP_ATEDATA_T where station_name = '{StationName}' and sn = '{SerialNo}'";
            dataTable = null;
            dataTable = DB.ExecSelect(sql).Tables[0];
            if (dataTable.Rows.Count > 0)
            {
                PassCount   = Int32.Parse(dataTable.Rows[0]["PASS_COUNT"].ToString());
                RetestCount = Int32.Parse(dataTable.Rows[0]["RETEST_COUNT"].ToString());
                Device_Name = dataTable.Rows[0]["DEVICE_NAME"].ToString();
            }
            //獲取產品狀態Fresh or Rework
            sql       = $@"SELECT RESULT_FLAG FROM R_SN_DETAIL WHERE SN = '{SerialNo}' AND STATION_NAME = '{StationName}'";
            dataTable = null;
            dataTable = DB.ExecSelect(sql).Tables[0];
            if (dataTable.Rows.Count > 0)
            {
                //有記錄,代表有測試過,因此TCQS為Rework
                RetestCountFlag = 1;
                foreach (DataRow dr in dataTable.Rows)
                {
                    //有過站記錄,因此總良率為Rework
                    if (dr["RESULT_FLAG"].ToString() == "0" || dr["RESULT_FLAG"].ToString() == "1")
                    {
                        PassCountFlag = 1;
                        break;
                    }
                }
            }

            //統計良率統計數據
            if (PassOrFail == "PASS")//測試結果為PASS
            {
                //如果有Fail記錄
                if (RetestCount > 0)
                {
                    //管控測試PASS次數>1
                    if (PassLimit > 1)
                    {
                        //如果有測試PASS的記錄,則需要判斷是否需切換工站,是否滿足測試次數
                        if (PassCount > 0)
                        {
                            //必須切換測試站
                            if (RepassModel == "0")
                            {
                                if (Device_Name == DeviceName)
                                {
                                    //必須換機臺測試
                                    string errMsg = MESReturnMessage.GetMESReturnMessage("MSGCODE20180526185619");
                                    throw new MESReturnMessage(errMsg);
                                }
                            }
                            else if (RepassModel == "1")   //不允許換機臺測試
                            {
                                if (Device_Name != DeviceName)
                                {
                                    //不允許換機臺測試,必須使用Device_Name機臺測試
                                    string errMsg = MESReturnMessage.GetMESReturnMessage("MSGCODE20180526185620", new string[] { Device_Name });
                                    throw new MESReturnMessage(errMsg);
                                }
                            }
                            //判斷是否滿足PASS測試次數
                            if (PassCount != PassLimit - 1) //不滿足測試次數
                            {
                                RepairFlag = 1;             //不過站,不清臨時表,過站記錄標識為非過站
                            }
                            RTYRD.TCQS_REWORK_BUILD_QTY = 1;
                            RTYRD.TCQS_REWORK_PASS_QTY  = 1;
                        }
                        else  //如果沒有測試PASS的記錄,則直接增加測試PASS次數
                        {
                            RepairFlag = 1;   //不過站,不清臨時表,過站記錄標識為非過站
                            RTYRD.TCQS_REWORK_BUILD_QTY = 1;
                            RTYRD.TCQS_REWORK_PASS_QTY  = 1;
                        }
                    }
                    else  //管控測試PASS次數=1
                    {
                        RTYRD.TCQS_REWORK_BUILD_QTY = 1;
                        RTYRD.TCQS_REWORK_PASS_QTY  = 1;
                    }
                }
                else  //如果臨時表沒有Fail記錄,則需要判斷是否有測試記錄,以確定是Fresh還是Rework
                {
                    //如果有測試記錄,則為Rework
                    if (RetestCountFlag == 1)
                    {
                        RTYRD.TCQS_REWORK_BUILD_QTY = 1;
                        RTYRD.TCQS_REWORK_PASS_QTY  = 1;
                    }
                    else//否則為Fresh
                    {
                        RTYRD.TCQS_FRESH_BUILD_QTY = 1;
                        RTYRD.TCQS_FRESH_PASS_QTY  = 1;
                    }
                }
                //如果做過站處理,則還需要統計總良率
                if (RepairFlag == 0)
                {
                    if (PassCountFlag == 1)//有過站記錄
                    {
                        RTYRD.TOTAL_REWORK_BUILD_QTY = 1;
                        RTYRD.TOTAL_REWORK_PASS_QTY  = 1;
                    }
                    else//沒有過站記錄
                    {
                        RTYRD.TOTAL_FRESH_BUILD_QTY = 1;
                        RTYRD.TOTAL_FRESH_PASS_QTY  = 1;
                    }
                }
            }
            else//測試結果為Fail
            {
                //管控測試重測次數>1
                if (RetestLimit > 1)
                {
                    //有Fail記錄
                    if (RetestCount > 0)
                    {
                        //必須切換測試站
                        if (RepassModel == "0")
                        {
                            if (Device_Name == DeviceName)
                            {
                                //必須換機臺測試
                                string errMsg = MESReturnMessage.GetMESReturnMessage("MSGCODE20180526185619");
                                throw new MESReturnMessage(errMsg);
                            }
                        }
                        else if (RepassModel == "1")  //不允許換機臺測試
                        {
                            if (Device_Name != DeviceName)
                            {
                                //不允許換機臺測試,必須使用Device_Name機臺測試
                                string errMsg = MESReturnMessage.GetMESReturnMessage("MSGCODE20180526185620", new string[] { Device_Name });
                                throw new MESReturnMessage(errMsg);
                            }
                        }
                        //判斷是否滿足重測次數
                        if (RetestCount != RetestLimit - 1) //不滿足測試次數
                        {
                            RepairFlag = 1;                 //不過站,不清臨時表,過站記錄標識為非過站
                        }
                        RTYRD.TCQS_REWORK_BUILD_QTY = 1;
                        RTYRD.TCQS_REWORK_FAIL_QTY  = 1;
                    }
                    else  //允許重測次數>1,且臨時表沒有Fail記錄
                    {
                        RepairFlag = 1;   //不過站,不清臨時表,過站記錄標識為非過站
                        //有測試記錄
                        if (RetestCountFlag == 1)
                        {
                            RTYRD.TCQS_REWORK_BUILD_QTY = 1;
                            RTYRD.TCQS_REWORK_FAIL_QTY  = 1;
                        }
                        else//沒有測試記錄
                        {
                            RTYRD.TCQS_FRESH_BUILD_QTY = 1;
                            RTYRD.TCQS_FRESH_FAIL_QTY  = 1;
                        }
                    }
                }
                else  //管控測試重測次數=1,則需要判斷是否有測試記錄,以確定是Fresh還是Rework
                {
                    //如果有測試記錄,則為Rework
                    if (RetestCountFlag == 1)
                    {
                        RTYRD.TCQS_REWORK_BUILD_QTY = 1;
                        RTYRD.TCQS_REWORK_FAIL_QTY  = 1;
                    }
                    else//否則為Fresh
                    {
                        RTYRD.TCQS_FRESH_BUILD_QTY = 1;
                        RTYRD.TCQS_FRESH_FAIL_QTY  = 1;
                    }
                }
                //如果做過站處理,則還需要統計總良率
                if (RepairFlag == 0)
                {
                    if (PassCountFlag == 1)//有過站記錄
                    {
                        RTYRD.TOTAL_REWORK_BUILD_QTY = 1;
                        RTYRD.TOTAL_REWORK_FAIL_QTY  = 1;
                    }
                    else//沒有過站記錄
                    {
                        RTYRD.TOTAL_FRESH_BUILD_QTY = 1;
                        RTYRD.TOTAL_FRESH_FAIL_QTY  = 1;
                    }
                }
            }
            return(RTYRD);
        }