public FoldSheet(int OldSizeId) { OldSize = new rectang(); NewSize = new rectang(); OldSize.Id = OldSizeId; Init(); }
/// <summary> /// 如果原始尺寸不是非标尺寸,得到一个开数; /// </summary> /// <param name="oldsize"></param> /// <param name="newsize"></param> /// <returns></returns> private int GetKaidu(int l, int h, rectang newsize) { int kaidu = 0; int chuxue = ConstantValue.Paper.ChuXue; int yaokou = ConstantValue.Paper.Yaokou; h += chuxue; l += chuxue; int maxh = newsize.Height - yaokou; int maxl = newsize.Length - yaokou; int rl = check(maxh / h); int ud = check(maxl / l); int rl1 = check(maxl / h); int ud1 = check(maxh / l); if (rl * ud > rl1 * ud1) { kaidu = rl * ud; } else { RatioTag = 1; kaidu = rl1 * ud1; } return(kaidu); }
/// <summary> /// /// </summary> /// <param name="psize">size.id 尺寸ID,size.Length长, size.Height高, size.MId纸的ID,size.Num页码数, /// psize.Status纸张来源,psize.b1 内容是否重复</param> /// <param name="ProNum">产品数量</param> /// <param name="color">颜色数</param> public papersheet(Model.recttange psize, int ProNum, int color) { rectang size = new rectang(); size = Common.GetRectByModle(psize); ProductSize = new rectang(); if (size.Id > 0) { ProductSize.Id = size.Id; Model.ProductSize p = DAL.ProductSize.GetModel(size.Id); ProductSize.Length = p.StandLength; ProductSize.Height = p.StandHeight; ProductSize.Kaidu = p.Kaidu; ProductSize.Name = p.NickName; } else { ProductSize.Length = psize.length; ProductSize.Height = psize.height; FoldSheet fd = new FoldSheet(ProductSize.Length, ProductSize.Height); if (fd.OldSize != null) { ProductSize.Kaidu = fd.OldSize.Kaidu; ProductSize.Name = fd.OldSize.Name; } } ProductNum = ProNum; Cover = new ProductUnit(size.Id, size.Length, size.Height, size.MId, color, size.Num, psize.Status, psize.b1, ProNum); Cover.GroupId = 0; Cover.UnitName = ProductName; //UserRequest = "test!"; }
public static Model.recttange GetPaperRect(Model.recttange size) { rectang old = GetRectByModle(size); rectang newsize = new rectang(); Model.recttange result = new Model.recttange(); FoldSheet fd; if (old.Id > 0) { fd = new FoldSheet(old.Id); } else { fd = new FoldSheet(old.Length, old.Height); } if (fd != null) { result.Id = fd.NewSize.Id; result.length = fd.NewSize.Length; result.height = fd.NewSize.Height; result.Name = fd.NewSize.Name; result.QuNum = fd.NewSize.Kaidu; return(result); } return(null); }
public static int CalWeight(rectang size, int kg, int Page, int productNum) { int result = 0; double r = (double)size.Length * size.Height * kg * Page * productNum / (double)(2 * 1000 * 1000 * 1000); result = Convert.ToInt32(r); return(result); }
public FoldSheet(int l, int h) { OldSize = new rectang(); NewSize = new rectang(); OldSize.Length = l; OldSize.Height = h; //AdjustOldSize(l, h); Init(); }
/// <summary> /// 把MODEL下的矩形转化自己的类 /// </summary> /// <param name="rect"></param> /// <returns></returns> public Model.recttange GetModleByRect(rectang rect) { Model.recttange r = new Model.recttange(); r.Id = rect.Id; r.height = rect.Height; r.length = rect.Length; r.MId = rect.MId; r.Name = rect.Name; r.QuNum = rect.Num; return(r); }
public FoldSheet(rectang oldsize) { OldSize = new rectang(); NewSize = new rectang(); OldSize = oldsize; if (oldsize.Id < 1) { //AdjustOldSize(oldsize.Length,oldsize.Height); } Init(); }
/// <summary> /// 把MODEL.RECTTANGE 转换成RECTANG; /// </summary> /// <param name="r"></param> /// <returns></returns> public static rectang GetRectByModle(Model.recttange r) { rectang rect = new rectang(); rect.Id = r.Id; rect.Height = r.height; rect.Length = r.length; rect.MId = r.MId; rect.Name = r.Name; rect.Num = r.QuNum; return(rect); }
/// <summary> /// 初始化一个标准产品 /// </summary> /// <param name="size">SIZE.NUM=PAGENUM Size.Mid=PaperId</param> /// <param name="color">颜色</param> /// <param name="ProNum">数量</param> public ProductUnit(rectang size, int color, int ProNum) { PageNum = size.Num; Size = new rectang(); Size = size; Color = color; PaperSource = 0; paperid = size.MId; ContentRepeat = 0; NeedNum = ProNum; ExtendRatio = 1; ReCaculation(); }
private void GetSize() { FoldSheet fd; if (Size.Id > 0) { fd = new FoldSheet(Size.Id); } else { fd = new FoldSheet(Size.Length, Size.Height); } Size = fd.OldSize; PrintPaper = new rectang(); PrintPaper = fd.NewSize; ProductKaidu = Size.Kaidu; PsKaidu = PrintPaper.Kaidu; }
/// <summary> /// c插入一个非标准的产品内页,可修改相应参数; /// </summary> /// <param name="paperid">纸张ID</param> /// <param name="page">页码数</param> /// <param name="color">颜色</param> /// <param name="papersource">纸张来源</param> /// <param name="contextrepeat">有无内容</param> public void InsertInner(int paperid, int page, int color, int papersource, int contextrepeat) { if (page > 0) { if (page % 2 > 0) { page = (page / 2 + 1) * 2; } rectang size = new rectang(); size.Id = ProductSize.Id; size.Name = ProductSize.Name; size.Length = ProductSize.Length; size.Height = ProductSize.Height; size.MId = paperid; size.Num = page; ProductUnit p1 = new ProductUnit(size.Id, size.Length, size.Height, paperid, color, page, papersource, contextrepeat, ProductNum); InserInner(p1); } }
public static rectang GetPaperRect(rectang old) { rectang newsize = new rectang(); FoldSheet fd; if (old.Id > 0) { fd = new FoldSheet(old.Id); } else { fd = new FoldSheet(old.Length, old.Height); } if (fd != null) { return(fd.NewSize); } return(null); }
/// <summary> /// 输入所有参数初始化一个产品基类;封面尺寸为不规范是,输入页码2,尺寸为展开尺寸, /// 标准的封面页码为4,尺寸为折叠尺寸 /// </summary> /// <param name="sizeid">尺寸ID</param> /// <param name="Length">尺寸长</param> /// <param name="Height">尺寸高</param> /// <param name="paperId">纸张的类型</param> /// <param name="color">印刷颜色</param> /// <param name="type">产品类型,1为单页,2为折页</param> /// <param name="pageNum">折页的页码数必须大于2,,否则为单页</param> /// <param name="paperSource">纸张来源0 为我厂,1为客户自带</param> /// <param name="contentRepeat">印刷内容是否重复,0为正常,不重复,1为重复,2为无内容</param> /// <param name="pronum">产品数量</param> public ProductUnit(int sizeid, int Length, int Height, int paperId, int color, int pageNum, int paperSource, int contentRepeat, int pronum) { PageNum = pageNum; Size = new rectang(); if (sizeid > 0) { Size.Id = sizeid; } else { Size.Length = Length; Size.Height = Height; } Color = color; PaperSource = paperSource; ContentRepeat = contentRepeat; NeedNum = pronum; paperid = paperId; ExtendRatio = 0; ReCaculation(); }
/// <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); } }
/// <summary> /// 用于销售某个产品,如纸杯 /// </summary> /// <param name="id">PaperStandId </param> /// <param name="num">数量</param> public papersheet(int id, int num) { ProductSize = new rectang(); ProductSize.Length = 210; ProductSize.Height = 285; ProductSize.Kaidu = 16; ProductSize.Name = ""; //UserRequest = "test!"; Cover = new ProductUnit(12, 210, 285, 5, 0, 2, 1, 2, num); Cover.GroupId = 0; Cover.UnitName = "纸杯"; ProductNum = num; Model.material m = new Model.material(); m.Mid = id; m.Num = num; m.Price = DAL.C_StandPrice.GetPrice(id, num); }
private void SetSize(BLL.rectang NewSize) { PrintPaper = NewSize; ProductKaidu = Size.Kaidu; PsKaidu = PrintPaper.Kaidu; }