Beispiel #1
0
        private Model.PartItem MakePrint(Model.PsSheet ps)
        {
            int num = 0;

            if (ps.PrintNum > 0)
            {
                num = ps.PsNum * ProductNum / (ps.PrintNum);
            }
            else
            {
                num = ps.PsNum * ProductNum;
            }
            int colornum = ColorNum;

            Model.PartItem pips = new Model.PartItem();
            pips.PartType = 4;
            string  psname  = "";
            int     pid     = 4;
            decimal psprice = 0;

            if (colornum == 1)
            {
                psname = "黑白印工";
                pid    = 34;
            }
            if (colornum == 2)
            {
                psname = "黑白印工";
                pid    = 34;
                num    = num * 2;
            }
            if (colornum == 4)
            {
                psname = "彩色印工";
            }
            psprice = Model.C_ProcessPrice.GetProcessPrice(pid, num);
            Model.C_ProcessPrice cp = Model.C_ProcessPrice.GetById(pid);
            pips.Price    = cp.SinglePrice1;
            pips.PartName = psname;
            pips.Name     = psname;
            pips.Id       = pid;
            pips.Num      = num;
            pips.Money    = psprice;
            pips.Remark   = ps.PrintNum.ToString() + "拼";
            return(pips);
        }
Beispiel #2
0
        private Model.PartItem MakePs(Model.PsSheet ps)
        {
            int colornum = ColorNum;

            Model.PartItem pips = new Model.PartItem();
            pips.PartType = 2;
            string  psname  = "";
            decimal psprice = 0;

            pips.Num = colornum * ps.PsNum;
            if (colornum == 1)
            {
                psname        = "黑白版纸";
                psprice       = (decimal)14.1;
                pips.PartType = 1;
            }
            if (colornum == 2)
            {
                psname        = "双套色版纸";
                psprice       = (decimal)14.1;
                pips.PartType = 1;
            }
            if (colornum == 4)
            {
                psname        = "彩色版纸";
                psprice       = (decimal)13.3;
                pips.PartType = 2;
            }
            pips.PartName = psname;
            pips.Name     = ps.PsKaidu.ToString() + "开" + psname;
            pips.Id       = colornum;
            pips.Price    = psprice;
            pips.Money    = pips.Num * pips.Price;
            pips.Remark   = ((Model.PsMode)ps.PrintNum).ToString();
            return(pips);
        }
Beispiel #3
0
        private Model.PartItem MakeOpen(Model.PsSheet ps)
        {
            int colornum = ColorNum;

            Model.PartItem pips = new Model.PartItem();
            pips.PartType = 3;
            string  psname  = "";
            int     pid     = 3;
            decimal psprice = 0;

            pips.Num = 1;
            if (colornum == 1)
            {
                psname = "黑白开机";
                pid    = 33;
            }
            if (colornum == 2)
            {
                psname   = "黑白开机";
                pips.Num = 2;
                pid      = 33;
            }
            if (colornum == 4)
            {
                psname = "彩色开机";
            }
            pips.Num      = pips.Num * ps.PsNum;
            psprice       = Model.C_ProcessPrice.GetProcessPrice(pid, 1);
            pips.PartName = psname;
            pips.Name     = psname;
            pips.Id       = pid;
            pips.Price    = psprice;
            pips.Money    = pips.Num * pips.Price;
            pips.Remark   = ps.PrintNum.ToString() + "拼";
            return(pips);
        }
