Browse Source

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

caosy 6 years ago
parent
commit
ef81c5bda7

+ 2 - 2
UAS-出货标签管理(贸易版)/PublicMethod/SqliteDBHelper.cs

@@ -242,7 +242,7 @@ namespace UAS_LabelMachine
                     }
                 }
             }
-            sb.Append("where pib_id=?");
+            sb.Append(" where pib_id=?");
             SQLiteTransaction tx = this._odcConnection.BeginTransaction();
             command = new SQLiteCommand();
             command.Connection = this._odcConnection;
@@ -255,7 +255,7 @@ namespace UAS_LabelMachine
                     command.CommandText = sql;
                     for (int j = 0; j < dt.Columns.Count; j++)
                     {
-                        if (dt.Columns[j].ColumnName.ToUpper() != "PIB_ID")
+                        if (dt.Columns[j].ColumnName.ToUpper() != "PIB_ID" && dt.Columns[j].ColumnName.ToUpper() != "PIB_DATECODE" && dt.Columns[j].ColumnName.ToUpper() != "PIB_LOTNO")
                             command.Parameters.AddWithValue(dt.Columns[j].ColumnName, dt.Rows[i][j]);
                     }
                     command.Parameters.AddWithValue("pib_id", dt.Rows[i]["pib_id"]);

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

@@ -1756,6 +1756,7 @@
             this.pib_id1.DataPropertyName = "pib_id";
             this.pib_id1.HeaderText = "pib_id";
             this.pib_id1.Name = "pib_id1";
+            this.pib_id1.Visible = false;
             this.pib_id1.Width = 66;
             // 
             // pib_pdno

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

@@ -1604,7 +1604,7 @@ namespace UAS_LabelMachine
             {
                 //检验查询的字段和本地数据库字段是否匹配
                 sdh.AddColumFromDataTable(LabelInfDataTable, "prodiobarcode");
-                //sdh.BatchInsert("prodiobarcode", LabelInfDataTable);
+                sdh.BatchInsert("prodiobarcode", LabelInfDataTable);
             }
             sql.Clear();
             sql.Append("select * from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' order by pib_id ");
@@ -1882,7 +1882,11 @@ namespace UAS_LabelMachine
                 }
                 sdh.BatchInsert("prodiobarcode", LabelInf.DataSource as DataTable);
             }
-            SaveGrid_Click(sender, e);
+            DataTable dt1 = (DataTable)sdh.ExecuteSql("select pib_id,pib_outboxcode1,pib_outboxcode2,pib_custmidboxcode,pib_custoutboxcode,pib_lotno,pib_datecode,pib_ifupload,pib_ifpick,pib_ifprint from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' ", "select");
+            if (dt1.Rows.Count > 0)
+            {
+                dh.CallProcedure("sp_uploadbarcode", dt1);
+            }
         }
 
         private void LogingOut_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
@@ -2204,6 +2208,7 @@ namespace UAS_LabelMachine
                     if (cu_code.Text != "")
                     {
                         附件内容打印 att = new 附件内容打印(cu_code.Text);
+                        att.FormClosed += Att_FormClosed;
                         att.ShowDialog();
                     }
                     else MessageBox.Show("请先获取出库单信息");
@@ -2317,6 +2322,11 @@ namespace UAS_LabelMachine
             }
         }
 
+        private void Att_FormClosed(object sender, FormClosedEventArgs e)
+        {
+            Attach = (DataTable)dh.ExecuteSql("select lap_param lp_name,lap_value lp_sql from LabelAttachPARAMETER where lap_custcode='" + cu_code.Text + "'", "select");
+        }
+
         //生成客户条码
         public string BarcodeMethod1(string Prefix, string Suffix, int Index, int Length, int radix)
         {

+ 81 - 14
UAS-出货标签管理/UAS_出货标签管理.cs

@@ -2050,7 +2050,7 @@ namespace UAS_LabelMachine
                 sql.Append("and pd_prodcode=pib_prodcode left join product on pr_code=pib_prodcode left join (select pd_prodcode ");
                 sql.Append("prcode,pd_pocode pocode,max(pd_detno) pd_detno from  prodinout left join packing on packing.pi_code=prodinout.pi_packingcode ");
                 sql.Append("left join packingdetail on packing.pi_id=pd_piid where prodinout.pi_id='" + PI_ID + "' group by pd_prodcode,pd_pocode");
-                sql.Append(")A on pd_pocode=A.pocode and pd_prodcode=A.PRCODE where pd_piid='" + PI_ID + "' order by pd_pdno,a.pd_detno,pib_id");
+                sql.Append(")A on pd_pocode=A.pocode and pd_prodcode=A.PRCODE where pd_piid='" + PI_ID + "' order by pr_code,pd_pdno,a.pd_detno,pib_id");
                 GetOutBoxCode.Visible = true;
             }
             else
