public override string ToString()
        {
            var t = Container.NewTitleBuilder();

            t.Append(OrderQty.ToString()).Append(" x", Product);
            return(t.ToString());
        }
Beispiel #2
0
        /// <summary>
        /// Returns the string presentation of the object
        /// </summary>
        /// <returns>String presentation of the object</returns>
        public override string ToString()
        {
            var sb = new System.Text.StringBuilder();

            sb.Append("class OrderResponse {\n");
            sb.Append("  OrderID: ").Append(OrderId.ToString()).Append("\n");
            sb.Append("  ClOrdID: ").Append(ClOrdId.ToString()).Append("\n");
            sb.Append("  ClOrdLinkID: ").Append(ClOrdLinkId.ToString()).Append("\n");
            sb.Append("  Account: ").Append(Account.ToString()).Append("\n");
            sb.Append("  Symbol: ").Append(Symbol.ToString()).Append("\n");
            sb.Append("  Side: ").Append(Side.ToString()).Append("\n");
            sb.Append("  OrderQty: ").Append(OrderQty.ToString()).Append("\n");
            sb.Append("  Price: ").Append(Price.ToString()).Append("\n");
            sb.Append("  DisplayQty: ").Append((DisplayQty == null) ? "null" : DisplayQty.ToString()).Append("\n");
            sb.Append("  StopPx: ").Append((StopPx == null) ? "null" : StopPx.ToString()).Append("\n");
            sb.Append("  PegOffsetValue: ").Append((PegOffsetValue == null) ? "null" : PegOffsetValue.ToString()).Append("\n");
            sb.Append("  PegPriceType: ").Append((PegPriceType == null) ? "null" : PegPriceType.ToString()).Append("\n");
            sb.Append("  Currency: ").Append((Currency == null) ? "null" : Currency.ToString()).Append("\n");
            sb.Append("  SettlCurrency: ").Append((SettlCurrency == null) ? "null" : SettlCurrency.ToString()).Append("\n");
            sb.Append("  OrdType: ").Append((OrdType == null) ? "null" : OrdType.ToString()).Append("\n");
            sb.Append("  TimeInForce: ").Append((TimeInForce == null) ? "null" : TimeInForce.ToString()).Append("\n");
            sb.Append("  ExecInst: ").Append((ExecInst == null) ? "null" : ExecInst.ToString()).Append("\n");
            sb.Append("  ContingencyType: ").Append((ContingencyType == null) ? "null" : ContingencyType.ToString()).Append("\n");
            sb.Append("  ExDestination: ").Append((ExDestination == null) ? "null" : ExDestination.ToString()).Append("\n");
            sb.Append("  OrdStatus: ").Append((OrdStatus == null) ? "null" : OrdStatus.ToString()).Append("\n");
            sb.Append("  Triggered: ").Append((Triggered == null) ? "null" : Triggered.ToString()).Append("\n");
            sb.Append("  WorkingIndicator: ").Append((WorkingIndicator == null) ? "null" : WorkingIndicator.ToString()).Append("\n");
            sb.Append("  OrdRejReason: ").Append((OrdRejReason == null) ? "null" : OrdRejReason.ToString()).Append("\n");
            sb.Append("  LeavesQty: ").Append((LeavesQty == null) ? "null" : LeavesQty.ToString()).Append("\n");
            sb.Append("  CumQty: ").Append((CumQty == null) ? "null" : CumQty.ToString()).Append("\n");
            sb.Append("  AvgPx: ").Append((AvgPx == null) ? "null" : AvgPx.ToString()).Append("\n");
            sb.Append("  MultiLegReportingType: ").Append((MultiLegReportingType == null) ? "null" : MultiLegReportingType.ToString()).Append("\n");
            sb.Append("  Text: ").Append((Text == null) ? "null" : Text.ToString()).Append("\n");
            sb.Append("  TransactTime: ").Append(TransactTime.ToString()).Append("\n");
            sb.Append("  Timestamp: ").Append(Timestamp.ToString()).Append("\n");
            sb.Append("}\n");
            return(sb.ToString());
        }
 /// <summary>
 /// 验证是否可以保存
 /// </summary>
 private bool Verification()
 {
     if (order != null && selectprocess.ProcessID != null && User != null && Qty > 1)
     {
         if ((Qty + Sum) > decimal.Parse(OrderQty.ToString()))
         {
             ZhuifengLib.MessageShow.Message.MessageInfo("录入数量不能大于工单总批量!");
             return(false);
         }
         else if (Qty > selectprocess.OnceQty)
         {
             ZhuifengLib.MessageShow.Message.MessageInfo("录入数量不能大于单次录入限制数" + selectprocess.OnceQty);
             return(false);
         }
         else
         {
             return(true);
         }
     }
     else
     {
         return(false);
     }
 }
        protected void CreateDetail(string strPO)
        {
            string         sqlCmdDMSource, sqlCmdDMTarget, sqlCommandRel;
            SqlDataReader  srcDataReader, tgtDataReader, relDataReader, outerDR;
            SqlConnection  scDMTarget = new SqlConnection(ConfigurationManager.ConnectionStrings["DMTargetConnectionString"].ConnectionString);
            SqlConnection  scDMSource = new SqlConnection(ConfigurationManager.ConnectionStrings["DMSourceConnectionString"].ConnectionString);
            SqlCommand     tgtCommand, relCommand;
            SqlTransaction srcTransaction;
            bool           hasComponents = false;
            bool           Replacement   = false;
            bool           Fallback      = false;
            bool           HasDetail     = false;
            string         strComponent;
            string         GCOrder   = "";
            string         Line      = "";
            string         LastLine  = "";
            string         OrderLine = "";
            string         Description;
            string         Item;
            string         itemLookup;
            string         Warehouse;
            decimal        OrderQty;
            string         CurrentPO;
            string         OriginalPO;
            string         LastPO = "";

            scDMTarget.Open();
            scDMSource.Open();

            OriginalPO = strPO;
            // Create a list of the possible PO/Replacement POs

            // 7/15/2020 changing loop from ONLY distinct purchase orders to all fields.
            // sqlCmdDMTarget = string.Concat("SELECT distinct(PBPONO) from POBCLBP where (PBVEND=", VendorList, ") and ((PBPONO='", strPO, "') or (PBORPO='", strPO, "'))");

            sqlCmdDMTarget = string.Concat("SELECT * from POBCLBP where (PBVEND=", VendorList, ") and ((PBPONO='", strPO, "') or (PBORPO='", strPO, "')) Order By PBORPO, PBORLN, PBPONO, PBLINE");
            SqlCommand command = new SqlCommand(sqlCmdDMTarget, scDMTarget);

            outerDR = command.ExecuteReader();
            if (!outerDR.HasRows)
            {
                // Only occurs if there is no detail for the PO and no replacement POs
                lblMessage.Text = "This PO cannot be located.";
            }
            else
            {
                // Mark having detail as false, will update when we find some
                while (outerDR.Read())
                {
                    Item = "";
                    Line = "";

                    CurrentPO   = outerDR["PBPONO"].ToString();
                    Replacement = (string.Compare(CurrentPO, strPO) != 0) ? true : false;

                    // Read necessary fields from AS400 Detail
                    if (Replacement)
                    {
                        Line = outerDR["PBORLN"].ToString();
                        // Line = srcDataReader["PDOLIN"].ToString();
                    }
                    else
                    {
                        Line = outerDR["PBLINE"].ToString();
                        // Line = srcDataReader["PDLINE"].ToString();
                    }

                    // Move to the next record if we are processing the PO line
                    if ((string.Compare(Line, LastLine) == 0) & (string.Compare(LastPO, CurrentPO) == 0))
                    {
                        continue;
                    }
                    LastLine  = Line;
                    LastPO    = CurrentPO;
                    OrderLine = outerDR["PBLINE"].ToString();
                    Item      = outerDR["PBITEM"].ToString();

                    // Pull this specific line from the order detail file
                    sqlCmdDMTarget = string.Concat("SELECT * from POORDDP where (PDPONO = '", CurrentPO, "') and (PDLINE= '", OrderLine, "') and (PDITEM <> '')");
                    command        = new SqlCommand(sqlCmdDMTarget, scDMTarget);
                    srcDataReader  = command.ExecuteReader();
                    if (srcDataReader.HasRows)
                    {
                        HasDetail = true;

                        // Begin a SQL transaction
                        srcTransaction = scDMSource.BeginTransaction();
                        try
                        {
                            while (srcDataReader.Read())
                            {
                                string DetailItem;
                                Description = "";
                                OrderQty    = 0;

                                Fallback   = false;
                                itemLookup = "";

                                OrderQty    = (decimal)srcDataReader["PDORQY"];
                                Description = srcDataReader["PDDESC"].ToString();
                                Warehouse   = srcDataReader["PDWHSI"].ToString();
                                DetailItem  = srcDataReader["PDITEM"].ToString();

                                // First step is to cross reference the vendor for this Item against ICITMBP
                                string sVen1 = "";
                                sqlCommandRel = string.Concat("Select * from ICITMBP where IBCONO=1 and IBITEM='", DetailItem, "' and IBWHSI='", Warehouse, "'");
                                relCommand    = new SqlCommand(sqlCommandRel, scDMTarget);
                                relDataReader = relCommand.ExecuteReader();
                                if (relDataReader.HasRows)
                                {
                                    relDataReader.Read();
                                    sVen1 = relDataReader["IBVEN1"].ToString();
                                }
                                relDataReader.Close();
                                // If the Vendor for this item isn't the current vendor, move to the next item from the detail
                                if (string.Compare(sVen1, VendorList) != 0)
                                {
                                    continue;
                                }

                                // Specific to Global Contract
                                // Check if this row is a Item or Component
                                // Next check in GCORDHP
                                sqlCommandRel = string.Concat("Select * from GCORDHP where CUSPON in ('", OriginalPO, "', '", string.Concat(strPO, "-RT"), "')");
                                relCommand    = new SqlCommand(sqlCommandRel, scDMTarget);
                                relDataReader = relCommand.ExecuteReader();


                                if (relDataReader.HasRows)
                                {
                                    hasComponents = true;
                                    relDataReader.Read();
                                    GCOrder = relDataReader["OrdNo"].ToString();
                                    relDataReader.Close();

                                    // Get the detail for this particular line
                                    sqlCommandRel = string.Concat("Select * from GCORDDP where ORDNO='", GCOrder, "' and [LineNo]=", Line);
                                    relCommand    = new SqlCommand(sqlCommandRel, scDMTarget);
                                    relDataReader = relCommand.ExecuteReader();
                                    if (relDataReader.HasRows)
                                    {
                                        // Get the product # for lookup
                                        relDataReader.Read();
                                        itemLookup = relDataReader["PRODNO"].ToString();
                                        relDataReader.Close();
                                    }
                                    else
                                    {
                                        relDataReader.Close();
                                        Fallback = true;
                                    }
                                }
                                else
                                {
                                    relDataReader.Close();
                                    Fallback = true;
                                }

                                // Not in GC's files, check the patterns of LP, HP, etc.
                                if (Fallback)
                                {
                                    string ItemList;
                                    itemLookup    = Item.Trim();
                                    ItemList      = string.Concat(" In ('", itemLookup, "', '", string.Concat(itemLookup, "LP"), "', '", string.Concat(itemLookup, "HP"), "', '", string.Concat(itemLookup, "B"), "', '", string.Concat(itemLookup, "E"), "', '", string.Concat(itemLookup, "FV"), "', '", string.Concat(itemLookup, "KL"), "', '", string.Concat(itemLookup, "KV"), "', '", string.Concat(itemLookup, "W"), "')");
                                    sqlCommandRel = string.Concat("Select * from GCBMPRP where GCPROD ", ItemList, " Order by GCPROD");
                                }
                                else
                                {
                                    sqlCommandRel = string.Concat("Select * from GCBMPRP where GCPROD='", itemLookup, "'");
                                }
                                relCommand    = new SqlCommand(sqlCommandRel, scDMTarget);
                                relDataReader = relCommand.ExecuteReader();

                                if (relDataReader.HasRows)
                                {
                                    hasComponents = true;
                                }

                                // Read existing detail rows for updating
                                sqlCmdDMSource         = string.Concat("Select * from SL_Detail where (Vendor=", VendorList, ") and PO='", OriginalPO, "' and Line='", Line, "'");
                                tgtCommand             = new SqlCommand(sqlCmdDMSource, scDMSource);
                                tgtCommand.Transaction = srcTransaction;
                                tgtDataReader          = tgtCommand.ExecuteReader();
                                if (!tgtDataReader.HasRows)
                                {
                                    sqlCmdDMSource         = string.Concat("Insert into SL_Detail (Vendor, PO, Line, LineType, Item, Description, ComponentQty, BOMQty, ShipQty, PackStatus, CalcLabels) Values (", VendorList, ", '", OriginalPO, "','", Line, "','I','", Item.Trim(), "','", Description, "', 1, ", OrderQty.ToString(), ",", OrderQty.ToString(), ", 'S', 0)");
                                    tgtCommand             = new SqlCommand(sqlCmdDMSource, scDMSource);
                                    tgtCommand.Transaction = srcTransaction;
                                    tgtCommand.ExecuteNonQuery();

                                    // Component Row?  Add Components to SL_Detail
                                    if (hasComponents)
                                    {
                                        string LastItem = "", ThisItem = "";
                                        // Loop through components and add detail into SL_Detail
                                        while (relDataReader.Read())
                                        {
                                            ThisItem = (string)relDataReader["GCPROD"];
                                            if ((ThisItem == LastItem) || (LastItem == ""))
                                            {
                                                strComponent = (string)relDataReader["GCCMPN"];
                                                Description  = (string)relDataReader["GCDSC1"];
                                                decimal PartQty = (decimal)relDataReader["GCQUAN"];
                                                decimal PartVol = (decimal)relDataReader["GCVOLM"];
                                                sqlCmdDMSource         = string.Concat("Insert into SL_Detail (Vendor, PO, Line, LineType, Item, Component, Description, ComponentQty, BOMQty, ShipQty, PackStatus, CalcLabels) Values (", VendorList, ", '", OriginalPO, "','", Line, "', 'C', '", Item.Trim(), "','", strComponent, "','", Description, "',", PartQty.ToString(), ", ", (OrderQty * PartQty).ToString(), ", ", (OrderQty * PartQty).ToString(), ", 'S', 0)");
                                                tgtCommand             = new SqlCommand(sqlCmdDMSource, scDMSource);
                                                tgtCommand.Transaction = srcTransaction;
                                                tgtCommand.ExecuteNonQuery();
                                            }
                                            else
                                            {
                                                if (LastItem != "")
                                                {
                                                    break;
                                                }
                                            }
                                            LastItem = (string)relDataReader["GCPROD"];
                                        }
                                    }
                                }
                                tgtDataReader.Close();
                                relDataReader.Close();
                            }   // End While Loop
                            srcDataReader.Close();
                            srcTransaction.Commit();
                        }
                        catch (Exception ex)
                        {
                            srcTransaction.Rollback();
                            lblMessage.Text = "Critical error generating PO detail.";
                        }
                    }
                }   // End Outer Loop
                outerDR.Close();

                // We should be finished processing
                if (!HasDetail)
                {
                    lblMessage.Text += "No detail records exist for this PO.";
                }
            }

            scDMSource.Close();
            scDMTarget.Close();
        }
Beispiel #5
0
        public int printLimitList()
        {
            Symbol   sym = new Symbol();
            Side     sd  = new Side();
            OrderQty oq  = new OrderQty();

            Console.WriteLine("      Index\tOrderID");
            int count = 0;

            foreach (string strOrdID in LimitOrders)
            {
                QuickFix42.Message msg = MSGS[strOrdID];

                msg.getField(sym);
                msg.getField(sd);
                msg.getField(oq);

                Console.WriteLine("\t" + count + "\t" + strOrdID + "\t" + sym.ToString() + " " + sd.ToString() + " " + oq.ToString());
                count++;
            }

            return(count);
        }