瀏覽代碼

Merge branch 'master' of ssh://10.10.100.21/source/mes-client

caosy 5 年之前
父節點
當前提交
0d87c714ae

+ 1 - 1
UAS-MES/FunctionCode/Make/Make_Decompose.cs

@@ -112,7 +112,7 @@ namespace UAS_MES.Make
             sql.Clear();
             sql.Append("select cm_craftcode,cm_spid,cm_craftname,cm_firstsn,cm_makecode,cm_stepcode,cm_stepname,cm_maprodcode,cm_fsoncode,cm_wccode,cm_maid,cm_soncode,cm_materialtype,");
             sql.Append("max(cm_status) cm_status,max(cm_id) cm_id from craftmaterial where(cm_sncode  in (select '" + sncode_1 + "' from dual union select firstsn from makesnrelation where sn ");
-            sql.Append(" ='" + sncode_1 + "'union  select sn from makesnrelation where firstsn = '" + sncode_1 + "')");
+            sql.Append(" ='" + sncode_1 + "'union  select sn from makesnrelation where firstsn = '" + sncode_1 + "' union select ms_code from makeserial where ms_sncode = '" + sncode_1 + "')");
             sql.Append(") group by cm_craftcode,cm_firstsn,cm_stepcode,cm_stepname,cm_spid,cm_makecode,cm_maprodcode,cm_maid,cm_soncode,cm_wccode,cm_materialtype,cm_craftname,cm_fsoncode ORDER BY cm_status DESC");
             dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
             if (dt.Rows.Count > 0)

+ 1 - 1
UAS-MES/FunctionCode/Make/Make_Decompose_Ex.cs

@@ -112,7 +112,7 @@ namespace UAS_MES.Make
             sql.Clear();
             sql.Append("select cm_craftcode,cm_spid,cm_craftname,cm_firstsn,cm_makecode,cm_stepcode,cm_stepname,cm_maprodcode,cm_fsoncode,cm_wccode,cm_maid,cm_soncode,cm_materialtype,");
             sql.Append("max(cm_status) cm_status,max(cm_id) cm_id from craftmaterial where(cm_sncode  in (select '" + sncode_1 + "' from dual union select firstsn from makesnrelation where sn ");
-            sql.Append(" ='" + sncode_1 + "'union  select sn from makesnrelation where firstsn = '" + sncode_1 + "')");
+            sql.Append(" ='" + sncode_1 + "'union  select sn from makesnrelation where firstsn = '" + sncode_1 + "' union select ms_code from makeserial where ms_sncode = '"+ sncode_1 + "')");
             sql.Append(") group by cm_craftcode,cm_firstsn,cm_stepcode,cm_stepname,cm_spid,cm_makecode,cm_maprodcode,cm_maid,cm_soncode,cm_wccode,cm_materialtype,cm_craftname,cm_fsoncode ORDER BY cm_status DESC");
             dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
             if (dt.Rows.Count > 0)

+ 11 - 32
UAS-MES/FunctionCode/Make/Make_Repair.cs

@@ -571,6 +571,16 @@ namespace UAS_MES.Make
                     OperatResult.AppendText(">>回流工序不在回流工艺中\n", Color.Red);
                 else
                 {
+                    //插入ERP生成追踪单,需要在更新mb_status之前插入,否则无法判断本次维修
+                    try
+                    {
+                        string[] param = new string[] { ms_sncode.Text, User.UserLineCode, User.WorkCenter, User.UserName, cd_stepcode.Text };
+                        dh.CallProcedure("SP_MAKEBADHANDLE", ref param);
+                    }
+                    catch (Exception ex)
+                    {
+                        LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, macode, User.UserLineCode, User.UserSourceCode, ex.Message.Substring(0, 20), "异常信息", ms_sncode.Text, ms_checkno.Text);
+                    }
                     dt = dh.getFieldsDataByCondition("makeserial", new string[] { "nvl(ms_ifrework,0) ms_ifrework", "ms_paststep" }, "ms_sncode='" + ms_sncode.Text + "' and ms_makecode='" + macode + "'");
                     List<string> SQLS = new List<string>();
                     if (dt.Rows.Count > 0)
@@ -590,39 +600,8 @@ namespace UAS_MES.Make
                     }
                     SQLS.Add("update makebad set mb_status=-1 where mb_sncode='" + ms_sncode.Text + "' and mb_makecode='" + ms_makecode.Text + "'");
                     //取消最近拆解部件
-                    SQLS.Add("update craftmaterial set cm_lastdeco=0 where cm_sncode='" + ms_sncode.Text + "' and cm_makecode='" + ms_makecode.Text + "' and nvl(cm_lastdeco,0)<>0");           
+                    SQLS.Add("update craftmaterial set cm_lastdeco=0 where cm_sncode='" + ms_sncode.Text + "' and cm_makecode='" + ms_makecode.Text + "' and nvl(cm_lastdeco,0)<>0");
                     dh.ExecuteSQLTran(SQLS.ToArray());
-                    //插入ERP生成追踪单
-                    try
-                    {
-                        string code = "";
-                        string[] param = new string[] { "makebadhandle", "2", code };
-                        dh.CallProcedure("SP_GETMAXNUMBER", ref param);
-                        code = param[2];
-                        //查询不良原因组数据插入,插入第一条
-                        sql.Clear();
-                        sql.Append("select mb_bgname,mb_badname,mbr_brgname from makebad left join makebadreason on mbr_mbid=mb_id where mb_sncode='" + ms_sncode.Text + "' and mb_status<>-1 and rownum=1");
-                        DataTable badinf = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                        string mb_bgname = "";
-                        string mb_badname = "";
-                        string mbr_brgname = "";
-                        if (badinf.Rows.Count > 0)
-                        {
-                            mb_bgname = badinf.Rows[0]["mb_bgname"].ToString();
-                            mb_badname = badinf.Rows[0]["mb_badname"].ToString();
-                            mbr_brgname = badinf.Rows[0]["mbr_brgname"].ToString();
-                        }
-                        sql.Clear();
-                        sql.Append("insert into makebadhandle@N_malata_zz(mbh_id,mbh_code,mbh_linecode,mbh_sn,mbh_indate,mbh_inman,mbh_statuscode,mbh_status,mbh_returnstep,mbh_wccode,mbh_badname,mbh_badgroup,mbh_badreason)");
-                        sql.Append("values(makebadhandle_seq.nextval@N_malata_zz,'" + code + "','" + User.UserLineCode + "','" + ms_sncode.Text + "',sysdate,'" + User.UserName + "',");
-                        sql.Append("'ENTERING','在录入','" + cd_stepcode.Text + "','" + User.WorkCenter + "','" + mb_badname + "','" + mb_bgname + "','" + mbr_brgname + "')");
-
-                        dh.ExecuteSql(sql.GetString(), "insert");
-                    }
-                    catch (Exception)
-                    {
-                        LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, macode, User.UserLineCode, User.UserSourceCode, "回流工序", "完成维修", ms_sncode.Text, ms_checkno.Text);
-                    }
                     LogicHandler.InsertMakeProcess(ms_sncode.Text, ms_makecode.Text, User.UserSourceCode, "回流工序", "完成维修", User.UserCode);
                     LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, macode, User.UserLineCode, User.UserSourceCode, "回流工序", "完成维修", ms_sncode.Text, ms_checkno.Text);
                     OperatResult.AppendText(">>序列号" + ms_sncode.Text + "回流成功\n", Color.Green);

+ 15 - 1
UAS-MES/FunctionCode/Make/Make_SMTStencil.cs

@@ -95,13 +95,18 @@ namespace UAS_MES.Make
             {
                 MessageBox.Show("工单号不能为空");
             }
-            DataTable dt = (DataTable)dh.ExecuteSql("select ST_USESTATUS,st_version from Stencil where st_code='" + SU_DEVCODE.Text + "' and st_statuscode='AUDITED'", "select");
+            int WaringCount =int.Parse(dh.GetConfig("WaringCount", "Stencil").ToString());
+            DataTable dt = (DataTable)dh.ExecuteSql("select ST_USESTATUS,st_version,nvl(st_maxusecount,0)st_maxusecount,nvl(st_usecount,0)st_usecount from Stencil where st_code='" + SU_DEVCODE.Text + "' and st_statuscode='AUDITED'", "select");
             string status = "";
             string version = "";
