示例#1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            var userName = txtUserName.Text.Trim();
            var password = txtPassword.Text.Trim();

            if (string.IsNullOrWhiteSpace(userName) || string.IsNullOrWhiteSpace(password))
            {
                DlgHelper.ShowAlertMsgBox("请输入用户名或密码");
                return;
            }

            if (Membership.ValidateUser(userName, password))
            {
                var userRoles = Roles.GetRolesForUser(userName);
                if (userRoles.Contains(PermissionEnum.班长.ToString()) || userRoles.Contains(PermissionEnum.系统管理员.ToString()))
                {
                    IsCorrect         = true;
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                else
                {
                    DlgHelper.ShowAlertMsgBox("用户权限不足!");
                }
            }
            else
            {
                DlgHelper.ShowAlertMsgBox("用户名或密码错误!");
            }
        }
示例#2
0
        private void SetCountStatisticProp(int count)
        {
            lblCountStatistic.Tag = count;
            if (count > 0)
            {
                //lblAlreadyPrintCount.Text = string.Format(_alreadyPrintCount, count / int.Parse(txtPrintCount.Text));
                //if (manualAdd == true)
                //{
                //    lblAlreadyPrintCount.Text = string.Format(_alreadyPrintCount, 1 + int.Parse(txtPrintCount.Text));
                //}
                //else {
                //    lblAlreadyPrintCount.Text = string.Format(_alreadyPrintCount, -1 + int.Parse(txtPrintCount.Text));
                //}
            }
            else
            {
                lblAlreadyPrintCount.Text = string.Format(_alreadyPrintCount, 0);
            }
            lblCountStatistic.Text      = string.Format(_countStatisticStr, count);
            lblPrintCountStatistic.Text = string.Format(_printOnceCountStr, _recentBarcodeList.Count);

            dgvBarCodeList.Rows.Clear();
            int i = 1;

            foreach (var item in _recentBarcodeList)
            {
                dgvBarCodeList.Rows.Add(i++, item);
            }

            if (count > 0 && count == int.Parse(txtCountLimit.Text.Trim()))
            {
                DlgHelper.ShowAlertMsgBox("已经达到入库设置的总数量,自动停止入库!");
                btnStopPutin_Click(null, null);
            }
        }
示例#3
0
        private void dgvPutinRecord_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            int columnIndex = e.ColumnIndex;
            int rowIndex    = e.RowIndex;

            if (rowIndex == -1)
            {
                return;
            }

            var clickColumn = dgvPutinRecord.Columns[columnIndex];
            var id          = (int)dgvPutinRecord.Rows[rowIndex].Cells["RecordID"].Value;

            if (clickColumn == dgvPutinRecord.Columns["PrintTwoCode"])
            {
                var twoCode = new RemovalWarehouseBLL().TwoDimensionCodeByBarID(id);
                if (twoCode.Code > 0)
                {
                    DlgHelper.ShowAlertMsgBox(twoCode.Msg);
                    return;
                }
                var resultPrintStr = ConfigHelper.TwoCodePre + DateTime.Now.ToString() + "^" + twoCode.Data;
                new PutinWarehouse().Print(resultPrintStr);
            }
        }
示例#4
0
        private void btnMannualPrint_Click(object sender, EventArgs e)
        {
            if (!PermissionCheckHelper.GetHighUserPermission("强制打印,需要高级权限!"))
            {
                return;
            }


            if (_recentBarcodeList.Count == 0)
            {
                return;
            }
            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;
                    }
                }
            }
        }
        private void btnStartRemoval_Click(object sender, EventArgs e)
        {
            if (CheckPutinSetIsCorrect() == false)
            {
                DlgHelper.ShowAlertMsgBox("出库设置信息错误,请检查设置!", true);
                return;
            }

            var removalOrder = new WebRemovalWarehouseOrder()
            {
                SpeedChangeBoxName = ((WebSpeedChangeBoxType)cbxProductType.SelectedItem).SpeedChangeBoxName,
                DispathPlace       = cbxDispathPlace.Text,
                Staff     = txtRemovalUserName.Text,
                PlanCount = int.Parse(txtCountLimit.Text),
            };
            var result = RemovalWarehouseBLL.SaveRemalWarehouseOrder(removalOrder);

            if (result.Code > 0)
            {
                DlgHelper.ShowAlertMsgBox(result.Msg);
                return;
            }
            _currentOrderID = result.Data;

            btnRemovalSet.Enabled   = false;
            btnStartRemoval.Enabled = false;
            btnStopRemoval.Enabled  = true;

            txtBarCode.Text = "";
            SetCountStatisticText(0, true);

            txtBarCode.Focus();
        }
