执行代码清理,修复warning

This commit is contained in:
2023-11-06 19:59:12 +08:00
parent c6b8dfc861
commit 1dbb17f103
118 changed files with 5046 additions and 4111 deletions

View File

@@ -49,7 +49,7 @@ namespace Tnb.EquipMgr
private async Task<object> GetList(VisualDevModelListQueryInput input)
{
var db = _repository.AsSugarClient();
ISqlSugarClient db = _repository.AsSugarClient();
Dictionary<string, object>? queryJson = (input == null || string.IsNullOrEmpty(input.queryJson)) ? new Dictionary<string, object>() : input.queryJson.ToObject<Dictionary<string, object>>();
string equioInfo = queryJson.ContainsKey("query_info") ? (queryJson["query_info"].ToString() ?? "") : "";
string status = queryJson.ContainsKey("status") ? (queryJson["status"].ToString() ?? "") : "";
@@ -66,7 +66,7 @@ namespace Tnb.EquipMgr
input.sidx = "a." + input.sidx;
}
var list = await db.Queryable<EqpSpotInsRecordH, EqpEquipment, UserEntity, UserEntity>((a, b, c, d) => new object[]
SqlSugarPagedList<EqpSpotInsRecordListOutput> list = await db.Queryable<EqpSpotInsRecordH, EqpEquipment, UserEntity, UserEntity>((a, b, c, d) => new object[]
{
JoinType.Left, a.equip_id == b.id,
JoinType.Left, a.spot_record_user_id == c.Id,
@@ -101,7 +101,7 @@ namespace Tnb.EquipMgr
a.spot_record_date_time = a.date_spot_record_date_time == null ? "" : a.date_spot_record_date_time.Value.ToString("yyyy-MM-dd HH:mm:ss");
a.repeat_time = a.date_repeat_time == null ? "" : a.date_repeat_time.Value.ToString("yyyy-MM-dd HH:mm:ss");
})
.ToPagedListAsync((input?.currentPage ?? 1), (input?.pageSize ?? 50));
.ToPagedListAsync(input?.currentPage ?? 1, input?.pageSize ?? 50);
return PageResult<EqpSpotInsRecordListOutput>.SqlSugarPageResult(list);
}
@@ -117,16 +117,8 @@ namespace Tnb.EquipMgr
{
EqpSpotInsRecordH eqpSpotInsRecordH = _repository.GetSingle(x => x.id == input.id);
string status = "";
if (eqpSpotInsRecordH.is_repeat == "1")
{
status = SpotInsRecordExecutionStatus.TOBECHECK;
}
else
{
status = SpotInsRecordExecutionStatus.COMPLETED;
}
await _repository.UpdateAsync(x => new EqpSpotInsRecordH()
string status = eqpSpotInsRecordH.is_repeat == "1" ? SpotInsRecordExecutionStatus.TOBECHECK : SpotInsRecordExecutionStatus.COMPLETED;
_ = await _repository.UpdateAsync(x => new EqpSpotInsRecordH()
{
result = input.result,
attachment = input.attachment,
@@ -138,9 +130,9 @@ namespace Tnb.EquipMgr
if (input != null && input.details != null)
{
foreach (var item in input.details)
foreach (Dictionary<string, string> item in input.details)
{
await _repository.AsSugarClient().Updateable<EqpSpotInsRecordD>().
_ = await _repository.AsSugarClient().Updateable<EqpSpotInsRecordD>().
SetColumns(x => x.result == item["result"])
.SetColumnsIF(item["judge_type"] == "1", x => x.real_value == Convert.ToDouble(item["real_value"]))
.Where(x => x.id == item["id"])
@@ -151,8 +143,7 @@ namespace Tnb.EquipMgr
});
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
return result.IsSuccess ? "执行成功" : result.ErrorMessage;
return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result.IsSuccess ? "执行成功" : result.ErrorMessage);
}
/// <summary>
@@ -167,7 +158,7 @@ namespace Tnb.EquipMgr
EqpSpotInsRecordH eqpSpotInsRecordH = await _repository.GetSingleAsync(x => x.id == id);
List<EqpSpotInsRecordD> eqpSpotInsRecordDs = await _repository.AsSugarClient().Queryable<EqpSpotInsRecordD>()
.Where(x => x.spot_ins_record_id == id).ToListAsync();
SpotInsRecordRepeatOutput output = new SpotInsRecordRepeatOutput()
SpotInsRecordRepeatOutput output = new()
{
model = eqpSpotInsRecordH,
details = eqpSpotInsRecordDs,
@@ -187,7 +178,7 @@ namespace Tnb.EquipMgr
{
throw Oops.Bah("状态错误");
}
await _repository.UpdateAsync(x => new EqpSpotInsRecordH()
_ = await _repository.UpdateAsync(x => new EqpSpotInsRecordH()
{
repeat_result = input.repeat_result,
repeat_remark = input.repeat_remark,
@@ -200,13 +191,13 @@ namespace Tnb.EquipMgr
[HttpPost]
public async Task<dynamic> GetSpotInsRecordList(EquipQueryInput input)
{
var db = _repository.AsSugarClient();
Dictionary<string, string>? queryJson = new Dictionary<string, string>();
ISqlSugarClient db = _repository.AsSugarClient();
Dictionary<string, string>? queryJson = new();
if (!string.IsNullOrEmpty(input.queryJson))
{
queryJson = JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson);
}
var result = await db.Queryable<EqpSpotInsRecordH>()
SqlSugarPagedList<EquipSpotInsRecordQueryOutput> result = await db.Queryable<EqpSpotInsRecordH>()
.LeftJoin<UserEntity>((a, b) => a.repeat_user_id == b.Id)
.Where(a => a.equip_id == input.equip_id)
.Select((a, b) => new EquipSpotInsRecordQueryOutput
@@ -235,24 +226,28 @@ namespace Tnb.EquipMgr
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<dynamic> GetEqpSpotInsRecordInfoById(Dictionary<string, string> dic)
public async Task<dynamic?> GetEqpSpotInsRecordInfoById(Dictionary<string, string> dic)
{
string id = dic.ContainsKey("id") ? dic["id"] : "";
if (string.IsNullOrEmpty(id)) return null;
var db = _repository.AsSugarClient();
if (string.IsNullOrEmpty(id))
{
return null;
}
ISqlSugarClient db = _repository.AsSugarClient();
return await db.Queryable<EqpSpotInsRecordH>()
.LeftJoin<EqpEquipment>((a, b) => a.equip_id == b.id)
.Where((a, b) => a.id == id)
.Select((a, b) => new
{
id = a.id,
equip_id = a.equip_id,
a.id,
a.equip_id,
equip_code = b.code,
equip_name = b.name,
create_time = a.create_time == null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS),
result_remark = a.result_remark,
result = a.result,
status = a.status,
a.result_remark,
a.result,
a.status,
}).FirstAsync();
}