+            int st_maxusecount = 0;
+            int st_usecount = 0;
             if (dt.Rows.Count > 0)
             {
                 status = dt.Rows[0]["ST_USESTATUS"].ToString();
                 version = dt.Rows[0]["st_version"].ToString();
+                st_maxusecount =int.Parse( dt.Rows[0]["st_maxusecount"].ToString());
+                st_usecount = int.Parse(dt.Rows[0]["st_usecount"].ToString());
                 if (status == "在线" || status == "报废" || status == "在仓")
                 {
                     MessageBox.Show("当前钢网" + SU_DEVCODE.Text + "处于" + status + "状态,无法领用");
@@ -113,6 +118,15 @@ namespace UAS_MES.Make
                 MessageBox.Show("钢网编号" + SU_DEVCODE.Text + "不存在或者未审核");
                 return;
             }
+            //使用次数预警
+            if (st_maxusecount - st_usecount < WaringCount)
+            {
+                string close = MessageBox.Show(this.ParentForm, "钢网已使用"+ st_usecount+",距离使用上限还有"+(st_maxusecount - st_usecount)+"次", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
+                if (close != "Yes")
+                {
+                    return;
+                }
+            }
             //限制钢网使用的产品
             dt = (DataTable)dh.ExecuteSql("select 1 from STENILCANUSEPRO where sp_stcode='" + SU_DEVCODE.Text + "' and sp_prodcode='" + ma_prodcode.Text + "'", "select");
             if (dt.Rows.Count == 0)

+ 15 - 1
UAS-MES/FunctionCode/Make/Make_SMTStockStencil.cs

@@ -85,10 +85,15 @@ namespace UAS_MES.Make
 
         private void Receive_Click(object sender, EventArgs e)
         {
-            DataTable dt = (DataTable)dh.ExecuteSql("select ST_USESTATUS from Stencil where st_code='" + SU_DEVCODE.Text + "' and st_statuscode='AUDITED'", "select");
+            DataTable dt = (DataTable)dh.ExecuteSql("select ST_USESTATUS,nvl(st_maxusecount,0)st_maxusecount,nvl(st_usecount,0)st_usecount from Stencil where st_code='" + SU_DEVCODE.Text + "' and st_statuscode='AUDITED'", "select");
+            int WaringCount = int.Parse(dh.GetConfig("WaringCount", "Stencil").ToString());
+            int st_maxusecount = 0;
+            int st_usecount = 0;
             if (dt.Rows.Count > 0)
             {
                 string status = dt.Rows[0]["ST_USESTATUS"].ToString();
+                st_maxusecount = int.Parse(dt.Rows[0]["st_maxusecount"].ToString());
+                st_usecount = int.Parse(dt.Rows[0]["st_usecount"].ToString());
                 if (status == "借出" || status == "报废" || status == "在线")
                 {
                     MessageBox.Show("当前钢网" + SU_DEVCODE.Text + "处于" + status + "状态,无法领用");
@@ -100,6 +105,15 @@ namespace UAS_MES.Make
                 MessageBox.Show("钢网编号" + SU_DEVCODE.Text + "不存在或者未审核");
                 return;
             }
+            //使用次数预警
+            if (st_maxusecount - st_usecount < WaringCount)
+            {
+                string close = MessageBox.Show(this.ParentForm, "钢网已使用" + st_usecount + ",距离使用上限还有" + (st_maxusecount - st_usecount) + "次", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
+                if (close != "Yes")
+                {
+                    return;
+                }
+            }
             sql.Clear();
             sql.Append("insert into StencilUse(su_id,su_stid,su_stcode,su_stockusedate,su_useman,SU_USEMANCODE,su_stverison,SU_STATUS,SU_CLEANNUMS)");
             sql.Append("select StencilUse_seq.nextval,st_id,'" + SU_DEVCODE.Text + "',sysdate,'" + User.UserName + "','" + User.UserCode + "'");

+ 6 - 6
UAS-MES/FunctionCode/Make/Make_SeqProgramTransform.cs

@@ -122,20 +122,20 @@ namespace UAS_MES.Make
                                         OperateResult.AppendText("<<当前TSN号处于下地状态不允许操作\n", Color.Red, code);
                                         return;
                                     }
-                                    if (dt.Rows[0]["ms_stepcode"].ToString() == User.CurrentStepCode)
-                                    {
+                                    //if (dt.Rows[0]["ms_stepcode"].ToString() == User.CurrentStepCode)
+                                    //{
                                         step = 1;
 
                                         TSN = code.Text;
                                         //显示序列号
                                         show_sncode.Text = TSN;
                                         ChangeResult.Enabled = false;
-                                    }
-                                    else
-                                    {
+                                    //}
+                                    //else
+                                    //{
                                         OperateResult.AppendText("<<当前工序不允许重新转号\n", Color.Red, code);
                                         return;
-                                    }
+                                    //}
                                 }
                                 else
                                 {

+ 9 - 9
UAS-MES/FunctionCode/Make/Make_SeqTransform.cs

@@ -87,18 +87,18 @@ namespace UAS_MES.Make
                                         OperateResult.AppendText("<<当前TSN号处于下地状态不允许操作\n", Color.Red, sncode);
                                         return;
                                     }
-                                    if (dt.Rows[0]["ms_stepcode"].ToString() == User.CurrentStepCode)
-                                    {
+                                    //if (dt.Rows[0]["ms_stepcode"].ToString() == User.CurrentStepCode)
+                                    //{
                                         bsncode = sncode.Text;
                                         //显示序列号
                                         show_sncode.Text = bsncode;
                                         ChangeResult.Enabled = false;
-                                    }
-                                    else
-                                    {
-                                        OperateResult.AppendText("<<当前工序不允许重新转号\n", Color.Red, sncode);
-                                        return;
-                                    }
+                                    //}
+                                    //else
+                                    //{
+                                    //    OperateResult.AppendText("<<当前工序不允许重新转号\n", Color.Red, sncode);
+                                    //    return;
+                                    //}
                                 }
                                 else
                                 {
@@ -278,7 +278,7 @@ namespace UAS_MES.Make
                                     }
                                 }
 
-                                if (!ChangeResult.Checked && !onlyPass || bsncode != sncode.Text)
+                                if (!ChangeResult.Checked && !onlyPass || ChangeResult.Checked)
                                 {
                                     string firstsn = "";
                                     string updateSql = "";

+ 40 - 14
UAS-出货标签管理(贸易版)/ExportColumns.cs

@@ -5,6 +5,7 @@ using System.Data;
 using System.Drawing;
 using System.Linq;
 using System.Text;
+using System.Text.RegularExpressions;
 using System.Windows.Forms;
 using UAS_LabelMachine.Entity;
 using UAS_LabelMachine.PublicMethod;
@@ -41,6 +42,7 @@ namespace UAS_LabelMachine
         {
             //先删除之前此客户的记录
             dh.ExecuteSql("delete from CS_EXPORTSETTING where es_custcode='" + custcode + "'", "delete");
+            string Param = dh.getFieldDataByCondition("CHIP_EDCPARAMS", "wm_concat(cep_name)", "1=1").ToString();
             StringBuilder sql = new StringBuilder();
             List<string> es_filed = new List<string>();
             List<string> es_caption = new List<string>();
@@ -50,10 +52,11 @@ namespace UAS_LabelMachine
             List<string> es_detno = new List<string>();
             List<string> es_filed1 = new List<string>();
             List<string> es_istitle = new List<string>();
+            List<string> es_datatype = new List<string>();
             //插入首页固定的抬头
             es_filed.Add("pi_title"); es_caption.Add("客户"); es_enable.Add("-1"); es_prefix.Add("'客户:'"); es_suffix.Add("''"); es_detno.Add("0.1"); es_filed1.Add("pi_title"); es_istitle.Add("-1");
             es_filed.Add("pi_inoutno"); es_caption.Add("出货单号"); es_enable.Add("-1"); es_prefix.Add("'出货单号:'"); es_suffix.Add("''"); es_detno.Add("0.2"); es_filed1.Add("pi_inoutno"); es_istitle.Add("-1");
-            es_filed.Add("pr_spec"); es_caption.Add("型号"); es_enable.Add("-1"); es_prefix.Add("'型号:'"); es_suffix.Add("''"); es_detno.Add("0.3"); es_filed1.Add("pr_spec"); es_istitle.Add("-1");
+            es_filed.Add("pr_orispeccode"); es_caption.Add("型号"); es_enable.Add("-1"); es_prefix.Add("'型号:'"); es_suffix.Add("''"); es_detno.Add("0.3"); es_filed1.Add("pr_orispeccode"); es_istitle.Add("-1");
             es_filed.Add("pi_date"); es_caption.Add("销售日期"); es_enable.Add("-1"); es_prefix.Add("'销售日期:'"); es_suffix.Add("'销售部门:市场部'"); es_detno.Add("0.4"); es_filed1.Add("pi_date"); es_istitle.Add("-1");
             es_filed.Add("pd_ordercode"); es_caption.Add("订单编号"); es_enable.Add("-1"); es_prefix.Add("''"); es_suffix.Add("''"); es_detno.Add("0.5"); es_filed1.Add("pd_ordercode"); es_istitle.Add("-1");
             //插入首页信息
@@ -63,8 +66,8 @@ namespace UAS_LabelMachine
                 {
                     if (i == FirstPage.Columns[j].DisplayIndex)
                     {
-                        //pr_spec1 冲突BUG暂时无解,先特殊处理
-                        es_filed.Add(FirstPage.Columns[j].Tag.ToString() == "pr_spec1" ? "pr_spec" : FirstPage.Columns[j].Tag.ToString());
+                        //pr_orispeccode1 冲突BUG暂时无解,先特殊处理
+                        es_filed.Add(FirstPage.Columns[j].Tag.ToString() == "pr_orispeccode1" ? "pr_orispeccode" : FirstPage.Columns[j].Tag.ToString());
                         es_caption.Add(FirstPage.Columns[j].DataPropertyName);
                         es_enable.Add("-1");
                         es_prefix.Add("''");
@@ -82,18 +85,20 @@ namespace UAS_LabelMachine
             //清除首页赋的值
             es_filed.Clear(); es_caption.Clear(); es_enable.Clear(); es_prefix.Clear(); es_suffix.Clear(); es_detno.Clear(); es_filed.Clear(); es_filed1.Clear(); es_istitle.Clear();
             //新生成Data的抬头
-            es_filed.Add("pi_title"); es_caption.Add("客户"); es_enable.Add("-1"); es_prefix.Add("'客户:'"); es_suffix.Add("''"); es_detno.Add("0.1"); es_filed1.Add("pi_title"); es_istitle.Add("-1");
-            es_filed.Add("pi_inoutno"); es_caption.Add("出货单号"); es_enable.Add("-1"); es_prefix.Add("'出货单号:'"); es_suffix.Add("''"); es_detno.Add("0.2"); es_filed1.Add("pi_inoutno"); es_istitle.Add("-1");
-            es_filed.Add("pr_spec"); es_caption.Add("型号"); es_enable.Add("-1"); es_prefix.Add("'型号:'"); es_suffix.Add("'销售部门:市场部'"); es_detno.Add("0.3"); es_filed1.Add("pr_spec"); es_istitle.Add("-1");
-            es_filed.Add("pi_date"); es_caption.Add("销售日期"); es_enable.Add("-1"); es_prefix.Add("'销售日期:'"); es_suffix.Add("''"); es_detno.Add("0.4"); es_filed1.Add("pi_date"); es_istitle.Add("-1");
+            es_filed.Add("pi_title"); es_caption.Add("客户"); es_enable.Add("-1"); es_prefix.Add("'客户:'"); es_suffix.Add("''"); es_detno.Add("0.1"); es_filed1.Add("pi_title"); es_istitle.Add("-1"); es_datatype.Add("");
+            es_filed.Add("pi_inoutno"); es_caption.Add("出货单号"); es_enable.Add("-1"); es_prefix.Add("'出货单号:'"); es_suffix.Add("''"); es_detno.Add("0.2"); es_filed1.Add("pi_inoutno"); es_istitle.Add("-1"); es_datatype.Add("");
+            es_filed.Add("pr_orispeccode"); es_caption.Add("型号"); es_enable.Add("-1"); es_prefix.Add("'型号:'"); es_suffix.Add("'销售部门:市场部'"); es_detno.Add("0.3"); es_filed1.Add("pr_orispeccode"); es_istitle.Add("-1"); es_datatype.Add("");
+            es_filed.Add("pi_date"); es_caption.Add("销售日期"); es_enable.Add("-1"); es_prefix.Add("'销售日期:'"); es_suffix.Add("''"); es_detno.Add("0.4"); es_filed1.Add("pi_date"); es_istitle.Add("-1"); es_datatype.Add("");
+            es_filed.Add("me_desc"); es_caption.Add("大小"); es_enable.Add("-1"); es_prefix.Add("'('"); es_suffix.Add("')'"); es_detno.Add("5.1"); es_filed1.Add("me_desc"); es_istitle.Add("-1"); es_datatype.Add("");
+            es_filed.Add("pr_size"); es_caption.Add("尺寸"); es_enable.Add("-1"); es_prefix.Add("'尺寸:'"); es_suffix.Add("'销售部门:市场部'"); es_detno.Add("5.2"); es_filed1.Add("pr_size"); es_istitle.Add("-1"); es_datatype.Add("");
             for (int i = 0; i < DataPage.Columns.Count; i++)
             {
                 for (int j = 0; j < DataPage.Columns.Count; j++)
                 {
                     if (i == DataPage.Columns[j].DisplayIndex)
                     {
-                        //pr_spec1 冲突BUG暂时无解,先特殊处理
-                        es_filed.Add(DataPage.Columns[j].Tag.ToString() == "pr_spec1" ? "pr_spec" : DataPage.Columns[j].Tag.ToString());
+                        //pr_orispeccode1 冲突BUG暂时无解,先特殊处理
+                        es_filed.Add(DataPage.Columns[j].Tag.ToString() == "pr_orispeccode1" ? "pr_orispeccode" : DataPage.Columns[j].Tag.ToString());
                         es_caption.Add(DataPage.Columns[j].DataPropertyName);
                         es_enable.Add("-1");
                         es_prefix.Add("''");
@@ -101,13 +106,21 @@ namespace UAS_LabelMachine
                         es_detno.Add((DataPage.Columns[j].DisplayIndex + 1).ToString());
                         es_filed1.Add(DataPage.Columns[j].Tag.ToString());
                         es_istitle.Add("");
+                        if (Param.Contains(Regex.Replace(DataPage.Columns[j].DataPropertyName.ToUpper(), @"\d", "")))
+                        {
+                            es_datatype.Add("Param");
+                        }
+                        else
+                        {
+                            es_datatype.Add("");
+                        }
                     }
                 }
             }
             sql.Clear();
-            sql.Append("insert into CS_EXPORTSETTING(es_type,es_filed,es_caption,es_enable,es_prefix,es_suffix,es_detno,es_filed1,es_custcode,es_istitle)");
-            sql.Append("values('DataPage',:es_filed,:es_caption,:es_enable,:es_prefix,:es_suffix,:es_detno,:es_filed1,'" + custcode + "',:es_istitle)");
-            dh.BatchInsert(sql.ToString(), new string[] { "es_filed", "es_caption", "es_enable", "es_prefix", "es_suffix", "es_detno", "es_filed1", "es_istitle" }, es_filed.ToArray(), es_caption.ToArray(), es_enable.ToArray(), es_prefix.ToArray(), es_suffix.ToArray(), es_detno.ToArray(), es_filed1.ToArray(), es_istitle.ToArray());
+            sql.Append("insert into CS_EXPORTSETTING(es_type,es_filed,es_datatype,es_caption,es_enable,es_prefix,es_suffix,es_detno,es_filed1,es_custcode,es_istitle)");
+            sql.Append("values('DataPage',:es_filed,:es_datatype,:es_caption,:es_enable,:es_prefix,:es_suffix,:es_detno,:es_filed1,'" + custcode + "',:es_istitle)");
+            dh.BatchInsert(sql.ToString(), new string[] { "es_filed", "es_datatype", "es_caption", "es_enable", "es_prefix", "es_suffix", "es_detno", "es_filed1", "es_istitle" }, es_filed.ToArray(), es_datatype.ToArray(), es_caption.ToArray(), es_enable.ToArray(), es_prefix.ToArray(), es_suffix.ToArray(), es_detno.ToArray(), es_filed1.ToArray(), es_istitle.ToArray());
             MessageBox.Show("保存成功!");
         }
 
@@ -165,23 +178,32 @@ namespace UAS_LabelMachine
 
         private void LoadData()
         {
+            Console.WriteLine(DateTime.Now.ToString("yyyy/MM/dd h:mm:ss.fff"));
             StringBuilder sql = new StringBuilder();
             custcode = dh.getFieldDataByCondition("prodinout", "pi_cardcode", "pi_inoutno='" + inoutno + "'").ToString();
             DataTable SQL1_ = (DataTable)dh.ExecuteSql("select es_filed,es_caption,es_prefix,es_suffix,es_filed1 from CS_EXPORTSETTING where es_type='DataPage' and es_enable=-1 and es_custcode='" + custcode + "' and nvl(es_istitle,0)<>-1 order by es_detno", "select");
             //没有置顶客户的取空的
             if (SQL1_.Rows.Count == 0)
             {
-                SQL1_ = (DataTable)dh.ExecuteSql("select es_filed,es_caption,es_prefix,es_suffix,es_filed1 from CS_EXPORTSETTING where es_type='DataPage' and es_enable=-1 and es_custcode is null  and nvl(es_istitle,0)<>-1 order by es_detno", "select");
+                SQL1_ = (DataTable)dh.ExecuteSql("select es_filed,es_caption,es_prefix,es_suffix,es_filed1 from CS_EXPORTSETTING where es_type='DataPage' and es_enable=-1 and es_custcode is null and nvl(es_istitle,0)<>-1  order by es_detno", "select");
             }
+            Console.WriteLine(DateTime.Now.ToString("yyyy/MM/dd h:mm:ss.fff"));
+
             string es_field1 = "";
             for (int i = 0; i < SQL1_.Rows.Count; i++)
             {
                 es_field1 += SQL1_.Rows[i]["es_prefix"].ToString() + "||" + SQL1_.Rows[i]["es_filed"].ToString() + "||" + SQL1_.Rows[i]["es_suffix"].ToString() + ",";
             }
+            Console.WriteLine(DateTime.Now.ToString("yyyy/MM/dd h:mm:ss.fff"));
+
             //分页信息的DataTable
             string datasql = "";
+            Console.WriteLine(DateTime.Now.ToString("yyyy/MM/dd h:mm:ss.fff"));
             LogicHandler.GetDataSQL(inoutno, es_field1.Substring(0, es_field1.Length - 1), out datasql);
+            Console.WriteLine(DateTime.Now.ToString("yyyy/MM/dd h:mm:ss.fff"));
             DataTable dt = (DataTable)dh.ExecuteSql(datasql, "select");
+            Console.WriteLine(DateTime.Now.ToString("yyyy/MM/dd h:mm:ss.fff"));
+
             for (int i = 0; i < dt.Columns.Count; i++)
             {
                 if (dt.Columns[i].ColumnName == (SQL1_.Rows[i]["es_prefix"].ToString() + "||" + SQL1_.Rows[i]["es_filed"].ToString() + "||" + SQL1_.Rows[i]["es_suffix"].ToString()).ToUpper())
@@ -194,8 +216,10 @@ namespace UAS_LabelMachine
             DataTable SQL_ = (DataTable)dh.ExecuteSql("select es_filed,es_caption,es_prefix,es_suffix,es_filed1 from CS_EXPORTSETTING where es_type='First' and es_enable=-1 and es_custcode='" + custcode + "' and nvl(es_istitle,0)<>-1 order by es_detno", "select");
             if (SQL_.Rows.Count == 0)
             {
-                SQL_ = (DataTable)dh.ExecuteSql("select es_filed,es_caption,es_prefix,es_suffix,es_filed1 from CS_EXPORTSETTING where es_type='First' and es_enable=-1 and es_custcode is null and  nvl(es_istitle,0)<>-1 order by es_detno", "select");
+                SQL_ = (DataTable)dh.ExecuteSql("select es_filed,es_datatype,es_caption,es_prefix,es_suffix,es_filed1 from CS_EXPORTSETTING where es_type='First' and es_enable=-1 and es_custcode is null and  nvl(es_istitle,0)<>-1 order by es_detno", "select");
             }
+            Console.WriteLine(DateTime.Now.ToString("yyyy/MM/dd h:mm:ss.fff"));
+
             string es_field = "";
             for (int i = 0; i < SQL_.Rows.Count; i++)
             {
@@ -213,6 +237,8 @@ namespace UAS_LabelMachine
                     dt1.Columns[i].ColumnName = SQL_.Rows[i]["es_caption"].ToString();
                 }
             }
+            Console.WriteLine(DateTime.Now.ToString("yyyy/MM/dd h:mm:ss.fff"));
+
             if (FirstPage.DataSource != null)
                 FirstPage.DataSource = null;
             if (DataPage.DataSource != null)

+ 204 - 121
UAS-出货标签管理(贸易版)/ExportExcel.Designer.cs

@@ -39,9 +39,9 @@
             this.label2 = new System.Windows.Forms.Label();
             this.label3 = new System.Windows.Forms.Label();
             this.label4 = new System.Windows.Forms.Label();
-            this.BVCEO = new System.Windows.Forms.CheckBox();
-            this.TS = new System.Windows.Forms.CheckBox();
-            this.percent = new System.Windows.Forms.CheckBox();
+            this.H_Param2 = new System.Windows.Forms.CheckBox();
+            this.H_Param1 = new System.Windows.Forms.CheckBox();
+            this.M_Param1 = new System.Windows.Forms.CheckBox();
             this.label5 = new System.Windows.Forms.Label();
             this.label6 = new System.Windows.Forms.Label();
             this.BatchCode = new System.Windows.Forms.RadioButton();
@@ -52,16 +52,21 @@
             this.ExportFileDialog = new System.Windows.Forms.FolderBrowserDialog();
             this.FirstPage_YIELD = new System.Windows.Forms.CheckBox();
             this.FirstPage_REMARK = new System.Windows.Forms.CheckBox();
-            this.RowNum = new UAS_LabelMachine.CustomControl.NumOnlyTextBox();
             this.ExportSetting = new System.Windows.Forms.Button();
+            this.M_Param2 = new System.Windows.Forms.CheckBox();
+            this.M_Param3 = new System.Windows.Forms.CheckBox();
+            this.H_Param3 = new System.Windows.Forms.CheckBox();
+            this.RowNum = new UAS_LabelMachine.CustomControl.NumOnlyTextBox();
+            this.M_Param4 = new System.Windows.Forms.CheckBox();
+            this.H_Param4 = new System.Windows.Forms.CheckBox();
             this.SuspendLayout();
             // 
             // Export
             // 
-            this.Export.Location = new System.Drawing.Point(292, 290);
-            this.Export.Margin = new System.Windows.Forms.Padding(2);
+            this.Export.Location = new System.Drawing.Point(584, 580);
+            this.Export.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.Export.Name = "Export";
-            this.Export.Size = new System.Drawing.Size(94, 24);
+            this.Export.Size = new System.Drawing.Size(188, 48);
             this.Export.TabIndex = 0;
             this.Export.Text = "导出";
             this.Export.UseVisualStyleBackColor = true;
@@ -73,10 +78,10 @@
             this.CH_BLUEFILM.Checked = true;
             this.CH_BLUEFILM.CheckState = System.Windows.Forms.CheckState.Checked;
             this.CH_BLUEFILM.Font = new System.Drawing.Font("宋体", 10F);
-            this.CH_BLUEFILM.Location = new System.Drawing.Point(130, 58);
-            this.CH_BLUEFILM.Margin = new System.Windows.Forms.Padding(2);
+            this.CH_BLUEFILM.Location = new System.Drawing.Point(260, 116);
+            this.CH_BLUEFILM.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.CH_BLUEFILM.Name = "CH_BLUEFILM";
-            this.CH_BLUEFILM.Size = new System.Drawing.Size(68, 18);
+            this.CH_BLUEFILM.Size = new System.Drawing.Size(125, 31);
             this.CH_BLUEFILM.TabIndex = 1;
             this.CH_BLUEFILM.Text = "蓝膜号";
             this.CH_BLUEFILM.UseVisualStyleBackColor = true;
@@ -87,10 +92,10 @@
             this.CH_SPLITBATCH.Checked = true;
             this.CH_SPLITBATCH.CheckState = System.Windows.Forms.CheckState.Checked;
             this.CH_SPLITBATCH.Font = new System.Drawing.Font("宋体", 10F);
-            this.CH_SPLITBATCH.Location = new System.Drawing.Point(350, 58);
-            this.CH_SPLITBATCH.Margin = new System.Windows.Forms.Padding(2);
+            this.CH_SPLITBATCH.Location = new System.Drawing.Point(700, 116);
+            this.CH_SPLITBATCH.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.CH_SPLITBATCH.Name = "CH_SPLITBATCH";
-            this.CH_SPLITBATCH.Size = new System.Drawing.Size(82, 18);
+            this.CH_SPLITBATCH.Size = new System.Drawing.Size(152, 31);
             this.CH_SPLITBATCH.TabIndex = 3;
             this.CH_SPLITBATCH.Text = "扩散批号";
             this.CH_SPLITBATCH.UseVisualStyleBackColor = true;
@@ -101,10 +106,10 @@
             this.CH_PBCODE.Checked = true;
             this.CH_PBCODE.CheckState = System.Windows.Forms.CheckState.Checked;
             this.CH_PBCODE.Font = new System.Drawing.Font("宋体", 10F);
-            this.CH_PBCODE.Location = new System.Drawing.Point(130, 94);
-            this.CH_PBCODE.Margin = new System.Windows.Forms.Padding(2);
+            this.CH_PBCODE.Location = new System.Drawing.Point(260, 188);
+            this.CH_PBCODE.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.CH_PBCODE.Name = "CH_PBCODE";
-            this.CH_PBCODE.Size = new System.Drawing.Size(54, 18);
+            this.CH_PBCODE.Size = new System.Drawing.Size(98, 31);
             this.CH_PBCODE.TabIndex = 8;
             this.CH_PBCODE.Text = "盒号";
             this.CH_PBCODE.UseVisualStyleBackColor = true;
@@ -115,10 +120,10 @@
             this.CH_REMARK.Checked = true;
             this.CH_REMARK.CheckState = System.Windows.Forms.CheckState.Checked;
             this.CH_REMARK.Font = new System.Drawing.Font("宋体", 10F);
-            this.CH_REMARK.Location = new System.Drawing.Point(244, 94);
-            this.CH_REMARK.Margin = new System.Windows.Forms.Padding(2);
+            this.CH_REMARK.Location = new System.Drawing.Point(488, 188);
+            this.CH_REMARK.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.CH_REMARK.Name = "CH_REMARK";
-            this.CH_REMARK.Size = new System.Drawing.Size(82, 18);
+            this.CH_REMARK.Size = new System.Drawing.Size(152, 31);
             this.CH_REMARK.TabIndex = 9;
             this.CH_REMARK.Text = "芯片备注";
             this.CH_REMARK.UseVisualStyleBackColor = true;
@@ -129,10 +134,10 @@
             this.ch_code.Checked = true;
             this.ch_code.CheckState = System.Windows.Forms.CheckState.Checked;
             this.ch_code.Font = new System.Drawing.Font("宋体", 10F);
-            this.ch_code.Location = new System.Drawing.Point(244, 58);
-            this.ch_code.Margin = new System.Windows.Forms.Padding(2);
+            this.ch_code.Location = new System.Drawing.Point(488, 116);
+            this.ch_code.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.ch_code.Name = "ch_code";
-            this.ch_code.Size = new System.Drawing.Size(68, 18);
+            this.ch_code.Size = new System.Drawing.Size(125, 31);
             this.ch_code.TabIndex = 10;
             this.ch_code.Text = "芯片号";
             this.ch_code.UseVisualStyleBackColor = true;
@@ -143,10 +148,10 @@
             this.CH_WATERID.Checked = true;
             this.CH_WATERID.CheckState = System.Windows.Forms.CheckState.Checked;
             this.CH_WATERID.Font = new System.Drawing.Font("宋体", 10F);
-            this.CH_WATERID.Location = new System.Drawing.Point(452, 58);
-            this.CH_WATERID.Margin = new System.Windows.Forms.Padding(2);
+            this.CH_WATERID.Location = new System.Drawing.Point(904, 116);
+            this.CH_WATERID.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.CH_WATERID.Name = "CH_WATERID";
-            this.CH_WATERID.Size = new System.Drawing.Size(82, 18);
+            this.CH_WATERID.Size = new System.Drawing.Size(156, 31);
             this.CH_WATERID.TabIndex = 11;
             this.CH_WATERID.Text = "Wafer_ID";
             this.CH_WATERID.UseVisualStyleBackColor = true;
@@ -155,10 +160,10 @@
             // 
             this.label1.AutoSize = true;
             this.label1.Font = new System.Drawing.Font("宋体", 10F);
-            this.label1.Location = new System.Drawing.Point(11, 26);
-            this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label1.Location = new System.Drawing.Point(22, 52);
+            this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(63, 14);
+            this.label1.Size = new System.Drawing.Size(120, 27);
             this.label1.TabIndex = 12;
             this.label1.Text = "打印选项";
             // 
@@ -166,10 +171,10 @@
             // 
             this.label2.AutoSize = true;
             this.label2.Font = new System.Drawing.Font("宋体", 10F);
-            this.label2.Location = new System.Drawing.Point(11, 60);
-            this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label2.Location = new System.Drawing.Point(22, 120);
+            this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(112, 14);
+            this.label2.Size = new System.Drawing.Size(215, 27);
             this.label2.TabIndex = 13;
             this.label2.Text = "请选择打印内容:";
             // 
@@ -177,10 +182,10 @@
             // 
             this.label3.AutoSize = true;
             this.label3.Font = new System.Drawing.Font("宋体", 10F);
-            this.label3.Location = new System.Drawing.Point(11, 135);
-            this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label3.Location = new System.Drawing.Point(22, 270);
+            this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label3.Name = "label3";
-            this.label3.Size = new System.Drawing.Size(112, 14);
+            this.label3.Size = new System.Drawing.Size(216, 27);
             this.label3.TabIndex = 14;
             this.label3.Text = "参数选择(机测):";
             // 
@@ -188,57 +193,60 @@
             // 
             this.label4.AutoSize = true;
             this.label4.Font = new System.Drawing.Font("宋体", 10F);
-            this.label4.Location = new System.Drawing.Point(11, 175);
-            this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label4.Location = new System.Drawing.Point(22, 350);
+            this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label4.Name = "label4";
-            this.label4.Size = new System.Drawing.Size(112, 14);
+            this.label4.Size = new System.Drawing.Size(216, 27);
             this.label4.TabIndex = 15;
             this.label4.Text = "参数选择(手测):";
             // 
-            // BVCEO
-            // 
-            this.BVCEO.AutoSize = true;
-            this.BVCEO.Font = new System.Drawing.Font("宋体", 10F);
-            this.BVCEO.Location = new System.Drawing.Point(244, 173);
-            this.BVCEO.Margin = new System.Windows.Forms.Padding(2);
-            this.BVCEO.Name = "BVCEO";
-            this.BVCEO.Size = new System.Drawing.Size(61, 18);
-            this.BVCEO.TabIndex = 17;
-            this.BVCEO.Text = "BVCEO";
-            this.BVCEO.UseVisualStyleBackColor = true;
-            // 
-            // TS
-            // 
-            this.TS.AutoSize = true;
-            this.TS.Font = new System.Drawing.Font("宋体", 10F);
-            this.TS.Location = new System.Drawing.Point(130, 173);
-            this.TS.Margin = new System.Windows.Forms.Padding(2);
-            this.TS.Name = "TS";
-            this.TS.Size = new System.Drawing.Size(40, 18);
-            this.TS.TabIndex = 18;
-            this.TS.Text = "TS";
-            this.TS.UseVisualStyleBackColor = true;
-            // 
-            // percent
-            // 
-            this.percent.AutoSize = true;
-            this.percent.Font = new System.Drawing.Font("宋体", 10F);
-            this.percent.Location = new System.Drawing.Point(130, 133);
-            this.percent.Margin = new System.Windows.Forms.Padding(2);
-            this.percent.Name = "percent";
-            this.percent.Size = new System.Drawing.Size(47, 18);
-            this.percent.TabIndex = 19;
-            this.percent.Text = "HFS";
-            this.percent.UseVisualStyleBackColor = true;
+            // H_Param2
+            // 
+            this.H_Param2.AutoSize = true;
+            this.H_Param2.Font = new System.Drawing.Font("宋体", 10F);
+            this.H_Param2.Location = new System.Drawing.Point(488, 346);
+            this.H_Param2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.H_Param2.Name = "H_Param2";
+            this.H_Param2.Size = new System.Drawing.Size(156, 31);
+            this.H_Param2.TabIndex = 17;
+            this.H_Param2.Text = "H_Param2";
+            this.H_Param2.UseVisualStyleBackColor = true;
+            this.H_Param2.Visible = false;
+            // 
+            // H_Param1
+            // 
+            this.H_Param1.AutoSize = true;
+            this.H_Param1.Font = new System.Drawing.Font("宋体", 10F);
+            this.H_Param1.Location = new System.Drawing.Point(260, 346);
+            this.H_Param1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.H_Param1.Name = "H_Param1";
+            this.H_Param1.Size = new System.Drawing.Size(156, 31);
+            this.H_Param1.TabIndex = 18;
+            this.H_Param1.Text = "H_Param1";
+            this.H_Param1.UseVisualStyleBackColor = true;
+            this.H_Param1.Visible = false;
+            // 
+            // M_Param1
+            // 
+            this.M_Param1.AutoSize = true;
+            this.M_Param1.Font = new System.Drawing.Font("宋体", 10F);
+            this.M_Param1.Location = new System.Drawing.Point(260, 266);
+            this.M_Param1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.M_Param1.Name = "M_Param1";
+            this.M_Param1.Size = new System.Drawing.Size(156, 31);
+            this.M_Param1.TabIndex = 19;
+            this.M_Param1.Text = "M_Param1";
+            this.M_Param1.UseVisualStyleBackColor = true;
+            this.M_Param1.Visible = false;
             // 
             // label5
             // 
             this.label5.AutoSize = true;
             this.label5.Font = new System.Drawing.Font("宋体", 10F);
-            this.label5.Location = new System.Drawing.Point(11, 254);
-            this.label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label5.Location = new System.Drawing.Point(22, 508);
+            this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label5.Name = "label5";
-            this.label5.Size = new System.Drawing.Size(98, 14);
+            this.label5.Size = new System.Drawing.Size(188, 27);
             this.label5.TabIndex = 20;
             this.label5.Text = "首页打印方式:";
             // 
@@ -246,10 +254,10 @@
             // 
             this.label6.AutoSize = true;
             this.label6.Font = new System.Drawing.Font("宋体", 10F);
-            this.label6.Location = new System.Drawing.Point(11, 216);
-            this.label6.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label6.Location = new System.Drawing.Point(22, 432);
+            this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label6.Name = "label6";
-            this.label6.Size = new System.Drawing.Size(98, 14);
+            this.label6.Size = new System.Drawing.Size(188, 27);
             this.label6.TabIndex = 21;
             this.label6.Text = "打印分页方式:";
             // 
@@ -257,10 +265,10 @@
             // 
             this.BatchCode.AutoSize = true;
             this.BatchCode.Font = new System.Drawing.Font("宋体", 10F);
-            this.BatchCode.Location = new System.Drawing.Point(130, 216);
-            this.BatchCode.Margin = new System.Windows.Forms.Padding(2);
+            this.BatchCode.Location = new System.Drawing.Point(260, 432);
+            this.BatchCode.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.BatchCode.Name = "BatchCode";
-            this.BatchCode.Size = new System.Drawing.Size(67, 18);
+            this.BatchCode.Size = new System.Drawing.Size(124, 31);
             this.BatchCode.TabIndex = 22;
             this.BatchCode.Text = "扩散批";
             this.BatchCode.UseVisualStyleBackColor = true;
@@ -269,10 +277,10 @@
             // 
             this.BoxCode.AutoSize = true;
             this.BoxCode.Font = new System.Drawing.Font("宋体", 10F);
-            this.BoxCode.Location = new System.Drawing.Point(222, 216);
-            this.BoxCode.Margin = new System.Windows.Forms.Padding(2);
+            this.BoxCode.Location = new System.Drawing.Point(444, 432);
+            this.BoxCode.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.BoxCode.Name = "BoxCode";
-            this.BoxCode.Size = new System.Drawing.Size(53, 18);
+            this.BoxCode.Size = new System.Drawing.Size(97, 31);
             this.BoxCode.TabIndex = 23;
             this.BoxCode.Text = "盒号";
             this.BoxCode.UseVisualStyleBackColor = true;
@@ -282,10 +290,10 @@
             this.FixRow.AutoSize = true;
             this.FixRow.Checked = true;
             this.FixRow.Font = new System.Drawing.Font("宋体", 10F);
-            this.FixRow.Location = new System.Drawing.Point(306, 216);
-            this.FixRow.Margin = new System.Windows.Forms.Padding(2);
+            this.FixRow.Location = new System.Drawing.Point(612, 432);
+            this.FixRow.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.FixRow.Name = "FixRow";
-            this.FixRow.Size = new System.Drawing.Size(81, 18);
+            this.FixRow.Size = new System.Drawing.Size(151, 31);
             this.FixRow.TabIndex = 24;
             this.FixRow.TabStop = true;
             this.FixRow.Text = "固定行号";
@@ -295,10 +303,10 @@
             // 
             this.label7.AutoSize = true;
             this.label7.Font = new System.Drawing.Font("宋体", 10F);
-            this.label7.Location = new System.Drawing.Point(405, 216);
-            this.label7.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label7.Location = new System.Drawing.Point(810, 432);
+            this.label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label7.Name = "label7";
-            this.label7.Size = new System.Drawing.Size(70, 14);
+            this.label7.Size = new System.Drawing.Size(134, 27);
             this.label7.TabIndex = 25;
             this.label7.Text = "分页行数:";
             // 
@@ -306,10 +314,10 @@
             // 
             this.FirstPage_WID.AutoSize = true;
             this.FirstPage_WID.Font = new System.Drawing.Font("宋体", 10F);
-            this.FirstPage_WID.Location = new System.Drawing.Point(130, 254);
-            this.FirstPage_WID.Margin = new System.Windows.Forms.Padding(2);
+            this.FirstPage_WID.Location = new System.Drawing.Point(260, 508);
+            this.FirstPage_WID.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.FirstPage_WID.Name = "FirstPage_WID";
-            this.FirstPage_WID.Size = new System.Drawing.Size(110, 18);
+            this.FirstPage_WID.Size = new System.Drawing.Size(210, 31);
             this.FirstPage_WID.TabIndex = 29;
             this.FirstPage_WID.Text = "打印Wafer id";
             this.FirstPage_WID.UseVisualStyleBackColor = true;
@@ -318,10 +326,10 @@
             // 
             this.FirstPage_YIELD.AutoSize = true;
             this.FirstPage_YIELD.Font = new System.Drawing.Font("宋体", 10F);
-            this.FirstPage_YIELD.Location = new System.Drawing.Point(244, 254);
-            this.FirstPage_YIELD.Margin = new System.Windows.Forms.Padding(2);
+            this.FirstPage_YIELD.Location = new System.Drawing.Point(488, 508);
+            this.FirstPage_YIELD.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.FirstPage_YIELD.Name = "FirstPage_YIELD";
-            this.FirstPage_YIELD.Size = new System.Drawing.Size(54, 18);
+            this.FirstPage_YIELD.Size = new System.Drawing.Size(98, 31);
             this.FirstPage_YIELD.TabIndex = 31;
             this.FirstPage_YIELD.Text = "良率";
             this.FirstPage_YIELD.UseVisualStyleBackColor = true;
@@ -330,40 +338,110 @@
             // 
             this.FirstPage_REMARK.AutoSize = true;
             this.FirstPage_REMARK.Font = new System.Drawing.Font("宋体", 10F);
-            this.FirstPage_REMARK.Location = new System.Drawing.Point(304, 254);
-            this.FirstPage_REMARK.Margin = new System.Windows.Forms.Padding(2);
+            this.FirstPage_REMARK.Location = new System.Drawing.Point(608, 508);
+            this.FirstPage_REMARK.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.FirstPage_REMARK.Name = "FirstPage_REMARK";
-            this.FirstPage_REMARK.Size = new System.Drawing.Size(54, 18);
+            this.FirstPage_REMARK.Size = new System.Drawing.Size(98, 31);
             this.FirstPage_REMARK.TabIndex = 32;
             this.FirstPage_REMARK.Text = "备注";
             this.FirstPage_REMARK.UseVisualStyleBackColor = true;
             // 
-            // RowNum
-            // 
-            this.RowNum.Location = new System.Drawing.Point(480, 214);
-            this.RowNum.Margin = new System.Windows.Forms.Padding(2);
-            this.RowNum.Name = "RowNum";
-            this.RowNum.Negative = false;
-            this.RowNum.Size = new System.Drawing.Size(52, 21);
-            this.RowNum.TabIndex = 30;
-            this.RowNum.Text = "10";
-            // 
             // ExportSetting
             // 
-            this.ExportSetting.Location = new System.Drawing.Point(201, 290);
-            this.ExportSetting.Margin = new System.Windows.Forms.Padding(2);
+            this.ExportSetting.Location = new System.Drawing.Point(402, 580);
+            this.ExportSetting.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.ExportSetting.Name = "ExportSetting";
-            this.ExportSetting.Size = new System.Drawing.Size(80, 24);
+            this.ExportSetting.Size = new System.Drawing.Size(160, 48);
             this.ExportSetting.TabIndex = 33;
             this.ExportSetting.Text = "导出列配置";
             this.ExportSetting.UseVisualStyleBackColor = true;
             this.ExportSetting.Click += new System.EventHandler(this.ExportSetting_Click);
             // 
+            // M_Param2
+            // 
+            this.M_Param2.AutoSize = true;
+            this.M_Param2.Font = new System.Drawing.Font("宋体", 10F);
+            this.M_Param2.Location = new System.Drawing.Point(488, 266);
+            this.M_Param2.Margin = new System.Windows.Forms.Padding(4);
+            this.M_Param2.Name = "M_Param2";
+            this.M_Param2.Size = new System.Drawing.Size(156, 31);
+            this.M_Param2.TabIndex = 34;
+            this.M_Param2.Text = "M_Param2";
+            this.M_Param2.UseVisualStyleBackColor = true;
+            this.M_Param2.Visible = false;
+            // 
+            // M_Param3
+            // 
+            this.M_Param3.AutoSize = true;
+            this.M_Param3.Font = new System.Drawing.Font("宋体", 10F);
+            this.M_Param3.Location = new System.Drawing.Point(700, 269);
+            this.M_Param3.Margin = new System.Windows.Forms.Padding(4);
+            this.M_Param3.Name = "M_Param3";
+            this.M_Param3.Size = new System.Drawing.Size(156, 31);
+            this.M_Param3.TabIndex = 35;
+            this.M_Param3.Text = "M_Param3";
+            this.M_Param3.UseVisualStyleBackColor = true;
+            this.M_Param3.Visible = false;
+            // 
+            // H_Param3
+            // 
+            this.H_Param3.AutoSize = true;
+            this.H_Param3.Font = new System.Drawing.Font("宋体", 10F);
+            this.H_Param3.Location = new System.Drawing.Point(700, 346);
+            this.H_Param3.Margin = new System.Windows.Forms.Padding(4);
+            this.H_Param3.Name = "H_Param3";
+            this.H_Param3.Size = new System.Drawing.Size(156, 31);
+            this.H_Param3.TabIndex = 36;
+            this.H_Param3.Text = "H_Param3";
+            this.H_Param3.UseVisualStyleBackColor = true;
+            this.H_Param3.Visible = false;
+            // 
+            // RowNum
+            // 
+            this.RowNum.Location = new System.Drawing.Point(960, 428);
+            this.RowNum.Margin = new System.Windows.Forms.Padding(4);
+            this.RowNum.Name = "RowNum";
+            this.RowNum.Negative = false;
+            this.RowNum.Size = new System.Drawing.Size(100, 35);
+            this.RowNum.TabIndex = 30;
+            this.RowNum.Text = "10";
+            // 
+            // M_Param4
+            // 
+            this.M_Param4.AutoSize = true;
+            this.M_Param4.Font = new System.Drawing.Font("宋体", 10F);
+            this.M_Param4.Location = new System.Drawing.Point(904, 266);
+            this.M_Param4.Margin = new System.Windows.Forms.Padding(4);
+            this.M_Param4.Name = "M_Param4";
+            this.M_Param4.Size = new System.Drawing.Size(156, 31);
+            this.M_Param4.TabIndex = 37;
+            this.M_Param4.Text = "M_Param4";
+            this.M_Param4.UseVisualStyleBackColor = true;
+            this.M_Param4.Visible = false;
+            // 
+            // H_Param4
+            // 
+            this.H_Param4.AutoSize = true;
+            this.H_Param4.Font = new System.Drawing.Font("宋体", 10F);
+            this.H_Param4.Location = new System.Drawing.Point(904, 346);
+            this.H_Param4.Margin = new System.Windows.Forms.Padding(4);
+            this.H_Param4.Name = "H_Param4";
+            this.H_Param4.Size = new System.Drawing.Size(156, 31);
+            this.H_Param4.TabIndex = 38;
+            this.H_Param4.Text = "H_Param4";
+            this.H_Param4.UseVisualStyleBackColor = true;
+            this.H_Param4.Visible = false;
+            // 
             // ExportExcel
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(572, 336);
+            this.ClientSize = new System.Drawing.Size(1144, 672);
+            this.Controls.Add(this.H_Param4);
+            this.Controls.Add(this.M_Param4);
+            this.Controls.Add(this.H_Param3);
+            this.Controls.Add(this.M_Param3);
+            this.Controls.Add(this.M_Param2);
             this.Controls.Add(this.ExportSetting);
             this.Controls.Add(this.FirstPage_REMARK);
             this.Controls.Add(this.FirstPage_YIELD);
@@ -375,9 +453,9 @@
             this.Controls.Add(this.BatchCode);
             this.Controls.Add(this.label6);
             this.Controls.Add(this.label5);
-            this.Controls.Add(this.percent);
-            this.Controls.Add(this.TS);
-            this.Controls.Add(this.BVCEO);
+            this.Controls.Add(this.M_Param1);
+            this.Controls.Add(this.H_Param1);
+            this.Controls.Add(this.H_Param2);
             this.Controls.Add(this.label4);
             this.Controls.Add(this.label3);
             this.Controls.Add(this.label2);
@@ -389,7 +467,7 @@
             this.Controls.Add(this.CH_SPLITBATCH);
             this.Controls.Add(this.CH_BLUEFILM);
             this.Controls.Add(this.Export);
-            this.Margin = new System.Windows.Forms.Padding(2);
+            this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.Name = "ExportExcel";
             this.Text = "导出数据";
             this.Load += new System.EventHandler(this.ExportExcel_Load);
@@ -411,9 +489,9 @@
         private System.Windows.Forms.Label label2;
         private System.Windows.Forms.Label label3;
         private System.Windows.Forms.Label label4;
-        private System.Windows.Forms.CheckBox BVCEO;
-        private System.Windows.Forms.CheckBox TS;
-        private System.Windows.Forms.CheckBox percent;
+        private System.Windows.Forms.CheckBox H_Param2;
+        private System.Windows.Forms.CheckBox H_Param1;
+        private System.Windows.Forms.CheckBox M_Param1;
         private System.Windows.Forms.Label label5;
         private System.Windows.Forms.Label label6;
         private System.Windows.Forms.RadioButton BatchCode;
@@ -426,5 +504,10 @@
         private System.Windows.Forms.CheckBox FirstPage_YIELD;
         private System.Windows.Forms.CheckBox FirstPage_REMARK;
         private System.Windows.Forms.Button ExportSetting;
+        private System.Windows.Forms.CheckBox M_Param2;
+        private System.Windows.Forms.CheckBox M_Param3;
+        private System.Windows.Forms.CheckBox H_Param3;
+        private System.Windows.Forms.CheckBox M_Param4;
+        private System.Windows.Forms.CheckBox H_Param4;
     }
 }

+ 55 - 11
UAS-出货标签管理(贸易版)/ExportExcel.cs

@@ -21,7 +21,7 @@ namespace UAS_LabelMachine
         public ExportExcel(string pi_inoutno)
         {
             InitializeComponent();
-     
+
             inoutno = pi_inoutno;
         }
 
@@ -50,9 +50,9 @@ namespace UAS_LabelMachine
                 conditionbox.Add(CH_SPLITBATCH);
                 conditionbox.Add(CH_WATERID);
                 conditionbox.Add(ch_code);
-                conditionbox.Add(percent);
-                conditionbox.Add(TS);
-                conditionbox.Add(BVCEO);
+                conditionbox.Add(M_Param1);
+                conditionbox.Add(H_Param1);
+                conditionbox.Add(H_Param2);
                 conditionbox.Add(FirstPage_WID);
                 conditionbox.Add(FirstPage_YIELD);
                 conditionbox.Add(FirstPage_REMARK);
@@ -69,16 +69,31 @@ namespace UAS_LabelMachine
                 {
                     SplitType = BoxCode.Name;
                 }
-                DataTable SQL1_ = (DataTable)dh.ExecuteSql("select es_filed,es_caption,es_prefix,es_suffix,es_filed1 from CS_EXPORTSETTING where es_type='DataPage' and es_enable=-1 and es_custcode='" + custcode + "' order by es_detno", "select");
+                DataTable SQL1_ = (DataTable)dh.ExecuteSql("select es_filed,es_datatype,es_caption,es_prefix,es_suffix,es_filed1 from CS_EXPORTSETTING where es_type='DataPage' and es_enable=-1 and es_custcode='" + custcode + "' order by es_detno", "select");
                 //没有置顶客户的取空的
                 if (SQL1_.Rows.Count == 0)
                 {
-                    SQL1_ = (DataTable)dh.ExecuteSql("select es_filed,es_caption,es_prefix,es_suffix,es_filed1 from CS_EXPORTSETTING where es_type='DataPage' and es_enable=-1 and es_custcode is null order by es_detno", "select");
+                    SQL1_ = (DataTable)dh.ExecuteSql("select es_filed,es_datatype,es_caption,es_prefix,es_suffix,es_filed1 from CS_EXPORTSETTING where es_type='DataPage' and es_enable=-1 and es_custcode is null order by es_detno", "select");
                 }
                 string es_field1 = "";
                 for (int i = 0; i < SQL1_.Rows.Count; i++)
                 {
-                    es_field1 += SQL1_.Rows[i]["es_prefix"].ToString() + "||" + SQL1_.Rows[i]["es_filed"].ToString() + "||" + SQL1_.Rows[i]["es_suffix"].ToString() + ",";
+                    //不是参数的直接拼接
+                    if (SQL1_.Rows[i]["es_datatype"].ToString() != "Param")
+                        es_field1 += SQL1_.Rows[i]["es_prefix"].ToString() + "||" + SQL1_.Rows[i]["es_filed"].ToString() + "||" + SQL1_.Rows[i]["es_suffix"].ToString() + ",";
+                    //是参数的则先判断是否含有内容
+                    else if (
+                        (SQL1_.Rows[i]["es_filed"].ToString().Contains(M_Param1.Text) && M_Param1.Visible == true && M_Param1.Checked) ||
+                        (SQL1_.Rows[i]["es_filed"].ToString().Contains(M_Param2.Text) && M_Param2.Visible == true && M_Param2.Checked) ||
+                        (SQL1_.Rows[i]["es_filed"].ToString().Contains(M_Param3.Text) && M_Param3.Visible == true && M_Param3.Checked) ||
+                        (SQL1_.Rows[i]["es_filed"].ToString().Contains(M_Param4.Text) && M_Param4.Visible == true && M_Param4.Checked) ||
+                        (SQL1_.Rows[i]["es_filed"].ToString().Contains(H_Param1.Text) && H_Param1.Visible == true && H_Param1.Checked) ||
+                        (SQL1_.Rows[i]["es_filed"].ToString().Contains(H_Param2.Text) && H_Param2.Visible == true && H_Param2.Checked) ||
+                        (SQL1_.Rows[i]["es_filed"].ToString().Contains(H_Param3.Text) && H_Param3.Visible == true && H_Param3.Checked) ||
+                        (SQL1_.Rows[i]["es_filed"].ToString().Contains(H_Param4.Text) && H_Param4.Visible == true && H_Param4.Checked))
+                    {
+                        es_field1 += SQL1_.Rows[i]["es_prefix"].ToString() + "||" + SQL1_.Rows[i]["es_filed"].ToString() + "||" + SQL1_.Rows[i]["es_suffix"].ToString() + ",";
+                    }
                 }
                 //分页信息的DataTable
                 string datasql = "";
@@ -86,13 +101,15 @@ namespace UAS_LabelMachine
                 DataTable dt = (DataTable)dh.ExecuteSql(datasql, "select");
                 for (int i = 0; i < dt.Columns.Count; i++)
                 {
-                    if (dt.Columns[i].ColumnName == (SQL1_.Rows[i]["es_prefix"].ToString() + "||" + SQL1_.Rows[i]["es_filed"].ToString() + "||" + SQL1_.Rows[i]["es_suffix"].ToString()).ToUpper())
+                    for (int j = 0; j < SQL1_.Rows.Count; j++)
                     {
-                        dt.Columns[i].ColumnName = SQL1_.Rows[i]["es_filed1"].ToString();
-                        dt.Columns[i].Caption = SQL1_.Rows[i]["es_caption"].ToString();
+                        if (dt.Columns[i].ColumnName == (SQL1_.Rows[j]["es_prefix"].ToString() + "||" + SQL1_.Rows[j]["es_filed"].ToString() + "||" + SQL1_.Rows[j]["es_suffix"].ToString()).ToUpper())
+                        {
+                            dt.Columns[i].ColumnName = SQL1_.Rows[j]["es_filed1"].ToString();
+                            dt.Columns[i].Caption = SQL1_.Rows[j]["es_caption"].ToString();
+                        }
                     }
                 }
-         
                 //获取首页需要展示的字段
                 DataTable SQL_ = (DataTable)dh.ExecuteSql("select es_filed,es_caption,es_prefix,es_suffix,es_filed1 from CS_EXPORTSETTING where es_type='First' and es_enable=-1 and es_custcode='" + custcode + "' order by es_detno", "select");
                 if (SQL_.Rows.Count == 0)
@@ -128,6 +145,33 @@ namespace UAS_LabelMachine
         {
             Activate();
             LogicHandler.CustInit("0");
+            StringBuilder sql = new StringBuilder();
+            sql.Clear();
+            sql.Append("select distinct cep_name,CEP_COLLECTIONTYPE from ProdIODetail left join Product on pd_prodcode = pr_code ");
+            sql.Append("left join CHIP_EDCPARAMS_SPEC on pr_orispeccode=ced_model left join  CHIP_EDCPARAMS_SPECDETAIL  on ced_id=cesd_cedid  ");
+            sql.Append("left join  CHIP_EDCPARAMS on CESD_CEPID = CEP_ID where pd_inoutno='" + inoutno + "' and ced_status='-1' and CEP_COLLECTIONTYPE='机测'");
+            DataTable dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
+            for (int i = 0; i < dt.Rows.Count; i++)
+            {
+                if (i <= 4)
+                {
+                    Controls["M_Param" + (i + 1)].Visible = true;
+                    Controls["M_Param" + (i + 1)].Text = dt.Rows[i]["cep_name"].ToString();
+                }
+            }
+            sql.Clear();
+            sql.Append("select distinct cep_name,CEP_COLLECTIONTYPE from ProdIODetail left join Product on pd_prodcode = pr_code ");
+            sql.Append("left join CHIP_EDCPARAMS_SPEC on pr_orispeccode=ced_model left join  CHIP_EDCPARAMS_SPECDETAIL  on ced_id=cesd_cedid  ");
+            sql.Append("left join  CHIP_EDCPARAMS on CESD_CEPID = CEP_ID where pd_inoutno='" + inoutno + "' and ced_status='-1' and CEP_COLLECTIONTYPE='手测'");
+            dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
+            for (int i = 0; i < dt.Rows.Count; i++)
+            {
+                if (i <= 4)
+                {
+                    Controls["H_Param" + (i + 1)].Visible = true;
+                    Controls["H_Param" + (i + 1)].Text = dt.Rows[i]["cep_name"].ToString();
+                }
+            }
         }
 
         private void ExportSetting_Click(object sender, EventArgs e)

+ 63 - 100
UAS-出货标签管理(贸易版)/PublicMethod/ExcelHandler.cs

@@ -186,7 +186,7 @@ namespace UAS_LabelMachine
                 return null;
             }
         }
-
+        int RowHeight = 11;
         /// <summary>
         /// 将DataTable形式的数据转成Excel格式的,然后用字节流的形式写入文件
         /// </summary>
@@ -278,7 +278,12 @@ namespace UAS_LabelMachine
             HSSFWorkbook book = new HSSFWorkbook();
             //Excel中的Sheet
             ISheet sheet = book.CreateSheet("分页");
-
+            sheet.SetMargin(MarginType.TopMargin, 0.5);
+            sheet.SetMargin(MarginType.BottomMargin, 0.5);
+            sheet.SetMargin(MarginType.LeftMargin, 0.5);
+            sheet.SetMargin(MarginType.RightMargin, 0.5);
+            //芯片号需要作为更新盒号的条件
+            bool ShowChcode = true;
             //更新箱号
             List<string> ch_code = new List<string>();
             //系统打印箱号
@@ -314,7 +319,7 @@ namespace UAS_LabelMachine
                     {
                         if (DataTable.Columns[i].ColumnName.ToLower().Contains("ch_code"))
                         {
-                            DataTable.Columns.RemoveAt(i);
+                            ShowChcode = true;
                             break;
                         }
                     }
@@ -350,30 +355,6 @@ namespace UAS_LabelMachine
                             break;
                         }
                     }
