示例#1
0
        //產品維修CheckIn Action
        public static void SNInRepairAction(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            if (Paras.Count == 0)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            MESStationSession SNLoadPoint = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (SNLoadPoint == null)
            {
                SNLoadPoint = new MESStationSession()
                {
                    MESDataType = "SN", InputValue = Input.Value.ToString(), SessionKey = "1", ResetInput = Input
                };
                Station.StationSession.Add(SNLoadPoint);
            }

            string sendEmp    = Station.Inputs.Find(s => s.DisplayName == "SendEMP").Value.ToString();
            string receiveEmp = Station.Inputs.Where(s => s.DisplayName == "ReceiveEMP").FirstOrDefault().Value.ToString();
            //string sendEmp = Station.Inputs[0].Value.ToString();
            //string receiveEmp = Station.Inputs[1].Value.ToString();
            string strSn = Input.Value.ToString();
            SN     sn    = new SN(strSn, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
            T_R_REPAIR_TRANSFER   rTransfer      = new T_R_REPAIR_TRANSFER(Station.SFCDB, DB_TYPE_ENUM.Oracle);
            Row_R_REPAIR_TRANSFER rowTransfer    = (Row_R_REPAIR_TRANSFER)rTransfer.NewRow();
            T_R_REPAIR_MAIN       rRepairMain    = new T_R_REPAIR_MAIN(Station.SFCDB, DB_TYPE_ENUM.Oracle);
            List <R_REPAIR_MAIN>  RepariMainList = rRepairMain.GetRepairMainBySN(Station.SFCDB, strSn);
            R_REPAIR_MAIN         rMain          = RepariMainList.Where(r => r.CLOSED_FLAG == "0").FirstOrDefault(); // Find(r => r.CLOSED_FLAG == "0");

            if (rMain != null)
            {
                rowTransfer.ID             = rTransfer.GetNewID(Station.BU, Station.SFCDB);
                rowTransfer.REPAIR_MAIN_ID = rMain.ID;
                rowTransfer.IN_SEND_EMP    = sendEmp;
                rowTransfer.IN_RECEIVE_EMP = receiveEmp;
                rowTransfer.IN_TIME        = DateTime.Now;
                rowTransfer.SN             = strSn;
                rowTransfer.LINE_NAME      = Station.Line;
                rowTransfer.STATION_NAME   = sn.CurrentStation;
                rowTransfer.WORKORDERNO    = sn.WorkorderNo;
                rowTransfer.SKUNO          = sn.SkuNo;
                rowTransfer.CLOSED_FLAG    = "1";
                string strRet = (Station.SFCDB).ExecSQL(rowTransfer.GetInsertString(DB_TYPE_ENUM.Oracle));
                if (Convert.ToInt32(strRet) > 0)
                {
                    Station.AddMessage("MES00000001", new string[] { }, MESReturnView.Station.StationMessageState.Pass);
                }
                else
                {
                    Station.AddMessage("MES00000037", new string[] { "INSET R_REPAIR_TRANSFER" }, MESReturnView.Station.StationMessageState.Pass);
                }
            }
            else
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000066", new string[] { strSn, "CLOSED" }));
            }
        }
示例#2
0
        /// <summary>
        /// 維修輸入SN Fail狀態檢查
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void SNRepairFailChecker(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            OleExec sfcdb = Station.SFCDB;
            //input test

            /*string inputValue = Input.Value.ToString();
             * if (string.IsNullOrEmpty(inputValue))
             * {
             *  throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000006", new string[] { "SN輸入值" }));
             * }
             * SN sn = new SN(inputValue, sfcdb, DB_TYPE_ENUM.Oracle);*/

            MESStationSession SN_Session = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE &&
                                                                       t.SessionKey == Paras[0].SESSION_KEY);

            if (SN_Session == null)
            {
                foreach (R_Station_Output output in Station.StationOutputs)
                {
                    Station.StationSession.Find(s => s.MESDataType == output.SESSION_TYPE && s.SessionKey == output.SESSION_KEY).Value = "";
                }
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000045", new string[] { "SN" }));
            }
            SN sn = (SN)SN_Session.Value;

            if (sn.RepairFailedFlag == "0")
            {
                foreach (R_Station_Output output in Station.StationOutputs)
                {
                    Station.StationSession.Find(s => s.MESDataType == output.SESSION_TYPE && s.SessionKey == output.SESSION_KEY).Value = "";
                }
                //正常品
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000078", new string[] { sn.SerialNo }));
            }
            List <R_REPAIR_MAIN> repairMains = new T_R_REPAIR_MAIN(sfcdb, DB_TYPE_ENUM.Oracle).GetRepairMainBySN(sfcdb, sn.SerialNo);

            if (repairMains == null || repairMains.Count == 0)
            {
                foreach (R_Station_Output output in Station.StationOutputs)
                {
                    Station.StationSession.Find(s => s.MESDataType == output.SESSION_TYPE && s.SessionKey == output.SESSION_KEY).Value = "";
                }
                //無維修主檔信息
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000079", new string[] { "SN", sn.SerialNo }));
            }
            R_REPAIR_MAIN rm = repairMains.Find(r => r.CLOSED_FLAG == "0");

            if (rm == null)
            {
                foreach (R_Station_Output output in Station.StationOutputs)
                {
                    Station.StationSession.Find(s => s.MESDataType == output.SESSION_TYPE && s.SessionKey == output.SESSION_KEY).Value = "";
                }
                //無維修主檔信息
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000079", new string[] { "SN", sn.SerialNo }));
            }
            //foreach (R_REPAIR_MAIN rm in repairMains)
            //{
            //    //存在closed_flag=0
            //    if (rm.CLOSED_FLAG != "0")
            //    {
            //        foreach (R_Station_Output output in Station.StationOutputs)
            //        {
            //            Station.StationSession.Find(s => s.MESDataType == output.SESSION_TYPE && s.SessionKey == output.SESSION_KEY).Value = "";
            //        }
            //        throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000097", new string[] {"SN", rm.SN }));
            //    }
            //}
            Station.AddMessage("MES00000046", new string[] { "OK" }, StationMessageState.Pass);
        }