UpstreamSendCalendar.cs
4.65 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
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
using System;
using System.Collections.Generic;
using Hh.Mes.Common.Json;
using Hh.Mes.Common.log;
using Hh.Mes.Pojo.System;
using Hh.Mes.POJO.ApiEntity;
using Hh.Mes.POJO.Entity;
using Hh.Mes.POJO.EnumEntitys;
using Hh.Mes.POJO.Response;
using NPOI.POIFS.FileSystem;
using Ubiety.Dns.Core;
namespace Hh.Mes.Service.ApiService
{
public partial class UpstreamService
{
public dynamic SendCalendar(CalendarEntity entity)
{
return ExceptionsHelp.Instance.ExecuteT(() =>
{
var response = new ResponseUpstream<string>(entity.plmeid);
var calendar = new base_calendar
{
keys = Guid.NewGuid(),
plmeId = entity.plmeid,
workShopCode = entity.work_code,
currentDate = entity.current_date,
shift = entity.shift,
startTime = entity.start_time,
endTime = entity.end_time,
timeFlag = entity.time,
isDelete = AddOrUpdateFlag
};
int resultCount = 0;
if (entity.type == EnumAction.I.ToString())
{
if (Context.Queryable<base_calendar>().Any(t => t.plmeId == calendar.plmeId && t.isDelete == AddOrUpdateFlag))
{
return response.ResponseError($"【MOM】【plmeid】日历信息[{entity.plmeid}]已经存在,请勿重复添加!");
}
calendar.createTime = DateTime.Now;
resultCount = Context.Insertable(calendar).ExecuteCommand();
}
else if (entity.type == EnumAction.U.ToString())
{
calendar.updateTime = DateTime.Now;
resultCount = Context.Updateable(calendar).IgnoreColumns(it => new { it.keys, it.createBy, it.createTime })
.Where(x => x.plmeId == entity.plmeid && x.isDelete == AddOrUpdateFlag)
.ExecuteCommand();
}
else if (entity.type == EnumAction.D.ToString())
{
calendar.updateTime = DateTime.Now;
resultCount = Context.Updateable<base_calendar>()
.SetColumns(t => t.isDelete == DeleteFlag)
.Where(x => x.plmeId.Equals(entity.plmeid) && x.isDelete == AddOrUpdateFlag)
.ExecuteCommand();
}
return resultCount > 0 ? response.ResponseSuccess() : response.ResponseError();
});
}
/// <summary>
/// ep3d订单推送接收
/// </summary>
/// <returns></returns>
public dynamic ep3dDataPush(dynamic requestData)
{
var response = new POJO.Response.Response();
try
{
var reqData = DynamicJson.Parse(requestData.ToString());
List<base_productionOrder_EP3D> productionOrderS = new List<base_productionOrder_EP3D>();
var list = reqData.data;
foreach (var item in list)
{
base_productionOrder_EP3D model = new base_productionOrder_EP3D();
model.keys = Guid.NewGuid();
model.pipelineNo = item.pipelineNo;
model.weldingPointNo = item.weldingPointNo;
model.pagination = item.pagination;
model.pipeSectionNo = item.pipeSectionNo;
model.pipelineGrade = item.pipelineGrade;
model.weldingMaterial1 = item.weldingMaterial1;
model.weldingMaterial2 = item.weldingMaterial2;
model.pipeLength = item.pipeLength;
model.pipeMaterialCode = item.pipeMaterialCode;
model.pipeNumber = item.pipeNumber;
model.state = 0;
model.createTime = DateTime.Now;
model.updateTime = DateTime.Now;
productionOrderS.Add(model);
}
int inI = Context.Insertable(productionOrderS).ExecuteCommand();
if (inI > 0)
{
return response;
}
else
{
return response.ResponseError($"数据接收失败,新增数据数量为0!");
}
}
catch (Exception ex)
{
return response.ResponseError($"{ex.Message}");
}
}
}
}