public static void CloseLot(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { DisplayOutPut Dis_LotNo = Station.DisplayOutput.Find(t => t.Name == "LOTNO"); T_R_LOT_STATUS tRLotStatus = new T_R_LOT_STATUS(Station.SFCDB, Station.DBType); Row_R_LOT_STATUS r = tRLotStatus.GetByLotNo(Dis_LotNo.Value.ToString(), Station.SFCDB); if (r == null || !r.CLOSED_FLAG.Equals("0")) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180528103627", new string[] { Dis_LotNo.Value.ToString() })); } try { r.CLOSED_FLAG = "1"; r.EDIT_EMP = Station.LoginUser.EMP_NO; Station.SFCDB.ThrowSqlExeception = true; r.EDIT_TIME = tRLotStatus.GetDBDateTime(Station.SFCDB); Station.SFCDB.ExecSQL(r.GetUpdateString(Station.DBType)); } catch (Exception e) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180528105826", new string[] { Dis_LotNo.Value.ToString(), e.Message })); } finally { Station.SFCDB.ThrowSqlExeception = false; } #region 清空界面信息 Station.StationSession.Clear(); Station.Inputs.Find(t => t.DisplayName == Paras[0].SESSION_TYPE).DataForUse.Clear(); #endregion }
public static void LOTNOINPUT(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras) { OleExec DB = Station.SFCDB; string LOTNO = Input.Value.ToString().ToUpper(); T_R_LOT_STATUS TRLS = new T_R_LOT_STATUS(Station.SFCDB, DB_TYPE_ENUM.Oracle); var LOT_COUNT_session = Station.StationSession.Find(t => t.MESDataType == "LOT_COUNT" && t.SessionKey == "1"); if (LOT_COUNT_session == null) { LOT_COUNT_session = new MESStationSession() { MESDataType = "LOT_COUNT", SessionKey = "1", Value = 0 }; Station.StationSession.Add(LOT_COUNT_session); } var Lot = TRLS.GetByLotNo(LOTNO, DB); if (Lot.ID == null || Lot.ID == "") { throw new Exception($@"LotNo '{LOTNO}' is not exten"); } if (Lot.CLOSED_FLAG == "1") { throw new Exception($@"LotNo '{LOTNO}' is closed"); } if (Lot.SAMPLE_STATION != Station.DisplayName) { throw new Exception($@"LotNo '{LOTNO}' is use to '{Lot.SAMPLE_STATION}'"); } var LOT_session = Station.StationSession.Find(t => t.MESDataType == "LOTNO" && t.SessionKey == "1"); if (LOT_session == null) { LOT_session = new MESStationSession() { MESDataType = "LOTNO", SessionKey = "1" }; Station.StationSession.Add(LOT_session); } LOT_session.Value = LOTNO; int count = DB.ORM.Queryable <R_LOT_DETAIL>().Where(t => t.LOT_ID == Lot.ID).Count(); LOT_COUNT_session.Value = count; Station.NextInput = Station.Inputs[1]; }
public static void CloseLot(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { DisplayOutPut Dis_LotNo = Station.DisplayOutput.Find(t => t.Name == "LOTNO"); MESStationInput Level = Station.Inputs.Find(t => t.DisplayName == "AQLLEVEL"); T_R_LOT_STATUS tRLotStatus = new T_R_LOT_STATUS(Station.SFCDB, Station.DBType); Row_R_LOT_STATUS r = tRLotStatus.GetByLotNo(Dis_LotNo.Value.ToString(), Station.SFCDB); if (r.LOT_NO == null || !r.CLOSED_FLAG.Equals("0")) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180528103627", new string[] { Dis_LotNo.Value.ToString() })); } try { //根據關閉時的AQL更新LotStatus T_C_AQLTYPE tCAqlType = new T_C_AQLTYPE(Station.SFCDB, Station.DBType); List <C_AQLTYPE> cAqlTypeList = tCAqlType.GetAqlTypeBySkunoAndLevel(r.SKUNO, Level.Value.ToString(), Station.SFCDB); r.REJECT_QTY = cAqlTypeList.Where(t => t.LOT_QTY > r.LOT_QTY).OrderBy(t => t.LOT_QTY).Take(1).ToList <C_AQLTYPE>()[0].REJECT_QTY; r.SAMPLE_QTY = cAqlTypeList.Where(t => t.LOT_QTY > r.LOT_QTY).OrderBy(t => t.LOT_QTY).Take(1).ToList <C_AQLTYPE>()[0].SAMPLE_QTY; r.SAMPLE_QTY = r.SAMPLE_QTY > r.LOT_QTY ? r.LOT_QTY : r.SAMPLE_QTY; r.CLOSED_FLAG = "1"; r.AQL_LEVEL = Level.Value.ToString(); r.EDIT_EMP = Station.LoginUser.EMP_NO; Station.SFCDB.ThrowSqlExeception = true; r.EDIT_TIME = tRLotStatus.GetDBDateTime(Station.SFCDB); Station.SFCDB.ExecSQL(r.GetUpdateString(Station.DBType)); } catch (Exception e) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180528105826", new string[] { Dis_LotNo.Value.ToString(), e.Message })); } finally { Station.SFCDB.ThrowSqlExeception = false; } #region 清空界面信息 Station.StationSession.Clear(); Station.Inputs.Find(t => t.DisplayName == Paras[0].SESSION_TYPE).DataForUse.Clear(); Station.Inputs.Find(t => t.DisplayName == "AQLLEVEL").DataForUse.Clear(); #endregion }
public void GetLockStation(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JToken Data, MESStationReturn StationReturn) { string lockType = Data["LockType"].ToString().Trim(); string lockData = Data["LockData"].ToString().Trim(); DataTable routeTable = new DataTable(); List <string> stationList = new List <string>(); OleExec sfcdb = null; try { sfcdb = this.DBPools["SFCDB"].Borrow(); T_C_ROUTE_DETAIL t_c_route_detail = new T_C_ROUTE_DETAIL(sfcdb, DBTYPE); if (lockType == "LockByWo") { T_R_WO_BASE t_r_wo_base = new T_R_WO_BASE(sfcdb, DBTYPE); R_WO_BASE r_wo_base = t_r_wo_base.GetWo(lockData, sfcdb).GetDataObject(); stationList = t_c_route_detail.GetByRouteIdOrderBySEQASC(r_wo_base.ROUTE_ID, sfcdb).Select(route => route.STATION_NAME).ToList(); } else if (lockType == "LockByLot") { T_R_LOT_STATUS t_r_lot_status = new T_R_LOT_STATUS(sfcdb, DBTYPE); Row_R_LOT_STATUS rowLotStatus = t_r_lot_status.GetByLotNo(lockData, sfcdb); if (rowLotStatus.ID == null) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000161", new string[] { })); } R_LOT_STATUS r_lot_status = rowLotStatus.GetDataObject(); T_C_SKU t_c_sku = new T_C_SKU(sfcdb, DBTYPE); C_SKU c_sku = t_c_sku.GetSku(r_lot_status.SKUNO, sfcdb, DBTYPE).GetDataObject(); T_R_SKU_ROUTE t_r_sku_route = new T_R_SKU_ROUTE(sfcdb, DBTYPE); List <R_SKU_ROUTE> r_sku_route_list = t_r_sku_route.GetMappingBySkuId(c_sku.ID, sfcdb); if (r_sku_route_list.Count > 0) { //t_c_route_detail.GetByRouteIdOrderBySEQASC(r_sku_route_list[0].ROUTE_ID, sfcdb); stationList = t_c_route_detail.GetByRouteIdOrderBySEQASC(r_sku_route_list[0].ROUTE_ID, sfcdb).Select(route => route.STATION_NAME).ToList(); } else { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000179", new string[] { })); } } else { routeTable = t_c_route_detail.GetALLStation(sfcdb); foreach (DataRow row in routeTable.Rows) { stationList.Add(row["station_name"].ToString()); } stationList.Sort(); } this.DBPools["SFCDB"].Return(sfcdb); StationReturn.Data = stationList; StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.MessageCode = "MES00000001"; } catch (Exception exception) { StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.MessageCode = "MES00000037"; StationReturn.MessagePara.Add(exception.Message); StationReturn.Data = exception.Message; if (sfcdb != null) { this.DBPools["SFCDB"].Return(sfcdb); } } }