public void DeleteMpnWithSku(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { string CSKUMPNIDS = Data["CSKUMPNIDS"].ToString().Trim(); ArrayList DelIds = new ArrayList(CSKUMPNIDS.Split(',')); DelIds.Remove(""); OleExec oleDB = null; T_C_SKU_MPN cSkuMpn = null; try { oleDB = this.DBPools["SFCDB"].Borrow(); cSkuMpn = new T_C_SKU_MPN(oleDB, DBTYPE); oleDB.BeginTrain(); foreach (var VARIABLE in (string[])DelIds.ToArray(typeof(string))) { oleDB.ThrowSqlExeception = true; Row_C_SKU_MPN rowCSkuMpn = (Row_C_SKU_MPN)cSkuMpn.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 UpdateMpnWithSku(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { string id = Data["ID"].ToString().Trim(), sku = Data["SKUNO"].ToString().Trim(), partNo = Data["PARTNO"].ToString().Trim(), mpn = Data["MPN"].ToString().Trim(); OleExec oleDB = null; T_C_SKU_MPN cSkuMpn = null; try { oleDB = this.DBPools["SFCDB"].Borrow(); cSkuMpn = new T_C_SKU_MPN(oleDB, DBTYPE); Row_C_SKU_MPN rowCSkuMpn = (Row_C_SKU_MPN)cSkuMpn.GetObjByID(id, oleDB, DBTYPE); if (cSkuMpn.IsExists(oleDB, sku, partNo, mpn)) { StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.MessageCode = "MES00000005"; StationReturn.Data = ""; } else if (rowCSkuMpn != null) { rowCSkuMpn.SKUNO = sku; rowCSkuMpn.PARTNO = partNo; rowCSkuMpn.MPN = mpn; rowCSkuMpn.EDIT_EMP = this.LoginUser.EMP_NO; rowCSkuMpn.EDIT_TIME = GetDBDateTime(); oleDB.ThrowSqlExeception = true; oleDB.ExecSQL(rowCSkuMpn.GetUpdateString(DBTYPE)); StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.MessageCode = "MES00000004"; } } catch (Exception e) { throw e; } finally { oleDB.ThrowSqlExeception = false; this.DBPools["SFCDB"].Return(oleDB); } }