Beispiel #1
0
        private void btnNav_Click(object sender, EventArgs e)
        {
            if (cbRoute.SelectedIndex == -1)
            {
                MessageBox.Show("Select Route");
                return;
            }

            var manager  = new TripManager();
            var tripUnit = new TripUnit();

            tripUnit.TripId        = lblTripNo.Text;
            tripUnit.ExpectedStart = lblTripStart.Text;
            tripUnit.ExpectedEnd   = lblTripEnd.Text;
            tripUnit.Incharge      = lblIncharge.Text;
            tripUnit.VehicleId     = lblVehicle.Text;
            tripUnit.RouteId       = cbRoute.SelectedValue.ToString();
            tripUnit.ActualStart   = "";
            tripUnit.ActualEnd     = "";
            tripUnit.Cost          = "";
            tripUnit.LastUpdated   = DateTime.Now.Date.ToShortDateString();
            manager.InsertTrip(tripUnit);

            manager.WMSHeaderInsert(lblTripNo.Text, lblIncharge.Text);
            foreach (DataGridViewRow row in grdOrders.Rows)
            {
                var tripOrderUnit = new TripOrderUnit();
                tripOrderUnit.DropSequence            = row.Cells["colDropSequence"].Value.ToString();
                tripOrderUnit.TripId                  = lblTripNo.Text;
                tripOrderUnit.OrderId                 = row.Cells["colShipId"].Value.ToString();
                tripOrderUnit.Reference               = row.Cells["colRefDoc"].Value.ToString();
                tripOrderUnit.ReferenceDate           = row.Cells["colRefDocDate"].Value.ToString();
                tripOrderUnit.ClientId                = row.Cells["colClient"].Value.ToString();
                tripOrderUnit.CustomerId              = row.Cells["colCustId"].Value.ToString();
                tripOrderUnit.OrderManagementSystem   = row.Cells["colClient"].Value.ToString();
                tripOrderUnit.DocumentValue           = row.Cells["colDocValue"].Value.ToString();
                tripOrderUnit.CustomerDeliveryAddress = "";
                tripOrderUnit.Remarks                 = "";
                tripOrderUnit.Status                  = "FOR RECEIVING";
                manager.InsertTripOrder(tripOrderUnit);

                manager.UpdateOutgoingShipmentRequest("out_shipment_id", tripOrderUnit.OrderId);
                manager.WMSDetailsInsert(tripOrderUnit.TripId, tripOrderUnit.OrderId, tripOrderUnit.DropSequence, lblTripStart.Text);
            }
            manager.RunScript();

            MessageBox.Show("SAVED");

            DialogResult = DialogResult.OK;
        }
Beispiel #2
0
        public void InsertTripOrder(TripOrderUnit unit)
        {
            var param = new Dictionary <string, object>
            {
                { "trip", unit.TripId },
                { "order_id", unit.OrderId },
                { "client", unit.ClientId },
                { "customer", unit.CustomerId },
                { "customer_delivery_address", unit.CustomerDeliveryAddress },
                { "status", unit.Status },
                { "remarks", unit.Remarks },
                { "reference", unit.Reference },
                { "reference_date", unit.ReferenceDate },
                { "oms", unit.OrderManagementSystem },
                { "doc_value", unit.DocumentValue },
                { "drop_sequence", unit.DropSequence },
            };

            TMSSqlScript.AppendLine(DataSupport.GetUpsert("TripOrders", param, "trip", "order_id"));
        }