This commit is contained in:
2024-05-23 00:33:42 +08:00
7 changed files with 132 additions and 62 deletions

View File

@@ -4,5 +4,6 @@ namespace Tnb.PerMgr.Entities.Dto
{
public string? id { get; set; }
public string? label_name { get; set; }
public string? label_point { get; set; }
}
}

View File

@@ -49,6 +49,7 @@ namespace Tnb.PerMgr
{
id = a.id,
label_name = a.label_name,
label_point = a.label_point,
}),
children = SqlFunc.Subqueryable<PerProcessParam>()
.LeftJoin<PerToleranceCategory>((y, z) => y.tolerance_category_id == z.id)

View File

@@ -31,7 +31,7 @@ using Tnb.WarehouseMgr.Entities.Dto.Inputs;
namespace Tnb.ProductionMgr
{
/// <summary>
/// mes<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/// mes生产入库申请
/// </summary>
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
[Route("api/[area]/[controller]/[action]")]
@@ -111,7 +111,7 @@ namespace Tnb.ProductionMgr
if (string.IsNullOrEmpty(input.station_id))
{
throw Oops.Bah("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ");
throw Oops.Bah("请先选择工位");
}
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
@@ -225,11 +225,11 @@ namespace Tnb.ProductionMgr
});
}
return !result2.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result2.IsSuccess ? "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>" : result2.ErrorMessage);
return !result2.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result2.IsSuccess ? "保存成功" : result2.ErrorMessage);
}
/// <summary>
/// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD>
/// 入库申请同步
/// </summary>
/// <param name="dic">source_id</param>
/// <returns></returns>
@@ -259,7 +259,7 @@ namespace Tnb.ProductionMgr
}
/// <summary>
/// ע<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>䵽λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/// 注塑满箱到位后入库申请
/// </summary>
/// <param name="inut"></param>
/// <returns></returns>
@@ -272,12 +272,12 @@ namespace Tnb.ProductionMgr
string warehouse_id = "2";
if (string.IsNullOrEmpty(equip_code))
{
throw Oops.Bah("<EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD><EFBFBD>");
throw Oops.Bah("请传机台号");
}
if (string.IsNullOrEmpty(label_code))
{
throw Oops.Bah("<EFBFBD><EFBFBD><EFBFBD>ǩ<EFBFBD><EFBFBD>");
throw Oops.Bah("请传标签号");
}
ISqlSugarClient db = _repository.AsSugarClient();
@@ -286,7 +286,7 @@ namespace Tnb.ProductionMgr
{
equipment = await db.Queryable<EqpEquipment>()
.LeftJoin<EqpDaq>((x, y) => x.id == y.equip_id)
.Where((x, y) => y.equip_code == equip_code && y.label_name == label_code && y.label_point == <>ܿ<EFBFBD><DCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
.Where((x, y) => y.equip_code == equip_code && y.label_point == label_code && y.label_name.Contains("注塑空满箱请求"))
.Select((x, y) => x)
.FirstAsync();
}
@@ -297,18 +297,18 @@ namespace Tnb.ProductionMgr
}
if (equipment == null)
{
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD>̨");
throw Oops.Bah("未找到机台");
}
if (string.IsNullOrEmpty(equipment.as_location_id))
{
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ");
throw Oops.Bah("未找到入库库位");
}
BasLocation basLocation = await db.Queryable<BasLocation>().SingleAsync(x => x.id == equipment.as_location_id);
if (basLocation == null)
{
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ");
throw Oops.Bah("未找到入库库位");
}
PrdReport prdReport = await db.Queryable<PrdReport>()
@@ -319,7 +319,7 @@ namespace Tnb.ProductionMgr
string org_id = user.OrganizeId;
if (prdReport == null)
{
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼");
throw Oops.Bah("未找到提报记录");
}
@@ -423,18 +423,18 @@ namespace Tnb.ProductionMgr
{
_ = await db.Insertable<PrdInstockD>(prdInstockDs).ExecuteCommandAsync();
}
//todo <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>޸<EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼״̬
//todo 入库申请后是否修改提报记录状态
});
}
return !result2.IsSuccess ? string.IsNullOrEmpty(result2.ErrorMessage) ? throw Oops.Oh(ErrorCode.COM1008) : throw Oops.Bah(result2.ErrorMessage) : "<EFBFBD>ɹ<EFBFBD>";
return !result2.IsSuccess ? string.IsNullOrEmpty(result2.ErrorMessage) ? throw Oops.Oh(ErrorCode.COM1008) : throw Oops.Bah(result2.ErrorMessage) : "成功";
}
// [HttpPost]
// public async Task<string> InstockTubeOne(PrdReport prdReport)
// {
// ISqlSugarClient db = _repository.AsSugarClient();
// string location_code = "ZCR01";//todo <EFBFBD>̹ܼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ֮<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// string location_code = "ZCR01";//todo 短管挤出件目标库位之后改
// string warehouse_id = "2";
//
// PrdInstockH? prdInstockH = null;
@@ -548,17 +548,17 @@ namespace Tnb.ProductionMgr
string label_code = input.label_code;
if (string.IsNullOrEmpty(equip_code))
{
throw Oops.Bah("<EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD><EFBFBD>");
throw Oops.Bah("请传机台号");
}
if (string.IsNullOrEmpty(label_code))
{
throw Oops.Bah("<EFBFBD><EFBFBD><EFBFBD>ǩ<EFBFBD><EFBFBD>");
throw Oops.Bah("请传标签号");
}
ISqlSugarClient db = _repository.AsSugarClient();
// string location_code = "ZCR01";//todo <EFBFBD>̹ܼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ֮<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//todo <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٸ<EFBFBD>
// string location_code = "ZCR01";//todo 短管挤出件目标库位之后改
//todo 入库仓库确定后再改
string warehouse_id = "2";
PrdInstockH? prdInstockH = null;
@@ -569,7 +569,7 @@ namespace Tnb.ProductionMgr
{
equipment = await db.Queryable<EqpEquipment>()
.LeftJoin<EqpDaq>((x, y) => x.id == y.equip_id)
.Where((x, y) => y.equip_code == equip_code && y.label_name == label_code && y.label_point == "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
.Where((x, y) => y.equip_code == equip_code && y.label_point == label_code && y.label_name.Contains("挤出空满箱请求"))
.Select((x, y) => x)
.FirstAsync();
}
@@ -580,18 +580,18 @@ namespace Tnb.ProductionMgr
}
if (equipment == null)
{
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD>̨");
throw Oops.Bah("未找到机台");
}
if (string.IsNullOrEmpty(equipment.as_location_id))
{
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ");
throw Oops.Bah("未找到入库库位");
}
BasLocation basLocation = await db.Queryable<BasLocation>().SingleAsync(x => x.id == equipment.as_location_id);
if (basLocation == null)
{
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ");
throw Oops.Bah("未找到入库库位");
}
string location_code = basLocation.location_code;
@@ -703,11 +703,11 @@ namespace Tnb.ProductionMgr
});
}
return !result2.IsSuccess ? string.IsNullOrEmpty(result2.ErrorMessage) ? throw Oops.Oh(ErrorCode.COM1008) : throw Oops.Bah(result2.ErrorMessage) : "<EFBFBD>ɹ<EFBFBD>";
return !result2.IsSuccess ? string.IsNullOrEmpty(result2.ErrorMessage) ? throw Oops.Oh(ErrorCode.COM1008) : throw Oops.Bah(result2.ErrorMessage) : "成功";
}
/// <summary>
/// <EFBFBD><EFBFBD><EFBFBD>ܹܼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/// 长管管挤出入库申请
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
@@ -715,7 +715,7 @@ namespace Tnb.ProductionMgr
{
ISqlSugarClient db = _repository.AsSugarClient();
string location_code = prdReport.location_code;
string warehouse_id = "27209786980373";//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
string warehouse_id = "27209786980373";//长件挤出缓存仓
PrdInstockH? prdInstockH = null;
List<PrdInstockD> prdInstockDs = new() { };
@@ -819,11 +819,11 @@ namespace Tnb.ProductionMgr
});
}
return !result2.IsSuccess ? string.IsNullOrEmpty(result2.ErrorMessage) ? throw Oops.Oh(ErrorCode.COM1008) : throw Oops.Bah(result2.ErrorMessage) : "<EFBFBD>ɹ<EFBFBD>";
return !result2.IsSuccess ? string.IsNullOrEmpty(result2.ErrorMessage) ? throw Oops.Oh(ErrorCode.COM1008) : throw Oops.Bah(result2.ErrorMessage) : "成功";
}
/// <summary>
/// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/// 外包装入库申请
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
@@ -831,39 +831,39 @@ namespace Tnb.ProductionMgr
{
string equip_code = input.equip_code;
string label_code = input.label_code;
string warehouse_id = "26103367464997";//<EFBFBD><EFBFBD>¥<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
string warehouse_id = "26103367464997";//四楼解析库
if (!string.IsNullOrEmpty(equip_code))
{
throw Oops.Bah("<EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD><EFBFBD>");
throw Oops.Bah("请传机台号");
}
if (!string.IsNullOrEmpty(label_code))
{
throw Oops.Bah("<EFBFBD><EFBFBD><EFBFBD>ǩ<EFBFBD><EFBFBD>");
throw Oops.Bah("请传标签号");
}
ISqlSugarClient db = _repository.AsSugarClient();
EqpEquipment equipment = await db.Queryable<EqpEquipment>()
.LeftJoin<EqpDaq>((x, y) => x.id == y.equip_id)
.Where((x, y) => y.equip_code == equip_code && y.label_name == label_code && y.label_point == "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD>Ʒ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ")
.Where((x, y) => y.equip_code == equip_code && y.label_point == label_code && y.label_name == "外包装成品码垛点位")
.Select((x, y) => x)
.FirstAsync();
if (equipment == null)
{
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD>̨");
throw Oops.Bah("未找到机台");
}
if (string.IsNullOrEmpty(equipment.as_location_id))
{
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ");
throw Oops.Bah("未找到入库库位");
}
BasLocation basLocation = await db.Queryable<BasLocation>().SingleAsync(x => x.id == equipment.as_location_id);
if (basLocation == null)
{
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ");
throw Oops.Bah("未找到入库库位");
}
OrganizeEntity station = await db.Queryable<OrganizeEntity>()
@@ -872,19 +872,19 @@ namespace Tnb.ProductionMgr
if (station == null)
{
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD>λ");
throw Oops.Bah("未找到工位");
}
PrdOutPacking prdOutPacking = await db.Queryable<PrdOutPacking>().Where(x => x.station_id == station.Id && x.status == "0").OrderByDescending(x => x.create_time).FirstAsync();
if (prdOutPacking == null)
{
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
throw Oops.Bah("未找到托盘");
}
var prdOutPackMarkLabelList = await db.Queryable<PrdOutPackMarkLabel>().Where(x => x.station_id == station.Id && x.status == "1").ToListAsync();
if (prdOutPackMarkLabelList == null || prdOutPackMarkLabelList.Count <= 0)
{
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼");
throw Oops.Bah("未找到提报记录");
}
List<string> reportIds = prdOutPackMarkLabelList.Select(x => x.report_id).ToList();
@@ -894,7 +894,7 @@ namespace Tnb.ProductionMgr
if (prdReports == null || prdReports.Count <= 0)
{
throw Oops.Bah("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼");
throw Oops.Bah("未找到提报记录");
}
string create_id = prdReports[0].create_id;
UserEntity user = await db.Queryable<UserEntity>().SingleAsync(x => x.Id == create_id);
@@ -1014,11 +1014,11 @@ namespace Tnb.ProductionMgr
.SetColumns(x => x.status == "2")
.Where(x => x.station_id == station.Id && x.status == "1").ExecuteCommandAsync();
//todo <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>޸<EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼״̬
//todo 入库申请后是否修改提报记录状态
});
}
return !result2.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result2.IsSuccess ? "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>" : result2.ErrorMessage);
return !result2.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result2.IsSuccess ? "申请成功" : result2.ErrorMessage);
}
}
}

