Exemplo n.º 1
0
        private void ShowPreview(bool qualifiedOnly)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            string strIDs      = serializer.Serialize(inspectionNoteIDs);
            var    previewData = RestClient.Get <List <IDictionary <string, object> > >(Defines.ServerURL + "/warehouse/WMS_Template/inspection_note/preview/" + (qualifiedOnly ? "qualified/" : "") + strIDs);            if (previewData == null)
            {
                return;
            }
            StandardFormPreviewExcel formPreviewExcel = new StandardFormPreviewExcel("送检单预览" + (qualifiedOnly ? " - 仅合格条目" : ""));

            foreach (IDictionary <string, object> noteAndItem in previewData)
            {
                IDictionary <string, object> inspectionNote = (IDictionary <string, object>)noteAndItem["inspectionNote"];
                object[] inspectionNoteItems = (object[])noteAndItem["inspectionNoteItems"];
                string   no = (string)inspectionNote["no"];
                if (!formPreviewExcel.AddPatternTable("Excel/InspectionNote.xlsx", no))
                {
                    return;
                }
                formPreviewExcel.AddData("inspectionNote", inspectionNote, no);
                formPreviewExcel.AddData("inspectionNoteItems", inspectionNoteItems, no);
                formPreviewExcel.SetPrintScale(0.8f, no);
            }
            formPreviewExcel.Show();
            this.Close();
        }
        private void buttonZhongDuFlow_Click(object sender, EventArgs e)
        {
            StandardFormPreviewExcel formPreview = new StandardFormPreviewExcel("出库流水预览");

            WMSEntities wmsEntities = new WMSEntities();
            List <PutOutStorageTicketItemView> items = new List <PutOutStorageTicketItemView>();

            foreach (int id in putOutStorageTicketIDs)
            {
                PutOutStorageTicketItemView[] putOutStorageTicketItemViews =
                    (from p in wmsEntities.PutOutStorageTicketItemView
                     where p.PutOutStorageTicketID == id
                     select p).ToArray();
                items.AddRange(putOutStorageTicketItemViews);
            }
            if (formPreview.AddPatternTable(@"Excel\patternPutOutStorageTicketZhongDuFlow.xlsx") == false)
            {
                this.Close();
                return;
            }
            formPreview.AddData("putOutStorageTicketItems", items.ToArray());
            formPreview.SetPrintScale(1.2f);
            formPreview.Show();
            this.Close();
        }
        private void buttonCover_Click(object sender, EventArgs e)
        {
            StandardFormPreviewExcel formPreview = new StandardFormPreviewExcel("发货单预览");
            WMSEntities wmsEntities = new WMSEntities();

            foreach (int id in this.putOutStorageTicketIDs)
            {
                PutOutStorageTicketView       putOutStorageTicketView      = null;
                ShipmentTicketView            shipmentTicketView           = null;
                PutOutStorageTicketItemView[] putOutStorageTicketItemViews = null;
                try
                {
                    putOutStorageTicketView = (from p in wmsEntities.PutOutStorageTicketView
                                               where p.ID == id
                                               select p).FirstOrDefault();
                    putOutStorageTicketItemViews =
                        (from p in wmsEntities.PutOutStorageTicketItemView
                         where p.PutOutStorageTicketID == putOutStorageTicketView.ID
                         select p).ToArray();
                    if (putOutStorageTicketView == null)
                    {
                        MessageBox.Show("出库单" + putOutStorageTicketView.No + "不存在,可能已被删除,请重新查询!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    shipmentTicketView =
                        wmsEntities.Database.SqlQuery <ShipmentTicketView>(string.Format(@"SELECT * FROM ShipmentTicketView WHERE ID = 
                                                                    (SELECT ShipmentTicketID FROM JobTicket
                                                                    WHERE JobTicket.ID = {0})", putOutStorageTicketView.JobTicketID)).FirstOrDefault();
                }
                catch
                {
                    MessageBox.Show("加载失败,请检查网络连接!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                string worksheetName = id.ToString();
                if (formPreview.AddPatternTable(@"Excel\patternPutOutStorageTicketNormal.xlsx", worksheetName) == false)
                {
                    this.Close();
                    return;
                }
                formPreview.AddData("putOutStorageTicket", putOutStorageTicketView, worksheetName);
                formPreview.AddData("putOutStorageTicketItems", putOutStorageTicketItemViews, worksheetName);
                formPreview.AddData("shipmentTicket", shipmentTicketView, worksheetName);
                formPreview.SetPrintScale(0.9F, worksheetName);
            }
            formPreview.Show();
            this.Close();
        }
        private void buttonAll_Click(object sender, EventArgs e)
        {
            WMSEntities wmsEntities = new WMSEntities();
            StandardFormPreviewExcel standardFormPreviewExcel = new StandardFormPreviewExcel("送检单预览");

            SubmissionTicket[] submissionTicket = idsToSubmissionTickets(this.ids);
            try
            {
                foreach (SubmissionTicket st in submissionTicket)
                {
                    string worksheetName = st.ID.ToString();
                    SubmissionTicketView       submissionTicketView     = (from stv in wmsEntities.SubmissionTicketView where stv.ID == st.ID select stv).FirstOrDefault();
                    SubmissionTicketItemView[] submissionTicketItemView =
                        (from p in wmsEntities.SubmissionTicketItemView
                         where p.SubmissionTicketID == st.ID
                         select p).ToArray();
                    ReceiptTicketView receiptTicketView = (from rt in wmsEntities.ReceiptTicketView where rt.ID == st.ReceiptTicketID select rt).FirstOrDefault();
                    if (standardFormPreviewExcel.AddPatternTable(@"Excel\SubmissionTicket.xlsx", worksheetName) == false)
                    {
                        this.Close();
                        return;
                    }
                    if (st != null)
                    {
                        standardFormPreviewExcel.AddData("SubmissionTicket", submissionTicketView, worksheetName);
                    }
                    if (receiptTicketView != null)
                    {
                        standardFormPreviewExcel.AddData("ReceiptTicket", receiptTicketView, worksheetName);
                    }
                    standardFormPreviewExcel.AddData("SubmissionTicketItem", submissionTicketItemView, worksheetName);
                    standardFormPreviewExcel.SetPrintScale(0.82f, worksheetName);
                }
                standardFormPreviewExcel.Show();
                this.Close();
            }
            catch
            {
                MessageBox.Show("无法连接到数据库,请查看网络连接!", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
                return;
            }

            //StartPreview(submissionTicketItemView);
        }
Exemplo n.º 5
0
        private void buttonPreview_Click(object sender, EventArgs e)
        {
            if (this.model1.SelectionRange == null)
            {
                MessageBox.Show("请选择要预览的入库单!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            List <int> ids = new List <int>();

            for (int i = 0; i < this.model1.SelectionRange.Rows; i++)
            {
                int curRow = this.model1.SelectionRange.Row + i;
                if (this.model1[curRow, "id"] == null)
                {
                    continue;
                }
                ids.Add((int)this.model1[curRow, "id"]);
            }
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            string strIDs      = serializer.Serialize(ids);
            var    previewData = RestClient.Get <List <IDictionary <string, object> > >(Defines.ServerURL + "/warehouse/WMS_Template/warehouse_entry/preview/" + strIDs);

            if (previewData == null)
            {
                return;
            }
            StandardFormPreviewExcel formPreviewExcel = new StandardFormPreviewExcel("入库单预览");

            foreach (IDictionary <string, object> entryAndItem in previewData)
            {
                IDictionary <string, object> warehouseEntry = (IDictionary <string, object>)entryAndItem["warehouseEntry"];
                object[] warehouseEntryItems = (object[])entryAndItem["warehouseEntryItems"];
                string   no = (string)warehouseEntry["no"];
                if (!formPreviewExcel.AddPatternTable("Excel/WarehouseEntry.xlsx", no))
                {
                    return;
                }
                formPreviewExcel.AddData("warehouseEntry", warehouseEntry, no);
                formPreviewExcel.AddData("warehouseEntryItems", warehouseEntryItems, no);
            }
            formPreviewExcel.Show();
            //ushort height = 50;
            //formPreviewExcel.SetAllCowsHeigth(5,5,height);
        }
Exemplo n.º 6
0
        private void buttonPreview_Click(object sender, EventArgs e)
        {
            if (this.model1.SelectionRange == null)
            {
                MessageBox.Show("请选择要预览的盘点单!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            List <int> ids = new List <int>();

            for (int i = 0; i < this.model1.SelectionRange.Rows; i++)
            {
                int curRow = this.model1.SelectionRange.Row + i;
                if (this.model1[curRow, "id"] == null)
                {
                    continue;
                }
                ids.Add((int)this.model1[curRow, "id"]);
            }
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            string strIDs = serializer.Serialize(ids);

            var previewData = RestClient.Get <List <IDictionary <string, object> > >(Defines.ServerURL + "/warehouse/WMS_Template/transfer_order/preview/" + strIDs);

            if (previewData == null)
            {
                return;
            }
            StandardFormPreviewExcel formPreviewExcel = new StandardFormPreviewExcel("上架单预览");

            foreach (IDictionary <string, object> entryAndItem in previewData)
            {
                IDictionary <string, object> transferOrder = (IDictionary <string, object>)entryAndItem["transferOrder"];
                object[] transferOrderItems = (object[])entryAndItem["transferOrderItems"];
                string   no = (string)transferOrder["no"];
                if (!formPreviewExcel.AddPatternTable("Excel/PutAwayNote.xlsx", no))
                {
                    return;
                }
                formPreviewExcel.AddData("putAwayTicket", transferOrder, no);
                formPreviewExcel.AddData("putAwayTicketItems", transferOrderItems, no);
            }
            formPreviewExcel.Show();
        }
        private void buttonMoBiSi_Click(object sender, EventArgs e)
        {
            StandardFormPreviewExcel formPreview = new StandardFormPreviewExcel("出库单预览");
            WMSEntities wmsEntities = new WMSEntities();

            if (putOutStorageTicketIDs.Length > 1)
            {
                MessageBox.Show("摩比斯格式暂不支持批量打印", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                this.Close();
                return;
            }
            int id = putOutStorageTicketIDs[0];
            PutOutStorageTicketView putOutStorageTicketView = (from p in wmsEntities.PutOutStorageTicketView
                                                               where p.ID == id
                                                               select p).FirstOrDefault();

            PutOutStorageTicketItemView[] putOutStorageTicketItemViews =
                (from p in wmsEntities.PutOutStorageTicketItemView
                 where p.PutOutStorageTicketID == putOutStorageTicketView.ID
                 select p).ToArray();
            if (putOutStorageTicketView == null)
            {
                MessageBox.Show("出库单不存在,请重新查询!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            ShipmentTicketView shipmentTicketView =
                wmsEntities.Database.SqlQuery <ShipmentTicketView>(string.Format(@"SELECT * FROM ShipmentTicketView WHERE ID = 
                                                    (SELECT ShipmentTicketID FROM JobTicket
                                                        WHERE JobTicket.ID = {0})", putOutStorageTicketView.JobTicketID)).FirstOrDefault();

            int[] supplierIDs = (from item in putOutStorageTicketItemViews
                                 where item.SupplierID != null
                                 select item.SupplierID.Value).ToArray();
            Supplier[] suppliers = (from s in wmsEntities.Supplier
                                    where supplierIDs.Contains(s.ID)
                                    select s).ToArray();

            foreach (Supplier supplier in suppliers)
            {
                formPreview.AddPatternTable(@"Excel\patternPutOutStorageTicketMoBiSi.xlsx", supplier.Name);
                formPreview.AddData("ticket", putOutStorageTicketView, supplier.Name);
                formPreview.AddData("items", (from item in putOutStorageTicketItemViews where item.SupplierID == supplier.ID select item).ToArray(), supplier.Name);
                formPreview.AddData("shipmentTicket", shipmentTicketView, supplier.Name);
                formPreview.AddData("supplier", supplier, supplier.Name);
            }

            //没有供应商信息的单独显示一个tab(非正常情况)
            PutOutStorageTicketItemView[] noSupplierItems = (from item in putOutStorageTicketItemViews
                                                             where item.SupplierID == null
                                                             select item).ToArray();
            if (noSupplierItems.Length > 0)
            {
                formPreview.AddPatternTable(@"Excel\patternPutOutStorageTicketMoBiSi.xlsx", "无供应商");
                formPreview.AddData("ticket", putOutStorageTicketView, "无供应商");
                formPreview.AddData("items", noSupplierItems, "无供应商");
                formPreview.AddData("shipmentTicket", shipmentTicketView, "无供应商");
                formPreview.AddData("supplier", default(Supplier), "无供应商");
            }

            formPreview.Show();
            this.Close();
        }
Exemplo n.º 8
0
        private void buttonPreview_Click(object sender, EventArgs e)
        {
            var worksheet = this.reoGridControlMain.Worksheets[0];
            StandardFormPreviewExcel formPreview = new StandardFormPreviewExcel("盘点单预览");

            if (formPreview.SetPatternTable(@"Excel\StockInfoCheckTicket.xlsx") == false)
            {
                this.Close();
                return;
            }
            WMSEntities wmsEntities = new WMSEntities();

            if (worksheet.SelectionRange.Rows != 1)
            {
                MessageBox.Show("请选择一项进行预览", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            int stockInfoCheckID;

            try
            {
                stockInfoCheckID = int.Parse(worksheet[worksheet.SelectionRange.Row, 0].ToString());
            }
            catch
            {
                MessageBox.Show("请选择一项导出", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }



            StockInfoCheckTicket stockInfoCheck1 = null;

            try
            {
                wmsEntities     = new WMSEntities();
                stockInfoCheck1 = (from s in wmsEntities.StockInfoCheckTicket
                                   where s.ID == stockInfoCheckID
                                   select s).FirstOrDefault();
            }
            catch
            {
                MessageBox.Show("加载盘点单数据失败,请检查网络连接", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                this.Close();
                return;
            }
            if (stockInfoCheck1 == null)
            {
                MessageBox.Show("要查看的项目已不存在,请确认后操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
                return;
            }

            StockInfoCheckTicketView StockInfoCheckTicketView = (from stv in wmsEntities.StockInfoCheckTicketView
                                                                 where stv.ID == stockInfoCheckID
                                                                 select stv).FirstOrDefault();

            StockInfoCheckTicketItemView [] StockInfoCheckTicketItemView =
                (from p in wmsEntities.StockInfoCheckTicketItemView
                 where p.StockInfoCheckTicketID == StockInfoCheckTicketView.ID
                 select p).ToArray();
            if (StockInfoCheckTicketView == null)
            {
                MessageBox.Show("盘点单不存在,请重新查询!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (StockInfoCheckTicketView != null)
            {
                formPreview.AddData("StockInfoCheckTicket", StockInfoCheckTicketView);
            }
            formPreview.AddData("StockInfoCheckTicketItem", StockInfoCheckTicketItemView);


            formPreview.Show();
        }