예제 #1
0
파일: MES.cs 프로젝트: jtzhang163/TengDa
        /// <summary>
        /// 入炉数据上传
        /// </summary>
        /// <param name="clamps"></param>
        /// <returns></returns>
        public static async System.Threading.Tasks.Task UploadInOvenAsync(List <Clamp> clamps)
        {
            for (int i = 0; i < clamps.Count; i++)
            {
                try
                {
                    bool isClampUploadSuccess = true;
                    var  clamp   = clamps[i];
                    var  station = Station.StationList.FirstOrDefault(s => s.Id == clamp.OvenStationId);

                    if (station != null)
                    {
                        var floor = station.GetFloor();
                        var oven  = floor.GetOven();

                        foreach (var battery in clamp.Batteries)
                        {
                            var uploadDatas = new List <UploadData>();

                            var uploadData = new UploadData();

                            uploadData.batch_number   = battery.Code.Split('-')[0];
                            uploadData.parameter_flag = "0";
                            uploadData.device_status  = "0";
                            uploadData.collector_time = clamp.InOvenTime.ToString("yyyy-MM-dd HH:mm:ss");

                            uploadData.materialCodeInfo = new List <MaterialCodeInfo>();
                            uploadData.materialCodeInfo.Add(new MaterialCodeInfo()
                            {
                                materialCodeName = "电芯编号",
                                materialCode     = battery.Code
                            });

                            uploadData.deviceCodeInfo = new List <DeviceCodeInfo>();
                            uploadData.deviceCodeInfo.Add(new DeviceCodeInfo()
                            {
                                deviceCodeName = "机台号",
                                deviceCode     = oven.Number
                            });
                            uploadData.deviceCodeInfo.Add(new DeviceCodeInfo()
                            {
                                deviceCodeName = "烤箱编号",
                                deviceCode     = station.Number
                            });
                            uploadData.deviceCodeInfo.Add(new DeviceCodeInfo()
                            {
                                deviceCodeName = "料框编号",
                                deviceCode     = clamp.Code
                            });

                            uploadData.deviceParamData = new List <DeviceParamData>();

                            uploadData.deviceParamData.Add(new DeviceParamData
                            {
                                parameter_name  = "工艺温度",
                                parameter_unit  = "℃",
                                parameter_value = clamp.ProcessTemperSet.ToString()
                            });

                            for (int k = 0; k < Option.TemperatureSetPointCount; k++)
                            {
                                uploadData.deviceParamData.Add(new DeviceParamData
                                {
                                    parameter_name  = Current.option.TemperSetNames[k],
                                    parameter_unit  = "℃",
                                    parameter_value = clamp.TsSet[k].ToString()
                                });
                            }

                            uploadData.deviceParamData.Add(new DeviceParamData
                            {
                                parameter_name  = "真空度设定值",
                                parameter_unit  = "Pa",
                                parameter_value = clamp.VacuumSet.ToString()
                            });

                            uploadData.deviceParamData.Add(new DeviceParamData
                            {
                                parameter_name  = "热风循环温度",
                                parameter_unit  = "℃",
                                parameter_value = clamp.YunFengTSet.ToString()
                            });

                            uploadData.deviceParamData.Add(new DeviceParamData
                            {
                                parameter_name  = "进烤箱时间",
                                parameter_unit  = "",
                                parameter_value = clamp.InOvenTime.ToString("yyyy-MM-dd HH:mm:ss")
                            });

                            uploadData.deviceParamData.Add(new DeviceParamData
                            {
                                parameter_name  = "预热时间设置",
                                parameter_unit  = "min",
                                parameter_value = clamp.PreheatTimeSet.ToString()
                            });

                            uploadData.deviceParamData.Add(new DeviceParamData
                            {
                                parameter_name  = "烘烤时间设置",
                                parameter_unit  = "min",
                                parameter_value = clamp.BakingTimeSet.ToString()
                            });

                            uploadData.deviceParamData.Add(new DeviceParamData
                            {
                                parameter_name  = "一段呼吸周期设置",
                                parameter_unit  = "min",
                                parameter_value = clamp.BreathingCycleSet1.ToString()
                            });

                            uploadData.deviceParamData.Add(new DeviceParamData
                            {
                                parameter_name  = "二段呼吸周期设置",
                                parameter_unit  = "min",
                                parameter_value = clamp.BreathingCycleSet2.ToString()
                            });

                            uploadDatas.Add(uploadData);
                            if (await UploadAsync(uploadDatas))
                            {
                                LogHelper.WriteInfo("上传MES成功 UploadInOvenAsync battery.Id: " + battery.Id);
                            }
                            else
                            {
                                isClampUploadSuccess = false;
                                break;
                            }
                        }
                    }

                    if (isClampUploadSuccess)
                    {
                        clamp.IsInUploaded = true;
                    }
                }
                catch (Exception ex)
                {
                    LogHelper.WriteError("上传MES出现错误,方法:UploadInOvenAsync 原因:" + ex.ToString());
                }
            }
        }