View File

@@ -786,8 +786,9 @@ namespace Tnb.ProductionMgr
await db.Ado.CommitTranAsync();
}
catch (Exception)
catch (Exception e)
{
Log.Error(e.Message,e);
await db.Ado.RollbackTranAsync();
}
}

View File

@@ -420,7 +420,7 @@ namespace Tnb.ProductionMgr
.LeftJoin<BasStandardTime>((a, b, c, d, e, f, g, h, i) => a.process_id == i.process_id && i.enabled == 1 && a.schedule_type==1)
.LeftJoin<PrdMo>((a, b, c, d, e, f, g, h, i, j) => a.mo_id == j.id)
.LeftJoin<BasMaterialUnit>((a, b, c, d, e, f, g, h, i, j, k) => a.material_id == k.material_id && k.auxiliary_unit_id == "kg")
.LeftJoin<EqpDaq>((a, b, c, d, e, f, g, h, i, j, k, l) => a.eqp_id == l.equip_id && l.enabled == 1 && l.label_point == "注塑空满箱请求")
.LeftJoin<EqpDaq>((a, b, c, d, e, f, g, h, i, j, k, l) => a.eqp_id == l.equip_id && l.enabled == 1 && l.label_name.Contains("允许称重"))//注塑空满箱请求
.Where((a, b) => a.workstation_id == input.stationId)
.WhereIF(!string.IsNullOrEmpty(mo_task_code), a => a.mo_task_code.Contains(mo_task_code))
//.WhereIF(!string.IsNullOrEmpty(mo_task_status),a=>a.mo_task_status==mo_task_status)
@@ -468,7 +468,7 @@ namespace Tnb.ProductionMgr
main_num = k.number_of_primary_unit,
deputy_num = k.number_of_auxiliary_unit,
third_equip_code = l.equip_code,
weight_name = l.label_name,
weight_name = l.label_point,
category_id = b.category_id,
as_location_id = f.as_location_id
})

