结果数据重传
This commit is contained in:
@@ -1,21 +1,25 @@
|
||||
using System;
|
||||
using JY.DAL;
|
||||
using JY.Inspection.Enums;
|
||||
using JY.Inspection.Mes;
|
||||
using JY.MES;
|
||||
using JY.MES.Entity;
|
||||
using JY.MES.Enum;
|
||||
using JY.MES.MES;
|
||||
using JY.Model;
|
||||
using JY.Model.Enums;
|
||||
using JY.Utility;
|
||||
using JYControl;
|
||||
using MiniExcelLibs;
|
||||
using Newtonsoft.Json;
|
||||
using OfficeOpenXml;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using JY.DAL;
|
||||
using JY.Utility;
|
||||
using System.Drawing;
|
||||
using Newtonsoft.Json;
|
||||
using JYControl;
|
||||
using JY.MES.Entity;
|
||||
using JY.MES;
|
||||
using OfficeOpenXml;
|
||||
using MiniExcelLibs;
|
||||
using System.Collections.Generic;
|
||||
using JY.Inspection.Enums;
|
||||
using JY.Model.Enums;
|
||||
using JY.Model;
|
||||
|
||||
namespace JY.Inspection.Frm
|
||||
{
|
||||
@@ -133,7 +137,8 @@ namespace JY.Inspection.Frm
|
||||
EnumSearchType curEnum = EnumSearchType.ArrivalStation;
|
||||
if (this.InvokeRequired)
|
||||
{
|
||||
this.BeginInvoke(new Action(() => {
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
var curItem = cbSelectType.SelectedItem as ComboItem;
|
||||
curEnum = curItem.Value.ToEnum<EnumSearchType>();
|
||||
}));
|
||||
@@ -225,7 +230,6 @@ namespace JY.Inspection.Frm
|
||||
|
||||
private void btnSelect_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
tSo = new Thread(new ThreadStart(ThreadWork));
|
||||
@@ -355,6 +359,8 @@ namespace JY.Inspection.Frm
|
||||
/// <param name="e"></param>
|
||||
private void btnUpMES_Click(object sender, EventArgs e)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if (dgvData.Columns.Count <= 1)
|
||||
{
|
||||
MessageBox.Show("请先查询数据,再进行上传MES操作", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
@@ -403,83 +409,101 @@ namespace JY.Inspection.Frm
|
||||
else//下料
|
||||
{
|
||||
// TODO 结果数据上传
|
||||
sb.Clear();
|
||||
|
||||
int i = 0;
|
||||
foreach (DataGridViewRow row in dgvData.Rows)
|
||||
{
|
||||
i++;
|
||||
|
||||
if (Convert.ToBoolean(row.Cells[0].Value))
|
||||
{
|
||||
if (Convert.ToInt32(row.Cells["状态"].Value) == 1 || Convert.ToInt32(row.Cells["状态"].Value) == 2)
|
||||
{
|
||||
MessageBox.Show("勾选电芯数据已上传", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
return;
|
||||
sb.AppendLine($"第{i}行数据: 勾选电芯数据已上传");
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO 获取出站数据上传MES
|
||||
JY.MES.FMS.FMS_Out fMS_Out = new MES.FMS.FMS_Out();
|
||||
//fMS_In.deviceCode = Global.systemConfig.eqp_code;
|
||||
//fMS_In.houseCode = "test11";
|
||||
//fMS_In.skuCode = m.BarCode;
|
||||
//fMS_In.systemCode = "win10";
|
||||
//fMS_In.processCode = Global.systemConfig.seq_code;
|
||||
//fMS_In.ngCode = "";
|
||||
//fMS_Out.systemCode = Global.systemConfig.systemCode;
|
||||
//fMS_Out.houseCode = Global.systemConfig.houseCode;
|
||||
//fMS_Out.skuCode = Convert.ToString(row.Cells["条码"].Value);
|
||||
//fMS_Out.deviceCode = Global.systemConfig.deviceCode;
|
||||
//fMS_Out.processCode = Global.systemConfig.processCode;
|
||||
fMS_Out.testResult = "NG";
|
||||
fMS_Out.ngCode = "0";
|
||||
{
|
||||
// 获取出站数据上传MES
|
||||
BlankingData data = GetBlankingData(row);
|
||||
|
||||
JY.MES.FMS.processData ProData = new JY.MES.FMS.processData();
|
||||
if (data == null)
|
||||
{
|
||||
sb.AppendLine($"第{i}行数据: 获取出站数据失败, 跳过该数据");
|
||||
continue;
|
||||
}
|
||||
|
||||
ProData.inTime = Convert.ToString(row.Cells["进站时间"].Value);
|
||||
ProData.outTime = Convert.ToString(row.Cells["进站时间"].Value);
|
||||
ProData.cspdjg = Convert.ToString(row.Cells["综合结果"].Value);
|
||||
ProData.cssj = "";
|
||||
ProData.cspc = "";
|
||||
ProData.csjg = Convert.ToString(row.Cells["综合结果"].Value);
|
||||
ProData.fcbj = "";
|
||||
ProData.fccs = "";
|
||||
ProData.fcsj = "";
|
||||
ProData.fcyy = "";
|
||||
ProData.ngyy = Convert.ToString(row.Cells["备注"].Value);
|
||||
ProData.ngsj = "";
|
||||
ProData.ngwz = "";
|
||||
ProData.hjwd = "";
|
||||
ProData.hjsd = "";
|
||||
ProData.kqjjd = "";
|
||||
ProData.workShift = Convert.ToString(row.Cells["班次"].Value);
|
||||
fMS_Out.processData = ProData;
|
||||
|
||||
string strJosn = JsonConvert.SerializeObject(fMS_Out);
|
||||
LogManagerControl.AddLog($"PC->FMS[电芯出站]:{strJosn}", LogAddtype.MES);
|
||||
var result = JY.MES.FMS.MesHelper_EVE.MES_Outbound(fMS_Out);
|
||||
string strRes = "statusCode:" + "[" + result.statusCode + "]" + "statusMessage" + "[" + result.statusMessage + "]";
|
||||
LogManagerControl.AddLog($"FMS->PC[电芯出站]:{strRes}", LogAddtype.MES);
|
||||
|
||||
string NowTime = DateTime.Now.ToString("yyyy - MM - dd HH: mm: ss");
|
||||
var result1 = @" UPDATE BlankingData set Flag=2,strUploadMESTime='" + NowTime + "' where[ID]=" + Convert.ToInt32(row.Cells["唯一ID"].Value);
|
||||
//var result2 = @" UPDATE BlankingData set UploadMESTime='" + NowTime + "' where[ID]='" + Convert.ToString(row.Cells["唯一ID"].Value) + "'";
|
||||
DataTable dt = SqlHelper<object>.QueryTable(result1);
|
||||
MesCallResult<RespProductResult> resMes = new MESDataCombin().ProductResultParameters(data);
|
||||
if (!resMes.IsSuccess)
|
||||
{
|
||||
if (resMes.ErrorType == MesErrorType.NetworkError || resMes.ErrorType == MesErrorType.NetworkTimeout)
|
||||
{
|
||||
sb.AppendLine($"第{i}行数据: 结果数据上传MES超时或无法访问MES服务器");
|
||||
LogManagerControl.AddLog("结果数据上传MES超时或无法访问MES服务器", LogAddtype.local, Logtype.Error);
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMsg = resMes.OriResponse == null ? resMes.ErrorMessage : resMes.OriResponse.ToString();
|
||||
sb.AppendLine($"第{i}行数据: 结果数据上传MES失败NG,{errMsg}");
|
||||
LogManagerControl.AddLog("结果数据上传MES失败NG," + errMsg, LogAddtype.local, Logtype.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch(Exception ex)
|
||||
{
|
||||
MessageBox.Show("手动上传MES失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
MessageBox.Show($"手动上传MES失败: {ex.ToString()}", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
return;
|
||||
}
|
||||
MessageBox.Show("手动上传MES成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
|
||||
|
||||
if (sb.Length > 0)
|
||||
{
|
||||
// 弹出错误信息
|
||||
MessageBox.Show(sb.ToString(), "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("手动上传MES成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
|
||||
private BlankingData GetBlankingData(DataGridViewRow row)
|
||||
{
|
||||
// TODO 获取BlankingData
|
||||
return null;
|
||||
// 获取BlankingData
|
||||
BlankingData data = new BlankingData();
|
||||
data.ID = Convert.ToInt32(row.Cells["ID"].Value);
|
||||
data.TD = Convert.ToInt32(row.Cells["序号"].Value);
|
||||
data.WorkShift = row.Cells["班次"].Value?.ToString();
|
||||
data.TDGroup = Convert.ToInt32(row.Cells["主道"].Value);
|
||||
data.ArrivalBarCode = row.Cells["入站条码"].Value?.ToString();
|
||||
data.DepartureBarCode = row.Cells["出站条码"].Value?.ToString();
|
||||
data.TMDB = row.Cells["条码对比"].Value?.ToString();
|
||||
data.OutTime = row.Cells["出站时间"].Value?.ToString();
|
||||
data.CCD1 = row.Cells["正面(2D/3D)"].Value?.ToString();
|
||||
data.CCD2 = row.Cells["反面(2D/3D)"].Value?.ToString();
|
||||
data.CCD3 = row.Cells["左侧面(2D/3D)"].Value?.ToString();
|
||||
data.CCD4 = row.Cells["右侧面(2D/3D)"].Value?.ToString();
|
||||
data.CCD5 = row.Cells["顶面(2D/3D)"].Value?.ToString();
|
||||
data.CCD6 = row.Cells["底面(2D/3D)"].Value?.ToString();
|
||||
data.CCD7 = row.Cells["底WE1"].Value?.ToString();
|
||||
data.CCD8 = row.Cells["底WE2"].Value?.ToString();
|
||||
data.CCD9 = row.Cells["底WE3"].Value?.ToString();
|
||||
data.CCD10 = row.Cells["底WE4"].Value?.ToString();
|
||||
data.CCD11 = row.Cells["中ME1"].Value?.ToString();
|
||||
data.CCD12 = row.Cells["中ME2"].Value?.ToString();
|
||||
data.CCD13 = row.Cells["中ME3"].Value?.ToString();
|
||||
data.CCD14 = row.Cells["中ME4"].Value?.ToString();
|
||||
data.CCD15 = row.Cells["极柱(POS/NEG)"].Value?.ToString();
|
||||
data.CCD16 = row.Cells["防爆阀(PRO)"].Value?.ToString();
|
||||
data.Result = row.Cells["综合结果"].Value?.ToString();
|
||||
data.Remark = row.Cells["备注"].Value?.ToString();
|
||||
data.Flag = Convert.ToInt32(row.Cells["状态"].Value);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user