孙世强
2025-11-14 a0597a2720e9d5061d5de16bf683183618ad5356
optimize_patch/订单排样客户端/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;