예제 #2
0
파일: MES.cs 프로젝트: jtzhang163/TengDa
        /// <summary>
        /// 出炉数据上传
        /// </summary>
        /// <param name="clamps"></param>
        /// <returns></returns>
        public static async System.Threading.Tasks.Task UploadOutOvenAsync(List <Clamp> clamps)
        {
            for (int i = 0; i < clamps.Count; i++)
            {
                try
                {
                    bool isClampUploadSuccess = true;

                    var clamp   = clamps[i];
                    var station = Station.StationList.FirstOrDefault(s => s.Id == clamp.OvenStationId);

                    if (station != null)
                    {
                        var floor = station.GetFloor();
                        var oven  = floor.GetOven();

                        foreach (var battery in clamp.Batteries)
                        {
                            var uploadDatas = new List <UploadData>();

                            var uploadData = new UploadData();

                            uploadData.batch_number   = battery.Code.Split('-')[0];
                            uploadData.parameter_flag = "0";
                            uploadData.device_status  = "0";
                            uploadData.collector_time = clamp.OutOvenTime.ToString("yyyy-MM-dd HH:mm:ss");

                            uploadData.materialCodeInfo = new List <MaterialCodeInfo>();
                            uploadData.materialCodeInfo.Add(new MaterialCodeInfo()
                            {
                                materialCodeName = "电芯编号",
                                materialCode     = battery.Code
                            });

                            uploadData.deviceCodeInfo = new List <DeviceCodeInfo>();
                            uploadData.deviceCodeInfo.Add(new DeviceCodeInfo()
                            {
                                deviceCodeName = "机台号",
                                deviceCode     = oven.Number
                            });
                            uploadData.deviceCodeInfo.Add(new DeviceCodeInfo()
                            {
                                deviceCodeName = "烤箱编号",
                                deviceCode     = station.Number
                            });
                            uploadData.deviceCodeInfo.Add(new DeviceCodeInfo()
                            {
                                deviceCodeName = "料框编号",
                                deviceCode     = clamp.Code
                            });

                            uploadData.deviceParamData = new List <DeviceParamData>();
                            uploadData.deviceParamData.Add(new DeviceParamData
                            {
                                parameter_name  = "出烤箱时间",
                                parameter_unit  = "",
                                parameter_value = clamp.OutOvenTime.ToString("yyyy-MM-dd HH:mm:ss")
                            });

                            if (clamp.WaterContent1 > 0f || clamp.WaterContent2 > 0f || clamp.WaterContent3 > 0f)
                            {
                                uploadData.deviceParamData.Add(new DeviceParamData
                                {
                                    parameter_name  = "水分测试正极标准值",
                                    parameter_unit  = "PPM",
                                    parameter_value = Current.option.WaterContentStandard1.ToString("#.00")
                                });
                                uploadData.deviceParamData.Add(new DeviceParamData
                                {
                                    parameter_name  = "水分测试正极实际值",
                                    parameter_unit  = "PPM",
                                    parameter_value = clamp.WaterContent1.ToString("#.00")
                                });
                                uploadData.deviceParamData.Add(new DeviceParamData
                                {
                                    parameter_name  = "水分测试负极标准值",
                                    parameter_unit  = "PPM",
                                    parameter_value = Current.option.WaterContentStandard2.ToString("#.00")
                                });
                                uploadData.deviceParamData.Add(new DeviceParamData
                                {
                                    parameter_name  = "水分测试负极实际值",
                                    parameter_unit  = "PPM",
                                    parameter_value = clamp.WaterContent2.ToString("#.00")
                                });
                                uploadData.deviceParamData.Add(new DeviceParamData
                                {
                                    parameter_name  = "水分测试混合标准值",
                                    parameter_unit  = "PPM",
                                    parameter_value = Current.option.WaterContentStandard3.ToString("#.00")
                                });
                                uploadData.deviceParamData.Add(new DeviceParamData
                                {
                                    parameter_name  = "水分测试混合实际值",
                                    parameter_unit  = "PPM",
                                    parameter_value = clamp.WaterContent3.ToString("#.00")
                                });
                            }

                            uploadDatas.Add(uploadData);
                            if (await UploadAsync(uploadDatas))
                            {
                                LogHelper.WriteInfo("上传MES成功 UploadOutOvenAsync battery.Id: " + battery.Id);
                            }
                            else
                            {
                                isClampUploadSuccess = false;
                                break;
                            }
                        }
                    }
                    if (isClampUploadSuccess)
                    {
                        clamp.IsOutUploaded = true;
                    }
                }
                catch (Exception ex)
                {
                    LogHelper.WriteError("上传MES出现错误,方法:UploadOutOvenAsync 原因:" + ex.ToString());
                }
            }
        }
