示例#1
0
        public WorkOrder Initwo(string strWo, MESDBHelper.OleExec SFCDB, MESDataObject.DB_TYPE_ENUM _DBType)
        {
            WorkOrder wo = new WorkOrder();

            DBType = _DBType;
            T_R_WO_BASE TRWB = new T_R_WO_BASE(SFCDB, DBType);

            RBaseWo           = TRWB.GetWo(strWo, SFCDB);
            this.BaseWo       = wo.BaseWo;
            this.ProcessingWo = new List <string>();
            this.LabelPaths   = new Dictionary <string, string>();
            this.SkuRoutes    = new List <Route>();
            return(this);
        }
示例#2
0
        /// <summary>
        /// 工單信息加載器,加載工單信息到指定位置,主要用來給界面做輸出. 2018/1/2 肖倫
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras">
        /// InputQTYSave	工單已投數量保存位置	{SESSION_TYPE:"INPUTQTY",SSION_KEY:"1",VALUE:""}
        /// FinishQTYSave 工單已完成數量保存位置 { SESSION_TYPE:"FINISHQTY",SSION_KEY:"1",VALUE:""}
        /// StationQTYSave 本工站過站數量保存位置 { SESSION_TYPE:"STATIONQTY",SSION_KEY:"1",VALUE:""}
        /// WOLoadPoint 工單的保存位置 { SESSION_TYPE:"WO",SSION_KEY:"1",VALUE:""}
        /// </param>
        public static void WoInfoDataloader(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            MESStation.LogicObject.WorkOrder wo = new MESStation.LogicObject.WorkOrder();
            string strWONO = "";

            if (Paras.Count != 5)
            {
                string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000057");
                throw new MESReturnMessage(errMsg);
            }
            MESStationSession InputQTY_Session = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

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

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

            if (StationQTY_Session == null)
            {
                StationQTY_Session = new MESStationSession()
                {
                    MESDataType = Paras[2].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[2].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(StationQTY_Session);
            }
            MESStationSession Wo_Session = Station.StationSession.Find(t => t.MESDataType == Paras[3].SESSION_TYPE && t.SessionKey == Paras[3].SESSION_KEY);

            if (Wo_Session == null)
            {
                strWONO    = Input.Value.ToString();
                Wo_Session = new MESStationSession()
                {
                    MESDataType = Paras[3].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[3].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(Wo_Session);
            }
            strWONO = Wo_Session.Value.ToString();
            //add by LLF 2018-03-26 增加工單數量Sesstion
            MESStationSession WoQty_Session = Station.StationSession.Find(t => t.MESDataType == Paras[4].SESSION_TYPE && t.SessionKey == Paras[4].SESSION_KEY);

            if (WoQty_Session == null)
            {
                WoQty_Session = new MESStationSession()
                {
                    MESDataType = Paras[4].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[4].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(WoQty_Session);
            }
            else
            {
                //wo = (WorkOrder)Wo_Session.Value;
                //if (wo != null && wo.WorkorderNo != null && wo.WorkorderNo.Length > 0)
                //{
                //    strWONO = wo.WorkorderNo;
                //   // wo.Init(wo.WorkorderNo, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
                //}
                //else
                //{
                //    wo = new MESStation.LogicObject.WorkOrder();
                //    strWONO = Input.Value.ToString();
                //   // wo.Init(Input.Value.ToString(), Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
                //}
                //  Wo_Session.Value = wo;
                //strWONO = Wo_Session.Value.ToString();
                Wo_Session.InputValue = Input.Value.ToString();
                Wo_Session.ResetInput = Input;
            }
            try
            {
                wo.Init(strWONO, Station.SFCDB, Station.DBType);
                Wo_Session.Value        = wo;
                InputQTY_Session.Value  = wo.INPUT_QTY;
                FinishQTY_Session.Value = wo.FINISHED_QTY;
                WoQty_Session.Value     = wo.WORKORDER_QTY;
                T_R_SN_STATION_DETAIL TR_SN_STATION_DETAIL = new T_R_SN_STATION_DETAIL(Station.SFCDB, Station.DBType);
                StationQTY_Session.Value = TR_SN_STATION_DETAIL.GetCountByWOAndStation(wo.ToString(), Station.StationName, Station.SFCDB);
                Station.AddMessage("MES00000001", new string[] { Input.Value.ToString() }, MESReturnView.Station.StationMessageState.Pass);
            }
            catch (Exception ex)
            {
                Wo_Session.Value         = null;
                InputQTY_Session.Value   = 0;
                FinishQTY_Session.Value  = 0;
                StationQTY_Session.Value = 0;
                WoQty_Session.Value      = 0;
                throw ex;
            }
        }
示例#3
0
        public void UpdateSNKP(WorkOrder woObject, List <R_SN> snList, BaseClass.MESStationBase Station)
        {
            T_C_KP_LIST             t_c_kp_list             = new T_C_KP_LIST(Station.SFCDB, Station.DBType);
            T_C_KP_List_Item        t_c_kp_list_item        = new T_C_KP_List_Item(Station.SFCDB, Station.DBType);
            T_C_KP_List_Item_Detail t_c_kp_list_item_detail = new T_C_KP_List_Item_Detail(Station.SFCDB, Station.DBType);
            T_R_SN_KP   t_r_sn_kp   = new T_R_SN_KP(Station.SFCDB, Station.DBType);
            T_C_SKU_MPN t_c_sku_mpn = new T_C_SKU_MPN(Station.SFCDB, Station.DBType);
            T_C_KP_Rule c_kp_rule   = new T_C_KP_Rule(Station.SFCDB, Station.DBType);
            Row_R_SN_KP rowSNKP;

            List <C_KP_List_Item>        kpItemList     = new List <C_KP_List_Item>();
            List <C_SKU_MPN>             skuMpnList     = new List <C_SKU_MPN>();
            List <C_KP_List_Item_Detail> itemDetailList = new List <C_KP_List_Item_Detail>();
            C_KP_Rule kpRule  = new C_KP_Rule();
            int       scanseq = 0;
            int       result;
            string    skuMpn = "";

            try
            {
                kpItemList = t_c_kp_list_item.GetItemObjectByListId(woObject.KP_LIST_ID, Station.SFCDB);
                if (kpItemList == null || kpItemList.Count == 0)
                {
                    throw new MESDataObject.MESReturnMessage(MESDataObject.MESReturnMessage.GetMESReturnMessage("MES00000255", new string[] { woObject.SkuNO }));
                }

                foreach (R_SN r_sn in snList)
                {
                    result = t_r_sn_kp.DeleteBySNID(r_sn.ID, Station.SFCDB);
                    if (result <= 0)
                    {
                        throw new MESDataObject.MESReturnMessage(MESDataObject.MESReturnMessage.GetMESReturnMessage("MES00000083", new string[] { "R_SN_KP:" + r_sn.SN, "DELETE" }));
                    }

                    foreach (C_KP_List_Item kpItem in kpItemList)
                    {
                        itemDetailList = t_c_kp_list_item_detail.GetItemDetailObjectByItemId(kpItem.ID, Station.SFCDB);
                        if (itemDetailList == null || itemDetailList.Count == 0)
                        {
                            throw new MESDataObject.MESReturnMessage(MESDataObject.MESReturnMessage.GetMESReturnMessage("MES00000255", new string[] { woObject.SkuNO }));
                        }

                        skuMpnList = t_c_sku_mpn.GetMpnBySkuAndPartno(Station.SFCDB, woObject.SkuNO, kpItem.KP_PARTNO);
                        if (skuMpnList.Count != 0)
                        {
                            skuMpn = skuMpnList[0].MPN;
                        }


                        foreach (C_KP_List_Item_Detail itemDetail in itemDetailList)
                        {
                            scanseq = scanseq + 1;
                            kpRule  = c_kp_rule.GetKPRule(Station.SFCDB, kpItem.KP_PARTNO, skuMpn, itemDetail.SCANTYPE);
                            if (kpRule == null)
                            {
                                throw new MESDataObject.MESReturnMessage(MESDataObject.MESReturnMessage.GetMESReturnMessage("MES00000256", new string[] { kpItem.KP_PARTNO, skuMpn, itemDetail.SCANTYPE }));
                            }
                            if (kpRule.REGEX == "")
                            {
                                throw new MESDataObject.MESReturnMessage(MESDataObject.MESReturnMessage.GetMESReturnMessage("MES00000256", new string[] { kpItem.KP_PARTNO, skuMpn, itemDetail.SCANTYPE }));
                            }
                            rowSNKP            = (Row_R_SN_KP)t_r_sn_kp.NewRow();
                            rowSNKP.ID         = t_r_sn_kp.GetNewID(Station.BU, Station.SFCDB);
                            rowSNKP.R_SN_ID    = r_sn.ID;
                            rowSNKP.SN         = r_sn.SN;
                            rowSNKP.VALUE      = "";
                            rowSNKP.PARTNO     = kpItem.KP_PARTNO;
                            rowSNKP.KP_NAME    = kpItem.KP_NAME;
                            rowSNKP.MPN        = skuMpn;
                            rowSNKP.SCANTYPE   = itemDetail.SCANTYPE;
                            rowSNKP.ITEMSEQ    = kpItem.SEQ;
                            rowSNKP.SCANSEQ    = scanseq;
                            rowSNKP.DETAILSEQ  = itemDetail.SEQ;
                            rowSNKP.STATION    = kpItem.STATION;
                            rowSNKP.REGEX      = kpRule.REGEX;
                            rowSNKP.VALID_FLAG = 1;
                            rowSNKP.EXKEY1     = "";
                            rowSNKP.EXVALUE1   = "";
                            rowSNKP.EXKEY2     = "";
                            rowSNKP.EXVALUE2   = "";
                            rowSNKP.EDIT_EMP   = Station.LoginUser.EMP_NO;
                            rowSNKP.EDIT_TIME  = Station.GetDBDateTime();
                            result             = Convert.ToInt32(Station.SFCDB.ExecSQL(rowSNKP.GetInsertString(Station.DBType)));
                            if (result <= 0)
                            {
                                throw new MESDataObject.MESReturnMessage(MESDataObject.MESReturnMessage.GetMESReturnMessage("MES00000083", new string[] { "R_SN_KP:" + r_sn.SN, "ADD" }));
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#4
0
        /// <summary>
        /// JOBSTOCK STATION PASS ACTION
        /// </summary>
        /// <param name="objWorkorder">wo obj</param>
        /// <param name="objSN">sn obj</param>
        /// <param name="Station">Station</param>
        /// <param name="confirmed_flag">confirmed_flag</param>
        public void JobStockPass(WorkOrder objWorkorder, SN objSN, MESPubLab.MESStation.MESStationBase Station, string confirmed_flag)
        {
            T_R_STOCK           t_r_stock           = new T_R_STOCK(Station.SFCDB, Station.DBType);
            T_R_SN              t_r_sn              = new T_R_SN(Station.SFCDB, Station.DBType);
            T_R_WO_BASE         t_r_wo_base         = new T_R_WO_BASE(Station.SFCDB, Station.DBType);
            T_R_STOCK_GT        t_r_stock_gt        = new T_R_STOCK_GT(Station.SFCDB, Station.DBType);
            T_C_SAP_STATION_MAP t_c_sap_station_map = new T_C_SAP_STATION_MAP(Station.SFCDB, Station.DBType);
            string              gt_id = "";

            #region  write r_stock,r_stock_gt

            List <C_SAP_STATION_MAP> sapCodeList = t_c_sap_station_map.GetSAPStationMapBySkuOrderBySAPCodeASC(objWorkorder.SkuNO, Station.SFCDB);
            if (sapCodeList.Count == 0)
            {
                throw new MESDataObject.MESReturnMessage(MESDataObject.MESReturnMessage.GetMESReturnMessage("MES00000224", new string[] { objWorkorder.SkuNO }));
            }
            Row_R_STOCK_GT rowStockGT;
            R_STOCK_GT     objGT = t_r_stock_gt.GetNotGTbjByWO(objWorkorder.WorkorderNo, confirmed_flag, Station.SFCDB);
            if (objGT == null)
            {
                gt_id                       = t_r_stock_gt.GetNewID(Station.BU, Station.SFCDB);
                rowStockGT                  = (Row_R_STOCK_GT)t_r_stock_gt.NewRow();
                rowStockGT.ID               = gt_id;
                rowStockGT.WORKORDERNO      = objWorkorder.WorkorderNo;
                rowStockGT.SKUNO            = objWorkorder.SkuNO;
                rowStockGT.TOTAL_QTY        = 1;
                rowStockGT.FROM_STORAGE     = objWorkorder.WorkorderNo;
                rowStockGT.TO_STORAGE       = objWorkorder.STOCK_LOCATION;
                rowStockGT.SAP_FLAG         = "0";
                rowStockGT.CONFIRMED_FLAG   = confirmed_flag;
                rowStockGT.SAP_STATION_CODE = sapCodeList.Last().SAP_STATION_CODE;
                rowStockGT.EDIT_EMP         = Station.LoginUser.EMP_NO;
                rowStockGT.EDIT_TIME        = Station.GetDBDateTime();
                Station.SFCDB.ExecSQL(rowStockGT.GetInsertString(Station.DBType));
            }
            else
            {
                rowStockGT           = (Row_R_STOCK_GT)t_r_stock_gt.GetObjByID(objGT.ID, Station.SFCDB);
                gt_id                = rowStockGT.ID;
                rowStockGT.TOTAL_QTY = rowStockGT.TOTAL_QTY + 1;
                rowStockGT.EDIT_EMP  = Station.LoginUser.EMP_NO;
                rowStockGT.EDIT_TIME = Station.GetDBDateTime();
                Station.SFCDB.ExecSQL(rowStockGT.GetUpdateString(Station.DBType));
            }

            Row_R_STOCK rowStock = (Row_R_STOCK)t_r_stock.NewRow();
            rowStock.ID             = t_r_stock.GetNewID(Station.BU, Station.SFCDB);
            rowStock.SN             = objSN.SerialNo;
            rowStock.WORKORDERNO    = objWorkorder.WorkorderNo;
            rowStock.SKUNO          = objWorkorder.SkuNO;
            rowStock.NEXT_STATION   = objSN.NextStation;
            rowStock.FROM_STORAGE   = objWorkorder.WorkorderNo;
            rowStock.TO_STORAGE     = objWorkorder.STOCK_LOCATION;
            rowStock.CONFIRMED_FLAG = confirmed_flag;
            rowStock.SAP_FLAG       = "0";
            rowStock.EDIT_EMP       = Station.LoginUser.EMP_NO;
            rowStock.EDIT_TIME      = Station.GetDBDateTime();
            rowStock.GT_ID          = gt_id;
            Station.SFCDB.ExecSQL(rowStock.GetInsertString(Station.DBType));
            #endregion

            #region update status
            Row_R_SN rowSN = (Row_R_SN)t_r_sn.GetObjByID(objSN.ID, Station.SFCDB);
            rowSN.NEXT_STATION   = "JOBFINISH";
            rowSN.STOCK_STATUS   = "1";
            rowSN.COMPLETED_FLAG = "1";
            rowSN.COMPLETED_TIME = Station.GetDBDateTime();
            rowSN.STOCK_IN_TIME  = Station.GetDBDateTime();
            rowSN.EDIT_EMP       = Station.LoginUser.EMP_NO;
            rowSN.EDIT_TIME      = Station.GetDBDateTime();
            Station.SFCDB.ExecSQL(rowSN.GetUpdateString(Station.DBType));

            t_r_sn.RecordPassStationDetail(rowSN.SN, Station.Line, Station.StationName, Station.StationName, Station.BU, Station.SFCDB);
            t_r_wo_base.UpdateFinishQty(objWorkorder.WorkorderNo, 1, Station.SFCDB);
            #endregion
        }