浏览代码

添加镭雕条码生成

callm 1 年之前
父节点
当前提交
6a978caa8e

+ 8 - 0
UAS_MES_LGDZ/FunctionCode/Query/ArrayList.cs

@@ -0,0 +1,8 @@
+using System.Collections;
+
+namespace UAS_MES_NEW.Query
+{
+    internal class ArrayList<T> : ArrayList
+    {
+    }
+}

+ 290 - 0
UAS_MES_LGDZ/FunctionCode/Query/Query_RadiumSN.Designer.cs

@@ -0,0 +1,290 @@
+namespace UAS_MES_NEW.Query
+{
+    partial class Query_RadiumSN
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Query_RadiumSN));
+            this.ma_qty = new System.Windows.Forms.Label();
+            this.label7 = new System.Windows.Forms.Label();
+            this.label5 = new System.Windows.Forms.Label();
+            this.pr_detail = new System.Windows.Forms.Label();
+            this.label4 = new System.Windows.Forms.Label();
+            this.label8 = new System.Windows.Forms.Label();
+            this.pr_code = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
+            this.ma_code = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SearchTextBox();
+            this.OneColumn = new System.Windows.Forms.RadioButton();
+            this.TwoColumn = new System.Windows.Forms.RadioButton();
+            this.ThreeColumn = new System.Windows.Forms.RadioButton();
+            this.FourColumn = new System.Windows.Forms.RadioButton();
+            this.GenSN = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
+            this.label1 = new System.Windows.Forms.Label();
+            this.ma_count = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
+            this.SuspendLayout();
+            // 
+            // ma_qty
+            // 
+            this.ma_qty.AutoSize = true;
+            this.ma_qty.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ma_qty.Location = new System.Drawing.Point(349, 270);
+            this.ma_qty.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.ma_qty.Name = "ma_qty";
+            this.ma_qty.Size = new System.Drawing.Size(0, 41);
+            this.ma_qty.TabIndex = 236;
+            // 
+            // label7
+            // 
+            this.label7.AutoSize = true;
+            this.label7.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label7.Location = new System.Drawing.Point(171, 270);
+            this.label7.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.label7.Name = "label7";
+            this.label7.Size = new System.Drawing.Size(146, 41);
+            this.label7.TabIndex = 234;
+            this.label7.Text = "工单数量";
+            // 
+            // label5
+            // 
+            this.label5.AutoSize = true;
+            this.label5.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label5.Location = new System.Drawing.Point(171, 204);
+            this.label5.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.label5.Name = "label5";
+            this.label5.Size = new System.Drawing.Size(146, 41);
+            this.label5.TabIndex = 232;
+            this.label5.Text = "工单编号";
+            // 
+            // pr_detail
+            // 
+            this.pr_detail.AutoSize = true;
+            this.pr_detail.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.pr_detail.Location = new System.Drawing.Point(349, 463);
+            this.pr_detail.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.pr_detail.Name = "pr_detail";
+            this.pr_detail.Size = new System.Drawing.Size(0, 41);
+            this.pr_detail.TabIndex = 241;
+            // 
+            // label4
+            // 
+            this.label4.AutoSize = true;
+            this.label4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label4.Location = new System.Drawing.Point(171, 463);
+            this.label4.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.label4.Name = "label4";
+            this.label4.Size = new System.Drawing.Size(146, 41);
+            this.label4.TabIndex = 240;
+            this.label4.Text = "产品名称";
+            // 
+            // label8
+            // 
+            this.label8.AutoSize = true;
+            this.label8.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label8.Location = new System.Drawing.Point(171, 386);
+            this.label8.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.label8.Name = "label8";
+            this.label8.Size = new System.Drawing.Size(146, 41);
+            this.label8.TabIndex = 238;
+            this.label8.Text = "产品代码";
+            // 
+            // pr_code
+            // 
+            this.pr_code.AllPower = null;
+            this.pr_code.BackColor = System.Drawing.Color.White;
+            this.pr_code.ID = null;
+            this.pr_code.Location = new System.Drawing.Point(356, 395);
+            this.pr_code.Name = "pr_code";
+            this.pr_code.Power = null;
+            this.pr_code.Size = new System.Drawing.Size(388, 35);
+            this.pr_code.Str = null;
+            this.pr_code.Str1 = null;
+            this.pr_code.Str2 = null;
+            this.pr_code.TabIndex = 239;
+            // 
+            // ma_code
+            // 
+            this.ma_code.AllPower = "IFALL";
+            this.ma_code.Caller = null;
+            this.ma_code.Condition = null;
+            this.ma_code.DBTitle = "";
+            this.ma_code.Font = new System.Drawing.Font("微软雅黑", 9F);
+            this.ma_code.FormName = null;
+            this.ma_code.Location = new System.Drawing.Point(356, 204);
+            this.ma_code.Margin = new System.Windows.Forms.Padding(6);
+            this.ma_code.Name = "ma_code";
+            this.ma_code.Power = "";
+            this.ma_code.ReturnData = null;
+            this.ma_code.SelectField = null;
+            this.ma_code.SetValueField = null;
+            this.ma_code.Size = new System.Drawing.Size(409, 46);
+            this.ma_code.TabIndex = 233;
+            this.ma_code.TableName = null;
+            this.ma_code.Tag = "makecode";
+            this.ma_code.TextBoxEnable = true;
+            // 
+            // OneColumn
+            // 
+            this.OneColumn.AutoSize = true;
+            this.OneColumn.Location = new System.Drawing.Point(356, 518);
+            this.OneColumn.Name = "OneColumn";
+            this.OneColumn.Size = new System.Drawing.Size(89, 28);
+            this.OneColumn.TabIndex = 242;
+            this.OneColumn.TabStop = true;
+            this.OneColumn.Text = "单排";
+            this.OneColumn.UseVisualStyleBackColor = true;
+            this.OneColumn.Visible = false;
+            // 
+            // TwoColumn
+            // 
+            this.TwoColumn.AutoSize = true;
+            this.TwoColumn.Location = new System.Drawing.Point(465, 518);
+            this.TwoColumn.Name = "TwoColumn";
+            this.TwoColumn.Size = new System.Drawing.Size(89, 28);
+            this.TwoColumn.TabIndex = 243;
+            this.TwoColumn.TabStop = true;
+            this.TwoColumn.Text = "双排";
+            this.TwoColumn.UseVisualStyleBackColor = true;
+            this.TwoColumn.Visible = false;
+            // 
+            // ThreeColumn
+            // 
+            this.ThreeColumn.AutoSize = true;
+            this.ThreeColumn.Checked = true;
+            this.ThreeColumn.Location = new System.Drawing.Point(583, 518);
+            this.ThreeColumn.Name = "ThreeColumn";
+            this.ThreeColumn.Size = new System.Drawing.Size(89, 28);
+            this.ThreeColumn.TabIndex = 244;
+            this.ThreeColumn.TabStop = true;
+            this.ThreeColumn.Text = "三排";
+            this.ThreeColumn.UseVisualStyleBackColor = true;
+            this.ThreeColumn.Visible = false;
+            // 
+            // FourColumn
+            // 
+            this.FourColumn.AutoSize = true;
+            this.FourColumn.Location = new System.Drawing.Point(693, 518);
+            this.FourColumn.Name = "FourColumn";
+            this.FourColumn.Size = new System.Drawing.Size(89, 28);
+            this.FourColumn.TabIndex = 245;
+            this.FourColumn.TabStop = true;
+            this.FourColumn.Text = "四排";
+            this.FourColumn.UseVisualStyleBackColor = true;
+            this.FourColumn.Visible = false;
+            // 
+            // GenSN
+            // 
+            this.GenSN.AccessibleRole = System.Windows.Forms.AccessibleRole.PageTabList;
+            this.GenSN.AllPower = null;
+            this.GenSN.BackColor = System.Drawing.Color.Transparent;
+            this.GenSN.DownImage = ((System.Drawing.Image)(resources.GetObject("GenSN.DownImage")));
+            this.GenSN.Image = null;
+            this.GenSN.IsShowBorder = true;
+            this.GenSN.Location = new System.Drawing.Point(358, 591);
+            this.GenSN.Margin = new System.Windows.Forms.Padding(6);
+            this.GenSN.MoveImage = ((System.Drawing.Image)(resources.GetObject("GenSN.MoveImage")));
+            this.GenSN.Name = "GenSN";
+            this.GenSN.NormalImage = ((System.Drawing.Image)(resources.GetObject("GenSN.NormalImage")));
+            this.GenSN.Power = null;
+            this.GenSN.Size = new System.Drawing.Size(150, 56);
+            this.GenSN.TabIndex = 246;
+            this.GenSN.Text = "生成SN";
+            this.GenSN.UseVisualStyleBackColor = false;
+            this.GenSN.Click += new System.EventHandler(this.GenSN_Click);
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label1.Location = new System.Drawing.Point(171, 329);
+            this.label1.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(146, 41);
+            this.label1.TabIndex = 248;
+            this.label1.Text = "工单数量";
+            // 
+            // ma_count
+            // 
+            this.ma_count.AllPower = null;
+            this.ma_count.BackColor = System.Drawing.Color.White;
+            this.ma_count.ID = null;
+            this.ma_count.Location = new System.Drawing.Point(356, 338);
+            this.ma_count.Name = "ma_count";
+            this.ma_count.Power = null;
+            this.ma_count.Size = new System.Drawing.Size(152, 35);
+            this.ma_count.Str = null;
+            this.ma_count.Str1 = null;
+            this.ma_count.Str2 = null;
+            this.ma_count.TabIndex = 249;
+            // 
+            // Query_RadiumSN
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(2034, 1118);
+            this.Controls.Add(this.ma_count);
+            this.Controls.Add(this.label1);
+            this.Controls.Add(this.GenSN);
+            this.Controls.Add(this.FourColumn);
+            this.Controls.Add(this.ThreeColumn);
+            this.Controls.Add(this.TwoColumn);
+            this.Controls.Add(this.OneColumn);
+            this.Controls.Add(this.pr_detail);
+            this.Controls.Add(this.label4);
+            this.Controls.Add(this.pr_code);
+            this.Controls.Add(this.label8);
+            this.Controls.Add(this.ma_qty);
+            this.Controls.Add(this.label7);
+            this.Controls.Add(this.ma_code);
+            this.Controls.Add(this.label5);
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
+            this.Margin = new System.Windows.Forms.Padding(6);
+            this.Name = "Query_RadiumSN";
+            this.Tag = "Query_SN";
+            this.Text = "打印机调试";
+            this.Load += new System.EventHandler(this.SystemSetting_PrinterTest_Load);
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+        private System.Windows.Forms.Label ma_qty;
+        private System.Windows.Forms.Label label7;
+        private CustomControl.TextBoxWithIcon.SearchTextBox ma_code;
+        private System.Windows.Forms.Label label5;
+        private System.Windows.Forms.Label pr_detail;
+        private System.Windows.Forms.Label label4;
+        private CustomControl.TextBoxWithIcon.EnterTextBox pr_code;
+        private System.Windows.Forms.Label label8;
+        private System.Windows.Forms.RadioButton OneColumn;
+        private System.Windows.Forms.RadioButton TwoColumn;
+        private System.Windows.Forms.RadioButton ThreeColumn;
+        private System.Windows.Forms.RadioButton FourColumn;
+        private CustomControl.ButtonUtil.NormalButton GenSN;
+        private System.Windows.Forms.Label label1;
+        private CustomControl.TextBoxWithIcon.EnterTextBox ma_count;
+    }
+}

