public string InserSnRule(string Lisdicsnrule, string ESN_TYPE) { IList <IDictionary <string, object> > Lsdicrule = MapListConverter.JsonToListDictionary(Lisdicsnrule); IDictionary <string, object> mst = null; IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); DbConnection conn = ProviderHelper.GetConnection(ProConfiguration.GetConfig().DatabaseType, ProConfiguration.GetConfig().DatabaseConnect); DbTransaction tx = ProviderHelper.BeginTransaction(conn); try { mst = new Dictionary <string, object>(); mst.Add("WOID", Lsdicrule[0]["WOID"]); mst.Add("REVE", "1"); dp.DeleteData(tx, "SFCR.T_SN_RULE", mst); mst = new Dictionary <string, object>(); mst.Add("WOID", Lsdicrule[0]["WOID"]); dp.DeleteData(tx, "SFCR.T_WO_SN_RULE", mst); foreach (Dictionary <string, object> dicrule in Lsdicrule) { if (dicrule["SNTYPE"].ToString() != "NA") ////如果前台没有添加区间信息,判定SNTYPE=NA,则不增加区间 { dp.AddData(tx, "SFCR.T_WO_SN_RULE", dicrule); if (dicrule["SNTYPE"].ToString() == ESN_TYPE) { mst = new Dictionary <string, object>(); mst.Add("WOID", dicrule["WOID"]); mst.Add("SNPREFIX", dicrule["SNPREFIX"]); mst.Add("SNPOSTFIX", dicrule["SNPOSTFIX"]); mst.Add("SNSTART", dicrule["SNSTART"]); mst.Add("SNEND", dicrule["SNEND"]); mst.Add("REVE", "1"); mst.Add("VER", dicrule["VER"]); mst.Add("CURRSN", "NA"); dp.AddData(tx, "SFCR.T_SN_RULE", mst); } } } tx.Commit(); return("OK"); } catch (Exception ex) { tx.Rollback(); return(ex.Message); } finally { conn.Close(); conn.Dispose(); } }
//public List<string> GetSnListForAte(string sntype, string woId, int snqty) //{ // List<string> BarcodeList = new List<string>(); // MySqlCommand cmd = new MySqlCommand(); // cmd.CommandText = string.Format("select rowid,snval from SFCR.T_WO_SNLIST where woId=@woId and sntype=@sntype and status=0 and rownum<={0} order by seq", snqty); // cmd.Parameters.Add("woId", MySqlDbType.VarChar, woId.Length).Value = woId; // cmd.Parameters.Add("sntype", MySqlDbType.VarChar, sntype.Length).Value = sntype; // DataTable dt = BLL.BllMsSqllib.Instance.ExecuteDataSet(cmd).Tables[0]; // if (dt != null && dt.Rows.Count != 0) // { // if (dt.Rows.Count == snqty) // { // MySqlCommand[] cmdList = new MySqlCommand[100]; // List<MySqlCommand> lsCmd = new List<MySqlCommand>(); // BarcodeList.Add("OK"); // int x = 0; // foreach (DataRow dr in dt.Rows) // { // int y = x++; // cmdList[y] = new MySqlCommand(); // cmdList[y].CommandText = "Update SFCR.T_WO_SNLIST set status=@flag where rowid=@idx and status=0"; // cmdList[y].Parameters.Add("idx", MySqlDbType.VarChar, 50).Value = dr["rowid"].ToString(); // cmdList[y].Parameters.Add("flag", MySqlDbType.Int32).Value = 2; // lsCmd.Add(cmdList[y]); // BarcodeList.Add(dr["snval"].ToString()); // } // string msg = BLL.BllMsSqllib.Instance.ExecteNonQueryTransaction(lsCmd); // if (msg != "OK") // { // return GetSnListForAte(sntype, woId, snqty); // } // } // else // { // BarcodeList.Add("Bar code is not enough"); // } // } // else // { // BarcodeList.Add("FAIL"); // } // return BarcodeList; //} //public string UpdateStatusGetSnListForAte(string sntype, string woId, List<string> listsn, int sStatus) //{ // int Flag = 0; // if (sStatus == 1) // Flag = 1; // MySqlCommand[] cmd = new MySqlCommand[100]; // List<MySqlCommand> lsCmd = new List<MySqlCommand>(); // int x = 0; // for (int i = 0; i < listsn.Count; i++) // { // int y = x++; // cmd[y] = new MySqlCommand(); // cmd[y].CommandText = "Update SFCR.T_WO_SNLIST set status=@flag where woId=@woId and sntype=@sntype and snval=@snval"; // cmd[y].Parameters.Add("flag", MySqlDbType.Int32).Value = Flag; // cmd[y].Parameters.Add("sntype", MySqlDbType.VarChar, sntype.Length).Value = sntype; // cmd[y].Parameters.Add("woId", MySqlDbType.VarChar, woId.Length).Value = woId; // cmd[y].Parameters.Add("snval", MySqlDbType.VarChar, listsn[i].Length).Value = listsn[i]; // lsCmd.Add(cmd[y]); // } // return BLL.BllMsSqllib.Instance.ExecteNonQueryTransaction(lsCmd); //} #endregion //#region 产品跟踪序列号 /// <summary> /// 添加序列号区间 /// </summary> /// <param name="snrule"></param> public void InsetSnRule(string dicstring) { IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); IDictionary <string, object> mst = MapListConverter.JsonToDictionary(dicstring); dp.AddData("SFCR.T_SN_RULE", mst); }
public void InsertKeyParts(string dickpt) { IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); IDictionary <string, object> dic = MapListConverter.JsonToDictionary(dickpt); dp.AddData("SFCB.B_KEYPART", dic); }
public void InsertSmtIoData(string dicskm) { IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); IDictionary <string, object> mst = MapListConverter.JsonToDictionary(dicskm); dp.AddData("SFCR.T_SMT_KP_MONNITOR", mst); }
public string InsertWoInfo(string dicwoinfo) { IDictionary <string, object> dic = MapListConverter.JsonToDictionary(dicwoinfo); string fieldlist = "COUNT(1)"; int count = 0; IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); IDictionary <string, object> mst = new Dictionary <string, object>(); mst.Add("WOID", dic["WOID"]); DataTable dt = dp.GetData(table, fieldlist, mst, out count).Tables[0]; try { if (dt.Rows[0][0].ToString() == "0") { mst.Add("RECDATE", System.DateTime.Now); dp.AddData(table, dic); } else { mst.Add("RECDATE", System.DateTime.Now); dp.UpdateData(table, new string[] { "WOID" }, dic); } return("OK"); } catch (Exception ex) { return(ex.Message); } }
public void InsertPartKeyParts(string dicstring) { IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); IDictionary <string, object> mst = MapListConverter.JsonToDictionary(dicstring); dp.AddData(table, mst); }
/// <summary> /// 添加料站表数据 /// </summary> /// <param name="kpmaster">料站表头数据</param> /// <param name="lskpdetalt">料站表身数据列表</param> public void InsertMaterTable(string kpmaster, string lskpdetalt) { string outmasteridTemp; string Err; IDictionary <string, object> mst = MapListConverter.JsonToDictionary(kpmaster); IList <IDictionary <string, object> > Lsmst = MapListConverter.JsonToListDictionary(lskpdetalt); mPro.PRO_INSERT_SMT_KP_MASTER(mst["LINEID"].ToString(), mst["USERID"].ToString(), mst["PARTNUMBER"].ToString(), mst["MODELNAME"].ToString(), mst["BOMVER"].ToString(), mst["PCBSIDE"].ToString(), mst["RESERVE1"].ToString(), "0", out outmasteridTemp, out Err); if (Err != "OK") { throw new Exception(Err + " 料站表头数据增加失败,请检查"); } IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); foreach (Dictionary <string, object> item in Lsmst) { item["MASTERID"] = outmasteridTemp; try { dp.AddData("SFCR.T_SMT_KP_DETALT", item); } catch (Exception ex) { throw new Exception(ex.Message + " 料站表身数据增加失败,请检查[" + item["STATIONNO"] + "]"); } } }
/// <summary> /// 新增工厂信息 /// </summary> /// <param name="facinfo"></param> public void InsertFacInfo(string dicFacinfo) { IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); IDictionary <string, object> dic = MapListConverter.JsonToDictionary(dicFacinfo); dp.AddData(table, dic); }
/// <summary> /// 增加制程段 /// </summary> /// <param name="bworksegment"></param> /// <returns></returns> public void InsertWorkSegment(string bworksegment) { IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); IDictionary<string, object> mst = new Dictionary<string, object>(); mst.Add("beworkseg", bworksegment); dp.AddData("SFCB.B_WORK_SEGMENT", mst); }
public void InsertPalletInfo(IDictionary <string, object> dic) { IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); dic.Add("RECDATE", System.DateTime.Now); dp.AddData(table, dic); }
public string Insert_T_WO_Material(string TrSn, string UserID, string STATUS) { try { IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); int count = 0; IDictionary <string, object> mst = new Dictionary <string, object>(); mst.Add("TR_SN", TrSn); DataTable dt = dp.GetData("SFCR.R_TR_SN", "TR_SN,KP_NO,VENDER_ID,DATE_CODE,LOT_CODE,QTY,WOID", mst, out count).Tables[0]; if (dt.Rows.Count > 0) { mst = new Dictionary <string, object>(); mst.Add("TR_SN", dt.Rows[0]["TR_SN"].ToString()); mst.Add("KP_NO", dt.Rows[0]["KP_NO"].ToString()); mst.Add("VENDER_ID", dt.Rows[0]["VENDER_ID"].ToString()); mst.Add("DATE_CODE", dt.Rows[0]["DATE_CODE"].ToString()); mst.Add("LOT_CODE", dt.Rows[0]["LOT_CODE"].ToString()); mst.Add("QTY", Convert.ToInt32(dt.Rows[0]["QTY"].ToString())); mst.Add("WOID", dt.Rows[0]["WOID"].ToString()); mst.Add("USER_ID", UserID); mst.Add("STATUS", STATUS); dp.AddData(table, mst); } return("OK"); } catch (Exception ex) { return(ex.Message); } }
public string InsertAteScript(string AteScript) { try { int count = 0; IDictionary <string, object> mstAteScript = MapListConverter.JsonToDictionary(AteScript); IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); IDictionary <string, object> mst = new Dictionary <string, object>(); mst = new Dictionary <string, object>(); mst.Add("WOID", mstAteScript["WOID"]); DataTable dtate = dp.GetData("SFCB.B_ATE_SCRIPT", "COUNT(1)", mst, out count).Tables[0]; if (dtate.Rows[0][0].ToString() == "0") { dp.AddData("SFCB.B_ATE_SCRIPT", mstAteScript); } else { dp.UpdateData("SFCB.B_ATE_SCRIPT", new string[] { "WOID" }, mstAteScript); } return("OK"); } catch (Exception ex) { return(ex.Message); } }
public string AddStorehouseloction(string dicwarehouseloc) { try { //MySqlCommand cmd = new MySqlCommand(); //cmd.CommandText = "INSERT INTO sfcr.t_storehouse_loction_info (LOCID, UPLOCID, LOCTYPE, STOREHOUSEID, LOCDESC, LOCTOTAL, REMARK) " + // "VALUES (@sLOCID,@sUPLOCID,@sLOCTYPE,@sSTOREHOUSEID,@sLOCDESC,@sLOCTOTAL,@sREMARK)"; //cmd.Parameters.AddRange(new MySqlParameter[]{ // new MySqlParameter("sLOCID",MySqlDbType.VarChar){Value=warehouseloc.locId}, // new MySqlParameter("sUPLOCID",MySqlDbType.VarChar){Value=warehouseloc.uplocId}, // new MySqlParameter("sLOCTYPE",MySqlDbType.VarChar){Value=warehouseloc.loctype}, // new MySqlParameter("sSTOREHOUSEID",MySqlDbType.VarChar){Value=warehouseloc.storehouseId}, // new MySqlParameter("sLOCDESC",MySqlDbType.VarChar){Value=warehouseloc.locdesc}, // new MySqlParameter("sLOCTOTAL",MySqlDbType.VarChar){Value=warehouseloc.loctotal}, // new MySqlParameter("sREMARK",MySqlDbType.VarChar){Value=warehouseloc.remark} //}); //BLL.BllMsSqllib.Instance.ExecteNonQuery(cmd); IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); IDictionary <string, object> mst = MapListConverter.JsonToDictionary(dicwarehouseloc); dp.AddData("sfcr.t_storehouse_loction_info".ToUpper(), mst); return(null); } catch (Exception ex) { return(ex.Message); } }
//新建一条记录 public void InserttCustomer(string Insp) { IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); IDictionary <string, object> dic = MapListConverter.JsonToDictionary(Insp); dp.AddData(table, dic); }
public string AddStorehouse(string dicwarehouse) { try { //MySqlCommand cmd = new MySqlCommand(); //cmd.CommandText = "INSERT INTO SFCB.B_STOREHOUSE_INFO (STOREHOUSEID,STOREHOUSENAME,STOREHOUSEDESC,STOREHOUSEMAN,STOREHOUSETYPE,REMARK) " + // "VALUES (@STID,@STNAME,@STDESC,@STMAN,@STYPE,@sREMARK)"; //cmd.Parameters.AddRange(new MySqlParameter[]{ // new MySqlParameter("STID",MySqlDbType.VarChar){Value=warehouse.storehouseId} , // new MySqlParameter("STNAME",MySqlDbType.VarChar){Value=warehouse.storehousename}, // new MySqlParameter("STDESC",MySqlDbType.VarChar){Value=warehouse.storehousedesc}, // new MySqlParameter("STMAN",MySqlDbType.VarChar){Value=warehouse.storehouseman}, // new MySqlParameter("STYPE",MySqlDbType.VarChar){Value=warehouse.storehousetype}, // new MySqlParameter("sREMARK",MySqlDbType.VarChar){Value=warehouse.remark}, //}); //BLL.BllMsSqllib.Instance.ExecteNonQuery(cmd); IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); IDictionary <string, object> mst = MapListConverter.JsonToDictionary(dicwarehouse); dp.AddData("SFCB.B_STOREHOUSE_INFO", mst); return(null); } catch (Exception ex) { return(ex.Message); } }
/// <summary> /// 新增线体信息 /// </summary> /// <param name="lineinfo"></param> public void InsertLineInfo(string dicLineinfo) { IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); IDictionary <string, object> dic = MapListConverter.JsonToDictionary(dicLineinfo); dp.AddData("SFCB.B_LINE_INFO", dic); }
// /// <summary> // /// 未入库重工使用 // /// </summary> // /// <param name="ClearWip"></param> // /// <param name="ESN"></param> // /// <param name="LocGroup"></param> // /// <param name="WipGroup"></param> // /// <param name="ReworkNo"></param> // /// <returns></returns> // public string UpdateDataForRework(List<string> ClearWip, List<string> Listsn, string LocGroup, string WipGroup, string ReworkNo, int Total) // { // string Msg = ""; // string ESN = ""; // if (Listsn.Count != Total) // { // return string.Format("传入资料异常,传入ESN数量{0}个,实际应该是{1}", Listsn.Count.ToString(), Total.ToString()); // } // else // { // for (int xi = 0; xi < Listsn.Count; xi++) // { // try // { // ESN = Listsn[xi].ToString(); // List<string> WipKeyparts = new List<string>(); // MySqlCommand[] cmd = new MySqlCommand[100]; // List<MySqlCommand> lsCmd = new List<MySqlCommand>(); // string ColnumWip = ""; // int y = 0; // for (int i = 0; i < ClearWip.Count; i++) // { // string str = ClearWip[i].ToString(); // int x = str.IndexOf('-'); // string Flag = str.Substring(0, x); // string Colnum = str.Substring(x + 1, str.Length - x - 1); // if (Flag == "0") // { // ColnumWip += string.Format("{0}='NA',", Colnum); // } // if (Flag == "1") // { // WipKeyparts.Add(string.Format("sntype='{0}'", Colnum)); // } // } // ColnumWip = ColnumWip + "Locstation=@loc,wipstation=@wip,"; // ColnumWip = ColnumWip.Substring(0, ColnumWip.Length - 1); // 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"; // cmd[y] = new MySqlCommand(); // cmd[y].CommandText = string.Format("insert into SFCR.T_WIP_UNDO ({0},reworkno) select {0},@rewno from sfcr.T_WIP_TRACKING_ONLINE where esn=@esn", colnum); // cmd[y].Parameters.Add("rewno", MySqlDbType.VarChar, ReworkNo.Length).Value = ReworkNo; // cmd[y].Parameters.Add("esn", MySqlDbType.VarChar, ESN.Length).Value = ESN; // lsCmd.Add(cmd[y]); // y++; // cmd[y] = new MySqlCommand(); // cmd[y].CommandText = "Update sfcr.T_WIP_TRACKING_ONLINE set reworkno=@rewno,nextstation=@next," + ColnumWip + " where esn=@esn"; // cmd[y].Parameters.Add("rewno", MySqlDbType.VarChar, ReworkNo.Length).Value = ReworkNo; // cmd[y].Parameters.Add("next", MySqlDbType.VarChar, WipGroup.Length).Value = WipGroup; // cmd[y].Parameters.Add("loc", MySqlDbType.VarChar, LocGroup.Length).Value = LocGroup; // cmd[y].Parameters.Add("wip", MySqlDbType.VarChar, WipGroup.Length).Value = WipGroup; // cmd[y].Parameters.Add("esn", MySqlDbType.VarChar, ESN.Length).Value = ESN; // lsCmd.Add(cmd[y]); // if (WipKeyparts.Count != 0) // { // for (int x = 0; x < WipKeyparts.Count; x++) // { // string colnumKeyPart = "esn,woId,sntype,snval,station,kpno,recdate"; // y++; // cmd[y] = new MySqlCommand(); // cmd[y].CommandText = string.Format("insert into SFCR.T_WIP_KEYPART_UNDO ({1}) select {1} from SFCR.T_WIP_KEYPART_ONLINE where esn=@esn and {0}", WipKeyparts[x].ToString(), colnumKeyPart); // cmd[y].Parameters.Add("esn", MySqlDbType.VarChar, ESN.Length).Value = ESN; // lsCmd.Add(cmd[y]); // y++; // cmd[y] = new MySqlCommand(); // cmd[y].CommandText = string.Format("Delete FROM SFCR.T_WIP_KEYPART_ONLINE where esn=@esn and {0}", WipKeyparts[x].ToString()); // cmd[y].Parameters.Add("esn", MySqlDbType.VarChar, ESN.Length).Value = ESN; // lsCmd.Add(cmd[y]); // y++; // cmd[y] = new MySqlCommand(); // cmd[y].CommandText = string.Format("update SFCR.T_WO_SNLIST set snval='0' where snval=(select snval from SFCR.T_WIP_KEYPART_ONLINE where esn=@esn and {0} and rownum=1)", WipKeyparts[x].ToString()); // cmd[y].Parameters.Add("esn", MySqlDbType.VarChar, ESN.Length).Value = ESN; // lsCmd.Add(cmd[y]); // } // } // if (ColnumWip.ToUpper().IndexOf("CARTONNUMBER") > -1) // { // y++; // cmd[y] = new MySqlCommand(); // cmd[y].CommandText = "update SFCR.T_CARTON_INFO_HAD set num=num-1,flag='0' where cartonId=(select cartonid from SFCR.T_CARTON_INFO_DTA where esn=@esn and rownum=1)"; // cmd[y].Parameters.Add("esn", MySqlDbType.VarChar, ESN.Length).Value = ESN; // lsCmd.Add(cmd[y]); // y++; // cmd[y] = new MySqlCommand(); // cmd[y].CommandText = "Delete FROM SFCR.T_CARTON_INFO_DTA where esn=@esn"; // cmd[y].Parameters.Add("esn", MySqlDbType.VarChar, ESN.Length).Value = ESN; // lsCmd.Add(cmd[y]); // } // //try // //{ // BLL.BllMsSqllib.Instance.ExecteNonQueryArr(lsCmd); // Msg = "OK"; // } // catch (Exception ex) // { // Msg = ex.Message + "ESN:" + ESN; // } // } // return Msg; // } // } // /// <summary> // /// 未入库重工使用------单个产品一过 // /// </summary> // /// <param name="ClearWip"></param> // /// <param name="Listsn"></param> // /// <param name="LocGroup"></param> // /// <param name="WipGroup"></param> // /// <param name="ReworkNo"></param> // /// <returns></returns> // public string UpdateDataForReworkSigle(List<string> ClearWip, string Listsn, string LocGroup, string WipGroup, string ReworkNo) // { // string Msg = ""; // string ESN = ""; // try // { // ESN = Listsn; // List<string> WipKeyparts = new List<string>(); // MySqlCommand[] cmd = new MySqlCommand[100]; // List<MySqlCommand> lsCmd = new List<MySqlCommand>(); // string ColnumWip = ""; // int y = 0; // for (int i = 0; i < ClearWip.Count; i++) // { // string str = ClearWip[i].ToString(); // int x = str.IndexOf('-'); // string Flag = str.Substring(0, x); // string Colnum = str.Substring(x + 1, str.Length - x - 1); // if (Flag == "0") // { // ColnumWip += string.Format("{0}='NA',", Colnum); // } // if (Flag == "1") // { // WipKeyparts.Add(string.Format("sntype='{0}'", Colnum)); // } // } // ColnumWip = ColnumWip + "Locstation=@loc,wipstation=@wip,"; // ColnumWip = ColnumWip.Substring(0, ColnumWip.Length - 1); // 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"; // cmd[y] = new MySqlCommand(); // cmd[y].CommandText = string.Format("insert into SFCR.T_WIP_UNDO ({0},reworkno) select {0},@rewno from sfcr.T_WIP_TRACKING_ONLINE where esn=@esn", colnum); // cmd[y].Parameters.Add("rewno", MySqlDbType.VarChar, ReworkNo.Length).Value = ReworkNo; // cmd[y].Parameters.Add("esn", MySqlDbType.VarChar, ESN.Length).Value = ESN; // lsCmd.Add(cmd[y]); // y++; // cmd[y] = new MySqlCommand(); // cmd[y].CommandText = "Update sfcr.T_WIP_TRACKING_ONLINE set reworkno=@rewno,nextstation=@next," + ColnumWip + " where esn=@esn"; // cmd[y].Parameters.Add("rewno", MySqlDbType.VarChar, ReworkNo.Length).Value = ReworkNo; // cmd[y].Parameters.Add("next", MySqlDbType.VarChar, WipGroup.Length).Value = WipGroup; // cmd[y].Parameters.Add("loc", MySqlDbType.VarChar, LocGroup.Length).Value = LocGroup; // cmd[y].Parameters.Add("wip", MySqlDbType.VarChar, WipGroup.Length).Value = WipGroup; // cmd[y].Parameters.Add("esn", MySqlDbType.VarChar, ESN.Length).Value = ESN; // lsCmd.Add(cmd[y]); // if (WipKeyparts.Count != 0) // { // for (int x = 0; x < WipKeyparts.Count; x++) // { // string colnumKeyPart = "esn,woId,sntype,snval,station,kpno,recdate"; // y++; // cmd[y] = new MySqlCommand(); // cmd[y].CommandText = string.Format("insert into SFCR.T_WIP_KEYPART_UNDO ({1}) select {1} from SFCR.T_WIP_KEYPART_ONLINE where esn=@esn and {0}", WipKeyparts[x].ToString(), colnumKeyPart); // cmd[y].Parameters.Add("esn", MySqlDbType.VarChar, ESN.Length).Value = ESN; // lsCmd.Add(cmd[y]); // y++; // cmd[y] = new MySqlCommand(); // cmd[y].CommandText = string.Format("DELETE FROM SFCR.T_WIP_KEYPART_ONLINE where esn=@esn and {0}", WipKeyparts[x].ToString()); // cmd[y].Parameters.Add("esn", MySqlDbType.VarChar, ESN.Length).Value = ESN; // lsCmd.Add(cmd[y]); // y++; // cmd[y] = new MySqlCommand(); // cmd[y].CommandText = string.Format("update SFCR.T_WO_SNLIST set snval='0' where snval=(select snval from SFCR.T_WIP_KEYPART_ONLINE where esn=@esn and {0} and rownum=1)", WipKeyparts[x].ToString()); // cmd[y].Parameters.Add("esn", MySqlDbType.VarChar, ESN.Length).Value = ESN; // lsCmd.Add(cmd[y]); // } // } // if (ColnumWip.ToUpper().IndexOf("CARTONNUMBER") > -1) // { // y++; // cmd[y] = new MySqlCommand(); // cmd[y].CommandText = "update SFCR.T_CARTON_INFO_HAD set num=num-1,flag='0' where cartonId=(select cartonid from SFCR.T_CARTON_INFO_DTA where esn=@esn and rownum=1)"; // cmd[y].Parameters.Add("esn", MySqlDbType.VarChar, ESN.Length).Value = ESN; // lsCmd.Add(cmd[y]); // y++; // cmd[y] = new MySqlCommand(); // cmd[y].CommandText = "DELETE FROM SFCR.T_CARTON_INFO_DTA where esn=@esn"; // cmd[y].Parameters.Add("esn", MySqlDbType.VarChar, ESN.Length).Value = ESN; // lsCmd.Add(cmd[y]); // } // //try // //{ // ExecteNonQueryArr(lsCmd); // Msg = "OK"; // } // catch (Exception ex) // { // Msg = ex.Message + "ESN:" + ESN; // } // // } // return Msg; // //} // } //public void ExecteNonQueryArr(List<MySqlCommand> cmd) //{ // using (MySqlConnection cn = new MySqlConnection(ProConfiguration.GetConfig().DatabaseConnect)) // { // cn.Open(); // MySqlTransaction sTran = cn.BeginTransaction(); // try // { // foreach (MySqlCommand _cmd in cmd) // { // _cmd.Connection = cn; // _cmd.Transaction = sTran; // _cmd.CommandTimeout = 84100; // _cmd.ExecuteNonQuery(); // _cmd.Dispose(); // } // sTran.Commit(); // } // catch (Exception ex) // { // sTran.Rollback(); // throw ex; // } // finally // { // cn.Close(); // cn.Dispose(); // } // } //} // /// <summary> // /// 已经入库使用 // /// </summary> // /// <param name="ClearWip"></param> // /// <param name="ESN"></param> // /// <param name="LocGroup"></param> // /// <param name="WipGroup"></param> // /// <param name="ReworkNo"></param> // /// <returns></returns> // public string UpdateDataForReworkWareHouse(List<string> ClearWip, List<string> Listsn, string LocGroup, string WipGroup, string ReworkNo, int Total) // { // string Msg = ""; // if (Listsn.Count != Total) // { // return string.Format("传入资料异常,传入ESN数量{0}个,实际应该是{1}", Listsn.Count.ToString(), Total.ToString()); // } // else // { // for (int xi = 0; xi < Listsn.Count; xi++) // { // string ESN = Listsn[xi].ToString(); // List<string> WipKeyparts = new List<string>(); // MySqlCommand[] cmd = new MySqlCommand[100]; // List<MySqlCommand> lsCmd = new List<MySqlCommand>(); // string ColnumWip = ""; // int y = 0; // for (int i = 0; i < ClearWip.Count; i++) // { // string str = ClearWip[i].ToString(); // int x = str.IndexOf('-'); // string Flag = str.Substring(0, x); // string Colnum = str.Substring(x + 1, str.Length - x - 1); // if (Flag == "0") // { // ColnumWip += string.Format("{0}='NA',", Colnum); // } // if (Flag == "1") // { // WipKeyparts.Add(string.Format("sntype='{0}'", Colnum)); // } // } // ColnumWip = ColnumWip + "Locstation=@loc,wipstation=@wip,"; // ColnumWip = ColnumWip.Substring(0, ColnumWip.Length - 1); // 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"; // cmd[y] = new MySqlCommand(); // cmd[y].CommandText = string.Format("insert into SFCR.T_WIP_UNDO ({0},@rewno) select {0},@rewno from sfcr.T_WIP_TRACKING_ONLINE where esn=@esn", colnum); // cmd[y].Parameters.Add("esn", MySqlDbType.VarChar, ESN.Length).Value = ESN; // cmd[y].Parameters.Add("rewno", MySqlDbType.VarChar, ReworkNo.Length).Value = ReworkNo; // lsCmd.Add(cmd[y]); // y++; // cmd[y] = new MySqlCommand(); // cmd[y].CommandText = "Update sfcr.T_WIP_TRACKING_ONLINE set nextstation=@nextwip,reworkno=@rewno," + ColnumWip + " where esn=@esn"; // cmd[y].Parameters.Add("rewno", MySqlDbType.VarChar, ReworkNo.Length).Value = ReworkNo; // cmd[y].Parameters.Add("esn", MySqlDbType.VarChar, ESN.Length).Value = ESN; // cmd[y].Parameters.Add("loc", MySqlDbType.VarChar, LocGroup.Length).Value = LocGroup; // cmd[y].Parameters.Add("wip", MySqlDbType.VarChar, WipGroup.Length).Value = WipGroup; // cmd[y].Parameters.Add("nextwip", MySqlDbType.VarChar, WipGroup.Length).Value = WipGroup; // lsCmd.Add(cmd[y]); // y++; // string whcolnum = @"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,lotin,storehouseid,locid,lotout,recdate1,status"; // cmd[y] = new MySqlCommand(); // cmd[y].CommandText = string.Format(" insert into sfcr.z_whs_tracking_undo ({0},reworkno) select {0},@rewno sfcr.Z_WHS_TRACKING where esn=@esn", whcolnum); // cmd[y].Parameters.Add("esn", MySqlDbType.VarChar, ESN.Length).Value = ESN; // cmd[y].Parameters.Add("rewno", MySqlDbType.VarChar, ReworkNo.Length).Value = ReworkNo; // lsCmd.Add(cmd[y]); // y++; // cmd[y] = new MySqlCommand(); // cmd[y].CommandText = "DELETE FROM sfcr.Z_WHS_TRACKING where esn=@esn"; // cmd[y].Parameters.Add("esn", MySqlDbType.VarChar, ESN.Length).Value = ESN; // lsCmd.Add(cmd[y]); // if (WipKeyparts.Count != 0) // { // for (int x = 0; x < WipKeyparts.Count; x++) // { // y++; // string colnumKeyPart = "esn,woId,sntype,snval,station,kpno,recdate"; // cmd[y] = new MySqlCommand(); // cmd[y].CommandText = string.Format("insert into SFCR.T_WIP_KEYPART_UNDO ({1}) select {1} from SFCR.T_WIP_KEYPART_ONLINE where esn=@SN and {0}", WipKeyparts[x].ToString(), colnumKeyPart); // cmd[y].Parameters.Add("SN", MySqlDbType.VarChar, ESN.Length).Value = ESN; // lsCmd.Add(cmd[y]); // y++; // cmd[y] = new MySqlCommand(); // cmd[y].CommandText = string.Format("DELETE FROM SFCR.T_WIP_KEYPART_ONLINE where esn=@esn and {0}", WipKeyparts[x].ToString()); // cmd[y].Parameters.Add("esn", MySqlDbType.VarChar, ESN.Length).Value = ESN; // lsCmd.Add(cmd[y]); // } // } // y++; // cmd[y] = new MySqlCommand(); // cmd[y].CommandText = string.Format("insert into SFCR.z_whs_keypart_undo (esn,woId,sntype,snval,station,kpno,recdate) select esn,woId,sntype,snval,station,kpno,recdate from SFCR.Z_WHS_KEYPART where esn=@esn "); // cmd[y].Parameters.Add("esn", MySqlDbType.VarChar, ESN.Length).Value = ESN; // // cmd[y].Parameters.Add("rewno", MySqlDbType.VarChar, ReworkNo.Length).Value = ReworkNo; // lsCmd.Add(cmd[y]); // y++; // cmd[y] = new MySqlCommand(); // cmd[y].CommandText = string.Format("DELETE FROM SFCR.Z_WHS_KEYPART where esn=@esn "); // cmd[y].Parameters.Add("esn", MySqlDbType.VarChar, ESN.Length).Value = ESN; // lsCmd.Add(cmd[y]); // if (ColnumWip.ToUpper().IndexOf("CARTONNUMBER") > -1) // { // y++; // cmd[y] = new MySqlCommand(); // cmd[y].CommandText = "update SFCR.T_CARTON_INFO_HAD set num=num-1 where cartonId=(select cartonid from tCartonInfodta where esn=@esn)"; // cmd[y].Parameters.Add("esn", MySqlDbType.VarChar, ESN.Length).Value = ESN; // lsCmd.Add(cmd[y]); // y++; // cmd[y] = new MySqlCommand(); // cmd[y].CommandText = "DELETE FROM SFCR.T_CARTON_INFO_DTA where esn=@esn"; // cmd[y].Parameters.Add("esn", MySqlDbType.VarChar, ESN.Length).Value = ESN; // lsCmd.Add(cmd[y]); // } // try // { // BLL.BllMsSqllib.Instance.ExecteNonQueryArr(lsCmd); // Msg = "OK"; // } // catch (Exception ex) // { // Msg = ex.Message + "ESN:" + ESN; // } // } // return Msg; // } // } public string Release_Bound(string ESN, string INPUTGROUP, string ReworkNo) { DbConnection conn = ProviderHelper.GetConnection(ProConfiguration.GetConfig().DatabaseType, ProConfiguration.GetConfig().DatabaseConnect); DbTransaction tx = ProviderHelper.BeginTransaction(conn); try { IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); IDictionary <string, object> mst = new Dictionary <string, object>(); int count = 0; mst.Add("LOCSTATION", INPUTGROUP); mst.Add("STATIONNAME", INPUTGROUP); mst.Add("WIPSTATION", INPUTGROUP); mst.Add("NEXTSTATION", INPUTGROUP); mst.Add("REWORKNO", ReworkNo); mst.Add("ESN", ESN); dp.UpdateData(tx, "SFCR.T_WIP_TRACKING_ONLINE", new string[] { "ESN" }, mst); mst = new Dictionary <string, object>(); mst.Add("ESN", ESN); DataSet ds = dp.GetData("SFCR.T_WIP_KEYPART_ONLINE", "ESN,WOID,SNTYPE,SNVAL,STATION,KPNO,RECDATE", mst, out count); foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["SNTYPE"].ToString() == "KPESN") { mst = new Dictionary <string, object>(); mst.Add("ESN", dr["SNVAL"].ToString()); mst.Add("WIPSTATION", "MB_Repair"); dp.UpdateData(tx, "SFCR.T_WIP_TRACKING_ONLINE", new string[] { "ESN" }, mst); } mst = new Dictionary <string, object>(); mst.Add("ESN", dr["ESN"].ToString()); mst.Add("WOID", dr["WOID"].ToString()); mst.Add("SNTYPE", dr["SNTYPE"].ToString()); mst.Add("SNVAL", dr["SNVAL"].ToString()); mst.Add("STATION", dr["STATION"].ToString()); mst.Add("KPNO", dr["KPNO"].ToString()); mst.Add("RECDATE", Convert.ToDateTime(dr["RECDATE"].ToString())); dp.AddData(tx, "SFCR.T_WIP_KEYPART_UNDO", mst); } mst = new Dictionary <string, object>(); mst.Add("ESN", ESN); dp.DeleteData(tx, "SFCR.T_WIP_KEYPART_ONLINE", mst); tx.Commit(); return("OK"); } catch (Exception ex) { tx.Rollback(); return(ex.Message); } finally { conn.Close(); conn.Dispose(); } }
public void InsertPackParameters(string dicstring) { IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); IDictionary <string, object> dic = MapListConverter.JsonToDictionary(dicstring); dic.Add("RECDATE", System.DateTime.Now); dp.AddData(table, dic); }
public void InserWoBomData(string dicstring) { IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); IDictionary <string, object> mst = MapListConverter.JsonToDictionary(dicstring); mst.Add("RECDATE", System.DateTime.Now); dp.AddData("SFCR.T_WO_BOM_INFO", mst); }
public void InsertFixtureType(string typeid, string typename) { IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); IDictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("typeId", typeid); dic.Add("typename", typename); dp.AddData("SFCR.T_FIXTURE_TYPE", dic); }
public string InsertVersionInfo(string WO, string lsVersionMark, string sId) { //OracleCommand cmd = new OracleCommand(); //cmd.CommandText = " DELETE FROM SFCB.B_VERSION_INFO WHERE WOID=:woid "; //cmd.Parameters.Add("woid", OracleDbType.Varchar2, 25).Value = WO; //BLL.BllMsSqllib.Instance.ExecteNonQuery(cmd); //foreach (Entity.tVersionMark item in lsVersionMark) //{ // cmd = new OracleCommand(); // cmd.CommandText = "insert into sfcb.b_version_info(woid,version_name,version_values,user_id,recdate)values(:woid,:version_name,:version_values,:sId,sysdate)"; // cmd.Parameters.Add("woid", OracleDbType.Varchar2, 20).Value = WO; // cmd.Parameters.Add("version_name", OracleDbType.Varchar2, 50).Value = item.VERSION_NAME; // cmd.Parameters.Add("version_values", OracleDbType.Varchar2, 100).Value = item.VERSION_VALUES; // cmd.Parameters.Add("sId", OracleDbType.Varchar2, 100).Value = sId; // BLL.BllMsSqllib.Instance.ExecteNonQuery(cmd); //} //return "OK"; IList <IDictionary <string, object> > VersionMark = MapListConverter.JsonToListDictionary(lsVersionMark); string table = "SFCB.B_VERSION_INFO"; IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); IDictionary <string, object> parms = new Dictionary <string, object>(); parms.Add("WOID", WO); dp.DeleteData(table, parms); DbConnection conn = ProviderHelper.GetConnection(ProConfiguration.GetConfig().DatabaseType, ProConfiguration.GetConfig().DatabaseConnect); DbTransaction tx = ProviderHelper.BeginTransaction(conn); try { IDictionary <string, object> mst = new Dictionary <string, object>(); foreach (Dictionary <string, object> dic in VersionMark) { mst = new Dictionary <string, object>(); mst.Add("WOID", dic["WOID"]); mst.Add("VERSION_NAME", dic["VERSION_NAME"]); mst.Add("VERSION_VALUES", dic["VERSION_VALUES"]); mst.Add("user_id", sId); mst.Add("recdate", System.DateTime.Now); dp.AddData(tx, "sfcb.b_version_info", mst); } return("OK"); } catch (Exception ex) { tx.Rollback(); return(ex.Message); } finally { conn.Close(); conn.Dispose(); } }
public void InsertPartBlocked(string dicstring) { IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); IDictionary <string, object> mst = MapListConverter.JsonToDictionary(dicstring); if (ProConfiguration.GetConfig().DatabaseType == SysModel.DataLinkType.MySql) { mst.Add("IN_STATION_TIME", System.DateTime.Now); } dp.AddData("SFCR.T_PART_BLOCKED", mst); }
/// <summary> /// 添加功能 /// </summary> /// <param name="lsfunlist"></param> public void AddFunctionList(string Lsdicstring) { IList <IDictionary <string, object> > LsDic = MapListConverter.JsonToListDictionary(Lsdicstring); IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); foreach (IDictionary <string, object> mst in LsDic) { // MySqlCommand cmd = new MySqlCommand(); if (!ChkFunctionList(mst["PROGID"].ToString(), mst["FUNID"].ToString())) { //cmd.CommandText = "insert into SFCB.B_FUNCTION_LIST(funId,progid,funname,fundesc) values(@funId,@progid,@funname,@fundesc)"; //cmd.Parameters.Add("funId", MySqlDbType.VarChar, 25).Value = fls.funId; //cmd.Parameters.Add("progid", MySqlDbType.VarChar, 25).Value = fls.progid; //cmd.Parameters.Add("funname", MySqlDbType.VarChar, 25).Value = fls.funname; //cmd.Parameters.Add("fundesc", MySqlDbType.VarChar, 25).Value = fls.fundesc; //BLL.BllMsSqllib.Instance.ExecteNonQuery(cmd); dp.AddData("SFCB.B_FUNCTION_LIST", mst); } else { //cmd.CommandText = "update SFCB.B_FUNCTION_LIST set funname=@funname,fundesc=@fundesc where funid=@funid and progid=@progid"; //cmd.Parameters.Add("funId", MySqlDbType.VarChar, 25).Value = fls.funId; //cmd.Parameters.Add("progid", MySqlDbType.VarChar, 25).Value = fls.progid; //cmd.Parameters.Add("funname", MySqlDbType.VarChar, 25).Value = fls.funname; //cmd.Parameters.Add("fundesc", MySqlDbType.VarChar, 25).Value = fls.fundesc; //BLL.BllMsSqllib.Instance.ExecteNonQuery(cmd); dp.UpdateData("SFCB.B_FUNCTION_LIST", new string[] { "FUNID", "PROGID" }, mst); } } // foreach (Entity.tFunctionList fls in lsfunlist) // { //MySqlCommand cmd = new MySqlCommand(); //if (!ChkFunctionList(fls.progid, fls.funId)) //{ // cmd.CommandText = "insert into SFCB.B_FUNCTION_LIST(funId,progid,funname,fundesc) values(@funId,@progid,@funname,@fundesc)"; // cmd.Parameters.Add("funId", MySqlDbType.VarChar, 25).Value = fls.funId; // cmd.Parameters.Add("progid", MySqlDbType.VarChar, 25).Value = fls.progid; // cmd.Parameters.Add("funname", MySqlDbType.VarChar, 25).Value = fls.funname; // cmd.Parameters.Add("fundesc", MySqlDbType.VarChar, 25).Value = fls.fundesc; // BLL.BllMsSqllib.Instance.ExecteNonQuery(cmd); //} //else //{ // cmd.CommandText = "update SFCB.B_FUNCTION_LIST set funname=@funname,fundesc=@fundesc where funid=@funid and progid=@progid"; // cmd.Parameters.Add("funId", MySqlDbType.VarChar, 25).Value = fls.funId; // cmd.Parameters.Add("progid", MySqlDbType.VarChar, 25).Value = fls.progid; // cmd.Parameters.Add("funname", MySqlDbType.VarChar, 25).Value = fls.funname; // cmd.Parameters.Add("fundesc", MySqlDbType.VarChar, 25).Value = fls.fundesc; // BLL.BllMsSqllib.Instance.ExecteNonQuery(cmd); //} // } }
public void InsertPalletInfohad(string PALLET, string PartNo, string Model, string Ver, string woId) { IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); IDictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("PALLETNUMBER", PALLET); dic.Add("PARTNUMBER", PartNo); dic.Add("PRODUCTNAME", Model); dic.Add("PRODUCTVERSION", Ver); dic.Add("WOID", woId); dp.AddData("SFCR.T_PALLET_INFO_HAD", dic); }
/// <summary> /// 添加工艺项目及参数 /// </summary> /// <param name="craftitem"></param> /// <param name="err"></param> public void InsertCraftItem(Dictionary<string,object> dic, out string err) { try { IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); dp.AddData("SFCB.B_CRAFT_ITEM", dic); err = "OK"; } catch (Exception ex) { err= ex.Message; } }
public string Update_StationConfig(IDictionary <string, object> dic) { try { IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); dp.AddData("SFCB.B_STATION_CONFIG", dic); return("OK"); } catch (Exception ex) { return(ex.Message); } }
public string Insert_T_WO_Material(IDictionary <string, object> mst) { try { IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); dp.AddData(table, mst); return("OK"); } catch (Exception ex) { return(ex.Message); } }
/// <summary> /// 插入设备维护信息 /// </summary> public string InsertFixtureRegist(string dicFixtureregist) { try { IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); IDictionary <string, object> dic = MapListConverter.JsonToDictionary(dicFixtureregist); dp.AddData("SFCR.T_FIXTURE_REGIST", dic); return("OK"); } catch (Exception ex) { return(ex.Message); } }
/// <summary> /// 插入设备信息 /// </summary> public string InsertFixtureInfo(string dicFixtureinfo) { try { IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); IDictionary <string, object> dic = MapListConverter.JsonToDictionary(dicFixtureinfo); dp.AddData(table, dic); return("OK"); } catch (Exception ex) { return(ex.Message); } }
public string InsertReworkDetail(string dicstring) { try { IAdminProvider dp = (IAdminProvider)DpFactory.Create(typeof(IAdminProvider), DpFactory.ADMIN); IDictionary <string, object> mst = MapListConverter.JsonToDictionary(dicstring); dp.AddData("SFCR.T_REWORK_DETAIL_INFO", mst); return("OK"); } catch (Exception e) { return(e.Message); } }