Fix migration + fix preparazione import DoorOpType
This commit is contained in:
@@ -58,7 +58,7 @@ namespace WebDoorCreator.API.Controllers
|
||||
};
|
||||
// recupero info ordine
|
||||
var rawOrder = await WDCService.OrderGetByKey(OrderId);
|
||||
if (rawOrder != null && rawOrder.CompanyNav!=null)
|
||||
if (rawOrder != null && rawOrder.CompanyNav != null)
|
||||
{
|
||||
answ.OrderDescript = rawOrder.OrderDescript;
|
||||
answ.OrderExtCode = rawOrder.OrderExtCode;
|
||||
@@ -82,16 +82,30 @@ namespace WebDoorCreator.API.Controllers
|
||||
foreach (var door in doorsList)
|
||||
{
|
||||
// recupero i dato DoorOp
|
||||
|
||||
// creo oggetto DTO
|
||||
var doorOpList = await WDCService.DoorOpGetByDoorId(door.DoorId);
|
||||
Dictionary<string, List<string>> currBOMList = new Dictionary<string, List<string>>();
|
||||
// ciclo su tutte le DoorOp
|
||||
foreach (var doorOp in doorOpList)
|
||||
{
|
||||
// cerco se ci sia già o meno nella BOM l'item corrente
|
||||
if (currBOMList.ContainsKey(doorOp.ObjectId))
|
||||
{
|
||||
currBOMList[doorOp.ObjectId].Add(doorOp.JsoncActVal);
|
||||
}
|
||||
else
|
||||
{
|
||||
List<string> currOp = new List<string>();
|
||||
currOp.Add(doorOp.JsoncActVal);
|
||||
currBOMList.Add(doorOp.ObjectId, currOp);
|
||||
}
|
||||
}
|
||||
// creo oggetto DTO finale della porta
|
||||
var doorDto = new DoorCostingDTO()
|
||||
{
|
||||
DoorId = door.DoorId,
|
||||
Quantity = door.Quantity,
|
||||
EstimatedWorkTime = 0,
|
||||
SizeX = 1,
|
||||
SizeY = 2,
|
||||
SizeZ = 3
|
||||
BOMList = currBOMList
|
||||
};
|
||||
dcDTO.Add(doorDto);
|
||||
}
|
||||
@@ -110,10 +124,12 @@ namespace WebDoorCreator.API.Controllers
|
||||
[HttpPost("DoorPriceUpdate")]
|
||||
public async Task<string> DoorPriceUpdate(List<DoorPriceDTO> EvalResults)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
string answ = "NA";
|
||||
//bool fatto = await QDataServ.SaveProcessingResult(EvalResults);
|
||||
//answ = fatto ? "OK" : "NO";
|
||||
var updateSet = EvalResults
|
||||
.Where(x => x.Valid)
|
||||
.ToDictionary(x => x.DoorId, x => x.UnitCost);
|
||||
bool fatto = await WDCService.DoorUpdateCosts(updateSet);
|
||||
answ = fatto ? "OK" : "NO";
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user