コード例 #1
0
        private static void ReadP4Break(Excel.IXLWorksheet shSheet)
        {
            int nRow = 1;
            int nCol = 1;

            lstP4Break.Clear();
            //第一行是产物,行号从1开始
            for (nCol = 1; shSheet.Cell(1, nCol).GetString() != String.Empty; nCol++)
            {
                nRow = 1;
                Objects.T2Product item = new Objects.T2Product();
                item.Name   = shSheet.Cell(nRow, nCol).GetString();
                item.Volume = 1;
                nRow++;
                //产出材料
                while (!string.IsNullOrEmpty(shSheet.Cell(nRow, nCol).GetString()))
                {
                    string[] strValue = shSheet.Cell(nRow, nCol).GetString().Split(new string[] { " (" }, StringSplitOptions.RemoveEmptyEntries);
                    double   dCount   = ReadDouble(strValue[1].Substring(0, strValue[1].IndexOf("个")));
                    dCount = Math.Floor(dCount * 0.55);
                    item.Items.Add(strValue[0], (int)dCount);
                    nRow++;
                }
                lstP4Break.Add(item);
            }
        }
コード例 #2
0
        private static void ReadT2Work(Excel.IXLWorksheet shSheet)
        {
            int nRow = 1;
            int nCol = 1;

            lstT2Product.Clear();
            //第一行是产物,行号从1开始
            for (nCol = 1; shSheet.Cell(1, nCol).GetString() != String.Empty; nCol++)
            {
                nRow = 1;
                Objects.T2Product item     = new Objects.T2Product();
                string[]          strValue = shSheet.Cell(nRow, nCol).GetString().Split(new string[] { " x " }, StringSplitOptions.RemoveEmptyEntries);
                item.Name   = strValue[1];
                item.Volume = int.Parse(strValue[0]);
                nRow++;
                //材料需求
                while (!string.IsNullOrEmpty(shSheet.Cell(nRow, nCol).GetString()))
                {
                    strValue = shSheet.Cell(nRow, nCol).GetString().Split(new string[] { " x " }, StringSplitOptions.RemoveEmptyEntries);
                    item.Items.Add(strValue[1], ReadInt(strValue[0]));
                    nRow++;
                }
                lstT2Product.Add(item);
            }
        }
コード例 #3
0
ファイル: frmT2Line.cs プロジェクト: conanhsj/JitaBuyPrice
        private void cmbT2Copy_SelectedValueChanged(object sender, EventArgs e)
        {
            string strT2Rate  = this.txtT2Rate.Text;
            string strComRate = this.txtComRate.Text;

            this.dT2Rate  = Commons.ReadDouble(strT2Rate) / 100;
            this.dComRate = Commons.ReadDouble(strComRate) / 100;

            if (dT2Rate == 0 || dComRate == 0)
            {
                return;
            }

            Objects.T2Product          item      = (Objects.T2Product)cmbT2Copy.SelectedItem;
            Objects.Item               target    = CEVEMarketFile.lstItem.Find(obj => obj.Name == item.Name);
            Dictionary <string, Price> dicResult = CEVEMarketAPI.SearchPriceJson(new List <string>()
            {
                target.TypeID
            });

            this.lblTargetSell.Text = strBaseSellPrice + string.Format("{0:C}", dicResult[target.TypeID].sell.min * item.Volume).Trim('¥');

            if (item != null)
            {
                lvBase.Items.Clear();
                double dPriceSumBase = 0;
                foreach (string strKey in item.Items.Keys)
                {
                    ListViewItem li = new ListViewItem(strKey);
                    li.UseItemStyleForSubItems = false;

                    //材料效率减免
                    int nItem = (int)Math.Ceiling(item.Items[strKey] * (1 - dT2Rate));
                    li.SubItems.Add(string.Format("{0:N}", nItem));
                    lvBase.Items.Add(li);

                    //价格查询
                    target    = CEVEMarketFile.lstItem.Find(obj => obj.Name == strKey);
                    dicResult = CEVEMarketAPI.SearchPriceJson(new List <string>()
                    {
                        target.TypeID
                    });
                    dPriceSumBase += nItem * dicResult[target.TypeID].sell.min;
                }
                this.lblBuyPrice0.Text = strBuyPrice + string.Format("{0:C}", dPriceSumBase).Trim('¥');
                DoCalComponentCost();
            }
        }