diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Product/PptPlan/PlanDownloadAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Product/PptPlan/PlanDownloadAction.cs index 5adab86..16086ce 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Product/PptPlan/PlanDownloadAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Product/PptPlan/PlanDownloadAction.cs @@ -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) - { - MessageBox.Show("配方还在正在执行中,请勿下发!"); - ICSharpCode.Core.LoggingService.Error("{生产计划-手动下发计划} 配方正在执行中..."); - return; - } - } - if (weighbridge == "2号地磅") + if (string.IsNullOrEmpty(weighbridge)) { - int status = BasePlcHelper.Instance.solvent2_SystemRuning.NowValue.ToInt(); - if (status ==1) - { - MessageBox.Show("配方还在正在执行中,请勿下发!"); - ICSharpCode.Core.LoggingService.Error("{生产计划-手动下发计划} 配方正在执行中..."); - return; - } + MessageBox.Show("地磅为空,不可以下发任务!"); + ICSharpCode.Core.LoggingService.Error("{生产计划-手动下发计划} 地磅为空."); + return; } + //任务还在称量中,不允许下发计划 + //if (weighbridge == "1号地磅") + //{ + // int status = BasePlcHelper.Instance.solvent_SystemRuning.NowValue.ToInt(); + // if (status == 1) + // { + // MessageBox.Show("配方还在正在执行中,请勿下发!"); + // ICSharpCode.Core.LoggingService.Error("{生产计划-手动下发计划} 配方正在执行中..."); + // return; + // } + //} + //if (weighbridge == "2号地磅") + //{ + // int status = BasePlcHelper.Instance.solvent2_SystemRuning.NowValue.ToInt(); + // if (status ==1) + // { + // MessageBox.Show("配方还在正在执行中,请勿下发!"); + // ICSharpCode.Core.LoggingService.Error("{生产计划-手动下发计划} 配方正在执行中..."); + // return; + // } + //} //获取选中计划、获取选中物料 @@ -119,19 +126,18 @@ namespace Mesnac.Action.ChemicalWeighing.Product.PptPlan List 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("计划任务下发成功!"); diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Warehouse/ImportAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Warehouse/ImportAction.cs index 31c32d9..e1f8ac7 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Warehouse/ImportAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Warehouse/ImportAction.cs @@ -49,6 +49,7 @@ namespace Mesnac.Action.ChemicalWeighing.Warehouse //{ // return; //} + base.RunIni(runtime); //必须要调用的 ICSharpCode.Core.LoggingService.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); diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Warehouse/ImportHelper/RjHelper.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Warehouse/ImportHelper/RjHelper.cs index 14ef41d..9c3b79f 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Warehouse/ImportHelper/RjHelper.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Warehouse/ImportHelper/RjHelper.cs @@ -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 diff --git a/Main/MCRun/Data/MCProject/nodeDataSource.xml b/Main/MCRun/Data/MCProject/nodeDataSource.xml index 479381b..91d4223 100644 --- a/Main/MCRun/Data/MCProject/nodeDataSource.xml +++ b/Main/MCRun/Data/MCProject/nodeDataSource.xml @@ -1,3 +1,3 @@ - + \ No newline at end of file diff --git a/Main/MCRun/MCRun.csproj b/Main/MCRun/MCRun.csproj index 673aefb..514a184 100644 --- a/Main/MCRun/MCRun.csproj +++ b/Main/MCRun/MCRun.csproj @@ -6,7 +6,7 @@ 8.0.30703 2.0 {91C803A6-90D1-4361-8B92-9AFD9E766411} - Exe + WinExe Properties MCRun MCRun