Continuo redistribuzione dati ordini
This commit is contained in:
+100
-14
@@ -53,23 +53,15 @@ namespace AppData
|
||||
public static ComLib man = new ComLib();
|
||||
|
||||
public static string redBatchDescend = "NKC:SERV:BATCHDESCEND";
|
||||
|
||||
public static string redMachUnloadCount = "NKC:SERV:MACH_UNLOAD:COUNT";
|
||||
|
||||
public static string redMachUnloadForce = "NKC:SERV:MACH_UNLOAD:FORCERELOAD";
|
||||
|
||||
public static string redMLCurrBunk = "NKC:SERV:TAKT:CurrBunk";
|
||||
|
||||
public static string redMsgCount = "NKC:SERV:BREQ:MCount";
|
||||
|
||||
public static string redMsgList = "NKC:SERV:BREQ:MList";
|
||||
|
||||
public static string redNestAnsw = "NKC:NEST:BANSW";
|
||||
|
||||
public static string redOrders = "NKC:SERV:ORDERS";
|
||||
public static string redOutPath = "NKC:SERV:BREQ";
|
||||
|
||||
public static string redProdAnsw = "NKC:PROD:BUNKS";
|
||||
|
||||
public static string redProdReq = "NKC:SERV:BUNKS";
|
||||
|
||||
/// <summary>
|
||||
@@ -673,17 +665,18 @@ namespace AppData
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco dei
|
||||
/// Elenco dei Batch descendant di un batch ancestor
|
||||
/// </summary>
|
||||
public static DS_App.BatchListDataTable BatchDescendant(int BatchId)
|
||||
{
|
||||
DataLayer DLMan = new DataLayer();
|
||||
string redKey = $"{redBatchDescend}:{BatchId}";
|
||||
string rawData = "";
|
||||
DS_App.BatchListDataTable answ = new DS_App.BatchListDataTable();
|
||||
// cerco in redis
|
||||
if (memLayer.ML.redKeyPresent(redBatchDescend))
|
||||
if (memLayer.ML.redKeyPresent(redKey))
|
||||
{
|
||||
rawData = memLayer.ML.getRSV(redBatchDescend);
|
||||
rawData = memLayer.ML.getRSV(redKey);
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
try
|
||||
@@ -699,7 +692,7 @@ namespace AppData
|
||||
answ = DLMan.taBL.getDescendByKey(BatchId);
|
||||
// salvo in cache
|
||||
rawData = JsonConvert.SerializeObject(answ);
|
||||
memLayer.ML.setRSV(redBatchDescend, rawData, 5 * 60);
|
||||
memLayer.ML.setRSV(redKey, rawData, 5 * 60);
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
@@ -1377,6 +1370,88 @@ namespace AppData
|
||||
return answ;
|
||||
}
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Elenco degli orders dato Batch
|
||||
/// </summary>
|
||||
public static DS_App.OrderListDataTable OrdersByBatch(int BatchId)
|
||||
{
|
||||
DataLayer DLMan = new DataLayer();
|
||||
string redKey = $"{redOrders}:BYBATCH:{BatchId}";
|
||||
string rawData = "";
|
||||
DS_App.OrderListDataTable answ = new DS_App.OrderListDataTable();
|
||||
// cerco in redis
|
||||
if (memLayer.ML.redKeyPresent(redKey))
|
||||
{
|
||||
rawData = memLayer.ML.getRSV(redKey);
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = JsonConvert.DeserializeObject<DS_App.OrderListDataTable>(rawData);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
// se vuoto rileggo
|
||||
if (answ.Count == 0)
|
||||
{
|
||||
answ = DLMan.taOL.getByBatch(BatchId);
|
||||
// salvo in cache
|
||||
rawData = JsonConvert.SerializeObject(answ);
|
||||
memLayer.ML.setRSV(redKey, rawData, 5 * 60);
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Elenco degli orders dato Batch
|
||||
/// </summary>
|
||||
public static Dictionary<string, DS_App.OrderListDataTable> OrdersExtByBatch(int BatchId, string PlaceCod)
|
||||
{
|
||||
DataLayer DLMan = new DataLayer();
|
||||
string redKey = $"{redOrders}:BYBATCH:{BatchId}";
|
||||
string rawData = "";
|
||||
Dictionary<string, DS_App.OrderListDataTable> answ = new Dictionary<string, DS_App.OrderListDataTable>();
|
||||
|
||||
// cerco in redis
|
||||
if (memLayer.ML.redKeyPresent(redKey))
|
||||
{
|
||||
rawData = memLayer.ML.getRSV(redKey);
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = JsonConvert.DeserializeObject<Dictionary<string, DS_App.OrderListDataTable>>(rawData);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
// se vuoto rileggo
|
||||
if (answ.Count == 0)
|
||||
{
|
||||
var tabBatchDesc = BatchDescendant(BatchId);
|
||||
|
||||
// recupero ordini MAIN
|
||||
DS_App.OrderListDataTable currOrders = DLMan.taOL.getByBatch(BatchId);
|
||||
answ.Add(PlaceCod, currOrders);
|
||||
|
||||
// recupero ordini dei 2 descendant...
|
||||
foreach (var item in tabBatchDesc)
|
||||
{
|
||||
currOrders = DLMan.taOL.getByBatch(item.BatchID);
|
||||
answ.Add(item.PlaceCod, currOrders);
|
||||
}
|
||||
// salvo in cache
|
||||
rawData = JsonConvert.SerializeObject(answ);
|
||||
memLayer.ML.setRSV(redKey, rawData, 5 * 60);
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public static string PositionStatusDescr(object value)
|
||||
{
|
||||
string answ = "";
|
||||
@@ -1659,7 +1734,8 @@ namespace AppData
|
||||
/// <param name="BatchId"></param>
|
||||
public static void ResetBatchDescendant(int BatchId)
|
||||
{
|
||||
memLayer.ML.setRSV(redBatchDescend, "", 10);
|
||||
string redKey = $"{redBatchDescend}:{BatchId}";
|
||||
memLayer.ML.setRSV(redKey, "", 10);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1735,6 +1811,16 @@ namespace AppData
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset della cache dei BatchDescendant x ID indicato
|
||||
/// </summary>
|
||||
/// <param name="BatchId"></param>
|
||||
public static void ResetOrderByBatch(int BatchId)
|
||||
{
|
||||
string redKey = $"{redOrders}:BYBATCH:{BatchId}";
|
||||
memLayer.ML.setRSV(redKey, "", 10);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resetto i dati PRIMA di salvare i nuovi dati dal nesting
|
||||
/// </summary>
|
||||
|
||||
@@ -530,6 +530,7 @@
|
||||
<Content Include="WebUserControls\cmp_offOrderDetail.ascx" />
|
||||
<Content Include="WebUserControls\cmp_OOIL_drawings.ascx" />
|
||||
<Content Include="WebUserControls\cmp_OOLI_detail.ascx" />
|
||||
<Content Include="WebUserControls\cmp_orderExtList.ascx" />
|
||||
<Content Include="WebUserControls\cmp_orderPrint.ascx" />
|
||||
<Content Include="WebUserControls\cmp_orderRunning.ascx" />
|
||||
<Content Include="WebUserControls\cmp_orderSched.ascx" />
|
||||
@@ -1489,6 +1490,13 @@
|
||||
<Compile Include="WebUserControls\cmp_OOLI_detail.ascx.designer.cs">
|
||||
<DependentUpon>cmp_OOLI_detail.ascx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WebUserControls\cmp_orderExtList.ascx.cs">
|
||||
<DependentUpon>cmp_orderExtList.ascx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="WebUserControls\cmp_orderExtList.ascx.designer.cs">
|
||||
<DependentUpon>cmp_orderExtList.ascx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WebUserControls\cmp_orderPrint.ascx.cs">
|
||||
<DependentUpon>cmp_orderPrint.ascx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<%@ 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" %>
|
||||
|
||||
<asp:FormView ID="frmView" runat="server" DataKeyNames="BatchID" DataSourceID="ods" Width="100%">
|
||||
<ItemTemplate>
|
||||
@@ -97,14 +98,11 @@
|
||||
</div>
|
||||
|
||||
<div class="row small text-center">
|
||||
<div class="col-4">
|
||||
<div class="col-6">
|
||||
<span class="btn btn-primary disabled"><b>NE01</b>
|
||||
<asp:Label runat="server" ID="lblRatio01" />%</span>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<asp:Label runat="server" ID="lblSplitRatio" />
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="col-6">
|
||||
<span class="btn btn-secondary disabled"><b>NE02</b>
|
||||
<asp:Label runat="server" ID="lblRatio02" />%</span>
|
||||
</div>
|
||||
@@ -113,12 +111,10 @@
|
||||
</div>
|
||||
<div class="col-6">
|
||||
ORD LIST NE01 - summary
|
||||
<br />
|
||||
table detail
|
||||
<uc1:cmp_orderExtList runat="server" id="cmp_orderExtListNE01" />
|
||||
</div>
|
||||
<div class="col-6">
|
||||
ORD LIST NE02- summary
|
||||
<br />
|
||||
table detail
|
||||
<uc1:cmp_orderExtList runat="server" id="cmp_orderExtListNE02" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -19,7 +19,10 @@ namespace NKC_WF.WebUserControls
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected DS_App.BatchListDataTable tabDesc
|
||||
/// <summary>
|
||||
/// Tabella dei batch Descendant di quello corrente
|
||||
/// </summary>
|
||||
protected DS_App.BatchListDataTable tabBatchDesc
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -27,6 +30,15 @@ namespace NKC_WF.WebUserControls
|
||||
}
|
||||
}
|
||||
|
||||
protected Dictionary<string, DS_App.OrderListDataTable> TabOrders
|
||||
{
|
||||
get
|
||||
{
|
||||
// cerco in redis
|
||||
return ComLib.OrdersExtByBatch(BatchId, PlaceCod);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
@@ -211,6 +223,7 @@ namespace NKC_WF.WebUserControls
|
||||
}
|
||||
}
|
||||
checkCreateDescendant();
|
||||
showBatchDescendant();
|
||||
}
|
||||
get
|
||||
{
|
||||
@@ -242,7 +255,7 @@ namespace NKC_WF.WebUserControls
|
||||
if (BatchId != 0)
|
||||
{
|
||||
// verifico se ho descendant
|
||||
if (tabDesc.Rows.Count == 0)
|
||||
if (tabBatchDesc.Rows.Count == 0)
|
||||
{
|
||||
// altrimenti creo...
|
||||
DLMan.taBL.makeDescendantByKey(BatchId, PlaceCod);
|
||||
@@ -250,6 +263,25 @@ namespace NKC_WF.WebUserControls
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mostro dati dei Batch descendant
|
||||
/// </summary>
|
||||
private void showBatchDescendant()
|
||||
{
|
||||
// se ho qualcosa aggiorno visualizzazione...
|
||||
if (TabOrders.Count > 0)
|
||||
{
|
||||
// se ne ho nel MAIN --> redistribuisco
|
||||
if (TabOrders["VIRTNE"].Count > 0)
|
||||
{
|
||||
// suddivido
|
||||
}
|
||||
// ...e poi mostro
|
||||
cmp_orderExtListNE01.CurrOrders = TabOrders["NE01"];
|
||||
cmp_orderExtListNE02.CurrOrders = TabOrders["NE02"];
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
@@ -326,13 +358,22 @@ namespace NKC_WF.WebUserControls
|
||||
return num / den;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco ordini dato BatchID
|
||||
/// </summary>
|
||||
/// <param name="BatchId"></param>
|
||||
/// <returns></returns>
|
||||
protected DS_App.OrderListDataTable tabOrdersByBatch(int BatchId)
|
||||
{
|
||||
return ComLib.OrdersByBatch(BatchId);
|
||||
}
|
||||
|
||||
protected void txtRatio_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
int valRatio = 0;
|
||||
int.TryParse(txtRatio.Text, out valRatio);
|
||||
lblRatio01.Text = $"{valRatio}";
|
||||
lblRatio02.Text = $"{100 - valRatio}";
|
||||
lblSplitRatio.Text = $"{valRatio}/{100 - valRatio}";
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
+18
-9
@@ -77,15 +77,6 @@ namespace NKC_WF.WebUserControls
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblRatio01;
|
||||
|
||||
/// <summary>
|
||||
/// lblSplitRatio 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 lblSplitRatio;
|
||||
|
||||
/// <summary>
|
||||
/// lblRatio02 control.
|
||||
/// </summary>
|
||||
@@ -103,5 +94,23 @@ namespace NKC_WF.WebUserControls
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox txtRatio;
|
||||
|
||||
/// <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_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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_orderExtList.ascx.cs" Inherits="NKC_WF.WebUserControls.cmp_orderExtList" %>
|
||||
|
||||
<asp:GridView ID="grView" runat="server"></asp:GridView>
|
||||
<asp:ObjectDataSource ID="ods" runat="server"></asp:ObjectDataSource>
|
||||
@@ -0,0 +1,27 @@
|
||||
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_orderExtList : System.Web.UI.UserControl
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public DS_App.OrderListDataTable CurrOrders { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <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_orderExtList
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// grView 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.GridView grView;
|
||||
|
||||
/// <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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user