예제 #1
0
        private void tbBarcode_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                string barcode = tbBarcode.Text;
                if (string.IsNullOrEmpty(barcode))
                {
                    barcode = CeReader.Barcode.Scan();
                }
                tbBarcode.Text = barcode;


                var productOrBarcode = tbBarcode.Text.ToUpper().Trim();
                tbBarcode.Text = productOrBarcode;
                if (string.IsNullOrEmpty(productOrBarcode))
                {
                    GlobalMessageBox.ShowInfomation("กรุณาระบุบาร์โค้ดสินค้า");
                    return;
                }

                try
                {
                    AddLocationCode(productOrBarcode);
                    //tbBarcode.SelectAll();
                    tbBarcode.Text = "";
                }
                catch (Exception ex)
                {
                    GlobalMessageBox.ShowError(ex);
                }
            }
        }
예제 #2
0
        private void btnSync_Click(object sender, EventArgs e)
        {
            if ("0000".Equals(ddlBranch.SelectedValue))
            {
                GlobalMessageBox.ShowInfomation("กรุณาเลือกสาขา ก่อนทำการปรับปรุงข้อมูล");
                return;
            }

            try
            {
                //ImportForm oForm = new ImportForm();
                //oForm.Show();

                GlobalContext.BranchCode = ddlBranch.SelectedValue.ToString();
                this.Enabled             = false;
                Cursor.Current           = Cursors.WaitCursor;
                SynchonizeData();
                Cursor.Current = Cursors.Default;
                this.Enabled   = true;
                GlobalMessageBox.ShowInfomation("ปรับปรุงข้อมูลเรียบร้อยแล้ว");
                txtUserName.Focus();
            }
            catch (Exception ex)
            {
                Cursor.Current = Cursors.Default;
                GlobalMessageBox.ShowError(ex);
                this.Enabled = true;
            }
        }
예제 #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (GlobalMessageBox.ShowQuestion("คุณต้องการบันทึกข้อมูล ใช่หรือไม่") == DialogResult.Yes)
            {
                try
                {
                    Cursor.Current = Cursors.WaitCursor;
                    var productLocations = (List <ProductLocation>)bsLocation.DataSource;
                    foreach (var item in productLocations)
                    {
                        item.ProductCode              = txtProductCode.Text;
                        item.ProductUnitCode          = txtUnitCode.Text;
                        item.ProductName              = txtProductName.Text;
                        item.BalanceQuantitySpecified = true;
                    }
                    ServiceHelper.MobileServices.ProductLocationBlankAdd(GlobalContext.BranchCode, productLocations.ToArray());

                    GlobalMessageBox.ShowInfomation("บันทึกข้อมูลเรียบร้อยแล้ว");
                    ClearGrid();
                }
                catch (Exception ex)
                {
                    GlobalMessageBox.ShowError(ex.Message);
                }
                finally
                {
                    Cursor.Current = Cursors.Default;
                }
            }
        }
