LiFan
2024-10-18 f21aea73037ad0465df2dfb2f161069dc024fd09
jrj/project/business/QuoteFile.cpp
@@ -275,6 +275,7 @@
      int colSKUID = getItemCol(cell, startRow - 1, L"SKUID");
      int colSaleRemark = getItemCol(cell, startRow - 1, L"业务To采购备注");
      int colBuyerMOQ = getItemCol(cell, startRow - 1, L"MOQ");
      int colBuyerRemark = getItemCol(cell, startRow - 1, L"采购To业务备注");
      int colFactoryImage = getItemCol(cell, startRow - 1, L"工厂图片");
      int colGWT = getItemCol(cell, startRow - 1, L"毛重,毛重(KG)");
@@ -326,6 +327,7 @@
         itemStr += L"<BuyerPrice>" + cell.GetItemString(row, colBuyerPrice) + L"</BuyerPrice>";
         itemStr += L"<SaleRemark>" + cell.GetItemString(row, colSaleRemark) + L"</SaleRemark>";
         itemStr += L"<BuyerMOQ>" + cell.GetItemString(row, colBuyerMOQ) + L"</BuyerMOQ>";
         itemStr += L"<BuyerRemark>" + cell.GetItemString(row, colBuyerRemark) + L"</BuyerRemark>";
         itemStr += L"<FactoryImage>" + cell.GetItemString(row, colFactoryImage) + L"</FactoryImage>";
         itemStr += L"<GWT>" + cell.GetItemString(row, colGWT) + L"</GWT>";
@@ -375,6 +377,7 @@
      int colSKUID = getItemCol(cell, startRow - 1, L"SKUID");
      int colSaleRemark = getItemCol(cell, startRow - 1, L"业务To采购备注");
      int colBuyerMOQ = getItemCol(cell, startRow - 1, L"MOQ");
      int colBuyerRemark = getItemCol(cell, startRow - 1, L"采购To业务备注");
      int colFactoryImage = getItemCol(cell, startRow - 1, L"工厂图片");
      int colGWT = getItemCol(cell, startRow - 1, L"毛重,毛重(KG)");
@@ -432,6 +435,7 @@
         itemStr += L"<BuyerPrice>" + cell.GetItemString(row, colBuyerPrice) + L"</BuyerPrice>";
         itemStr += L"<SaleRemark>" + cell.GetItemString(row, colSaleRemark) + L"</SaleRemark>";
         itemStr += L"<BuyerMOQ>" + cell.GetItemString(row, colBuyerMOQ) + L"</BuyerMOQ>";
         itemStr += L"<BuyerRemark>" + cell.GetItemString(row, colBuyerRemark) + L"</BuyerRemark>";
         itemStr += L"<FactoryImage>" + cell.GetItemString(row, colFactoryImage) + L"</FactoryImage>";
         itemStr += L"<GWT>" + cell.GetItemString(row, colGWT) + L"</GWT>";
@@ -507,10 +511,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;
@@ -828,6 +831,7 @@
      int colItemSpec = getItemCol(dw_cell, startRow - 1, L"Specifications,规格,产品规格");
      int colBuyerPrice = getItemCol(dw_cell, startRow - 1, L"采购价,采购价格");
      int colBuyerMOQ = getItemCol(dw_cell, startRow - 1, L"MOQ");
      int colBuyerRemark = getItemCol(dw_cell, startRow - 1, L"采购To业务备注");
      int colFactoryImage = getItemCol(dw_cell, startRow - 1, L"工厂图片");
      int colGWT = getItemCol(dw_cell, startRow - 1, L"毛重,毛重(KG)");
@@ -880,6 +884,7 @@
         {
            if (dw_cell.GetItemString(row, colPOPrice1) == L"") return L"采购价格1没有录入";
         }
         itemStr += L"<BuyerMOQ>" + dw_cell.GetItemString(row, colBuyerMOQ) + L"</BuyerMOQ>";
         itemStr += L"<BuyerRemark>" + dw_cell.GetItemString(row, colBuyerRemark) + L"</BuyerRemark>";
         itemStr += L"<FactoryImage>" + dw_cell.GetItemString(row, colFactoryImage) + L"</FactoryImage>";
         itemStr += L"<GWT>" + dw_cell.GetItemString(row, colGWT) + L"</GWT>";
