You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.2 KiB

3 years ago
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data;
using Stone.Entity;
using Gm_WMS.DataAccess.DataService;
namespace Stone.WinBiz.BasicData
{
public class F_FeaturePart : F_Base
{
public string FeatureCode = string.Empty;
public F_FeaturePart()
{
this.type = "FeaturePart";
this.name = "基础资料_匹配特征管理_零件设置";
this.entity = new Entity_t_FeaturePart();
}
public override void GetView(DataGridView dgv)
{
base.GetView(dgv);
dgv.Columns["FeatureCode"].Visible = false;
dgv.Columns["PartNumber"].HeaderText = "零件号";
dgv.Columns["PartName"].HeaderText = "零件名称";
}
public override void Checking(DataRow drData, bool isNew)
{
//base.Checking(drData, isNew);
if (isNew)
{
if (entity.GetData("", "FeatureCode='" + drData["FeatureCode"].ToString() + "' and PartNumber='" + drData["PartNumber"].ToString() + "'", "id asc").Tables[0].Rows.Count > 0)
throw new Exception("零件号 " + drData["PartNumber"].ToString() + " 已经存在!");
}
}
public override void InputData(DataSet dsData, LocalDBService db)
{
Entity_t_FeaturePart t_Input = new Entity_t_FeaturePart(db);
DataRow drInput = null;
foreach (DataRow drData in dsData.Tables[0].Rows)
{
drInput = t_Input.Table.NewRow();
drInput["FeatureCode"] = FeatureCode;
drInput["PartNumber"] = drData["零件号"].ToString().Trim();
drInput["PartName"] = drData["零件名称"].ToString().Trim();
if (t_Input.GetData("", "FeatureCode='" + drInput["FeatureCode"].ToString() + "' and PartNumber='" + drInput["PartNumber"].ToString() + "'", "id asc").Tables[0].Rows.Count > 0)
throw new Exception("零件号 " + drInput["PartNumber"].ToString() + " 已经存在!");
t_Input.Add(drInput);
}
}
}
}