-                    if (box[j].Name.ToLower() == "percent" && !box[j].Checked)
-                    {
-                        if (DataTable.Columns[i].ColumnName.ToLower().Contains("chw_percent1") || DataTable.Columns[i].ColumnName.ToLower().Contains("chw_percent2") || DataTable.Columns[i].ColumnName.ToLower().Contains("chw_itemname1") || DataTable.Columns[i].ColumnName.ToLower().Contains("chw_itemname2"))
-                        {
-                            DataTable.Columns.RemoveAt(i);
-                            break;
-                        }
-                    }
-                    if (box[j].Name.ToLower() == "ts" && !box[j].Checked)
-                    {
-                        if (DataTable.Columns[i].ColumnName.ToLower() == ("ts1") || DataTable.Columns[i].ColumnName.ToLower() == ("ts2") || DataTable.Columns[i].ColumnName.ToLower() == ("ts3"))
-                        {
-                            DataTable.Columns.RemoveAt(i);
-                            break;
-                        }
-                    }
-                    if (box[j].Name.ToLower() == "bvceo" && !box[j].Checked)
-                    {
-                        if (DataTable.Columns[i].ColumnName.ToLower() == "bvceo1" || DataTable.Columns[i].ColumnName.ToLower() == ("bvceo2") || DataTable.Columns[i].ColumnName.ToLower() == ("bvceo3"))
-                        {
-                            DataTable.Columns.RemoveAt(i);
-                            break;
-                        }
-                    }
                 }
             }
             //获取行数量和列数量
