diff --git a/HighWayIot.Repository/HighWayIot.Repository.csproj b/HighWayIot.Repository/HighWayIot.Repository.csproj index 7ad1940..528eac3 100644 --- a/HighWayIot.Repository/HighWayIot.Repository.csproj +++ b/HighWayIot.Repository/HighWayIot.Repository.csproj @@ -58,10 +58,10 @@ - + @@ -72,6 +72,7 @@ + @@ -79,7 +80,6 @@ - diff --git a/HighWayIot.Repository/domain/ZxCarParaEntity.cs b/HighWayIot.Repository/domain/ZxCarParaEntity.cs deleted file mode 100644 index 95ea6b2..0000000 --- a/HighWayIot.Repository/domain/ZxCarParaEntity.cs +++ /dev/null @@ -1,256 +0,0 @@ -using SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HighWayIot.Repository.domain -{ - /// - /// 小车参数 - /// - [SugarTable("zx_car_para")] - public class ZxCarParaEntity - { - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)] - public int Id { get; set; } - - /// - /// 备 注: - /// 默认值: 设备编号 - /// - [SugarColumn(ColumnName = "device_no")] - public int Device_no { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p01")] - public bool? P01 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p02")] - public bool? P02 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p03")] - public bool? P03 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p04")] - public bool? P04 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p05")] - public bool? P05 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p06")] - public bool? P06 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p07")] - public bool? P07 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p08")] - public bool? P08 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p09")] - public bool? P09 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p10")] - public bool? P10 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p11")] - public bool? P11 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p12")] - public bool? P12 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p13")] - public bool? P13 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p14")] - public bool? P14 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p15")] - public bool? P15 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p16")] - public bool? P16 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p17")] - public bool? P17 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p18")] - public bool? P18 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p19")] - public bool? P19 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p20")] - public bool? P20 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p21")] - public bool? P21 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p22")] - public bool? P22 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p23")] - public bool? P23 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p24")] - public bool? P24 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p25")] - public bool? P25 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p26")] - public bool? P26 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p27")] - public bool? P27 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p28")] - public bool? P28 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p29")] - public bool? P29 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p30")] - public bool? P30 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p31")] - public bool? P31 { get; set; } - - /// - /// 备 注: - /// 默认值: - /// - [SugarColumn(ColumnName = "p32")] - public bool? P32 { get; set; } - - - } -} diff --git a/HighWayIot.Repository/domain/ZxMesPlanTransferEntity.cs b/HighWayIot.Repository/domain/ZxMesPlanTransferEntity.cs new file mode 100644 index 0000000..632729d --- /dev/null +++ b/HighWayIot.Repository/domain/ZxMesPlanTransferEntity.cs @@ -0,0 +1,165 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using SqlSugar; +namespace HighWayIot.Repository.domain +{ + /// + /// + /// + [SugarTable("zx_mes_plan_transfer")] + public class ZxMesPlanTransferEntity + { + + + /// + /// 备 注:主键 + /// 默认值: + /// + [SugarColumn(ColumnName = "uuid", IsPrimaryKey = true)] + public string Uuid { get; set; } + + /// + /// 备 注:同步标记 + /// 默认值: + /// + [SugarColumn(ColumnName = "request_flag")] + public bool? RequestFlag { get; set; } + + /// + /// 备 注:标称尺度 + /// 默认值: + /// + [SugarColumn(ColumnName = "recipe_name")] + public string RecipeName { get; set; } = string.Empty; + + /// + /// 备 注:SPEC名称 + /// 默认值: + /// + [SugarColumn(ColumnName = "spec_name")] + public string SpecName { get; set; } = string.Empty; + + /// + /// 备 注:SPEC编号 + /// 默认值: + /// + [SugarColumn(ColumnName = "spec_code")] + public string SpecCode { get; set; } = string.Empty; + + /// + /// 备 注:钢圈尺寸 + /// 默认值: + /// + [SugarColumn(ColumnName = "rim_inch")] + public int? RimInch { get; set; } + + /// + /// 备 注:固定胶宽度 + /// 默认值: + /// + [SugarColumn(ColumnName = "fix_rub_width")] + public int? FixRubWidth { get; set; } + + /// + /// 备 注:胎体重量 + /// 默认值: + /// + [SugarColumn(ColumnName = "tire_weight")] + public double? TireWeight { get; set; } + + /// + /// 备 注:物料名称1基部胶 + /// 默认值: + /// + [SugarColumn(ColumnName = "material_name_1")] + public string MaterialName1 { get; set; } = string.Empty; + + /// + /// 备 注:贴合层数1基部胶 + /// 默认值: + /// + [SugarColumn(ColumnName = "material_layers_1")] + public int? MaterialLayers1 { get; set; } + + /// + /// 备 注:重量1基部胶 + /// 默认值: + /// + [SugarColumn(ColumnName = "material_weight_1")] + public double? MaterialWeight1 { get; set; } + + /// + /// 备 注:宽度1基部胶 + /// 默认值: + /// + [SugarColumn(ColumnName = "material_width_1")] + public double? MaterialWidth1 { get; set; } + + /// + /// 备 注:物料名称2缓冲胶 + /// 默认值: + /// + [SugarColumn(ColumnName = "material_name_2")] + public string MaterialName2 { get; set; } = string.Empty; + + /// + /// 备 注:贴合层数2缓冲胶 + /// 默认值: + /// + [SugarColumn(ColumnName = "material_layers_2")] + public int? MaterialLayers2 { get; set; } + + /// + /// 备 注:重量2缓冲胶 + /// 默认值: + /// + [SugarColumn(ColumnName = "material_weight_2")] + public double? MaterialWeight2 { get; set; } + + /// + /// 备 注:宽度2缓冲胶 + /// 默认值: + /// + [SugarColumn(ColumnName = "material_width_2")] + public double? MaterialWidth2 { get; set; } + + /// + /// 备 注:物料名称3胎面胶 + /// 默认值: + /// + [SugarColumn(ColumnName = "material_name_3")] + public string MaterialName3 { get; set; } = string.Empty; + + /// + /// 备 注:贴合层数3胎面胶 + /// 默认值: + /// + [SugarColumn(ColumnName = "material_layers_3")] + public int? MaterialLayers3 { get; set; } + + /// + /// 备 注:重量3胎面胶 + /// 默认值: + /// + [SugarColumn(ColumnName = "material_weight_3")] + public double? MaterialWeight3 { get; set; } + + /// + /// 备 注:宽度3胎面胶 + /// 默认值: + /// + [SugarColumn(ColumnName = "material_width_3")] + public double? MaterialWidth3 { get; set; } + + /// + /// 备 注:更新时间 + /// 默认值: + /// + [SugarColumn(ColumnName = "sync_time")] + public DateTime? SyncTime { get; set; } + + + } + +} \ No newline at end of file diff --git a/HighWayIot.Repository/domain/ZxWeightEntity.cs b/HighWayIot.Repository/domain/ZxWeightEntity.cs index 8a89aba..264a1da 100644 --- a/HighWayIot.Repository/domain/ZxWeightEntity.cs +++ b/HighWayIot.Repository/domain/ZxWeightEntity.cs @@ -24,14 +24,28 @@ namespace Models /// 默认值: /// [SugarColumn(ColumnName = "recipe_code")] - public string RecipeCode { get; set; } = null; + public string RecipeCode { get; set; } = string.Empty; /// /// 备 注:物料编号 /// 默认值: /// [SugarColumn(ColumnName = "material_code")] - public string MaterialCode { get; set; } = null; + public string MaterialCode { get; set; } = string.Empty; + + /// + /// 备 注:物料名称 + /// 默认值: + /// + [SugarColumn(ColumnName = "material_name")] + public string MaterialName { get; set; } = string.Empty; + + /// + /// 备 注:物料类型 + /// 默认值: + /// + [SugarColumn(ColumnName = "material_type")] + public string MaterialType { get; set; } = string.Empty; /// /// 备 注:厚度 diff --git a/HighWayIot.Repository/service/ZxCarParaService.cs b/HighWayIot.Repository/service/ZxCarParaService.cs deleted file mode 100644 index 59a32cd..0000000 --- a/HighWayIot.Repository/service/ZxCarParaService.cs +++ /dev/null @@ -1,63 +0,0 @@ -using HighWayIot.Log4net; -using HighWayIot.Repository.domain; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HighWayIot.Repository.service -{ - public class ZxCarParaService - { - private static readonly Lazy lazy = new Lazy(() => new ZxCarParaService()); - - public static ZxCarParaService Instance - { - get - { - return lazy.Value; - } - } - - private LogHelper log = LogHelper.Instance; - Repository _repository => new Repository("sqlserver"); - - /// - /// 查询所有小车参数信息 - /// - /// - public List GetCarParaInfos() - { - try - { - List entity = _repository.GetList(); - return entity; - } - catch (Exception ex) - { - log.Error("用户信息获取异常", ex); - return null; - } - } - - /// - /// 更新小车参数信息 - /// - /// - public bool UpDateCarParaInfos(ZxCarParaEntity entity) - { - try - { - return _repository.Update(entity); - } - catch (Exception ex) - { - log.Error("用户信息获取异常", ex); - return false; - } - } - - - } -} diff --git a/HighWayIot.Repository/service/ZxMaterialService.cs b/HighWayIot.Repository/service/ZxMaterialService.cs index 9613ce3..9fa348d 100644 --- a/HighWayIot.Repository/service/ZxMaterialService.cs +++ b/HighWayIot.Repository/service/ZxMaterialService.cs @@ -70,6 +70,24 @@ namespace HighWayIot.Repository.service } } + /// + /// 物料名称获取单个物料信息 + /// + /// + /// + public ZxMaterialEntity GetMaterialInfoByMaterialName(string materialName) + { + try + { + var result = _repository.GetSingle(x => x.MaterialName == materialName); + return result; + } + catch (Exception ex) + { + return null; + } + } + /// /// 根据Id获取单条数据 /// diff --git a/HighWayIot.Repository/service/ZxMesPlanTransferService.cs b/HighWayIot.Repository/service/ZxMesPlanTransferService.cs new file mode 100644 index 0000000..39199c1 --- /dev/null +++ b/HighWayIot.Repository/service/ZxMesPlanTransferService.cs @@ -0,0 +1,119 @@ +using HighWayIot.Log4net; +using HighWayIot.Repository.domain; +using Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Text; +using System.Threading.Tasks; + +namespace HighWayIot.Repository.service +{ + /// + /// 配方同步接口 + /// + public class ZxMesPlanTransferService + { + private static readonly Lazy lazy = new Lazy(() => new ZxMesPlanTransferService()); + + public static ZxMesPlanTransferService Instance + { + get + { + return lazy.Value; + } + } + + private LogHelper log = LogHelper.Instance; + Repository _repository => new Repository("sqlserver"); + + /// + /// 查询所有物料类别信息 + /// + /// + public List GetRecipeInfos() + { + try + { + List entity = _repository.GetList(); + return entity; + } + catch (Exception ex) + { + log.Error("配方同步信息获取异常", ex); + return null; + } + } + + /// + /// 查询所有物料类别信息 + /// + /// + public List GetRecipeInfos(Expression> whereExpression) + { + try + { + List entity = _repository.GetList(whereExpression); + return entity; + } + catch (Exception ex) + { + log.Error("配方同步信息获取异常", ex); + return null; + } + } + + /// + /// 更新基准数据标识为True + /// + /// + public bool SetFlagTrue() + { + try + { + var result = _repository.Update(x => new ZxMesPlanTransferEntity() { RequestFlag = true }, x => x.Uuid == "syncsignal"); + return result; + } + catch (Exception ex) + { + log.Error("配方同步基准信息修改异常", ex); + return false; + } + } + + /// + /// 获取更新基准数据标识状态 + /// + /// + public bool GetFlagState() + { + try + { + var result = _repository.GetById("syncsignal").RequestFlag; + return result ?? true; + } + catch (Exception ex) + { + return true; + } + } + + ///// + ///// 有更无插 + ///// + ///// + //public int UpdateOrAddInfos(List lists) + //{ + // try + // { + // return _repository.Context.Storageable(lists).WhereColumns(x => x.RecipeName).ExecuteCommand(); + // } + // catch (Exception ex) + // { + // log.Error($"更新配方数据失败", ex); + // return 0; + // } + //} + } +} diff --git a/HighWayIot.Repository/service/ZxWeightService.cs b/HighWayIot.Repository/service/ZxWeightService.cs index db684f3..d641aa1 100644 --- a/HighWayIot.Repository/service/ZxWeightService.cs +++ b/HighWayIot.Repository/service/ZxWeightService.cs @@ -44,6 +44,30 @@ namespace HighWayIot.Repository.service } } + /// + /// 根据配方编号和物料编号和子类型查询称量信息 + /// + /// 配方号 + /// + public ZxWeightEntity GetWeightInfos(string recipeCode, string materialCode, string materialType) + { + try + { + ZxWeightEntity entity = _repository + .GetSingle(x => + x.RecipeCode == recipeCode + && x.MaterialCode == materialCode + && x.MaterialType == materialType + && x.IsDeleted == false); + return entity; + } + catch (Exception ex) + { + log.Error("称量信息获取异常", ex); + return null; + } + } + /// /// 新增称量信息 /// diff --git a/HighWayIot.Winform/Business/RecipeMesSyncBusiness.cs b/HighWayIot.Winform/Business/RecipeMesSyncBusiness.cs new file mode 100644 index 0000000..e4ce089 --- /dev/null +++ b/HighWayIot.Winform/Business/RecipeMesSyncBusiness.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HighWayIot.Winform.Business +{ + public class RecipeMesSyncBusiness + { + + } +} diff --git a/HighWayIot.Winform/HighWayIot.Winform.csproj b/HighWayIot.Winform/HighWayIot.Winform.csproj index b5b50a5..6f99d74 100644 --- a/HighWayIot.Winform/HighWayIot.Winform.csproj +++ b/HighWayIot.Winform/HighWayIot.Winform.csproj @@ -53,6 +53,7 @@ + diff --git a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddRecipeForm.Designer.cs b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddRecipeForm.Designer.cs index ddee759..067f756 100644 --- a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddRecipeForm.Designer.cs +++ b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddRecipeForm.Designer.cs @@ -97,6 +97,7 @@ // // RecipeCodeTextBox // + this.RecipeCodeTextBox.Enabled = false; this.RecipeCodeTextBox.Location = new System.Drawing.Point(103, 28); this.RecipeCodeTextBox.Name = "RecipeCodeTextBox"; this.RecipeCodeTextBox.Size = new System.Drawing.Size(130, 21); diff --git a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddRecipeForm.cs b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddRecipeForm.cs index 8645a0d..327ea9c 100644 --- a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddRecipeForm.cs +++ b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddRecipeForm.cs @@ -24,7 +24,8 @@ namespace HighWayIot.Winform.UserControlPages.RecipeConfigPages private void Init() { - + string recipeCode = DateTime.Now.ToString("yyyyMMddHHmmss"); + RecipeCodeTextBox.Text = recipeCode; } private void ConfrimAddButton_Click(object sender, EventArgs e) diff --git a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddWeightForm.Designer.cs b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddWeightForm.Designer.cs index 4b70dec..f5cf45f 100644 --- a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddWeightForm.Designer.cs +++ b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddWeightForm.Designer.cs @@ -51,6 +51,8 @@ this.SetErrorTextBox = new System.Windows.Forms.TextBox(); this.label10 = new System.Windows.Forms.Label(); this.AddButton = new System.Windows.Forms.Button(); + this.RubTypeCombobox = new System.Windows.Forms.ComboBox(); + this.label11 = new System.Windows.Forms.Label(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // @@ -267,11 +269,31 @@ this.AddButton.UseVisualStyleBackColor = true; this.AddButton.Click += new System.EventHandler(this.AddButton_Click); // + // RubTypeCombobox + // + this.RubTypeCombobox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.RubTypeCombobox.FormattingEnabled = true; + this.RubTypeCombobox.Location = new System.Drawing.Point(469, 38); + this.RubTypeCombobox.Name = "RubTypeCombobox"; + this.RubTypeCombobox.Size = new System.Drawing.Size(104, 20); + this.RubTypeCombobox.TabIndex = 11; + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(374, 41); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(89, 12); + this.label11.TabIndex = 24; + this.label11.Text = "胶料位置类型:"; + // // AddWeightForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(638, 274); + this.Controls.Add(this.label11); + this.Controls.Add(this.RubTypeCombobox); this.Controls.Add(this.AddButton); this.Controls.Add(this.SetErrorTextBox); this.Controls.Add(this.label10); @@ -322,5 +344,7 @@ private System.Windows.Forms.TextBox SetErrorTextBox; private System.Windows.Forms.Label label10; private System.Windows.Forms.Button AddButton; + private System.Windows.Forms.ComboBox RubTypeCombobox; + private System.Windows.Forms.Label label11; } } \ No newline at end of file diff --git a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddWeightForm.cs b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddWeightForm.cs index 46373f0..01e9e12 100644 --- a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddWeightForm.cs +++ b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddWeightForm.cs @@ -70,13 +70,20 @@ namespace HighWayIot.Winform.UserControlPages.RecipeConfigPages private void Init() { - RecipeCodeTextBox.Text = RecipeCode; + RecipeCodeTextBox.Text = DateTime.Now.ToString("yyyyMMddHHmmss"); //获取数据 MaterialTypeArray = zxMaterialTypeService.GetMaterialTypeInfos().Select(x => x.MaterialTypeName).ToArray(); List list = zxMaterialService.GetMaterialInfos(); MaterialCodeArray = list.Select(x => x.MaterialCode).ToArray(); MaterialNameArray = list.Select(x => x.MaterialName).ToArray(); + string[] materialType = new string[4] + { + "", + "基部胶", + "缓冲胶", + "胎面胶" + }; //添加空白行 MaterialTypeArray = GeneralUtils.HeadAddEmptyString(MaterialTypeArray); @@ -87,6 +94,7 @@ namespace HighWayIot.Winform.UserControlPages.RecipeConfigPages MaterialTypeComboBox.DataSource = MaterialTypeArray; MaterialCodeComboBox.DataSource = MaterialCodeArray; MaterialNameComboBox.DataSource = MaterialNameArray; + RubTypeCombobox.DataSource = materialType; } private void AddButton_Click(object sender, EventArgs e) @@ -101,10 +109,18 @@ namespace HighWayIot.Winform.UserControlPages.RecipeConfigPages { RecipeCode = this.RecipeCode, MaterialCode = MaterialCodeComboBox.Text.Trim(), + MaterialName = MaterialNameComboBox.Text.Trim(), + MaterialType = RubTypeCombobox.Text.Trim(), IsUse = IsUseCheckBox.Checked, IsDeleted = false, }; + if (string.IsNullOrEmpty(RubTypeCombobox.Text)) + { + MessageBox.Show("请选择胶料位置类型!"); + return; + } + var lists = zxWeightService.GetWeightInfos(RecipeCode); if (lists.Where(x => x.MaterialCode == MaterialCodeComboBox.Text.Trim()).Count() >= 1) diff --git a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.Designer.cs b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.Designer.cs index 47a6a6f..9091711 100644 --- a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.Designer.cs +++ b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.Designer.cs @@ -32,36 +32,16 @@ namespace HighWayIot.Winform.UserControlPages private void InitializeComponent() { this.WeightDataGridView = new System.Windows.Forms.DataGridView(); - this.Id = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.MaterialCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.MaterialName = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.MaterialType = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.MaterialChildType = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.SetThickness = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.SetWidth = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.SetLayer = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.SetWeight = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.SetError = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.WeightIsUse = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.AddRecipeButton = new System.Windows.Forms.Button(); this.ButtonPanel = new System.Windows.Forms.Panel(); + this.SyncDataButton = new System.Windows.Forms.Button(); this.label26 = new System.Windows.Forms.Label(); - this.label25 = new System.Windows.Forms.Label(); this.RefreshRecipeButton = new System.Windows.Forms.Button(); this.UpdateRecipeButton = new System.Windows.Forms.Button(); this.DeleteRecipeButton = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.RecipeDataGridView = new System.Windows.Forms.DataGridView(); - this.RId = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.RecipeCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.RecipeName = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.RecipeSpecCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.RecipeSpecName = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.SizeKind = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.FixedWidth = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.WeightError = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.IsUse = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.groupBox3 = new System.Windows.Forms.GroupBox(); this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); @@ -108,6 +88,7 @@ namespace HighWayIot.Winform.UserControlPages this.Position2RadioButton = new System.Windows.Forms.RadioButton(); this.Position1RadioButton = new System.Windows.Forms.RadioButton(); this.groupbox5 = new System.Windows.Forms.GroupBox(); + this.S2Check = new System.Windows.Forms.CheckBox(); this.label16 = new System.Windows.Forms.Label(); this.PlcSpecNameLabel = new System.Windows.Forms.Label(); this.label34 = new System.Windows.Forms.Label(); @@ -143,12 +124,29 @@ namespace HighWayIot.Winform.UserControlPages this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); this.panel1 = new System.Windows.Forms.Panel(); this.label27 = new System.Windows.Forms.Label(); - this.label24 = new System.Windows.Forms.Label(); this.RefreshWeightButton = new System.Windows.Forms.Button(); this.UpdateWeightButton = new System.Windows.Forms.Button(); this.AddWeightButton = new System.Windows.Forms.Button(); this.DeleteWeightButton = new System.Windows.Forms.Button(); - this.S2Check = new System.Windows.Forms.CheckBox(); + this.Id = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.MaterialCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.MaterialName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.MaterialType = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.SetThickness = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.SetWidth = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.SetLayer = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.SetWeight = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.SetError = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.WeightIsUse = new System.Windows.Forms.DataGridViewCheckBoxColumn(); + this.RId = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.RecipeCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.RecipeName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.RecipeSpecCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.RecipeSpecName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.SizeKind = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.FixedWidth = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.WeightError = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.IsUse = new System.Windows.Forms.DataGridViewCheckBoxColumn(); ((System.ComponentModel.ISupportInitialize)(this.WeightDataGridView)).BeginInit(); this.ButtonPanel.SuspendLayout(); this.groupBox1.SuspendLayout(); @@ -175,7 +173,6 @@ namespace HighWayIot.Winform.UserControlPages this.MaterialCode, this.MaterialName, this.MaterialType, - this.MaterialChildType, this.SetThickness, this.SetWidth, this.SetLayer, @@ -192,93 +189,6 @@ namespace HighWayIot.Winform.UserControlPages this.WeightDataGridView.TabIndex = 0; this.WeightDataGridView.Tag = ""; // - // Id - // - this.Id.DataPropertyName = "Id"; - this.Id.HeaderText = "编号"; - this.Id.Name = "Id"; - this.Id.ReadOnly = true; - this.Id.Width = 40; - // - // MaterialCode - // - this.MaterialCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.MaterialCode.DataPropertyName = "MaterialCode"; - this.MaterialCode.HeaderText = "物料编码"; - this.MaterialCode.Name = "MaterialCode"; - this.MaterialCode.ReadOnly = true; - this.MaterialCode.Resizable = System.Windows.Forms.DataGridViewTriState.True; - // - // MaterialName - // - this.MaterialName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.MaterialName.DataPropertyName = "MaterialName"; - this.MaterialName.HeaderText = "物料名称"; - this.MaterialName.Name = "MaterialName"; - this.MaterialName.ReadOnly = true; - // - // MaterialType - // - this.MaterialType.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.MaterialType.DataPropertyName = "MaterialType"; - this.MaterialType.HeaderText = "物料类型"; - this.MaterialType.Name = "MaterialType"; - this.MaterialType.ReadOnly = true; - this.MaterialType.Resizable = System.Windows.Forms.DataGridViewTriState.True; - // - // MaterialChildType - // - this.MaterialChildType.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.MaterialChildType.DataPropertyName = "MaterialChildType"; - this.MaterialChildType.HeaderText = "子类型"; - this.MaterialChildType.Name = "MaterialChildType"; - this.MaterialChildType.ReadOnly = true; - this.MaterialChildType.Resizable = System.Windows.Forms.DataGridViewTriState.True; - // - // SetThickness - // - this.SetThickness.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.SetThickness.DataPropertyName = "SetThickness"; - this.SetThickness.HeaderText = "厚度"; - this.SetThickness.Name = "SetThickness"; - // - // SetWidth - // - this.SetWidth.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.SetWidth.DataPropertyName = "SetWidth"; - this.SetWidth.HeaderText = "宽度"; - this.SetWidth.Name = "SetWidth"; - // - // SetLayer - // - this.SetLayer.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.SetLayer.DataPropertyName = "SetLayer"; - this.SetLayer.HeaderText = "层数"; - this.SetLayer.Name = "SetLayer"; - // - // SetWeight - // - this.SetWeight.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.SetWeight.DataPropertyName = "SetWeight"; - this.SetWeight.HeaderText = "重量"; - this.SetWeight.Name = "SetWeight"; - // - // SetError - // - this.SetError.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.SetError.DataPropertyName = "SetError"; - this.SetError.HeaderText = "公差"; - this.SetError.Name = "SetError"; - // - // WeightIsUse - // - this.WeightIsUse.DataPropertyName = "IsUse"; - this.WeightIsUse.HeaderText = "启用"; - this.WeightIsUse.Name = "WeightIsUse"; - this.WeightIsUse.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.WeightIsUse.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.WeightIsUse.Width = 40; - // // AddRecipeButton // this.AddRecipeButton.Location = new System.Drawing.Point(11, 9); @@ -294,8 +204,8 @@ namespace HighWayIot.Winform.UserControlPages // this.ButtonPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.ButtonPanel.Controls.Add(this.SyncDataButton); this.ButtonPanel.Controls.Add(this.label26); - this.ButtonPanel.Controls.Add(this.label25); this.ButtonPanel.Controls.Add(this.RefreshRecipeButton); this.ButtonPanel.Controls.Add(this.UpdateRecipeButton); this.ButtonPanel.Controls.Add(this.AddRecipeButton); @@ -306,6 +216,18 @@ namespace HighWayIot.Winform.UserControlPages this.ButtonPanel.Size = new System.Drawing.Size(861, 58); this.ButtonPanel.TabIndex = 4; // + // SyncDataButton + // + this.SyncDataButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.SyncDataButton.Location = new System.Drawing.Point(637, 9); + this.SyncDataButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.SyncDataButton.Name = "SyncDataButton"; + this.SyncDataButton.Size = new System.Drawing.Size(103, 39); + this.SyncDataButton.TabIndex = 8; + this.SyncDataButton.Text = "同步数据"; + this.SyncDataButton.UseVisualStyleBackColor = true; + this.SyncDataButton.Click += new System.EventHandler(this.SyncDataButton_Click); + // // label26 // this.label26.AutoSize = true; @@ -315,15 +237,6 @@ namespace HighWayIot.Winform.UserControlPages this.label26.TabIndex = 7; this.label26.Text = "双击单元格更改数值再点击修改按钮完成数值更改"; // - // label25 - // - this.label25.AutoSize = true; - this.label25.Location = new System.Drawing.Point(338, 36); - this.label25.Name = "label25"; - this.label25.Size = new System.Drawing.Size(101, 12); - this.label25.TabIndex = 6; - this.label25.Text = "配方编号不可更改"; - // // RefreshRecipeButton // this.RefreshRecipeButton.Location = new System.Drawing.Point(120, 9); @@ -408,73 +321,6 @@ namespace HighWayIot.Winform.UserControlPages this.RecipeDataGridView.Tag = ""; this.RecipeDataGridView.SelectionChanged += new System.EventHandler(this.RecipeDataGridView_SelectionChanged); // - // RId - // - this.RId.DataPropertyName = "Id"; - this.RId.HeaderText = "ID"; - this.RId.Name = "RId"; - this.RId.ReadOnly = true; - this.RId.Width = 40; - // - // RecipeCode - // - this.RecipeCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.RecipeCode.DataPropertyName = "RecipeCode"; - this.RecipeCode.HeaderText = "配方编号"; - this.RecipeCode.Name = "RecipeCode"; - this.RecipeCode.ReadOnly = true; - // - // RecipeName - // - this.RecipeName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.RecipeName.DataPropertyName = "RecipeName"; - this.RecipeName.HeaderText = "配方名称"; - this.RecipeName.Name = "RecipeName"; - // - // RecipeSpecCode - // - this.RecipeSpecCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.RecipeSpecCode.DataPropertyName = "RecipeSpecCode"; - this.RecipeSpecCode.HeaderText = "SPEC编号"; - this.RecipeSpecCode.Name = "RecipeSpecCode"; - // - // RecipeSpecName - // - this.RecipeSpecName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.RecipeSpecName.DataPropertyName = "RecipeSpecName"; - this.RecipeSpecName.HeaderText = "SPEC名称"; - this.RecipeSpecName.Name = "RecipeSpecName"; - // - // SizeKind - // - this.SizeKind.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.SizeKind.DataPropertyName = "SizeKind"; - this.SizeKind.HeaderText = "寸别"; - this.SizeKind.Name = "SizeKind"; - // - // FixedWidth - // - this.FixedWidth.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.FixedWidth.DataPropertyName = "FixedWidth"; - this.FixedWidth.HeaderText = "固定胶宽度"; - this.FixedWidth.Name = "FixedWidth"; - // - // WeightError - // - this.WeightError.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.WeightError.DataPropertyName = "WeightError"; - this.WeightError.HeaderText = "重量公差"; - this.WeightError.Name = "WeightError"; - // - // IsUse - // - this.IsUse.DataPropertyName = "IsUse"; - this.IsUse.HeaderText = "启用"; - this.IsUse.Name = "IsUse"; - this.IsUse.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.IsUse.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.IsUse.Width = 40; - // // tableLayoutPanel1 // this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -1009,6 +855,16 @@ namespace HighWayIot.Winform.UserControlPages this.groupbox5.TabStop = false; this.groupbox5.Text = "公共参数"; // + // S2Check + // + this.S2Check.AutoSize = true; + this.S2Check.Location = new System.Drawing.Point(95, 56); + this.S2Check.Margin = new System.Windows.Forms.Padding(6); + this.S2Check.Name = "S2Check"; + this.S2Check.Size = new System.Drawing.Size(15, 14); + this.S2Check.TabIndex = 70; + this.S2Check.UseVisualStyleBackColor = true; + // // label16 // this.label16.AutoSize = true; @@ -1331,7 +1187,6 @@ namespace HighWayIot.Winform.UserControlPages this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.panel1.Controls.Add(this.label27); - this.panel1.Controls.Add(this.label24); this.panel1.Controls.Add(this.RefreshWeightButton); this.panel1.Controls.Add(this.UpdateWeightButton); this.panel1.Controls.Add(this.AddWeightButton); @@ -1351,15 +1206,6 @@ namespace HighWayIot.Winform.UserControlPages this.label27.TabIndex = 8; this.label27.Text = "双击单元格更改数值再点击修改按钮完成数值更改"; // - // label24 - // - this.label24.AutoSize = true; - this.label24.Location = new System.Drawing.Point(338, 36); - this.label24.Name = "label24"; - this.label24.Size = new System.Drawing.Size(125, 12); - this.label24.TabIndex = 5; - this.label24.Text = "称量物料信息不可更改"; - // // RefreshWeightButton // this.RefreshWeightButton.Location = new System.Drawing.Point(120, 9); @@ -1405,15 +1251,150 @@ namespace HighWayIot.Winform.UserControlPages this.DeleteWeightButton.UseVisualStyleBackColor = true; this.DeleteWeightButton.Click += new System.EventHandler(this.DeleteWeightButton_Click); // - // S2Check + // Id // - this.S2Check.AutoSize = true; - this.S2Check.Location = new System.Drawing.Point(95, 56); - this.S2Check.Margin = new System.Windows.Forms.Padding(6); - this.S2Check.Name = "S2Check"; - this.S2Check.Size = new System.Drawing.Size(15, 14); - this.S2Check.TabIndex = 70; - this.S2Check.UseVisualStyleBackColor = true; + this.Id.DataPropertyName = "Id"; + this.Id.HeaderText = "ID"; + this.Id.Name = "Id"; + this.Id.ReadOnly = true; + this.Id.Width = 40; + // + // MaterialCode + // + this.MaterialCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.MaterialCode.DataPropertyName = "MaterialCode"; + this.MaterialCode.HeaderText = "胶料编码"; + this.MaterialCode.Name = "MaterialCode"; + this.MaterialCode.ReadOnly = true; + this.MaterialCode.Resizable = System.Windows.Forms.DataGridViewTriState.True; + // + // MaterialName + // + this.MaterialName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.MaterialName.DataPropertyName = "MaterialName"; + this.MaterialName.HeaderText = "胶料名称"; + this.MaterialName.Name = "MaterialName"; + this.MaterialName.ReadOnly = true; + // + // MaterialType + // + this.MaterialType.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.MaterialType.DataPropertyName = "MaterialType"; + this.MaterialType.HeaderText = "胶料类型"; + this.MaterialType.Name = "MaterialType"; + this.MaterialType.ReadOnly = true; + this.MaterialType.Resizable = System.Windows.Forms.DataGridViewTriState.True; + // + // SetThickness + // + this.SetThickness.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.SetThickness.DataPropertyName = "SetThickness"; + this.SetThickness.HeaderText = "厚度"; + this.SetThickness.Name = "SetThickness"; + // + // SetWidth + // + this.SetWidth.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.SetWidth.DataPropertyName = "SetWidth"; + this.SetWidth.HeaderText = "宽度"; + this.SetWidth.Name = "SetWidth"; + // + // SetLayer + // + this.SetLayer.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.SetLayer.DataPropertyName = "SetLayer"; + this.SetLayer.HeaderText = "层数"; + this.SetLayer.Name = "SetLayer"; + // + // SetWeight + // + this.SetWeight.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.SetWeight.DataPropertyName = "SetWeight"; + this.SetWeight.HeaderText = "重量"; + this.SetWeight.Name = "SetWeight"; + // + // SetError + // + this.SetError.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.SetError.DataPropertyName = "SetError"; + this.SetError.HeaderText = "公差"; + this.SetError.Name = "SetError"; + // + // WeightIsUse + // + this.WeightIsUse.DataPropertyName = "IsUse"; + this.WeightIsUse.HeaderText = "启用"; + this.WeightIsUse.Name = "WeightIsUse"; + this.WeightIsUse.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.WeightIsUse.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.WeightIsUse.Width = 40; + // + // RId + // + this.RId.DataPropertyName = "Id"; + this.RId.HeaderText = "ID"; + this.RId.Name = "RId"; + this.RId.ReadOnly = true; + this.RId.Width = 40; + // + // RecipeCode + // + this.RecipeCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.RecipeCode.DataPropertyName = "RecipeCode"; + this.RecipeCode.HeaderText = "配方编号"; + this.RecipeCode.Name = "RecipeCode"; + this.RecipeCode.ReadOnly = true; + // + // RecipeName + // + this.RecipeName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.RecipeName.DataPropertyName = "RecipeName"; + this.RecipeName.HeaderText = "标称尺度"; + this.RecipeName.Name = "RecipeName"; + // + // RecipeSpecCode + // + this.RecipeSpecCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.RecipeSpecCode.DataPropertyName = "RecipeSpecCode"; + this.RecipeSpecCode.HeaderText = "SPEC编号"; + this.RecipeSpecCode.Name = "RecipeSpecCode"; + // + // RecipeSpecName + // + this.RecipeSpecName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.RecipeSpecName.DataPropertyName = "RecipeSpecName"; + this.RecipeSpecName.HeaderText = "SPEC名称"; + this.RecipeSpecName.Name = "RecipeSpecName"; + // + // SizeKind + // + this.SizeKind.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.SizeKind.DataPropertyName = "SizeKind"; + this.SizeKind.HeaderText = "寸别"; + this.SizeKind.Name = "SizeKind"; + // + // FixedWidth + // + this.FixedWidth.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.FixedWidth.DataPropertyName = "FixedWidth"; + this.FixedWidth.HeaderText = "固定胶宽度"; + this.FixedWidth.Name = "FixedWidth"; + // + // WeightError + // + this.WeightError.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.WeightError.DataPropertyName = "WeightError"; + this.WeightError.HeaderText = "重量公差"; + this.WeightError.Name = "WeightError"; + // + // IsUse + // + this.IsUse.DataPropertyName = "IsUse"; + this.IsUse.HeaderText = "启用"; + this.IsUse.Name = "IsUse"; + this.IsUse.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.IsUse.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.IsUse.Width = 40; // // RecipeConfigPage // @@ -1476,30 +1457,6 @@ namespace HighWayIot.Winform.UserControlPages private Button SaveParaButton; private Label NowCopyLabel; private Label label23; - private DataGridViewTextBoxColumn Id; - private DataGridViewTextBoxColumn MaterialCode; - private DataGridViewTextBoxColumn MaterialName; - private DataGridViewTextBoxColumn MaterialType; - private DataGridViewTextBoxColumn MaterialChildType; - private DataGridViewTextBoxColumn SetThickness; - private DataGridViewTextBoxColumn SetWidth; - private DataGridViewTextBoxColumn SetLayer; - private DataGridViewTextBoxColumn SetWeight; - private DataGridViewTextBoxColumn SetError; - private DataGridViewCheckBoxColumn WeightIsUse; - private DataGridViewTextBoxColumn RId; - private DataGridViewTextBoxColumn RecipeCode; - private DataGridViewTextBoxColumn RecipeName; - private DataGridViewTextBoxColumn RecipeSpecCode; - private DataGridViewTextBoxColumn RecipeSpecName; - private DataGridViewTextBoxColumn SizeKind; - private DataGridViewTextBoxColumn FixedWidth; - private DataGridViewTextBoxColumn WeightError; - private DataGridViewCheckBoxColumn IsUse; - private Label label24; - private Label label25; - private Label label26; - private Label label27; private GroupBox groupBox4; private RadioButton Position3RadioButton; private RadioButton Position2RadioButton; @@ -1570,5 +1527,27 @@ namespace HighWayIot.Winform.UserControlPages private Label label32; private Label label16; private CheckBox S2Check; + private Button SyncDataButton; + private Label label26; + private Label label27; + private DataGridViewTextBoxColumn Id; + private DataGridViewTextBoxColumn MaterialCode; + private DataGridViewTextBoxColumn MaterialName; + private DataGridViewTextBoxColumn MaterialType; + private DataGridViewTextBoxColumn SetThickness; + private DataGridViewTextBoxColumn SetWidth; + private DataGridViewTextBoxColumn SetLayer; + private DataGridViewTextBoxColumn SetWeight; + private DataGridViewTextBoxColumn SetError; + private DataGridViewCheckBoxColumn WeightIsUse; + private DataGridViewTextBoxColumn RId; + private DataGridViewTextBoxColumn RecipeCode; + private DataGridViewTextBoxColumn RecipeName; + private DataGridViewTextBoxColumn RecipeSpecCode; + private DataGridViewTextBoxColumn RecipeSpecName; + private DataGridViewTextBoxColumn SizeKind; + private DataGridViewTextBoxColumn FixedWidth; + private DataGridViewTextBoxColumn WeightError; + private DataGridViewCheckBoxColumn IsUse; } } diff --git a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.cs b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.cs index ffa959a..3780c16 100644 --- a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.cs +++ b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.cs @@ -49,6 +49,16 @@ namespace HighWayIot.Winform.UserControlPages /// private ZxRecipePositionParaService zxRecipePositionParaService = ZxRecipePositionParaService.Instance; + /// + /// 配方同步服务类实例 + /// + private ZxMesPlanTransferService zxMesPlanTransferService = ZxMesPlanTransferService.Instance; + + /// + /// 配方同步实体类 + /// + private ZxMesPlanTransferEntity zxMesPlanTransferEntity; + /// /// 配方字段实例 /// @@ -282,10 +292,10 @@ namespace HighWayIot.Winform.UserControlPages form.ShowDialog(); WeightLists = zxWeightService.GetWeightInfos(NowRecipeCode); - WeightToDataSource(); + //WeightToDataSource(); WeightDataGridView.DataSource = null; - WeightDataGridView.DataSource = weightDataSourceEntities; + WeightDataGridView.DataSource = WeightLists; } /// @@ -324,10 +334,10 @@ namespace HighWayIot.Winform.UserControlPages WeightLists = zxWeightService.GetWeightInfos(NowRecipeCode); - WeightToDataSource(); + //WeightToDataSource(); WeightDataGridView.DataSource = null; - WeightDataGridView.DataSource = weightDataSourceEntities; + WeightDataGridView.DataSource = WeightLists; } /// @@ -339,8 +349,6 @@ namespace HighWayIot.Winform.UserControlPages { DataGridViewRow nowRow = WeightDataGridView.CurrentRow; - - if (MessageBox.Show($"确认要更改配方编号为 [{NowRecipeCode}] 物料编号为 [{nowRow.Cells["MaterialCode"].Value.ToString()}] 的数据吗" , "确认" , MessageBoxButtons.OKCancel) @@ -356,6 +364,8 @@ namespace HighWayIot.Winform.UserControlPages entity.Id = int.Parse(nowRow.Cells["Id"].Value.ToString().Trim()); entity.RecipeCode = NowRecipeCode; entity.MaterialCode = nowRow.Cells["MaterialCode"].Value.ToString().Trim(); + entity.MaterialName = nowRow.Cells["MaterialName"].Value.ToString().Trim(); + entity.MaterialType = nowRow.Cells["MaterialType"].Value.ToString().Trim(); entity.SetThickness = decimal.Parse(nowRow.Cells["SetThickness"].Value.ToString().Trim()); entity.SetWidth = decimal.Parse(nowRow.Cells["SetWidth"].Value.ToString().Trim()); entity.SetLayer = int.Parse(nowRow.Cells["SetLayer"].Value.ToString().Trim()); @@ -381,10 +391,10 @@ namespace HighWayIot.Winform.UserControlPages WeightLists = zxWeightService.GetWeightInfos(NowRecipeCode); - WeightToDataSource(); + //WeightToDataSource(); WeightDataGridView.DataSource = null; - WeightDataGridView.DataSource = weightDataSourceEntities; + WeightDataGridView.DataSource = WeightLists; } /// @@ -394,14 +404,12 @@ namespace HighWayIot.Winform.UserControlPages /// private void RefreshWeightButton_Click(object sender, EventArgs e) { - - WeightLists = zxWeightService.GetWeightInfos(NowRecipeCode); - WeightToDataSource(); + //WeightToDataSource(); WeightDataGridView.DataSource = null; - WeightDataGridView.DataSource = weightDataSourceEntities; + WeightDataGridView.DataSource = WeightLists; } /// @@ -425,7 +433,11 @@ namespace HighWayIot.Winform.UserControlPages return; } - ZxMaterialEntity material = entitys[0]; + ZxMaterialEntity material = new ZxMaterialEntity(); + if (entitys.Count > 0) + { + material = entitys[0]; + } weightDataSourceEntities.Add(new WeightDataSourceEntity() { @@ -464,10 +476,10 @@ namespace HighWayIot.Winform.UserControlPages WeightLists = zxWeightService.GetWeightInfos(NowRecipeCode); - WeightToDataSource(); + //WeightToDataSource(); WeightDataGridView.DataSource = null; - WeightDataGridView.DataSource = weightDataSourceEntities; + WeightDataGridView.DataSource = WeightLists; //设置参数 var paraData = zxRecipeParaService.GetRecipeParaInfoByRecipeCode(NowRecipeCode); @@ -629,7 +641,7 @@ namespace HighWayIot.Winform.UserControlPages int index = zxRecipePositionParaEntity.FindIndex(x => x.Position == entity.Position); if (index == -1) { - BaseForm.LogRefreshAction.Invoke("数据保存失败,请重新启动页面"); + BaseForm.LogRefreshAction.Invoke($"[{entity.RecipeCode}]工位信息数据未找到"); return; } zxRecipePositionParaEntity[index] = entity; @@ -1000,5 +1012,281 @@ namespace HighWayIot.Winform.UserControlPages #endregion + /// + /// 同步数据按钮 + /// + /// + /// + private void SyncDataButton_Click(object sender, EventArgs e) + { + if (zxMesPlanTransferService.GetFlagState()) + { + MessageBox.Show("正在同步数据,请稍后"); + return; + } + if (zxMesPlanTransferService.SetFlagTrue()) + { + Task.Run(() => { + while (true) + { + if (!zxMesPlanTransferService.GetFlagState()) + { + RecipeDataSync(zxMesPlanTransferService.GetRecipeInfos(x => x.Uuid != "syncsignal")); + } + Task.Delay(1000); + } + }); + } + } + + /// + /// 配方数据同步类 + /// + private void RecipeDataSync(List sourceEntity) + { + foreach(var newRecipes in sourceEntity) + { + //////////////////////////////更新配方表///////////////////////////////// + var newEneitys = RecipeLists.Where(x => x.RecipeName == newRecipes.RecipeName).ToList(); + if (newEneitys.Count > 0) //有就更新 + { + //配方 + newEneitys[0].RecipeSpecCode = newRecipes.SpecCode; + newEneitys[0].RecipeSpecName = newRecipes.SpecName; + newEneitys[0].SizeKind = newRecipes.RimInch; + newEneitys[0].FixedWidth = newRecipes.FixRubWidth; + if (!zxRecipeService.UpdateRecipeInfo(newEneitys[0])) + { + return; + } + } + else //没有就插入 + { + ZxRecipeEntity entity = new ZxRecipeEntity() + { + RecipeName = newRecipes.RecipeName, + RecipeCode = DateTime.Now.ToString("yyyyMMddHHmmssffff"), + RecipeSpecCode = newRecipes.SpecCode, + RecipeSpecName = newRecipes.SpecName, + SizeKind = newRecipes.RimInch, + FixedWidth = newRecipes.FixRubWidth, + IsUse = true, + IsDeleted = false, + }; + zxRecipeService.InsertRecipeInfo(entity); + } + + /////////////////////////////更新称量信息表//////////////////////////////// + string recipeCode = zxRecipeService.GetSingleInfoByRecipeName(newRecipes.RecipeName).RecipeCode; + var material1 = zxMaterialService.GetMaterialInfoByMaterialName(newRecipes.MaterialName1); + var material2 = zxMaterialService.GetMaterialInfoByMaterialName(newRecipes.MaterialName2); + var material3 = zxMaterialService.GetMaterialInfoByMaterialName(newRecipes.MaterialName3); + //物料1 + if (string.IsNullOrEmpty(newRecipes.MaterialName1)) + { + if (material1 != null) //有这个物料 + { + //查询是否有这个配方这个物料的称量 有更改 没有添加 + var weightInfo = zxWeightService.GetWeightInfos(recipeCode, material1.MaterialCode, "基部胶"); + if (weightInfo == null) + { + zxWeightService.InsertWeightInfo(new ZxWeightEntity() + { + RecipeCode = recipeCode, + MaterialCode = material1.MaterialCode, + MaterialName = material1.MaterialName, + MaterialType = "基部胶", + SetWidth = (decimal?)newRecipes.MaterialWidth1, + SetWeight = (decimal?)newRecipes.MaterialWeight1, + SetLayer = newRecipes.MaterialLayers1, + IsDeleted = false, + IsUse = true + }); + } + else + { + weightInfo.SetWidth = (decimal?)newRecipes.MaterialWidth1; + weightInfo.SetWeight = (decimal?)newRecipes.MaterialWeight1; + weightInfo.SetLayer = newRecipes.MaterialLayers1; + zxWeightService.UpdateWeightInfo(weightInfo); + } + } + else //没这个物料 + { + //先添加物料 + ZxMaterialEntity newMaterialEntity = new ZxMaterialEntity() + { + MaterialCode = DateTime.Now.ToString("yyyyMMddHHmmssffff"), + MaterialName = newRecipes.MaterialName1, + MaterialType = "胶料", + IsDeleted = false, + IsUse = true + }; + zxMaterialService.InsertMaterialInfo(newMaterialEntity); + //查询是否有这个配方这个物料的称量 有更改 没有添加 + var weightInfo = zxWeightService.GetWeightInfos(recipeCode, newMaterialEntity.MaterialCode, "基部胶"); + if (weightInfo == null) //没有配方数据 + { + zxWeightService.InsertWeightInfo(new ZxWeightEntity() + { + RecipeCode = recipeCode, + MaterialCode = newMaterialEntity.MaterialCode, + MaterialName = newMaterialEntity.MaterialName, + MaterialType = "基部胶", + SetWidth = (decimal?)newRecipes.MaterialWidth1, + SetWeight = (decimal?)newRecipes.MaterialWeight1, + SetLayer = newRecipes.MaterialLayers1, + IsDeleted = false, + IsUse = true + }); + } + else //有配方数据 + { + weightInfo.SetWidth = (decimal?)newRecipes.MaterialWidth1; + weightInfo.SetWeight = (decimal?)newRecipes.MaterialWeight1; + weightInfo.SetLayer = newRecipes.MaterialLayers1; + zxWeightService.UpdateWeightInfo(weightInfo); + } + } + } + //物料2 + if (string.IsNullOrEmpty(newRecipes.MaterialName2)) + { + if (material2 != null) //有这个物料 + { + //查询是否有这个配方这个物料的称量 有更改 没有添加 + var weightInfo = zxWeightService.GetWeightInfos(recipeCode, material2.MaterialCode, "基部胶"); + if (weightInfo == null) + { + zxWeightService.InsertWeightInfo(new ZxWeightEntity() + { + RecipeCode = recipeCode, + MaterialCode = material1.MaterialCode, + MaterialName = material1.MaterialName, + MaterialType = "基部胶", + SetWidth = (decimal?)newRecipes.MaterialWidth2, + SetWeight = (decimal?)newRecipes.MaterialWeight2, + SetLayer = newRecipes.MaterialLayers2, + IsDeleted = false, + IsUse = true + }); + } + else + { + weightInfo.SetWidth = (decimal?)newRecipes.MaterialWidth2; + weightInfo.SetWeight = (decimal?)newRecipes.MaterialWeight2; + weightInfo.SetLayer = newRecipes.MaterialLayers2; + zxWeightService.UpdateWeightInfo(weightInfo); + } + } + else //没这个物料 + { + //先添加物料 + ZxMaterialEntity newMaterialEntity = new ZxMaterialEntity() + { + MaterialCode = DateTime.Now.ToString("yyyyMMddHHmmssffff"), + MaterialName = newRecipes.MaterialName2, + MaterialType = "胶料", + IsDeleted = false, + IsUse = true + }; + zxMaterialService.InsertMaterialInfo(newMaterialEntity); + //查询是否有这个配方这个物料的称量 有更改 没有添加 + var weightInfo = zxWeightService.GetWeightInfos(recipeCode, newMaterialEntity.MaterialCode, "基部胶"); + if (weightInfo == null) //没有配方数据 + { + zxWeightService.InsertWeightInfo(new ZxWeightEntity() + { + RecipeCode = recipeCode, + MaterialCode = newMaterialEntity.MaterialCode, + MaterialName = newMaterialEntity.MaterialName, + MaterialType = "基部胶", + SetWidth = (decimal?)newRecipes.MaterialWidth2, + SetWeight = (decimal?)newRecipes.MaterialWeight2, + SetLayer = newRecipes.MaterialLayers2, + IsDeleted = false, + IsUse = true + }); + } + else //有配方数据 + { + weightInfo.SetWidth = (decimal?)newRecipes.MaterialWidth2; + weightInfo.SetWeight = (decimal?)newRecipes.MaterialWeight2; + weightInfo.SetLayer = newRecipes.MaterialLayers2; + zxWeightService.UpdateWeightInfo(weightInfo); + } + } + } + + //物料3 + if (string.IsNullOrEmpty(newRecipes.MaterialName3)) + { + if (material3 != null) //有这个物料 + { + //查询是否有这个配方这个物料的称量 有更改 没有添加 + var weightInfo = zxWeightService.GetWeightInfos(recipeCode, material3.MaterialCode, "基部胶"); + if (weightInfo == null) + { + zxWeightService.InsertWeightInfo(new ZxWeightEntity() + { + RecipeCode = recipeCode, + MaterialCode = material3.MaterialCode, + MaterialName = material3.MaterialName, + MaterialType = "基部胶", + SetWidth = (decimal?)newRecipes.MaterialWidth3, + SetWeight = (decimal?)newRecipes.MaterialWeight3, + SetLayer = newRecipes.MaterialLayers3, + IsDeleted = false, + IsUse = true + }); + } + else + { + weightInfo.SetWidth = (decimal?)newRecipes.MaterialWidth3; + weightInfo.SetWeight = (decimal?)newRecipes.MaterialWeight3; + weightInfo.SetLayer = newRecipes.MaterialLayers3; + zxWeightService.UpdateWeightInfo(weightInfo); + } + } + else //没这个物料 + { + //先添加物料 + ZxMaterialEntity newMaterialEntity = new ZxMaterialEntity() + { + MaterialCode = DateTime.Now.ToString("yyyyMMddHHmmssffff"), + MaterialName = newRecipes.MaterialName3, + MaterialType = "胶料", + IsDeleted = false, + IsUse = true + }; + zxMaterialService.InsertMaterialInfo(newMaterialEntity); + //查询是否有这个配方这个物料的称量 有更改 没有添加 + var weightInfo = zxWeightService.GetWeightInfos(recipeCode, newMaterialEntity.MaterialCode, "基部胶"); + if (weightInfo == null) //没有配方数据 + { + zxWeightService.InsertWeightInfo(new ZxWeightEntity() + { + RecipeCode = recipeCode, + MaterialCode = newMaterialEntity.MaterialCode, + MaterialName = newMaterialEntity.MaterialName, + MaterialType = "基部胶", + SetWidth = (decimal?)newRecipes.MaterialWidth3, + SetWeight = (decimal?)newRecipes.MaterialWeight3, + SetLayer = newRecipes.MaterialLayers3, + IsDeleted = false, + IsUse = true + }); + } + else //有配方数据 + { + weightInfo.SetWidth = (decimal?)newRecipes.MaterialWidth3; + weightInfo.SetWeight = (decimal?)newRecipes.MaterialWeight3; + weightInfo.SetLayer = newRecipes.MaterialLayers3; + zxWeightService.UpdateWeightInfo(weightInfo); + } + } + } + } + } } } diff --git a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.resx b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.resx index 2c39e2a..36b3ae9 100644 --- a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.resx +++ b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.resx @@ -129,9 +129,6 @@ True - - True - True @@ -150,6 +147,33 @@ True + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + True @@ -162,9 +186,6 @@ True - - True - True @@ -183,58 +204,4 @@ True - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - \ No newline at end of file