Conflicts:
	BasicData/Tnb.BasicData.Entities/Entity/BasMaterial.cs
This commit is contained in:
2024-05-24 14:33:09 +08:00
6 changed files with 172 additions and 18 deletions

View File

@@ -269,9 +269,13 @@ public partial class BasMaterial : BaseEntity<string>
/// </summary>
public int? deleted { get; set; }
/// <summary>
/// 箱号
/// </summary>
public string container_no { get; set; }
/// <summary>
/// 规格型号
/// </summary>
public string? material_specification { get; set; }
}

View File

@@ -174,7 +174,18 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
/// 入库库位编号
/// </summary>
public string? as_location_code { get; set; }
/// <summary>
/// 规格型号
/// </summary>
public string material_standard { get; set; }
/// <summary>
/// 箱号
/// </summary>
public string container_no { get; set; }
/// <summary>
/// di编码
/// </summary>
public string di { get; set; }
}
}

View File

@@ -2784,6 +2784,35 @@ namespace Tnb.ProductionMgr
return prdMoTask;
}
/// <summary>
/// 根据chanxian 获取进行中的任务单信息
/// </summary>
/// <param name="dic"></param>
/// <returns></returns>
[HttpPost]
public async Task<PrdMoTask> GetPrdMoTaskInfoByWorklineId(Dictionary<string, string> dic)
{
string workline_id = dic.ContainsKey("workline_id") ? dic["workline_id"] : "";
if (string.IsNullOrEmpty(workline_id))
{
throw Oops.Bah("产线错误");
}
PrdMoTask? prdMoTask = await _db.Queryable<PrdMoTask>().Where(x => x.workline_id == workline_id && x.parent_id == null && x.mo_task_status == DictConst.InProgressEnCode).FirstAsync();
PrdMoTask? childPrdMoTask = null;
if (prdMoTask != null)
{
childPrdMoTask = await _db.Queryable<PrdMoTask>().Where(x => x.parent_id == prdMoTask.id && x.mo_task_status == DictConst.InProgressEnCode).FirstAsync();
if (childPrdMoTask != null)
{
BasMaterial basMaterial = await _db.Queryable<BasMaterial>().SingleAsync(x => x.id == prdMoTask.material_id);
childPrdMoTask.material_name = basMaterial.name;
}
}
return childPrdMoTask;
}
/// <summary>
/// 根据工位获取进行中待开工暂停的任务单信息
/// </summary>
@@ -2910,12 +2939,59 @@ namespace Tnb.ProductionMgr
public async Task<dynamic> GetLabelInfo(MarkingLabelInput input)
{
Log.Information($"获取喷码贴标信息参数:{JsonConvert.SerializeObject(input)}");
Dictionary<String, String> dic = new Dictionary<string, string>()
{
["WBZX1"] = "30019971917589",//血路管自动生产线1线
["WBZX2"] = "123",
["WBZX3"] = "123",
};
if (dic.TryGetValue(input.result, out string worklineId))
{
if (worklineId != null && !worklineId.IsEmpty())
{
PrdMoTask prdMoTask = await GetPrdMoTaskInfoByWorklineId(new Dictionary<string, string>()
{
{ "workline_id", worklineId }
});
if (prdMoTask == null) throw Oops.Bah("没找到对应任务单");
return "(01)16945155732691(11)240510(17)270510(10)24053026#TX-JB-12*24053026*202405*1020270510RJ-A1F3NC2";
if (await _db.Queryable<PrdOutPackMarkLabel>().Where(x =>
x.mo_task_code == prdMoTask.mo_task_code && x.status == "0" && x.is_label == null && x.is_mark==0).AnyAsync())
{
await _db.Updateable<PrdOutPackMarkLabel>()
.SetColumns(x => x.is_label == 0)
.Where(x => x.mo_task_code == prdMoTask.mo_task_code && x.status == "0" && x.is_label == null &&
x.is_mark == 0)
.ExecuteCommandAsync();
}
else
{
PrdOutPackMarkLabel prdOutPackMarkLabel = new PrdOutPackMarkLabel()
{
is_mark = null,
is_label = 0,
mo_task_code = prdMoTask.mo_task_code,
material_code = prdMoTask.material_code,
create_time = DateTime.Now,
};
await _db.Insertable<PrdOutPackMarkLabel>(prdOutPackMarkLabel).ExecuteCommandAsync();
}
PrdMoTask parent = await _db.Queryable<PrdMoTask>().SingleAsync(x => x.id == prdMoTask.parent_id);
BasMaterial basMaterial = await _db.Queryable<BasMaterial>().SingleAsync(x=>x.id==parent.material_id);
string code = $"(01){basMaterial.di ?? ""}(11){DateTime.Now.ToString("yyMMdd")}(17){DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyMMdd")}(10){parent.batch??""}#{basMaterial.material_standard}*{DateTime.Now.ToString("yyyyMMdd")}*{DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyyyMMdd")}*{basMaterial.container_no}";
return code;
}
}
// return "(01)16945155732691(11)240510(17)270510(10)24053026#TX-JB-12*24053026*202405*1020270510RJ-A1F3NC2";
return "";
}
/// <summary>
/// 觉设备判定
/// 觉设备判定
/// </summary>
/// <returns></returns>
[HttpPost]

