private void ToolSelectLine_Click(object sender, EventArgs e) { string[] EmpData = Input.InputBox.ShowInputBox("输入权限", string.Empty); try { string UserId = EmpData[0]; string PWD = EmpData[1]; if (!string.IsNullOrEmpty(UserId) && !string.IsNullOrEmpty(PWD)) { string _StrErr = tUser.CHECK_SET_LINE_EMPLOYEE(UserId, PWD); if (_StrErr == "OK") { SendPrgMsg(mLogMsgType.Incoming, "权限正确"); Dictionary <string, object> dic = new Dictionary <string, object>(); Frm_Public.Frm_Select fd = new Frm_Public.Frm_Select(ReleaseData.arrByteToDataTable(sLine.GetAllLineInfo()), ref dic); if (fd.ShowDialog() == DialogResult.OK) { txt_line.Text = dic["线别"].ToString(); Encoder.ReadIniFile.IniWriteValue("SFIS_DCT_INPUT", "LINE", Encoder.Encoder.EncryptString(dic["线别"].ToString()), IniFilePath); } } else { SendPrgMsg(mLogMsgType.Error, _StrErr); } } } catch { SendPrgMsg(mLogMsgType.Error, "权限格式不正确"); } }
private void GetStationList(string woId) { cbroute.Text = ""; DataTable dt = ReleaseData.arrByteToDataTable(tWoInfo.GetWoInfo(woId, null)); if (dt.Rows.Count > 0) { // cbroute.Text = tWoInfo.GetCraftInfoBywoid(woId); cbroute.Text = dt.Rows[0]["INPUTGROUP"].ToString(); ProductLine = dt.Rows[0]["LINEID"].ToString(); SendPrgMsg(mLogMsgType.Incoming, string.Format("此工单可在[{0}]线生产", ProductLine)); } }
private void InitializationInfo() { string C_RES = ""; try { this.Invoke(new EventHandler(delegate { SendMsg(mLogMsgType.Incoming, "正在加载基础数据!"); C_RES = "加载串口DLL失败"; // bzz = new Buzzer.buzzer(); C_RES = "连接串口失败"; // bzz.ConnPort("SFIS_ISCM"); C_RES = "工单类加载失败"; tWoInfo = new WebServices.tWoInfo.tWoInfo(); C_RES = "公共方法PubStor加载失败"; PubStor = new WebServices.tPublicStoredproc.tPublicStoredproc(); C_RES = "绑定关系接口加载失败"; wipkeyparts = new WebServices.tWipKeyPart.tWipKeyPart(); C_RES = "线体信息加载失败"; sLine = new WebServices.tLineInfo.tLineInfo(); DataTable dt = ReleaseData.arrByteToDataTable(sLine.GetAllLineInfo()); DataView dv = dt.DefaultView; dv.Sort = "线别 ASC"; DataTable dTemp = dv.ToTable(); cb_Line.Items.Clear(); foreach (DataRow dr in dTemp.Rows) { cb_Line.Items.Add(dr["线别"].ToString()); } cb_Line.SelectedIndex = 0; C_RES = "加载SFIS_ISCM.ini失败"; string filePath = System.Environment.CurrentDirectory + "\\SFIS_ISCM.ini"; LabDir = ReadIniFile.IniReadValue("TEST_INPUT", "Patch", filePath); LabInput.Text = ""; LabTarget.Text = ""; LabRoute.Text = ""; tb_Input.Focus(); SendMsg(mLogMsgType.Incoming, "基础数据加载完成!"); })); } catch { SendMsg(mLogMsgType.Error, C_RES); } }
/// <summary> /// 获取自动发料表 /// </summary> private DataTable GetWoKpnumber(string strwo, string process) { DataTable dt = ReleaseData.arrByteToDataTable( RefWebService_BLL.refWebtPartStorehousehad.Instance.GetKpnumberByWoid(strwo, process)); DataTable mdt = new DataTable("ndt"); DataRow mdr; bool flag = false; foreach (DataRow dr in dt.Rows) { DataTable _dt = ReleaseData.arrByteToDataTable(RefWebService_BLL.refWebtPartStorehousehad.Instance.GetKpnumberLocation(dr["kpnumber"].ToString(), int.Parse(dr["qty"].ToString())));//料号,领料数 if (!flag) { flag = true; mdt = _dt.Clone(); } float count = 0; if (_dt == null || _dt.Rows.Count < 1) { //mdr.ItemArray = item.ItemArray; mdt.Rows.Add("NA", dr["kpnumber"].ToString(), "无库存", "无库存", 0); } else { foreach (DataRow item in _dt.Rows) { mdr = mdt.NewRow(); count += float.Parse(item["qty"].ToString()); if (count < float.Parse(dr["qty"].ToString())) { mdr.ItemArray = item.ItemArray; mdt.Rows.Add(mdr); } else { mdr.ItemArray = item.ItemArray; mdt.Rows.Add(mdr); break; } } } } return(mdt); }
public void PrintLabel(string Esn) { DataTable dt = ReleaseData.arrByteToDataTable(_wipkeyparts.GetWipKeyPart(Esn)); if (dt.Rows.Count > 0) { Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("ESN", dt.Rows[0]["ESN"].ToString()); foreach (DataRow dr in dt.Rows) { dic.Add(dr["SNTYPE"].ToString(), dr["SNVAL"].ToString()); } PublicPrintLabel(dic); } else { SendPrgMsg(mLogMsgType.Error, "没有需要打印的数据"); } }
private void tb_wo_KeyDown(object sender, KeyEventArgs e) { if (!string.IsNullOrEmpty(tb_wo.Text) && e.KeyCode == Keys.Enter) { DataTable dtNoCloseCtn = ReleaseData.arrByteToDataTable(refWebtPalletInfo.Instance.Get_Pallet_Info_bywo(tb_wo.Text, 1, 0)); this.lv_Carton.Items.Clear(); int x = 1; foreach (DataRow dr in dtNoCloseCtn.Rows) { ListViewItem lvi = new ListViewItem(); this.lv_Carton.View = System.Windows.Forms.View.Details; lvi.SubItems[0].Text = x++.ToString(); lvi.SubItems.AddRange(new string[] { dr[0].ToString(), dr[1].ToString(), dr[2].ToString(), dr[3].ToString(), dr[6].ToString(), dr[7].ToString() }); this.lv_Carton.Items.Add(lvi); lv_Carton.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); } tb_wo.SelectAll(); } }
private void txt_userid_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (Check_EMP(txt_userid.Text.ToString())) { sEMP = txt_userid.Text.ToString(); txt_userid.Text = ReleaseData.arrByteToDataTable(tUser.GetUserInfoByUserId(sEMP.Split('-')[0].ToString())).Rows[0]["username"].ToString(); } else { txt_userid.SelectAll(); txt_userid.Focus(); return; } txt_userid.Enabled = false; txt_sn.Enabled = true; txt_sn.Focus(); } }
private void tb_wo_KeyDown(object sender, KeyEventArgs e) { if (!string.IsNullOrEmpty(tb_wo.Text) && e.KeyCode == Keys.Enter) { DataTable dt = ReleaseData.arrByteToDataTable(tWoInfo.GetWoInfoByWo(tb_wo.Text)); if (dt.Rows.Count > 0) { LabTarget.Text = dt.Rows[0]["qty"].ToString(); LabInput.Text = dt.Rows[0]["inputqty"].ToString(); LabRoute.Text = dt.Rows[0]["inputgroup"].ToString(); SendMsg(mLogMsgType.Outgoing, "工单信息OK"); tb_Input.Focus(); } else { SendMsg(mLogMsgType.Error, "工单不存在或输入错误"); } tb_wo.SelectAll(); } }
private void tb_wo_KeyDown(object sender, KeyEventArgs e) { if (!string.IsNullOrEmpty(tb_wo.Text) && e.KeyCode == Keys.Enter) { DataTable dt = ReleaseData.arrByteToDataTable(tWoInfo.GetWoInfoByWo(tb_wo.Text)); if (dt.Rows.Count > 0) { LabTarget.Text = dt.Rows[0]["qty"].ToString(); LabInput.Text = dt.Rows[0]["inputqty"].ToString(); LabRoute.Text = dt.Rows[0]["inputgroup"].ToString(); ProductLine = dt.Rows[0]["LINEID"].ToString(); SendPrgMsg(Color.Green, string.Format("此工单可在[{0}]线生产", ProductLine)); sPrint.SendMsg(PrintDLL.PrintLabel.mLogMsgType.Outgoing, "工单信息OK"); } else { sPrint.SendMsg(PrintDLL.PrintLabel.mLogMsgType.Error, "工单不存在或输入错误"); } tb_wo.SelectAll(); } }
private void imbt_OK_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txt_data.Text)) { string _Colnum = string.Empty; if (radESN.Checked) { _Colnum = "ESN"; } if (radSN.Checked) { _Colnum = "SN"; } if (radIMEI.Checked) { _Colnum = "IMEI"; } if (radCarton.Checked) { _Colnum = "CARTONNUMBER"; } DataTable dt = ReleaseData.arrByteToDataTable(refWebtWipTracking.Instance.GetQueryWipAllInfo(_Colnum, txt_data.Text)); if (dt.Rows.Count > 0) { mFrm.Close_Carton(dt.Rows[0]["CARTONNUMBER"].ToString()); // mFrm.PrintCartonLabel_CodeSoft(dt.Rows[0]["CARTONNUMBER"].ToString()); txt_data.Text = string.Empty; txt_data.Focus(); MessageBox.Show("This Carton Already Closed"); } else { txt_data.SelectAll(); MessageBox.Show("NO DATA"); } } }
private void PrintLabel(string ESN) { WebServices.tWipKeyPart.tWipKeyPart wipkeyparts = new WebServices.tWipKeyPart.tWipKeyPart(); DataTable dt_wipkeyparts = ReleaseData.arrByteToDataTable(wipkeyparts.GetWipKeyPart(ESN)); string labfilefullpath = string.Format(@"{0}\{1}\{2}", this.LabDir.IndexOf(":") != -1 ? this.LabDir : this.LabDir + ":", this.tb_wo.Text, LabRoute.Text + ".lab"); if (!File.Exists(labfilefullpath)) { SendMsg(mLogMsgType.Error, "条码文件不存在:" + labfilefullpath); } else { DataTable dt = new DataTable(); dt.Columns.Add("Colnum", typeof(string)); dt.Columns.Add("DATA", typeof(string)); dt.Rows.Add("ESN", ESN); foreach (DataRow dr in dt_wipkeyparts.Rows) { dt.Rows.Add(dr["SNTYPE"].ToString(), dr["SNVAL"].ToString()); } Call_PrintLabel(dt, labfilefullpath, Convert.ToInt32(numprint.Value)); } }
private void tb_wo_KeyDown(object sender, KeyEventArgs e) { if ((!string.IsNullOrEmpty(tb_wo.Text)) && (e.KeyCode == Keys.Enter)) { DataTable dt = ReleaseData.arrByteToDataTable(tWoInfo.GetWoInfo(tb_wo.Text, null)); if (dt.Rows.Count != 0) { tb_Partnumber.Text = dt.Rows[0]["PARTNUMBER"].ToString(); tb_Inputqty.Text = dt.Rows[0]["INPUTQTY"].ToString(); tb_TargetQty.Text = dt.Rows[0]["QTY"].ToString(); RouteCode = dt.Rows[0]["ROUTGROUPID"].ToString(); ProductLine = dt.Rows[0]["LINEID"].ToString(); SendPrgMsg(mLogMsgType.Normal, string.Format("此工单可在[{0}]线生产", ProductLine)); SendPrgMsg(mLogMsgType.Normal, string.Format("工单[{0}]确认完成", tb_wo.Text)); tb_wo.Enabled = false; imbt_ChgLine.Visible = false; } else { SendPrgMsg(mLogMsgType.Error, string.Format("工单[{0}]没有找到", tb_wo.Text)); tb_wo.Text = ""; } } }
private void Calculation_MacPassword(string ESN) { Dictionary <string, string> dicpwd = new Dictionary <string, string>(); List <string> _Allpwd = new List <string>(); if (radNoPWD.Checked) { } else { DataTable dt_wipkeyparts = ReleaseData.arrByteToDataTable(wipkeyparts.GetWipKeyPart(ESN)); if (dt_wipkeyparts.Rows.Count > 0) { string MAC = string.Empty; string woId = string.Empty; foreach (DataRow dr in dt_wipkeyparts.Rows) { if (dr["SNTYPE"].ToString() == "MAC") { MAC = dr["SNVAL"].ToString(); woId = dr["WOID"].ToString(); } } if (!string.IsNullOrEmpty(MAC)) { if (radMAC.Checked) { _Allpwd = macPassword.getMacAllPassword(MAC); dicpwd.Add("DEK", _Allpwd[3]); } if (radMAC2.Checked) { string Mac_Prefix = MAC.Substring(0, 6); int i = Convert.ToInt32(MAC.Substring(6, 6), 16) + 2; string Mac_Suffix = string.Format("{0:X}", i); SendMsg(mLogMsgType.Outgoing, "MAC:" + MAC); SendMsg(mLogMsgType.Outgoing, "PLCMAC:" + Mac_Prefix + Mac_Suffix); _Allpwd = macPassword.getMacAllPassword(Mac_Prefix + Mac_Suffix); dicpwd.Add("DEK", _Allpwd[3]); dicpwd.Add("PLCMAC", Mac_Prefix + Mac_Suffix); } List <Dictionary <string, object> > LsDic = new List <Dictionary <string, object> >(); Dictionary <string, object> dic = null; //List<WebServices.tWipTracking.tWipKeyPartTable> Listwip = new List<WebServices.tWipTracking.tWipKeyPartTable>(); //WebServices.tWipTracking.tWipKeyPartTable twip = null; foreach (KeyValuePair <string, string> item in dicpwd) { dic = new Dictionary <string, object>(); dic.Add("ESN", MAC); dic.Add("WOID", woId); dic.Add("SNTYPE", item.Key); dic.Add("SNVAL", item.Value); dic.Add("STATION", LabRoute.Text); dic.Add("KPNO", "NA"); LsDic.Add(dic); //twip = new WebServices.tWipTracking.tWipKeyPartTable(); //twip.esn = MAC; //twip.woId = woId; //twip.sntype = item.Key; //twip.snval = item.Value; //twip.station = LabRoute.Text; //twip.KPNO = "NA"; //Listwip.Add(twip); } WebServices.tWipTracking.tWipTracking mTracking = new WebServices.tWipTracking.tWipTracking(); string _StrErr = mTracking.InsertWipKeyParts(Newtonsoft.Json.JsonConvert.SerializeObject(LsDic)); if (_StrErr == "OK") { SendMsg(mLogMsgType.Incoming, "Inser KeyParts OK"); } else { SendMsg(mLogMsgType.Error, "Inser KeyParts Err:" + _StrErr); } } } } }
private void bt_login_Click(object sender, EventArgs e) { if (!File.Exists(Directory.GetCurrentDirectory() + "\\getWebServices.dll")) { Close(); return; } if (iasyncresult != null && !iasyncresult.IsCompleted) { mpm.ShowMsg(PrintMain.MLogMsgType.Warning, "正在与服务器通讯中,请稍后."); return; } bt_CfgIp.Enabled = false; try { if (string.IsNullOrEmpty(tb_username.Text)) { throw new Exception("用户名不能为空!!"); } if (string.IsNullOrEmpty(tb_password.Text)) { throw new Exception("密码不能为空!!"); } DataTable _dt = ReleaseData.arrByteToDataTable(refWebtUserInfo.Instance.GetUserInfo(tb_username.Text.Trim(), null, tb_password.Text)); if (_dt == null || _dt.Rows.Count < 1) { throw new Exception("用户名或密码输入错误\n请重新输入!!"); } if (_dt.Rows[0]["USERSTATUS"].ToString() != "1") { throw new Exception(string.Format("用户名[{0}]已经停用\n请重新输入!!", tb_username.Text)); } mpm.GUserInfo = new UserInfo { UserId = _dt.Rows[0]["userId"].ToString(), Pwd = _dt.Rows[0]["pwd"].ToString(), Username = _dt.Rows[0]["username"].ToString(), Useremail = _dt.Rows[0]["useremail"].ToString(), Userphone = _dt.Rows[0]["userphone"].ToString(), Userstatus = Convert.ToBoolean(int.Parse(_dt.Rows[0]["userstatus"].ToString())), Deptname = _dt.Rows[0]["deptname"].ToString(), FacId = _dt.Rows[0]["facId"].ToString(), Rolecaption = _dt.Rows[0]["rolecaption"].ToString(), UserPopList = ReleaseData.arrByteToDataTable( refWebtUserInfo.Instance.GetUserJurisdictionByUserId(tb_username.Text.Trim())) }; CreateAccessDb cad = new CreateAccessDb(); mpm.LoginOk = true; DialogResult = DialogResult.OK; } catch (Exception ex) { mpm.ShowMsg(PrintMain.MLogMsgType.Error, ex.Message); MessageBox.Show(ex.Message, "提示"); tb_username.SelectAll(); tb_username.Focus(); } }
private void tb_sn_KeyDown(object sender, KeyEventArgs e) { if ((!string.IsNullOrEmpty(tb_sn.Text)) && (e.KeyCode == Keys.Enter)) { try { if (string.IsNullOrEmpty(EmpNo)) { string Msg = "Emp Format Error"; try { string PWD = tb_sn.Text.Split('-')[1]; Msg = "Emp No Data"; DataTable dt = ReleaseData.arrByteToDataTable(tuser.GetUserInfoByUserId(tb_sn.Text.Split('-')[0])); if (dt.Rows.Count != 0) { if (PWD != dt.Rows[0]["pwd"].ToString()) { SendPrgMsg(mLogMsgType.Error, "NO EMP"); } else { SendPrgMsg(mLogMsgType.Incoming, "EMP OK"); EmpNo = tb_sn.Text.Split('-')[0]; } } else { SendPrgMsg(mLogMsgType.Error, "NO USER EMP"); } } catch { SendPrgMsg(mLogMsgType.Error, "人员权限格式错误--" + Msg); } } else { string InputData = tb_sn.Text.Trim(); if (InputData == "UNDO") { tb_wo.Enabled = true; imbt_ChgLine.Visible = true; tb_wo.Text = ""; tb_Partnumber.Text = ""; tb_Inputqty.Text = "0"; tb_TargetQty.Text = "0"; EmpNo = string.Empty; sSQLMAC = string.Empty; sSQLSN = string.Empty; SendPrgMsg(mLogMsgType.Normal, "清除完成,切换工单....."); } else { if (chkimei.Checked) { DataTable dtImei = ReleaseData.arrByteToDataTable(twip.GetQueryWipAllInfo("IMEI", InputData)); if (dtImei.Rows.Count > 0) { InputData = dtImei.Rows[0]["ESN"].ToString(); } else { SendPrgMsg(mLogMsgType.Error, "IMEI 没有找到"); return; } } #region 增加存储过程参数 if (!CHECK_PRODUCT_LINE()) { return; } string flag = "0"; if (radmobile.Checked) { flag = "1"; } Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("DATA", InputData); dic.Add("EMP", EmpNo); dic.Add("MODEL", tb_Partnumber.Text.Trim()); dic.Add("WO", tb_wo.Text.Trim()); dic.Add("LINE", LabLine.Text); dic.Add("FLAG", flag); string sMsg = PubStor.ExecuteProcedure("PRO_TEST_REWORK_INPUT", GenericUtil.MapListConverter.DictionaryToJson(dic)); #endregion if (sMsg == "OK") { SendPrgMsg(mLogMsgType.Incoming, string.Format("SN: [{0}] {1}", InputData, sMsg)); tb_Inputqty.Text = (int.Parse(tb_Inputqty.Text) + 1).ToString(); } else { SendPrgMsg(mLogMsgType.Error, string.Format("SN: [{0}] {1}", InputData, sMsg)); } sSQLMAC = string.Empty; sSQLSN = string.Empty; } } } catch (Exception ex) { SendPrgMsg(mLogMsgType.Error, "程序异常-->" + ex.Message); } finally { tb_sn.Text = ""; } } }
public void LoadInfoSnRuleWO() { dt_snRulewo = ReleaseData.arrByteToDataTable(refWebtB_SnRule_WO.Instance.GetALLB_SnRule_WO()); dgv_snrulewo.DataSource = dt_snRulewo; }