예제 #1
0
        protected override void GetReceiptNotes(Resolver resolver)
        {
            DetachedCriteria criteria = DetachedCriteria.For(typeof(PickList));

            criteria.Add(Expression.Eq("IsPrinted", false));
            OrderHelper.SetOpenOrderStatusCriteria(criteria, "Status");                            //订单状态
            SecurityHelper.SetRegionSearchCriteria(criteria, "PartyFrom.Code", resolver.UserCode); //区域权限

            IList <PickList> pickList = criteriaMgr.FindAll <PickList>(criteria, 0, 5);

            List <ReceiptNote> receiptNotes = new List <ReceiptNote>();

            if (pickList != null && pickList.Count > 0)
            {
                foreach (PickList pl in pickList)
                {
                    string newUrl = reportMgr.WriteToFile("PickList.xls", pl.PickListNo);
                    pl.IsPrinted = true;//to be refactored
                    pickListMgr.UpdatePickList(pl);
                    ReceiptNote receiptNote = PickList2ReceiptNote(pl);
                    receiptNote.PrintUrl = newUrl;
                    receiptNotes.Add(receiptNote);
                }
            }
            resolver.ReceiptNotes = receiptNotes;
        }
예제 #2
0
        private void PrintPickList(Resolver resolver, string[] region)
        {
            DetachedCriteria criteria = DetachedCriteria.For(typeof(PickList));

            criteria.Add(Expression.Eq("IsPrinted", false));
            criteria.Add(Expression.Eq("Status", BusinessConstants.CODE_MASTER_STATUS_VALUE_SUBMIT));
            criteria.Add(Expression.In("PartyFrom.Code", region));

            IList <PickList> pickList = criteriaMgr.FindAll <PickList>(criteria);

            List <ReceiptNote> receiptNotes = new List <ReceiptNote>();

            if (pickList != null && pickList.Count > 0)
            {
                foreach (PickList pl in pickList)
                {
                    string newUrl = reportMgr.WriteToFile("PickList.xls", pl.PickListNo);
                    pl.IsPrinted = true;//to be refactored
                    pickListMgr.UpdatePickList(pl);
                    ReceiptNote receiptNote = PickList2ReceiptNote(pl);
                    receiptNote.PrintUrl = newUrl;
                    receiptNotes.Add(receiptNote);
                }
            }

            if (resolver.ReceiptNotes == null)
            {
                resolver.ReceiptNotes = receiptNotes;
            }
            else
            {
                IListHelper.AddRange <ReceiptNote>(resolver.ReceiptNotes, receiptNotes);
            }
        }
예제 #3
0
        protected override bool FillValuesImpl(String templateFileName, IList <object> list)
        {
            try
            {
                PickList pickList = (PickList)list[0];
                IList <PickListDetail> pickListDetails = pickList.PickListDetails;

                if (pickList == null ||
                    pickListDetails == null || pickListDetails.Count == 0)
                {
                    return(false);
                }
                if (pickList.PartyFrom.Code == "YFK-RW" || pickList.PartyFrom.Code == "YFK-RM-HD")
                // if (!pickList.PartyFrom.Code.Contains("YFK-BJ") && (pickList.PartyFrom.Code.Contains("-RM") || pickList.PartyFrom.Code.Contains("RM-")))
                {
                    pickListDetails = pickListDetails.OrderBy(pd => pd.PrintLocationCode).ToList();
                }
                this.barCodeFontName = this.GetBarcodeFontName(0, 7);
                //this.SetRowCellBarCode(0, 0, 7);
                this.CopyPage(pickListDetails.Count);

                this.FillHead(pickList);


                int pageIndex = 1;
                int rowIndex  = 0;
                int rowTotal  = 0;
                int no        = 1;
                foreach (PickListDetail pickListDetail in pickListDetails)
                {
                    // No.
                    this.SetRowCell(pageIndex, rowIndex, 0, "" + (no++));

                    //零件号 Item Code
                    this.SetRowCell(pageIndex, rowIndex, 1, pickListDetail.Item.Code);

                    //描述Description
                    this.SetRowCell(pageIndex, rowIndex, 2, pickListDetail.Item.Description);

                    //单包装UC
                    this.SetRowCell(pageIndex, rowIndex, 3, pickListDetail.UnitCount.ToString("0.########"));

                    //需求 Request	包装
                    int UCs = (int)Math.Ceiling(pickListDetail.Qty / pickListDetail.UnitCount);
                    this.SetRowCell(pageIndex, rowIndex, 4, UCs.ToString());

                    //需求 Request	零件数
                    this.SetRowCell(pageIndex, rowIndex, 5, pickListDetail.Qty.ToString("0.########"));

                    //库位(loc)
                    this.SetRowCell(pageIndex, rowIndex, 6, pickListDetail.PrintLocationCode);
                    //批号(LOT)
                    this.SetRowCell(pageIndex, rowIndex, 7, pickListDetail.LotNo != null ? pickListDetail.LotNo : String.Empty);

                    //实收 Received	包装
                    this.SetRowCell(pageIndex, rowIndex, 8, String.Empty);

                    //实收 Received	零件数
                    this.SetRowCell(pageIndex, rowIndex, 9, String.Empty);

                    //备注
                    this.SetRowCell(pageIndex, rowIndex, 10, pickListDetail.Memo);


                    if (this.isPageBottom(rowIndex, rowTotal))//页的最后一行
                    {
                        pageIndex++;
                        rowIndex = 0;
                    }
                    else
                    {
                        rowIndex++;
                    }
                    rowTotal++;
                }

                this.sheet.DisplayGridlines = false;
                this.sheet.IsPrintGridlines = false;

                if (pickList.IsPrinted == null || pickList.IsPrinted == false)
                {
                    pickList.IsPrinted = true;
                    pickListMgr.UpdatePickList(pickList);
                }
            }
            catch (Exception)
            {
                return(false);
            }
            return(true);
        }
