zhao
2021-07-19 8347f2fbddbd25369359dcb2da1233ac48a19fdc
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
using HH.WMS.BLL;
using HH.WMS.BLL.Interface;
using HH.WMS.BLL.OutStock;
using HH.WMS.Entitys;
using HH.WMS.WebApi.Areas.Common.Controllers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
 
namespace HH.WMS.WebApi.Areas.OutStock.Controllers
{
    public class DeliverGoodsController : BaseController
    {
        #region 包装箱信息
        /// <summary>
        /// 包装箱信息
        /// </summary>
        /// <param name="opNo"></param>
        /// <returns></returns>
        [HttpGet]
        public OperateResult OutPackList(string opNo)
        {
            return ValidateToken(t =>
            {
                var outPackList = BLLCreator.Create<DapperBLL<TN_WM_B_OUT_PACKEntity>>().GetList(new
                {
                    CN_S_OP_NO = opNo
                });
                var boxDtlList = BLLCreator.Create<DapperBLL<TN_WM_B_BOX_DTLEntity>>().GetList(new
                {
                    CN_S_PACKING_CODE = outPackList.Select(x => x.CN_S_PACKING_CODE).ToList()
                });
                var result = outPackList.Select(x => new
                {
                    CN_S_OP_NO = x.CN_S_OP_NO,
                    CN_S_PACKING_CODE = x.CN_S_PACKING_CODE,
                    CN_S_PACKING_NUM = boxDtlList.Where(y => y.CN_S_PACKING_CODE == x.CN_S_PACKING_CODE).Sum(z => z.CN_F_QUANTITY)
                });
                return OperateResult.Succeed(null, result);
            });
        }
        #endregion
 
        #region 装箱明细
        /// <summary>
        /// 装箱明细
        /// </summary>
        /// <param name="pack"></param>
        /// <returns></returns>
        [HttpGet]
        public OperateResult BoxDtlList(string pack)
        {
            return ValidateToken(t =>
            {
                var boxDtlList = BLLCreator.Create<DapperBLL<TN_WM_B_BOX_DTLEntity>>().GetList(new
                {
                    CN_S_PACKING_CODE = pack
                });
                return OperateResult.Succeed(null, boxDtlList);
            });
        }
        #endregion
 
        #region 确认发货
        /// <summary>
        /// 确认发货
        /// </summary>
        /// <param name="opNo"></param>
        /// <returns></returns>
        [HttpGet]
        public OperateResult ComfirmDeliverGoods(string opNo)
        {
            return ValidateToken(t =>
            {
                try
                {
                    OperateResult result = BLLCreator.Create<TN_WM_WAVE_MSTBLL>().DeliverGoods(opNo);
                    return result;
                    //if (result.Status == ResultStatus.Success)
                    //{
                    //    //TN_WM_OUT_MSTEntity mst = BLLCreator.Create<DapperBLL<TN_WM_OUT_MSTEntity>>().GetSingleEntity(new { CN_S_OP_NO = opNo });
                    //    //OperateResult apiResult = BLLCreator.Create<OtherSysApi>().OutOrderConmit(mst.CN_S_OP_TYPE, mst.CN_S_FROM_NO);
 
 
                    //    if (apiResult.Status != ResultStatus.Success)
                    //    {
                    //        result.Status = ResultStatus.Warning;
                    //        result.Msg = apiResult.Msg;
                    //    }
                    //}
                    //return result;
                }
                catch (Exception ex)
                {
                    return OperateResult.Error(ex.Message);
                }
            });
        }
        #endregion
 
        #region 发货明细
        /// <summary>
        /// 发货明细
        /// </summary>
        /// <param name="opNo"></param>
        /// <param name="uniqueCode"></param>
        /// <returns></returns>
        [HttpGet]
        public OperateResult DeliverGoodsDetail(string opNo, string uniqueCode)
        {
            return ValidateToken(t =>
            {
                var data = BLLCreator.Create<TN_WM_ORDER_SORTING_RELBLL>().DeliverGoodsDetail(opNo, uniqueCode);
                return OperateResult.Succeed(null, data);
            });
        }
        #endregion
    }
}