View File

@@ -1,18 +1,24 @@
using System.Reflection;
using JNPF;
using JNPF.Common.Cache;
using JNPF.Common.Dtos.VisualDev;
using JNPF.Common.Security;
using JNPF.DependencyInjection;
using JNPF.DynamicApiController;
using JNPF.FriendlyException;
using JNPF.Logging;
using JNPF.VisualDev;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using SqlSugar;
using Tnb.Common.Extension;
using Tnb.Common.Redis;
using Tnb.ProductionMgr.Entities;
using Tnb.ProductionMgr.Interfaces;
using Tnb.WarehouseMgr.Entities.Configs;
using Tnb.Common.Utils;
using Tnb.EquipMgr.Entities;
namespace Tnb.ProductionMgr
{
@@ -27,6 +33,7 @@ namespace Tnb.ProductionMgr
private const string ModuleId = "30062789830933";
private readonly RedisData _redisData;
private readonly ISqlSugarRepository<RedisReadConfig> _repository;
private readonly ElevatorControlConfiguration _eleCtlCfg = App.Configuration.Build<ElevatorControlConfiguration>();
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
public RedisDataService(RedisData redisData, ISqlSugarRepository<RedisReadConfig> repository)
{
@@ -54,14 +61,60 @@ namespace Tnb.ProductionMgr
[HttpPost]
public async Task<dynamic> GetWeight(string device, string jihao)
{
bool flag = await _redisData.HashExist(device, jihao);
EqpDaq eqpDaq1 = await _repository.AsSugarClient().Queryable<EqpDaq>().Where(x => x.equip_code == device && x.label_name.Contains("允许称重")).FirstAsync();
if (eqpDaq1 == null)
{
throw Oops.Bah("未在数据采集中设置允许称重标签点");
}
Dictionary<string, string> dicCommand = new(StringComparer.OrdinalIgnoreCase)
{
["DevName"] = device,
["token"] = _eleCtlCfg.token,
["TagName"] = eqpDaq1.label_point,
["Value"] = "true",
};
Log.Information($"确认称重参数:{JsonConvert.SerializeObject(dicCommand)}");
var str = await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand);
EqpDaq eqpDaq2 = await _repository.AsSugarClient().Queryable<EqpDaq>().Where(x => x.equip_code == device && x.label_name.Contains("当前重量")).FirstAsync();
if (eqpDaq2 == null)
{
throw Oops.Bah("未在数据采集中设置当前重量标签点");
}
bool flag = await _redisData.HashExist(device, eqpDaq2.label_point);
if (!flag)
{
throw Oops.Bah("没有找到" + device + "----" + jihao + "的数据");
throw Oops.Bah("没有找到" + device + "----" + eqpDaq2.label_point + "的数据");
}
string data = await _redisData.GetHash(device, jihao);
string data = await _redisData.GetHash(device, eqpDaq2.label_point);
JObject? res = JsonConvert.DeserializeObject<JObject>(data);
decimal result = res != null && res["Value"] != null ? decimal.Parse(res["Value"]!.ToString()) : throw Oops.Bah("数据格式错误");
if (result > 0)
{
EqpDaq eqpDaq3 = await _repository.AsSugarClient().Queryable<EqpDaq>().Where(x => x.equip_code == device && x.label_name.Contains("称重完成")).FirstAsync();
if (eqpDaq3 == null)
{
throw Oops.Bah("未在数据采集中设置称重完成标签点");
}
Dictionary<string, string> dicCommand2 = new(StringComparer.OrdinalIgnoreCase)
{
["DevName"] = device,
["token"] = _eleCtlCfg.token,
["TagName"] = eqpDaq3.label_point,
["Value"] = "false",
};
Log.Information($"称重完成参数:{JsonConvert.SerializeObject(dicCommand)}");
for (int i = 0; i < 5; i++)
{
await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand);
}
}
return result;
}
}