예제 #4
0
        protected override bool FillValuesImpl(String templateFileName, IList <object> list)
        {
            try
            {
                PickList pickList = (PickList)list[0];
                IList <PickListDetail> pickListDetails = pickList.PickListDetails;

                if (pickList == null ||
                    pickListDetails == null || pickListDetails.Count == 0)
                {
                    return(false);
                }


                this.SetRowCellBarCode(0, 2, 7);
                this.CopyPage(pickListDetails.Count);

                this.FillHead(pickList);


                int pageIndex = 1;
                int rowIndex  = 0;
                int rowTotal  = 0;
                foreach (PickListDetail pickListDetail in pickListDetails)
                {
                    //"订单号Order No."
                    this.SetRowCell(pageIndex, rowIndex, 0, pickListDetail.OrderLocationTransaction.OrderDetail.OrderHead.OrderNo);
                    //物料号
                    this.SetRowCell(pageIndex, rowIndex, 1, pickListDetail.Item.Code);
                    //物料描述
                    this.SetRowCell(pageIndex, rowIndex, 2, pickListDetail.Item.Description);
                    //"单位Unit"
                    this.SetRowCell(pageIndex, rowIndex, 3, pickListDetail.Uom.Code);
                    //"单包装UC"
                    this.SetRowCell(pageIndex, rowIndex, 4, pickListDetail.UnitCount.ToString("0.########"));
                    //库位
                    this.SetRowCell(pageIndex, rowIndex, 5, pickListDetail.Location.Code);
                    //库区
                    this.SetRowCell(pageIndex, rowIndex, 6, pickListDetail.StorageArea == null ? string.Empty : pickListDetail.StorageArea.Code);
                    //库格
                    this.SetRowCell(pageIndex, rowIndex, 7, pickListDetail.StorageBin == null ? string.Empty : pickListDetail.StorageBin.Code);
                    //批号
                    this.SetRowCell(pageIndex, rowIndex, 8, pickListDetail.LotNo);
                    //订单数
                    this.SetRowCell(pageIndex, rowIndex, 9, pickListDetail.Qty.ToString("0.########"));


                    if (this.isPageBottom(rowIndex, rowTotal))//页的最后一行
                    {
                        pageIndex++;
                        rowIndex = 0;
                    }
                    else
                    {
                        rowIndex++;
                    }
                    rowTotal++;
                }

                this.sheet.DisplayGridlines = false;
                this.sheet.IsPrintGridlines = false;

                if (pickList.IsPrinted == null || pickList.IsPrinted == false)
                {
                    pickList.IsPrinted = true;
                    pickListMgr.UpdatePickList(pickList);
                }
            }
            catch (Exception)
            {
                return(false);
            }
            return(true);
        }