Пример #1
0
        private void InitControls()
        {
            lblAlreadyPrintCount.Tag = 0;
            txtPutinUserName.Text    = MainForm.CurrentUserName;
            var boxTypeDir = new PutInWarehouseBLL().GetSpeedChangeBoxType();

            foreach (var item in boxTypeDir.Data)
            {
                cbxProductType.Items.Add(item);
                cbxProductType.DisplayMember = "SpeedChangeBoxName";
                cbxProductType.ValueMember   = "SpeedChangeBoxTypeID";
            }

            ReadConfigFromFile();

            SetPutinSetEnable(false);
            btnStartPutin.Enabled = true;
            btnStopPutin.Enabled  = false;
            SetCountStatisticProp(0);

            if (MainForm.CurrentUserRoles.Contains(PermissionEnum.系统管理员.ToString()))
            {
                this.btnPutinSet.Visible = true;
            }
            else if (MainForm.CurrentUserRoles.Contains(PermissionEnum.班长.ToString()))
            {
                this.btnPutinSet.Visible = true;
                //this.txtPutinAddress.Enabled =  false  ;
                this.txtPutinAddress.ReadOnly = true;
            }
            else
            {
                this.btnPutinSet.Visible = false;
            }
        }
Пример #2
0
        private void InitControls()
        {
            dgvBarCodeList.AutoGenerateColumns = false;
            txtRemovalUserName.Text            = MainForm.CurrentUserName;
            var boxTypeDir = new PutInWarehouseBLL().GetSpeedChangeBoxType();

            foreach (var item in boxTypeDir.Data)
            {
                cbxProductType.Items.Add(item);
                cbxProductType.DisplayMember = "SpeedChangeBoxName";
                cbxProductType.ValueMember   = "SpeedChangeBoxTypeID";
            }

            LoadDispatchPlaceList();

            ReadConfigFromFile();

            SetPutinSetEnable(false);
            btnStartRemoval.Enabled = true;
            btnStopRemoval.Enabled  = false;
            SetCountStatisticText(0, true);

            //        if (MainForm.CurrentUserRoles.Contains(PermissionEnum.班长.ToString())
            //|| MainForm.CurrentUserRoles.Contains(PermissionEnum.系统管理员.ToString())) {
            //            this.btnRemovalSet.Visible = true;
            //        } else {
            //            this.btnRemovalSet.Visible = false;
            //        }
        }
Пример #3
0
        private int PageChange(int pageIndex, int pageSize)
        {
            _firstIndex = (pageIndex - 1) * pageSize + 1;

            var warehouseBLL = new PutInWarehouseBLL();
            int totalCount;
            CResult <List <WebPutInWarehouseRecord> > result;

            // if (_isPutinOrWarehouseCheck == true)
            // {
            // dgvPutinRecord.Columns["PrintTwoCode"].Visible = false;
            // result = warehouseBLL.GetPutInWarehouseInfo(out totalCount, txtSearchKey.Text.Trim(), pageIndex, pageSize, _currentOrderBy,
            //   _ascding, searchStartTime.Value, searchEndTime.Value);
            //  }
            //  else if (_isPutinOrWarehouseCheck == false & (MainForm.CurrentUserRoles.Contains(PermissionEnum.系统管理员.ToString())))
            //  {
            //if (MainForm.CurrentUserRoles.Contains(PermissionEnum.系统管理员.ToString()))
            //{
            //  result = warehouseBLL.GetWarehouseInfoList(out totalCount, txtSearchKey.Text.Trim(), pageIndex, pageSize, _currentOrderBy, _ascding
            //  , searchStartTime.Value, searchEndTime.Value);



            //  }

            // dgvPutinRecord.DataSource = result.Data;

            // return totalCount;

            //if (_isPutinOrWarehouseCheck == false & (MainForm.CurrentUserRoles.Contains(PermissionEnum.系统管理员.ToString())))
            if (_isPutinOrWarehouseCheck == false)

            {
                result = warehouseBLL.GetWarehouseInfoList(out totalCount, txtSearchKey.Text.Trim(), pageIndex, pageSize, _currentOrderBy, _ascding
                                                           , searchStartTime.Value, searchEndTime.Value);
            }
            else
            {
                dgvPutinRecord.Columns["PrintTwoCode"].Visible = false;
                result = warehouseBLL.GetPutInWarehouseInfo(out totalCount, txtSearchKey.Text.Trim(), pageIndex, pageSize, _currentOrderBy,
                                                            _ascding, searchStartTime.Value, searchEndTime.Value);
            }

            dgvPutinRecord.DataSource = result.Data;

            return(totalCount);
        }
