Completato giro update info batch detail split x ora
This commit is contained in:
+24
-1
@@ -794,6 +794,29 @@ namespace AppData
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stato batch (bozza/stima/nesting...)
|
||||
/// </summary>
|
||||
/// <param name="BatchId"></param>
|
||||
/// <returns></returns>
|
||||
public static BatchStatus BStatus(int BatchId)
|
||||
{
|
||||
DataLayer DLMan = new DataLayer();
|
||||
BatchStatus answ = BatchStatus.Imported;
|
||||
DS_App.BatchListDataTable tabBatch = DLMan.taBL.getByKey(BatchId);
|
||||
if (tabBatch != null && tabBatch.Count > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
// mostro split se di tipo 1...
|
||||
answ = (BatchStatus)tabBatch[0].STATUS;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tipo batch tra ancestor/descendant
|
||||
/// </summary>
|
||||
@@ -802,7 +825,7 @@ namespace AppData
|
||||
public static BatchType BType(int BatchId)
|
||||
{
|
||||
DataLayer DLMan = new DataLayer();
|
||||
BatchType answ = NKC_SDK.BatchType.Original;
|
||||
BatchType answ = BatchType.Original;
|
||||
DS_App.BatchListDataTable tabBatch = DLMan.taBL.getByKey(BatchId);
|
||||
if (tabBatch != null && tabBatch.Count > 0)
|
||||
{
|
||||
|
||||
@@ -477,6 +477,9 @@
|
||||
<Content Include="site\UpdMan.aspx" />
|
||||
<Content Include="WebUserControls\cmp_barcode.ascx" />
|
||||
<Content Include="WebUserControls\cmp_batchDetail.ascx" />
|
||||
<Content Include="WebUserControls\cmp_batchDetailData.ascx" />
|
||||
<Content Include="WebUserControls\cmp_batchDetailSplit.ascx" />
|
||||
<Content Include="WebUserControls\cmp_batchDetailSplitInfo.ascx" />
|
||||
<Content Include="WebUserControls\cmp_batchList.ascx" />
|
||||
<Content Include="WebUserControls\cmp_binDetIRK.ascx" />
|
||||
<Content Include="WebUserControls\cmp_BP_bunkList.ascx" />
|
||||
@@ -1098,6 +1101,27 @@
|
||||
<Compile Include="WebUserControls\cmp_batchDetail.ascx.designer.cs">
|
||||
<DependentUpon>cmp_batchDetail.ascx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WebUserControls\cmp_batchDetailData.ascx.cs">
|
||||
<DependentUpon>cmp_batchDetailData.ascx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="WebUserControls\cmp_batchDetailData.ascx.designer.cs">
|
||||
<DependentUpon>cmp_batchDetailData.ascx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WebUserControls\cmp_batchDetailSplit.ascx.cs">
|
||||
<DependentUpon>cmp_batchDetailSplit.ascx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="WebUserControls\cmp_batchDetailSplit.ascx.designer.cs">
|
||||
<DependentUpon>cmp_batchDetailSplit.ascx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WebUserControls\cmp_batchDetailSplitInfo.ascx.cs">
|
||||
<DependentUpon>cmp_batchDetailSplitInfo.ascx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="WebUserControls\cmp_batchDetailSplitInfo.ascx.designer.cs">
|
||||
<DependentUpon>cmp_batchDetailSplitInfo.ascx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WebUserControls\cmp_batchList.ascx.cs">
|
||||
<DependentUpon>cmp_batchList.ascx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_batchDetail.ascx.cs" Inherits="NKC_WF.WebUserControls.cmp_batchDetail" %>
|
||||
<%@ Register Src="~/WebUserControls/cmp_orderExtList.ascx" TagPrefix="uc1" TagName="cmp_orderExtList" %>
|
||||
<%@ Register Src="~/WebUserControls/cmp_batchDetailSplit.ascx" TagPrefix="uc1" TagName="cmp_batchDetailSplit" %>
|
||||
|
||||
<%--<%@ Register Src="~/WebUserControls/cmp_orderExtList.ascx" TagPrefix="uc1" TagName="cmp_orderExtList" %>--%>
|
||||
|
||||
<asp:FormView ID="frmView" runat="server" DataKeyNames="BatchID" DataSourceID="ods" Width="100%">
|
||||
<ItemTemplate>
|
||||
@@ -96,7 +98,10 @@
|
||||
<asp:Label runat="server" ID="lblTestJson" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="card" runat="server" id="divSplit">
|
||||
<div runat="server" id="divSplit">
|
||||
<uc1:cmp_batchDetailSplit runat="server" id="cmp_batchDetailSplit" />
|
||||
</div>
|
||||
<%--<div class="card" runat="server" id="divSplit">
|
||||
<div class="card-header text-center">
|
||||
<h5><%: traduci("BatchSplit") %></h5>
|
||||
<asp:HiddenField runat="server" ID="hfNeedSave" />
|
||||
@@ -122,7 +127,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-1">
|
||||
<uc1:cmp_orderExtList runat="server" ID="cmp_orderExtListNE01" />
|
||||
<uc1:cmp_orderextlist runat="server" id="cmp_orderExtListNE01" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -142,10 +147,10 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-1">
|
||||
<uc1:cmp_orderExtList runat="server" ID="cmp_orderExtListNE02" />
|
||||
<uc1:cmp_orderextlist runat="server" id="cmp_orderExtListNE02" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>--%>
|
||||
@@ -10,16 +10,9 @@ namespace NKC_WF.WebUserControls
|
||||
{
|
||||
public partial class cmp_batchDetail : BaseUserControl
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
// place master hard-coded
|
||||
protected string PlaceCod = "VIRTNE";
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected bool batchIsAncestor
|
||||
protected bool BatchIsAncestor
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -27,96 +20,6 @@ namespace NKC_WF.WebUserControls
|
||||
}
|
||||
}
|
||||
|
||||
protected double fullTime
|
||||
{
|
||||
get
|
||||
{
|
||||
double answ = 1;
|
||||
if (!string.IsNullOrEmpty(hfFullTime.Value))
|
||||
{
|
||||
double.TryParse(hfFullTime.Value, out answ);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
hfFullTime.Value = $"{value}";
|
||||
}
|
||||
}
|
||||
|
||||
protected int lastValRatio
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 50;
|
||||
if (!string.IsNullOrEmpty(hfLastRatio.Value))
|
||||
{
|
||||
int.TryParse(hfLastRatio.Value, out answ);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
hfLastRatio.Value = $"{value}";
|
||||
}
|
||||
}
|
||||
|
||||
protected bool needSave
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = true;
|
||||
bool.TryParse(hfNeedSave.Value, out answ);
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
hfNeedSave.Value = $"{value}";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tabella dei batch Descendant di quello corrente
|
||||
/// </summary>
|
||||
protected DS_App.BatchListDataTable TabBatchDesc
|
||||
{
|
||||
get
|
||||
{
|
||||
return ComLib.BatchDescendant(BatchId);
|
||||
}
|
||||
}
|
||||
|
||||
protected DS_App.OrderListTreeDataTable TabOrders
|
||||
{
|
||||
get
|
||||
{
|
||||
// cerco in redis
|
||||
return ComLib.OrdersExtByBatch(BatchId);
|
||||
}
|
||||
}
|
||||
|
||||
protected int valRatio
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 50;
|
||||
if (!string.IsNullOrEmpty(txtRatio.Text))
|
||||
{
|
||||
int.TryParse(txtRatio.Text, out answ);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
txtRatio.Text = $"{value}";
|
||||
// scrivo ANCHE i valori assoluti
|
||||
lblRatio01.Text = $"{valRatio} %";
|
||||
lblRatio02.Text = $"{100 - valRatio} %";
|
||||
lblTime01.Text = $"{fullTime * value / (100 * 60):N2} h";
|
||||
lblTime02.Text = $"{fullTime * (100 - value) / (100 * 60):N2} h";
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
@@ -309,11 +212,9 @@ namespace NKC_WF.WebUserControls
|
||||
lblTestJson.Text = "<hr/>" + sbDebug.Replace("\r\n", "<br/>").ToString();
|
||||
}
|
||||
}
|
||||
cmp_batchDetailSplit.BatchId = value;
|
||||
if (BatchId > 0)
|
||||
{
|
||||
checkCreateDescendant();
|
||||
showBatchDescendant();
|
||||
fixChildBatch();
|
||||
fixDisplayDesc();
|
||||
}
|
||||
}
|
||||
@@ -341,211 +242,15 @@ namespace NKC_WF.WebUserControls
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void checkCreateDescendant()
|
||||
{
|
||||
// se ho un batchId...
|
||||
if (BatchId != 0)
|
||||
{
|
||||
// verifico se ho descendant
|
||||
if (TabBatchDesc.Rows.Count == 0)
|
||||
{
|
||||
// altrimenti creo...
|
||||
DLMan.taBL.makeDescendantByKey(BatchId, PlaceCod);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void fixChildBatch()
|
||||
{
|
||||
DS_App.BatchListDataTable TabBatch = TabBatchDesc;
|
||||
cmp_orderExtListNE01.BatchId = TabBatch.Rows.Count > 0 ? TabBatchDesc[0].BatchID : 0;
|
||||
cmp_orderExtListNE02.BatchId = TabBatch.Rows.Count > 0 ? TabBatchDesc[1].BatchID : 0;
|
||||
cmp_orderExtListNE01.doUpdate();
|
||||
cmp_orderExtListNE02.doUpdate();
|
||||
}
|
||||
|
||||
private void fixDisplayDesc()
|
||||
{
|
||||
divSplit.Visible = batchIsAncestor;
|
||||
}
|
||||
|
||||
private void fixRatio()
|
||||
{
|
||||
// sistemazione ratio calcolata...
|
||||
DS_App.OrderListTreeDataTable tabNe01 = DLMan.taOLT.getByBatch(cmp_orderExtListNE01.BatchId);
|
||||
DS_App.OrderListTreeDataTable tabNe02 = DLMan.taOLT.getByBatch(cmp_orderExtListNE02.BatchId);
|
||||
|
||||
double totTime01 = tabNe01.Sum(x => x.EstProcTime);
|
||||
double totTime02 = tabNe02.Sum(x => x.EstProcTime);
|
||||
|
||||
// aggiorno valore ratio e ratio last...
|
||||
fullTime = totTime01 + totTime02;
|
||||
fullTime = fullTime > 0 ? fullTime : 1;
|
||||
double newRatio = (totTime01 * 100 / fullTime);
|
||||
valRatio = (int)newRatio;
|
||||
lastValRatio = valRatio;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// effettua ribilanciamento ordini partendo da elenco completo e poi assegnando a impianti
|
||||
/// </summary>
|
||||
private void rebalanceOrder()
|
||||
{
|
||||
// solo se variato il ratio...
|
||||
if (valRatio != lastValRatio)
|
||||
{
|
||||
// costruisco vettore durata ordini
|
||||
OrderSetSim FullSet = new OrderSetSim();
|
||||
OrderSetSim SetNe01 = new OrderSetSim();
|
||||
OrderSetSim SetNe02 = new OrderSetSim();
|
||||
|
||||
// creo liste x i valori da processare...
|
||||
Dictionary<int, double> RawList = new Dictionary<int, double>();
|
||||
Dictionary<int, double> OrderedList = new Dictionary<int, double>();
|
||||
|
||||
foreach (var item in TabOrders)
|
||||
{
|
||||
RawList.Add(item.OrdID, item.EstProcTime);
|
||||
}
|
||||
|
||||
// ordino la lista x processing successivo
|
||||
OrderedList = RawList.OrderBy(x => x.Value).ToDictionary(t => t.Key, t => t.Value);
|
||||
|
||||
// salvo i set
|
||||
FullSet.OrderSet = OrderedList;
|
||||
|
||||
// lavoro sull'ottimizzare il MINORE
|
||||
double ValRatio = (double)valRatio / 100;
|
||||
if (ValRatio <= 0.5)
|
||||
{
|
||||
SetNe01.TargetValue = FullSet.ActualValue * ValRatio;
|
||||
SetNe01.OrderSet = findLocalMin(OrderedList, SetNe01.TargetValue);
|
||||
// l'altro è la differenza
|
||||
SetNe02.OrderSet = OrderedList;
|
||||
foreach (var item in SetNe01.OrderSet)
|
||||
{
|
||||
SetNe02.OrderSet.Remove(item.Key);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SetNe02.TargetValue = FullSet.ActualValue * (1 - ValRatio);
|
||||
SetNe02.OrderSet = findLocalMin(OrderedList, SetNe02.TargetValue);
|
||||
// l'altro è la differenza
|
||||
SetNe01.OrderSet = OrderedList;
|
||||
foreach (var item in SetNe02.OrderSet)
|
||||
{
|
||||
SetNe01.OrderSet.Remove(item.Key);
|
||||
}
|
||||
}
|
||||
|
||||
// riorganizzo tabOrders...
|
||||
foreach (var orderItem in TabOrders)
|
||||
{
|
||||
if (SetNe01.OrderSet.ContainsKey(orderItem.OrdID))
|
||||
{
|
||||
if (orderItem.BatchID != cmp_orderExtListNE01.BatchId)
|
||||
{
|
||||
DLMan.taOLT.updateBatch(orderItem.BatchID, orderItem.OrdID, cmp_orderExtListNE01.BatchId);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (orderItem.BatchID != cmp_orderExtListNE02.BatchId)
|
||||
{
|
||||
DLMan.taOLT.updateBatch(orderItem.BatchID, orderItem.OrdID, cmp_orderExtListNE02.BatchId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --> richiede salvataggio
|
||||
needSave = true;
|
||||
}
|
||||
fixRatio();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mostro dati dei Batch descendant
|
||||
/// </summary>
|
||||
private void showBatchDescendant()
|
||||
{
|
||||
// suddivido
|
||||
rebalanceOrder();
|
||||
divSplit.Visible = BatchIsAncestor;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Cerca il set con lo score migliore calcolando x subset della lista ordinata
|
||||
/// </summary>
|
||||
/// <param name="OrderedList">Lista ordinata oggetti (INT) + valore</param>
|
||||
/// <param name="TargetVal">Valore desiderato (comeSOMMA)</param>
|
||||
/// <returns></returns>
|
||||
protected Dictionary<int, double> findLocalMin(Dictionary<int, double> OrderedList, double TargetVal)
|
||||
{
|
||||
Dictionary<int, double> answ = new Dictionary<int, double>();
|
||||
List<OrderSetSim> Candidates = new List<OrderSetSim>();
|
||||
OrderSetSim CurrSimSet = new OrderSetSim();
|
||||
|
||||
// parte dal valore (singolo) più piccolo tra quelli maggiori del target... se c'è...
|
||||
var OrdSup = OrderedList.Where(x => x.Value > TargetVal).OrderBy(x => x.Value);
|
||||
if (OrdSup != null && OrdSup.Any())
|
||||
{
|
||||
var currOrder = OrdSup.FirstOrDefault();
|
||||
CurrSimSet = new OrderSetSim();
|
||||
CurrSimSet.TargetValue = TargetVal;
|
||||
CurrSimSet.OrderSet.Add(currOrder.Key, currOrder.Value);
|
||||
Candidates.Add(CurrSimSet);
|
||||
}
|
||||
|
||||
// ora guardo gli elementi restanti.. se ci sono
|
||||
var OrdInf = OrderedList.Where(x => x.Value <= TargetVal).OrderByDescending(x => x.Value).ToDictionary(t => t.Key, t => t.Value);
|
||||
if (OrdInf != null && OrdInf.Any())
|
||||
{
|
||||
var currOrder = OrdInf.FirstOrDefault();
|
||||
CurrSimSet = new OrderSetSim();
|
||||
CurrSimSet.TargetValue = TargetVal;
|
||||
CurrSimSet.OrderSet.Add(currOrder.Key, currOrder.Value);
|
||||
Candidates.Add(CurrSimSet);
|
||||
// prendo i restanti tranne il primo
|
||||
OrdInf.Remove(currOrder.Key);
|
||||
// se rimane qualcosa...
|
||||
if (OrdInf != null && OrdInf.Any())
|
||||
{
|
||||
// calcolo il minimo locale nei 2 casi, da soli
|
||||
Dictionary<int, double> TestOrderSet01 = findLocalMin(OrdInf, TargetVal);
|
||||
if (TestOrderSet01.Count > 0)
|
||||
{
|
||||
OrderSetSim CurrSet = new OrderSetSim();
|
||||
CurrSet.TargetValue = TargetVal;
|
||||
CurrSet.OrderSet = TestOrderSet01;
|
||||
Candidates.Add(CurrSet);
|
||||
}
|
||||
// ...e con il primo valore...
|
||||
Dictionary<int, double> TestOrderSet02 = findLocalMin(OrdInf, TargetVal - currOrder.Value);
|
||||
TestOrderSet02.Add(currOrder.Key, currOrder.Value);
|
||||
// verifico se migliorativo...
|
||||
if (TestOrderSet02.Count > 0)
|
||||
{
|
||||
OrderSetSim CurrSet = new OrderSetSim();
|
||||
CurrSet.TargetValue = TargetVal - currOrder.Value;
|
||||
CurrSet.OrderSet = TestOrderSet02;
|
||||
Candidates.Add(CurrSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
// cerco il minimo...
|
||||
if (Candidates != null && Candidates.Count > 0)
|
||||
{
|
||||
answ = Candidates.OrderBy(x => x.IndexScore).FirstOrDefault().OrderSet;
|
||||
}
|
||||
|
||||
// calcolo il minimo e lo restituisco...
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected void lbtAccept_Click(object sender, EventArgs e)
|
||||
{
|
||||
// registro accettazione Nesting
|
||||
@@ -569,7 +274,7 @@ namespace NKC_WF.WebUserControls
|
||||
// invia a redis a a richiesta...
|
||||
ComLib.sendMaterials();
|
||||
// controllo SE SIA un batch ANCESTOR --> invio il PRIMO batch da calcolare...
|
||||
if (batchIsAncestor)
|
||||
if (BatchIsAncestor)
|
||||
{
|
||||
// effettuo VERA ri-assegnazione ordini/kit a nuovi batch
|
||||
DLMan.taOLT.setBatchSplit(BatchId, true);
|
||||
@@ -613,15 +318,6 @@ namespace NKC_WF.WebUserControls
|
||||
raiseEvent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Init di base
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnInit(EventArgs e)
|
||||
{
|
||||
checkCreateDescendant();
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
@@ -638,12 +334,6 @@ namespace NKC_WF.WebUserControls
|
||||
return num / den;
|
||||
}
|
||||
|
||||
protected void txtRatio_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
rebalanceOrder();
|
||||
fixChildBatch();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Internal Methods
|
||||
|
||||
+2
-83
@@ -78,93 +78,12 @@ namespace NKC_WF.WebUserControls
|
||||
protected global::System.Web.UI.HtmlControls.HtmlGenericControl divSplit;
|
||||
|
||||
/// <summary>
|
||||
/// hfNeedSave control.
|
||||
/// cmp_batchDetailSplit control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HiddenField hfNeedSave;
|
||||
|
||||
/// <summary>
|
||||
/// hfLastRatio control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HiddenField hfLastRatio;
|
||||
|
||||
/// <summary>
|
||||
/// hfFullTime control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HiddenField hfFullTime;
|
||||
|
||||
/// <summary>
|
||||
/// txtRatio control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox txtRatio;
|
||||
|
||||
/// <summary>
|
||||
/// lblTime01 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblTime01;
|
||||
|
||||
/// <summary>
|
||||
/// lblRatio01 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblRatio01;
|
||||
|
||||
/// <summary>
|
||||
/// cmp_orderExtListNE01 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::NKC_WF.WebUserControls.cmp_orderExtList cmp_orderExtListNE01;
|
||||
|
||||
/// <summary>
|
||||
/// lblTime02 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblTime02;
|
||||
|
||||
/// <summary>
|
||||
/// lblRatio02 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblRatio02;
|
||||
|
||||
/// <summary>
|
||||
/// cmp_orderExtListNE02 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::NKC_WF.WebUserControls.cmp_orderExtList cmp_orderExtListNE02;
|
||||
protected global::NKC_WF.WebUserControls.cmp_batchDetailSplit cmp_batchDetailSplit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_batchDetailData.ascx.cs" Inherits="NKC_WF.WebUserControls.cmp_batchDetailData" %>
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace NKC_WF.WebUserControls
|
||||
{
|
||||
public partial class cmp_batchDetailData : System.Web.UI.UserControl
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace NKC_WF.WebUserControls
|
||||
{
|
||||
public partial class cmp_batchDetailData
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_batchDetailSplit.ascx.cs" Inherits="NKC_WF.WebUserControls.cmp_batchDetailSplit" %>
|
||||
<%@ Register Src="~/WebUserControls/cmp_orderExtList.ascx" TagPrefix="uc1" TagName="cmp_orderExtList" %>
|
||||
<%@ Register Src="~/WebUserControls/cmp_batchDetailSplitInfo.ascx" TagPrefix="uc1" TagName="cmp_batchDetailSplitInfo" %>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header text-center">
|
||||
<h5><%: traduci("BatchSplit") %></h5>
|
||||
<asp:HiddenField runat="server" ID="hfBatchId" />
|
||||
<asp:HiddenField runat="server" ID="hfNeedSave" />
|
||||
<asp:HiddenField runat="server" ID="hfLastRatio" />
|
||||
<asp:HiddenField runat="server" ID="hfFullTime" />
|
||||
<asp:TextBox runat="server" ID="txtRatio" TextMode="Range" CssClass="form-control-range" AutoPostBack="true" OnTextChanged="txtRatio_TextChanged" />
|
||||
</div>
|
||||
<div class="card-body p-1">
|
||||
<div class="row small text-center">
|
||||
<div class="col-6">
|
||||
<div class="card">
|
||||
<div class="card-header bg-primary text-light py-1">
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<asp:Label runat="server" ID="lblTime01" />
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<b>NE01</b>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<asp:Label runat="server" ID="lblRatio01" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body py-1">
|
||||
<uc1:cmp_orderExtList runat="server" ID="cmp_orderExtListNE01" />
|
||||
<uc1:cmp_batchDetailSplitInfo runat="server" ID="cmp_batchDetailSplitInfoNE01" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="card">
|
||||
<div class="card-header bg-secondary text-light py-1">
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<asp:Label runat="server" ID="lblTime02" />
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<b>NE02</b>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<asp:Label runat="server" ID="lblRatio02" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body py-1">
|
||||
<uc1:cmp_orderExtList runat="server" ID="cmp_orderExtListNE02" />
|
||||
<uc1:cmp_batchDetailSplitInfo runat="server" ID="cmp_batchDetailSplitInfoNE02" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,394 @@
|
||||
using AppData;
|
||||
using NKC_SDK;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace NKC_WF.WebUserControls
|
||||
{
|
||||
public partial class cmp_batchDetailSplit : BaseUserControl
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
/// <summary>
|
||||
/// Master Place (hard-coded)
|
||||
/// </summary>
|
||||
protected string PlaceCod = "VIRTNE";
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected bool BatchIsAncestor
|
||||
{
|
||||
get
|
||||
{
|
||||
return ComLib.BType(BatchId) == BatchType.Ancestor;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Status corrente del batch
|
||||
/// </summary>
|
||||
protected BatchStatus CurrBatchStatus
|
||||
{
|
||||
get
|
||||
{
|
||||
return ComLib.BStatus(BatchId);
|
||||
}
|
||||
}
|
||||
|
||||
protected double fullTime
|
||||
{
|
||||
get
|
||||
{
|
||||
double answ = 1;
|
||||
if (!string.IsNullOrEmpty(hfFullTime.Value))
|
||||
{
|
||||
double.TryParse(hfFullTime.Value, out answ);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
hfFullTime.Value = $"{value}";
|
||||
}
|
||||
}
|
||||
|
||||
protected int lastValRatio
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 50;
|
||||
if (!string.IsNullOrEmpty(hfLastRatio.Value))
|
||||
{
|
||||
int.TryParse(hfLastRatio.Value, out answ);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
hfLastRatio.Value = $"{value}";
|
||||
}
|
||||
}
|
||||
|
||||
protected bool needSave
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = true;
|
||||
bool.TryParse(hfNeedSave.Value, out answ);
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
hfNeedSave.Value = $"{value}";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tabella dei batch Descendant di quello corrente
|
||||
/// </summary>
|
||||
protected DS_App.BatchListDataTable TabBatchDesc
|
||||
{
|
||||
get
|
||||
{
|
||||
return ComLib.BatchDescendant(BatchId);
|
||||
}
|
||||
}
|
||||
|
||||
protected DS_App.OrderListTreeDataTable TabOrders
|
||||
{
|
||||
get
|
||||
{
|
||||
// cerco in redis
|
||||
return ComLib.OrdersExtByBatch(BatchId);
|
||||
}
|
||||
}
|
||||
|
||||
protected int valRatio
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 50;
|
||||
if (!string.IsNullOrEmpty(txtRatio.Text))
|
||||
{
|
||||
int.TryParse(txtRatio.Text, out answ);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
txtRatio.Text = $"{value}";
|
||||
// scrivo ANCHE i valori assoluti
|
||||
lblRatio01.Text = $"{valRatio} %";
|
||||
lblRatio02.Text = $"{100 - valRatio} %";
|
||||
lblTime01.Text = $"{fullTime * value / (100 * 60):N2} h";
|
||||
lblTime02.Text = $"{fullTime * (100 - value) / (100 * 60):N2} h";
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public int BatchId
|
||||
{
|
||||
set
|
||||
{
|
||||
hfBatchId.Value = value.ToString();
|
||||
if (BatchId > 0)
|
||||
{
|
||||
checkCreateDescendant();
|
||||
showBatchDescendant();
|
||||
fixChildBatch();
|
||||
checkDisplayMode();
|
||||
}
|
||||
fixRatio();
|
||||
}
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
int.TryParse(hfBatchId.Value, out answ);
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void checkCreateDescendant()
|
||||
{
|
||||
// se ho un batchId...
|
||||
if (BatchId != 0)
|
||||
{
|
||||
// verifico se ho descendant
|
||||
if (TabBatchDesc.Rows.Count == 0)
|
||||
{
|
||||
// altrimenti creo...
|
||||
DLMan.taBL.makeDescendantByKey(BatchId, PlaceCod);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// verifico modalità display (editing solo se PRIMA di lanciare nesting...)
|
||||
/// </summary>
|
||||
private void checkDisplayMode()
|
||||
{
|
||||
txtRatio.Visible = (BatchIsAncestor && CurrBatchStatus <= BatchStatus.EstimationDone);
|
||||
cmp_orderExtListNE01.Visible = txtRatio.Visible;
|
||||
cmp_orderExtListNE02.Visible = txtRatio.Visible;
|
||||
cmp_batchDetailSplitInfoNE01.Visible = !txtRatio.Visible;
|
||||
cmp_batchDetailSplitInfoNE02.Visible = !txtRatio.Visible;
|
||||
}
|
||||
|
||||
private void fixChildBatch()
|
||||
{
|
||||
DS_App.BatchListDataTable TabBatch = TabBatchDesc;
|
||||
cmp_orderExtListNE01.BatchId = TabBatch.Rows.Count > 0 ? TabBatchDesc[0].BatchID : 0;
|
||||
cmp_orderExtListNE02.BatchId = TabBatch.Rows.Count > 0 ? TabBatchDesc[1].BatchID : 0;
|
||||
cmp_orderExtListNE01.doUpdate();
|
||||
cmp_orderExtListNE02.doUpdate();
|
||||
cmp_batchDetailSplitInfoNE01.BatchId = cmp_orderExtListNE01.BatchId;
|
||||
cmp_batchDetailSplitInfoNE02.BatchId = cmp_orderExtListNE02.BatchId;
|
||||
}
|
||||
|
||||
private void fixRatio()
|
||||
{
|
||||
// sistemazione ratio calcolata...
|
||||
DS_App.OrderListTreeDataTable tabNe01 = DLMan.taOLT.getByBatch(cmp_orderExtListNE01.BatchId);
|
||||
DS_App.OrderListTreeDataTable tabNe02 = DLMan.taOLT.getByBatch(cmp_orderExtListNE02.BatchId);
|
||||
|
||||
double totTime01 = tabNe01.Sum(x => x.EstProcTime);
|
||||
double totTime02 = tabNe02.Sum(x => x.EstProcTime);
|
||||
|
||||
// aggiorno valore ratio e ratio last...
|
||||
fullTime = totTime01 + totTime02;
|
||||
fullTime = fullTime > 0 ? fullTime : 1;
|
||||
double newRatio = (totTime01 * 100 / fullTime);
|
||||
valRatio = (int)newRatio;
|
||||
lastValRatio = valRatio;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// effettua ribilanciamento ordini partendo da elenco completo e poi assegnando a impianti
|
||||
/// </summary>
|
||||
private void rebalanceOrder()
|
||||
{
|
||||
// solo se variato il ratio...
|
||||
if (valRatio != lastValRatio)
|
||||
{
|
||||
// costruisco vettore durata ordini
|
||||
OrderSetSim FullSet = new OrderSetSim();
|
||||
OrderSetSim SetNe01 = new OrderSetSim();
|
||||
OrderSetSim SetNe02 = new OrderSetSim();
|
||||
|
||||
// creo liste x i valori da processare...
|
||||
Dictionary<int, double> RawList = new Dictionary<int, double>();
|
||||
Dictionary<int, double> OrderedList = new Dictionary<int, double>();
|
||||
|
||||
foreach (var item in TabOrders)
|
||||
{
|
||||
RawList.Add(item.OrdID, item.EstProcTime);
|
||||
}
|
||||
|
||||
// ordino la lista x processing successivo
|
||||
OrderedList = RawList.OrderBy(x => x.Value).ToDictionary(t => t.Key, t => t.Value);
|
||||
|
||||
// salvo i set
|
||||
FullSet.OrderSet = OrderedList;
|
||||
|
||||
// lavoro sull'ottimizzare il MINORE
|
||||
double ValRatio = (double)valRatio / 100;
|
||||
if (ValRatio <= 0.5)
|
||||
{
|
||||
SetNe01.TargetValue = FullSet.ActualValue * ValRatio;
|
||||
SetNe01.OrderSet = findLocalMin(OrderedList, SetNe01.TargetValue);
|
||||
// l'altro è la differenza
|
||||
SetNe02.OrderSet = OrderedList;
|
||||
foreach (var item in SetNe01.OrderSet)
|
||||
{
|
||||
SetNe02.OrderSet.Remove(item.Key);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SetNe02.TargetValue = FullSet.ActualValue * (1 - ValRatio);
|
||||
SetNe02.OrderSet = findLocalMin(OrderedList, SetNe02.TargetValue);
|
||||
// l'altro è la differenza
|
||||
SetNe01.OrderSet = OrderedList;
|
||||
foreach (var item in SetNe02.OrderSet)
|
||||
{
|
||||
SetNe01.OrderSet.Remove(item.Key);
|
||||
}
|
||||
}
|
||||
|
||||
// riorganizzo tabOrders...
|
||||
foreach (var orderItem in TabOrders)
|
||||
{
|
||||
if (SetNe01.OrderSet.ContainsKey(orderItem.OrdID))
|
||||
{
|
||||
if (orderItem.BatchID != cmp_orderExtListNE01.BatchId)
|
||||
{
|
||||
DLMan.taOLT.updateBatch(orderItem.BatchID, orderItem.OrdID, cmp_orderExtListNE01.BatchId);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (orderItem.BatchID != cmp_orderExtListNE02.BatchId)
|
||||
{
|
||||
DLMan.taOLT.updateBatch(orderItem.BatchID, orderItem.OrdID, cmp_orderExtListNE02.BatchId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --> richiede salvataggio
|
||||
needSave = true;
|
||||
}
|
||||
fixRatio();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mostro dati dei Batch descendant
|
||||
/// </summary>
|
||||
private void showBatchDescendant()
|
||||
{
|
||||
// suddivido
|
||||
rebalanceOrder();
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Cerca il set con lo score migliore calcolando x subset della lista ordinata
|
||||
/// </summary>
|
||||
/// <param name="OrderedList">Lista ordinata oggetti (INT) + valore</param>
|
||||
/// <param name="TargetVal">Valore desiderato (comeSOMMA)</param>
|
||||
/// <returns></returns>
|
||||
protected Dictionary<int, double> findLocalMin(Dictionary<int, double> OrderedList, double TargetVal)
|
||||
{
|
||||
Dictionary<int, double> answ = new Dictionary<int, double>();
|
||||
List<OrderSetSim> Candidates = new List<OrderSetSim>();
|
||||
OrderSetSim CurrSimSet = new OrderSetSim();
|
||||
|
||||
// parte dal valore (singolo) più piccolo tra quelli maggiori del target... se c'è...
|
||||
var OrdSup = OrderedList.Where(x => x.Value > TargetVal).OrderBy(x => x.Value);
|
||||
if (OrdSup != null && OrdSup.Any())
|
||||
{
|
||||
var currOrder = OrdSup.FirstOrDefault();
|
||||
CurrSimSet = new OrderSetSim();
|
||||
CurrSimSet.TargetValue = TargetVal;
|
||||
CurrSimSet.OrderSet.Add(currOrder.Key, currOrder.Value);
|
||||
Candidates.Add(CurrSimSet);
|
||||
}
|
||||
|
||||
// ora guardo gli elementi restanti.. se ci sono
|
||||
var OrdInf = OrderedList.Where(x => x.Value <= TargetVal).OrderByDescending(x => x.Value).ToDictionary(t => t.Key, t => t.Value);
|
||||
if (OrdInf != null && OrdInf.Any())
|
||||
{
|
||||
var currOrder = OrdInf.FirstOrDefault();
|
||||
CurrSimSet = new OrderSetSim();
|
||||
CurrSimSet.TargetValue = TargetVal;
|
||||
CurrSimSet.OrderSet.Add(currOrder.Key, currOrder.Value);
|
||||
Candidates.Add(CurrSimSet);
|
||||
// prendo i restanti tranne il primo
|
||||
OrdInf.Remove(currOrder.Key);
|
||||
// se rimane qualcosa...
|
||||
if (OrdInf != null && OrdInf.Any())
|
||||
{
|
||||
// calcolo il minimo locale nei 2 casi, da soli
|
||||
Dictionary<int, double> TestOrderSet01 = findLocalMin(OrdInf, TargetVal);
|
||||
if (TestOrderSet01.Count > 0)
|
||||
{
|
||||
OrderSetSim CurrSet = new OrderSetSim();
|
||||
CurrSet.TargetValue = TargetVal;
|
||||
CurrSet.OrderSet = TestOrderSet01;
|
||||
Candidates.Add(CurrSet);
|
||||
}
|
||||
// ...e con il primo valore...
|
||||
Dictionary<int, double> TestOrderSet02 = findLocalMin(OrdInf, TargetVal - currOrder.Value);
|
||||
TestOrderSet02.Add(currOrder.Key, currOrder.Value);
|
||||
// verifico se migliorativo...
|
||||
if (TestOrderSet02.Count > 0)
|
||||
{
|
||||
OrderSetSim CurrSet = new OrderSetSim();
|
||||
CurrSet.TargetValue = TargetVal - currOrder.Value;
|
||||
CurrSet.OrderSet = TestOrderSet02;
|
||||
Candidates.Add(CurrSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
// cerco il minimo...
|
||||
if (Candidates != null && Candidates.Count > 0)
|
||||
{
|
||||
answ = Candidates.OrderBy(x => x.IndexScore).FirstOrDefault().OrderSet;
|
||||
}
|
||||
|
||||
// calcolo il minimo e lo restituisco...
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
checkDisplayMode();
|
||||
}
|
||||
}
|
||||
|
||||
protected void txtRatio_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
rebalanceOrder();
|
||||
fixChildBatch();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace NKC_WF.WebUserControls
|
||||
{
|
||||
|
||||
|
||||
public partial class cmp_batchDetailSplit
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// hfBatchId control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HiddenField hfBatchId;
|
||||
|
||||
/// <summary>
|
||||
/// hfNeedSave control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HiddenField hfNeedSave;
|
||||
|
||||
/// <summary>
|
||||
/// hfLastRatio control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HiddenField hfLastRatio;
|
||||
|
||||
/// <summary>
|
||||
/// hfFullTime control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HiddenField hfFullTime;
|
||||
|
||||
/// <summary>
|
||||
/// txtRatio control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox txtRatio;
|
||||
|
||||
/// <summary>
|
||||
/// lblTime01 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblTime01;
|
||||
|
||||
/// <summary>
|
||||
/// lblRatio01 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblRatio01;
|
||||
|
||||
/// <summary>
|
||||
/// cmp_orderExtListNE01 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::NKC_WF.WebUserControls.cmp_orderExtList cmp_orderExtListNE01;
|
||||
|
||||
/// <summary>
|
||||
/// cmp_batchDetailSplitInfoNE01 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::NKC_WF.WebUserControls.cmp_batchDetailSplitInfo cmp_batchDetailSplitInfoNE01;
|
||||
|
||||
/// <summary>
|
||||
/// lblTime02 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblTime02;
|
||||
|
||||
/// <summary>
|
||||
/// lblRatio02 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblRatio02;
|
||||
|
||||
/// <summary>
|
||||
/// cmp_orderExtListNE02 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::NKC_WF.WebUserControls.cmp_orderExtList cmp_orderExtListNE02;
|
||||
|
||||
/// <summary>
|
||||
/// cmp_batchDetailSplitInfoNE02 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::NKC_WF.WebUserControls.cmp_batchDetailSplitInfo cmp_batchDetailSplitInfoNE02;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_batchDetailSplitInfo.ascx.cs" Inherits="NKC_WF.WebUserControls.cmp_batchDetailSplitInfo" %>
|
||||
|
||||
<asp:HiddenField runat="server" ID="hfBatchId" />
|
||||
|
||||
<asp:FormView runat="server" ID="frmView" DataSourceID="ods" CssClass="" Width="100%">
|
||||
<ItemTemplate>
|
||||
<div class="row table-info">
|
||||
<div class="col-8 text-left">
|
||||
<asp:Label runat="server" ID="lblBatchType" ToolTip='<%# tooltipByType(Eval("BatchType")) %>'><span style="font-size: 1.3em;"><i class='<%# cssIconByType(Eval("BatchType")) %>'></i></span> <b><%# Eval("Takt") %></b></asp:Label>
|
||||
</div>
|
||||
<div class="col-4 text-right">
|
||||
Estim.Time: <%# Eval("TotalTime","{0:N2}") %> min
|
||||
</div>
|
||||
</div>
|
||||
<div class="row textCondens">
|
||||
<div class="col-8 text-left">
|
||||
<div class="d-flex">
|
||||
<div class="px-2 flex-grow-1">
|
||||
<asp:Label ID="lblStatus" runat="server" CssClass='<%# cssByStatus(Eval("Status")) %>'><%# BStatus(Eval("Status")) %></asp:Label>
|
||||
<i class="fa fa-spinner fa-spin" aria-hidden="true" runat="server" visible='<%# Eval("Status").ToString()=="1" || Eval("Status").ToString()=="3" %>'></i>
|
||||
</div>
|
||||
<div class="px-2 text-right">
|
||||
<asp:HyperLink runat="server" ID="hlSheetPreview" Target="_blank" NavigateUrl='<%# $"../site/BatchPreview?BatchId={Eval("BatchID")}" %>' Visible='<%# isPreviewVisible(Eval("Status")) && hasPreviewByType(Eval("BatchType")) %>' ToolTip="Show Batch preview" CssClass="btn btn-sm btn-info"><i class="fa fa-object-group" aria-hidden="true"></i></asp:HyperLink>
|
||||
<asp:HyperLink runat="server" ID="hlPlannerReports" Target="_blank" NavigateUrl='<%# $"../site/PlannerReports?BatchId={Eval("BatchID")}&MaxHour=4" %>' Visible='<%# isPreviewVisible(Eval("Status")) && hasPreviewByType(Eval("BatchType")) %>' ToolTip="Show Unload Preview" CssClass="btn btn-sm btn-dark"><i class="fa fa-bar-chart" aria-hidden="true"></i></asp:HyperLink>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 text-right">
|
||||
<asp:HyperLink runat="server" ID="hlShowErr" NavigateUrl='<%# $"../site/ErrorsLog?PUID=B.{Eval("BatchID")}" %>' CssClass="text-warning" Visible='<%# Eval("NumErrPre").ToString()!="0" %>' Target="_blank" ToolTip="Show errors"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> <%# $"{Eval("Errors")} (tot: {Eval("NumErrPre")} err)" %></asp:HyperLink>
|
||||
<asp:HyperLink runat="server" ID="HyperLink1" NavigateUrl='<%# $"../site/ErrorsLog?PUID={Eval("EnvNum")}" %>' CssClass="text-danger" Visible='<%# Eval("NumErr").ToString()!="0" %>' Target="_blank" ToolTip="Show errors"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> <%# $"{Eval("Errors")} (tot: {Eval("NumErr")} err)" %></asp:HyperLink>
|
||||
</div>
|
||||
</div>
|
||||
</ItemTemplate>
|
||||
</asp:FormView>
|
||||
<asp:HiddenField ID="hfDeleteEnabled" runat="server" />
|
||||
<asp:ObjectDataSource ID="ods" runat="server" SelectMethod="getByKey" TypeName="AppData.DS_AppTableAdapters.BatchListTableAdapter" FilterExpression="Status <> 5">
|
||||
<SelectParameters>
|
||||
<asp:ControlParameter ControlID="hfBatchId" DefaultValue="0" Name="BatchId" PropertyName="Value" Type="Int32" />
|
||||
</SelectParameters>
|
||||
</asp:ObjectDataSource>
|
||||
@@ -0,0 +1,182 @@
|
||||
using AppData;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace NKC_WF.WebUserControls
|
||||
{
|
||||
public partial class cmp_batchDetailSplitInfo : BaseUserControl
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public int BatchId
|
||||
{
|
||||
set
|
||||
{
|
||||
hfBatchId.Value = value.ToString();
|
||||
}
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
int.TryParse(hfBatchId.Value, out answ);
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Converte il codice stato in effettivo campo
|
||||
/// </summary>
|
||||
/// <param name="_status"></param>
|
||||
/// <returns></returns>
|
||||
public string BStatus(object _status)
|
||||
{
|
||||
string answ = ComLib.BatchStatusDescr(_status);
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Codice CSS in base a status...
|
||||
/// </summary>
|
||||
/// <param name="_status"></param>
|
||||
/// <returns></returns>
|
||||
public string cssByStatus(object _status)
|
||||
{
|
||||
string answ = "text-muted";
|
||||
int status = -1;
|
||||
int.TryParse(_status.ToString(), out status);
|
||||
switch (status)
|
||||
{
|
||||
case 1:
|
||||
answ = "font-weight-bold text-info";
|
||||
break;
|
||||
|
||||
case 2:
|
||||
answ = "font-weight-bold text-primary";
|
||||
break;
|
||||
|
||||
case 3:
|
||||
answ = "font-weight-bold text-warning";
|
||||
break;
|
||||
|
||||
case 4:
|
||||
answ = "font-weight-bold text-danger";
|
||||
break;
|
||||
|
||||
case 5:
|
||||
answ = "font-weight-bold text-success";
|
||||
break;
|
||||
|
||||
case 6:
|
||||
answ = "font-weight-bold text-secondary";
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Codice CSS in base a BatchType...
|
||||
/// </summary>
|
||||
/// <param name="_BatchType"></param>
|
||||
/// <returns></returns>
|
||||
public string cssIconByType(object _BatchType)
|
||||
{
|
||||
string answ = "fa fa-circle-thin";
|
||||
int status = -1;
|
||||
int.TryParse(_BatchType.ToString(), out status);
|
||||
switch (status)
|
||||
{
|
||||
case 0:
|
||||
answ = "fa fa-file-text-o";
|
||||
break;
|
||||
|
||||
case 1:
|
||||
answ = "fa fa-file-text";
|
||||
break;
|
||||
|
||||
case 2:
|
||||
answ = "fa fa-scissors";
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determina se sia visibile previewin base a BatchType...
|
||||
/// </summary>
|
||||
/// <param name="_BatchType"></param>
|
||||
/// <returns></returns>
|
||||
public bool hasPreviewByType(object _BatchType)
|
||||
{
|
||||
bool answ = false;
|
||||
int status = -1;
|
||||
int.TryParse(_BatchType.ToString(), out status);
|
||||
switch (status)
|
||||
{
|
||||
case 0:
|
||||
case 2:
|
||||
answ = true;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
default:
|
||||
answ = false;
|
||||
break;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica se sia visualizzabile preview dato stato
|
||||
/// </summary>
|
||||
/// <param name="_status"></param>
|
||||
/// <returns></returns>
|
||||
public bool isPreviewVisible(object _status)
|
||||
{
|
||||
bool answ = false;
|
||||
int status = -1;
|
||||
int.TryParse(_status.ToString(), out status);
|
||||
// solo stati 4 (nesting done), 5 (approvato), 6 (eliminazione logica)
|
||||
if (status > 3 && status < 7)
|
||||
{
|
||||
answ = true;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tooltip in base a BatchType...
|
||||
/// </summary>
|
||||
/// <param name="_BatchType"></param>
|
||||
/// <returns></returns>
|
||||
public string tooltipByType(object _BatchType)
|
||||
{
|
||||
string answ = "-";
|
||||
|
||||
answ = traduci($"tooltipBatchType_{_BatchType}");
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace NKC_WF.WebUserControls
|
||||
{
|
||||
|
||||
|
||||
public partial class cmp_batchDetailSplitInfo
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// hfBatchId control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HiddenField hfBatchId;
|
||||
|
||||
/// <summary>
|
||||
/// frmView control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.FormView frmView;
|
||||
|
||||
/// <summary>
|
||||
/// hfDeleteEnabled control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HiddenField hfDeleteEnabled;
|
||||
|
||||
/// <summary>
|
||||
/// ods control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.ObjectDataSource ods;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_orderExtList.ascx.cs" Inherits="NKC_WF.WebUserControls.cmp_orderExtList" %>
|
||||
|
||||
<asp:GridView ID="grView" runat="server" AutoGenerateColumns="False" DataKeyNames="BatchID,OrdID" DataSourceID="ods" CssClass="table table-sm table-striped table-default">
|
||||
<asp:GridView ID="grView" runat="server" AutoGenerateColumns="False" DataKeyNames="BatchID,OrdID" DataSourceID="ods" CssClass="table table-sm table-striped textCondens">
|
||||
<EmptyDataTemplate>
|
||||
<div class="alert alert-warning">
|
||||
No record
|
||||
|
||||
Reference in New Issue
Block a user