@@ -384,12 +365,12 @@ namespace UAS_LabelMachine
             //冻结第一行
             sheet.CreateFreezePane(0, 1, 0, 1);
    
-            row.HeightInPoints = 20;
+            row.HeightInPoints = RowHeight;
             //固定第一行
             //row.RowStyle.IsLocked=true;
             //给第一行的标签赋值样式和值
             row.CreateCell(0);
-            row.Cells[0].SetCellValue("                     深爱半导体有限公司芯片出货清单");
+            row.Cells[0].SetCellValue("                     深爱半导体股份有限公司芯片出货清单");
             row.GetCell(0).CellStyle = style;
             //开始绘制的Index
             int PaintIndex = 1;
@@ -404,21 +385,22 @@ namespace UAS_LabelMachine
                     string First_OrderCode = "";
                     string First_Prspec = "";
                     string First_Batch = "";
+                    int NumIndex = 0;
                     ArrayList<string> First_WID = new ArrayList<string>();
                     for (int i = 0; i < rowNum; i++)
                     {
                         IRow row1 = sheet.CreateRow(PaintIndex);
                         PaintIndex = PaintIndex + 1;
-                        row1.HeightInPoints = 20;
+                        row1.HeightInPoints = RowHeight;
                         //不包含的订单号
                         if (DataTable.Columns.Contains("pd_ordercode") && !First_OrderCode.Contains(DataTable.Rows[i]["pd_ordercode"].ToString()))
                         {
                             First_OrderCode += DataTable.Rows[i]["pd_ordercode"].ToString() + " ";
                         }
                         //不包含的物料型号
-                        if (DataTable.Columns.Contains("pr_spec1") && !First_Prspec.Contains(DataTable.Rows[i]["pr_spec1"].ToString()))
+                        if (DataTable.Columns.Contains("pr_orispeccode1") && !First_Prspec.Contains(DataTable.Rows[i]["pr_orispeccode1"].ToString()))
                         {
-                            First_Prspec += DataTable.Rows[i]["pr_spec1"].ToString() + " ";
+                            First_Prspec += DataTable.Rows[i]["pr_orispeccode1"].ToString() + " ";
                         }
                         //不包含扩撒批号
                         if (DataTable.Columns.Contains("ch_splitbatch") && !First_Batch.Contains(DataTable.Rows[i]["ch_splitbatch"].ToString()))
@@ -433,13 +415,13 @@ namespace UAS_LabelMachine
                         if (i / PageSize >= 1 && i % PageSize == 0)
                         {
                             DataRow dr = FirstDT.NewRow();
-                            dr["pr_spec"] = DataTable.Rows[i]["pr_spec"].ToString();
+                            dr["pr_orispeccode"] = DataTable.Rows[i]["pr_orispeccode"].ToString();
                             dr["pi_inoutno"] = DataTable.Rows[i]["pi_inoutno"].ToString();
                             pi_inoutno = DataTable.Rows[i]["pi_inoutno"].ToString();
                             dr["pi_title"] = DataTable.Rows[i]["pi_title"].ToString();
                             dr["pi_date"] = DataTable.Rows[i]["pi_date"].ToString();
                             dr["pd_ordercode"] = First_OrderCode;
-                            dr["pr_spec1"] = First_Prspec;
+                            dr["pr_orispeccode1"] = First_Prspec;
                             dr["ch_splitbatch"] = First_Batch;
                             dr["ch_waterid"] = BaseUtil.GetArrStr(First_WID, " ");
                             dr["num"] = PageSize;
@@ -452,24 +434,20 @@ namespace UAS_LabelMachine
                             BoxCode = BoxCode + 1;
                             for (int j = 0; j < columnNum - 4; j++)
                             {
+                                row1.CreateCell(j);
                                 if (j == 0)
                                 {
-                                    row1.CreateCell(j);
                                     row1.Cells[j].SetCellValue("小计");
                                 }
-                                else if (j == 2)
-                                {
-                                    row1.CreateCell(j);
-                                    row1.Cells[j].SetCellValue(sumCount);
-                                }
-                                else
+                                else if (DataTable.Columns[j].ColumnName=="io_qty")
                                 {
-                                    row1.CreateCell(j);
+                                    row1.Cells[NumIndex - 4].SetCellValue(sumCount);
                                 }
                                 row1.Cells[j].CellStyle = styleborder;
                             }
                             sumCount = 0;
                             row1 = sheet.CreateRow(PaintIndex);
+                            sheet.SetRowBreak(PaintIndex-1);
                             PaintIndex = PaintIndex + 1;
                         }
                         //每次到了页数开始分页
@@ -509,7 +487,7 @@ namespace UAS_LabelMachine
                                     if (j == 0)
                                     {
                                         row1.CreateCell(j);
-                                        row1.Cells[j].SetCellValue(DataTable.Rows[i]["pr_spec"].ToString());
+                                        row1.Cells[j].SetCellValue(DataTable.Rows[i]["pr_orispeccode"].ToString()+ DataTable.Rows[i]["me_desc"].ToString() + DataTable.Rows[i]["pr_size"].ToString());
                                     }
                                     else if (columnNum > 5 && j == columnNum - 5)
                                     {
@@ -530,6 +508,7 @@ namespace UAS_LabelMachine
                                 //添加列名
                                 row1 = sheet.CreateRow(PaintIndex);
                                 PaintIndex = PaintIndex + 1;
+                                //计数列所在的索引
                                 for (int j = 4; j < columnNum; j++)
                                 {
                                     row1.CreateCell(j - 4);
@@ -544,8 +523,13 @@ namespace UAS_LabelMachine
                                     }
                                     else
                                         row1.Cells[j - 4].SetCellValue(DataTable.Columns[j].Caption);
+
+                                    if (DataTable.Columns[j].ColumnName.ToString() == "io_qty")
+                                    {
+                                        NumIndex = j;
+                                    }
                                     //如果chw_itemname1的值为空,则值为100和0,其中一列不显示,不显示
-                                    if (DataTable.Columns[j].ColumnName.ToLower().Contains("chw_itemname") || DataTable.Columns[j].ColumnName.ToLower().Contains("pr_spec") || DataTable.Columns[j].ColumnName.ToLower().Contains("pd_ordercode"))
+                                    if (DataTable.Columns[j].ColumnName.ToLower().Contains("chw_itemname") || DataTable.Columns[j].ColumnName.ToLower().Contains("pr_orispeccode") || DataTable.Columns[j].ColumnName.ToLower().Contains("pd_ordercode") || DataTable.Columns[j].ColumnName.ToLower().Contains("pr_size") || DataTable.Columns[j].ColumnName.ToLower().Contains("me_desc")||(!ShowChcode && DataTable.Columns[j].ColumnName.ToLower().Contains("ch_code")))
                                     {
                                         sheet.SetColumnHidden(j - 4, true);
                                     }
@@ -575,12 +559,12 @@ namespace UAS_LabelMachine
                         if (i == rowNum - 1)
                         {
                             DataRow dr = FirstDT.NewRow();
-                            dr["pr_spec"] = DataTable.Rows[i]["pr_spec"].ToString();
+                            dr["pr_orispeccode"] = DataTable.Rows[i]["pr_orispeccode"].ToString();
                             dr["pi_inoutno"] = DataTable.Rows[i]["pi_inoutno"].ToString();
                             dr["pi_title"] = DataTable.Rows[i]["pi_title"].ToString();
                             dr["pi_date"] = DataTable.Rows[i]["pi_date"].ToString();
                             dr["pd_ordercode"] = First_OrderCode;
-                            dr["pr_spec1"] = First_Prspec;
+                            dr["pr_orispeccode1"] = First_Prspec;
                             dr["ch_splitbatch"] = First_Batch;
                             dr["ch_waterid"] = BaseUtil.GetArrStr(First_WID, " ");
                             dr["num"] = (i % PageSize) + 1;
@@ -590,25 +574,18 @@ namespace UAS_LabelMachine
                             PaintIndex = PaintIndex + 1;
                             for (int j = 0; j < columnNum - 4; j++)
                             {
+                                row1.CreateCell(j);
                                 if (j == 0)
                                 {
-                                    row1.CreateCell(j);
                                     row1.Cells[j].SetCellValue("小计");
                                 }
-                                else if (j == 2)
-                                {
-                                    row1.CreateCell(j);
-                                    row1.Cells[j].SetCellValue(sumCount);
-                                }
-                                else
+                                else if (DataTable.Columns[j].ColumnName=="io_qty")
                                 {
-                                    row1.CreateCell(j);
+                                    row1.Cells[j - 4].SetCellValue(sumCount);
                                 }
                                 row1.Cells[j].CellStyle = styleborder;
                             }
-
                             row1 = sheet.CreateRow(PaintIndex);
-                            PaintIndex = PaintIndex + 1;
                             for (int j = 0; j < columnNum - 3; j++)
                             {
                                 if (j == 0)
@@ -643,6 +620,8 @@ namespace UAS_LabelMachine
                                 }
                                 row1.Cells[j].CellStyle = style;
                             }
+                            sheet.SetRowBreak(PaintIndex);
+                            PaintIndex = PaintIndex + 1;
                         }
                         ch_code.Add(DataTable.Rows[i]["ch_code"].ToString());
                         pib_outboxcode1.Add(BoxCode.ToString());
@@ -662,31 +641,27 @@ namespace UAS_LabelMachine
                     {
                         IRow row1 = sheet.CreateRow(PaintIndex);
                         PaintIndex = PaintIndex + 1;
-                        row1.HeightInPoints = 20;
+                        row1.HeightInPoints = RowHeight;
                         //如果批号不相等的时候
                         if (LastBatchCode != "" && LastBatchCode != DataTable.Rows[i]["ch_splitbatch"].ToString())
                         {
                             BoxCode = BoxCode + 1;
                             for (int j = 0; j < columnNum - 4; j++)
                             {
+                                row1.CreateCell(j);
                                 if (j == 0)
                                 {
-                                    row1.CreateCell(j);
                                     row1.Cells[j].SetCellValue("小计");
                                 }
-                                else if (j == 2)
+                                else if (DataTable.Columns[j].ColumnName == "io_qty")
                                 {
-                                    row1.CreateCell(j);
-                                    row1.Cells[j].SetCellValue(sumCount);
-                                }
-                                else
-                                {
-                                    row1.CreateCell(j);
+                                    row1.Cells[j - 4].SetCellValue(sumCount);
                                 }
                                 row1.Cells[j].CellStyle = styleborder;
                             }
                             sumCount = 0;
                             row1 = sheet.CreateRow(PaintIndex);
+                            sheet.SetRowBreak(PaintIndex - 1);
                             PaintIndex = PaintIndex + 1;
                         }
                         //每次到了页数开始分页
@@ -722,7 +697,7 @@ namespace UAS_LabelMachine
                                     if (j == 0)
                                     {
                                         row1.CreateCell(j);
-                                        row1.Cells[j].SetCellValue(DataTable.Rows[i]["pr_spec"].ToString());
+                                        row1.Cells[j].SetCellValue(DataTable.Rows[i]["pr_orispeccode"].ToString() + DataTable.Rows[i]["me_desc"].ToString() + DataTable.Rows[i]["pr_size"].ToString());
                                     }
                                     else if (j == columnNum - 4)
                                     {
@@ -752,7 +727,7 @@ namespace UAS_LabelMachine
                                     }
                                     else
                                         row1.Cells[j - 4].SetCellValue(DataTable.Columns[j].Caption);
-                                    if (DataTable.Columns[j].ColumnName.ToLower().Contains("chw_itemname") || DataTable.Columns[j].ColumnName.ToLower().Contains("pr_spec") || DataTable.Columns[j].ColumnName.ToLower().Contains("pd_ordercode"))
+                                    if (DataTable.Columns[j].ColumnName.ToLower().Contains("chw_itemname") || DataTable.Columns[j].ColumnName.ToLower().Contains("pr_orispeccode") || DataTable.Columns[j].ColumnName.ToLower().Contains("pd_ordercode") || DataTable.Columns[j].ColumnName.ToLower().Contains("pr_size") || DataTable.Columns[j].ColumnName.ToLower().Contains("me_desc") || (!ShowChcode && DataTable.Columns[j].ColumnName.ToLower().Contains("ch_code")))
                                     {
                                         sheet.SetColumnHidden(j - 4, true);
                                     }
@@ -784,25 +759,19 @@ namespace UAS_LabelMachine
                             PaintIndex = PaintIndex + 1;
                             for (int j = 0; j < columnNum - 4; j++)
                             {
+                                row1.CreateCell(j);
                                 if (j == 0)
                                 {
-                                    row1.CreateCell(j);
                                     row1.Cells[j].SetCellValue("小计");
                                 }
-                                else if (j == 2)
+                                else if (DataTable.Columns[j].ColumnName == "io_qty")
                                 {
-                                    row1.CreateCell(j);
-                                    row1.Cells[j].SetCellValue(sumCount);
-                                }
-                                else
-                                {
-                                    row1.CreateCell(j);
+                                    row1.Cells[j - 4].SetCellValue(sumCount);
                                 }
                                 row1.Cells[j].CellStyle = styleborder;
                             }
                             //创建备注内容
                             row1 = sheet.CreateRow(PaintIndex);
-                            PaintIndex = PaintIndex + 1;
                             for (int j = 0; j < columnNum - 3; j++)
                             {
                                 if (j == 0)
@@ -836,6 +805,8 @@ namespace UAS_LabelMachine
                                 }
                                 row1.Cells[j].CellStyle = style;
                             }
+                            sheet.SetRowBreak(PaintIndex);
+                            PaintIndex = PaintIndex + 1;
                         }
                         ch_code.Add(DataTable.Rows[i]["ch_code"].ToString());
                         pib_outboxcode1.Add(BoxCode.ToString());
