执行代码清理,修复warning
This commit is contained in:
@@ -164,36 +164,38 @@ namespace Tnb.ProductionMgr
|
||||
[HttpPost]
|
||||
public async Task<dynamic> KittingOut(KittingOutInput kittingOutInput)
|
||||
{
|
||||
PrdKittingOutH prdKittingOutH = new PrdKittingOutH();
|
||||
PrdKittingOutH prdKittingOutH = new();
|
||||
try
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
ISqlSugarClient db = _repository.AsSugarClient();
|
||||
OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(kittingOutInput.workstation_id, DictConst.RegionCategoryWorklineCode);
|
||||
kittingOutInput.workline_id = workline?.Id ?? "";
|
||||
|
||||
List<MESKittingOutStkInput> input = new List<MESKittingOutStkInput>();
|
||||
input.Add(new MESKittingOutStkInput()
|
||||
List<MESKittingOutStkInput> input = new()
|
||||
{
|
||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||
bill_date = DateTime.Now,
|
||||
warehouse_id = kittingOutInput.warehouse_id,
|
||||
location_code = kittingOutInput.location_code,
|
||||
material_id = kittingOutInput.material_id,
|
||||
material_code = kittingOutInput.material_code,
|
||||
collocation_scheme_id = kittingOutInput.collocation_scheme_id,
|
||||
collocation_scheme_code = kittingOutInput.collocation_scheme_code,
|
||||
source_id = prdKittingOutH.id,
|
||||
create_id = _userManager.UserId,
|
||||
wmsKittingoutDs = new List<MESKittingOutStkDInput>(),
|
||||
});
|
||||
new MESKittingOutStkInput()
|
||||
{
|
||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||
bill_date = DateTime.Now,
|
||||
warehouse_id = kittingOutInput.warehouse_id,
|
||||
location_code = kittingOutInput.location_code,
|
||||
material_id = kittingOutInput.material_id,
|
||||
material_code = kittingOutInput.material_code,
|
||||
collocation_scheme_id = kittingOutInput.collocation_scheme_id,
|
||||
collocation_scheme_code = kittingOutInput.collocation_scheme_code,
|
||||
source_id = prdKittingOutH.id,
|
||||
create_id = _userManager.UserId,
|
||||
wmsKittingoutDs = new List<MESKittingOutStkDInput>(),
|
||||
}
|
||||
};
|
||||
|
||||
input[0].wmsKittingoutDs = JsonConvert.DeserializeObject<List<MESKittingOutStkDInput>>(JsonConvert.SerializeObject(kittingOutInput.tableField115));
|
||||
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_KITTING_OUT_STK, JsonConvert.SerializeObject(input), header);
|
||||
string sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_KITTING_OUT_STK, JsonConvert.SerializeObject(input), header);
|
||||
Log.Information(sendResult);
|
||||
|
||||
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
|
||||
@@ -217,8 +219,8 @@ namespace Tnb.ProductionMgr
|
||||
prdKittingOutH.create_id = _userManager.UserId;
|
||||
prdKittingOutH.create_time = DateTime.Now;
|
||||
prdKittingOutH.org_id = _userManager.GetUserInfo().Result.organizeId;
|
||||
List<PrdKittingOutD> prdKittingOutDs = new List<PrdKittingOutD>();
|
||||
foreach (var item in kittingOutInput.tableField115)
|
||||
List<PrdKittingOutD> prdKittingOutDs = new();
|
||||
foreach (Dictionary<string, object> item in kittingOutInput.tableField115)
|
||||
{
|
||||
prdKittingOutDs.Add(new PrdKittingOutD()
|
||||
{
|
||||
@@ -238,10 +240,10 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
{
|
||||
await _repository.InsertAsync(prdKittingOutH);
|
||||
_ = await _repository.InsertAsync(prdKittingOutH);
|
||||
if (prdKittingOutDs.Count > 0)
|
||||
{
|
||||
await db.Insertable<PrdKittingOutD>(prdKittingOutDs).ExecuteCommandAsync();
|
||||
_ = await db.Insertable<PrdKittingOutD>(prdKittingOutDs).ExecuteCommandAsync();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -271,11 +273,11 @@ namespace Tnb.ProductionMgr
|
||||
[HttpPost]
|
||||
public async Task<dynamic> KittingOutNew(KittingOutNewInput kittingOutInput)
|
||||
{
|
||||
PrdKittingOutH prdKittingOutH = new PrdKittingOutH();
|
||||
PrdKittingOutH prdKittingOutH = new();
|
||||
string warehouse_id = "26103348825381";//二楼缓存仓
|
||||
try
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
ISqlSugarClient db = _repository.AsSugarClient();
|
||||
PrdMoTask prdMoTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == kittingOutInput.mo_task_id);
|
||||
BasMaterial basMaterial = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == prdMoTask.material_id);
|
||||
WmsCollocationSchemeH wmsCollocationSchemeH = await db.Queryable<WmsCollocationSchemeH>().SingleAsync(x => x.id == kittingOutInput.collocation_scheme_id);
|
||||
@@ -295,23 +297,25 @@ namespace Tnb.ProductionMgr
|
||||
Dictionary<string, string> unitCodeDic = basMaterials.ToDictionary(x => x.id, x => x.unit_id);
|
||||
OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(kittingOutInput.workstation_id, DictConst.RegionCategoryWorklineCode);
|
||||
|
||||
List<MESKittingOutStkInput> input = new List<MESKittingOutStkInput>();
|
||||
input.Add(new MESKittingOutStkInput()
|
||||
List<MESKittingOutStkInput> input = new()
|
||||
{
|
||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||
bill_date = DateTime.Now,
|
||||
warehouse_id = warehouse_id,
|
||||
location_code = kittingOutInput.location_code,
|
||||
material_id = prdMoTask.material_id,
|
||||
material_code = basMaterial.code,
|
||||
collocation_scheme_id = kittingOutInput.collocation_scheme_id,
|
||||
collocation_scheme_code = wmsCollocationSchemeH.bill_code,
|
||||
source_id = prdKittingOutH.id,
|
||||
create_id = _userManager.UserId,
|
||||
wmsKittingoutDs = new List<MESKittingOutStkDInput>(),
|
||||
});
|
||||
new MESKittingOutStkInput()
|
||||
{
|
||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||
bill_date = DateTime.Now,
|
||||
warehouse_id = warehouse_id,
|
||||
location_code = kittingOutInput.location_code,
|
||||
material_id = prdMoTask.material_id,
|
||||
material_code = basMaterial.code,
|
||||
collocation_scheme_id = kittingOutInput.collocation_scheme_id,
|
||||
collocation_scheme_code = wmsCollocationSchemeH.bill_code,
|
||||
source_id = prdKittingOutH.id,
|
||||
create_id = _userManager.UserId,
|
||||
wmsKittingoutDs = new List<MESKittingOutStkDInput>(),
|
||||
}
|
||||
};
|
||||
|
||||
foreach (var item in wmsCollocationSchemeDs)
|
||||
foreach (WmsCollocationSchemeD item in wmsCollocationSchemeDs)
|
||||
{
|
||||
input[0].wmsKittingoutDs.Add(new MESKittingOutStkDInput()
|
||||
{
|
||||
@@ -326,11 +330,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_KITTING_OUT_STK, JsonConvert.SerializeObject(input), header);
|
||||
string sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_KITTING_OUT_STK, JsonConvert.SerializeObject(input), header);
|
||||
Log.Information(sendResult);
|
||||
|
||||
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
|
||||
@@ -354,8 +358,8 @@ namespace Tnb.ProductionMgr
|
||||
prdKittingOutH.create_id = _userManager.UserId;
|
||||
prdKittingOutH.create_time = DateTime.Now;
|
||||
prdKittingOutH.org_id = _userManager.GetUserInfo().Result.organizeId;
|
||||
List<PrdKittingOutD> prdKittingOutDs = new List<PrdKittingOutD>();
|
||||
foreach (var item in wmsCollocationSchemeDs)
|
||||
List<PrdKittingOutD> prdKittingOutDs = new();
|
||||
foreach (WmsCollocationSchemeD item in wmsCollocationSchemeDs)
|
||||
{
|
||||
prdKittingOutDs.Add(new PrdKittingOutD()
|
||||
{
|
||||
@@ -375,10 +379,10 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
{
|
||||
await _repository.InsertAsync(prdKittingOutH);
|
||||
_ = await _repository.InsertAsync(prdKittingOutH);
|
||||
if (prdKittingOutDs.Count > 0)
|
||||
{
|
||||
await db.Insertable<PrdKittingOutD>(prdKittingOutDs).ExecuteCommandAsync();
|
||||
_ = await db.Insertable<PrdKittingOutD>(prdKittingOutDs).ExecuteCommandAsync();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user