/// <summary> /// 用实际数据填充gridview /// </summary> /// <returns></returns> private DataTable getBomDataTable1() { DataTable dt = initBomTable(); DataRow newRow = null; string remark; try { IList<SmtmoInfo> sMTMOInfoList = iGenSMTMO.Report(Master.userInfo.UserId, this.station.Value, Master.userInfo.Customer); if (sMTMOInfoList != null && sMTMOInfoList.Count != 0) { foreach (SmtmoInfo temp in sMTMOInfoList) { MbCodeAndMdlInfo info = new MbCodeAndMdlInfo(); info = iGenSMTMO.GetMBMDLByPno(temp.iecpartno); newRow = dt.NewRow(); newRow["MO"] = temp.smtmo; if (info != null) { newRow["MBCODE"] = info.mbCode; newRow["Descr"] = info.mdl; } else { newRow["MBCODE"] = string.Empty; newRow["Descr"] = string.Empty; } newRow["Model"] = temp.iecpartno; newRow["Qty"] = temp.qty.ToString(); newRow["PQty"] = temp.printQty.ToString(); remark = temp.remark; remark = remark.Replace("<","<"); remark = remark.Replace(">",">"); remark = remark.Replace(Environment.NewLine, "<br>"); newRow["Remark"] = remark; newRow["Cdt"] = temp.cdt.ToString("yy-MM-dd HH:mm:ss"); dt.Rows.Add(newRow); } } else { for (int i = 0; i < fullRowCount; i++) { newRow = dt.NewRow(); newRow["MO"] = String.Empty; newRow["MBCODE"] = String.Empty; newRow["Descr"] = String.Empty; newRow["Model"] = String.Empty; newRow["Qty"] = String.Empty; newRow["PQty"] = String.Empty; newRow["Remark"] = String.Empty; newRow["Cdt"] = String.Empty; dt.Rows.Add(newRow); } } dt.Columns[0].ColumnName = this.GetLocalResourceObject(pre + "_" + "colMO").ToString(); dt.Columns[1].ColumnName = this.GetLocalResourceObject(pre + "_" + "colMBCODE").ToString(); dt.Columns[2].ColumnName = this.GetLocalResourceObject(pre + "_" + "colDes").ToString(); dt.Columns[3].ColumnName = this.GetLocalResourceObject(pre + "_" + "colModel").ToString(); dt.Columns[4].ColumnName = this.GetLocalResourceObject(pre + "_" + "colQty").ToString(); dt.Columns[5].ColumnName = this.GetLocalResourceObject(pre + "_" + "colPQty").ToString(); dt.Columns[6].ColumnName = this.GetLocalResourceObject(pre + "_" + "colRemark").ToString(); dt.Columns[7].ColumnName = this.GetLocalResourceObject(pre + "_" + "colCDT").ToString(); } catch (FisException ee) { writeToAlertMessage(ee.mErrmsg); } catch (Exception ex) { writeToAlertMessage(ex.Message); } return dt; }
/// <summary> /// /// </summary> /// <param name="pno"></param> /// <returns></returns> public MbCodeAndMdlInfo GetMBMDLByPno(string pno) { IMBRepository mbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>(); MbCodeAndMdlInfo info = new MbCodeAndMdlInfo(); info = mbRepository.GetMbCodeAndMdlInfoByPnoForMB(pno); return info; }
/// <summary> /// 用实际数据填充gridview /// </summary> /// <returns></returns> private DataTable getBomDataTable() { DataTable dt = initBomTable(); DataRow newRow = null; //try //{ IList<SmtmoInfo> sMTMOInfoList = iGenSMTMO.Query(Master.userInfo.UserId, this.station.Value, Master.userInfo.Customer); if (sMTMOInfoList != null && sMTMOInfoList.Count != 0) { foreach (SmtmoInfo temp in sMTMOInfoList) { newRow = dt.NewRow(); MbCodeAndMdlInfo info = new MbCodeAndMdlInfo(); info = iGenSMTMO.GetMBMDLByPno(temp.iecpartno); //if (info != null) { newRow["MO"] = temp.smtmo; if (info != null) { newRow["MBCODE"] = info.mbCode; newRow["Descr"] = info.mdl; } else { newRow["MBCODE"] = string.Empty; newRow["Descr"] = string.Empty; } newRow["Model"] = temp.iecpartno; newRow["Qty"] = temp.qty.ToString(); newRow["PQty"] = temp.printQty.ToString(); newRow["Remark"] = temp.remark; newRow["Cdt"] = temp.cdt.ToString("yy-MM-dd HH:mm:ss"); dt.Rows.Add(newRow); } } if (sMTMOInfoList.Count < fullRowCount) { for (int i = sMTMOInfoList.Count; i < fullRowCount; i++) { newRow = dt.NewRow(); dt.Rows.Add(newRow); } } } else { for (int i = 0; i < fullRowCount; i++) { newRow = dt.NewRow(); newRow["MO"] = String.Empty; newRow["MBCODE"] = String.Empty; newRow["Descr"] = String.Empty; newRow["Model"] = String.Empty; newRow["Qty"] = String.Empty; newRow["PQty"] = String.Empty; newRow["Remark"] = String.Empty; newRow["Cdt"] = String.Empty; dt.Rows.Add(newRow); } } //} //catch (FisException ee) //{ // writeToAlertMessage(ee.mErrmsg); //} //catch (Exception ex) //{ // writeToAlertMessage(ex.Message); //} return dt; }