Пример #1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            string wareHouse = WareHouseHelper.GetWareHouse(LoginUserInfo.ID, LoginUserInfo.Name)[0].Value;

            //低库存预警检查
            bool lowWarning = BLLFactory <Stock> .Instance.CheckStockLowWarning(wareHouse);

            if (lowWarning)
            {
                string message = string.Format("{0} 库存已经处于低库存预警状态\r\n请及时补充库存", wareHouse);
                WareHouseHelper.Notify(string.Format("{0} 低库存预警", wareHouse), message);
            }

            //超库存预警检查
            bool highWarning = BLLFactory <Stock> .Instance.CheckStockHighWarning(wareHouse);

            if (highWarning)
            {
                string message = string.Format("{0} 库存量已经高过超预警库存量\r\n请注意减少库存积压", wareHouse);
                WareHouseHelper.Notify(string.Format("{0} 超库存预警", wareHouse), message);
            }

            if (!lowWarning && !highWarning)
            {
                string message = string.Format("暂无相关的系统提示信息");
                WareHouseHelper.Notify(message, message);
            }
        }
Пример #2
0
        private void InitDictItem()
        {
            this.txtCreateDate.DateTime = DateTime.Now;
            //this.dtStart.DateTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 00:00:00"));
            //this.dtEnd.DateTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 23:59:59"));

            this.txtManufacture.BindDictItems("供货商");
            this.txtSearchManufacture.BindDictItems("供货商");
            this.txtSearchDept.BindDictItems("部门");

            this.txtWareHouse.Properties.Items.Clear();
            this.txtWareHouse.Properties.Items.AddRange(WareHouseHelper.GetWareHouse(LoginUserInfo.ID, LoginUserInfo.Name).ToArray());
            this.txtWareHouse.SelectedIndex = 0;

            this.txtSearchWareHouse.Properties.Items.Clear();
            this.txtSearchWareHouse.Properties.Items.Add(new CListItem("所有仓库", ""));
            this.txtSearchWareHouse.Properties.Items.AddRange(WareHouseHelper.GetWareHouse(LoginUserInfo.ID, LoginUserInfo.Name).ToArray());
            this.txtSearchWareHouse.SelectedIndex = 0;

            this.txtCreator.Items.Clear();
            this.txtCreator.Items.Add(this.LoginUserInfo.FullName);
            this.txtCreator.SelectedIndex = this.txtCreator.FindString(this.LoginUserInfo.FullName);

            this.txtHandNo.Text = BLLFactory <PurchaseHeader> .Instance.GetHandNumber(true);//进货单号

            this.txtCreateDate.Enabled = false;
        }
        private void btnAdvanceSearch_Click(object sender, EventArgs e)
        {
            if (dlg == null)
            {
                dlg = new FrmAdvanceSearch();
                dlg.FieldTypeTable = BLLFactory <ItemDetail> .Instance.GetFieldTypeList();

                dlg.DisplayColumns  = "ID,ItemNo,ItemName,Manufacture,MapNo,Specification,Material,ItemBigType,ItemType,Unit,Price,Source,StoragePos,UsagePos,StockQuantity,AlarmQuantity,Note,Dept,WareHouse";
                dlg.ColumnNameAlias = BLLFactory <ItemDetail> .Instance.GetColumnNameAlias();//字段列显示名称转义

                #region  拉列表数据

                dlg.AddColumnListItem("Manufacture", WareHouseHelper.GetDictData("供货商"));
                dlg.AddColumnListItem("ItemBigType", WareHouseHelper.GetDictData("备件属类"));
                dlg.AddColumnListItem("ItemType", WareHouseHelper.GetDictData("备件类别"));
                dlg.AddColumnListItem("Source", WareHouseHelper.GetDictData("来源"));
                dlg.AddColumnListItem("Dept", WareHouseHelper.GetDictData("部门"));

                dlg.AddColumnListItem("Material", BLLFactory <ItemDetail> .Instance.GetFieldList("Material"));
                dlg.AddColumnListItem("Specification", BLLFactory <ItemDetail> .Instance.GetFieldList("Specification"));
                dlg.AddColumnListItem("Unit", BLLFactory <ItemDetail> .Instance.GetFieldList("Unit"));

                List <CListItem> wareList = BLLFactory <WareHouse> .Instance.GetAllWareHouse();

                dlg.AddColumnListItem("WareHouse", wareList);

                //dlg.AddColumnListItem("Sex", "男,女");

                #endregion

                dlg.ConditionChanged += new FrmAdvanceSearch.ConditionChangedEventHandler(dlg_ConditionChanged);
            }
            dlg.ShowDialog();
        }
