public void GetWoInfo(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JToken Data, MESStationReturn StationReturn) { OleExec sfcdb = null; try { sfcdb = this.DBPools["SFCDB"].Borrow(); sfcdb.ThrowSqlExeception = true; 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.GetWoByWoNo(Data["WO"].ToString().ToUpper().Trim(), sfcdb); if (r_wo_base == null) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000164", new string[] { Data["WO"].ToString().ToUpper().Trim() })); } this.DBPools["SFCDB"].Return(sfcdb); StationReturn.Data = r_wo_base; 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); } } }
//WorkOrder wo = new WorkOrder(); public void Init(string strWo, MESDBHelper.OleExec SFCDB, MESDataObject.DB_TYPE_ENUM _DBType) { DBType = _DBType; T_R_WO_BASE TRWB = new T_R_WO_BASE(SFCDB, DBType); //T_R_SN TSN = new T_R_SN(SFCDB, DBType); //_SNNO = TSN.GETSN(strWo, SFCDB); RBaseWo = TRWB.GetWo(strWo, SFCDB); BaseWo = RBaseWo.GetDataObject(); _Route = new Route(RBaseWo.ROUTE_ID, GetRouteType.ROUTEID, SFCDB, DBType); }
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); }
public WOBase(string wo, OleExec sfcdb) { T_R_WO_BASE TR_WO_BASE = new T_R_WO_BASE(sfcdb, MESDataObject.DB_TYPE_ENUM.Oracle); WO = TR_WO_BASE.GetWoByWoNo(wo, sfcdb); if (WO == null) { throw new Exception("工單 " + wo + " 不存在!"); } else { if (WO.SKUNO == null || WO.SKUNO.Trim().Length <= 0) { throw new Exception("工單 " + wo + " 未配置機種!"); } _SAPMapping = new SAPMappingBase(WO.SKUNO, sfcdb); if (WO.ROUTE_ID == null || WO.ROUTE_ID.Trim().Length <= 0) { throw new Exception("工單 " + wo + " 未配置路由ID!"); } _Route = new RouteBase(WO.ROUTE_ID.Trim(), sfcdb); } }
public void GetSNDetailByWo(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JToken Data, MESStationReturn StationReturn) { OleExec sfcdb = null; try { sfcdb = this.DBPools["SFCDB"].Borrow(); sfcdb.ThrowSqlExeception = true; 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.GetWoByWoNo(Data["WO"].ToString().ToUpper().Trim(), sfcdb); if (r_wo_base == null) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000164", new string[] { Data["WO"].ToString().ToUpper().Trim() })); } T_R_SN t_r_sn = new T_R_SN(sfcdb, DBTYPE); List <R_SN> snList = t_r_sn.GetRSNbyWo(Data["WO"].ToString().ToUpper().Trim(), sfcdb).FindAll(sn => sn.CURRENT_STATION.IndexOf("LOADING") >= 0); if (snList.Count == 0) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180731133844", new string[] { Data["WO"].ToString().ToUpper().Trim() })); } this.DBPools["SFCDB"].Return(sfcdb); StationReturn.Data = snList; 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); } } }
//工單狀態檢查 public static void WoStateDatachecker(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <R_Station_Action_Para> Paras) { ////ADD BY SDL 20180316 if (Paras.Count != 1) { throw new Exception("參數數量不正確!"); } MESStationSession WoLoadPoint = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (WoLoadPoint == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY })); } WorkOrder ObjWO = (WorkOrder)WoLoadPoint.Value; ////ADD BY SDL 20180316 //CHECK Workorder是否存在 string ErrMessage = ""; T_R_WO_BASE TRWO = new T_R_WO_BASE(Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle); Row_R_WO_BASE ROWWO; T_R_SN rSn = new T_R_SN(Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle); // string WO = Input.Value.ToString(); by sdl 20180316 string WO = ObjWO.WorkorderNo; try { //List<R_SN> snList = rSn.GetRSNbyWo(WO, Station.SFCDB); ROWWO = TRWO.GetWo(WO, Station.SFCDB); R_WO_BASE woBase = ROWWO.GetDataObject(); WorkOrder ObjWorkorder = new WorkOrder(); //if (snList!=null) //{ // foreach (var item in snList) // { // if (woBase.ROUTE_ID != item.ROUTE_ID) // { // //throw new Exception("SN RouteID不唯一!"); // ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000167", new string[] { item.SN }); // throw new MESReturnMessage(ErrMessage); // } // } //} if (woBase.CLOSED_FLAG == 1.ToString()) { // throw new Exception("ClosedFlag=1!"); ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000168", new string[] { woBase.WORKORDERNO }); throw new MESReturnMessage(ErrMessage); } if ((woBase.START_STATION == null || woBase.START_STATION == "N/A") && woBase.WO_TYPE == "REWORK") { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000203", new string[] { woBase.WORKORDERNO }); throw new MESReturnMessage(ErrMessage); } if (woBase.FINISHED_QTY > woBase.WORKORDER_QTY) { // throw new Exception("FinishQty>WorkOrderQty!"); ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000169", new string[] { woBase.WORKORDERNO }); throw new MESReturnMessage(ErrMessage); } Station.StationSession.Add(WoLoadPoint); ObjWorkorder.Init(WO, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle); WoLoadPoint.Value = ObjWorkorder; WoLoadPoint.InputValue = Input.Value.ToString(); WoLoadPoint.ResetInput = Input; WoLoadPoint.SessionKey = "1"; WoLoadPoint.MESDataType = "WO"; Station.AddMessage("MES00000029", new string[] { "Workorder", WO }, MESReturnView.Station.StationMessageState.Message); } catch (Exception ex) { throw ex; } }
public void CutWoBySNId(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JToken Data, MESStationReturn StationReturn) { OleExec sfcdb = null; try { string wo = Data["WO"].ToString().ToUpper().Trim(); string closeFlag = Data["CLOSEFLAG"].ToString().ToUpper().Trim(); Newtonsoft.Json.Linq.JArray arrayId = (Newtonsoft.Json.Linq.JArray)Data["ID"]; sfcdb = this.DBPools["SFCDB"].Borrow(); sfcdb.ThrowSqlExeception = true; 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.GetWoByWoNo(wo, sfcdb); if (r_wo_base == null) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000164", new string[] { wo })); } T_R_SN t_r_sn = new T_R_SN(sfcdb, DBTYPE); Row_R_SN rowSN; for (int i = 0; i < arrayId.Count; i++) { rowSN = (Row_R_SN)t_r_sn.GetObjByID(arrayId[i].ToString(), sfcdb); rowSN.SN = "CUT_" + rowSN.SN; rowSN.WORKORDERNO = "CUT_" + rowSN.WORKORDERNO; rowSN.SKUNO = "CUT_" + rowSN.SKUNO; rowSN.EDIT_EMP = LoginUser.EMP_NO; rowSN.EDIT_TIME = GetDBDateTime(); sfcdb.ExecSQL(rowSN.GetUpdateString(DBTYPE)); } Row_R_WO_BASE rowWoBase = (Row_R_WO_BASE)t_r_wo_base.GetObjByID(r_wo_base.ID, sfcdb); rowWoBase.WORKORDER_QTY = r_wo_base.WORKORDER_QTY - Convert.ToDouble(arrayId.Count); rowWoBase.INPUT_QTY = r_wo_base.INPUT_QTY - Convert.ToDouble(arrayId.Count); rowWoBase.EDIT_EMP = LoginUser.EMP_NO; rowWoBase.EDIT_TIME = GetDBDateTime(); if (closeFlag == "1") { rowWoBase.CLOSED_FLAG = closeFlag; rowWoBase.CLOSE_DATE = GetDBDateTime(); } sfcdb.ExecSQL(rowWoBase.GetUpdateString(DBTYPE)); this.DBPools["SFCDB"].Return(sfcdb); StationReturn.Data = r_wo_base; StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.MessageCode = "MES00000210"; StationReturn.MessagePara.Add(wo); StationReturn.MessagePara.Add(arrayId.Count); } 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); } } }
public void CutWoByNum(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JToken Data, MESStationReturn StationReturn) { string wo = Data["WO"].ToString().ToUpper().Trim(); string closeFlag = Data["CLOSEFLAG"].ToString().ToUpper().Trim(); double num = 0; OleExec sfcdb = null; try { sfcdb = this.DBPools["SFCDB"].Borrow(); sfcdb.ThrowSqlExeception = true; 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.GetWoByWoNo(wo, sfcdb); if (r_wo_base == null) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000164", new string[] { wo })); } try { num = Convert.ToDouble(Data["NUM"].ToString().ToUpper().Trim()); } catch { throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180731151259", new string[] { Data["NUM"].ToString().ToUpper().Trim() })); } if (num <= 0) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180731151259", new string[] { Data["NUM"].ToString().ToUpper().Trim() })); } if (r_wo_base.WORKORDER_QTY - r_wo_base.INPUT_QTY < num) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000208", new string[] { wo, num.ToString(), (r_wo_base.WORKORDER_QTY - r_wo_base.INPUT_QTY).ToString() })); } Row_R_WO_BASE rowWoBase = (Row_R_WO_BASE)t_r_wo_base.GetObjByID(r_wo_base.ID, sfcdb); rowWoBase.WORKORDER_QTY = r_wo_base.WORKORDER_QTY - Convert.ToDouble(num); if (closeFlag == "1") { rowWoBase.CLOSED_FLAG = closeFlag; rowWoBase.CLOSE_DATE = GetDBDateTime(); } rowWoBase.EDIT_EMP = LoginUser.EMP_NO; rowWoBase.EDIT_TIME = GetDBDateTime(); sfcdb.ExecSQL(rowWoBase.GetUpdateString(DBTYPE)); this.DBPools["SFCDB"].Return(sfcdb); StationReturn.Data = r_wo_base; StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.MessageCode = "MES00000210"; StationReturn.MessagePara.Add(wo); StationReturn.MessagePara.Add(num); } 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); } } }
private void Get2000E3CartonValue(R_SN r_sn, OleExec DB) { t_r_sn_kp = new T_R_SN_KP(DB, MESDataObject.DB_TYPE_ENUM.Oracle); t_c_sku_ver_mapping = new T_C_SKU_VER_MAPPING(DB, DB_TYPE_ENUM.Oracle); R_SN kpSN; R_SN_STATION_DETAIL snStationDetail = null; C_SKU_VER_MAPPING verMapping = null; R_WO_BASE r_wo_base = null; List <R_SN_KP> KPList = new List <R_SN_KP>(); List <R_SN_KP> printKPList = new List <R_SN_KP>(); R_SN_KP printKP = null; R_SN_KP GPNKP; R_SN_KP GSNKP; C_SKU_DETAIL skuDetail; if (r_sn != null) { r_wo_base = DB.ORM.Queryable <R_WO_BASE>().Where(wo => wo.WORKORDERNO == r_sn.WORKORDERNO).ToList().FirstOrDefault(); KPList = t_r_sn_kp.GetKPRecordBySnID(r_sn.ID, DB); skuDetail = DB.ORM.Queryable <C_SKU_DETAIL>().Where(d => d.SKUNO == r_wo_base.SKUNO && d.STATION_NAME == I_STATION.Value.ToString() && d.CATEGORY == "PRINT" && d.CATEGORY_NAME == "KEYPART").ToList().FirstOrDefault(); if (skuDetail != null) { //打印keypart SN 對應的keypart 信息 printKP = KPList.Find(k => k.PARTNO == skuDetail.VALUE); } if (printKP != null) { kpSN = t_r_sn.LoadSN(printKP.VALUE, DB); printKPList = t_r_sn_kp.GetKPRecordBySnID(kpSN.ID, DB); GPNKP = printKPList.Find(k => k.SCANTYPE == "GPN"); GSNKP = printKPList.Find(k => k.SCANTYPE == "GSN"); if (GPNKP != null) { O_GPN.Value = GPNKP.VALUE; } if (GSNKP != null) { O_GSN.Value = GSNKP.VALUE; } } snStationDetail = DB.ORM.Queryable <R_SN_STATION_DETAIL>().Where(s => s.R_SN_ID == r_sn.ID && s.STATION_NAME == I_STATION.Value.ToString()).ToList().FirstOrDefault(); DateTime dateTime = (DateTime)snStationDetail.EDIT_TIME; O_PRINTDATE.Value = dateTime.ToString("MM/dd/yyyy"); verMapping = t_c_sku_ver_mapping.GetMappingBySkuAndVersion(r_wo_base.SKUNO, r_wo_base.SKU_VER, DB); if (verMapping != null) { O_VER.Value = verMapping.CUSTOMER_VERSION; } else { O_VER.Value = r_wo_base.SKU_VER; } } }
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); } } }