Beispiel #4
0
        public bool MakePart()
        {
            #region 基础计算;
            bool result = true;


            if (!CheckPart())
            {
                ProductType = -1;
                return(false);
            }


            Model.Tree cutree = Model.Common.PaperCut;

            Paper    = cutree.GetPaper(Product.Length, Product.Width);
            Ps       = cutree.GetPs(Product.Length, Product.Width);
            CutPaper = cutree.GetCutSize(Product.Length, Product.Width);

            int NumPrePage = 1;
            int calpage    = PageNum;
            #region 计算用纸数量;

            if (PageNum % 2 == 1)
            {
                calpage = PageNum + 1;
                if (PageNum > 2)
                {
                    PageNum = calpage;
                }
            }

            NumPrePage    = calpage / 2;
            Part.PaperNum = NumPrePage * ProductNum / CutPaper.Kaidu;
            if (!PaperSource)
            {
                Model.PartItem pi = new Model.PartItem();
                pi.PartType = 0;
                pi.PartName = "纸张";
                pi.Id       = PaperName.Id;
                pi.Name     = PaperName.Name;
                pi.Price    = Model.Paper_Store.GetPaperById(PaperName.Id).UnitPrice;

                pi.Num    = Part.PaperNum;
                pi.Money  = pi.Price * pi.Num;
                pi.Remark = PaperName.Name.Substring(0, 2) + CutPaper.Kaidu.ToString() + "开";
                AllItem.Add(pi);
            }
            else
            {
                Part.PaperName = "来料加工";
                Part.PaperId   = 0;
            }

            #endregion

            if (ColorNum <= 0)
            {
                return(true);
            }
            if (Ps.Kaidu > 2 && CutPaper.Kaidu >= 12)
            {
                Ps.Kaidu = 2;
            }
            //计算2开印刷的情况;
            Model.PsSheet Sheet2      = new Model.PsSheet(Ps.Kaidu, CutPaper.Kaidu, PageNum);
            Model.PsSheet pstemp      = Sheet2;
            decimal       totalprice2 = 0;
            while (pstemp != null)
            {
                Model.PartItem pips    = MakePs(pstemp);
                Model.PartItem piprint = MakePrint(pstemp);
                Model.PartItem piopen  = MakeOpen(pstemp);
                totalprice2 += pips.Money;
                totalprice2 += piprint.Money;
                totalprice2 += piopen.Money;
                pips.Id     += 20;
                piopen.Id   += 20;
                piprint.Id  += 20;
                AllItem.Add(pips);
                AllItem.Add(piprint);
                AllItem.Add(piopen);
                pstemp = pstemp.Next;
            }
            //如果可以三开印,也计算下三开的。
            decimal totalprice3 = 0;
            bool    Needchange  = false;
            if (CutPaper.Kaidu % 3 == 0)
            {
                Model.PsSheet Sheet3 = new Model.PsSheet(3, CutPaper.Kaidu, PageNum);
                Model.PsSheet ps11   = Sheet3;
                while (ps11 != null)
                {
                    Model.PartItem pips    = MakePs(ps11);
                    Model.PartItem piprint = MakePrint(ps11);
                    Model.PartItem piopen  = MakeOpen(ps11);
                    totalprice3 += pips.Money;
                    totalprice3 += piprint.Money;
                    totalprice3 += piopen.Money;

                    pips.Id    += 30;
                    piopen.Id  += 30;
                    piprint.Id += 30;

                    AllItem.Add(pips);
                    AllItem.Add(piprint);
                    AllItem.Add(piopen);
                    ps11 = ps11.Next;
                }
                if (totalprice3 < totalprice2)
                {
                    Needchange = true;
                }
                else
                {
                    List <Model.PartItem> Newlist = new List <Model.PartItem>();
                    foreach (Model.PartItem pi in AllItem)
                    {
                        if (!(pi.Id >= 30 && pi.Id < 40))
                        {
                            if (pi.Id >= 20 && pi.Id < 30)
                            {
                                pi.Id = pi.Id - 20;
                            }
                            Newlist.Add(pi);
                        }
                    }
                    AllItem   = Newlist;
                    Sheet     = Sheet3;
                    Ps.Kaidu  = 2;
                    Ps.Length = Paper.Length / 2;
                    Ps.Width  = Paper.Width;
                }
            }
            if (Needchange)
            {
                List <Model.PartItem> Newlist = new List <Model.PartItem>();
                foreach (Model.PartItem pi in AllItem)
                {
                    if (!(pi.Id >= 20 && pi.Id < 30))
                    {
                        if (pi.Id >= 30 && pi.Id < 40)
                        {
                            pi.Id = pi.Id - 30;
                        }
                        Newlist.Add(pi);
                    }
                }
                AllItem   = Newlist;
                Sheet     = Sheet2;
                Ps.Kaidu  = 3;
                Ps.Length = Paper.Length / 3;
                Ps.Width  = Paper.Width;
            }
            CalTotalNum();
            AllExtendPaper  += AllPsSet * 50;
            Part.PaperExtend = AllExtendPaper;
            CalAllNum();
            return(result);

            #endregion
        }