@@ -2460,13 +2460,15 @@ namespace UAS_LabelMachine
                     string outboxcode = "";
                     string pwd = "9G69NHy5";
                     //装入箱内的数量统计,用于判断是否达到容量
-                    decimal InBoxCount = OutboxCapacity.Value;
+                    decimal InBoxCount = 0;
+                    int LastChooseIndex = 0;
+                    double amount = 0;
                     for (int i = 0; i < LabelInf.Rows.Count; i++)
                     {
                         //勾选了的内容才进行料盘的获取和箱号的维护
                         if (LabelInf.Rows[i].Cells["Choose"].FormattedValue.ToString() == "True")
                         {
-                            double amount = double.Parse(LabelInf.Rows[i].Cells["pib_qty"].Value.ToString());
+                            amount = double.Parse(LabelInf.Rows[i].Cells["pib_qty"].Value.ToString());
                             string DateCode = LabelInf.Rows[i].Cells["pib_datecode"].Value.ToString();
                             string LotNo = LabelInf.Rows[i].Cells["pib_lotno"].Value.ToString();
                             string OrderCode = LabelInf.Rows[i].Cells["pr_vendprodcode"].Value.ToString();
@@ -2476,8 +2478,21 @@ namespace UAS_LabelMachine
                             string custbarcode = BaseUtil.ToDictionary(getPlateID.getCompID_20190403("", custprodcode, VenderCode, brand, amount, "新条码", "", "", "", VenderCode, pwd), "")["return_result"].ToString();
                             getPlateID.SaveMrn_20190403("", custbarcode, LotNo, DateCode, OrderCode, "", VenderCode, pwd);
                             LabelInf.Rows[i].Cells["pib_cusbarcode"].Value = custbarcode;
-                            //如果下一行的外箱号和当前行不一致
+                            LastChooseIndex = i;
+                        }
+                    }
+                    //上传箱号内容
+                    string str_custbarcode = "";
+                    List<int> Rowindex = new List<int>();
+                    amount = 0;
+                    for (int i = 0; i < LabelInf.Rows.Count; i++)
+                    {
+                        if (LabelInf.Rows[i].Cells["Choose"].FormattedValue.ToString() == "True")
+                        {
                             bool NextBoxDiff = false;
+                            string OrderCode = LabelInf.Rows[i].Cells["pr_vendprodcode"].Value.ToString();
+                            string custprodcode = LabelInf.Rows[i].Cells["pd_custprodcode"].Value.ToString();
+                            string custbarcode = LabelInf.Rows[i].Cells["pib_cusbarcode"].Value.ToString();
                             //通过接口维护料盘和外箱关系,需要根据箱内容量计算
                             //判断下一行箱号不一样重新取一个客户外箱号
                             if (i - 1 > 0)
@@ -2490,20 +2505,72 @@ namespace UAS_LabelMachine
                                     InBoxCount = OutboxCapacity.Value - 1;
                                 }
                             }
