This commit is contained in:
2023-11-22 17:33:12 +08:00
parent d09d2c6370
commit 88e6fb700e
4 changed files with 18 additions and 14 deletions

View File

@@ -310,6 +310,8 @@ namespace Tnb.ProductionMgr
.Where(x => x.equip_id == equipment.id && x.status == 0).OrderByDescending(x => x.create_time)
.FirstAsync();
string create_id = prdReport.create_id;
UserEntity user = await db.Queryable<UserEntity>().SingleAsync(x => x.Id == create_id);
string org_id = user.OrganizeId;
if (prdReport == null)
{
throw Oops.Bah("未找到提报记录");
@@ -335,7 +337,7 @@ namespace Tnb.ProductionMgr
station_id = prdReport.station,
workline_id = workline?.Id ?? "",
workshop_id = workshop?.Id ?? "",
// org_id = _userManager.GetUserInfo().Result.organizeId,
org_id = org_id,
// warehouse_id = basLocation?.wh_id,
warehouse_id = warehouse_id,
status = 0,
@@ -349,7 +351,7 @@ namespace Tnb.ProductionMgr
material_code = basMaterial.code,
unit_id = prdReport.unit_id,
barcode = prdReport.barcode,
code_batch = prdReport.barcode + "0001",
code_batch = prdReport.mo_task_code,
quantity = (int)prdReport.reported_qty,
});
});
@@ -360,7 +362,7 @@ namespace Tnb.ProductionMgr
{
instock = new MESWmsInstockHInput()
{
// org_id = _userManager.GetUserInfo().Result.organizeId,
org_id = org_id,
bill_date = DateTime.Now,
bill_type = DictConst.CHANCHENGPINRUKUDAN,
// warehouse_id = basLocation?.wh_id,
@@ -379,7 +381,7 @@ namespace Tnb.ProductionMgr
material_id = prdReport.material_id,
material_code = basMaterial.code,
unit_id = prdReport.unit_id,
code_batch = prdReport.barcode,
code_batch = prdReport.mo_task_code,
pr_qty = (int)prdReport.reported_qty,
});
@@ -389,10 +391,11 @@ namespace Tnb.ProductionMgr
material_code = basMaterial.code,
unit_id = prdReport.unit_id,
barcode = prdReport.barcode,
code_batch = prdReport.barcode + "0001",
code_batch = prdReport.mo_task_code,
codeqty = (int)prdReport.reported_qty,
});
// string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
// string domain = "http://localhost:9232";
string domain = "http://tnb.tuotong-tech.com";
Dictionary<string, object> header = new()
{
@@ -401,7 +404,7 @@ namespace Tnb.ProductionMgr
string sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK, JsonConvert.SerializeObject(mesCreateInstockInput), header);
Log.Information(sendResult);
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
result2 = authResponse.code != 200 || !authResponse.data.ObjToBool()
result2 = authResponse.code != 200 || !(bool)authResponse.data
? throw Oops.Bah(authResponse.msg)
: await db.Ado.UseTranAsync(async () =>
{

View File

@@ -1503,7 +1503,8 @@ namespace Tnb.ProductionMgr
report.create_id = _userManager.UserId;
report.create_time = DateTime.Now;
// report.batch = input.mo_task_code + DateTimeOffset.Now.ToUnixTimeSeconds().ToString();
report.barcode = input.mo_task_code + DateTimeOffset.Now.ToUnixTimeSeconds().ToString();
// report.barcode = input.mo_task_code + DateTimeOffset.Now.ToUnixTimeSeconds().ToString();
report.barcode = input.mo_task_code+"0001";
report.equip_id = prdMoTask.eqp_id;
report.mbom_process_id = prdMoTask.mbom_process_id;
report.station = input.station;

View File

@@ -220,7 +220,7 @@ namespace Tnb.ProductionMgr
}
public Task StartAsync(CancellationToken cancellationToken)
{
Readtimer = new Timer(GetRedisData, null, TimeSpan.Zero, TimeSpan.FromSeconds(60));
Readtimer = new Timer(GetRedisData, null, TimeSpan.Zero, TimeSpan.FromSeconds(300));
return Task.CompletedTask;
}
public Task StopAsync(CancellationToken cancellationToken)