From 703d27d52ba0ac373b62aedb93f9cfe9f8857ed2 Mon Sep 17 00:00:00 2001
From: xj qian <qianxj15@sina.com>
Date: 星期三, 25 九月 2024 17:19:56 +0800
Subject: [PATCH] update

---
 jrj/project/business/QuoteFile.cpp |   85 ++++++++++++++++++++++++++++++------------
 1 files changed, 60 insertions(+), 25 deletions(-)

diff --git a/jrj/project/business/QuoteFile.cpp b/jrj/project/business/QuoteFile.cpp
index 56de5c5..c1a716a 100644
--- a/jrj/project/business/QuoteFile.cpp
+++ b/jrj/project/business/QuoteFile.cpp
@@ -507,10 +507,9 @@
 
 		xaserverarg argx;
 		argx.AddArg(L"QuoteNo", dw_base.GetItemString(1, L"QuoteNo"));
-		int p1 = argx;
 		if (dw_base.GetItemString(1, L"QuoteNo") != L"")
 		{
-			OpenWindow(L"dev:xpage[xmQuoteBillList.vx]", p1);
+			OpenWindow(L"dev:xpage[xmQuoteBillList.vx]", argx);
 		}
 		if (argx.GetArgString(L"action") != L"ok") return 1;
 
@@ -3015,14 +3014,14 @@
 						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"+L" + price;
+							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"+L" + price;
+							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"+L" + price;
+							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"+L" + price;
+							if (pricec == L"") pricec = price; else pricec += L"+" + price;
 					}
 					if (price1 != L"")
 					{
@@ -3030,14 +3029,14 @@
 						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"+L" + price;
+							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"+L" + price;
+							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"+L" + price;
+							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"+L" + price;
+							if (pricec == L"") pricec = price; else pricec += L"+" + price;
 					}
 					if (price2 != L"")
 					{
@@ -3045,14 +3044,14 @@
 						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"+L" + price;
+							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"+L" + price;
+							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"+L" + price;
+							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"+L" + price;
+							if (pricec == L"") pricec = price; else pricec += L"+" + price;
 					}
 					if (price3 != L"")
 					{
@@ -3060,14 +3059,14 @@
 						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"+L" + price;
+							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"+L" + price;
+							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"+L" + price;
+							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"+L" + price;
+							if (pricec == L"") pricec = price; else pricec += L"+" + price;
 					}
 					price = pricec;
 					if (priceb != L"")
@@ -3075,14 +3074,14 @@
 						if (price == L"")
 							price = priceb;
 						else
-							price += L"+L" + priceb;
+							price += L"+" + priceb;
 					}
 					if (pricea != L"")
 					{
 						if (price == L"")
 							price = pricea;
 						else
-							price += L"+L" + pricea;
+							price += L"+" + pricea;
 					}
 					dw_cell.SetItemString(row, colPrice, price);
 					dw_cell.Redraw();
@@ -3446,6 +3445,10 @@
 			//if(makeMessage(L"/task/quote/purchar/backtosaler")==-1) return 1;
 			return OnSaleBack();
 		}
+		else if (comdid == L"xmPurch2")
+		{
+			return OnPurch2();
+		}
 		else if (comdid == L"xmPurch")
 		{
 			return OnPurch();
@@ -3555,10 +3558,10 @@
 			if (action == L"purch")
 			{
 				int crow = dw_cell.GetRow();
-				xstring cmd = comdid.mid(3, comdid.length());
-				if (getRowID(dw_cell, crow) == L"") SendCtrlCmd(dw_cell, cmd);
+				if (getRowID(dw_cell, crow) == L"") SendCtrlCmd(dw_cell, comdid);
 				return 1;
 			}
+			return 1;
 		}
 		return 0;
 	}
@@ -3589,6 +3592,19 @@
 			xstring error = x.text();
 			alert(error);
 			return -1;
+		}
+		return 1;
+	}
+
+	int OnPurch2()
+	{
+		xaserverarg arg;
+		arg.AddArg(L"EntityID", entityID);
+		OpenWindow(L"dev:xpage[QuoteFilePurch2Select.vx]", arg);
+		xstring taskID = arg.GetArgString(L"TaskID");
+		if (taskID != L"")
+		{
+			ProcessSendMessage(L"/task/quote/repurch", taskID, L"", L"", true);
 		}
 		return 1;
 	}
@@ -4492,7 +4508,7 @@
 						{
 							alert(L"价格中没指定ABC");
 						}
-						price = price0 + L"+L" + price1;
+						price = price0 + L"+" + price1;
 					}
 					dw_cell.SetItemString(ARow, colPrice, price);
 				}
@@ -4724,6 +4740,21 @@
 		return 1;
 	}
 
+	xstring GetTryFirstAttr(xstring str, xstring term)
+	{
+		xstring foundStr = L" " + term + L"=";
+		wchar quote = L'"';
+		int pos = str.find(foundStr);
+		if (pos < 0) return L"";
+		pos += foundStr.length();
+		while (str.at(pos) == L' ')pos++;
+		if (str.at(pos) == L'\'')quote = L'\'';
+		int epos = ++pos;
+		while (str.at(epos) && str.at(epos) != quote)epos++;
+		if (!str.at(epos))return L"";
+		return str.mid(pos, epos - pos);
+	}
+
 	int onload()
 	{
 		SetArg();
@@ -4755,7 +4786,11 @@
 			x.loadXML(templ);
 			*/
 			action = L"purch";
-
+			action = GetTryFirstAttr(templ, L"action");
+			if (action == L"") action = L"purch";
+			entityItemID = GetTryFirstAttr(templ, L"TemplateItemID");
+			if (entityItemID == L"")entityItemID = GetTryFirstAttr(templ, L"ItemID");
+#if 0
 			if (templ.find(L"action=\"") >= 0)
 			{
 				action = templ.mid(templ.find(L"action=\"") + 8, templ.find(L"\"", templ.find(L"action=\"") + 8) - (templ.find(L"action=\"") + 8));
@@ -4772,7 +4807,7 @@
 					entityItemID = templ.mid(templ.find(L" ItemID=\"") + 9, templ.find(L"\"", templ.find(L" ItemID=\"") + 9) - (templ.find(L" ItemID=\"") + 9));
 				}
 			}
-
+#endif
 			/*action = x.documentElement.getAttribute(L"action");
 			if(action==L"") action=L"purch";
 			entityItemID = x.documentElement.getAttribute(L"TemplateItemID");

--
Gitblit v1.9.3