示例#6
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (this.ValidateChildren(ValidationConstraints.Enabled) == false)
            {
                return;
            }

            if (txtConfirmPassword.Text != txtPassword.Text)
            {
                DlgHelper.ShowAlertMsgBox("输入密码不一致,请重新输入!");
                return;
            }

            if (txtConfirmPassword.Text.Trim().Length < 6)
            {
                DlgHelper.ShowAlertMsgBox("密码长度最少是6位!");
                return;
            }

            var result = new UserBLL().ChangePassword(txtOldPassword.Text.Trim(), txtConfirmPassword.Text.Trim(), _userName);

            if (result.Code > 0)
            {
                DlgHelper.ShowAlertMsgBox(result.Msg);
                return;
            }
            else
            {
                DlgHelper.ShowSuccessBox();
                this.Close();
            }
        }
        private void dgvSpeedChangeBox_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            int columnIndex = e.ColumnIndex;
            int rowIndex    = e.RowIndex;

            if (rowIndex == -1)
            {
                return;
            }

            if (this.dgvSpeedChangeBox.Columns[columnIndex] == this.dgvSpeedChangeBox.Columns["Delete"])
            {
                var dialogResult = DlgHelper.ShowConfirmMsgBox("确定要删除吗?");
                if (dialogResult == DialogResult.Yes)
                {
                    var id     = (int)dgvSpeedChangeBox.Rows[rowIndex].Cells["SpeedChangeBoxTypeID"].Value;
                    var result = new SpeedChangeBoxTypeBLL().DelSpeedChangeBox(id);
                    if (result.Code > 0)
                    {
                        DlgHelper.ShowAlertMsgBox(result.Msg);
                        return;
                    }
                    BindData();
                }
            }
        }
示例#8
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            var departmentName = txtDepartmentName.Text.Trim();

            if (this.ValidateChildren(ValidationConstraints.Enabled) == false)
            {
                return;
            }

            CResult <bool> result;
            var            bll = new DepartmentBLL();

            if (_isEdit)
            {
                result = bll.UpdateDepartment(departmentName, _departmentID);
            }
            else
            {
                result = bll.AddDepartment(departmentName);
            }

            if (result.Code > 0)
            {
                DlgHelper.ShowAlertMsgBox(result.Msg);
                return;
            }

            this.Close();

            if (CallBack != null)
            {
                CallBack();
            }
        }
        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;
            }
            if (btnStartRemoval.Enabled == true)
            {
                DlgHelper.ShowAlertMsgBox("请进行出库设置并点击开始入库后,再开始出库操作!", true);
                txtBarCode.Text = "";
                return;
            }

            _isScanOnefinished = true;

            var twoDimensionCode  = txtBarCode.Text;
            var planTotalCount    = int.Parse(txtCountLimit.Text.Trim());
            var currentTotalCount = (int)lblCountStatistic.Tag;
            int containCount      = 0;

            var saveRemovalResult = RemovalWarehouseBLL.SaveRemalWarehouseInfo(out barCodeList, out containCount, twoDimensionCode, _currentOrderID, ((WebSpeedChangeBoxType)cbxProductType.SelectedItem).SpeedChangeBoxTypeID
                                                                               , planTotalCount, currentTotalCount);

            if (saveRemovalResult != RemovalResultEnum.执行成功)
            {
                if (saveRemovalResult == RemovalResultEnum.变速箱型号不一致)
                {
                    //报警
                    new AlarmForm(RemovalResultEnum.变速箱型号不一致.ToString(), AlarmType.出库报警).ShowDialog();
                    return;
                }
                else if (saveRemovalResult == RemovalResultEnum.当前出库数量已经大于设置的出库数量)
                {
                    new AlarmForm(RemovalResultEnum.当前出库数量已经大于设置的出库数量.ToString(), AlarmType.出库报警).ShowDialog();
                    var dlgResult = DlgHelper.ShowConfirmMsgBox("是否继续将超出的数量出库?");
                    if (dlgResult == DialogResult.Yes)
                    {
                        RemovalWarehouseBLL.SaveRemalWarehouseInfo(out barCodeList, out containCount, twoDimensionCode, _currentOrderID, ((WebSpeedChangeBoxType)cbxProductType.SelectedItem).SpeedChangeBoxTypeID
                                                                   , planTotalCount, currentTotalCount, true);
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    DlgHelper.ShowAlertMsgBox(saveRemovalResult.ToString(), true);
                    return;
                }
            }
            SetCountStatisticText(containCount, false);
        }
