UpstreamSendCheck.cs
2.48 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
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;
namespace Hh.Mes.Service.ApiService
{
public partial class UpstreamService
{
/// <summary>
/// 质量反馈理论上只有质量状态,没有数据操作类型(兼容)
/// 此处后续根据实际业务需要修改逻辑
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public dynamic SendCheck(QualityFeedbackEntity entity)
{
var response = new ResponseUpstream<string>(entity.plmeid);
var feedback = new bus_quality_feedback
{
plmeId = entity.plmeid,
proOrderCode = entity.pro_order_code,
jobCode = entity.job_code,
shift = entity.shift,
isDelete = AddOrUpdateFlag
};
return ExceptionsHelp.Instance.ExecuteT(() =>
{
var resultCount = 0;
if (entity.type == EnumAction.I.ToString())
{
if (base.Context.Queryable<bus_quality_feedback>().Any(t => t.plmeId == feedback.plmeId && t.isDelete == AddOrUpdateFlag))
{
return response.ResponseError($"【MOM】【plmeid】质量反馈信息[{entity.plmeid}]已经存在,请勿重复添加!");
}
resultCount = base.Context.Insertable(feedback).ExecuteCommand();
}
else if (entity.type == EnumAction.U.ToString())
{
resultCount = base.Context.Updateable(feedback)
.IgnoreColumns(it => new { it.createBy, it.createTime })
.Where(x => x.plmeId == entity.plmeid && x.isDelete == AddOrUpdateFlag).ExecuteCommand();
}
else if (entity.type == EnumAction.D.ToString())
{
resultCount = base.Context.Updateable<bus_quality_feedback>()
.SetColumns(t => t.isDelete == DeleteFlag)
.Where(x => x.plmeId == entity.plmeid && x.isDelete == AddOrUpdateFlag)
.ExecuteCommand();
}
return resultCount > 0 ? response.ResponseSuccess() : response.ResponseError();
});
}
}
}