Ejemplo n.º 1
0
        /// <summary>
        /// 刷新控件
        /// </summary>
        private void RefreshControl()
        {
            if (dataGridView1.Rows.Count == 0)
            {
                return;
            }

            if (dataGridView1.SelectedRows.Count == 0)
            {
                dataGridView1.Rows[0].Selected = true;
            }

            View_S_Stock stockInfo = (from r in m_stockInfo
                                      where r.序号 == (int)dataGridView1.SelectedRows[0].Cells[0].Value
                                      select r).Single();

            txtCode.Text            = stockInfo.图号型号;
            txtName.Text            = stockInfo.物品名称;
            txtSpec.Text            = stockInfo.规格;
            txtProvider.Text        = stockInfo.供货单位;
            txtProviderBatchNo.Text = stockInfo.供方批次号;
            txtBatchNo.Text         = stockInfo.批次号;
            txtVersion.Text         = stockInfo.版次号;
            numCount.Value          = (decimal)stockInfo.库存数量;
            txtMaterialType.Text    = stockInfo.材料类别编码;
            txtMaterialType.Tag     = stockInfo.材料类别编码;
            txtShelf.Text           = stockInfo.货架;
            txtColumn.Text          = stockInfo.列;
            txtLayer.Text           = stockInfo.层;
            numFactUnitPrice.Value  = (decimal)stockInfo.实际单价;
            numFactPrice.Value      = (decimal)stockInfo.实际金额;
            cmbUnit.Text            = stockInfo.单位;
            cmbGoodsStatus.Text     = stockInfo.物品状态;
            dateTimeInDepot.Value   = stockInfo.入库时间;
            cmbStorage.Text         = UniversalFunction.GetStorageName(stockInfo.库房代码);

            if (stockInfo.备注 != null)
            {
                txtRemark.Text = stockInfo.备注;
            }
            else
            {
                txtRemark.Text = "";
            }
        }
        /// <summary>
        /// 检查业务中是否存在此物品相关信息
        /// </summary>
        /// <param name="id">物品ID</param>
        /// <param name="prompt">存在时返回的提示信息</param>
        /// <returns>存在返回true, 不存在返回false</returns>
        public bool IsExistInBusiness(int id, out string prompt)
        {
            prompt = null;

            IStoreServer storeServer = ServerModuleFactory.GetServerModule <IStoreServer>();
            View_S_Stock storeData   = storeServer.GetGoodsStore(id);

            if (storeServer != null)
            {
                prompt = "库存中存在此物品的相关信息";
                return(true);
            }

            ICheckOutInDepotServer cs = ServerModuleFactory.GetServerModule <ICheckOutInDepotServer>();

            if (cs.IsExist(id))
            {
                prompt = "报检入库单中存在此物品的相关信息";
                return(true);
            }

            IOrdinaryInDepotGoodsBill og = ServerModuleFactory.GetServerModule <IOrdinaryInDepotGoodsBill>();

            if (og.IsExist(id))
            {
                prompt = "普通入库单中存在此物品的相关信息";
                return(true);
            }

            IHomemadePartInDepotServer hs = ServerModuleFactory.GetServerModule <IHomemadePartInDepotServer>();

            if (hs.IsExist(id))
            {
                prompt = "自制件入库单中存在此物品的相关信息";
                return(true);
            }

            return(false);
        }
        private void dataGridView1_Click(object sender, EventArgs e)
        {
            if (dataGridView1.CurrentRow == null)
            {
                return;
            }
            else
            {
                txtName.Text          = dataGridView1.CurrentRow.Cells["物品名称"].Value.ToString();
                txtName.Tag           = dataGridView1.CurrentRow.Cells["物品ID"].Value.ToString();
                txtSpec.Text          = dataGridView1.CurrentRow.Cells["规格"].Value.ToString();
                txtCode.Text          = dataGridView1.CurrentRow.Cells["图号型号"].Value.ToString();
                txtCode.Tag           = Convert.ToBoolean(dataGridView1.CurrentRow.Cells["是否为客户责任"].Value);
                txtBatchNo.Text       = dataGridView1.CurrentRow.Cells["批次号"].Value.ToString();
                txtBatchNo.Tag        = dataGridView1.CurrentRow.Cells["单位"].Value.ToString();
                numPickingCount.Value = Convert.ToDecimal(dataGridView1.CurrentRow.Cells["领用数量"].Value);
                numPickingCount.Tag   = Convert.ToDecimal(dataGridView1.CurrentRow.Cells["单价"].Value);
                txtRemark.Text        = dataGridView1.CurrentRow.Cells["备注"].Value.ToString();

                View_S_Stock tempLnq = m_serverStore.GetGoodsStockInfo(Convert.ToInt32(txtName.Tag), txtBatchNo.Text);

                txtSpec.Tag = tempLnq == null ? 0 : tempLnq.库存数量;
            }
        }
        private void dataGridView1_CellEnter(object sender, DataGridViewCellEventArgs e)
        {
            if (dataGridView1.RowCount == 0)
            {
                return;
            }

            #region 信息区显示

            BindingCollection <View_S_IsolationManageBill> dataSource = dataGridView1.DataSource as BindingCollection <View_S_IsolationManageBill>;

            View_S_IsolationManageBill bill = dataSource.First(p => p.单据号 == dataGridView1.CurrentRow.Cells["单据号"].Value.ToString());

            View_S_Stock stockInfo = m_serverStore.GetGoodsStockInfoView((int)bill.物品ID, bill.批次号, bill.供货单位, bill.库房代码);

            if (stockInfo == null)
            {
                return;
            }

            cmbStorage.Tag   = stockInfo.库房代码;
            cmbStorage.Text  = UniversalFunction.GetStorageName(stockInfo.库房代码);
            txtName.Text     = stockInfo.物品名称;
            txtName.Tag      = Convert.ToInt32(stockInfo.物品ID);
            txtCode.Text     = stockInfo.图号型号;
            txtSpec.Text     = stockInfo.规格;
            txtDepot.Text    = stockInfo.材料类别编码;
            txtCount.Text    = bill.隔离数量.ToString();
            txtProvider.Text = stockInfo.供货单位;
            txtBatchNo.Text  = stockInfo.批次号;
            lbdw.Text        = stockInfo.单位;

            #endregion

            #region 单据内容

            txtReason.Text           = bill.隔离原因;
            txtMeansAndAsk.Text      = bill.隔离方法和要求;
            chkIsOutsourcing.Checked = bill.是否委外返修;
            m_strRejectMode          = bill.退货方式 == null ? "" : bill.退货方式;
            lbCLBM.Tag  = bill.处理部门代码;
            lbCLBM.Text = bill.处理部门;

            NudQC_FQ.Value    = bill.QC废弃数;
            NudQC_BF.Value    = bill.QC报废数;
            NudQC_HG.Value    = bill.QC合格数;
            NudQC_RB.Value    = bill.QC让步数;
            NudQC_TH.Value    = bill.QC退货数;
            NudSQE_BHG.Value  = bill.合格数;
            NudSQE_HG.Value   = bill.合格数;
            NudSQE_TFGS.Value = bill.处理工时;

            #endregion

            #region 单据信息

            lbDJH.Text  = bill.单据号;
            lbDJZT.Text = bill.单据状态;
            lbBZ.Text   = bill.编制人;
            lbSH.Text   = bill.审核人;
            lbDC.Text   = bill.调出人;
            lbCLJG.Text = bill.处理人;
            lbJYJG.Text = bill.检验人;
            lbDR.Text   = bill.调入人;
            lbQE.Text   = bill.QE人员;

            #endregion

            SetRejectMode();

            仓管员操作ToolStripMenuItem.Visible =
                UniversalFunction.CheckStorageAndPersonnel(bill.库房代码);

            if (lbCLBM.Tag == null || !BasicInfo.DeptCode.Contains(lbCLBM.Tag.ToString()))
            {
                sQE操作ToolStripMenuItem.Visible  = false;
                处理结果提交ToolStripMenuItem.Visible = false;
            }
            else
            {
                sQE操作ToolStripMenuItem.Visible  = true;
                处理结果提交ToolStripMenuItem.Visible = true;
            }

            if (lbDJZT.Text == "新建单据" || lbDJZT.Text == "等待主管审核" || lbDJZT.Text == "等待仓管调出")
            {
                txtBatchNo.ShowResultForm = true;
                txtName.ShowResultForm    = true;
            }
            else
            {
                txtBatchNo.ShowResultForm = false;
                txtName.ShowResultForm    = false;
            }
        }