public void GetMappingList(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { T_C_SKU_VER_MAPPING skuVerMapping = null; OleExec sfcdb = null; try { sfcdb = this.DBPools["SFCDB"].Borrow(); skuVerMapping = new T_C_SKU_VER_MAPPING(sfcdb, DB_TYPE_ENUM.Oracle); List <C_SKU_VER_MAPPING> list = skuVerMapping.GetMappingListBySku((Data["SKUNO"].ToString()).Trim(), sfcdb); if (list.Count > 0) { StationReturn.Message = "获取成功!!"; StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.Data = list; } else { StationReturn.MessageCode = "MES00000034"; StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.Data = ""; } this.DBPools["SFCDB"].Return(sfcdb); } catch (Exception e) { this.DBPools["SFCDB"].Return(sfcdb); StationReturn.Message = e.Message; StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.Data = ""; } }
public void AddNewMapping(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { T_C_SKU_VER_MAPPING skuVerMapping = null; OleExec sfcdb = null; try { string result; string foxSkuno = Data["FOX_SKUNO"].ToString().Trim().ToUpper(); string custSkuno = Data["CUST_SKUNO"].ToString().Trim().ToUpper(); string foxVer1 = Data["FOX_VER1"].ToString().Trim().ToUpper(); string foxVer2 = Data["FOX_VER2"].ToString().Trim().ToUpper(); string custVer = Data["CUST_VER"].ToString().Trim().ToUpper(); sfcdb = this.DBPools["SFCDB"].Borrow(); sfcdb.ThrowSqlExeception = true; skuVerMapping = new T_C_SKU_VER_MAPPING(sfcdb, DB_TYPE_ENUM.Oracle); if (skuVerMapping.MappingIsExistBySku(foxSkuno, sfcdb)) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000008", new string[] { foxSkuno })); } Row_C_SKU_VER_MAPPING rowMapping = (Row_C_SKU_VER_MAPPING)skuVerMapping.NewRow(); rowMapping.ID = skuVerMapping.GetNewID(this.BU, sfcdb); rowMapping.FOX_SKUNO = foxSkuno; rowMapping.FOX_VERSION1 = foxVer1; rowMapping.FOX_VERSION2 = foxVer2; rowMapping.CUSTOMER_SKUNO = custSkuno; rowMapping.CUSTOMER_VERSION = custVer; rowMapping.EDIT_EMP = this.LoginUser.EMP_NO; rowMapping.EDIT_TIME = GetDBDateTime(); result = sfcdb.ExecSQL(rowMapping.GetInsertString(this.DBTYPE)); if (Convert.ToInt32(result) > 0) { StationReturn.Message = ""; StationReturn.MessageCode = "MES00000002"; StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.Data = ""; } else { StationReturn.Message = ""; StationReturn.MessagePara.Add(result); StationReturn.MessageCode = "MES00000021"; StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.Data = ""; } this.DBPools["SFCDB"].Return(sfcdb); } catch (Exception e) { this.DBPools["SFCDB"].Return(sfcdb); StationReturn.Message = e.Message; StationReturn.MessagePara.Add(e.Message); StationReturn.MessageCode = "MES00000021"; StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.Data = ""; } }
public void ModifyMapping(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { T_C_SKU_VER_MAPPING skuVerMapping = null; OleExec sfcdb = null; try { string result; string id = Data["ID"].ToString().Trim().ToUpper(); string custSkuno = Data["CUST_SKUNO"].ToString().Trim().ToUpper(); string foxVer1 = Data["FOX_VER1"].ToString().Trim().ToUpper(); string foxVer2 = Data["FOX_VER2"].ToString().Trim().ToUpper(); string custVer = Data["CUST_VER"].ToString().Trim().ToUpper(); sfcdb = this.DBPools["SFCDB"].Borrow(); sfcdb.ThrowSqlExeception = true; skuVerMapping = new T_C_SKU_VER_MAPPING(sfcdb, DB_TYPE_ENUM.Oracle); Row_C_SKU_VER_MAPPING rowMapping = (Row_C_SKU_VER_MAPPING)skuVerMapping.GetObjByID(id, sfcdb); rowMapping.FOX_VERSION1 = foxVer1; rowMapping.FOX_VERSION2 = foxVer2; rowMapping.CUSTOMER_SKUNO = custSkuno; rowMapping.CUSTOMER_VERSION = custVer; rowMapping.EDIT_EMP = this.LoginUser.EMP_NO; rowMapping.EDIT_TIME = GetDBDateTime(); result = sfcdb.ExecSQL(rowMapping.GetUpdateString(this.DBTYPE)); if (Convert.ToInt32(result) > 0) { StationReturn.Message = ""; StationReturn.MessagePara.Add(Convert.ToInt32(result)); StationReturn.MessageCode = "MES00000035"; StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.Data = ""; } else { StationReturn.Message = ""; StationReturn.MessagePara.Add(result); StationReturn.MessageCode = "MES00000025"; StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.Data = ""; } this.DBPools["SFCDB"].Return(sfcdb); } catch (Exception e) { this.DBPools["SFCDB"].Return(sfcdb); StationReturn.MessagePara.Add(e.Message); StationReturn.Message = e.Message; StationReturn.MessageCode = "MES00000025"; StationReturn.Status = StationReturnStatusValue.Fail; } }
public void DeleteMapping(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { T_C_SKU_VER_MAPPING skuVerMapping = null; OleExec sfcdb = null; try { string result; string id = Data["ID"].ToString().Trim().ToUpper(); sfcdb = this.DBPools["SFCDB"].Borrow(); sfcdb.ThrowSqlExeception = true; skuVerMapping = new T_C_SKU_VER_MAPPING(sfcdb, DB_TYPE_ENUM.Oracle); Row_C_SKU_VER_MAPPING rowMapping = (Row_C_SKU_VER_MAPPING)skuVerMapping.GetObjByID(id, sfcdb); result = sfcdb.ExecSQL(rowMapping.GetDeleteString(this.DBTYPE)); if (Convert.ToInt32(result) > 0) { StationReturn.Message = ""; StationReturn.MessageCode = "MES00000004"; StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.Data = ""; } else { StationReturn.Message = ""; StationReturn.MessagePara.Add(result); StationReturn.MessageCode = "MES00000023"; StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.Data = ""; } this.DBPools["SFCDB"].Return(sfcdb); } catch (Exception e) { this.DBPools["SFCDB"].Return(sfcdb); StationReturn.Message = e.Message; StationReturn.MessagePara.Add(e.Message); StationReturn.MessageCode = "MES00000023"; StationReturn.Status = StationReturnStatusValue.Fail; } }
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; } } }