Archived
主逻辑
This commit is contained in:
commit
d530b35e35
4 files changed
+59
-8
No files matched your search
@@ -33,8 +33,10 @@
|
|||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="PresentationFramework" />
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Windows.Forms" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
|||||||
Binary file not shown.
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -7,6 +8,7 @@ using System.Security.Cryptography;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
namespace ProcessManage
|
namespace ProcessManage
|
||||||
{
|
{
|
||||||
@@ -22,6 +24,9 @@ namespace ProcessManage
|
|||||||
private static Timer _timer;
|
private static Timer _timer;
|
||||||
private static int Count = 0;
|
private static int Count = 0;
|
||||||
private static readonly int _intervalMs = int.Parse( Configini.IniReadvalue("SQL_SERVER", "SQL6"));
|
private static readonly int _intervalMs = int.Parse( Configini.IniReadvalue("SQL_SERVER", "SQL6"));
|
||||||
|
private static DataTable Product = new DataTable();
|
||||||
|
private static DataTable Gram = new DataTable();
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Process选择功能启动");
|
Console.WriteLine("Process选择功能启动");
|
||||||
@@ -40,12 +45,9 @@ namespace ProcessManage
|
|||||||
private static void EXTask(object state)
|
private static void EXTask(object state)
|
||||||
{
|
{
|
||||||
string Connstr_SC;
|
string Connstr_SC;
|
||||||
string DyelotsBulkedRecipe_sql = "SELECT * FROM [dbo].[DyelotsBulkedRecipe] WHERE Created > '"
|
string DyelotsBulkedRecipe_sql =
|
||||||
+ DateTime.Now.AddDays(-1).ToString("yyyy/MM/dd") + "' AND Process IS NULL";
|
"SELECT * FROM [dbo].[DyelotsBulkedRecipe] WHERE Created > '" + DateTime.Now.AddDays(-1).ToString("yyyy/MM/dd") +
|
||||||
try
|
"' AND ProductType = '1' AND Process IS NULL AND StepNumber IS NOT NULL AND ProductCode IS NOT NULL AND ReDye IS NOT NULL";
|
||||||
{
|
|
||||||
DyelotsBulkedRecipe.Clear();
|
|
||||||
|
|
||||||
if (SQMOD == "Windows Authentication")
|
if (SQMOD == "Windows Authentication")
|
||||||
{
|
{
|
||||||
Connstr_SC = "server=" + SQLIP + ";database=" + SQLNAME + ";Trusted_Connection=SSPI";
|
Connstr_SC = "server=" + SQLIP + ";database=" + SQLNAME + ";Trusted_Connection=SSPI";
|
||||||
@@ -57,14 +59,60 @@ namespace ProcessManage
|
|||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC);
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC);
|
||||||
conn_SC.OpenAsync(); //连接数据库
|
conn_SC.OpenAsync(); //连接数据库
|
||||||
SqlDataAdapter DyelotsBulkedRecipe_ = new SqlDataAdapter(DyelotsBulkedRecipe_sql, Connstr_SC);
|
SqlDataAdapter DyelotsBulkedRecipe_ = new SqlDataAdapter(DyelotsBulkedRecipe_sql, Connstr_SC);
|
||||||
conn_SC.Close();
|
try
|
||||||
|
{
|
||||||
|
DyelotsBulkedRecipe.Clear();
|
||||||
DyelotsBulkedRecipe_.Fill(DyelotsBulkedRecipe);
|
DyelotsBulkedRecipe_.Fill(DyelotsBulkedRecipe);
|
||||||
|
|
||||||
|
for (int i = DyelotsBulkedRecipe.Rows.Count; i > 0; i--)
|
||||||
|
{
|
||||||
|
if (DyelotsBulkedRecipe.Rows.Count <= 0) { break; }//跳出循环
|
||||||
|
|
||||||
|
string Dyelot = DyelotsBulkedRecipe.Rows[0].Field<string>("Dyelot");
|
||||||
|
int ReDye = DyelotsBulkedRecipe.Rows[0].Field<int>("ReDye");
|
||||||
|
int StepNumber = DyelotsBulkedRecipe.Rows[0].Field<int>("StepNumber");
|
||||||
|
double gram = 0;
|
||||||
|
int type_id = 0;
|
||||||
|
DataRow[] rowdat = DyelotsBulkedRecipe.Select("Dyelot ='" + Dyelot + "' AND ReDye='" + ReDye + "' AND StepNumber ='" + StepNumber + "'");//行
|
||||||
|
|
||||||
|
foreach (DataRow row in rowdat)//删除指定信息行
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int a = Product.Select("ProductCode = " + row.Field<string>("ProductCode")).First().Field<int>("ProductType");
|
||||||
|
if (a > type_id) type_id = a;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogGing.ERRDATA(ex);
|
||||||
|
Console.Write(ex.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
gram += row.Field<double>("Grams");
|
||||||
|
row.Delete();
|
||||||
|
row.AcceptChanges();
|
||||||
|
}
|
||||||
|
string NAME = "Process";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
NAME = Gram.Select("Type='" + type_id + "' and min<=" + (int)gram + " and max>" + (int)gram + "").First().Field<string>("name");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogGing.ERRDATA(ex);
|
||||||
|
Console.Write(ex.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
Console.Write("\n"+DateTime.Now.ToString("yyyy/MM/dd-HH:mm:ss")+$"转换{Count}条");
|
string DyelotsBulkedRecipe_updata = "UPDATE [dbo].[DyelotsBulkedRecipe] SET Process ='" + NAME +
|
||||||
|
"'WHERE Dyelot ='" + Dyelot + "' AND ReDye='" + ReDye + "' AND StepNumber ='" + StepNumber + "'";
|
||||||
|
SqlCommand DyelotsBulkedRecipe_UP = new SqlCommand(DyelotsBulkedRecipe_updata, conn_SC);
|
||||||
|
Count++;
|
||||||
|
Console.Write("\n" + DateTime.Now.ToString("yyyy/MM/dd-HH:mm:ss") +
|
||||||
|
" 转换工单:" + Dyelot + "-重染:" + ReDye + "-步骤:" + StepNumber + "\n影响行数" +
|
||||||
|
DyelotsBulkedRecipe_UP.ExecuteNonQuery() + "-流程:" + NAME);
|
||||||
|
LogGing.LogGingDATA("转换工单:" + Dyelot + "重染" + ReDye + "步骤" + StepNumber + "流程:" + NAME);
|
||||||
|
}
|
||||||
|
// Console.Write("\n" + DateTime.Now.ToString("yyyy/MM/dd-HH:mm:ss") + $" 转换完成{Count}条");
|
||||||
Count = 0;
|
Count = 0;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -74,6 +122,7 @@ namespace ProcessManage
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
conn_SC.Close();
|
||||||
_timer.Change(
|
_timer.Change(
|
||||||
dueTime: _intervalMs,
|
dueTime: _intervalMs,
|
||||||
period: Timeout.Infinite);//设定下次触发
|
period: Timeout.Infinite);//设定下次触发
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
Reference in new issue
Block a user