@@ -855,31 +826,27 @@ namespace UAS_LabelMachine
                     {
                         IRow row1 = sheet.CreateRow(PaintIndex);
                         PaintIndex = PaintIndex + 1;
-                        row1.HeightInPoints = 20;
+                        row1.HeightInPoints = RowHeight;
                         //如果批号不相等的时候
                         if (LastBoxCode != "" && LastBoxCode != DataTable.Rows[i]["CH_PBCODE"].ToString())
                         {
                             BoxCode = BoxCode + 1;
                             for (int j = 0; j < columnNum - 4; j++)
                             {
+                                row1.CreateCell(j);
                                 if (j == 0)
                                 {
-                                    row1.CreateCell(j);
                                     row1.Cells[j].SetCellValue("小计");
                                 }
-                                else if (j == 2)
-                                {
-                                    row1.CreateCell(j);
-                                    row1.Cells[j].SetCellValue(sumCount);
-                                }
-                                else
+                                else if (DataTable.Columns[j].ColumnName == "io_qty")
                                 {
-                                    row1.CreateCell(j);
+                                    row1.Cells[j - 4].SetCellValue(sumCount);
                                 }
                                 row1.Cells[j].CellStyle = styleborder;
                             }
                             sumCount = 0;
                             row1 = sheet.CreateRow(PaintIndex);
+                            sheet.SetRowBreak(PaintIndex - 1);
                             PaintIndex = PaintIndex + 1;
                         }
                         //每次到了页数开始分页
@@ -920,7 +887,7 @@ namespace UAS_LabelMachine
                                     if (j == 0)
                                     {
                                         row1.CreateCell(j);
-                                        row1.Cells[j].SetCellValue(DataTable.Rows[i]["pr_spec"].ToString());
+                                        row1.Cells[j].SetCellValue(DataTable.Rows[i]["pr_orispeccode"].ToString() + DataTable.Rows[i]["me_desc"].ToString() + DataTable.Rows[i]["pr_size"].ToString());
                                     }
                                     else if (j > 5 && j == columnNum - 5)
                                     {
@@ -956,7 +923,7 @@ namespace UAS_LabelMachine
                                     }
                                     else
                                         row1.Cells[j - 4].SetCellValue(DataTable.Columns[j].Caption);
-                                    if (DataTable.Columns[j].ColumnName.ToLower().Contains("chw_itemname") || DataTable.Columns[j].ColumnName.ToLower().Contains("pr_spec") || DataTable.Columns[j].ColumnName.ToLower().Contains("pd_ordercode"))
+                                    if (DataTable.Columns[j].ColumnName.ToLower().Contains("chw_itemname") || DataTable.Columns[j].ColumnName.ToLower().Contains("pr_orispeccode") || DataTable.Columns[j].ColumnName.ToLower().Contains("pd_ordercode") || DataTable.Columns[j].ColumnName.ToLower().Contains("pr_size") || DataTable.Columns[j].ColumnName.ToLower().Contains("me_desc") || (!ShowChcode && DataTable.Columns[j].ColumnName.ToLower().Contains("ch_code")))
                                     {
                                         sheet.SetColumnHidden(j - 4, true);
                                     }
@@ -988,25 +955,19 @@ namespace UAS_LabelMachine
                             PaintIndex = PaintIndex + 1;
                             for (int j = 0; j < columnNum - 4; j++)
                             {
+                                row1.CreateCell(j);
                                 if (j == 0)
                                 {
-                                    row1.CreateCell(j);
                                     row1.Cells[j].SetCellValue("小计");
                                 }
-                                else if (j == 2)
+                                else if (DataTable.Columns[j].ColumnName == "io_qty")
                                 {
-                                    row1.CreateCell(j);
-                                    row1.Cells[j].SetCellValue(sumCount);
-                                }
-                                else
-                                {
-                                    row1.CreateCell(j);
+                                    row1.Cells[j - 4].SetCellValue(sumCount);
                                 }
                                 row1.Cells[j].CellStyle = styleborder;
                             }
-
                             row1 = sheet.CreateRow(PaintIndex);
-                            PaintIndex = PaintIndex + 1;
+                   
                             for (int j = 0; j < columnNum - 3; j++)
                             {
                                 if (j == 0)
@@ -1040,6 +1001,8 @@ namespace UAS_LabelMachine
                                 }
                                 row1.Cells[j].CellStyle = style;
                             }