예제 #4
0
        private void BindGrid()
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;

                if (ddlCounterBill.SelectedValue == null)
                {
                    GlobalMessageBox.ShowInfomation("กรุณาเลือกเลขที่ใบนับ");
                    return;
                }


                var counterDocumentNo = ddlCounterBill.Text;
                var accountingYear    = ddlCounterBill.SelectedValue as string;

                var zddList = ServiceHelper.MobileServices.GetHandHeldCounterMainHoldZDDHandHeldCheckStockFromSap(GlobalContext.BranchCode, counterDocumentNo
                                                                                                                  , accountingYear
                                                                                                                  , GlobalContext.UserCode);

                bindingSource.DataSource = zddList;
                ddlCounterBill.Enabled   = false;
                this.btnSearch.Enabled   = false;
            }
            catch (Exception ex)
            {
                GlobalMessageBox.ShowError(ex);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
예제 #5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (IsValidateForm)
            {
                if (GlobalMessageBox.ShowQuestion("คุณต้องการบันทึกเอกสารนี้ ใช่หรือไม่") == DialogResult.Yes)
                {
                    try
                    {
                        Cursor.Current = Cursors.WaitCursor;

                        grdProduct.EndEdit();
                        List <HandHeldCounterHold> products = (List <HandHeldCounterHold>)bindingSource.DataSource;

                        foreach (var item in products)
                        {
                            item.Warehouse         = GlobalContext.WarehouseCode;
                            item.Branchcode        = GlobalContext.BranchCode;
                            item.QuantitySpecified = true;
                            item.Officerid         = GlobalContext.UserCode;//ddlEmployee.SelectedValue as string;
                            item.Createuser        = GlobalContext.UserCode;
                        }

                        string messageStatus = string.Empty;
                        // save data to server.
                        var documentNo = ServiceHelper.MobileServices.AddHandHeldCounterHold(GlobalContext.BranchCode, products.ToArray());
                        var message    = ServiceHelper.MobileServices.AddHandHeldCounter(GlobalContext.BranchCode, documentNo, false, out messageStatus);

                        //lblMessage.Text = messageStatus;
                        //lblMessage.Visible = true;
                        if (message.IndexOf("true") > -1)
                        {
                            GlobalMessageBox.ShowInfomation(message);
                        }
                        else if (message.IndexOf("false") > -1)
                        {
                            if (GlobalMessageBox.ShowQuestion(message) == DialogResult.Yes)
                            {
                                Cursor.Current = Cursors.WaitCursor;
                                message        = ServiceHelper.MobileServices.AddHandHeldCounter(GlobalContext.BranchCode, documentNo, true, out messageStatus);
                                GlobalMessageBox.ShowInfomation(message);
                            }
                            else
                            {
                                this.ClearControlBinding();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        GlobalMessageBox.ShowError(ex);
                    }
                    finally
                    {
                        Cursor.Current = Cursors.Default;
                    }
                }
            }
        }
예제 #6
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         Add();
     }
     catch (Exception ex)
     {
         GlobalMessageBox.ShowError(ex);
     }
 }
예제 #7
0
 private void RequestLocationLabelSuperForm_Load(object sender, EventArgs e)
 {
     try
     {
         this.PrepareForm();
     }
     catch (Exception ex)
     {
         GlobalMessageBox.ShowError(ex);
     }
 }
예제 #8
0
 private void btnOfflineToSap_Click(object sender, EventArgs e)
 {
     try
     {
         new LocationCheckOfflineForm().ShowDialog();
     }
     catch (Exception ex)
     {
         GlobalMessageBox.ShowError(ex);
     }
 }
예제 #9
0
 private void mnuChangeWarehouse_Click(object sender, EventArgs e)
 {
     try
     {
         new ChangeWarehouseForm().ShowDialog();
     }
     catch (Exception ex)
     {
         GlobalMessageBox.ShowError(ex);
     }
 }
예제 #10
0
        private void AddOnLineMode()
        {
            var productLocations = (List <ProductLocation>)bsLocation.DataSource;

            if (productLocations.Exists(p => p.RequestPrintLabel) && cmbLabelType.SelectedIndex == 0)
            {
                GlobalMessageBox.ShowInfomation("กรุณาเลือกประเภทป้าย\nก่อนบันทึกข้อมูล");
                return;
            }

            if (GlobalMessageBox.ShowQuestion("คุณต้องการบันทึกข้อมูล ใช่หรือไม่") == DialogResult.Yes)
            {
                try
                {
                    Cursor.Current = Cursors.WaitCursor;
                    this.PrepareSave();
                    string result = string.Empty;

                    productLocations = (List <ProductLocation>)bsLocation.DataSource;

                    result = ServiceHelper.MobileServices.ProductLocationAdd(GlobalContext.BranchCode, txtLocationCodeScan.Text.Trim()
                                                                             , GlobalContext.WarehouseCode
                                                                             , productLocations.ToArray());
                    if (!"ERROR".Equals(result))
                    {
                        string message = string.Empty;
                        if (result.Contains("PL"))
                        {
                            message = "บันทึกข้อมูลเรียบร้อย\nเลขที่เอกสารพิมพ์ป้ายที่ได้\n" + result;
                        }
                        else
                        {
                            message = "บันทึกข้อมูลเรียบร้อย";
                        }

                        GlobalMessageBox.ShowInfomation(message);
                        // call btnClear button
                        btnClear_Click(null, null);
                    }
                    else
                    {
                        GlobalMessageBox.ShowError("บันทึกข้อมูลไม่สำเร็จ กรุณาติดต่อผู้ดูแล");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "พบข้อผิดพลาด");
                }
                finally
                {
                    Cursor.Current = Cursors.Default;
                }
            }
        }
