/// <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!"; }
/// <summary> /// 检查每一个构件的辅助工艺、隐含工艺 /// </summary> /// <param name="p1"></param> public void CheckUnit(ProductUnit p1) { int PagePrePs = p1.PsKaidu / p1.Size.Kaidu; int FoldTimes = 1; //成品尺寸小于32开,超过折页次数,需要增加裁切工艺; if (PagePrePs > 8) { InsertSingleProcess(46, p1.weight); FoldTimes = 2; PagePrePs = PagePrePs / 2; } if (PagePrePs % 4 == 0) { //十字折2次 FoldTimes = FoldTimes * PagePrePs / 4; if (FoldTimes > 0) { InsertSingleProcess(8, ProductNum * FoldTimes, p1.GroupId); } } else { InsertSingleProcess(7, PagePrePs * ProductNum, p1.GroupId); } }
/// <summary> /// 计算一个构件所有用纸的重量; /// </summary> /// <param name="pu"></param> /// <returns></returns> public int GetPaperWeigh(ProductUnit pu) { int weight = 0; if (pu.PageNum > 0) { decimal pw = (decimal)pu.weight / pu.PaperUserRatio; pw = pw / pu.PaperNum * (pu.PaperNum + pu.ExtendNum); weight = Convert.ToInt32(pw); } return(weight); }
/// <summary> /// 计算一个产品的材料清单。纸和版的数量。 /// </summary> /// <returns></returns> public void CaculationUnitMaterial(ProductUnit cover) { if (cover != null) { if (AllMaterial == null) { AllMaterial = new List <Model.P_MaterialList>(); } if (cover.PaperSource == 0) { Model.P_MaterialList m1 = new Model.P_MaterialList(); m1.StandId = cover.UserPaper.Id; m1.StandName = cover.UserPaper.PaperName; m1.MType = 1; m1.UnitPrice = cover.UserPaper.PaperPrice; m1.GroupId = cover.GroupId; m1.ExtendNum = cover.ExtendNum; m1.ExtendRatio = cover.ExtendRatio; m1.Num = cover.PaperNum; m1.Price = Convert.ToInt32((m1.Num + m1.ExtendNum) * m1.UnitPrice); m1.ListCode = cover.UnitName; AllMaterial.Add(m1); } if (cover.PrintPs != null) { Model.P_MaterialList m2 = new Model.P_MaterialList(); if (cover.Color > 2) { m2.StandId = ConstantValue.Process.ColorPsid; } else { m2.StandId = ConstantValue.Process.BlackPsid; } m2.MType = 2; int tie = cover.PrintPs.AllPsNum * 2 + cover.PrintPs.HalfPsNum + cover.PrintPs.QuarPsNum; m2.Num = tie * cover.PrintPs.Color; m2.StandName = cover.PrintPs.PsName; m2.UnitPrice = cover.PrintPs.UnitPrice; m2.GroupId = cover.GroupId; m2.Price = Convert.ToInt32(m2.Num * m2.UnitPrice); m2.ListCode = cover.UnitName; AllMaterial.Add(m2); } } }
/// <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); } }
private Model.P_ProcessList CheckProcess(Model.P_ProcessList w) { //检查某种工艺需要关联工艺; //折页超过克重后,压痕; ProductUnit p1 = null; Model.P_ProcessList result = null; if (w.ProcessName.IndexOf("折页") >= 0) { int gp = w.GroupId; if (gp > 0) { if (Inner != null) { if (Inner.Count <= gp) { p1 = Inner[gp - 1]; } } } else { p1 = Cover; } if (p1 != null) { if (p1.UserPaper.kg > 157) { int id = 41; result = new Model.P_ProcessList(); Model.Process p2 = DAL.Process.GetModel(id); result.ProcessId = p2.ProcessId; result.ProcessName = p2.ProcessName; result.Num = w.Num; result.Price = DAL.C_ProcessPrice.GetPrice(result.ProcessId, w.Num); result.ListCode = w.ListCode; result.GroupId = w.GroupId; } } } return(result); }
/// <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); }
/// <summary> /// 把一个初始化好的产品插入到队列INNER中; /// </summary> /// <param name="p"></param> private void InserInner(ProductUnit p1) { AllThick += p1.thick; //如果内页总厚度超过规定厚度,需要重新计算封面的尺寸; if (AllThick > ConstantValue.Process.ThickLast) { ReSetCover(Convert.ToInt32(p1.thick)); } if (IsHeban(Cover, p1)) { Cover.PageNum += p1.Size.Num; Cover.ReCaculation(); } else { if (Inner == null) { Inner = new List <ProductUnit>(); } p1.GroupId = Inner.Count + 1; p1.UnitName = "画册内页" + Inner.Count.ToString(); Inner.Add(p1); } }
private bool IsHeban(ProductUnit p1, ProductUnit p2) { return((p1.UserPaper.Id == p2.UserPaper.Id) && (p1.Color == p2.Color) && (p1.Size.Length == p2.Size.Length) && (p1.PaperSource == p2.PaperSource)); }
public List <Model.P_PrintList> GetPrintUnitByProduct(ProductUnit pu) { List <Model.P_PrintList> result = new List <Model.P_PrintList>(); Model.P_PrintList All; Model.P_PrintList Half; Model.P_PrintList Qur; PrintSheet ps = pu.PrintPs; int tie = ps.AllPsNum * 2 + ps.HalfPsNum + ps.QuarPsNum; if (ps.AllPsNum > 0) { All = new Model.P_PrintList(); All.PsMode = (int)ConstantValue.Process.PsMode.大翻; All.PsModeName = ConstantValue.Process.PsMode.大翻.ToString(); All.PrintHeight = pu.PrintPaper.Height; All.PsNum = ps.AllPsNum * 2; All.PrintLength = pu.PrintPaper.Length; All.PaperId = pu.PrintPaper.Id; All.PaperName = pu.UserPaper.PaperName; All.PrintPaperNum = ps.AllPrintNum; All.ProductHeight = pu.Size.Height; All.ProductLength = pu.Size.Length; All.BigPaperNum = ps.AllPrintNum / ps.PsKaidu; All.Color = pu.Color; All.PaperSource = pu.PaperSource; All.ExtendNum = pu.ExtendNum * ps.AllPsNum * 2 / tie; if (pu.Size.Num > 1) { All.DoubleSide = 2; } else { All.DoubleSide = 1; } All.GroupId = pu.GroupId; if (All.GroupId == 0) { All.UnitName = ProductName; } else { All.UnitName = ProductName + "第" + All.GroupId.ToString() + "个内页"; } result.Add(All); } if (ps.HalfPsNum > 0) { Half = new Model.P_PrintList(); Half.PsMode = (int)ConstantValue.Process.PsMode.正反自翻; Half.PsModeName = ConstantValue.Process.PsMode.正反自翻.ToString(); Half.PrintHeight = pu.PrintPaper.Height; Half.PrintLength = pu.PrintPaper.Length; Half.PaperId = pu.PrintPaper.Id; Half.PaperName = pu.UserPaper.PaperName; Half.PrintPaperNum = ps.HalfPrintNum * pu.PsKaidu; Half.BigPaperNum = ps.HalfPrintNum; Half.Color = pu.Color; Half.PsNum = 1; Half.ProductHeight = pu.Size.Height; Half.ProductLength = pu.Size.Length; Half.PaperSource = pu.PaperSource; Half.ExtendNum = pu.ExtendNum * ps.HalfPsNum / tie; if (pu.Size.Num > 1) { Half.DoubleSide = 2; } else { Half.DoubleSide = 1; } Half.GroupId = pu.GroupId; if (Half.GroupId == 0) { Half.UnitName = ProductName; } else { Half.UnitName = ProductName + "第" + Half.GroupId.ToString() + "个内页"; } result.Add(Half); } if (ps.QuarPsNum > 0) { Qur = new Model.P_PrintList(); Qur.PsMode = (int)ConstantValue.Process.PsMode.双拼自翻; Qur.PsModeName = ConstantValue.Process.PsMode.双拼自翻.ToString(); Qur.PrintHeight = pu.PrintPaper.Height; Qur.PrintLength = pu.PrintPaper.Length; Qur.PaperId = pu.UserPaper.Id; Qur.PaperName = pu.UserPaper.PaperName; Qur.PrintPaperNum = ps.QuarPrintNum * pu.PsKaidu; Qur.BigPaperNum = ps.QuarPrintNum; Qur.Color = pu.Color; Qur.ProductHeight = pu.Size.Height; Qur.ProductLength = pu.Size.Length; Qur.PaperSource = pu.PaperSource; Qur.PsNum = 1; Qur.ExtendNum = pu.ExtendNum * ps.QuarPsNum / tie; if (pu.Size.Num > 1) { Qur.DoubleSide = 2; } else { Qur.DoubleSide = 1; } Qur.GroupId = pu.GroupId; if (Qur.GroupId == 0) { Qur.UnitName = ProductName; } else { Qur.UnitName = ProductName + "第" + Qur.GroupId.ToString() + "个内页"; } result.Add(Qur); } return(result); }
/// <summary> /// 计算一个部件的印刷费用,含开机费和印工费; /// </summary> /// <param name="color"></param> /// <returns></returns> public void CaculationPrintProcess(ProductUnit pu) { if (Process == null) { Process = new List <Model.P_ProcessList>(); } int PrintId, PrintPsId; if (pu.PrintPs == null) { pu.ReCaculation(); } if (pu.PrintPs.Color > 2) { PrintId = ConstantValue.Process.ColorPrint; PrintPsId = ConstantValue.Process.MakeColorPs; } else { PrintId = ConstantValue.Process.BlackPrint; PrintPsId = ConstantValue.Process.MakeBlackPs; } Model.P_ProcessList w1 = new Model.P_ProcessList(); Model.P_ProcessList w2 = new Model.P_ProcessList(); int printnum = pu.PrintPs.AllPrintNum + pu.PrintPs.HalfPrintNum + pu.PrintPs.QuarPrintNum; int tie = pu.PrintPs.AllPsNum * 2 + pu.PrintPs.HalfPsNum + pu.PrintPs.QuarPsNum; int makenum = tie; //插入并计算印工费 if (pu.Color > 0) { w1.ProcessId = PrintId; w1.Num = printnum; if (pu.Size.Num > 1) { w1.Num = w1.Num * 2; } w1.ProcessName = "印工费"; if (w1.Num > 1) { w1.Price = DAL.C_ProcessPrice.GetPrice(w1.ProcessId, w1.Num); } else { w1.Price = 0; } w1.GroupId = pu.GroupId; w1.PType = 1; w1.ListCode = pu.UnitName; //增加印刷的损耗; pu.ExtendRatio = ConstantValue.Process.ExtendRatio; pu.ExtendNum += tie * ConstantValue.Process.ExtendBase / pu.PrintPaper.Kaidu; //插入并计算开机费 if (pu.ContentRepeat < 2) { w2.ProcessId = PrintPsId; w2.ProcessName = "开机费"; w2.Num = tie; w2.GroupId = pu.GroupId; w2.PType = 1; w2.Price = DAL.C_ProcessPrice.GetPrice(w2.ProcessId, w2.Num); w2.ListCode = pu.UnitName; Process.Add(w2); } Process.Add(w1); } }
public void Init(ProductUnit pu) { CaculationPrintProcess(pu); CaculationUnitMaterial(pu); }