Browse Source

万利达MES 拆箱增加拆解回传接口

caosy 1 week ago
parent
commit
0e2034c1fc

+ 1 - 0
UAS-MES/CustomControl/TextBoxWithIcon/SnCollectionBox.cs

@@ -68,6 +68,7 @@ namespace UAS_MES.CustomControl.TextBoxWithIcon
                     if (sn == "" || count > 1)
                     {
                         MessageBox.Show("SN:" + base.Text + "未找到关联信息");
+                        base.Text = "";
                         return ;
                     }
                     else

+ 4 - 0
UAS-MES/FunctionCode/Make/Make_PackageCollection.cs

@@ -933,6 +933,10 @@ namespace UAS_MES.Make
                                 dh.ExecuteSql("delete from labelprintlog where lpl_value='" + pa_outboxcode.Text + "'", "delete");
                                 dh.ExecuteSql("delete from packagedetail where pd_outboxcode='" + pa_outboxcode.Text + "'", "delete");
                                 LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "卡通箱拆解", "成功", pa_outboxcode.Text, ob_checkno.Text);
+                                if (!LogicHandler.resetOutBoxStatus(pa_outboxcode.Text, out ErrorMessage))
+                                {
+                                    OperateResult.AppendText(">>拆箱接口回传:" + ErrorMessage + "!\n", Color.Red);
+                                }
                                 OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "成功拆解!\n", Color.Green);
                                 LoadGridData();
                                 LoadCheckQTY();

+ 4 - 0
UAS-MES/FunctionCode/Make/Make_PackageCollectionWeigh.cs

@@ -920,6 +920,10 @@ namespace UAS_MES.Make
                                 dh.ExecuteSql("delete from labelprintlog where lpl_value='" + pa_outboxcode.Text + "'", "delete");
                                 dh.ExecuteSql("delete from packagedetail where pd_outboxcode='" + pa_outboxcode.Text + "'","delete");
                                 LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "卡通箱拆解", "成功", pa_outboxcode.Text, ob_checkno.Text);
+                                if (!LogicHandler.resetOutBoxStatus(pa_outboxcode.Text, out ErrorMessage))
+                                {
+                                    OperateResult.AppendText(">>拆箱接口回传:" + ErrorMessage + "!\n", Color.Red);
+                                }
                                 OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "成功拆解!\n", Color.Green);
                                 LoadGridData();
                                 LoadCheckQTY();

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

@@ -140,7 +140,7 @@ namespace UAS_MES.Make
 
 
                             //获取需要关联采集的信息,以及校验规则
-                            ListA = (DataTable)dh.ExecuteSql("select * from makeaddresslist where mal_makecode='" + ma_code.Text + "' order by psr_detno", "select");
+                            ListA = (DataTable)dh.ExecuteSql("select * from makeaddresslist where mal_makecode='" + ma_code.Text + "' order by mal_detno", "select");
                             //没有获取到就提示错误请维护产品对应的关联采集信息
                             if (ListA.Rows.Count > 0)
                             {
@@ -156,7 +156,7 @@ namespace UAS_MES.Make
                             }
 
                             //获取需要关联采集的信息,以及校验规则
-                            ListA = (DataTable)dh.ExecuteSql("select * from makeimeilist where mil_makecode='" + ma_code.Text + "' order by psr_detno", "select");
+                            ListA = (DataTable)dh.ExecuteSql("select * from makeimeilist where mil_makecode='" + ma_code.Text + "' order by mil_detno", "select");
                             //没有获取到就提示错误请维护产品对应的关联采集信息
                             if (ListA.Rows.Count > 0)
                             {

+ 4 - 0
UAS-MES/FunctionCode/Make/Make_SpecialCartonPack.cs

@@ -682,6 +682,10 @@ namespace UAS_MES.Make
                                 //删除箱的明细
                                 SQLS2.Add("delete from packagedetail where pd_outboxcode='" + pa_outboxcode.Text + "'");
                                 dh.ExecuteSQLTran(SQLS2.ToArray());
+                                if (!LogicHandler.resetOutBoxStatus(pa_outboxcode.Text, out ErrorMessage))
+                                {
+                                    OperateResult.AppendText(">>拆箱接口回传:" + ErrorMessage + "!\n", Color.Red);
+                                }
                                 OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "成功拆解!\n", Color.Green);
                                 LoadGridData();
                                 LoadCheckQTY();

+ 6 - 1
UAS-MES/FunctionCode/Special/Special_Reset.cs

@@ -106,6 +106,11 @@ namespace UAS_MES.Special
                         //删除箱的明细
                         dh.ExecuteSql("delete from packagedetail where pd_outboxcode='" + sb[i].ToString() + "'", "delete");
                         LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode.Text, User.UserLineCode, User.UserSourceCode, "站点重置", "站点重置至" + stname, sb[i].ToString(), "");
