浏览代码

BUG调整

章政 6 年之前
父节点
当前提交
8b588f4a5a

+ 10 - 11
UAS-出货标签管理/UAS_出货标签管理.Designer.cs

@@ -169,9 +169,9 @@
             this.pr_unit = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pib_lotno = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pib_datecode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_datecode1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pib_cusbarcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pib_cusoutboxcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pib_datecode1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pib_qty = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pib_barcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pib_custbarcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -1172,9 +1172,9 @@
             this.pr_unit,
             this.pib_lotno,
             this.pib_datecode,
+            this.pib_datecode1,
             this.pib_cusbarcode,
             this.pib_cusoutboxcode,
-            this.pib_datecode1,
             this.pib_qty,
             this.pib_barcode,
             this.pib_custbarcode,
@@ -1686,6 +1686,13 @@
             this.pib_datecode.Name = "pib_datecode";
             this.pib_datecode.Width = 78;
             // 
+            // pib_datecode1
+            // 
+            this.pib_datecode1.DataPropertyName = "pib_datecode1";
+            this.pib_datecode1.HeaderText = "DC年周";
+            this.pib_datecode1.Name = "pib_datecode1";
+            this.pib_datecode1.Width = 66;
+            // 
             // pib_cusbarcode
             // 
             this.pib_cusbarcode.DataPropertyName = "pib_cusbarcode";
@@ -1700,14 +1707,6 @@
             this.pib_cusoutboxcode.Name = "pib_cusoutboxcode";
             this.pib_cusoutboxcode.Width = 78;
             // 
-            // pib_datecode1
-            // 
-            this.pib_datecode1.DataPropertyName = "pib_datecode1";
-            this.pib_datecode1.HeaderText = "DateCode1";
-            this.pib_datecode1.Name = "pib_datecode1";
-            this.pib_datecode1.Visible = false;
-            this.pib_datecode1.Width = 84;
-            // 
             // pib_qty
             // 
             this.pib_qty.DataPropertyName = "pib_qty";
@@ -1997,9 +1996,9 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_unit;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_lotno;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_datecode;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pib_datecode1;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_cusbarcode;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_cusoutboxcode;
-        private System.Windows.Forms.DataGridViewTextBoxColumn pib_datecode1;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_qty;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_barcode;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_custbarcode;

+ 97 - 37
UAS-出货标签管理/UAS_出货标签管理.cs

