Explorar o código

VIVO接口调整

章政 %!s(int64=6) %!d(string=hai) anos
pai
achega
c91d5794fa
Modificáronse 1 ficheiros con 81 adicións e 14 borrados
  1. 81 14
      UAS-出货标签管理/UAS_出货标签管理.cs

+ 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");
+                                    }
+                                }
                             }
                         }
                     }