+                        String ErrorMessage = "";
+                        if (!LogicHandler.resetOutBoxStatus(sb[i].ToString(), out ErrorMessage))
+                        {
+                            OperatResult.AppendText(">>拆箱接口回传:" + ErrorMessage + "!\n", Color.Red);
+                        }
                         OperatResult.AppendText("卡通箱:" + sb[i].ToString() + "回流至" + cd_stepcode.Text + "完成\n", Color.Green);
                     }
                     WeighRecord.Items.Clear();
@@ -227,7 +232,7 @@ namespace UAS_MES.Special
                 }
                 else if (bigboxBtn.Checked)
                 {
-                    dt = (DataTable)dh.ExecuteSql("select pa_makecode ms_makecode,pa_prodcode ms_prodcode,pa_outboxcode,pa_mothercode,ma_craftcode cr_code from package left join make on pa_makecode = ma_code where pa_outboxcode = '"+input.Text+"' and pa_type = '1'", "select");
+                    dt = (DataTable)dh.ExecuteSql("select pd_makecode ms_makecode,pd_prodcode ms_prodcode,pa_outboxcode,pa_mothercode,ma_craftcode cr_code from package left join packagedetail on pa_outboxcode = pd_outboxcode left join make on pd_makecode = ma_code where pa_outboxcode = '" + input.Text+"' and pa_type = '1'", "select");
                     if (dt.Rows.Count > 0)
                     {
                         if (ms_makecode.Text != "" && dt.Rows[0]["ms_makecode"].ToString() != ms_makecode.Text)

+ 64 - 1
UAS-MES/PublicMethod/LogicHandler.cs

@@ -144,7 +144,7 @@ namespace UAS_MES.PublicMethod
                     if (!dic.ContainsKey("erpaccount"))
                     {
                         oMsg = dic["code"].ToString();
-                        LogManager.DoLog("oMsg:"+ oMsg);
+                        //LogManager.DoLog("oMsg:"+ oMsg);
                         if (oMsg.Contains("200"))
                         {
                             return true;
@@ -164,6 +164,69 @@ namespace UAS_MES.PublicMethod
             return true;
         }
 
+        public static bool resetOutBoxStatus(string outBoxCode, out string oMsg)
+        {
+            oMsg = "";
+            try
+            {
+                string url = "http://172.16.100.18:7010/openApi/npt/mes/resetOutBoxStatus?outBoxCode=" + outBoxCode;//html调用的地址              
+                LogManager.DoLog(url);
+                HttpWebRequest webrequest = (HttpWebRequest)WebRequest.Create(url);
+                if (webrequest == null)
+                {
+                    return false;
+                }
+                webrequest.Method = "GET";
+                webrequest.Timeout = 1000;
+                webrequest.ContentType = "application/json; charset=utf-8";
+                System.Collections.Hashtable pars = new System.Collections.Hashtable();
+                string buffer = "";
+                //发送POST数据 
+                if (!(pars == null || pars.Count == 0))
+                {
+                    foreach (string key in pars.Keys)
+                    {
+                        buffer = buffer + "&" + key + "=" + pars[key].ToString();
+                    }
+                    byte[] data = Encoding.UTF8.GetBytes(buffer);
+                    using (Stream stream = webrequest.GetRequestStream())
+                    {
+                        stream.Write(data, 0, data.Length);
+                    }
+                }
+
+                string[] values = webrequest.Headers.GetValues("Content-Type");
+                WebResponse myResponse = webrequest.GetResponse();
+
+                using (Stream resStream = myResponse.GetResponseStream())//得到回写的流
+                {
+                    StreamReader newReader = new StreamReader(myResponse.GetResponseStream(), Encoding.UTF8);
+                    string Content = newReader.ReadToEnd();
+                    Dictionary<string, object> dic = new Dictionary<string, object>();
+                    dic = BaseUtil.ToDictionary(Content);
+                    if (!dic.ContainsKey("erpaccount"))
+                    {
+                        oMsg = dic["message"].ToString();
+                        LogManager.DoLog("oMsg:" + oMsg+":"+ oMsg.Equals("").ToString());
+                        if (oMsg.Equals(""))
+                        {
+                            return true;
+                        }
+                        else
+                        {
+                            return false;
+                        }
+                    }
+                    newReader.Close();
+                }
+            }
+            catch (Exception ex)
+            {
+                LogManager.DoLog(ex.Message.ToString());
+            }
+            return true;
+        }
+
 
         public static void SendMessage(string iUserID, string iUserName, string iContext)
         {