You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

584 lines
21 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using MaterialTraceability.Common;
using MaterialTraceability.WebService.MiBatchCompleteSfcAndAdujustQtyServiceService;
using MaterialTraceability.WebService.MiFirstOperationForsfcServiceService;
using MaterialTraceability.WebService.MiReleaseSfcWithActivityServiceService;
using MaterialTraceability.WebService.MiSFCQueryQtyServiceService;
using MaterialTraceability.WebService.MiSignOffSFCsServiceService;
using MaterialTraceability.WebService.Param;
using MaterialTraceability.WebService.ProcessLotServiceWSService;
using MaterialTraceability.WebService.ShopOrderServiceWSService;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MaterialTraceability.WebService
{
public class WebServiceLog
{
/// <summary>
/// 新自动完工接口日志记录
/// </summary>
/// <param name="requestParam"></param>
/// <param name="responseParam"></param>
/// <param name="beginTime"></param>
public static void saveMiBatchCompleteSfcAndAdujustQtyServiceService(MiBatchCompleteSfcAndAdujustQtyServiceServiceParam requestParam, MiBatchCompleteSfcAndAdujustQtyResponse responseParam, DateTime beginTime,string errorInfo)
{
DateTime endTime = DateTime.Now;
string MesLogPath = @"D:\MESlog\" + @"MiBatchCompleteSfcAndAdujustQtyServiceService\";
DataTable dt = new DataTable();
dt.Columns.Add("参数类型");
dt.Columns.Add("参数值");
DataRow dtRow1 = dt.NewRow();
dtRow1[0] = "开始时间";
dtRow1[1] = beginTime.ToString("yyy-MM-dd HH:mm:ss");
dt.Rows.Add(dtRow1);
DataRow dtRow2 = dt.NewRow();
dtRow2[0] = "结束时间";
dtRow2[1] = endTime.ToString("yyy-MM-dd HH:mm:ss");
dt.Rows.Add(dtRow2);
DataRow dtRow3 = dt.NewRow();
dtRow3[0] = "请求耗时";
dtRow3[1] = MsgUtil.ElapsedTime(beginTime, endTime);
dt.Rows.Add(dtRow3);
DataRow dtRow4 = dt.NewRow();
dtRow4[0] = "请求参数";
dtRow4[1] = JsonChange.ModeToJson(requestParam);
dt.Rows.Add(dtRow4);
DataRow dtRow5 = dt.NewRow();
dtRow5[0] = "返回Code";
dtRow5[1] = responseParam != null ? responseParam.@return.code.ToString() : "";
dt.Rows.Add(dtRow5);
DataRow dtRow6 = dt.NewRow();
dtRow6[0] = "返回消息";
dtRow6[1] = responseParam != null ? responseParam.@return.message : "";
dt.Rows.Add(dtRow6);
DataRow dtRow7 = dt.NewRow();
dtRow7[0] = "返回SFC";
//dtRow7[1] =responseParam != null ? responseParam.@return.sfc : "";
dtRow7[1] = "";
dt.Rows.Add(dtRow7);
DataRow dtRow8 = dt.NewRow();
dtRow8[0] = "返回参数";
dtRow8[1] = responseParam != null ? JsonChange.ModeToJson(responseParam) : "";
dt.Rows.Add(dtRow8);
DataRow dtRow9 = dt.NewRow();
dtRow9[0] = "异常信息";
dtRow9[1] = errorInfo;
dt.Rows.Add(dtRow9);
MsgUtil.WriteMesLog(MesLogPath, requestParam.resource, dt);
}
/// <summary>
/// 首工序获取SFC接口、自动入账接口、卷绕自动上料接口日志
/// activity执行作业Z_AUTO_EN530 上料功能(冷压、卷绕),默认为空,仅执行开始作业(模切)
/// modeProcessSfc过账模式MODE_RELEASE_START_SFC 冷压下达并开始SFCMODE_START_SFC 模切开始SFCMODE_NONE 卷绕仅上料,不执行其他作业
/// </summary>
/// <param name="requestParam"></param>
/// <param name="responseParam"></param>
/// <param name="beginTime"></param>
public static void saveMiFirstOperationForsfcServiceService(MiFirstOperationForsfcServiceServiceParam requestParam, miFirstOperationForsfcResponse responseParam,DateTime beginTime,string errorInfo)
{
DateTime endTime = DateTime.Now;
string MesLogPath = @"D:\MESlog\" + @"MiFirstOperationForsfcServiceService\";
DataTable dt = new DataTable();
dt.Columns.Add("参数类型");
dt.Columns.Add("参数值");
DataRow dtRow1 = dt.NewRow();
dtRow1[0] = "开始时间";
dtRow1[1] = beginTime.ToString("yyy-MM-dd HH:mm:ss");
dt.Rows.Add(dtRow1);
DataRow dtRow2 = dt.NewRow();
dtRow2[0] = "结束时间";
dtRow2[1] = endTime.ToString("yyy-MM-dd HH:mm:ss");
dt.Rows.Add(dtRow2);
DataRow dtRow3 = dt.NewRow();
dtRow3[0] = "请求耗时";
dtRow3[1] = MsgUtil.ElapsedTime(beginTime, endTime);
dt.Rows.Add(dtRow3);
DataRow dtRow4 = dt.NewRow();
dtRow4[0] = "请求参数";
dtRow4[1] = JsonChange.ModeToJson(requestParam);
dt.Rows.Add(dtRow4);
DataRow dtRow5 = dt.NewRow();
dtRow5[0] = "返回Code";
dtRow5[1] = responseParam != null ? responseParam.@return.code.ToString() : "";
dt.Rows.Add(dtRow5);
DataRow dtRow6 = dt.NewRow();
dtRow6[0] = "返回消息";
dtRow6[1] = responseParam != null ? responseParam.@return.message : "";
dt.Rows.Add(dtRow6);
DataRow dtRow7 = dt.NewRow();
dtRow7[0] = "返回SFC";
dtRow7[1] = responseParam != null ? responseParam.@return.sfc : "";
dt.Rows.Add(dtRow7);
DataRow dtRow8 = dt.NewRow();
dtRow8[0] = "返回数量";
dtRow8[1] = responseParam != null ? responseParam.@return.qty : "";
dt.Rows.Add(dtRow8);
DataRow dtRow9 = dt.NewRow();
dtRow9[0] = "返回单位";
dtRow9[1] = responseParam != null ? responseParam.@return.unit : "";
dt.Rows.Add(dtRow9);
DataRow dtRow10 = dt.NewRow();
dtRow10[0] = "返回参数";
dtRow10[1] = responseParam != null ? JsonChange.ModeToJson(responseParam) : "";
dt.Rows.Add(dtRow10);
DataRow dtRow11 = dt.NewRow();
dtRow11[0] = "异常信息";
dtRow11[1] = errorInfo;
dt.Rows.Add(dtRow11);
MsgUtil.WriteMesLog(MesLogPath, requestParam.resource, dt);
}
/// <summary>
/// 涂布工单下达接口日志
/// </summary>
/// <param name="requestParam"></param>
/// <param name="responseParam"></param>
/// <param name="beginTime"></param>
public static void saveMiReleaseSfcWithActivityServiceService(MiReleaseSfcWithActivityServiceServiceParam requestParam, miReleaseSfcWithActivityResponse responseParam,DateTime beginTime,string errorInfo)
{
DateTime endTime = DateTime.Now;
string MesLogPath = @"D:\MESlog\" + @"MiReleaseSfcWithActivityServiceService\";
DataTable dt = new DataTable();
dt.Columns.Add("参数类型");
dt.Columns.Add("参数值");
DataRow dtRow1 = dt.NewRow();
dtRow1[0] = "开始时间";
dtRow1[1] = beginTime.ToString("yyy-MM-dd HH:mm:ss");
dt.Rows.Add(dtRow1);
DataRow dtRow2 = dt.NewRow();
dtRow2[0] = "结束时间";
dtRow2[1] = endTime.ToString("yyy-MM-dd HH:mm:ss");
dt.Rows.Add(dtRow2);
DataRow dtRow3 = dt.NewRow();
dtRow3[0] = "请求耗时";
dtRow3[1] = MsgUtil.ElapsedTime(beginTime, endTime);
dt.Rows.Add(dtRow3);
DataRow dtRow4 = dt.NewRow();
dtRow4[0] = "请求参数";
dtRow4[1] = JsonChange.ModeToJson(requestParam);
dt.Rows.Add(dtRow4);
DataRow dtRow5 = dt.NewRow();
DataRow dtRow6 = dt.NewRow();
DataRow dtRow7 = dt.NewRow();
DataRow dtRow8 = dt.NewRow();
dtRow5[0] = "返回Code";
dtRow6[0] = "返回信息";
dtRow7[0] = "返回SFC";
dtRow8[0] = "返回参数";
if (responseParam != null)
{
dtRow5[1] = responseParam.@return.code;
dtRow6[1] = responseParam.@return.message;
if(responseParam.@return.code > 0)
{
dtRow7[1] = "";
dtRow8[1] = "";
}
else
{
dtRow7[1] = responseParam.@return.sfcArray[0].sfc;
dtRow8[1] = JsonChange.ModeToJson(responseParam);
}
}
else
{
dtRow5[1] = "";
dtRow6[1] = "";
dtRow7[1] = "";
dtRow8[1] = "";
}
dt.Rows.Add(dtRow5);
dt.Rows.Add(dtRow6);
dt.Rows.Add(dtRow7);
dt.Rows.Add(dtRow8);
DataRow dtRow9 = dt.NewRow();
dtRow9[0] = "异常信息";
dtRow9[1] = errorInfo;
dt.Rows.Add(dtRow9);
MsgUtil.WriteMesLog(MesLogPath, requestParam.Resource, dt);
}
/// <summary>
/// 获取SFC数量
/// </summary>
/// <param name="miSFCQueryQtyServiceServiceParam"></param>
/// <returns></returns>
public static void saveMiSFCQueryQtyServiceService(MiSFCQueryQtyServiceServiceParam requestParam,sfcQueryQtyResponse responseParam,DateTime beginTime,string errorInfo)
{
DateTime endTime = DateTime.Now;
string MesLogPath = @"D:\MESlog\" + @"MiSFCQueryQtyServiceService\";
DataTable dt = new DataTable();
dt.Columns.Add("参数类型");
dt.Columns.Add("参数值");
DataRow dtRow1 = dt.NewRow();
dtRow1[0] = "开始时间";
dtRow1[1] = beginTime.ToString("yyy-MM-dd HH:mm:ss");
dt.Rows.Add(dtRow1);
DataRow dtRow2 = dt.NewRow();
dtRow2[0] = "结束时间";
dtRow2[1] = endTime.ToString("yyy-MM-dd HH:mm:ss");
dt.Rows.Add(dtRow2);
DataRow dtRow3 = dt.NewRow();
dtRow3[0] = "请求耗时";
dtRow3[1] = MsgUtil.ElapsedTime(beginTime, endTime);
dt.Rows.Add(dtRow3);
DataRow dtRow4 = dt.NewRow();
dtRow4[0] = "请求参数";
dtRow4[1] = JsonChange.ModeToJson(requestParam);
dt.Rows.Add(dtRow4);
DataRow dtRow5 = dt.NewRow();
dtRow5[0] = "返回Code";
dtRow5[1] = responseParam != null ? responseParam.@return.code.ToString() : "";
dt.Rows.Add(dtRow5);
DataRow dtRow6 = dt.NewRow();
dtRow6[0] = "返回消息";
dtRow6[1] = responseParam != null ? responseParam.@return.message : "";
dt.Rows.Add(dtRow6);
DataRow dtRow7 = dt.NewRow();
dtRow7[0] = "返回SFC";
dtRow7[1] = responseParam != null ? responseParam.@return.sfc : "";
dt.Rows.Add(dtRow7);
DataRow dtRow8 = dt.NewRow();
dtRow8[0] = "返回数量";
dtRow8[1] = responseParam != null ? responseParam.@return.qty : "";
dt.Rows.Add(dtRow8);
DataRow dtRow10 = dt.NewRow();
dtRow10[0] = "返回参数";
dtRow10[1] = responseParam != null ? JsonChange.ModeToJson(responseParam) : "";
dt.Rows.Add(dtRow10);
DataRow dtRow11 = dt.NewRow();
dtRow11[0] = "异常信息";
dtRow11[1] = errorInfo;
dt.Rows.Add(dtRow11);
MsgUtil.WriteMesLog(MesLogPath, "", dt);
}
/// <summary>
/// 注销接口日志
/// </summary>
/// <param name="requestParam"></param>
/// <param name="responseParam"></param>
/// <param name="beginTime"></param>
public static void saveMiSignOffSFCsServiceService(MiSignOffSFCsServiceServiceParam requestParam, miSignOffSFCsResponse responseParam, DateTime beginTime,string errorInfo)
{
DateTime endTime = DateTime.Now;
string MesLogPath = @"D:\MESlog\" + @"MiSignOffSFCsServiceService\";
DataTable dt = new DataTable();
dt.Columns.Add("参数类型");
dt.Columns.Add("参数值");
DataRow dtRow1 = dt.NewRow();
dtRow1[0] = "开始时间";
dtRow1[1] = beginTime.ToString("yyy-MM-dd HH:mm:ss");
dt.Rows.Add(dtRow1);
DataRow dtRow2 = dt.NewRow();
dtRow2[0] = "结束时间";
dtRow2[1] = endTime.ToString("yyy-MM-dd HH:mm:ss");
dt.Rows.Add(dtRow2);
DataRow dtRow3 = dt.NewRow();
dtRow3[0] = "请求耗时";
dtRow3[1] = MsgUtil.ElapsedTime(beginTime, endTime);
dt.Rows.Add(dtRow3);
DataRow dtRow4 = dt.NewRow();
dtRow4[0] = "请求参数";
dtRow4[1] = JsonChange.ModeToJson(requestParam);
dt.Rows.Add(dtRow4);
DataRow dtRow5 = dt.NewRow();
DataRow dtRow6 = dt.NewRow();
DataRow dtRow7 = dt.NewRow();
if(responseParam != null)
{
dtRow5[0] = "返回Code";
dtRow5[1] = responseParam.@return.code;
dtRow6[0] = "返回信息";
dtRow6[1] = responseParam.@return.message;
dtRow7[0] = "返回参数";
dtRow7[1] = JsonChange.ModeToJson(responseParam);
}
else
{
dtRow5[0] = "返回Code";
dtRow5[1] = "";
dtRow6[0] = "返回信息";
dtRow6[1] = "";
dtRow7[0] = "返回参数";
dtRow7[1] = "";
}
dt.Rows.Add(dtRow5);
dt.Rows.Add(dtRow6);
dt.Rows.Add(dtRow7);
DataRow dtRow8 = dt.NewRow();
dtRow8[0] = "异常信息";
dtRow8[1] = errorInfo;
dt.Rows.Add(dtRow8);
MsgUtil.WriteMesLog(MesLogPath, requestParam.Resource, dt);
}
/// <summary>
/// 托盘绑定
/// </summary>
/// <param name="processLotServiceWSServiceParam"></param>
/// <returns></returns>
public static void saveAddMemberResponse(ProcessLotServiceWSServiceParam requestParam, addMemberResponse responseParam,DateTime beginTime,string errorInfo)
{
DateTime endTime = DateTime.Now;
string MesLogPath = @"D:\MESlog\" + @"AddMember\";
DataTable dt = new DataTable();
dt.Columns.Add("参数类型");
dt.Columns.Add("参数值");
DataRow dtRow1 = dt.NewRow();
dtRow1[0] = "开始时间";
dtRow1[1] = beginTime.ToString("yyy-MM-dd HH:mm:ss");
dt.Rows.Add(dtRow1);
DataRow dtRow2 = dt.NewRow();
dtRow2[0] = "结束时间";
dtRow2[1] = endTime.ToString("yyy-MM-dd HH:mm:ss");
dt.Rows.Add(dtRow2);
DataRow dtRow3 = dt.NewRow();
dtRow3[0] = "请求耗时";
dtRow3[1] = MsgUtil.ElapsedTime(beginTime, endTime);
dt.Rows.Add(dtRow3);
DataRow dtRow4 = dt.NewRow();
dtRow4[0] = "请求参数";
dtRow4[1] = JsonChange.ModeToJson(requestParam);
dt.Rows.Add(dtRow4);
DataRow dtRow5 = dt.NewRow();
dtRow5[0] = "返回参数";
dtRow5[1] = JsonChange.ModeToJson(responseParam);
dt.Rows.Add(dtRow5);
MsgUtil.WriteMesLog(MesLogPath, "", dt);
}
/// <summary>
/// 托盘解绑
/// </summary>
/// <param name="processLotServiceWSServiceParam"></param>
/// <returns></returns>
public static void saveRemoveMember(ProcessLotServiceWSServiceParam requestParam, removeMemberResponse responseParam, DateTime beginTime,string errorInfo)
{
DateTime endTime = DateTime.Now;
string MesLogPath = @"D:\MESlog\" + @"RemoveMember\";
DataTable dt = new DataTable();
dt.Columns.Add("参数类型");
dt.Columns.Add("参数值");
DataRow dtRow1 = dt.NewRow();
dtRow1[0] = "开始时间";
dtRow1[1] = beginTime.ToString("yyy-MM-dd HH:mm:ss");
dt.Rows.Add(dtRow1);
DataRow dtRow2 = dt.NewRow();
dtRow2[0] = "结束时间";
dtRow2[1] = endTime.ToString("yyy-MM-dd HH:mm:ss");
dt.Rows.Add(dtRow2);
DataRow dtRow3 = dt.NewRow();
dtRow3[0] = "请求耗时";
dtRow3[1] = MsgUtil.ElapsedTime(beginTime, endTime);
dt.Rows.Add(dtRow3);
DataRow dtRow4 = dt.NewRow();
dtRow4[0] = "请求参数";
dtRow4[1] = JsonChange.ModeToJson(requestParam);
dt.Rows.Add(dtRow4);
DataRow dtRow5 = dt.NewRow();
dtRow5[0] = "返回参数";
if (responseParam != null)
{
dtRow5[1] = JsonChange.ModeToJson(responseParam);
}
else
{
dtRow5[1] = "";
}
dt.Rows.Add(dtRow5);
DataRow dtRow6 = dt.NewRow();
dtRow6[0] = "异常信息";
dtRow6[1] = errorInfo;
dt.Rows.Add(dtRow6);
MsgUtil.WriteMesLog(MesLogPath, "", dt);
}
/// <summary>
/// 根据RFID获取膜卷号
/// </summary>
/// <param name="processLotServiceWSServiceParam"></param>
/// <returns></returns>
public static void saveReadProcessLot(ProcessLotServiceWSServiceParam requestParam, readProcessLotResponse responseParam,DateTime beginTime,string errorInfo)
{
DateTime endTime = DateTime.Now;
string MesLogPath = @"D:\MESlog\" + @"ReadProcessLot\" ;
DataTable dt = new DataTable();
dt.Columns.Add("参数类型");
dt.Columns.Add("参数值");
DataRow dtRow1 = dt.NewRow();
dtRow1[0] = "开始时间";
dtRow1[1] = beginTime.ToString("yyy-MM-dd HH:mm:ss");
dt.Rows.Add(dtRow1);
DataRow dtRow2 = dt.NewRow();
dtRow2[0] = "结束时间";
dtRow2[1] = endTime.ToString("yyy-MM-dd HH:mm:ss");
dt.Rows.Add(dtRow2);
DataRow dtRow3 = dt.NewRow();
dtRow3[0] = "请求耗时";
dtRow3[1] = MsgUtil.ElapsedTime(beginTime, endTime);
dt.Rows.Add(dtRow3);
DataRow dtRow4 = dt.NewRow();
dtRow4[0] = "请求参数";
dtRow4[1] = JsonChange.ModeToJson(requestParam);
dt.Rows.Add(dtRow4);
DataRow dtRow5 = dt.NewRow();
dtRow5[0] = "返回参数";
dtRow5[1] = JsonChange.ModeToJson(responseParam);
dt.Rows.Add(dtRow5);
DataRow dtRow6 = dt.NewRow();
dtRow6[0] = "返回SFC";
dtRow6[1] = responseParam.Response.processLotMemberList != null ? responseParam.Response.processLotMemberList[0].memberContext : "";
dt.Rows.Add(dtRow6);
DataRow dtRow7 = dt.NewRow();
dtRow7[0] = "异常信息";
dtRow7[1] = errorInfo;
dt.Rows.Add(dtRow7);
MsgUtil.WriteMesLog(MesLogPath, "", dt);
}
/// <summary>
/// 根据工单编号获取工单信息
/// </summary>
/// <param name="requestParam"></param>
/// <param name="responseParam"></param>
/// <param name="beginTime"></param>
/// <param name="errorInfo"></param>
public static void findShopOrder(FindShopRequestParam requestParam, findShopOrderResponse responseParam, DateTime beginTime, string errorInfo)
{
DateTime endTime = DateTime.Now;
string MesLogPath = @"D:\MESlog\" + @"ReadProcessLot\";
DataTable dt = new DataTable();
dt.Columns.Add("参数类型");
dt.Columns.Add("参数值");
DataRow dtRow1 = dt.NewRow();
dtRow1[0] = "开始时间";
dtRow1[1] = beginTime.ToString("yyy-MM-dd HH:mm:ss");
dt.Rows.Add(dtRow1);
DataRow dtRow2 = dt.NewRow();
dtRow2[0] = "结束时间";
dtRow2[1] = endTime.ToString("yyy-MM-dd HH:mm:ss");
dt.Rows.Add(dtRow2);
DataRow dtRow3 = dt.NewRow();
dtRow3[0] = "请求耗时";
dtRow3[1] = MsgUtil.ElapsedTime(beginTime, endTime);
dt.Rows.Add(dtRow3);
DataRow dtRow4 = dt.NewRow();
dtRow4[0] = "请求参数";
dtRow4[1] = JsonChange.ModeToJson(requestParam);
dt.Rows.Add(dtRow4);
DataRow dtRow5 = dt.NewRow();
dtRow5[0] = "返回参数";
dtRow5[1] = JsonChange.ModeToJson(responseParam);
dt.Rows.Add(dtRow5);
//DataRow dtRow6 = dt.NewRow();
//dtRow6[0] = "返回SFC";
//dtRow6[1] = responseParam.Response.processLotMemberList != null ? responseParam.Response.processLotMemberList[0].memberContext : "";
//dt.Rows.Add(dtRow6);
DataRow dtRow7 = dt.NewRow();
dtRow7[0] = "异常信息";
dtRow7[1] = errorInfo;
dt.Rows.Add(dtRow7);
MsgUtil.WriteMesLog(MesLogPath, "", dt);
}
}
}