执行代码清理,修复warning

This commit is contained in:
2023-11-06 19:59:12 +08:00
parent c6b8dfc861
commit 1dbb17f103
118 changed files with 5046 additions and 4111 deletions

View File

@@ -60,13 +60,15 @@ namespace Tnb.ProductionMgr
{
try
{
var db = _repository.AsSugarClient();
ISqlSugarClient db = _repository.AsSugarClient();
MESCreateOutstockInput input = new MESCreateOutstockInput();
input.outstock = new MESWmsOutstockHInput();
input.outstockDs = new List<MESWmsOutstockDInput>();
MESCreateOutstockInput input = new()
{
outstock = new MESWmsOutstockHInput(),
outstockDs = new List<MESWmsOutstockDInput>()
};
string locationId = visualDevModelDataCrInput.data.ContainsKey("location_id") ? visualDevModelDataCrInput.data["location_id"].ToString() : "";
string? locationId = visualDevModelDataCrInput.data.ContainsKey("location_id") ? visualDevModelDataCrInput.data["location_id"].ToString() : "";
BasLocation location = await db.Queryable<BasLocation>().SingleAsync(x => x.id == locationId);
input.outstock.bill_type = visualDevModelDataCrInput.data.ContainsKey("bill_type") ? visualDevModelDataCrInput.data["bill_type"].ToString() : "";
@@ -92,11 +94,11 @@ namespace Tnb.ProductionMgr
input.outstockDs = JsonConvert.DeserializeObject<List<MESWmsOutstockDInput>>(JsonConvert.SerializeObject(visualDevModelDataCrInput.data["tablefield107"]));
string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
Dictionary<string, object> header = new Dictionary<string, object>()
Dictionary<string, object> header = new()
{
["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
};
var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_OUTSTOCK, JsonConvert.SerializeObject(input), header);
string sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_OUTSTOCK, JsonConvert.SerializeObject(input), header);
Log.Information(sendResult);
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
@@ -124,16 +126,22 @@ namespace Tnb.ProductionMgr
{
try
{
var db = _repository.AsSugarClient();
ISqlSugarClient db = _repository.AsSugarClient();
string warehouse_id = "26103348825381";//二楼缓存仓
MESCreateOutstockInput input = new MESCreateOutstockInput();
input.outstock = new MESWmsOutstockHInput();
input.outstockDs = new List<MESWmsOutstockDInput>();
MESCreateOutstockInput input = new()
{
outstock = new MESWmsOutstockHInput(),
outstockDs = new List<MESWmsOutstockDInput>()
};
PrdMoTask prdMoTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == generalOutstockInput.mo_task_id);
BasLocation location = await db.Queryable<BasLocation>().Where(x => x.location_code == generalOutstockInput.location_code).FirstAsync();
if (location == null) throw Oops.Bah("未找到库位");
if (location == null)
{
throw Oops.Bah("未找到库位");
}
string locationId = location.id;
input.outstock.bill_type = DictConst.SHENGCHANLINGLIAO;
@@ -158,7 +166,7 @@ namespace Tnb.ProductionMgr
})
.ToDictionaryAsync(x => x.key, x => x.value);
foreach (var item in generalOutstockInput.details)
foreach (GeneralOutstockDInput item in generalOutstockInput.details)
{
input.outstockDs.Add(new MESWmsOutstockDInput()
{
@@ -170,11 +178,11 @@ namespace Tnb.ProductionMgr
}
string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
Dictionary<string, object> header = new Dictionary<string, object>()
Dictionary<string, object> header = new()
{
["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
};
var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_OUTSTOCK, JsonConvert.SerializeObject(input), header);
string sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_OUTSTOCK, JsonConvert.SerializeObject(input), header);
Log.Information(sendResult);
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
@@ -184,18 +192,20 @@ namespace Tnb.ProductionMgr
}
else
{
PrdOutstockH prdOutstockH = new PrdOutstockH();
prdOutstockH.bill_type = DictConst.SHENGCHANLINGLIAO;
prdOutstockH.warehouse_id = warehouse_id;
prdOutstockH.location_code = generalOutstockInput.location_code;
prdOutstockH.create_id = _userManager.UserId;
prdOutstockH.org_id = _userManager.GetUserInfo().Result.organizeId;
prdOutstockH.bill_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
prdOutstockH.workstation = generalOutstockInput.workstation_id;
prdOutstockH.workline = workline?.Id ?? "";
PrdOutstockH prdOutstockH = new()
{
bill_type = DictConst.SHENGCHANLINGLIAO,
warehouse_id = warehouse_id,
location_code = generalOutstockInput.location_code,
create_id = _userManager.UserId,
org_id = _userManager.GetUserInfo().Result.organizeId,
bill_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
workstation = generalOutstockInput.workstation_id,
workline = workline?.Id ?? ""
};
List<PrdOutstockD> prdOutstockDs = new List<PrdOutstockD>();
foreach (var item in generalOutstockInput.details)
List<PrdOutstockD> prdOutstockDs = new();
foreach (GeneralOutstockDInput item in generalOutstockInput.details)
{
prdOutstockDs.Add(new PrdOutstockD()
{
@@ -211,10 +221,10 @@ namespace Tnb.ProductionMgr
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
{
await _repository.InsertAsync(prdOutstockH);
_ = await _repository.InsertAsync(prdOutstockH);
if (prdOutstockDs.Count > 0)
{
await db.Insertable<PrdOutstockD>(prdOutstockDs).ExecuteCommandAsync();
_ = await db.Insertable<PrdOutstockD>(prdOutstockDs).ExecuteCommandAsync();
}
});