Admin
5 天以前 bd6818fc9d40f343547bafca0743658f3c0379dc
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
using System;
using System.Collections.Generic;
using System.Text;
using WIDESEA_Common;
using WIDESEA_Common.TaskEnum;
using WIDESEA_Common.Tools;
using WIDESEA_Entity.DomainModels;
using WIDESEA_Services.IRepositories;
using WIDESEA_WCS.WCSClient;
 
namespace WIDESEA_WCS.Jobs.ConveyorLine.OutboundArea
{
    public partial class OutboundAreaDispatch
    {
 
        /// <summary>
        /// 出库前移库到
        /// </summary>
        /// <param name="taskWCSinfoRepository"></param>
        /// <param name="taskRGVinfoRepository"></param>
        /// <param name="client"></param>
        public static void OutboundMoveAction(IDt_TaskWCSinfoRepository taskWCSinfoRepository, IDt_TaskRGVinfoRepository taskRGVinfoRepository, PLCClient client)
        {
            try
            {
                string rgvTaskType = RGVTaskType.RgvTaskType_Move.ToString();
                List<Dt_TaskWCSinfo> inboundWaitMoveTask = taskWCSinfoRepository.Find(r => r.wcstask_state == TaskState.TaskState_InboundWaitMove.ToString());
                if (null != inboundWaitMoveTask)
                {
                    //将缓存位的移入目的地
                    foreach (var item in inboundWaitMoveTask)
                    {
                        Dt_TaskRGVinfo rgvTask = GetRGVTask(taskRGVinfoRepository, item, rgvTaskType);
                        taskRGVinfoRepository.Add(rgvTask, true);
                        item.wcstask_state = TaskState.TaskState_InboundMoveExecuting.ToString();
                        taskWCSinfoRepository.Update(item, x => x.wcstask_state, true);
                    }
                }
                List<Dt_TaskWCSinfo> outboundWaitMoveTask = taskWCSinfoRepository.Find(r => r.wcstask_state == TaskState.TaskState_Assigned.ToString());
                if (null != outboundWaitMoveTask)
                {
                    //将缓存位的移入目的地
                    foreach (var item in outboundWaitMoveTask)
                    {
                        //当前层已经有移库任务了
                        Dt_TaskWCSinfo task = taskWCSinfoRepository.FindFirst(r => OutboundStationLayerNo.Contains(r.wcstask_startPoint) &&
                        (r.wcstask_state == TaskState.TaskState_OutboundMoveExecuting.ToString() || r.wcstask_state == TaskState.TaskState_OutboundMoveFinished.ToString()));
                        if (null != task)
                            continue;
 
                        Dt_TaskRGVinfo rgvTask = GetRGVTask(taskRGVinfoRepository, item, rgvTaskType);
                        taskRGVinfoRepository.Add(rgvTask, true);
                        item.wcstask_state = TaskState.TaskState_OutboundMoveExecuting.ToString();
                        taskWCSinfoRepository.Update(item, x => x.wcstask_state, true);
                    }
                }
            }
            catch (Exception ex)
            {
                WriteLog.Info("OutboundArea").Write($"{ DateTime.Now }出库区域调度失败:{ex.Message}", "OutboundArea");
            }
        }
 
    }
}