zhao
2021-07-02 081df17b8cc4a6e7e4f4e1e1887f24810e3ec2f9
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
using HH.WMS.Common;
using HH.WMS.Entitys;
using HH.WMS.Entitys.Basic;
using HH.WMS.WebUI.Controllers;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
 
namespace HH.WMS.WebUI.Areas.Basic.Controllers
{
    public class LogisticsController : BaseController
    {
        public ActionResult Index()
        {
            return View();
        }
 
        public ActionResult PrintTemplet(string guid) 
        {
            TN_WM_LOGISTICS_TEMPLET_RELEntity entity = new TN_WM_LOGISTICS_TEMPLET_RELEntity();
            if (!string.IsNullOrEmpty(guid))
            {
                string result = HttpWMS_Get("api/Logistics/LogisticsTempletListByGuid?guid=" + guid);
                OperateResult opResult = JsonConvert.DeserializeObject<OperateResult>(result);
                if (!opResult.Success)
                {
                    entity.OperateMessage = opResult.Msg;
                }
                else
                {
                    entity = opResult.GetData<TN_WM_LOGISTICS_TEMPLET_RELEntity>();
                }
            }
            return View(entity);
        }
 
        public ActionResult Edit(string guid)
        {
            TN_WM_LOGISTICS_COMPANYEntity entity = new TN_WM_LOGISTICS_COMPANYEntity();
            if (!string.IsNullOrEmpty(guid))
            {
                string result = HttpWMS_Get("api/Logistics/GetById?guid=" + guid);
                OperateResult opResult = JsonConvert.DeserializeObject<OperateResult>(result);
                if (!opResult.Success)
                {
                    entity.OperateMessage = opResult.Msg;
                }
                else
                {
                    entity = opResult.GetData<TN_WM_LOGISTICS_COMPANYEntity>();
                }
            }
            return View(entity);
        }
 
        #region 新增修改
        /// <summary>
        /// 新增修改
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        [HttpPost]
        public string Edit(TN_WM_LOGISTICS_COMPANYEntity entity)
        {
            return HttpWMS_Post("api/Logistics/Edit", JsonConvert.SerializeObject(new
            {
                TokenId = ViewConstants.TokenId,
                PostData = entity
            }));
        }
        #endregion
 
        public string Delete(string guid)
        {
            return HttpWMS_Get("api/Logistics/Delete?guid=" + guid);
        }
 
        public string DeleteTemplet(string guid)
        {
            return HttpWMS_Get("api/Logistics/DeleteTemplet?guid=" + guid);
        }
 
        public string LogisticsList(string logistics, int pageIndex, int pageSize)
        {
            return HttpWMS_Post("api/Logistics/LogisticsList", JsonConvert.SerializeObject(new
            {
                TokenId = ViewConstants.TokenId,
                PageIndex = pageIndex,
                PageSize = pageSize,
                SearchCondition = new
                {
                    logistics = logistics
                }
            }));
        }
 
        public string LogisticsTempletList(string logisticsFlag)
        {
            string datas = HttpWMS_Get("api/Logistics/LogisticsTempletList?logisticsFlag=" + logisticsFlag);
            return datas;
        }
 
        #region 根据模版类型获取所有模版
        /// <summary>
        /// 根据模版类型获取所有模版
        /// </summary>
        /// <param name="type">模版名称</param>
        /// <returns></returns>
        public string GetPrintTempletByType(string type)
        {
            return HttpWMS_Get("api/PrintTemplet/GetPrintTempletByType?type=" + type);
        }
        #endregion
 
 
        #region 新增物料公司与打印模版
        /// <summary>
        /// 新增物料公司与打印模版
        /// </summary>
        /// <param name="obj">实体类</param>
        /// <returns></returns>
        public string add(JObject obj)
        {
            TN_WM_LOGISTICS_TEMPLET_RELEntity entity = JsonHelper.ParseFormJson<TN_WM_LOGISTICS_TEMPLET_RELEntity>(obj.Value<object>("rows").ToString());
            return HttpWMS_Post("api/Logistics/addLogisticsTemplet", new
            {
                TokenId = ViewConstants.TokenId,
                PostData = entity
            });
        }
        #endregion
    }
}