模具维修修改

This commit is contained in:
2024-08-08 17:16:33 +08:00
parent 18dac9b6b2
commit 141de28d0c
6 changed files with 184 additions and 5 deletions

View File

@@ -5,6 +5,7 @@ namespace Tnb.EquipMgr.Entities.Dto
public string id { get; set; } = string.Empty; public string id { get; set; } = string.Empty;
public string repeat_result { get; set; } = string.Empty; public string repeat_result { get; set; } = string.Empty;
public string repeat_descrip { get; set; } = string.Empty;
public string? repeat_remark { get; set; } public string? repeat_remark { get; set; }
public string? attachment { get; set; } public string? attachment { get; set; }

View File

@@ -61,4 +61,29 @@ public partial class ToolMoldMaintainTask : BaseEntity<string>
public string? wxattachment { get; set; } public string? wxattachment { get; set; }
public string? wxdescribe { get; set; } public string? wxdescribe { get; set; }
/// <summary>
/// 复核 1 通过 2 不通过
/// </summary>
public string repeat_result { get; set; }
/// <summary>
/// 复核结果描述
/// </summary>
public string repeat_descrip { get; set; }
/// <summary>
/// 复核人
/// </summary>
public string repeat_user_id { get; set; }
/// <summary>
/// 复核时间
/// </summary>
public DateTime? repeat_time { get; set; }
/// <summary>
/// 工时(小时)
/// </summary>
public decimal cost_work_time { get; set; }
} }

View File

@@ -122,5 +122,27 @@ namespace Tnb.EquipMgr
throw Oops.Oh(ErrorCode.COM1001); throw Oops.Oh(ErrorCode.COM1001);
} }
} }
[HttpPost]
public async Task<string> RepeatRepair(MaintainRecordRepeatInput input)
{
ToolMoldMaintainTask toolMoldMaintainTask = await _db.Queryable<ToolMoldMaintainTask>().SingleAsync(x => x.id == input.id);
if (toolMoldMaintainTask.status != "YWC")
{
throw Oops.Bah("状态错误");
}
DbResult<bool> result = await _db.Ado.UseTranAsync(async () =>
{
await _db.Updateable<ToolMoldMaintainTask>()
.SetColumns(x => x.repeat_result == input.repeat_result)
.SetColumns(x => x.repeat_descrip == input.repeat_descrip)
.SetColumns(x=>x.repeat_user_id==_userManager.UserId)
.SetColumns(x=>x.repeat_time==DateTime.Now)
.Where(x => x.id == input.id)
.ExecuteCommandAsync();
});
return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : result.IsSuccess ? "复核成功" : result.ErrorMessage;
}
} }
} }

View File

@@ -47,7 +47,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
/// <summary> /// <summary>
/// 管道状态 /// 管道状态
/// </summary> /// </summary>
public int piping_status { get; set; } public string piping_status { get; set; }
/// <summary> /// <summary>
/// 开始时间 /// 开始时间

View File

@@ -140,8 +140,7 @@ namespace Tnb.ProductionMgr
["TagName"] = "开工1", ["TagName"] = "开工1",
["Value"] = "true", ["Value"] = "true",
}; };
string responseresult = string responseresult = await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand, false);
await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand, false);
Log.Information($"注塑主控柜开工1开启返回结果:{responseresult}"); Log.Information($"注塑主控柜开工1开启返回结果:{responseresult}");
Dictionary<string, string> dicCommand2 = new(StringComparer.OrdinalIgnoreCase) Dictionary<string, string> dicCommand2 = new(StringComparer.OrdinalIgnoreCase)
@@ -152,9 +151,19 @@ namespace Tnb.ProductionMgr
["Value"] = "true", ["Value"] = "true",
}; };
string responseresult2 = string responseresult2 = await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand2, false);
await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand2, false);
Log.Information($"注塑主控柜开工2开启返回结果:{responseresult2}"); Log.Information($"注塑主控柜开工2开启返回结果:{responseresult2}");
Dictionary<string, string> dicCommand4 = new(StringComparer.OrdinalIgnoreCase)
{
["DevName"] = "挤出集中供料",
["token"] = _eleCtlCfg.token,
["TagName"] = "开关1",
["Value"] = "true",
};
string responseresult4 = await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand4, false);
Log.Information($"挤出集中供料开关1开启返回结果:{responseresult4}");
List<PrdRawMaterialBarcode> prdRawMaterialBarcodeList = await _db.Queryable<PrdRawMaterialBarcode>() List<PrdRawMaterialBarcode> prdRawMaterialBarcodeList = await _db.Queryable<PrdRawMaterialBarcode>()
.Where(x => ids.Contains(x.id)).ToListAsync(); .Where(x => ids.Contains(x.id)).ToListAsync();
@@ -224,6 +233,17 @@ namespace Tnb.ProductionMgr
}; };
string responseresult2 = await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand2, false); string responseresult2 = await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand2, false);
Log.Information($"注塑主控柜开工2关闭返回结果:{responseresult2}"); Log.Information($"注塑主控柜开工2关闭返回结果:{responseresult2}");
Dictionary<string, string> dicCommand4 = new(StringComparer.OrdinalIgnoreCase)
{
["DevName"] = "挤出集中供料",
["token"] = _eleCtlCfg.token,
["TagName"] = "开关1",
["Value"] = "false",
};
string responseresult4 = await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand4, false);
Log.Information($"挤出集中供料开关1关闭返回结果:{responseresult4}");
} }
return "成功"; return "成功";