示例#10
0
        private void btnChangeUser_Click(object sender, EventArgs e)
        {
            var result = DlgHelper.ShowConfirmMsgBox("是否切换用户?");

            if (result == DialogResult.Yes)
            {
                this.Dispose();
                new UserLoginForm().ShowDialog();
            }
        }
示例#11
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (this.ValidateChildren(ValidationConstraints.Enabled) == false)
            {
                return;
            }
            if (txtConfirmPassword.Text != txtPassword.Text)
            {
                DlgHelper.ShowAlertMsgBox("输入密码不一致,请重新输入!");
                return;
            }

            if (txtConfirmPassword.Text.Trim().Length < 6)
            {
                DlgHelper.ShowAlertMsgBox("密码长度最少是6位!");
                return;
            }

            if (cbxDepartment.SelectedValue == null)
            {
                DlgHelper.ShowAlertMsgBox("请选择部门!");
                return;
            }

            var userInfo = new WebUserInfo()
            {
                DepartmentID    = (int)cbxDepartment.SelectedValue,
                Adress          = txtAddress.Text.Trim(),
                ConfirmPassWord = txtConfirmPassword.Text.Trim(),
                PassWord        = txtPassword.Text.Trim(),
                Phone           = txtPhone.Text.Trim(),
                UserName        = txtUserName.Text.Trim(),
                IsMonitor       = ckBoxIsMonitor.Checked,
                IsPutinMan      = ckBoxIsPutinMan.Checked,
                IsRemovalMan    = ckBoxIsRemovalMan.Checked,
            };

            var result = new UserBLL().AddUser(userInfo);

            if (result.Code > 0)
            {
                DlgHelper.ShowAlertMsgBox(result.Msg);
                return;
            }
            else
            {
                DlgHelper.ShowAlertMsgBox("创建用户成功!");
                this.Close();
            }

            if (CallBack != null)
            {
                CallBack();
            }
        }
示例#12
0
        private void dgvUserList_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            int columnIndex = e.ColumnIndex;
            int rowIndex    = e.RowIndex;

            if (rowIndex == -1)
            {
                return;
            }

            var clickColumn = dgvUserList.Columns[columnIndex];
            var id          = (int)dgvUserList.Rows[rowIndex].Cells["ID"].Value;

            if (clickColumn == dgvUserList.Columns["Delete"])
            {
                var dialogResult = DlgHelper.ShowConfirmMsgBox("确定要删除吗?");
                if (dialogResult == DialogResult.Yes)
                {
                    var result = new UserBLL().DeleteUserByID(id);
                    if (result.Code > 0)
                    {
                        DlgHelper.ShowAlertMsgBox(result.Msg);
                        return;
                    }
                    BindData();
                }
            }
            else if (clickColumn == this.dgvUserList.Columns["Edit"])
            {
                var departmentForm = new UserEditForm(true, id);
                departmentForm.CallBack += BindData;

                departmentForm.ShowDialog();
            }
            else if (clickColumn == dgvUserList.Columns["IsMonitor"])
            {
                var  checkBox = (DataGridViewCheckBoxCell)dgvUserList.Rows[rowIndex].Cells[columnIndex];
                bool value    = (bool)checkBox.EditingCellFormattedValue;
            }
            else if (clickColumn == dgvUserList.Columns["IsPutinMan"])
            {
                var  checkBox = (DataGridViewCheckBoxCell)dgvUserList.Rows[rowIndex].Cells[columnIndex];
                bool value    = (bool)checkBox.EditingCellFormattedValue;
            }
            else if (clickColumn == dgvUserList.Columns["IsRemovalMan"])
            {
                var  checkBox = (DataGridViewCheckBoxCell)dgvUserList.Rows[rowIndex].Cells[columnIndex];
                bool value    = (bool)checkBox.EditingCellFormattedValue;
            }
            else if (clickColumn == dgvUserList.Columns["ReSetPassword"])
            {
                new ReNewPasswordForm(id).ShowDialog();
            }
        }
