public static List <PKDeliverErrorBox> GetDeliverErrorBoxListByBoxGuid(string BOXGUID) { try { string sql = @"SELECT BOXGUID, LOUCENG, PARTNER, SHIP_DATE, HU, ZSATNR, ZCOLSN, ZSIZTX, QUAN, REAL, DIFF, REMARK, SHORTQTY, PICK_TASK, PICK_TASK_ITEM, MATNR, ADD_REAL FROM DeliverErrorBox WHERE BOXGUID = @BOXGUID "; SqlParameter p1 = DBHelper.CreateParameter("@BOXGUID", BOXGUID); DataTable table = DBHelper.GetTable(sql, false, p1); if (table != null && table.Rows.Count > 0) { List <PKDeliverErrorBox> list = new List <PKDeliverErrorBox>(); foreach (DataRow row in table.Rows) { PKDeliverErrorBox item = new PKDeliverErrorBox(); item.BOXGUID = row["BOXGUID"] != null ? row["BOXGUID"].ToString() : null; item.LOUCENG = row["LOUCENG"] != null ? row["LOUCENG"].ToString() : null; item.PICK_TASK = row["PICK_TASK"] != null ? row["PICK_TASK"].ToString() : null; item.PICK_TASK_ITEM = row["PICK_TASK_ITEM"] != null ? row["PICK_TASK_ITEM"].ToString() : null; item.PARTNER = row["PARTNER"] != null ? row["PARTNER"].ToString() : null; item.SHIP_DATE = row["SHIP_DATE"] != null?DateTime.Parse(row["SHIP_DATE"].ToString()) : DateTime.MinValue; item.SHORTQTY = row["SHORTQTY"] != null?long.Parse(row["SHORTQTY"].ToString()) : 0; item.HU = row["HU"] != null ? row["HU"].ToString() : null; item.MATNR = row["MATNR"] != null ? row["MATNR"].ToString() : null; item.ZSATNR = row["ZSATNR"] != null ? row["ZSATNR"].ToString() : null; item.ZCOLSN = row["ZCOLSN"] != null ? row["ZCOLSN"].ToString() : null; item.ZSIZTX = row["ZSIZTX"] != null ? row["ZSIZTX"].ToString() : null; item.QUAN = row["QUAN"] != null?long.Parse(row["QUAN"].ToString()) : 0; item.REAL = row["REAL"] != null?long.Parse(row["REAL"].ToString()) : 0; item.ADD_REAL = row["ADD_REAL"] != null?long.Parse(row["ADD_REAL"].ToString()) : 0; item.DIFF = row["DIFF"] != null?long.Parse(row["DIFF"].ToString()) : 0; item.REMARK = row["REMARK"] != null ? row["REMARK"].ToString() : null; list.Add(item); } return(list); } return(null); } catch { return(null); } }
public static List <PKDeliverErrorBox> GetDeliverErrorBoxByHu(string hu) { string sql = string.Format(@"SELECT * FROM dbo.DeliverErrorBox WHERE BOXGUID = (SELECT TOP 1 BOXGUID FROM dbo.DeliverErrorBox WHERE HU = '{0}' ORDER BY CreateTime DESC)", hu); DataTable dt = DBHelper.GetTable(sql, false); List <PKDeliverErrorBox> result = null; if (dt?.Rows.Count > 0) { result = new List <PKDeliverErrorBox>(); foreach (DataRow row in dt.Rows) { result.Add(PKDeliverErrorBox.BuildPKDeliverErrorBox(row)); } } return(result); }
private void AddErrorRecord(PKDeliverErrorBox item) { grid.Rows.Insert(0, item.PARTNER, item.HU, item.ZSATNR, item.ZCOLSN, item.ZSIZTX, item.DIFF, item.REMARK); }