zoukankan      html  css  js  c++  java
  • Master scheduling run for All Items not picking up level 0 items

    Master scheduling had been working fine for a number of days following Go-live, but then something happening and a lot of items were not being picked up in the master scheduling run. The symptoms reported by the user was that the process was only running for 10 minutes, where initially it was taking 2 hours to run. Also, no errors were being reported. I suspected a data issue and after a several hours of investigation I finally found the issue. Somehow an InventTable record with a blank ItemId had been created in the database. In the Master Scheduling code that builds the item list for each level there's an If statement that checks the ItemId and if it's blank exits the loop and because this blank item was the first item processed for the level, no items were being selected for this level for the master scheduling run.

     

    take it easy , Following on from the discovery of this issue and the workaround of deleting the blank item from InventTable, the blank item kept reappearing in the database and it was decided to modify the Master Planning code to discard items with a blank ItemId.

    select * from InventTable a where a.ItemId =  ''

    delete from InventTable where ItemId =  ''

    This was done by making a simple change to the createListsFromQueryRun method of the ReqTransCache_Periodic class which builds the item lists used by master planning.

    Remark by Jimmy on May 20th 2011

     

    ReqTransCache_Periodic
    /// <summary>
    /// Creates the itemSet and inserts record into the ReqProcessItemList and ReqProcessItemListLine tables
    /// based on the QueryRun object from the <paramref name="_con"/> parameter.
    /// </summary>
    /// <param name="_con">
    /// Container holding a QueryRun object.
    /// </param>
    /// <param name="_listSize">
    /// Factor for determining the size of the lists.
    /// </param>
    public void createListsFromQueryRun(container _con, ReqProcessListSize _listSize)
    {
    QueryRun runQuery
    = new QueryRun(_con);
    ReqProcessItemList reqProcessItemList;
    ReqProcessItemListLine reqProcessItemListLine;
    InventTable inventTable;
    RecordInsertList recordInsertList
    = new RecordInsertList(tablenum(ReqProcessItemListLine));
    Map levelItemMap
    = new Map(Types::Integer, Types::Class);
    Set itemSet;
    int itemCount;
    MapEnumerator me_level;
    SetEnumerator se_item;
    int listSize;
    int listNum;
    boolean createLastList;

    void initReqProcessItemList()
    {
    ;
    reqProcessItemList.clear();
    reqProcessItemList.ProcessId
    = processId;
    reqProcessItemList.Level
    = me_level.current();
    reqProcessItemList.ListNum
    = listNum;
    reqProcessItemList.Status
    = ReqProcessStatus::Update;
    }

    ;

    while (runQuery.next())
    {
    inventTable
    = runQuery.get(tablenum(InventTable));

    //remark by Jimmy 2011-05-20 --
    // Discard any items with a blank ItemId
    if (inventTable.ItemId == "")
    {
    continue;
    }
    //remark by Jimmy 2011-05-20 --

    if (!levelItemMap.exists(inventTable.bomLevel))
    {
    itemSet
    = new Set(Types::String);
    levelItemMap.insert(inventTable.bomLevel, itemSet);
    }
    else
    itemSet
    = levelItemMap.lookup(inventTable.bomLevel);

    itemSet.add(inventTable.ItemId);

    }

    ttsbegin;

    me_level
    = levelItemMap.getEnumerator();

    while (me_level.moveNext())
    {
    itemCount
    = 0;
    createLastList
    = false;
    itemSet
    = me_level.currentValue();

    listSize
    = (maxChildThreads + 1) * _listSize;

    if (maxChildThreads > 0 && listSize > (itemSet.elements() / maxChildThreads))
    listSize
    = itemSet.elements() / maxChildThreads;

    if (listSize < 1)
    listSize
    = 1;

    se_item
    = itemSet.getEnumerator();

    while (se_item.moveNext())
    {
    reqProcessItemListLine.ProcessId
    = processId;
    reqProcessItemListLine.ListNum
    = listNum;
    reqProcessItemListLine.ItemId
    = se_item.current();
    recordInsertList.add(reqProcessItemListLine);

    itemCount
    ++;

    createLastList
    = true;

    if (itemCount == listSize)
    {
    itemCount
    = 0;
    createLastList
    = false;
    initReqProcessItemList();
    reqProcessItemList.insert();

    listNum
    ++;
    }
    }

    if (createLastList)
    {
    initReqProcessItemList();
    reqProcessItemList.insert();

    listNum
    ++;
    }

    initReqProcessItemList();
    reqProcessItemList.Spare
    = true;
    reqProcessItemList.insert();

    listNum
    ++;
    }

    recordInsertList.insertDatabase();

    ttscommit;
    }
  • 相关阅读:
    阶段一-01.万丈高楼,地基首要-第2章 单体架构设计与准备工作-2-1 单体架构阶段概述与项目演示
    阶段一-01.万丈高楼,地基首要-第1章 学习指南-1-4 架构师所需要具备的技术栈与能力
    阶段一-01.万丈高楼,地基首要-第1章 学习指南-1-3 大型网站架构演变历程
    Spring cloud微服务安全实战-8-1课程总结
    Spring cloud微服务安全实战-7-13章节总结
    Spring cloud微服务安全实战-7-12整合链路追踪和日志监控
    Spring cloud微服务安全实战-7-11PinPoint+SpringBoot环境搭建
    Spring cloud微服务安全实战-7-10ELK日志采集架构优化
    Spring cloud微服务安全实战-7-9自定义日志采集的格式和内容
    Spring cloud微服务安全实战-7-8ELK+SpringBoot环境搭建
  • 原文地址:https://www.cnblogs.com/Fandyx/p/2052196.html
Copyright © 2011-2022 走看看