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.
72 lines
2.3 KiB
72 lines
2.3 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
using Stone.Entity;
|
|
using System.Data;
|
|
using Stone.Common;
|
|
|
|
namespace Stone.WinBiz.BasicData
|
|
{
|
|
public class F_Bom : F_Base
|
|
{
|
|
public F_Bom()
|
|
{
|
|
this.type = "BOM";
|
|
this.name = "BOM";
|
|
this.entity = new Entity_t_Bom();
|
|
}
|
|
|
|
|
|
|
|
public override void Checking(DataRow drData, bool isNew)
|
|
{
|
|
string Code = drData["Code"].ToString().Trim();
|
|
string PartNumber = drData["PartNumber"].ToString().Trim();
|
|
|
|
if (isNew)
|
|
{
|
|
if (entity.GetData($"[Code]='{Code}' and [PartNumber]='{PartNumber}'").Tables[0].Rows.Count > 0)
|
|
throw new Exception($"Code {Code} 已经包括子零件 {PartNumber}");
|
|
|
|
}
|
|
else
|
|
{
|
|
if (entity.GetData($"[Code]='{Code}' and [PartNumber]='{PartNumber}' and [ID]<>{drData["ID"]}").Tables[0].Rows.Count > 0)
|
|
throw new Exception($"Code {Code} 已经包括子零件 {PartNumber}");
|
|
}
|
|
|
|
}
|
|
|
|
|
|
public override void InputData(DataSet dsInput, Gm_WMS.DataAccess.DataService.LocalDBService db)
|
|
{
|
|
try
|
|
{
|
|
Entity_t_Bom t_Input = new Entity_t_Bom(db);
|
|
DataRow drInput = null;
|
|
|
|
foreach (DataRow drData in dsInput.Tables[0].Rows)
|
|
{
|
|
drInput = t_Input.Table.NewRow();
|
|
drInput["CarType"] = drData["CarType"].ToString().Trim();
|
|
drInput["Code"] = drData["Code"].ToString().Trim();
|
|
drInput["Position"] = drData["Position"].ToString().Trim();
|
|
drInput["PartNumber"] = drData["PartNumber"].ToString().Trim();
|
|
drInput["Qty"] = drData["Qty"].ToString();
|
|
drInput["Memo"] = drData["Memo"].ToString();
|
|
|
|
if (t_Input.GetData($"[Code]='{drData["Code"]}' and [PartNumber]='{drData["PartNumber"]}'").Tables[0].Rows.Count > 0)
|
|
throw new Exception($"Code {drData["Code"]} 已经包括子零件 {drData["PartNumber"]}");
|
|
|
|
t_Input.Add(drInput);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception("错误原因为:\r\n" + ex.Message);
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|