-                            if (InBoxCount == OutboxCapacity.Value || NextBoxDiff)
+                            if (NextBoxDiff)
                             {
-                                InBoxCount = 1;
-                                NextBoxDiff = false;
+                                //换箱号时
                                 outboxcode = BaseUtil.ToDictionary(getOutBox.getBoxID_20190403(VenderCode, custprodcode, amount.ToString(), OrderCode, "", VenderCode, pwd), "")["return_result"].ToString();
+                                str_custbarcode = "";
+                                for (int j = 0; j < Rowindex.Count; j++)
+                                {
+                                    custbarcode = LabelInf.Rows[Rowindex[j]].Cells["pib_cusbarcode"].Value.ToString();
+                                    LabelInf.Rows[Rowindex[j]].Cells["pib_cusoutboxcode"].Value = outboxcode;
+                                    str_custbarcode += custbarcode + ",";
+                                }
+                                string Message = getOutBox.BindReelToBox(outboxcode, str_custbarcode.Substring(0, str_custbarcode.Length - 1), VenderCode, pwd);
+                                amount = 0;
+                                InBoxCount = 0;
+                                Rowindex.Clear();
+                                str_custbarcode = "";
+                                if (BaseUtil.ToDictionary(Message, "")["return_status"].ToString() != "T")
+                                {
+                                    MessageLog.AppendText(BaseUtil.ToDictionary(Message, "")["return_message"].ToString() + "\n");
+                                }
                             }
-                            else
-                                InBoxCount = InBoxCount + 1;
-                            //获取信息为T-表示成功获取了信息
-                            string Message = getOutBox.BindReelToBox(outboxcode, custbarcode, VenderCode, pwd);
-                            LabelInf.Rows[i].Cells["pib_cusoutboxcode"].Value = outboxcode;
-                            if (BaseUtil.ToDictionary(Message, "")["return_status"].ToString() != "T")
+                            InBoxCount = InBoxCount + 1;
+                            amount += double.Parse(LabelInf.Rows[i].Cells["pib_qty"].Value.ToString());
+                            Rowindex.Add(i);
+                            //达到容量时
+                            if (InBoxCount == OutboxCapacity.Value)
                             {
-                                MessageLog.AppendText(BaseUtil.ToDictionary(Message, "")["return_message"].ToString() + "\n");
+                                outboxcode = BaseUtil.ToDictionary(getOutBox.getBoxID_20190403(VenderCode, custprodcode, amount.ToString(), OrderCode, "", VenderCode, pwd), "")["return_result"].ToString();
+                                for (int j = 0; j < Rowindex.Count; j++)
+                                {
+                                    custbarcode = LabelInf.Rows[Rowindex[j]].Cells["pib_cusbarcode"].Value.ToString();
+                                    LabelInf.Rows[Rowindex[j]].Cells["pib_cusoutboxcode"].Value = outboxcode;
+                                    str_custbarcode += custbarcode + ",";
+                                }
+                                string Message = getOutBox.BindReelToBox(outboxcode, str_custbarcode.Substring(0, str_custbarcode.Length - 1), VenderCode, pwd);
+                                amount = 0;
+                                InBoxCount = 0;
+                                str_custbarcode = "";
+                                Rowindex.Clear();
+                                if (BaseUtil.ToDictionary(Message, "")["return_status"].ToString() != "T")
+                                {
+                                    MessageLog.AppendText(BaseUtil.ToDictionary(Message, "")["return_message"].ToString() + "\n");
+                                }
+                            }
+                            if (LastChooseIndex == i)
+                            {
+                                if (Rowindex.Count > 0)
+                                {
+                                    outboxcode = BaseUtil.ToDictionary(getOutBox.getBoxID_20190403(VenderCode, custprodcode, amount.ToString(), OrderCode, "", VenderCode, pwd), "")["return_result"].ToString();
+                                    str_custbarcode = "";
+                                    for (int j = 0; j < Rowindex.Count; j++)
+                                    {
+                                        custbarcode = LabelInf.Rows[Rowindex[j]].Cells["pib_cusbarcode"].Value.ToString();
+                                        LabelInf.Rows[Rowindex[j]].Cells["pib_cusoutboxcode"].Value = outboxcode;
+                                        str_custbarcode += custbarcode + ",";
+                                    }
+                                    string Message = getOutBox.BindReelToBox(outboxcode, str_custbarcode.Substring(0, str_custbarcode.Length - 1), VenderCode, pwd);
+                                    amount = 0;
+                                    InBoxCount = 0;
+                                    Rowindex.Clear();
+                                    str_custbarcode = "";
+                                    if (BaseUtil.ToDictionary(Message, "")["return_status"].ToString() != "T")
+                                    {
+                                        MessageLog.AppendText(BaseUtil.ToDictionary(Message, "")["return_message"].ToString() + "\n");
+                                    }
+                                }
                             }
                         }
                     }