public string Rework_SN(IDictionary <string, object> mst, List <string> LsKeyParts) { DbConnection conn = ProviderHelper.GetConnection(ProConfiguration.GetConfig().DatabaseType, ProConfiguration.GetConfig().DatabaseConnect); DbTransaction tx = ProviderHelper.BeginTransaction(conn); string Colnum = "ESN,WOID,PARTNUMBER,PRODUCTNAME,VERSIONCODE,TYPE,LOCSTATION,STATIONNAME,WIPSTATION,NEXTSTATION,USERID,RECDATE," + "ERRFLAG,SCRAPFLAG,SN,MAC,IMEI,CARTONNUMBER,TRAYNO,PALLETNUMBER,MCARTONNUMBER,MPALLETNUMBER,LINE,SECTIONNAME,ROUTGROUPID," + "STORENUMBER,WEIGHTQTY,QA_NO,QA_RESULT,TRACK_NO,ATE_STATION_NO,IN_LINE_TIME,BOMNUMBER,REWORKNO"; int count = 0; try { IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("ESN", mst["ESN"]); DataTable dt_wip_tracking = dp.GetData("SFCR.T_WIP_TRACKING_ONLINE", Colnum, dic, out count).Tables[0]; if (count > 0) { dp.AddListData(tx, "SFCR.T_WIP_UNDO", DataTableToDictionary(dt_wip_tracking)); } if (LsKeyParts.Count > 0) { string colnumKeyPart = "esn,woId,sntype,snval,station,kpno,recdate".ToUpper(); DataTable dt_KeyParts = dp.GetData("SFCR.T_WIP_KEYPART_ONLINE", colnumKeyPart, dic, out count).Tables[0]; DataTable dt_Backup_KeyParts = new DataTable(); foreach (string str in colnumKeyPart.Split(',')) { dt_Backup_KeyParts.Columns.Add(str, typeof(string)); } if (dt_KeyParts.Rows.Count > 0) { foreach (DataRow dr in dt_KeyParts.Rows) { if (LsKeyParts.Contains(dr["SNTYPE"].ToString())) { dt_Backup_KeyParts.Rows.Add(dr["ESN"].ToString(), dr["WOID"].ToString(), dr["SNTYPE"].ToString(), dr["SNVAL"].ToString(), dr["STATION"].ToString(), dr["KPNO"].ToString(), dr["RECDATE"].ToString()); } } } if (dt_Backup_KeyParts.Rows.Count > 0) { dp.AddListData(tx, "SFCR.T_WIP_KEYPART_UNDO", DataTableToDictionary(dt_Backup_KeyParts)); dp.DeleteListData(tx, "SFCR.T_WIP_KEYPART_ONLINE", DataTableToDictionary(dt_Backup_KeyParts)); } } dp.UpdateData(tx, "SFCR.T_WIP_TRACKING_ONLINE", new string[] { "ESN" }, mst); tx.Commit(); return("OK"); } catch (Exception ex) { tx.Rollback(); return(ex.Message); } finally { conn.Close(); conn.Dispose(); } }