using Hanhe.iWCS.Common;
using Hanhe.iWCS.MData;
using MongoDB.Bson;
using MongoDB.Driver;
using MongoDB.Driver.Builders;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;
using static Hanhe.iWCS.TaizhouGEMTwoProtocol.PLCControl;
using static Hanhe.iWCS.TaizhouGEMTwoProtocol.ProcessHelper;
using static System.Runtime.CompilerServices.RuntimeHelpers;
namespace Hanhe.iWCS.TaizhouGEMTwoProtocol
{
public class MESHelper
{
private static string mesurl = Settings.MESUrl;
private static string timeurl = Settings.TimeCuo;
private static WebApiHelper helper = new WebApiHelper();
///
/// 时间戳数据计数
///
public static int total;
///
/// 包装机下线任务调用的MES接口——GlmTonBagFillInfo
///
/// 设备号
///
internal static MachineInfoCache GetPackingMachineInfo(string location) {
//mes 地址读配置文件
MachineInfoCache result = new MachineInfoCache();
//需要进一步确认MES接口传输的数据
var param = new { machineNo = location };
CMMLog.Info($"向MES发送数据{JsonConvert.SerializeObject(param)},接口地址为:{mesurl}");
var res = helper.WebPost(mesurl, JsonConvert.SerializeObject(param));
if (!string.IsNullOrEmpty(res))
{
CMMLog.Info($"MES获取到数据:{JsonConvert.DeserializeObject(res)}");
var req = JsonConvert.DeserializeObject(res);
if (req != null)
{
if(location == req.machineNo)
{
CMMLog.Info($"转换后MES数据{req}");
var machine = MongoDBSingleton.Instance.FindOne(Query.EQ("machineNo", req.machineNo), "MachineInfo");
if (machine == null)
{
MongoDBSingleton.Instance.Insert(new MachineInfo
{
machineNo = req.machineNo,
lotNo = req.lotNo,
bagNo = req.bagNo,
productType = req.productType,
palletLayers = req.palletLayers,
materialCode = req.materialCode,
overlappingLayers = req.overlappingLayers
});
}
else
{
CMMLog.Info($"当前中间表有当前包装机点位的信息存在,请检查MST主表是否有任务正在执行!");
Console.WriteLine($"当前中间表有当前包装机点位的信息存在,请检查MST主表是否有任务正在执行!");
}
CMMLog.Info($"MES接口传输数据信息:machineNo:{req.machineNo},lotNo:{req.lotNo},bagNo:{req.bagNo},productType:{req.productType},materialCode:{req.materialCode},overlappingLayers:{req.overlappingLayers}");
Console.WriteLine($"MES接口传输数据信息:machineNo:{req.machineNo},lotNo:{req.lotNo},bagNo:{req.bagNo},productType:{req.productType},materialCode:{req.materialCode},overlappingLayers:{req.overlappingLayers}");
result = req;
}
else CMMLog.Info($"MES传输的包装机号与当前包装机号不符合:当前包装机号:{location},MES传输的包装机号:{req.machineNo}");
}
else CMMLog.Info($"MES接口:Json返回数据为空值!接受的数据为:{req}");
}
else CMMLog.Info($"MES接口:返回数据为空值!接受的数据为:{res}");
return result;
}
///
/// 3楼打包下线口到1楼成品货架口——调用打包线下线口接受传输的照相机接口数据
///
/// 时间戳
///
internal static TimeChuoInfo TimeCuo(string timeStamp,ref string deviceNo)
{
//时间戳 地址读配置文件
TimeChuoInfo result = new TimeChuoInfo();
var param = new { machineNo = timeStamp };
CMMLog.Info($"TimeCuo-01:SendMsg:{JsonConvert.SerializeObject(param)},url:{timeurl}");
//var res = helper.WebGet(timeurl, JsonConvert.SerializeObject(param));
var res = helper.WebGet(timeurl+"?timeStamp="+timeStamp);
CMMLog.Info($"TimeCuo-02:ReqMsg:{JsonConvert.SerializeObject(res)},url:{timeurl}");
try
{
if (!string.IsNullOrEmpty(res))
{
CMMLog.Info("time 02");
var req = JsonConvert.DeserializeObject(res);
if (req != null)
{
CMMLog.Info("time 03");
//req.info = TransUTF8(req.info);//MES传输的UTF-8格式参数,C#默认UniCode格式,出现解析错误,但是此字段无意义,看情况更新
//var time = req.data[req.data.Count];
var timeReq = req.data.Where(a => a.timeStamp == int.Parse(timeStamp)).FirstOrDefault();
CMMLog.Info("需要处理的参数:" + JsonConvert.SerializeObject(timeReq));
if (timeReq != null && req.count == 1)
{
CMMLog.Info("time 04");
total = timeReq.totalCount;
if (timeReq.batchNumber.Length % 2 == 0 && timeReq.batchNumber.Substring(0, 1) == "0")
timeReq.batchNumber = timeReq.batchNumber.Substring(1, timeReq.batchNumber.Length - 1);
if (timeReq.productModel.Length % 2 == 0 && timeReq.productModel.Substring(0, 1) == "0")
timeReq.productModel = timeReq.batchNumber.Substring(1, timeReq.productModel.Length - 1);
CMMLog.Info("time 05");
var timeCuo = MongoDBSingleton.Instance.FindOne(Query.EQ("packingMachineNumber", timeReq.packingMachineNumber_1), "TimeCuoInfoCom");
if (timeCuo == null)
{
MongoDBSingleton.Instance.Insert(new TimeCuoInfoCom
{
isFold = timeReq.isFold,
packingMachineNumber = timeReq.packingMachineNumber_1,
//bagNumber = timeReq.bagNumber_1+","+timeReq.bagNumber_2,
//needWeight = timeReq.needWeight_1,
realWeight = timeReq.realWeight_1,
totalWeight = timeReq.totalWeight,
batchNumber = timeReq.batchNumber,
productModel = timeReq.productModel,
isNeedTray = timeReq.isNeedTray,
//totalCount = timeReq.totalCount,
totalCount = timeReq.totalCount,
timeStamp = timeReq.timeStamp,
photoURL = timeReq.photoURL,
// ERP变更-照相机新增字段
materialCode = timeReq.materialCode,
materialName = timeReq.materialName,
measurementUnit = timeReq.measurementUnit,
createOrganization = timeReq.createOrganization,
count = timeReq.count,
WarehouseCode = timeReq.WarehouseCode,
workshopCode = timeReq.workshopCode,
BusinessDate = timeReq.BusinessDate,
barcode = timeReq.barcode,
codeRules = timeReq.codeRules,
employeeId = timeReq.employeeID1,
employeeID2 = timeReq.employeeID2,
employeeID3 = timeReq.employeeID3
});
}
else
{
var query = Query.EQ("packingMachineNumber", timeReq.packingMachineNumber_1);
UpdateBuilder update = Update.Set("isFold", timeReq.isFold).Set("totalWeight", timeReq.totalWeight)
.Set("batchNumber", timeReq.batchNumber).Set("productModel", timeReq.productModel).Set("isNeedTray", timeReq.isNeedTray)
.Set("totalCount", timeReq.totalCount).Set("timeStamp", timeReq.timeStamp).Set("photoURL", timeReq.photoURL)
.Set("materialCode", timeReq.materialCode).Set("materialName", timeReq.materialName).Set("measurementUnit", timeReq.measurementUnit)
.Set("createOrganization", timeReq.createOrganization).Set("count", timeReq.count).Set("WarehouseCode", timeReq.WarehouseCode)
.Set("workshopCode", timeReq.workshopCode).Set("BusinessDate", timeReq.BusinessDate).Set("barcode", timeReq.barcode)
.Set("codeRules", timeReq.codeRules);
MongoDBSingleton.Instance.Update(query, update, UpdateFlags.None);
}
CMMLog.Info($"获取到的时间戳接口数据:包装机号packingMachineNumber:{timeReq.packingMachineNumber_1},叠托后的实际重量totalWeight:{timeReq.totalWeight},产品批次号batchNumber:{timeReq.batchNumber}" +
$",产品型号productModel:{timeReq.productModel},totalCount:{timeReq.totalCount},timeStamp:{timeReq.timeStamp},photoURL:{timeReq.photoURL}");
#region 判断叠包层数
if (timeReq.isFold == 1 || timeReq.isFold == 2 || timeReq.isFold == 3)
{
var query = Query.EQ("packingMachineNumber", timeReq.packingMachineNumber_1);
UpdateBuilder update = null;
if (timeReq.isFold == 1) update = Update.Set("bagNumber", timeReq.bagNumber_1).Set("realWeight", (timeReq.realWeight_1 / 100).ToString().Trim());
else if (timeReq.isFold == 2) update = Update.Set("bagNumber", timeReq.bagNumber_1 + "," + timeReq.bagNumber_2);
else if (timeReq.isFold == 3) update = Update.Set("bagNumber", timeReq.bagNumber_1 + "," + timeReq.bagNumber_2 + "," + timeReq.bagNumber_3);
if (update != null)
MongoDBSingleton.Instance.Update(query, update, "TimeCuoInfoCom", UpdateFlags.None);
}
else CMMLog.Error($"isFold:{timeReq.isFold}");
#region
// if (timeReq.isFold == 1)
// MongoDBSingleton.Instance.Update(Query.EQ("packingMachineNumber", timeReq.packingMachineNumber_1), Update.Set("bagNumber", timeReq.bagNumber_1).Set("realWeight", (timeReq.realWeight_1 / 100).ToString().Trim()), UpdateFlags.None);
// else if (timeReq.isFold == 2)
// //MongoDBSingleton.Instance.Update(Query.EQ("packingMachineNumber", timeReq.packingMachineNumber_1), Update.Set("bagNumber", timeReq.bagNumber_1 + "," + timeReq.bagNumber_2).Set("realWeight", (timeReq.realWeight_1 / 100).ToString().Trim()+","+ (timeReq.realWeight_2 / 100).ToString().Trim()), UpdateFlags.None);
// MongoDBSingleton.Instance.Update(Query.EQ("packingMachineNumber", timeReq.packingMachineNumber_1), Update.Set("bagNumber", timeReq.bagNumber_1 + "," + timeReq.bagNumber_2), UpdateFlags.None);
// else if (timeReq.isFold == 3)
// //MongoDBSingleton.Instance.Update(Query.EQ("packingMachineNumber", timeReq.packingMachineNumber_1), Update.Set("bagNumber", timeReq.bagNumber_1 + "," + timeReq.bagNumber_2 + "," + timeReq.bagNumber_3).Set("realWeight", (timeReq.realWeight_1 / 100).ToString().Trim() + "," + (timeReq.realWeight_2 / 100).ToString().Trim()+","+ (timeReq.realWeight_3 / 100).ToString().Trim()), UpdateFlags.None);
// MongoDBSingleton.Instance.Update(Query.EQ("packingMachineNumber", timeReq.packingMachineNumber_1), Update.Set("bagNumber", timeReq.bagNumber_1 + "," + timeReq.bagNumber_2 + "," + timeReq.bagNumber_3), UpdateFlags.None);
// else CMMLog.Error($"isFold:{timeReq.isFold}");
#endregion
#endregion
//判断是否叠底托
deviceNo = timeReq.isNeedTray == 2 ? "7" : "10";
result = req;
}
else result = null;
}
else result = null;
CMMLog.Info($"code:{req.code},count:{req.count},info:{req.info},info:{req.msg},info:{req.status}");
}
CMMLog.Info("time over!");
}
catch(Exception ex)
{
CMMLog.Error($"TimeCuo Error:{ex.Message}");
}
return result;
}
///
/// 打包下线口到成品货架口——直接查询下线口通道内数据(四钴车间)
///
/// 时间戳
///
internal static TimeCuoInfoComTwo TimeCuoTwo(int[] result)
{
//时间戳 地址读配置文件
string FCWeightTotal = GetTrayCode(result.Skip(96).Take(2).ToArray());//总复称重量
string timeCuo = GetTrayCode(result.Skip(98).Take(2).ToArray());//时间戳
var timeCuoInfo = MongoDBSingleton.Instance.FindOne(Query.EQ("TimeCuo", timeCuo), "TimeCuoInfoComTwo");
if(timeCuoInfo == null)
{
MongoDBSingleton.Instance.Insert(new TimeCuoInfoComTwo() { TimeCuo = timeCuo,FCWeightTotal = FCWeightTotal });
}
var infoPack = MongoDBSingleton.Instance.FindOne(Query.And(Query.EQ("TimeCuo", timeCuo)), "TimeCuoInfoComTwo");
if(infoPack != null)
{
for (int i = 1; i <= 4; i++)
{
string empCode = RemoveNull(GetTrayCode(result.Skip((i - 1) * 24).Take(5).ToArray()));//员工编码
string trayCode = RemoveNull(GetTrayCode(result.Skip((i - 1) * 24 + 5).Take(3).ToArray()));//托盘码
string machineCode = RemoveNull(GetTrayCode(result.Skip((i - 1) * 24 + 8).Take(1).ToArray()));//包装机号
int needWeight = Convert.ToInt32(Completion(result[((i - 1) * 24 + 9)]) + Completion(result[((i - 1) * 24 + 10)]), 2);//产品需求重量
int oneWeight = Convert.ToInt32(Completion(result[((i - 1) * 24 + 11)]) + Completion(result[((i - 1) * 24 + 12)]), 2);//单托毛重
int readWeight = Convert.ToInt32(Completion(result[((i - 1) * 24 + 13)]) + Completion(result[((i - 1) * 24 + 14)]), 2);//单托净重
int fcWeight = Convert.ToInt32(Completion(result[((i - 1) * 24 + 15)]) + Completion(result[((i - 1) * 24 + 16)]), 2);//单托复称重量
int trayType = Convert.ToInt32(Completion(result[((i - 1) * 24 + 17)]), 2);//托盘类型
int addState = Convert.ToInt32(Completion(result[((i - 1) * 24 + 18)]), 2);//叠包层数
int bagNumber = Convert.ToInt32(Completion(result[((i - 1) * 24 + 19)]), 2);//袋号
int productTime = Convert.ToInt32(Completion(result[(i - 1) * 24 + 20]) + Completion(result[(i - 1) * 24 + 21]), 2);//生产日期
string timeCuoTwo = Convert.ToInt32(Completion(result[(i - 1) * 24 + 22]) + Completion(result[(i - 1) * 24 + 23]), 2).ToString(); //时间戳
//注意:这里赋值中间表参数请对照信息交互表具体通道值对应
//UpdateBuilder update = Update.Set("employeeId" + i.ToString(), empCode).Set("trayCode" + i.ToString(), trayCode).Set("packingMachineNumber" + i.ToString(), machineCode).Set("needWeight" + i.ToString(), needWeight)
// .Set("oneWeight" + i.ToString(), oneWeight).Set("realWeight" + i.ToString(), readWeight).Set("FCWeight" + i.ToString(), fcWeight).Set("trayType" + i.ToString(), trayType)
// .Set("isFold" + i.ToString(), addState).Set("bagNumber" + i.ToString(), bagNumber).Set("productData" + i.ToString(), productTime).Set("timeCuo" + i.ToString(), timeCuoTwo);
UpdateBuilder updateBuilder = Update.Set("employeeId" + i.ToString(), empCode).Set("trayCode" + i.ToString(), trayCode).Set("packingMachineNumber" + i.ToString(), machineCode).Set("needWeight" + i.ToString(), needWeight)
.Set("oneWeight" + i.ToString(), oneWeight).Set("realWeight" + i.ToString(), readWeight).Set("FCWeight" + i.ToString(), fcWeight).Set("trayType" + i.ToString(), trayType)
.Set("isFold" + i.ToString(), addState).Set("bagNumber" + i.ToString(), bagNumber).Set("productData" + i.ToString(), productTime).Set("timeCuo" + i.ToString(), timeCuoTwo);
MongoDBSingleton.Instance.Update(Query.EQ("TimeCuo", timeCuo), updateBuilder, UpdateFlags.None);
}
//产品批次号 产品型号 物料名称 计量单位均可在erp表中根据物料编码获取
string materialCode = RemoveNull(GetTrayCode(result.Skip(130).Take(15).ToArray()).Trim().ToString());
UpdateBuilder update = Update.Set("materialCode", materialCode);
MongoDBSingleton.Instance.Update(Query.EQ("TimeCuo", timeCuo), update, UpdateFlags.None);
}
return MongoDBSingleton.Instance.FindOne(Query.EQ("TimeCuo", timeCuo), "TimeCuoInfoComTwo");
}
public static string TransUTF8(string text)
{
//声明字符集
System.Text.Encoding utf8, gb2312;
//utf8
utf8 = System.Text.Encoding.GetEncoding("utf-8");
//gb2312
gb2312 = System.Text.Encoding.GetEncoding("gb2312");
byte[] utf;
utf = gb2312.GetBytes(text);
utf = System.Text.Encoding.Convert(gb2312, utf8, utf);
//返回转换后的字符
return utf8.GetString(utf);
}
///
/// 存放从MES接受的数据和设备通道里面读取的数据(包括转换后的数据)
///
public class MachineInfo
{
public ObjectId _id { get; set; }
///
/// mes返回的包装机号(T1,T2,......,T9)
///
public string machineNo { get; set; }
///
/// mes返回的成品批次号
///
public string lotNo { get; set; } = "0";
///
/// mes返回的袋号
///
public string bagNo { get; set; } = "0";
///
/// mes返回的产品型号
///
public string productType { get; set; } = "0";
///
/// MES返回的是否叠底托(1-不叠底托 2-叠底托)
///
public string palletLayers { get; set; } = "0";
///
/// mes返回的物料编码
///
public string materialCode { get; set; } = "0";
///
/// mes返回的叠包层数 (例1,2,3:1代表不叠包,2代表叠2层,3代表叠3层)
///
public string overlappingLayers { get; set; } = "0";
///
/// 设备通道数据3——托盘码
///
public string trayCode { get; set; } = "0";
///
/// 设备通道数据1——包装机号
///
public string location { get; set; } = "0";
///
/// 设备通道数据2——产品需求重量:32位整数
///
public string productWeight { get; set; } = "0";
///
/// 设备通道数据2——托盘重量:32位整数 ERP变更:根据最新信号协议 trayCodeWeight 变更为 【员工编号】通道
///
public string trayCodeWeight { get; set; } = "0";
///
/// 设备通道数据2——单托实际重量:32位整数
///
public string oneTrayWeight { get; set; } = "0";
///
/// 设备通道数据2——叠包后实际重量:32位整数
///
public string addWeight { get; set; } = "0";
///
/// 设备通道数据1——包装机出口称重结果:1:OK,2:NG
///
public int packNg { get; set; } = 1;
///
/// 设备通道数据1——复称口称重结果:1:OK,2:NG
///
public int secondNg { get; set; } = 1;
///
/// 设备通道数据1——是否需要叠包:1:叠包,2:不叠包
///
public int addState { get; set; } = 0;
///
/// 设备通道数据1——袋号(001,002,003…999)
///
public string packageCode { get; set; } = "0";
///
/// 设备通道数据——全16位short
///
public int[] machinedown = new int[16];
///
/// 设备通道数据——数据库JSON
///
public string jsonData { get; set; } = "0";
public string occupy { get; set; } = "1";
public DateTime modify { get; set; }
}
public class MachineInfoTwo
{
public ObjectId _id { get; set; }
///
/// mes返回的包装机号(T1,T2,......,T9)
///
public string machineNo { get; set; }
///
/// mes返回的成品批次号
///
public string lotNo { get; set; } = "0";
///
/// mes返回的袋号
///
public string bagNo { get; set; } = "0";
///
/// mes返回的产品型号
///
public string productType { get; set; } = "0";
///
/// MES返回的是否叠底托(1-不叠底托 2-叠底托)
///
public string palletLayers { get; set; } = "0";
///
/// mes返回的物料编码
///
public string materialCode { get; set; } = "0";
///
/// mes返回的叠包层数 (例1,2,3:1代表不叠包,2代表叠2层,3代表叠3层)
///
public string overlappingLayers { get; set; } = "0";
///
/// 设备通道数据3——托盘码
///
public string trayCode { get; set; } = "0";
///
/// 设备通道数据1——包装机号
///
public string location { get; set; } = "0";
///
/// 设备通道数据2——产品需求重量:32位整数
///
public string productWeight { get; set; } = "0";
///
/// 设备通道数据2——托盘重量:32位整数
///
public string trayCodeWeight { get; set; } = "0";
///
/// 设备通道数据2——单托实际重量:32位整数
///
public string oneTrayWeight { get; set; } = "0";
///
/// 设备通道数据2——叠包后实际重量:32位整数
///
public string addWeight { get; set; } = "0";
///
/// 设备通道数据1——包装机出口称重结果:1:OK,2:NG
///
public int packNg { get; set; } = 1;
///
/// 设备通道数据1——复称口称重结果:1:OK,2:NG
///
public int secondNg { get; set; } = 1;
///
/// 设备通道数据1——是否需要叠包:1:叠包,2:不叠包
///
public int addState { get; set; } = 0;
///
/// 设备通道数据1——袋号(001,002,003…999)
///
public string packageCode { get; set; } = "0";
///
/// 设备通道数据——全16位short
///
public int[] machinedown = new int[16];
///
/// 设备通道数据——数据库JSON
///
public string jsonData { get; set; } = "0";
public string occupy { get; set; } = "1";
public DateTime modify { get; set; }
}
///
/// 存放从MES接受的数据和设备通道里面读取的数据(包括转换后的数据)
///
public class MachineInfoTetracobalt
{
public ObjectId _id { get; set; }
///
/// 员工编码
///
public string empCode { get; set; }
///
/// mes返回的包装机号(T1,T2,......,T9)
///
public string machineNo { get; set; }
///
/// mes返回的成品批次号
///
public string lotNo { get; set; } = "0";
///
/// mes返回的袋号
///
public string bagNo { get; set; } = "0";
///
/// mes返回的产品型号
///
public string productType { get; set; } = "0";
///
/// MES返回的是否叠底托(1-不叠底托 2-叠底托)
///
public string palletLayers { get; set; } = "0";
///
/// mes返回的物料编码
///
public string materialCode { get; set; } = "0";
///
/// MES返回的物料名称
///
public string materialName { get; set; } = "0";
///
/// mes返回的计量单位
///
public string measurementUnit { get; set; } = "0";
///
/// mes返回的叠包层数 (例1,2,3:1代表不叠包,2代表叠2层,3代表叠3层)
///
public string overlappingLayers { get; set; } = "0";
///
/// 设备通道数据3——托盘码
///
public string trayCode { get; set; } = "0";
///
/// 设备通道数据1——包装机号
///
public string location { get; set; } = "0";
///
/// 设备通道数据2——产品需求重量:32位整数
///
public string productWeight { get; set; } = "0";
///
/// 设备通道数据2——单托毛重
///
public string trayCodeWeight { get; set; } = "0";
///
/// 设备通道数据2——单托实际重量:32位整数
///
public string oneTrayWeight { get; set; } = "0";
///
/// 设备通道数据2——托盘类型:32位整数
///
public string trayType { get; set; } = "0";
///
/// 设备通道数据2——叠包后实际重量:32位整数
///
public string addWeight { get; set; } = "0";
///
/// 设备通道数据1——包装机出口称重结果:1:OK,2:NG
///
public int packNg { get; set; } = 1;
///
/// 设备通道数据1——复称口称重结果:1:OK,2:NG
///
public int secondNg { get; set; } = 1;
///
/// 设备通道数据1——是否需要叠包:1:叠包,2:不叠包
///
public int addState { get; set; } = 0;
///
/// 设备通道数据1——袋号(001,002,003…999)
///
public string packageCode { get; set; } = "0";
///
/// 设备通道数据1——生产日期
///
public string productTime { get; set; } = "0";
///
/// 设备通道数据——全16位short
///
public int[] machinedown = new int[22];
///
/// 设备通道数据——数据库JSON
///
public string jsonData { get; set; } = "0";
public string occupy { get; set; } = "1";
public DateTime modify { get; set; }
}
public class MachineInfoTwoTetracobalt
{
public ObjectId _id { get; set; }
///
/// 员工编码
///
public string empCode { get; set; }
///
/// mes返回的包装机号(T1,T2,......,T9)
///
public string machineNo { get; set; }
///
/// mes返回的成品批次号
///
public string lotNo { get; set; } = "0";
///
/// mes返回的袋号
///
public string bagNo { get; set; } = "0";
///
/// mes返回的产品型号
///
public string productType { get; set; } = "0";
///
/// MES返回的是否叠底托(1-不叠底托 2-叠底托)
///
public string palletLayers { get; set; } = "0";
///
/// mes返回的物料编码
///
public string materialCode { get; set; } = "0";
///
/// MES返回的物料名称
///
public string materialName { get; set; } = "0";
///
/// mes返回的计量单位
///
public string measurementUnit { get; set; } = "0";
///
/// mes返回的叠包层数 (例1,2,3:1代表不叠包,2代表叠2层,3代表叠3层)
///
public string overlappingLayers { get; set; } = "0";
///
/// 设备通道数据3——托盘码
///
public string trayCode { get; set; } = "0";
///
/// 设备通道数据1——包装机号
///
public string location { get; set; } = "0";
///
/// 设备通道数据2——产品需求重量:32位整数
///
public string productWeight { get; set; } = "0";
///
/// 设备通道数据2——单托毛重
///
public string trayCodeWeight { get; set; } = "0";
///
/// 设备通道数据2——单托实际重量:32位整数
///
public string oneTrayWeight { get; set; } = "0";
///
/// 设备通道数据2——复称毛重:32位整数
///
public string oneTrayWeightFC { get; set; } = "0,0";
///
/// 设备通道数据2——托盘类型:32位整数
///
public string trayType { get; set; } = "0";
///
/// 设备通道数据2——叠包后实际重量:32位整数
///
public string addWeight { get; set; } = "0";
///
/// 设备通道数据1——包装机出口称重结果:1:OK,2:NG
///
public int packNg { get; set; } = 1;
///
/// 设备通道数据1——复称口称重结果:1:OK,2:NG
///
public int secondNg { get; set; } = 1;
///
/// 设备通道数据1——是否需要叠包:1:叠包,2:不叠包
///
public int addState { get; set; } = 0;
///
/// 设备通道数据1——袋号(001,002,003…999)
///
public string packageCode { get; set; } = "0";
///
/// 设备通道数据1——生产日期
///
public string productTime { get; set; } = "0";
///
/// 设备通道数据——全16位short
///
public int[] machinedown = new int[22];
///
/// 设备通道数据——数据库JSON
///
public string jsonData { get; set; } = "0";
public string occupy { get; set; } = "1";
public DateTime modify { get; set; }
}
public class MachineInfoCache
{
///
/// mes返回的包装机号(T1,T2,......,T9)
///
public string machineNo { get; set; }
///
/// mes返回的成品批次号
///
public string lotNo { get; set; }
///
/// mes返回的袋号
///
public string bagNo { get; set; }
///
/// mes返回的产品型号
///
public string productType { get; set; }
///
/// mes返回的是否叠底托信号
///
public string palletLayers { get; set; }
///
/// mes返回的物料编码
///
public string materialCode { get; set; }
///
/// mes返回的叠包层数 (例1,2,3:1代表不叠包,2代表叠2层,3代表叠3层)
///
public string overlappingLayers { get; set; }
}
///
/// 时间戳——调用照相机设备获取的返回信息
///
public class TimeChuoInfo
{
public int code { get; set; }
public int count { get; set; }
public string info { get; set; }
public string msg { get; set; }
public int status { get; set; }
public List data { get; set; }
public class TimeCuoInfo
{
public int isFold { get; set; }
///
/// 员工编号1
///
public string employeeID1 { get; set; }
///
/// 员工编号2
///
public string employeeID2 { get; set; }
///
/// 员工编号3
///
public string employeeID3 { get; set; }
public string packingMachineNumber_1 { get; set; }
public string bagNumber_1 { get; set; }
public int needWeight_1 { get; set; }
public int realWeight_1 { get; set; }
public string packingMachineNumber_2 { get; set; }
public string bagNumber_2 { get; set; }
public int needWeight_2 { get; set; }
public int realWeight_2 { get; set; }
public string packingMachineNumber_3 { get; set; }
public string bagNumber_3 { get; set; }
public int needWeight_3 { get; set; }
public int realWeight_3 { get; set; }
public int totalWeight { get; set; }
public string batchNumber { get; set; }
public string productModel { get; set; }
public int totalCount { get; set; }
public int timeStamp { get; set; }
public string photoURL { get; set; }
///
/// 是否叠底托(ERP变更功能之后不再使用此字段)
///
public int isNeedTray { get; set; }
///
/// 物料编码
///
public string materialCode { get; set; } = "1";
///
/// 物料名称
///
public string materialName { get; set; }
///
/// 计量单位
///
public string measurementUnit { get; set; }
///
/// 创建组织
///
public string createOrganization { get; set; }
///
/// 数量
///
public int count { get; set; }
///
/// 仓库编码
///
public string WarehouseCode { get; set; }
///
/// 车间编码
///
public string workshopCode { get; set; }
///
/// 业务日期
///
public string BusinessDate { get; set; }
///
/// 条形码
///
public string barcode { get; set; }
///
/// 条码规则
///
public string codeRules { get; set; }
}
}
public class TimeCuoInfoCom
{
public ObjectId _id { get; set; }
///
/// 是否叠包(1,2,3)
///
public int isFold { get; set; }
///
/// 包装机号
///
public string packingMachineNumber{ get; set; }
///
/// 袋号(001,002,003…999)1
///
public string bagNumber { get; set; }
///
/// 产品需求重量1:32位整数
///
public int needWeight { get; set; }
///
/// 单托实际重量1:32位整数
///
public int realWeight { get; set; }
///
/// 叠托后的实际重量:32位整数
///
public int totalWeight { get; set; }
///
/// 产品批次号
///
public string batchNumber { get; set; }
///
/// 产品型号
///
public string productModel { get; set; }
///
/// 是否叠底托(1-不叠底托 2-叠底托)
///
public int isNeedTray { get; set; }
///
/// 计数(只在数据库)
///
public int totalCount { get; set; }
///
/// 时间戳
///
public int timeStamp { get; set; }
///
/// 照片url
///
public string photoURL { get; set; }
///
/// 物料编码
///
public string materialCode { get; set; }
///
/// 物料名称
///
public string materialName { get; set; }
///
/// 计量单位
///
public string measurementUnit { get; set; }
///
/// 创建组织
///
public string createOrganization { get; set; }
///
/// 数量
///
public int count { get; set; }
///
/// 仓库编码
///
public string WarehouseCode { get; set; }
///
/// 车间编码
///
public string workshopCode { get; set; }
///
/// 业务日期
///
public string BusinessDate { get; set; }
///
/// 条形码
///
public string barcode { get; set; }
///
/// 条码规则
///
public string codeRules { get; set; }
///
/// 员工编号
///
public string employeeId { get; set; }
///
/// 员工编号2
///
public string employeeID2 { get; set; }
///
/// 员工编号3
///
public string employeeID3 { get; set; }
}
public class TimeCuoInfoTwo
{
public ObjectId _id { get; set; }
///
/// 员工编号1
///
public string employeeId1 { get; set; }
///
/// 托盘码1
///
public string trayCode1 { get; set; }
///
/// 包装机号1
///
public string packingMachineNumber1 { get; set; }
///
/// 产品需求重量1:32位整数
///
public int needWeight1 { get; set; }
///
/// 单托毛重1:32位整数
///
public int oneWeight1 { get; set; }
///
/// 单托实际重量1:32位整数
///
public int realWeight1 { get; set; }
///
/// 单托复称重量1:32位整数
///
public int FCWeight1 { get; set; }
///
/// 托盘类型1
///
public string trayType1 { get; set; }
///
/// 叠包层数1
///
public int isFold1 { get; set; }
///
/// 本批次内袋号:(1,2,3……10) 整数1
///
public int bagNumber1 { get; set; }
///
/// 生产日期(32位整数)1
///
public string productData1 { get; set; }
///
/// 单包下料时间戳
///
public string timeCuo1 { get; set; }
///
/// 员工编号2
///
public string employeeId2 { get; set; }
///
/// 托盘码2
///
public string trayCode2 { get; set; }
///
/// 包装机号2
///
public string packingMachineNumber2 { get; set; }
///
/// 产品需求重量2:32位整数
///
public int needWeight2 { get; set; }
///
/// 单托毛重2:32位整数
///
public int oneWeight2 { get; set; }
///
/// 单托实际重量2:32位整数
///
public int realWeight2 { get; set; }
///
/// 单托复称重量2:32位整数
///
public int FCWeight2 { get; set; }
///
/// 托盘类型2
///
public string trayType2 { get; set; }
///
/// 叠包层数2
///
public int isFold2 { get; set; }
///
/// 本批次内袋号:(1,2,3……20) 整数2
///
public int bagNumber2 { get; set; }
///
/// 生产日期(32位整数)2
///
public string productData2 { get; set; }
///
/// 单包下料时间戳
///
public string timeCuo2 { get; set; }
///
/// 员工编号3
///
public string employeeId3 { get; set; }
///
/// 托盘码3
///
public string trayCode3 { get; set; }
///
/// 包装机号3
///
public string packingMachineNumber3 { get; set; }
///
/// 产品需求重量3:33位整数
///
public int needWeight3 { get; set; }
///
/// 单托毛重3:32位整数
///
public int oneWeight3 { get; set; }
///
/// 单托实际重量3:32位整数
///
public int realWeight3 { get; set; }
///
/// 单托复称重量3:32位整数
///
public int FCWeight3 { get; set; }
///
/// 托盘类型3
///
public string trayType3 { get; set; }
///
/// 叠包层数3
///
public int isFold3 { get; set; }
///
/// 本批次内袋号:(1,2,3……30) 整数3
///
public int bagNumber3 { get; set; }
///
/// 生产日期(32位整数)3
///
public string productData3 { get; set; }
///
/// 单包下料时间戳
///
public string timeCuo3 { get; set; }
///
/// 员工编号4
///
public string employeeId4 { get; set; }
///
/// 托盘码4
///
public string trayCode4 { get; set; }
///
/// 包装机号4
///
public string packingMachineNumber4 { get; set; }
///
/// 产品需求重量4:32位整数
///
public int needWeight4 { get; set; }
///
/// 单托毛重4:32位整数
///
public int oneWeight4 { get; set; }
///
/// 单托实际重量4:32位整数
///
public int realWeight4 { get; set; }
///
/// 单托复称重量4:32位整数
///
public int FCWeight4 { get; set; }
///
/// 托盘类型4
///
public string trayType4 { get; set; }
///
/// 叠包层数4
///
public int isFold4 { get; set; }
///
/// 本批次内袋号:(1,2,3……40) 整数4
///
public int bagNumber4 { get; set; }
///
/// 生产日期(32位整数)4
///
public string productData4 { get; set; }
///
/// 单包下料时间戳
///
public string timeCuo4 { get; set; }
///
/// 复称总重量
///
public string FCWeightTotal { get; set; }
///
/// 时间戳
///
public string TimeCuo { get; set; }
///
/// 批次号
///
public string lotNo { get; set; }
///
/// 产品型号
///
public string productModel { get; set; }
///
/// 物料编码
///
public string materialCode { get; set; }
///
/// 物料名称
///
public string materialName { get; set; }
///
/// 计量单位
///
public string measurementUnit { get; set; }
}
///
/// 四钴车间存储下线口物料信息
///
public class TimeCuoInfoComTwo
{
public ObjectId _id { get; set; }
///
/// 员工编号1
///
public string employeeId1 { get; set; }
///
/// 托盘码1
///
public string trayCode1 { get; set; }
///
/// 包装机号1
///
public string packingMachineNumber1 { get; set; }
///
/// 产品需求重量1:32位整数
///
public int needWeight1 { get; set; }
///
/// 单托毛重1:32位整数
///
public int oneWeight1 { get; set; }
///
/// 单托实际重量1:32位整数
///
public int realWeight1 { get; set; }
///
/// 单托复称重量1:32位整数
///
public int FCWeight1 { get; set; }
///
/// 托盘类型1
///
public string trayType1 { get; set; }
///
/// 叠包层数1
///
public int isFold1 { get; set; }
///
/// 本批次内袋号:(1,2,3……10) 整数1
///
public int bagNumber1 { get; set; }
///
/// 生产日期(32位整数)1
///
public string productData1 { get; set; }
///
/// 单包下料时间戳
///
public string timeCuo1 { get; set; }
///
/// 员工编号2
///
public string employeeId2 { get; set; }
///
/// 托盘码2
///
public string trayCode2 { get; set; }
///
/// 包装机号2
///
public string packingMachineNumber2 { get; set; }
///
/// 产品需求重量2:32位整数
///
public int needWeight2 { get; set; }
///
/// 单托毛重2:32位整数
///
public int oneWeight2 { get; set; }
///
/// 单托实际重量2:32位整数
///
public int realWeight2 { get; set; }
///
/// 单托复称重量2:32位整数
///
public int FCWeight2 { get; set; }
///
/// 托盘类型2
///
public string trayType2 { get; set; }
///
/// 叠包层数2
///
public int isFold2 { get; set; }
///
/// 本批次内袋号:(1,2,3……20) 整数2
///
public int bagNumber2 { get; set; }
///
/// 生产日期(32位整数)2
///
public string productData2 { get; set; }
///
/// 单包下料时间戳
///
public string timeCuo2 { get; set; }
///
/// 员工编号3
///
public string employeeId3 { get; set; }
///
/// 托盘码3
///
public string trayCode3 { get; set; }
///
/// 包装机号3
///
public string packingMachineNumber3 { get; set; }
///
/// 产品需求重量3:33位整数
///
public int needWeight3 { get; set; }
///
/// 单托毛重3:32位整数
///
public int oneWeight3 { get; set; }
///
/// 单托实际重量3:32位整数
///
public int realWeight3 { get; set; }
///
/// 单托复称重量3:32位整数
///
public int FCWeight3 { get; set; }
///
/// 托盘类型3
///
public string trayType3 { get; set; }
///
/// 叠包层数3
///
public int isFold3 { get; set; }
///
/// 本批次内袋号:(1,2,3……30) 整数3
///
public int bagNumber3 { get; set; }
///
/// 生产日期(32位整数)3
///
public string productData3 { get; set; }
///
/// 单包下料时间戳
///
public string timeCuo3 { get; set; }
///
/// 员工编号4
///
public string employeeId4 { get; set; }
///
/// 托盘码4
///
public string trayCode4 { get; set; }
///
/// 包装机号4
///
public string packingMachineNumber4 { get; set; }
///
/// 产品需求重量4:32位整数
///
public int needWeight4 { get; set; }
///
/// 单托毛重4:32位整数
///
public int oneWeight4 { get; set; }
///
/// 单托实际重量4:32位整数
///
public int realWeight4 { get; set; }
///
/// 单托复称重量4:32位整数
///
public int FCWeight4 { get; set; }
///
/// 托盘类型4
///
public string trayType4 { get; set; }
///
/// 叠包层数4
///
public int isFold4 { get; set; }
///
/// 本批次内袋号:(1,2,3……40) 整数4
///
public int bagNumber4 { get; set; }
///
/// 生产日期(32位整数)4
///
public string productData4 { get; set; }
///
/// 单包下料时间戳
///
public string timeCuo4 { get; set; }
///
/// 复称总重量
///
public string FCWeightTotal { get; set; }
///
/// 时间戳
///
public string TimeCuo { get; set; }
///
/// 批次号
///
public string lotNo { get; set; }
///
/// 产品型号
///
public string productModel { get; set; }
///
/// 物料编码
///
public string materialCode { get; set; }
///
/// 物料名称
///
public string materialName { get; set; }
///
/// 计量单位
///
public string measurementUnit { get; set; }
}
///
/// 物料表
///
public class T_JY_MATERIALSync
{
///
/// 流水号
///
public int FID { get; set; }
///
/// 名称
///
public string FName { get; set; }
///
/// 编码
///
public string FNumber { get; set; }
///
/// 规格型号
///
public string FSpecification { get; set; }
///
/// 使用组织编码
///
public string FUseOrgNumber { get; set; }
///
/// 车间名称
///
public string FWorkShopNumber { get; set; }
///
/// 保质期
///
public int FExpPeriod { get; set; }
///
/// 保质期单位
///
public string FExpUnit { get; set; }
///
/// 库存单位
///
public string FStoreUnit { get; set; }
///
/// 物料分组名称
///
public string FMaterialGroupName { get; set; }
///
/// 物料分组编码
///
public string FMaterialGroupNumber { get; set; }
}
///
/// 员工表
///
public class T_JY_EMPINFOSync
{
///
/// 流水号
///
public int FID { get; set; }
///
/// 编码
///
public string FNumber { get; set; }
///
/// 名称
///
public string FName { get; set; }
///
/// 员工编号
///
public string FStaffNumber { get; set; }
}
public class trayTypeTable
{
public ObjectId _id { get; set; }
///
/// 货位编码
///
public string locCode { get; set; }
///
/// 托盘类型
///
public string trayType { get; set; }
}
public class STOCK_LOCATION_Two
{
public ObjectId _id { get; set; }
public string CN_S_LOCATION_CODE { get; set; }
public int CN_N_AGV_LOCATION { get; set; }
}
}
}