View File

@@ -88,8 +88,9 @@ namespace Tnb.ProductionMgr
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
public async Task<dynamic> EmptyCarryOutStk()
public async Task<string> EmptyCarryOutStk()
{
string result = "";
bool? cs01 = await _redisData.TryGetValueByKeyField<bool?>("YTCS", "CallCtuEmptyIn_CS01");
bool? cs03 = await _redisData.TryGetValueByKeyField<bool?>("YTCS", "CallCtuEmptyIn_CS03");
bool cs01Flag = _redisData.Get<bool>("YTCS_CallCtuEmptyIn_CS01_flag");
@@ -97,24 +98,29 @@ namespace Tnb.ProductionMgr
if (cs01==true && !cs01Flag)
{
BasFactoryConfig config = await _repository.AsSugarClient().Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.DOMAIN);
HttpUtils.RequestGet($"{config.value}/api/production/time-work/empty-carry-out-stk-left");
// HttpUtils.RequestGet($"http://localhost:9232/api/production/time-work/empty-carry-out-stk-left");
string response = HttpUtils.RequestGet($"{config.value}/api/production/time-work/empty-carry-out-stk-left");
// string response = HttpUtils.RequestGet($"http://localhost:9232/api/production/time-work/empty-carry-out-stk-left");
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(response);
result += authResponse.data.ToString();
}
if (cs03==true && !cs03Flag)
{
BasFactoryConfig config = await _repository.AsSugarClient().Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.DOMAIN);
HttpUtils.RequestGet($"{config.value}/api/production/time-work/empty-carry-out-stk-right");
// HttpUtils.RequestGet($"http://localhost:9232/api/production/time-work/empty-carry-out-stk-right");
string response = HttpUtils.RequestGet($"{config.value}/api/production/time-work/empty-carry-out-stk-right");
// string response = HttpUtils.RequestGet($"http://localhost:9232/api/production/time-work/empty-carry-out-stk-right");
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(response);
result += authResponse.data.ToString();
}
return Task.CompletedTask;
return result;
}
[HttpGet]
[AllowAnonymous]
public async Task<dynamic> EmptyCarryOutStkLeft()
public async Task<string> EmptyCarryOutStkLeft()
{
string msg = "";
MESEmptyCarryOutStkInput input = new MESEmptyCarryOutStkInput();
input.org_id = WmsWareHouseConst.AdministratorOrgId;
input.location_code = "SSX-021-001";
@@ -126,20 +132,23 @@ namespace Tnb.ProductionMgr
Result result = await _wmsEmptyOutstockService.MESEmptyCarryOutStk(input);
if (result.code == HttpStatusCode.OK)
{
msg = "左输送线空箱入呼叫成功";
Log.Information("【EmptyCarryOutStk】左输送线空箱入呼叫成功");
//_redisData.Set("YTCS_CallCtuEmptyIn_CS01_flag", true, TimeSpan.FromMinutes(20));
}
else
{
msg = $"左输送线空箱入呼叫失败:{result.msg}";
Log.Error($"【EmptyCarryOutStk】左输送线空箱入呼叫失败:{result.msg}");
}
return Task.CompletedTask;
return msg;
}
[HttpGet]
[AllowAnonymous]
public async Task<dynamic> EmptyCarryOutStkRight()
public async Task<string> EmptyCarryOutStkRight()
{
string msg = "";
MESEmptyCarryOutStkInput input = new MESEmptyCarryOutStkInput();
input.org_id = WmsWareHouseConst.AdministratorOrgId;
input.location_code = "SSX-021-003";
@@ -151,20 +160,23 @@ namespace Tnb.ProductionMgr
Result result = await _wmsEmptyOutstockService.MESEmptyCarryOutStk(input);
if (result.code == HttpStatusCode.OK)
{
msg = "右输送线空箱入呼叫成功";
Log.Information("【EmptyCarryOutStk】右输送线空箱入呼叫成功");
//_redisData.Set("YTCS_CallCtuEmptyIn_CS03_flag", true, TimeSpan.FromMinutes(20));
}
else
{
msg = $"右输送线空箱入呼叫失败:{result.msg}";
Log.Error($"【EmptyCarryOutStk】右输送线空箱入呼叫失败:{result.msg}");
}
return Task.CompletedTask;
return msg;
}
[HttpGet]
[AllowAnonymous]
public async Task<dynamic> FixedPointDelivery()
public async Task<string> FixedPointDelivery()
{
string msg = "";
bool? value = await _redisData.TryGetValueByKeyField<bool?>("hxjC", "DB100.132.3");
bool valueFlag = _redisData.Get<bool>("hxjC_DB100.132.3_flag");
if (value==true && !valueFlag)
@@ -175,7 +187,7 @@ namespace Tnb.ProductionMgr
if (startLocationCode.IsEmpty())
{
Log.Error($"起始库位为空");
return Task.CompletedTask;
return "起始库位为空";
}
var db = _repository.AsSugarClient();
@@ -184,7 +196,7 @@ namespace Tnb.ProductionMgr
if (equipment == null)
{
Log.Error($"未找到设备编号为TYZS001的设备");
return Task.CompletedTask;
return "未找到设备编号为TYZS001的设备";
}
CommonCreatePretaskInput postData = new CommonCreatePretaskInput();
@@ -195,21 +207,23 @@ namespace Tnb.ProductionMgr
Log.Information($"【FixedPointDelivery】注塑定点配送,参数:{JsonConvert.SerializeObject(postData)}");
BasFactoryConfig config = await db.Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.DOMAIN);
string sendResult = HttpUtils.RequestPost($"{config.value}/api/wms/ware-house/common-create-pretask", JsonConvert.SerializeObject(postData), null);
// string sendResult = HttpUtils.RequestPost($"http://localhost:9232/api/wms/ware-house/common-create-pretask", JsonConvert.SerializeObject(postData), null);
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
if(authResponse.code == 200 && authResponse.data.ObjToBool())
{
msg = "注塑定点配送成功";
Log.Information("【FixedPointDelivery】注塑定点配送成功");
//_redisData.Set("hxjC_DB100.132.3_flag", true, TimeSpan.FromMinutes(20));
}
else
{
msg = $"注塑定点配送失败:{authResponse.msg}";
Log.Error($"【FixedPointDelivery】注塑定点配送失败:{authResponse.msg}");
}
}
return Task.CompletedTask;
return msg;
}
}