예제 #11
0
 private void btnLabelPrintList_Click(object sender, EventArgs e)
 {
     try
     {
         new LocationLabelPrintForm().ShowDialog();
     }
     catch (Exception ex)
     {
         GlobalMessageBox.ShowError(ex);
     }
 }
예제 #12
0
 private void mnuMainStockCounter_Click(object sender, EventArgs e)
 {
     try
     {
         new CountStockMainForm().ShowDialog();
     }
     catch (Exception ex)
     {
         GlobalMessageBox.ShowError(ex);
     }
 }
예제 #13
0
        //private void mnuCheckProductProfile_Click(object sender, EventArgs e)
        //{
        //    try
        //    {
        //        new ProductCheckForm3().ShowDialog();
        //    }
        //    catch (Exception ex)
        //    {
        //        GlobalMessageBox.ShowError(ex);
        //    }
        //}

        private void mnuRequestLocationLabelSuper_Click(object sender, EventArgs e)
        {
            try
            {
                new LabelLocationForm().ShowDialog();
            }
            catch (Exception ex)
            {
                GlobalMessageBox.ShowError(ex);
            }
        }
예제 #14
0
 private void mnuLabelPrice_Click(object sender, EventArgs e)
 {
     try
     {
         new LabelPriceForm().ShowDialog();
     }
     catch (Exception ex)
     {
         GlobalMessageBox.ShowError(ex);
     }
 }
예제 #15
0
 private void mnuLocationCheck_Click(object sender, EventArgs e)
 {
     try
     {
         new LocationCheckForm2().ShowDialog();
     }
     catch (Exception ex)
     {
         GlobalMessageBox.ShowError(ex);
     }
 }
예제 #16
0
 private void mnuBlankProduct_Click(object sender, EventArgs e)
 {
     try
     {
         new ProductBlankForm().ShowDialog();
     }
     catch (Exception ex)
     {
         GlobalMessageBox.ShowError(ex);
     }
 }
 private void OrderedSetForm_Load(object sender, EventArgs e)
 {
     try
     {
         BindGridview();
         chkDisplayOnlyNotClose.Checked = true;
     }
     catch (Exception ex)
     {
         GlobalMessageBox.ShowError(ex);
     }
 }
예제 #18
0
        private void Add()
        {
            if (this.ValidateForm())
            {
                try
                {
                    if (OfflineMode)
                    {
                        Cursor.Current = Cursors.WaitCursor;
                        var agenda = (List <LocationCheckPeriodAgenda>)bsAgenda.DataSource;
                        LocationCheckManager.Add(txtLocationCode.Text.Trim()
                                                 , txtEmployeeCode.Text.Trim()
                                                 , agenda);
                    }
                    else
                    {
                        var locationCheck = new LocationCheck();
                        locationCheck.Location          = txtLocationCode.Text.Trim();
                        locationCheck.OfficerCode       = txtEmployeeCode.Text.Trim();
                        locationCheck.CheckerCode       = GlobalContext.UserCode;
                        locationCheck.WarehouseCode     = GlobalContext.WarehouseCode;
                        locationCheck.PeriodId          = LocationCheckManager.GetCurrentPeriodId();
                        locationCheck.PeriodIdSpecified = true;

                        var locationCheckDetail = new List <LocationCheckDetail>();
                        var agenda = (List <LocationCheckPeriodAgenda>)bsAgenda.DataSource;
                        foreach (var item in agenda)
                        {
                            locationCheckDetail.Add(new LocationCheckDetail
                            {
                                PeriodAgendaId          = item.AgendaTemplateId,
                                PeriodAgendaIdSpecified = true,
                                AgendaValue             = item.CheckedValue,
                                IsChecked          = item.Checked,
                                IsCheckedSpecified = true,
                            });
                        }

                        ServiceHelper.MobileServices.LocationCheckAdd(GlobalContext.BranchCode, locationCheck, locationCheckDetail.ToArray());
                    }
                    Cursor.Current = Cursors.Default;
                }
                catch (Exception ex)
                {
                    Cursor.Current = Cursors.Default;
                    var message = "เกิดข้อผิดพลาดในการบันทึกข้อมูล ดังนี้ \n" + ex.Message;
                    GlobalMessageBox.ShowError(message);
                }

                //clear controls
                this.ClearBindingControl();
            }
        }
