更改 ProdRouteJob 对 WrkCtrCapRes 或重新计算容量预留没有影响

发布于 2024-12-18 11:31:57 字数 149 浏览 0 评论 0原文

我正在使用外部优化工具的优化数据更改路线作业 (ProdRouteJob)。更改的数据是用一个简单的 ax 类和 prodRouteJob.update() 写入的。 现在的问题是,容量预留 (WrkCtrCapRes) 将不会更新。有没有办法重新计算容量预留?或者创建新的容量预留?

I'm changing the route jobs (ProdRouteJob) with optimised data from an external optimisation tool. The changed data is written with a simple ax class and a prodRouteJob.update().
The problem now is, that the capacity reservations (WrkCtrCapRes) will not get updated. Is the a way to recalculate the capacity reservations? Or create new capacity reservations?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

寂寞陪衬 2024-12-25 11:31:57

WrkCtrCapRes 唯一更新的地方是 WrkCtrJobData.updateCapacityReservations() 方法。 WrkCtrJobData 类需要 WrkCtrScheduleJobs 和其他深层复杂性。

ProdRouteJob 不具备更新容量预留的完整知识,它必须考虑日历。

我采用了以下方法来进行类似的更新。它不支持“基本日历”,但在其他方面做了我需要的事情。

Hours updateWrkCtrCapRes(ProdRouteJob prodRouteJob, WrkCtrTable wrkCtrTable = WrkCtrTable::find(prodRouteJob.WrkCtrId))
{
    WrkCtrCapRes         wrkCtrCapRes;
    WorkCalendarDateLine workCalendarDateLine;
    Seconds              sec;    
    delete_from wrkCtrCapRes
        where wrkCtrCapRes.RefType     == WrkCtrCapRefType::Production &&
              wrkCtrCapRes.RefId       == prodRouteJob.ProdId &&
              wrkCtrCapRes.OprNum      == prodRouteJob.OprNum &&
              wrkCtrCapRes.OprPriority == prodRouteJob.OprPriority &&
              wrkCtrCapRes.JobId       == prodRouteJob.JobId;    
    wrkCtrCapRes.ReqPlanId     = ReqPlanSched::defaultDynamicId();
    wrkCtrCapRes.LoadType      = WrkCtrCapacityType::JobSched;
    wrkCtrCapRes.RefType       = WrkCtrCapRefType::Production;
    wrkCtrCapRes.RefId         = prodRouteJob.ProdId;
    wrkCtrCapRes.OprNum        = prodRouteJob.OprNum;
    wrkCtrCapRes.OprPriority   = prodRouteJob.OprPriority;
    wrkCtrCapRes.JobType       = prodRouteJob.JobType;
    wrkCtrCapRes.JobId         = prodRouteJob.JobId;
    wrkCtrCapRes.Locked        = prodRouteJob.Locked;    
    wrkCtrCapRes.WrkCtrGroupId = wrkCtrTable.WrkCtrGroupId;
    wrkCtrCapRes.WrkCtrId      = wrkCtrTable.WrkCtrId;
    wrkCtrCapRes.WrkCtrLoadPct = 100.0;    
    while select workCalendarDateLine
        where workCalendarDateLine.CalendarId == wrkCtrTable.CalendarId &&
              workCalendarDateLine.TransDate  >= prodRouteJob.FromDate &&
              workCalendarDateLine.TransDate  <= prodRouteJob.ToDate
    {
        if (workCalendarDateLine.TransDate == prodRouteJob.FromDate)
            workCalendarDateLine.FromTime   = max(workCalendarDateLine.FromTime, prodRouteJob.FromTime);
        if (workCalendarDateLine.TransDate == prodRouteJob.ToDate)
            workCalendarDateLine.ToTime     = min(workCalendarDateLine.ToTime, prodRouteJob.ToTime);
        if (workCalendarDateLine.FromTime < workCalendarDateLine.ToTime)
        {
            wrkCtrCapRes.TransDate = workCalendarDateLine.TransDate;
            wrkCtrCapRes.StartTime = workCalendarDateLine.FromTime;
            wrkCtrCapRes.EndTime   = workCalendarDateLine.ToTime;
            wrkCtrCapRes.WrkCtrSec = wrkCtrCapRes.EndTime - wrkCtrCapRes.StartTime;
            wrkCtrCapRes.insert();
            sec += wrkCtrCapRes.WrkCtrSec;
        }
    }
    return decRound(sec / 3600.0, 5);
}

