diff --git a/LeatherProject/.vs/LeatherApp/FileContentIndex/21085037-606c-48a3-89a0-9eb0be5557c6.vsidx b/LeatherProject/.vs/LeatherApp/FileContentIndex/21085037-606c-48a3-89a0-9eb0be5557c6.vsidx new file mode 100644 index 0000000..44dc1be Binary files /dev/null and b/LeatherProject/.vs/LeatherApp/FileContentIndex/21085037-606c-48a3-89a0-9eb0be5557c6.vsidx differ diff --git a/LeatherProject/.vs/LeatherApp/FileContentIndex/363f5ff6-01d4-41ca-96f6-a44ba5dcbb1d.vsidx b/LeatherProject/.vs/LeatherApp/FileContentIndex/363f5ff6-01d4-41ca-96f6-a44ba5dcbb1d.vsidx new file mode 100644 index 0000000..fae4a6a Binary files /dev/null and b/LeatherProject/.vs/LeatherApp/FileContentIndex/363f5ff6-01d4-41ca-96f6-a44ba5dcbb1d.vsidx differ diff --git a/LeatherProject/.vs/LeatherApp/FileContentIndex/446b0e82-026f-4af1-995a-c72b5be74b7e.vsidx b/LeatherProject/.vs/LeatherApp/FileContentIndex/446b0e82-026f-4af1-995a-c72b5be74b7e.vsidx new file mode 100644 index 0000000..727b0eb Binary files /dev/null and b/LeatherProject/.vs/LeatherApp/FileContentIndex/446b0e82-026f-4af1-995a-c72b5be74b7e.vsidx differ diff --git a/LeatherProject/.vs/LeatherApp/FileContentIndex/d1d9143f-2c68-45eb-b5a9-5a815f84eaf2.vsidx b/LeatherProject/.vs/LeatherApp/FileContentIndex/d1d9143f-2c68-45eb-b5a9-5a815f84eaf2.vsidx new file mode 100644 index 0000000..611ba1b Binary files /dev/null and b/LeatherProject/.vs/LeatherApp/FileContentIndex/d1d9143f-2c68-45eb-b5a9-5a815f84eaf2.vsidx differ diff --git a/LeatherProject/.vs/LeatherApp/FileContentIndex/f83ef48f-4d01-4f4a-8f08-d804306cdd14.vsidx b/LeatherProject/.vs/LeatherApp/FileContentIndex/f83ef48f-4d01-4f4a-8f08-d804306cdd14.vsidx deleted file mode 100644 index 3802905..0000000 Binary files a/LeatherProject/.vs/LeatherApp/FileContentIndex/f83ef48f-4d01-4f4a-8f08-d804306cdd14.vsidx and /dev/null differ diff --git a/LeatherProject/.vs/LeatherApp/FileContentIndex/ff17767f-c4c1-400b-a2ec-a82e42bafa41.vsidx b/LeatherProject/.vs/LeatherApp/FileContentIndex/ff17767f-c4c1-400b-a2ec-a82e42bafa41.vsidx deleted file mode 100644 index 70aef67..0000000 Binary files a/LeatherProject/.vs/LeatherApp/FileContentIndex/ff17767f-c4c1-400b-a2ec-a82e42bafa41.vsidx and /dev/null differ diff --git a/LeatherProject/LeatherApp/Config.cs b/LeatherProject/LeatherApp/Config.cs index 2450c60..aadcb4b 100644 --- a/LeatherProject/LeatherApp/Config.cs +++ b/LeatherProject/LeatherApp/Config.cs @@ -40,7 +40,7 @@ namespace LeatherApp public static string ErpSql = "select top 1 a,b,c from tableA where code=@code order by id desc"; //使用oracle数据库 - public static bool OracleDB = false; + public static string ErpDBType = "sqlServer"; //远程服务器连接字段 public static string ServerDBConStr = "server=localhost;Database=LeatherDB;Uid=root;Pwd=123456; AllowLoadLocalInfile=true"; //LOG @@ -51,6 +51,7 @@ namespace LeatherApp public static bool StopIO = false; public static bool StopPLC=true; public static bool StopLight = true; + public static bool StopCeHou = true; public static string PlcIPAdrees; public static short PlcRackN=0, PlcSolt=1; @@ -62,6 +63,11 @@ namespace LeatherApp public static string Light_PortName;//COM端口号 public static LightDevNameEnum Light_Name = LightDevNameEnum.锐视; public static CamerDevNameEnum Camer_Name = CamerDevNameEnum.海康; + public static string CeHouIP; + public static int CeHouPort; + public static int CeHouCnt; + public static double JinShuTanCeDis; + public static string CustomerName; public static string JM_PortName;//COM端口号 //LIB @@ -104,6 +110,8 @@ namespace LeatherApp public static bool OpenBeep; public static int BeepTime; + //开启检出就报警 + public static bool OpenWarnBeep; //边补偿 public static int L_offset, R_offset; public static void LoadCloudConfig() @@ -133,6 +141,10 @@ namespace LeatherApp if (!Directory.Exists(lsCmdPath)) Directory.CreateDirectory(lsCmdPath); + string TempPicPath = appBasePath + "\\TempPic\\"; + if (!Directory.Exists(TempPicPath)) + Directory.CreateDirectory(TempPicPath); + string fileName; CMDProcess = new Dictionary(); foreach (int item in Enum.GetValues(typeof(CMDName)))//item为key值 @@ -150,7 +162,9 @@ namespace LeatherApp //[DB] DBConStr = ini.ReadString("DB", "DBConStr", ""); - OracleDB = ini.ReadBool("DB", "OracleDB"); + ErpDBType = ini.ReadString("DB", "ErpDBType", "SqlServer"); + if (string.IsNullOrEmpty(ErpDBType)) + ErpDBType = "SqlServer"; //[Erp] ErpDBConStr = ini.ReadString("ErpDB", "ErpDBConStr", ""); ErpSql = ini.ReadString("ErpDB", "ErpSql", ""); @@ -170,6 +184,7 @@ namespace LeatherApp PlcSolt = ini.ReadShort("DEV", "PlcSolt", PlcSolt); StopLight = ini.ReadBool("DEV", "StopLight", false); + Carmer1ConfigFilePath = ini.ReadString("DEV", "Carmer1ConfigFilePath", ""); Carmer2ConfigFilePath = ini.ReadString("DEV", "Carmer2ConfigFilePath", ""); IOCard_DeviceNum = ini.ReadString("DEV", "IOCard_DeviceNum", ""); @@ -181,6 +196,11 @@ namespace LeatherApp JM_PortName = ini.ReadString("DEV", "JM_PortName", ""); + StopCeHou = ini.ReadBool("DEV", "StopCeHou", true); + CeHouIP = ini.ReadString("DEV", "CeHouIP", ""); + CeHouPort = ini.ReadInt("DEV", "CeHouPort"); + CeHouCnt = ini.ReadInt("DEV", "CeHouCnt"); + JinShuTanCeDis = ini.ReadDouble("DEV", "JinShuTanCeDis"); //[LIB] model_path = ini.ReadString("LIB", "model_path", ""); //labels_path = ini.ReadString("LIB", "labels_path", ""); @@ -244,10 +264,13 @@ namespace LeatherApp //蜂鸣 OpenBeep = ini.ReadBool("Beep", "OpenBeep"); + OpenWarnBeep = ini.ReadBool("Beep", "OpenWarnBeep"); BeepTime = ini.ReadInt("Beep", "BeepTime", 3000); L_offset = ini.ReadInt("BOffset", "L_offset", 0); R_offset = ini.ReadInt("BOffset", "R_offset", 0); + + CustomerName = ini.ReadString("Customer", "CustomerName", "").Trim(); } #region defectItemList <=> DefectItemList.json diff --git a/LeatherProject/LeatherApp/DevContainer.cs b/LeatherProject/LeatherApp/DevContainer.cs index c74aa3d..691826e 100644 --- a/LeatherProject/LeatherApp/DevContainer.cs +++ b/LeatherProject/LeatherApp/DevContainer.cs @@ -38,6 +38,8 @@ namespace LeatherApp private PictureBox preView1, preView2; private SerialPort lengthCounter; + + private DL_EN1Dev dL_EN1Dev; public void start(PictureBox view1, PictureBox view2) { this.preView1 = view1; @@ -68,6 +70,10 @@ namespace LeatherApp try { libDefect.stop(); } catch { } try { libPhoto.stop(); } catch { } + if (!Config.StopCeHou) + { + try { dL_EN1Dev.stopDev(); } catch { } + } } catch { } } @@ -95,6 +101,13 @@ namespace LeatherApp #if JM lengthCounter = new SerialPort(Config.JM_PortName, 9600); #endif + //开启测厚 + if (!Config.StopCeHou) + { + dL_EN1Dev = new DL_EN1Dev(); + if(!dL_EN1Dev.startDev(Config.CeHouIP, Config.CeHouPort)) + throw new Exception("位移传感器初始化失败!"); + } if (Config.Camer_Name == CamerDevNameEnum.海康) { devCamer2 = new CamerCardDev(); diff --git a/LeatherProject/LeatherApp/Device/DL_EN1Dev.cs b/LeatherProject/LeatherApp/Device/DL_EN1Dev.cs new file mode 100644 index 0000000..3b21c95 --- /dev/null +++ b/LeatherProject/LeatherApp/Device/DL_EN1Dev.cs @@ -0,0 +1,400 @@ +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Linq; +using System.Net.Sockets; +using System.Net; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using DocumentFormat.OpenXml.VariantTypes; + +namespace LeatherApp.Device +{ + public class DL_EN1Dev + { + TCPClient tCPClient; + + public DL_EN1Dev() + { + + } + + public bool startDev(string localIp, int port) + { + tCPClient = new TCPClient(localIp, port); + return tCPClient.TcpClientStart(); + } + + public void stopDev() + { + tCPClient.CloseAll(); + } + + public bool GetValue(string index, out double val) + { + val = 0; + bool ret = true; + string recv; + ret = tCPClient.SendMessage($"SW,{index},171,+000000001\r\n"); + if ( !ret ) + { + return ret; + } + Thread.Sleep( 10 ); + DateTime dateTime = DateTime.Now; + do + { + ret = tCPClient.SendMessage($"SW,{index},172\r\n"); + if (!ret) + { + return ret; + } + Thread.Sleep(10); + ret = tCPClient.ReceiveMessage(out recv); + if (recv.IndexOf("1.") >= 0) + break; + if ((DateTime.Now - dateTime).TotalSeconds > 3) + return false; + } while (true); + ret = tCPClient.SendMessage($"SW,{index},173\r\n"); + if (!ret) + { + return ret; + } + Thread.Sleep(10); + ret = tCPClient.ReceiveMessage(out recv); + if (!ret) + { + return ret; + } + if(string.IsNullOrEmpty(recv)) + return ret; + ret = double.TryParse(recv, out val); + val = val / 100; + return ret; + } + } + + //客户端类 + public class TCPClient + { + //private TcpListener tcpListener = null; + private TcpClient tcpClient; + private IPAddress localIP; + private NetworkStream stream; + private int port; + //private int buffer_length = 0; + private bool isConnected; + Thread myThread = null; + CancellationTokenSource cts; + + /// + /// 接收队列的上限 + /// + public int comDDLength = 100; + /// + /// 客户端的连接状态 + /// + public bool IsConnected + { + get { return this.isConnected; } + } + + public TCPClient(string localIp, int port) + { + this.localIP = IPAddress.Parse(localIp); + this.port = port; + //this.buffer_length = Marshal.SizeOf(dataType); + } + public bool TcpClientStart() + { + try + { + tcpClient = new TcpClient(); + tcpClient.Connect(this.localIP, this.port); + + this.isConnected = true; + + //ThreadStart myThreadDelegate = new ThreadStart(Listening); + ////实例化新线程 + //cts = new CancellationTokenSource(); + //myThread = new Thread(myThreadDelegate); + //myThread.IsBackground = true; + //myThread.Start(); + return true; + } + catch (Exception) + { + this.isConnected = false; + return false; + } + + } + private void Listening() + { + try + { + while (true) + { + // 获取一个数据流对象来进行读取和写入 + this.stream = tcpClient.GetStream(); + if (this.stream.CanRead) + { + if (cts.Token.IsCancellationRequested) return; + byte[] buffer = new byte[256];//new byte[buffer_length]; + int bytesLength = this.stream.Read(buffer, 0, buffer.Length); + #region 异常情况,服务器突然关闭 + if (bytesLength == 0) + { + CloseAll(); + this.isConnected = false; + //Thread.Sleep(500); + + //while (true) + //{ + // try + // { + // TcpClientStart(); + // break; + // } + // catch (Exception) + // { + // } + //} + //break; + } + #endregion + //object msg = BytesToStuct(buffer, this.type); + //if (msg == null) continue; + //lock (this) + //{ + + //} + } + } + } + catch (System.IO.IOException)//服务器异常断开 + { + CloseAll(); + this.isConnected = false; + + } + catch (Exception) + { + + } + } + public bool SendMessage(object sendMsg) + { + //把成 ASCII 字符串转化数据字符。 + byte[] sendMsgbyte = null; + // NetworkStream stream = null; + //TcpClient tcpClient = new TcpClient(); + try + { + //tcpClient.Connect(this.localIP, port); + this.stream = this.tcpClient.GetStream(); + if (this.stream.CanWrite) + { + sendMsgbyte = StructToBytes(sendMsg); + stream.Write(sendMsgbyte, 0, sendMsgbyte.Length); + } + return true; + } + catch (Exception) + { + return false; + } + } + public bool SendMessage(string sendMsg) + { + //把成 ASCII 字符串转化数据字符。 + byte[] sendMsgbyte = null; + try + { + this.stream = this.tcpClient.GetStream(); + if (this.stream.CanWrite) + { + sendMsgbyte = System.Text.Encoding.ASCII.GetBytes(sendMsg); + stream.Write(sendMsgbyte, 0, sendMsgbyte.Length); + } + return true; + } + catch (Exception) + { + return false; + } + } + /// + /// 清除缓存区中某条指令 + /// + /// + /// + public bool ClearMessage(int cmdID) + { + try + { + + return true; + } + catch (Exception) + { + return false; + } + } + /// + /// 不启用监听功能时可以使用 + /// + /// + public bool ReceiveMessage(out string receiveMsg) + { + receiveMsg = ""; + try + { + // 获取一个数据流对象来进行读取和写入 + stream = tcpClient.GetStream(); + if (this.stream.CanRead) + { + byte[] buffer = new byte[this.tcpClient.ReceiveBufferSize]; + this.stream.Read(buffer, 0, this.tcpClient.ReceiveBufferSize); + receiveMsg = Encoding.Default.GetString(buffer); + } + return true; + } + catch (SocketException) + { + return false; + //MessageBox.Show(se.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + + ///// + ///// 启用监听功能时使用,默认接收队列中的第一个数据 + ///// + ///// 超时时间,单位ms + ///// 返回接收到的数据 + ///// + //public bool ReceiveMessage(double timeOut, out ComData comData) + //{ + // comData = new ComData(0); + // try + // { + // DateTime startTime = DateTime.Now; + // while (true) + // { + // if (DateTime.Now.Subtract(startTime).TotalMilliseconds > timeOut) + // return false; + // if (comDataDic.Count > 0) + // { + // foreach (var item in comDataDic.Values) + // { + // if (comDataDic.TryRemove(item.cmdID, out comData)) + // { + // comData.status = 1; + // return true; + // } + // } + // } + // } + // } + // catch (Exception) + // { + // return false; + // } + //} + + + ///// + ///// 异步接收信息,防止主线程卡死 + ///// + ///// + ///// + ///// + //public Task ReceiveMsgAsync(double timeOut) + //{ + // return Task.Run(() => + // { + // ComData comData; + // ReceiveMessage(timeOut, out comData); + // return comData; + // }); + //} + + //// + + /// 结构体转byte数组 + /// + /// 要转换的结构体 + /// 转换后的byte数组 + public static byte[] StructToBytes(object structObj) + { + //得到结构体的大小 + int size = Marshal.SizeOf(structObj); + //创建byte数组 + byte[] bytes = new byte[size]; + //分配结构体大小的内存空间 + IntPtr structPtr = Marshal.AllocHGlobal(size); + //将结构体拷到分配好的内存空间 + Marshal.StructureToPtr(structObj, structPtr, false); + //从内存空间拷到byte数组 + Marshal.Copy(structPtr, bytes, 0, size); + //释放内存空间 + Marshal.FreeHGlobal(structPtr); + //返回byte数组 + return bytes; + } + + + /// + /// byte数组转结构体 + /// + /// byte数组 + /// 结构体类型 + /// 转换后的结构体 + public static object BytesToStuct(byte[] bytes, Type type) + { + //得到结构体的大小 + int size = Marshal.SizeOf(type); + //byte数组长度小于结构体的大小 + if (size > bytes.Length) + { + //返回空 + return null; + } + //分配结构体大小的内存空间 + IntPtr structPtr = Marshal.AllocHGlobal(size); + //将byte数组拷到分配好的内存空间 + Marshal.Copy(bytes, 0, structPtr, size); + //将内存空间转换为目标结构体 + object obj = Marshal.PtrToStructure(structPtr, type); + //释放内存空间 + Marshal.FreeHGlobal(structPtr); + //返回结构体 + return obj; + } + public void CloseAll() + { + this.CloseResource(); + } + private void CloseResource() + { + if (this != null) + { + cts.Cancel(); + if (this.stream != null) + { + this.stream.Close(); + this.stream.Dispose(); + } + if (this.tcpClient != null) + { + this.tcpClient.Close(); + this.tcpClient = null; + } + } + } + } +} diff --git a/LeatherProject/LeatherApp/FrmVerList.resx b/LeatherProject/LeatherApp/FrmVerList.resx index d791869..b03b057 100644 --- a/LeatherProject/LeatherApp/FrmVerList.resx +++ b/LeatherProject/LeatherApp/FrmVerList.resx @@ -118,7 +118,12 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - v1.2.0.0(2024-09-27) + v1.2.0.6(2024-11-06) +1、禾欣控股所有设备兼容 +2、新材料ERP并入 +3、内存缓存改为硬盘存图 +4、计米器单独传感器流程 +v1.2.0.0(2024-09-27) 1、加入传统算法,修改核心 v1.0.2.10(2024-08-05) 1、修复bug,优化显示 diff --git a/LeatherProject/LeatherApp/LeatherApp.csproj b/LeatherProject/LeatherApp/LeatherApp.csproj index 641fcc6..2bdb59a 100644 --- a/LeatherProject/LeatherApp/LeatherApp.csproj +++ b/LeatherProject/LeatherApp/LeatherApp.csproj @@ -227,6 +227,7 @@ + @@ -261,6 +262,18 @@ + + Form + + + AddErpFrm.cs + + + Form + + + FErpMesEdit.cs + Form @@ -367,6 +380,12 @@ FrmVerList.cs + + AddErpFrm.cs + + + FErpMesEdit.cs + FSelDefect.cs diff --git a/LeatherProject/LeatherApp/Page/AddErpFrm.Designer.cs b/LeatherProject/LeatherApp/Page/AddErpFrm.Designer.cs new file mode 100644 index 0000000..f1a1399 --- /dev/null +++ b/LeatherProject/LeatherApp/Page/AddErpFrm.Designer.cs @@ -0,0 +1,127 @@ +namespace LeatherApp.Page +{ + partial class AddErpFrm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.panel1 = new System.Windows.Forms.Panel(); + this.tbERPID = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.cbPdtList = new System.Windows.Forms.ComboBox(); + this.label2 = new System.Windows.Forms.Label(); + this.pnlBtm.SuspendLayout(); + this.panel1.SuspendLayout(); + this.SuspendLayout(); + // + // pnlBtm + // + this.pnlBtm.Location = new System.Drawing.Point(1, 344); + this.pnlBtm.Size = new System.Drawing.Size(725, 55); + // + // btnCancel + // + this.btnCancel.Location = new System.Drawing.Point(597, 12); + this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); + // + // btnOK + // + this.btnOK.Location = new System.Drawing.Point(482, 12); + this.btnOK.Click += new System.EventHandler(this.btnOK_Click); + // + // panel1 + // + this.panel1.Controls.Add(this.label2); + this.panel1.Controls.Add(this.cbPdtList); + this.panel1.Controls.Add(this.label1); + this.panel1.Controls.Add(this.tbERPID); + this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel1.Location = new System.Drawing.Point(1, 35); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(725, 309); + this.panel1.TabIndex = 2; + // + // tbERPID + // + this.tbERPID.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.tbERPID.Location = new System.Drawing.Point(154, 55); + this.tbERPID.Name = "tbERPID"; + this.tbERPID.Size = new System.Drawing.Size(543, 30); + this.tbERPID.TabIndex = 0; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(43, 61); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(87, 16); + this.label1.TabIndex = 1; + this.label1.Text = "产品绑定ID"; + // + // cbPdtList + // + this.cbPdtList.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.cbPdtList.FormattingEnabled = true; + this.cbPdtList.Location = new System.Drawing.Point(154, 133); + this.cbPdtList.Name = "cbPdtList"; + this.cbPdtList.Size = new System.Drawing.Size(543, 29); + this.cbPdtList.TabIndex = 2; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(43, 140); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(103, 16); + this.label2.TabIndex = 3; + this.label2.Text = "产品检测流程"; + // + // AddErpFrm + // + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + this.ClientSize = new System.Drawing.Size(727, 402); + this.Controls.Add(this.panel1); + this.Name = "AddErpFrm"; + this.Text = "添加ERP绑定"; + this.ZoomScaleRect = new System.Drawing.Rectangle(15, 15, 727, 377); + this.Controls.SetChildIndex(this.pnlBtm, 0); + this.Controls.SetChildIndex(this.panel1, 0); + this.pnlBtm.ResumeLayout(false); + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.ComboBox cbPdtList; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox tbERPID; + } +} \ No newline at end of file diff --git a/LeatherProject/LeatherApp/Page/AddErpFrm.cs b/LeatherProject/LeatherApp/Page/AddErpFrm.cs new file mode 100644 index 0000000..e3f74fe --- /dev/null +++ b/LeatherProject/LeatherApp/Page/AddErpFrm.cs @@ -0,0 +1,109 @@ +using DocumentFormat.OpenXml.EMMA; +using Sunny.UI; +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 LeatherApp.Page +{ + public partial class AddErpFrm : UIEditForm + { + private Service.ProductService service = new Service.ProductService(); + string _ErpID; + string[] Material = new string[6]; + public AddErpFrm(string erpID) + { + InitializeComponent(); + _ErpID = erpID; + FrmInit(); + } + + private void FrmInit() + { + tbERPID.Text = _ErpID; + Material[0] = Config.materialNameList.FirstOrDefault(x => x.Value("code") == 0).Value("name"); + Material[1] = Config.materialNameList.FirstOrDefault(x => x.Value("code") == 1).Value("name"); + Material[2] = Config.materialNameList.FirstOrDefault(x => x.Value("code") == 2).Value("name"); + Material[3] = Config.materialNameList.FirstOrDefault(x => x.Value("code") == 3).Value("name"); + Material[4] = Config.materialNameList.FirstOrDefault(x => x.Value("code") == 4).Value("name"); + Material[5] = Config.materialNameList.FirstOrDefault(x => x.Value("code") == 5).Value("name"); + + var lstColor = Config.colorNameList.Select(x => new { code = x.Value("code"), name = x.Value("name") }).ToList(); + + var modellist = service.GetListNav(); + foreach (var model in modellist) + { + string pdtName = ""; + if (model.Material == "0") + pdtName += Material[0]; + else if (model.Material == "1") + pdtName += Material[1]; + else if (model.Material == "2") + pdtName += Material[2]; + else if (model.Material == "3") + pdtName += Material[3]; + else if (model.Material == "4") + pdtName += Material[4]; + else if (model.Material == "5") + pdtName += Material[5]; + else + pdtName += "错误材质"; + + var tp = lstColor.Find(x => x.code == model.Color); + if (tp != null) + pdtName += "_" + tp.name; + else + pdtName += "_无效颜色"; + cbPdtList.Items.Add(pdtName); + } + } + + private void btnCancel_Click(object sender, EventArgs e) + { + this.Close(); + } + + private void btnOK_Click(object sender, EventArgs e) + { + try + { + var temp = cbPdtList.Text.Split('_'); + string MaterialID = ""; + if (temp[0] == Material[0]) + MaterialID = "0"; + else if (temp[0] == Material[1]) + MaterialID = "1"; + else if (temp[0] == Material[2]) + MaterialID = "2"; + else if (temp[0] == Material[3]) + MaterialID = "3"; + else if (temp[0] == Material[4]) + MaterialID = "4"; + else if (temp[0] == Material[5]) + MaterialID = "5"; + + var lstColor = Config.colorNameList.Select(x => new { code = x.Value("code"), name = x.Value("name") }).ToList(); + int colorID = lstColor.Find(x => x.name == temp[1]).code; + + var modellist = service.GetListNav(); + var model = modellist.Find(x => (x.Material == MaterialID && x.Color == colorID)); + if (string.IsNullOrEmpty(model.Spec)) + model.Spec += _ErpID; + else + model.Spec += $",{_ErpID}"; + var result = service.UpdateNav(model); + UIMessageTip.ShowOk($"Erp信息绑定成功", 2000); + } + catch (Exception ex) + { + UIMessageTip.ShowError($"Erp信息绑定失败:{ex.Message}", 2000); + } + } + } +} diff --git a/LeatherProject/LeatherApp/Page/AddErpFrm.resx b/LeatherProject/LeatherApp/Page/AddErpFrm.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/LeatherProject/LeatherApp/Page/AddErpFrm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/LeatherProject/LeatherApp/Page/FErpMesEdit.Designer.cs b/LeatherProject/LeatherApp/Page/FErpMesEdit.Designer.cs new file mode 100644 index 0000000..8bbfe19 --- /dev/null +++ b/LeatherProject/LeatherApp/Page/FErpMesEdit.Designer.cs @@ -0,0 +1,79 @@ +namespace LeatherApp.Page +{ + partial class FErpMesEdit + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.textBox1 = new System.Windows.Forms.TextBox(); + this.pnlBtm.SuspendLayout(); + this.SuspendLayout(); + // + // pnlBtm + // + this.pnlBtm.Location = new System.Drawing.Point(1, 240); + this.pnlBtm.Size = new System.Drawing.Size(562, 55); + // + // btnCancel + // + this.btnCancel.Location = new System.Drawing.Point(434, 12); + this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); + // + // btnOK + // + this.btnOK.Location = new System.Drawing.Point(319, 12); + this.btnOK.Click += new System.EventHandler(this.btnOK_Click); + // + // textBox1 + // + this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill; + this.textBox1.Location = new System.Drawing.Point(1, 35); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(562, 205); + this.textBox1.TabIndex = 2; + // + // FErpMesEdit + // + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + this.ClientSize = new System.Drawing.Size(564, 298); + this.Controls.Add(this.textBox1); + this.Name = "FErpMesEdit"; + this.Text = "MES/ERP信息编辑"; + this.ZoomScaleRect = new System.Drawing.Rectangle(15, 15, 800, 450); + this.Controls.SetChildIndex(this.pnlBtm, 0); + this.Controls.SetChildIndex(this.textBox1, 0); + this.pnlBtm.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox1; + } +} \ No newline at end of file diff --git a/LeatherProject/LeatherApp/Page/FErpMesEdit.cs b/LeatherProject/LeatherApp/Page/FErpMesEdit.cs new file mode 100644 index 0000000..212fb38 --- /dev/null +++ b/LeatherProject/LeatherApp/Page/FErpMesEdit.cs @@ -0,0 +1,35 @@ +using Sunny.UI; +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 LeatherApp.Page +{ + public partial class FErpMesEdit : UIEditForm + { + public string erpInfo; + public FErpMesEdit(string mesInfo) + { + InitializeComponent(); + textBox1.Text = mesInfo; + erpInfo = mesInfo; + } + + private void btnCancel_Click(object sender, EventArgs e) + { + this.Close(); + } + + private void btnOK_Click(object sender, EventArgs e) + { + erpInfo = textBox1.Text; + this.Close(); + } + } +} diff --git a/LeatherProject/LeatherApp/Page/FErpMesEdit.resx b/LeatherProject/LeatherApp/Page/FErpMesEdit.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/LeatherProject/LeatherApp/Page/FErpMesEdit.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/LeatherProject/LeatherApp/Page/FHome.Designer.cs b/LeatherProject/LeatherApp/Page/FHome.Designer.cs index 731a094..2dbcdfa 100644 --- a/LeatherProject/LeatherApp/Page/FHome.Designer.cs +++ b/LeatherProject/LeatherApp/Page/FHome.Designer.cs @@ -28,14 +28,14 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle137 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle138 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle142 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle143 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle144 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle139 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle140 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle141 = new System.Windows.Forms.DataGridViewCellStyle(); this.uiPanel1 = new Sunny.UI.UIPanel(); this.lblLen = new Sunny.UI.UILabel(); this.lblSpeed = new Sunny.UI.UISymbolLabel(); @@ -60,6 +60,7 @@ this.btnEnd = new Sunny.UI.UISymbolButton(); this.btnStart = new Sunny.UI.UISymbolButton(); this.uiTitlePanel2 = new Sunny.UI.UITitlePanel(); + this.ucColorListDefect = new LeatherApp.UIExtend.UCColorList(); this.lineChartDefect = new Sunny.UI.UILineChart(); this.uiTitlePanel3 = new Sunny.UI.UITitlePanel(); this.uiDataGridView1 = new Sunny.UI.UIDataGridView(); @@ -82,6 +83,7 @@ this.lstboxLog = new Sunny.UI.UIListBox(); this.uiTitlePanel6 = new Sunny.UI.UITitlePanel(); this.uiPanel3 = new Sunny.UI.UIPanel(); + this.picDefectImage = new LeatherApp.UIExtend.UCImageView(); this.pnlScannerImg = new Sunny.UI.UITitlePanel(); this.picScanner2 = new System.Windows.Forms.PictureBox(); this.picScanner1 = new System.Windows.Forms.PictureBox(); @@ -100,8 +102,6 @@ this.uiLabel8 = new Sunny.UI.UILabel(); this.uiLabel7 = new Sunny.UI.UILabel(); this.uiLabel6 = new Sunny.UI.UILabel(); - this.picDefectImage = new LeatherApp.UIExtend.UCImageView(); - this.ucColorListDefect = new LeatherApp.UIExtend.UCColorList(); this.uiPanel1.SuspendLayout(); this.uiTitlePanel1.SuspendLayout(); this.uiPanel2.SuspendLayout(); @@ -659,6 +659,29 @@ this.uiTitlePanel2.TitleColor = System.Drawing.Color.White; this.uiTitlePanel2.TitleForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138))))); // + // ucColorListDefect + // + this.ucColorListDefect.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.ucColorListDefect.ColorChanged = null; + this.ucColorListDefect.FillColor = System.Drawing.Color.White; + this.ucColorListDefect.FillColor2 = System.Drawing.Color.White; + this.ucColorListDefect.FillDisableColor = System.Drawing.Color.White; + this.ucColorListDefect.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.ucColorListDefect.Location = new System.Drawing.Point(1, 38); + this.ucColorListDefect.MinimumSize = new System.Drawing.Size(1, 1); + this.ucColorListDefect.Name = "ucColorListDefect"; + this.ucColorListDefect.RadiusSides = Sunny.UI.UICornerRadiusSides.None; + this.ucColorListDefect.RectColor = System.Drawing.Color.White; + this.ucColorListDefect.RectDisableColor = System.Drawing.Color.White; + this.ucColorListDefect.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom; + this.ucColorListDefect.Size = new System.Drawing.Size(121, 42); + this.ucColorListDefect.Style = Sunny.UI.UIStyle.Custom; + this.ucColorListDefect.StyleCustomMode = true; + this.ucColorListDefect.TabIndex = 1; + this.ucColorListDefect.Text = "ucColorList1"; + this.ucColorListDefect.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; + // // lineChartDefect // this.lineChartDefect.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -708,21 +731,21 @@ // // uiDataGridView1 // - dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(251)))), ((int)(((byte)(250))))); - this.uiDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle137.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(251)))), ((int)(((byte)(250))))); + this.uiDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle137; this.uiDataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.uiDataGridView1.BackgroundColor = System.Drawing.Color.White; this.uiDataGridView1.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single; - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle2.BackColor = System.Drawing.Color.Blue; - dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle2.ForeColor = System.Drawing.Color.White; - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138))))); - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.uiDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle138.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle138.BackColor = System.Drawing.Color.Blue; + dataGridViewCellStyle138.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle138.ForeColor = System.Drawing.Color.White; + dataGridViewCellStyle138.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138))))); + dataGridViewCellStyle138.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle138.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.uiDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle138; this.uiDataGridView1.ColumnHeadersHeight = 32; this.uiDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.uiDataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { @@ -737,14 +760,14 @@ this.colArea, this.colZXD, this.colTarget}); - dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle6.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle6.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle6.ForeColor = System.Drawing.Color.White; - dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(242)))), ((int)(((byte)(238))))); - dataGridViewCellStyle6.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); - dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.uiDataGridView1.DefaultCellStyle = dataGridViewCellStyle6; + dataGridViewCellStyle142.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle142.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle142.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle142.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); + dataGridViewCellStyle142.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(242)))), ((int)(((byte)(238))))); + dataGridViewCellStyle142.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); + dataGridViewCellStyle142.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.uiDataGridView1.DefaultCellStyle = dataGridViewCellStyle142; this.uiDataGridView1.EnableHeadersVisualStyles = false; this.uiDataGridView1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.uiDataGridView1.GridColor = System.Drawing.Color.CornflowerBlue; @@ -752,21 +775,21 @@ this.uiDataGridView1.MultiSelect = false; this.uiDataGridView1.Name = "uiDataGridView1"; this.uiDataGridView1.RectColor = System.Drawing.Color.DodgerBlue; - dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(251)))), ((int)(((byte)(250))))); - dataGridViewCellStyle7.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle7.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); - dataGridViewCellStyle7.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138))))); - dataGridViewCellStyle7.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); - dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.uiDataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle7; + dataGridViewCellStyle143.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle143.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(251)))), ((int)(((byte)(250))))); + dataGridViewCellStyle143.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle143.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); + dataGridViewCellStyle143.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138))))); + dataGridViewCellStyle143.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); + dataGridViewCellStyle143.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.uiDataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle143; this.uiDataGridView1.RowHeadersWidth = 62; - dataGridViewCellStyle8.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle8.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); - dataGridViewCellStyle8.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(242)))), ((int)(((byte)(238))))); - dataGridViewCellStyle8.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); - this.uiDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle8; + dataGridViewCellStyle144.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle144.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle144.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); + dataGridViewCellStyle144.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(242)))), ((int)(((byte)(238))))); + dataGridViewCellStyle144.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); + this.uiDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle144; this.uiDataGridView1.RowTemplate.Height = 30; this.uiDataGridView1.ScrollBarBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(251)))), ((int)(((byte)(250))))); this.uiDataGridView1.ScrollBarColor = System.Drawing.Color.DodgerBlue; @@ -817,9 +840,9 @@ // colX // this.colX.DataPropertyName = "X"; - dataGridViewCellStyle3.Format = "N1"; - dataGridViewCellStyle3.NullValue = null; - this.colX.DefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle139.Format = "N1"; + dataGridViewCellStyle139.NullValue = null; + this.colX.DefaultCellStyle = dataGridViewCellStyle139; this.colX.HeaderText = "X(cm)"; this.colX.MinimumWidth = 8; this.colX.Name = "colX"; @@ -829,9 +852,9 @@ // colY // this.colY.DataPropertyName = "Y"; - dataGridViewCellStyle4.Format = "N2"; - dataGridViewCellStyle4.NullValue = null; - this.colY.DefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle140.Format = "N2"; + dataGridViewCellStyle140.NullValue = null; + this.colY.DefaultCellStyle = dataGridViewCellStyle140; this.colY.HeaderText = "Y(米)"; this.colY.MinimumWidth = 8; this.colY.Name = "colY"; @@ -854,9 +877,9 @@ // // colArea // - dataGridViewCellStyle5.Format = "N2"; - dataGridViewCellStyle5.NullValue = null; - this.colArea.DefaultCellStyle = dataGridViewCellStyle5; + dataGridViewCellStyle141.Format = "N2"; + dataGridViewCellStyle141.NullValue = null; + this.colArea.DefaultCellStyle = dataGridViewCellStyle141; this.colArea.HeaderText = "面积(mm²)"; this.colArea.MinimumWidth = 8; this.colArea.Name = "colArea"; @@ -1065,6 +1088,15 @@ this.uiPanel3.Text = null; this.uiPanel3.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; // + // picDefectImage + // + this.picDefectImage.Dock = System.Windows.Forms.DockStyle.Fill; + this.picDefectImage.Location = new System.Drawing.Point(0, 0); + this.picDefectImage.Margin = new System.Windows.Forms.Padding(0); + this.picDefectImage.Name = "picDefectImage"; + this.picDefectImage.Size = new System.Drawing.Size(350, 226); + this.picDefectImage.TabIndex = 1; + // // pnlScannerImg // this.pnlScannerImg.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -1353,38 +1385,6 @@ this.uiLabel6.Text = "光源"; this.uiLabel6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // - // picDefectImage - // - this.picDefectImage.Dock = System.Windows.Forms.DockStyle.Fill; - this.picDefectImage.Location = new System.Drawing.Point(0, 0); - this.picDefectImage.Margin = new System.Windows.Forms.Padding(0); - this.picDefectImage.Name = "picDefectImage"; - this.picDefectImage.Size = new System.Drawing.Size(350, 226); - this.picDefectImage.TabIndex = 1; - // - // ucColorListDefect - // - this.ucColorListDefect.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.ucColorListDefect.ColorChanged = null; - this.ucColorListDefect.FillColor = System.Drawing.Color.White; - this.ucColorListDefect.FillColor2 = System.Drawing.Color.White; - this.ucColorListDefect.FillDisableColor = System.Drawing.Color.White; - this.ucColorListDefect.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.ucColorListDefect.Location = new System.Drawing.Point(1, 38); - this.ucColorListDefect.MinimumSize = new System.Drawing.Size(1, 1); - this.ucColorListDefect.Name = "ucColorListDefect"; - this.ucColorListDefect.RadiusSides = Sunny.UI.UICornerRadiusSides.None; - this.ucColorListDefect.RectColor = System.Drawing.Color.White; - this.ucColorListDefect.RectDisableColor = System.Drawing.Color.White; - this.ucColorListDefect.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom; - this.ucColorListDefect.Size = new System.Drawing.Size(121, 42); - this.ucColorListDefect.Style = Sunny.UI.UIStyle.Custom; - this.ucColorListDefect.StyleCustomMode = true; - this.ucColorListDefect.TabIndex = 1; - this.ucColorListDefect.Text = "ucColorList1"; - this.ucColorListDefect.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; - // // FHome // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; diff --git a/LeatherProject/LeatherApp/Page/FHome.cs b/LeatherProject/LeatherApp/Page/FHome.cs index 89d68f1..168bd70 100644 --- a/LeatherProject/LeatherApp/Page/FHome.cs +++ b/LeatherProject/LeatherApp/Page/FHome.cs @@ -2,7 +2,9 @@ #define JM //#define Oracle //禾欣使用oracle数据库 #define NT //新流程 +//#define UPDATA +using DocumentFormat.OpenXml.EMMA; using IKapC.NET; using LeatherApp.Device; using LeatherApp.Device.CamerUtil; @@ -68,7 +70,8 @@ namespace LeatherApp.Page private double ThnDieLen = 0; - private Dictionary defectTag = new Dictionary(); + //private Dictionary defectTag = new Dictionary(); + private Dictionary defectTag = new Dictionary(); //裁切偏移 private double OffsetCut = 0.2; //云端 @@ -191,10 +194,20 @@ namespace LeatherApp.Page UIMessageTip.ShowError("此记录已不存在!", 1000); return; } - if (defectInfo.image != null) + if (defectInfo.imageID != null) { - this.picDefectImage.loadImage(defectInfo.image); - this.picDefectImage.Refresh(); + try + { + string filename = Path.Combine(Config.appBasePath + "\\TempPic\\", $"{defectInfo.imageID}.jpg"); + var pmat = new Mat(filename);//defectPuaseImgList[liPhotoIndex].Clone(); + var pimage = (Bitmap)pmat.ToBitmap().Clone(); + this.picDefectImage.loadImage(pimage); + this.picDefectImage.Refresh(); + } + catch (Exception ex) + { + UIMessageTip.ShowError($"此记录临时图片已不存在!{ex.Message}", 1000); + } } else UIMessageTip.ShowError("此记录图片已不存在!", 1000); @@ -647,6 +660,7 @@ namespace LeatherApp.Page uilbKF.Top = 8; } //开机 + private Thread t_test0; private Thread t_test1; private Thread t_test2; private Thread t_test3; @@ -751,8 +765,21 @@ namespace LeatherApp.Page if (!devContainer.state || string.IsNullOrWhiteSpace(barCode) || (currentState != CurrentStateEnum.初始 )) return; - - string barCodeName="",len = "0", batchId = "", reelId = ""; + //明新二维码解析 + if (Config.CustomerName == "MX") + { + try + { + JObject codeJson = JObject.Parse(barCode); + barCode = codeJson.Value("id"); + } + catch (Exception ex) + { + AddTextEvent(DateTime.Now, "扫码", $"产品条码({barCode})解析失败!{ex.Message}", WarningEnum.High); + return; + } + } + string barCodeName="",len = "0", batchId = "", reelId = "", erpID = ""; if (!string.IsNullOrWhiteSpace(Config.ErpDBConStr) && !string.IsNullOrWhiteSpace(Config.ErpSql) && !string.IsNullOrWhiteSpace(barCode)) { AddTextEvent(DateTime.Now,"扫码", $"产品条码({barCode})到ERP查询对应数据...", WarningEnum.Normal); @@ -767,26 +794,33 @@ namespace LeatherApp.Page if (rowData.ItemArray.Length > 1) len = rowData[1].ToString(); if (rowData.ItemArray.Length > 2) batchId = rowData[2].ToString(); if (rowData.ItemArray.Length > 3) reelId = rowData[3].ToString(); + if(Config.CustomerName == "MX") + if (rowData.ItemArray.Length > 4) erpID = rowData[4].ToString(); } else barCodeName = barCode;//没有ERP对应关系时直接使用条码做为品名 errCode = 1; - //SHNY-PX-6-*** - string[] codes = barCodeName.Split(new char[] { '-' }); - if (codes.Length < 4) + Product productInfo = null; + string pcode = ""; + string[] codes = new string[5]; + if (Config.CustomerName != "MX" && Config.CustomerName != "XCL") { - AddTextEvent(DateTime.Now,"扫码", $"产品品名({barCodeName})格式错误,不做响应!", WarningEnum.Low); - return; - } - //新开始 - this.resetUIValue(false); - errCode = 2; - //加载新产品 - string pcode = "1-" + codes[2]; - if (codes[1] == "0" || Config.SuedeList1.Contains(codes[1])) - pcode = "0-" + codes[2]; - + //SHNY-PX-6-*** + codes = barCodeName.Split(new char[] { '-' }); + if (codes.Length < 4) + { + AddTextEvent(DateTime.Now, "扫码", $"产品品名({barCodeName})格式错误,不做响应!", WarningEnum.Low); + return; + } + //新开始 + this.resetUIValue(false); + errCode = 2; + //加载新产品 + pcode = "1-" + codes[2]; + if (codes[1] == "0" || Config.SuedeList1.Contains(codes[1])) + pcode = "0-" + codes[2]; + #if false else pcode = codes[1] + "-" + codes[2]; @@ -794,21 +828,85 @@ namespace LeatherApp.Page else pcode = "1-" + codes[2]; #else - else if (codes[1] == "1" || Config.SuedeList2.Contains(codes[1])) - pcode = "1-" + codes[2]; - else if (codes[1] == "2" || Config.SuedeList3.Contains(codes[1])) - pcode = "2-" + codes[2]; - else if (codes[1] == "3" || Config.SuedeList4.Contains(codes[1])) - pcode = "3-" + codes[2]; - else if (codes[1] == "4" || Config.SuedeList5.Contains(codes[1])) - pcode = "4-" + codes[2]; - else if (codes[1] == "5" || Config.SuedeList6.Contains(codes[1])) - pcode = "5-" + codes[2]; - else - pcode = "1-" + codes[2]; + else if (codes[1] == "1" || Config.SuedeList2.Contains(codes[1])) + pcode = "1-" + codes[2]; + else if (codes[1] == "2" || Config.SuedeList3.Contains(codes[1])) + pcode = "2-" + codes[2]; + else if (codes[1] == "3" || Config.SuedeList4.Contains(codes[1])) + pcode = "3-" + codes[2]; + else if (codes[1] == "4" || Config.SuedeList5.Contains(codes[1])) + pcode = "4-" + codes[2]; + else if (codes[1] == "5" || Config.SuedeList6.Contains(codes[1])) + pcode = "5-" + codes[2]; + else + pcode = "1-" + codes[2]; #endif + productInfo = svcProduct.GetModelNav(pcode); //frmProduct.loadProduct(code); + } + else if(Config.CustomerName == "MX") + { + //新开始 + this.resetUIValue(false); + AddTextEvent(DateTime.Now, "扫码", $"产品品名({barCodeName}),ERP-ID:{erpID}!", WarningEnum.Normal); + productInfo = svcProduct.GetModelNavByErpID(erpID); + if(productInfo == null) + { + //添加配方 + AddErpFrm frm = new AddErpFrm(erpID); + frm.Render(); + frm.Text = "绑定ERP信息"; + frm.ShowDialog(); + if (frm.IsOK) + { + AddTextEvent(DateTime.Now, "扫码", $"产品品名({barCodeName})-ERP_ID({erpID})对应配方添加!"); - var productInfo = svcProduct.GetModelNav(pcode); //frmProduct.loadProduct(code); + productInfo = svcProduct.GetModelNavByErpID(erpID); + } + else + { + AddTextEvent(DateTime.Now, "扫码", $"产品品名({barCodeName})-ERP_ID({erpID})对应配方不存在,请先添加ERP绑定设置,暂停设备!", WarningEnum.High); + warning(WarningEnum.Low);//暂停 + return; + } + frm.Dispose(); + } + pcode = barCodeName; + codes[0] = "MX"; + codes[1] = productInfo.Material; + codes[2] = productInfo.Color.ToString(); + } + else if (Config.CustomerName == "XCL") + { + erpID = barCodeName; + //新开始 + this.resetUIValue(false); + AddTextEvent(DateTime.Now, "扫码", $"产品品名({barCodeName}),ERP-ID:{erpID}!", WarningEnum.Normal); + productInfo = svcProduct.GetModelNavByErpID(erpID); + if (productInfo == null) + { + //添加配方 + AddErpFrm frm = new AddErpFrm(erpID); + frm.Render(); + frm.Text = "绑定ERP信息"; + frm.ShowDialog(); + if (frm.IsOK) + { + AddTextEvent(DateTime.Now, "扫码", $"产品品名({barCodeName})-ERP_ID({erpID})对应配方添加!"); + productInfo = svcProduct.GetModelNavByErpID(erpID); + } + else + { + AddTextEvent(DateTime.Now, "扫码", $"产品品名({barCodeName})-ERP_ID({erpID})对应配方不存在,请先添加ERP绑定设置,暂停设备!", WarningEnum.High); + warning(WarningEnum.Low);//暂停 + return; + } + frm.Dispose(); + } + pcode = barCodeName; + codes[0] = "XCL"; + codes[1] = productInfo.Material; + codes[2] = productInfo.Color.ToString(); + } Records record; lock (lockCurrKey) { @@ -854,13 +952,34 @@ namespace LeatherApp.Page Material = codes[0] + "-" + codes[1],// (materialItem == null ? "未知" : materialItem["name"].ToString()), BarCode = barCode, BarCodeName = barCodeName, - ErpLen=double.Parse(len), - BatchId=batchId, - ReelId=reelId, + ErpLen = double.Parse(len), + BatchId = batchId, + ReelId = reelId, ModifyUserCode = Config.loginUser.Code, CreateUserCode = Config.loginUser.Code, + DefectInfoList = new List(), }; +#if UPDATA + if (!svcRecord.InsertNav(record)) + { + AddTextEvent(DateTime.Now, "数据预存", $"数据预存失败!", WarningEnum.High); + return; + } + var trecord = svcRecord.GetRecordsNav(record.BarCode, record.BarCodeName); + if(trecord == null) + { + AddTextEvent(DateTime.Now, "数据预存", $"预存数据获取失败失败!", WarningEnum.High); + return; + } + else + { + AddTextEvent(DateTime.Now, "数据预存", $"产品条码({trecord.BarCode}),创建时间({trecord.CreateTime})", WarningEnum.Normal); + } + trecord.ProductInfo = productInfo; + htTask.Add(currKey, trecord); +#else htTask.Add(currKey, record); +#endif } errCode = 8; // @@ -905,9 +1024,9 @@ namespace LeatherApp.Page this.swcDefectPauseForUser.Active = this.defectPauseForUser = productInfo.DefectPauseForUser; })); - // + // + //ptStopWatch.Reset(); pStopWatch.Restart(); - ptStopWatch.Reset(); errCode = 19; //扫码成功 _IsGetErpCode = true; @@ -980,15 +1099,18 @@ namespace LeatherApp.Page devContainer.start(this.picScanner1, this.picScanner2); //devContainer.start(IntPtr.Zero,IntPtr.Zero); #if NT + t_test0 = new System.Threading.Thread(GetLenAndSpd); + t_test0.IsBackground = true; + t_test0.Start(); t_test1 = new System.Threading.Thread(Cam1ThreadFunction); t_test1.IsBackground = true; t_test1.Start(); t_test2 = new System.Threading.Thread(Cam2ThreadFunction); t_test2.IsBackground = true; t_test2.Start(); - t_test1 = new System.Threading.Thread(MainThreadFunction); - t_test1.IsBackground = true; - t_test1.Start(); + t_test3 = new System.Threading.Thread(MainThreadFunction); + t_test3.IsBackground = true; + t_test3.Start(); #endif } private DataRow loadErpData(string barCode) @@ -1090,6 +1212,223 @@ namespace LeatherApp.Page } #endregion + #region 长度与速度流程 + + #region 计米器位置和速度 + /// + /// 分卷上次长度 + /// + private double ActiveSpeed = 0; + //实时位置 + private double ActiveDis = 0; + private object LockSpd = new object(); + private object LockDis = new object(); + private void SetSpd(double spd) + { + lock (LockSpd) + { + ActiveSpeed = spd; + } + } + private double GetSpd() + { + double spd; + lock (LockSpd) + { + spd = ActiveSpeed; + } + return spd; + } + private void SetDis(double dis) + { + lock (LockDis) + { + ActiveDis = dis; + } + } + private double GetDis() + { + double dis; + lock (LockDis) + { + dis = ActiveDis; + } + return dis; + } + #endregion + /// + /// 第一次计米启用 + /// + private bool JmFtStart = false; + //计算速度用,计算实时速度 + private Stopwatch pRunSpeedWatch = new Stopwatch(); + /// + /// 获取速度和长度 + /// + private void GetLenAndSpd() + { + int errStep = 0; + double stl = 0; //计米起始位置 + double etl = 0; //计米结束位置 + double spl = 0; //计算速度计米位置 + double yqjimi = 0; //计米长度 + double cehouDis = 0;//测厚位置记录 + double UseTime = 1; + double preSpd = 0;//上次速度,防止速度出差 + double rioSpd = 0.3;//过冲 + bool haveNG = false; + AddTextEvent(DateTime.Now, "传感器流程", $"流程启动!"); + while (true) + { + int spdcnt = 0; + try + { + if (_cts.IsCancellationRequested) + break; + + if (true) + { + ////暂停开始 + //stopWatch.Start(); + do + { + if (currKey > 0) + { + Records curRecord = Hashtable.Synchronized(htTask)[currKey] as Records; + #region 实时速度 + +#if JM + double length = devContainer.GetLength(); + if (length < 9999) + { + haveNG = false; + curRecord.Len = length; + if (!JmFtStart) + { + //第一次记录起始数据 + stl = 0; + spl = 0; + cehouDis = 0; + JmFtStart = true; + pRunSpeedWatch.Restart(); + } + else + { + errStep = 2; + //1s计算一次实时速度 + double dt = pRunSpeedWatch.ElapsedMilliseconds; + if (dt / 1000.0d > UseTime) + { + double spddis = Math.Abs(length - spl); + spl = length; + + double runOnePicTime = dt / 1000.0d / (60.0d);//总时间 分 + double spd = Math.Round(spddis / runOnePicTime, 2); + //if (spd !=0&&((Math.Abs(spd - preSpd) / preSpd) > rioSpd)) + //{ + // spd = (Math.Abs(spd - preSpd))/4 + preSpd; + //} + errStep = 3; + preSpd = spd; + SetSpd(spd); + + if (spdcnt > 2) + { + AddTextEvent(DateTime.Now, $"计米对比", $"计米器距离{Math.Round(spddis, 2)},计米速度{Math.Round(spd, 2)},计米时间{Math.Round(runOnePicTime, 4)}", WarningEnum.Normal, false); + spdcnt = 0; + } + spdcnt++; + //重新计时 + pRunSpeedWatch.Restart(); + } + errStep = 4; + etl = length;//记录当前读数 + yqjimi = Math.Round((etl - stl) / 1.00, 2); //记录长度 + SetDis(yqjimi); + } + lock (lockCurrKey) + { + errStep = 5; + curRecord.Len = yqjimi; + curRecord.TimeLen = pStopWatch.ElapsedMilliseconds / 1000.0d / 60.0d;//总时间 分 + } + double tRunSpd = GetSpd();//1s计算的实时速度 + this.BeginInvoke(new System.Action(() => + { + AddTextEvent(DateTime.Now, $"记录", $"(计米{yqjimi}米), 速度:{tRunSpd}米/分", WarningEnum.Normal, false); + this.lblLen.Text = $"{yqjimi}米";//$"{lenMi}米"; + this.lblSpeed.Text = $"速度:{tRunSpd}米/分";//$"速度:{Math.Round(lenMi / curRecord.TimeLen, 2)}米/分"; + })); + } + else + { + if (haveNG) + { + AddTextEvent(DateTime.Now, "运行报警", $"计米器无数据", WarningEnum.Low); + haveNG = true; + } + // stLen = lenMi; + // curRecord.Len = lenMi; + // this.BeginInvoke(new System.Action(() => + // { + // AddTextEvent(DateTime.Now, $"计米无数据记录", $"(计米{stLen}米), 速度:{Math.Round(lenMi / curRecord.TimeLen, 2)}米/分", WarningEnum.Normal, false); + // this.lblLen.Text = $"@ {stLen}米";//$"{lenMi}米"; + // this.lblLen.Tag = faceWidthX_cm; + // this.lblSpeed.Text = $"@速度:{Math.Round(lenMi / curRecord.TimeLen, 2)}米/分"; + // this.uilbKF.Text = $"当前幅宽:{faceWidthY_cm}cm"; + // })); + } + +#endif + } + +#endregion + +#if Online + lock (lockCurrKey) + { + errStep = 15; + #region 换卷长度提示 + if (confMgr.SysConfigParams.OpenLengthCount) + { + if (curRecord.ProductInfo.residueWarnningLen > 0 && yqjimi > curRecord.ProductInfo.residueWarnningLen) + { + Log($"告警", $"已经达到换卷长度最大值{curRecord.ProductInfo.residueWarnningLen}-当前长度{yqjimi}-", WarningEnum.High); + } + } + #endregion + + #region 测厚停止 + if (confMgr.SysConfigParams.OpenLengthCount && curRecord.ProductInfo.OpenThicknessDetection) + { + errStep = 16; + if (curRecord.ProductInfo.ThicknessDetectionStopDis > 0 && (yqjimi - cehouDis) > curRecord.ProductInfo.ThicknessDetectionStopDis) + { + Stop(); + Log($"测厚提示", $"已经达到测厚位置{curRecord.ProductInfo.ThicknessDetectionStopDis}-当前前进长度{(yqjimi - cehouDis)}-", WarningEnum.High); + } + } + #endregion + } + } +#endif + Thread.Sleep(300); + } while (!isBreakProcessRun()); + //暂停中断 + //stopWatch.Stop(); + //pStopWatch.Stop(); + //_isRuning = false; + } + Thread.Sleep(10); + } + catch (Exception e) + { + AddTextEvent( DateTime.Now, "运行报警", $"传感器流程运行出错{errStep}:" + e.Message , WarningEnum.High); + } + } + } +#endregion + #region 相机线程1 && 二次判定 /// /// 相机1采图预处理 @@ -1130,6 +1469,13 @@ namespace LeatherApp.Page } bool gsts = devContainer.devCamer1.readDataImage(out index, out Image, out devNo); //AcquisitionMat acq = _LinecamDev1.GetFrames(100); +#else + Thread.Sleep(2500); + bool gsts = true; + int index = 0; + Mat Image = timg; + int devNo = 0; +#endif if (gsts) { //double stLen = devContainer.GetLength(); @@ -1284,7 +1630,10 @@ namespace LeatherApp.Page this.BeginInvoke(new System.Action(() => { int liDefectCount = lstEditDefect.Count; - FHome_Defect frmDefect = new FHome_Defect(lstEditDefect, defectTag[liPhotoIndex]); + string filename = Path.Combine(Config.appBasePath + "\\TempPic\\", defectTag[liPhotoIndex]); + var pmat = new Mat(filename); + //var pimage = (Bitmap)pmat.ToBitmap().Clone(); + FHome_Defect frmDefect = new FHome_Defect(lstEditDefect, pmat); if (frmDefect.ShowDialog() == DialogResult.OK) { defectTag.Remove(liPhotoIndex); @@ -1362,6 +1711,44 @@ namespace LeatherApp.Page } } } +#if false //未在改时间进行判定,改为检出时候 + else if(Config.OpenWarnBeep) + { + AddTextEvent(DateTime.Now, $"拍照", $"图像索引:{index},标识数:{curRecord.dicPhoto_Defect.Count}", WarningEnum.Normal, false); + int liPhotoIndex = index - Config.defectPauseSkipPhotoCount; + AddTextEvent(DateTime.Now, $"拍照", $"Dev={devNo},图像{index} {liPhotoIndex}={index}-{Config.defectPauseSkipPhotoCount};", WarningEnum.Normal, false); + if (liPhotoIndex >= 0 && curRecord.dicPhoto_Defect.ContainsKey(liPhotoIndex) && curRecord.dicPhoto_Defect[liPhotoIndex]) + { + errStep = 8; + //for (int fi = 0; fi < 3; fi++) + { + //循环等待数据后期处理完成 + //Thread.Sleep(500); + List lstEditDefect = curRecord.DefectInfoList.Where(m => m.PhotoIndex == liPhotoIndex).ToList(); + AddTextEvent(DateTime.Now, $"准备报警", $"(图像{liPhotoIndex})已达观察台,瑕疵二次判断=》({string.Join(",", lstEditDefect.Select(m => m.Code).ToArray())})是否包含在({string.Join(",", curRecord.ProductInfo.DefectPauseOption.ToArray())})中。"); + //瑕疵选项过滤 + if (Config.OpenHalconDefect || curRecord.ProductInfo.DefectPauseOption.Count == 0 || lstEditDefect.Where(x => curRecord.ProductInfo.DefectPauseOption.Contains(x.Code)).Count() > 0) + { + //暂停 + AddTextEvent(DateTime.Now, $"蜂鸣报警", $"(图像{liPhotoIndex})需瑕疵报警,已达观察台。"); + if (!Config.StopIO && devContainer.devIOCard.IsInit) + { + if (Config.OpenBeep) + { + Task.Run(async () => + { + devContainer.io_output(CMDName.蜂鸣器输出, false, true, Config.BeepTime); + await Task.Delay(5); + }); + } + } + errStep = 9; + //break; + } + } + } + } +#endif errStep = 10; //以下判定放置于二次判定之后,因为二次判定可能会忽略部分检测项!! @@ -1456,18 +1843,7 @@ namespace LeatherApp.Page } _matList1.Enqueue(new tScanPhotoInfo(1, index, Image.Clone(), 0)); } -#else - Thread.Sleep(2500); - AcquisitionMat acq = new AcquisitionMat(); - { - acq.GrabStatus = "GrabPass"; - acq.Image = timg.Clone(); - Log($"图像预处理", $"模拟相机1-{Cam1Cnt}", WarningEnum.Normal, true); - } - if (acq.GrabStatus == "GrabPass") - { -#endif #endregion //System.GC.Collect(); Thread.Sleep(50); @@ -1533,6 +1909,13 @@ namespace LeatherApp.Page continue; } bool gsts = devContainer.devCamer2.readDataImage(out index, out Image, out devNo); +#else + Thread.Sleep(2500); + int index = 0; + Mat Image = timg; + int devNo = 1; + bool gsts = true; +#endif //AcquisitionMat acq = _LinecamDev1.GetFrames(100); if (gsts) { @@ -1575,18 +1958,7 @@ namespace LeatherApp.Page _matList2.Enqueue(new tScanPhotoInfo(1, index, Image.Clone(), 0)); } -#else - Thread.Sleep(2500); - AcquisitionMat acq = new AcquisitionMat(); - { - acq.GrabStatus = "GrabPass"; - acq.Image = timg.Clone(); - Log($"图像预处理", $"模拟相机1-{Cam1Cnt}", WarningEnum.Normal, true); - } - if (acq.GrabStatus == "GrabPass") - { -#endif #endregion //System.GC.Collect(); Thread.Sleep(50); @@ -1668,6 +2040,7 @@ namespace LeatherApp.Page ScanPhotoInfo scanPhotos1 = new ScanPhotoInfo(tscanPhotos1.devIndex, tscanPhotos1.photoIndex, tscanPhotos1.mat); Stopwatch stopWatch = new Stopwatch(); + curRecord.ScannerPhotoCount++; AddTextEvent(DateTime.Now, $"图像处理", $"图像{scanPhotos0.photoIndex}", WarningEnum.Low, false); string time = ""; stopWatch.Start(); @@ -1718,7 +2091,7 @@ namespace LeatherApp.Page AddTextEvent(DateTime.Now, $"裁边", $"(图像{scanPhotos0.photoIndex}); 裁边去孔洞后:({mat0.Width}+{mat1.Width}={mat0.Width + mat1.Width});合并后(去孔洞):{mat.Width}*{mat.Height}", WarningEnum.Normal, false); float widthRatio = mat.Width * 1.0f / resize.Width;//宽度比例 time += $"->图1+2合并({stopWatch.ElapsedMilliseconds})"; - + errStep = 5; //门幅更新(含两侧孔洞)x,y cm float faceWidthX_cm = (float)Math.Round((scanPhotos0.photoIndex + 1) * mat.Height * 1.0f / Config.cm2px_y, 2); float faceWidthY_cm = (float)Math.Round((mat.Width + Config.MarginHoleWidth * 2) * 1.0f / Config.cm2px_x, 2); @@ -1731,7 +2104,7 @@ namespace LeatherApp.Page var point = new float[] { faceWidthX_cm, faceWidthY_cm };// new System.Drawing.PointF(faceWidthX_cm, faceWidthY_cm); AddTextEvent(DateTime.Now, $"门幅", $"(图像{scanPhotos0.photoIndex})-({scanPhotos0.photoIndex})位置:{point[0]}; 幅宽:{point[1]}", WarningEnum.Normal, false); curRecord.FacePointList.Add(point); - + errStep = 6; List mfdata = new List(); for (int i = 0; i < curRecord.FacePointList.Count; i++) //foreach (var item in curRecord.FacePointList) @@ -1750,10 +2123,10 @@ namespace LeatherApp.Page // curRecord.TimeLen = pStopWatch.ElapsedMilliseconds / 1000.0d / 60.0d;//总时间 分 #if JM - double stLen = devContainer.GetLength(); - if (stLen < 9999) - { - curRecord.Len = stLen; + //double stLen = devContainer.GetLength(); + //if (stLen < 9999) + //{ + // curRecord.Len = stLen; #else double lenMi = Math.Round(faceWidthX_cm / 100, 2); double stLen = lenMi; @@ -1763,23 +2136,37 @@ namespace LeatherApp.Page this.BeginInvoke(new System.Action(() => { //double sstLen = devContainer.GetLength(); - ptTime = ptStopWatch.ElapsedMilliseconds / 1000.0d / 60.0d;//总时间 分 - AddTextEvent(DateTime.Now, $"记录", $"(计米{stLen}米),时间:{ptTime}分; 速度:{Math.Round((stLen - ptLen) / ptTime, 2)}米/分", WarningEnum.Normal, false); + //ptTime = ptStopWatch.ElapsedMilliseconds / 1000.0d / 60.0d;//总时间 分 + //AddTextEvent(DateTime.Now, $"记录", $"(计米{stLen}米),时间:{ptTime}分; 速度:{Math.Round((stLen - ptLen) / ptTime, 2)}米/分", WarningEnum.Normal, false); - this.lblLen.Text = $"{stLen}米";//$"{lenMi}米"; - this.lblLen.Tag = faceWidthX_cm; + //this.lblLen.Text = $"{stLen}米";//$"{lenMi}米"; + //this.lblLen.Tag = faceWidthX_cm; #if JM - this.lblSpeed.Text = $"速度:{Math.Round((stLen - ptLen) / ptTime, 2)}米/分";//$"速度:{Math.Round(lenMi / curRecord.TimeLen, 2)}米/分"; + //this.lblSpeed.Text = $"速度:{Math.Round((stLen - ptLen) / ptTime, 2)}米/分";//$"速度:{Math.Round(lenMi / curRecord.TimeLen, 2)}米/分"; #else this.lblSpeed.Text = $"速度:{Math.Round(lenMi / curRecord.TimeLen, 2)}米/分"; #endif this.uilbKF.Text = $"当前幅宽:{faceWidthY_cm}cm"; - ptLen = stLen; - ptStopWatch.Restart();//重新计时 + //ptLen = stLen; + //ptStopWatch.Restart();//重新计时 })); #if JM - } + //} + //else + //{ + // double lenMi = Math.Round(faceWidthX_cm / 100, 2); + // stLen = lenMi; + // curRecord.Len = lenMi; + // this.BeginInvoke(new System.Action(() => + // { + // AddTextEvent(DateTime.Now, $"计米无数据记录", $"(计米{stLen}米), 速度:{Math.Round(lenMi / curRecord.TimeLen, 2)}米/分", WarningEnum.Normal, false); + // this.lblLen.Text = $"@ {stLen}米";//$"{lenMi}米"; + // this.lblLen.Tag = faceWidthX_cm; + // this.lblSpeed.Text = $"@速度:{Math.Round(lenMi / curRecord.TimeLen, 2)}米/分"; + // this.uilbKF.Text = $"当前幅宽:{faceWidthY_cm}cm"; + // })); + //} #endif // errStep = 9; @@ -2472,7 +2859,7 @@ namespace LeatherApp.Page double stLen = devContainer.GetLength(); curRecord.Len = stLen; #else - stLen = lenMi; + double stLen = lenMi; #endif //ptTime = ptStopWatch.ElapsedMilliseconds / 1000.0d / 60.0d;//总时间 分 this.BeginInvoke(new System.Action(() => @@ -2579,9 +2966,14 @@ namespace LeatherApp.Page DefectInfo defectInfo=null; List dataRowlist=new List(); long preTicks = pStopWatch.ElapsedMilliseconds;// DateTime.Now.Ticks; + List tempDefect = new List(); + + string currentDate = DateTime.Now.ToString("HHmmssfff"); //"yyyyMMddHHmmssfff:ffffff" + Image LastImg = BitmapConverter.ToBitmap(res.lstDefectBmp[0]); for (int i = 0; i < res.lstDefectBmp.Count; i++) { step = 5 + i * 10; + string imgid = currentDate + i.ToString("000"); defectNameInfo = Config.getDefectItem(int.Parse(res.excelTable.Rows[i]["类别"].ToString())); defectInfo = new DefectInfo @@ -2597,18 +2989,35 @@ namespace LeatherApp.Page ZXD = double.Parse(res.excelTable.Rows[i]["置信度"].ToString()), Contrast = double.Parse(res.excelTable.Rows[i]["对比度"].ToString()), Target = int.Parse(res.excelTable.Rows[i]["目标"].ToString()), - image = BitmapConverter.ToBitmap(res.lstDefectBmp[i]) + imageID = imgid,//res.lstDefectBmp[i].Clone(), }; defectInfo.ModifyUserCode = defectInfo.CreateUserCode = res.record.CreateUserCode; step = 6 + i * 10; res.record.DefectInfoList.Add(defectInfo); + tempDefect.Add(defectInfo); defectInfo.uid = preTicks++;// res.record.DefectInfoList.Count;//程序中的唯一索引,用于移除用索引 //AddTextEvent(DateTime.Now,$"打标完成", $"第{i}个缺陷:{ JsonConvert.SerializeObject(defectInfo)}; Y={res.photoIndex * res.bmp.Height * 1.0d / Config.cm2px_y}+{res.excelTable.Rows[i]["Y"].ToString()}"); step = 7 + i * 10; - + //二次判定大图缓存 + //if (!defectTag.ContainsKey(res.photoIndex)) + //{ + // defectTag.Add(res.photoIndex, res.bmpTag.Clone()); + //} if (!defectTag.ContainsKey(res.photoIndex)) { - defectTag.Add(res.photoIndex, res.bmpTag.Clone()); + defectTag.Add(res.photoIndex, currentDate + "Img.jpg"); + } + + //保存二次判定查看图 + if (true) //全部保存 + { + if (!Directory.Exists(Config.appBasePath + "\\TempPic\\")) + { + Directory.CreateDirectory(Config.appBasePath + "\\TempPic\\"); + } + string filename = Path.Combine(Config.appBasePath + "\\TempPic\\", $"{imgid}.jpg"); + res.lstDefectBmp[i].ImWrite(filename); + LastImg = BitmapConverter.ToBitmap(res.lstDefectBmp[i]); } //保存打标小图 if (Config.IsSaveDefectCutImage) @@ -2652,6 +3061,18 @@ namespace LeatherApp.Page } } } + //保存二次判定查看图 大图 + if (true) //全部保存 + { + if (!Directory.Exists(Config.appBasePath + "\\TempPic\\")) + { + Directory.CreateDirectory(Config.appBasePath + "\\TempPic\\"); + } + string filename = Path.Combine(Config.appBasePath + "\\TempPic\\", currentDate + "Img.jpg"); + res.bmpTag.ImWrite(filename); + } + + AddTextEvent(DateTime.Now,$"检测完成", "更新UI", WarningEnum.Low, false); //更新UI int bmpHeight = res.bmp.Height; @@ -2659,7 +3080,7 @@ namespace LeatherApp.Page { //这里显示了第1张图的最后一个缺陷 if (this.uiDataGridView1.Rows.Count == 0 && defectInfo!=null) - this.picDefectImage.loadImage(defectInfo.image); + this.picDefectImage.loadImage(LastImg); foreach (var rowItem in dataRowlist) this.uiDataGridView1.Rows.Insert(0, rowItem); @@ -2711,8 +3132,35 @@ namespace LeatherApp.Page #endif } #endif + +#if true //检出时候 + if(Config.OpenWarnBeep) + { + //蜂鸣 + AddTextEvent(DateTime.Now, $"蜂鸣报警", $"(图像{res.photoIndex})判断是否需要报警{string.Join(",", tempDefect.Select(m => m.Code).ToArray())})是否包含在({string.Join(",", res.record.ProductInfo.DefectPauseOption.ToArray())})中"); + if (res.record.ProductInfo.DefectPauseOption == null || + res.record.ProductInfo.DefectPauseOption.Count ==0 || + tempDefect.Where(x => res.record.ProductInfo.DefectPauseOption.Contains(x.Code)).Count() > 0) + { + AddTextEvent(DateTime.Now, $"蜂鸣报警", $"(图像{res.photoIndex})需瑕疵报警,已检出瑕疵。"); + if (!Config.StopIO && devContainer.devIOCard.IsInit) + { + if (Config.OpenBeep) + { + Task.Run(async () => + { + devContainer.io_output(CMDName.蜂鸣器输出, false, true, Config.BeepTime); + await Task.Delay(5); + }); + } + } + } + step = 11; + } +#endif } + } else { @@ -2743,6 +3191,11 @@ namespace LeatherApp.Page } finally { +#if UPDATA + //数据保存 + if (!svcRecord.UpdateNav(res.record)) + AddTextEvent(DateTime.Now, $"数据更新", $"数据更新失败,record-ID{res.record.Id}"); +#endif res.record.ScannerPhotoFinishCount++; int liScannerPhotoFinishCount = res.record.ScannerPhotoFinishCount; int liScannerPhotoCount = res.record.ScannerPhotoCount; @@ -2777,6 +3230,7 @@ namespace LeatherApp.Page step = 2; if (model.Len == 0) { + AddTextEvent(DateTime.Now, "入库失败", $"计米长度为0", WarningEnum.Low); _isDefect = false; return; } @@ -2784,8 +3238,19 @@ namespace LeatherApp.Page model.BatchId = batchId; model.ReelId = reelId; model.ErpLen = erpLen; + AddTextEvent(DateTime.Now, "入库", $"等待处理完成{model.ScannerPhotoCount}-{model.ScannerPhotoFinishCount}"); + DateTime dt = DateTime.Now; + bool isTimeout = false; while (model.ScannerPhotoCount > model.ScannerPhotoFinishCount) + { await Task.Delay(100); + if ((DateTime.Now - dt).TotalSeconds > 3) + { + isTimeout = true; + break; + } + } + if (isTimeout) { AddTextEvent(DateTime.Now, "入库处理", $"等待完成超时"); } step = 3; //计算等级标准 List gradeLimitList = model.ProductInfo.GradeLimitList; @@ -2810,8 +3275,14 @@ namespace LeatherApp.Page step = 5; } model.Qualified = (model.Grade < 6);//是否合格 + +#if UPDATA + if (!svcRecord.UpdateNav(model)) + throw new Exception("写库失败!"); +#else if (!svcRecord.InsertNav(model)) throw new Exception("写库失败!"); +#endif AddTextEvent(DateTime.Now,"入库完成", $"({key}) 批号({model.BatchId})已完成检测。"); if(!string.IsNullOrEmpty(Config.ServerDBConStr)) @@ -2878,6 +3349,12 @@ namespace LeatherApp.Page //重置缓存 scanPhotos = new ScanPhotoInfo[3]; #if NT + if (t_test0 != null) + { + bool b = t_test0.Join(5000); + if (!b) t_test0.Abort(); + t_test0 = null; + } if (t_test1 != null) { bool b = t_test1.Join(5000); @@ -3011,6 +3488,29 @@ namespace LeatherApp.Page }); } } + private void ClearTempPic() + { + //清空二次判定缓存 + if (!Directory.Exists(Config.appBasePath + "\\TempPic\\")) + { + return; + } + else + { + string[] array = Directory.GetFiles(Config.appBasePath + "\\TempPic\\"); + foreach (string text in array) + { + try + { + File.Delete(text); + } + catch (Exception ex) + { + ; + } + } + } + } private void startCommand() { if (!devContainer.state || currentState == CurrentStateEnum.运行中) @@ -3037,6 +3537,7 @@ namespace LeatherApp.Page { pStopWatch.Start(); ptStopWatch.Start(); + pRunSpeedWatch.Start(); } //写I/O启动。。。 //继续读取编译器和门幅等 @@ -3063,7 +3564,11 @@ namespace LeatherApp.Page AddTextEvent(DateTime.Now,"启动", "开始测试..."); currentState = CurrentStateEnum.运行中; defectTag.Clear(); + ClearTempPic(); ThnDieLen = 0; + JmFtStart = false; + pStopWatch.Restart(); + pRunSpeedWatch.Restart(); } this.Invoke(new System.Action(() => @@ -3166,6 +3671,7 @@ namespace LeatherApp.Page txtBarCodeName.Text = txtBatchId.Text = txtReelId.Text = ""; pStopWatch.Stop(); ptStopWatch.Stop(); + pRunSpeedWatch.Stop(); this.btnStart.Enabled = true; this.btnEnd.Enabled = this.btnPause.Enabled = false;//这里有问题,应该是devPlc回调设置 _IsGetErpCode = false; @@ -3569,16 +4075,205 @@ namespace LeatherApp.Page private void button2_Click(object sender, EventArgs e) { - double sstLen = devContainer.GetLength(); - MessageBox.Show($"{sstLen}"); + //double sstLen = devContainer.GetLength(); + //MessageBox.Show($"{sstLen}"); + + + AddErpFrm frm = new AddErpFrm("dwerw31"); + frm.Render(); + frm.Text = "绑定ERP信息"; + frm.ShowDialog(); + if (frm.IsOK) + { + UIMessageTip.ShowWarning("Erp信息绑定成功", 2000); + } + + frm.Dispose(); + + //DefectInfo defectInfo = new DefectInfo(); + //defectInfo.Code = "lj"; + //defectInfo.Id = 7; + //defectInfo.Name = "test"; + //defectInfo.ZXD = 0.9; + //defectInfo.ModifyUserCode = "tt"; + //defectInfo.ModifyTime = DateTime.Now; + //defectInfo.CreateUserCode = "tt"; + //defectInfo.CreateTime = DateTime.Now; + + //Records records = new Records(); + //records.currKey = 1; + //records.BarCode = "1234567"; + //records.BarCodeName = "abdff"; + //records.Material = "gh"; + //records.Color = "black"; + //records.BatchId = "555"; + //records.ReelId = "666"; + //records.ErpLen = 100; + ////records.ProductInfo = pdt; + //records.DefectInfoList = new List { defectInfo }; + //records.ModifyUserCode = "tt"; + //records.ModifyTime = DateTime.Now; + //records.CreateUserCode = "tt"; + //records.CreateTime = DateTime.Now; + //if (!svcRecord.InsertNav(records)) + //{ + // AddTextEvent(DateTime.Now, "数据预存", $"数据预存失败!", WarningEnum.High); + // return; + //} + //var trecord = svcRecord.GetRecordsNav(records.BarCode, records.BarCodeName); + //if (trecord == null) + //{ + // AddTextEvent(DateTime.Now, "数据预存", $"预存数据获取失败失败!", WarningEnum.High); + // return; + //} + //else + //{ + // AddTextEvent(DateTime.Now, "数据预存", $"产品条码({trecord.BarCode}),创建时间({trecord.CreateTime})", WarningEnum.Normal); + //} + //trecord.Color = "111"; + //if (!svcRecord.UpdateNav(trecord)) + // AddTextEvent(DateTime.Now, $"数据更新", $"数据更新失败,record-ID{trecord.Id}"); } #region ERP测试 private void button3_Click(object sender, EventArgs e) { - string code = "RSHX2410002536"; - var dt = loadErpData(code); - MessageBox.Show($"{JsonConvert.SerializeObject(dt)}"); + //string code = "RSHX2410002536"; + //var dt = loadErpData(code); + //MessageBox.Show($"{JsonConvert.SerializeObject(dt)}"); +#if false + try + { + if (Config.ErpDBType == "Oracle") + { + SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() + { + DbType = SqlSugar.DbType.Oracle, + ConnectionString = Config.ErpDBConStr, + InitKeyType = InitKeyType.Attribute, + IsAutoCloseConnection = true, + AopEvents = new AopEvents + { + OnLogExecuting = (tsql, p) => + { + Console.WriteLine(tsql); + Console.WriteLine(string.Join(",", p?.Select(it => it.ParameterName + ":" + it.Value))); + } + } + }); + //var dt = db.Ado.GetDataTable(sql); + //if (dt != null) + //{ + // for (int i = 0; i < dt.Rows.Count; i++) + // { + // Console.WriteLine($"PJXTBH:{dt.Rows[i]["PJXTBH"]},WPH:{dt.Rows[i]["WPH"]},WPMC:{dt.Rows[i]["WPMC"]},SL:{dt.Rows[i]["SL"]},PH:{dt.Rows[i]["PH"]},JH:{dt.Rows[i]["JH"]}"); + // } + //} + + string sqlstr = $"select * from tb_qc_prodinfo where PJXTBH='RSHX2410002536'"; + var dt2 = db.Ado.GetDataTable(sqlstr); + dt2.Columns.RemoveAt(0); + dt2.Columns.RemoveAt(0); + MessageBox.Show($"{ JsonConvert.SerializeObject(dt2.Rows[0])}"); + //var dt2 = db.Ado.GetDataTable(sqlstr); + } + else if (Config.ErpDBType == "PostgreSQL") + { + string dbStr = "PORT=5432;DATABASE=postgres;HOST=100.0.1.25;PASSWORD=fqc_password1;USER ID=fqc_user1"; + SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() + { + DbType = SqlSugar.DbType.PostgreSQL, + ConnectionString = dbStr, + IsAutoCloseConnection = true, + LanguageType = LanguageType.Default,//Set language + AopEvents = new AopEvents + { + OnLogExecuting = (tsql, p) => + { + Console.WriteLine(tsql); + Console.WriteLine(string.Join(",", p?.Select(it => it.ParameterName + ":" + it.Value))); + } + } + }); + + string sqlstr = $"select * from mingxin_prod"; + var dt2 = db.Ado.GetDataTable(sqlstr); + //dt2.Columns.RemoveAt(0); + //dt2.Columns.RemoveAt(0); + + MessageBox.Show($"{JsonConvert.SerializeObject(dt2.Rows[0])}"); + //var dt2 = db.Ado.GetDataTable(sqlstr); + } + } + catch (Exception ex) + { + MessageBox.Show($"ERP报错:{ex.Message}"); + } +#endif +#if true //测试新材料服务器 + try + { + string dbstring = Config.ServerDBConStr; + dbstring = "server=localhost;Database=LeatherDB;Uid=root;Pwd=123456; AllowLoadLocalInfile=true"; + QualifiedLimit qualifiedLimit = new QualifiedLimit(); + qualifiedLimit.Code = "lj"; + qualifiedLimit.ZXD = 1; + qualifiedLimit.ModifyUserCode = "tt"; + qualifiedLimit.ModifyTime = DateTime.Now; + qualifiedLimit.CreateUserCode = "tt"; + qualifiedLimit.CreateTime = DateTime.Now; + GradeLimit gradeLimit = new GradeLimit(); + gradeLimit.Code = "lj"; + gradeLimit.A = 10; + gradeLimit.ModifyUserCode = "tt"; + gradeLimit.ModifyTime = DateTime.Now; + gradeLimit.CreateUserCode = "tt"; + gradeLimit.CreateTime = DateTime.Now; + Product pdt = new Product(); + pdt.Code = "7788"; + pdt.Gain = 1; + pdt.Color = 91; + pdt.Material = "额绒面2"; + pdt.ModelName = DateTime.Now.ToString(); + //pdt.Id = 9888; + pdt.QualifiedLimitList = new List { qualifiedLimit }; + pdt.GradeLimitList = new List { gradeLimit }; + pdt.ModifyUserCode = "tt"; + pdt.ModifyTime = DateTime.Now; + pdt.CreateUserCode = "tt"; + pdt.CreateTime = DateTime.Now; + DefectInfo defectInfo = new DefectInfo(); + defectInfo.Code = "lj"; + defectInfo.Id = 7; + defectInfo.Name = "test"; + defectInfo.ZXD = 0.9; + defectInfo.ModifyUserCode = "tt"; + defectInfo.ModifyTime = DateTime.Now; + defectInfo.CreateUserCode = "tt"; + defectInfo.CreateTime = DateTime.Now; + + Records records = new Records(); + records.currKey = 1; + records.BarCode = "1234567"; + records.BarCodeName = "abdff"; + records.Material = "gh"; + records.Color = "black"; + records.BatchId = "555"; + records.ReelId = "666"; + records.ErpLen = 100; + records.ProductInfo = pdt; + records.DefectInfoList = new List { defectInfo }; + records.ModifyUserCode = "tt"; + records.ModifyTime = DateTime.Now; + records.CreateUserCode = "tt"; + records.CreateTime = DateTime.Now; + InitDB.SendServerDB(dbstring, records); + } + catch (Exception ex) + { + MessageBox.Show($"上传报错:{ex.Message}"); + } +#endif } - #endregion +#endregion } } diff --git a/LeatherProject/LeatherApp/Page/FHome_Defect.cs b/LeatherProject/LeatherApp/Page/FHome_Defect.cs index 579e08e..afec80a 100644 --- a/LeatherProject/LeatherApp/Page/FHome_Defect.cs +++ b/LeatherProject/LeatherApp/Page/FHome_Defect.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -33,12 +34,14 @@ namespace LeatherApp.Page { this.Text += $" 原图索引({list[0].PhotoIndex})"; list.ForEach(item => { + string filename = Path.Combine(Config.appBasePath + "\\TempPic\\", $"{item.imageID}.jpg"); + OpenCvSharp.Mat img = new OpenCvSharp.Mat(filename); UIDefectImage userCon = new UIDefectImage() { Code = item.Code, Tag = item, DefecLocation=$"[{item.CentreX}cm,{Math.Round(item.CentreY/ 100.0f,2)}米]", - Image = item.image + Image = img.ToBitmap() }; //userCon.CodeChangeEvent = (code, name) => //{ diff --git a/LeatherProject/LeatherApp/Page/FProductInfo.Designer.cs b/LeatherProject/LeatherApp/Page/FProductInfo.Designer.cs index 14d1d56..66395a6 100644 --- a/LeatherProject/LeatherApp/Page/FProductInfo.Designer.cs +++ b/LeatherProject/LeatherApp/Page/FProductInfo.Designer.cs @@ -28,17 +28,17 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle21 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle22 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle34 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle35 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle37 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle38 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle39 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle36 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle40 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle41 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle42 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle43 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle44 = new System.Windows.Forms.DataGridViewCellStyle(); this.uiTitlePanel2 = new Sunny.UI.UITitlePanel(); this.tcbarTensionValue = new Sunny.UI.UITrackBar(); this.tcbarGain = new Sunny.UI.UITrackBar(); @@ -53,6 +53,10 @@ this.lblLightValue = new Sunny.UI.UILabel(); this.uiLabel6 = new Sunny.UI.UILabel(); this.uiTitlePanel3 = new Sunny.UI.UITitlePanel(); + this.tbClass = new Sunny.UI.UITextBox(); + this.uiLabel13 = new Sunny.UI.UILabel(); + this.tbAera = new Sunny.UI.UINumPadTextBox(); + this.uiLabel12 = new Sunny.UI.UILabel(); this.cmbModelName = new Sunny.UI.UIComboBox(); this.uiLabel1 = new Sunny.UI.UILabel(); this.uiTitlePanel4 = new Sunny.UI.UITitlePanel(); @@ -99,10 +103,8 @@ this.cmbColor = new Sunny.UI.UIComboBox(); this.uiLabel3 = new Sunny.UI.UILabel(); this.uiLabel2 = new Sunny.UI.UILabel(); - this.uiLabel12 = new Sunny.UI.UILabel(); - this.uiLabel13 = new Sunny.UI.UILabel(); - this.tbAera = new Sunny.UI.UINumPadTextBox(); - this.tbClass = new Sunny.UI.UITextBox(); + this.uiSymbolButton1 = new Sunny.UI.UISymbolButton(); + this.uiLabel14 = new Sunny.UI.UILabel(); this.uiTitlePanel2.SuspendLayout(); this.uiTitlePanel3.SuspendLayout(); this.uiTitlePanel4.SuspendLayout(); @@ -327,6 +329,8 @@ // uiTitlePanel3 // this.uiTitlePanel3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.uiTitlePanel3.Controls.Add(this.uiLabel14); + this.uiTitlePanel3.Controls.Add(this.uiSymbolButton1); this.uiTitlePanel3.Controls.Add(this.tbClass); this.uiTitlePanel3.Controls.Add(this.uiLabel13); this.uiTitlePanel3.Controls.Add(this.tbAera); @@ -349,6 +353,65 @@ this.uiTitlePanel3.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; this.uiTitlePanel3.TitleColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); // + // tbClass + // + this.tbClass.ButtonSymbolOffset = new System.Drawing.Point(0, 0); + this.tbClass.Cursor = System.Windows.Forms.Cursors.IBeam; + this.tbClass.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.tbClass.Location = new System.Drawing.Point(4, 176); + this.tbClass.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.tbClass.MinimumSize = new System.Drawing.Size(1, 16); + this.tbClass.Name = "tbClass"; + this.tbClass.Padding = new System.Windows.Forms.Padding(5); + this.tbClass.ShowText = false; + this.tbClass.Size = new System.Drawing.Size(233, 29); + this.tbClass.Style = Sunny.UI.UIStyle.Custom; + this.tbClass.TabIndex = 29; + this.tbClass.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; + this.tbClass.Watermark = ""; + // + // uiLabel13 + // + this.uiLabel13.AutoSize = true; + this.uiLabel13.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.uiLabel13.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); + this.uiLabel13.Location = new System.Drawing.Point(3, 210); + this.uiLabel13.Name = "uiLabel13"; + this.uiLabel13.Size = new System.Drawing.Size(215, 21); + this.uiLabel13.Style = Sunny.UI.UIStyle.Custom; + this.uiLabel13.TabIndex = 28; + this.uiLabel13.Text = "传统算法过滤像素面积(piexl)"; + this.uiLabel13.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // tbAera + // + this.tbAera.FillColor = System.Drawing.Color.White; + this.tbAera.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.tbAera.Location = new System.Drawing.Point(4, 236); + this.tbAera.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.tbAera.MinimumSize = new System.Drawing.Size(63, 0); + this.tbAera.Name = "tbAera"; + this.tbAera.NumPadType = Sunny.UI.NumPadType.Double; + this.tbAera.Padding = new System.Windows.Forms.Padding(0, 0, 30, 2); + this.tbAera.Size = new System.Drawing.Size(235, 29); + this.tbAera.Style = Sunny.UI.UIStyle.Custom; + this.tbAera.TabIndex = 27; + this.tbAera.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; + this.tbAera.Watermark = ""; + // + // uiLabel12 + // + this.uiLabel12.AutoSize = true; + this.uiLabel12.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.uiLabel12.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); + this.uiLabel12.Location = new System.Drawing.Point(5, 150); + this.uiLabel12.Name = "uiLabel12"; + this.uiLabel12.Size = new System.Drawing.Size(138, 21); + this.uiLabel12.Style = Sunny.UI.UIStyle.Custom; + this.uiLabel12.TabIndex = 26; + this.uiLabel12.Text = "传统算法颜色类别"; + this.uiLabel12.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // // cmbModelName // this.cmbModelName.DataSource = null; @@ -572,21 +635,21 @@ // // uiDataGridView1 // - dataGridViewCellStyle12.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); - this.uiDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle12; + dataGridViewCellStyle34.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); + this.uiDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle34; this.uiDataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.uiDataGridView1.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); this.uiDataGridView1.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single; - dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle13.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); - dataGridViewCellStyle13.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle13.ForeColor = System.Drawing.Color.White; - dataGridViewCellStyle13.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); - dataGridViewCellStyle13.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.uiDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle13; + dataGridViewCellStyle35.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle35.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); + dataGridViewCellStyle35.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle35.ForeColor = System.Drawing.Color.White; + dataGridViewCellStyle35.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); + dataGridViewCellStyle35.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle35.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.uiDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle35; this.uiDataGridView1.ColumnHeadersHeight = 32; this.uiDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.uiDataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { @@ -598,35 +661,35 @@ this.col_IsOR, this.col_Len, this.col_Cnt}); - dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle15.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle15.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle15.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); - dataGridViewCellStyle15.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255))))); - dataGridViewCellStyle15.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); - dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.uiDataGridView1.DefaultCellStyle = dataGridViewCellStyle15; + dataGridViewCellStyle37.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle37.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle37.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle37.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); + dataGridViewCellStyle37.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255))))); + dataGridViewCellStyle37.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); + dataGridViewCellStyle37.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.uiDataGridView1.DefaultCellStyle = dataGridViewCellStyle37; this.uiDataGridView1.EnableHeadersVisualStyles = false; this.uiDataGridView1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.uiDataGridView1.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(104)))), ((int)(((byte)(173)))), ((int)(((byte)(255))))); this.uiDataGridView1.Location = new System.Drawing.Point(3, 41); this.uiDataGridView1.MultiSelect = false; this.uiDataGridView1.Name = "uiDataGridView1"; - dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle16.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); - dataGridViewCellStyle16.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle16.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); - dataGridViewCellStyle16.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); - dataGridViewCellStyle16.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); - dataGridViewCellStyle16.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.uiDataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle16; + dataGridViewCellStyle38.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle38.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); + dataGridViewCellStyle38.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle38.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); + dataGridViewCellStyle38.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); + dataGridViewCellStyle38.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); + dataGridViewCellStyle38.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.uiDataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle38; this.uiDataGridView1.RowHeadersWidth = 62; - dataGridViewCellStyle17.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle17.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle17.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); - dataGridViewCellStyle17.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255))))); - dataGridViewCellStyle17.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); - this.uiDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle17; + dataGridViewCellStyle39.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle39.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle39.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); + dataGridViewCellStyle39.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255))))); + dataGridViewCellStyle39.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); + this.uiDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle39; this.uiDataGridView1.RowTemplate.Height = 30; this.uiDataGridView1.SelectedIndex = -1; this.uiDataGridView1.Size = new System.Drawing.Size(581, 308); @@ -646,8 +709,8 @@ // col_zxd // this.col_zxd.DataPropertyName = "ZXD"; - dataGridViewCellStyle14.NullValue = null; - this.col_zxd.DefaultCellStyle = dataGridViewCellStyle14; + dataGridViewCellStyle36.NullValue = null; + this.col_zxd.DefaultCellStyle = dataGridViewCellStyle36; this.col_zxd.HeaderText = "置信度"; this.col_zxd.MinimumWidth = 20; this.col_zxd.Name = "col_zxd"; @@ -718,21 +781,21 @@ // // uiDataGridView2 // - dataGridViewCellStyle18.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); - this.uiDataGridView2.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle18; + dataGridViewCellStyle40.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); + this.uiDataGridView2.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle40; this.uiDataGridView2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.uiDataGridView2.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); this.uiDataGridView2.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single; - dataGridViewCellStyle19.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle19.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); - dataGridViewCellStyle19.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle19.ForeColor = System.Drawing.Color.White; - dataGridViewCellStyle19.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); - dataGridViewCellStyle19.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle19.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.uiDataGridView2.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle19; + dataGridViewCellStyle41.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle41.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); + dataGridViewCellStyle41.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle41.ForeColor = System.Drawing.Color.White; + dataGridViewCellStyle41.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); + dataGridViewCellStyle41.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle41.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.uiDataGridView2.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle41; this.uiDataGridView2.ColumnHeadersHeight = 32; this.uiDataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.uiDataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { @@ -742,35 +805,35 @@ this.col2_3, this.col2_4, this.col2_5}); - dataGridViewCellStyle20.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle20.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle20.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle20.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); - dataGridViewCellStyle20.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255))))); - dataGridViewCellStyle20.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); - dataGridViewCellStyle20.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.uiDataGridView2.DefaultCellStyle = dataGridViewCellStyle20; + dataGridViewCellStyle42.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle42.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle42.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle42.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); + dataGridViewCellStyle42.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255))))); + dataGridViewCellStyle42.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); + dataGridViewCellStyle42.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.uiDataGridView2.DefaultCellStyle = dataGridViewCellStyle42; this.uiDataGridView2.EnableHeadersVisualStyles = false; this.uiDataGridView2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.uiDataGridView2.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(104)))), ((int)(((byte)(173)))), ((int)(((byte)(255))))); this.uiDataGridView2.Location = new System.Drawing.Point(3, 41); this.uiDataGridView2.MultiSelect = false; this.uiDataGridView2.Name = "uiDataGridView2"; - dataGridViewCellStyle21.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle21.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); - dataGridViewCellStyle21.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle21.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); - dataGridViewCellStyle21.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); - dataGridViewCellStyle21.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); - dataGridViewCellStyle21.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.uiDataGridView2.RowHeadersDefaultCellStyle = dataGridViewCellStyle21; + dataGridViewCellStyle43.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle43.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255))))); + dataGridViewCellStyle43.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle43.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); + dataGridViewCellStyle43.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); + dataGridViewCellStyle43.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); + dataGridViewCellStyle43.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.uiDataGridView2.RowHeadersDefaultCellStyle = dataGridViewCellStyle43; this.uiDataGridView2.RowHeadersWidth = 62; - dataGridViewCellStyle22.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle22.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle22.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); - dataGridViewCellStyle22.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255))))); - dataGridViewCellStyle22.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); - this.uiDataGridView2.RowsDefaultCellStyle = dataGridViewCellStyle22; + dataGridViewCellStyle44.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle44.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle44.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); + dataGridViewCellStyle44.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255))))); + dataGridViewCellStyle44.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); + this.uiDataGridView2.RowsDefaultCellStyle = dataGridViewCellStyle44; this.uiDataGridView2.RowTemplate.Height = 30; this.uiDataGridView2.SelectedIndex = -1; this.uiDataGridView2.Size = new System.Drawing.Size(488, 308); @@ -1073,64 +1136,32 @@ this.uiLabel2.Text = "产品颜色"; this.uiLabel2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // - // uiLabel12 + // uiSymbolButton1 // - this.uiLabel12.AutoSize = true; - this.uiLabel12.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.uiLabel12.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); - this.uiLabel12.Location = new System.Drawing.Point(5, 150); - this.uiLabel12.Name = "uiLabel12"; - this.uiLabel12.Size = new System.Drawing.Size(138, 21); - this.uiLabel12.Style = Sunny.UI.UIStyle.Custom; - this.uiLabel12.TabIndex = 26; - this.uiLabel12.Text = "传统算法颜色类别"; - this.uiLabel12.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.uiSymbolButton1.Cursor = System.Windows.Forms.Cursors.Hand; + this.uiSymbolButton1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.uiSymbolButton1.Location = new System.Drawing.Point(155, 292); + this.uiSymbolButton1.MinimumSize = new System.Drawing.Size(1, 1); + this.uiSymbolButton1.Name = "uiSymbolButton1"; + this.uiSymbolButton1.Size = new System.Drawing.Size(82, 29); + this.uiSymbolButton1.Style = Sunny.UI.UIStyle.Custom; + this.uiSymbolButton1.Symbol = 61459; + this.uiSymbolButton1.TabIndex = 30; + this.uiSymbolButton1.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.uiSymbolButton1.Click += new System.EventHandler(this.uiSymbolButton1_Click); // - // uiLabel13 + // uiLabel14 // - this.uiLabel13.AutoSize = true; - this.uiLabel13.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.uiLabel13.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); - this.uiLabel13.Location = new System.Drawing.Point(3, 210); - this.uiLabel13.Name = "uiLabel13"; - this.uiLabel13.Size = new System.Drawing.Size(215, 21); - this.uiLabel13.Style = Sunny.UI.UIStyle.Custom; - this.uiLabel13.TabIndex = 28; - this.uiLabel13.Text = "传统算法过滤像素面积(piexl)"; - this.uiLabel13.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // tbAera - // - this.tbAera.FillColor = System.Drawing.Color.White; - this.tbAera.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.tbAera.Location = new System.Drawing.Point(2, 236); - this.tbAera.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.tbAera.MinimumSize = new System.Drawing.Size(63, 0); - this.tbAera.Name = "tbAera"; - this.tbAera.NumPadType = Sunny.UI.NumPadType.Double; - this.tbAera.Padding = new System.Windows.Forms.Padding(0, 0, 30, 2); - this.tbAera.Size = new System.Drawing.Size(235, 29); - this.tbAera.Style = Sunny.UI.UIStyle.Custom; - this.tbAera.TabIndex = 27; - this.tbAera.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; - this.tbAera.Watermark = ""; - // - // tbClass - // - this.tbClass.ButtonSymbolOffset = new System.Drawing.Point(0, 0); - this.tbClass.Cursor = System.Windows.Forms.Cursors.IBeam; - this.tbClass.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.tbClass.Location = new System.Drawing.Point(4, 176); - this.tbClass.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.tbClass.MinimumSize = new System.Drawing.Size(1, 16); - this.tbClass.Name = "tbClass"; - this.tbClass.Padding = new System.Windows.Forms.Padding(5); - this.tbClass.ShowText = false; - this.tbClass.Size = new System.Drawing.Size(233, 29); - this.tbClass.Style = Sunny.UI.UIStyle.Custom; - this.tbClass.TabIndex = 29; - this.tbClass.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; - this.tbClass.Watermark = ""; + this.uiLabel14.AutoSize = true; + this.uiLabel14.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.uiLabel14.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); + this.uiLabel14.Location = new System.Drawing.Point(20, 294); + this.uiLabel14.Name = "uiLabel14"; + this.uiLabel14.Size = new System.Drawing.Size(112, 21); + this.uiLabel14.Style = Sunny.UI.UIStyle.Custom; + this.uiLabel14.TabIndex = 31; + this.uiLabel14.Text = "ERP/MES配置"; + this.uiLabel14.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // FProductInfo // @@ -1231,5 +1262,7 @@ private Sunny.UI.UINumPadTextBox tbAera; private Sunny.UI.UILabel uiLabel12; private Sunny.UI.UITextBox tbClass; + private Sunny.UI.UILabel uiLabel14; + private Sunny.UI.UISymbolButton uiSymbolButton1; } } diff --git a/LeatherProject/LeatherApp/Page/FProductInfo.cs b/LeatherProject/LeatherApp/Page/FProductInfo.cs index bd39a75..86d1cac 100644 --- a/LeatherProject/LeatherApp/Page/FProductInfo.cs +++ b/LeatherProject/LeatherApp/Page/FProductInfo.cs @@ -55,6 +55,17 @@ namespace LeatherApp.Page this.rbMaterial4.Text = Config.materialNameList.FirstOrDefault(x => x.Value("code") == 4).Value("name"); this.rbMaterial5.Text = Config.materialNameList.FirstOrDefault(x => x.Value("code") == 5).Value("name"); + if(Config.CustomerName == "MX" || Config.CustomerName == "XCL") + { + uiLabel14.Visible = true; + uiSymbolButton1.Visible = true; + } + else + { + uiLabel14.Visible = false; + uiSymbolButton1.Visible = false; + } + initData(); } private void initData() @@ -509,5 +520,27 @@ namespace LeatherApp.Page { btnDefectOption.Enabled = swcDefectPauseForUser.Active; } + + /// + /// MES、ERP信息输入 + /// + /// + /// + private void uiSymbolButton1_Click(object sender, EventArgs e) + { + if (this.model == null || this.model.Id == 0) + return; + + FErpMesEdit frm = new FErpMesEdit(model.Spec); + frm.Render(); + frm.Text = "MES/ERP信息编辑"; + frm.ShowDialog(); + if (frm.IsOK) + { + model.Spec = frm.erpInfo; + } + + frm.Dispose(); + } } } diff --git a/LeatherProject/LeatherApp/Properties/AssemblyInfo.cs b/LeatherProject/LeatherApp/Properties/AssemblyInfo.cs index 2b36200..8fbe8aa 100644 --- a/LeatherProject/LeatherApp/Properties/AssemblyInfo.cs +++ b/LeatherProject/LeatherApp/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //通过使用 "*",如下所示: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2.0.1")] -[assembly: AssemblyFileVersion("1.2.0.1")] +[assembly: AssemblyVersion("1.2.0.6")] +[assembly: AssemblyFileVersion("1.2.0.6")] diff --git a/LeatherProject/LeatherApp/Utils/DBUtils.cs b/LeatherProject/LeatherApp/Utils/DBUtils.cs index 8224be2..0bd59f0 100644 --- a/LeatherProject/LeatherApp/Utils/DBUtils.cs +++ b/LeatherProject/LeatherApp/Utils/DBUtils.cs @@ -1,4 +1,5 @@ -using SqlSugar; +using Newtonsoft.Json; +using SqlSugar; using System; using System.Collections.Generic; using System.Data; @@ -48,7 +49,7 @@ namespace LeatherApp.Utils } public static DataTable execSql(string sql, List parameters, SqlSugar.DbType dbType = SqlSugar.DbType.SqlServer) { - if (!Config.OracleDB) + if (string.IsNullOrEmpty(Config.ErpDBType) || Config.ErpDBType == "SqlServer") { //查询表的所有 var mydb = getErpDBCon(dbType); @@ -62,7 +63,7 @@ namespace LeatherApp.Utils mydb.Ado.Open(); return mydb.Ado.GetDataTable(sql, parameters); } - else + else if (Config.ErpDBType == "Oracle") { SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { @@ -87,14 +88,63 @@ namespace LeatherApp.Utils // Console.WriteLine($"PJXTBH:{dt.Rows[i]["PJXTBH"]},WPH:{dt.Rows[i]["WPH"]},WPMC:{dt.Rows[i]["WPMC"]},SL:{dt.Rows[i]["SL"]},PH:{dt.Rows[i]["PH"]},JH:{dt.Rows[i]["JH"]}"); // } //} - - string sqlstr = $"select * from tb_qc_prodinfo where PJXTBH='{parameters[0].Value}'"; + string sqlstr = $"{sql}'{parameters[0].Value}'"; + //string sqlstr = $"select * from tb_qc_prodinfo where PJXTBH='{parameters[0].Value}'"; var dt2 = db.Ado.GetDataTable(sqlstr); dt2.Columns.RemoveAt(0); dt2.Columns.RemoveAt(0); return dt2; //var dt2 = db.Ado.GetDataTable(sqlstr); } + else if (Config.ErpDBType == "PostgreSQL") + { + SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() + { + DbType = SqlSugar.DbType.PostgreSQL, + ConnectionString = Config.ErpDBConStr, + IsAutoCloseConnection = true, + AopEvents = new AopEvents + { + OnLogExecuting = (tsql, p) => + { + Console.WriteLine(tsql); + Console.WriteLine(string.Join(",", p?.Select(it => it.ParameterName + ":" + it.Value))); + } + } + }); + + //string sqlstr = $"select * from mingxin_prod where PJXTBH='{parameters[0].Value}'"; + //var dt2 = db.Ado.GetDataTable(sqlstr); + //dt2.Columns.RemoveAt(0); + //dt2.Columns.RemoveAt(0); + + string sqlstr = $"select id,current_qty,batch_no,goods_code,material_id from mfg_material_goods where id={parameters[0].Value}"; + var dt2 = db.Ado.GetDataTable(sqlstr); + + + sqlstr = $"select id,material_code,material_name from base_material where id={dt2.Rows[0]["material_id"]}"; + var dt3 = db.Ado.GetDataTable(sqlstr); + + DataTable dt = new DataTable(); //建立个数据表WPMC,SL,PH,JH + dt.Columns.Add(new DataColumn("WPMC", typeof(string)));//在表中添加string类型的列 + dt.Columns.Add(new DataColumn("SL", typeof(string)));//在表中添加string类型的列 + dt.Columns.Add(new DataColumn("PH", typeof(string)));//在表中添加string类型的列 + dt.Columns.Add(new DataColumn("JH", typeof(string)));//在表中添加string类型的列 + dt.Columns.Add(new DataColumn("ERPID", typeof(string)));//在表中添加string类型的列 + + DataRow dr;//行 + dr = dt.NewRow(); + dr["WPMC"] = dt3.Rows[0]["material_name"]; + dr["SL"] = dt2.Rows[0]["current_qty"]; + dr["PH"] = dt2.Rows[0]["batch_no"]; + dr["JH"] = dt2.Rows[0]["goods_code"]; + dr["ERPID"] = dt3.Rows[0]["material_code"]; + + dt.Rows.Add(dr);//在表的对象的行里添加此行 + return dt; + } + else + return null; } } } diff --git a/LeatherProject/LeatherApp/bin/Debug/DefectItemList-11.json b/LeatherProject/LeatherApp/bin/Debug/DefectItemList-11.json new file mode 100644 index 0000000..7dd52a4 --- /dev/null +++ b/LeatherProject/LeatherApp/bin/Debug/DefectItemList-11.json @@ -0,0 +1,57 @@ + +[ + { + "id": 0, + "code": "laji", + "name": "垃圾", + "color": "#0080FF" + }, + { + "id": 1, + "code": "wuyin", + "name": "污印", + "color": "Lime" + }, + { + "id": 2, + "code": "jiangyin", + "name": "浆印", + "color": "DarkViolet" + }, + { + "id": 3, + "code": "zhouyin", + "name": "皱印", + "color": "Magenta" + }, + { + "id": 4, + "code": "hengdang", + "name": "横档", + "color": "Orange" + }, + { + "id": 5, + "code": "jietou", + "name": "接头", + "color": "Blue" + }, + { + "id": 6, + "code": "chongying", + "name": "重影", + "color": "Red" + }, + { + "id": 7, + "code": "aokeng", + "name": "凹坑", + "color": "Green" + }, + { + "id": 8, + "code": "bmss", + "name": "表面损伤", + "color": "Yellow" + } +] \ No newline at end of file diff --git a/LeatherProject/LeatherApp/bin/Debug/DefectItemList.json b/LeatherProject/LeatherApp/bin/Debug/DefectItemList.json index 7dd52a4..fb1b77c 100644 --- a/LeatherProject/LeatherApp/bin/Debug/DefectItemList.json +++ b/LeatherProject/LeatherApp/bin/Debug/DefectItemList.json @@ -1,57 +1,56 @@ - [ { - "id": 0, - "code": "laji", - "name": "垃圾", - "color": "#0080FF" + "id": 0, + "code": "bmss", + "name": "表面损伤", + "color": "Orange" }, { "id": 1, - "code": "wuyin", - "name": "污印", + "code": "zw", + "name": "脏污", "color": "Lime" }, { "id": 2, - "code": "jiangyin", - "name": "浆印", + "code": "zy", + "name": "皱印", "color": "DarkViolet" }, { "id": 3, - "code": "zhouyin", - "name": "皱印", - "color": "Magenta" + "code": "ty", + "name": "条印", + "color": "#0080FF" }, { "id": 4, - "code": "hengdang", - "name": "横档", - "color": "Orange" + "code": "jt", + "name": "接头", + "color": "Magenta" }, { "id": 5, - "code": "jietou", - "name": "接头", + "code": "wy", + "name": "污印", "color": "Blue" }, - { +{ "id": 6, - "code": "chongying", - "name": "重影", - "color": "Red" - }, - { - "id": 7, - "code": "aokeng", - "name": "凹坑", + "code": "jty", + "name": "停车印", "color": "Green" }, - { - "id": 8, - "code": "bmss", - "name": "表面损伤", + { + "id": 7, + "code": "hd", + "name": "横档", "color": "Yellow" + }, +{ + "id": 8, + "code": "chongying", + "name": "重影", + "color": "#208020" } ] \ No newline at end of file diff --git a/LeatherProject/LeatherApp/bin/Debug/ErrorLog.txt b/LeatherProject/LeatherApp/bin/Debug/ErrorLog.txt index 393000f..f2298df 100644 --- a/LeatherProject/LeatherApp/bin/Debug/ErrorLog.txt +++ b/LeatherProject/LeatherApp/bin/Debug/ErrorLog.txt @@ -164,3 +164,33 @@ Global捕获到未处理异常:System.NullReferenceException 异常堆栈: 在 LeatherApp.Page.FHome.reDrawDefectPoints(List`1 lstDefectInfo, Double[] XSizeRange, Double[] YSizeRange, Boolean addSelRect) 在 LeatherApp.Page.FHome.<>c__DisplayClass41_1.b__0() +2024-10-25 15:05:47 +Global捕获到未处理异常:MySql.Data.MySqlClient.MySqlException +异常信息:Column 'BarCodeName' cannot be null +异常堆栈: 在 SqlSugar.AdoProvider.ExecuteCommand(String sql, SugarParameter[] parameters) + 在 SqlSugar.InsertableProvider`1.ExecuteCommand() + 在 Service.InitDB.SendServerDB(String dbConStr, Records record, Boolean dropTable) 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\Service\InitDB.cs:行号 153 + 在 LeatherApp.Page.FHome.button3_Click(Object sender, EventArgs e) 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\Page\FHome.cs:行号 3607 + 在 System.Windows.Forms.Control.OnClick(EventArgs e) + 在 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) + 在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) + 在 System.Windows.Forms.Control.WndProc(Message& m) + 在 System.Windows.Forms.ButtonBase.WndProc(Message& m) + 在 System.Windows.Forms.Button.WndProc(Message& m) + 在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) + +2024-10-25 15:06:39 +Global捕获到未处理异常:MySql.Data.MySqlClient.MySqlException +异常信息:Column 'Material' cannot be null +异常堆栈: 在 SqlSugar.AdoProvider.ExecuteCommand(String sql, SugarParameter[] parameters) + 在 SqlSugar.InsertableProvider`1.ExecuteCommand() + 在 Service.InitDB.SendServerDB(String dbConStr, Records record, Boolean dropTable) 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\Service\InitDB.cs:行号 153 + 在 LeatherApp.Page.FHome.button3_Click(Object sender, EventArgs e) 位置 E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\Page\FHome.cs:行号 3608 + 在 System.Windows.Forms.Control.OnClick(EventArgs e) + 在 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) + 在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) + 在 System.Windows.Forms.Control.WndProc(Message& m) + 在 System.Windows.Forms.ButtonBase.WndProc(Message& m) + 在 System.Windows.Forms.Button.WndProc(Message& m) + 在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) + diff --git a/LeatherProject/LeatherApp/bin/Debug/SysConfig.ini b/LeatherProject/LeatherApp/bin/Debug/SysConfig.ini index d0f7d2c..66b2ae1 100644 --- a/LeatherProject/LeatherApp/bin/Debug/SysConfig.ini +++ b/LeatherProject/LeatherApp/bin/Debug/SysConfig.ini @@ -42,13 +42,18 @@ cm2px_y=73 MiddleSuperposition=700 [DB] DBConStr=server=localhost;Database=LeatherDB;Uid=root;Pwd=123456; AllowLoadLocalInfile=true +ErpDBType=PostgreSQL [ErpDB] -ErpDBConStr= -ErpSql= +ErpDBConStr=Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=200.1.1.15)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=PUDB)));User Id=qcvi;Password=qcvi;Pooling='true';Max Pool Size=150 +ErpSql=select * from tb_qc_prodinfo where PJXTBH= +ServerDBConStr=server=172.16.21.210;Database=LeatherDB;Uid=XCL001;Pwd=123456;AllowLoadLocalInfile=true [LOG] LogPath=D:\log\ [Halcon] OpenHalconDefect=false [Beep] OpenBeep=True +OpenWarnBeep=True BeepTime=3000 +[Customer] +CustomerName=MX diff --git a/LeatherProject/LeatherApp/obj/Debug/LeatherApp.FrmVerList.resources b/LeatherProject/LeatherApp/obj/Debug/LeatherApp.FrmVerList.resources index 301d8f1..e5b672d 100644 Binary files a/LeatherProject/LeatherApp/obj/Debug/LeatherApp.FrmVerList.resources and b/LeatherProject/LeatherApp/obj/Debug/LeatherApp.FrmVerList.resources differ diff --git a/LeatherProject/LeatherApp/obj/Debug/LeatherApp.Page.AddErpFrm.resources b/LeatherProject/LeatherApp/obj/Debug/LeatherApp.Page.AddErpFrm.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/LeatherProject/LeatherApp/obj/Debug/LeatherApp.Page.AddErpFrm.resources differ diff --git a/LeatherProject/LeatherApp/obj/Debug/LeatherApp.Page.FErpMesEdit.resources b/LeatherProject/LeatherApp/obj/Debug/LeatherApp.Page.FErpMesEdit.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/LeatherProject/LeatherApp/obj/Debug/LeatherApp.Page.FErpMesEdit.resources differ diff --git a/LeatherProject/LeatherApp/obj/Debug/LeatherApp.csproj.FileListAbsolute.txt b/LeatherProject/LeatherApp/obj/Debug/LeatherApp.csproj.FileListAbsolute.txt index 2ed5f69..3d652d3 100644 --- a/LeatherProject/LeatherApp/obj/Debug/LeatherApp.csproj.FileListAbsolute.txt +++ b/LeatherProject/LeatherApp/obj/Debug/LeatherApp.csproj.FileListAbsolute.txt @@ -457,3 +457,5 @@ E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\b E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\bin\Debug\System.Text.Encodings.Web.xml E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\bin\Debug\System.Text.Json.xml E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\bin\Debug\System.Threading.Tasks.Extensions.xml +E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\obj\Debug\LeatherApp.Page.FErpMesEdit.resources +E:\CPL\迈沐智能项目\2023\革博士\源码\V1.0\LeatherProject\LeatherApp\obj\Debug\LeatherApp.Page.AddErpFrm.resources diff --git a/LeatherProject/Models/Product.cs b/LeatherProject/Models/Product.cs index d06c422..8cc94a1 100644 --- a/LeatherProject/Models/Product.cs +++ b/LeatherProject/Models/Product.cs @@ -26,7 +26,7 @@ namespace Models /// /// 规格 /// - [SugarColumn(IsNullable = true)] + [SugarColumn(IsNullable = true, Length = 4096)] public string Spec { get; set; } /// /// 颜色名称 diff --git a/LeatherProject/Models/Records.cs b/LeatherProject/Models/Records.cs index 3162e06..c29dacb 100644 --- a/LeatherProject/Models/Records.cs +++ b/LeatherProject/Models/Records.cs @@ -79,19 +79,6 @@ namespace Models /// 缺陷总数 /// public int DefectTotalCount { get; set; } - #region 缺陷种类 - public int DKCount { get; set; }//堵孔数量 - public int ZWCount { get; set; }//脏污数量 - public int GSYCCount { get; set; }//钢丝异常数量 - public int XWSCount { get; set; }//纤维丝数量 - public int QKCount { get; set; }//缺口数量 - public int ZKCount { get; set; }//针孔数量 - public int PPCount { get; set; }//泡泡数量 - public int HSCount { get; set; }//划伤数量 - public int YXCount { get; set; }//压线数量 - public int XBCount { get; set; }//斜边数量 new - public int SXCount { get; set; }//栅线数量 new - #endregion public bool Succeed { get; set; } /// @@ -109,6 +96,12 @@ namespace Models [SqlSugar.SugarColumn(IsJson = true, ColumnDataType = StaticConfig.CodeFirst_BigString)] public List FacePointList { get; set; } = new List(); + /// + /// 测厚数据[长度,厚度1,厚度2,厚度3] + /// + [SqlSugar.SugarColumn(IsJson = true, ColumnDataType = StaticConfig.CodeFirst_BigString)] + public List ThicknessPointList { get; set; } = new List(); + /// /// Defect和Size比对失败的坐标位置 /// @@ -202,9 +195,13 @@ namespace Models { get { return Width * Height; } } + //[SugarColumn(IsIgnore = true)] + //public Image image{get;set;} + /// + /// 图像编号 + /// [SugarColumn(IsIgnore = true)] - public Image image{get;set;} - + public string imageID { get; set; } [SugarColumn(IsIgnore = true)] public string Name { get; set; } [SugarColumn(IsIgnore = true)] diff --git a/LeatherProject/Service/InitDB.cs b/LeatherProject/Service/InitDB.cs index 343cf41..699bb47 100644 --- a/LeatherProject/Service/InitDB.cs +++ b/LeatherProject/Service/InitDB.cs @@ -110,48 +110,111 @@ namespace Service public static void SendServerDB(string dbConStr, Records record, bool dropTable = false) { - ConnectionString = dbConStr; - ConnectionConfig connectionConfig = new ConnectionConfig() + //ConnectionString = dbConStr; + int errStep = 0; + try { - ConnectionString = dbConStr, - DbType = DbType.MySql, - IsAutoCloseConnection = true - }; - connectionConfig.ConnectionString = dbConStr; - //创建数据库对象 - using (SqlSugarClient db = new SqlSugarClient(connectionConfig)) - { - db.Aop.OnLogExecuting = (sql, pars) => + var db = new SqlSugarClient(new ConnectionConfig() { - Console.WriteLine(sql);//输出sql,查看执行sql 性能无影响 + DbType = SqlSugar.DbType.MySql, + //InitKeyType = InitKeyType.Attribute, + IsAutoCloseConnection = true, + ConnectionString = dbConStr + }); + errStep = 1; + //var pt = db.Queryable() + // //.Includes(m => m.ClassesInfo) + // .Includes(m => m.QualifiedLimitList) + // .Includes(m => m.GradeLimitList) + // .First(m => m.Code == record.ProductInfo.Code); + //errStep = 2; + //if (pt == null) + //{ + // errStep = 3; + // db.InsertNav(record.ProductInfo) + // //.Include(a => a.ProductParamsList)//.ThenInclude(z1 => z1.RoomList) //插入2层 Root->ShoolA->RoomList + // .Include(m => m.QualifiedLimitList) + // .Include(m => m.GradeLimitList) + // .ExecuteCommand(); + //} + //else + //{ + // errStep = 4; + // //db.DeleteNav(pt) + // //.Include(m => m.QualifiedLimitList) + // //.Include(m => m.GradeLimitList) + // //.ExecuteCommand(); + // record.ProductInfo.Id = pt.Id; + // db.UpdateNav(record.ProductInfo) + // .Include(m => m.QualifiedLimitList) + // .Include(m => m.GradeLimitList) + // .ExecuteCommand(); + //} + errStep = 5; + //var newpd = db.Queryable() + // .Includes(m => m.QualifiedLimitList) + // .Includes(m => m.GradeLimitList) + // .First(m => m.Code == record.ProductInfo.Code); + + //record.ProductId = newpd.Id; + db.InsertNav(record) + .Include(m => m.DefectInfoList) + .ExecuteCommand(); + /* + ConnectionConfig connectionConfig = new ConnectionConfig() + { + ConnectionString = dbConStr, + DbType = DbType.MySql, + IsAutoCloseConnection = true }; - - //create db - db.DbMaintenance.CreateDatabase(); - - //===建表 - if (dropTable && db.DbMaintenance.IsAnyTable("Product", false)) db.DbMaintenance.DropTable("Product"); - if (dropTable && db.DbMaintenance.IsAnyTable("QualifiedLimit", false)) db.DbMaintenance.DropTable("QualifiedLimit"); - if (dropTable && db.DbMaintenance.IsAnyTable("GradeLimit", false)) db.DbMaintenance.DropTable("GradeLimit"); - if (dropTable && db.DbMaintenance.IsAnyTable("Records", false)) db.DbMaintenance.DropTable("Records"); - if (dropTable && db.DbMaintenance.IsAnyTable("DefectInfo", false)) db.DbMaintenance.DropTable("DefectInfo"); - - //===添加与更新表 - db.CodeFirst.InitTables(); - db.CodeFirst.InitTables(); - db.CodeFirst.InitTables(); - db.CodeFirst.InitTables(); - db.CodeFirst.InitTables(); - - //更改表数据 - try + connectionConfig.ConnectionString = dbConStr; + //创建数据库对象 + using (SqlSugarClient db = new SqlSugarClient(connectionConfig)) { - db.Ado.ExecuteCommand("drop index index_Records_ProductId_SerialNum ON table_name");//删除索引 + db.Aop.OnLogExecuting = (sql, pars) => + { + Console.WriteLine(sql);//输出sql,查看执行sql 性能无影响 + }; + + //create db + db.DbMaintenance.CreateDatabase(); + + //===建表 + if (dropTable && db.DbMaintenance.IsAnyTable("Product", false)) db.DbMaintenance.DropTable("Product"); + if (dropTable && db.DbMaintenance.IsAnyTable("QualifiedLimit", false)) db.DbMaintenance.DropTable("QualifiedLimit"); + if (dropTable && db.DbMaintenance.IsAnyTable("GradeLimit", false)) db.DbMaintenance.DropTable("GradeLimit"); + if (dropTable && db.DbMaintenance.IsAnyTable("Records", false)) db.DbMaintenance.DropTable("Records"); + if (dropTable && db.DbMaintenance.IsAnyTable("DefectInfo", false)) db.DbMaintenance.DropTable("DefectInfo"); + + //===添加与更新表 + try + { + db.CodeFirst.InitTables(); + db.CodeFirst.InitTables(); + db.CodeFirst.InitTables(); + db.CodeFirst.InitTables(); + db.CodeFirst.InitTables(); + } + catch { } + //更改表数据 + try + { + db.Ado.ExecuteCommand("drop index index_Records_ProductId_SerialNum ON table_name");//删除索引 + } + catch { } + //数据插入表 + db.Insertable(record).ExecuteCommand(); + db.Insertable(record.DefectInfoList).ExecuteCommand(); + db.Insertable(record.ProductInfo).ExecuteCommand(); + db.Insertable(record.ProductInfo.QualifiedLimitList).ExecuteCommand(); + db.Insertable(record.ProductInfo.GradeLimitList).ExecuteCommand(); + } - catch { } - //数据插入表 - db.Insertable(record).ExecuteCommand(); - + */ + } + catch (Exception ex) + { + throw new Exception($"err{errStep}:{ex.Message}"); } } /// diff --git a/LeatherProject/Service/ProductService.cs b/LeatherProject/Service/ProductService.cs index 48398c6..35daec2 100644 --- a/LeatherProject/Service/ProductService.cs +++ b/LeatherProject/Service/ProductService.cs @@ -46,6 +46,30 @@ namespace Service .Includes(m => m.GradeLimitList) .First(m => m.Id == id); } + public Product GetModelNavByErpID(string id) + { + var lt = base.AsSugarClient().Queryable() + //.Includes(m => m.ClassesInfo) + .Includes(m => m.QualifiedLimitList) + .Includes(m => m.GradeLimitList) + .ToList(); + foreach (var item in lt) + { + if (!string.IsNullOrWhiteSpace(item.Spec)) + { + if (item.Spec.Split(',').Contains(id)) + return item; + } + } + + return null; + + //return base.AsSugarClient().Queryable() + // //.Includes(m => m.ClassesInfo) + // .Includes(m => m.QualifiedLimitList) + // .Includes(m => m.GradeLimitList) + // .First(m => m.Spec.Split(',').Contains(id)); + } public Product GetModelNav(string code) { return base.AsSugarClient().Queryable() diff --git a/LeatherProject/Service/RecordsService.cs b/LeatherProject/Service/RecordsService.cs index 2cd1e45..3010a93 100644 --- a/LeatherProject/Service/RecordsService.cs +++ b/LeatherProject/Service/RecordsService.cs @@ -69,6 +69,20 @@ namespace Service .Include(m => m.DefectInfoList) .ExecuteCommand(); } + public Records GetRecordsNav(string barCode, string barCodeName) + { + return base.AsSugarClient().Queryable() + .OrderByDescending(m => m.CreateTime) + //.Includes(m => m.ProductInfo).Includes(m => m.ProductInfo.GradeLimitList).Includes(m => m.ProductInfo.QualifiedLimitList) + .Includes(m => m.DefectInfoList)//.OrderBy(st => SqlFunc.Desc(st.CreateTime)) + .First(m => m.BarCode == barCode && m.BarCodeName == barCodeName ); + } + public bool UpdateNav(Models.Records model) + { + return base.AsSugarClient().UpdateNav(model) + .Include(m => m.DefectInfoList) + .ExecuteCommand(); + } public bool DelNav(Models.Records model) { return base.AsSugarClient().DeleteNav(model) @@ -207,17 +221,17 @@ namespace Service .Select((a) => new { a.CreateTime.Date, Total = SqlFunc.AggregateSum(1), - 堵孔 = SqlFunc.AggregateSum(a.DKCount), - 脏污 = SqlFunc.AggregateSum(a.ZWCount), - 钢丝异常 = SqlFunc.AggregateSum(a.GSYCCount), - 纤维丝 = SqlFunc.AggregateSum(a.XWSCount), - 缺口 = SqlFunc.AggregateSum(a.QKCount), - 针孔 = SqlFunc.AggregateSum(a.ZKCount), - 泡泡 = SqlFunc.AggregateSum(a.PPCount), - 划伤 = SqlFunc.AggregateSum(a.HSCount), - 压线 = SqlFunc.AggregateSum(a.YXCount), - 斜边 = SqlFunc.AggregateSum(a.XBCount), - 栅线 = SqlFunc.AggregateSum(a.SXCount), + //堵孔 = SqlFunc.AggregateSum(a.DKCount), + //脏污 = SqlFunc.AggregateSum(a.ZWCount), + //钢丝异常 = SqlFunc.AggregateSum(a.GSYCCount), + //纤维丝 = SqlFunc.AggregateSum(a.XWSCount), + //缺口 = SqlFunc.AggregateSum(a.QKCount), + //针孔 = SqlFunc.AggregateSum(a.ZKCount), + //泡泡 = SqlFunc.AggregateSum(a.PPCount), + //划伤 = SqlFunc.AggregateSum(a.HSCount), + //压线 = SqlFunc.AggregateSum(a.YXCount), + //斜边 = SqlFunc.AggregateSum(a.XBCount), + //栅线 = SqlFunc.AggregateSum(a.SXCount), }); return sql2.ToJson(); @@ -233,17 +247,17 @@ namespace Service .WhereIF(exp != null, exp); return sql.Select((a) => new { - 堵孔 = SqlFunc.AggregateSum(a.DKCount), - 脏污 = SqlFunc.AggregateSum(a.ZWCount), - 钢丝异常 = SqlFunc.AggregateSum(a.GSYCCount), - 纤维丝 = SqlFunc.AggregateSum(a.XWSCount), - 缺口 = SqlFunc.AggregateSum(a.QKCount), - 针孔 = SqlFunc.AggregateSum(a.ZKCount), - 泡泡 = SqlFunc.AggregateSum(a.PPCount), - 划伤 = SqlFunc.AggregateSum(a.HSCount), - 压线 = SqlFunc.AggregateSum(a.YXCount), - 斜边 = SqlFunc.AggregateSum(a.XBCount), - 栅线 = SqlFunc.AggregateSum(a.SXCount), + //堵孔 = SqlFunc.AggregateSum(a.DKCount), + //脏污 = SqlFunc.AggregateSum(a.ZWCount), + //钢丝异常 = SqlFunc.AggregateSum(a.GSYCCount), + //纤维丝 = SqlFunc.AggregateSum(a.XWSCount), + //缺口 = SqlFunc.AggregateSum(a.QKCount), + //针孔 = SqlFunc.AggregateSum(a.ZKCount), + //泡泡 = SqlFunc.AggregateSum(a.PPCount), + //划伤 = SqlFunc.AggregateSum(a.HSCount), + //压线 = SqlFunc.AggregateSum(a.YXCount), + //斜边 = SqlFunc.AggregateSum(a.XBCount), + //栅线 = SqlFunc.AggregateSum(a.SXCount), }).ToJson(); } }