zhao
2021-07-07 2fdf959ac739edd6de84aa8053b8b9683dce8e8b
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
using HH.WMS.BLL.Pda;
using HH.WMS.Common;
using HH.WMS.Entitys;
using HH.WMS.Entitys.Entitys.Mes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace HH.WMS.BLL.MiddleDB
{
    public class ZCMiddleOperateBll : DapperBaseBLL
    {
        public OperateResult TransportSuccess(TN_MES_TASK _req, TN_WM_SERVICE_EXECEntity _serviceExec, string _taskNo)
        {
            return UseTransaction(trans =>
            {
                //反馈mes
                if (_serviceExec.CN_C_SEND_MES == Constants.Y)
                {
                    CreateDapperDAL<TN_MES_TASK>().Update(new
                    {
                        Data_status = _req.Data_status,
                        NeedTrig = _req.NeedTrig,
                        Section = _req.SECTION
                    }, new
                    {
                        TaskNo = _req.task_no
                    }, trans);
                }
 
                if (_serviceExec.Update)
                {
                    var or = BLLCreator.CreateDapper<TN_WM_SERVICE_EXECEntity>().Update(new
                    {
                        CN_S_START_LOCATION = _serviceExec.CN_S_START_LOCATION,
                        CN_S_END_LOCATION = _serviceExec.CN_S_END_LOCATION,
                        CN_C_COMPLETE = _serviceExec.CN_C_COMPLETE,
                        CN_C_SEND_MES = _serviceExec.CN_C_SEND_MES,
                        CN_S_MSG = _serviceExec.CN_S_MSG
                    }, new
                    {
                        CN_S_TASK_NO = _serviceExec.CN_S_TASK_NO
                    });
                    if (!or.Success)
                        throw new Exception(or.Msg);
                }
                else
                {
                    var or = BLLCreator.CreateDapper<TN_WM_SERVICE_EXECEntity>().Add(_serviceExec);
                    if (!or.Success)
                        throw new Exception(or.Msg);
                }
 
                // 关联主任务
                if (!string.IsNullOrEmpty(_taskNo))
                {
                    CreateDapperDAL<TN_WM_TASKEntity>().Update(new
                    {
                        CN_S_EXT1 = _req.task_no
                    }, new
                    {
                        CN_S_TASK_NO = _taskNo
                    }, trans);
                }
            });
        }
    }
}