Exemple #1
0
        public override void Rec_Create(ActionAttribute p_attr)
        {
            _QuantityUnitComponentInfo m_info = p_attr.Source as _QuantityUnitComponentInfo;
            _QuantityUnitComponentInfo p_info = p_attr.TagValue as _QuantityUnitComponentInfo;

            if (m_info != null)
            {
                if (this.Activitie.Property.RepeatInfo(m_info))
                {
                    if (this.Parent.QuantityUnitComponentList.GetCount(m_info) == 0)
                    {
                        int index = 0;
                        if (p_info != null)
                        {
                            index = this.Parent.QuantityUnitComponentList.IndexOf(p_info);
                        }
                        this.Parent.QuantityUnitComponentList.Add(index, m_info);
                        //引发计算
                        this.Parent.Parent.Subheadings_Statistics.Begin();
                        //刷新数据
                        this.Parent.QuantityUnitComponentList_BindingSource.ResetBindings(false);
                        //对象设置为创建中状态
                        this.Activitie.BeginEdit(this);
                    }
                }
            }
        }
Exemple #2
0
        public override void Rec_Delete(ActionAttribute p_attr)
        {
            _QuantityUnitComponentInfo m_info = p_attr.Source as _QuantityUnitComponentInfo;

            if (m_info != null)
            {
                this.Parent.QuantityUnitComponentList.Remove(m_info, true);
                //引发计算
                this.Parent.Parent.Subheadings_Statistics.Begin();
                //刷新数据
                this.Parent.QuantityUnitComponentList_BindingSource.ResetBindings(false);
                //对象设置为创建中状态
                this.Activitie.BeginEdit(this);
            }
        }
 public bool Create(_ObjectQuantityUnitInfo p_info)
 {
     if (p_info != null)
     {
         if (!p_info.YSBH.StartsWith("P") && !p_info.YSBH.StartsWith("J"))
         {
             _ObjectQuantityUnitInfo c_info = null;
             if (this.Activitie.Property.RepeatInfo(p_info, out c_info) && this.QuantityUnitComponentList.GetCount(p_info) == 0)
             {
                 //当前容器业务设置为添加状态
                 _QuantityUnitComponentInfo info = new _QuantityUnitComponentInfo(this);
                 info.STATUS = Status.AreAdd;
                 //状态设置为创建中
                 info.YSBH     = p_info.YSBH;
                 info.YSMC     = p_info.YSMC;
                 info.YSDW     = p_info.YSDW;
                 info.YSXHL    = 1m;
                 info.DEDJ     = p_info.DEDJ;
                 info.BH       = p_info.BH;
                 info.MC       = p_info.MC;
                 info.DW       = p_info.DW;
                 info.XHL      = 1m;
                 info.SCDJ     = p_info.SCDJ;
                 info.LB       = p_info.LB;
                 info.ZCLB     = this.YSBH.Substring(0, 1);
                 info.SDCLB    = p_info.SDCLB;
                 info.SDCXS    = p_info.SDCXS;
                 info.GGXH     = p_info.GGXH;
                 info.GCL      = this.GCL;
                 info.SSKLB    = this.SSKLB;
                 info.SSDWGCLB = this.Parent.GetSSDWGCLB();
                 info.SSDWGC   = this.Activitie.Name;
                 if (info.LB == "主材" || info.LB == "设备")
                 {
                     info.SCDJ = 0m;
                 }
                 if (c_info != null)
                 {
                     info.IFSC     = c_info.IFSC;
                     info.IFFX     = c_info.IFFX;
                     info.IFSDSCDJ = c_info.IFSDSCDJ;
                     info.IFZYCL   = c_info.IFZYCL;
                     info.YTLB     = c_info.YTLB;
                     info.JSDJ     = c_info.JSDJ;
                     info.CJ       = c_info.CJ;
                     info.PP       = c_info.PP;
                     info.ZLDJ     = c_info.ZLDJ;
                     info.GYS      = c_info.GYS;
                     info.CD       = c_info.CD;
                     info.CJBZ     = c_info.CJBZ;
                 }
                 int index = (this.m_QuantityUnitComponentList.IndexOf(this.QuantityUnitComponentList_BindingSource.Current) + 1);
                 info.STATUS = Status.Normal;
                 this.m_QuantityUnitComponentList.Add(index, info);
                 this.Parent.Subheadings_Statistics.Begin();
                 this.m_QuantityUnitComponentList_BindingSource.ResetBindings(false);
                 this.Parent.SubheadingsQuantityUnitList_BindingSource.ResetBindings(false);
                 //对象设置为创建中状态
                 this.ActionAttribute("Create", "创建子目工料机组成", info, null);
                 this.Activitie.BeginEdit(this);
                 return(true);
             }
         }
     }
     return(false);
 }
 public bool Replace(_ObjectQuantityUnitInfo p_info)
 {
     if (p_info != null)
     {
         if (this.YSBH.StartsWith("P") || this.YSBH.StartsWith("J"))
         {
             _ObjectQuantityUnitInfo m_info = this.QuantityUnitComponentList_BindingSource.Current as _ObjectQuantityUnitInfo;
             _ObjectQuantityUnitInfo c_info = null;
             if (this.Activitie.Property.RepeatInfo(p_info, out c_info) && (this.QuantityUnitComponentList.GetCount(p_info) == 0 || m_info.BH == p_info.BH))
             {
                 int indexID = this.QuantityUnitComponentList.IndexOf(m_info);
                 this.m_QuantityUnitComponentList.Remove(m_info, false);
                 _QuantityUnitComponentInfo info = new _QuantityUnitComponentInfo(this);
                 info.STATUS   = Status.AreAdd;
                 info.YSBH     = p_info.YSBH;
                 info.YSMC     = p_info.YSMC;
                 info.YSDW     = p_info.YSDW;
                 info.YSXHL    = 1m;
                 info.DEDJ     = p_info.DEDJ;
                 info.BH       = p_info.BH;
                 info.MC       = p_info.MC;
                 info.DW       = p_info.DW;
                 info.XHL      = 1m;
                 info.SCDJ     = p_info.SCDJ;
                 info.LB       = p_info.LB;
                 info.ZCLB     = this.YSBH.Substring(0, 1);
                 info.SDCLB    = p_info.SDCLB;
                 info.SDCXS    = p_info.SDCXS;
                 info.GCL      = this.GCL;
                 info.SSKLB    = this.SSKLB;
                 info.SSDWGCLB = this.Parent.GetSSDWGCLB();
                 info.SSDWGC   = this.Activitie.Name;
                 if (info.LB == "主材" || info.LB == "设备")
                 {
                     info.SCDJ = 0m;
                 }
                 if (c_info != null)
                 {
                     info.IFSC     = c_info.IFSC;
                     info.IFFX     = c_info.IFFX;
                     info.IFSDSCDJ = c_info.IFSDSCDJ;
                     info.IFZYCL   = c_info.IFZYCL;
                     info.YTLB     = c_info.YTLB;
                     info.JSDJ     = c_info.JSDJ;
                     info.CJ       = c_info.CJ;
                     info.PP       = c_info.PP;
                     info.ZLDJ     = c_info.ZLDJ;
                     info.GYS      = c_info.GYS;
                     info.CD       = c_info.CD;
                     info.CJBZ     = c_info.CJBZ;
                 }
                 this.m_QuantityUnitComponentList.Add(indexID, info);
                 this.Parent.Subheadings_Statistics.Begin();
                 this.m_QuantityUnitComponentList_BindingSource.ResetBindings(false);
                 this.Parent.SubheadingsQuantityUnitList_BindingSource.ResetBindings(false);
                 this.ActionAttribute("Replace", "替换工料机组成", info, m_info);
                 this.Activitie.BeginEdit(this);
                 return(true);
             }
         }
     }
     return(false);
 }
 /// <summary>
 /// 创建工料机组成
 /// </summary>
 /// <returns>工料机组成对象</returns>
 public void Create()
 {
     if (this.YSBH.StartsWith("P") || this.YSBH.StartsWith("J"))
     {
         _Library.GetLibrary(this.SSKLB);
         if (this.SSKLB == string.Empty)
         {
             this.SSKLB = this.Activitie.Property.Libraries.FixedLibrary.FullName;
         }
         DataRow[] drs_zc = drs_zc = (_Library.Libraries[this.SSKLB] as DataSet).Tables["配合比表"].Select(string.Format("CAIJBH ='{0}'", this.YSBH));
         this.IFKFJ = drs_zc.Count() > 0 ? true : false;
         foreach (DataRow dr in drs_zc)
         {
             DataRow[] dr_zc = (_Library.Libraries[this.SSKLB] as DataSet).Tables["材机表"].Select(string.Format("CAIJBH ='{0}'", dr["PHB_CJBH"]));
             if (dr_zc != null)
             {
                 _QuantityUnitComponentInfo info = new _QuantityUnitComponentInfo(this);
                 info.STATUS   = Status.AreAdd;
                 info.YSBH     = dr_zc[0]["CAIJBH"].ToString();
                 info.YSMC     = dr_zc[0]["CAIJMC"].ToString();
                 info.YSDW     = dr_zc[0]["CAIJDW"].ToString();
                 info.YSXHL    = ToolKit.ParseDecimal(dr["PHB_CJSL"]);
                 info.BH       = dr_zc[0]["CAIJBH"].ToString();
                 info.MC       = dr_zc[0]["CAIJMC"].ToString();
                 info.DW       = dr_zc[0]["CAIJDW"].ToString();
                 info.XHL      = ToolKit.ParseDecimal(dr["PHB_CJSL"]);
                 info.DEDJ     = dr_zc[0]["CAIJDJ"].ToString().Trim() == string.Empty ? 0m : Convert.ToDecimal(dr_zc[0]["CAIJDJ"].ToString());
                 info.LB       = dr_zc[0]["CAIJLB"].ToString();
                 info.ZCLB     = "W";
                 info.SDCLB    = dr_zc[0]["SANDCMC"].ToString();
                 info.SDCXS    = dr_zc[0]["SANDCXS"].ToString().Length == 0 ? 0m : Convert.ToDecimal(dr_zc[0]["SANDCXS"]);
                 info.GCL      = this.GCL;
                 info.SSKLB    = this.Parent.LibraryName;
                 info.SSDWGCLB = this.Parent.GetSSDWGCLB();
                 info.SSDWGC   = this.Activitie.Name;
                 _ObjectQuantityUnitInfo y_info = this.Activitie.Property.GetAllQuantityUnit.Cast <_ObjectQuantityUnitInfo>().Where(p => p.BH == info.BH).FirstOrDefault();
                 if (y_info == null)
                 {
                     info.IFSC   = dr_zc[0]["CAIJSC"].ToString() == "是" ? true : false;
                     info.IFZYCL = dr_zc[0]["CAIJXSJG"].ToString() == "是" ? true : false;
                     if (info.LB == "主材" || info.LB == "设备")
                     {
                         info.SCDJ = 0m;
                     }
                     else
                     {
                         info.SCDJ = info.DEDJ;
                     }
                 }
                 else
                 {
                     info.IFSC     = y_info.IFSC;
                     info.IFFX     = y_info.IFFX;
                     info.IFSDSCDJ = y_info.IFSDSCDJ;
                     info.IFZYCL   = y_info.IFZYCL;
                     info.YTLB     = y_info.YTLB;
                     info.SCDJ     = y_info.SCDJ;
                     info.JSDJ     = y_info.JSDJ;
                     info.CJ       = y_info.CJ;
                     info.PP       = y_info.PP;
                     info.ZLDJ     = y_info.ZLDJ;
                     info.GYS      = y_info.GYS;
                     info.CD       = y_info.CD;
                     info.CJBZ     = y_info.CJBZ;
                 }
                 info.STATUS = Status.Normal;
                 this.m_QuantityUnitComponentList.Add(info);
             }
         }
         if (this.IFKFJ)
         {
             this.CalculateParentSCDJ();
         }
     }
 }