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
using BLL.DAL;
using Common;
using Json;
using Lib;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Script.Serialization;
 
namespace wms.Areas.Data.Controllers
{
    public class DeliveryOutDetailController : MasterPage
    {
        // GET: Data/DeliveryOutDetail
 
        [LoginFilter]
        public ActionResult Index()
        {
            ViewBag.Title = "出入库明细";
            ViewBag.MatType = LocalHelper.GetDictionaryHtml("MatType");
            ViewBag.OrdNoType = LocalHelper.GetOrdNoTypeHtml();
            ViewBag.Certificate = LocalHelper.GetCertificateHtml();
 
            return View();
        }
 
        public ActionResult EditCertificates(string ordNo,string matNo) 
        {
            DALDeliveryOutDetail provider = new DALDeliveryOutDetail();
            DeliveryOutDetail entity = provider.GetCertificate(ordNo, matNo);
            ViewBag.Certificate = entity.Certificate;
            ViewBag.Demo = entity.Demo;
 
            return View();
        }
    }
 
    public class DeliveryOutAjaxController : AjaxPage 
    {
        public ActionResult GetList()
        {
            try
            {
                var dd = Request["aaa"];
                var modelItems = new JavaScriptSerializer().Deserialize<AjaxOutDetail>(dd);
                if (modelItems != null)
                {
                    // 实例化分页信息
                    PageInfo pageInfo = new PageInfo()
                    {
                        PageIndex = modelItems.pageIndex,
                        PageSize = modelItems.pageSize
                    };
                    modelItems.DepartGuid = this.LoginDepartNum;
 
                    // 数据库交互,获取库区集合and分页信息。
                    DALDeliveryOutDetail provider = new DALDeliveryOutDetail();
                    List<DeliveryOutDetail> entity = provider.GetList(modelItems, ref pageInfo).ToList();
 
                    // Data =》json
                    string json = JsonHelper.IListToJson<DeliveryOutDetail>(entity, "List");
                    string pjson = ConvertJson.Serializer(pageInfo);
 
                    // controller => view
                    ReturnJson.AddProperty("Result", new JsonObject(json));
                    ReturnJson.AddProperty("PageInfo", new JsonObject(pjson));
                    ReturnJson.AddProperty("Code", 1);
                    ReturnJson.AddProperty("Message", "出库明细加载成功!");
 
                    return Content(this.ReturnJson.ToString());
                }
 
                return Content(null);
            }
            catch (System.Exception)
            {
                return Content(null);
            }
        }
 
        public ActionResult SetCertificates() 
        {
            string dd = Request["aaa"];
            if (dd != null)
            {
                var models = new JavaScriptSerializer().Deserialize<DeliveryOutDetail>(dd);
 
                DALDeliveryOutDetail provider = new DALDeliveryOutDetail();
 
                if (provider.SetCertificates(models))
                {
                    ReturnJson.AddProperty("Code", 1);
                    ReturnJson.AddProperty("Message", "数据更新成功!");
                }
                else 
                {
                    ReturnJson.AddProperty("Code", 0);
                    ReturnJson.AddProperty("Message", "数据更新失败!");
                }
 
                return Content(this.ReturnJson.ToString());
            }
 
            return Content(null);
        }
    }
}