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_PartOutQty : F_Base { public F_PartOutQty() { this.type = "PartOutQty"; this.name = "基础资料_累计发货数量"; this.entity = new Entity_t_PartOutQty(); } public override void GetView(DataGridView dgv) { base.GetView(dgv); dgv.Columns["Code"].HeaderText = "存货代码"; dgv.Columns["PartOutQty"].HeaderText = "累计发货数量"; dgv.Columns["LastOutQty"].HeaderText = "最后发货数量"; dgv.Columns["LastOutTime"].HeaderText = "最后发货时间"; dgv.Columns["AsnNum"].HeaderText = "ASN号"; } public override void Checking(DataRow drData, bool isNew) { Entity_t_Product product = new Entity_t_Product(); if (product.GetData("", "Code='" + drData["Code"].ToString() + "'", "id asc").Tables[0].Rows.Count < 1) { //这NM的是个魔鬼~! throw new Exception(drData["Code"].ToString()+"不存在"); } base.Checking(drData, isNew); } public override void InputData(DataSet dsData, LocalDBService db) { Entity_t_PartOutQty t_Input = new Entity_t_PartOutQty(db); DataRow drInput = null; foreach (DataRow drData in dsData.Tables[0].Rows) { drInput = t_Input.Table.NewRow(); drInput["Code"] = drData["存货代码"].ToString().Trim(); drInput["PartOutQty"] = drData["累计发货数量"].ToString().Trim(); drInput["LastOutQty"] = drData["最后发货数量"].ToString().Trim(); drInput["LastOutTime"] = drData["最后发货时间"].ToString().Trim(); drInput["AsnNum"] = drData["ASN号"].ToString().Trim(); if (drInput["Code"].ToString().Trim() == "") throw new Exception("存货代码不能为空!"); if (t_Input.GetData("", "Code='" + drInput["Code"].ToString() + "'", "id asc").Tables[0].Rows.Count > 0) throw new Exception("存货代码 " + drInput["Code"].ToString() + " 已经存在!"); t_Input.Add(drInput); } } } }