示例#13
0
        private void BindData()
        {
            var result = new UserBLL().GetUserInfoListByDepartment(MainForm.CurrentUserName);

            if (result.Code > 0)
            {
                DlgHelper.ShowAlertMsgBox(result.Msg);
                return;
            }

            dgvUserList.DataSource = result.Data;
        }
示例#14
0
        private void OrderDetailForm_Load(object sender, EventArgs e)
        {
            int totalCount = 0;
            var result     = new RemovalWarehouseBLL().GetRemovalWarehouseInfoListByOrderID(_orderID, out totalCount, "", 1, -1);

            if (result.Code > 0)
            {
                DlgHelper.ShowAlertMsgBox(result.Msg);
                return;
            }
            dgvRemovalOrderDetailRecord.AutoGenerateColumns = false;
            dgvRemovalOrderDetailRecord.DataSource          = result.Data;
        }
示例#15
0
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (e.CloseReason != CloseReason.ApplicationExitCall)
            {
                e.Cancel = true;
                Application.Exit();
                return;
            }
            var result = DlgHelper.ShowConfirmMsgBox("是否要退出系统?", false);

            if (result != DialogResult.Yes)
            {
                e.Cancel = true;
            }
        }
示例#16
0
        private void btnStopPutin_Click(object sender, EventArgs e)
        {
            if (_recentBarcodeList.Count > 0)
            {
                var result = DlgHelper.ShowConfirmMsgBox("是否打印二维码?");
                if (result == DialogResult.Yes)
                {
                    if (_recentBarcodeList.Count != int.Parse(txtPrintCount.Text.Trim()))
                    {
                        if (PermissionCheckHelper.GetHighUserPermission("打印不满数量设置的二维码,需要高级权限"))
                        {
                            var saveResult = PrintTwoDimensioncode();
                            while (saveResult == false)
                            {
                                var dlgResult = MessageBox.Show("入库失败,请检查打印机和服务器状态后重试,点击重试!\n点击取消,需要重新入库这条二维码上的产品!", "重试", MessageBoxButtons.RetryCancel);
                                if (dlgResult == DialogResult.Retry)
                                {
                                    saveResult = PrintTwoDimensioncode();
                                }
                                else
                                {
                                    _recentBarcodeList.Clear();
                                    return;
                                }
                            }
                        }
                        else
                        {
                            int removeCount = _recentBarcodeList.Count;
                            _recentBarcodeList.Clear();
                            SetCountStatisticProp((int)lblCountStatistic.Tag - removeCount);
                            DlgHelper.ShowAlertMsgBox("此货架上的货物没有入库,请重新扫描入库!");
                        }
                    }
                }
                else
                {
                    int removeCount = _recentBarcodeList.Count;
                    _recentBarcodeList.Clear();
                    SetCountStatisticProp((int)lblCountStatistic.Tag - removeCount);
                    DlgHelper.ShowAlertMsgBox("此货架上的货物没有入库,请重新扫描入库!");
                }
            }

            btnStopPutin.Enabled  = false;
            btnStartPutin.Enabled = true;
            btnPutinSet.Enabled   = true;
        }
示例#17
0
        private bool WriteConfigToFile()
        {
            if (CheckPutinSetIsCorrect() == false)
            {
                DlgHelper.ShowAlertMsgBox("出库设置信息错误,请检查设置!", true);
                return(false);
            }
            ;
            var filePath = FileHelper.MakeSureFileExist(SystemInfo.RemovalConfigFile);

            using (var writer = new StreamWriter(filePath, false)) {
                writer.WriteLine(((WebSpeedChangeBoxType)cbxProductType.SelectedItem).SpeedChangeBoxName);
                writer.WriteLine(txtCountLimit.Text);
                writer.WriteLine(cbxDispathPlace.Text);
                return(true);
            }
        }
示例#18
0
        public AlarmForm(string alarmContent, AlarmType alarmType)
        {
            InitializeComponent();

            richTextBoxAlarmContent.Text = alarmContent;
            var alarm = new WebAlarm()
            {
                AlarmContent = alarmContent,
                AlarmTypeInt = (int)alarmType,
                Operator     = MainForm.CurrentUserName,
            };
            var result = new AlarmBLL().AddAlarm(alarm);

            if (result.Code > 0)
            {
                DlgHelper.ShowAlertMsgBox(result.Msg);
            }
        }
        private void BindData()
        {
            dgvSpeedChangeBox.Rows.Clear();
            var depBLL = new SpeedChangeBoxTypeBLL();
            var result = depBLL.GetSpeedChangeBoxList();

            if (result.Code > 0)
            {
                DlgHelper.ShowAlertMsgBox(result.Msg);
                return;
            }
            int i = 1;

            foreach (var item in result.Data)
            {
                dgvSpeedChangeBox.Rows.Add(item.SpeedChangeBoxTypeID, i++, item.SpeedChangeBoxName);
            }
        }
