Add - LJPlanning-TestAction等待实装

dep_nodyang
wangsr 1 year ago
parent 65848c2175
commit 67ab37d415

@ -0,0 +1,121 @@

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using FreeSql.DataAnnotations;
namespace Mesnac.Action.ChemicalWeighing.FreeDb.DBEntity
{
[Table(Name = "Lj_Formula_Detail_Down")]
public partial class LjFormulaDetailDownEntity
{
[Column(IsPrimary = true, IsIdentity = true)]
public int Id { get; set; }
public int? ActionCode { get; set; }
/// <summary>
/// 动作Id
/// </summary>
public int? ActionId { get; set; }
/// <summary>
/// 动作名称
/// </summary>
[Column(DbType = "nvarchar(50)")]
public string ActionName { get; set; } = string.Empty;
public int BinNo { get; set; }
/// <summary>
/// 糊化机称量Copy
/// </summary>
public int? CbCopyC { get; set; }
/// <summary>
/// 湿混机混合配方copy
/// </summary>
public int? CbCopyH { get; set; }
/// <summary>
/// 糊化机混合配方copy
/// </summary>
public int? CpSiloH { get; set; }
public int FormulaId { get; set; }
/// <summary>
/// 1 称量 2 混合
/// </summary>
public int FormulaType { get; set; }
/// <summary>
/// 机台
/// </summary>
[Column(DbType = "nvarchar(2)")]
public string Machine { get; set; } = string.Empty;
[Column(DbType = "nvarchar(50)")]
public string MachineType { get; set; } = string.Empty;
/// <summary>
/// 物料编码
/// </summary>
public int MId { get; set; }
[Column(DbType = "nvarchar(50)")]
public string MName { get; set; } = string.Empty;
public double? SetTolerance { get; set; }
public double? SetValue { get; set; }
/// <summary>
/// 速度
/// </summary>
public double? Speed { get; set; }
/// <summary>
/// 物料Id
/// </summary>
public int? StockMaterialId { get; set; }
/// <summary>
/// 温度
/// </summary>
public double? Temp { get; set; }
public double? TimeInfo { get; set; }
public double Tolerance { get; set; }
/// <summary>
/// 重量
/// </summary>
public double Weight { get; set; }
}
}

@ -0,0 +1,129 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
// Website: http://www.freesql.net
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using FreeSql.DataAnnotations;
namespace Mesnac.Action.ChemicalWeighing.FreeDb.DBEntity
{
[Table(Name = "Lj_Formula_Detail")]
public partial class LjFormulaDetailEntity
{
[Column(IsPrimary = true, IsIdentity = true)]
public int Id { get; set; }
public int? ActionCode { get; set; }
/// <summary>
/// 动作Id
/// </summary>
public int? ActionId { get; set; }
/// <summary>
/// 动作名称
/// </summary>
[Column(DbType = "nvarchar(50)")]
public string ActionName { get; set; } = string.Empty;
public int BinNo { get; set; }
/// <summary>
/// 糊化机称量Copy
/// </summary>
public int? CbCopyC { get; set; }
/// <summary>
/// 湿混机混合配方copy
/// </summary>
public int? CbCopyH { get; set; }
/// <summary>
/// 糊化机混合配方copy
/// </summary>
public int? CpSiloH { get; set; }
public int FormulaId { get; set; }
/// <summary>
/// 1 称量 2 混合
/// </summary>
public int FormulaType { get; set; }
/// <summary>
/// 机台
/// </summary>
[Column(DbType = "nvarchar(2)")]
public string Machine { get; set; } = string.Empty;
[Column(DbType = "nvarchar(50)")]
public string MachineType { get; set; } = string.Empty;
/// <summary>
/// 物料编码
/// </summary>
public int MId { get; set; }
[Column(DbType = "nvarchar(50)")]
public string MName { get; set; } = string.Empty;
public double? SetTolerance { get; set; }
public double? SetValue { get; set; }
/// <summary>
/// 速度
/// </summary>
public double? Speed { get; set; }
/// <summary>
/// 物料Id
/// </summary>
public int? StockMaterialId { get; set; }
/// <summary>
/// 温度
/// </summary>
public double? Temp { get; set; }
public double? TimeInfo { get; set; }
public double Tolerance { get; set; }
/// <summary>
/// 重量
/// </summary>
public double Weight { get; set; }
}
}