Пример #4
0
        /// <summary>
        /// 初始化数据字典
        /// </summary>
        private void InitDictItem()
        {
            this.txtManufacture.BindDictItems("供货商");
            this.txtBigType.BindDictItems("备件属类");
            this.txtItemType.BindDictItems("备件类别");
            this.txtUnit.BindDictItems("单位");
            this.txtSource.BindDictItems("来源");
            this.txtUsagePos.BindDictItems("使用位置");
            this.txtUsagePos.SelectedIndex = 0;
            this.txtBelongDept.BindDictItems("部门");

            //其他绑定方式
            this.txtBelongWareHouse.Properties.Items.Clear();
            this.txtBelongWareHouse.Properties.Items.AddRange(WareHouseHelper.GetWareHouse(LoginUserInfo.ID, LoginUserInfo.Name).ToArray());
            this.txtBelongWareHouse.SelectedIndex = 0;
        }
        private void InitWareHouseInfo(TreeNode node)
        {
            List <CListItem> wareHouseList = WareHouseHelper.GetWareHouse(LoginUserInfo.ID, LoginUserInfo.Name);

            foreach (CListItem item in wareHouseList)
            {
                string condition = string.Format(" where t.WareHouse = '{0}' ", item.Value);
                int    count     = BLLFactory <Stock> .Instance.GetCurrentStockReportCount(condition);

                string displayText = string.Format("{0}({1})", item.Value, count);

                TreeNode subNode = new TreeNode(displayText, 1, 1);
                subNode.Tag = new CustomTreeData(CustomTreeType.Ware, item.Value);

                node.Nodes.Add(subNode);
            }
        }
        private void SetColumnAliasForm_Load(object sender, EventArgs e)
        {
            //SetColumnAliasForm form = new SetColumnAliasForm();
            const int heightEvery    = 25; //每行元素的高度
            const int reservedLength = 60; //最后按钮修改预留的高度
            int       elementsHeight = WareHouseDict.Count * heightEvery;

            int newHeight = Size.Height;

            if ((elementsHeight + reservedLength) > Size.Height)
            {
                newHeight = elementsHeight + reservedLength;
            }
            Size = new System.Drawing.Size(Size.Width, newHeight);

            foreach (string key in WareHouseDict.Keys)
            {
                Label lblColumName = new Label();
                lblColumName.Font      = new Font("宋体", 11f, FontStyle.Bold);
                lblColumName.ForeColor = Color.Blue;
                lblColumName.Anchor    = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top)
                                                                                | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right)));
                lblColumName.Text = string.Format("库房编号:{0}", key);

                ComboBox txtWareHouse = new ComboBox();
                txtWareHouse.DropDownStyle = ComboBoxStyle.DropDownList;
                txtWareHouse.Name          = key;
                txtWareHouse.Tag           = key;
                txtWareHouse.Items.Clear();
                txtWareHouse.Items.AddRange(WareHouseHelper.GetWareHouse(LoginUserInfo.ID, LoginUserInfo.Name).ToArray());
                //txtWareHouse.SelectedIndex = 0;

                txtWareHouse.Size   = new System.Drawing.Size(200, 25);
                txtWareHouse.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top)
                                                                             | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right)));

                tableLayoutPanel1.Controls.Add(lblColumName);
                tableLayoutPanel1.Controls.Add(txtWareHouse);
            }
        }
