From a0597a2720e9d5061d5de16bf683183618ad5356 Mon Sep 17 00:00:00 2001
From: 孙世强 <sunshiqiang@ng.com>
Date: 星期五, 14 十一月 2025 17:03:38 +0800
Subject: [PATCH] 1.MES数据库存在变更,适配现有的mes数据库2.新增mes的数据库ip和端口设置

---
 optimize_patch/订单排样客户端/ng.optima.server/PatchProjectDB.cs |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git "a/optimize_patch/\350\256\242\345\215\225\346\216\222\346\240\267\345\256\242\346\210\267\347\253\257/ng.optima.server/PatchProjectDB.cs" "b/optimize_patch/\350\256\242\345\215\225\346\216\222\346\240\267\345\256\242\346\210\267\347\253\257/ng.optima.server/PatchProjectDB.cs"
index fa2c4e0..f17d2b5 100644
--- "a/optimize_patch/\350\256\242\345\215\225\346\216\222\346\240\267\345\256\242\346\210\267\347\253\257/ng.optima.server/PatchProjectDB.cs"
+++ "b/optimize_patch/\350\256\242\345\215\225\346\216\222\346\240\267\345\256\242\346\210\267\347\253\257/ng.optima.server/PatchProjectDB.cs"
@@ -53,13 +53,15 @@
             if (globel.CustomerName == "涔変箤")
             {
                 sql.Append(" inner join damage d on gi.glass_id=d.glass_id and d.status=1 and d.type=8 ");
+                sql.AppendFormat(" where gi.thickness = {0} and gi.filmsid = '{1}';", hd, mx);
             }
             else
             {
                 sql.Append(" inner join damage d on gi.glass_id=d.glass_id and d.report_state=1");
+                sql.AppendFormat(" where gi.thickness = {0} and gi.films_id = '{1}';", hd, mx);
             }
 
-            sql.AppendFormat(" where gi.thickness = {0} and gi.filmsid = '{1}';", hd, mx);
+           
             //sql.AppendFormat(" where gi.thickness = {0} and gi.filmsid = '{1}' and (gi.flow_card_id REGEXP '{2}' or d.engineer_id REGEXP '{2}');", hd, mx);
             DataTable dt = MesMysqlHelper.QueryResultToTable(sql.ToString()) ;
 
@@ -80,12 +82,15 @@
             if (globel.CustomerName == "涔変箤")
             {
                 sql.Append(" inner join damage d on gi.glass_id=d.glass_id and d.status=1 and d.type=8 ");
+                sql.AppendFormat(" where gi.thickness = {0} and gi.filmsid = '{1}' and (gi.flow_card_id REGEXP '{2}' or d.engineer_id REGEXP '{2}');", hd, mx, value);
+
             }
             else
             {
                 sql.Append(" inner join damage d on gi.glass_id=d.glass_id and d.report_state=1 ");
+                sql.AppendFormat(" where gi.thickness = {0} and gi.films_id = '{1}' and (gi.flow_card_id REGEXP '{2}' or d.engineer_id REGEXP '{2}');", hd, mx, value);
+
             }
-            sql.AppendFormat(" where gi.thickness = {0} and gi.filmsid = '{1}' and (gi.flow_card_id REGEXP '{2}' or d.engineer_id REGEXP '{2}');", hd, mx, value);
             //DataTable dt = MesMysqlHelper.QueryResultToTable(sql.ToString(), dbName);
             DataTable dt = MesMysqlHelper.QueryResultToTable(sql.ToString());
 
@@ -384,22 +389,27 @@
                 sbSql.AppendFormat(@"Delete from optimize_detail WHERE project_no = '{0}';", pNo);
                 sbSql.AppendFormat(@"Delete from optimize_project_file WHERE project_no = '{0}';", pNo);
                 sbSql.AppendFormat(@"update optimize_use set state = 0 WHERE project_no = '{0}';", pNo);
-                sbSql.Append("use north_glass_mes;");
+
+
+                StringBuilder sbMesSql = new StringBuilder();
+                //sbSql.Append("use north_glass_mes;");
                 foreach (DataRow dr in dt.Rows)
                 {
                     string gId = dr["glass_id"].ToString();
 
                     if (globel.CustomerName == "涔変箤")
                     {
-                        sbSql.AppendFormat("update damage set status = 1 where glass_id='{0}' and type=8 and status=7;", gId);
+                        sbMesSql.AppendFormat("update damage set status = 1 where glass_id='{0}' and type=8 and status=7;", gId);
                     }
                     else {
-                        sbSql.AppendFormat("update damage set report_state = 1 where glass_id='{0}' and  report_state=7;", gId);
+                        sbMesSql.AppendFormat("update damage set report_state = 1 where glass_id='{0}' and  report_state=7;", gId);
 
                     }
                 }
                 //om.state = MesMysqlHelper.ExecutSqlTranOne(sbSql.ToString()) > 0;
                 om.state = MySqlDbHelper.ExecutSqlTranOne(sbSql.ToString()) > 0;
+
+                om.state = MesMysqlHelper.ExecutSqlTranOne(sbMesSql.ToString()) > 0;
                 om.info = om.state? "鎵ц鎴愬姛" : "鎵ц寮傚父";
                 return om;
 

--
Gitblit v1.8.0