예제 #19
0
 private void menuItem2_Click(object sender, EventArgs e)
 {
     try
     {
         var frm = new ProductCheckForm2();
         frm.ShowDialog();
     }
     catch (Exception ex)
     {
         GlobalMessageBox.ShowError(ex);
     }
 }
예제 #20
0
 private void mnuProductLocation_Click(object sender, EventArgs e)
 {
     try
     {
         var oform = new LocationForm();
         oform.ShowDialog();
     }
     catch (Exception ex)
     {
         GlobalMessageBox.ShowError(ex);
     }
 }
예제 #21
0
 private void mnuOrdersSet_Click(object sender, EventArgs e)
 {
     try
     {
         var oform = new OrderedSetForm();
         oform.ShowDialog();
     }
     catch (Exception ex)
     {
         GlobalMessageBox.ShowError(ex);
     }
 }
예제 #22
0
        private void LocationOfflineModeForm_Load(object sender, EventArgs e)
        {
            Utils.FormSetCenterSceen(this);

            try
            {
                BindGrid();
            }
            catch (Exception ex)
            {
                GlobalMessageBox.ShowError(ex);
            }
        }
예제 #23
0
 private void btnScanerFix_Click(object sender, EventArgs e)
 {
     try
     {
         CeReader.Barcode.FreeModule();
         CeReader.Barcode.InitModule();
         GlobalMessageBox.ShowInfomation("แก้ไขระบบสแกนเรียบร้อยแล้ว กรุณาทดสอบการสแกนบาร์โค้ดอีกครั้ง");
     }
     catch (Exception ex)
     {
         GlobalMessageBox.ShowError(ex.Message);
     }
 }
예제 #24
0
 private void btnFinish_Click(object sender, EventArgs e)
 {
     try
     {
         var oForm = new OrderedSetCloseForm();
         oForm.ShowDialog();
         btnNew_Click(null, null);
     }
     catch (Exception ex)
     {
         GlobalMessageBox.ShowError(ex);
     }
 }
예제 #25
0
 private void dgDisplayList_DoubleClick(object sender, EventArgs e)
 {
     try
     {
         this.DialogResult  = DialogResult.OK;
         this.SelectedValue = dgDisplayList[_currentRowIndex, 0] as string;
         this.Close();
     }
     catch (Exception ex)
     {
         GlobalMessageBox.ShowError(ex);
     }
 }
        private void RequestLocationLabelSuperOfflineForm_Load(object sender, EventArgs e)
        {
            Utils.FormSetCenterSceen(this);

            try
            {
                BindGridView();
            }
            catch (Exception ex)
            {
                GlobalMessageBox.ShowError(ex);
            }
        }
예제 #27
0
        private void tbSerialNo_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                try
                {
                    Cursor.Current = Cursors.WaitCursor;

                    var barcode = tbOrderNo.Text.Trim();
                    if (string.IsNullOrEmpty(barcode))
                    {
                        barcode = CeReader.Barcode.Scan();
                    }

                    if (string.IsNullOrEmpty(barcode))
                    {
                        GlobalMessageBox.ShowWarnning("กรุณาระบุเลขที่เอกสาร");
                        return;
                    }
                    else
                    {
                        if (barcode.Length > 10)
                        {
                            barcode = barcode.Substring(0, 10);
                        }

                        tbOrderNo.Text = barcode;
                        var order = ServiceHelper.MobileServices.OrderedSetGetByOrderNo(barcode);
                        if (order != null)
                        {
                            Cursor.Current = Cursors.Default;
                            new OrderedInfoForm(order).ShowDialog();
                            btnNew_Click(null, null);
                            return;
                        }

                        tbOrderNo.Text      = barcode;
                        tbOrderNo.ReadOnly  = true;
                        tbOrderNo.BackColor = Color.FromArgb(255, 255, 192);
                        btnSave.Enabled     = true;
                        grdForkLift.Enabled = true;
                    }
                }
                catch (Exception ex)
                { GlobalMessageBox.ShowError(ex.Message); }
                finally
                {
                    Cursor.Current = Cursors.Default;
                }
            }
        }