The only place where WrkCtrCapRes is updated is in the WrkCtrJobData.updateCapacityReservations() method. The class WrkCtrJobData requires WrkCtrScheduleJobs and other deep down complexities.

The ProdRouteJob does not have the full knowledge to update capacity reservation, it will have to take calendar into consideration.

I have made the following method to do a similar update. It does not support "Base calendar", but otherwise did what I needed.

Hours updateWrkCtrCapRes(ProdRouteJob prodRouteJob, WrkCtrTable wrkCtrTable = WrkCtrTable::find(prodRouteJob.WrkCtrId))
{
    WrkCtrCapRes         wrkCtrCapRes;
    WorkCalendarDateLine workCalendarDateLine;
    Seconds              sec;    
    delete_from wrkCtrCapRes
        where wrkCtrCapRes.RefType     == WrkCtrCapRefType::Production &&
              wrkCtrCapRes.RefId       == prodRouteJob.ProdId &&
              wrkCtrCapRes.OprNum      == prodRouteJob.OprNum &&
              wrkCtrCapRes.OprPriority == prodRouteJob.OprPriority &&
              wrkCtrCapRes.JobId       == prodRouteJob.JobId;    
    wrkCtrCapRes.ReqPlanId     = ReqPlanSched::defaultDynamicId();
    wrkCtrCapRes.LoadType      = WrkCtrCapacityType::JobSched;
    wrkCtrCapRes.RefType       = WrkCtrCapRefType::Production;
    wrkCtrCapRes.RefId         = prodRouteJob.ProdId;
    wrkCtrCapRes.OprNum        = prodRouteJob.OprNum;
    wrkCtrCapRes.OprPriority   = prodRouteJob.OprPriority;
    wrkCtrCapRes.JobType       = prodRouteJob.JobType;
    wrkCtrCapRes.JobId         = prodRouteJob.JobId;
    wrkCtrCapRes.Locked        = prodRouteJob.Locked;    
    wrkCtrCapRes.WrkCtrGroupId = wrkCtrTable.WrkCtrGroupId;
    wrkCtrCapRes.WrkCtrId      = wrkCtrTable.WrkCtrId;
    wrkCtrCapRes.WrkCtrLoadPct = 100.0;    
    while select workCalendarDateLine
        where workCalendarDateLine.CalendarId == wrkCtrTable.CalendarId &&
              workCalendarDateLine.TransDate  >= prodRouteJob.FromDate &&
              workCalendarDateLine.TransDate  <= prodRouteJob.ToDate
    {
        if (workCalendarDateLine.TransDate == prodRouteJob.FromDate)
            workCalendarDateLine.FromTime   = max(workCalendarDateLine.FromTime, prodRouteJob.FromTime);
        if (workCalendarDateLine.TransDate == prodRouteJob.ToDate)
            workCalendarDateLine.ToTime     = min(workCalendarDateLine.ToTime, prodRouteJob.ToTime);
        if (workCalendarDateLine.FromTime < workCalendarDateLine.ToTime)
        {
            wrkCtrCapRes.TransDate = workCalendarDateLine.TransDate;
            wrkCtrCapRes.StartTime = workCalendarDateLine.FromTime;
            wrkCtrCapRes.EndTime   = workCalendarDateLine.ToTime;
            wrkCtrCapRes.WrkCtrSec = wrkCtrCapRes.EndTime - wrkCtrCapRes.StartTime;
            wrkCtrCapRes.insert();
            sec += wrkCtrCapRes.WrkCtrSec;
        }
    }
    return decRound(sec / 3600.0, 5);
}
埋情葬爱 2024-12-25 11:31:57

我只是添加了这个方法:

static void ProdSchedule(ProdId _ProdId) 
{
 ProdTableType ProdTableType;
 ProdTable ProdTable=ProdTable::find(_ProdId);
 ProdParmScheduling ProdParmScheduling;
 ; 
 ProdTableType=new ProdTableType(ProdTable);
 ProdParmScheduling = ProdParmScheduling::findLast(_ProdId,ProdSchedMethod::JobScheduling);     ProdTableType.runJobScheduling(ProdParmScheduling); 
}

I simply added this method :

static void ProdSchedule(ProdId _ProdId) 
{
 ProdTableType ProdTableType;
 ProdTable ProdTable=ProdTable::find(_ProdId);
 ProdParmScheduling ProdParmScheduling;
 ; 
 ProdTableType=new ProdTableType(ProdTable);
 ProdParmScheduling = ProdParmScheduling::findLast(_ProdId,ProdSchedMethod::JobScheduling);     ProdTableType.runJobScheduling(ProdParmScheduling); 
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文