IStationTaskApp.cs
2.99 KB
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
using System;
using System.Linq;
using Infrastructure;
using WebRepository;
namespace WebApp
{
/// <summary>
/// 站台下发接口
/// </summary>
public partial class IStationTaskApp : ApiApp
{
public IRepository<ReceiptHeader> _app;
public IStationTaskApp(IUnitWork unitWork, IAuth auth, BaseDBContext context, IRepository<ReceiptHeader> app) : base(unitWork, auth, context)
{
_app = app;
}
public TableData StationTask(string containerCode, string startStation, string endStation)
{
TableData response = new TableData();
response.code = 200;
try
{
Station SStation = _unitWork.Find<Station>(n => n.Code == startStation).FirstOrDefault();
Station EStation = _unitWork.Find<Station>(n => n.Code == endStation).FirstOrDefault();
if (SStation == null)
{
response.code = 300;
response.msg = startStation + ":无此站台!";
return response;
}
else if (EStation == null)
{
response.code = 300;
response.msg = endStation + ":无此站台!";
return response;
}
else if (EStation != null)
{
Task ptask = new Task();
TaskDetail ptaskDetail = new TaskDetail();
var taskNo = _app.GetTaskNo(TaskNo.站台到站台);
ptask.TaskNo = taskNo;
ptask.OrderCode = taskNo;
ptask.BusinessType = BusinessType.出库_其他出库单;
ptask.FirstStatus = TaskStatus.待下发任务;
ptask.LastStatus = TaskStatus.待下发任务;
ptask.CreateTime = DateTime.Now;
_unitWork.Add(ptask);
ptaskDetail.TaskNo = taskNo;
ptaskDetail.OrderCode = taskNo;
ptaskDetail.TaskType = TaskType.站台到站台;
ptaskDetail.ContainerCode = containerCode;
ptaskDetail.SourceLocation = startStation;
ptaskDetail.DestinationLocation = endStation;
ptaskDetail.OderQty = 0;
ptaskDetail.ContainerQty = 0;
ptaskDetail.HadQty = 0;
ptaskDetail.Roadway = 0;
ptaskDetail.Station = endStation;
ptaskDetail.Status = TaskStatus.待下发任务;
ptaskDetail.Priority = 99;
ptaskDetail.CreateTime = DateTime.Now;
_unitWork.Add(ptaskDetail);
}
}
catch (Exception ex)
{
response.code = 500;
response.msg = ex.Message;
return response;
}
return response;
}
}
}