Пример #7
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            #region 验证输入

            //检查是否可以入库出库
            for (int i = 0; i < this.lvwDetail.Items.Count; i++)
            {
                PurchaseDetailInfo detailInfo = this.lvwDetail.Items[i].Tag as PurchaseDetailInfo;
                if (detailInfo != null)
                {
                    bool isInit = BLLFactory <Stock> .Instance.CheckIsInitedWareHouse(this.txtWareHouse.Text, detailInfo.ItemNo);

                    if (!isInit)
                    {
                        if (MessageDxUtil.ShowYesNoAndTips(string.Format("备件项目【{0}】在库房【{1}】还没有期初建账,您是否要进行期初建账,初始化库存为0?\r\n按【是】初始化库房并继续,按【否】退出。",
                                                                         detailInfo.ItemNo, this.txtWareHouse.Text)) == DialogResult.No)
                        {
                            return;
                        }
                        else
                        {
                            ItemDetailInfo itemInfo = new ItemDetailInfo();
                            itemInfo.ItemNo      = detailInfo.ItemNo;
                            itemInfo.ItemName    = detailInfo.ItemName;
                            itemInfo.ItemBigType = detailInfo.ItemBigType;
                            itemInfo.ItemType    = detailInfo.ItemType;

                            BLLFactory <Stock> .Instance.InitStockQuantity(itemInfo, 0, this.txtWareHouse.Text);
                        }
                    }
                }
            }

            if (this.txtHandNo.Text.Trim() == "")
            {
                MessageDxUtil.ShowTips("货单编号不能为空");
                this.txtHandNo.Focus();
                return;
            }
            else if (this.txtManufacture.Text.Trim() == "")
            {
                MessageDxUtil.ShowTips("请选择供应商");
                this.txtManufacture.Focus();
                return;
            }
            else if (this.txtWareHouse.Text.Trim() == "")
            {
                MessageDxUtil.ShowTips("请选择仓库");
                this.txtWareHouse.Focus();
                return;
            }
            else if (this.lvwDetail.Items.Count == 0)
            {
                MessageDxUtil.ShowTips("请添加商品");
                return;
            }
            else if (this.txtCreator.Text.Length == 0)
            {
                MessageDxUtil.ShowTips("请选择经手人");
                this.txtCreator.Focus();
                return;
            }
            #endregion

            try
            {
                PurchaseHeaderInfo headInfo = new PurchaseHeaderInfo();
                headInfo.CreateDate    = txtCreateDate.DateTime;
                headInfo.Creator       = this.txtCreator.Text;
                headInfo.HandNo        = this.txtHandNo.Text;
                headInfo.Manufacture   = this.txtManufacture.Text;
                headInfo.Note          = this.txtNote.Text;
                headInfo.OperationType = "入库";
                headInfo.WareHouse     = this.txtWareHouse.Text;
                headInfo.CreateYear    = DateTime.Now.Year;
                headInfo.CreateMonth   = DateTime.Now.Month;

                int headId = BLLFactory <PurchaseHeader> .Instance.Insert2(headInfo);

                if (headId > 0)
                {
                    for (int i = 0; i < this.lvwDetail.Items.Count; i++)
                    {
                        PurchaseDetailInfo detailInfo = this.lvwDetail.Items[i].Tag as PurchaseDetailInfo;
                        if (detailInfo != null)
                        {
                            detailInfo.PurchaseHead_ID = headId;
                            BLLFactory <PurchaseDetail> .Instance.Insert(detailInfo);

                            AddStockQuantity(detailInfo);//增加库存
                        }
                    }

                    MessageDxUtil.ShowTips("保存成功");
                    ClearContent();

                    //超库存预警检查
                    bool highWarning = BLLFactory <Stock> .Instance.CheckStockHighWarning(this.txtWareHouse.Text);

                    if (highWarning)
                    {
                        string message = string.Format("{0} 库存量已经高过超预警库存量\r\n请注意减少库存积压", this.txtWareHouse.Text);
                        WareHouseHelper.Notify(string.Format("{0} 超库存预警", this.txtWareHouse.Text), message);
                    }
                }
                else
                {
                    MessageDxUtil.ShowError("保存失败");
                }
            }
            catch (Exception ex)
            {
                LogTextHelper.Error(ex);
                MessageDxUtil.ShowError(ex.Message);
            }
        }
