diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Alarm/PmtAlarm/ImportAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Alarm/PmtAlarm/ImportAction.cs
index a70bdd6..6862349 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Alarm/PmtAlarm/ImportAction.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Alarm/PmtAlarm/ImportAction.cs
@@ -9,23 +9,34 @@ using ICSharpCode.Core;
using Mesnac.Action.Base;
using Mesnac.Codd.Session;
-namespace Mesnac.Action.ChemicalWeighing.Alarm.PmtAlarm
+namespace Mesnac.Action.ChemicalWeighing.Barrel
{
///
/// 导入报警参数业务
///
public class ImportAction: ChemicalWeighingAction, IAction
{
+ #region 事件定义
+
+ ///
+ /// 新增物料事件定义
+ ///
+ public static event EventHandler OnInsertBarrel;
+
+ #endregion
+ private RuntimeParameter _runtime;
+
private string caption = StringParser.Parse(ResourceService.GetString("Mesnac_Dialog_Caption")); //提示
public void Run(RuntimeParameter runtime)
{
- string msg = StringParser.Parse(ResourceService.GetString("Mesnac_Action_ChemicalWeighing_Alarm_PmtAlarm_ImportAction_msg")); //导入操作会覆盖当前所有报警信息!是否继续?
+ string msg = "确定要导入料桶吗?";// StringParser.Parse(ResourceService.GetString("Mesnac_Action_ChemicalWeighing_Alarm_PmtAlarm_ImportAction_msg")); //导入操作会覆盖当前所有报警信息!是否继续?
if (MessageBox.Show(msg, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
{
return;
}
base.RunIni(runtime); //必须要调用的
- ICSharpCode.Core.LoggingService.Debug("报警参数-导入...");
+ this._runtime = runtime;
+ ICSharpCode.Core.LoggingService.Debug("料桶参数-导入...");
DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
if (dbHelper == null)
@@ -46,35 +57,29 @@ namespace Mesnac.Action.ChemicalWeighing.Alarm.PmtAlarm
{
DataSet ds = Mesnac.Basic.DataToFileHandler.Instance.FromExcel(fileName);
//判断导入Excel表格式的合法性
- if (!ds.Tables[0].Columns.Contains("Alarm_PLC") ||
- !ds.Tables[0].Columns.Contains("Alarm_Block") ||
- !ds.Tables[0].Columns.Contains("Alarm_Alias") ||
- !ds.Tables[0].Columns.Contains("Alarm_Cn_Info") )
+ if (!ds.Tables[0].Columns.Contains("BarrelName") ||
+ !ds.Tables[0].Columns.Contains("BarCode") )
{
string msg4 = StringParser.Parse(ResourceService.GetString("Mesnac_Action_ChemicalWeighing_Alarm_PmtAlarm_ImportAction_msg4")); //导入的Excel表格式不正确!请检查后重试!
MessageBox.Show(msg4);
return;
}
- string del = "truncate table Pmt_Alarm";
- dbHelper.ClearParameter();
- dbHelper.CommandType = CommandType.Text;
- dbHelper.CommandText = del;
- dbHelper.ExecuteNonQuery();
+ //string del = "truncate table Pmt_Alarm";
+ //dbHelper.ClearParameter();
+ //dbHelper.CommandType = CommandType.Text;
+ //dbHelper.CommandText = del;
+ //dbHelper.ExecuteNonQuery();
//truncate table PmtAlarm
if (ds != null && ds.Tables.Count > 0)
{
- string sqlstr = @"insert into Pmt_Alarm(Equip_Code, Alarm_PLC, Alarm_Block, Alarm_Alias, Alarm_Cn_Info)
- values (@EquipCode, @AlarmPLC, @AlarmBlock, @Alarm_Alias, @Alarm_Cn_Info)";
+ string sqlstr = @"insert into Hw_Barrel(BarrelName, BarCode)VALUES(@BarrelName, @BarCode)";
foreach (DataRow row in ds.Tables[0].Rows)
{
dbHelper.ClearParameter();
dbHelper.CommandType = CommandType.Text;
dbHelper.CommandText = sqlstr;
- dbHelper.AddParameter("@EquipCode", row["Equip_Code"]);
- dbHelper.AddParameter("@AlarmPLC", row["Alarm_PLC"]);
- dbHelper.AddParameter("@AlarmBlock", row["Alarm_Block"]);
- dbHelper.AddParameter("@Alarm_Alias", row["Alarm_Alias"]);
- dbHelper.AddParameter("@AlarmName", row["Alarm_Cn_Info"]);
+ dbHelper.AddParameter("@BarrelName", row["BarrelName"]);
+ dbHelper.AddParameter("@BarCode", row["BarCode"]);
dbHelper.ExecuteNonQuery();
}
string msg1 = StringParser.Parse(ResourceService.GetString("Mesnac_Action_ChemicalWeighing_Alarm_PmtAlarm_ImportAction_msg1")); //从Excel导入报警参数数据完毕!
@@ -117,19 +122,29 @@ namespace Mesnac.Action.ChemicalWeighing.Alarm.PmtAlarm
MessageBox.Show(msg3, Mesnac.Basic.LanguageHelper.WarnCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
+ #region 触发事件
- //刷新DataGridView数据
- DbMCControl dgPmtAlarmInfo = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Pmt_Alarm").FirstOrDefault();
- if (dgPmtAlarmInfo == null || !(dgPmtAlarmInfo.BaseControl is DataGridView))
+ if (OnInsertBarrel != null)
{
- ICSharpCode.Core.LoggingService.Warn("报警参数-导入-缺少报警参数DataGridView控件...");
- runtime.IsReturn = false;
- return;
+ OnInsertBarrel(this._runtime.BaseControl.MCRoot, System.EventArgs.Empty);
}
- DataTable table = dbHelper.GetDataTableBySql(dgPmtAlarmInfo.BaseControl.ActionDataSource);
- dgPmtAlarmInfo.BaseControl.BindDataSource = table;
+ #endregion
+
+ //刷新DataGridView数据
+ //DbMCControl dgPmtAlarmInfo = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Hw_Barrel").FirstOrDefault();
+ //if (dgPmtAlarmInfo == null || !(dgPmtAlarmInfo.BaseControl is DataGridView))
+ //{
+ // ICSharpCode.Core.LoggingService.Warn("料桶导入-导入-缺少料桶参数DataGridView控件...");
+ // runtime.IsReturn = false;
+ // return;
+ //}
+
+ //DataTable table = dbHelper.GetDataTableBySql(dgPmtAlarmInfo.BaseControl.ActionDataSource);
+ //dgPmtAlarmInfo.BaseControl.BindDataSource = null;
+ //dgPmtAlarmInfo.BaseControl.BindDataSource = table;
}
}
+
}
}
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Barrel/BarrelHelper.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Barrel/BarrelHelper.cs
index 7e6938f..3e297c6 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Barrel/BarrelHelper.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Barrel/BarrelHelper.cs
@@ -84,12 +84,14 @@ namespace Mesnac.Action.ChemicalWeighing.Barrel
dbHelper.ClearParameter();
dbHelper.CommandType = CommandType.Text;
- string insertUserSql = "INSERT INTO Hw_Barrel(BarrelID, BarrelName, BarCode,IsEnable) VALUES(@BarrelID, @BarrelName, @BarCode,@IsEnable)";
+ string insertUserSql = "INSERT INTO Hw_Barrel(BarrelID, BarrelName, BarCode,MaterialID,MaterialName,IsEnable) VALUES(@BarrelID, @BarrelName, @BarCode,@MaterialID,@MaterialName,@IsEnable)";
dbHelper.CommandText = insertUserSql;
dbHelper.AddParameter("@BarrelID", bar.BarrelID);
dbHelper.AddParameter("@BarrelName", bar.BarrelName);
dbHelper.AddParameter("@BarCode", bar.BarCode);
+ dbHelper.AddParameter("@MaterialID", bar.MaterialID);
+ dbHelper.AddParameter("@MaterialName", bar.MaterialName);
dbHelper.AddParameter("@IsEnable", bar.IsEnable);
dbHelper.ExecuteNonQuery();
}
@@ -107,10 +109,12 @@ namespace Mesnac.Action.ChemicalWeighing.Barrel
}
dbHelper.ClearParameter();
dbHelper.CommandType = CommandType.Text;
- string strSql = "UPDATE Hw_Barrel SET BarrelName=@BarrelName, BarCode=@BarCode,IsEnable=@IsEnable WHERE ID=@ID";
+ string strSql = "UPDATE Hw_Barrel SET BarrelName=@BarrelName, BarCode=@BarCode,MaterialID=@MaterialID,MaterialName=@MaterialName,IsEnable=@IsEnable WHERE ID=@ID";
dbHelper.CommandText = strSql;
dbHelper.AddParameter("@BarrelName", barrel.BarrelName);
dbHelper.AddParameter("@BarCode", barrel.BarCode);
+ dbHelper.AddParameter("@MaterialID", barrel.MaterialID);
+ dbHelper.AddParameter("@MaterialName", barrel.MaterialName);
dbHelper.AddParameter("@IsEnable", barrel.IsEnable);
dbHelper.AddParameter("@ID", barrel.ID);
dbHelper.ExecuteNonQuery();
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Barrel/FrmBarrel.Designer.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Barrel/FrmBarrel.Designer.cs
index 8ead345..56895c9 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Barrel/FrmBarrel.Designer.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Barrel/FrmBarrel.Designer.cs
@@ -28,55 +28,28 @@
///
private void InitializeComponent()
{
- this.txtBarrelName = new System.Windows.Forms.TextBox();
- this.txtBarCode = new System.Windows.Forms.TextBox();
- this.label1 = new System.Windows.Forms.Label();
- this.label2 = new System.Windows.Forms.Label();
this.chcIsEnable = new System.Windows.Forms.CheckBox();
this.btnCancel = new System.Windows.Forms.Button();
this.btnOk = new System.Windows.Forms.Button();
+ this.txtBarrelName = new System.Windows.Forms.TextBox();
+ this.label3 = new System.Windows.Forms.Label();
+ this.label1 = new System.Windows.Forms.Label();
+ this.txtBarCode = new System.Windows.Forms.TextBox();
+ this.label2 = new System.Windows.Forms.Label();
+ this.txtMaterialID = new System.Windows.Forms.TextBox();
+ this.txtMaterialName = new System.Windows.Forms.TextBox();
+ this.lable3 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
- // txtBarrelName
- //
- this.txtBarrelName.Location = new System.Drawing.Point(160, 42);
- this.txtBarrelName.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.txtBarrelName.Name = "txtBarrelName";
- this.txtBarrelName.Size = new System.Drawing.Size(202, 28);
- this.txtBarrelName.TabIndex = 1;
- //
- // txtBarCode
- //
- this.txtBarCode.Location = new System.Drawing.Point(160, 98);
- this.txtBarCode.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
- this.txtBarCode.Name = "txtBarCode";
- this.txtBarCode.Size = new System.Drawing.Size(202, 28);
- this.txtBarCode.TabIndex = 2;
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(71, 47);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(71, 18);
- this.label1.TabIndex = 3;
- this.label1.Text = "桶名称:";
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(53, 103);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(89, 18);
- this.label2.TabIndex = 4;
- this.label2.Text = "条码编码:";
- //
// chcIsEnable
//
this.chcIsEnable.AutoSize = true;
- this.chcIsEnable.Location = new System.Drawing.Point(160, 149);
+ this.chcIsEnable.Checked = true;
+ this.chcIsEnable.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.chcIsEnable.Location = new System.Drawing.Point(50, 217);
+ this.chcIsEnable.Margin = new System.Windows.Forms.Padding(2);
this.chcIsEnable.Name = "chcIsEnable";
- this.chcIsEnable.Size = new System.Drawing.Size(102, 22);
+ this.chcIsEnable.Size = new System.Drawing.Size(72, 16);
this.chcIsEnable.TabIndex = 14;
this.chcIsEnable.Text = "是否启用";
this.chcIsEnable.UseVisualStyleBackColor = true;
@@ -85,10 +58,9 @@
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.btnCancel.Location = new System.Drawing.Point(250, 188);
- this.btnCancel.Margin = new System.Windows.Forms.Padding(4);
+ this.btnCancel.Location = new System.Drawing.Point(279, 205);
this.btnCancel.Name = "btnCancel";
- this.btnCancel.Size = new System.Drawing.Size(108, 48);
+ this.btnCancel.Size = new System.Drawing.Size(72, 32);
this.btnCancel.TabIndex = 16;
this.btnCancel.Text = "取消(&C)";
this.btnCancel.UseVisualStyleBackColor = true;
@@ -96,30 +68,105 @@
// btnOk
//
this.btnOk.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.btnOk.Location = new System.Drawing.Point(119, 188);
- this.btnOk.Margin = new System.Windows.Forms.Padding(4);
+ this.btnOk.Location = new System.Drawing.Point(161, 205);
this.btnOk.Name = "btnOk";
- this.btnOk.Size = new System.Drawing.Size(108, 48);
+ this.btnOk.Size = new System.Drawing.Size(72, 32);
this.btnOk.TabIndex = 15;
this.btnOk.Text = "确定(&O)";
this.btnOk.UseVisualStyleBackColor = true;
this.btnOk.Click += new System.EventHandler(this.button1_Click);
//
+ // txtBarrelName
+ //
+ this.txtBarrelName.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.txtBarrelName.Location = new System.Drawing.Point(138, 33);
+ this.txtBarrelName.Name = "txtBarrelName";
+ this.txtBarrelName.Size = new System.Drawing.Size(278, 29);
+ this.txtBarrelName.TabIndex = 17;
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.label3.Location = new System.Drawing.Point(60, 38);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(69, 19);
+ this.label3.TabIndex = 18;
+ this.label3.Text = "桶名称";
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.label1.Location = new System.Drawing.Point(19, 83);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(109, 19);
+ this.label1.TabIndex = 18;
+ this.label1.Text = "条码二维码";
+ //
+ // txtBarCode
+ //
+ this.txtBarCode.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.txtBarCode.Location = new System.Drawing.Point(138, 73);
+ this.txtBarCode.Name = "txtBarCode";
+ this.txtBarCode.Size = new System.Drawing.Size(278, 29);
+ this.txtBarCode.TabIndex = 17;
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.label2.Location = new System.Drawing.Point(17, 125);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(109, 19);
+ this.label2.TabIndex = 18;
+ this.label2.Text = "配方二维码";
+ //
+ // txtMaterialID
+ //
+ this.txtMaterialID.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.txtMaterialID.Location = new System.Drawing.Point(138, 118);
+ this.txtMaterialID.Name = "txtMaterialID";
+ this.txtMaterialID.Size = new System.Drawing.Size(278, 29);
+ this.txtMaterialID.TabIndex = 17;
+ //
+ // txtMaterialName
+ //
+ this.txtMaterialName.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.txtMaterialName.Location = new System.Drawing.Point(138, 163);
+ this.txtMaterialName.Name = "txtMaterialName";
+ this.txtMaterialName.Size = new System.Drawing.Size(278, 29);
+ this.txtMaterialName.TabIndex = 17;
+ //
+ // lable3
+ //
+ this.lable3.AutoSize = true;
+ this.lable3.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.lable3.Location = new System.Drawing.Point(35, 170);
+ this.lable3.Name = "lable3";
+ this.lable3.Size = new System.Drawing.Size(89, 19);
+ this.lable3.TabIndex = 18;
+ this.lable3.Text = "配方名称";
+ //
// FrmBarrel
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(409, 260);
- this.Controls.Add(this.btnCancel);
- this.Controls.Add(this.btnOk);
- this.Controls.Add(this.chcIsEnable);
+ this.ClientSize = new System.Drawing.Size(463, 264);
+ this.Controls.Add(this.lable3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
+ this.Controls.Add(this.label3);
+ this.Controls.Add(this.txtMaterialName);
+ this.Controls.Add(this.txtMaterialID);
this.Controls.Add(this.txtBarCode);
this.Controls.Add(this.txtBarrelName);
- this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
+ this.Controls.Add(this.btnCancel);
+ this.Controls.Add(this.btnOk);
+ this.Controls.Add(this.chcIsEnable);
+ this.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
this.Name = "FrmBarrel";
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "料桶管理";
this.ResumeLayout(false);
this.PerformLayout();
@@ -127,12 +174,16 @@
}
#endregion
- private System.Windows.Forms.TextBox txtBarrelName;
- private System.Windows.Forms.TextBox txtBarCode;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.Label label2;
private System.Windows.Forms.CheckBox chcIsEnable;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnOk;
+ private System.Windows.Forms.TextBox txtBarrelName;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.TextBox txtBarCode;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.TextBox txtMaterialID;
+ private System.Windows.Forms.TextBox txtMaterialName;
+ private System.Windows.Forms.Label lable3;
}
}
\ No newline at end of file
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Barrel/FrmBarrel.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Barrel/FrmBarrel.cs
index 748eedb..7a0123e 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Barrel/FrmBarrel.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Barrel/FrmBarrel.cs
@@ -20,7 +20,7 @@ namespace Mesnac.Action.ChemicalWeighing.Barrel
{
InitializeComponent();
- bar.BarrelID = Guid.NewGuid().ToString();
+ bar.BarrelID = Guid.NewGuid().ToString("N").ToUpper();
}
public FrmBarrel(ActionType type, Hw_Barrel _barrel)
{
@@ -28,8 +28,10 @@ namespace Mesnac.Action.ChemicalWeighing.Barrel
_actionType = type;
bar = _barrel;
- this.txtBarrelName.Text = bar.BarrelName;
- this.txtBarCode.Text = bar.BarCode;
+ this.txtBarrelName.Text = _barrel.BarrelName;
+ this.txtBarCode.Text = _barrel.BarCode;
+ this.txtMaterialID.Text = _barrel.MaterialID;
+ this.txtMaterialName.Text = _barrel.MaterialName;
//if (bar.IsEnable=="是")
//{
// this.chcIsEnable.Checked = true;
@@ -59,10 +61,10 @@ namespace Mesnac.Action.ChemicalWeighing.Barrel
bar.BarrelName = this.txtBarrelName.Text;
bar.BarCode = this.txtBarCode.Text;
+ bar.MaterialID = this.txtMaterialID.Text;
+ bar.MaterialName = this.txtMaterialName.Text;
bar.IsEnable = chcIsEnable.Checked == true ? "是" : "否";
-
-
//当修改桶时 条码唯一性都需要验证
if (_actionType == ActionType.Add || (_actionType == ActionType.Modify))
{
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Barrel/ModifyAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Barrel/ModifyAction.cs
index 7f8ec98..151a454 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Barrel/ModifyAction.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Barrel/ModifyAction.cs
@@ -63,6 +63,8 @@ namespace Mesnac.Action.ChemicalWeighing.Barrel
BarrelID = Guid.NewGuid().ToString(),
BarrelName = clientGridView.SelectedRows[0].Cells["BarrelName"].Value as string,
BarCode = clientGridView.SelectedRows[0].Cells["BarCode"].Value as string,
+ MaterialID = clientGridView.SelectedRows[0].Cells["MaterialID"].Value as string,
+ MaterialName = clientGridView.SelectedRows[0].Cells["MaterialName"].Value as string,
IsEnable = clientGridView.SelectedRows[0].Cells["IsEnable"].Value as string
};
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Barrel/RefreshAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Barrel/RefreshAction.cs
index eb2b32a..17c0c46 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Barrel/RefreshAction.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Barrel/RefreshAction.cs
@@ -43,8 +43,12 @@ namespace Mesnac.Action.ChemicalWeighing.Barrel
ICSharpCode.Core.LoggingService.Debug("料桶管理—刷新料桶业务...");
#region 事件订阅
+
+ //添加计划后,要刷新计划
+ ImportAction.OnInsertBarrel -= Process_Event;
+ ImportAction.OnInsertBarrel += Process_Event;
#endregion
-
+
DbMCControl clientGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Hw_Barrel").FirstOrDefault(); //获取配方管理控件
if (clientGridControl == null || !(clientGridControl.BaseControl is DataGridView))
@@ -65,7 +69,21 @@ namespace Mesnac.Action.ChemicalWeighing.Barrel
}
#endregion
+ #region 事件处理方法
+
+ private void Process_Event(object sender, EventArgs e)
+ {
+ if (sender is RuntimeParameter)
+ {
+ this.Run(sender as RuntimeParameter);
+ }
+ else
+ {
+ this.Run(this._runtime);
+ }
+ }
+ #endregion
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ChemicalWeighingPlc/PlcPlanHelper.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ChemicalWeighingPlc/PlcPlanHelper.cs
index d216a2b..9680e9a 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ChemicalWeighingPlc/PlcPlanHelper.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ChemicalWeighingPlc/PlcPlanHelper.cs
@@ -29,6 +29,7 @@ namespace Mesnac.Action.ChemicalWeighing.ChemicalWeighingPlc
public static object sender = null;
public static event EventHandler OnUpdatePlanStateFromPlc;
+
public static event EventHandler AutoDownloadPlan;
public static event EventHandler OnAutoAddPlan;
public static event EventHandler OnChangePlan;
@@ -2358,5 +2359,7 @@ namespace Mesnac.Action.ChemicalWeighing.ChemicalWeighingPlc
#endregion
#endregion
+
+
}
}
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/FinishBatchService.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/FinishBatchService.cs
index afec574..9b25592 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/FinishBatchService.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/FinishBatchService.cs
@@ -65,6 +65,7 @@ namespace Mesnac.Action.ChemicalWeighing.FinishBatch
{
//BasePlcHelper.Instance.PlcRead(BasePlcHelper.Instance.read_data, out int[] p);
Mesnac.Equips.Factory.Instance.SetMinHZReadDataEvent(ReadData);
+ // Mesnac.Equips.Factory.Instance.SetMinHZReadDataEvent(UpdateData);
this.runState = true;
}
}
@@ -113,13 +114,7 @@ namespace Mesnac.Action.ChemicalWeighing.FinishBatch
{
#region 实时刷新自动保存报警
- SaveHelper.AlarmSaveHelper.Save();
-
- #endregion
-
- #region 更新溶剂称量计划状态
-
- //ChemicalWeighingPlc.PlcPlanHelper.UpdatePlanData();
+ //SaveHelper.AlarmSaveHelper.Save();
#endregion
@@ -128,16 +123,28 @@ namespace Mesnac.Action.ChemicalWeighing.FinishBatch
XlPlcHelper.PlcPlanHelper.ExecPlanState();
#endregion
- #region 初始小料重量防错
- //ChemicalWeighingPlc.PlcPlanHelper.InitScanCode();
- #endregion
+ }
+ }
+ catch(Exception ex)
+ {
+ ICSharpCode.Core.LoggingService.Error(ex.Message, ex);
+ }
+ }
+
+ private void UpdateData(object sender, Mesnac.Equips.ReadEventArgs e)
+ {
+ try
+ {
+ lock (String.Empty)
+ {
+ #region 更新计划状态
- #region 扫码读取数据
- //ChemicalWeighingPlc.PlcPlanHelper.XlScanCode();
+ XlPlcHelper.PlcPlanHelper.UpdateXlPlanStateFromPlc();
+ XlPlcHelper.PlcPlanHelper.UpdateBinAlarm();
#endregion
}
}
- catch(Exception ex)
+ catch (Exception ex)
{
ICSharpCode.Core.LoggingService.Error(ex.Message, ex);
}
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Product/XlPlan/InitFormAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Product/XlPlan/InitFormAction.cs
index 2ebffd4..f654f76 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Product/XlPlan/InitFormAction.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Product/XlPlan/InitFormAction.cs
@@ -10,6 +10,7 @@ using Mesnac.Codd.Session;
using System.Reflection;
using Mesnac.Controls.Base;
using System.Timers;
+using Mesnac.Action.ChemicalWeighing.DBHelper;
namespace Mesnac.Action.ChemicalWeighing.Product.XlPlan
{
@@ -26,6 +27,7 @@ namespace Mesnac.Action.ChemicalWeighing.Product.XlPlan
#region 字段定义
public static bool IsFirstRun = true; //是否首次运行
+ public static bool IsRun = true; //是否首次运行
private RuntimeParameter _runtime;
//private DbMCControl _planDateControl = null; //计划日期
//private DbMCControl _pptShiftControl = null; //班次
@@ -73,8 +75,6 @@ namespace Mesnac.Action.ChemicalWeighing.Product.XlPlan
DataGridView clientGrid = (clientGridControl.BaseControl as DataGridView);
this.InitGridViewEvent(clientGrid);
-
- this.InitData();
#endregion
@@ -105,35 +105,49 @@ namespace Mesnac.Action.ChemicalWeighing.Product.XlPlan
//MessageBox.Show("11111");
}
+ #endregion
#endregion
- #region 初始化界面控件数据
-
- ///
- /// 初始化界面控件数据
- ///
- private void InitData()
- {
- System.Timers.Timer timer = new System.Timers.Timer(10000);
- timer.Elapsed += new ElapsedEventHandler(StartServer1);
- timer.AutoReset = true;
- timer.Enabled = true;
- timer.Start();
- }
-
- private void StartServer1(object sender, ElapsedEventArgs e)
+ protected void DoWork()
{
#region 业务实现
- if (OnRefreshPlan != null)
+
+ //int shiftID = Global.PublicVar.Instance.globalShiftID;
+ //int.TryParse(this._pptShiftControl.BaseControl.MCValue.ToString(), out shiftID);
+ string equipCode = base.CurrEquipCode; //当前机台
+ //DateTime selectedDate = Convert.ToDateTime(this._planDateControl.BaseControl.MCValue);
+ //DataTable table = PlanHelper.GetPlanData(selectedDate, shiftID);
+ //DataTable table = PlanHelper.GetPlanData(selectedDate);
+ //DataTable table = PlanHelper.GetPlanData();
+ IFreeSql fsql = FreeHelper.Instance;
+ string sql = @"select *from (SELECT Batch,ProductName,Plan_Serial,Recipe_ID,Recipe_Name,Equip_Code,Version,Plan_Id,Plan_Num,Real_Num,Plan_State,Plan_StateText,Start_Date,End_Date,Plan_Date,IsPrenatalTest,CreateTime FROM xl_plan
+ where IsPrenatalTest=0 or IsPrenatalTest IS NULL
+ ) t where datediff(day, t.CreateTime,getdate())=0 ";
+ DataTable table = fsql.Select