/// <summary> /// 显示一个包含输入框的对话框,等待用户输入内容,并在用户点击确定时将输入的字符串返回。如果用户取消了输入,返回null。 /// </summary> /// <param name="title">对话框的标题。</param> /// <param name="content">输入框的初始内容,可选,默认为空。</param> /// <param name="callback">回调函数,可选。当用户点击确定时被调用。</param> public void rawInput(string title, string content = "", Action <string> callback = null) { var context = GetActivityContext(); var result = new CallBackData(); var action = new Action <string>((value) => { if (result.IsEnd) { return; } result.IsEnd = true; callback?.Invoke(value); }); var builder = new MaterialDialog.Builder(context) .Input(null, content, true, new InputCallback((input) => action(input))) .Title(title) .CancelListener(dialog => { action.Invoke(string.Empty); }); Show(builder); }
/// <summary> /// 写入数据库返回 /// </summary> /// <param name="receiveData"></param> private void onCreateLabelReceived(CallBackData receiveData) { if (!receiveData.bIsOK) { MessageBox.Show(receiveData.Result); return; } //打印序列号 待完善 //string strWriteFileStream = BuildModuleIDLabelContent(_modulePrefix, Convert.ToInt32(tbx_wip_count.Text)+1, Convert.ToInt32(tbx_label_count.Text)); //using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"c:\BarcodePrint\ModulePrint.cmd", false)) //{ // file.WriteLine(strWriteFileStream); //} //using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"c:\BarcodePrint\usb.bat", false)) //{ // file.WriteLine(@"net use LPT3: \\127.0.0.1\LabelPrint"); // file.WriteLine(@"print /D:LPT3 C:\BarcodePrint\ModulePrint.cmd pause"); // //file.WriteLine(@"pause"); //} //try //{ // System.Diagnostics.Process.Start(@"c:\BarcodePrint\usb.bat"); //} //catch (Exception) //{ // throw; //} refleshPage(); }
/// <summary> /// 显示一个多选列表对话框,等待用户选择,返回用户选择的选项索引的数组。如果用户取消了选择,返回[]。 /// </summary> /// <param name="title">对话框的标题。</param> /// <param name="indices">选项列表中初始选中的项目索引的数组,默认为空数组。</param> /// <param name="items">对话框的选项列表,是一个字符串数组。</param> /// <param name="callback">回调函数,可选。当用户点击确定时被调用。</param> public void multiChoice(string title, LuaTable indices, LuaTable items, Action <int[], string[]> callback = null) { var context = GetActivityContext(); var result = new CallBackData(); var action = new Func <int[], string[], bool>((point, value) => { if (result.IsEnd) { return(false); } result.IsEnd = true; callback?.Invoke(point, value); return(true); }); var list = new List <string>(); var tableIndicesList = new List <int>(); try { if (indices != null) { var strIndices = JsonConvert.SerializeObject(indices); var tableIndices = JsonConvert.DeserializeObject <TableLua>(strIndices); foreach (var x in tableIndices.Values) { var status = int.TryParse(x, out int res); if (status) { tableIndicesList.Add(res); } } } if (items != null) { var str = JsonConvert.SerializeObject(items); var table = JsonConvert.DeserializeObject <TableLua>(str); list = table.Values; } } catch (System.Exception) { } var builder = new MaterialDialog.Builder(context) .DismissListener((dialog) => action(new int[0], new string[0])) .ItemsCallbackMultiChoice(tableIndicesList.ToArray(), new Func <MaterialDialog, int[], string[], bool>((dialog, which, text) => action(which, text))) .Title(title) .PositiveText("确定") .Items(list); Show(builder); }
public WipService(bool bDebug) { _bDebug = bDebug; oData = new CallBackData(); oData.bIsOK = true; #region open mysql connection try { oDbCon = new MySqlConnection(sConnectionString); oDbCon.Open(); oDbCmd = oDbCon.CreateCommand(); } catch (MySql.Data.MySqlClient.MySqlException ex) { switch (ex.Number) { case 0: oData.bIsOK = false; oData.Result = "Cannot connect to server. Contact administrator"; //return oData; break; case 1045: oData.bIsOK = false; oData.Result = "Invalid username/password, please try again"; //return oData; break; } } #endregion }
/// <summary> /// 没有处理程序的手势 /// </summary> /// <param name="description">手势</param> private static bool GesturesWithoutHandler(GestureDescription description) { //获得当前服务 var service = AutoAccessibilityService.Instance; if (service == null) { return(false); } var result = new CallBackData(); var task = new Task(() => { while (!result.IsEnd) { Task.Delay(100); } }); //回调函数 var callBack = new WithCallBack(result); service.DispatchGesture(description, callBack, null); task.Start(); task.Wait(); return(result.Status); }
private void OnAuthenticateUserCompleted(CallBackData _Result) { try { bExecuted = false; btnLogin.Enabled = true; string[] saRsult = Regex.Split(_Result.Result, "@"); string sUserID = saRsult[0]; string sReuslt = saRsult[1]; if (sReuslt.Equals("Ok")) { cusEvtLogin(sUserID);//txtUserName.Text); this.Close(); } else { MessageBox.Show("Account/Password is invalid, please check caps is lock or not!"); } } catch (Exception _ex) { MessageBox.Show(_Result.Result + " " + _ex.ToString()); } }
/// <summary> /// 插入装框信息返回 /// </summary> /// <param name="receiveData"></param> private void onInsertModuleFrameInfoReceived(CallBackData receiveData) { tbx_module_id.Enabled = true; if (!receiveData.bIsOK) { toolStripStatusLabelRight.Text = receiveData.Result; toolStripStatusLabelRight.BackColor = Color.Red; this.BackColor = Color.Red; changeColorTimer.Start(); tbx_module_id.Focus(); tbx_module_id.SelectAll(); //MessageBox.Show(receiveData.Result); return; } btn_scan_count.Text = receiveData.Result; this.BackColor = Color.LightGreen; toolStripStatusLabelRight.Text = "成功插入一条新数据:" + tbx_module_id.Text; toolStripStatusLabelRight.BackColor = Color.Green; changeColorTimer.Start(); tbx_module_id.Focus(); tbx_module_id.SelectAll(); }
private void bombAnim(object obj) { if (state == BombState.alive) { flipSprite(); // local data for my call back (I call it monkey) CallBackData monoData = (CallBackData)obj; // get the current time TimeSpan totTime = Timer.GetCurrentTime() - monoData.deltaTime; if (totTime.TotalSeconds > 5) { BombManager.Instance().removeBomb(this); } else { // Update my target time for next TimeEvent monoData.targetTime = Timer.GetCurrentTime() + new TimeSpan(0, 0, 0, 0, 300); // just increment count to show off monoData.count += 10; // install next TimeEvent Timer.Add(monoData.targetTime, obj, bombAnim); } } else { } }
/// <summary> /// 插入清洗信息返回 /// </summary> /// <param name="receiveData"></param> private void onInsertModuleCleanInfoReceived(CallBackData receiveData) { tbx_module_id.Enabled = true; if (!receiveData.bIsOK) { toolStripStatusLabelRight.Text = receiveData.Result; toolStripStatusLabelRight.BackColor = Color.Red; this.BackColor = Color.Red; changeColorTimer.Start(); tbx_module_id.Focus(); tbx_module_id.SelectAll(); //MessageBox.Show(receiveData.Result); return; } btn_scan_count.Text = receiveData.Result; this.BackColor = Color.LightGreen; toolStripStatusLabelRight.Text = "成功插入一条新数据"; toolStripStatusLabelRight.BackColor = Color.Green; changeColorTimer.Start(); #region 打印条码 using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"c:\BarcodePrint\ModuleID.txt", false)) { file.WriteLine(_currentModuleId); } using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"c:\BarcodePrint\usb.bat", false)) { file.WriteLine("@echo off"); //if (busbar_type == "三栅") //{ file.WriteLine("Bartend.exe /F=\"C:\\BarcodePrint\\ModuleID.btw\" /D=\"C:\\BarcodePrint\\ModuleID.txt\" /P /x"); //} //else if (busbar_type == "三栅") //{ // file.WriteLine("Bartend.exe /F=\"C:\\BarcodePrint\\China4.btw\" /D=\"C:\\BarcodePrint\\A4Label.txt\" /P /x"); //} //file.WriteLine("Bartend.exe /F=\"C:\\BarcodePrint\\China.btw\" /D=\"C:\\BarcodePrint\\A4Label.txt\" /P /x"); } try { System.Diagnostics.Process.Start(@"c:\BarcodePrint\usb.bat"); } catch (Exception) { throw; } #endregion tbx_module_id.Focus(); tbx_module_id.SelectAll(); }
/// <summary> /// 初始化工单信息 /// </summary> /// <param name="receiveData"></param> private void onWoInfoReceived(CallBackData receiveData) { if (!receiveData.bIsOK) { MessageBox.Show("系统中没有此车间的工单"); return; } _woWIPinfo = receiveData.RowDatas; cbx_workorder.Items.Clear(); for (int i = 0; i < _woWIPinfo.Count(); i++) { cbx_workorder.Items.Add(_woWIPinfo[i].rowData[0]); } tbx_count_remain.Text = string.Empty; tbx_plan_count.Text = string.Empty; tbx_wip_count.Text = string.Empty; cbx_workorder.SelectedIndex = -1; //工单号清空 _modulePrefix = string.Empty; //组件前缀清空 dgv_module_id.Rows.Clear(); //清空组件序列号 tbx_label_count.Text = string.Empty; cbx_workorder.Enabled = true; //使能工单选项 }
public GeneralService() { oData = new CallBackData(); oData.bIsOK = true; #region open mysql connection try { oDbCon = new MySqlConnection(sConnectionString); oDbCon.Open(); oDbCmd = oDbCon.CreateCommand(); } catch (MySql.Data.MySqlClient.MySqlException ex) { switch (ex.Number) { case 0: oData.bIsOK = false; oData.Result = "Cannot connect to server. Contact administrator"; //return oData; break; case 1045: oData.bIsOK = false; oData.Result = "Invalid username/password, please try again"; //return oData; break; } } #endregion }
/// <summary> /// 初始化下拉项 /// </summary> /// <param name="receiveData"></param> private void onReceiveComoboxItems(CallBackData receiveData) { TextReader oTR = new StringReader(receiveData.Result); XElement oResult = XElement.Load(oTR); oTR.Close(); IEnumerable <XElement> cReports = (from xNode in oResult.Descendants("Comoboxes") select xNode); foreach (XElement oModuleNode in cReports) { string ComoboxName = ((XElement)oModuleNode).Attribute("ComoboxName").Value.ToString(); string displayName = ((XElement)oModuleNode).Attribute("displayName").Value.ToString(); string sourceName = ((XElement)oModuleNode).Attribute("sourceName").Value.ToString(); if (ComoboxName == BasicClass.comoboxItemName.Workshop) { cbx_workshop.Items.Add(new ListItem(sourceName, displayName)); } else if (ComoboxName == BasicClass.comoboxItemName.PowerTemplate) { cbx_template.Items.Add(new ListItem(sourceName, displayName)); } else if (ComoboxName == BasicClass.comoboxItemName.PackCount) { cbx_pack_count.Items.Add(new ListItem(sourceName, displayName)); } } }
public void removeExplosion(object obj) { CallBackData nodeData = (CallBackData)obj; SBNode sbNode = SpriteBatchManager.Instance().getBatch(batchEnum.explosions); sbNode.removeDisplayObject(nodeData.spriteRef); }
private void onSetCurrentUserInfoCompleted(CallBackData userInfo) { if (!userInfo.bIsOK) { //自动退出 Application.Exit(); } }
private void armBomb() { TimeSpan currentTime = Timer.GetCurrentTime(); TimeSpan t_1 = currentTime.Add(new TimeSpan(0, 0, 0, 2, 0)); CallBackData nodeData = new CallBackData(0, Timer.GetCurrentTime()); Timer.Add(t_1, nodeData, armed); }
public void hit() { playFenceHit(); CallBackData nodeData = new CallBackData(0, TimeSpan.Zero); playAnim(nodeData); }
/// <summary> /// 确定按钮返回 /// </summary> /// <param name="receiveData"></param> private void onSetPowerGradeReceived(CallBackData receiveData) { _dicPowerGrade = null; _dicPowerGradeFinal = new Dictionary <string, List <string> >(); _dicImpGradeFinal = new Dictionary <string, List <string> >(); dgv_power_set.Rows.Clear(); dgv_imp_set.Rows.Clear(); }
public static void RemoveCallback(Action __fun) { for (int i = _cbdList.Count - 1; i >= 0; i--) { CallBackData data = _cbdList[i]; if (data.fun == __fun) { _cbdList.RemoveAt(i); } } }
private void onReleaseModuleBingingInfoReceived(CallBackData receiveData) { this.BackColor = Color.LightGreen; toolStripStatusLabelRight.Text = "接触绑定信息成功"; toolStripStatusLabelRight.BackColor = Color.Green; changeColorTimer.Start(); dgv_cellreturn_detail.Rows.Clear(); tbx_module.Focus(); tbx_module.SelectAll(); }
public static void RemoveCallback(int __id) { for (int i = _cbdList.Count - 1; i >= 0; i--) { CallBackData data = _cbdList[i]; if (data.id == __id) { _cbdList.RemoveAt(i); break; } } }
public static int AddCallback(Action __fun, float __interval = 0f, uint __repeat = 1) { CallBackData item = new CallBackData { fun = __fun, interval = __interval, repeat = __repeat, lastTime = realTime }; _cbdList.Add(item); return(item.id); }
public void hit(PlayerID _id) { PlayerManager.getPlayer(_id).state = PlayerState.dead; TimeSpan currentTime = Timer.GetCurrentTime(); TimeSpan t_1 = currentTime.Add(new TimeSpan(0, 0, 0, 0, 600)); CallBackData nodeData = new CallBackData(3, TimeSpan.Zero); nodeData.playerID = _id; Timer.Add(t_1, nodeData, PlayerManager.Instance().respawn); }
/// <summary> /// 上传文件 网络访问数据回调 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void Request_UploadFile_HttpCompleted(object sender, WP7HttpEventArgs e) { CallBackData data = CallBackData.Create(e.Result, e.IsError); if (e.IsError) { MessageBox.Show(data.ErrorMessage); } else { MessageBox.Show("上传成功!"); } }
/// <summary> /// 复制请求回调 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Request_Copy_Compeleted(object sender, WP7HttpEventArgs e) { CallBackData data = CallBackData.Create(e.Result, e.IsError); if (e.IsError) { MessageBox.Show(data.ErrorMessage); } else { MessageBox.Show("复制成功!"); } }
/// <summary> /// 获取车间工单 /// </summary> /// <param name="receiveData"></param> private void onGetWorkOrderReceived(CallBackData receiveData) { if (!receiveData.bIsOK) { MessageBox.Show(receiveData.Result); cbx_workshop.Enabled = true; return; } string[] woItem = receiveData.Result.Split('|'); cbx_wo.Items.AddRange(woItem); cbx_wo.Enabled = true; }
/// <summary> /// wcf返回 /// </summary> /// <param name="receiveData"></param> private void onReceiveComoboxItems(CallBackData receiveData) { if (receiveData.bIsOK) { toolStripStatusLabelRight.Text = "成功插入一条新数据"; toolStripStatusLabelRight.BackColor = Color.Green; changeColorTimer.Start(); resetControlState(); } else { MessageBox.Show(receiveData.Result); } }
/// <summary> /// 显示一个包含“确定”和“取消”按钮的提示对话框。 /// </summary> /// <param name="title">对话框的标题。</param> /// <param name="content">可选,对话框的内容。默认为空。</param> /// <param name="callback">如果用户点击“确定”则返回 true ,否则返回 false</param> public void confirm(string title, string content = "", Action <bool> callback = null) { var context = GetActivityContext(); var result = new CallBackData(); var action = new Action <bool>((value) => { if (result.IsEnd) { return; } result.IsEnd = true; callback?.Invoke(value); }); var builder = new MaterialDialog.Builder(context) .Title(title) .PositiveText("确定") .NegativeText("取消") .DismissListener(dialog => { if (result.IsEnd) { return; } action.Invoke(false); }) .OnAny((dialog, which) => { if (which == DialogAction.Positive) { action.Invoke(true); } else { action.Invoke(false); } }); if (!string.IsNullOrWhiteSpace(content)) { builder.Content(content); } Show(builder); }
private void onCreateWOCompleted(CallBackData wipReceiveData) { if (wipReceiveData.bIsOK) { toolStripStatusLabelRight.Text = "成功插入一条新数据"; toolStripStatusLabelRight.BackColor = Color.Green; changeColorTimer.Start(); BasicClass.resetControlState(groupBox_woinfo); //resetControlState(); } else { MessageBox.Show(wipReceiveData.Result); } }
/// <summary> /// 记录到数据库中 /// </summary> /// <param name="wipDataReceive"></param> private void onCellBindingReceive(CallBackData wipDataReceive) { if (!wipDataReceive.bIsOK) { //MessageBox.Show(wipDataReceive.Result); toolStripStatusLabelRight.Text = wipDataReceive.Result; this.BackColor = Color.Red; toolStripStatusLabelRight.BackColor = Color.Red; tbx_module_id.Focus(); tbx_module_id.SelectAll(); changeColorTimer.Start(); return; } iScanCount++; btn_scan_count.Text = iScanCount.ToString(); dgv_cellbatch_info.Rows.Clear(); //DataTable dt = new DataTable(); RowData[] row40data = wipDataReceive.RowDatas; for (int i = 0; i < row40data.Length; i++) { dgv_cellbatch_info.Rows.Add(); string[] rowdata = row40data[i].rowData; for (int j = 0; j < rowdata.Length; j++) { dgv_cellbatch_info.Rows[i].Cells[j].Value = rowdata[j]; } } btn_site_count.Text = wipDataReceive.Result; toolStripStatusLabelRight.Text = "插入数据成功"; toolStripStatusLabelRight.BackColor = Color.Green; changeColorTimer.Start(); tbx_module_id.Focus(); tbx_module_id.SelectAll(); }
private void playAnim(object obj) { CallBackData data = (CallBackData)obj; if (data.count < 6) { anim.flipImage(); TimeSpan currentTime = Timer.GetCurrentTime(); TimeSpan t_1 = currentTime.Add(new TimeSpan(0, 0, 0, 0, 50)); data.count++; Timer.Add(t_1, data, playAnim); } }
public void addExplosion(Vector2 _pos, Color _color) { Sprite expSprite = (Sprite)DisplayManager.Instance().getDisplayObj(SpriteEnum.Explosion); Sprite_Proxy expProxy = new Sprite_Proxy(expSprite, (int)_pos.X, (int)_pos.Y, 0.20f, _color); SBNode expBatch = SpriteBatchManager.Instance().getBatch(batchEnum.explosions); expBatch.addDisplayObject(expProxy); TimeSpan currentTime = Timer.GetCurrentTime(); TimeSpan t_1 = currentTime.Add(new TimeSpan(0, 0, 0, 0, 500)); CallBackData nodeData = new CallBackData(3, TimeSpan.Zero); nodeData.spriteRef = expProxy; Timer.Add(t_1, nodeData, removeExplosion); }
/// <summary> /// wcf返回 /// </summary> /// <param name="receiveData"></param> private void onCreateBatchNoCompleted(CallBackData receiveData) { if (!receiveData.bIsOK) { MessageBox.Show(receiveData.Result); return; } string strWriteFileStream = receiveData.Result; toolStripStatusLabelRight.Text = "成功插入一条新数据"; toolStripStatusLabelRight.BackColor = Color.Green; changeColorTimer.Start(); BasicClass.resetControlState(groupBox_cell_info); #region 打印电池片分批条码 using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"c:\BarcodePrint_cell\cell.txt", false)) { file.WriteLine(strWriteFileStream); } using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"c:\BarcodePrint_cell\usb.bat", false)) { file.WriteLine("@echo off"); file.WriteLine("Bartend.exe /F=\"C:\\BarcodePrint_cell\\cell.btw\" /D=\"C:\\BarcodePrint_cell\\cell.txt\" /P /x"); } try { System.Diagnostics.Process.Start(@"c:\BarcodePrint_cell\usb.bat"); } catch (Exception) { throw; } #endregion }
/// <summary> /// 初始化下拉项 /// </summary> /// <param name="receiveData"></param> private void onReceiveComoboxItems(CallBackData receiveData) { TextReader oTR = new StringReader(receiveData.Result); XElement oResult = XElement.Load(oTR); oTR.Close(); IEnumerable<XElement> cReports = (from xNode in oResult.Descendants("Comoboxes") select xNode); foreach (XElement oModuleNode in cReports) { string ComoboxName = ((XElement)oModuleNode).Attribute("ComoboxName").Value.ToString(); string displayName = ((XElement)oModuleNode).Attribute("displayName").Value.ToString(); string sourceName = ((XElement)oModuleNode).Attribute("sourceName").Value.ToString(); if (ComoboxName == BasicClass.comoboxItemName.Workshop) { comboBox_workshop.Items.Add(new ListItem(sourceName, displayName)); } else if (ComoboxName == BasicClass.comoboxItemName.WO_type) { comboBox_wo_type.Items.Add(new ListItem(sourceName, displayName)); } else if (ComoboxName == BasicClass.comoboxItemName.Cristal_Type) { comboBox_cristal_type.Items.Add(new ListItem(sourceName, displayName)); } else if (ComoboxName == BasicClass.comoboxItemName.Cell_Size) { comboBox_cell_size.Items.Add(new ListItem(sourceName, displayName)); } else if (ComoboxName == BasicClass.comoboxItemName.Cell_Consumption) { comboBox_cell_consumption.Items.Add(new ListItem(sourceName, displayName)); } else if (ComoboxName == BasicClass.comoboxItemName.Cell_Type) { comboBox_cell_type.Items.Add(new ListItem(sourceName, displayName)); } else if (ComoboxName == BasicClass.comoboxItemName.Workflow) { comboBox_producing_flow.Items.Add(new ListItem(sourceName, displayName)); } else if (ComoboxName == BasicClass.comoboxItemName.Module_color) { cbx_module_color.Items.Add(new ListItem(sourceName, displayName)); } else if (ComoboxName == BasicClass.comoboxItemName.Module_type) { cbx_module_type.Items.Add(new ListItem(sourceName, displayName)); } else if (ComoboxName == BasicClass.comoboxItemName.PID_type) { cbx_pid_type.Items.Add(new ListItem(sourceName, displayName)); } else if (ComoboxName == BasicClass.comoboxItemName.Product_name1) { comboBox_product_id1.Items.Add(new ListItem(sourceName, displayName)); } else if (ComoboxName == BasicClass.comoboxItemName.Product_name2) { comboBox_product_id2.Items.Add(new ListItem(sourceName, displayName)); } } }
public GeneralService(bool bDebug) { _bDebug = bDebug; oData = new CallBackData(); oData.bIsOK = true; }
/// <summary> /// 获取到托盘信息 /// </summary> /// <param name="wipDataReceived"></param> private void onCreatePckInfoReceived(CallBackData wipDataReceived) { if (!wipDataReceived.bIsOK) { //MessageBox.Show(wipDataReceived.Result); tbx_module_id.Enabled = true; btn_ok.Enabled = true; this.BackColor = Color.Red; changeColorTimer.Start(); toolStripStatusLabelRight.Text = wipDataReceived.Result; toolStripStatusLabelRight.BackColor = Color.Red; tbx_module_id.Focus(); tbx_module_id.SelectAll(); return; } //==>如果托盘内组件数量等于设定数量,则自动打印,否则,把托盘信息加入字典 string[] palletTag = wipDataReceived.Result.Split('|'); int i=0; _currentPallet = palletTag[i++]; //托盘号 int iPrintCount = Convert.ToInt32(palletTag[i++]); //预设包装数量 string palletTagInfo = palletTag[i++]; //托盘pattern string palletPower = palletTag[i++]; //A4_功率 string pallettype = palletTag[i++]; //A4_类型 string jbox_spec = palletTag[i++]; //A4_线盒规格 string frame_spec = palletTag[i++]; //A4_边框规格 string pallet_class_grade= palletTag[i++]; //A4_质量等级 string busbar_type = palletTag[i++]; //A4_三栅四删类型 需求改为了电流等级2015-10-07 RowData[] rowDatas = wipDataReceived.RowDatas;//组件数量 //显示包装数量 btn_packing_count.Text = rowDatas.Count().ToString(); if (rowDatas.Count()==iPrintCount) {//====>打印,并删除托盘字典中托盘号 #region create file stream string strWriteFileStream = _currentPallet + "," + palletPower + "," + pallettype + "," + jbox_spec + "," + frame_spec + "," + pallet_class_grade + ","; strWriteFileStream = strWriteFileStream + busbar_type+","; for (int idx = 0; idx < rowDatas.Length; idx++) { string[] rowdata = rowDatas[idx].rowData; string module_d_temp=rowdata[1]; strWriteFileStream = strWriteFileStream + module_d_temp + ","; } #endregion using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"c:\BarcodePrint\A4Label.txt", false)) { file.WriteLine(strWriteFileStream); } using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"c:\BarcodePrint\usb.bat", false)) { file.WriteLine("@echo off"); if (busbar_type=="三栅") { file.WriteLine("Bartend.exe /F=\"C:\\BarcodePrint\\China3.btw\" /D=\"C:\\BarcodePrint\\A4Label.txt\" /P /x"); } else if (busbar_type=="三栅") { file.WriteLine("Bartend.exe /F=\"C:\\BarcodePrint\\China4.btw\" /D=\"C:\\BarcodePrint\\A4Label.txt\" /P /x"); } //file.WriteLine("Bartend.exe /F=\"C:\\BarcodePrint\\China.btw\" /D=\"C:\\BarcodePrint\\A4Label.txt\" /P /x"); } try { System.Diagnostics.Process.Start(@"c:\BarcodePrint\usb.bat"); } catch (Exception) { throw; } _dicPalletPattern.Remove(_currentPallet); dgv_pallet_info.Rows.Clear(); //printLabel(); //清空相关空间内容 btn_packing_count.Text = string.Empty; btn_power_grade.Text = string.Empty; btn_Imp_Grade.Text = string.Empty; btn_final_grade.Text = string.Empty; //==>更新托盘信息 List<string> lstInparas = new List<string>(); lstInparas.Add(_currentPallet); lstInparas.Add(iPrintCount.ToString()); FuncTagInfo wipFunctionTag = new FuncTagInfo(); wipFunctionTag.FuncName = "UpdatePalletInfo"; wipFunctionTag.InputParams = lstInparas.ToArray(); WcfRequests.SendWipRequest(onUpdatePalletInfoReceived, wipFunctionTag); } else {//====>加入托盘字典,并更新托盘明细信息 if (!_dicPalletPattern.ContainsKey(_currentPallet)) { _dicPalletPattern.Add(_currentPallet, palletTagInfo); } dgv_pallet_info.Rows.Clear(); DataTable dt = new DataTable(); RowData[] row40data = wipDataReceived.RowDatas; for (i = 0; i < row40data.Length; i++) { dgv_pallet_info.Rows.Add(); string[] rowdata = row40data[i].rowData; for (int j = 0; j < rowdata.Length; j++) { dgv_pallet_info.Rows[i].Cells[j].Value = rowdata[j]; } } } btn_ok.Enabled = true; tbx_module_id.Enabled = true; tbx_module_id.Focus(); tbx_module_id.SelectAll(); }
/// <summary> /// 获取到机台信息 /// </summary> /// <param name="receiveData"></param> private void onGetEQPInfoReceived(CallBackData receiveData) { tbx_current_site.Text = string.Empty; _currentSite = string.Empty; _currentEqp = string.Empty; if (!receiveData.bIsOK) { MessageBox.Show("系统中没有找到合适的机台"); cbx_workshop.Enabled = true; return; } _eqpInfo = receiveData.RowDatas; for (int i = 0; i < _eqpInfo.Count(); i++) { cbx_eqp.Items.Add(_eqpInfo[i].rowData[0]); } cbx_eqp.Enabled = true; }
/// <summary> /// 获取到当前用户 /// </summary> /// <param name="receiveData"></param> private void onCurrentUserReceive(CallBackData receiveData) { _user = receiveData.Result; }
/// <summary> /// 确定按钮返回 /// </summary> /// <param name="receiveData"></param> private void onSetPowerGradeReceived(CallBackData receiveData) { _dicPowerGrade = null; _dicPowerGradeFinal = new Dictionary<string, List<string>>(); _dicImpGradeFinal = new Dictionary<string, List<string>>(); dgv_power_set.Rows.Clear(); dgv_imp_set.Rows.Clear(); }
/// <summary> /// 获取到组件绑定信息 /// </summary> /// <param name="receiveData"></param> private void onGetModuleBingingInfoReceived(CallBackData receiveData) { if (!receiveData.bIsOK) { tbx_module.Enabled = true; this.BackColor = Color.Red; toolStripStatusLabelRight.Text = receiveData.Result; toolStripStatusLabelRight.BackColor = Color.Red; tbx_module.Focus(); tbx_module.SelectAll(); changeColorTimer.Start(); return; } string[] row40data = receiveData.Result.Split('|'); string sPattern = row40data[1]; string currentBatch = row40data[1]; string cell_consumption = row40data[3]; if (!_isFstModule) { if (sPattern!=_currentPattern) { this.BackColor = Color.Red; toolStripStatusLabelRight.Text = "不允许不同批次的片源退库"; toolStripStatusLabelRight.BackColor = Color.Red; tbx_module.Focus(); tbx_module.SelectAll(); changeColorTimer.Start(); return; } } else { _isFstModule = false; _currentPattern = sPattern; _currentBatch = currentBatch; _cellConsumption = cell_consumption; } dgv_cellreturn_detail.Rows.Add(); for (int i = 0; i < 3; i++) { dgv_cellreturn_detail.Rows[_iCurrentScanCount].Cells[i].Value = row40data[i]; } _iCurrentScanCount++; btn_scanCount.Text = _iCurrentScanCount.ToString(); lstScanedModule.Add(tbx_module.Text); toolStripStatusLabelRight.Text = ""; toolStripStatusLabelRight.BackColor = Color.Transparent; tbx_module.Enabled = true; tbx_module.Focus(); tbx_module.SelectAll(); }
/// <summary> /// 插入叠层信息返回 /// </summary> /// <param name="receiveData"></param> private void onInsertModuleLayupInfoReceived(CallBackData receiveData) { tbx_module_id.Enabled = true; if (!receiveData.bIsOK) { toolStripStatusLabelRight.Text = receiveData.Result; toolStripStatusLabelRight.BackColor = Color.Red; this.BackColor = Color.Red; changeColorTimer.Start(); tbx_module_id.Focus(); tbx_module_id.SelectAll(); //MessageBox.Show(receiveData.Result); return; } btn_scan_count.Text = receiveData.Result; this.BackColor = Color.LightGreen; toolStripStatusLabelRight.Text = "成功插入一条新数据"; toolStripStatusLabelRight.BackColor = Color.Green; changeColorTimer.Start(); tbx_module_id.Focus(); tbx_module_id.SelectAll(); }
private void onUpdatePalletInfoReceived(CallBackData wipDataReceived) { // tbx_module_id.Focus(); // tbx_module_id.SelectAll(); }
/// <summary> /// 初始化下拉项 /// </summary> /// <param name="receiveData"></param> private void onReceiveComoboxItems(CallBackData receiveData) { TextReader oTR = new StringReader(receiveData.Result); XElement oResult = XElement.Load(oTR); oTR.Close(); IEnumerable<XElement> cReports = (from xNode in oResult.Descendants("Comoboxes") select xNode); foreach (XElement oModuleNode in cReports) { string ComoboxName = ((XElement)oModuleNode).Attribute("ComoboxName").Value.ToString(); string displayName = ((XElement)oModuleNode).Attribute("displayName").Value.ToString(); string sourceName = ((XElement)oModuleNode).Attribute("sourceName").Value.ToString(); if (ComoboxName == BasicClass.comoboxItemName.Glass_Comp) { cbx_glass_comp.Items.Add(new ListItem(sourceName, displayName)); } else if (ComoboxName == BasicClass.comoboxItemName.TPT_Comp) { cbx_tpt_comp.Items.Add(new ListItem(sourceName, displayName)); } else if (ComoboxName == BasicClass.comoboxItemName.EVA_comp) { cbx_eva_comp.Items.Add(new ListItem(sourceName, displayName)); } else if (ComoboxName == BasicClass.comoboxItemName.Glass_Desc) { cbx_glass_desc.Items.Add(new ListItem(sourceName, displayName)); } else if (ComoboxName == BasicClass.comoboxItemName.TPT_Desc) { cbx_tpt_desc.Items.Add(new ListItem(sourceName, displayName)); } else if (ComoboxName == BasicClass.comoboxItemName.EVA_desc) { cbx_eva_desc.Items.Add(new ListItem(sourceName, displayName)); } else if (ComoboxName == BasicClass.comoboxItemName.Workshop) { cbx_workshop.Items.Add(new ListItem(sourceName, displayName)); } } }
/// <summary> /// 获取完组件信息 /// </summary> /// <param name="WipDataReceived"></param> private void onGetModuleInfoReceived(CallBackData WipDataReceived) { //-->有问题,则show出来 if (!WipDataReceived.bIsOK) { btn_ok.Enabled = true; tbx_module_id.Enabled = true; //MessageBox.Show(WipDataReceived.Result); this.BackColor = Color.Red; changeColorTimer.Start(); toolStripStatusLabelRight.Text = WipDataReceived.Result; toolStripStatusLabelRight.BackColor = Color.Red; tbx_module_id.Focus(); tbx_module_id.SelectAll(); return; } //-->没问题,则继续 string[] rowDatas = WipDataReceived.RowDatas[0].rowData; int i=0; string module_id =rowDatas[i++]; string workorder = rowDatas[i++]; string sale_order = rowDatas[i++]; string final_grade = rowDatas[i++]; string power_grade = rowDatas[i++]; string imp_grade = rowDatas[i++]; string cell_consumption = rowDatas[i++]; string module_color = rowDatas[i++]; string pack_count = rowDatas[i++]; string jbox_desc = rowDatas[i++]; string frame_desc = rowDatas[i++]; string pmax = rowDatas[i++]; string vpm = rowDatas[i++]; string ipm = rowDatas[i++]; string ff = rowDatas[i++]; string voc = rowDatas[i++]; string isc = rowDatas[i++]; string test_time = rowDatas[i++]; string surf_temp = rowDatas[i++]; string modult_type = rowDatas[i++]; string cristal_type = rowDatas[i++]; string wrokshop = rowDatas[i++]; string cell_type = rowDatas[i++]; string product_no1 = rowDatas[i++]; string product_no2 = rowDatas[i++]; //test_time = Convert.ToDateTime(test_time).ToString("yyyy-MM-dd HH:mm:ss"); //test_time = "1970-01-01 00:00:00"; //bug //====>检查信息是否完整 #region MyRegion if (power_grade==string.Empty) { //MessageBox.Show("没有功率测试信息"); tbx_module_id.Enabled = true; this.BackColor = Color.Red; changeColorTimer.Start(); toolStripStatusLabelRight.Text = "没有功率测试信息"; toolStripStatusLabelRight.BackColor = Color.Red; tbx_module_id.Focus(); tbx_module_id.SelectAll(); return; } #endregion //==>显示组件工单,质量等级,功率等级,电流等级 tbx_work_order.Text = workorder; btn_final_grade.Text = final_grade; btn_power_grade.Text = power_grade; btn_Imp_Grade.Text = imp_grade; //====>构建pattern,作为拼托盘依据 string sPattern = string.Empty; if (checkBox_sale_order.Checked) { sPattern = sPattern + sale_order + "!"; } if (checkBox_workorder.Checked) { sPattern = sPattern + workorder + "!"; } if (checkBox_final_grade.Checked) { sPattern = sPattern + final_grade + "!"; } if (checkBox_power.Checked) { sPattern = sPattern + power_grade + "!"; } if (checkBox_imp.Checked) { sPattern = sPattern + imp_grade + "!"; } if (checkBox_module_color.Checked) { sPattern = sPattern + module_color + "!"; } if (sPattern==string.Empty) { //MessageBox.Show("包装条件不能为空!"); this.BackColor = Color.Red; changeColorTimer.Start(); toolStripStatusLabelRight.Text = "包装条件不能为空!"; toolStripStatusLabelRight.BackColor = Color.Red; tbx_module_id.Focus(); tbx_module_id.SelectAll(); return; } //====>如果当前没有托盘,那么则产生托盘,如果有,则跟托盘的pattern做比较,相同则包到一块儿 #region MyRegion bool FIND_THE_SAME_PATTERN = false; //字典中有托盘,则比较托盘的pattern和当前pattern是否相同 foreach (var item in _dicPalletPattern) { if (item.Value==sPattern) { _currentPallet = item.Key; FIND_THE_SAME_PATTERN = true; } } List<string> inputParas = new List<string>(); if (FIND_THE_SAME_PATTERN) { inputParas.Add(_currentPallet); } else { #region 如果需要自动分拖,则将此段代码注释掉 if (_dicPalletPattern.Count>0) { this.BackColor = Color.Red; changeColorTimer.Start(); toolStripStatusLabelRight.Text = "这块组件不符合成拖条件!"; toolStripStatusLabelRight.BackColor = Color.Red; tbx_module_id.Enabled = true; tbx_module_id.Focus(); tbx_module_id.SelectAll(); return; } #endregion inputParas.Add(""); } inputParas.Add(sPattern); inputParas.Add(pack_count); inputParas.Add(module_id); inputParas.Add(final_grade); inputParas.Add(power_grade); inputParas.Add(imp_grade); inputParas.Add(pmax); inputParas.Add(vpm); inputParas.Add(ipm); inputParas.Add(ff); inputParas.Add(voc); inputParas.Add(isc); inputParas.Add(test_time); inputParas.Add(surf_temp); inputParas.Add(modult_type); inputParas.Add(cristal_type); inputParas.Add(wrokshop); inputParas.Add(module_color); inputParas.Add(cell_consumption); inputParas.Add(workorder); inputParas.Add(_user); inputParas.Add(cell_type); inputParas.Add(jbox_desc); inputParas.Add(frame_desc); inputParas.Add(product_no1); inputParas.Add(product_no2); FuncTagInfo wipFunctionTag = new FuncTagInfo(); wipFunctionTag.FuncName = "GetPalletInfo"; wipFunctionTag.InputParams = inputParas.ToArray(); WcfRequests.SendWipRequest(onCreatePckInfoReceived, wipFunctionTag); #endregion }
/// <summary> /// 获取电池片批次信息 /// </summary> /// <param name="wipDataReceive"></param> private void onCellBatchInfoReceive(CallBackData wipDataReceive) { if (!wipDataReceive.bIsOK) { tbx_module_id.Enabled = false; //MessageBox.Show(wipDataReceive.Result); //return; this.BackColor = Color.Red; toolStripStatusLabelRight.Text = wipDataReceive.Result; toolStripStatusLabelRight.BackColor = Color.Red; tbx_cell_batch.Focus(); tbx_cell_batch.SelectAll(); changeColorTimer.Start(); return; } tbx_module_id.Enabled = true; dgv_cellbatch_info.Rows.Clear(); //DataTable dt = new DataTable(); RowData[] row40data = wipDataReceive.RowDatas; for (int i = 0; i < row40data.Length; i++) { dgv_cellbatch_info.Rows.Add(); string[] rowdata = row40data[i].rowData; for (int j = 0; j < rowdata.Length; j++) { dgv_cellbatch_info.Rows[i].Cells[j].Value = rowdata[j]; } } tbx_module_id.Focus(); tbx_module_id.SelectAll(); }
/// <summary> /// 获取功率模板 /// </summary> private void onGetPowerTemplateReceived(CallBackData receiveData) { _dicPowerGradeFinal = new Dictionary<string, List<string>>(); //清空缓存 _dicImpGradeFinal = new Dictionary<string, List<string>>(); //清空缓存 TextReader oTR = new StringReader(receiveData.Result); XElement oResult = XElement.Load(oTR); oTR.Close(); _dicPowerGrade = new Dictionary<string, List<string>>(); IEnumerable<XElement> cReports = (from xNode in oResult.Descendants("PowerItem") select xNode); foreach (XElement oModuleNode in cReports) { string sPowerGrade = ((XElement)oModuleNode).Attribute("POWER_GRADE").Value.ToString(); string sUpperPower = ((XElement)oModuleNode).Attribute("UPPERPOWER").Value.ToString(); string sLowerPower = ((XElement)oModuleNode).Attribute("LOWERPOWER").Value.ToString(); string sUpperImp = ((XElement)oModuleNode).Attribute("UPPERIMP").Value.ToString(); if (!_dicPowerGrade.Keys.Contains(sPowerGrade)) { _dicPowerGrade.Add(sPowerGrade, new List<string>()); } _dicPowerGrade[sPowerGrade].Add(sUpperPower); _dicPowerGrade[sPowerGrade].Add(sLowerPower); if (!_dicImpGradeFinal.Keys.Contains(sPowerGrade)) { _dicImpGradeFinal.Add(sPowerGrade,new List<string>()); } _dicImpGradeFinal[sPowerGrade].Add(sUpperImp); } #region 显示模板功率档位 dgv_power_set.Rows.Clear(); List<string> powerPara = new List<string>(); int rowIdx = 0; foreach (var item in _dicPowerGrade) { powerPara = item.Value; dgv_power_set.Rows.Add(); dgv_power_set.Rows[rowIdx].Cells[0].Value = item.Key; for (int j = 0; j < 2; j++) { dgv_power_set.Rows[rowIdx].Cells[j+1].Value = powerPara[j]; } //如果有电流档,则背景色改为绿色 if (_dicImpGradeFinal[item.Key].Count>1) { dgv_power_set.Rows[rowIdx].DefaultCellStyle.BackColor = Color.Green; } rowIdx++; } #endregion }