齐套出库 一般出库 物料出库添加状态

This commit is contained in:
2023-11-08 14:06:40 +08:00
parent 30b40fb28e
commit bd739b3060
6 changed files with 159 additions and 25 deletions

View File

@@ -165,6 +165,7 @@ namespace Tnb.ProductionMgr
public async Task<dynamic> KittingOut(KittingOutInput kittingOutInput)
{
PrdKittingOutH prdKittingOutH = new();
prdKittingOutH.code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDKITTINGOUTSTOCK_CODE);
try
{
ISqlSugarClient db = _repository.AsSugarClient();
@@ -184,6 +185,7 @@ namespace Tnb.ProductionMgr
collocation_scheme_id = kittingOutInput.collocation_scheme_id,
collocation_scheme_code = kittingOutInput.collocation_scheme_code,
source_id = prdKittingOutH.id,
source_code = prdKittingOutH.code,
create_id = _userManager.UserId,
wmsKittingoutDs = new List<MESKittingOutStkDInput>(),
}
@@ -205,7 +207,6 @@ namespace Tnb.ProductionMgr
}
else
{
prdKittingOutH.code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDKITTINGOUTSTOCK_CODE);
prdKittingOutH.warehouse_id = kittingOutInput.warehouse_id;
prdKittingOutH.location_code = kittingOutInput.location_code;
prdKittingOutH.material_id = kittingOutInput.material_id;
@@ -274,6 +275,7 @@ namespace Tnb.ProductionMgr
public async Task<dynamic> KittingOutNew(KittingOutNewInput kittingOutInput)
{
PrdKittingOutH prdKittingOutH = new();
prdKittingOutH.code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDKITTINGOUTSTOCK_CODE);
string warehouse_id = "26103348825381";//二楼缓存仓
try
{
@@ -310,6 +312,7 @@ namespace Tnb.ProductionMgr
collocation_scheme_id = kittingOutInput.collocation_scheme_id,
collocation_scheme_code = wmsCollocationSchemeH.bill_code,
source_id = prdKittingOutH.id,
source_code = prdKittingOutH.code,
create_id = _userManager.UserId,
wmsKittingoutDs = new List<MESKittingOutStkDInput>(),
}
@@ -344,7 +347,6 @@ namespace Tnb.ProductionMgr
}
else
{
prdKittingOutH.code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDKITTINGOUTSTOCK_CODE);
prdKittingOutH.warehouse_id = warehouse_id;
prdKittingOutH.location_code = kittingOutInput.location_code;
prdKittingOutH.material_id = basMaterial.id;
@@ -358,6 +360,7 @@ namespace Tnb.ProductionMgr
prdKittingOutH.create_id = _userManager.UserId;
prdKittingOutH.create_time = DateTime.Now;
prdKittingOutH.org_id = _userManager.GetUserInfo().Result.organizeId;
prdKittingOutH.status = DictConst.OUTSTOCKSTATUSADD;
List<PrdKittingOutD> prdKittingOutDs = new();
foreach (WmsCollocationSchemeD item in wmsCollocationSchemeDs)
{
@@ -401,5 +404,38 @@ namespace Tnb.ProductionMgr
}
}
/// <summary>
/// 齐套出库 一般出库 物料出库 改状态
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
public async Task<dynamic> ChangeStatusById(List<PrdKittingOutChangeStatusInput> inputs)
{
// if(string.IsNullOrEmpty(input.code) || string.IsNullOrEmpty(input.type) || string.IsNullOrEmpty(input.status))
// throw Oops.Bah("参数错误");
if (inputs == null || inputs.Count <= 0)
{
throw Oops.Bah("参数错误");
}
ISqlSugarClient db = _repository.AsSugarClient();
foreach (var input in inputs)
{
if (input.type == "0")
{
await db.Updateable<PrdKittingOutH>().SetColumns(x => x.status == input.status)
.Where(x => x.code == input.code).ExecuteCommandAsync();
}else if (input.type == "1" || input.type == "2")
{
await db.Updateable<PrdOutstockH>().SetColumns(x => x.status == input.status)
.Where(x => x.bill_code == input.code).ExecuteCommandAsync();
}
}
return true;
}
}
}