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)

View File

@@ -349,7 +349,7 @@ namespace Tnb.WarehouseMgr
instockCOdes.Add(c);
}
}
string orgId = _userManager.User.OrganizeId;
string orgId = _userManager.User?.OrganizeId ?? input.instock.org_id;
_ = await _db.Insertable(instockCOdes).CallEntityMethod(it => it.Create(orgId)).ExecuteCommandAsync();
//生成预任务申请
@@ -372,7 +372,7 @@ namespace Tnb.WarehouseMgr
WmsPretaskH preTask = new()
{
org_id = _userManager.User.OrganizeId,
org_id = orgId,
startlocation_id = sPoint?.location_id ?? string.Empty,
startlocation_code = sPoint?.location_code ?? string.Empty,
endlocation_id = ePoint?.location_id ?? string.Empty,
@@ -389,7 +389,7 @@ namespace Tnb.WarehouseMgr
area_code = it.Key,
require_id = instock?.id ?? string.Empty,
require_code = instock?.bill_code ?? string.Empty,
create_id = _userManager.UserId,
create_id = instock.create_id,
create_time = DateTime.Now
};
return preTask;
@@ -448,16 +448,16 @@ namespace Tnb.WarehouseMgr
{
WmsHandleCode handleCode = jo.Adapt<WmsHandleCode>();
handleCode.id = SnowflakeIdHelper.NextId();
handleCode.org_id = _userManager.User.OrganizeId;
handleCode.org_id = orgId;
handleCode.bill_id = operBillId;
handleCode.create_id = _userManager.UserId;
handleCode.create_id = instock.create_id;
handleCode.create_time = DateTime.Now;
preTaskUpInput.PreTaskHandleCodes.Add(handleCode);
}
}
//生成载具条码记录
List<WmsCarryCode> carryCodes = preTaskUpInput.PreTaskHandleCodes.Adapt<List<WmsCarryCode>>();
carryCodes.ForEach(x =>
{
x.id = SnowflakeIdHelper.NextId();