View File

@@ -0,0 +1,111 @@
using JNPF;
using JNPF.Common.Core.Manager;
using JNPF.Common.Dtos.VisualDev;
using JNPF.Common.Extension;
using JNPF.Common.Filter;
using JNPF.Common.Security;
using JNPF.DependencyInjection;
using JNPF.DynamicApiController;
using JNPF.FriendlyException;
using JNPF.Logging;
using JNPF.Systems.Entitys.System;
using JNPF.Systems.Interfaces.System;
using JNPF.VisualDev;
using JNPF.VisualDev.Entitys;
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
using JNPF.VisualDev.Interfaces;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Senparc.CO2NET.HttpUtility;
using SqlSugar;
using Tnb.BasicData;
using Tnb.BasicData.Entities;
using Tnb.Common.Extension;
using Tnb.EquipMgr.Entities;
using Tnb.ProductionMgr.Entities;
using Tnb.WarehouseMgr.Entities.Configs;
using Tnb.Common.Utils;
using Tnb.WarehouseMgr.Entities.Consts;
using HttpClientHelper = Tnb.Common.Utils.HttpClientHelper;
using Tnb.Common.Redis;
using Tnb.ProductionMgr.Entities.Dto.PrdManage;
namespace Tnb.ProductionMgr
{
/// <summary>
/// 机台原料设定服务
/// </summary>
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
[Route("api/[area]/[controller]/[action]")]
[OverideVisualDev(ModuleId)]
public class PrdRawMaterialBarcodeTwoService: IOverideVisualDevService,IDynamicApiController, ITransient
{
private const string ModuleId = "36009683052821";
private readonly ISqlSugarClient _db;
private readonly IDictionaryDataService _dictionaryDataService;
private readonly IUserManager _userManager;
private static Dictionary<string, Tuple<string, string>> _dicWorkLine = new();
private readonly ElevatorControlConfiguration _eleCtlCfg = App.Configuration.Build<ElevatorControlConfiguration>();
private readonly IBillRullService _billRuleService;
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
private readonly IVisualDevService _visualDevService;
private readonly IRunService _runService;
private readonly RedisData _redisData;
public PrdRawMaterialBarcodeTwoService(ISqlSugarRepository<PrdRawMaterialBarcode> repository,
IUserManager userManager,
IBillRullService billRuleService,
IVisualDevService visualDevService,
RedisData redisData,
IRunService runService,
IDictionaryDataService dictionaryDataService)
{
_db = repository.AsSugarClient();
_userManager = userManager;
_billRuleService = billRuleService;
_dictionaryDataService = dictionaryDataService;
_visualDevService = visualDevService;
_runService = runService;
_redisData = redisData;
OverideFuncs.GetListAsync = GetList;
}
private async Task<dynamic> GetList(VisualDevModelListQueryInput input)
{
Dictionary<string, object>? queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, object>>(input.queryJson) : new Dictionary<string, object>();
string billCode = queryJson.ContainsKey("bill_code") ? queryJson["bill_code"].ToString() : "";
string equipTypeId = queryJson.ContainsKey("f_flowid") ? queryJson["f_flowid"].ToString() : "";
string isUpdate = queryJson.ContainsKey("is_update") ? queryJson["is_update"].ToString() : "";
SqlSugarPagedList<PrdRawMaterialBarcodeListDto> result = await _db.Queryable<PrdRawMaterialBarcode>()
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
.LeftJoin<EqpEquipment>((a, b,c) => a.equip_id == c.id)
.LeftJoin<EqpEquipType>((a,b,c,d)=>c.equip_type_id==d.id)
.WhereIF(!string.IsNullOrEmpty(billCode),(a,b,c)=>a.bill_code.Contains(billCode))
.WhereIF(!string.IsNullOrEmpty(equipTypeId),(a,b,c)=>c.equip_type_id==equipTypeId)
.WhereIF(!string.IsNullOrEmpty(isUpdate),(a,b,c)=>a.is_update.ToString()==isUpdate)
.Where((a,b,c)=>a.type=="2")
.Select((a, b, c,d) => new PrdRawMaterialBarcodeListDto
{
id = a.id,
bill_code = a.bill_code,
equip_id = c.name,
material_id = b.name,
absorb_material_finish = a.absorb_material_finish==1 ? "是" : "否",
is_update = a.is_update==1 ? "是" : "否",
piping_status = a.piping_status == 1 ? "开" : "关",
start_time = a.start_time!=null ? a.start_time.Value.ToString(DbTimeFormat.SS) : "",
end_time = a.end_time!=null ? a.end_time.Value.ToString(DbTimeFormat.SS) : "",
remark = a.remark,
stop_valve = a.stop_valve,
f_flowid = d.name,
equip_id_id = c.id,
material_id_id = b.id,
equip_ids = SqlFunc.Subqueryable<EqpEquipment>().Where(x=>a.equip_ids.Contains(x.id)).SelectStringJoin(x=>x.name,",")
}).ToPagedListAsync(input.currentPage, int.MaxValue);
return PageResult<PrdRawMaterialBarcodeListDto>.SqlSugarPageResult(result);
}
}
}