From e05f7cc8755eb7f5525e6bf86a7e5454a0c91fd0 Mon Sep 17 00:00:00 2001
From: xj qian <qianxj15@sina.com>
Date: 星期三, 23 十月 2024 18:07:24 +0800
Subject: [PATCH] Merge branch 'master' of http://116.62.18.175:6699/r/mis-prj

---
 jrj/project/business/QuoteFile.cpp |  152 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 150 insertions(+), 2 deletions(-)

diff --git a/jrj/project/business/QuoteFile.cpp b/jrj/project/business/QuoteFile.cpp
index a048890..8f048b2 100644
--- a/jrj/project/business/QuoteFile.cpp
+++ b/jrj/project/business/QuoteFile.cpp
@@ -2225,6 +2225,7 @@
 		xml sheet ;
 		sheet.setNativePointer(x.CreateInstance());
 		sheet.loadXML(x.selectSingleNode(L"data/*").xml);
+		wangushendi xiuluowushen taigukuangmo
 		*/
 
 		//trace(x.xml());
@@ -2802,13 +2803,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 +3599,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 +3708,7 @@
 				}
 			}
 			SendCtrlCmd(dw_cell, cmd);
+			if (comdid == L"IK_xmEditCut"|| comdid == L"IK_xmEditCut")ReCalcPOPrice();
 			return 1;
 		}
 		else if (comdid == L"xmFormatCellDeleteRow")
@@ -3617,9 +3760,10 @@
 		arg.AddArg(L"EntityID", entityID);
 		OpenWindow(L"dev:xpage[QuoteFilePurch2Select.vx]", arg);
 		xstring taskID = arg.GetArgString(L"TaskID");
+		xstring reason = arg.GetArgString(L"Reason");
 		if (taskID != L"")
 		{
-			ProcessSendMessage(L"/task/quote/repurch", taskID, L"", L"", true);
+			ProcessSendMessage(L"/task/quote/repurch", taskID, reason, L"", true);
 		}
 		return 1;
 	}
@@ -4235,6 +4379,8 @@
 			else if (col == colTyp1 || col == colTyp || col == colTyp2 || col == colTyp3)
 			{
 				xstring pitems1 = L"";
+				pitems1 += (xstring)L"&lt;row&gt;&lt;显示列&gt;&lt;/显示列&gt;&lt;数据列&gt;"
+					+ L"&lt;/数据列&gt;&lt;/row&gt;";
 				pitems1 += (xstring)L"&lt;row&gt;&lt;显示列&gt;成品&lt;/显示列&gt;&lt;数据列&gt;"
 					+ L"成品&lt;/数据列&gt;&lt;/row&gt;";
 				pitems1 += (xstring)L"&lt;row&gt;&lt;显示列&gt;散货&lt;/显示列&gt;&lt;数据列&gt;"
@@ -4489,6 +4635,8 @@
 			else if (col == colTyp1 || col == colTyp)
 			{
 				xstring pitems1 = L"";
+				pitems1 += (xstring)L"&lt;row&gt;&lt;显示列&gt;&lt;/显示列&gt;&lt;数据列&gt;"
+					+ L"&lt;/数据列&gt;&lt;/row&gt;";
 				pitems1 += (xstring)L"&lt;row&gt;&lt;显示列&gt;成品&lt;/显示列&gt;&lt;数据列&gt;"
 					+ L"成品&lt;/数据列&gt;&lt;/row&gt;";
 				pitems1 += (xstring)L"&lt;row&gt;&lt;显示列&gt;散货&lt;/显示列&gt;&lt;数据列&gt;"

--
Gitblit v1.9.3