优化
This commit is contained in:
@@ -14,5 +14,10 @@ namespace Tnb.BasicData
|
||||
/// 报工允许超过工单计划数百分比 例:填写10就是10%
|
||||
/// </summary>
|
||||
public const string IS_SURPASS_PERCENTAGE = "is_surpass_percentage";
|
||||
|
||||
/// <summary>
|
||||
/// 域名
|
||||
/// </summary>
|
||||
public const string DOMAIN = "domain";
|
||||
}
|
||||
}
|
||||
@@ -10,5 +10,8 @@ namespace Tnb.EquipMgr.Entities.Dto
|
||||
public string? equip_id { get; set; }
|
||||
public string? equip_id_id { get; set; }
|
||||
public string? file_name { get; set; }
|
||||
|
||||
public string file_type { get; set; }
|
||||
public string file_ext { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,16 @@ public partial class EqpEquipFile : BaseEntity<string>
|
||||
/// 文件名
|
||||
/// </summary>
|
||||
public string file_name { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 文件后缀
|
||||
/// </summary>
|
||||
public string file_ext { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 文件类型
|
||||
/// </summary>
|
||||
public string file_type { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
|
||||
@@ -38,12 +38,12 @@ namespace Tnb.EquipMgr
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<string> Upload([FromForm] string equip_id, [FromForm] ChunkModel input)
|
||||
public async Task<string> Upload([FromForm] string equip_id,[FromForm] string file_type, [FromForm] ChunkModel input)
|
||||
{
|
||||
string msg;
|
||||
try
|
||||
{
|
||||
dynamic attachment = await _fileService.Uploader("annexpic", input);
|
||||
FileControlsModel attachment = await _fileService.Uploader("annexpic", input);
|
||||
|
||||
EqpEquipFile eqpEquipFile = new()
|
||||
{
|
||||
@@ -52,6 +52,8 @@ namespace Tnb.EquipMgr
|
||||
create_id = _userManager.UserId,
|
||||
create_time = DateTime.Now,
|
||||
attachment = JsonConvert.SerializeObject(attachment),
|
||||
file_ext = attachment.fileExtension,
|
||||
file_type = file_type,
|
||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||
};
|
||||
|
||||
@@ -82,6 +84,7 @@ namespace Tnb.EquipMgr
|
||||
.LeftJoin<EqpEquipment>((a, b, c, d) => a.equip_id == d.id)
|
||||
.Where((a, b, c, d) => a.equip_id == input.equip_id)
|
||||
.WhereIF(queryJson != null && queryJson.ContainsKey("file_name"), (a, b, c, d) => a.file_name.Contains(queryJson!["file_name"]))
|
||||
.WhereIF(queryJson != null && queryJson.ContainsKey("file_type"), (a, b, c, d) => a.file_type==queryJson!["file_type"])
|
||||
.Select((a, b, c, d) => new EquipFileQueryOutput
|
||||
{
|
||||
id = a.id,
|
||||
@@ -91,6 +94,8 @@ namespace Tnb.EquipMgr
|
||||
create_time = a.create_time == null ? null : a.create_time.Value.ToString("yyyy-MM-dd"),
|
||||
equip_id = d.name,
|
||||
equip_id_id = a.equip_id,
|
||||
file_ext = a.file_ext,
|
||||
file_type = a.file_type,
|
||||
file_name = a.file_name,
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
|
||||
141
ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs
Normal file
141
ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs
Normal file
@@ -0,0 +1,141 @@
|
||||
using Aop.Api.Domain;
|
||||
using JNPF;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Extras.CollectiveOAuth.Models;
|
||||
using JNPF.Extras.CollectiveOAuth.Utils;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Logging;
|
||||
using JNPF.Systems.Interfaces.Permission;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using SqlSugar.Extensions;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.Common.Redis;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
|
||||
using Result = Tnb.WarehouseMgr.Entities.Dto.Outputs.Result;
|
||||
using Tnb.BasicData;
|
||||
using Tnb.WarehouseMgr;
|
||||
|
||||
namespace Tnb.ProductionMgr
|
||||
{
|
||||
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
public class TimeWorkService : IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly ISqlSugarRepository<BasMaterial> _repository;
|
||||
private readonly IOrganizeService _organizeService;
|
||||
private readonly IBillRullService _billRullService;
|
||||
private readonly RedisData _redisData;
|
||||
private readonly IWmsEmptyOutstockService _wmsEmptyOutstockService;
|
||||
|
||||
public TimeWorkService(
|
||||
RedisData redisData,
|
||||
ISqlSugarRepository<BasMaterial> repository,
|
||||
IBillRullService billRullService,
|
||||
IOrganizeService organizeService,
|
||||
IWmsEmptyOutstockService wmsEmptyOutstockService
|
||||
)
|
||||
{
|
||||
_redisData = redisData;
|
||||
_repository = repository;
|
||||
_organizeService = organizeService;
|
||||
_billRullService = billRullService;
|
||||
_wmsEmptyOutstockService = wmsEmptyOutstockService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注塑空载具出库
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public async Task<dynamic> EmptyCarryOutStk()
|
||||
{
|
||||
bool cs01 = _redisData.Get<bool>("CallCcuEmptyin_cs01");
|
||||
bool c503 = _redisData.Get<bool>("CallCtuEmptyin c503");
|
||||
bool cs01Flag = _redisData.Get<bool>("CallCcuEmptyin_cs01_flag");
|
||||
bool c503Flag = _redisData.Get<bool>("CallCtuEmptyin c503_flag");
|
||||
if (cs01 && !cs01Flag)
|
||||
{
|
||||
MESEmptyCarryOutStkInput input = new MESEmptyCarryOutStkInput();
|
||||
input.org_id = "";
|
||||
input.location_code = "SSX-021-001";
|
||||
input.warehouse_id = WmsWareHouseConst.WAREHOUSE_ZC_ID;
|
||||
input.carrystd_id = WmsWareHouseConst.LIAOXIANGID;
|
||||
input.qty = 5;
|
||||
Log.Information($"【EmptyCarryOutStk】左输送线空箱入呼叫开始,参数:{JsonConvert.SerializeObject(input)}");
|
||||
Result result = await _wmsEmptyOutstockService.MESEmptyCarryOutStk(input);
|
||||
if (result.code == HttpStatusCode.OK)
|
||||
{
|
||||
Log.Information("【EmptyCarryOutStk】左输送线空箱入呼叫成功");
|
||||
_redisData.Set("CallCcuEmptyin_cs01_flag", true, TimeSpan.FromMinutes(20));
|
||||
}
|
||||
}
|
||||
|
||||
if (c503 && !c503Flag)
|
||||
{
|
||||
MESEmptyCarryOutStkInput input = new MESEmptyCarryOutStkInput();
|
||||
input.org_id = "";
|
||||
input.location_code = "SSX-021-003";
|
||||
input.warehouse_id = WmsWareHouseConst.WAREHOUSE_ZC_ID;
|
||||
input.carrystd_id = WmsWareHouseConst.LIAOXIANGID;
|
||||
input.qty = 5;
|
||||
Log.Information($"【EmptyCarryOutStk】右输送线空箱入呼叫开始,参数:{JsonConvert.SerializeObject(input)}");
|
||||
Result result = await _wmsEmptyOutstockService.MESEmptyCarryOutStk(input);
|
||||
if (result.code == HttpStatusCode.OK)
|
||||
{
|
||||
Log.Information("【EmptyCarryOutStk】右输送线空箱入呼叫成功");
|
||||
_redisData.Set("CallCtuEmptyin c503_flag", true, TimeSpan.FromMinutes(20));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public async Task<dynamic> FixedPointDelivery()
|
||||
{
|
||||
bool value = _redisData.Get<bool>("DB100.132.0");
|
||||
bool valueFlag = _redisData.Get<bool>("DB100.132.0_flag");
|
||||
if (value && !valueFlag)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
Dictionary<String, Object> postData = new Dictionary<string, object>();
|
||||
|
||||
|
||||
Dictionary<string, object> header = new()
|
||||
{
|
||||
["Authorization"] = App.HttpContext != null ? App.HttpContext.Request.Headers["Authorization"] : ""
|
||||
};
|
||||
BasFactoryConfig config = await db.Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.DOMAIN);
|
||||
string sendResult = HttpUtils.RequestPost($"{config.value}/api/visualdev/OnlineDev/{ModuleConsts.MODULE_WMSDELIVERYPDA_ID}", JsonConvert.SerializeObject(postData), header);
|
||||
|
||||
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
|
||||
if(authResponse.code == 200 && authResponse.data.ObjToBool())
|
||||
{
|
||||
Log.Information("【FixedPointDelivery】注塑定点配送成功");
|
||||
_redisData.Set("DB100.132.0_flag", true, TimeSpan.FromMinutes(20));
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Information(sendResult);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -322,5 +322,9 @@
|
||||
/// 一楼中储仓出库工位
|
||||
/// </summary>
|
||||
public const string ZZCSSX111012 = "32609251845653";
|
||||
/// <summary>
|
||||
/// 料箱id
|
||||
/// </summary>
|
||||
public const string LIAOXIANGID = "26037262680357";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user