示例#20
0
        private void btnStartPutin_Click(object sender, EventArgs e)
        {
            //AlarmHelper.StartAlarm();

            if (CheckPutinSetIsCorrect() == false)
            {
                DlgHelper.ShowAlertMsgBox("入库设置信息错误,请检查设置!", true);
                return;
            }

            btnPutinSet.Enabled   = false;
            btnStartPutin.Enabled = false;
            btnStopPutin.Enabled  = true;

            txtBarCode.Text = "";
            _recentBarcodeList.Clear();
            SetCountStatisticProp(0);

            txtBarCode.Focus();
        }
        public static bool GetHighUserPermission(string msg)
        {
            if (MainForm.CurrentUserRoles.Contains(PermissionEnum.班长.ToString()) ||
                MainForm.CurrentUserRoles.Contains(PermissionEnum.系统管理员.ToString()))
            {
                return(true);
            }

            var hasPermission  = false;
            var permissionForm = new PermissionCheckForm(msg);

            if (permissionForm.ShowDialog() == DialogResult.OK)
            {
                hasPermission = permissionForm.IsCorrect;
            }
            else
            {
                DlgHelper.ShowAlertMsgBox("没有高级权限!");
            }
            return(hasPermission);
        }
示例#22
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            var userName = cbxUserNameList.Text.Trim();
            var password = txtPassword.Text.Trim();

            if (string.IsNullOrWhiteSpace(userName) || string.IsNullOrWhiteSpace(password))
            {
                DlgHelper.ShowAlertMsgBox("请输入用户名或密码");
                return;
            }

            if (Membership.ValidateUser(userName, password))
            {
                WriteRemberUserName();
                this.Visible = false;
                new MainForm(userName).ShowDialog();
            }
            else
            {
                DlgHelper.ShowAlertMsgBox("用户名或密码错误!");
                return;
            }
        }
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txtProductName.Text.Trim()))
            {
                DlgHelper.ShowAlertMsgBox("请填写产品型号!");
                return;
            }

            var result = new SpeedChangeBoxTypeBLL().AddSpeedChangeBoxType(txtProductName.Text.Trim());

            if (result.Code > 0)
            {
                DlgHelper.ShowAlertMsgBox(result.Msg);
                return;
            }

            if (CallBack != null)
            {
                CallBack();
            }

            this.Dispose();
        }
示例#24
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);
            }
        }
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            int columnIndex = e.ColumnIndex;
            int rowIndex    = e.RowIndex;

            if (rowIndex == -1)
            {
                return;
            }

            if (this.dgvDepartment.Columns[columnIndex] == this.dgvDepartment.Columns["Delete"])
            {
                var dialogResult = DlgHelper.ShowConfirmMsgBox("确定要删除吗?");
                if (dialogResult == DialogResult.Yes)
                {
                    var id     = (int)dgvDepartment.Rows[rowIndex].Cells["DepartmentID"].Value;
                    var result = new DepartmentBLL().DeleteDepartmentByID(id);
                    if (result.Code > 0)
                    {
                        DlgHelper.ShowAlertMsgBox(result.Msg);
                        return;
                    }
                    BindData();
                }
            }
            else if (this.dgvDepartment.Columns[columnIndex] == this.dgvDepartment.Columns["Edit"])
            {
                var id   = (int)dgvDepartment.Rows[rowIndex].Cells["DepartmentID"].Value;
                var name = dgvDepartment.Rows[rowIndex].Cells["DepartmentName"].Value.ToString();

                var departmentForm = new AddDepartmentForm(true, id, name);
                departmentForm.CallBack += BindData;

                departmentForm.ShowDialog();
            }
        }
