2023-11-27之前

main
liulb@mesnac.com 1 year ago
parent 4ade919223
commit c491d0af76

@ -11,6 +11,7 @@ using Mesnac.Action.Base;
using Mesnac.Action.ChemicalWeighing.Entity.PptPlan;
using Mesnac.Action.ChemicalWeighing.ChemicalWeighingPlc;
using Mesnac.Action.ChemicalWeighing.Entity;
using Steema.TeeChart.Styles;
namespace Mesnac.Action.ChemicalWeighing.Product.PptPlan
{
@ -89,27 +90,33 @@ namespace Mesnac.Action.ChemicalWeighing.Product.PptPlan
return;
}
string weighbridge = clientGridView.SelectedRows[0].Cells["Weighbridge"].Value.ToString();
//任务还在称量中,不允许下发计划
if (weighbridge == "1号地磅")
{
int status = BasePlcHelper.Instance.solvent_SystemRuning.NowValue.ToInt();
if (status == 1)
if (string.IsNullOrEmpty(weighbridge))
{
MessageBox.Show("配方还在正在执行中,请勿下发!");
ICSharpCode.Core.LoggingService<PlanDownloadAction>.Error("{生产计划-手动下发计划} 配方正在执行中...");
MessageBox.Show("地磅为空,不可以下发任务!");
ICSharpCode.Core.LoggingService<PlanDownloadAction>.Error("{生产计划-手动下发计划} 地磅为空.");
return;
}
}
if (weighbridge == "2号地磅")
{
int status = BasePlcHelper.Instance.solvent2_SystemRuning.NowValue.ToInt();
if (status ==1)
{
MessageBox.Show("配方还在正在执行中,请勿下发!");
ICSharpCode.Core.LoggingService<PlanDownloadAction>.Error("{生产计划-手动下发计划} 配方正在执行中...");
return;
}
}
//任务还在称量中,不允许下发计划
//if (weighbridge == "1号地磅")
//{
// int status = BasePlcHelper.Instance.solvent_SystemRuning.NowValue.ToInt();
// if (status == 1)
// {
// MessageBox.Show("配方还在正在执行中,请勿下发!");
// ICSharpCode.Core.LoggingService<PlanDownloadAction>.Error("{生产计划-手动下发计划} 配方正在执行中...");
// return;
// }
//}
//if (weighbridge == "2号地磅")
//{
// int status = BasePlcHelper.Instance.solvent2_SystemRuning.NowValue.ToInt();
// if (status ==1)
// {
// MessageBox.Show("配方还在正在执行中,请勿下发!");
// ICSharpCode.Core.LoggingService<PlanDownloadAction>.Error("{生产计划-手动下发计划} 配方正在执行中...");
// return;
// }
//}
//获取选中计划、获取选中物料
@ -119,19 +126,18 @@ namespace Mesnac.Action.ChemicalWeighing.Product.PptPlan
List<MetagePlan> list = (materialList.Concat(emptList)).ToList();
//下传计划给PLC
bool IsSucess;
bool IsSucess=false;
if (weighbridge=="1号地磅")
{
IsSucess = PlcPlanHelper.DownloadPlanDataToWeighbridge1Plc(list);
}
else
if (weighbridge == "2号地磅")
{
IsSucess = PlcPlanHelper.DownloadPlanDataToWeighbridge2Plc(list);
}
if (IsSucess)
{
//回写计划任务状态 3:任务执行中
PlanHelper.UpdatePlanState1(selectedPlanId, 3);
MessageBox.Show("计划任务下发成功!");

@ -49,6 +49,7 @@ namespace Mesnac.Action.ChemicalWeighing.Warehouse
//{
// return;
//}
base.RunIni(runtime); //必须要调用的
ICSharpCode.Core.LoggingService<ImportAction>.Debug("投料参数-导入...");
@ -73,11 +74,12 @@ namespace Mesnac.Action.ChemicalWeighing.Warehouse
//判断导入Excel表格式的合法性
if (!ds.Tables[0].Columns.Contains("PId") || !ds.Tables[0].Columns.Contains("ProductName") ||
!ds.Tables[0].Columns.Contains("Material_Code") || !ds.Tables[0].Columns.Contains("MaterialName") ||
!ds.Tables[0].Columns.Contains("MaterialType") || !ds.Tables[0].Columns.Contains("SetWeight") ||
!ds.Tables[0].Columns.Contains("SetError") || !ds.Tables[0].Columns.Contains("Difference") ||
!ds.Tables[0].Columns.Contains("Fixed") || !ds.Tables[0].Columns.Contains("FixedRatio") ||
!ds.Tables[0].Columns.Contains("Recipe"))
!ds.Tables[0].Columns.Contains("BinId") ||!ds.Tables[0].Columns.Contains("Material_Code") ||
!ds.Tables[0].Columns.Contains("MaterialName") ||!ds.Tables[0].Columns.Contains("MaterialType") ||
!ds.Tables[0].Columns.Contains("SetWeight") ||!ds.Tables[0].Columns.Contains("SetError") ||
!ds.Tables[0].Columns.Contains("Difference") ||!ds.Tables[0].Columns.Contains("Fixed") ||
!ds.Tables[0].Columns.Contains("FixedRatio") || !ds.Tables[0].Columns.Contains("PumpCode") ||
!ds.Tables[0].Columns.Contains("Weighbridge") || !ds.Tables[0].Columns.Contains("Recipe"))
{
string msg4 = "导入的Excel表格式不正确请检查后重试"; //导入的Excel表格式不正确请检查后重试
MessageBox.Show(msg4);

@ -35,10 +35,11 @@ namespace Mesnac.Action.ChemicalWeighing
sb.Difference = a.Difference;
sb.Fixed = a.Fixed == "" || a.Fixed == null ? false : true;
sb.FixedRatio = a.FixedRatio == ""|| a.FixedRatio == null ? 0.00 : Convert.ToDouble(a.FixedRatio);
sb.Recipe = a.Recipe;
sb.Remark = a.Remark;
sb.Weighbridge = a.Weighbridge;
sb.PumpCode = a.PumpCode;
sb.Recipe = a.Recipe;
sb.Remark = a.Remark;
sb.CreateTime = DateTime.Now;
subList.Add(sb);
});
//查询溶剂数据
@ -153,6 +154,10 @@ namespace Mesnac.Action.ChemicalWeighing
plan.Plan_StateText = CommHelper.StateToShow((int)PlanState.UnStart);
plan.Plan_Date = String.Format("{0:yyyy-MM-dd}", DateTime.Now);
plan.IF_FLAG = 1;
if (string.IsNullOrEmpty(item.Weighbridge))
{
throw new Exception("地磅不可为空!");
}
plan.Weighbridge = item.Weighbridge;
plan.PumpBarCode = item.PumpCode;
if (item.PumpCode==null|| item.PumpCode=="")
@ -216,8 +221,11 @@ namespace Mesnac.Action.ChemicalWeighing
sb.SetWeight = Convert.ToDouble(a.SetWeight);
sb.SetError = Convert.ToDouble(a.SetError);
sb.Difference = a.Difference;
sb.PumpCode = a.PumpCode;
sb.Weighbridge = a.Weighbridge;
sb.Recipe = a.Recipe;
sb.Remark = a.Remark;
sb.CreateTime = DateTime.Now;
subList.Add(sb);
});
//查询数据
@ -225,10 +233,6 @@ namespace Mesnac.Action.ChemicalWeighing
var xt = (from d in xlList
select new
{
//d.PId,
//d.ProductName,
//d.MaterialType,
//d.Recipe,
d.PId,
d.ProductName,
d.MaterialType,
@ -324,6 +328,10 @@ namespace Mesnac.Action.ChemicalWeighing
plan.Plan_StateText = CommHelper.StateToShow((int)PlanState.UnStart);
plan.Plan_Date = String.Format("{0:yyyy-MM-dd}", DateTime.Now);
plan.IF_FLAG = 1;
if (string.IsNullOrEmpty(item.Weighbridge))
{
throw new Exception("地磅不可为空!");
}
plan.Weighbridge = item.Weighbridge;
#endregion

@ -1,3 +1,3 @@
<DataSources>
<DataSourceItem Name="DataSource1" Driver="MS SQL Server" Server="192.168.10.50" UserName="sa" Password="sa" DataBase="cwss_xl" ConnectionTimeout="5" DriverAssembly="ICSharpCode.Data.SQLServer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" DriverClass="ICSharpCode.Data.Core.DatabaseDrivers.SQLServer.SQLServerDatabaseDriver" DataSourceClass="ICSharpCode.Data.Core.DatabaseObjects.Database" />
<DataSourceItem Name="DataSource1" Driver="MS SQL Server" Server="localhost" UserName="sa" Password="sa" DataBase="cwss_xl" ConnectionTimeout="5" DriverAssembly="ICSharpCode.Data.SQLServer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" DriverClass="ICSharpCode.Data.Core.DatabaseDrivers.SQLServer.SQLServerDatabaseDriver" DataSourceClass="ICSharpCode.Data.Core.DatabaseObjects.Database" />
</DataSources>

@ -6,7 +6,7 @@
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{91C803A6-90D1-4361-8B92-9AFD9E766411}</ProjectGuid>
<OutputType>Exe</OutputType>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MCRun</RootNamespace>
<AssemblyName>MCRun</AssemblyName>

Loading…
Cancel
Save