@@ -1219,6 +1224,7 @@
      int colBuyerPrice = getItemCol(dw_cell, startRow - 1, L"采购价,采购价格");
      int colPurchor = getItemCol(dw_cell, startRow - 1, L"采购员,采购人员");
      int colBuyerMOQ = getItemCol(dw_cell, startRow - 1, L"MOQ");
      int colBuyerRemark = getItemCol(dw_cell, startRow - 1, L"采购To业务备注");
      int colFactoryImage = getItemCol(dw_cell, startRow - 1, L"工厂图片");
      int colGWT = getItemCol(dw_cell, startRow - 1, L"毛重,毛重(KG)");
@@ -1431,6 +1437,7 @@
            if(dw_cell.GetItemString(row, colVolDesc)==L"") return L"体积信息没有录入";
         }
         */
         itemStr += L"<BuyerMOQ>" + dw_cell.GetItemString(row, colBuyerMOQ) + L"</BuyerMOQ>";
         itemStr += L"<BuyerRemark>" + dw_cell.GetItemString(row, colBuyerRemark) + L"</BuyerRemark>";
         itemStr += L"<FactoryImage>" + dw_cell.GetItemString(row, colFactoryImage) + L"</FactoryImage>";
         itemStr += L"<GWT>" + dw_cell.GetItemString(row, colGWT) + L"</GWT>";
@@ -2934,44 +2941,50 @@
         /*计算体积*/
         double v = 0.0;
         xstring desc = dw_cell.GetItemString(row, colVolDesc);
         if (desc.find(L"cm") >= 0)
         if(desc!=L"")
         {
            desc = desc.replace(L"cm", L"");
            dw_cell.SetItemString(row, colVolDesc, desc);
         }
         if (desc.find(L"CM") >= 0)
         {
            desc = desc.replace(L"CM", L"");
            dw_cell.SetItemString(row, colVolDesc, desc);
         }
         if (desc == L"")
            dw_cell.SetItemString(row, colVol, L"");
         else
         {
            v = calcVol(desc) / 1000000.00;
            xstring str = xstring(v);
            if (str.find(L".") >= 0)   str = str.left(str.find(L".") + 5);
            dw_cell.SetItemString(row, colVol, str);
            dw_cell.Redraw();
         }
         xstring qtyperPack = dw_cell.GetItemString(row, colQtyPerPack);
         if (qtyperPack != L"")
         {
            xstring qty1 = qtyperPack;
            xstring qty2 = L"";
            double qty = 0.00;
            int pos2 = qtyperPack.find(L"/");
            if (pos2 >= 0)
            if (desc.find(L"cm") >= 0)
            {
               qty1 = qtyperPack.left(qtyperPack.find(L"/"));
               qty2 = qtyperPack.mid(qtyperPack.find(L"/") + 1, 9999);
               desc = desc.replace(L"cm", L"");
               dw_cell.SetItemString(row, colVolDesc, desc);
            }
            //if(qty1 !=L"") qty = qty1.toDouble();
            //if(qty2 !=L"") qty = qty*qty2.toDouble();
            qty = qty2.toDouble();
            double ttl = 65.0 * qty / v;
            dw_cell.SetItemString(row, col40HQ, xstring((int)ttl));
            if (desc.find(L"CM") >= 0)
            {
               desc = desc.replace(L"CM", L"");
               dw_cell.SetItemString(row, colVolDesc, desc);
            }
            if (desc == L"")
               dw_cell.SetItemString(row, colVol, L"");
            else
            {
               v = calcVol(desc) / 1000000.00;
               xstring str = xstring(v);
               if (str.find(L".") >= 0)   str = str.left(str.find(L".") + 5);
               dw_cell.SetItemString(row, colVol, str);
               dw_cell.Redraw();
            }
            xstring qtyperPack = dw_cell.GetItemString(row, colQtyPerPack);
            if (qtyperPack != L"")
            {
               xstring qty1 = qtyperPack;
               xstring qty2 = L"";
               double qty = 0.00;
               int pos2 = qtyperPack.find(L"/");
               if (pos2 >= 0)
               {
                  qty1 = qtyperPack.left(qtyperPack.find(L"/"));
                  qty2 = qtyperPack.mid(qtyperPack.find(L"/") + 1, 9999);
               }
               //if(qty1 !=L"") qty = qty1.toDouble();
               //if(qty2 !=L"") qty = qty*qty2.toDouble();
               if (qty2 != L"")
               {
                  qty = qty2.toDouble();
                  double ttl = 65.0 * qty / v;
                  dw_cell.SetItemString(row, col40HQ, xstring((int)ttl));
               }
            }
         }
      }