Пример #4
0
        private bool PrintTwoDimensioncode()
        {
            //string printStr = string.Join("?", _recentBarcodeList);
            string printStr       = string.Join("?", _recentBarcodeList) + "?" + Guid.NewGuid().ToString();
            var    resultPrintStr = ConfigHelper.TwoCodePre + DateTime.Now.ToString() + "^" + cbxProductType.Text + "~" + printStr;


            //var resultPrintStr ="变速箱二维码"+DateTime .Now.ToString()+"~"+printStr;
            //var resultPrintStr ="512班二维码"+DateTime.Now.ToString()+"~"+printStr;
            //var resultPrintStr ="513班二维码"+DateTime.Now.ToString()+"~"+printStr;
            //var resultPrintStr ="525班二维码"+DateTime.Now.ToString()+"~"+printStr;
            var printResult = Print(resultPrintStr);

            if (printResult)
            {
                var result = PutInWarehouseBLL.SavePutInWarehouseInfo(_recentBarcodeList, printStr, ((WebSpeedChangeBoxType)cbxProductType.SelectedItem).SpeedChangeBoxTypeID, txtPutinUserName.Text.Trim(), txtPutinAddress.Text.Trim());
                if (result.Code > 0)
                {
                    DlgHelper.ShowAlertMsgBox(result.Msg + "\n此条二维码作废,请处理!", true);
                    //lblAlreadyPrintCount.Text = string.Format(_alreadyPrintCount, -1 + int.Parse(lblAlreadyPrintCount.Text));
                    SetTwoCodePrintCount(-1);

                    return(false);
                }
                else
                {
                    _recentBarcodeList.Clear();
                    SetTwoCodePrintCount(1);
                    return(true);
                }
            }
            else
            {
                DlgHelper.ShowAlertMsgBox("二维码打印失败,请检查打印机!", true);
                return(false);
            }
        }
Пример #5
0
        private void txtBarCode_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar != 13)
            {
                if (_isScanOnefinished == true)
                {
                    txtBarCode.Text    = "";
                    _isScanOnefinished = false;
                }
                txtBarCode.Text = txtBarCode.Text + e.KeyChar;
                return;
            }
            else
            {
                _isScanOnefinished = true;
            }

            if (btnStartPutin.Enabled == true)
            {
                DlgHelper.ShowAlertMsgBox("请进行入库设置并点击开始入库后,再开始入库操作!", true);
                txtBarCode.Text = "";
                return;
            }
            var barCode = txtBarCode.Text.Trim();

            if (barCode.Length != 17)
            {
                DlgHelper.ShowAlertMsgBox("条形码长度有误!", true);
                return;
            }

            Console.Beep(5000, 1000);

            if (_recentBarcodeList.Contains(barCode))
            {
                //DlgHelper.ShowAlertMsgBox("产品编号重复!", true);
                return;
            }

            var isNumCorrect = PutInWarehouseBLL.IsSpeedChangeTypeNumRight(barCode, ((WebSpeedChangeBoxType)cbxProductType.SelectedItem).SpeedChangeBoxName);

            if (isNumCorrect == false)
            {
                DlgHelper.ShowAlertMsgBox("产品型号和当前设置的型号不一致!", true);
                return;
            }

            if ((int)lblCountStatistic.Tag >= int.Parse(txtCountLimit.Text.Trim()))
            {
                DlgHelper.ShowAlertMsgBox("已达到数量限制,不能入库!", true);
                return;
            }

            var numCheckResult = PutInWarehouseBLL.IsCurrentPutInInfoRight(barCode);

            if (numCheckResult == PutInResultEnum.仓库已经存在此货物)
            {
                DlgHelper.ShowAlertMsgBox(numCheckResult.ToString(), true);
                return;
            }
            else if (numCheckResult == PutInResultEnum.重复入库)
            {
                if (!PermissionCheckHelper.GetHighUserPermission("重复入库,需要高级权限!"))
                {
                    return;
                }
            }

            _recentBarcodeList.Add(txtBarCode.Text.Trim());

            if (_recentBarcodeList.Count == int.Parse(txtPrintCount.Text))
            {
                var saveResult = PrintTwoDimensioncode();
                if (!saveResult)
                {
                    DlgHelper.AlarmSound();
                    while (saveResult == false)
                    {
                        var dlgResult = MessageBox.Show("入库失败,请检查打印机和服务器状态后重试,点击重试!\n点击取消,需要重新入库这条二维码上的产品!", "重试", MessageBoxButtons.RetryCancel);
                        if (dlgResult == DialogResult.Retry)
                        {
                            saveResult = PrintTwoDimensioncode();
                        }
                        else
                        {
                            _recentBarcodeList.Clear();
                            return;
                        }
                    }
                }
            }

            SetCountStatisticProp((int)lblCountStatistic.Tag + 1);
        }