326 lines
11 KiB
C#
326 lines
11 KiB
C#
using MisDataSaveDate;
|
||
using MisDataSaveDate.MOM;
|
||
using Newtonsoft.Json;
|
||
using NPOI.SS.Formula.Functions;
|
||
using PLMTEST;
|
||
using System;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using System.ComponentModel;
|
||
using System.Configuration;
|
||
using System.Data;
|
||
using System.Data.SqlClient;
|
||
using System.Diagnostics;
|
||
using System.Drawing;
|
||
using System.IO;
|
||
using System.Linq;
|
||
using System.Net;
|
||
using System.Net.NetworkInformation;
|
||
using System.Text;
|
||
using System.Threading;
|
||
using System.Threading.Tasks;
|
||
using System.Windows.Forms;
|
||
using WebApi;
|
||
using static NPOI.HSSF.Record.UnicodeString;
|
||
using static System.Configuration.ConfigurationManager;
|
||
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
namespace SlMesDbIterface
|
||
{
|
||
public partial class Form_MoveSqlTable : Form
|
||
{
|
||
public static Action<double, String, String> Delegate_UpdateValue = null;
|
||
public int count = 0;
|
||
//InitServer initServer = null;
|
||
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
public Form_MoveSqlTable()
|
||
{
|
||
InitializeComponent();
|
||
}
|
||
|
||
private void Form_MoveSqlTable_Load(object sender, EventArgs e)
|
||
{
|
||
//MyLog4Net.MyLogHelper.LogCommit += MyLogHelper_LogCommit;
|
||
//initServer = new InitServer();
|
||
}
|
||
|
||
private void MyLogHelper_LogCommit(object sender, MyLog4Net.MyLogEventArgs e)
|
||
{
|
||
var module = e.Module;
|
||
var message = e.Message;
|
||
|
||
var log = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff") + " " + module + " " + message + "\r\n";
|
||
|
||
count++;
|
||
|
||
|
||
if (this.InvokeRequired)
|
||
{
|
||
this.Invoke(new Action(() =>
|
||
{
|
||
if (count > 100)
|
||
{
|
||
this.richTextBoxLogBox.Text = "";
|
||
}
|
||
this.richTextBoxLogBox.AppendText(log);
|
||
// this.richTextBoxLogBox.Text += log;
|
||
richTextBoxLogBox.Focus();
|
||
}));
|
||
}
|
||
else
|
||
{
|
||
if (count > 100)
|
||
{
|
||
this.richTextBoxLogBox.Text = "";
|
||
}
|
||
this.richTextBoxLogBox.AppendText(log);
|
||
// this.richTextBoxLogBox.Text += log;
|
||
richTextBoxLogBox.Focus();
|
||
}
|
||
|
||
}
|
||
|
||
private void Form_MoveSqlTable_FormClosing_1(object sender, FormClosingEventArgs e)
|
||
{
|
||
|
||
}
|
||
|
||
private void label1_Click(object sender, EventArgs e)
|
||
{
|
||
|
||
}
|
||
|
||
private void button1_Click(object sender, EventArgs e)
|
||
{
|
||
//new TaskFactory().StartNew(delegate ()
|
||
//{
|
||
try
|
||
{
|
||
CALL_Inerface_DataHandle.CALL_Inerface_JobStart("AC2401", "SCDD-0302-250707-0410-01", "SCDD-0302-250707-0410-01");
|
||
}
|
||
catch (Exception err)
|
||
{
|
||
MyLog4Net.MyLogHelper.Info("生产开工接口res:", err.Message);
|
||
}
|
||
//});
|
||
}
|
||
|
||
private void button2_Click(object sender, EventArgs e)
|
||
{
|
||
try
|
||
{
|
||
CALL_Inerface_DataHandle.CALL_Inerface_DeviceAlarm("AC0901", "90010003", "1", "测试报警信息!");
|
||
}
|
||
|
||
catch (Exception err)
|
||
{
|
||
MyLog4Net.MyLogHelper.Info("产线报警接口res:", err.Message);
|
||
}
|
||
}
|
||
|
||
private void button3_Click(object sender, EventArgs e)
|
||
{
|
||
|
||
try
|
||
{
|
||
//JobFinished productionReport = GenerateTestData_ProductionReport();
|
||
//string InterfaceUrl = ConfigurationManager.AppSettings["CallWebApiUrl_ProcessJobFinish"];
|
||
//var result = CALL_Interface_WebAPI.CALL_WebApi_JobFinished(InterfaceUrl,productionReport);
|
||
//richTextBoxLogBox.Text = result.ToString();
|
||
CALL_Inerface_DataHandle.CALL_Inerface_JobFinished("AC2401", "SCDD-0302-250707-0410-01", "SCDD-0302-250707-0410-01");
|
||
}
|
||
|
||
catch (Exception err)
|
||
{
|
||
MyLog4Net.MyLogHelper.Info("工序完工接口res:", err.Message);
|
||
}
|
||
|
||
}
|
||
|
||
private void button4_Click(object sender, EventArgs e)
|
||
{
|
||
//new TaskFactory().StartNew(delegate ()
|
||
//{
|
||
try
|
||
{
|
||
// 1退托盘,2叫料,3送料,4转序
|
||
CALL_Inerface_DataHandle.CALL_Inerface_CallMaterial("AC0901-2", "2");
|
||
}
|
||
catch (Exception err)
|
||
{
|
||
MyLog4Net.MyLogHelper.Info("物料配送接口res:", err.Message);
|
||
}
|
||
//});
|
||
}
|
||
|
||
private void button56_Click(object sender, EventArgs e)
|
||
{
|
||
//new TaskFactory().StartNew(delegate ()
|
||
//{
|
||
try
|
||
{
|
||
TaskFinish taskFinish = GenerateTestData_taskFinish();
|
||
var result = CALL_Interface_WebAPI.CALL_WebApi_FinishedReport(taskFinish);
|
||
richTextBoxLogBox.Text = result.ToString();
|
||
|
||
}
|
||
|
||
catch (Exception err)
|
||
{
|
||
MyLog4Net.MyLogHelper.Info("任务完工与工时汇报接口res:", err.Message);
|
||
}
|
||
//});
|
||
}
|
||
|
||
public static JobFinished GenerateTestData_ProductionReport()
|
||
{
|
||
return new JobFinished
|
||
{
|
||
orderID = "OrderID20250512",
|
||
taskID = "TASK202403150001",
|
||
finishedQuantity = 100.00m,
|
||
createTime = "2024-03-15 08:00:00",
|
||
endTime = "2024-03-15 17:00:00",
|
||
beat = 5.5m,
|
||
processNo = "PROC001",
|
||
lastModifiedTime = "2024-03-15 17:00:00",
|
||
operation = "操作人",
|
||
inspectionInfo = new List<InspectionInfo>
|
||
{
|
||
new InspectionInfo
|
||
{
|
||
Inspectcode = "INS202403150001",
|
||
inspector = "张三",
|
||
inspectionTime = "2024-03-15 16:30:00",
|
||
qualifiedQuantity = 98.00m,
|
||
unqualifiedQuantity = 2.00m,
|
||
inspectionDetails = new List<InspectionDetail>
|
||
{
|
||
new InspectionDetail
|
||
{
|
||
inspectionItemID = "ITEM001",
|
||
inspectionItemNo = "CHECK001",
|
||
inspectionItemName = "尺寸检查",
|
||
inspectionValue = "检测值",
|
||
inspectionStandardText = "标准尺寸检查",
|
||
upperLimitSymbol = "≤",
|
||
upperLimitValue = 11.0m,
|
||
lowerLimitSymbol = "≥",
|
||
lowerLimitValue = 10.0m,
|
||
standardValue = 10.5m,
|
||
inspectionResult = "检验结果"
|
||
},
|
||
new InspectionDetail
|
||
{
|
||
inspectionItemID = "ITEM002",
|
||
inspectionItemNo = "CHECK002",
|
||
inspectionItemName = "重量检查",
|
||
inspectionValue = "检测值",
|
||
inspectionStandardText = "标准重量检查",
|
||
upperLimitSymbol = "≤",
|
||
upperLimitValue = 550.0m,
|
||
lowerLimitSymbol = "≥",
|
||
lowerLimitValue = 450.0m,
|
||
standardValue = 500.0m,
|
||
inspectionResult = "检验结果"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
materialInfo = new List<MaterialInfo>
|
||
{
|
||
new MaterialInfo
|
||
{
|
||
consumedMaterialNo = "MAT001",
|
||
qty = 1.0m,
|
||
qualifiedqty = 1.0m,
|
||
unqualifiedqty = 0.0m,
|
||
inspectionTool = "游标卡尺",
|
||
batchNo = "BATCH202403150001",
|
||
serialNo = "序列号"
|
||
},
|
||
new MaterialInfo
|
||
{
|
||
consumedMaterialNo = "MAT002",
|
||
qty = 1.0m,
|
||
qualifiedqty = 1.0m,
|
||
unqualifiedqty = 0.0m,
|
||
inspectionTool = "电子秤",
|
||
batchNo = "BATCH202403150002",
|
||
serialNo = "序列号"
|
||
}
|
||
},
|
||
workinghours = new List<Workinghours>
|
||
{
|
||
new Workinghours
|
||
{
|
||
employee = "员工1",
|
||
quantity = 1.0m,
|
||
workingHours = 1.0m,
|
||
},
|
||
new Workinghours
|
||
{
|
||
employee = "员工2",
|
||
quantity = 1.0m,
|
||
workingHours = 1.0m,
|
||
}
|
||
}
|
||
};
|
||
}
|
||
|
||
public static TaskFinish GenerateTestData_taskFinish()
|
||
{
|
||
return new TaskFinish
|
||
{
|
||
orderID = "ORD202403150002",
|
||
taskID = "TASK202403150003",
|
||
employee = "王五",
|
||
quantity = 120,
|
||
workingHours = 9
|
||
};
|
||
}
|
||
|
||
private void button4_Click_1(object sender, EventArgs e)
|
||
{
|
||
new TaskFactory().StartNew(delegate ()
|
||
{
|
||
try
|
||
{
|
||
MaterialPosition materialPosition = new MaterialPosition
|
||
{
|
||
requestId = "请求ID",
|
||
process = "工序"
|
||
};
|
||
//var result = CALL_Interface_WebAPI.CALL_WebApi_CallMaterial(materialSend);
|
||
//richTextBoxLogBox.Text = result.ToString();
|
||
}
|
||
|
||
catch (Exception err)
|
||
{
|
||
MyLog4Net.MyLogHelper.Info("缓存位置查询接口res:", err.Message);
|
||
}
|
||
});
|
||
}
|
||
|
||
private void button6_Click(object sender, EventArgs e)
|
||
{
|
||
CALL_Inerface_DataHandle.CALL_Inerface_DeviceInfoQuery("AC0901-2", "Y1030121000595");
|
||
}
|
||
|
||
private void button7_Click(object sender, EventArgs e)
|
||
{
|
||
CALL_Inerface_DataHandle.CALL_Inerface_MaterialConfirm("AC0901-02", "YX126GISSGW002");
|
||
}
|
||
|
||
private void button8_Click(object sender, EventArgs e)
|
||
{
|
||
CALL_Inerface_DataHandle.CALL_Inerface_MaterialTransfer("ACHC01", "ACHC02");
|
||
}
|
||
}
|
||
}
|