MES-Toolkit/src/Archiver/Data/TableQueryHelper.cs

78 lines
3.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Chenfeng.MES.Archiver.Data
{
public class TableQueryHelper
{
public static void MesTables(Core.IArchiveReader executor, string starMonth)
{
executor.Step((table) =>
{
executor.ExecuteData(table, "LEFT(orderno,6) >= @starMonth", new { starMonth });
}, "order", "order_box_block", "order_data_block", "order_data_goods", "order_data_parts", "order_item", "order_module_extra", "order_module_item", "order_package");
executor.Step((tProcess) =>
{
executor.ExecuteData(tProcess, "LEFT(orderno,6) >= @starMonth", new { starMonth });
executor.Step((table) =>
{
executor.ExecuteChildData(table, tProcess, "parent.ID = child.OrderProcessID");
}, "order_process_step_item", "order_process_step");
}, "order_process");
executor.Step((table) =>
{
executor.ExecuteData(table, "LEFT(DATE_FORMAT(CreateTime,'%Y%m'),6) >= @starMonth", new { starMonth });
}, "simple_plan_order");
executor.Step((parent) =>
{
executor.ExecuteData(parent, "LEFT(DATE_FORMAT(CreateTime,'%Y%m'),6) >= @starMonth", new { starMonth });
executor.Step((child) =>
{
executor.ExecuteChildData(child, parent, "parent.ID = child.ID");
}, "order_block_plan_result");
}, "order_block_plan");
//CopyStep((table, newTable) =>
//{
// CopyData(table, newTable, "concat('20',left(id,4)) >= @starMonth ", new { starMonth });
//}, "order_scrap_board");
}
public static void MesLegacyTables(Core.IArchiveReader executor, string starMonth)
{
executor.Step((order) =>
{
executor.ExecuteData(order, "LEFT(DATE_FORMAT(SaleDate,'%Y%m'),6) >= @starMonth", new { starMonth });
executor.Step((child) =>
{
executor.ExecuteChildData(child, order, "parent.orderno=child.orderno");
}, "SaleOrderItem", "saleblock", "saleobject", "saleorderobject", "saleorderoffer", "saleorderpackage", "saleblockobjids", "saleobjectobjids", "saleorder_block_cadmodelinfo", "saleorderblockbaseposition",
"saleordergoodsinfo", "saleorder_block_point", "saleorder_block_pointinfo", "orderprocess", "orderprocessstep", "orderprocessstepitem");
}, "saleorder");
executor.Step((plan) =>
{
executor.ExecuteData(plan, "LEFT(DATE_FORMAT(createtime,'%Y%m'),6) >= @starMonth", new { starMonth });
executor.Step((child) =>
{
executor.ExecuteChildData(child, plan, "parent.id=child.id");
}, "orderblockprocessplanplaceresult");
}, "orderblockprocessplan");
}
}
}