Example #1
0
        /// <summary>
        /// 从SIZE表中得到2,开,3开纸的原始尺寸,并计算纸张利用率最高的开法;
        /// </summary>
        /// <returns></returns>
        public rectang GetNewSize(int l, int h)
        {
            rectang   max = new rectang();
            bool      sucess = false;
            float     r0 = 0, rmax = 0;
            DataTable dt = JxPrint.DAL.Size.GetList("Status='2' ").Tables[0];

            foreach (DataRow dr in dt.Rows)
            {
                rectang    t = new rectang();
                Model.Size s = DAL.Size.DataRowToModel(dr);
                t.Id     = s.Id;
                t.Kaidu  = s.KaiShu;
                t.Length = s.Length;
                t.Height = s.Height;
                t.Name   = s.SizeName;

                r0 = GetRatio(l, h, t.Length, t.Height);
                int kaidu = GetKaidu(l, h, t);
                r0 = r0 * kaidu;
                if (r0 > rmax)
                {
                    rmax          = r0;
                    max           = t;
                    OldSize.Kaidu = max.Kaidu * kaidu;
                    string kd = max.Name.Remove(2);
                    OldSize.Name = kd + OldSize.Kaidu.ToString() + "开";
                    sucess       = true;
                }
            }
            if (sucess)
            {
                return(max);
            }
            else
            {
                return(null);
            }
        }
Example #2
0
        private bool GetPsSheet(int l, int h)
        {
            bool sucess = false;

            Model.P_Sheet ps = DAL.P_Sheet.GetModelByLH(l, h);
            if (ps != null)
            {
                sucess = true;
                Model.Size st = DAL.Size.GetModel(ps.SizeId);//得到目标尺寸的数据,存入目标尺寸表
                if (st != null)
                {
                    NewSize.Id     = st.Id;
                    NewSize.Height = st.Height;
                    NewSize.Length = st.Length;
                    NewSize.Kaidu  = st.KaiShu;
                    NewSize.Name   = st.SizeName;
                    OldSize.Kaidu  = ps.ProductKaidu;
                    if (NewSize.Name.IndexOf("大") > 0)
                    {
                        OldSize.Name = "大度" + ps.ProductKaidu.ToString();
                    }
                    else
                    {
                        OldSize.Name = "正度" + ps.ProductKaidu.ToString();
                    }
                }
                else
                {
                    NewSize.Height = ps.MaxHeight;
                    NewSize.Length = ps.MaxLength;
                    NewSize.Kaidu  = ps.PaperKaiShu;
                    NewSize.Name   = "自适应" + ps.PaperKaiShu.ToString();
                    OldSize.Kaidu  = ps.ProductKaidu;
                    OldSize.Name   = "自适应" + ps.ProductKaidu.ToString();
                }
            }
            return(sucess);
        }
Example #3
0
        /// <summary>
        /// 根据OldSize的尺寸ID,去得到一个标准的开纸方法;
        /// </summary>
        /// <returns></returns>
        private bool GetPsSheet()
        {
            bool sucess = false;

            if (OldSize.Id > 0)
            {
                Model.P_Sheet ps = DAL.P_Sheet.GetModelBySize(OldSize.Id);
                if (ps != null)
                {
                    Model.Size st = DAL.Size.GetModel(ps.SizeId);//得到目标尺寸的数据,存入目标尺寸表
                    if (st != null)
                    {
                        NewSize.Id     = st.Id;
                        NewSize.Height = st.Height;
                        NewSize.Length = st.Length;
                        NewSize.Kaidu  = st.KaiShu;
                        NewSize.Name   = st.SizeName;
                        sucess         = true;
                        TransTag       = 0;
                    }
                }
            }
            return(sucess);
        }