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.
80 lines
2.9 KiB
80 lines
2.9 KiB
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;
|
|
using Stone.Common;
|
|
|
|
namespace Stone.WinBiz.BasicData
|
|
{
|
|
public class F_Part_ValidityDays : F_Base
|
|
{
|
|
public F_Part_ValidityDays()
|
|
{
|
|
this.type = "Part_ValidityDays";
|
|
this.name = "基础资料_物料与保质期对应关系";
|
|
this.entity = new Entity_t_Part_ValidityDays();
|
|
}
|
|
|
|
public override void GetView(DataGridView dgv)
|
|
{
|
|
base.GetView(dgv);
|
|
|
|
dgv.Columns["PartCode"].HeaderText = "零件编号";
|
|
dgv.Columns["ValidityDays"].HeaderText = "质保期(天)";
|
|
dgv.Columns["Memo"].HeaderText = "备注";
|
|
|
|
|
|
}
|
|
|
|
public override void Checking(DataRow drData, bool isNew)
|
|
{
|
|
if (drData["PartCode"].ToString().Trim() == "")
|
|
throw new Exception("零件编号 不能为空!");
|
|
//零件校验
|
|
//Entity_t_Dep t_Dep = new Entity_t_Dep();
|
|
//if (t_Dep.GetData("[DepCode]='" + drData["DepCode"].ToString() + "'").Tables[0].Rows.Count == 0)
|
|
// throw new Exception("部门编号 " + drData["DepCode"].ToString() + " 在系统中不存在");
|
|
|
|
if (isNew)
|
|
{
|
|
if (entity.GetData("", "PartCode='" + drData["PartCode"].ToString() + "'", "id asc").Tables[0].Rows.Count > 0)
|
|
throw new Exception("编号 " + drData["PartCode"].ToString() + " 已经存在!");
|
|
|
|
}
|
|
else
|
|
{
|
|
if (entity.GetData("", "[ID]<>" + drData["ID"].ToString() + " and PartCode='" + drData["PartCode"].ToString() + "'", "id asc").Tables[0].Rows.Count > 0)
|
|
throw new Exception("编号 " + drData["PartCode"].ToString() + " 已经存在!");
|
|
}
|
|
}
|
|
|
|
public override void InputData(DataSet dsData, LocalDBService db)
|
|
{
|
|
Entity_t_Part_ValidityDays t_Input = new Entity_t_Part_ValidityDays(db);
|
|
DataRow drInput = null;
|
|
|
|
foreach (DataRow drData in dsData.Tables[0].Rows)
|
|
{
|
|
|
|
drInput = t_Input.Table.NewRow();
|
|
drInput["PartCode"] = MyStrings.GetString(drData["零件编号"].ToString().Trim());
|
|
drInput["ValidityDays"] = MyStrings.GetString(drData["质保期(天)"].ToString().Trim());
|
|
drInput["Memo"] = MyStrings.GetString(drData["备注"].ToString().Trim());
|
|
|
|
|
|
if (drInput["PartCode"].ToString().Trim() == "")
|
|
throw new Exception("零件编号 不能为空!");
|
|
|
|
if (drInput["ValidityDays"].ToString().Trim() == "")
|
|
throw new Exception("质保期 不能为空!");
|
|
|
|
t_Input.Add(drInput);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|