@ -0,0 +1,85 @@

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using FreeSql.DataAnnotations;
namespace Mesnac.Action.ChemicalWeighing.FreeDb.DBEntity
{
[Table(Name = "Lj_Formula_Down")]
public partial class LjFormulaDownEntity
{
[Column(IsPrimary = true, IsIdentity = true)]
public int Id { get; set; }
/// <summary>
/// 糊化机copy称量配方
/// </summary>
public int? CbSiloC { get; set; }
/// <summary>
/// 糊化机copy混合配方
/// </summary>
public int? CbSiloH { get; set; }
/// <summary>
/// 湿混机copy混合配方
/// </summary>
public int? CbWeterH { get; set; }
public DateTime CreateTime { get; set; }
public int? FormulaId { get; set; }
[Column(DbType = "nvarchar(50)")]
public string FormulaName { get; set; } = string.Empty;
/// <summary>
/// 编号
/// </summary>
[Column(DbType = "nvarchar(50)")]
public string FormulaNo { get; set; } = string.Empty;
[Column(DbType = "nvarchar(50)")]
public string FormulaVersion { get; set; } = string.Empty;
public int? IsEnable { get; set; }
public int? PlanId { get; set; }
public int? RecipeTypeId { get; set; }
[Column(DbType = "nvarchar(50)")]
public string RecipeTypeName { get; set; } = string.Empty;
/// <summary>
/// 状态
/// </summary>
public int? Status { get; set; }
/// <summary>
/// 生产单元
/// </summary>
public int? Unit { get; set; }
public DateTime? UpdateTime { get; set; }
}
}

@ -0,0 +1,79 @@

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using FreeSql.DataAnnotations;
namespace Mesnac.Action.ChemicalWeighing.FreeDb.DBEntity
{
[Table(Name = "Lj_Formula")]
public partial class LjFormulaEntity
{
[Column(IsPrimary = true)]
public int Id { get; set; }
/// <summary>
/// 糊化机copy称量配方
/// </summary>
public int? CbSiloC { get; set; }
/// <summary>
/// 糊化机copy混合配方
/// </summary>
public int? CbSiloH { get; set; }
/// <summary>
/// 湿混机copy混合配方
/// </summary>
public int? CbWeterH { get; set; }
public DateTime CreateTime { get; set; }
[Column(DbType = "nvarchar(50)")]
public string FormulaName { get; set; } = string.Empty;
/// <summary>
/// 编号
/// </summary>
[Column(DbType = "nvarchar(50)")]
public string FormulaNo { get; set; } = string.Empty;
[Column(DbType = "nvarchar(50)")]
public string FormulaVersion { get; set; } = string.Empty;
public int? IsEnable { get; set; }
public int? RecipeTypeId { get; set; }
[Column(DbType = "nvarchar(50)")]
public string RecipeTypeName { get; set; } = string.Empty;
/// <summary>
/// 状态
/// </summary>
public int? Status { get; set; }
/// <summary>
/// 生产单元
/// </summary>
public int? Unit { get; set; }
public DateTime? UpdateTime { get; set; }
}
}

@ -0,0 +1,89 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using FreeSql.DataAnnotations;
namespace Mesnac.Action.ChemicalWeighing.FreeDb.DBEntity
{
[Table(Name = "lj_planning")]
public partial class LjPlanningEntity {
/// <summary>
/// 主键
/// </summary>
[Column(IsPrimary = true, IsIdentity = true)]
public int Id { get; set; }
[Column(DbType = "nvarchar(10)")]
public string BegTime { get; set; } = string.Empty;
/// <summary>
/// 班次名称
/// </summary>
[Column(DbType = "nvarchar(2)")]
public string ClassName { get; set; } = string.Empty;
public DateTime? CreateTime { get; set; }
[Column(DbType = "nvarchar(10)")]
public string EndTime { get; set; } = string.Empty;
/// <summary>
/// 配料Id
/// </summary>
public int? FormulaId { get; set; }
/// <summary>
/// 配料名称
/// </summary>
[Column(DbType = "nvarchar(50)")]
public string FormulaName { get; set; } = string.Empty;
/// <summary>
/// 是否启用 删除标记
/// </summary>
public int? IsEnable { get; set; }
public int? NumCar { get; set; }
/// <summary>
/// 计划名称
/// </summary>
[Column(DbType = "nvarchar(50)")]
public string PlanName { get; set; } = string.Empty;
/// <summary>
/// 编号
/// </summary>
[Column(DbType = "nvarchar(50)")]
public string PlanNo { get; set; } = string.Empty;
[Column(DbType = "nvarchar(50)")]
public string Remark { get; set; } = string.Empty;
/// <summary>
/// 计划状态 0 新建 1下发 2暂停 3执行中 4 异常 10结束 11重发
/// </summary>
[Column(DbType = "nvarchar(50)")]
public string Status { get; set; } = string.Empty;
/// <summary>
/// 工作单元 1 2 3 4 共4条线
/// </summary>
public int? Unit { get; set; }
public DateTime? UpdateTime { get; set; }
}
}

