/// <summary> /// 根據當前工站生產新的LOTNO /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void GetLotDataloaderNew(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { if (Paras.Count <= 0) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050")); } MESStationSession sessionSN = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); MESStationSession sessionLotNo = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); MESStationSession sessionLotNewFlag = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY); LotNo lot = new LotNo(); string lotno = ""; if (sessionSN == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE })); } if (sessionLotNewFlag == null) { sessionLotNewFlag = new MESStationSession() { MESDataType = Paras[2].SESSION_TYPE, SessionKey = Paras[2].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(sessionLotNewFlag); } try { if (sessionLotNo == null) { T_R_LOT_STATUS tLotStatus = new T_R_LOT_STATUS(Station.SFCDB, DB_TYPE_ENUM.Oracle); Row_R_LOT_STATUS rowLotStatus = tLotStatus.GetLotBySNNotCloesd(sessionSN.Value.ToString(), Station.SFCDB); if (rowLotStatus != null) { sessionLotNewFlag.Value = "0"; lot.Init(rowLotStatus.LOT_NO, "", Station.SFCDB); sessionLotNo = new MESStationSession() { MESDataType = Paras[1].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[1].SESSION_KEY, ResetInput = Input }; sessionLotNo.Value = lot; Station.StationSession.Add(sessionLotNo); } else { //新建lot號 sessionLotNo = new MESStationSession() { MESDataType = Paras[1].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[1].SESSION_KEY, ResetInput = Input }; sessionLotNo.Value = lot.GetNewLotNo("HWD_FQCLOT", Station.SFCDB); sessionLotNewFlag.Value = "1"; Station.StationSession.Add(sessionLotNo); } } else { if (sessionLotNo.Value is string && sessionLotNo.Value.ToString() != "") { lotno = sessionLotNo.Value.ToString(); } else if (sessionLotNo.Value is LotNo) { lotno = ((LotNo)sessionLotNo.Value).LOT_NO.ToString(); } else { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY })); } try { lot.Init(lotno, "", Station.SFCDB); } catch { lot = null; } if (lot != null) { if (lot.CLOSED_FLAG.ToString() == "1") { sessionLotNo.Value = lot.GetNewLotNo("HWD_FQCLOT", Station.SFCDB); sessionLotNewFlag.Value = "1"; Station.StationSession.Add(sessionLotNo); } else { sessionLotNewFlag.Value = "0"; lot.Init(((LotNo)lot).LOT_NO, "", Station.SFCDB); sessionLotNo.Value = lot; } } } } catch (Exception ex) { throw ex; } }
/// <summary> /// 通過SKU對象,獲取對應批次對象,如果批次對象為空,新增批次對象 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras">2個參數,SKU,LOTNO保存的位置</param> public static void GetLotDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { string ColoumName = "skuno"; Row_R_LOT_STATUS RLotSku; T_R_LOT_STATUS TR = new T_R_LOT_STATUS(Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle); LotNo LOT = new LotNo(); if (Paras.Count <= 0) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050")); } MESStationSession Ssku = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); MESStationSession Slot = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); MESStationSession SLotNewFlag = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY); if (Ssku == null) { //throw new Exception("请输入SKU!"); throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE })); } else { SKU ObjSku = (SKU)Ssku.Value; //Marked by LLF 20018-02-22 //RLotSku = TR.GetByInput(ObjSku.SkuNo, ColoumName, Station.SFCDB); //RLotSku = TR.GetLotBySku(ObjSku.SkuNo, ColoumName, Station.SFCDB); //modify by fgg get lot by sku and station name 2018.8.16 RLotSku = TR.GetLotBySkuAnd(ObjSku.SkuNo, Station.StationName, Station.SFCDB); } if (Slot == null) { Slot = new MESStationSession() { MESDataType = Paras[1].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[1].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(Slot); } if (SLotNewFlag == null) { SLotNewFlag = new MESStationSession() { MESDataType = Paras[2].SESSION_TYPE, SessionKey = Paras[2].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(SLotNewFlag); } try { //Modify by LLF 2018-02-07 SLotNewFlag 為新生成Lot的標誌位 //if (LOT == null)//LOT 為空需產生新的LOTNO if (RLotSku == null) { SLotNewFlag.Value = "1"; Slot.Value = LOT.GetNewLotNo("HWD_FQCLOT", Station.SFCDB); } else { SLotNewFlag.Value = "0"; LOT.Init(RLotSku.LOT_NO, "", Station.SFCDB); Slot.Value = LOT; Station.AddMessage("MES00000029", new string[] { "LotNo", LOT.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Message); } } catch (Exception ex) { string msgCode = ex.Message; throw ex; } }