示例#26
0
        private void SetCountStatisticText(int addCount, bool clearCount = false)
        {
            if (clearCount == true)
            {
                lblCountStatistic.Tag   = 0;
                lblAlreadySacnCount.Tag = 0;
            }
            else
            {
                if (addCount > 0)
                {
                    lblAlreadySacnCount.Tag = (int)lblAlreadySacnCount.Tag + 1;
                }
                lblCountStatistic.Tag = (int)lblCountStatistic.Tag + addCount;
            }

            //dgvBarCodeList.Rows.Clear();
            dgvBarCodeList.DataSource = barCodeList;
            int i = 1;

            foreach (DataGridViewRow row in dgvBarCodeList.Rows)
            {
                row.Cells[0].Value = i++;
            }

            lblAlreadySacnCount.Text = string.Format(_alreadyPrintCount, lblAlreadySacnCount.Tag);
            lblCountStatistic.Text   = string.Format(_countStatisticStr, lblCountStatistic.Tag);

            var totalCount = (int)lblCountStatistic.Tag;

            if (totalCount > 0 && totalCount >= int.Parse(txtCountLimit.Text.Trim()))
            {
                DlgHelper.ShowAlertMsgBox("已经达到出库设置的总数量,自动停止出库!", true);
                btnStopRemoval_Click(null, null);
            }
        }
示例#27
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            if (this.ValidateChildren(ValidationConstraints.Enabled) == false)
            {
                return;
            }

            if (_editOrView == true)
            {
                var userInfo = new WebUserInfo()
                {
                    ID           = _userID,
                    UserName     = txtUserName.Text.Trim(),
                    Adress       = txtAddress.Text.Trim(),
                    Phone        = txtPhone.Text.Trim(),
                    IsMonitor    = ckBoxIsMonitor.Checked,
                    IsRemovalMan = ckBoxIsRemovalMan.Checked,
                    IsPutinMan   = ckBoxIsPutinMan.Checked,
                };
                var result = new UserBLL().UpdateUser(userInfo);
                if (result.Code > 0)
                {
                    DlgHelper.ShowAlertMsgBox(result.Msg);
                    return;
                }
                else
                {
                    DlgHelper.ShowSuccessBox();
                    this.Close();
                    if (CallBack != null)
                    {
                        CallBack();
                    }
                }
            }
        }
示例#28
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);
        }
示例#29
0
 private void PermissionCheckForm_Load(object sender, EventArgs e)
 {
     DlgHelper.AlarmSound();
 }
示例#30
0
        private void InitControls()
        {
            var departments = new DepartmentBLL().GetAllDepartment();

            cbxDepartment.DataSource    = departments;
            cbxDepartment.ValueMember   = "DepartmentID";
            cbxDepartment.DisplayMember = "DepartmentName";
            if (cbxDepartment.Items.Count > 0)
            {
                cbxDepartment.SelectedIndex = 0;
            }

            var result = new UserBLL().GetUserInfoByUserID(_userID);

            if (result.Code > 0)
            {
                DlgHelper.ShowAlertMsgBox(result.Msg);
                return;
            }
            else
            {
                var userInfo = result.Data;
                txtAddress.Text  = userInfo.Adress;
                txtPhone.Text    = userInfo.Phone;
                txtUserName.Text = userInfo.UserName;
                if (userInfo.DepartmentID != null)
                {
                    cbxDepartment.SelectedValue = userInfo.DepartmentID;
                }
                ckBoxIsMonitor.Checked    = userInfo.IsMonitor;
                ckBoxIsPutinMan.Checked   = userInfo.IsPutinMan;
                ckBoxIsRemovalMan.Checked = userInfo.IsRemovalMan;

                _isSelf = MainForm.CurrentUserName == userInfo.UserName;
            }

            if (_editOrView == false)
            {
                cbxDepartment.Enabled     = false;
                txtAddress.Enabled        = false;
                txtPhone.Enabled          = false;
                txtUserName.Enabled       = false;
                btnConfirm.Visible        = false;
                ckBoxIsMonitor.Enabled    = false;
                ckBoxIsRemovalMan.Enabled = false;
                ckBoxIsPutinMan.Enabled   = false;
            }

            if (MainForm.CurrentUserRoles.Contains(PermissionEnum.系统管理员.ToString()))
            {
                ckBoxIsMonitor.Enabled    = false;
                ckBoxIsRemovalMan.Enabled = false;
                ckBoxIsPutinMan.Enabled   = false;
            }
            else if (MainForm.CurrentUserRoles.Contains(PermissionEnum.班长.ToString()))
            {
                ckBoxIsMonitor.Visible = false;
            }

            if (_isSelf && _editOrView != false)
            {
                ckBoxIsMonitor.Visible    = false;
                ckBoxIsRemovalMan.Visible = false;
                ckBoxIsPutinMan.Visible   = false;
                lblPermisson.Visible      = false;
            }
        }