@ -23,10 +23,10 @@ namespace Mesnac.Action.ChemicalWeighing.FreeDb
{
DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
return new FreeSql.FreeSqlBuilder()
.UseMonitorCommand(cmd => Trace.WriteLine($"Sql{cmd.CommandText}"))//监听SQL语句,Trace在输出选项卡中查看
.UseConnectionString(FreeSql.DataType.SqlServer, dbHelper.DbSession.ConnectionString)
.UseAutoSyncStructure(false) //自动同步实体结构到数据库FreeSql不会扫描程序集只有CRUD时才会生成表。
.Build();
.UseMonitorCommand(cmd => Trace.WriteLine($"Sql{cmd.CommandText}"))//监听SQL语句,Trace在输出选项卡中查看
.UseConnectionString(FreeSql.DataType.SqlServer, dbHelper.DbSession.ConnectionString)
.UseAutoSyncStructure(false) //自动同步实体结构到数据库FreeSql不会扫描程序集只有CRUD时才会生成表。
.Build();
});

@ -0,0 +1,106 @@
using Mesnac.Action.Base;
using Mesnac.Action.ChemicalWeighing.FreeDb;
using Mesnac.Action.ChemicalWeighing.FreeDb.DBEntity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mesnac.Action.ChemicalWeighing.LjPlanning
{
public class TestAction: ChemicalWeighingAction, IAction
{
public static event EventHandler OnAdd;
private DbMCControl _materialGridControl = null; //物料列表控件
private RuntimeParameter _runtime;
public void Run(RuntimeParameter runtime)
{
base.RunIni(runtime); //必须调用
this._runtime = runtime;
DbMCControl materialGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "lj_planning").FirstOrDefault();
this._materialGridControl = materialGridControl;
DataGridView clientGridView = this._materialGridControl.BaseControl as DataGridView;
//验证是否选中某物料
if (clientGridView.SelectedRows.Count != 1)
{
//MessageBox.Show("请选择要修改的数据", Mesnac.Basic.LanguageHelper.Caption,
// MessageBoxButtons.OK, MessageBoxIcon.Information);
//this._runtime.IsReturn = true;
return;
}
var dataGridViewRow = clientGridView.SelectedRows[0];
var id = Convert.ToInt32(dataGridViewRow.Cells["Id"].Value);
LjPlanningEntity ljPlanningEntity = FreeSqlUnit.Instance.Select<LjPlanningEntity>().Where(x => x.Id == id).ToOne();
LjFormulaEntity ljFormulaEntity = FreeSqlUnit.Instance.Select<LjFormulaEntity>().Where(x => x.Id == ljPlanningEntity.FormulaId).ToOne();
List<LjFormulaDetailEntity> ljFormulaDetailEntity = FreeSqlUnit.Instance.Select<LjFormulaDetailEntity>().Where(x => x.FormulaId == ljFormulaEntity.Id).ToList();
FreeSqlUnit.Instance.Delete<LjFormulaDownEntity>().Where(x => x.PlanId == ljPlanningEntity.Id && x.FormulaId == ljFormulaEntity.Id).ExecuteDeleted();
LjFormulaDownEntity ljFormulaDownEntity = new LjFormulaDownEntity()
{
CbSiloC = ljFormulaEntity.CbSiloC,
CbSiloH = ljFormulaEntity.CbSiloH,
CbWeterH = ljFormulaEntity.CbWeterH,
CreateTime = ljFormulaEntity.CreateTime,
FormulaId = ljFormulaEntity.Id,
FormulaName = ljFormulaEntity.FormulaName,
FormulaNo = ljFormulaEntity.FormulaNo,
FormulaVersion = ljFormulaEntity.FormulaVersion,
IsEnable = ljFormulaEntity.IsEnable,
PlanId = ljPlanningEntity.Id,
RecipeTypeId = ljFormulaEntity.RecipeTypeId,
RecipeTypeName = ljFormulaEntity.RecipeTypeName,
Status = ljFormulaEntity.Status,
Unit = ljFormulaEntity.Unit,
UpdateTime = ljFormulaEntity.UpdateTime
};
FreeSqlUnit.Instance.Insert(ljFormulaDownEntity).ExecuteIdentity();
List<LjFormulaDetailDownEntity> ljFormulaDetailDownEntity = new List<LjFormulaDetailDownEntity>();
LjFormulaDetailDownEntity singleEntity;
foreach (LjFormulaDetailEntity Entity in ljFormulaDetailEntity)
{
singleEntity = new LjFormulaDetailDownEntity()
{
ActionCode = Entity.ActionCode,
ActionId = Entity.ActionId,
ActionName = Entity.ActionName,
BinNo = Entity.BinNo,
CbCopyC = Entity.CbCopyC,
CbCopyH = Entity.CbCopyH,
CpSiloH = Entity.CpSiloH,
FormulaId = Entity.FormulaId,
FormulaType = Entity.FormulaType,
Machine = Entity.Machine,
MachineType = Entity.MachineType,
MId = Entity.MId,
MName = Entity.MName,
SetTolerance = Entity.SetTolerance,
SetValue = Entity.SetValue,
Speed = Entity.Speed,
StockMaterialId = Entity.StockMaterialId,
Temp = Entity.Temp,
TimeInfo = Entity.TimeInfo,
Tolerance = Entity.Tolerance,
Weight = Entity.Weight
};
ljFormulaDetailDownEntity.Add(singleEntity);
}
FreeSqlUnit.Instance.Insert(ljFormulaDetailDownEntity).ExecuteIdentity();
}
}
}

