public string Update_WIP_KEYPARTS(string ESN, string KPS, string OLDKPS, string SNTYPE) { try { string table = "SFCR.T_WIP_KEYPART_ONLINE"; if (DB_Flag == 1) { table = "SFCR.T_WIP_KEYPART"; } string fieldlist = "SNVAL={0},RECDATE={1}"; string filter = "ESN={0} AND SNTYPE={1} AND SNVAL={2}"; IDictionary <string, object> modFields = new Dictionary <string, object>(); modFields.Add("SNVAL", KPS); modFields.Add("RECDATE", DateTime.Now); IDictionary <string, object> keyVals = new Dictionary <string, object>(); keyVals.Add("ESN", ESN); keyVals.Add("SNTYPE", SNTYPE); keyVals.Add("SNVAL1", OLDKPS); TransactionManager.UpdateBatchData(table, fieldlist, modFields, filter, keyVals); table = "SFCR.T_WIP_TRACKING_ONLINE"; if (DB_Flag == 1) { table = "SFCR.T_WIP_TRACKING"; } if ((SNTYPE == "MAC") || (SNTYPE == "IMEI") || (SNTYPE == "SN")) { fieldlist = SNTYPE + "={0}, STORENUMBER=CONCAT(STORENUMBER,'_R')"; filter = "ESN={0}"; modFields = new Dictionary <string, object>(); modFields.Add(SNTYPE, KPS); keyVals = new Dictionary <string, object>(); keyVals.Add("ESN", OLDKPS); TransactionManager.UpdateBatchData(table, fieldlist, modFields, filter, keyVals); } else { fieldlist = "STORENUMBER=CONCAT(STORENUMBER,'_R')"; filter = "ESN={0}"; modFields = new Dictionary <string, object>(); keyVals = new Dictionary <string, object>(); keyVals.Add("ESN", OLDKPS); TransactionManager.UpdateBatchData(table, fieldlist, modFields, filter, keyVals); } return("OK"); } catch (Exception ex) { return(ex.Message); } }
public string Scrap_SN(IDictionary <string, object> mst, IDictionary <string, object> mst_scrap) { 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)); } dp.UpdateData(tx, "SFCR.T_WIP_TRACKING_ONLINE", new string[] { "ESN" }, mst); dp.AddData(tx, "SFCR.T_SN_SCRAP", mst_scrap); string table = "SFCR.T_WO_INFO"; string fieldlist = "SCRAPQTY = SCRAPQTY + {0}"; string filter = "WOID ={0}"; IDictionary <string, object> modFields = new Dictionary <string, object>(); modFields.Add("SCRAPQTY", 1); IDictionary <string, object> keyVals = new Dictionary <string, object>(); keyVals.Add("WOID", mst_scrap["WOID"]); TransactionManager.UpdateBatchData(table, fieldlist, modFields, filter, keyVals); tx.Commit(); return("OK"); } catch (Exception ex) { tx.Rollback(); return(ex.Message); } finally { conn.Close(); conn.Dispose(); } }
public string UPDATE_TOOLS_Use_Quantity(string TOOSNO) { try { StringBuilder ofilter = new StringBuilder(); ofilter.Append(" USE_QTY=USE_QTY+1 "); IDictionary <string, object> modFields = new Dictionary <string, object>(); string filter = "TOOLS_NO = {0}"; IDictionary <string, object> keyVals = new Dictionary <string, object>(); keyVals.Add("TOOLS_NO", TOOSNO); TransactionManager.UpdateBatchData(table, ofilter.ToString(), modFields, filter, keyVals); return("OK"); } catch (Exception ex) { return(ex.Message); } }
public string update_station_recout(string ROWID, string WOID, string CRAFTID, string WORKDATE, string WORKSECTION, string LINEID, int PASSQTY, int FAILQTY, int RPASSQTY, int RFAILQTY, string FLAG) { //string table = "SFCR.T_STATION_RECOUNT"; //string fieldlist = "PASSQTY=PASSQTY+{0},FAILQTY=FAILQTY+{1},RPASSQTY=RPASSQTY+{2},RFAILQTY=RFAILQTY+{3}, FLAG={4}"; //string filter = "WOID ={0} AND CRAFTID = {1} AND WORKDATE ={2} AND WORKSECTION = {3} AND LINEID = {4} LIMIT 1"; //IDictionary<string, object> modFields = new Dictionary<string, object>(); //modFields.Add("PASSQTY", PASSQTY); //modFields.Add("FAILQTY", FAILQTY); //modFields.Add("RPASSQTY", RPASSQTY); //modFields.Add("RFAILQTY", RFAILQTY); //modFields.Add("FLAG", FLAG); //IDictionary<string, object> keyVals = new Dictionary<string, object>(); //keyVals.Add("WOID", WOID); //keyVals.Add("CRAFTID", CRAFTID); //keyVals.Add("WORKDATE", WORKDATE); //keyVals.Add("WORKSECTION", WORKSECTION); //keyVals.Add("LINEID", LINEID); //TransactionManager.UpdateBatchData(table, fieldlist, modFields, filter, keyVals); //return "OK"; string table = "SFCR.T_STATION_RECOUNT"; string filter = "ROWID={0}"; string fieldlist = null; IDictionary <string, object> modFields = null; if (PASSQTY != 0) { fieldlist = "PASSQTY=PASSQTY+{0}"; modFields = new Dictionary <string, object>(); modFields.Add("PASSQTY", PASSQTY); } if (FAILQTY != 0) { fieldlist = "FAILQTY=FAILQTY+{0}"; modFields = new Dictionary <string, object>(); modFields.Add("FAILQTY", FAILQTY); } if (RPASSQTY != 0) { fieldlist = "RPASSQTY=RPASSQTY+{0}"; modFields = new Dictionary <string, object>(); modFields.Add("RPASSQTY", RPASSQTY); } if (RFAILQTY != 0) { fieldlist = "RFAILQTY=RFAILQTY+{0}"; modFields = new Dictionary <string, object>(); modFields.Add("RFAILQTY", RFAILQTY); } IDictionary <string, object> keyVals = new Dictionary <string, object>(); keyVals.Add("ROWID", ROWID); // keyVals.Add("WOID", WOID); //keyVals.Add("CRAFTID", CRAFTID); //keyVals.Add("WORKDATE", WORKDATE); //keyVals.Add("WORKSECTION", WORKSECTION); //keyVals.Add("LINEID", LINEID); TransactionManager.UpdateBatchData(table, fieldlist, modFields, filter, keyVals); return("OK"); }