예제 #3
0
파일: MES.cs 프로젝트: jtzhang163/TengDa
        /// <summary>
        /// 上传真空温度数据
        /// </summary>
        /// <param name="uploadTVDs"></param>
        /// <returns></returns>
        public static async System.Threading.Tasks.Task UploadTvdInfoAsync(List <UploadTVD> uploadTVDs)
        {
            for (int i = 0; i < uploadTVDs.Count; i++)
            {
                try
                {
                    bool isClampUploadSuccess = true;

                    var uploadTVD = uploadTVDs[i];
                    var clamp     = new Clamp(uploadTVD.ClampId);
                    var station   = Station.StationList.FirstOrDefault(s => s.Id == clamp.OvenStationId);
                    if (station != null)
                    {
                        var floor = station.GetFloor();
                        var oven  = floor.GetOven();

                        if (clamp.Batteries.Count > 0)
                        {
                            var battery = clamp.Batteries[0];

                            var uploadDatas = new List <UploadData>();
                            var uploadData  = new UploadData();

                            uploadData.batch_number   = battery.Code.Split('-')[0];
                            uploadData.parameter_flag = uploadTVD.ParameterFlag.ToString();
                            uploadData.device_status  = uploadTVD.DeviceStatus.ToString();
                            uploadData.collector_time = uploadTVD.CollectorTime.ToString("yyyy-MM-dd HH:mm:ss");

                            uploadData.materialCodeInfo = new List <MaterialCodeInfo>();
                            uploadData.materialCodeInfo.Add(new MaterialCodeInfo()
                            {
                                materialCodeName = "电芯编号",
                                materialCode     = battery.Code
                            });

                            uploadData.deviceCodeInfo = new List <DeviceCodeInfo>();
                            uploadData.deviceCodeInfo.Add(new DeviceCodeInfo()
                            {
                                deviceCodeName = "机台号",
                                deviceCode     = oven.Number
                            });
                            uploadData.deviceCodeInfo.Add(new DeviceCodeInfo()
                            {
                                deviceCodeName = "烤箱编号",
                                deviceCode     = station.Number
                            });
                            uploadData.deviceCodeInfo.Add(new DeviceCodeInfo()
                            {
                                deviceCodeName = "料框编号",
                                deviceCode     = clamp.Code
                            });

                            uploadData.deviceParamData = new List <DeviceParamData>();
                            for (int k = 0; k < Option.TemperaturePointCount; k++)
                            {
                                uploadData.deviceParamData.Add(new DeviceParamData
                                {
                                    parameter_name  = Current.option.TemperNames[k] + "实际值",
                                    parameter_unit  = "℃",
                                    parameter_value = uploadTVD.T[k].ToString()
                                });
                            }

                            uploadData.deviceParamData.Add(new DeviceParamData
                            {
                                parameter_name  = "真空度实际值",
                                parameter_unit  = "Pa",
                                parameter_value = uploadTVD.V1.ToString()
                            });

                            uploadDatas.Add(uploadData);
                            if (await UploadAsync(uploadDatas))
                            {
                                //LogHelper.WriteInfo("上传MES成功 UploadTvdInfoAsync  battery.Id: " + battery.Id + " uploadData.collector_time:" + uploadData.collector_time);
                            }
                            else
                            {
                                isClampUploadSuccess = false;
                                break;
                            }
                        }
                    }

                    if (isClampUploadSuccess)
                    {
                        LogHelper.WriteInfo("上传MES成功 UploadTvdInfoAsync  uploadTVD.Id: " + uploadTVD.Id);
                        uploadTVD.IsUploaded = true;
                    }
                }
                catch (Exception ex)
                {
                    LogHelper.WriteError("上传MES出现错误,方法:UploadTvdInfoAsync 原因:" + ex.ToString());
                }
            }
        }