• Intercompany Sales order


    1)Update Intercompany infomation

    void updateNewDimension()
    {
    /**
    Add by Jimmy 2010-07-12
    update New dimension
    */
    SalesLine UpInterSOCN,UpInterSOHK;
    PurchLine _purchLine;
    // SalesLine _salesLine;
    ;
    if(salesLine.isInterCompanyOrder())
    {
    changecompany(salesLine.salesTable().InterCompanyCompanyId)
    {
    select firstonly _purchLine
    index hint PurchLineIdx
    where _purchLine.InventTransId == salesLine.InterCompanyInventTransId ;

    ttsbegin;
    select firstonly forupdate UpInterSOCN
    index hint SalesLineIdx
    where UpInterSOCN.InventTransId == _purchLine.InventRefTransId;

    if (UpInterSOCN)
    {

    UpInterSOCN.NewDimension
    = salesLine.NewDimension;
    UpInterSOCN.doUpdate();
    }
    ttscommit;
    }
    }
    else
    {
    if(salesLine.salesTable().InterCompanyAutoCreateOrders)
    {
    select firstonly _purchLine
    index hint PurchLineIdx
    where _purchLine.InventRefTransId == SalesLine.InventTransId;

    if (PurchTable::find(_purchLine.PurchId).InterCompanyCompanyId)
    {
    ChangeCompany(PurchTable::find(_purchLine.PurchId).InterCompanyCompanyId)
    {
    ttsbegin;
    select firstonly forupdate UpInterSOHK
    index hint SalesLineIdx
    where UpInterSOHK.InventTransId == _purchLine.InterCompanyInventTransId;

    if(UpInterSOHK)
    {
    UpInterSOHK.NewDimension
    = SalesLine.NewDimension;
    UpInterSOHK.doUpdate();
    }
    ttscommit;
    }
    }
    }
    }
    }

    2)check intercompany delivery date

    static void Jimmy_CheckIntercompanyOrderDeliveryDate(Args _args)
    {
    SalesLine SalesLineHK,SalesLineCN;
    PurchLine PurchLineHK;
    Container con;
    int i;
    ;
    //qcn
    setprefix("Different delivery date!");
    changecompany(
    "qcn")
    {
    while select SalesLineCN
    where SalesLineCN.SalesStatus == SalesStatus::Backorder
    && SalesLineCN.InterCompanyInventTransId != ""
    {
    con
    = ["qhk"];
    select firstonly crosscompany:con PurchLineHK
    where PurchLineHK.InventTransId == SalesLineCN.InterCompanyInventTransId
    && PurchLineHK.InterCompanyInventTransId != "";
    select firstonly crosscompany:con SalesLineHK
    where SalesLineHK.SalesId == PurchLineHK.InventRefId //CN SO
    && SalesLineHK.InventRefTransId == PurchLineHK.InventTransId;
    if(SalesLineHK)
    {
    if(SalesLineCN.ConfirmedDlv != SalesLineHK.ConfirmedDlv)
    {
    i
    ++;
    info(strfmt(
    "%6 - SO: %1,ItemId: %2,HK: %3,CN: %4,HK PO: %5",
    i,SalesLineHK.SalesId,SalesLineHK.ItemId,SalesLineHK.ConfirmedDlv,
    SalesLineCN.ConfirmedDlv,PurchLineHK.DeliveryDate));
    }
    }
    }
    }

    //qhk
    setprefix("Different delivery date!");
    changecompany(
    "QHK")
    {
    while select SalesLineHK
    where SalesLineHK.SalesStatus == SalesStatus::Backorder
    && SalesLineHK.InventRefType == InventRefType::Purch
    {
    PurchLineHK
    = PurchLine::findInventTransId(SalesLineHK.InventRefTransId);
    //if(SalesLineHK.interCompanySalesLineExist())
    if(PurchLineHK.InterCompanyInventTransId)
    {
    CON
    = ["QCN"];
    select firstonly crosscompany:con SalesLineCN
    where SalesLineCN.SalesId == SalesLineHK.SalesId
    && SalesLineCN.InterCompanyInventTransId == PurchLineHK.InventTransId;
    if(SalesLineCN.ConfirmedDlv != SalesLineHK.ConfirmedDlv)
    {
    i
    ++;
    info(strfmt(
    "%6 - SO: %1,ItemId: %2,HK: %3,CN: %4,HK PO: %5",
    i,SalesLineHK.SalesId,SalesLineHK.ItemId,SalesLineHK.ConfirmedDlv,
    SalesLineCN.ConfirmedDlv,PurchLineHK.DeliveryDate));
    }
    }
    }
    }
    info(strfmt(
    "total %1 records",i));
    }
  • 相关阅读:
    「Poetize10」封印一击
    「Poetize10」能量获取
    vijosP1499炸毁燃料库
    BZOJ3550: [ONTAK2010]Vacation
    总结#3--一类最小割问题
    BZOJ1976: [BeiJing2010组队]能量魔方 Cube
    BZOJ2132: 圈地计划
    BZOJ2127: happiness
    BZOJ1754: [Usaco2005 qua]Bull Math
    920. 会议室
  • 原文地址:https://www.cnblogs.com/Fandyx/p/1775651.html
Copyright © 2020-2023  润新知