예제 #28
0
        private void BindLocationData()
        {
            var locationCode = txtLocationCode.Text.ToUpper();

            if (locationCode.IndexOf(Convert.ToChar(".")) > -1)
            {
                txtLocationCode.Text = null;
                txtLocationCode.Focus();
                return;
            }
            else if (Utils.CheckIsDigitOnly(locationCode))
            {
                txtLocationCode.Text = null;
                txtLocationCode.Focus();
                return;
            }

            try
            {
                Cursor.Current = Cursors.WaitCursor;

                if (!OfflineMode)
                {
                    var EndPoint   = GlobalContext.ServerEndpointAddress;
                    var ServiceUrl = GlobalContext.remoteAddress;
                    var cnn        = new DoHome.HandHeld.Client.SAPCnn.MobileService();
                    cnn.Url = ServiceUrl.Replace("localhost", EndPoint);
                    var location = cnn.LocationGetByCode(locationCode, GlobalContext.WarehouseCode);
                    if (location == null)
                    {
                        GlobalMessageBox.ShowInfomation("ไม่พบตำแหน่งจัดเก็บสินค้านี้ ในระบบ");
                        return;
                    }
                    txtLocationCode.Text = location.Code;
                }
                else
                {
                    txtLocationCode.Text = locationCode;
                }

                //chkOffline.Enabled = false;
                txtLocationCode.Enabled = false;
                txtBarcode.Enabled      = true;
                txtEmployeeCode.Enabled = true;
                btnSearchUser.Enabled   = true;
                txtBarcode.Focus();
            }
            catch (Exception ex) { GlobalMessageBox.ShowError(ex.Message); }
            finally { Cursor.Current = Cursors.Default; }
        }
        private void SalesInfoForm_Load(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;

                tbGroupingofmaterials.Text  = _groupingofmaterials;
                tbProductCode.Text          = _productCode;
                tbProductName.Text          = _productName;
                grdPurchaseOrder.DataSource = ServiceHelper.MobileServices.OrderAccrualGetByProductCode(_productCode, GlobalContext.BranchCode);
            }
            catch (Exception ex) { GlobalMessageBox.ShowError(ex); }
            finally { Cursor.Current = Cursors.Default; }
        }
예제 #30
0
        private void Add()
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;

                var products      = (List <ProductLocation>)bsProductLocation.DataSource;
                var warehouseCode = GlobalContext.WarehouseCode;
                var userID        = GlobalContext.UserCode;
                var employeeCode  = txtEmployeeCode.Text.Trim();
                int displayOrder  = 0;
                foreach (var item in products)
                {
                    item.SalePriceSpecified    = true;
                    item.ShopPriceSpecified    = true;
                    item.DisplayOrder          = displayOrder;
                    item.DisplayOrderSpecified = true;
                    item.CreateDateSpecified   = true;
                    item.OfficerID             = employeeCode;
                    item.WarehouseCode         = warehouseCode;
                    item.UserID       = userID;
                    item.LocationCode = txtLocationCode.Text;
                    item.DocumentDate = this.dtChangePrice.Value;
                    displayOrder++;
                }
                if (OfflineMode)
                {
                    LocationCheckProductManager.Add(products);
                }
                else
                {
                    ServiceHelper.MobileServices.ProductLocationAddHandHeldLocation(GlobalContext.BranchCode, products.ToArray());
                }

                //clear controls
                this.ClearBindingControl();

                //GlobalMessageBox.ShowInfomation("บันทึกข้อมูลเรียบร้อย");
            }
            catch (Exception ex)
            {
                var message = "เกิดข้อผิดพลาดในการบันทึกข้อมูล ดังนี้ \n" + ex.Message;
                GlobalMessageBox.ShowError(message);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }