bklLiudl
2024-07-23 277bbae216debe7e6c04e8cc6ee6e1ba9763e14b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
using System.Collections.Generic;
using System.Linq;
using Json;
using Lib;
using System.Web.Mvc;
using Model;
using BLL;
using Common;
using System.Data;
using FastReport.Web;
 
namespace WMS.Areas.Business.Controllers
{
    public class PurchaseController : MasterPage
    {
        // GET: Business/Purchase
        public ActionResult GetList()
        {
            ViewBag.AuditList = LocalHelper.GetAuditList("");
            return View();
        }
        public ActionResult Add()
        {
            string PurchaseNo = Request.QueryString.Get("PurchaseNo");
            Session["TEMPDATA_CACHE_PURCHASE"] = null;
            if (string.IsNullOrEmpty(PurchaseNo))
            {
                ViewBag.Admin = new Purchase();
               
            }
            else
            {
                IDALPurchase provider = new DALPurchase();
                IList<PurchaseMat> erpMats = new List<PurchaseMat>();
                Purchase entity = provider.GetModel(PurchaseNo, ref erpMats);
                Session["TEMPDATA_CACHE_PURCHASE"] = erpMats;
                entity = entity == null ? new Purchase() : entity;
                //ViewBag.OrdTypeList = LocalHelper.GetOrdTypeList(entity.OrdType);
                ViewBag.Admin = entity;
 
            }
 
            return View();
        }
        public ActionResult AddProduct()
        {
            string MatNo = Request.QueryString.Get("MatNo");
            if (MatNo.IsEmpty())
            {
                ViewBag.Admin = new PurchaseMat();
            }
            else
            {
                List<PurchaseMat> list = Session["TEMPDATA_CACHE_PURCHASE"] as List<PurchaseMat>;
                List<PurchaseMat> list1 = list.Where(a => a.MatNo == MatNo).ToList<PurchaseMat>();
                ViewBag.UnitList = LocalHelper.GetUnitList("");
                ViewBag.Admin = list1[0];
            }
            return View();
        }
        public ActionResult Detail(string PurchaseNo)
        {
            if (!string.IsNullOrEmpty(PurchaseNo))
            {
                IDALPurchase provider = new DALPurchase();
                Purchase entity = provider.GetModel(PurchaseNo);
                entity = entity == null ? new Purchase() : entity;
                ViewBag.Admin = entity;
            }
            return View();
        }
        public ActionResult Dialog(string PurchaseNo)
        {
            return View();
        }
        public ActionResult ReportShow()
        {
            string ReportNo = Request["ReportNo"];
            string OrdNo = Request["OrdNo"];
 
 
 
            WebReport webReport = new WebReport();
            webReport.Width = System.Web.UI.WebControls.Unit.Percentage(100);
            webReport.Height = 600;
            webReport.ToolbarIconsStyle = ToolbarIconsStyle.Black;
            webReport.ToolbarIconsStyle = ToolbarIconsStyle.Black;
            webReport.PrintInBrowser = true;
            webReport.PrintInPdf = true;
            webReport.ShowExports = true;
            webReport.ShowPrint = true;
            webReport.SinglePage = true;
 
            DataSet ds = null;
 
            if (ReportNo.IndexOf("采购单") >= 0)
            {
                ReportNo = "采购单2";
                IDALPurchase purchase = new DALPurchase();
                ds = purchase.GetPrintData(OrdNo);
            }
            else if (ReportNo.IndexOf("入库单") >= 0)
            {
                ReportNo = "入库单";
                //ReportNo = "采购单2";
                IDALErpIn purchase = new DALErpIn();
                ds = purchase.GetPrintData(OrdNo);
            }
            else if (ReportNo.IndexOf("出库单") >= 0)
            {
                ReportNo = "出库单";
                //ReportNo = "采购单2";
                IDALErpIn purchase = new DALErpIn();
                ds = purchase.GetPrintData(OrdNo);
            }
 
            //ds = new ReportProvider().GetDataSource(entity, list, orderType, orderNum);
            string path = "~/Report/" + ReportNo + ".frx";
            path = Server.MapPath(path);
            //if (!Directory.Exists(path))
            //{
            //    string template = Server.MapPath("~Report/Report.frx");
            //    System.IO.File.Copy(template, path, true);
            //}
            webReport.Report.Load(path);
            if (ds != null && ds.Tables != null && ds.Tables.Count > 0)
            {
                webReport.Report.RegisterData(ds);
                for (int i = 0; i < ds.Tables.Count; i++)
                {
                    webReport.Report.GetDataSource(ds.Tables[i].TableName).Enabled = true;
                }
            }
            webReport.ID = ReportNo;
            ViewBag.WebReport = webReport;
 
            return View();
 
        }
        public ActionResult SelMatDialog() 
        {
            return View();
        }
 
    }
}