public void DeleteWoReplaceKpWithSku(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { string RWOKPREPLACEIDS = Data["RWOKPREPLACEIDS"].ToString().Trim(); ArrayList DelIds = new ArrayList(RWOKPREPLACEIDS.Split(',')); DelIds.Remove(""); OleExec oleDB = null; T_R_WO_KP_Repalce rWoKpRepalce = null; try { oleDB = this.DBPools["SFCDB"].Borrow(); rWoKpRepalce = new T_R_WO_KP_Repalce(oleDB, DBTYPE); oleDB.BeginTrain(); foreach (var VARIABLE in (string[])DelIds.ToArray(typeof(string))) { oleDB.ThrowSqlExeception = true; Row_R_WO_KP_Repalce rowCSkuMpn = (Row_R_WO_KP_Repalce)rWoKpRepalce.GetObjByID(VARIABLE, oleDB, DBTYPE); oleDB.ExecSQL(rowCSkuMpn.GetDeleteString(DBTYPE)); } oleDB.CommitTrain(); StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.MessageCode = "MES00000004"; } catch (Exception e) { oleDB.RollbackTrain(); throw e; } finally { this.DBPools["SFCDB"].Return(oleDB); } }
public void SetWoReplaceKpWithSku(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { string Wo = Data["WO"].ToString().Trim(), PartNo = Data["PARTNO"].ToString().Trim(), ReplacePartno = Data["REPLACEPARTNO"].ToString().Trim(), Sku = Data["SKUNO"].ToString().Trim(); OleExec oleDB = null; T_R_WO_KP_Repalce rWoKpReplace = null; T_C_SKU cSku = null; T_R_WO_BASE rWoBase = null; try { oleDB = this.DBPools["SFCDB"].Borrow(); rWoKpReplace = new T_R_WO_KP_Repalce(oleDB, DBTYPE); cSku = new T_C_SKU(oleDB, DBTYPE); rWoBase = new T_R_WO_BASE(oleDB, DBTYPE); if (!cSku.SkuIsExist(Sku, oleDB)) { StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.MessageCode = "MES00000245"; StationReturn.MessagePara = new List <object>() { Sku }; } else if (rWoBase.CheckDataExist(Wo, Sku, oleDB)) { StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.MessageCode = "MES00000245"; StationReturn.Data = ""; } else if (rWoKpReplace.CheckDataExist(Wo, PartNo, ReplacePartno, oleDB)) { StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.MessageCode = "MES00000005"; StationReturn.Data = ""; } else { Row_R_WO_KP_Repalce rowRWoKpReplace = (Row_R_WO_KP_Repalce)rWoKpReplace.NewRow(); rowRWoKpReplace.ID = rWoKpReplace.GetNewID(this.BU, oleDB, DBTYPE); rowRWoKpReplace.WO = Wo; rowRWoKpReplace.PARTNO = PartNo; rowRWoKpReplace.REPALCEPARTNO = ReplacePartno; rowRWoKpReplace.EDIT_EMP = this.LoginUser.EMP_NO; rowRWoKpReplace.EDIT_TIME = GetDBDateTime();; oleDB.ThrowSqlExeception = true; oleDB.ExecSQL(rowRWoKpReplace.GetInsertString(DBTYPE)); StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.MessageCode = "MES00000002"; StationReturn.Data = ""; } } catch (Exception e) { throw e; } finally { this.DBPools["SFCDB"].Return(oleDB); } }