|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using Mesnac.Action.Base;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using Mesnac.Controls.Base;
|
|
|
|
|
using Mesnac.Action.Intake.Qingquan.MaterialManager;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Action.Intake.Qingquan.Verification
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 物料验证
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class MaterialValidateAction : IntakeAction,IAction
|
|
|
|
|
{
|
|
|
|
|
public void Run(RuntimeParameter runtime)
|
|
|
|
|
{
|
|
|
|
|
base.RunIni(runtime);
|
|
|
|
|
DbMCControl materCodeControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "[pmt_material].[mater_code]").FirstOrDefault();
|
|
|
|
|
DbMCControl materNameControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "[pmt_material].[mater_name]").FirstOrDefault();
|
|
|
|
|
if (materCodeControl == null)
|
|
|
|
|
{
|
|
|
|
|
ICSharpCode.Core.LoggingService.Warn("缺少物料编码输入控件!");
|
|
|
|
|
MessageBox.Show("缺少物料编码输入控件!", Language(1), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
|
runtime.IsReturn = true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (materNameControl == null)
|
|
|
|
|
{
|
|
|
|
|
ICSharpCode.Core.LoggingService.Warn("缺少物料名称输入控件!");
|
|
|
|
|
MessageBox.Show("缺少物料名称输入控件!", Language(1), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
|
runtime.IsReturn = true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
string materCode = String.Empty;
|
|
|
|
|
string materName = String.Empty;
|
|
|
|
|
if (materCodeControl.BaseControl.MCValue != null)
|
|
|
|
|
{
|
|
|
|
|
materCode = materCodeControl.BaseControl.MCValue.ToString();
|
|
|
|
|
}
|
|
|
|
|
if (materNameControl.BaseControl.MCValue != null)
|
|
|
|
|
{
|
|
|
|
|
materName = materNameControl.BaseControl.MCValue.ToString();
|
|
|
|
|
}
|
|
|
|
|
if (Material.IsExistsMaterCode(materCode.Trim()))
|
|
|
|
|
{
|
|
|
|
|
//【物料编码】已存在,请输入一个不存在的物料编码!
|
|
|
|
|
MessageBox.Show(Language(290), Language(1), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
|
runtime.IsReturn = true; //终止执行
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (Material.IsExistsMaterName(materName.Trim()))
|
|
|
|
|
{
|
|
|
|
|
//【物料名称】已存在,请输入一个不存在的物料名称!
|
|
|
|
|
MessageBox.Show(Language(291), Language(1), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
|
runtime.IsReturn = true; //终止执行
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|