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
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 GLMiddleOperateBll : MiddleDapperBaseBLL
    {
        public OperateResult TransportSuccess(AGV_Transport_Request_log _log, AGV_Transport_Request _req, AGV_Task_execution_record _exec, TN_WM_SERVICE_EXECEntity _serviceExec)
        {
            return UseTransaction(trans =>
            {
                //反馈mes
                if (_serviceExec.CN_C_SEND_MES == Constants.Y)
                {
                    MiddleCreateDapperDAL<AGV_Transport_Request>().Update(new
                    {
                        HasBeenReceived = Constants.Y
                    }, new
                    {
                        TaskNo = _req.TaskNo
                    }, trans);
                }
                //成功时会记录移送任务日志
                if (_log != null)
                    MiddleCreateDapperDAL<AGV_Transport_Request_log>().Add(_log, trans);
                //失败为7、8时会记录任务执行情况
                if (_exec != null)
                    MiddleCreateDapperDAL<AGV_Task_execution_record>().Add(_exec, 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);
                }
            });
        }
    }
}