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, "没有需要打印的数据"); } }
public void PrintLabel(string sEsn) { #region 打印标签 DataTable dt = ReleaseData.arrByteToDataTable(wkp.GetWipKeyPart(sEsn)); if (dt.Rows.Count > 0) { string sWO = dt.Rows[0][1].ToString(); if (sWO != tb_wo.Text) { SendMsg(mLogMsgType.Error, "工单不同-->" + sWO); return; } DataTable dtPrint = new DataTable(); dtPrint.Columns.Add("Name", Type.GetType("System.String")); dtPrint.Columns.Add("val", Type.GetType("System.String")); dtPrint.Rows.Add("ESN", sEsn); dtPrint.Rows.Add("BLACK", sPartColor); dtPrint.Rows.Add("PARTNUMBER", sPartNumber); dtPrint.Rows.Add("FWVER", string.IsNullOrEmpty(_FwVer) ? "NA" : _FwVer); foreach (DataRow dr in dt.Rows) { dtPrint.Rows.Add(dr[2].ToString().ToUpper(), dr[3].ToString().ToUpper()); } //string filepatch = System.IO.Directory.GetCurrentDirectory() + "\\LabelFile\\" + sPartNumber + ".lab"; //string labfilefullpath = string.Format(@"{0}\{1}\{2}", this.LabDir.IndexOf(":") != -1 ? this.LabDir : this.LabDir, "PACK_BOX", sPartNumber + ".lab"); //if (!File.Exists(labfilefullpath)) //{ // SendMsg(mLogMsgType.Error, "条码文件不存在:" + labfilefullpath); //} //else //{ // SendPrintLabel(dtPrint, labfilefullpath, 1); //} PrintLabel(dtPrint); } else { SendMsg(mLogMsgType.Error, "没有找到信息"); } #endregion }
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 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); } } } } }