View File

@@ -436,6 +436,9 @@ namespace Tnb.ProductionMgr
material_id = a.material_id,
material_code = b.code,
material_name = b.name,
material_standard = b.material_standard,
container_no = b.container_no,
di = b.di,
workline_id = a.workline_id,
workline_name = d.FullName,
bom_id = a.bom_id,

View File

@@ -93,12 +93,14 @@ namespace Tnb.ProductionMgr
string result = "";
bool? cs01 = await _redisData.TryGetValueByKeyField<bool?>("YTCS", "CallCtuEmptyIn_CS01");
bool? cs03 = await _redisData.TryGetValueByKeyField<bool?>("YTCS", "CallCtuEmptyIn_CS03");
bool? cs06 = await _redisData.TryGetValueByKeyField<bool?>("YTCS", "CallCtuEmptyIn_CS06");
bool cs01Flag = _redisData.Get<bool>("YTCS_CallCtuEmptyIn_CS01_flag");
bool cs03Flag = _redisData.Get<bool>("YTCS_CallCtuEmptyIn_CS03_flag");
bool cs06Flag = _redisData.Get<bool>("YTCS_CallCtuEmptyIn_CS06_flag");
if (cs01==true && !cs01Flag)
{
BasFactoryConfig config = await _repository.AsSugarClient().Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.DOMAIN);
string response = HttpUtils.RequestGet($"{config.value}/api/production/time-work/empty-carry-out-stk-left");
string response = HttpUtils.RequestGet($"{config.value}/api/production/time-work/empty-carry-out-stk-ctu1");
// 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();
@@ -107,7 +109,16 @@ namespace Tnb.ProductionMgr
if (cs03==true && !cs03Flag)
{
BasFactoryConfig config = await _repository.AsSugarClient().Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.DOMAIN);
string response = HttpUtils.RequestGet($"{config.value}/api/production/time-work/empty-carry-out-stk-right");
string response = HttpUtils.RequestGet($"{config.value}/api/production/time-work/empty-carry-out-stk-ctu3");
// 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();
}
if (cs06==true && !cs06Flag)
{
BasFactoryConfig config = await _repository.AsSugarClient().Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.DOMAIN);
string response = HttpUtils.RequestGet($"{config.value}/api/production/time-work/empty-carry-out-stk-ctu6");
// 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();
@@ -118,7 +129,7 @@ namespace Tnb.ProductionMgr
[HttpGet]
[AllowAnonymous]
public async Task<string> EmptyCarryOutStkLeft()
public async Task<string> EmptyCarryOutStkCtu1()
{
string msg = "";
MESEmptyCarryOutStkInput input = new MESEmptyCarryOutStkInput();
@@ -128,25 +139,25 @@ namespace Tnb.ProductionMgr
input.carrystd_id = WmsWareHouseConst.LIAOXIANGID;
input.qty = 1;
input.create_id = WmsWareHouseConst.AdministratorUserId;
Log.Information($"【EmptyCarryOutStk】左输送线空箱入呼叫开始,参数:{JsonConvert.SerializeObject(input)}");
Log.Information($"【EmptyCarryOutStk】ctu1空箱入呼叫开始,参数:{JsonConvert.SerializeObject(input)}");
Result result = await _wmsEmptyOutstockService.MESEmptyCarryOutStk(input);
if (result.code == HttpStatusCode.OK)
{
msg = "左输送线空箱入呼叫成功";
Log.Information("【EmptyCarryOutStk】左输送线空箱入呼叫成功");
msg = "ctu1空箱入呼叫成功";
Log.Information("【EmptyCarryOutStk】ctu1空箱入呼叫成功");
//_redisData.Set("YTCS_CallCtuEmptyIn_CS01_flag", true, TimeSpan.FromMinutes(20));
}
else
{
msg = $"左输送线空箱入呼叫失败:{result.msg}";
Log.Error($"【EmptyCarryOutStk】左输送线空箱入呼叫失败:{result.msg}");
msg = $"ctu1空箱入呼叫失败:{result.msg}";
Log.Error($"【EmptyCarryOutStk】ctu1空箱入呼叫失败:{result.msg}");
}
return msg;
}
[HttpGet]
[AllowAnonymous]
public async Task<string> EmptyCarryOutStkRight()
public async Task<string> EmptyCarryOutStkCtu3()
{
string msg = "";
MESEmptyCarryOutStkInput input = new MESEmptyCarryOutStkInput();
@@ -156,18 +167,46 @@ namespace Tnb.ProductionMgr
input.carrystd_id = WmsWareHouseConst.LIAOXIANGID;
input.qty = 1;
input.create_id = WmsWareHouseConst.AdministratorUserId;
Log.Information($"【EmptyCarryOutStk】右输送线空箱入呼叫开始,参数:{JsonConvert.SerializeObject(input)}");
Log.Information($"【EmptyCarryOutStk】ctu3空箱入呼叫开始,参数:{JsonConvert.SerializeObject(input)}");
Result result = await _wmsEmptyOutstockService.MESEmptyCarryOutStk(input);
if (result.code == HttpStatusCode.OK)
{
msg = "右输送线空箱入呼叫成功";
Log.Information("【EmptyCarryOutStk】右输送线空箱入呼叫成功");
msg = "ctu3空箱入呼叫成功";
Log.Information("【EmptyCarryOutStk】ctu3空箱入呼叫成功");
//_redisData.Set("YTCS_CallCtuEmptyIn_CS03_flag", true, TimeSpan.FromMinutes(20));
}
else
{
msg = $"右输送线空箱入呼叫失败:{result.msg}";
Log.Error($"【EmptyCarryOutStk】右输送线空箱入呼叫失败:{result.msg}");
msg = $"ctu3空箱入呼叫失败:{result.msg}";
Log.Error($"【EmptyCarryOutStk】ctu3空箱入呼叫失败:{result.msg}");
}
return msg;
}
[HttpGet]
[AllowAnonymous]
public async Task<string> EmptyCarryOutStkCtu6()
{
string msg = "";
MESEmptyCarryOutStkInput input = new MESEmptyCarryOutStkInput();
input.org_id = WmsWareHouseConst.AdministratorOrgId;
input.location_code = "SSX-011-006";
input.warehouse_id = WmsWareHouseConst.WAREHOUSE_ZC_ID;
input.carrystd_id = WmsWareHouseConst.LIAOXIANGID;
input.qty = 1;
input.create_id = WmsWareHouseConst.AdministratorUserId;
Log.Information($"【EmptyCarryOutStk】ctu6空箱入呼叫开始,参数:{JsonConvert.SerializeObject(input)}");
Result result = await _wmsEmptyOutstockService.MESEmptyCarryOutStk(input);
if (result.code == HttpStatusCode.OK)
{
msg = "ctu6空箱入呼叫成功";
Log.Information("【EmptyCarryOutStk】ctu6空箱入呼叫成功");
//_redisData.Set("YTCS_CallCtuEmptyIn_CS03_flag", true, TimeSpan.FromMinutes(20));
}
else
{
msg = $"ctu6空箱入呼叫失败:{result.msg}";
Log.Error($"【EmptyCarryOutStk】ctu6空箱入呼叫失败:{result.msg}");
}
return msg;
}

View File

@@ -0,0 +1,21 @@
namespace Tnb.WarehouseMgr.Entities.Dto
{
/// <summary>
/// 库房业务更新输入参数
/// </summary>
public class MaterialTransferGetMaterialInventoryInput
{
/// <summary>
/// 托盘数
/// </summary>
public int palletCount { get; set; }
/// <summary>
/// 物料id
/// </summary>
public string? material_id { get; set; }
/// <summary>
/// 批次
/// </summary>
public string? code_batch { get; set; }
}
}