20260831功能同步:

1. 不同车间区分料框查询、料框解绑接口
2. 注释电池型号逻辑
3. 打开电池状况界面
This commit is contained in:
Administrator
2026-08-31 13:54:07 +08:00
parent 6dfac6d986
commit c2ed98d52d
26 changed files with 1646 additions and 13 deletions
+13 -3
View File
@@ -32,6 +32,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "解决方案项", "解决
TextFile1.txt = TextFile1.txt
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestProject", "UnitTestProject\UnitTestProject.csproj", "{DD9EBAB8-7A56-470D-92A6-60CEEDE963F7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -128,14 +130,22 @@ Global
{242400F4-9B01-4AEE-A6F7-05083757FCDD}.Release|Any CPU.Build.0 = Release|Any CPU
{242400F4-9B01-4AEE-A6F7-05083757FCDD}.Release|x64.ActiveCfg = Release|Any CPU
{242400F4-9B01-4AEE-A6F7-05083757FCDD}.Release|x64.Build.0 = Release|Any CPU
{DD9EBAB8-7A56-470D-92A6-60CEEDE963F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DD9EBAB8-7A56-470D-92A6-60CEEDE963F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DD9EBAB8-7A56-470D-92A6-60CEEDE963F7}.Debug|x64.ActiveCfg = Debug|Any CPU
{DD9EBAB8-7A56-470D-92A6-60CEEDE963F7}.Debug|x64.Build.0 = Debug|Any CPU
{DD9EBAB8-7A56-470D-92A6-60CEEDE963F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DD9EBAB8-7A56-470D-92A6-60CEEDE963F7}.Release|Any CPU.Build.0 = Release|Any CPU
{DD9EBAB8-7A56-470D-92A6-60CEEDE963F7}.Release|x64.ActiveCfg = Release|Any CPU
{DD9EBAB8-7A56-470D-92A6-60CEEDE963F7}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
RESX_AutoCreateNewLanguageFiles = False
RESX_SortFileContentOnSave = True
RESX_NeutralResourcesLanguage = zh-Hans
SolutionGuid = {E8421996-BAC4-4509-9C3E-BC424197F2D8}
RESX_NeutralResourcesLanguage = zh-Hans
RESX_SortFileContentOnSave = True
RESX_AutoCreateNewLanguageFiles = False
EndGlobalSection
EndGlobal
+25 -2
View File
@@ -1,4 +1,6 @@
using JinYuan.DAL.Models;
using JinYuan.DAL.Service;
using JinYuan.Helper;
using JinYuan.MES.Enums;
using JinYuan.MES.Models;
@@ -312,9 +314,16 @@ namespace JinYuan.ControlCenters
/// </summary>
private async Task FeedBackToPLC(PlcGroup pf, TrayInfo trayInfo, string grade)
{
MaterialFrameRuleService service = new MaterialFrameRuleService(CommonMethods.db.Db);
MaterialFrameRule rule = service.GetRuleByCode(trayInfo.trayNo);
short model = (short)CommonMethods.mesConfig.GetModel(trayInfo?.productCode ?? CommonMethods.mesConfig.ModelName);
if (model == 0) model = 1;
// TODO 注释电池型号自动选择逻辑 by clm 20260831
//string modelName = trayInfo?.productCode;
//short model = CommonMethods.mesConfig.GetModelNum(modelName, rule?.Workshop_Code ?? string.Empty);
short gradeCode = 99;
if (!string.IsNullOrEmpty(grade))
gradeCode = (short)CommonMethods.GetGradeNo(grade);
@@ -364,8 +373,15 @@ namespace JinYuan.ControlCenters
try
{
MesUrlService service = new MesUrlService(CommonMethods.db.Db);
string url = service.GetMesUrl(trayID, ConstValue.INTER_QueryTray);
if (string.IsNullOrEmpty(url))
{
throw new ArgumentException($"未找到{ConstValue.INTER_QueryTray}对应的MES接口地址");
}
var (success, mesMessage, mesResType, trayinfo) = await CommonMethods.hbgMes.QueryMesTrayInfosAsync(
CommonMethods.mesConfig.queryTrayUrl,
url,
CommonMethods.mesConfig.siteCode,
CommonMethods.mesConfig.lineCode,
CommonMethods.mesConfig.equipNum,
@@ -2029,8 +2045,15 @@ namespace JinYuan.ControlCenters
//}
try
{
MesUrlService service = new MesUrlService(CommonMethods.db.Db);
string url = service.GetMesUrl(trayID, ConstValue.INTER_UnBindTray);
if (string.IsNullOrEmpty(url))
{
throw new ArgumentException($"未找到{ConstValue.INTER_UnBindTray}对应的MES接口地址");
}
var (success, mesMessage) = await CommonMethods.hbgMes.UnbindTrayInfosAsync(
CommonMethods.mesConfig.unbindTrayUrl,
url,
CommonMethods.mesConfig.equipNum,
trayID
).ConfigureAwait(false);
+8
View File
@@ -116,10 +116,18 @@
<ItemGroup>
<Compile Include="Enums\Enums.cs" />
<Compile Include="ISugarHelper.cs" />
<Compile Include="Models\MaterialFrameRule.cs" />
<Compile Include="Models\ModelExtension.cs" />
<Compile Include="Models\OrderSortEntity.cs" />
<Compile Include="Models\QueryCondition.cs" />
<Compile Include="Models\QueryDescriptor.cs" />
<Compile Include="Models\WorkshopInterfaceConfig.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Service\IBaseService.cs" />
<Compile Include="Service\MaterialFrameRuleService.cs" />
<Compile Include="Service\MesUrlService.cs" />
<Compile Include="Service\BaseService.cs" />
<Compile Include="Service\WorkshopInterCfgService.cs" />
<Compile Include="SQLSugarHelper.cs" />
<Compile Include="SQLSugarService.cs" />
</ItemGroup>
+47
View File
@@ -0,0 +1,47 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JinYuan.DAL.Models
{
/// <summary>
/// 料框码规则表
/// </summary>
[SugarTable("material_frame_rule")]
public class MaterialFrameRule
{
/// <summary>
/// 主键ID
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public int Id { get; set; }
/// <summary>
/// 料框码规则起始匹配编码(第4-7位)
/// </summary>
[SugarColumn(ColumnName = "start_code", Length = 20, IsNullable = false)]
public string Start_Code { get; set; }
/// <summary>
/// 车间编码 (如 601)
/// </summary>
[SugarColumn(ColumnName = "workshop_code", Length = 10, IsNullable = false)]
public string Workshop_Code { get; set; } = string.Empty;
/// <summary>
/// 逻辑删除标识 (0:正常, 1:已删除)
/// 注意:建议在Service层统一过滤此字段,不直接参与常规业务查询映射
/// </summary>
[SugarColumn(ColumnName = "is_deleted")]
public bool Is_Deleted { get; set; }
/// <summary>
/// 最后更新时间
/// </summary>
[SugarColumn(ColumnName = "update_time", IsOnlyIgnoreUpdate = true)] // 插入时由数据库默认值处理,更新时自动更新
public DateTime Update_Time { get; set; }
}
}
+31
View File
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JinYuan.DAL.Models
{
public static class ModelExtension
{
public static T ToModel<T>(this System.Data.DataRow row) where T : class, new()
{
if (row == null) return null;
T model = new T();
var type = typeof(T);
var properties = type.GetProperties();
foreach (var prop in properties)
{
if (row.Table.Columns.Contains(prop.Name))
{
var value = row[prop.Name];
if (value != DBNull.Value)
{
prop.SetValue(model, Convert.ChangeType(value, prop.PropertyType));
}
}
}
return model;
}
}
}
@@ -0,0 +1,58 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JinYuan.DAL.Models
{
/// <summary>
/// 车间接口配置表
/// </summary>
[SugarTable("workshop_interface_config")]
public class WorkshopInterfaceConfig
{
/// <summary>
/// 主键ID
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public int Id { get; set; }
/// <summary>
/// 车间编码
/// </summary>
[SugarColumn(ColumnName = "workshop_code", Length = 10, IsNullable = false)]
public string Workshop_Code { get; set; }
/// <summary>
/// 接口标识 (如 QueryTrayUrl)
/// </summary>
[SugarColumn(ColumnName = "interface_flag", Length = 50, IsNullable = false)]
public string Interface_Flag { get; set; }
/// <summary>
/// 接口名称 (如 料框查询)
/// </summary>
[SugarColumn(ColumnName = "interface_name", Length = 100, IsNullable = true)]
public string Interface_Name { get; set; }
/// <summary>
/// 接口URL地址
/// </summary>
[SugarColumn(ColumnName = "interface_url", Length = 500, IsNullable = true)]
public string Interface_Url { get; set; }
/// <summary>
/// 逻辑删除标识 (0:正常, 1:已删除)
/// </summary>
[SugarColumn(ColumnName = "is_deleted", IsIgnore = true)]
public bool Is_Deleted { get; set; }
/// <summary>
/// 最后更新时间
/// </summary>
[SugarColumn(ColumnName = "update_time", IsOnlyIgnoreUpdate = true)]
public DateTime Update_Time { get; set; }
}
}
+42
View File
@@ -0,0 +1,42 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace JinYuan.DAL.Service
{
public class BaseService<T> : IBaseService<T> where T : class, new()
{
protected readonly ISqlSugarClient _db;
public BaseService(ISqlSugarClient db) { _db = db; }
public virtual bool Add(T model)
{
return _db.Insertable(model).ExecuteCommand() > 0;
}
public virtual DataTable GetDataTable()
{
return _db.Queryable<T>().ToDataTable();
}
public virtual List<T> GetList()
{
return _db.Queryable<T>().ToList();
}
public virtual bool SoftDelete(int id)
{
return _db.Deleteable<T>().In(id).ExecuteCommand() > 0;
}
public virtual bool Update(T model)
{
return _db.Updateable(model).ExecuteCommand() > 0;
}
}
}
+21
View File
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace JinYuan.DAL.Service
{
public interface IBaseService<T> where T : class, new()
{
List<T> GetList();
DataTable GetDataTable();
bool Add(T model);
bool Update(T model);
bool SoftDelete(int id);
}
}
@@ -0,0 +1,91 @@
using JinYuan.DAL.Models;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JinYuan.DAL.Service
{
public interface IMaterialFrameRuleService : IBaseService<MaterialFrameRule>
{
MaterialFrameRule GetRuleByCode(string code);
}
public class MaterialFrameRuleService : BaseService<MaterialFrameRule>, IMaterialFrameRuleService
{
public MaterialFrameRuleService(ISqlSugarClient db) : base(db)
{ }
public override List<MaterialFrameRule> GetList()
{
return _db.Queryable<MaterialFrameRule>()
.Where(x => !x.Is_Deleted)
.OrderBy(x => x.Start_Code)
.ToList();
}
public override DataTable GetDataTable()
{
return _db.Queryable<MaterialFrameRule>()
.Where(x => !x.Is_Deleted)
.OrderBy(x => x.Start_Code)
.ToDataTable();
}
public override bool Add(MaterialFrameRule model)
{
// 车间 + 匹配编码 + isdelete = 0 的唯一性校验
bool isExist = _db.Queryable<MaterialFrameRule>()
.Where(x => x.Workshop_Code == model.Workshop_Code
&& x.Start_Code == model.Start_Code
&& !x.Is_Deleted)
.Any();
if (isExist)
{
throw new ArgumentException($"该车间{model.Workshop_Code}已存在该匹配编码{model.Start_Code}");
}
return base.Add(model);
}
public override bool Update(MaterialFrameRule model)
{
// 车间 + 匹配编码 + isdelete = 0 的唯一性校验
bool isExist = _db.Queryable<MaterialFrameRule>()
.Where(x => x.Workshop_Code == model.Workshop_Code
&& x.Start_Code == model.Start_Code
&& !x.Is_Deleted)
.Any();
if (isExist)
{
return false;
}
return base.Update(model);
}
public MaterialFrameRule GetRuleByCode(string code)
{
if (string.IsNullOrEmpty(code))
{
return null;
}
string matchStr = code.Substring(3, 4);
return _db.Queryable<MaterialFrameRule>()
.Where(x => matchStr.StartsWith(x.Start_Code) && !x.Is_Deleted)
.First();
}
public override bool SoftDelete(int id)
{
return _db.Updateable<MaterialFrameRule>()
.SetColumns(x => x.Is_Deleted == true)
.SetColumns(x => x.Update_Time == DateTime.Now)
.Where(x => x.Id == id)
.ExecuteCommand() > 0;
}
}
}
+43
View File
@@ -0,0 +1,43 @@
using JinYuan.DAL.Models;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JinYuan.DAL.Service
{
public interface IMesUrlService
{
string GetMesUrl(string trayCode, string interfaceKey);
}
public class MesUrlService : IMesUrlService
{
protected readonly ISqlSugarClient _db;
private MaterialFrameRuleService _ruleService;
private WorkshopInterCfgService _cfgService;
public MesUrlService(ISqlSugarClient db)
{
_db = db;
_ruleService = new MaterialFrameRuleService(_db);
_cfgService = new WorkshopInterCfgService(_db);
}
public string GetMesUrl(string trayCode, string interfaceKey)
{
if (string.IsNullOrEmpty(trayCode) || string.IsNullOrEmpty(interfaceKey))
return string.Empty;
var rule = _ruleService.GetRuleByCode(trayCode);
if (rule == null)
return string.Empty;
var url = _cfgService.GetUrl(rule.Workshop_Code, interfaceKey);
return url;
}
}
}
@@ -0,0 +1,87 @@
using JinYuan.DAL.Models;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JinYuan.DAL.Service
{
public interface IWorkshopInterCfgService : IBaseService<WorkshopInterfaceConfig>
{
string GetUrl(string workshopCode, string interfaceKey);
}
public class WorkshopInterCfgService : BaseService<WorkshopInterfaceConfig>, IWorkshopInterCfgService
{
public WorkshopInterCfgService(ISqlSugarClient db) : base(db)
{
}
public override List<WorkshopInterfaceConfig> GetList()
{
return _db.Queryable<WorkshopInterfaceConfig>()
.Where(x => !x.Is_Deleted)
.OrderBy(x => x.Workshop_Code)
.OrderBy(x => x.Interface_Flag)
.ToList();
}
public override DataTable GetDataTable()
{
return _db.Queryable<WorkshopInterfaceConfig>()
.Where(x => !x.Is_Deleted)
.OrderBy(x => x.Workshop_Code)
.OrderBy(x => x.Interface_Flag)
.ToDataTable();
}
public override bool Add(WorkshopInterfaceConfig model)
{
// 车间 + 接口标识 + isDeleted = 0 的唯一性校验
bool isExist = _db.Queryable<WorkshopInterfaceConfig>()
.Where(x => x.Workshop_Code == model.Workshop_Code && x.Interface_Flag == model.Interface_Flag && !x.Is_Deleted)
.Any();
if (isExist)
{
throw new ArgumentException($"该车间{model.Workshop_Code}已存在该接口{model.Interface_Flag}");
}
return base.Add(model);
}
public override bool Update(WorkshopInterfaceConfig model)
{
// 车间 + 接口标识 + isDeleted = 0 的唯一性校验
bool isExist = _db.Queryable<WorkshopInterfaceConfig>()
.Where(x => x.Workshop_Code == model.Workshop_Code && x.Interface_Flag == model.Interface_Flag && !x.Is_Deleted)
.Any();
if (isExist)
{
return false;
}
return base.Update(model);
}
public override bool SoftDelete(int id)
{
return _db.Updateable<WorkshopInterfaceConfig>()
.SetColumns(x => x.Is_Deleted == true)
.SetColumns(x => x.Update_Time == DateTime.Now)
.Where(x => x.Id == id)
.ExecuteCommand() > 0;
}
public string GetUrl(string workshopCode, string interfaceKey)
{
return _db.Queryable<WorkshopInterfaceConfig>()
.Where(x => x.Workshop_Code == workshopCode && x.Interface_Flag == interfaceKey && !x.Is_Deleted)
.Select(x => x.Interface_Url)
.First();
}
}
}
+21 -1
View File
@@ -8,10 +8,30 @@ namespace JinYuan.Models
{
public class ConstValue
{
#region 日志文件夹名称
/// <summary>
/// 料框查询接口标识
/// </summary>
public const string INTER_QueryTray = "QueryTrayUrl";
/// <summary>
/// 料框解绑接口标识
/// </summary>
public const string INTER_UnBindTray = "unBindTrayUrl";
/// <summary>
/// 定义车间偏移编号
/// 操作日志存储
/// </summary>
public static readonly Dictionary<string, short> WorkshopMap = new Dictionary<string, short>
{
{ "601", 1 },
{ "602", 2 },
{ "603", 3 },
{ "604", 4 }
};
#region 日志文件夹名称
public const string USER_LOG = "OperaLog";
#endregion
}
+1 -1
View File
@@ -26,7 +26,7 @@ namespace JinYuan.VirtualDataLibrary
/// <summary>
/// 本地数据库
/// </summary>
public static ISugarHelper db = new SQLSugarService();
public static SQLSugarService db = new SQLSugarService();
/// <summary>
/// 远程服务段数据库
/// </summary>
+23
View File
@@ -182,6 +182,29 @@ namespace JinYuan.VirtualDataLibrary
return 0;
}
/// <summary>
/// 将电池型号+车间转换成下发PLC的型号编号
/// </summary>
/// <returns></returns>
public short GetModelNum(string modelName, string workshopCode)
{
short defVal = 0;
bool existModel = modelMapping.TryGetValue(modelName, out int resModel);
if (!existModel)
{
return defVal; // 键存在,返回对应值
}
bool existCode = ConstValue.WorkshopMap.TryGetValue(workshopCode, out short workshopOffset);
if (!existCode)
{
workshopOffset = 0;
}
defVal = (short)(resModel * 10 + workshopOffset);
return defVal;
}
// 物流线各工位,生产型号写PLC地址
private Dictionary<string, string> modelPLCAddr_Mapping = new Dictionary<string, string>()
{
+382
View File
@@ -0,0 +1,382 @@
namespace LargeSquareOne
{
partial class FrmInterCfg
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
this.panelEnhanced1 = new System.Windows.Forms.Panel();
this.panel_mid = new System.Windows.Forms.Panel();
this.btn_interSave = new System.Windows.Forms.Button();
this.btn_interDelete = new System.Windows.Forms.Button();
this.btn_interAdd = new System.Windows.Forms.Button();
this.dgv_workInterface = new System.Windows.Forms.DataGridView();
this.label2 = new AntdUI.Label();
this.panel_bottom = new System.Windows.Forms.Panel();
this.btn_test = new System.Windows.Forms.Button();
this.btn_exit = new System.Windows.Forms.Button();
this.panel_top = new System.Windows.Forms.Panel();
this.btn_codeDelete = new System.Windows.Forms.Button();
this.btn_codeSave = new System.Windows.Forms.Button();
this.btn_codeAdd = new System.Windows.Forms.Button();
this.label1 = new AntdUI.Label();
this.dgv_materialRul = new System.Windows.Forms.DataGridView();
this.bindingSource_frameRule = new System.Windows.Forms.BindingSource(this.components);
this.bindingSource_workInterface = new System.Windows.Forms.BindingSource(this.components);
this.panelEnhanced1.SuspendLayout();
this.panel_mid.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgv_workInterface)).BeginInit();
this.panel_bottom.SuspendLayout();
this.panel_top.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgv_materialRul)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.bindingSource_frameRule)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.bindingSource_workInterface)).BeginInit();
this.SuspendLayout();
//
// panelEnhanced1
//
this.panelEnhanced1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(14)))), ((int)(((byte)(23)))), ((int)(((byte)(38)))));
this.panelEnhanced1.Controls.Add(this.panel_mid);
this.panelEnhanced1.Controls.Add(this.panel_bottom);
this.panelEnhanced1.Controls.Add(this.panel_top);
this.panelEnhanced1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panelEnhanced1.Location = new System.Drawing.Point(0, 0);
this.panelEnhanced1.Name = "panelEnhanced1";
this.panelEnhanced1.Size = new System.Drawing.Size(1207, 766);
this.panelEnhanced1.TabIndex = 0;
//
// panel_mid
//
this.panel_mid.BackColor = System.Drawing.Color.Transparent;
this.panel_mid.Controls.Add(this.btn_interSave);
this.panel_mid.Controls.Add(this.btn_interDelete);
this.panel_mid.Controls.Add(this.btn_interAdd);
this.panel_mid.Controls.Add(this.dgv_workInterface);
this.panel_mid.Controls.Add(this.label2);
this.panel_mid.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel_mid.Location = new System.Drawing.Point(0, 327);
this.panel_mid.Name = "panel_mid";
this.panel_mid.Size = new System.Drawing.Size(1207, 339);
this.panel_mid.TabIndex = 1;
//
// btn_interSave
//
this.btn_interSave.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(3)))), ((int)(((byte)(27)))), ((int)(((byte)(78)))));
this.btn_interSave.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_interSave.Font = new System.Drawing.Font("微软雅黑", 11.5F);
this.btn_interSave.ForeColor = System.Drawing.Color.White;
this.btn_interSave.Location = new System.Drawing.Point(1032, 230);
this.btn_interSave.Name = "btn_interSave";
this.btn_interSave.Size = new System.Drawing.Size(103, 42);
this.btn_interSave.TabIndex = 6;
this.btn_interSave.Text = "保存";
this.btn_interSave.UseVisualStyleBackColor = false;
this.btn_interSave.Click += new System.EventHandler(this.btn_interSave_Click);
//
// btn_interDelete
//
this.btn_interDelete.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(3)))), ((int)(((byte)(27)))), ((int)(((byte)(78)))));
this.btn_interDelete.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_interDelete.Font = new System.Drawing.Font("微软雅黑", 11.5F);
this.btn_interDelete.ForeColor = System.Drawing.Color.White;
this.btn_interDelete.Location = new System.Drawing.Point(1032, 145);
this.btn_interDelete.Name = "btn_interDelete";
this.btn_interDelete.Size = new System.Drawing.Size(103, 42);
this.btn_interDelete.TabIndex = 5;
this.btn_interDelete.Text = "删除";
this.btn_interDelete.UseVisualStyleBackColor = false;
this.btn_interDelete.Click += new System.EventHandler(this.btn_interDelete_Click);
//
// btn_interAdd
//
this.btn_interAdd.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(3)))), ((int)(((byte)(27)))), ((int)(((byte)(78)))));
this.btn_interAdd.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_interAdd.Font = new System.Drawing.Font("微软雅黑", 11.5F);
this.btn_interAdd.ForeColor = System.Drawing.Color.White;
this.btn_interAdd.Location = new System.Drawing.Point(1032, 61);
this.btn_interAdd.Name = "btn_interAdd";
this.btn_interAdd.Size = new System.Drawing.Size(103, 42);
this.btn_interAdd.TabIndex = 4;
this.btn_interAdd.Text = "增加";
this.btn_interAdd.UseVisualStyleBackColor = false;
this.btn_interAdd.Click += new System.EventHandler(this.btn_interAdd_Click);
//
// dgv_workInterface
//
this.dgv_workInterface.AllowUserToAddRows = false;
this.dgv_workInterface.AllowUserToDeleteRows = false;
this.dgv_workInterface.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(11)))), ((int)(((byte)(20)))), ((int)(((byte)(36)))));
this.dgv_workInterface.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.dgv_workInterface.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(11)))), ((int)(((byte)(20)))), ((int)(((byte)(36)))));
dataGridViewCellStyle7.Font = new System.Drawing.Font("微软雅黑", 10.5F);
dataGridViewCellStyle7.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle7.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(11)))), ((int)(((byte)(20)))), ((int)(((byte)(36)))));
dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgv_workInterface.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7;
this.dgv_workInterface.ColumnHeadersHeight = 29;
this.dgv_workInterface.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle8.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(11)))), ((int)(((byte)(20)))), ((int)(((byte)(36)))));
dataGridViewCellStyle8.Font = new System.Drawing.Font("微软雅黑", 10.5F);
dataGridViewCellStyle8.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle8.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(20)))), ((int)(((byte)(80)))));
dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgv_workInterface.DefaultCellStyle = dataGridViewCellStyle8;
this.dgv_workInterface.EnableHeadersVisualStyles = false;
this.dgv_workInterface.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(77)))), ((int)(((byte)(147)))));
this.dgv_workInterface.Location = new System.Drawing.Point(29, 47);
this.dgv_workInterface.Name = "dgv_workInterface";
this.dgv_workInterface.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle9.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(6)))), ((int)(((byte)(40)))), ((int)(((byte)(86)))));
dataGridViewCellStyle9.Font = new System.Drawing.Font("微软雅黑", 10.5F);
dataGridViewCellStyle9.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle9.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(20)))), ((int)(((byte)(80)))));
dataGridViewCellStyle9.SelectionForeColor = System.Drawing.Color.White;
dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dgv_workInterface.RowHeadersDefaultCellStyle = dataGridViewCellStyle9;
this.dgv_workInterface.RowHeadersWidth = 51;
this.dgv_workInterface.RowTemplate.Height = 27;
this.dgv_workInterface.Size = new System.Drawing.Size(942, 269);
this.dgv_workInterface.TabIndex = 3;
//
// label2
//
this.label2.Font = new System.Drawing.Font("微软雅黑", 12F);
this.label2.ForeColor = System.Drawing.Color.White;
this.label2.Location = new System.Drawing.Point(29, 18);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(132, 23);
this.label2.TabIndex = 2;
this.label2.Text = "车间与接口";
//
// panel_bottom
//
this.panel_bottom.BackColor = System.Drawing.Color.Transparent;
this.panel_bottom.Controls.Add(this.btn_test);
this.panel_bottom.Controls.Add(this.btn_exit);
this.panel_bottom.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel_bottom.Location = new System.Drawing.Point(0, 666);
this.panel_bottom.Name = "panel_bottom";
this.panel_bottom.Size = new System.Drawing.Size(1207, 100);
this.panel_bottom.TabIndex = 2;
//
// btn_test
//
this.btn_test.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(3)))), ((int)(((byte)(27)))), ((int)(((byte)(78)))));
this.btn_test.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_test.Font = new System.Drawing.Font("微软雅黑", 11.5F);
this.btn_test.ForeColor = System.Drawing.Color.White;
this.btn_test.Location = new System.Drawing.Point(1092, 29);
this.btn_test.Name = "btn_test";
this.btn_test.Size = new System.Drawing.Size(103, 42);
this.btn_test.TabIndex = 5;
this.btn_test.Text = "For Test";
this.btn_test.UseVisualStyleBackColor = false;
this.btn_test.Visible = false;
this.btn_test.Click += new System.EventHandler(this.btn_test_Click);
//
// btn_exit
//
this.btn_exit.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(3)))), ((int)(((byte)(27)))), ((int)(((byte)(78)))));
this.btn_exit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_exit.Font = new System.Drawing.Font("微软雅黑", 11.5F);
this.btn_exit.ForeColor = System.Drawing.Color.White;
this.btn_exit.Location = new System.Drawing.Point(552, 29);
this.btn_exit.Name = "btn_exit";
this.btn_exit.Size = new System.Drawing.Size(103, 42);
this.btn_exit.TabIndex = 4;
this.btn_exit.Text = "退出";
this.btn_exit.UseVisualStyleBackColor = false;
this.btn_exit.Click += new System.EventHandler(this.btn_exit_Click);
//
// panel_top
//
this.panel_top.BackColor = System.Drawing.Color.Transparent;
this.panel_top.Controls.Add(this.btn_codeDelete);
this.panel_top.Controls.Add(this.btn_codeSave);
this.panel_top.Controls.Add(this.btn_codeAdd);
this.panel_top.Controls.Add(this.label1);
this.panel_top.Controls.Add(this.dgv_materialRul);
this.panel_top.Dock = System.Windows.Forms.DockStyle.Top;
this.panel_top.Location = new System.Drawing.Point(0, 0);
this.panel_top.Name = "panel_top";
this.panel_top.Size = new System.Drawing.Size(1207, 327);
this.panel_top.TabIndex = 0;
//
// btn_codeDelete
//
this.btn_codeDelete.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(3)))), ((int)(((byte)(27)))), ((int)(((byte)(78)))));
this.btn_codeDelete.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_codeDelete.Font = new System.Drawing.Font("微软雅黑", 11.5F);
this.btn_codeDelete.ForeColor = System.Drawing.Color.White;
this.btn_codeDelete.Location = new System.Drawing.Point(798, 136);
this.btn_codeDelete.Name = "btn_codeDelete";
this.btn_codeDelete.Size = new System.Drawing.Size(103, 42);
this.btn_codeDelete.TabIndex = 4;
this.btn_codeDelete.Text = "删除";
this.btn_codeDelete.UseVisualStyleBackColor = false;
this.btn_codeDelete.Click += new System.EventHandler(this.btn_codeDelete_Click);
//
// btn_codeSave
//
this.btn_codeSave.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(3)))), ((int)(((byte)(27)))), ((int)(((byte)(78)))));
this.btn_codeSave.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_codeSave.Font = new System.Drawing.Font("微软雅黑", 11.5F);
this.btn_codeSave.ForeColor = System.Drawing.Color.White;
this.btn_codeSave.Location = new System.Drawing.Point(798, 200);
this.btn_codeSave.Name = "btn_codeSave";
this.btn_codeSave.Size = new System.Drawing.Size(103, 42);
this.btn_codeSave.TabIndex = 3;
this.btn_codeSave.Text = "保存";
this.btn_codeSave.UseVisualStyleBackColor = false;
this.btn_codeSave.Click += new System.EventHandler(this.btn_codeSave_Click);
//
// btn_codeAdd
//
this.btn_codeAdd.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(3)))), ((int)(((byte)(27)))), ((int)(((byte)(78)))));
this.btn_codeAdd.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_codeAdd.Font = new System.Drawing.Font("微软雅黑", 11.5F);
this.btn_codeAdd.ForeColor = System.Drawing.Color.White;
this.btn_codeAdd.Location = new System.Drawing.Point(798, 67);
this.btn_codeAdd.Name = "btn_codeAdd";
this.btn_codeAdd.Size = new System.Drawing.Size(103, 42);
this.btn_codeAdd.TabIndex = 2;
this.btn_codeAdd.Text = "增加";
this.btn_codeAdd.UseVisualStyleBackColor = false;
this.btn_codeAdd.Click += new System.EventHandler(this.btn_codeAdd_Click);
//
// label1
//
this.label1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.label1.ForeColor = System.Drawing.Color.White;
this.label1.Location = new System.Drawing.Point(29, 12);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(132, 23);
this.label1.TabIndex = 1;
this.label1.Text = "料框码与车间";
//
// dgv_materialRul
//
this.dgv_materialRul.AllowUserToAddRows = false;
this.dgv_materialRul.AllowUserToDeleteRows = false;
this.dgv_materialRul.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(11)))), ((int)(((byte)(20)))), ((int)(((byte)(36)))));
this.dgv_materialRul.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.dgv_materialRul.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle10.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(11)))), ((int)(((byte)(20)))), ((int)(((byte)(36)))));
dataGridViewCellStyle10.Font = new System.Drawing.Font("微软雅黑", 10.5F);
dataGridViewCellStyle10.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle10.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(11)))), ((int)(((byte)(20)))), ((int)(((byte)(36)))));
dataGridViewCellStyle10.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgv_materialRul.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle10;
this.dgv_materialRul.ColumnHeadersHeight = 29;
this.dgv_materialRul.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle11.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(11)))), ((int)(((byte)(20)))), ((int)(((byte)(36)))));
dataGridViewCellStyle11.Font = new System.Drawing.Font("微软雅黑", 10.5F);
dataGridViewCellStyle11.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle11.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(20)))), ((int)(((byte)(80)))));
dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgv_materialRul.DefaultCellStyle = dataGridViewCellStyle11;
this.dgv_materialRul.EnableHeadersVisualStyles = false;
this.dgv_materialRul.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(77)))), ((int)(((byte)(147)))));
this.dgv_materialRul.Location = new System.Drawing.Point(29, 51);
this.dgv_materialRul.Name = "dgv_materialRul";
this.dgv_materialRul.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle12.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(6)))), ((int)(((byte)(40)))), ((int)(((byte)(86)))));
dataGridViewCellStyle12.Font = new System.Drawing.Font("微软雅黑", 10.5F);
dataGridViewCellStyle12.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle12.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(20)))), ((int)(((byte)(80)))));
dataGridViewCellStyle12.SelectionForeColor = System.Drawing.Color.White;
dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dgv_materialRul.RowHeadersDefaultCellStyle = dataGridViewCellStyle12;
this.dgv_materialRul.RowHeadersWidth = 51;
this.dgv_materialRul.RowTemplate.Height = 27;
this.dgv_materialRul.Size = new System.Drawing.Size(731, 245);
this.dgv_materialRul.TabIndex = 0;
//
// FrmInterCfg
//
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 23F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1207, 766);
this.Controls.Add(this.panelEnhanced1);
this.Font = new System.Drawing.Font("微软雅黑", 10.5F);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.Name = "FrmInterCfg";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "FrmInterCfg";
this.Load += new System.EventHandler(this.FrmInterCfg_Load);
this.panelEnhanced1.ResumeLayout(false);
this.panel_mid.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgv_workInterface)).EndInit();
this.panel_bottom.ResumeLayout(false);
this.panel_top.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgv_materialRul)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.bindingSource_frameRule)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.bindingSource_workInterface)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel panelEnhanced1;
private System.Windows.Forms.Panel panel_bottom;
private System.Windows.Forms.Panel panel_mid;
private System.Windows.Forms.Panel panel_top;
private AntdUI.Label label1;
private System.Windows.Forms.DataGridView dgv_materialRul;
private System.Windows.Forms.Button btn_codeSave;
private System.Windows.Forms.Button btn_codeAdd;
private System.Windows.Forms.BindingSource bindingSource_frameRule;
private System.Windows.Forms.Button btn_exit;
private System.Windows.Forms.Button btn_codeDelete;
private System.Windows.Forms.Button btn_interSave;
private System.Windows.Forms.Button btn_interDelete;
private System.Windows.Forms.Button btn_interAdd;
private System.Windows.Forms.DataGridView dgv_workInterface;
private AntdUI.Label label2;
private System.Windows.Forms.BindingSource bindingSource_workInterface;
private System.Windows.Forms.Button btn_test;
}
}
+386
View File
@@ -0,0 +1,386 @@
using JinYuan.ControlCenters;
using JinYuan.DAL.Models;
using JinYuan.DAL.Service;
using JinYuan.MES.Models;
using JinYuan.Models;
using JinYuan.VirtualDataLibrary;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LargeSquareOne
{
public partial class FrmInterCfg : Form
{
public FrmInterCfg()
{
InitializeComponent();
InitDgv();
}
private void InitDgv()
{
#region 料框码与车间
DataGridViewTextBoxColumn column_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
column_ID.HeaderText = "ID";
column_ID.MinimumWidth = 6;
column_ID.Name = "Column_ID";
column_ID.Visible = false;
column_ID.Width = 125;
column_ID.DataPropertyName = "ID";
DataGridViewTextBoxColumn column_StartCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
column_StartCode.HeaderText = "料框码匹配编码(第4-7位)";
column_StartCode.MinimumWidth = 6;
column_StartCode.Name = "Column_StartCode";
column_StartCode.Width = 225;
column_StartCode.DataPropertyName = "start_code";
column_StartCode.AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader;
column_StartCode.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
DataGridViewTextBoxColumn column_WorkshopCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
column_WorkshopCode.HeaderText = "车间";
column_WorkshopCode.MinimumWidth = 6;
column_WorkshopCode.Name = "Column_WorkshopCode";
column_WorkshopCode.Width = 225;
column_WorkshopCode.DataPropertyName = "workshop_code";
column_WorkshopCode.AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader;
column_WorkshopCode.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
DataGridViewTextBoxColumn column_IsDeleted = new System.Windows.Forms.DataGridViewTextBoxColumn();
column_IsDeleted.HeaderText = "是否删除";
column_IsDeleted.MinimumWidth = 6;
column_IsDeleted.Name = "Column_IsDeleted";
column_IsDeleted.Visible = false;
column_IsDeleted.Width = 125;
column_IsDeleted.DataPropertyName = "is_deleted";
DataGridViewTextBoxColumn column_updateTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
column_updateTime.HeaderText = "更新时间";
column_updateTime.MinimumWidth = 6;
column_updateTime.Name = "Column_updateTime";
column_updateTime.Visible = false;
column_updateTime.Width = 125;
column_updateTime.DataPropertyName = "update_time";
dgv_materialRul.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
column_ID,
column_StartCode,
column_WorkshopCode,
column_IsDeleted,
column_updateTime
});
#endregion
#region 车间与接口
DataGridViewTextBoxColumn colInter_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
colInter_ID.HeaderText = "ID";
colInter_ID.MinimumWidth = 6;
colInter_ID.Name = "colInter_ID";
colInter_ID.Visible = false;
colInter_ID.Width = 125;
colInter_ID.DataPropertyName = "ID";
DataGridViewTextBoxColumn colInter_workShopCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
colInter_workShopCode.HeaderText = "车间编码";
colInter_workShopCode.MinimumWidth = 6;
colInter_workShopCode.Name = "colInter_workShopCode";
colInter_workShopCode.Width = 225;
colInter_workShopCode.DataPropertyName = "workshop_code";
colInter_workShopCode.AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader;
colInter_workShopCode.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
DataGridViewTextBoxColumn colInter_interFlag = new System.Windows.Forms.DataGridViewTextBoxColumn();
colInter_interFlag.HeaderText = "接口标识";
colInter_interFlag.MinimumWidth = 6;
colInter_interFlag.Name = "colInter_interFlag";
colInter_interFlag.Width = 225;
colInter_interFlag.DataPropertyName = "interface_flag";
colInter_interFlag.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
colInter_interFlag.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
DataGridViewTextBoxColumn colInter_interName = new System.Windows.Forms.DataGridViewTextBoxColumn();
colInter_interName.HeaderText = "接口名称";
colInter_interName.MinimumWidth = 6;
colInter_interName.Name = "colInter_interName";
colInter_interName.Width = 225;
colInter_interName.DataPropertyName = "interface_name";
colInter_interName.AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader;
colInter_interName.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
DataGridViewTextBoxColumn colInter_interUrl = new System.Windows.Forms.DataGridViewTextBoxColumn();
colInter_interUrl.HeaderText = "接口URL地址";
colInter_interUrl.MinimumWidth = 6;
colInter_interUrl.Name = "colInter_interUrl";
colInter_interUrl.Width = 225;
colInter_interUrl.DataPropertyName = "interface_url";
colInter_interUrl.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
colInter_interUrl.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
DataGridViewTextBoxColumn colInter_IsDeleted = new System.Windows.Forms.DataGridViewTextBoxColumn();
colInter_IsDeleted.HeaderText = "是否删除";
colInter_IsDeleted.MinimumWidth = 6;
colInter_IsDeleted.Name = "colInter_IsDeleted";
colInter_IsDeleted.Visible = false;
colInter_IsDeleted.Width = 125;
colInter_IsDeleted.DataPropertyName = "is_deleted";
DataGridViewTextBoxColumn colInter_updateTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
colInter_updateTime.HeaderText = "更新时间";
colInter_updateTime.MinimumWidth = 6;
colInter_updateTime.Name = "colInter_updateTime";
colInter_updateTime.Visible = false;
colInter_updateTime.Width = 125;
colInter_updateTime.DataPropertyName = "update_time";
dgv_workInterface.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
colInter_ID,
colInter_workShopCode,
colInter_interFlag,
colInter_interName,
colInter_interUrl,
colInter_IsDeleted,
colInter_updateTime
});
#endregion
}
private MaterialFrameRuleService ruleService;
private WorkshopInterCfgService interService;
private void InitDgvData()
{
ruleService = new MaterialFrameRuleService(CommonMethods.db.Db);
DataTable ruleDt = ruleService.GetDataTable();
bindingSource_frameRule.DataSource = ruleDt;
dgv_materialRul.DataSource = bindingSource_frameRule;
dgv_materialRul.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader);
interService = new WorkshopInterCfgService(CommonMethods.db.Db);
DataTable interDt = interService.GetDataTable();
bindingSource_workInterface.DataSource = interDt;
dgv_workInterface.DataSource = bindingSource_workInterface;
dgv_workInterface.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader);
}
private void FrmInterCfg_Load(object sender, EventArgs e)
{
InitDgvData();
}
private void btn_exit_Click(object sender, EventArgs e)
{
this.Close();
}
#region 料框码与车间
private void btn_codeAdd_Click(object sender, EventArgs e)
{
bindingSource_frameRule.AddNew();
}
private void btn_codeSave_Click(object sender, EventArgs e)
{
DataTable dt = bindingSource_frameRule.DataSource as DataTable;
StringBuilder sb = new StringBuilder();
MaterialFrameRule model = null;
foreach (DataRow row in dt.Rows)
{
if (row.RowState == DataRowState.Deleted)
{
continue;
}
try
{
model = row.ToModel<MaterialFrameRule>();
switch (row.RowState)
{
case DataRowState.Added:
// 调用新增方法
ruleService.Add(model);
break;
case DataRowState.Modified:
// 调用修改方法
ruleService.Update(model);
break;
//case DataRowState.Deleted:
// // 调用删除方法
// ruleService.SoftDelete(model.Id);
// break;
case DataRowState.Unchanged:
// 未更改,不处理
break;
default:
break;
}
}
catch (Exception ex)
{
// 收集错误信息
sb.AppendLine($"处理行时发生错误: {ex.Message}");
}
}
// 如果有错误信息,一起展示
if (sb.Length > 0)
{
MessageBox.Show(sb.ToString(), "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
DataTable ruleDt = ruleService.GetDataTable();
bindingSource_frameRule.DataSource = ruleDt;
}
private void btn_codeDelete_Click(object sender, EventArgs e)
{
// 获取选中的行删除
foreach (DataGridViewRow row in dgv_materialRul.SelectedRows)
{
object colVal = row.Cells["Column_ID"].Value;
if (colVal == null)
{
bindingSource_frameRule.RemoveAt(row.Index);
continue;
}
int id = Convert.ToInt32(colVal);
bindingSource_frameRule.RemoveAt(row.Index);
ruleService.SoftDelete(id);
}
}
#endregion
#region 车间与接口
private void btn_interAdd_Click(object sender, EventArgs e)
{
bindingSource_workInterface.AddNew();
}
private void btn_interDelete_Click(object sender, EventArgs e)
{
// 获取选中的行删除
foreach (DataGridViewRow row in dgv_workInterface.SelectedRows)
{
object colVal = row.Cells["colInter_ID"].Value;
if (colVal == null)
{
bindingSource_workInterface.RemoveAt(row.Index);
continue;
}
int id = Convert.ToInt32(colVal);
bindingSource_workInterface.RemoveAt(row.Index);
interService.SoftDelete(id);
}
}
private void btn_interSave_Click(object sender, EventArgs e)
{
DataTable dt = bindingSource_workInterface.DataSource as DataTable;
StringBuilder sb = new StringBuilder();
WorkshopInterfaceConfig model = null;
foreach (DataRow row in dt.Rows)
{
if (row.RowState == DataRowState.Deleted)
{
continue;
}
try
{
model = row.ToModel<WorkshopInterfaceConfig>();
switch (row.RowState)
{
case DataRowState.Added:
// 调用新增方法
interService.Add(model);
break;
case DataRowState.Modified:
// 调用修改方法
interService.Update(model);
break;
//case DataRowState.Deleted:
// // 调用删除方法
// ruleService.SoftDelete(model.Id);
// break;
case DataRowState.Unchanged:
// 未更改,不处理
break;
default:
break;
}
}
catch (Exception ex)
{
// 收集错误信息
sb.AppendLine($"处理行时发生错误: {ex.Message}");
}
}
// 如果有错误信息,一起展示
if (sb.Length > 0)
{
MessageBox.Show(sb.ToString(), "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
DataTable ruleDt = ruleService.GetDataTable();
bindingSource_frameRule.DataSource = ruleDt;
}
#endregion
private void btn_test_Click(object sender, EventArgs e)
{
string trayId = "PLT60I10032567";
string modelName = "LF350S";
//UnbindTrayInfo(trayId).ConfigureAwait(false);
MaterialFrameRuleService service = new MaterialFrameRuleService(CommonMethods.db.Db);
MaterialFrameRule rule = service.GetRuleByCode(trayId);
short model = CommonMethods.mesConfig.GetModelNum(modelName, rule?.Workshop_Code ?? string.Empty);
}
private async Task<(bool success, string mesMessage)> UnbindTrayInfo(string trayID)
{
try
{
MesUrlService service = new MesUrlService(CommonMethods.db.Db);
string url = service.GetMesUrl(trayID, ConstValue.INTER_UnBindTray);
if (string.IsNullOrEmpty(url))
{
throw new ArgumentException($"未找到{ConstValue.INTER_UnBindTray}对应的MES接口地址");
}
var (success, mesMessage) = await CommonMethods.hbgMes.UnbindTrayInfosAsync(
url,
CommonMethods.mesConfig.equipNum,
trayID
).ConfigureAwait(false);
return (success, mesMessage);
}
catch (Exception ex)
{
return (false, $"MES解绑失败{ex.Message}");
}
}
}
}
+126
View File
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="bindingSource_frameRule.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="bindingSource_workInterface.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>265, 17</value>
</metadata>
</root>
+6 -6
View File
@@ -1181,12 +1181,12 @@ namespace LargeSquareOne
case FormNames.用户管理:
frm = new FrmUserManage();
break;
//case FormNames.电池状况:
// frm = new FrmBatteryStatus();
// CommonMethods.ShowBatteryStatusDelegate += ((FrmBatteryStatus)frm).ShowBatteryStatus;//电池状态显示
// CommonMethods.ShowBatteryNGRsnDelegate += ((FrmBatteryStatus)frm).ShowBatteryNGRsn;//档位NG原因显示
// CommonMethods.ShowBatteryReplaceDelegate += ((FrmBatteryStatus)frm).ShowBatteryReplace;
// break;
case FormNames.电池状况:
frm = new FrmBatteryStatus();
CommonMethods.ShowBatteryStatusDelegate += ((FrmBatteryStatus)frm).ShowBatteryStatus;//电池状态显示
CommonMethods.ShowBatteryNGRsnDelegate += ((FrmBatteryStatus)frm).ShowBatteryNGRsn;//档位NG原因显示
CommonMethods.ShowBatteryReplaceDelegate += ((FrmBatteryStatus)frm).ShowBatteryReplace;
break;
//case FormNames.二维码:
// frm = new FrmQRCoder();
// CommonMethods.ShowBatteryQRCoderDelegate += ((FrmQRCoder)frm).ShowBatteryQRCoder;
+19
View File
@@ -124,6 +124,7 @@
this.txtQueryGrade = new System.Windows.Forms.TextBox();
this.lblUpResultParam = new System.Windows.Forms.Label();
this.txtUpResultParam = new System.Windows.Forms.TextBox();
this.btn_cfgUrl = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dgvPlcConfigs)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dgvFdConfigs)).BeginInit();
this.capacityGroupBox.SuspendLayout();
@@ -468,6 +469,7 @@
//
// txtQueryTray
//
this.txtQueryTray.Enabled = false;
this.txtQueryTray.Font = new System.Drawing.Font("Cambria", 10.5F, System.Drawing.FontStyle.Bold);
this.txtQueryTray.Location = new System.Drawing.Point(64, 618);
this.txtQueryTray.Name = "txtQueryTray";
@@ -1199,6 +1201,7 @@
//
// txtUnbind
//
this.txtUnbind.Enabled = false;
this.txtUnbind.Font = new System.Drawing.Font("Cambria", 10.5F, System.Drawing.FontStyle.Bold);
this.txtUnbind.Location = new System.Drawing.Point(64, 795);
this.txtUnbind.Name = "txtUnbind";
@@ -1293,12 +1296,27 @@
this.txtUpResultParam.Size = new System.Drawing.Size(580, 24);
this.txtUpResultParam.TabIndex = 111;
//
// btn_cfgUrl
//
this.btn_cfgUrl.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(3)))), ((int)(((byte)(27)))), ((int)(((byte)(78)))));
this.btn_cfgUrl.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_cfgUrl.Font = new System.Drawing.Font("Cambria", 10.5F, System.Drawing.FontStyle.Bold);
this.btn_cfgUrl.ForeColor = System.Drawing.Color.White;
this.btn_cfgUrl.Location = new System.Drawing.Point(674, 784);
this.btn_cfgUrl.Name = "btn_cfgUrl";
this.btn_cfgUrl.Size = new System.Drawing.Size(137, 44);
this.btn_cfgUrl.TabIndex = 113;
this.btn_cfgUrl.Text = "其它接口配置";
this.btn_cfgUrl.UseVisualStyleBackColor = false;
this.btn_cfgUrl.Click += new System.EventHandler(this.btn_cfgUrl_Click);
//
// FrmSystemSet
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(14)))), ((int)(((byte)(23)))), ((int)(((byte)(38)))));
this.ClientSize = new System.Drawing.Size(1874, 868);
this.Controls.Add(this.btn_cfgUrl);
this.Controls.Add(this.lblUpResultParam);
this.Controls.Add(this.txtUpResultParam);
this.Controls.Add(this.lblQueryGrade);
@@ -1486,5 +1504,6 @@
private System.Windows.Forms.TextBox txtQueryGrade;
private System.Windows.Forms.Label lblUpResultParam;
private System.Windows.Forms.TextBox txtUpResultParam;
private System.Windows.Forms.Button btn_cfgUrl;
}
}
+5
View File
@@ -1921,5 +1921,10 @@ namespace LargeSquareOne
}
}
private void btn_cfgUrl_Click(object sender, EventArgs e)
{
FrmInterCfg frm = new FrmInterCfg();
frm.ShowDialog();
}
}
}
+9
View File
@@ -239,6 +239,12 @@
<Compile Include="FrmHelper.Designer.cs">
<DependentUpon>FrmHelper.cs</DependentUpon>
</Compile>
<Compile Include="FrmInterCfg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmInterCfg.Designer.cs">
<DependentUpon>FrmInterCfg.cs</DependentUpon>
</Compile>
<Compile Include="FrmLogin.cs">
<SubType>Form</SubType>
</Compile>
@@ -375,6 +381,9 @@
<EmbeddedResource Include="FrmHelper.resx">
<DependentUpon>FrmHelper.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmInterCfg.resx">
<DependentUpon>FrmInterCfg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmLogin.en.resx">
<DependentUpon>FrmLogin.cs</DependentUpon>
</EmbeddedResource>
@@ -0,0 +1,20 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("UnitTestProject")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UnitTestProject")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("dd9ebab8-7a56-470d-92a6-60ceede963f7")]
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+45
View File
@@ -0,0 +1,45 @@
using JinYuan.DAL.Models;
using JinYuan.DAL.Service;
using JinYuan.VirtualDataLibrary;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
namespace UnitTestProject
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
string modelName = "LF350S";
string workshopCode = "601";
short model = CommonMethods.mesConfig.GetModelNum(modelName, workshopCode);
Assert.IsTrue(model == 11);
}
[TestMethod]
public void TestMethod2()
{
string modelName = "LF350X";
string workshopCode = "601";
short model = CommonMethods.mesConfig.GetModelNum(modelName, workshopCode);
Assert.IsTrue(model == 0);
}
[TestMethod]
public void TestMethod3()
{
string modelName = "LF350S";
string workshopCode = "609";
short model = CommonMethods.mesConfig.GetModelNum(modelName, workshopCode);
Assert.IsTrue(model == 10);
}
}
}
+82
View File
@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{DD9EBAB8-7A56-470D-92A6-60CEEDE963F7}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UnitTestProject</RootNamespace>
<AssemblyName>UnitTestProject</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.2.2.10\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.2.2.10\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
</Reference>
<Reference Include="SqlSugar, Version=5.1.4.199, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\LargeSquareOne\bin\Debug\SqlSugar.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="UnitTest1.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\JinYuan.DAL\JinYuan.DAL.csproj">
<Project>{114AA012-29C9-418C-A2D6-3173C5341F51}</Project>
<Name>JinYuan.DAL</Name>
</ProjectReference>
<ProjectReference Include="..\JinYuan.VirtualDataLibrary\JinYuan.VirtualDataLibrary.csproj">
<Project>{2AB7E380-7795-448A-933C-0F6A081B5E7E}</Project>
<Name>JinYuan.VirtualDataLibrary</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.targets'))" />
</Target>
<Import Project="..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.targets')" />
</Project>
+5
View File
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MSTest.TestAdapter" version="2.2.10" targetFramework="net48" />
<package id="MSTest.TestFramework" version="2.2.10" targetFramework="net48" />
</packages>
+50
View File
@@ -0,0 +1,50 @@
-- ----------------------------
-- 1. 料框码规则表(存储料框码起始编码与车间的对应关系)
-- ----------------------------
DROP TABLE IF EXISTS `material_frame_rule`;
CREATE TABLE `material_frame_rule` (
`id` INT NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`start_code` VARCHAR(20) NOT NULL COMMENT '料框码规则匹配编码(第4-7位)',
`workshop_code` VARCHAR(10) NOT NULL COMMENT '车间编码',
`is_deleted` TINYINT(1) DEFAULT 0 COMMENT '0:正常, 1:已删除(误删可恢复)',
`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_start_code` (`start_code`) -- 起始编码唯一约束
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='料框码规则表';
-- ----------------------------
-- 2. 车间接口配置表(存储车间与接口的映射关系)
-- ----------------------------
DROP TABLE IF EXISTS `workshop_interface_config`;
CREATE TABLE `workshop_interface_config` (
`id` INT NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`workshop_code` VARCHAR(10) NOT NULL COMMENT '车间编码',
`interface_flag` VARCHAR(50) NOT NULL COMMENT '接口标识',
`interface_name` VARCHAR(100) NOT NULL COMMENT '接口名称',
`interface_url` VARCHAR(255) NOT NULL COMMENT '接口URL',
`is_deleted` TINYINT(1) DEFAULT 0 COMMENT '0:正常, 1:已删除(误删可恢复)',
`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_workshop_interface` (`workshop_code`, `interface_flag`) -- 车间+接口标识唯一约束
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='车间接口配置表';
-- ----------------------------
-- 3. 初始化示例数据(根据业务需求调整)
-- ----------------------------
INSERT INTO `material_frame_rule` (`start_code`, `workshop_code`) VALUES
('60I1', '601'),
('60I2', '602'),
('60I3', '603'),
('60I4', '604');
INSERT INTO `workshop_interface_config` (`workshop_code`, `interface_flag`, `interface_name`, `interface_url`) VALUES
('601', 'QueryTrayUrl', '料框查询', 'http://10.22.160.9/prod-api/produce/trayQuery/trayComposeInfo'),
('601', 'unBindTrayUrl', '料框解绑', 'http://10.22.160.9/prod-api/api/fms/mp/unbindWholeTray'),
('602', 'QueryTrayUrl', '料框查询', 'http://10.22.160.84/prod-api/produce/trayQuery/trayComposeInfo'),
('602', 'unBindTrayUrl', '料框解绑', 'http://10.22.160.84/prod-api/api/fms/mp/unbindWholeTray'),
('603', 'QueryTrayUrl', '料框查询', 'http://10.22.160.7/prod-api/produce/trayQuery/trayComposeInfo'),
('603', 'unBindTrayUrl', '料框解绑', 'http://10.22.160.7/prod-api/api/fms/mp/unbindWholeTray'),
('604', 'QueryTrayUrl', '料框查询', 'http://10.22.160.160/prod-api/produce/trayQuery/trayComposeInfo'),
('604', 'unBindTrayUrl', '料框解绑', 'http://10.22.160.160/prod-api/api/fms/mp/unbindWholeTray');