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_Location : F_Base { public F_Location() { this.type = "Location"; this.name = "基础资料_库位"; this.entity = new Entity_t_Location(); this.entityView = new Entity_t_Location(); } public override void GetView(System.Windows.Forms.DataGridView dgv) { base.GetView(dgv); dgv.Columns["Code"].HeaderText = "编号"; dgv.Columns["Name"].HeaderText = "名称"; dgv.Columns["COM"].HeaderText = "端口"; dgv.Columns["PartType"].HeaderText = "零件类型"; dgv.Columns["LightAddress"].HeaderText = "灯地址"; dgv.Columns["LocationType"].HeaderText = "库位类型"; dgv.Columns["Enabled"].HeaderText = "状态"; dgv.Columns["AssyType"].HeaderText = "装配类型"; dgv.Columns["PreAssyType"].HeaderText = "预装"; } public override void InputData(DataSet dsInput, Gm_WMS.DataAccess.DataService.LocalDBService db) { try { Entity_t_Location t_Input = new Entity_t_Location(db); DataRow drInput = null; foreach (DataRow drData in dsInput.Tables[0].Rows) { if (drData["编号"].ToString().Trim() == "") continue; drInput = t_Input.Table.NewRow(); drInput["Code"] = drData["编号"].ToString().Trim(); drInput["Name"] = drData["名称"].ToString().Trim(); drInput["COM"] = drData["端口"].ToString(); drInput["PartType"] = drData["零件类型"].ToString(); drInput["LightAddress"] = drData["灯地址"].ToString(); drInput["LocationType"] = drData["库位类型"].ToString(); drInput["Enabled"] = drData["状态"].ToString(); drInput["AssyType"] = drData["装配类型"].ToString(); drInput["PreAssyType"] = drData["预装"].ToString(); if (drInput["Code"].ToString().Trim() == "") throw new Exception("编号不能为空!"); if (new Entity_t_Location(db).GetData("", "Code='" + drInput["Code"].ToString() + "'", "id asc").Tables[0].Rows.Count > 0) throw new Exception("编号 " + drInput["Code"].ToString() + " 已经存在!"); t_Input.Add(drInput); } } catch (Exception ex) { throw new Exception(ex.Message); } } } }