/// <summary> /// Creates a new instance of the sol_Shipment class and populates it with data from the specified SqlDataReader. /// </summary> protected virtual Sol_Shipment MakeSol_Shipment(SqlDataReader dataReader) { Sol_Shipment sol_Shipment = new Sol_Shipment(); sol_Shipment.ShipmentID = SqlClientUtility.GetInt32(dataReader, "ShipmentID", 0); sol_Shipment.UserID = SqlClientUtility.GetGuid(dataReader, "UserID", Guid.Empty); sol_Shipment.UserName = SqlClientUtility.GetString(dataReader, "UserName", String.Empty); sol_Shipment.RBillNumber = SqlClientUtility.GetString(dataReader, "RBillNumber", String.Empty); sol_Shipment.Date = SqlClientUtility.GetDateTime(dataReader, "Date", new DateTime(0)); sol_Shipment.AgencyID = SqlClientUtility.GetInt32(dataReader, "AgencyID", 0); sol_Shipment.AgencyName = SqlClientUtility.GetString(dataReader, "AgencyName", String.Empty); sol_Shipment.AgencyAddress1 = SqlClientUtility.GetString(dataReader, "AgencyAddress1", String.Empty); sol_Shipment.AgencyAddress2 = SqlClientUtility.GetString(dataReader, "AgencyAddress2", String.Empty); sol_Shipment.AgencyCity = SqlClientUtility.GetString(dataReader, "AgencyCity", String.Empty); sol_Shipment.AgencyProvince = SqlClientUtility.GetString(dataReader, "AgencyProvince", String.Empty); sol_Shipment.AgencyCountry = SqlClientUtility.GetString(dataReader, "AgencyCountry", String.Empty); sol_Shipment.AgencyPostalCode = SqlClientUtility.GetString(dataReader, "AgencyPostalCode", String.Empty); sol_Shipment.Status = SqlClientUtility.GetString(dataReader, "Status", String.Empty); sol_Shipment.CarrierID = SqlClientUtility.GetInt32(dataReader, "CarrierID", 0); sol_Shipment.PlantID = SqlClientUtility.GetInt32(dataReader, "PlantID", 0); sol_Shipment.TrailerNumber = SqlClientUtility.GetString(dataReader, "TrailerNumber", String.Empty); sol_Shipment.ProBillNumber = SqlClientUtility.GetString(dataReader, "ProBillNumber", String.Empty); sol_Shipment.ShippedDate = SqlClientUtility.GetDateTime(dataReader, "ShippedDate", new DateTime(0)); sol_Shipment.SealNumber = SqlClientUtility.GetString(dataReader, "SealNumber", String.Empty); sol_Shipment.LoadReference = SqlClientUtility.GetString(dataReader, "LoadReference", String.Empty); sol_Shipment.ERBillTransmitted = SqlClientUtility.GetBoolean(dataReader, "eRBillTransmitted", false); return(sol_Shipment); }
/// <summary> /// Updates a record in the sol_Shipment table. /// </summary> public virtual void Update(Sol_Shipment sol_Shipment) { ValidationUtility.ValidateArgument("sol_Shipment", sol_Shipment); SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@ShipmentID", sol_Shipment.ShipmentID), new SqlParameter("@UserID", sol_Shipment.UserID), new SqlParameter("@UserName", sol_Shipment.UserName), new SqlParameter("@RBillNumber", sol_Shipment.RBillNumber), new SqlParameter("@Date", sol_Shipment.Date), new SqlParameter("@AgencyID", sol_Shipment.AgencyID), new SqlParameter("@AgencyName", sol_Shipment.AgencyName), new SqlParameter("@AgencyAddress1", sol_Shipment.AgencyAddress1), new SqlParameter("@AgencyAddress2", sol_Shipment.AgencyAddress2), new SqlParameter("@AgencyCity", sol_Shipment.AgencyCity), new SqlParameter("@AgencyProvince", sol_Shipment.AgencyProvince), new SqlParameter("@AgencyCountry", sol_Shipment.AgencyCountry), new SqlParameter("@AgencyPostalCode", sol_Shipment.AgencyPostalCode), new SqlParameter("@Status", sol_Shipment.Status), new SqlParameter("@CarrierID", sol_Shipment.CarrierID), new SqlParameter("@PlantID", sol_Shipment.PlantID), new SqlParameter("@TrailerNumber", sol_Shipment.TrailerNumber), new SqlParameter("@ProBillNumber", sol_Shipment.ProBillNumber), new SqlParameter("@ShippedDate", sol_Shipment.ShippedDate), new SqlParameter("@SealNumber", sol_Shipment.SealNumber), new SqlParameter("@LoadReference", sol_Shipment.LoadReference), new SqlParameter("@eRBillTransmitted", sol_Shipment.ERBillTransmitted) }; SqlClientUtility.ExecuteNonQuery(connectionStringName, CommandType.StoredProcedure, "sol_Shipment_Update", parameters); }
private void ReadContainersOnShipment(ref ListView lv1, string rBillNumber, StageTypes stageType) { lv1.Items.Clear(); sol_Shipment = sol_Shipment_Sp.SelectByRBillNumber(rBillNumber); if (sol_Shipment == null || sol_Shipment.Status == "V" ) { return; } sol_StageList = sol_Stage_Sp._SelectAllByShipmentID(sol_Shipment.ShipmentID); //I-InProgress; P-Picked S-Shipped if (sol_StageList == null) { return; } foreach (Sol_Stage st in sol_StageList) { if (st.Status != "V") { addItemStagedContainers(ref lv1, st.TagNumber, st.ProductName, st.Dozen, st.ContainerDescription, st.StageID, st.Quantity); } } labelContainersOnShipMentCount.Text = String.Format("Count:" + Funciones.Indent(2) + "{0,10:##,###,##0}", listViewContainersOnShipment.Items.Count); }
private void buttoneRBill_Click(object sender, EventArgs e) { dataGridViewCurrentShipment.Focus(); if (!Main.CheckUserPermission(Properties.Settings.Default.WsirConnectionString, Properties.Settings.Default.UsuarioNombre, "SolViewShipment", true)) { return; } if (dataGridViewCurrentShipment.SelectedRows.Count < 1) { MessageBox.Show("Please select a Shipment to tramsmit", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } RBillNumber = dataGridViewCurrentShipment.SelectedRows[0].Cells[0].Value.ToString(); string status = dataGridViewCurrentShipment.SelectedRows[0].Cells[3].Value.ToString(); if (status.ToLower() != "s") { MessageBox.Show("Only Shipments marked as Shipped please", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (sol_Shipment_Sp == null) { sol_Shipment_Sp = new Sol_Shipment_Sp(Properties.Settings.Default.WsirDbConnectionString); } sol_Shipment = sol_Shipment_Sp.SelectByRBillNumber(RBillNumber); if (sol_Shipment == null) { MessageBox.Show(String.Format("Invalid RBill Number: {0}, please verify it!", RBillNumber), "", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (sol_Shipment.ERBillTransmitted) { //MessageBox.Show("Shipment already transmitted!"); //return; DialogResult result = MessageBox.Show("This R-Bill has already been submitted. Are you sure you want to send it again?", "", MessageBoxButtons.YesNoCancel); //.YesNo); if (result != System.Windows.Forms.DialogResult.Yes) { return; } } if (sol_Agencie_Sp == null) { sol_Agencie_Sp = new Sol_Agencie_Sp(Properties.Settings.Default.WsirDbConnectionString); } sol_Agencie = sol_Agencie_Sp.Select(sol_Shipment.AgencyID); if (sol_Agencie.Name.ToLower().Trim() != "abcrc") { MessageBox.Show("Shipment's agency is not ABCRC!"); return; } ShippingShipments.eRBill(sol_Shipment, sol_Shipment_Sp); }
private void buttonVoidShipment_Click(object sender, EventArgs e) { if (!Main.CheckUserPermission(Properties.Settings.Default.WsirConnectionString, Properties.Settings.Default.UsuarioNombre, "SolModifyContainer", true)) { return; } ListView.SelectedListViewItemCollection selectedItems = listViewCurrentShipment.SelectedItems; if (selectedItems.Count < 1) { MessageBox.Show("Please select a Shipment"); return; } bool firstTime = true; //int stageId = 0; string shipNumber = ""; //selected items foreach (ListViewItem item in selectedItems) { try { //stageId = Int32.Parse(item.SubItems[0].Text); shipNumber = item.SubItems[0].Text; } catch { continue; } if (firstTime) { firstTime = false; if (MessageBox.Show("Are you sure you want to delete shipment:" + item.SubItems[0].Text + "?", "Delete Shipment", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) != System.Windows.Forms.DialogResult.Yes) { return; } } sol_Shipment = sol_Shipment_Sp.SelectByRBillNumber(shipNumber); sol_StageList = sol_Stage_Sp._SelectAllByShipmentID(sol_Shipment.ShipmentID); //I-InProgress; P-Picked S-Shipped if (sol_StageList.Count > 0) { MessageBox.Show("Shipment is not empty, cannot void it!"); return; } //delete it sol_Shipment_Sp.Delete(sol_Shipment.ShipmentID); } //refresh list or remove item above??? ReadCurrentShipments(); }
/// <summary> /// Selects all records from the sol_Shipment table. /// </summary> public virtual List <Sol_Shipment> SelectAll() { using (SqlDataReader dataReader = SqlClientUtility.ExecuteReader(connectionStringName, CommandType.StoredProcedure, "sol_Shipment_SelectAll")) { List <Sol_Shipment> sol_ShipmentList = new List <Sol_Shipment>(); while (dataReader.Read()) { Sol_Shipment sol_Shipment = MakeSol_Shipment(dataReader); sol_ShipmentList.Add(sol_Shipment); } return(sol_ShipmentList); } }
private bool CreateShipmentEntry() { /*If it is the first item added to this adjustment, * it should create an entry in the sol_Shipment table with status A for Adjustment * and the same RBill Number with an A added to the end. */ //sol_Shipment = sol_Shipment_Sp.SelectByRBillNumber(RemoveShipmentPostFix(textBoxRBill.Text)); // + "A"); sol_ShipmentAdjustment = sol_Shipment_Sp.SelectByRBillNumber(textBoxRBill.Text); // + "A"); if (sol_ShipmentAdjustment == null) { DateTime dt = sol_Shipment.Date; if (checkBoxDate.Checked) { dt = Main.rc.FechaActual; } sol_ShipmentAdjustment = new Sol_Shipment(); sol_ShipmentAdjustment.UserID = sol_Shipment.UserID; sol_ShipmentAdjustment.UserName = sol_Shipment.UserName; sol_ShipmentAdjustment.Date = dt; // Main.rc.FechaActual; // ; // Properties.Settings.Default.FechaActual; sol_ShipmentAdjustment.RBillNumber = sol_Shipment.RBillNumber + "A"; sol_ShipmentAdjustment.AgencyID = sol_Shipment.AgencyID; sol_ShipmentAdjustment.AgencyName = sol_Shipment.AgencyName; sol_ShipmentAdjustment.AgencyAddress1 = sol_Shipment.AgencyAddress1; sol_ShipmentAdjustment.AgencyAddress2 = sol_Shipment.AgencyAddress2; sol_ShipmentAdjustment.AgencyCity = sol_Shipment.AgencyCity; sol_ShipmentAdjustment.AgencyProvince = sol_Shipment.AgencyProvince; sol_ShipmentAdjustment.AgencyCountry = sol_Shipment.AgencyCountry; sol_ShipmentAdjustment.AgencyPostalCode = sol_Shipment.AgencyPostalCode; sol_ShipmentAdjustment.Status = "A"; //InProcess sol_ShipmentAdjustment.TrailerNumber = sol_Shipment.TrailerNumber; sol_ShipmentAdjustment.ProBillNumber = sol_Shipment.ProBillNumber; sol_ShipmentAdjustment.ShippedDate = sol_Shipment.ShippedDate; sol_Shipment_Sp.Insert(sol_ShipmentAdjustment); } return(true); }
// comment out the original routine /// <summary> /// Selects all records from the sol_Shipment table. /// </summary> public virtual List <Sol_Shipment> SelectAll(bool newestOnTop) { SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@NewestOnTop", newestOnTop) }; using (SqlDataReader dataReader = SqlClientUtility.ExecuteReader(connectionStringName, CommandType.StoredProcedure, "sol_Shipment_SelectAll", parameters)) { List <Sol_Shipment> sol_ShipmentList = new List <Sol_Shipment>(); while (dataReader.Read()) { Sol_Shipment sol_Shipment = MakeSol_Shipment(dataReader); sol_ShipmentList.Add(sol_Shipment); } return(sol_ShipmentList); } }
/// <summary> /// Updates a record in the sol_Shipment table. /// </summary> public virtual void UpdateERBill(Sol_Shipment sol_Shipment) { ValidationUtility.ValidateArgument("sol_Shipment", sol_Shipment); SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@ShipmentID", sol_Shipment.ShipmentID), new SqlParameter("@CarrierID", sol_Shipment.CarrierID), new SqlParameter("@PlantID", sol_Shipment.PlantID), new SqlParameter("@TrailerNumber", sol_Shipment.TrailerNumber), new SqlParameter("@ProBillNumber", sol_Shipment.ProBillNumber), new SqlParameter("@ShippedDate", sol_Shipment.ShippedDate), new SqlParameter("@SealNumber", sol_Shipment.SealNumber), new SqlParameter("@LoadReference", sol_Shipment.LoadReference), new SqlParameter("@eRBillTransmitted", sol_Shipment.ERBillTransmitted) }; SqlClientUtility.ExecuteNonQuery(connectionStringName, CommandType.StoredProcedure, "sol_Shipment_UpdateERBill", parameters); }
private bool DeleteAdjustment(int stageId) { sol_ShipmentAdjustment = sol_Shipment_Sp.SelectByRBillNumber(textBoxRBill.Text); sol_StageAdjustment = sol_Stage_Sp.Select(stageId); if (sol_StageAdjustment != null) { //check if it was a staging container addition (option 2) bool flagDelete = false; int l = sol_StageAdjustment.TagNumber.Count() - 1; if (l > 0) { if (sol_StageAdjustment.TagNumber.Substring(l, 1) == "A") { flagDelete = true; } } if (flagDelete) { //sol_StageAdjustment.Status = "V"; //sol_Stage_Sp.Update(sol_StageAdjustment); sol_Stage_Sp._DeleteAllByShipmentIdTagNumber(sol_ShipmentAdjustment.ShipmentID, sol_StageAdjustment.TagNumber); } else { sol_StageAdjustment.ShipmentID = 0; sol_StageAdjustment.Status = "I"; //from "S" to "I" sol_Stage_Sp.Update(sol_StageAdjustment); sol_Stage_SelectAllByAgencyTableAdapter.Fill( this.dataSetStageLookup.sol_Stage_SelectAllByAgency, "I", sol_Shipment.AgencyID); } } else { return(false); } return(true); }
/// <summary> /// Selects all records from the sol_Shipment table. /// </summary> public virtual List <Sol_Shipment> SelectAllBetweenDatesByStatus(string dateFrom, string dateTo, string status, bool newestOnTop) { SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@DateFrom", dateFrom), new SqlParameter("@DateTo", dateTo), new SqlParameter("@Status", status), new SqlParameter("@NewestOnTop", newestOnTop) }; using (SqlDataReader dataReader = SqlClientUtility.ExecuteReader(connectionStringName, CommandType.StoredProcedure, "sol_Shipment_SelectAllBetweenDatesByStatus", parameters)) { List <Sol_Shipment> sol_ShipmentList = new List <Sol_Shipment>(); while (dataReader.Read()) { Sol_Shipment sol_Shipment = MakeSol_Shipment(dataReader); sol_ShipmentList.Add(sol_Shipment); } return(sol_ShipmentList); } }
private void buttonView_Click(object sender, EventArgs e) { //buttonCreate.PerformClick(); if (dataGridViewCurrentShipment.SelectedRows.Count < 1) { MessageBox.Show("Please select a Shipment to view", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } RBillNumber = dataGridViewCurrentShipment.SelectedRows[0].Cells[0].Value.ToString(); ChangeView(AdjustmentViewTypes.Details); textBoxRBill.Text = RBillNumber; // RemoveShipmentPostFix(RBillNumber); sol_Shipment = sol_Shipment_Sp.SelectByRBillNumber(RemoveShipmentPostFix(RBillNumber)); sol_Stage_SelectAllByAgencyTableAdapter.Fill( this.dataSetStageLookup.sol_Stage_SelectAllByAgency, "I", sol_Shipment.AgencyID); buttonOriginalRbill.PerformClick(); buttonOriginalRbill.Select(); }
private void ShippingAdjustments_Load(object sender, EventArgs e) { //classes of tables sol_Shipment = new Sol_Shipment(); sol_Shipment_Sp = new Sol_Shipment_Sp(Properties.Settings.Default.WsirDbConnectionString); sol_ShipmentList = new List <Sol_Shipment>(); sol_Stage = new Sol_Stage(); sol_Stage_Sp = new Sol_Stage_Sp(Properties.Settings.Default.WsirDbConnectionString); sol_StageList = new List <Sol_Stage>(); if (Properties.Settings.Default.TouchOriented) { toolStripButtonVirtualKb.Visible = true; } toolStrip1.Renderer = new App_Code.NewToolStripRenderer(); //clock object obj1 = toolStripStatusLabelToday; object obj2 = toolStripStatusLabelTimer; Main.rc.CambiarControlFecha(ref obj1); Main.rc.CambiarControlHora(ref obj2); //disable form resizing // this.FormBorderStyle = FormBorderStyle.FixedSingle; //listview with headers listViewContainersOnShipment.View = View.Details; //listViewContainersOnShipment.Columns.Add("Tag #", 200, HorizontalAlignment.Left); //listViewContainersOnShipment.Columns.Add("Product", 190, HorizontalAlignment.Left); //listViewContainersOnShipment.Columns.Add("Dozen", 80, HorizontalAlignment.Left); //listViewContainersOnShipment.Columns.Add("Container", 170, HorizontalAlignment.Left); //listViewContainersOnShipment.Columns.Add("StageID", 170, HorizontalAlignment.Left); listViewContainersOnShipment.Columns.Add("Tag #", 200, HorizontalAlignment.Left); listViewContainersOnShipment.Columns.Add("Product", 190, HorizontalAlignment.Left); listViewContainersOnShipment.Columns.Add("Quantity", 80, HorizontalAlignment.Right); listViewContainersOnShipment.Columns.Add("Container", 170, HorizontalAlignment.Left); listViewContainersOnShipment.Columns.Add("StageID", 170, HorizontalAlignment.Left); listViewContainersOnShipment.Columns.Add("Dozen", 80, HorizontalAlignment.Right); //listViewContainersOnShipment.Columns["StageID"] listViewContainersOnShipment.FullRowSelect = true; listViewContainersOnShipment.CheckBoxes = true; listViewContainersOnShipment.GridLines = true; //listViewContainersOnShipment.Activation = ItemActivation.OneClick; listViewContainersOnShipment.MultiSelect = true; sol_Shipment_SelectAllByStatusTableAdapter.Fill(this.dataSetShipmentByStatusLookup.sol_Shipment_SelectAllByStatus, "S", true); //sol_Orders_SelectAllLookupTableAdapter.Fill(this.dataSetOrdersLookup.sol_Orders_SelectAllLookup, userName, strOrderType, "A", ""); //r = returns, = normal unpaid this.sol_ProductsTableAdapter.Fill(this.dataSetProductsLookup.sol_Products, 0); //0 = return products ChangeView(AdjustmentViewTypes.Overview); //read shipments ready to be shippped ReadCurrentShipments(); if (ShippingLookup.ShipmentButtonAdjustment) { comboBoxRbill.SelectedIndex = comboBoxRbill.FindStringExact(ShippingLookup.RBillNumber); buttonCreate.PerformClick(); ////textBoxRBillNumber.Text = ShippingHome.RBillNumber; ////ShippingHome.RBillNumber = ""; ////ShippingHome.ShipmentButtonView = false; ////buttonSearch.Enabled = true; ////buttonSearch.PerformClick(); ////if (dataGridViewCurrentShipment.SelectedRows.Count < 1) ////{ //// MessageBox.Show("Please select a Shipment to view", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); //// return; ////} //RBillNumber = ShippingLookup.RBillNumber; // dataGridViewCurrentShipment.SelectedRows[0].Cells[0].Value.ToString(); //ChangeView(AdjustmentViewTypes.Details); //textBoxRBill.Text = RBillNumber; // RemoveShipmentPostFix(RBillNumber); //sol_Shipment = sol_Shipment_Sp.SelectByRBillNumber(RemoveShipmentPostFix(RBillNumber)); //sol_Stage_SelectAllByAgencyTableAdapter.Fill( // this.dataSetStageLookup.sol_Stage_SelectAllByAgency, // "I", sol_Shipment.AgencyID); //buttonOriginalRbill.PerformClick(); //buttonOriginalRbill.Select(); } //training warning if (Properties.Settings.Default.SQLBaseDeDatos == "Solum_Training") { toolStripStatusLabelTrainingMode.Visible = true; Main.tslCntr = toolStripStatusLabelTrainingMode; Main.timerBlink.Enabled = true; } //initialFlag = false; CheckUserPermissions(); if (Properties.Settings.Default.StagingType == 0) //!Properties.Settings.Default.MultiProductStagingEnabled) { toolStripSeparatorMultiProductStaging.Visible = false; toolStripButtonMultiProductStaging.Visible = false; } }
//SOAP v1.2, and binding is wsHttpBindin private bool Test_validate(Sol_Shipment sol_Shipment, Sol_Shipment_Sp sol_Shipment_Sp) { if (String.IsNullOrEmpty(Main.Sol_ControlInfo.ABCRCUserName)) { MessageBox.Show("Please go to Settings -> ABCRC and add User Name and Password", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } if (checkBoxViewERBill.Checked) { f1 = new eRBill_CheckList_ListView(); } //https://abcrcerbill.com/WcfAbcrcService/ //former: https://abcrcerbill.com/WsHttpsAbcrcService.svc WsHttpsAbcrcServiceClient client = new WsHttpsAbcrcServiceClient(); //"configName", "https://abcrcerbill.com/WsHttpsAbcrcService.svc"); client.ClientCredentials.UserName.UserName = Main.Sol_ControlInfo.ABCRCUserName; client.ClientCredentials.UserName.Password = Main.Sol_ControlInfo.ABCRCPassword; int intNumber = 0; string strValue = String.Empty; string vendorId = String.Empty; string tagNumber = String.Empty; string productCode = String.Empty; int iProductCode = 0; string quantity = String.Empty; try { AbcrcERBill eRBill = new AbcrcERBill(); strValue = sol_Shipment.RBillNumber; vendorId = string.Format("{0:d4}", Main.Sol_ControlInfo.VendorID); //parse it if (sol_Shipment.RBillNumber.Length < 7) { Int32.TryParse(sol_Shipment.RBillNumber, out intNumber); strValue = vendorId + string.Format("{0:d6}", intNumber); } eRBill.RBillNumber = strValue; ////temporaly change for testing //vendorId = "0000"; eRBill.CarrierCrisID = sol_Shipment.CarrierID; eRBill.PlantCrisID = sol_Shipment.PlantID; eRBill.TrailerNumber = sol_Shipment.TrailerNumber; eRBill.ProBillNumber = sol_Shipment.ProBillNumber; eRBill.ShippedDate = sol_Shipment.ShippedDate; eRBill.SealNumber = sol_Shipment.SealNumber; eRBill.LoadReference = sol_Shipment.LoadReference; //add used and empty bags AbcrcERBillBag bag; int nBags = 0, nMaxBags = 0; AbcrcOtherShippingContainer aosc; int nAosc = 0, nMaxAosc = 0; //open product table Sol_Product_Sp sol_Product_Sp = new Sol_Product_Sp(Properties.Settings.Default.WsirDbConnectionString); Sol_Product sol_Product; //open Container table Sol_Container_Sp sol_Container_Sp = new Sol_Container_Sp(Properties.Settings.Default.WsirDbConnectionString); Sol_Container sol_Container; //read containers in shipment and get number of bags Sol_Stage_Sp sol_Stage_Sp = new Sol_Stage_Sp(Properties.Settings.Default.WsirDbConnectionString); List <Sol_Stage> sol_StageList = sol_Stage_Sp._SelectAllByShipmentID(sol_Shipment.ShipmentID); if (sol_StageList.Count < 1) { MessageBox.Show("", "No containers found in shipment, cannot continue!", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } nMaxBags = sol_StageList.Count; //read eRBill empty containers and get number of bags Sol_SupplyInventory_Sp sol_SupplyInventory_Sp = new Sol_SupplyInventory_Sp(Properties.Settings.Default.WsirDbConnectionString); List <Sol_SupplyInventory> sol_SupplyInventoryList = sol_SupplyInventory_Sp._SelectAllByShipmentID(sol_Shipment.ShipmentID); foreach (Sol_SupplyInventory ssi in sol_SupplyInventoryList) { if (ssi.ProductID < 1) { //Empty Bags - EmptyContainer nMaxAosc++; } } //set max bags if (nMaxBags > 0) { eRBill.Bags = new AbcrcERBillBag[nMaxBags]; } if (nMaxAosc > 0) { eRBill.AdditionalShippingContainers = new AbcrcOtherShippingContainer[nMaxAosc]; } //process shipment containers foreach (Sol_Stage ssi in sol_StageList) { //get ShippingContainerID for ItemTypeCrisID sol_Container = sol_Container_Sp.Select(ssi.ContainerID); //begin loop //get productCode for ShippingContainerTypeCrisID sol_Product = sol_Product_Sp.Select(ssi.ProductID); Int32.TryParse(sol_Product.ProductCode, out iProductCode); productCode = string.Format("{0:d4}", iProductCode); bag = new AbcrcERBillBag(); quantity = string.Format("{0:d5}", ssi.Quantity); if (ssi.TagNumber.Length < 8) { Int32.TryParse(ssi.TagNumber, out intNumber); tagNumber = string.Format("{0:d7}", intNumber); strValue = vendorId + productCode + quantity + tagNumber; } else if (ssi.TagNumber.Length == 20) { strValue = ssi.TagNumber; } else { string m = String.Format("Tag Number {0} has the wrong number of digits. eR-Bill can't be processed. Please correct the Tag Number and submit the eR-Bill again.", ssi.TagNumber); MessageBox.Show("", m, MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } bag.BagTag = strValue; //sol_Stage.TagNumber bag.ItemTypeCrisID = iProductCode; bag.ShippingContainerTypeCrisID = sol_Container.ShippingContainerTypeID; bag.UnitsShipped = ssi.Quantity; //ssi.Dozen * 12; //KEV - this was fixed in 5.0.4. Dozens are not used. if (checkBoxViewERBill.Checked) { addItem(bag.BagTag, bag.ItemTypeCrisID, bag.ShippingContainerTypeCrisID, bag.UnitsShipped, ref eRBill_CheckList_ListView.listView1); } eRBill.Bags[nBags++] = bag; //end loop } //process empty containers foreach (Sol_SupplyInventory ssi in sol_SupplyInventoryList) { //bag tag ? //Item Type ID //Shipping Container Type ID //Units Shipped //get ShippingContainerID for ItemTypeCrisID sol_Container = sol_Container_Sp.Select(ssi.ContainerID); //} if (ssi.ProductID < 1) { //Empty Bags - EmptyContainer //empty bags aosc = new AbcrcOtherShippingContainer(); //eRBill.AdditionalShippingContainers = new AbcrcOtherShippingContainer[1]; aosc.ShippingContainerTypeCrisID = sol_Container.ShippingContainerTypeID; aosc.ContainersShipped = ssi.Quantity; if (checkBoxViewERBill.Checked) { addItem("", 0, aosc.ShippingContainerTypeCrisID, aosc.ContainersShipped, ref eRBill_CheckList_ListView.listView2); } eRBill.AdditionalShippingContainers[nAosc++] = aosc; } } AbcrcValidationResponse response = client.ValidateErBill(eRBill); string c = String.Empty; foreach (AbcrcValidationMessage m in response.ValidationMessages) { c = c + "\r\n" + m.ValidationMessage; } c = c + "\r\n" + response.ErrorMessage; if (response.Error == false && response.IsValid == true) { //MessageBox.Show("Validation passed successful!"); c = String.Empty; //submit AbcrcSubmitResponse submitResponse = client.SubmitErBill(eRBill); foreach (AbcrcValidationMessage m in submitResponse.ValidationMessages) { c = c + "\r\n" + m.ValidationMessage; } c = c + "\r\n" + submitResponse.ErrorMessage; if (!(submitResponse.Error == false && submitResponse.IsValid == true)) { //CajaDeMensaje.Show("", "Validation not passed successful, debug it!", c, CajaDeMensajeImagen.Error); MessageBox.Show(c, "Even thought the erBill validation was succesfull, it was not received by the agency!", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } } else { //CajaDeMensaje.Show("", "Validation not passed successful, debug it!", c, CajaDeMensajeImagen.Error); MessageBox.Show(c, "Validation not passed successful, debug it!", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } } catch (Exception exception) { //MessageBox.Show(exception.Message); //CajaDeMensaje.Show("", exception.Message, exception.InnerException.Message, CajaDeMensajeImagen.Error); string m1 = String.Empty; try { m1 = exception.InnerException.Message; } catch { m1 = "Error when trying to create and validate eRBill's object. "; } //string m2 = exception.Message; MessageBox.Show(exception.Message, m1, MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } return(true); }
private void Inventory_Load(object sender, EventArgs e) { if (Properties.Settings.Default.TouchOriented) { toolStripButtonVirtualKb.Visible = true; } //FullScreenMode if (Properties.Settings.Default.SettingsAdFullScreenMode) { this.WindowState = FormWindowState.Maximized; } else { this.WindowState = FormWindowState.Normal; } //años //ejemplo: int aa = Main.rc.FechaActual.Year; // System.DateTime.Now.Year; // 2010 año actual computadora byte ah = Main.Sol_ControlInfo.HistoryYears; // -5 años de historia //----- int uah = aa - ah; // 2005 ultimo año de historia string c = Main.rc.FechaActual.ToString(); // DateTime.Now.ToString(); flagInicio = true; dateTimePickerTo.MaxDate = Main.rc.FechaActual; dateTimePickerTo.Value = dateTimePickerTo.MaxDate; flagInicio = false; dateFrom = null; dateTo = null; UpdateDataSets(); //classes of tables sol_Shipment = new Sol_Shipment(); sol_Shipment_Sp = new Sol_Shipment_Sp(Properties.Settings.Default.WsirDbConnectionString); sol_ShipmentList = new List <Sol_Shipment>(); sol_Stage = new Sol_Stage(); sol_Stage_Sp = new Sol_Stage_Sp(Properties.Settings.Default.WsirDbConnectionString); sol_StageList = new List <Sol_Stage>(); //disable form resizing this.FormBorderStyle = FormBorderStyle.FixedSingle; //listview with headers listViewUnstagedProducts.View = View.Details; listViewUnstagedProducts.Columns.Add("Category", 160, HorizontalAlignment.Left); listViewUnstagedProducts.Columns.Add("Quantity", 100, HorizontalAlignment.Right); listViewUnstagedProducts.Columns.Add("Dozen", 90, HorizontalAlignment.Right); listViewUnstagedProducts.Columns.Add("Amount", 120, HorizontalAlignment.Right); listViewUnstagedProducts.FullRowSelect = true; //listViewCurrentStagedContainers.CheckBoxes = true; listViewUnstagedProducts.GridLines = true; //listView1.Activation = ItemActivation.OneClick; //listViewUnstagedProducts.FullRowSelect = true; //listViewUnstagedProducts.GridLines = true; listViewUnstagedProducts.LabelEdit = false; // true; listViewUnstagedProducts.columnEditable = 1; //-1 = all //listview with headers listViewStagedProducts.View = View.Details; listViewStagedProducts.Columns.Add("Product Category", 175, HorizontalAlignment.Left); listViewStagedProducts.Columns.Add("Quantity", 100, HorizontalAlignment.Right); listViewStagedProducts.Columns.Add("Dozen", 90, HorizontalAlignment.Right); listViewStagedProducts.Columns.Add("Amount", 120, HorizontalAlignment.Right); listViewStagedProducts.GridLines = true; //array to store categoryid this.arrayListViewCategoryId = new ArrayList(); this.arrayListViewQuantity = new ArrayList(); this.arrayListViewRefundAmount = new ArrayList(); ReadProducts(dataSetProductsUnstaged.Tables[0], listViewUnstagedProducts, labelUnstagedTotalQuantity, labelUnstagedTotalAmount, false, "Unstaged"); ReadProducts(dataSetProductsStaged.Tables[0], listViewStagedProducts, labelStagedTotalQuantity, labelStagedTotalAmount, false, "Staged"); //training warning if (Properties.Settings.Default.SQLBaseDeDatos == "Solum_Training") { toolStripStatusLabelTrainingMode.Visible = true; Main.tslCntr = toolStripStatusLabelTrainingMode; Main.timerBlink.Enabled = true; } }
private void buttonUnNow_Click(object sender, EventArgs e) { dataGridViewCurrentShipment.Focus(); if (!Main.CheckUserPermission(Properties.Settings.Default.WsirConnectionString, Properties.Settings.Default.UsuarioNombre, "SolUnshipShipment", true)) { return; } if (dataGridViewCurrentShipment.SelectedRows.Count < 1) { MessageBox.Show("Please select a Shipment to Unship", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } RBillNumber = dataGridViewCurrentShipment.SelectedRows[0].Cells[0].Value.ToString(); string status = dataGridViewCurrentShipment.SelectedRows[0].Cells[3].Value.ToString(); string strShipmentId = dataGridViewCurrentShipment.SelectedRows[0].Cells[5].Value.ToString(); string rBillDate = dataGridViewCurrentShipment.SelectedRows[0].Cells[2].Value.ToString(); if (status.ToLower() != "s") { MessageBox.Show("Only Shipments already shipped can be Unshipped", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //update shipment status int shipmentId = 0; Int32.TryParse(strShipmentId, out shipmentId); if (shipmentId < 1) { MessageBox.Show("Shipment ID invalid!"); } else { sol_Shipment = sol_Shipment_Sp.Select(shipmentId); //if (sol_Shipment.ERBillTransmitted) //{ // MessageBox.Show("Shipment already transmitted!"); // return; //} //update stage status sol_Stage_Sp.UpdateStatusByShipmentId(shipmentId, "P"); //I-InProgress; P-Picked S-Shipped sol_Shipment_Sp.UpdateStatus(shipmentId, "I"); //I-InProgress; P-Picked S-Shipped //sol_Shipment_Sp.UpdateERBillTransmitted(shipmentId, false); //delete supply inventory entries //Sol_SupplyInventory sol_SupplyInventory; if (sol_SupplyInventory_Sp == null) { sol_SupplyInventory_Sp = new Sol_SupplyInventory_Sp(Properties.Settings.Default.WsirDbConnectionString); } sol_SupplyInventory_Sp._DeleteAllByShipmentID(shipmentId); //refresh shipments ReadCurrentShipments(); MessageBox.Show("UnShipped!"); dataGridViewCurrentShipment.Focus(); } }
private void buttonPrintRBill_Click(object sender, EventArgs e) { dataGridViewCurrentShipment.Focus(); if (dataGridViewCurrentShipment.SelectedRows.Count < 1) { MessageBox.Show("Please select a Shipment to print", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } RBillNumber = dataGridViewCurrentShipment.SelectedRows[0].Cells[0].Value.ToString(); string status = dataGridViewCurrentShipment.SelectedRows[0].Cells[3].Value.ToString(); string strShipmentId = dataGridViewCurrentShipment.SelectedRows[0].Cells[5].Value.ToString(); string agencyName = dataGridViewCurrentShipment.SelectedRows[0].Cells[1].Value.ToString(); string rBillDate = dataGridViewCurrentShipment.SelectedRows[0].Cells[2].Value.ToString(); if (status != "S") { MessageBox.Show("Only shipped Shipments can be printed.", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } this.Cursor = Cursors.WaitCursor; if (agencyName.Trim().ToLower() == "abcrc") { int shipmentId = 0; Int32.TryParse(strShipmentId, out shipmentId); if (sol_Shipment_Sp == null) { sol_Shipment_Sp = new Sol_Shipment_Sp(Properties.Settings.Default.WsirDbConnectionString); } sol_Shipment = sol_Shipment_Sp.Select(shipmentId); if (sol_WS_Carrier_Sp == null) { sol_WS_Carrier_Sp = new Sol_WS_Carrier_Sp(Properties.Settings.Default.WsirDbConnectionString); } sol_WS_Carrier = sol_WS_Carrier_Sp.Select(sol_Shipment.CarrierID); if (sol_WS_Carrier == null) { sol_WS_Carrier = new Sol_WS_Carrier(); sol_WS_Carrier.CarrierID = 0; sol_WS_Carrier.Carrier = String.Empty; } ShippingShipments.UpdateDataSetBol2(shipmentId, RBillNumber); ShippingShipments.PrintBol2( shipmentId, RBillNumber, sol_Shipment.ShippedDate.ToString(), sol_WS_Carrier.Carrier, sol_Shipment.TrailerNumber, sol_Shipment.ProBillNumber ); } else { ShippingShipments.PrintRBill(strShipmentId); } this.Cursor = Cursors.Default; }
private void Shipping_Load(object sender, EventArgs e) { //classes of tables sol_Shipment = new Sol_Shipment(); sol_Shipment_Sp = new Sol_Shipment_Sp(Properties.Settings.Default.WsirDbConnectionString); sol_ShipmentList = new List <Sol_Shipment>(); sol_Stage = new Sol_Stage(); sol_Stage_Sp = new Sol_Stage_Sp(Properties.Settings.Default.WsirDbConnectionString); sol_StageList = new List <Sol_Stage>(); toolStrip1.Renderer = new App_Code.NewToolStripRenderer(); if (Properties.Settings.Default.TouchOriented) { toolStripButtonVirtualKb.Visible = true; } //clock object obj1 = toolStripStatusLabelToday; object obj2 = toolStripStatusLabelTimer; Main.rc.CambiarControlFecha(ref obj1); Main.rc.CambiarControlHora(ref obj2); //disable form resizing //this.FormBorderStyle = FormBorderStyle.FixedSingle; //listview with headers listViewCurrentStagedContainers.View = View.Details; //listViewCurrentStagedContainers.Columns.Add("Tag #", 190, HorizontalAlignment.Right); //70 //listViewCurrentStagedContainers.Columns.Add("Product", 165, HorizontalAlignment.Left); //listViewCurrentStagedContainers.Columns.Add("Dozen", 80, HorizontalAlignment.Left); //listViewCurrentStagedContainers.Columns.Add("Container", 170, HorizontalAlignment.Left); listViewCurrentStagedContainers.Columns.Add("Tag #", 190, HorizontalAlignment.Left); //70 listViewCurrentStagedContainers.Columns.Add("Product", 165, HorizontalAlignment.Left); listViewCurrentStagedContainers.Columns.Add("Quantity", 80, HorizontalAlignment.Right); listViewCurrentStagedContainers.Columns.Add("Container", 170, HorizontalAlignment.Left); listViewCurrentStagedContainers.Columns.Add("Dozen", 80, HorizontalAlignment.Right); listViewCurrentStagedContainers.FullRowSelect = true; //listViewCurrentStagedContainers.CheckBoxes = true; listViewCurrentStagedContainers.GridLines = true; //listView1.Activation = ItemActivation.OneClick; //manual sorting of items by columns listViewCurrentStagedContainers.Sorting = System.Windows.Forms.SortOrder.Ascending; // Make owner-drawn to be able to give different alignments to single subitems //listViewCurrentStagedContainers.OwnerDraw = true; //listViewCurrentStagedContainers.DrawColumnHeader += new System.Windows.Forms.DrawListViewColumnHeaderEventHandler(this.listView1_DrawColumnHeader); //listViewCurrentStagedContainers.DrawSubItem += new System.Windows.Forms.DrawListViewSubItemEventHandler(this.listView1_DrawSubItem); //listViewCurrentStagedContainers.DrawSubItem += new System.Windows.Forms.DrawListViewSubItemEventHandler(this.listView2_DrawSubItem); //listview with headers listViewCurrentShipment.View = View.Details; //listViewCurrentShipment.Columns.Add("ShipmentID", 100, HorizontalAlignment.Left); listViewCurrentShipment.Columns.Add("BOL #", 160, HorizontalAlignment.Left); listViewCurrentShipment.Columns.Add("Agency", 300, HorizontalAlignment.Left); listViewCurrentShipment.FullRowSelect = true; //listViewCurrentShipment.CheckBoxes = true; listViewCurrentShipment.GridLines = true; //listview with headers listViewContainersOnShipment.View = View.Details; //listViewContainersOnShipment.Columns.Add("Tag #", 190, HorizontalAlignment.Right); //listViewContainersOnShipment.Columns.Add("Product", 165, HorizontalAlignment.Left); //listViewContainersOnShipment.Columns.Add("Dozen", 80, HorizontalAlignment.Left); //listViewContainersOnShipment.Columns.Add("Container", 170, HorizontalAlignment.Left); listViewContainersOnShipment.Columns.Add("Tag #", 190, HorizontalAlignment.Left); listViewContainersOnShipment.Columns.Add("Product", 165, HorizontalAlignment.Left); listViewContainersOnShipment.Columns.Add("Quantity", 80, HorizontalAlignment.Right); listViewContainersOnShipment.Columns.Add("Container", 170, HorizontalAlignment.Left); listViewContainersOnShipment.Columns.Add("Dozen", 80, HorizontalAlignment.Right); //listViewContainersOnShipment.FullRowSelect = true; //listViewContainersOnShipment.CheckBoxes = true; listViewContainersOnShipment.GridLines = true; //read outstandig orders (unpaid) ReadCurrentStagedContainers(); //read shipments ready to be shippped ReadCurrentShipments(); //training warning if (Properties.Settings.Default.SQLBaseDeDatos == "Solum_Training") { toolStripStatusLabelTrainingMode.Visible = true; Main.tslCntr = toolStripStatusLabelTrainingMode; Main.timerBlink.Enabled = true; } CheckUserPermissions(); if (Properties.Settings.Default.StagingType == 0) //!Properties.Settings.Default.MultiProductStagingEnabled) { toolStripSeparatorMultiProductStaging.Visible = false; toolStripButtonMultiProductStaging.Visible = false; } }
private void ShippingLookup_Load(object sender, EventArgs e) { ShipmentButtonAdjustment = false; //classes of tables sol_Shipment = new Sol_Shipment(); sol_Shipment_Sp = new Sol_Shipment_Sp(Properties.Settings.Default.WsirDbConnectionString); sol_ShipmentList = new List <Sol_Shipment>(); sol_Stage = new Sol_Stage(); sol_Stage_Sp = new Sol_Stage_Sp(Properties.Settings.Default.WsirDbConnectionString); sol_StageList = new List <Sol_Stage>(); toolStrip1.Renderer = new App_Code.NewToolStripRenderer(); //años int aa = Main.rc.FechaActual.Year; byte ah = Main.Sol_ControlInfo.HistoryYears; int uah = aa - ah; dateTimePickerFrom.MinDate = DateTime.Parse(String.Format("{0}-1-1", uah)); dateTimePickerFrom.MaxDate = Main.rc.FechaActual; dateTimePickerFrom.Value = dateTimePickerFrom.MaxDate; dateTimePickerTo.MinDate = dateTimePickerFrom.MaxDate; dateTimePickerTo.MaxDate = dateTimePickerFrom.MaxDate; dateTimePickerTo.Value = dateTimePickerFrom.MaxDate; if (Properties.Settings.Default.TouchOriented) { toolStripButtonVirtualKb.Visible = true; } //clock object obj1 = toolStripStatusLabelToday; object obj2 = toolStripStatusLabelTimer; Main.rc.CambiarControlFecha(ref obj1); Main.rc.CambiarControlHora(ref obj2); //disable form resizing //this.FormBorderStyle = FormBorderStyle.FixedSingle; //dataGridViewCurrentShipment //this.dataGridViewCurrentShipment.CellBorderStyle = DataGridViewCellBorderStyle.None; //this.dataGridViewCurrentShipment.RowHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single; //this.dataGridViewCurrentShipment.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single; //this.dataGridViewCurrentShipment.GridColor = Color.Black; //this.dataGridViewCurrentShipment.BorderStyle = BorderStyle.Fixed3D; //this.dataGridViewCurrentShipment.CellBorderStyle = DataGridViewCellBorderStyle.None; //this.dataGridViewCurrentShipment.RowHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single; //this.dataGridViewCurrentShipment.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single; //listview with headers listViewContainersOnShipment.View = View.Details; //listViewContainersOnShipment.Columns.Add("Tag #", 190, HorizontalAlignment.Left); //listViewContainersOnShipment.Columns.Add("Product", 170, HorizontalAlignment.Left); //listViewContainersOnShipment.Columns.Add("Dozen", 80, HorizontalAlignment.Left); //listViewContainersOnShipment.Columns.Add("Container", 170, HorizontalAlignment.Left); listViewContainersOnShipment.Columns.Add("Tag #", 190, HorizontalAlignment.Left); listViewContainersOnShipment.Columns.Add("Product", 170, HorizontalAlignment.Left); listViewContainersOnShipment.Columns.Add("Quantity", 80, HorizontalAlignment.Right); listViewContainersOnShipment.Columns.Add("Container", 170, HorizontalAlignment.Left); listViewContainersOnShipment.Columns.Add("Dozen", 80, HorizontalAlignment.Right); //listViewContainersOnShipment.FullRowSelect = true; //listViewContainersOnShipment.CheckBoxes = true; listViewContainersOnShipment.GridLines = true; //listViewContainersOnShipment.Activation = ItemActivation.OneClick; //read shipments ready to be shippped ReadCurrentShipments(); //training warning if (Properties.Settings.Default.SQLBaseDeDatos == "Solum_Training") { toolStripStatusLabelTrainingMode.Visible = true; Main.tslCntr = toolStripStatusLabelTrainingMode; Main.timerBlink.Enabled = true; } //initialFlag = false; CheckUserPermissions(); if (Properties.Settings.Default.StagingType == 0) //!Properties.Settings.Default.MultiProductStagingEnabled) { toolStripSeparatorMultiProductStaging.Visible = false; toolStripButtonMultiProductStaging.Visible = false; } //originally in Solum //if (!(Main.Sol_ControlInfo.State == "AB" // && Main.QuickDrop_DepotID != null && Main.QuickDrop_DepotID.Length == 6) // ) //{ // buttoneRBill.Visible = false; // //buttonPrintRBill // //buttonUnNow // //this.buttoneRBill.Location = new System.Drawing.Point(604, 5); // this.buttonPrintRBill.Location = new System.Drawing.Point(604, 5); //new System.Drawing.Point(721, 5); // this.buttonUnNow.Location = new System.Drawing.Point(721, 5); //new System.Drawing.Point(838, 5); //} }