河南省建设厅官方网站 吴浩/关键词优化的技巧
条码打印基于:BarTender、ORM EF架构
UI展示:
主页代码:
using NPOI.OpenXmlFormats.Spreadsheet;
using ServerSide.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;namespace PlantProcessControlSystem.BarCodePrint
{//tss_nowdatepublic partial class Main_BarCodePrint_Frm : Form{private System.Windows.Forms.Timer timer;//1.声明自适应类实例 private AutoSizeFormClass asc = null;private AutoSetControlSize ass = null;public Main_BarCodePrint_Frm(){InitializeComponent();ass = new AutoSetControlSize(this, this.Width, this.Height);}#region 窗体控件事件private void btn_Close_Click(object sender, EventArgs e){if (((Button)sender).Name == "btn_Close")//窗体关闭{//DialogResult result = MessageBox.Show("是否确认退出??","提醒",MessageBoxButtons.YesNo,MessageBoxIcon.Warning);//if (result == DialogResult.Yes)// Application.Exit();//else// return;//this.Hide();//隐藏//tlrm_Show.Enabled = true;//控件可使用Environment.Exit(0);//Application.Exit();}else if (((Button)sender).Name == "btn_WinMinSize")//窗体最小化{this.WindowState = FormWindowState.Minimized;}else if (((Button)sender).Name == "btn_WinMaxSize")//窗体最大化{if (this.WindowState == FormWindowState.Normal)this.WindowState = FormWindowState.Maximized;elsethis.WindowState = FormWindowState.Normal;}}#endregion#region 时间同步private void Timer_Tick(object sender, EventArgs e){tss_nowdate.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");}#endregion#region 窗体加载private void Main_BarCodePrint_Frm_Load(object sender, EventArgs e){timer = new System.Windows.Forms.Timer();timer.Interval = 1000;timer.Tick += Timer_Tick;timer.Enabled = true;}#endregion#region 窗体移动private Point mouseOff;//鼠标移动位置变量private bool leftFlag;//标签是否为左键private void Frm_MouseDown(object sender, MouseEventArgs e){if (e.Button == MouseButtons.Left){mouseOff = new Point(-e.X, -e.Y); //得到变量的值leftFlag = true; //点击左键按下时标注为true;}}private void Frm_MouseMove(object sender, MouseEventArgs e){if (leftFlag){Point mouseSet = Control.MousePosition;mouseSet.Offset(mouseOff.X, mouseOff.Y); //设置移动后的位置Location = mouseSet;}}private void Frm_MouseUp(object sender, MouseEventArgs e){if (leftFlag){leftFlag = false;//释放鼠标后标注为false;}}#endregion#region 移动鼠标private void MainFrm_Move(object sender, EventArgs e){// 获取当前鼠标的坐标Point cursorPosition = Cursor.Position;TS_X.Text = cursorPosition.X.ToString();TS_Y.Text = cursorPosition.Y.ToString();tss_State.Text = "当前状态:操作";}#endregion#region 装载窗体/// <summary>/// 装载窗体/// </summary>/// <param name="childFrom"></param>private void OpenForm(Form childFrom){//首先判断容器中是否有其他的窗体foreach (Control item in this.Panel_Winfrm.Controls){if (item is Form){((Form)item).Close();}}//嵌入新的窗体childFrom.TopLevel = false;//将子窗体设置成非顶级控件// childFrom.FormBorderStyle = FormBorderStyle.None;//去掉窗体边框(目前不需要了)childFrom.Parent = this.Panel_Winfrm;//设置窗体的容器childFrom.Dock = DockStyle.Fill;//随着容器大小自动调整窗体大小(目前可能没有效果)childFrom.Show();}#endregion#region 窗体自适应private void MainFrm_SizeChanged(object sender, EventArgs e){asc = new AutoSizeFormClass(this);asc.controlAutoSize(this);}private void MainFrm_Resize(object sender, EventArgs e){ass.setControls((this.Width) / ass.X, (this.Height) / ass.Y, this);}#endregion#region 树形菜单单击事件private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e){if (e.Node.Text == "配置.客户信息"){CfgClientInfoFrm cfgClientInfoFrm = new CfgClientInfoFrm();this.OpenForm(cfgClientInfoFrm);}else if (e.Node.Text == "配置.产品信息"){CfgProductInfoFrm cfgProductInfoFrm = new CfgProductInfoFrm();this.OpenForm(cfgProductInfoFrm);}else if (e.Node.Text == "配置.订单信息"){CfgOrderInfoFrm cfgOrderInfoFrm = new CfgOrderInfoFrm();this.OpenForm(cfgOrderInfoFrm);}else if (e.Node.Text == "配置.条码工序信息"){CfgBarCodeWkInfoFrm cfgBarCodeWkInfoFrm = new CfgBarCodeWkInfoFrm();this.OpenForm(cfgBarCodeWkInfoFrm);}else if ((e.Node.Text == "在线.条码打印")){OnLineBarCodePrintFrm onLineBarCodePrintFrm = new OnLineBarCodePrintFrm();this.OpenForm(onLineBarCodePrintFrm);}else if (e.Node.Text == "配置.打印模板"){CfgBarCodePrintTemplateFrm cfgBarCodePrintTemplateFrm = new CfgBarCodePrintTemplateFrm();this.OpenForm(cfgBarCodePrintTemplateFrm);}else if (e.Node.Text == "配置.条码打印参数"){CfgBarCodePrintInfoFrm cfgBarCodePrintInfoFrm = new CfgBarCodePrintInfoFrm();cfgBarCodePrintInfoFrm.callBack += new Action<bool>((b) =>{if (b == false) this.Hide();else this.Show();});this.OpenForm((cfgBarCodePrintInfoFrm));}else if (e.Node.Text == "配置.动态字段"){CfgBarCodeInfoFrm cfgBarCodeInfoFrm = new CfgBarCodeInfoFrm();this.OpenForm(cfgBarCodeInfoFrm);}}#endregion}
}
using ServerSide.DAL;
using ServerSide.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;namespace PlantProcessControlSystem.BarCodePrint
{public partial class CfgBarCodeWkInfoFrm : Form{private List<Processinformation> processinformations;//工序信息private Processinformation oldProcessinformation;//旧的工序信息public string errInfo;//错误信息public CfgBarCodeWkInfoFrm(){InitializeComponent();}#region 初始化界面private void InitWinFrmTable(){using (EFContext db = new EFContext()){this.processinformations = new List<Processinformation>();this.processinformations = db!.Processinformation!.ToList();this.dataSource.DataSource = processinformations;txt_Process.Text = "";txt_Process.Enabled = false;}this.btn_Del.Enabled = false;this.btn_Rework.Enabled = false;this.dataSource.ClearSelection();}#endregion#region 返回private void btn_Result_Click(object sender, EventArgs e){this.InitWinFrmTable();this.pe_Processinfo.Visible = false;}#endregion#region 添加private void btn_Add_Click(object sender, EventArgs e){this.lbl_ItemName.Text = "添加";this.pe_Processinfo.Visible = true;this.btn_Del.Enabled = false;this.btn_Rework.Enabled = false;this.txt_Process.Text = "";this.oldProcessinformation = null;this.txt_Process.Enabled = true;}#endregion#region 删除private void btn_Del_Click(object sender, EventArgs e){this.pe_Processinfo.Visible = true;this.lbl_ItemName.Text = "删除";this.txt_Process.Enabled = false;this.btn_Save.Focus();}#endregion#region 修改private void btn_Rework_Click(object sender, EventArgs e){this.pe_Processinfo.Visible = true;this.lbl_ItemName.Text = "修改";this.txt_Process.Enabled = true;this.txt_Process.SelectAll();this.txt_Process.Focus();}#endregion#region 保存private void btn_Save_Click(object sender, EventArgs e){if (txt_Process.Text != string.Empty && txt_Process.Text.Length > 0){using (EFContext db = new EFContext()){if (lbl_ItemName.Text == "添加"){Processinformation processinformation = new Processinformation{PrsName = txt_Process.Text};db?.Processinformation?.Add(processinformation);}else if (lbl_ItemName.Text == "修改"){db!.Processinformation!.ToList().ForEach((p) =>{if (p.PrsInfoID == oldProcessinformation.PrsInfoID)p.PrsName = txt_Process.Text;});}else if (lbl_ItemName.Text == "删除"){db?.Processinformation?.Remove(oldProcessinformation);}int result = db!.SaveChanges();if (result <= 0)MessageBox.Show("数据保存失败!!", "系统提醒", MessageBoxButtons.OK, MessageBoxIcon.Error);}this.pe_Processinfo.Visible = false;this.InitWinFrmTable();}}#endregion#region 窗体加载private void CfgBarCodeWkInfoFrm_Load(object sender, EventArgs e){this.InitWinFrmTable();this.dataSource.ClearSelection();}#endregion#region 点击选择private void dataSource_CellClick(object sender, DataGridViewCellEventArgs e){try{if (e.RowIndex >= 0){if (processinformations[e.RowIndex] != null){this.oldProcessinformation = new Processinformation();this.oldProcessinformation = processinformations[e.RowIndex];this.btn_Del.Enabled = true;this.btn_Rework.Enabled = true;this.txt_Process.Text = processinformations[e.RowIndex].PrsName;}else{this.btn_Del.Enabled = false;this.btn_Rework.Enabled = false;}}this.pe_Processinfo.Visible = false;}catch (Exception ex){this.errInfo = string.Empty;MessageBox.Show($@"{ex.Message}", "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);}}#endregion}
}
using ServerSide.DAL;
using ServerSide.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;namespace PlantProcessControlSystem.BarCodePrint
{public partial class CfgProductInfoFrm : Form{private List<ProductNames> productNames;//产品名称private ProductNames oldproductName;private string ErrInfo;//错误信息public CfgProductInfoFrm(){InitializeComponent();}#region 初始化界面private void InitWinFrmTable(){using (EFContext db = new EFContext()){productNames = new List<ProductNames>();productNames = db!.ProductNames!.ToList();this.dataSource.DataSource = productNames;cmb_Client.Items.Clear();db!.ClientInfo!.ToList().ForEach((c) => cmb_Client.Items.Add(c.ClientName));txt_ProductName.Text = "";txt_ProductName.Enabled = false;cmb_Client.Enabled = true;}this.btn_Del.Enabled = false;this.btn_Rework.Enabled = false;this.dataSource.ClearSelection();}#endregion#region 窗体加载private void CfgProductInfoFrm_Load(object sender, EventArgs e){this.InitWinFrmTable();}#endregion#region 修改private void btn_Rework_Click(object sender, EventArgs e){this.pe_ProductInfo.Visible = true;this.lbl_ItemName.Text = "修改";this.txt_ProductName.SelectAll();this.txt_ProductName.Focus();}#endregion#region 册除private void btn_Del_Click(object sender, EventArgs e){this.pe_ProductInfo.Visible = true;this.lbl_ItemName.Text = "删除";this.txt_ProductName.Enabled = false;this.cmb_Client.Enabled = false;}#endregion#region 添加private void btn_Add_Click(object sender, EventArgs e){this.lbl_ItemName.Text = "添加";this.pe_ProductInfo.Visible = true;this.btn_Del.Enabled = false;this.btn_Rework.Enabled = false;this.txt_ProductName.Text = "";this.oldproductName = null;}#endregion#region 返回private void btn_Result_Click(object sender, EventArgs e){this.InitWinFrmTable();this.pe_ProductInfo.Visible = false;}#endregion#region 保存private void btn_Save_Click(object sender, EventArgs e){if (txt_ProductName.Text != string.Empty && txt_ProductName.Text.Length > 0){using (EFContext db = new EFContext()){if (lbl_ItemName.Text == "添加"){ProductNames productNames = new ProductNames{ClientId = db?.ClientInfo?.ToList()?.Where(c => c.ClientName == cmb_Client.Text)?.FirstOrDefault()?.ClientId,ProductName = txt_ProductName.Text};db?.ProductNames?.Add(productNames);}else if (lbl_ItemName.Text == "修改"){oldproductName.ProductName = txt_ProductName.Text;db?.ProductNames?.ToList().ForEach(p =>{if (p.ProductId == oldproductName.ProductId)p.ProductName = txt_ProductName.Text;});}else if (lbl_ItemName.Text == "删除"){db?.ProductNames?.Remove(oldproductName);}int result = db.SaveChanges();if (result <= 0) MessageBox.Show("数据保存失败!!", "系统提醒", MessageBoxButtons.OK, MessageBoxIcon.Error);}}this.pe_ProductInfo.Visible = false;this.InitWinFrmTable();}#endregion#region 选择客户名称private void cmb_Client_SelectedIndexChanged(object sender, EventArgs e){if (cmb_Client.Text != string.Empty){txt_ProductName.Enabled = true;txt_ProductName.Focus();}}#endregion#region 点击选择private void dataSource_CellClick(object sender, DataGridViewCellEventArgs e){try{if (e.RowIndex >= 0){if (productNames[e.RowIndex] != null){//txt_UserName.Text = allAuthorizedUsers[e.RowIndex].UserName;//txt_NickName.Text = allAuthorizedUsers[e.RowIndex].NickName;//pte_Image.Image = ImageHelper.ByteToImage(allAuthorizedUsers[e.RowIndex].Picture);//pnl_Edit.Visible = true;using (EFContext db = new EFContext()){this.cmb_Client.Text = db?.ClientInfo?.ToList()?.Where(c => c?.ClientId == productNames[e.RowIndex]?.ClientId)?.FirstOrDefault()?.ClientName;}this.oldproductName = new ProductNames();this.oldproductName = productNames[e.RowIndex];this.btn_Del.Enabled = true;this.btn_Rework.Enabled = true;this.txt_ProductName.Text = productNames[e.RowIndex].ProductName;//this.btn_Query.Enabled = true;}else{this.btn_Del.Enabled = false;this.btn_Rework.Enabled = false;}}this.pe_ProductInfo.Visible = false;}catch (Exception ex){//LogHelper.Error("授权信息", ex);this.ErrInfo = string.Empty;MessageBox.Show($@"{ex.Message}", "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);//WMessageBox wMessageBox = new WMessageBox(ex.Message, Color.Red);}}#endregion}
}
using NPOI.OpenXmlFormats.Spreadsheet;
using ServerSide.DAL;
using ServerSide.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;namespace PlantProcessControlSystem.BarCodePrint
{public partial class CfgOrderInfoFrm : Form{private List<ConfigBarCodeOrderInfoEntity> configBarCodeOrderInfoEntities;//配置订单信息private ConfigBarCodeOrderInfoEntity oldconfigBarCodeOrderInfoEntity;//public string ErrInfo;//错误日志public CfgOrderInfoFrm(){InitializeComponent();this.InitWinFrmTable();}#region 初始化界面private void InitWinFrmTable(){using (EFContext db = new EFContext()){configBarCodeOrderInfoEntities = new List<ConfigBarCodeOrderInfoEntity>();db?.ConfigBarCodeOrderInfoEntity?.ToList().ForEach(c => configBarCodeOrderInfoEntities.Add(c));dtgv_dataSource.DataSource = configBarCodeOrderInfoEntities;//数据源cmb_ProductName.Text = "";//产品名称cmb_ProductName.Items.Clear();db?.ProductNames?.ToList().ForEach(p => cmb_ProductName.Items.Add(p.ProductName));txt_OrderNum.Text = "";//订单号txt_BoxNum.Text = "";//外箱序号txt_OrderTotal.Text = "";//订单总数cmb_Binding_Nbr.Text = "";//绑码数cmb_Binding_Nbr.Items.Clear();for (int i = 1; i <= 60; i++)cmb_Binding_Nbr.Items.Add(i.ToString());}btn_Del.Enabled = false;//删除btn_Rework.Enabled = false;//修改btn_Query.Enabled = false;//查询this.txt_OrderNum.Enabled = true;this.cmb_ProductName.Enabled = true;this.txt_BoxNum.Enabled = true;this.txt_OrderTotal.Enabled = true;this.cmb_Binding_Nbr.Enabled = true;pe_OrderInfo.Visible = false;}#endregion#region 添加private void btn_Add_Click(object sender, EventArgs e){this.lbl_ItemName.Text = "添加";this.btn_Del.Enabled = false;this.btn_Rework.Enabled = false;oldconfigBarCodeOrderInfoEntity = null;this.InitWinFrmTable();this.pe_OrderInfo.Visible = true;}#endregion#region 删除private void btn_Del_Click(object sender, EventArgs e){this.lbl_ItemName.Text = "删除";this.pe_OrderInfo.Visible = true;this.txt_OrderNum.Enabled = false;this.cmb_ProductName.Enabled = false;this.txt_BoxNum.Enabled = false;this.txt_OrderTotal.Enabled = false;this.cmb_Binding_Nbr.Enabled = false;}#endregion#region 修改private void btn_Rework_Click(object sender, EventArgs e){this.lbl_ItemName.Text = "修改";this.txt_OrderNum.Enabled = true;this.cmb_ProductName.Enabled = true;this.txt_BoxNum.Enabled = true;this.txt_OrderTotal.Enabled = true;this.cmb_Binding_Nbr.Enabled = true;this.pe_OrderInfo.Visible = true;}#endregion#region 保存private void btn_Save_Click(object sender, EventArgs e){using (EFContext db = new EFContext()){if (txt_BoxNum.Text != string.Empty &&txt_OrderNum.Text != string.Empty &&txt_OrderTotal.Text != string.Empty &&cmb_Binding_Nbr.Text != string.Empty &&cmb_ProductName.Text != string.Empty){if (this.lbl_ItemName.Text == "添加"){oldconfigBarCodeOrderInfoEntity = new ConfigBarCodeOrderInfoEntity{OrderInfo = txt_OrderNum.Text.Trim(),ProductId = db?.ProductNames?.ToList()?.Where(p => p.ProductName == cmb_ProductName.Text)?.FirstOrDefault()?.ProductId,OrderCount = Convert.ToInt32(txt_OrderTotal.Text.Trim()),CartonSerialNumber = txt_BoxNum?.Text.Trim(),PackingBindingCode = Convert.ToInt32(cmb_Binding_Nbr.Text.Trim()),FuselageScanCount = 0,GiftBoxScanCount = 0,MasterCartonScanCount = 0};db?.ConfigBarCodeOrderInfoEntity?.Add(oldconfigBarCodeOrderInfoEntity);}else if (this.lbl_ItemName.Text == "修改"){db?.ConfigBarCodeOrderInfoEntity?.ToList().ForEach((c) =>{if (c.WorkOrderId == oldconfigBarCodeOrderInfoEntity.WorkOrderId){c.OrderInfo = txt_OrderNum.Text.Trim();c.ProductId = db?.ProductNames?.ToList()?.Where(p => p?.ProductName?.Trim() == cmb_ProductName.Text.Trim())?.FirstOrDefault()?.ProductId;c.OrderCount = Convert.ToInt32(txt_OrderTotal.Text.Trim());c.CartonSerialNumber = txt_BoxNum?.Text.Trim();c.PackingBindingCode = Convert.ToInt32(cmb_Binding_Nbr?.Text.Trim());}});}else if (this.lbl_ItemName.Text == "删除"){db?.ConfigBarCodeOrderInfoEntity?.Remove(oldconfigBarCodeOrderInfoEntity);}int result = db!.SaveChanges();if (result <= 0) MessageBox.Show("数据保存失败!!", "系统提醒", MessageBoxButtons.OK, MessageBoxIcon.Error);this.pe_OrderInfo.Visible = false;this.InitWinFrmTable();//初始化界面}}}#endregion#region 表单选择private void dtgv_dataSource_CellClick(object sender, DataGridViewCellEventArgs e){try{if (e.RowIndex >= 0){if (configBarCodeOrderInfoEntities[e.RowIndex] != null){this.oldconfigBarCodeOrderInfoEntity = new ConfigBarCodeOrderInfoEntity();this.oldconfigBarCodeOrderInfoEntity.WorkOrderId = configBarCodeOrderInfoEntities[e.RowIndex].WorkOrderId;this.oldconfigBarCodeOrderInfoEntity.ProductId = configBarCodeOrderInfoEntities[e.RowIndex].ProductId;this.oldconfigBarCodeOrderInfoEntity.OrderInfo = configBarCodeOrderInfoEntities[e.RowIndex].OrderInfo;this.oldconfigBarCodeOrderInfoEntity.CartonSerialNumber = configBarCodeOrderInfoEntities[e.RowIndex].CartonSerialNumber;this.oldconfigBarCodeOrderInfoEntity.OrderCount = configBarCodeOrderInfoEntities[e.RowIndex].OrderCount;this.oldconfigBarCodeOrderInfoEntity.FuselageScanCount = configBarCodeOrderInfoEntities[e.RowIndex].FuselageScanCount;this.oldconfigBarCodeOrderInfoEntity.GiftBoxScanCount = configBarCodeOrderInfoEntities[e.RowIndex].GiftBoxScanCount;this.oldconfigBarCodeOrderInfoEntity.MasterCartonScanCount = configBarCodeOrderInfoEntities[e.RowIndex].MasterCartonScanCount;this.oldconfigBarCodeOrderInfoEntity.PackingBindingCode = configBarCodeOrderInfoEntities[e.RowIndex].PackingBindingCode;this.txt_OrderNum.Text = configBarCodeOrderInfoEntities[e.RowIndex].OrderInfo;//订单数this.txt_OrderTotal.Text = configBarCodeOrderInfoEntities[e.RowIndex].OrderCount.ToString();//订单总数using (EFContext db = new EFContext()){this.cmb_ProductName.Text = db?.ProductNames?.ToList()?.Where(p => p.ProductId == configBarCodeOrderInfoEntities[e.RowIndex].ProductId)?.FirstOrDefault()?.ProductName;//产品名称}this.txt_BoxNum.Text = configBarCodeOrderInfoEntities[e.RowIndex].CartonSerialNumber;//外箱//this.txt_OrderTotal.Text = configBarCodeOrderInfoEntities[e.RowIndex].OrderCount.ToString();//订单总数this.cmb_Binding_Nbr.Text = configBarCodeOrderInfoEntities[e.RowIndex].PackingBindingCode.ToString();//绑码数}}this.pe_OrderInfo.Visible = false;btn_Del.Enabled = e.RowIndex >= 0 ? true : false;btn_Rework.Enabled = e.RowIndex >= 0 ? true : false;}catch (Exception ex){this.ErrInfo = $@"{ex.Message}";MessageBox.Show($@"{ex.Message}", "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);}}#endregion#region 返回private void btn_Result_Click(object sender, EventArgs e){this.pe_OrderInfo.Visible = false;this.InitWinFrmTable();}#endregion}
}
using ServerSide.DAL;
using ServerSide.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;namespace PlantProcessControlSystem.BarCodePrint
{public partial class CfgBarCodeWkInfoFrm : Form{private List<Processinformation> processinformations;//工序信息private Processinformation oldProcessinformation;//旧的工序信息public string errInfo;//错误信息public CfgBarCodeWkInfoFrm(){InitializeComponent();}#region 初始化界面private void InitWinFrmTable(){using (EFContext db = new EFContext()){this.processinformations = new List<Processinformation>();this.processinformations = db!.Processinformation!.ToList();this.dataSource.DataSource = processinformations;txt_Process.Text = "";txt_Process.Enabled = false;}this.btn_Del.Enabled = false;this.btn_Rework.Enabled = false;this.dataSource.ClearSelection();}#endregion#region 返回private void btn_Result_Click(object sender, EventArgs e){this.InitWinFrmTable();this.pe_Processinfo.Visible = false;}#endregion#region 添加private void btn_Add_Click(object sender, EventArgs e){this.lbl_ItemName.Text = "添加";this.pe_Processinfo.Visible = true;this.btn_Del.Enabled = false;this.btn_Rework.Enabled = false;this.txt_Process.Text = "";this.oldProcessinformation = null;this.txt_Process.Enabled = true;}#endregion#region 删除private void btn_Del_Click(object sender, EventArgs e){this.pe_Processinfo.Visible = true;this.lbl_ItemName.Text = "删除";this.txt_Process.Enabled = false;this.btn_Save.Focus();}#endregion#region 修改private void btn_Rework_Click(object sender, EventArgs e){this.pe_Processinfo.Visible = true;this.lbl_ItemName.Text = "修改";this.txt_Process.Enabled = true;this.txt_Process.SelectAll();this.txt_Process.Focus();}#endregion#region 保存private void btn_Save_Click(object sender, EventArgs e){if (txt_Process.Text != string.Empty && txt_Process.Text.Length > 0){using (EFContext db = new EFContext()){if (lbl_ItemName.Text == "添加"){Processinformation processinformation = new Processinformation{PrsName = txt_Process.Text};db?.Processinformation?.Add(processinformation);}else if (lbl_ItemName.Text == "修改"){db!.Processinformation!.ToList().ForEach((p) =>{if (p.PrsInfoID == oldProcessinformation.PrsInfoID)p.PrsName = txt_Process.Text;});}else if (lbl_ItemName.Text == "删除"){db?.Processinformation?.Remove(oldProcessinformation);}int result = db!.SaveChanges();if (result <= 0)MessageBox.Show("数据保存失败!!", "系统提醒", MessageBoxButtons.OK, MessageBoxIcon.Error);}this.pe_Processinfo.Visible = false;this.InitWinFrmTable();}}#endregion#region 窗体加载private void CfgBarCodeWkInfoFrm_Load(object sender, EventArgs e){this.InitWinFrmTable();this.dataSource.ClearSelection();}#endregion#region 点击选择private void dataSource_CellClick(object sender, DataGridViewCellEventArgs e){try{if (e.RowIndex >= 0){if (processinformations[e.RowIndex] != null){this.oldProcessinformation = new Processinformation();this.oldProcessinformation = processinformations[e.RowIndex];this.btn_Del.Enabled = true;this.btn_Rework.Enabled = true;this.txt_Process.Text = processinformations[e.RowIndex].PrsName;}else{this.btn_Del.Enabled = false;this.btn_Rework.Enabled = false;}}this.pe_Processinfo.Visible = false;}catch (Exception ex){this.errInfo = string.Empty;MessageBox.Show($@"{ex.Message}", "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);}}#endregion}
}
using ServerSide.DAL;
using ServerSide.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;namespace PlantProcessControlSystem.BarCodePrint
{public partial class CfgBarCodeInfoFrm : Form{private List<ConfigBarCodeInfoEntity> configBarCodeInfoEntitys;//配置动态字段信息private ConfigBarCodeInfoEntity oldConfigBarCodeInfoEntity;//旧的配置动态字段信息public string errInfo;//错误信息public CfgBarCodeInfoFrm(){InitializeComponent();}#region 初始化界面private void InitWinFrmTable(){using (EFContext db = new EFContext()){this.configBarCodeInfoEntitys = new List<ConfigBarCodeInfoEntity>();this.configBarCodeInfoEntitys = db!.ConfigBarCodeInfoEntity!.ToList();this.dataSource.DataSource = this.configBarCodeInfoEntitys;txt_Process.Text = "";txt_Process.Enabled = false;txt_Description.Text = "";txt_Description.Enabled = false;}this.btn_Del.Enabled = false;this.btn_Rework.Enabled = false;this.dataSource.ClearSelection();}#endregion#region 返回private void btn_Result_Click(object sender, EventArgs e){this.InitWinFrmTable();this.pe_Processinfo.Visible = false;}#endregion#region 添加private void btn_Add_Click(object sender, EventArgs e){this.lbl_ItemName.Text = "添加";this.pe_Processinfo.Visible = true;this.btn_Del.Enabled = false;this.btn_Rework.Enabled = false;this.txt_Process.Text = "";this.oldConfigBarCodeInfoEntity = null;this.txt_Process.Enabled = true;this.txt_Description.Enabled = true;}#endregion#region 删除private void btn_Del_Click(object sender, EventArgs e){this.pe_Processinfo.Visible = true;this.lbl_ItemName.Text = "删除";this.txt_Process.Enabled = false;this.txt_Description.Enabled = false;this.btn_Save.Focus();}#endregion#region 修改private void btn_Rework_Click(object sender, EventArgs e){this.pe_Processinfo.Visible = true;this.lbl_ItemName.Text = "修改";this.txt_Process.Enabled = true;this.txt_Description.Enabled = true;this.txt_Process.SelectAll();this.txt_Process.Focus();}#endregion#region 保存private void btn_Save_Click(object sender, EventArgs e){if ((txt_Process.Text != string.Empty && txt_Process.Text.Length > 0)&&(txt_Description.Text!=string.Empty&&txt_Description.Text.Length>0)){using (EFContext db = new EFContext()){if (lbl_ItemName.Text == "添加"){ConfigBarCodeInfoEntity configBarCodeInfoEntity = new ConfigBarCodeInfoEntity{ConfigBarCodeName = txt_Process.Text,ConfigDescription=txt_Description.Text};db?.ConfigBarCodeInfoEntity?.Add(configBarCodeInfoEntity);}else if (lbl_ItemName.Text == "修改"){db!.ConfigBarCodeInfoEntity!.ToList().ForEach((p) =>{if (p.cfBarCodeID == oldConfigBarCodeInfoEntity.cfBarCodeID){p.ConfigBarCodeName = txt_Process.Text;p.ConfigDescription=txt_Description.Text;} });}else if (lbl_ItemName.Text == "删除"){db?.ConfigBarCodeInfoEntity?.Remove(oldConfigBarCodeInfoEntity);}int result = db!.SaveChanges();if (result <= 0)MessageBox.Show("数据保存失败!!", "系统提醒", MessageBoxButtons.OK, MessageBoxIcon.Error);}this.pe_Processinfo.Visible = false;this.InitWinFrmTable();}}#endregion#region 窗体加载private void CfgBarCodeWkInfoFrm_Load(object sender, EventArgs e){this.InitWinFrmTable();this.dataSource.ClearSelection();}#endregion#region 点击选择private void dataSource_CellClick(object sender, DataGridViewCellEventArgs e){try{if (e.RowIndex >= 0){if (configBarCodeInfoEntitys[e.RowIndex] != null){this.oldConfigBarCodeInfoEntity = new ConfigBarCodeInfoEntity();this.oldConfigBarCodeInfoEntity = configBarCodeInfoEntitys[e.RowIndex];this.btn_Del.Enabled = true;this.btn_Rework.Enabled = true;this.txt_Process.Text = configBarCodeInfoEntitys[e.RowIndex].ConfigBarCodeName;this.txt_Description.Text = configBarCodeInfoEntitys[e.RowIndex].ConfigDescription;}else{this.btn_Del.Enabled = false;this.btn_Rework.Enabled = false;}}this.pe_Processinfo.Visible = false;}catch (Exception ex){this.errInfo = string.Empty;MessageBox.Show($@"{ex.Message}", "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);}}#endregion}
}
using NPOI.SS.Formula.Functions;
using Org.BouncyCastle.Tls.Crypto;
using ServerSide.Common;
using ServerSide.DAL;
using ServerSide.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;namespace PlantProcessControlSystem
{public partial class CfgBarCodePrintTemplateFrm : Form{private List<ConfigBarCodePrintTemplate> configBarCodePrintTemplates;//斑码打印模板配置private ConfigBarCodePrintTemplate oldconfigBarCodePrintTemplate;//旧的模板配置信息public string errInfo;//错误日志public CfgBarCodePrintTemplateFrm(){InitializeComponent();this.InitWinFrmTable();}#region 初始化界面private void InitWinFrmTable(){using (EFContext db = new EFContext()){configBarCodePrintTemplates = new List<ConfigBarCodePrintTemplate>();configBarCodePrintTemplates = db!.ConfigBarCodePrintTemplate!.ToList();this.dataSource.DataSource = configBarCodePrintTemplates;//客户信息this.cmb_Client.Items.Clear();db!.ClientInfo!.ToList()!.ForEach((c) =>{cmb_Client.Items.Add(c.ClientName);});this.cmb_Client.Text = "";this.cmb_Client.Enabled = true;//工序信息this.cmb_Processinformation.Items.Clear();db!.Processinformation!.ToList()!.ForEach(p =>{this.cmb_Processinformation.Items.Add(p.PrsName);});this.cmb_Processinformation.Text = "";this.cmb_Processinformation.Enabled = true;}//this.gb_PrintModel.Visible = false;this.txt_PrintTemplateDownPath.Text = "";this.txt_TemplateName.Text = "";this.btn_Del.Enabled = false;this.btn_Rework.Enabled = false;this.dataSource.ClearSelection();this.panel_Edit.Visible = false;templateName = string.Empty;}#endregion#region 选择文档//private List<FileServiceEntity> fileServiceModels;private FileProcesService fProcesService;private string selectFileName;//选择文件名称private void btn_Example_Click(object sender, EventArgs e){selectFileName = string.Empty;this.txt_PrintTemplateDownPath.Text = "";fProcesService = new FileProcesService();fProcesService.SelectFile(out selectFileName, "所有文件(*.btw) | *.btw");string[] arrayStr = selectFileName.Split('\\');if (this.UploadFile(selectFileName, arrayStr[arrayStr.Length - 1]))//上传模板{txt_PrintTemplateDownPath.Text = templateName;//上传模板文件全路径txt_TemplateName.Text = arrayStr[arrayStr.Length - 1];//上传模板名称}}#endregion#region 返回private void btn_Result_Click(object sender, EventArgs e){this.panel_Edit.Visible = false;this.InitWinFrmTable();}#endregion#region 添加private void btn_Add_Click(object sender, EventArgs e){this.lbl_ItemName.Text = "添加";this.btn_Del.Enabled = false;this.btn_Rework.Enabled = false;this.InitWinFrmTable();this.panel_Edit.Visible = true;}#endregion#region 删除private void btn_Del_Click(object sender, EventArgs e){this.lbl_ItemName.Text = "删除";this.panel_Edit.Visible = true;this.cmb_Client.Enabled = false;this.txt_PrintTemplateDownPath.Enabled = false;this.txt_TemplateName.Enabled = false;this.cmb_Processinformation.Enabled = false;}#endregion#region 修改private void btn_Rework_Click(object sender, EventArgs e){this.lbl_ItemName.Text = "修改";//this.txt_TemplateName.Enabled = true;//this.txt_PrintTemplateDownPath.Enabled = true;this.cmb_Client.Enabled = true;//this.InitWinFrmTable();this.panel_Edit.Visible = true;}#endregion#region 表单点击事件private void dataSource_CellClick(object sender, DataGridViewCellEventArgs e){try{if (e.RowIndex >= 0){if (configBarCodePrintTemplates[e.RowIndex] != null){this.oldconfigBarCodePrintTemplate = new ConfigBarCodePrintTemplate();this.oldconfigBarCodePrintTemplate = configBarCodePrintTemplates[e.RowIndex];this.btn_Del.Enabled = true;this.btn_Rework.Enabled = true;using (EFContext db = new EFContext()){this.cmb_Client.Text = db?.ClientInfo?.ToList()?.Where(c => c.ClientId == configBarCodePrintTemplates[e.RowIndex].ClientId)?.FirstOrDefault()?.ClientName;this.cmb_Processinformation.Text = db?.Processinformation?.ToList()?.Where(p => p.PrsInfoID == this.oldconfigBarCodePrintTemplate.PrsInfoID)?.FirstOrDefault()?.PrsName;}this.txt_TemplateName.Text = this.oldconfigBarCodePrintTemplate.TempateName;//打印模板名称this.txt_PrintTemplateDownPath.Text = this.oldconfigBarCodePrintTemplate.TempateDownPath;//打印模板下载路径}else{this.btn_Del.Enabled = false;this.btn_Rework.Enabled = false;}}}catch (Exception ex){this.errInfo = string.Empty;MessageBox.Show($@"{ex.Message}", "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);}}#endregion#region 保存private void btn_Save_Click(object sender, EventArgs e){if (cmb_Client.Text != string.Empty &&txt_TemplateName.Text != string.Empty &&txt_PrintTemplateDownPath.Text != string.Empty &&cmb_Processinformation.Text != string.Empty){using (EFContext db = new EFContext()){if (lbl_ItemName.Text == "添加"){ConfigBarCodePrintTemplate cfgbptemplate = new ConfigBarCodePrintTemplate{ClientId = db?.ClientInfo?.ToList().Where(c => c.ClientName == cmb_Client.Text)?.FirstOrDefault()?.ClientId,PrsInfoID = db?.Processinformation?.ToList().Where(p => p.PrsName == cmb_Processinformation.Text.Trim())?.FirstOrDefault()?.PrsInfoID,TempateDownPath = txt_PrintTemplateDownPath.Text.Trim(),TempateName = txt_TemplateName.Text.Trim()};db?.ConfigBarCodePrintTemplate?.Add(cfgbptemplate);}else if (lbl_ItemName.Text == "修改"){db?.ConfigBarCodePrintTemplate?.ToList().ForEach(c =>{if (c.BarCodePrintId == oldconfigBarCodePrintTemplate.BarCodePrintId){c.ClientId = db?.ClientInfo?.ToList()?.Where(c => c.ClientName == cmb_Client.Text)?.FirstOrDefault()?.ClientId;//客户c.TempateDownPath = txt_PrintTemplateDownPath.Text.Trim();c.TempateName = txt_TemplateName.Text.Trim();}});}else if (lbl_ItemName.Text == "删除"){db?.ConfigBarCodePrintTemplate?.Remove(oldconfigBarCodePrintTemplate);}int result = db!.SaveChanges();if (result <= 0)MessageBox.Show("数据保存失败!!", "系统提醒", MessageBoxButtons.OK, MessageBoxIcon.Error);}this.panel_Edit.Visible = false;this.InitWinFrmTable();//初始化界面}}#endregion#region 上传日志/// <summary>/// 上传日志信息/// </summary>/// <param name=""></param>/// <param name="uploadFilePath">上传文件路径</param>/// <param name="fileName">上传文件名及路径</param>/// <returns></returns>public bool UploadLog(string uploadFilePath, string fileName, string processFile,bool isLogPass=false){try{if(uploadFilePath!=string.Empty&&fileName!=string.Empty){string networkPath = string.Empty;if (!File.Exists(@"\\10.2.2.163\Data\PASS.OK")){NetworkShareConnect mess = new NetworkShareConnect();if (mess.connectToShare(networkPath, "test", "Admin123") != "OK"){MessageBox.Show($@"{networkPath}:服务器连接失败", "系统提醒", MessageBoxButtons.OK, MessageBoxIcon.Error);return false;}}if (isLogPass)//是PASS{if (!Directory.Exists($@"\\10.2.2.163\data\LOG\PASS\{processFile}\{DateTime.Now.ToString("yyyyMMdd")}"))Directory.CreateDirectory($@"\\10.2.2.163\data\LOG\{processFile}\PASS\{DateTime.Now.ToString("yyyyMMdd")}");//创建文件夹System.IO.File.Copy(uploadFilePath, $@"\\10.2.2.163\data\LOG\{processFile}\PASS\{DateTime.Now.ToString("yyyyMMdd")}\{fileName}_{DateTime.Now.ToString("yyyyMMddHHmmss")}.log");if (System.IO.File.Exists($@"\\10.2.2.163\data\LOG\{processFile}\PASS\{DateTime.Now.ToString("yyyyMMdd")}\{fileName}_{DateTime.Now.ToString("yyyyMMddHHmmss")}.log"))return true;}else if (!isLogPass)//是FAIL{if (!Directory.Exists($@"\\10.2.2.163\data\LOG\{processFile}\FAIL\{DateTime.Now.ToString("yyyyMMdd")}"))Directory.CreateDirectory($@"\\10.2.2.163\data\LOG\{processFile}\FAIL\{DateTime.Now.ToString("yyyyMMdd")}");//创建文件夹System.IO.File.Copy(uploadFilePath, $@"\\10.2.2.163\data\LOG\{processFile}\FAIL\{DateTime.Now.ToString("yyyyMMdd")}\{fileName}_{DateTime.Now.ToString("yyyyMMddHHmmss")}.FA");if (System.IO.File.Exists($@"\\10.2.2.163\data\LOG\{processFile}\FAIL\{DateTime.Now.ToString("yyyyMMdd")}\{fileName}_{DateTime.Now.ToString("yyyyMMddHHmmss")}.FA"))return true;}}}catch(Exception ex){MessageBox.Show(ex.Message, "系统提醒", MessageBoxButtons.OK, MessageBoxIcon.Error);return false;}return false;}#endregion#region 上传模板private string templateName = string.Empty;private bool UploadFile(string uploadFilePath, string fileName){try{if (uploadFilePath != string.Empty){string networkPath = string.Empty;//networkPath = $@"\\10.2.2.163\BarCode\{cmb_Processinformation.Text}\{fileName}";networkPath = $@"\\10.2.2.163\BarCode\{cmb_Processinformation.Text}";if (!File.Exists(@"\\10.2.2.163\Data\PASS.OK")){NetworkShareConnect mess = new NetworkShareConnect();if (mess.connectToShare(networkPath, "test", "Admin123") != "OK"){MessageBox.Show($@"{networkPath}:服务器连接失败", "系统提醒", MessageBoxButtons.OK, MessageBoxIcon.Error);return false;}}if (System.IO.File.Exists($@"\\10.2.2.163\BarCode\{cmb_Processinformation.Text}\{fileName}"))System.IO.File.Delete($@"\\10.2.2.163\BarCode\{cmb_Processinformation.Text}\{fileName}");if (System.IO.File.Exists($@"\\10.2.2.163\BarCode\{cmb_Processinformation.Text}\{fileName}")){MessageBox.Show($"打印模板:{fileName}名称在服务器中已存在", "系统提醒", MessageBoxButtons.OK, MessageBoxIcon.Error);return false;}else{//MessageBox.Show(txt_PrintModelSample.Text);//MessageBox.Show(networkPath);System.IO.File.Copy(uploadFilePath, $@"\\10.2.2.163\BarCode\{cmb_Processinformation.Text}\{fileName}");if (System.IO.File.Exists($@"\\10.2.2.163\BarCode\{cmb_Processinformation.Text}\{fileName}") == true){templateName = $@"\\10.2.2.163\BarCode\{cmb_Processinformation.Text}\{fileName}";return true;}else{MessageBox.Show($"打印模板:{fileName}上传服务器失败", "系统提醒", MessageBoxButtons.OK, MessageBoxIcon.Error);return false;}}}}catch (Exception ex){MessageBox.Show(ex.Message, "系统提醒", MessageBoxButtons.OK, MessageBoxIcon.Error);return false;}return false;}#endregion}
}
1.条码打印实现类
using ServerSide.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace ServerSide.Common
{public class BarTenderHelper{public event Action<string> callBack;private PrintConfigEntity pcEntity;private BarTender.Application btapp;//引用方法1private BarTender.Format btformat;//引用方法2public BarTenderHelper(PrintConfigEntity pcfEntity){this.pcEntity= pcfEntity;}#region 条码打印public Boolean BarTenderPrint(){try{this.btapp = new BarTender.Application();this.btformat = this.btapp.Formats.Open(this.pcEntity.PTemplate, false, "");//设置模板文件this.btformat.PrintSetup.NumberSerializedLabels = Convert.ToInt32(this.pcEntity.PCount);//设置打印份数this.pcEntity.ScanDt.ForEach((d) => {this.btformat.SetNamedSubStringValue(d.BarCodeName, d.BarCodeString);});this.btformat.PrintOut(true,Convert.ToBoolean(this.pcEntity.IsShowPrint));//打印提示this.btapp.Quit(BarTender.BtSaveOptions.btPromptSave);//退出并改变BarTender模板return true;}catch (Exception ex){this.callBack(ex.Message);return false;}}#endregion}
}
实体类:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace ServerSide.Models
{#region 配置动态字段信息public class ConfigBarCodeInfoEntity{/// <summary>/// 配置动态条码ID/// </summary>[Key][DatabaseGenerated(DatabaseGeneratedOption.Identity)] //自增public int ?cfBarCodeID { get; set; }/// <summary>/// 动态字段名称/// </summary>[Required]//不允许为空[StringLength(50)]public string? ConfigBarCodeName { get; set; }/// <summary>/// 项目描述/// </summary>[Required][StringLength(80)]public string? ConfigDescription { get; set; }public DateTime? CreateTim { get; set; } = DateTime.Now;//创建时间 }#endregion
}
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace ServerSide.Models
{/// <summary>/// 条码配置/// </summary>public class BarCodeCfig{/// <summary>/// 配置ID/// </summary>[Key][DatabaseGenerated(DatabaseGeneratedOption.Identity)] //自增public int ?CfigId { get; set; }/// <summary>/// 客户ID/// </summary>[ForeignKey("ClientId")]//设置导航属性//public ClientInfo? ClientInfo { get; set; }public int? ClientId { get; set; }//外键/// <summary>/// 产品ID/// </summary>[ForeignKey("ProductId")]//设置导航属性//public ProductNames? ProductNames { get; set; }public int? ProductId { get; set; }//外键/// <summary>/// 订单ID/// </summary>[ForeignKey("WorkOrderId")]//设置导航属性//public ProductNames? ProductNames { get; set; }public int? WorkOrderId { get; set; }//外键/// <summary>/// 工序ID/// </summary>[ForeignKey("PrsInfoID")]//设置导航属性//public Processinformation? Processinformation { get; set; }public int? PrsInfoID { get; set; }//外键/// <summary>/// 配置打印模板ID/// </summary>[Required]//不允许为空[ForeignKey("BarCodePrintId")]//打印模板ID//public ConfigBarCodeInfoEntity? ConfigBarCodeInfoEntity { get; set; }public int? BarCodePrintId { get; set; }//外键/// <summary>/// 配置参数值/// </summary>[StringLength(255)]public string? CfgArgsValue { get; set; }public DateTime? CreateTim { get; set; } = DateTime.Now;//创建时间}
}
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace ServerSide.Models
{/// <summary>/// 配置打印模板/// </summary>public class ConfigBarCodePrintTemplate{/// <summary>/// 打印模板ID/// </summary>[Key][DatabaseGenerated(DatabaseGeneratedOption.Identity)] //自增public int BarCodePrintId { get; set; }/// <summary>/// 客户ID/// </summary>[ForeignKey("ClientId")]//设置导航属性//public ClientInfo? ClientInfo { get; set; }public int? ClientId { get; set; }//外键/// <summary>/// 工序ID/// </summary>[ForeignKey("PrsInfoID")]//设置导航属性//public Processinformation? Processinformation { get; set; }public int? PrsInfoID { get; set; }//外键/// <summary>/// 模板名称/// </summary>[Required][StringLength(100)]public string? TempateName { get; set; }/// <summary>/// 模板下载路径/// </summary>[Required][StringLength(255)]public string? TempateDownPath { get; set; }}
}
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace ServerSide.Models
{/// <summary>/// 配置打印模板/// </summary>public class ConfigBarCodePrintTemplate{/// <summary>/// 打印模板ID/// </summary>[Key][DatabaseGenerated(DatabaseGeneratedOption.Identity)] //自增public int BarCodePrintId { get; set; }/// <summary>/// 客户ID/// </summary>[ForeignKey("ClientId")]//设置导航属性//public ClientInfo? ClientInfo { get; set; }public int? ClientId { get; set; }//外键/// <summary>/// 工序ID/// </summary>[ForeignKey("PrsInfoID")]//设置导航属性//public Processinformation? Processinformation { get; set; }public int? PrsInfoID { get; set; }//外键/// <summary>/// 模板名称/// </summary>[Required][StringLength(100)]public string? TempateName { get; set; }/// <summary>/// 模板下载路径/// </summary>[Required][StringLength(255)]public string? TempateDownPath { get; set; }}
}
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace ServerSide.Models
{/// <summary>/// 配置打印模板/// </summary>public class ConfigBarCodePrintTemplate{/// <summary>/// 打印模板ID/// </summary>[Key][DatabaseGenerated(DatabaseGeneratedOption.Identity)] //自增public int BarCodePrintId { get; set; }/// <summary>/// 客户ID/// </summary>[ForeignKey("ClientId")]//设置导航属性//public ClientInfo? ClientInfo { get; set; }public int? ClientId { get; set; }//外键/// <summary>/// 工序ID/// </summary>[ForeignKey("PrsInfoID")]//设置导航属性//public Processinformation? Processinformation { get; set; }public int? PrsInfoID { get; set; }//外键/// <summary>/// 模板名称/// </summary>[Required][StringLength(100)]public string? TempateName { get; set; }/// <summary>/// 模板下载路径/// </summary>[Required][StringLength(255)]public string? TempateDownPath { get; set; }}
}
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace ServerSide.Models
{#region 配置打印的订单信息public class ConfigBarCodeOrderInfoEntity{/// <summary>/// 订单ID/// </summary>[Key][DatabaseGenerated(DatabaseGeneratedOption.Identity)] //自增public int WorkOrderId { get; set; }/// <summary>/// 产品ID/// </summary>[ForeignKey("ProductId")]//设置导航属性//public ProductNames? ProductNames { get; set; }public int? ProductId { get; set; }//外键/// <summary>/// 订单号/// </summary>[Required][StringLength(150)]public string ?OrderInfo { get; set; }/// <summary>/// 订单总数/// </summary>[Required]public int? OrderCount { get; set; }/// <summary>/// 外箱序号/// </summary>[Required][StringLength(100)]public string ?CartonSerialNumber { get; set; }/// <summary>/// 机身扫描总数/// </summary>[Required]public int? FuselageScanCount { get; set; } = 0;/// <summary>/// 彩盒扫描总数/// </summary>[Required]public int? GiftBoxScanCount { get; set; } = 0;/// <summary>/// 外箱扫描总数/// </summary>[Required]public int? MasterCartonScanCount { get; set; } = 0;/// <summary>/// 装箱绑码数/// </summary>[Required]public int PackingBindingCode { get; set; } = 1;public DateTime? CreateTim { get; set; } = DateTime.Now;//创建时间}#endregion
}
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace ServerSide.Models
{/// <summary>/// 产品名称/// </summary>public class ProductNames{/// <summary>/// 产品ID/// </summary>[Key][DatabaseGenerated(DatabaseGeneratedOption.Identity)] //自增public int? ProductId { get; set; }/// <summary>/// 客户ID/// </summary>[ForeignKey("ClientId")]//设置导航属性//public ClientInfo? ClientInfo { get; set; }public int? ClientId { get; set; }//外键/// <summary>/// 产品名称/// </summary>[Required][StringLength(100)]public string? ProductName { get; set; }public DateTime? CreateTim { get; set; } = DateTime.Now;//创建时间}
}
相关文章:

c# .net6 在线条码打印基于
条码打印基于:BarTender、ORM EF架构 UI展示: 主页代码: using NPOI.OpenXmlFormats.Spreadsheet; using ServerSide.Models; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawi…...

Hive SQL的编译过程
1.MapReduce实现基本SQL操作的原理 详细讲解SQL编译为MapReduce之前,我们先来看看MapReduce框架实现SQL基本操作的原理 1.1 Join的实现原理 select u.name, o.orderid from order o join user u on o.uid = u.uid; 在map的输出value中为不同表的数据打上tag标记,在reduce阶段…...

[架构之路-245/创业之路-76]:目标系统 - 纵向分层 - 企业信息化的呈现形态:常见企业信息化软件系统 - 企业资源管理计划ERP
目录 前言: 一、企业信息化的结果:常见企业信息化软件 1.1 企业资源管理计划 1.1.1 什么是ERP:企业最常用的信息管理系统 1.1.2 ERP的演进过程 1.1.3 EPR模块 1.1.4 EPR五个层级 1.1.5 企业EPR业务总体流程图 1.1.6 什么类型的企业需…...

数据库简史:多主数据库架构的由来和华为参天引擎的机遇
注:本文发表后,收到了很多后台反馈,其中关于大型机的早期成就不容省略。微调重发本文,纯属个人观点,错谬之处,仍然期待指正。 2023年10月13日,在北京举办的“2023金融业数据库技术大会"上&…...

C语言每日一练(二)
单链表经典算法专题 一、 单链表相关经典算法OJ题1:移除链表元素 解法一:在原链表中删除Node.nextnext的节点 typedef struct ListNode ListNode; struct ListNode* removeElements( ListNode* head, int val) {ListNode* pcur head;ListNode* pre h…...

HashJoin 在 Apache Arrow 和PostgreSQL 中的实现
文章目录 背景PostgreSQL HashJoin实现PG 执行器架构HashJoin 基本流程HashJoin 实现细节Join 类型HashJoin 的划分阶段HashJoin 的分批处理阶段JOIN 类型的状态机转换HashJoin 的投影和过滤 Arrow Acero HashJoin实现Acero 基本框架HashJoin 基本流程 总结 背景 近两个月转到…...

FL Studio21.2.0.3421最新汉化破解版中文解锁下载完整版本
音乐在人们心中的地位日益增高,近几年音乐选秀的节目更是层出不穷,喜爱音乐,创作音乐的朋友们也是越来越多,音乐的类型有很多,好比古典,流行,摇滚等等。对新手友好程度基本上在首位,…...

docker在java项目中打成tar包
docker在java项目中打成tar包 1、首先安装一个docker desktop 2、mvn install项目后,建立一个自己的dockerfile 这里我以我的代码举例,from 镜像,这里你也能打包好一个镜像的基础上,from打好的镜像,这里我们用openj…...

No175.精选前端面试题,享受每天的挑战和学习
🤍 前端开发工程师(主业)、技术博主(副业)、已过CET6 🍨 阿珊和她的猫_CSDN个人主页 🕠 牛客高级专题作者、在牛客打造高质量专栏《前端面试必备》 🍚 蓝桥云课签约作者、已在蓝桥云课上架的前后端实战课程《Vue.js 和 Egg.js 开发企业级健康管理项目》、《带你从入…...

【网安AIGC专题10.19】论文6:Java漏洞自动修复+数据集 VJBench+大语言模型、APR技术+代码转换方法+LLM和DL-APR模型的挑战与机会
How Effective Are Neural Networks for Fixing Security Vulnerabilities 写在最前面摘要贡献发现 介绍背景:漏洞修复需求和Java漏洞修复方向动机方法贡献 数据集先前的数据集和Java漏洞Benchmark数据集扩展要求数据处理工作最终数据集 VJBenchVJBench 与 Vul4J 的…...

解决国外镜像无法访问导致的R包无法安装问题
我自己的方法: install.packages("vcd", repos "https://mirrors.tuna.tsinghua.edu.cn/CRAN/") R包安装镜像设置的三种方法:R包安装镜像设置的三种方法 - 简书 更新了Rstudio后,出现 unable to access index for rep…...

【2021集创赛】Robei杯一等奖:基于Robei EDA工具的隔离病房看护机器人设计
本作品参与极术社区组织的有奖征集|秀出你的集创赛作品风采,免费电子产品等你拿~活动。 团队介绍 参赛单位:重庆交通大学 队伍名称:一丘之貉 指导老师:毕波 李艾星 参赛队员:郁航 张坤 秦衡 总决赛奖项:Robei杯一等奖…...

Python之函数-传实参的两种方式
Python之函数-传实参的两种方式 函数参数 函数在定义是要定义好形式参数,调用时也提供足够的实际参数,一般来说,形参和实参个数要一致(可变参数除外)。实参传参方式 1、位置传参 定义时def f(x, y, z), 调用使用 f(1, 3, 5)&am…...

Hive客户端和Beeline命令行的基本使用
本专栏案例数据集链接: https://download.csdn.net/download/shangjg03/88478038 1.Hive CLI 1.1 命令帮助Help 使用 `hive -H` 或者 `hive --help` 命令可以查看所有命令的帮助,显示如下: usage: hive-d,--define <key=value> Variable subsitution to ap…...

Ubuntu 22.04自动登录进入桌面
1.编辑gdm3配置文件 sudo vim /etc/gdm3/custom.conf 2.修改内容为 AutomaticLoginEnableTrue AutomaticLoginusername 3.查看和重启服务 # 查看服务状态 systemctl --user status gnome-remote-desktop.service # 重启服务 systemctl --user restart gnome-remote-deskt…...

C#__简单了解XML文档
/* XML(可扩展标记语言):用于传输和存储数据 XML文档:树结构;包含根元素 XML元素:从开始标签到结束标签的部分 XML语法规则: 1、所有XML元素都必须有结束标签 …...

云游数智农业世界,体验北斗时空智能
今日,2023年中国国际农业机械展览会在武汉正式拉开帷幕,众多与会者云集,各类农机产品纷呈,盛况空前。 千寻位置作为国家北斗地基增强系统的建设与运营方,在中国国际农业机械展览会上亮相,以「北斗时空智能 …...

C# 递归算法使用简介_常用整理
一、递归简介 递归算法是一种直接或者间接调用自身函数或者方法的算法。 递归算法的实质是把问题分解成规模缩小的同类问题的子问题,然后递归调用方法来表示问题的解。递归算法对解决一大类问题很有效,它可以使算法简洁和易于理解。 递归本质是循环&a…...

[Python]unittest-单元测试
目录 unittest的大致构成: Test Fixture Test Case-测试用例 Test Suite-测试套件 Test Runner 批量执行脚本 makeSuite() TestLoader discover() 用例的执行顺序 忽略用例执行 skip skipIf skipUnless 断言 HTML测试报告 错误截图 unittest是python中的单元测…...

Jetpack:021-Jetpack中的滑动列表
文章目录 1. 概念介绍2. 使用方法2.1 函数参数2.2 列表成员 3. 示例代码4. 内容扩展5. 内容总结 我们在上一章回中介绍了Jetpack中底部导航栏相关的内容,本章回中主要介绍 滑动列表。闲话休提,让我们一起Talk Android Jetpack吧! 1. 概念介绍…...

基于单片机的空气质量检测系统
欢迎大家点赞、收藏、关注、评论啦 ,由于篇幅有限,只展示了部分核心代码。 技术交流认准下方 CSDN 官方提供的联系方式 文章目录 概要 一、主要内容二、系统方案设计2.1 系统方案设计2.2 主控制器模块选择 三、 系统软件设计4.1 程序结构分析4.2系统程序…...

论文阅读——InstructGPT
论文:Training_language_models_to_follow_instructions_with_human_feedback.pdf (openai.com) github:GitHub - openai/following-instructions-human-feedback 将语言模型做得更大并不能从本质上使它们更好地遵循用户的意图。例如,大型语…...

【表面缺陷检测】铝型材表面缺陷检测数据集介绍(含xml标签文件)
一、铝型材介绍 铝型材是一种由铝合金材料制成的,具有固定截面形状和尺寸的条形建材。由于其优良的物理性能和广泛的应用领域,铝型材在现代工业和生活中发挥着重要的作用。 1、铝型材的分类 根据截面形状的不同,铝型材可分为角铝、槽铝、工…...

我的学习:从本科到研究生的认识与实践经验总结
学习实践经历 18年 上大学以后,因为对计算机的喜爱和对未知编程技术的好奇和探索,选择了从零开始学习程序设计,经过实践,选择了转专业到计算机科学与技术,开始了我的计算机学习之路。 19年 因为想要拓宽自己的专业能力…...

云游长江大桥,3DCAT实时云渲染助力打造沉浸化数字文旅平台
南京长江大桥是中国第一座自主设计建造的双层公路铁路桥,也是世界上最早的双层公路铁路桥之一。它不仅是一座桥梁,更是一座历史文化的见证者和传承者。它见证了中国人民的智慧和奋斗,承载了中国社会的变迁和发展。 如何让这座不可移动的文物…...

【音视频|PCM】PCM格式详解
😁博客主页😁:🚀https://blog.csdn.net/wkd_007🚀 🤑博客内容🤑:🍭嵌入式开发、Linux、C语言、C、数据结构、音视频🍭 🤣本文内容🤣&a…...

行为型模式-行为型模式
在模板模式中,一个抽象类公开定义了执行它的方法的方式/模板。它的子类可以按需要重写方法实现,但调用将以抽象类中定义的方式进行。这种类型的设计模式属于行为型模式。 意图:定义一个操作中的算法的骨架,而将一些步骤延迟到子类…...

openpnp - Warning - Unknown firmware
文章目录 openpnp - Warning - Unknown firmware概述笔记https://github.com/openpnp/openpnp/wiki/Motion-Controller-Firmwares备注END openpnp - Warning - Unknown firmware 概述 接上飞达控制板后, 显示未知固件的警告 开始没看源码之前, 总以为是回答的版本号不合适, …...

Android 中如何使用 App Links
1. 简介 什么是 App Links呢?App Links 是 Android 6.0 (API 级别23) 引入的新功能,它是基于 DeepLinking,允许应用自动处理网站的 URL,而无需提示用户启动相应的应用。 例如:如果你在手机浏览器中输入了某个网站&am…...

7 款好用的 PDF 密码删除工具
这是最佳 PDF 密码删除工具列表。该列表包括免费和付费软件。将要在线完成的所有事情都需要密码才能感到安全。数据传输也是如此。大多数数据是通过文件传输的,PDF有自己的标志。PDF是一种灵活的文件格式,因此也可以专业使用。 有多种PDF 编辑器软件&am…...