xj qian
2024-10-18 75c79a8f48b19a40b1a86b7206fbb5302c947567
update
已修改2个文件
162 ■■■■■ 文件已修改
jrj/project/business/Quote/QuoteFilePurch2Select.cpp 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/business/QuoteFile.cpp 144 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/business/Quote/QuoteFilePurch2Select.cpp
@@ -74,6 +74,21 @@
        return 1;
    }
    xstring GetReason(LPARAM pr)
    {
        xaserverarg arg;
        arg.AddArg(L"EntityID", GetEntityID(2),L"xs:string");
        openUrl(L"/sale/view/workflow.view/xpage/chkdlg_vd", &arg);    //---openUrl("/sale/view/workflow.view/xpage/chkdlg", arg);
        string comdid = arg.GetArgString(L"comdid");
        if (comdid == L"xmOK")
        {
            string value = arg.GetArgString(L"content");
            if (value == L"")value = L".";
            return value;
        }
        return L"";
    }
    //命令发布函数
    int OnCmdDispatch(xstring comdid)
    {
@@ -85,7 +100,10 @@
                xstring TaskID = dw_process.GetItemString(row, L"taskid");
                if (GetWinParam())
                {
                    xstring reason = GetReason(0);
                    if (reason == L"")return 1;
                    xaserverarg arg = GetArg();
                    arg.AddArg(L"Reason", reason);
                    arg.AddArg(L"TaskID", TaskID);
                    CloseWindow();
                    return 1;
jrj/project/business/QuoteFile.cpp
@@ -2802,13 +2802,153 @@
        return 1;
    }
    int OnCellItemChanged(TEvent* evt, int p)
    int ReCalcPOPrice()
    {
        int startRow = getItemHeadRow(dw_cell);
        if (startRow < 1) return 1;
        startRow++;
        int sRow = dw_cell.GetRow();
        int eRow = dw_cell.GetAnchorRow();
        int sCol = dw_cell.GetColumn();
        int eCol = dw_cell.GetAnchorCol();
        auto Exchange = [](int& first, int& second)
            {
                int tmp = first;first = second;second = tmp;
            };
        if (sRow > eRow)Exchange(sRow, eRow);
        if (sCol > eCol)Exchange(sCol, eCol);
        if (action != L"purch") return 1;
        if (sRow < startRow  && eRow < startRow) return 1;
        if (sRow < startRow) sRow = startRow;
        int colPrice0 = getItemCol(dw_cell, startRow - 1, L"价格");
        int colPrice1 = getItemCol(dw_cell, startRow - 1, L"价格1");
        int colPrice2 = getItemCol(dw_cell, startRow - 1, L"价格2");
        int colPrice3 = getItemCol(dw_cell, startRow - 1, L"价格3");
        int colPrice = getItemCol(dw_cell, startRow - 1, L"采购价");
        int colSKUID = getItemCol(dw_cell, startRow - 1, L"SKUID");
        bool shouldRedraw = false;
        if ((colPrice0 >= sCol && colPrice0 <= eCol) || (colPrice1 >= sCol && colPrice1 <= eCol)
            || (colPrice2 >= sCol && colPrice2 <= eCol) || (colPrice3 >= sCol && colPrice3 <= eCol))
        {
            for (int row = sRow; row <= eRow; row++)
            {
                if (dw_cell.GetItemString(row, colSKUID) == L"")continue;
                for (int col = sCol; col <= eCol; col++)
                {
                    if (colPrice0 == col || colPrice1 == col || colPrice2 == col || colPrice3 == col)
                    {
                        xstring pricea = L"";
                        xstring priceb = L"";
                        xstring pricec = L"";
                        xstring price0 = dw_cell.GetItemString(row, colPrice0);
                        xstring price1 = dw_cell.GetItemString(row, colPrice1);
                        xstring price2 = L"";
                        if (colPrice2 > 0) price2 = dw_cell.GetItemString(row, colPrice2);
                        xstring price3 = L"";
                        if (colPrice3 > 0) price3 = dw_cell.GetItemString(row, colPrice3);
                        xstring price = L"";
                        if (price0 != L"")
                        {
                            price = price0;
                            if (price.find(L"A") < 1 && price.find(L"B") < 1 && price.find(L"C") < 1 && price.find(L"a") < 1 && price.find(L"b") < 1 && price.find(L"b") < 1)
                            {
                                alert(L"价格中没指定ABC");
                                if (pricea == L"") pricea = price; else pricea += L"+" + price;
                            }
                            else if (price.find(L"A") > 0 || price.find(L"a") > 0)
                                if (pricea == L"") pricea = price; else pricea += L"+" + price;
                            else if (price.find(L"B") > 0 || price.find(L"b") > 0)
                                if (priceb == L"") priceb = price; else priceb += L"+" + price;
                            else if (price.find(L"C") > 0 || price.find(L"c") > 0)
                                if (pricec == L"") pricec = price; else pricec += L"+" + price;
                        }
                        if (price1 != L"")
                        {
                            price = price1;
                            if (price.find(L"A") < 1 && price.find(L"B") < 1 && price.find(L"C") < 1 && price.find(L"a") < 1 && price.find(L"b") < 1 && price.find(L"b") < 1)
                            {
                                alert(L"价格中没指定ABC");
                                if (pricea == L"") pricea = price; else pricea += L"+" + price;
                            }
                            else if (price.find(L"A") > 0 || price.find(L"a") > 0)
                                if (pricea == L"") pricea = price; else pricea += L"+" + price;
                            else if (price.find(L"B") > 0 || price.find(L"b") > 0)
                                if (priceb == L"") priceb = price; else priceb += L"+" + price;
                            else if (price.find(L"C") > 0 || price.find(L"c") > 0)
                                if (pricec == L"") pricec = price; else pricec += L"+" + price;
                        }
                        if (price2 != L"")
                        {
                            price = price2;
                            if (price.find(L"A") < 1 && price.find(L"B") < 1 && price.find(L"C") < 1 && price.find(L"a") < 1 && price.find(L"b") < 1 && price.find(L"b") < 1)
                            {
                                alert(L"价格中没指定ABC");
                                if (pricea == L"") pricea = price; else pricea += L"+" + price;
                            }
                            else if (price.find(L"A") > 0 || price.find(L"a") > 0)
                                if (pricea == L"") pricea = price; else pricea += L"+" + price;
                            else if (price.find(L"B") > 0 || price.find(L"b") > 0)
                                if (priceb == L"") priceb = price; else priceb += L"+" + price;
                            else if (price.find(L"C") > 0 || price.find(L"c") > 0)
                                if (pricec == L"") pricec = price; else pricec += L"+" + price;
                        }
                        if (price3 != L"")
                        {
                            price = price3;
                            if (price.find(L"A") < 1 && price.find(L"B") < 1 && price.find(L"C") < 1 && price.find(L"a") < 1 && price.find(L"b") < 1 && price.find(L"b") < 1)
                            {
                                alert(L"价格中没指定ABC");
                                if (pricea == L"") pricea = price; else pricea += L"+" + price;
                            }
                            else if (price.find(L"A") > 0 || price.find(L"a") > 0)
                                if (pricea == L"") pricea = price; else pricea += L"+" + price;
                            else if (price.find(L"B") > 0 || price.find(L"b") > 0)
                                if (priceb == L"") priceb = price; else priceb += L"+" + price;
                            else if (price.find(L"C") > 0 || price.find(L"c") > 0)
                                if (pricec == L"") pricec = price; else pricec += L"+" + price;
                        }
                        price = pricec;
                        if (priceb != L"")
                        {
                            if (price == L"")
                                price = priceb;
                            else
                                price += L"+" + priceb;
                        }
                        if (pricea != L"")
                        {
                            if (price == L"")
                                price = pricea;
                            else
                                price += L"+" + pricea;
                        }
                        dw_cell.SetItemString(row, colPrice, price);
                        shouldRedraw = true;
                    }
                }
            }
        }
        if(shouldRedraw)dw_cell.Redraw();
        return 1;
    }
    int OnCellItemChanged(TEvent* evt, LPARAM p)
    {
        CELLNMHDR&  hdr = *(CELLNMHDR*)evt->notify.pnmh;
        xstring value = hdr.data;
        int row = hdr.currentrow;
        int col = hdr.currentcol;
        trace(L"\r\n----row:" + xstring(row) + L"--col:" + xstring(col));
        trace(L"\r\n----row:" + xstring(row) + L"--col:" + xstring(col));
        trace(L"\r\n--value:" + dw_cell.GetItemString(row, col) + L"--orig:" + orivalue);
@@ -3458,6 +3598,7 @@
        else if (comdid == L"xmPurched")
        {
            //if(makeMessage(L"/task/quote/purchar/backtosaler")==-1) return 1;
            //dw_cell.SetRowColumn(dw_cell.GetRow(), dw_cell.GetColumn());
            return OnSaleBack();
        }
        else if (comdid == L"xmPurch2")
@@ -3566,6 +3707,7 @@
                }
            }
            SendCtrlCmd(dw_cell, cmd);
            if (comdid == L"IK_xmEditCut"|| comdid == L"IK_xmEditCut")ReCalcPOPrice();
            return 1;
        }
        else if (comdid == L"xmFormatCellDeleteRow")