private void DownLoad_DB_SnRange(string m_woId) { DataTable _mdt = FrmBLL.ReleaseData.arrByteToDataTable(RefWebService_BLL.refWebtWoInfo.Instance.GetWoSnRule(m_woId, null)); if (_mdt.Rows.Count > 0) { FrmBLL.cdbAccess ass = new FrmBLL.cdbAccess(); ass.ExecuteOracleCommand(string.Format("delete from wosnrule where woId='{0}'", m_woId)); foreach (DataRow dr in _mdt.Rows) { string sql = string.Format("insert into wosnrule(woId,sntype,snstart,snend,snprefix,snpostfix,ver,reve,snleng,usenum) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')", dr["WOID"].ToString(), // this.dgvserialnumberrule["woid", i].Value.ToString(), dr["SNTYPE"].ToString(), //this.dgvserialnumberrule["sntype", i].Value.ToString(), dr["SNSTART"].ToString(), //this.dgvserialnumberrule["snstart", i].Value.ToString(), dr["SNEND"].ToString(), // this.dgvserialnumberrule["snend", i].Value.ToString(), dr["SNPREFIX"].ToString(), // this.dgvserialnumberrule["snprefix", i].Value.ToString(), dr["SNPOSTFIX"].ToString(), // this.dgvserialnumberrule["snpostfix", i].Value.ToString(), dr["VER"].ToString(), // this.dgvserialnumberrule["ver", i].Value.ToString(), dr["REVE"].ToString(), // this.dgvserialnumberrule["reve", i].Value.ToString(), dr["SNLENG"].ToString(), // this.dgvserialnumberrule["snleng", i].Value.ToString(), dr["USENUM"].ToString()); // this.dgvserialnumberrule["usenum", i].Value.ToString()); if (!ass.ExecuteOracleCommand(sql)) { ass.ExecuteOracleCommand(string.Format("delete from wosnrule where woId='{1}'", dr["WOID"].ToString())); (mFrm as Frm_MO_Manage).SendMsg(Frm_MO_Manage.mLogMsgType.Error, string.Format("加载条码区间[{0}]失败,请联系SFIS人员", dr["SNTYPE"].ToString())); ip_labletypes.Enabled = false; return; } } } dgv_snRange.DataSource = _mdt; }
private void RunData(DataTable mdt) { FrmBLL.cdbAccess ass = new FrmBLL.cdbAccess(); ass.ExecuteOracleCommand("delete from bomdata"); int i = 0; this.ShowMsg(LogMsgType.Warning, "正在加载BOM数据"); foreach (DataRow dr in mdt.Rows) { i++; string sql = string.Format("insert into bomdata(kpnumber,kpdesc,loction,kpgroup,bomver,kptype,qty) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}')", dr[0].ToString(), dr[1].ToString(), dr[6].ToString(), dr[2].ToString(), dr[3].ToString(), dr[4].ToString(), dr[5].ToString()); ass.ExecuteOracleCommand(sql); this.Showpb(i); } string str = string.Empty; if (this.gelidip) { str = " where kptype<>'DIP'"; } this.ShowData(this.BomDataTable = ass.GetDatatable(string.Format("select kpnumber,kpdesc,kpgroup,bomver,qty,loction from bomdata {0}", str))); this.ShowMsg(LogMsgType.Outgoing, "BOM数据加载完成"); }
private void bt_save_Click(object sender, EventArgs e) { if (this.dgvserialnumberrule.Rows.Count < 2) { MessageBoxEx.Show("没有设置序列号区间", "提示"); return; } try { string strTemp = string.Empty; string strTemp1 = string.Empty; FrmBLL.cdbAccess ass = new FrmBLL.cdbAccess(); ass.ExecuteOracleCommand(string.Format("delete from wosnrule where woId='{1}' and sntype='{0}'", this.mKey, this.mwoId)); for (int i = 0; i < this.dgvserialnumberrule.Rows.Count - 1; i++) { object _snstart = this.dgvserialnumberrule["snstart", i].Value; object _snend = this.dgvserialnumberrule["snend", i].Value; //判断开始序列号是否大于结束序列号 if (_snstart == null || _snstart.ToString().Length < 3 || _snend == null || _snend.ToString().Length < 3) { // ass.ExecuteOracleCommand(string.Format("delete from wosnrule where woId='{1}' and sntype='{0}'", this.mKey, this.mwoid)); this.dgvserialnumberrule.Rows[i].DefaultCellStyle.BackColor = Color.FromArgb(250, 250, 160); MessageBoxEx.Show("序列号区间存在空值,或长度小于3!!请修正..", "提示"); return; } //判断长度是否一致 if (_snstart.ToString().Length != _snend.ToString().Length) { // ass.ExecuteOracleCommand(string.Format("delete from wosnrule where woId='{1}' and sntype='{0}'", this.mKey, this.mwoid)); this.dgvserialnumberrule.Rows[i].DefaultCellStyle.BackColor = Color.FromArgb(250, 250, 160); MessageBoxEx.Show("起始序列号与结束序列号长度不一致,请修正.."); return; } if (string.CompareOrdinal(_snstart.ToString(), _snend.ToString()) > 0) { // ass.ExecuteOracleCommand(string.Format("delete from wosnrule where woId='{1}' and sntype='{0}'", this.mKey, this.mwoid)); this.dgvserialnumberrule.Rows[i].DefaultCellStyle.BackColor = Color.FromArgb(250, 250, 160); MessageBoxEx.Show("序列号起始值大于结束值!!,请修正.."); return; } DataTable dtt = ass.GetDatatable(string.Format("select * from wosnrule where '{0}' between snstart and snend", this.dgvserialnumberrule["snstart", i].Value.ToString())); bool bflag = true; if (dtt != null && dtt.Rows.Count > 0) { if (dtt.Rows[0]["woId"].ToString().ToUpper() != this.mwoId.ToUpper()) { bflag = false; } } if (bflag) { dtt = ass.GetDatatable(string.Format("select * from wosnrule where '{0}' between snstart and snend", this.dgvserialnumberrule["snend", i].Value.ToString())); if (dtt != null && dtt.Rows.Count > 0) { if (dtt.Rows[0]["woId"].ToString().ToUpper() != this.mwoId.ToUpper()) { bflag = false; } } } if (!bflag) { this.dgvserialnumberrule.Rows[i].DefaultCellStyle.BackColor = Color.FromArgb(250, 250, 160); // ass.ExecuteOracleCommand(string.Format("delete from wosnrule where woId='{1}' and sntype='{0}'", this.mKey, this.mwoid)); MessageBox.Show("序列号区间已经存在于工单" + dtt.Rows[0]["woId"].ToString() + "中,请重新设置..", "提示"); return; } //需要剔除重工工单 if ((mFrm as Frm_SnRange)._woType != "Rework" && (mFrm as Frm_SnRange)._woType != "RMA") {//如果是重工工单或者是RAM工单 //DataTable _dta = new DataTable(); string err = RefWebService_BLL.refWebtWoInfo.Instance.ChkSerialNumberRule_New(this.mwoId, _snstart.ToString(), _snend.ToString()); if (err.ToUpper() != "OK") { this.dgvserialnumberrule.Rows[i].DefaultCellStyle.BackColor = Color.FromArgb(250, 250, 160); // ass.ExecuteOracleCommand(string.Format("delete from wosnrule where woId='{1}' and sntype='{0}'", this.mKey, this.mwoid)); MessageBox.Show(err, "提示"); return; } #region xxx //bool _flag = true; //_dta = FrmBLL.ReleaseData.arrByteToDataTable(RefWebService_BLL.refWebtWoInfo.Instance.ChkSerialNumberRule(_snstart.ToString())); //if (_dta != null && _dta.Rows.Count > 0) //{//在数据库中找到了数据 // if (_dta.Rows[0]["woId"].ToString().ToUpper() != this.mwoid.ToUpper()) //但是返回的数据不是同一个工单 // _flag = false; //} //if (_flag) //{ // _dta = FrmBLL.ReleaseData.arrByteToDataTable(RefWebService_BLL.refWebtWoInfo.Instance.ChkSerialNumberRule(_snend.ToString())); // if (_dta != null && _dta.Rows.Count > 0) // { // if (_dta.Rows[0]["woId"].ToString().ToUpper() != this.mwoid.ToUpper()) // _flag = false; // } //} //if (!_flag) //{ // this.dgvserialnumberrule.Rows[i].DefaultCellStyle.BackColor = Color.FromArgb(250, 250, 160); // ass.ExecuteOracleCommand(string.Format("delete from wosnrule where woId='{1}' and sntype='{0}'", this.mKey, this.mwoid)); // MessageBox.Show("序列号区间已经存在于工单" + _dta.Rows[0]["woId"].ToString() + "中,请重新设置..", "提示"); // return; //} #endregion } string sql = string.Format("insert into wosnrule(woId,sntype,snstart,snend,snprefix,snpostfix,ver,reve,snleng,usenum) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')", this.dgvserialnumberrule["woid", i].Value.ToString(), this.dgvserialnumberrule["sntype", i].Value.ToString(), this.dgvserialnumberrule["snstart", i].Value.ToString(), this.dgvserialnumberrule["snend", i].Value.ToString(), this.dgvserialnumberrule["snprefix", i].Value.ToString(), this.dgvserialnumberrule["snpostfix", i].Value.ToString(), this.dgvserialnumberrule["ver", i].Value.ToString(), this.dgvserialnumberrule["reve", i].Value.ToString(), this.dgvserialnumberrule["snleng", i].Value.ToString(), this.dgvserialnumberrule["usenum", i].Value.ToString()); if (!ass.ExecuteOracleCommand(sql)) { ass.ExecuteOracleCommand(string.Format("delete from wosnrule where woId='{1}' and sntype='{0}'", this.mKey, this.mwoId)); MessageBox.Show("数据记录失败!!", "错误"); return; } this.dgvserialnumberrule.Rows[i].DefaultCellStyle.BackColor = Color.Green; } this.DialogResult = DialogResult.OK; } catch (Exception ex) { MessageBoxEx.Show(ex.Message); } }
private void SaveExcelSmtSoftKpList(string[] sFileName) { this.ShowMsg(LogMsgType.Warning, "开始读取Excel."); DataTable dtTemp = new DataTable(); dtTemp.Columns.Add("IID", System.Type.GetType("System.String")); dtTemp.Columns.Add("smtsoftname", System.Type.GetType("System.String")); dtTemp.Columns.Add("pcbside", System.Type.GetType("System.String")); dtTemp.Columns.Add("LineId", System.Type.GetType("System.String")); dtTemp.Columns.Add("stationId", System.Type.GetType("System.String")); dtTemp.Columns.Add("kpnumber", System.Type.GetType("System.String")); dtTemp.Columns.Add("feeder", System.Type.GetType("System.String")); dtTemp.Columns.Add("loction", System.Type.GetType("System.String")); foreach (string item in sFileName) { DataTable dt1 = new DataTable(); FrmBLL.ClsAllExcel cls = new FrmBLL.ClsAllExcel(); cls.OpenFileName = item; cls.OpenExcelFile(); dt1 = cls.getAllCellsValue(); cls.CloseExcelFile(); foreach (DataRow dr in dt1.Rows) { dtTemp.ImportRow(dr); } } this.ShowMsg(LogMsgType.Incoming, "读取Execel完成."); this.ShowMsg(LogMsgType.Warning, "开始处理料站表..."); SmtSoftKpList = dtTemp; this.SetPb2MaxValue(SmtSoftKpList.Rows.Count); int i = 0; FrmBLL.cdbAccess ass = new FrmBLL.cdbAccess(); ass.ExecuteOracleCommand("delete from smtsoftkplist"); foreach (DataRow dr in SmtSoftKpList.Rows) { string sql = string.Format("insert into smtsoftkplist(smtsoftname,pcbside,lineId,stationId,kpnumber,feeder,stationcount,loction) values('{0}','{1}','{2}','{3}','{4}','{5}','0','{6}')", dr["smtsoftname"].ToString(), dr["pcbside"].ToString(), dr["lineId"].ToString(), dr["stationId"].ToString(), dr["kpnumber"].ToString(), dr["feeder"].ToString(), dr["loction"].ToString()); ass.ExecuteOracleCommand(sql); this.Showpb1(i++); } string cmd = "select lineId,count(stationId) as total from smtsoftkplist group by lineId"; DataTable dt = ass.GetDatatable(cmd); foreach (DataRow dr in dt.Rows) { cmd = string.Format("update smtsoftkplist set stationcount='{0}' where lineId='{1}'", dr["total"].ToString(), dr["lineId"].ToString()); ass.ExecuteOracleCommand(cmd); } SmtSoftKpList = ass.GetDatatable("select * from smtsoftkplist"); this.ShowMsg(LogMsgType.Incoming, "Excel料站表处理完成."); this.ShowData2(SmtSoftKpList); }
private void SaveSmtSoftKpList(string[] filenames, string machine) { try { this.ShowMsg(LogMsgType.Outgoing, "正在处理SMT料站表......"); this.SmtSoftKpList = new DataTable(); string Err = ""; string extension = ""; foreach (string item in filenames) { extension = System.IO.Path.GetExtension(item).ToUpper();//扩展名 “.aspx” } if (extension.Contains("TXT")) { SmtSoftKpList = FrmBLL.publicfuntion.LoadTxt(filenames, machine, out Err); } if (extension.Contains("CSV")) { SmtSoftKpList = FrmBLL.publicfuntion.LoadCSV(filenames, machine, out Err); } if (!string.IsNullOrEmpty(Err)) { if (Err.IndexOf("警告!!") != -1) { this.ShowMsg(LogMsgType.Error, Err); } else { this.ShowMsg(LogMsgType.Error, Err); return; } } this.SetPb2MaxValue(SmtSoftKpList.Rows.Count); int i = 0; FrmBLL.cdbAccess ass = new FrmBLL.cdbAccess(); ass.ExecuteOracleCommand("delete from smtsoftkplist"); foreach (DataRow dr in SmtSoftKpList.Rows) { string sql = string.Format("insert into smtsoftkplist(smtsoftname,pcbside,lineId,stationId,kpnumber,feeder,stationcount,loction) values('{0}','{1}','{2}','{3}','{4}','{5}','0','{6}')", dr["smtsoftname"].ToString(), dr["pcbside"].ToString(), dr["lineId"].ToString(), dr["stationId"].ToString(), dr["kpnumber"].ToString(), dr["feeder"].ToString(), dr["loction"].ToString()); ass.ExecuteOracleCommand(sql); this.Showpb1(i++); } string cmd = "select lineId,count(stationId) as total from smtsoftkplist group by lineId"; DataTable dt = ass.GetDatatable(cmd); foreach (DataRow dr in dt.Rows) { cmd = string.Format("update smtsoftkplist set stationcount='{0}' where lineId='{1}'", dr["total"].ToString(), dr["lineId"].ToString()); ass.ExecuteOracleCommand(cmd); } SmtSoftKpList = ass.GetDatatable("select * from smtsoftkplist"); this.ShowMsg(LogMsgType.Incoming, "SMT料站表处理完成."); this.ShowData2(SmtSoftKpList); } catch (Exception ex) { throw ex; } }
private void FrmRepair_Load(object sender, EventArgs e) { try { #region 添加应用程序 if (this.sMain.gUserInfo.rolecaption == "系统开发员") { IList <IDictionary <string, object> > lsfunls = new List <IDictionary <string, object> >(); IDictionary <string, object> funls = new Dictionary <string, object>(); funls = new Dictionary <string, object>(); funls.Add("FUNID", "PD_Transfer".ToUpper()); funls.Add("PROGID", this.Name); funls.Add("FUNNAME", "生产转账"); funls.Add("FUNDESC", "生产转账"); lsfunls.Add(funls); Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("PROGID", this.Name); dic.Add("PROGNAME", this.Text); dic.Add("PROGDESC", this.Text); FrmBLL.publicfuntion.GetFromCtls(this, ref lsfunls); FrmBLL.publicfuntion.AddProgInfo(dic, lsfunls); } #endregion } catch (Exception ex) { this.sMain.ShowPrgMsg(ex.Message, MainParent.MsgType.Error); } tbrepairuser.Text = sMain.gUserInfo.userId; RCList = new GetRCList(GetReasonCode); RCList.BeginInvoke(null, null); CraftInfo = new GetCraftInfo(GetAllCraftInfo); CraftInfo.BeginInvoke(null, null); GetDutyData = new GetDuty(GetDutyInfo); GetDutyData.BeginInvoke(null, null); #region 单元格交替颜色 this.dgvallrepairinfo.RowsDefaultCellStyle.BackColor = Color.Bisque; this.dgvallrepairinfo.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige; this.dgvRepairReport.RowsDefaultCellStyle.BackColor = Color.Bisque; this.dgvRepairReport.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige; this.dgvQrepair.RowsDefaultCellStyle.BackColor = Color.Bisque; this.dgvQrepair.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige; #endregion tabSelect.SelectedIndex = 3; //for (int i = 0; i < 24; i++) //{ // combStime.Items.Add(i.ToString().PadLeft(2, '0') + ":30"); // combEtime.Items.Add(i.ToString().PadLeft(2, '0') + ":30"); //} CB_Class.Items.Clear(); CB_Class.Items.Add("ALL"); CB_Class.Items.Add("D"); CB_Class.Items.Add("N"); CB_Class.SelectedIndex = 0; GetColnumName(); FrmBLL.cdbAccess ass = new FrmBLL.cdbAccess(); ass.ExecuteOracleCommand("delete from tProduct"); }
private void ip_labletypes_ItemClick(object sender, EventArgs e) { try { if (sender is DevComponents.DotNetBar.CheckBoxItem) { FrmBLL.cdbAccess ass = new FrmBLL.cdbAccess(); // if (!ChkPwd(((DevComponents.DotNetBar.CheckBoxItem)sender).Name)) // { #region SN修改需要权限 if (((DevComponents.DotNetBar.CheckBoxItem)sender).Name.ToUpper() == "SN") { //DataTable dt = _mdt; //if (dt == null || dt.Rows.Count < 1) //{ // (mFrm as Frm_MO_Manage).SendMsg(Frm_MO_Manage.mLogMsgType.Error ,"工单未找到,请确认..."); // return; //} if (Convert.ToInt32(dgv_woinfo.Rows[0].Cells["inputqty"].Value.ToString()) > 0) { string pwd = Input.InputQuery.ShowInputBox("输入密码", string.Empty, '*'); if (pwd != "phicomm_mes") { (mFrm as Frm_MO_Manage).SendMsg(Frm_MO_Manage.mLogMsgType.Error, "密码不符,请确认..."); return; } } } #endregion if (((DevComponents.DotNetBar.CheckBoxItem)sender).Checked) {//选中 this.cbSetEsn.Items.Add(((DevComponents.DotNetBar.CheckBoxItem)sender).Name); if (MessageBoxEx.Show(string.Format("是否需要对[{0}]号设定区间?\n继续 , 请选择[Yes] ,不设定区间 , 请选择[No]", ((DevComponents.DotNetBar.CheckBoxItem)sender).Name) , "区间设定提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes) { Frm_AddSnRange asr = new Frm_AddSnRange(((DevComponents.DotNetBar.CheckBoxItem)sender).Name, dgv_woinfo.Rows[0].Cells["WOID"].Value.ToString(), this); asr.ShowDialog(); } } else {//取消选中 this.cbSetEsn.Items.Remove(((DevComponents.DotNetBar.CheckBoxItem)sender).Name); if (MessageBoxEx.Show("查看数据请选择 [Yes] ,清除原来的数据请选择 [No]", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes) { ((DevComponents.DotNetBar.CheckBoxItem)sender).Checked = true; this.cbSetEsn.Items.Add(((DevComponents.DotNetBar.CheckBoxItem)sender).Name); // this.ip_labletypes_ItemClick(sender, null); Frm_AddSnRange asr = new Frm_AddSnRange(((DevComponents.DotNetBar.CheckBoxItem)sender).Name, dgv_woinfo.Rows[0].Cells["WOID"].Value.ToString(), this); asr.ShowDialog(); } else { ass.ExecuteOracleCommand(string.Format("delete from wosnrule where woId='{0}' and sntype='{1}'", dgv_woinfo.Rows[0].Cells["WOID"].Value.ToString(), ((DevComponents.DotNetBar.CheckBoxItem)sender).Name)); } // this.NewLableTypesValues.Remove(((DevComponents.DotNetBar.CheckBoxItem)sender).Name); } //} //else //{ // (mFrm as Frm_MO_Manage).SendMsg(Frm_MO_Manage.mLogMsgType.Warning,string.Format("当前选择的属于密码类型{0}", // ((DevComponents.DotNetBar.CheckBoxItem)sender).Name)); //} // } dgv_snRange.DataSource = ass.GetDatatable(string.Format("select distinct woId,sntype,snstart,snend,snprefix,snpostfix,ver,reve,snleng,usenum from wosnrule where woId='{0}' ", dgv_woinfo.Rows[0].Cells["WOID"].Value.ToString())); } } catch (Exception ex) { (mFrm as Frm_MO_Manage).SendMsg(Frm_MO_Manage.mLogMsgType.Error, ex.Message); } }