/// <summary> /// 获取当前集合指定行的实体对象 /// </summary> /// <param name="index">集合中行的索引</param> /// <returns>相关的实体对象(没有记录则返回空)</returns> public CEntityQuantityUnit this[int index] { get { //如果前一次执行已经转换过当前索引则直接返回 if (index == this.m_index) { return(this.m_CEntityQuantityUnit); } if (this.Rows.Count > 0) { m_CEntityQuantityUnit = new CEntityQuantityUnit(); m_CEntityQuantityUnit.ID = ToolKit.ParseInt(this.Rows[index][CEntityQuantityUnit.FILED_ID]); m_CEntityQuantityUnit.XID = ToolKit.ParseInt(this.Rows[index][CEntityQuantityUnit.FILED_XID]); m_CEntityQuantityUnit.DXID = ToolKit.ParseInt(this.Rows[index][CEntityQuantityUnit.FILED_DXID]); m_CEntityQuantityUnit.DWID = ToolKit.ParseInt(this.Rows[index][CEntityQuantityUnit.FILED_DWID]); m_CEntityQuantityUnit.QID = ToolKit.ParseInt(this.Rows[index][CEntityQuantityUnit.FILED_QID]); m_CEntityQuantityUnit.ZID = ToolKit.ParseInt(this.Rows[index][CEntityQuantityUnit.FILED_ZID]); m_CEntityQuantityUnit.ZCID = ToolKit.ParseInt(this.Rows[index][CEntityQuantityUnit.FILED_ZCID]); m_CEntityQuantityUnit.ZCLB = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntityQuantityUnit.FILED_ZCLB]); m_CEntityQuantityUnit.CJXXID = ToolKit.ParseInt(this.Rows[index][CEntityQuantityUnit.FILED_CJXXID]); m_CEntityQuantityUnit.YSBH = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntityQuantityUnit.FILED_YSBH]); m_CEntityQuantityUnit.YSMC = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntityQuantityUnit.FILED_YSMC]); m_CEntityQuantityUnit.YSDW = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntityQuantityUnit.FILED_YSDW]); m_CEntityQuantityUnit.YSXHL = CDataConvert.ConToValue <System.Decimal>(this.Rows[index][CEntityQuantityUnit.FILED_YSXHL]); m_CEntityQuantityUnit.DEDJ = CDataConvert.ConToValue <System.Decimal>(this.Rows[index][CEntityQuantityUnit.FILED_DEDJ]); m_CEntityQuantityUnit.DEHJ = CDataConvert.ConToValue <System.Decimal>(this.Rows[index][CEntityQuantityUnit.FILED_DEHJ]); m_CEntityQuantityUnit.BH = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntityQuantityUnit.FILED_BH]); m_CEntityQuantityUnit.LB = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntityQuantityUnit.FILED_LB]); m_CEntityQuantityUnit.SDCLB = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntityQuantityUnit.FILED_SDCLB]); m_CEntityQuantityUnit.SDCXS = CDataConvert.ConToValue <System.Decimal>(this.Rows[index][CEntityQuantityUnit.FILED_SDCXS]); m_CEntityQuantityUnit.SDCHJ = CDataConvert.ConToValue <System.Decimal>(this.Rows[index][CEntityQuantityUnit.FILED_SDCHJ]); m_CEntityQuantityUnit.MC = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntityQuantityUnit.FILED_MC]); m_CEntityQuantityUnit.GGXH = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntityQuantityUnit.FILED_GGXH]); m_CEntityQuantityUnit.DW = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntityQuantityUnit.FILED_DW]); m_CEntityQuantityUnit.SCDJ = CDataConvert.ConToValue <System.Decimal>(this.Rows[index][CEntityQuantityUnit.FILED_SCDJ]); m_CEntityQuantityUnit.SCHJ = CDataConvert.ConToValue <System.Decimal>(this.Rows[index][CEntityQuantityUnit.FILED_SCHJ]); m_CEntityQuantityUnit.XHL = CDataConvert.ConToValue <System.Decimal>(this.Rows[index][CEntityQuantityUnit.FILED_XHL]); m_CEntityQuantityUnit.GCL = CDataConvert.ConToValue <System.Decimal>(this.Rows[index][CEntityQuantityUnit.FILED_GCL]); m_CEntityQuantityUnit.JC = CDataConvert.ConToValue <System.Decimal>(this.Rows[index][CEntityQuantityUnit.FILED_SL]); m_CEntityQuantityUnit.SL = CDataConvert.ConToValue <System.Decimal>(this.Rows[index][CEntityQuantityUnit.FILED_JC]); m_CEntityQuantityUnit.IFPB = ToolKit.ParseBoolen(this.Rows[index][CEntityQuantityUnit.FILED_IFPB]); m_CEntityQuantityUnit.IFZG = ToolKit.ParseBoolen(this.Rows[index][CEntityQuantityUnit.FILED_IFZG]); m_CEntityQuantityUnit.IFJG = ToolKit.ParseBoolen(this.Rows[index][CEntityQuantityUnit.FILED_IFJG]); m_CEntityQuantityUnit.IFYG = ToolKit.ParseBoolen(this.Rows[index][CEntityQuantityUnit.FILED_IFYG]); m_CEntityQuantityUnit.IFFX = ToolKit.ParseBoolen(this.Rows[index][CEntityQuantityUnit.FILED_IFFX]); m_CEntityQuantityUnit.IFSDSL = ToolKit.ParseBoolen(this.Rows[index][CEntityQuantityUnit.FILED_IFSDSL]); m_CEntityQuantityUnit.IFSDSCDJ = ToolKit.ParseBoolen(this.Rows[index][CEntityQuantityUnit.FILED_IFSDSCDJ]); m_CEntityQuantityUnit.IFSDGLJ = ToolKit.ParseBoolen(this.Rows[index][CEntityQuantityUnit.FILED_IFSDGLJ]); m_CEntityQuantityUnit.IFSDXHL = ToolKit.ParseBoolen(this.Rows[index][CEntityQuantityUnit.FILED_IFSDXHL]); m_CEntityQuantityUnit.SSKLB = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntityQuantityUnit.FILED_SSKLB]); m_CEntityQuantityUnit.SSXMLB = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntityQuantityUnit.FILED_SSXMLB]); m_CEntityQuantityUnit.SSXM = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntityQuantityUnit.FILED_SSXM]); m_CEntityQuantityUnit.GLJBZ = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntityQuantityUnit.FILED_GLJBZ]); m_CEntityQuantityUnit.ZJCS = CDataConvert.ConToValue <System.String>(this.Rows[index][CEntityQuantityUnit.FILED_ZJCS]); this.m_index = index; return(m_CEntityQuantityUnit); } return(null); } set { this.Rows[index][CEntityQuantityUnit.FILED_ID] = value.ID; this.Rows[index][CEntityQuantityUnit.FILED_XID] = value.XID; this.Rows[index][CEntityQuantityUnit.FILED_DXID] = value.DXID; this.Rows[index][CEntityQuantityUnit.FILED_DWID] = value.DWID; this.Rows[index][CEntityQuantityUnit.FILED_QID] = value.QID; this.Rows[index][CEntityQuantityUnit.FILED_ZID] = value.ZID; this.Rows[index][CEntityQuantityUnit.FILED_ZCID] = value.ZCID; this.Rows[index][CEntityQuantityUnit.FILED_ZCLB] = value.ZCLB; this.Rows[index][CEntityQuantityUnit.FILED_CJXXID] = value.CJXXID; this.Rows[index][CEntityQuantityUnit.FILED_YSBH] = value.YSBH; this.Rows[index][CEntityQuantityUnit.FILED_YSMC] = value.YSMC; this.Rows[index][CEntityQuantityUnit.FILED_YSDW] = value.YSDW; this.Rows[index][CEntityQuantityUnit.FILED_YSXHL] = value.YSXHL; this.Rows[index][CEntityQuantityUnit.FILED_DEDJ] = value.DEDJ; this.Rows[index][CEntityQuantityUnit.FILED_DEHJ] = value.DEHJ; this.Rows[index][CEntityQuantityUnit.FILED_BH] = value.BH; this.Rows[index][CEntityQuantityUnit.FILED_LB] = value.LB; this.Rows[index][CEntityQuantityUnit.FILED_SDCLB] = value.SDCLB; this.Rows[index][CEntityQuantityUnit.FILED_SDCXS] = value.SDCXS; this.Rows[index][CEntityQuantityUnit.FILED_SDCHJ] = value.SDCHJ; this.Rows[index][CEntityQuantityUnit.FILED_MC] = value.MC; this.Rows[index][CEntityQuantityUnit.FILED_GGXH] = value.GGXH; this.Rows[index][CEntityQuantityUnit.FILED_DW] = value.DW; this.Rows[index][CEntityQuantityUnit.FILED_SCDJ] = value.SCDJ; this.Rows[index][CEntityQuantityUnit.FILED_SCHJ] = value.SCHJ; this.Rows[index][CEntityQuantityUnit.FILED_XHL] = value.XHL; this.Rows[index][CEntityQuantityUnit.FILED_GCL] = value.GCL; this.Rows[index][CEntityQuantityUnit.FILED_JC] = value.JC; this.Rows[index][CEntityQuantityUnit.FILED_SL] = value.SL; this.Rows[index][CEntityQuantityUnit.FILED_IFPB] = value.IFPB; this.Rows[index][CEntityQuantityUnit.FILED_IFZG] = value.IFZG; this.Rows[index][CEntityQuantityUnit.FILED_IFJG] = value.IFJG; this.Rows[index][CEntityQuantityUnit.FILED_IFYG] = value.IFYG; this.Rows[index][CEntityQuantityUnit.FILED_IFFX] = value.IFFX; this.Rows[index][CEntityQuantityUnit.FILED_IFSDSL] = value.IFSDSL; this.Rows[index][CEntityQuantityUnit.FILED_IFSDSCDJ] = value.IFSDSCDJ; this.Rows[index][CEntityQuantityUnit.FILED_IFSDGLJ] = value.IFSDGLJ; this.Rows[index][CEntityQuantityUnit.FILED_IFSDXHL] = value.IFSDXHL; this.Rows[index][CEntityQuantityUnit.FILED_SSKLB] = value.SSKLB; this.Rows[index][CEntityQuantityUnit.FILED_SSXMLB] = value.SSXMLB; this.Rows[index][CEntityQuantityUnit.FILED_SSXM] = value.SSXM; this.Rows[index][CEntityQuantityUnit.FILED_GLJBZ] = value.GLJBZ; this.Rows[index][CEntityQuantityUnit.FILED_ZJCS] = value.ZJCS; } }
/// <summary> /// 创建工料机(根据定额材机) /// </summary> public virtual void CreateGLJ() { DataTable dt = this.Unit.Property.Libraries.FixedLibrary.LibraryDataSet.Tables["材机表"]; if (!string.IsNullOrEmpty(this.Current.DECJ)) { string[] strs = this.Current.DECJ.Split('|'); CEntityQuantityUnit[] infos = new CEntityQuantityUnit[strs.Length - 1]; for (int i = 0; i < strs.Length - 1; i++) { string[] str = strs[i].Split(','); DataRow[] dr = dt.Select(string.Format("CAIJBH ='{0}'", str[0].ToString())); if (dr != null) { if (dr.Length < 1) { continue; } DataRow info = this.Unit.StructSource.ModelQuantity.NewRow(); info["YSBH"] = dr[0]["CAIJBH"]; info["YSMC"] = dr[0]["CAIJMC"]; info["YSDW"] = dr[0]["CAIJDW"]; info["YSXHL"] = ToolKit.ParseDecimal(str[1]); info["BH"] = dr[0]["CAIJBH"]; info["MC"] = dr[0]["CAIJMC"]; info["DW"] = dr[0]["CAIJDW"]; info["LB"] = dr[0]["CAIJLB"]; info["XHL"] = str.Length == 4 && !info["LB"].ToString().Contains("%") ? ToolKit.ParseDecimal(str[3]) : ToolKit.ParseDecimal(str[1]); info["DEDJ"] = ToolKit.ParseDecimal(dr[0]["CAIJDJ"]); info["ZCLB"] = "W"; info["SDCLB"] = dr[0]["SANDCMC"]; info["SDCXS"] = ToolKit.ParseDecimal(dr[0]["SANDCXS"]); info["GCL"] = this.Current.GCL; info["SSKLB"] = this.Current.LibraryName; DataRow row = this.Unit.StructSource.ModelQuantity.Select(string.Format("BH='{0}'", info["BH"])).FirstOrDefault(); if (row == null) { info["IFSC"] = dr[0]["CAIJSC"].Equals("是") ? true : false; info["IFZYCL"] = dr[0]["CAIJXSJG"].Equals("是") ? true : false; if (str[2] != string.Empty) { info["SCDJ"] = ToolKit.ParseDecimal(str[2]); } else { info["SCDJ"] = info["DEDJ"]; } } else { info["IFSC"] = row["IFSC"]; info["IFFX"] = row["IFFX"]; info["IFSDSCDJ"] = row["IFSDSCDJ"]; info["IFZYCL"] = row["IFZYCL"]; info["YTLB"] = row["YTLB"]; info["SCDJ"] = row["SCDJ"]; info["DEDJ"] = row["DEDJ"]; info["JSDJ"] = row["JSDJ"]; info["CJ"] = row["CJ"]; info["PP"] = row["PP"]; info["ZLDJ"] = row["ZLDJ"]; info["GYS"] = row["GYS"]; info["CD"] = row["CD"]; info["CJBZ"] = row["CJBZ"]; } if (info["LB"].Equals("主材") || info["LB"].Equals("设备")) { info["DEDJ"] = info["SCDJ"]; } info["UnID"] = this.Current.UnID; info["EnID"] = this.Current.EnID; info["ZMID"] = this.Current.ID; info["QDID"] = this.Current.PID; info["SSLB"] = this.Current.SSLB; info["PID"] = DBNull.Value; if (info["LB"].Equals("配合比") || info["LB"].ToString().Contains("台班")) { info["IFKFJ"] = true; } info["CTIME"] = DateTime.Now; this.Unit.StructSource.ModelQuantity.Rows.Add(info); if (info["IFKFJ"].Equals(true)) { //此处需要调用 当前工料机的行计算 _Methods_Quantity met = new _Methods_Quantity(this.Unit); met.Parent = info; met.Create(); } } } } }
/// <summary> /// 当前实体集合中追加单个实体 /// </summary> /// <param name="entity">要追加的实体对象</param> /// <returns>追加的行的索引(当前)</returns> public int AppendEntityInfo(CEntityQuantityUnit entity) { if (this == null || this.Columns.Count == 0) { this.buliderTable(); } if (entity != null) { DataRow row = this.NewRow(); row[CEntityQuantityUnit.FILED_XID] = entity.XID; row[CEntityQuantityUnit.FILED_DXID] = entity.DXID; row[CEntityQuantityUnit.FILED_DWID] = entity.DWID; row[CEntityQuantityUnit.FILED_QID] = entity.QID; row[CEntityQuantityUnit.FILED_ZID] = entity.ZID; row[CEntityQuantityUnit.FILED_ZCID] = entity.ZCID; row[CEntityQuantityUnit.FILED_ZCLB] = entity.ZCLB; row[CEntityQuantityUnit.FILED_CJXXID] = entity.CJXXID; row[CEntityQuantityUnit.FILED_YSBH] = entity.YSBH; row[CEntityQuantityUnit.FILED_YSMC] = entity.YSMC; row[CEntityQuantityUnit.FILED_YSDW] = entity.YSDW; row[CEntityQuantityUnit.FILED_YSXHL] = entity.YSXHL; row[CEntityQuantityUnit.FILED_DEDJ] = entity.DEDJ; row[CEntityQuantityUnit.FILED_BH] = entity.BH; row[CEntityQuantityUnit.FILED_LB] = entity.LB; row[CEntityQuantityUnit.FILED_SDCLB] = entity.SDCLB; row[CEntityQuantityUnit.FILED_SDCXS] = entity.SDCXS; row[CEntityQuantityUnit.FILED_SDCHJ] = entity.SDCHJ; row[CEntityQuantityUnit.FILED_MC] = entity.MC; row[CEntityQuantityUnit.FILED_GGXH] = entity.GGXH; row[CEntityQuantityUnit.FILED_DW] = entity.DW; row[CEntityQuantityUnit.FILED_SCDJ] = entity.SCDJ; row[CEntityQuantityUnit.FILED_XHL] = entity.XHL; row[CEntityQuantityUnit.FILED_GCL] = entity.GCL; row[CEntityQuantityUnit.FILED_IFPB] = entity.IFPB; row[CEntityQuantityUnit.FILED_IFZG] = entity.IFZG; row[CEntityQuantityUnit.FILED_IFJG] = entity.IFJG; row[CEntityQuantityUnit.FILED_IFYG] = entity.IFYG; row[CEntityQuantityUnit.FILED_IFFX] = entity.IFFX; row[CEntityQuantityUnit.FILED_IFSDSL] = entity.IFSDSL; row[CEntityQuantityUnit.FILED_IFSDSCDJ] = entity.IFSDSCDJ; row[CEntityQuantityUnit.FILED_IFSDGLJ] = entity.IFSDGLJ; row[CEntityQuantityUnit.FILED_IFSDXHL] = entity.IFSDXHL; row[CEntityQuantityUnit.FILED_SSKLB] = entity.SSKLB; row[CEntityQuantityUnit.FILED_SSXMLB] = entity.SSXMLB; row[CEntityQuantityUnit.FILED_SSXM] = entity.SSXM; row[CEntityQuantityUnit.FILED_GLJBZ] = entity.GLJBZ; row[CEntityQuantityUnit.FILED_ZJCS] = entity.ZJCS; //自增长列 //row[CEntityQuantityUnit.FILED_ID] = entity.ID; //需要计算赋值列 //row[CEntityQuantityUnit.FILED_DEHJ] = entity.DEHJ; //row[CEntityQuantityUnit.FILED_SCHJ] = entity.SCHJ; //row[CEntityQuantityUnit.FILED_JC] = entity.JC; //row[CEntityQuantityUnit.FILED_SL] = entity.SL; this.Rows.Add(row); return(Convert.ToInt32(row[CEntityQuantityUnit.FILED_ID])); } else { return(-1); } }