@@ -3148,6 +3161,7 @@
      int colFOBPrice = getItemCol(dw_cell, startRow - 1, L"FOB Price,FOB Price(USD),Fob Price");
      int colQuantity = getItemCol(dw_cell, startRow - 1, L"数量,Qty");
      int colBuyerMOQ = getItemCol(dw_cell, startRow - 1, L"MOQ");
      int colBuyerRemark = getItemCol(dw_cell, startRow - 1, L"采购To业务备注");
      int colFactoryImage = getItemCol(dw_cell, startRow - 1, L"工厂图片");
      int colGWT = getItemCol(dw_cell, startRow - 1, L"毛重,毛重(KG)");
@@ -3446,6 +3460,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 +3573,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 +3607,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;
   }
@@ -4204,6 +4235,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;"
@@ -4458,6 +4491,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;"
@@ -4602,6 +4637,7 @@
      int colBuyerPrice = getItemCol(dw_cell, startRow - 1, L"采购价,采购价格");
      int colBuyer = getItemCol(dw_cell, startRow - 1, L"采购人员");
      int colBuyerMOQ = getItemCol(dw_cell, startRow - 1, L"MOQ");
      int colBuyerRemark = getItemCol(dw_cell, startRow - 1, L"采购To业务备注");
      int colFactoryImage = getItemCol(dw_cell, startRow - 1, L"工厂图片");
      int colGWT = getItemCol(dw_cell, startRow - 1, L"毛重,毛重(KG)");
@@ -4623,6 +4659,7 @@
         KXMLDOMElement ele = items.item(i);
         xstring rowid = ele.selectSingleNode(L"RowID").text();
         xstring BuyerPrice = ele.selectSingleNode(L"BuyerPrice").text();
         xstring BuyerMOQ = L"";
         xstring BuyerRemark = L"";
         xstring FactoryImage = L"";
         xstring GWT = L"";
@@ -4637,6 +4674,7 @@
         xstring  EnquiryLineID = L"";
         xstring  Buyer = L"";
         if (ele.selectSingleNode(L"BuyerMOQ")) BuyerMOQ = ele.selectSingleNode(L"BuyerMOQ").text();
         if (ele.selectSingleNode(L"BuyerRemark")) BuyerRemark = ele.selectSingleNode(L"BuyerRemark").text();
         if (ele.selectSingleNode(L"FactoryImage"))FactoryImage = ele.selectSingleNode(L"FactoryImage").text();
         if (ele.selectSingleNode(L"GWT")) GWT = ele.selectSingleNode(L"GWT").text();
@@ -4645,7 +4683,7 @@
         if (ele.selectSingleNode(L"Vol")) Vol = ele.selectSingleNode(L"Vol").text();
         if (ele.selectSingleNode(L"F40HQ")) F40HQ = ele.selectSingleNode(L"F40HQ").text();
         if (ele.selectSingleNode(L"PurchedDate")) PurchedDate = ele.selectSingleNode(L"PurchedDate").text();
         trace(L"\r\n******" + PurchedDate);
         //trace(L"\r\n******" + PurchedDate);
         if (ele.selectSingleNode(L"supplier-photo")) supplierphoto = ele.selectSingleNode(L"supplier-photo").text();
         if (ele.selectSingleNode(L"ProductInfo")) productInfo = ele.selectSingleNode(L"ProductInfo").text();
         if (ele.selectSingleNode(L"ProductInfo1")) productInfo1 = ele.selectSingleNode(L"ProductInfo1").text();
@@ -4660,6 +4698,7 @@
            if (getRowID(dw_cell, row) == rowid)
            {
               dw_cell.SetItemString(row, colBuyerPrice, BuyerPrice);
               dw_cell.SetItemString(row, colBuyerMOQ, BuyerMOQ);
               dw_cell.SetItemString(row, colBuyerRemark, BuyerRemark);
               dw_cell.SetItemString(row, colFactoryImage, FactoryImage);
               dw_cell.SetItemString(row, colGWT, GWT);
@@ -4724,6 +4763,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 +4809,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 +4830,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");
@@ -4863,7 +4921,7 @@
         dw_cell.SetColumnCount(dw_cell.GetValidCol() + 6);
      }
      else
         dw_cell.SetColumnCount(dw_cell.GetValidCol());
         dw_cell.SetColumnCount(dw_cell.GetValidCol()+3);
      //OnRetrieve();