Пример #8
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            #region 验证输入

            //检查是否可以入库出库
            for (int i = 0; i < this.lvwDetail.Items.Count; i++)
            {
                PurchaseDetailInfo detailInfo = this.lvwDetail.Items[i].Tag as PurchaseDetailInfo;
                if (detailInfo != null)
                {
                    bool isInit = BLLFactory <Stock> .Instance.CheckIsInitedWareHouse(this.txtWareHouse.Text, detailInfo.ItemNo);

                    if (!isInit)
                    {
                        MessageDxUtil.ShowTips(string.Format("备件项目【{0}】在库房【{1}】还没有期初建账,请先在备件信息管理中进行期初建账。", detailInfo.ItemNo, this.txtWareHouse.Text));
                        return;
                    }
                }
            }

            if (this.txtHandNo.Text.Trim() == "")
            {
                MessageDxUtil.ShowTips("货单编号不能为空");
                this.txtHandNo.Focus();
                return;
            }
            else if (this.txtManufacture.Text.Trim() == "")
            {
                MessageDxUtil.ShowTips("请选择供应商");
                this.txtManufacture.Focus();
                return;
            }
            else if (this.txtCostCenter.Text.Trim() == "")
            {
                MessageDxUtil.ShowTips("请选择成本中心");
                this.txtCostCenter.Focus();
                return;
            }
            else if (this.txtWareHouse.Text.Trim() == "")
            {
                MessageDxUtil.ShowTips("请选择仓库");
                this.txtWareHouse.Focus();
                return;
            }
            else if (this.lvwDetail.Items.Count == 0)
            {
                MessageDxUtil.ShowTips("请添加商品");
                return;
            }
            else if (this.txtCreator.Text.Length == 0)
            {
                MessageDxUtil.ShowTips("请选择经手人");
                this.txtCreator.Focus();
                return;
            }
            else if (this.txtPickingPeople.Text.Length == 0)
            {
                MessageDxUtil.ShowTips("请输入领料人");
                this.txtPickingPeople.Focus();
                return;
            }
            #endregion

            try
            {
                PurchaseHeaderInfo headInfo = new PurchaseHeaderInfo();
                headInfo.CreateDate    = txtCreateDate.DateTime;
                headInfo.Creator       = this.txtCreator.Text;
                headInfo.HandNo        = this.txtHandNo.Text;
                headInfo.Manufacture   = this.txtManufacture.Text;
                headInfo.Note          = this.txtNote.Text;
                headInfo.OperationType = "出库";
                headInfo.WareHouse     = this.txtWareHouse.Text;
                headInfo.CostCenter    = this.txtCostCenter.Text;
                headInfo.CreateYear    = DateTime.Now.Year;
                headInfo.CreateMonth   = DateTime.Now.Month;
                //领料人
                headInfo.PickingPeople = this.txtPickingPeople.Text;

                int headId = BLLFactory <PurchaseHeader> .Instance.Insert2(headInfo);

                if (headId > 0)
                {
                    for (int i = 0; i < this.lvwDetail.Items.Count; i++)
                    {
                        PurchaseDetailInfo detailInfo = this.lvwDetail.Items[i].Tag as PurchaseDetailInfo;
                        if (detailInfo != null)
                        {
                            detailInfo.PurchaseHead_ID = headId;
                            BLLFactory <PurchaseDetail> .Instance.Insert(detailInfo);

                            AddStockQuantity(detailInfo);//增加库存
                        }
                    }

                    MessageDxUtil.ShowTips("保存成功");
                    ClearContent();

                    //低库存预警检查
                    bool lowWarning = BLLFactory <Stock> .Instance.CheckStockLowWarning(this.txtWareHouse.Text);

                    if (lowWarning)
                    {
                        string message = string.Format("{0} 库存已经处于低库存预警状态\r\n请及时补充库存", this.txtWareHouse.Text);
                        WareHouseHelper.Notify(string.Format("{0} 低库存预警", this.txtWareHouse.Text), message);
                    }
                }
                else
                {
                    MessageDxUtil.ShowError("保存失败");
                }
            }
            catch (Exception ex)
            {
                LogTextHelper.Error(ex);
                MessageDxUtil.ShowError(ex.Message);
            }
        }