+                            sheet.SetRowBreak(PaintIndex);
+                            PaintIndex = PaintIndex + 1;
                         }
                         ch_code.Add(DataTable.Rows[i]["ch_code"].ToString());
                         pib_outboxcode1.Add(BoxCode.ToString());
@@ -1064,7 +1027,7 @@ namespace UAS_LabelMachine
             ISheet sheet2 = book.CreateSheet("首页");
             row = sheet2.CreateRow(0);
             row.CreateCell(0);
-            row.Cells[0].SetCellValue("                     深爱半导体有限公司芯片出货清单");
+            row.Cells[0].SetCellValue("                     深爱半导体股份有限公司芯片出货清单");
             row.GetCell(0).CellStyle = style;
             rowNum = FirstDT.Rows.Count;
             //不需要显示的列移除
@@ -1100,7 +1063,7 @@ namespace UAS_LabelMachine
             {
                 IRow row1 = sheet2.CreateRow(PaintIndex);
                 PaintIndex = PaintIndex + 1;
-                row1.HeightInPoints = 20;
+                row1.HeightInPoints = RowHeight;
                 //只需要绘制一行
                 if (i == 0)
                 {
@@ -1135,7 +1098,7 @@ namespace UAS_LabelMachine
                         if (j == 0)
                         {
                             row1.CreateCell(j);
-                            row1.Cells[j].SetCellValue(FirstDT.Rows[i]["pr_spec"].ToString());
+                            row1.Cells[j].SetCellValue(FirstDT.Rows[i]["pr_orispeccode"].ToString());
                         }
                         else if (j > 5 && j == columnNum - 5)
                         {

+ 19 - 9
UAS-出货标签管理(贸易版)/UAS-出货标签管理(贸易版).csproj

@@ -100,6 +100,14 @@
     <Reference Include="Analysis">
       <HintPath>tool\Analysis.dll</HintPath>
     </Reference>
+    <Reference Include="CheckBoxComboBox">
+      <HintPath>tool\CheckBoxComboBox.dll</HintPath>
+    </Reference>
+    <Reference Include="DevExpress.Data.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
+    <Reference Include="DevExpress.Printing.v15.2.Core, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
+    <Reference Include="DevExpress.Sparkline.v15.2.Core, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
+    <Reference Include="DevExpress.Utils.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
+    <Reference Include="DevExpress.XtraEditors.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
     <Reference Include="ICSharpCode.SharpZipLib">
       <HintPath>tool\ICSharpCode.SharpZipLib.dll</HintPath>
     </Reference>
@@ -123,8 +131,10 @@
       <HintPath>tool\Seagull.BarTender.Print.dll</HintPath>
     </Reference>
     <Reference Include="System" />
+    <Reference Include="System.ComponentModel.DataAnnotations" />
     <Reference Include="System.configuration" />
     <Reference Include="System.Core" />
+    <Reference Include="System.Data.Linq" />
     <Reference Include="System.Data.SQLite, Version=1.0.82.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>tool\System.Data.SQLite.dll</HintPath>
@@ -265,6 +275,12 @@
     <Compile Include="PowerSetting.Designer.cs">
       <DependentUpon>PowerSetting.cs</DependentUpon>
     </Compile>
+    <Compile Include="PreViewWindow.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="PreViewWindow.Designer.cs">
+      <DependentUpon>PreViewWindow.cs</DependentUpon>
+    </Compile>
     <Compile Include="Properties\Settings1.Designer.cs">
       <AutoGen>True</AutoGen>
       <DesignTimeSharedInput>True</DesignTimeSharedInput>
@@ -385,6 +401,9 @@
     <EmbeddedResource Include="PowerSetting.resx">
       <DependentUpon>PowerSetting.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="PreViewWindow.resx">
+      <DependentUpon>PreViewWindow.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="ReSetMaxNum.resx">
       <DependentUpon>ReSetMaxNum.cs</DependentUpon>
     </EmbeddedResource>
@@ -737,15 +756,6 @@
     <None Include="Resources\preview_16px_25980_easyicon.net.png" />
   </ItemGroup>
   <ItemGroup>
-    <COMReference Include="BarTender">
-      <Guid>{D58562C1-E51B-11CF-8941-00A024A9083F}</Guid>
-      <VersionMajor>7</VersionMajor>
-      <VersionMinor>75</VersionMinor>
-      <Lcid>0</Lcid>
-      <WrapperTool>tlbimp</WrapperTool>
-      <Isolated>False</Isolated>
-      <EmbedInteropTypes>False</EmbedInteropTypes>
-    </COMReference>
     <COMReference Include="LabelManager2">
       <Guid>{3624B9C2-9E5D-11D3-A896-00C04F324E22}</Guid>
       <VersionMajor>6</VersionMajor>

+ 14 - 0
UAS-出货标签管理(贸易版)/UAS_出货标签管理.Designer.cs

@@ -200,6 +200,7 @@
             this.OutboxCapacity = new System.Windows.Forms.NumericUpDown();
             this.OutBoxLabelPrint = new System.Windows.Forms.Button();
             this.OutBoxCombox = new System.Windows.Forms.ComboBox();
+            this.MidLabelPreView = new System.Windows.Forms.LinkLabel();
             ((System.ComponentModel.ISupportInitialize)(this.Si_ItemDGV)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.MidSource)).BeginInit();
             this.ShowMenu.SuspendLayout();
@@ -1584,6 +1585,7 @@
             // 
             // MidLabel
             // 
+            this.MidLabel.Controls.Add(this.MidLabelPreView);
             this.MidLabel.Controls.Add(this.GetMidBoxCode);
             this.MidLabel.Controls.Add(this.label9);
             this.MidLabel.Controls.Add(this.MidDocRefresh);
@@ -1978,6 +1980,17 @@
             this.OutBoxCombox.TabIndex = 78;
             this.OutBoxCombox.SelectedIndexChanged += new System.EventHandler(this.OutBoxCombox_SelectedIndexChanged);
             // 
+            // MidLabelPreView
+            // 
+            this.MidLabelPreView.AutoSize = true;
+            this.MidLabelPreView.Location = new System.Drawing.Point(97, 19);
+            this.MidLabelPreView.Name = "MidLabelPreView";
+            this.MidLabelPreView.Size = new System.Drawing.Size(42, 21);
+            this.MidLabelPreView.TabIndex = 119;
+            this.MidLabelPreView.TabStop = true;
+            this.MidLabelPreView.Text = "预览";
+            this.MidLabelPreView.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.MidLabelPreView_LinkClicked);
+            // 
             // UAS_出货标签打印
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -2228,5 +2241,6 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_spec;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_outboxcode1;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_outboxcode2;
+        private System.Windows.Forms.LinkLabel MidLabelPreView;
     }
 }