@ -1,4 +1,5 @@
using System;
using Mesnac.Action.ChemicalWeighing.FreeDb;
using System;
using System.Threading;
namespace Mesnac.Action.ChemicalWeighing
@ -60,6 +61,7 @@ namespace Mesnac.Action.ChemicalWeighing
{
Thread.Sleep(50); //通过三次延时,确保可以彻底关闭窗口
loadingForm.Invoke(new CloseDelegate(LoadingHelper.CloseFormInternal));
}
}
}

@ -319,6 +319,11 @@
<Compile Include="FinishBatch\SaveHelper\ReportSaveHelper.cs" />
<Compile Include="FinishBatch\SaveHelper\ReportWetMixerSaveHelper.cs" />
<Compile Include="FinishBatch\SCADAHelper\AlarmRefreshActionForExtend.cs" />
<Compile Include="FreeDb\DBEntity\LjFormulaDownEntity.cs" />
<Compile Include="FreeDb\DBEntity\LjFormulaDetailDownEntity.cs" />
<Compile Include="FreeDb\DBEntity\LjFormulaDetailEntity.cs" />
<Compile Include="FreeDb\DBEntity\LjFormulaEntity.cs" />
<Compile Include="FreeDb\DBEntity\LjPlanningEntity.cs" />
<Compile Include="FreeDb\FreeSqlUnit.cs" />
<Compile Include="LjAction\InitDbAction.cs" />
<Compile Include="LjDevice\DeviceHelp.cs" />
@ -441,6 +446,7 @@
<Compile Include="LjMixManager\RecipePlcView.cs" />
<Compile Include="LjMixManager\UpdateAction.cs" />
<Compile Include="LjPlanning\AddAction.cs" />
<Compile Include="LjPlanning\TestAction.cs" />
<Compile Include="LjPlanning\SelectAction.cs" />
<Compile Include="LjPlanning\Db\LjFormulaDb.cs" />
<Compile Include="LjPlanning\DelAction.cs" />

@ -35,6 +35,11 @@
<Caption>查询计划管理</Caption>
<Remark>查询计划管理</Remark>
</Action>
<Action action="006CC09D2397FD798EF3BF2B6FB549B8">
<Caption>测试</Caption>
<Remark>测试</Remark>
</Action>
</Path>
</Design>
@ -71,6 +76,10 @@
<Design action="10FD0031BDA5B8BC169D9110058782C5">
<Runtime action="5156CF089B112F6D176C35E958B9FEA4"/>
</Design>
<Design action="006CC09D2397FD798EF3BF2B6FB549B8">
<Runtime action="47FA1C64D1895D91E1BC32A8156134AA"/>
</Design>
</DesignToRuntime>
<Runtime>
@ -82,6 +91,7 @@
<Action action="B66445AADCB561B9AE43E8E7ED1AB55C" class="Mesnac.Action.ChemicalWeighing.LjPlanning.DownloadAction"/>
<Action action="77A5B59C593DBB7C3595D08ACF11B37C" class="Mesnac.Action.ChemicalWeighing.LjPlanning.PauseAction"/>
<Action action="5156CF089B112F6D176C35E958B9FEA4" class="Mesnac.Action.ChemicalWeighing.LjPlanning.SelectAction"/>
<Action action="47FA1C64D1895D91E1BC32A8156134AA" class="Mesnac.Action.ChemicalWeighing.LjPlanning.TestAction"/>
</Import>
</Runtime>

Loading…
Cancel
Save