From 75c79a8f48b19a40b1a86b7206fbb5302c947567 Mon Sep 17 00:00:00 2001 From: xj qian <qianxj15@sina.com> Date: 星期五, 18 十月 2024 13:56:17 +0800 Subject: [PATCH] update --- jrj/project/business/QuoteFile.cpp | 144 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 143 insertions(+), 1 deletions(-) diff --git a/jrj/project/business/QuoteFile.cpp b/jrj/project/business/QuoteFile.cpp index 8f3644f..f9b3d37 100644 --- a/jrj/project/business/QuoteFile.cpp +++ b/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") -- Gitblit v1.9.3