+ 10 - 0
UAS-出货标签管理(贸易版)/UAS_出货标签管理.cs

@@ -2778,5 +2778,15 @@ namespace UAS_LabelMachine
                 dh.CallProcedure("sp_uploadbarcode", dt1);
             }
         }
+
+        private void MidLabelPreView_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
+        {
+            MidFormat = engine.Documents.Open(ftpOperater.DownLoadTo + MidLabelCombox.Text);
+            Resolution re = new Resolution(ImageResolution.Printer);
+            MidFormat.ExportImageToFile(@"C:\打印标签\"+ MidLabelCombox.Text + ".jpg",ImageType.JPEG, Seagull.BarTender.Print.ColorDepth.Mono, re, OverwriteOptions.DoNotOverwrite);
+            PreViewWindow pre = new PreViewWindow(MidLabelCombox.Text);
+            pre.StartPosition = FormStartPosition.CenterScreen;
+            pre.ShowDialog();
+        }
     }
 }

二進制
UAS-出货标签管理(贸易版)/tool/CheckBoxComboBox.dll


+ 3 - 2
UAS-出货标签管理/PublicMethod/Analysis.cs

@@ -68,7 +68,7 @@ namespace UAS_LabelMachine.PublicMethod
                         string Year = Data.Substring(0, 1);
                         string Week = Data.Substring(1, 2);
                         DateTime DateBegin = DateTime.Now;
-                        GetDaysOfWeeks(int.Parse("201" + Year), int.Parse(Week), out DateBegin);
+                        GetDaysOfWeeks(int.Parse("202" + Year), int.Parse(Week), out DateBegin);
                         ReturnData = DateBegin.ToString("yyyyMMdd");
                     }
                     break;
@@ -103,7 +103,8 @@ namespace UAS_LabelMachine.PublicMethod
             }
             else
             {
-                first = startDay.AddDays((7 - dayOfWeek) + (index - 1) * 7); //index周的起始日期
+                first = startDay.AddDays((7 - dayOfWeek) + (index - 2) * 7); //index周的起始日期
+
             }
             if (first > endDay)  //startDayOfWeeks不在该年范围内
             {