@@ -222,6 +222,7 @@ namespace UAS_LabelMachine
             if (DataHelper.DBConnectionString.Contains("sz.hi-mantech.com") || DataHelper.DBConnectionString.Contains("192.168.1.200"))
             {
                 pib_datecode1.Visible = true;
+                pib_datecode.HeaderText = "DC年月日";
                 SingleLabelAutoPrint.Checked = true;
                 MidLabelAutoPrint.Checked = true;
                 pib_madein.Visible = true;
@@ -542,19 +543,13 @@ namespace UAS_LabelMachine
                     DataTable dt = (DataTable)MidSource.DataSource;
                     if (CollectionUnit.Text == "盒")
                     {
-                        string la_id = "";
-                        if (SingleLabelCombox.SelectedValue != null)
-                        {
-                            la_id = SingleLabelCombox.SelectedValue.ToString().Split('#')[0];
-                        }
-                        string cl_labelname = SingleLabelCombox.Text;
-                        string LabelUrl = dh.getFieldDataByCondition("label left join customerlabel on la_code=cl_labelcode", "cl_labelurl", "la_id='" + la_id + "' and cl_labelname='" + cl_labelname + "'").ToString();
                         for (int i = 0; i < LabelInf.RowCount; i++)
                         {
                             if (LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString() == LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode1"].Value.ToString())
                             {
                                 dt.Rows[i]["pib_lotno"] = LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value;
                                 dt.Rows[i]["pib_datecode"] = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value;
+                                dt.Rows[i]["pib_datecode1"] = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode1"].Value;
                                 LabelInf.Rows[i].Cells["pib_ifpick"].Value = true;
                                 LabelInf.Rows[i].Cells["Choose"].Value = true;
                                 LabelInf.Invalidate();
@@ -562,13 +557,7 @@ namespace UAS_LabelMachine
                                 CurrentRowIndex = i;
                                 if (SingleLabelAutoPrint.Checked)
                                 {
-                                    if (la_id != "")
-                                        AutoPrintSingleLabel(la_id, LabelUrl);
-                                    else
-                                    {
-                                        MessageBox.Show("未维护单盘标签");
-                                        return;
-                                    }
+                                    AutoPrintSingleLabel();
                                 }
                                 if (MidLabelAutoPrint.Checked)
                                     AutoPrintMidLabel();
@@ -582,6 +571,7 @@ namespace UAS_LabelMachine
                         {
                             dt.Rows[i]["pib_lotno"] = LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value;
                             dt.Rows[i]["pib_datecode"] = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value;
+                            dt.Rows[i]["pib_datecode1"] = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode1"].Value;
                             CurrentRowIndex = i;
                             LabelInf.Refresh();
                             LabelInf.Rows[i].Cells["pib_ifpick"].Value = true;
@@ -600,10 +590,7 @@ namespace UAS_LabelMachine
                         {
                             if (SingleLabelCombox.SelectedValue != null)
                             {
-                                string la_id = SingleLabelCombox.SelectedValue.ToString().Split('#')[0];
-                                string cl_labelname = SingleLabelCombox.Text;
-                                string LabelUrl = dh.getFieldDataByCondition("label left join customerlabel on la_code=cl_labelcode", "cl_labelurl", "la_id='" + la_id + "' and cl_labelname='" + cl_labelname + "'").ToString();
-                                AutoPrintSingleLabel(la_id, LabelUrl);
+                                AutoPrintSingleLabel();
                             }
                             else
                             {
@@ -676,7 +663,7 @@ namespace UAS_LabelMachine
             }
         }
 
-        private void AutoPrintSingleLabel(string la_id, string LabelUrl)
+        private void AutoPrintSingleLabel()
         {
             //用标签本身的变量作为最外层的循环条件去匹配;
             string[] arg = SingleBoxArgument.ToArray();
@@ -687,12 +674,37 @@ namespace UAS_LabelMachine
                 for (int k = 0; k < SingleLabelParam.Rows.Count; k++)
                 {
                     //名称相等的时候,取SQL进行值的查询
-                    if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name == SingleLabelParam.Rows[k]["lp_name"].ToString().ToLower())
+                    if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() == SingleLabelParam.Rows[k]["lp_name"].ToString().ToLower())
                     {
                         string pib_id = LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value.ToString();
                         DataRow[] dr = SingleBoxCacheData.Select("pib_id=" + pib_id);
                         if (arg.Contains(SingleDoc.Variables.FreeVariables.Item(j + 1).Name))
                             SingleDoc.Variables.FreeVariables.Item(j + 1).Value = dr[0][SingleDoc.Variables.FreeVariables.Item(j + 1).Name].ToString();
+                        if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode1"))
+                        {
+                            if (LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode1"].Value != null)
+                                SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode1"].Value.ToString();
+                        }
+                        else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("lotno"))
+                        {
+                            if (LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value != null)
+                                SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value.ToString();
+                        }
+                        else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode"))
+                        {
+                            if (LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value != null)
+                                SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value.ToString();
+                        }
+                        else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("产地"))
+                        {
+                            if (LabelInf.Rows[CurrentRowIndex].Cells["pib_madein"].Value != null)
+                                SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[CurrentRowIndex].Cells["pib_madein"].Value.ToString();
+                        }
+                        else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("pib_cusbarcode"))
+                        {
+                            if (LabelInf.Rows[CurrentRowIndex].Cells["pib_cusbarcode"].Value != null)
+                                SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[CurrentRowIndex].Cells["pib_cusbarcode"].Value.ToString();
+                        }
                         if (SingleDoc.Variables.FreeVariables.Item(j + 1).Value == "")
                         {
                             DataRow[] dr1 = Attach.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "'");
@@ -1276,6 +1288,31 @@ namespace UAS_LabelMachine
                             {
                                 if (arg.Contains(SingleDoc.Variables.FreeVariables.Item(j + 1).Name))
                                     SingleDoc.Variables.FreeVariables.Item(j + 1).Value = dr[0][SingleDoc.Variables.FreeVariables.Item(j + 1).Name].ToString();
+                                if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode1"))
+                                {
+                                    if (LabelInf.Rows[i].Cells["pib_datecode1"].Value != null)
+                                        SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[i].Cells["pib_datecode1"].Value.ToString();
+                                }
+                                else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("lotno"))
+                                {
+                                    if (LabelInf.Rows[i].Cells["pib_lotno"].Value != null)
+                                        SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[i].Cells["pib_lotno"].Value.ToString();
+                                }
+                                else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode"))
+                                {
+                                    if (LabelInf.Rows[i].Cells["pib_datecode"].Value != null)
+                                        SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[i].Cells["pib_datecode"].Value.ToString();
+                                }
+                                else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("产地"))
+                                {
+                                    if (LabelInf.Rows[i].Cells["pib_madein"].Value != null)
+                                        SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[i].Cells["pib_madein"].Value.ToString();
+                                }
+                                else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("pib_cusbarcode"))
+                                {
+                                    if (LabelInf.Rows[i].Cells["pib_cusbarcode"].Value != null)
+                                        SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[i].Cells["pib_cusbarcode"].Value.ToString();
+                                }
                                 if (SingleDoc.Variables.FreeVariables.Item(j + 1).Value == "")
                                 {
                                     DataRow[] dr1 = Attach.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "'");
@@ -1358,7 +1395,7 @@ namespace UAS_LabelMachine
                     //将维护的模板参数和模板本身的参数名称进行比对
                     for (int k = 0; k < SingleLabelParam.Rows.Count; k++)
                     {
-                        if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name == SingleLabelParam.Rows[k]["lp_name"].ToString())
+                        if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() == SingleLabelParam.Rows[k]["lp_name"].ToString().ToLower())
                         {
                             DataColumn dc = new DataColumn(SingleDoc.Variables.FreeVariables.Item(j + 1).Name);
                             SingleBoxCacheData.Columns.Add(dc);
@@ -1444,7 +1481,7 @@ namespace UAS_LabelMachine
                 //将维护的模板参数和模板本身的参数名称进行比对
                 for (int k = 0; k < MidLabelParam.Rows.Count; k++)
                 {
-                    if (MidDoc.Variables.FreeVariables.Item(j + 1).Name == MidLabelParam.Rows[k]["lp_name"].ToString())
+                    if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() == MidLabelParam.Rows[k]["lp_name"].ToString().ToLower())
                     {
                         DataColumn dc = new DataColumn(MidDoc.Variables.FreeVariables.Item(j + 1).Name);
                         MidBoxCacheData.Columns.Add(dc);
@@ -1729,7 +1766,7 @@ namespace UAS_LabelMachine
                 for (int k = 0; k < MidLabelParam.Rows.Count; k++)
                 {
                     //名称相等的时候,取SQL进行值的查询
-                    if (MidDoc.Variables.FreeVariables.Item(j + 1).Name == MidLabelParam.Rows[k]["lp_name"].ToString())
+                    if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() == MidLabelParam.Rows[k]["lp_name"].ToString().ToLower())
                     {
                         //获取对应行的pib_id
                         string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
@@ -1747,7 +1784,27 @@ namespace UAS_LabelMachine
                             else
                             {
                                 DataRow[] dr = MidBoxCacheData.Select("pib_outboxcode1='" + pib_outboxcode1 + "'");
-                                if (arg.Contains(MidDoc.Variables.FreeVariables.Item(j + 1).Name))
+                                if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode1"))
+                                {
+                                    if (LabelInf.Rows[rowindex].Cells["pib_datecode1"].Value != null)
+                                        MidDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_datecode1"].Value.ToString();
+                                }
+                                else if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("lotno"))
+                                {
+                                    if (LabelInf.Rows[rowindex].Cells["pib_lotno"].Value != null)
+                                        MidDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_lotno"].Value.ToString();
+                                }
+                                else if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode"))
+                                {
+                                    if (LabelInf.Rows[rowindex].Cells["pib_datecode"].Value != null)
+                                        MidDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_datecode"].Value.ToString();
+                                }
+                                else if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("产地"))
+                                {
+                                    if (LabelInf.Rows[rowindex].Cells["pib_madein"].Value != null)
+                                        MidDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_madein"].Value.ToString();
+                                }
+                                else if (arg.Contains(MidDoc.Variables.FreeVariables.Item(j + 1).Name))
                                 {
                                     if (dr.Length > 0)
                                     {
@@ -1785,7 +1842,7 @@ namespace UAS_LabelMachine
                 for (int k = 0; k < MidLabelParam.Rows.Count; k++)
                 {
                     //名称相等的时候,取SQL进行值的查询
-                    if (MidDoc.Variables.FreeVariables.Item(j + 1).Name == MidLabelParam.Rows[k]["lp_name"].ToString())
+                    if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() == MidLabelParam.Rows[k]["lp_name"].ToString().ToLower())
                     {
                         //获取对应行的pib_id
                         string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
@@ -1851,7 +1908,7 @@ namespace UAS_LabelMachine
                     for (int k = 0; k < OutLabelParam.Rows.Count; k++)
                     {
                         //名称相等的时候,取SQL进行值的查询
-                        if (OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name == OutLabelParam.Rows[k]["lp_name"].ToString())
+                        if (OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() == OutLabelParam.Rows[k]["lp_name"].ToString().ToLower())
                         {
                             //获取对应行的pib_id
                             string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
@@ -2187,20 +2244,23 @@ namespace UAS_LabelMachine
         /// <param name="e"></param>
         private void LabelInf_CellValueChanged(object sender, DataGridViewCellEventArgs e)
         {
-            if (LabelInf.Columns[e.ColumnIndex].Name == "pib_datecode")
+            if (e.RowIndex >= 0)
             {
-                string datecode = LabelInf.Rows[e.RowIndex].Cells["pib_datecode"].Value.ToString();
-                try
+                if (LabelInf.Columns[e.ColumnIndex].Name == "pib_datecode")
                 {
-                    System.DateTime dt = System.DateTime.ParseExact(datecode, "yyyyMMdd", CultureInfo.CurrentCulture);
-                    GregorianCalendar gc = new GregorianCalendar();
-                    int weekOfYear = gc.GetWeekOfYear(dt, CalendarWeekRule.FirstDay, DayOfWeek.Monday);
-                    if (weekOfYear < 10)
-                        LabelInf.Rows[e.RowIndex].Cells["pib_datecode1"].Value = dt.Year.ToString().Substring(2, 2) + "0" + weekOfYear;
-                    else
-                        LabelInf.Rows[e.RowIndex].Cells["pib_datecode1"].Value = dt.Year.ToString().Substring(2, 2) + weekOfYear;
+                    string datecode = LabelInf.Rows[e.RowIndex].Cells["pib_datecode"].Value.ToString();
+                    try
+                    {
+                        System.DateTime dt = System.DateTime.ParseExact(datecode, "yyyyMMdd", CultureInfo.CurrentCulture);
+                        GregorianCalendar gc = new GregorianCalendar();
+                        int weekOfYear = gc.GetWeekOfYear(dt, CalendarWeekRule.FirstDay, DayOfWeek.Monday);
+                        if (weekOfYear < 10)
+                            LabelInf.Rows[e.RowIndex].Cells["pib_datecode1"].Value = dt.Year.ToString().Substring(2, 2) + "0" + weekOfYear;
+                        else
+                            LabelInf.Rows[e.RowIndex].Cells["pib_datecode1"].Value = dt.Year.ToString().Substring(2, 2) + weekOfYear;
+                    }
+                    catch (Exception) { }
                 }
-                catch (Exception) { }
             }
         }
 

+ 3 - 3
UAS-出货标签管理/UAS_出货标签管理.resx

@@ -159,13 +159,13 @@
   <metadata name="pr_unit.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="pib_cusbarcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="pib_datecode1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="pib_cusoutboxcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="pib_cusbarcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="pib_datecode1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="pib_cusoutboxcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
   <metadata name="pib_custbarcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

+ 9 - 2
UAS-出货标签管理/生成条码.cs

@@ -455,12 +455,19 @@ namespace UAS_LabelMachine
                 switch (pi_class.Text)
                 {
                     case "出货单":
+                        //sql.Clear();
+                        //sql.Append("select pd_piid,pd_id,pr_id,pr_brand,pr_madein,pr_unit,pr_detail,pr_spec,pr_zxbzs,outqty pd_totalqty,pd_ordercode,pd_orderdetno,pd_pdno,pd_prodcode,");
+                        //sql.Append("pd_piclass,pd_qty from (select pd_piid,pd_id,pr_id,pr_brand,pr_madein,pr_unit,pr_detail,pr_spec,pr_zxbzs,outqty,pd_ordercode,pd_orderdetno,pd_pdno,");
+                        //sql.Append("pd_prodcode,pd_piclass,outqty-nvl((select sum(nvl(pib_qty,0)) from PRODIOBARCODE where PIB_PIID=pd_piid and pib_pdno=pd_pdno ),0)pd_qty ");
+                        //sql.Append("from (select pd_piid,min(pd_id) pd_id,sum(pd_outqty)outqty,pd_ordercode,pd_orderdetno,pd_pdno,max(pd_prodcode)pd_prodcode,max(pd_piclass)pd_piclass ");
+                        //sql.Append("from prodiodetail  group by pd_piid,pd_ordercode, pd_orderdetno,pd_pdno)T left join product ");
+                        //sql.Append("on pr_code=pd_prodcode where nvl(pr_zxbzs,0)>0)  where  pd_piid='" + pi_id + "'");
                         sql.Clear();
                         sql.Append("select pd_piid,pd_id,pr_id,pr_brand,pr_madein,pr_unit,pr_detail,pr_spec,pr_zxbzs,outqty pd_totalqty,pd_ordercode,pd_orderdetno,pd_pdno,pd_prodcode,");
                         sql.Append("pd_piclass,pd_qty from (select pd_piid,pd_id,pr_id,pr_brand,pr_madein,pr_unit,pr_detail,pr_spec,pr_zxbzs,outqty,pd_ordercode,pd_orderdetno,pd_pdno,");
                         sql.Append("pd_prodcode,pd_piclass,outqty-nvl((select sum(nvl(pib_qty,0)) from PRODIOBARCODE where PIB_PIID=pd_piid and pib_pdno=pd_pdno ),0)pd_qty ");
-                        sql.Append("from (select pd_piid,min(pd_id) pd_id,sum(pd_outqty)outqty,pd_ordercode,pd_orderdetno,pd_pdno,max(pd_prodcode)pd_prodcode,max(pd_piclass)pd_piclass ");
-                        sql.Append("from prodiodetail  group by pd_piid,pd_ordercode, pd_orderdetno,pd_pdno)T left join product ");
+                        sql.Append("from (select pd_piid,min(pd_id) pd_id,sum(pd_outqty)outqty,min(pd_ordercode)pd_ordercode,min(pd_orderdetno)pd_orderdetno,min(pd_pdno)pd_pdno,max(pd_prodcode)pd_prodcode,max(pd_piclass)pd_piclass ");
+                        sql.Append("from prodiodetail  group by pd_piid,pd_prodcode,pd_custprodcode,pd_custprodspec)T left join product ");
                         sql.Append("on pr_code=pd_prodcode where nvl(pr_zxbzs,0)>0)  where  pd_piid='" + pi_id + "'");
                         break;
                     case "完工入库单":