+ 245 - 0
UAS_MES_LGDZ/FunctionCode/Query/Query_RadiumSN.cs

@@ -0,0 +1,245 @@
+using Seagull.BarTender.Print;
+using System;
+using System.Data;
+using System.Drawing;
+using System.Drawing.Printing;
+using System.Text.RegularExpressions;
+using System.Windows.Forms;
+using UAS_MES_NEW.DataOperate;
+using UAS_MES_NEW.Entity;
+using UAS_MES_NEW.PublicMethod;
+
+namespace UAS_MES_NEW.Query
+{
+    public partial class Query_RadiumSN : Form
+    {
+
+        int serialnum = 0;
+        //客户的流水号
+        int custserialnum = 0;
+
+        LabelFormatDocument format;
+
+        DataHelper dh = SystemInf.dh;
+
+        //前缀条件
+
+        //生成条码的流水号
+
+        DataTable Dbfind;
+        public Query_RadiumSN()
+        {
+            InitializeComponent();
+        }
+
+        private void PrintTest_Click(object sender, EventArgs e)
+        {
+         
+        }
+
+        private void Print_PrintPage(object sender, PrintPageEventArgs e)
+        {
+            Graphics g = e.Graphics;
+            float leftMargin = 10f; //左边距
+            SolidBrush myBrush = new SolidBrush(Color.Black);//刷子
+            float yPosition = 5f;//行定位
+            Font printFont = new Font("微软雅黑", 20f, FontStyle.Bold);//设置字体
+            yPosition += printFont.GetHeight(g);//另起一行
+            g.DrawString("成功连接此打印机", printFont, myBrush, leftMargin, yPosition, new StringFormat());
+        }
+
+        private void Setting_Click(object sender, EventArgs e)
+        {
+         
+        }
+
+        private void Export_Click(object sender, EventArgs e)
+        {
+            if (!dh.CheckExist("make", "ma_code='" + ma_code.Text + "'"))
+            {
+                MessageBox.Show("工单号不存在");
+                return;
+            }
+            DataTable dt = (DataTable)dh.ExecuteSql("select msl_sncode from makesnlist where  msl_makecode='" + ma_code.Text + "' order by msl_sncode", "select");
+            if (dt.Rows.Count == 0)
+            {
+                MessageBox.Show("工单号未生成SN");
+                return;
+            }
+        }
+
+        public string BarcodeMethod1(string Prefix, string Suffix, int Index, int Length, int radix)
+        {
+            string str = Prefix;
+            //如果是流水则需要在前面加0
+            string serialcode = BaseUtil.DToAny(custserialnum, radix);
+            for (int j = serialcode.ToString().Length; j < Length; j++)
+            {
+                serialcode = "0" + serialcode;
+            }
+            str += serialcode;
+            str += Suffix;
+            custserialnum = custserialnum + 1;
+            return str;
+        }
+
+        private static string lpad(int length, string number)
+        {
+            while (number.Length < length)
+            {
+                number = "0" + number;
+            }
+            number = number.Substring(number.Length - length, length);
+            return number;
+        }
+
+        private void SystemSetting_PrinterTest_Load(object sender, EventArgs e)
+        {
+            ma_code.TableName = " make left join product on ma_prodcode=pr_code";
+            ma_code.SelectField = "ma_code # 工单编号,pr_code # 产品编号,pr_spec # 型号";
+            ma_code.FormName = Name;
+            ma_code.SetValueField = new string[] { "ma_code" };
+            //ma_code.Condition = "ma_statuscode='STARTED'";
+            ma_code.DbChange += pr_code_DbChange;
+        }
+
+        private void pr_code_DbChange(object sender, EventArgs e)
+        {
+            Dbfind = ma_code.ReturnData;
+            BaseUtil.SetFormValue(this.Controls, Dbfind);
+            DataTable dt = (DataTable)dh.ExecuteSql("select ma_qty,ma_prodcode,pr_detail from make left join product on ma_prodcode=pr_code  where ma_code='" + ma_code.Text + "'", "select");
+            if (dt.Rows.Count > 0)
+            {
+                pr_code.Text = dt.Rows[0]["ma_prodcode"].ToString();
+                ma_qty.Text = dt.Rows[0]["ma_qty"].ToString();
+                pr_detail.Text = dt.Rows[0]["pr_detail"].ToString();
+            }
+            ma_count.Text = ma_qty.Text;
+        }
+
+        private void GenSN_Click(object sender, EventArgs e)
+        {
+            string Prefix = "";
+
+            string Suffix = "";
+            //获取编码规则
+            if (!dh.CheckExist("make", "ma_code='" + ma_code.Text + "'"))
+            {
+                MessageBox.Show("工单号不存在");
+                return;
+            }
+            DataTable dt = (DataTable)dh.ExecuteSql("select pr_exbarcode,ma_qty from make left join product on ma_prodcode=pr_code where ma_code='" + ma_code.Text + "'", "select");
+            string pr_exbarcode = "";
+            string ma_qty = "";
+            if (dt.Rows.Count > 0)
+            {
+                pr_exbarcode = dt.Rows[0]["pr_exbarcode"].ToString();
+                ma_qty = dt.Rows[0]["ma_qty"].ToString();
+            }
+            if (dh.getRowCount("makesnlist", "msl_makecode='" + ma_code.Text + "'") + int.Parse(ma_count.Text) > int.Parse(ma_qty))
+            {
+                MessageBox.Show("工单号" + ma_code.Text + "生产序列号超出工单数");
+                return;
+            }
+            DataTable Nr = (DataTable)dh.ExecuteSql("select nrd_detno,nrd_name,nrd_type,nrd_radix,nrd_sql,nrd_length from NoRuleDetail left join norule on nrd_nrid=nr_id where nr_code='" + pr_exbarcode + "' order by nrd_detno", "select");
+            //如果没有则取公共规则
+            if (Nr.Rows.Count == 0)
+                Nr = (DataTable)dh.ExecuteSql("select nrd_detno,nrd_name,nrd_radix,nrd_type,nrd_sql,nrd_length from NoRuleDetail left join norule on nrd_nrid=nr_id where nr_custcode is null and nr_isdefault <> 0 order by nrd_detno", "select");
+            //用于过滤参数的正则表达式
+            Regex match = new Regex("{\\w+}");
+            //用于存放每一项的明细的数据
+            string[] NrData = new string[Nr.Rows.Count];
+            //流水号的索引
+            int SerialNumIndex = 0;
+            //流水长度
+            int SerialNumLength = 0;
+            //存放键值对
+            int Radix = 10;
+            string PrefixFixed = "";
+            for (int m = 0; m < Nr.Rows.Count; m++)
+            {
+                switch (Nr.Rows[m]["nrd_type"].ToString())
+                {
+                    //常量直接进行拼接
+                    case "常量":
+                        NrData[m] = Nr.Rows[m]["nrd_sql"].ToString();
+                        Prefix += NrData[m];
+                        Suffix += NrData[m];
+                        break;
+                    case "SQL":
+                        string SQL = Nr.Rows[m]["nrd_sql"].ToString();
+                        DataTable Temp;
+                        //如果不包含参数替换
+                        if (SQL.IndexOf("{") == 0)
+                        {
+                            Temp = (DataTable)dh.ExecuteSql(SQL, "select");
+                        }
+                        else
+                        {
+                            //替换参数后重新执行SQL
+                            foreach (Match mch in match.Matches(SQL))
+                            {
+                                SQL = SQL.Replace(mch.Value.Trim(), "'" + ma_code.Text + "'");
+                            }
+                            Temp = (DataTable)dh.ExecuteSql(SQL, "select");
+                        }
+                        if (Temp.Rows.Count > 0)
+                        {
+                            NrData[m] = Temp.Rows[0][0].ToString();
+                            Prefix += NrData[m];
+                            Suffix += NrData[m];
+                        }
+                        else
+                        {
+                            NrData[m] = "";
+                            Prefix += NrData[m];
+                            Suffix += NrData[m];
+                        }
+                        break;
+                    //流水需要通过MaxNumber去取
+                    case "流水":
+                        NrData[m] = dh.getFieldDataByCondition("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + pr_exbarcode + "'").ToString();
+                        Suffix = "";
+                        PrefixFixed = Prefix;
+                        //设置当前流水
+                        custserialnum = int.Parse(NrData[m] == "" ? "0" : NrData[m]);
+                        SerialNumIndex = m;
+                        SerialNumLength = int.Parse(Nr.Rows[m]["nrd_length"].ToString());
+                        Radix = int.Parse(Nr.Rows[m]["nrd_radix"].ToString());
+                        break;
+                    default:
+                        break;
+                }
+            }
+            //获取最大的流水号
+            string maxnum = dh.getFieldDataByCondition("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + pr_exbarcode + "' and rmn_prefix='" + Prefix + "'").ToString();
+            //如果流水号为空则插入一条新记录,从1开始取
+            if (maxnum == "")
+            {
+                dh.ExecuteSql("insert into RuleMaxNum(rmn_id,rmn_nrcode,rmn_prefix,rmn_maxnumber) values(RuleMaxNum_seq.nextval,'" + pr_exbarcode + "','" + Prefix + "','1')", "insert");
+                custserialnum = 1;
+            }
+            //如果流水号不为空则取当前流水
+            else
+            {
+                custserialnum = int.Parse(maxnum);
+            }
+            //遍历整个Grid,勾选的项目全部进行条码生成
+            ArrayList<string> custbarcode = new ArrayList<string>();
+            for (int i = 0; i < int.Parse(ma_count.Text); i++)
+            {
+                string data = BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix);
+                if (!custbarcode.Contains(data))
+                    custbarcode.Add(data);
+            }
+            //插入条码
+            string sql = "insert into MAKESNLIST_RADIUM(MSL_ID, MSL_INDATE, MSL_MAKECODE, MSL_SNCODE, MSL_TYPE,msl_status)" +
+                "select MAKESNLIST_RADIUM_seq.nextval,sysdate,'" + ma_code.Text + "',:custbarcode,'before',0 from dual where :custbarcode not in " +
+                "(select msl_sncode from MAKESNLIST_RADIUM)";
+            dh.BatchInsert(sql, new string[] { "custbarcode", "custbarcode" }, custbarcode.ToArray(), custbarcode.ToArray());
+            //更新最大流水号
+            dh.UpdateByCondition("RuleMaxNum", "rmn_maxnumber='" + custserialnum + "'", "rmn_nrcode='" + pr_exbarcode + "' and rmn_prefix='" + Prefix + "'");
+            MessageBox.Show("工单" + ma_code.Text + "生成SN清单成功");
+        }
+    }
+}

+ 159 - 0
UAS_MES_LGDZ/FunctionCode/Query/Query_RadiumSN.resx

@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+  <data name="GenSN.DownImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
+        dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFcSURBVFhH5di7UsJAFMbxtDT6QMI76IAFT0npIE0K
+        GcRORxHklpAIBHLfbILV8XxeNsMznJ35F5vu+82kWYuILD4N7oq75roCw27sb/x5WBdc27btntY64o/i
+        DnZjPxy4S6A0R6PHO1WUNHc9ep4uxIXd2D8eP/XZowWUThBG+n3p0stsKbbJ0qFDFFfscQuUbpzm9Pqx
+        Eh8c4PGLkuX0Nl+LDw4GJckUTRaO+OBQo+SKpitXfHAwKClfZuuN+OBgUDJV0NzxxAeHM5TFxhffGUpe
+        aFp5n+KDg0FRfHH8nfjgUKPoktztXnxwMCgFX7xdID441ChlRf7+ID44GBTNl21wFB8capSqot0xFB8c
+        /lE6Wa70IU5oH0Ziw/5cFebpoPUwHPbL04nCJKUgisWF3dgPB3gABc9v7fvBoBcnaVKdvkha2I39cPjx
+        oPrhusndcPinpIXd2N8gIusbTaFspKtR2SQAAAAASUVORK5CYII=
+</value>
+  </data>
+  <data name="GenSN.MoveImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
+        dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFzSURBVFhH5djNSgJRGMZxL2P2gTfQFbZvHSEZFBEW
+        CEIQBEIgVFiS9qXWoDmp4/fHzDmjM2a+vU/QqUVX0DvwXxxn9fwYXJwYEcXWNzIWt83dcq7AsBv7LXgA
+        ZI0r71/aaqjCJf8o7sFu7IcDFwdK4vimrv1oSZXRnArdQFzYjf3pQkOzRxIoVWc6X5X6M7ruBGIr9mbU
+        9MIVe9hAcXvBO125WnxwgMcXSpcPF20tPjgYlI5eUK6lxAcHg9Lmw3nTFx8cDEpLLSjr+OKDg0FpqojO
+        Gp744GBQ3vyITutT8cHBoDheRCe1ifjgYFBe+ZCxJ+KDg0GpT0NKv4zFBweDUpuEdFQdiQ8OBsXmw2Fl
+        JD44/KCM53TwNBQfHAzKMx/2Hgfig8M3SrXYUasUfz67DwOxYf9dV5urg+RWzta4aEnxn83OfV9c2I39
+        cIAHUOJceTNbUfmW94GX0sJu7IcDPH5fXCe4EvfXxe5/D7ux3yKi2CfkPhTy27lqkwAAAABJRU5ErkJg
+        gg==
+</value>
+  </data>
+  <data name="GenSN.NormalImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
+        dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAGVSURBVFhH5di7agJRFIXhDSKoYBQEC8FCECwEQRBE
+        4uUVEtTiPKVlom2wttM6IfF+15njXHRnL19jD/zFmanWV8zAEDNTp9OJS6/Sm2QUht3YH4cHtdvtF6k7
+        mUwG1tqd3FR3YTf2w0FKUVOu6XT68Xgw3+8PtWH/bDYbCkeLGo1Gz/d9JwzvrL0gCKx49KlerxtIBUGo
+        PjjAg2q1mqDc2fN99cEBHlStVk0oB+t56oMDPKhSqZggDNm1N/XBAR5ULpeNvGD46rrqgwM8qFQqGV8O
+        56ujPjjAg4rFosFL5ni5qA8O8KBCoWBuns/701l9cIAH5fN5QfF4dzipDw7woFwuZ+zN483+oD44wIOy
+        2azB52i13asPDvCgTCZjHGt5sdmqDw7woHQ6bRzX8ny1UR8c4EHJZNJc5fC7XKsPDvCgRCLR2x9Pzt9q
+        zT+Lpdqw/3A6W/HoUywWa32Nx8OL4zwffM8X6sJu7IcDPCgajaak7udoNNjsdgc81BZ2Yz8c4PH8cR2J
+        ROJSU3qXjMKwG/vjzEz/skOI3Zqgv7AAAAAASUVORK5CYII=
+</value>
+  </data>
+</root>

+ 57 - 0
UAS_MES_LGDZ/PublicMethod/BaseUtil.cs

@@ -31,6 +31,63 @@ namespace UAS_MES_NEW.PublicMethod
     class BaseUtil
     {
 
+        public static string DToAny(double DB, int Type)
+        {
+            string H = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+            string H1 = "23456789ABCDEFGHJKLMNPQRSTUVWXYZ";
+            long D;
+            double B;
+            string tempD = "", tempB = "";
+            if (Type == 32)
+            {
+                return GetRandomChar(H1);
+            }
+            else
+            {
+                D = (long)DB;
+                B = DB - D;
+                if (D == 0)
+                {
+                    tempD = "0";
+                }
+                while (D != 0)
+                {
+                    tempD = H[(((int)D % Type))] + tempD;
+                    D = D / Type;
+                }
+                for (int i = 0; i < 7; i++)
+                {
+                    if (B == 0)
+                    {
+                        break;
+                    }
+                    tempB += H[((int)(B * Type))];
+                    B = B * Type - (int)(B * Type);
+                }
+                if (tempB == "")
+                {
+                    return tempD;
+                }
+                else
+                {
+                    return tempD + "." + tempB;
+                }
+            }
+        }
+
+        public static string GetRandomChar(string str)
+        {
+            byte[] buffer = Guid.NewGuid().ToByteArray();
+            int iSeed = BitConverter.ToInt32(buffer, 0);
+            Random random = new Random(iSeed);
+            string data = "";
+            for (int i = 0; i < 5; i++)
+            {
+                int index = random.Next(0, 31);
+                data += str[index];
+            }
+            return data;
+        }
 
         public static Dictionary<string, object> ToDictionary(string JsonData)
         {

+ 10 - 0
UAS_MES_LGDZ/UAS_MES_LGDZ.csproj

@@ -1037,6 +1037,7 @@
     <Compile Include="FunctionCode\Packing\Packing_ProdWeightSet.Designer.cs">
       <DependentUpon>Packing_ProdWeightSet.cs</DependentUpon>
     </Compile>
+    <Compile Include="FunctionCode\Query\ArrayList.cs" />
     <Compile Include="FunctionCode\Query\Query_ExeProgress.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -1067,6 +1068,12 @@
     <Compile Include="FunctionCode\Query\Query_DateRate.Designer.cs">
       <DependentUpon>Query_DateRate.cs</DependentUpon>
     </Compile>
+    <Compile Include="FunctionCode\Query\Query_RadiumSN.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="FunctionCode\Query\Query_RadiumSN.Designer.cs">
+      <DependentUpon>Query_RadiumSN.cs</DependentUpon>
+    </Compile>
     <Compile Include="FunctionCode\Query\Query_SN.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -1814,6 +1821,9 @@
     <EmbeddedResource Include="FunctionCode\Query\Query_DateRate.resx">
       <DependentUpon>Query_DateRate.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="FunctionCode\Query\Query_RadiumSN.resx">
+      <DependentUpon>Query_RadiumSN.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="FunctionCode\Query\Query_SN.resx">
       <DependentUpon>Query_SN.cs</DependentUpon>
     </EmbeddedResource>