private void btn_PrintCode_Click(object sender, EventArgs e) { int boxCapability = new MbTask().GetBoxCapability(); try { if (this.dgv_Mboard.SelectedCells[2].Value.ToString().Trim() != "清洗烘干") { MessageBox.Show("只有清洗烘干工序可以打印条形码", "底板任务查询", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { PanBarCode[] codeArray; if ((int.Parse(this.dgv_Mboard.SelectedCells[3].Value.ToString()) % boxCapability) != 0) { int num1 = int.Parse(this.dgv_Mboard.SelectedCells[3].Value.ToString()) / boxCapability; } else { int num3 = int.Parse(this.dgv_Mboard.SelectedCells[3].Value.ToString()) / boxCapability; } string queryStr = "select * from t_pantaskinfo where left(pantaskid,12)='" + this.dgv_Mboard.SelectedCells[0].Value.ToString() + "'"; DataSet set = new Sql2KDataAccess().Run_SqlText(queryStr); if ((set != null) && (set.Tables[0].Rows.Count > 0)) { codeArray = new PanBarCode[set.Tables[0].Rows.Count]; for (int i = 0; i < set.Tables[0].Rows.Count; i++) { codeArray[i].strCount = set.Tables[0].Rows[i]["pancount"].ToString(); codeArray[i].strTaskID = set.Tables[0].Rows[i]["pantaskid"].ToString(); codeArray[i].strPanType = this.dgv_Mboard.SelectedCells[1].Value.ToString(); } } else { codeArray = new PanBarCode[0]; } new Print().LabelPrintTaskPan(codeArray); } } catch (Exception exception) { MessageBox.Show("打印条形码时发生错误\n" + exception.Message, "底板任务管理", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void Frm_MatherBoard_Load(object sender, EventArgs e) { base.Size = base.Parent.ClientSize; DataTable dt = new DataTable(); Sql2KDataAccess access = new Sql2KDataAccess(); access.Run_SqlText("select * from V_MbType", ref dt); this.cbx_Size.DataSource = dt; this.cbx_Size.DisplayMember = "CodeName"; this.cbx_Size.ValueMember = "Code"; access.Run_SqlText("select * from V_ProcessAll", ref dt); this.cbx_WProcedure.DataSource = dt; this.cbx_WProcedure.DisplayMember = "CodeName"; this.cbx_WProcedure.ValueMember = "Code"; this.tbx_Amount.Text = ""; this.mt = new MbTask(); DataSet todayWork = WorkPlan.GetTodayWork(this.dtp_WorkDay.Value); this.Lvw_MbTask.Items.Clear(); for (int i = 0; i < todayWork.Tables[0].Rows.Count; i++) { ListViewItem item = new ListViewItem { Checked = this.cbx_SelectAll.Checked, ImageKey = "MBoard", Text = todayWork.Tables[0].Rows[i]["workplanid"].ToString() }; item.SubItems.Add(todayWork.Tables[0].Rows[i]["Worker"].ToString()); item.SubItems.Add(todayWork.Tables[0].Rows[i]["Process"].ToString()); item.SubItems.Add(todayWork.Tables[0].Rows[i]["WorkLoad"].ToString()); item.SubItems.Add(todayWork.Tables[0].Rows[i]["WorkDay"].ToString()); item.SubItems.Add(todayWork.Tables[0].Rows[i]["Remark"].ToString()); item.SubItems.Add(todayWork.Tables[0].Rows[i]["MakePersonName"].ToString()); item.SubItems.Add(todayWork.Tables[0].Rows[i]["MakeTime"].ToString()); this.Lvw_MbTask.Items.Add(item); } this.listVwWorkers.Items.Clear(); todayWork = new Sql2KDataAccess().Run_SqlText("SELECT * FROM T_Attendance WHERE (DATEDIFF([day], ArriveTime, GETDATE()) = 0) AND (LeaveTime IS NULL)"); if (todayWork != null) { for (int j = 0; j < todayWork.Tables[0].Rows.Count; j++) { this.listVwWorkers.Items.Add(todayWork.Tables[0].Rows[j]["personid"].ToString()); } this.labelWorker.Text = "当前" + todayWork.Tables[0].Rows.Count.ToString() + "人"; } }
private void Frm_Data_Load(object sender, EventArgs e) { User user = new User(); DataSet allUser = user.GetAllUser(); this.Lvw_User.Items.Clear(); this.lbx_User.Items.Clear(); for (int i = 0; i < allUser.Tables[0].Rows.Count; i++) { ListViewItem item = new ListViewItem { Text = allUser.Tables[0].Rows[i]["UserName"].ToString() }; item.SubItems.Add(allUser.Tables[0].Rows[i]["TrueName"].ToString()); item.SubItems.Add(allUser.Tables[0].Rows[i]["Duty"].ToString()); item.SubItems.Add(allUser.Tables[0].Rows[i]["BarCode"].ToString()); this.Lvw_User.Items.Add(item); this.lbx_User.Items.Add(item.Text.Trim()); } allUser = user.GetAllAuthority(); this.lvw_Authority.Items.Clear(); for (int j = 0; j < allUser.Tables[0].Rows.Count; j++) { ListViewItem item2 = new ListViewItem { Text = allUser.Tables[0].Rows[j]["CodeName"].ToString(), Tag = allUser.Tables[0].Rows[j]["Code"].ToString() }; this.lvw_Authority.Items.Add(item2); } foreach (string str in PrinterSettings.InstalledPrinters) { this.cbx_SendListPrinter.Items.Add(str); this.cbx_SendPrinter.Items.Add(str); } this.cbx_SendPrinter.Text = Invoice.GetSendPrinter(); this.cbx_SendListPrinter.Text = Invoice.GetSendListPrinter(); this.tbx_UName.Text = User.UserName; if (!User.IsHaveAuthority("用户管理")) { this.tabControl.TabPages.Remove(this.tabPage1); } if (!User.IsHaveAuthority("权限设定")) { this.tabControl.TabPages.Remove(this.tabPage2); } if (!User.IsHaveAuthority("修改密码")) { this.tabControl.TabPages.Remove(this.tabPage3); } if (!User.IsHaveAuthority("选项设置")) { this.tabControl.TabPages.Remove(this.tabPage4); } MbTask task = new MbTask(); this.tbx_BoxAmount.Text = task.GetBoxCapability().ToString(); }
private void btn_PrintBarCode_Click(object sender, EventArgs e) { int boxCapability = new MbTask().GetBoxCapability(); try { foreach (ListViewItem item in this.Lvw_MbTask.CheckedItems) { PanBarCode[] codeArray; if (item.SubItems[2].Text.ToString().Trim() != "清洗烘干") { MessageBox.Show("只有清洗烘干工序可以打印条形码", "底板任务管理", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } int num2 = ((int.Parse(item.SubItems[3].Text.ToString()) % boxCapability) == 0) ? (int.Parse(item.SubItems[3].Text.ToString()) / boxCapability) : ((int.Parse(item.SubItems[3].Text.ToString()) / boxCapability) + 1); string queryStr = "select * from t_pantaskinfo where left(pantaskid,12)='" + item.Text + "'"; DataSet set = new Sql2KDataAccess().Run_SqlText(queryStr); if ((set != null) && (set.Tables[0].Rows.Count > 0)) { codeArray = new PanBarCode[set.Tables[0].Rows.Count]; for (int i = 0; i < set.Tables[0].Rows.Count; i++) { codeArray[i].strCount = set.Tables[0].Rows[i]["pancount"].ToString(); codeArray[i].strTaskID = set.Tables[0].Rows[i]["pantaskid"].ToString(); codeArray[i].strPanType = item.SubItems[1].Text; } } else { codeArray = new PanBarCode[0]; } new Print().LabelPrintTaskPan(codeArray); } } catch (Exception exception) { MessageBox.Show("打印条形码时发生错误\n" + exception.Message, "底板任务管理", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }