1930 lines
69 KiB
C#
1930 lines
69 KiB
C#
using Egw.Window.Data;
|
|
using EgwCoreLib.Lux.Core;
|
|
using EgwCoreLib.Lux.Core.Generic;
|
|
using EgwCoreLib.Lux.Core.RestPayload;
|
|
using EgwCoreLib.Lux.Data.DbModel.Config;
|
|
using EgwCoreLib.Lux.Data.DbModel.Production;
|
|
using EgwCoreLib.Lux.Data.DbModel.Sales;
|
|
using EgwCoreLib.Lux.Data.DbModel.Utils;
|
|
using EgwCoreLib.Lux.Data.Domains;
|
|
using EgwCoreLib.Lux.Data.Services.Config;
|
|
using EgwCoreLib.Lux.Data.Services.General;
|
|
using EgwCoreLib.Lux.Data.Services.Items;
|
|
using EgwCoreLib.Lux.Data.Services.Production;
|
|
using EgwCoreLib.Lux.Data.Services.Sales;
|
|
using EgwCoreLib.Lux.Data.Services.Utils;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.AspNetCore.Components.Forms;
|
|
using Microsoft.JSInterop;
|
|
using Newtonsoft.Json;
|
|
using NLog;
|
|
using WebWindowComplex;
|
|
using WebWindowComplex.DTO;
|
|
using static EgwCoreLib.Lux.Core.Enums;
|
|
|
|
namespace Lux.UI.Components.Compo
|
|
{
|
|
public partial class OrderRowMan : IDisposable
|
|
{
|
|
#region Public Enums
|
|
|
|
/// <summary>
|
|
/// modalit� modifica riga offerta
|
|
/// </summary>
|
|
public enum EditMode
|
|
{
|
|
None = 0,
|
|
|
|
/// <summary>
|
|
/// Dati generici del record
|
|
/// </summary>
|
|
RecData,
|
|
|
|
/// <summary>
|
|
/// Struttura serializzata (es JWD)
|
|
/// </summary>
|
|
SerStruc,
|
|
|
|
/// <summary>
|
|
/// BOM editing
|
|
/// </summary>
|
|
BOM,
|
|
|
|
/// <summary>
|
|
/// File editing (es BTL)
|
|
/// </summary>
|
|
File,
|
|
|
|
/// <summary>
|
|
/// Editing ciclo di lavoro
|
|
/// </summary>
|
|
JobCycle,
|
|
|
|
/// <summary>
|
|
/// Dettaglio WorkLoad per TEMPI
|
|
/// </summary>
|
|
WorkLoadDetailTime,
|
|
|
|
/// <summary>
|
|
/// Dettaglio WorkLoad per Pezzi/Tags
|
|
/// </summary>
|
|
WorkLoadDetailTag
|
|
}
|
|
|
|
#endregion Public Enums
|
|
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public OrderModel CurrRecord { get; set; } = null!;
|
|
|
|
[Parameter]
|
|
public DisplayMode DisplayMode { get; set; } = DisplayMode.Standard;
|
|
|
|
[Parameter]
|
|
public EventCallback<bool> EC_Updated { get; set; }
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Public Methods
|
|
|
|
/// <summary>
|
|
/// Dispose sottoscrizione canale
|
|
/// </summary>
|
|
public void Dispose()
|
|
{
|
|
DLService.PipeUpdate.EA_NewMessage -= PipeUpdate_EA_NewMessage;
|
|
DLService.PipePng.EA_NewMessage -= PipePng_EA_NewMessage;
|
|
DLService.PipeSvg.EA_NewMessage -= PipeSvg_EA_NewMessage;
|
|
DLService.PipeHwOpt.EA_NewMessage -= PipeHwOpt_EA_NewMessage;
|
|
DLService.PipeProfList.EA_NewMessage -= PipeProfList_EA_NewMessage;
|
|
DLService.PipeShape.EA_NewMessage -= PipeShape_EA_NewMessage;
|
|
}
|
|
|
|
#endregion Public Methods
|
|
|
|
#region Public Classes
|
|
|
|
/// <summary>
|
|
/// Oggetto merged tra riga d'ordine e carico di lavoro associato
|
|
/// </summary>
|
|
public class MergedOrderRow
|
|
{
|
|
#region Public Properties
|
|
|
|
public OrderRowModel Original { get; set; } = null!;
|
|
public WorkLoadDetailDTO? WorkLoad { get; set; }
|
|
|
|
#endregion Public Properties
|
|
}
|
|
|
|
#endregion Public Classes
|
|
|
|
#region Protected Methods
|
|
|
|
/// <summary>
|
|
/// Verifica after render x stato interattivo pagina
|
|
/// </summary>
|
|
/// <param name="firstRender"></param>
|
|
protected override void OnAfterRender(bool firstRender)
|
|
{
|
|
if (firstRender)
|
|
{
|
|
// JS interop or data fetches go here
|
|
isInteractive = true;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// init obj
|
|
/// </summary>
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
ConfInit();
|
|
prevJwd = "";
|
|
await ReloadBaseList();
|
|
DLService.PipeUpdate.EA_NewMessage += PipeUpdate_EA_NewMessage;
|
|
DLService.PipePng.EA_NewMessage += PipePng_EA_NewMessage;
|
|
DLService.PipeSvg.EA_NewMessage += PipeSvg_EA_NewMessage;
|
|
DLService.PipeHwOpt.EA_NewMessage += PipeHwOpt_EA_NewMessage;
|
|
DLService.PipeProfList.EA_NewMessage += PipeProfList_EA_NewMessage;
|
|
DLService.PipeShape.EA_NewMessage += PipeShape_EA_NewMessage;
|
|
}
|
|
|
|
protected override async Task OnParametersSetAsync()
|
|
{
|
|
await ReloadDataAsync();
|
|
UpdateTable();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private static Logger Log = LogManager.GetCurrentClassLogger();
|
|
|
|
private List<GenValueModel> AllColors = new();
|
|
|
|
private List<EnvirParamModel> AllConfEnvir = new();
|
|
|
|
private List<GlassModel> AllConfGlass = new();
|
|
|
|
private List<HardwareModel> AllConfHardware = new();
|
|
|
|
private List<WoodModel> AllConfWood = new();
|
|
|
|
private List<ProductionPlantModel> AllProdPlant = new();
|
|
|
|
private List<OrderRowModel> AllRecords = new List<OrderRowModel>();
|
|
|
|
private string apiUrl = "";
|
|
|
|
private List<string> AvailColorMaterialList = new List<string>();
|
|
|
|
private List<string> AvailFamilyHardwareList = new List<string>();
|
|
|
|
private List<string> AvailGlassList = new List<string>();
|
|
|
|
private List<Egw.Window.Data.Hardware> AvailHardwareList = new();
|
|
|
|
private List<string> AvailMaterialList = new List<string>();
|
|
|
|
/// <summary>
|
|
/// Lista profili da DB
|
|
/// </summary>
|
|
private List<ProfileModel> AvailProfileList = new();
|
|
|
|
/// <summary>
|
|
/// Lista profili da Redis (old way)
|
|
/// </summary>
|
|
private List<string> AvailProfileListOld = new List<string>();
|
|
|
|
/// <summary>
|
|
/// Base path x network share files
|
|
/// </summary>
|
|
private string basePath = "unsafe_uploads";
|
|
|
|
private string calcTag = "calc";
|
|
|
|
private EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS cEnvir = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW;
|
|
|
|
/// <summary>
|
|
/// Channel update HwOptions
|
|
/// </summary>
|
|
private string chHwOpt = "";
|
|
|
|
/// <summary>
|
|
/// Channel update PNG
|
|
/// </summary>
|
|
private string chPng = "";
|
|
|
|
/// <summary>
|
|
/// Channel update Profile List
|
|
/// </summary>
|
|
private string chProfList = "";
|
|
|
|
/// <summary>
|
|
/// Channel update Shape
|
|
/// </summary>
|
|
private string chShape = "";
|
|
|
|
/// <summary>
|
|
/// Channel update SVG
|
|
/// </summary>
|
|
private string chSvg = "";
|
|
|
|
private List<BomItemDTO>? CurrBomList = null;
|
|
|
|
/// <summary>
|
|
/// Predisposizione valori live SVG/JWD
|
|
/// </summary>
|
|
private LivePayload CurrData = new LivePayload();
|
|
|
|
/// <summary>
|
|
/// Modalit� editint attiva
|
|
/// </summary>
|
|
private EditMode CurrEditMode = EditMode.None;
|
|
|
|
private Dictionary<int, string> currGroupShape = new Dictionary<int, string>();
|
|
|
|
private Dictionary<int, string> currHwOption = new Dictionary<int, string>();
|
|
|
|
private int currPage = 1;
|
|
|
|
private string currPng = "";
|
|
|
|
private string currSvg = "";
|
|
|
|
/// <summary>
|
|
/// Record in Edit corrente x modifica file/serializzato
|
|
/// </summary>
|
|
private OrderRowModel? EditRecord = null;
|
|
|
|
/// <summary>
|
|
/// Abilita edit massivo record ITEM
|
|
/// </summary>
|
|
private bool enableMassEdit = false;
|
|
|
|
private string genericBasePath = "";
|
|
|
|
private string imgBasePath = "";
|
|
|
|
/// <summary>
|
|
/// Semaforo x definire se sia gi� in modalit� ionterattiva o di prerendering
|
|
/// </summary>
|
|
private bool isInteractive = false;
|
|
|
|
private bool isLoading = false;
|
|
|
|
private List<ProductionGroupModel>? ListProdAssign = null;
|
|
|
|
private List<MergedOrderRow> ListRecords = new List<MergedOrderRow>();
|
|
|
|
private int numRecord = 10;
|
|
|
|
/// <summary>
|
|
/// Versione originale (pre edit)
|
|
/// </summary>
|
|
private string origJwd = "";
|
|
|
|
/// <summary>
|
|
/// Versione precedente JWD x test e confronto
|
|
/// </summary>
|
|
private string prevJwd = "";
|
|
|
|
/// <summary>
|
|
/// Dizionario richieste
|
|
/// </summary>
|
|
private Dictionary<string, string> reqDict = new Dictionary<string, string>();
|
|
|
|
private OrderRowModel? SelRecord = null;
|
|
|
|
/// <summary>
|
|
/// Configurazione elenchi anagrafiche
|
|
/// </summary>
|
|
private BaseListPayload SetupList = new BaseListPayload();
|
|
|
|
private int totalCount = 0;
|
|
|
|
private WorkLoadDetailDTO? WorkLoadRecord = null;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Properties
|
|
|
|
private Dictionary<string, List<Threshold>> AvailThreshold { get; set; } = new Dictionary<string, List<Threshold>>()
|
|
{
|
|
{"Profilo78", new List<Threshold>() { new Threshold(3, "Bottom")}},
|
|
{"ProfiloSaomad", new List<Threshold>(){ new Threshold(3, "Bottom")}}
|
|
#if false
|
|
{"Profilo78", new List<Threshold>() { new Threshold(3, "Bottom"), new Threshold(1, "Threshold")}},
|
|
{"ProfiloSaomad", new List<Threshold>(){ new Threshold(3, "Bottom"), new Threshold(2, "BottomWaterdrip"), new Threshold(1, "Threshold")}}
|
|
#endif
|
|
};
|
|
|
|
[Inject]
|
|
private IConfigDataService CDService { get; set; } = null!;
|
|
|
|
[Inject]
|
|
private IConfGlassService CGService { get; set; } = null!;
|
|
|
|
[Inject]
|
|
private IConfiguration Config { get; set; } = null!;
|
|
|
|
[Inject]
|
|
private IConfProfileService CPService { get; set; } = null!;
|
|
|
|
[Inject]
|
|
private ICalcRuidService CRService { get; set; } = null!;
|
|
|
|
[Inject]
|
|
private ICalcRequestService CService { get; set; } = null!;
|
|
|
|
[Inject]
|
|
private IConfWoodService CWService { get; set; } = null!;
|
|
|
|
[Inject]
|
|
private IDataLayerServices DLService { get; set; } = null!;
|
|
|
|
[Inject]
|
|
private IEnvirParamService EPService { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// Costo totale calcolato x offerta
|
|
/// </summary>
|
|
private double GrandTotCost
|
|
{
|
|
get => AllRecords != null && AllRecords.Count > 0 ? AllRecords.Sum(x => x.TotalCost) : 0;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Margine medio calcolato x offerta
|
|
/// </summary>
|
|
private double GrandTotMargin
|
|
{
|
|
get
|
|
{
|
|
double answ = 0;
|
|
if (AllRecords != null && AllRecords.Count > 0)
|
|
{
|
|
double totPrice = AllRecords.Sum(x => x.TotalPrice);
|
|
double totCost = AllRecords.Sum(x => x.TotalCost);
|
|
if (totPrice > 0)
|
|
{
|
|
answ = (totPrice - totCost) / totPrice;
|
|
}
|
|
}
|
|
return answ;
|
|
}
|
|
}
|
|
|
|
private decimal GrandTotMaxTime
|
|
{
|
|
get
|
|
{
|
|
decimal answ = 0;
|
|
if (ListRecords != null && ListRecords.Count > 0)
|
|
{
|
|
answ = ListRecords.Sum(x => x.WorkLoad?.TotMaxTime ?? 0);
|
|
}
|
|
return answ;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Importo totale calcolato x offerta
|
|
/// </summary>
|
|
private double GrandTotNumItems
|
|
{
|
|
get
|
|
{
|
|
double answ = 0;
|
|
if (AllRecords != null && AllRecords.Count > 0)
|
|
{
|
|
answ = AllRecords.Sum(x => x.ProdItemQtyTot);
|
|
}
|
|
return answ;
|
|
}
|
|
}
|
|
|
|
private int GrandTotNumKo
|
|
{
|
|
get
|
|
{
|
|
int answ = 0;
|
|
if (ListRecords != null && ListRecords.Count > 0)
|
|
{
|
|
answ = ListRecords.Sum(x => x.WorkLoad?.NumKo ?? 0);
|
|
}
|
|
return answ;
|
|
}
|
|
}
|
|
|
|
private int GrandTotNumOk
|
|
{
|
|
get
|
|
{
|
|
int answ = 0;
|
|
if (ListRecords != null && ListRecords.Count > 0)
|
|
{
|
|
answ = ListRecords.Sum(x => x.WorkLoad?.NumOk ?? 0);
|
|
}
|
|
return answ;
|
|
}
|
|
}
|
|
|
|
private int GrandTotNumOkVin
|
|
{
|
|
get
|
|
{
|
|
int answ = 0;
|
|
if (ListRecords != null && ListRecords.Count > 0)
|
|
{
|
|
answ = ListRecords.Sum(x => x.WorkLoad?.NumOkVin ?? 0);
|
|
}
|
|
return answ;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Importo totale calcolato x offerta
|
|
/// </summary>
|
|
private double GrandTotPrice
|
|
{
|
|
get => AllRecords != null && AllRecords.Count > 0 ? AllRecords.Sum(x => x.TotalPrice) : 0;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Num totale obj calcolato x offerta
|
|
/// </summary>
|
|
private double GrandTotQty
|
|
{
|
|
get => AllRecords != null && AllRecords.Count > 0 ? AllRecords.Sum(x => x.Qty) : 0;
|
|
}
|
|
|
|
[Inject]
|
|
private IGenValService GVService { get; set; } = default!;
|
|
|
|
[Inject]
|
|
private IWebHostEnvironment HostEnv { get; set; } = null!;
|
|
|
|
[Inject]
|
|
private IImageCacheService ICService { get; set; } = null!;
|
|
|
|
[Inject]
|
|
private IItemService ItemService { get; set; } = null!;
|
|
|
|
[Inject]
|
|
private IJSRuntime JSRuntime { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// ID Offerta corrente
|
|
/// </summary>
|
|
private int OrderID
|
|
{
|
|
get => CurrRecord.OrderID;
|
|
}
|
|
|
|
[Inject]
|
|
private IOrderRowService OrdRService { get; set; } = null!;
|
|
|
|
[Inject]
|
|
private IOrderService OrdService { get; set; } = null!;
|
|
|
|
[Inject]
|
|
private IProductionGroupService PGService { get; set; } = null!;
|
|
|
|
[Inject]
|
|
private IProductionItemService PIService { get; set; } = null!;
|
|
|
|
[Inject]
|
|
private IProductionPlantService PPService { get; set; } = null!;
|
|
|
|
[Inject]
|
|
private IProdService PService { get; set; } = null!;
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Private Methods
|
|
|
|
/// <summary>
|
|
/// Effettua vera richiesta della BOM
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private async Task callRefreshProfList()
|
|
{
|
|
Dictionary<string, string> DictExec = new Dictionary<string, string>();
|
|
var cMode = Egw.Window.Data.Enums.QuestionModes.CONFIG;
|
|
var cSubMode = Egw.Window.Data.Enums.QuestionConfSubModes.PROFILELIST;
|
|
// compongo righiesta
|
|
string reqUid = "Default";
|
|
DictExec.Add("Mode", $"{(int)cMode}");
|
|
DictExec.Add("UID", reqUid);
|
|
// creo registrazione richiesta...
|
|
var ruid = await CRService.AddRequestAsync($"{cEnvir}", $"{cMode}-{cSubMode}", reqUid);
|
|
// aggiungo RUID effettivo
|
|
DictExec.Add("RUID", ruid);
|
|
DictExec.Add("SubMode", $"{(int)cSubMode}");
|
|
|
|
CalcRequestDTO req = new CalcRequestDTO()
|
|
{
|
|
EnvType = cEnvir,
|
|
DictExec = DictExec
|
|
};
|
|
// chiamo la chiamata POST alla API, che manda la richiesta via REDIS
|
|
await CService.CallRestPost($"{apiUrl}/{genericBasePath}", $"{calcTag}/{reqUid}", req);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Chiude edit andando eventualmente a salvare
|
|
/// </summary>
|
|
/// <param name="args"></param>
|
|
/// <returns></returns>
|
|
private async Task CloseEdit(bool doSave)
|
|
{
|
|
// Proseguo solo se sono in interattivo (NO prerender pagina)
|
|
if (isInteractive)
|
|
{
|
|
// ...se ho editing
|
|
if (EditRecord != null)
|
|
{
|
|
bool updateBom = false;
|
|
// SE richiesto salvataggio...
|
|
if (doSave)
|
|
{
|
|
// salvo su DB!
|
|
await OrdRService.UpdateSerStructAsync(EditRecord.OrderRowID, prevJwd);
|
|
// salvo nel record corrente!
|
|
EditRecord.SerStruct = prevJwd;
|
|
updateBom = true;
|
|
}
|
|
else
|
|
// altrimenti ricalcolo valore salvato
|
|
{
|
|
prevJwd = EditRecord.SerStruct;
|
|
CurrData.CurrJwd = EditRecord.SerStruct;
|
|
}
|
|
if (updateBom)
|
|
{
|
|
await reqBomUpdate(EditRecord);
|
|
}
|
|
// aggiorno nel dizionari
|
|
if (reqDict.ContainsKey("SerializedData"))
|
|
{
|
|
reqDict["SerializedData"] = prevJwd;
|
|
}
|
|
|
|
if (reqDict != null && reqDict.Count > 0)
|
|
{
|
|
// chiamo richiesta update
|
|
CalcRequestDTO calcRequestDTO = new CalcRequestDTO();
|
|
calcRequestDTO.EnvType = EditRecord.Envir;
|
|
calcRequestDTO.DictExec = reqDict;
|
|
// chiamo la chiamata POST alla API, che manda la richiesta via REDIS
|
|
await ICService.CallRestPost($"{apiUrl}/{genericBasePath}", $"{calcTag}/{EditRecord.OrderRowUID}", calcRequestDTO);
|
|
}
|
|
EditRecord = null;
|
|
CurrEditMode = EditMode.None;
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Chiude edit con preprocess x caso JWD
|
|
/// </summary>
|
|
/// <param name="args"></param>
|
|
/// <returns></returns>
|
|
private Task CloseEditJwd(DataSave infoSave)
|
|
{
|
|
prevJwd = infoSave.currJwd;
|
|
return CloseEdit(infoSave.ForceSave);
|
|
}
|
|
|
|
private void ClosePopup()
|
|
{
|
|
CurrEditMode = EditMode.None;
|
|
EditRecord = null;
|
|
}
|
|
|
|
private void ConfInit()
|
|
{
|
|
basePath = Config.GetValue<string>("ServerConf:FileSharePath") ?? "unsafe_uploads";
|
|
apiUrl = Config.GetValue<string>("ServerConf:Prog.ApiUrl") ?? "";
|
|
imgBasePath = Config.GetValue<string>("ServerConf:ImageBaseUrl") ?? "";
|
|
genericBasePath = Config.GetValue<string>("ServerConf:GenericBaseUrl") ?? "";
|
|
calcTag = Config.GetValue<string>("ServerConf:CalcTag") ?? "calc";
|
|
chHwOpt = Config.GetValue<string>("ServerConf:ChannelHwOpt") ?? "";
|
|
chPng = Config.GetValue<string>("ServerConf:ChannelPng") ?? "";
|
|
chProfList = Config.GetValue<string>("ServerConf:ChannelProfList") ?? "";
|
|
chShape = Config.GetValue<string>("ServerConf:ChannelShape") ?? "";
|
|
chSvg = Config.GetValue<string>("ServerConf:ChannelSvg") ?? "";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Esegue assegnazione diretta valori ricevuti
|
|
/// </summary>
|
|
/// <param name="updInfo"></param>
|
|
/// <returns></returns>
|
|
private async Task DirectAssign(DirectAssignReqDto updInfo)
|
|
{
|
|
if (updInfo != null)
|
|
{
|
|
int numDone = await PIService.BulkAssignProdGroupAsync(updInfo.OrderRowID, updInfo.ProdAssignID, updInfo.DictPartAssign);
|
|
|
|
await ForceOrderReload(updInfo.OrderRowID);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Esecuzione azione richiesta
|
|
/// </summary>
|
|
/// <param name="actReq">Azione richiesta</param>
|
|
private void DoAction(LayoutConst.DataAction actReq)
|
|
{
|
|
switch (actReq)
|
|
{
|
|
case LayoutConst.DataAction.None:
|
|
break;
|
|
|
|
case LayoutConst.DataAction.ResetDictShape:
|
|
CurrData.DictShape = new Dictionary<int, string>();
|
|
break;
|
|
|
|
case LayoutConst.DataAction.ResetHwOpt:
|
|
CurrData.DictOptionsXml = new Dictionary<int, string>();
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Aggiunge una nuova riga vuota come nota sotto il record selezionato oppure in coda...
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private async Task DoAddNote()
|
|
{
|
|
#if false
|
|
int numRow = AllRecords.Count + 1;
|
|
if (EditRecord != null)
|
|
{
|
|
numRow = EditRecord.RowNum + 1;
|
|
}
|
|
OrderRowModel newNote = new OrderRowModel()
|
|
{
|
|
OrderID = CurrRecord.OrderID,
|
|
Envir = CurrRecord.Envir,
|
|
RowNum = numRow,
|
|
OrderRowUID = "",
|
|
Qty = 0,
|
|
BomCost = 0,
|
|
BomPrice = 0,
|
|
StepCost = 0,
|
|
StepPrice = 0
|
|
};
|
|
await DLService.OffertRowUpsert(newNote);
|
|
#endif
|
|
await ReloadDataAsync();
|
|
UpdateTable();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Annullamento modifica
|
|
/// </summary>
|
|
/// <param name="curRec"></param>
|
|
/// <returns></returns>
|
|
private async Task DoCancel()
|
|
{
|
|
isLoading = true;
|
|
CurrEditMode = EditMode.None;
|
|
EditRecord = null;
|
|
await Task.Delay(20);
|
|
await OrdService.FlushCacheOrdersAsync();
|
|
await Task.Delay(20);
|
|
await ReloadDataAsync();
|
|
UpdateTable();
|
|
isLoading = false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Clona riga richiesta
|
|
/// </summary>
|
|
/// <param name="rec2clone"></param>
|
|
private async Task DoClone(OrderRowModel rec2clone)
|
|
{
|
|
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Confermi di voler duplicare la riga corrente?"))
|
|
return;
|
|
|
|
// calcolo indice riga...
|
|
int numRow = totalCount + 1;
|
|
OrderRowModel newRec = new OrderRowModel()
|
|
{
|
|
AwaitBom = true,
|
|
AwaitPrice = true,
|
|
Envir = rec2clone.Envir,
|
|
FileName = rec2clone.FileName,
|
|
FileResource = rec2clone.FileResource,
|
|
FileSize = rec2clone.FileSize,
|
|
Inserted = DateTime.Now,
|
|
ItemBOM = rec2clone.ItemBOM,
|
|
ItemSteps = rec2clone.ItemSteps,
|
|
Modified = DateTime.Now,
|
|
Note = rec2clone.Note,
|
|
OrderID = OrderID,
|
|
OrderRowUID = "",
|
|
Qty = rec2clone.Qty,
|
|
RowNum = numRow,
|
|
SellingItemID = rec2clone.SellingItemID,
|
|
SerStruct = rec2clone.SerStruct,
|
|
StepCost = rec2clone.StepCost,
|
|
StepPrice = rec2clone.StepPrice,
|
|
};
|
|
// salvo sul DB
|
|
await OrdRService.UpsertAsync(newRec);
|
|
// chiamo update record che non hanno UID x questo ordine
|
|
var list2fix = await OrdRService.FixUidAsync(OrderID);
|
|
if (list2fix != null && list2fix.Count > 0)
|
|
{
|
|
// rileggo i miei record...
|
|
await ReloadDataAsync();
|
|
var listCalc = SorListCalc();
|
|
foreach (var item in listCalc)
|
|
{
|
|
// se UID fosse tra quelli da ricalcolare...
|
|
if (list2fix.Contains(item.OrderRowUID))
|
|
{
|
|
// chiedo BOM e immagine
|
|
await reqBomUpdate(item);
|
|
}
|
|
}
|
|
}
|
|
await ReloadDataAsync();
|
|
UpdateTable();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Eliminazione riga Ordine
|
|
/// </summary>
|
|
/// <param name="rec2del"></param>
|
|
/// <returns></returns>
|
|
private async Task DoDelete(OrderRowModel rec2del)
|
|
{
|
|
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Confermi di voler eliminare la riga corrente?<br/>Codice: {rec2del.OrderRowUID} | {rec2del.Note} | importo tot: {rec2del.TotalPrice}"))
|
|
return;
|
|
|
|
await OrdRService.DeleteAsync(rec2del);
|
|
// elimino cache img
|
|
await ICService.DeleteSvgAsync(rec2del.OrderRowUID, rec2del.Envir);
|
|
await ReloadDataAsync();
|
|
UpdateTable();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Va in edit della riga richiesta
|
|
/// </summary>
|
|
/// <param name="curRec"></param>
|
|
private void DoEdit(OrderRowModel curRec)
|
|
{
|
|
// imposto edit record
|
|
EditRecord = curRec;
|
|
/// modalita edit: gestione valori campi record
|
|
CurrEditMode = EditMode.RecData;
|
|
isLoading = false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Edit del file:
|
|
/// - abilitazione fileUpload
|
|
/// - anteprima grande (live)
|
|
/// </summary>
|
|
/// <param name="curRec"></param>
|
|
private void DoEditFile(OrderRowModel curRec)
|
|
{
|
|
EditRecord = curRec;
|
|
/// modalit�edit: gestione JWD
|
|
CurrEditMode = EditMode.File;
|
|
#if false
|
|
// preparazione dati da record corrente
|
|
PrepareWindowData(EditRecord.SerStruct);
|
|
// reset prev
|
|
prevJwd = "";
|
|
#endif
|
|
}
|
|
|
|
/// <summary>
|
|
/// Apre editor finestre del record richiesto
|
|
/// </summary>
|
|
/// <param name="curRec"></param>
|
|
private void DoEditJwd(OrderRowModel curRec)
|
|
{
|
|
EditRecord = curRec;
|
|
/// modalit�edit: gestione JWD
|
|
CurrEditMode = EditMode.SerStruc;
|
|
// preparazione dati da record corrente
|
|
PrepareWindowData(EditRecord.SerStruct);
|
|
// reset prev
|
|
prevJwd = "";
|
|
}
|
|
|
|
private async Task DoRecalcOrder(bool forceResetCalc)
|
|
{
|
|
isLoading = true;
|
|
if (forceResetCalc)
|
|
{
|
|
await setAwaitPrice(true, false);
|
|
UpdateTable();
|
|
await InvokeAsync(StateHasChanged);
|
|
await Task.Delay(300);
|
|
}
|
|
await OrdService.UpdateCostAsync(OrderID);
|
|
if (forceResetCalc)
|
|
{
|
|
await Task.Delay(300);
|
|
await setAwaitPrice(false, true);
|
|
}
|
|
|
|
// rileggo dati
|
|
await ReloadDataAsync();
|
|
UpdateTable();
|
|
isLoading = false;
|
|
await EC_Updated.InvokeAsync(true);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Salvataggio edit record + reload
|
|
/// </summary>
|
|
/// <param name="curRec"></param>
|
|
/// <returns></returns>
|
|
private async Task DoSave(OrderRowModel curRec)
|
|
{
|
|
isLoading = true;
|
|
// salvo record modificato...
|
|
await OrdRService.UpsertAsync(curRec);
|
|
// reset
|
|
CurrEditMode = EditMode.None;
|
|
EditRecord = null;
|
|
await OrdService.FlushCacheOrdersAsync();
|
|
await ReloadDataAsync();
|
|
UpdateTable();
|
|
isLoading = false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Seleziono riga senza cambiare modalita editing
|
|
/// </summary>
|
|
/// <param name="curRec"></param>
|
|
private void DoSelect(OrderRowModel curRec)
|
|
{
|
|
// imposto edit record
|
|
EditRecord = curRec;
|
|
/// modalit�edit: gestione valori campi record
|
|
CurrEditMode = EditMode.None;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Imposta modalita edit ciclo di lavoro
|
|
/// </summary>
|
|
/// <param name="currRow"></param>
|
|
private Task DoSwapJobCycle(OrderRowModel currRow)
|
|
{
|
|
CurrEditMode = EditMode.JobCycle;
|
|
return selectBom(currRow);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Imposta modalita ad edit BOM
|
|
/// </summary>
|
|
/// <param name="currRow"></param>
|
|
private Task DoSwapMat(OrderRowModel currRow)
|
|
{
|
|
CurrEditMode = EditMode.BOM;
|
|
return selectBom(currRow);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Salvataggio del JWD aggiornato nella mia riga di offerta
|
|
/// </summary>
|
|
/// <param name="CurrArgs"></param>
|
|
private async Task ExecRequest(Dictionary<string, string> CurrArgs)
|
|
{
|
|
// Proseguo solo se sono in interattivo (NO prerender pagina)
|
|
if (isInteractive)
|
|
{
|
|
// ...se ho editing
|
|
if (EditRecord != null)
|
|
{
|
|
// SE contiene il mio Jwd...
|
|
if (CurrArgs.ContainsKey("SerializedData"))
|
|
{
|
|
string serStruct = CurrArgs["SerializedData"];
|
|
// controllo SE variato...
|
|
if (!prevJwd.Equals(serStruct) || !EgwCoreLib.Utils.DictUtils.DictAreEqual(reqDict, CurrArgs))
|
|
{
|
|
// aggiorno val prev
|
|
reqDict = CurrArgs;
|
|
prevJwd = serStruct;
|
|
// aggiorno live data
|
|
CurrData.CurrJwd = serStruct;
|
|
// chiamo richiesta update
|
|
CalcRequestDTO calcRequestDTO = new CalcRequestDTO();
|
|
calcRequestDTO.EnvType = EditRecord.Envir;
|
|
calcRequestDTO.DictExec = reqDict;
|
|
// chiamo la chiamata POST alla API, che manda la richiesta via REDIS
|
|
await ICService.CallRestPost($"{apiUrl}/{genericBasePath}", $"{calcTag}/{EditRecord.OrderRowUID}", calcRequestDTO);
|
|
#if false
|
|
// salvo su DB!
|
|
await DLService.OffertRowUpdateSerStruct(EditRecord.OrderRowID, serStruct);
|
|
#endif
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Path da parent record
|
|
/// </summary>
|
|
/// <param name="objID"></param>
|
|
/// <returns></returns>
|
|
private string FolderPath(int objID)
|
|
{
|
|
return $"SO-{objID:X8}";
|
|
}
|
|
|
|
private async Task ForceOrderReload(int OrderRowID)
|
|
{
|
|
// chiudo modale...
|
|
ClosePopup();
|
|
// rileggo i dati!
|
|
await ReloadDataAsync();
|
|
// recupero il record con orderId indicato
|
|
var item = ListRecords.FirstOrDefault(x => x.Original.OrderRowID == OrderRowID);
|
|
if (item != null)
|
|
{
|
|
// seleziono nuovamente i dati...
|
|
await ShowWLD(item, EditMode.WorkLoadDetailTime);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Svuota cache corrente + rilegge dati
|
|
/// </summary>
|
|
private async Task ForceReloadData()
|
|
{
|
|
isLoading = true;
|
|
CurrEditMode = EditMode.None;
|
|
EditRecord = null;
|
|
await Task.Delay(20);
|
|
await OrdService.FlushCacheOrdersAsync();
|
|
await Task.Delay(20);
|
|
await ReloadDataAsync();
|
|
UpdateTable();
|
|
isLoading = false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Formattazione durata
|
|
/// </summary>
|
|
/// <param name="durationSec"></param>
|
|
/// <returns></returns>
|
|
private string FormatDatetime(decimal durationSec)
|
|
{
|
|
TimeSpan tsWorkTime = TimeSpan.FromSeconds((double)durationSec);
|
|
return DtUtils.FormatDateTime(tsWorkTime);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Display fileSize scalato
|
|
/// </summary>
|
|
/// <param name="size"></param>
|
|
/// <returns></returns>
|
|
private string fSize(long size)
|
|
{
|
|
return EgwCoreLib.Utils.FileHelpers.SizeSuffix(size, 1);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Formattazione testo come html x display
|
|
/// </summary>
|
|
private MarkupString HtmlConv(string rawData)
|
|
{
|
|
return (MarkupString)rawData.Replace(Environment.NewLine, "<br />").Replace("\n", "<br />");//.Replace(" ", " ");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Calcolo URL immagine
|
|
/// </summary>
|
|
/// <param name="imgUid"></param>
|
|
/// <param name="env"></param>
|
|
/// <returns></returns>
|
|
private string imgUrl(string imgUid, string env)
|
|
{
|
|
// cast string su env..
|
|
EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS envir = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW;
|
|
Enum.TryParse(env, out envir);
|
|
return ICService.ImageUrl($"{apiUrl}/{imgBasePath}", false, imgUid, envir);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Restituisce il contenuto del file salvato
|
|
/// </summary>
|
|
/// <param name="folderPath"></param>
|
|
/// <param name="secureName"></param>
|
|
/// <returns></returns>
|
|
private string LoadFileContent(string folderPath, string secureName)
|
|
{
|
|
string answ = "";
|
|
if (!string.IsNullOrEmpty(folderPath))
|
|
{
|
|
try
|
|
{
|
|
// calcolo path file...
|
|
string filePath = Path.Combine(basePath, folderPath, secureName);
|
|
if (File.Exists(filePath))
|
|
{
|
|
answ = File.ReadAllText(filePath);
|
|
}
|
|
}
|
|
catch (Exception exc)
|
|
{
|
|
Log.Error($"Exception on LoadFileContent{Environment.NewLine}{exc}");
|
|
}
|
|
}
|
|
return answ;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Conversione record originali/merged
|
|
/// </summary>
|
|
/// <param name="origList"></param>
|
|
/// <returns></returns>
|
|
private List<MergedOrderRow> MergeRecord(List<OrderRowModel> origList)
|
|
{
|
|
var mergedList = AllRecords
|
|
.Select(item => new MergedOrderRow
|
|
{
|
|
Original = item,
|
|
WorkLoad = !string.IsNullOrEmpty(item.ProdEstimate) ? WorkLoadDetail(item.OrderRowUID, item.ProdEstimate) : null
|
|
})
|
|
.ToList();
|
|
return mergedList;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Forza parametri generali selezionati nell'offerta
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private async Task OfferForceParameters()
|
|
{
|
|
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Confermi di voler impostare i parametri selezionati per l'Ordine?"))
|
|
return;
|
|
// recupero obj dizionario x i parametri compresi...
|
|
ParamDict CurrSel = new ParamDict(CurrRecord.DictPresel);
|
|
// metto a waiting tutte le righe con bom...
|
|
var listCalc = SorListCalc();
|
|
foreach (var item in listCalc)
|
|
{
|
|
await OrdRService.UpdateAwaitStateAsync(item.OrderRowID, true, true);
|
|
// poich� non � gestito evento ritorno update window interno si "scassa" --> try catch/ if FALSE
|
|
try
|
|
{
|
|
string rColor = CurrSel.GetVal("Color");
|
|
string rGlass = CurrSel.GetVal("Glass");
|
|
string rProfile = CurrSel.GetVal("Profile");
|
|
string rWood = CurrSel.GetVal("Wood");
|
|
var newSerStruct = SerialMan.MassUpdate((string)item.SerStruct, null, null, rColor, rWood, rGlass, rProfile);
|
|
await OrdRService.UpdateSerStructAsync(item.OrderRowID, newSerStruct);
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
await InvokeAsync(StateHasChanged);
|
|
|
|
// verifica preliminare UID
|
|
await OrdRService.FixUidAsync(OrderID);
|
|
|
|
// ricalcolo di tutte le BOM e relativi prezzi...
|
|
foreach (var item in listCalc)
|
|
{
|
|
// chiedo BOM e immagine
|
|
await reqBomUpdate(item);
|
|
}
|
|
|
|
//await DoRecalcOrder();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Aggiornamento costing completo:
|
|
/// - verifica UID
|
|
/// - ricalcolo BOM
|
|
/// - update prezzi
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private async Task OfferUpdateAllCosting()
|
|
{
|
|
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Confermi di voler ricalcolare/validare in toto l'offerta?"))
|
|
return;
|
|
|
|
// metto a waiting tutte le righe con bom...
|
|
var listCalc = SorListCalc();
|
|
foreach (var item in listCalc)
|
|
{
|
|
await OrdRService.UpdateAwaitStateAsync(item.OrderRowID, true, true);
|
|
}
|
|
await InvokeAsync(StateHasChanged);
|
|
|
|
// verifica preliminare UID
|
|
await OrdRService.FixUidAsync(OrderID);
|
|
await OrdRService.FixImgTypeAsync(OrderID);
|
|
|
|
// ricalcolo di tutte le BOM e relativi prezzi...
|
|
foreach (var item in listCalc)
|
|
{
|
|
// chiedo BOM e immagine
|
|
await reqBomUpdate(item);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Verifica e ricalcolo dei prezzi degli items nell'Ordine
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private async Task OrderUpdatePrices()
|
|
{
|
|
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Confermi di voler ricalcolare Ordine a costi correnti?"))
|
|
return;
|
|
|
|
await DoRecalcOrder(true);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Ricevuto HwOpt, processo
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private async void PipeHwOpt_EA_NewMessage(object? sender, EventArgs e)
|
|
{
|
|
// vale SOLO SE sono in editing...
|
|
if (EditRecord != null)
|
|
{
|
|
// aggiorno visualizzazione
|
|
PubSubEventArgs currArgs = (PubSubEventArgs)e;
|
|
// conversione on-the-fly SVG da mostrare
|
|
if (!string.IsNullOrEmpty(currArgs.newMessage))
|
|
{
|
|
if (currArgs.msgUid.Equals($"{chHwOpt}:{EditRecord.OrderRowUID}"))
|
|
{
|
|
var rawDict = JsonConvert.DeserializeObject<Dictionary<int, string>>(currArgs.newMessage) ?? new Dictionary<int, string>();
|
|
currHwOption = rawDict;
|
|
// salvo in live data...
|
|
CurrData.DictOptionsXml = currHwOption;
|
|
}
|
|
await InvokeAsync(StateHasChanged);
|
|
}
|
|
}
|
|
}
|
|
|
|
private async void PipePng_EA_NewMessage(object? sender, EventArgs e)
|
|
{
|
|
// vale SOLO SE sono in editing...
|
|
if (EditRecord != null)
|
|
{
|
|
// aggiorno visualizzazione
|
|
PubSubEventArgs currArgs = (PubSubEventArgs)e;
|
|
// conversione on-the-fly SVG da mostrare
|
|
if (!string.IsNullOrEmpty(currArgs.newMessage))
|
|
{
|
|
if (currArgs.msgUid.Equals($"{chPng}:{EditRecord.OrderRowUID}"))
|
|
{
|
|
currPng = currArgs.newMessage;
|
|
// non devo passarlo al componente...
|
|
#if false
|
|
// salvo in live data...
|
|
CurrData.SvgPreview = currSvg;
|
|
#endif
|
|
}
|
|
await InvokeAsync(StateHasChanged);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Ricevuta profile list, processo
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private async void PipeProfList_EA_NewMessage(object? sender, EventArgs e)
|
|
{
|
|
// vale SOLO SE sono in editing...
|
|
if (EditRecord != null)
|
|
{
|
|
// aggiorno visualizzazione
|
|
PubSubEventArgs currArgs = (PubSubEventArgs)e;
|
|
// conversione on-the-fly SVG da mostrare
|
|
if (!string.IsNullOrEmpty(currArgs.newMessage))
|
|
{
|
|
if (currArgs.msgUid.Equals($"{chProfList}:{EditRecord.OrderRowUID}"))
|
|
{
|
|
try
|
|
{
|
|
// nuova gestione da DB: attendo 500ms che il DB sia aggiornato
|
|
await Task.Delay(500);
|
|
// rileggo DB x info profili
|
|
AvailProfileList = await CPService.GetAllAsync();
|
|
// converto i profili nel nuovo formato x payload...
|
|
var profList = AvailProfileList.Select(x => new ProfilePayload()
|
|
{
|
|
ProfileName = x.Code,
|
|
ThresholdList = x.ThresholdList,
|
|
ParameterDict = x.ProfileDataDict
|
|
}).ToList();
|
|
SetupList.ProfileList = profList;
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
await InvokeAsync(StateHasChanged);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Ricevuta shape, procersso
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private async void PipeShape_EA_NewMessage(object? sender, EventArgs e)
|
|
{
|
|
// vale SOLO SE sono in editing...
|
|
if (EditRecord != null)
|
|
{
|
|
#if false
|
|
// aggiorno visualizzazione
|
|
PubSubEventArgs currArgs = (PubSubEventArgs)e;
|
|
// conversione on-the-fly SVG da mostrare
|
|
if (!string.IsNullOrEmpty(currArgs.newMessage))
|
|
{
|
|
if (currArgs.msgUid.Equals($"{shapeChannel}:{EditRecord.OrderRowUID}"))
|
|
{
|
|
currGroupShape = currArgs.newMessage;
|
|
// salvo in live data...
|
|
CurrData.DictShape = currGroupShape;
|
|
}
|
|
await InvokeAsync(StateHasChanged);
|
|
}
|
|
#endif
|
|
|
|
// aggiorno visualizzazione
|
|
PubSubEventArgs currArgs = (PubSubEventArgs)e;
|
|
// conversione on-the-fly SVG da mostrare
|
|
if (!string.IsNullOrEmpty(currArgs.newMessage))
|
|
{
|
|
if (currArgs.msgUid.StartsWith($"{chShape}:{EditRecord.OrderRowUID}"))
|
|
{
|
|
// deserializzo il dizionario delle risposte...
|
|
var rawDict = JsonConvert.DeserializeObject<Dictionary<int, string>>(currArgs.newMessage);
|
|
#if false
|
|
int groupId = 0;
|
|
// verifica del groupID...
|
|
int.TryParse(currArgs.msgUid.Replace($"{shapeChannel}:{windowUid}:", ""), out groupId);
|
|
if (currGroupShape.ContainsKey(groupId))
|
|
{
|
|
currGroupShape[groupId] = currArgs.newMessage;
|
|
}
|
|
else
|
|
{
|
|
currGroupShape.Add(groupId, currArgs.newMessage);
|
|
}
|
|
#endif
|
|
currGroupShape = rawDict ?? new Dictionary<int, string>();
|
|
CurrData.DictShape = currGroupShape;
|
|
}
|
|
await InvokeAsync(StateHasChanged);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Ricevuto SVG, se � il mio lo aggiorno...
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private async void PipeSvg_EA_NewMessage(object? sender, EventArgs e)
|
|
{
|
|
// vale SOLO SE sono in editing...
|
|
if (EditRecord != null)
|
|
{
|
|
// aggiorno visualizzazione
|
|
PubSubEventArgs currArgs = (PubSubEventArgs)e;
|
|
// conversione on-the-fly SVG da mostrare
|
|
if (!string.IsNullOrEmpty(currArgs.newMessage))
|
|
{
|
|
if (currArgs.msgUid.Equals($"{chSvg}:{EditRecord.OrderRowUID}"))
|
|
{
|
|
currSvg = currArgs.newMessage;
|
|
// salvo in live data...
|
|
CurrData.SvgPreview = currSvg;
|
|
}
|
|
await InvokeAsync(StateHasChanged);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Task verifica update ricevuti
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private async void PipeUpdate_EA_NewMessage(object? sender, EventArgs e)
|
|
{
|
|
// aggiorno visualizzazione
|
|
PubSubEventArgs currArgs = (PubSubEventArgs)e;
|
|
// conversione on-the-fly SVG da mostrare
|
|
if (!string.IsNullOrEmpty(currArgs.newMessage))
|
|
{
|
|
// cerco se faccia parte dei record correnti...
|
|
var recFound = AllRecords.Any(x => x.OrderRowUID == currArgs.newMessage);
|
|
if (recFound)
|
|
{
|
|
isLoading = true;
|
|
await Task.Delay(1);
|
|
// se si tratta dell'UID corrente --> fa update
|
|
await DoRecalcOrder(false);
|
|
await InvokeAsync(StateHasChanged);
|
|
}
|
|
}
|
|
await Task.Delay(1);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Preparazione dati x componente edit JWD
|
|
/// </summary>
|
|
/// <param name="currJwd"></param>
|
|
private void PrepareWindowData(string currJwd)
|
|
{
|
|
// converto i profili nel nuovo formato x payload...
|
|
var profList = AvailProfileList.Select(x => new ProfilePayload()
|
|
{
|
|
ProfileName = x.Code,
|
|
ThresholdList = x.ThresholdList,
|
|
ParameterDict = x.ProfileDataDict
|
|
}).ToList();
|
|
|
|
// preparo conf oggetti x controllo
|
|
SetupList = SetupList = new BaseListPayload()
|
|
{
|
|
ColorMaterial = AvailColorMaterialList,
|
|
FamilyHardware = AvailFamilyHardwareList,
|
|
Glass = AvailGlassList,
|
|
Hardware = AvailHardwareList,
|
|
Material = AvailMaterialList,
|
|
ProfileList = profList
|
|
};
|
|
CurrData = new LivePayload()
|
|
{
|
|
CurrJwd = currJwd,
|
|
SvgPreview = currSvg
|
|
};
|
|
}
|
|
|
|
/// <summary>
|
|
/// init classi configurazione
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private async Task ReloadBaseList()
|
|
{
|
|
// lettura config setup varie da DB/Cache Redis
|
|
AllConfEnvir = await EPService.GetAllAsync();
|
|
AllConfGlass = await CGService.GetAllAsync();
|
|
AvailProfileList = await CPService.GetAllAsync();
|
|
AllProdPlant = await PPService.GetAllAsync();
|
|
|
|
// FixMe ToDo rimuovere vers redis obsolete
|
|
var rawProfiles = await CDService.ProfileListAsync(cEnvir, "Default");
|
|
// se fosse vuoto chiamo update...
|
|
if (rawProfiles == null || rawProfiles.Count == 0)
|
|
{
|
|
await callRefreshProfList();
|
|
// aspetto 200ms... e richiedo!
|
|
await Task.Delay(200);
|
|
rawProfiles = await CDService.ProfileListAsync(cEnvir, "Default");
|
|
}
|
|
AvailProfileListOld = rawProfiles;
|
|
|
|
var rawHw = await CDService.HwModelListAsync(cEnvir, "HW.AGB");
|
|
// hw filtro solo validi...
|
|
AllConfHardware = rawHw
|
|
.Where(x => !x.FamilyName.Equals(x.Description, StringComparison.OrdinalIgnoreCase))
|
|
.ToList();
|
|
AllConfWood = await CWService.GetAllAsync();
|
|
AllColors = await GVService.GetFiltAsync("WoodCol");
|
|
// conversione tipi
|
|
AvailGlassList = AllConfGlass
|
|
.Select(x => x.Description)
|
|
.ToList();
|
|
AvailFamilyHardwareList = AllConfHardware
|
|
.DistinctBy(x => x.FamilyName)
|
|
.OrderBy(x => x.FamilyName)
|
|
.Select(x => x.FamilyName)
|
|
.ToList();
|
|
AvailHardwareList = AllConfHardware
|
|
.Select(x => new Egw.Window.Data.Hardware(x.Id, x.FamilyName, x.Description, x.OpeningType, x.Shape, x.SashQty, x.SashPosition))
|
|
.ToList();
|
|
AvailMaterialList = AllConfWood
|
|
.Select(x => x.Description)
|
|
.ToList();
|
|
// FixMe Todo: aggiunta profili (manca anche nel costruttore...)
|
|
AvailColorMaterialList = AllColors
|
|
.OrderBy(x => x.Index)
|
|
.Select(x => x.ValString)
|
|
.ToList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Legge i dati dei record completi
|
|
/// </summary>
|
|
private async Task ReloadDataAsync()
|
|
{
|
|
if (OrderID > 0)
|
|
{
|
|
AllRecords = await OrdRService.GetByParentAsync(OrderID);
|
|
totalCount = AllRecords.Count();
|
|
// faccio un controllo/fix dei record
|
|
int numFix = await OrdRService.ValidateAsync(AllRecords);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Eliminazione file (old)
|
|
/// </summary>
|
|
/// <param name="secureName">Nome secure da impiegare</param>
|
|
/// <param name="content">Contenuto file</param>
|
|
private bool removeOldFile(string folderPath, string secureName)
|
|
{
|
|
bool answ = false;
|
|
if (!string.IsNullOrEmpty(folderPath))
|
|
{
|
|
// calcolo path file...
|
|
string filePath = Path.Combine(basePath, folderPath, secureName);
|
|
// se esiste...
|
|
if (File.Exists(filePath))
|
|
{
|
|
File.Delete(filePath);
|
|
}
|
|
}
|
|
return answ;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Invio richiesta balance ordine
|
|
/// </summary>
|
|
/// <param name="balData"></param>
|
|
/// <returns></returns>
|
|
private async Task ReqBalance(BalanceReqDto balData)
|
|
{
|
|
if (WorkLoadRecord != null && balData != null && balData.TagList.Count > 0)
|
|
{
|
|
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Confermi richiesta bilanciamento carico per {balData.TagList.Count} articoli?"))
|
|
return;
|
|
|
|
// preparo oggetto richiesta
|
|
|
|
// verifico parametri da conf envir...
|
|
var envRec = AllConfEnvir.FirstOrDefault(x => x.EnvirID == CurrRecord.Envir);
|
|
Egw.Window.Data.Enums.QuestionModes cMode = Egw.Window.Data.Enums.QuestionModes.ORDER;
|
|
Egw.Window.Data.Enums.QuestionOrderSubModes cSubMode = Egw.Window.Data.Enums.QuestionOrderSubModes.BALANCE;
|
|
string reqKey = "";
|
|
// preparo la richiesta di bilanciamento
|
|
CalcRequestDTO calcReq = new CalcRequestDTO();
|
|
// elenco tags ricevuto...
|
|
List<string> TagList = balData.TagList;
|
|
string serTagList = string.Join(",", TagList);
|
|
|
|
// preparo richiesta serializzata e la accodo (viene inviata richiesta calcolo)
|
|
Dictionary<string, string> dictArgs = new Dictionary<string, string>();
|
|
// creo registrazione richiesta...
|
|
var ruid = await CRService.AddRequestAsync($"{CurrRecord.Envir}", $"{(int)cMode}-{(int)cSubMode}", WorkLoadRecord.UID);
|
|
dictArgs.Add("UID", WorkLoadRecord.UID);
|
|
dictArgs.Add("Group", $"99");
|
|
// aggiungo RUID effettivo
|
|
dictArgs.Add("RUID", ruid);
|
|
dictArgs.Add("OrderUID", CurrRecord.OrderCode);
|
|
dictArgs.Add("Mode", $"{(int)cMode}");
|
|
dictArgs.Add("SubMode", $"{(int)cSubMode}");
|
|
dictArgs.Add("TagList", serTagList);
|
|
// serializzo la richiesta di bilanciamento...
|
|
string reqBalance = JsonConvert.SerializeObject(balData.MachineBalance);
|
|
dictArgs.Add("ReqBalance", reqBalance);
|
|
dictArgs.Add("BarLenght", $"{balData.BarLenght}");
|
|
calcReq = new CalcRequestDTO()
|
|
{
|
|
DictExec = dictArgs,
|
|
EnvType = CurrRecord.Envir
|
|
};
|
|
// chiave: composta da cMode, submode, UID riga...
|
|
reqKey = $"{cMode}:{cSubMode}:{WorkLoadRecord.UID}";
|
|
// invio richiesta
|
|
await PService.EnqueueRequestAsync("Balance", reqKey, calcReq);
|
|
// parto dalla history attuale
|
|
var currHist = CurrRecord.LogHistory;
|
|
// aggiungo evento...
|
|
currHist.Add(new TaskHistDTO()
|
|
{
|
|
DtEvent = DateTime.Now,
|
|
UserName = "Default User",
|
|
Message = $"{reqKey}",
|
|
IconCss = "fa-solid fa-hourglass-start"
|
|
});
|
|
CurrRecord.LogHistory = currHist;
|
|
await OrdService.UpsertAsync(CurrRecord);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Effettua vera richiesta della BOM
|
|
/// </summary>
|
|
/// <param name="currRec"></param>
|
|
/// <returns></returns>
|
|
private async Task reqBomUpdate(OrderRowModel currRec)
|
|
{
|
|
// salvo richiesta BOM su record
|
|
currRec.AwaitBom = true;
|
|
currRec.AwaitPrice = true;
|
|
await OrdRService.UpdateAwaitStateAsync(currRec.OrderRowID, true, true);
|
|
|
|
// preparo la domanda serializzata
|
|
Dictionary<string, string> DictExec = new Dictionary<string, string>();
|
|
// verifico parametri da conf envir...
|
|
var envRec = AllConfEnvir.FirstOrDefault(x => x.EnvirID == currRec.Envir);
|
|
string serKey = envRec != null ? envRec.SerStrucKey : "SerializedData";
|
|
// cablata la BOM
|
|
DictExec.Add("Mode", $"{(int)Egw.Window.Data.Enums.QuestionModes.BOM}");
|
|
// UID cablato x ora...
|
|
DictExec.Add("UID", currRec.OrderRowUID);
|
|
// aggiungo file secondo ambiente...
|
|
switch (currRec.Envir)
|
|
{
|
|
case EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW:
|
|
DictExec.Add(serKey, currRec.SerStruct);
|
|
break;
|
|
|
|
case EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.BEAM:
|
|
case EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WALL:
|
|
case EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.CABINET:
|
|
// rileggo da file...
|
|
string folderPath = FolderPath(currRec.OrderID);
|
|
string rawData = LoadFileContent(folderPath, currRec.FileResource);
|
|
DictExec.Add(serKey, rawData);
|
|
DictExec.Add("FileName", currRec.FileName);
|
|
break;
|
|
|
|
case EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.NULL:
|
|
default:
|
|
break;
|
|
}
|
|
|
|
CalcRequestDTO req = new CalcRequestDTO()
|
|
{
|
|
EnvType = currRec.Envir,
|
|
DictExec = DictExec
|
|
};
|
|
|
|
await InvokeAsync(StateHasChanged);
|
|
|
|
// chiamo la chiamata POST alla API, che manda la richiesta via REDIS
|
|
await CService.CallRestPost($"{apiUrl}/{genericBasePath}", $"{calcTag}/{currRec.OrderRowUID}", req);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Lancia la richiesta di ricaolo della BOM dal JWD (o equivalente)
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private async Task RequestBom(OrderRowModel currRec)
|
|
{
|
|
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Confermi di voler ricalcolare la BOM?"))
|
|
return;
|
|
|
|
await reqBomUpdate(currRec);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Rimette da coda running in waiting il Job del WLD corrente
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private async Task ReRunJob()
|
|
{
|
|
if (WorkLoadRecord != null && SelRecord != null)
|
|
{
|
|
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler rimettere in coda il calcolo?"))
|
|
return;
|
|
|
|
string JobCode = $"ORDER:ESTIMATE:{WorkLoadRecord.UID}";
|
|
await PService.ReRunJobAsync(SelRecord.Envir, JobCode);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Esegue reset assegnazioni
|
|
/// </summary>
|
|
/// <param name="args"></param>
|
|
/// <returns></returns>
|
|
private async Task ResetAssign(int OrderRowID)
|
|
{
|
|
await PIService.ResetAssignAsync(OrderRowID);
|
|
await ForceOrderReload(OrderRowID);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Css di verifica riga selezionata
|
|
/// </summary>
|
|
/// <param name="selRow"></param>
|
|
/// <returns></returns>
|
|
private string RowClass(OrderRowModel selRow)
|
|
{
|
|
return EditRecord != null && EditRecord.OrderRowID == selRow.OrderRowID ? "table-info" : "";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Salvataggio dei dati del file caricato
|
|
/// </summary>
|
|
/// <param name="fileDict">Dizionario info file</param>
|
|
private void SaveFile(Dictionary<string, string> fileDict)
|
|
{
|
|
// verifico di essere in edit...
|
|
if (EditRecord != null)
|
|
{
|
|
string folderPath = FolderPath(EditRecord.OrderID);
|
|
// verifico di avere parametri...
|
|
if (fileDict != null && fileDict.Count > 0)
|
|
{
|
|
string secureName = "";
|
|
string content = "";
|
|
if (fileDict.ContainsKey("secureName"))
|
|
{
|
|
secureName = fileDict["secureName"];
|
|
}
|
|
if (fileDict.ContainsKey("content"))
|
|
{
|
|
content = fileDict["content"];
|
|
}
|
|
if (!string.IsNullOrEmpty(folderPath) && !string.IsNullOrEmpty(secureName) && !string.IsNullOrEmpty(content))
|
|
{
|
|
// salvo!
|
|
saveFileContent(folderPath, secureName, content);
|
|
}
|
|
}
|
|
// altrimenti signifca cleanup eventuale vecchio file...
|
|
else
|
|
{
|
|
removeOldFile(folderPath, EditRecord.FileResource);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Esegue salvataggio del file ricevuto
|
|
/// </summary>
|
|
/// <param name="folderPath">Path relativo x file (tipicamente UID parent order)</param>
|
|
/// <param name="secureName">Nome secure da impiegare</param>
|
|
/// <param name="content">Contenuto file</param>
|
|
private bool saveFileContent(string folderPath, string secureName, string content)
|
|
{
|
|
bool answ = false;
|
|
if (!string.IsNullOrEmpty(folderPath))
|
|
{
|
|
// calcolo path file...
|
|
string filePath = Path.Combine(basePath, folderPath, secureName);
|
|
string? directoryPath = Path.GetDirectoryName(filePath);
|
|
try
|
|
{
|
|
if (!string.IsNullOrEmpty(directoryPath))
|
|
{
|
|
Directory.CreateDirectory(directoryPath);
|
|
}
|
|
File.WriteAllText(filePath, content);
|
|
}
|
|
catch (Exception exc)
|
|
{
|
|
Log.Error($"Exception on save{Environment.NewLine}{exc}");
|
|
}
|
|
}
|
|
return answ;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Selezione e fix dati BOM
|
|
/// </summary>
|
|
/// <param name="currRow"></param>
|
|
/// <returns></returns>
|
|
private async Task selectBom(OrderRowModel currRow)
|
|
{
|
|
EditRecord = currRow;
|
|
CurrBomList = BomCalculator.GetBomList(EditRecord.ItemBOM);
|
|
if (CurrBomList.Any(x => x.ItemID == 0))
|
|
{
|
|
CurrBomList = await ItemService.GetBomFixItemIdAsync(CurrBomList);
|
|
}
|
|
}
|
|
|
|
private async Task setAwaitPrice(bool awaitPrice, bool flushCache)
|
|
{
|
|
foreach (var item in AllRecords)
|
|
{
|
|
item.AwaitPrice = awaitPrice;
|
|
await OrdRService.UpdateAwaitStateAsync(item.OrderRowID, null, awaitPrice, flushCache);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Verifia ammissibilit� display btn ricalcolo BOM da item
|
|
/// </summary>
|
|
/// <param name="reqItem"></param>
|
|
/// <returns></returns>
|
|
private bool ShowBom(OrderRowModel reqItem)
|
|
{
|
|
bool answ = false;
|
|
if (DisplayMode == EgwCoreLib.Lux.Core.Enums.DisplayMode.Edit)
|
|
{
|
|
switch (reqItem.Envir)
|
|
{
|
|
case EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW:
|
|
answ = !string.IsNullOrEmpty(reqItem.SerStruct) && reqItem.SerStruct.Length > 2;
|
|
break;
|
|
|
|
case EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.BEAM:
|
|
case EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WALL:
|
|
case EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.CABINET:
|
|
// da cambiare con ricerca file su disco?!?
|
|
answ = !string.IsNullOrEmpty(reqItem.FileResource) && !string.IsNullOrEmpty(reqItem.FileName);
|
|
break;
|
|
|
|
case EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.NULL:
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
return answ;
|
|
}
|
|
|
|
/// <summary>
|
|
/// salva dettaglio workload x mostrare tipo pezzi richiesti
|
|
/// </summary>
|
|
/// <param name="detailRec"></param>
|
|
private async Task ShowWLD(MergedOrderRow mergeRec, EditMode reqMode)
|
|
{
|
|
CurrEditMode = reqMode;
|
|
EditRecord = null;
|
|
SelRecord = mergeRec.Original;
|
|
WorkLoadRecord = mergeRec.WorkLoad;
|
|
// recupero i prodassign data...
|
|
List<ProductionGroupModel>? curList = await PGService.GetByOrderRowAsync(SelRecord.OrderRowID);
|
|
#if false
|
|
// se non avessi tutte le macchine configurate --> chiamo fix!
|
|
if (curList == null || curList.Count == 0 || curList.Count < AllProdPlant.Count())
|
|
{
|
|
//var currMachLilst = WorkLoadRecord?.ListMachines ?? AllProdPlant.Select(x => x.ProdPlantCod).ToList();
|
|
// metto tutte le macchine configurate, DA DISCUTERE...
|
|
var currMachLilst = AllProdPlant.Select(x => x.ProdPlantCod).ToList();
|
|
curList = await DLService.ProdAssignCheckExist(SelRecord.OrderRowID, currMachLilst);
|
|
}
|
|
#endif
|
|
ListProdAssign = curList;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Elenco SalesOfferRows calcolabili:
|
|
/// - contengono serializzazione come JWD
|
|
/// - contengono file come BTL
|
|
/// </summary>
|
|
private List<OrderRowModel> SorListCalc()
|
|
{
|
|
var rawList = AllRecords
|
|
.Where(x => (!string.IsNullOrEmpty(x.SerStruct) && x.SerStruct.Length > 2) || (!string.IsNullOrEmpty(x.FileName) && !string.IsNullOrEmpty(x.FileResource)))
|
|
.ToList();
|
|
return rawList ?? new List<OrderRowModel>();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Toggle visibilit� modifica file indicando ID della OfferRow corrente (o zero se deselect)
|
|
/// </summary>
|
|
private void ToggleFileEdit(OrderRowModel? currRec)
|
|
{
|
|
CurrEditMode = currRec == null ? EditMode.None : EditMode.File;
|
|
EditRecord = currRec;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Salva nel record corrente la BOM aggiornata e poi ricalcola importo...
|
|
/// </summary>
|
|
/// <param name="newBomList"></param>
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
private async Task UpdateBom(List<BomItemDTO> newBomList)
|
|
{
|
|
if (EditRecord != null)
|
|
{
|
|
// salvo BOM nel record corrente...
|
|
bool fatto = await OrdRService.UpdateBomAsync(EditRecord.OrderRowID, newBomList);
|
|
// ricalcolo offerta completa
|
|
await ReloadDataAsync();
|
|
UpdateTable();
|
|
// rilegge il record da elenco appena rinfrescato...
|
|
int OrderRowID = EditRecord.OrderRowID;
|
|
var updRec = AllRecords.FirstOrDefault(x => x.OrderRowID == OrderRowID);
|
|
if (updRec != null)
|
|
{
|
|
CurrBomList = new List<BomItemDTO>();
|
|
// fa refresh dei dati della BOM visualizzata
|
|
await selectBom(updRec);
|
|
await InvokeAsync(StateHasChanged);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Filtro e paginazione
|
|
/// </summary>
|
|
private void UpdateTable()
|
|
{
|
|
// fix paginazione
|
|
var filtRecords = AllRecords
|
|
.OrderBy(x => x.RowNum)
|
|
.Skip(numRecord * (currPage - 1))
|
|
.Take(numRecord)
|
|
.ToList();
|
|
ListRecords = MergeRecord(filtRecords);
|
|
isLoading = false;
|
|
}
|
|
|
|
private async Task UploadFile(InputFileChangeEventArgs e)
|
|
{
|
|
// Proseguo solo se sono in interattivo (NO prerender pagina)
|
|
if (isInteractive)
|
|
{
|
|
if (EditRecord != null)
|
|
{
|
|
// init dizionari arg richiesta update
|
|
Dictionary<string, string> fileArgs = new Dictionary<string, string>();
|
|
|
|
// leggo il contenuto del PRIMO (singolo) file
|
|
IBrowserFile file = e.File;
|
|
// limite file size (al momento 10 MB)
|
|
var maxAllowedSize = 10 * 1024 * 1024;
|
|
|
|
using var stream = file.OpenReadStream(maxAllowedSize);
|
|
using var reader = new StreamReader(stream);
|
|
string rawContent = await reader.ReadToEndAsync();
|
|
|
|
// calcolo il nome del file trusted...
|
|
string trustedFileName = Path.GetRandomFileName();
|
|
EditRecord.FileResource = trustedFileName;
|
|
EditRecord.FileName = file.Name;
|
|
EditRecord.FileSize = rawContent.LongCount();
|
|
// salvo sul DB i dati (nome, nome sicuro, size...)
|
|
await OrdRService.UpdateFileDataAsync(EditRecord);
|
|
|
|
// parametri richiesta
|
|
fileArgs.Add("Mode", $"{(int)Egw.Window.Data.Enums.QuestionModes.PREVIEW}");
|
|
fileArgs.Add("SubMode", "2");
|
|
fileArgs.Add("FileName", $"{file.Name}");
|
|
fileArgs.Add("Height", "1200");
|
|
fileArgs.Add("Width", "1800");
|
|
//fileArgs.Add("Btl", rawContent);
|
|
fileArgs.Add("SerializedData", rawContent);
|
|
// invio!
|
|
CalcRequestDTO calcRequestDTO = new CalcRequestDTO();
|
|
calcRequestDTO.EnvType = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.BEAM;
|
|
calcRequestDTO.DictExec = fileArgs;
|
|
await ICService.CallRestPost($"{apiUrl}/{genericBasePath}", $"{calcTag}/{EditRecord.OrderRowUID}", calcRequestDTO);
|
|
|
|
// ora chiedo anche la BOM!
|
|
|
|
#if false
|
|
// salvo in locale il file: SISTEMARE PERMESSI
|
|
saveFileContent(EditFileRecord.OrderRowUID, trustedFileName, rawContent);
|
|
#endif
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Restituisce struttura dettaglio WorkLoad x item
|
|
/// </summary>
|
|
/// <param name="UID"></param>
|
|
/// <param name="rawData"></param>
|
|
/// <returns></returns>
|
|
private WorkLoadDetailDTO WorkLoadDetail(string UID, string rawData)
|
|
{
|
|
var currWLD = new WorkLoadDetailDTO(UID, rawData);
|
|
return currWLD;
|
|
}
|
|
|
|
#endregion Private Methods
|
|
|
|
/// <summary>
|
|
/// Esegue lettura file + invio richiesta specifica
|
|
/// </summary>
|
|
/// <param name="e"></param>
|
|
/// <returns></returns>
|
|
}
|
|
} |