private void customDataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == -1 && e.RowIndex >= 0 &&
                customDataGridView1.CurrentRow.Cells["物品ID"].Value != null &&
                customDataGridView1.CurrentRow.Cells["物品ID"].Value.ToString().Length > 0)
            {
                BarCodeInfo barCode = new BarCodeInfo();

                barCode.BatchNo = customDataGridView1.CurrentRow.Cells["批次号"].Value == null ? "" :
                                  customDataGridView1.CurrentRow.Cells["批次号"].Value.ToString();
                barCode.Count = customDataGridView1.CurrentRow.Cells["数量"].Value == null ? 0 :
                                Convert.ToDecimal(customDataGridView1.CurrentRow.Cells["数量"].Value);
                barCode.GoodsID = Convert.ToInt32(customDataGridView1.CurrentRow.Cells["物品ID"].Value);

                View_F_GoodsPlanCost goodsInfo = UniversalFunction.GetGoodsInfo(barCode.GoodsID);

                barCode.GoodsName = goodsInfo.物品名称;
                barCode.GoodsCode = goodsInfo.图号型号;
                barCode.Spec      = goodsInfo.规格;

                CE_BusinessType tempType = CE_BusinessType.库房业务;

                Service_Manufacture_WorkShop.IWorkShopBasic serverWSBasic =
                    Service_Manufacture_WorkShop.ServerModuleFactory.GetServerModule <Service_Manufacture_WorkShop.IWorkShopBasic>();

                WS_WorkShopCode tempWSCode = serverWSBasic.GetWorkShopCodeInfo(txtApplyingDepartment.Tag.ToString());

                Dictionary <string, string> tempDic = new Dictionary <string, string>();

                CE_InPutBusinessType inPutType =
                    GlobalObject.GeneralFunction.StringConvertToEnum <CE_InPutBusinessType>(cmbBillType.Text);
                CE_MarketingType marketType =
                    GlobalObject.EnumOperation.InPutBusinessTypeConvertToMarketingType(inPutType);
                CE_SubsidiaryOperationType subsdiaryType =
                    GlobalObject.EnumOperation.InPutBusinessTypeConvertToSubsidiaryOperationType(inPutType);

                tempDic.Add("", marketType.ToString());

                if (tempWSCode != null)
                {
                    tempType = CE_BusinessType.综合业务;
                    tempDic.Add(tempWSCode.WSCode, subsdiaryType.ToString());
                }

                产品编号 frm = new 产品编号(barCode, tempType, txtBillNo.Text, (lbBillStatus.Text != CE_CommonBillStatus.单据完成.ToString()), tempDic);

                if (frm.ShowDialog() == DialogResult.OK)
                {
                    customDataGridView1.Rows[e.RowIndex].Cells["数量"].Value = frm.IntCount;
                }
            }
        }
Exemple #2
0
        private void dgv_Main_DoubleClick(object sender, EventArgs e)
        {
            if (dgv_Main.CurrentRow == null)
            {
                return;
            }

            BarCodeInfo tempInfo = new BarCodeInfo();

            tempInfo.BatchNo   = m_dtMxRK.Rows[dgv_Main.CurrentRow.Index]["BatchNo"].ToString();
            tempInfo.Count     = Convert.ToDecimal(m_dtMxRK.Rows[dgv_Main.CurrentRow.Index]["Count"]);
            tempInfo.GoodsCode = m_dtMxRK.Rows[dgv_Main.CurrentRow.Index]["GoodsCode"].ToString();
            tempInfo.GoodsID   = Convert.ToInt32(m_dtMxRK.Rows[dgv_Main.CurrentRow.Index]["CPID"]);
            tempInfo.GoodsName = m_dtMxRK.Rows[dgv_Main.CurrentRow.Index]["GoodsName"].ToString();
            tempInfo.Remark    = m_dtMxRK.Rows[dgv_Main.CurrentRow.Index]["Remark"].ToString();
            tempInfo.Spec      = m_dtMxRK.Rows[dgv_Main.CurrentRow.Index]["Spec"].ToString();

            CE_BusinessType tempType = CE_BusinessType.库房业务;

            Service_Manufacture_WorkShop.IWorkShopBasic serverWSBasic =
                Service_Manufacture_WorkShop.ServerModuleFactory.GetServerModule <Service_Manufacture_WorkShop.IWorkShopBasic>();

            if (tbsDept.Text.Trim().Length == 0 || tbsDept.Tag == null)
            {
                throw new Exception("请选择【出货车间】");
            }

            WS_WorkShopCode tempWSCode = serverWSBasic.GetWorkShopCodeInfo(tbsDept.Tag.ToString());

            Dictionary <string, string> tempDic = new Dictionary <string, string>();

            tempDic.Add(UniversalFunction.GetStorageID(cmbStorage.Text), CE_MarketingType.入库.ToString());

            if (tempWSCode != null)
            {
                tempType = CE_BusinessType.综合业务;
                tempDic.Add(tempWSCode.WSCode, CE_SubsidiaryOperationType.营销入库.ToString());
            }

            产品编号 form = new 产品编号(tempInfo, tempType, txtSellID.Text,
                                 !(m_strDJZTFlag != "已保存" && m_strDJZTFlag != ""), tempDic);

            form.BlAfterServer = cmbRKFS.Text.Contains("售后返修");

            form.ShowDialog();

            if (form.IntCount != 0)
            {
                dgv_Main.CurrentRow.Cells["Count"].Value = form.IntCount;
            }
        }
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="barCodeInfo">物品信息</param>
        /// <param name="businessType">业务状态</param>
        /// <param name="strDJH">业务编号</param>
        /// <param name="isEnteringState">是否为录入状态</param>
        /// <param name="dicInfo">字典信息(库房,业务类型(MarketingType(库房业务),SubsidiaryOperationType(车间业务)))</param>
        public 产品编号(BarCodeInfo barCodeInfo, CE_BusinessType businessType, string strDJH,
                    bool isEnteringState, Dictionary <string, string> dicInfo)
        {
            m_enumBusinessType = businessType;

            switch (m_enumBusinessType)
            {
            case CE_BusinessType.库房业务:

                foreach (KeyValuePair <string, string> item in dicInfo)
                {
                    m_dicMarkInfo.Add(item.Key,
                                      GeneralFunction.StringConvertToEnum <CE_MarketingType>(item.Value));
                }

                break;

            case CE_BusinessType.车间业务:

                foreach (KeyValuePair <string, string> item in dicInfo)
                {
                    m_dicWorkShopInfo.Add(item.Key,
                                          GeneralFunction.StringConvertToEnum <CE_SubsidiaryOperationType>(item.Value));
                }

                break;

            case CE_BusinessType.综合业务:
                System.Text.RegularExpressions.Regex rex = new System.Text.RegularExpressions.Regex(@"^\d+$");

                if (dicInfo != null)
                {
                    foreach (KeyValuePair <string, string> item in dicInfo)
                    {
                        if (rex.IsMatch(item.Key))
                        {
                            m_dicMarkInfo.Add(item.Key,
                                              GeneralFunction.StringConvertToEnum <CE_MarketingType>(item.Value));
                        }
                        else
                        {
                            m_dicWorkShopInfo.Add(item.Key,
                                                  GeneralFunction.StringConvertToEnum <CE_SubsidiaryOperationType>(item.Value));
                        }
                    }
                }

                break;

            default:
                break;
            }

            InitializeComponent();

            if (!isEnteringState)
            {
                ProductCode.ReadOnly = true;
                btnAdd.Enabled       = false;
                btnDelete.Enabled    = false;
                btnAuditing.Enabled  = false;
            }

            m_barCodeInfo = barCodeInfo;
            m_strBillID   = strDJH;

            m_server = AsynSocketFactory.GetSingletonServer(m_currentPort);
            m_server.Begin();

            m_server.OnConnected += new GlobalObject.DelegateCollection.SocketConnectEvent(AsynServer_OnConnected);
            m_server.OnReceive   += new ReceiveEventHandler(AsynServer_OnReceive);
        }
        private void dataGridView1_DoubleClick(object sender, EventArgs e)
        {
            if (dataGridView1.CurrentRow == null)
            {
                return;
            }


            View_S_MaterialReturnedInTheDepot lnqMaterialReturn = m_goodsServer.GetBillView(m_billNo);
            int intGoodsID = Convert.ToInt32(dataGridView1.CurrentRow.Cells["物品ID"].Value);

            switch (UniversalFunction.GetGoodsType(intGoodsID, m_strStorage))
            {
            case CE_GoodsType.CVT:
            case CE_GoodsType.TCU:
                BarCodeInfo tempInfo = new BarCodeInfo();

                tempInfo.BatchNo   = dataGridView1.CurrentRow.Cells["批次号"].Value.ToString();
                tempInfo.Count     = Convert.ToDecimal(dataGridView1.CurrentRow.Cells["退库数"].Value);
                tempInfo.GoodsCode = dataGridView1.CurrentRow.Cells["图号型号"].Value.ToString();
                tempInfo.GoodsID   = intGoodsID;
                tempInfo.GoodsName = dataGridView1.CurrentRow.Cells["物品名称"].Value.ToString();
                tempInfo.Remark    = dataGridView1.CurrentRow.Cells["备注"].Value.ToString();
                tempInfo.Spec      = dataGridView1.CurrentRow.Cells["规格"].Value.ToString();

                bool blCheck = true;

                if (m_operateMode == CE_BusinessOperateMode.查看)
                {
                    blCheck = false;
                }
                else
                {
                    if (lnqMaterialReturn.单据状态 != "等待仓管退库")
                    {
                        blCheck = false;
                    }
                }

                IMaterialReturnedInTheDepot serverBill = ServerModuleFactory.GetServerModule <IMaterialReturnedInTheDepot>();

                View_S_MaterialReturnedInTheDepot tempLnq = serverBill.GetBillView(m_billNo);

                CE_BusinessType tempType = CE_BusinessType.库房业务;

                Service_Manufacture_WorkShop.IWorkShopBasic serverWSBasic =
                    Service_Manufacture_WorkShop.ServerModuleFactory.GetServerModule <Service_Manufacture_WorkShop.IWorkShopBasic>();

                WS_WorkShopCode tempWSCode = serverWSBasic.GetPersonnelWorkShop(tempLnq.申请人编码);

                Dictionary <string, string> tempDic = new Dictionary <string, string>();

                tempDic.Add(m_strStorage, CE_MarketingType.领料退库.ToString());

                if (tempWSCode != null)
                {
                    tempType = CE_BusinessType.综合业务;
                    tempDic.Add(tempWSCode.WSCode, CE_SubsidiaryOperationType.领料退库.ToString());
                }

                产品编号 formCode = new 产品编号(tempInfo, tempType, m_billNo, blCheck, tempDic);

                if (m_strStorage == "05")
                {
                    if (dataGridView1.CurrentRow.Cells["返修状态"].Value == null ||
                        dataGridView1.CurrentRow.Cells["返修状态"].Value.ToString() == "")
                    {
                        MessageDialog.ShowPromptMessage("请选择产品的返修状态");
                        return;
                    }
                    else
                    {
                        formCode.BlIsRepaired = (bool)dataGridView1.CurrentRow.Cells["返修状态"].Value;
                    }
                }

                formCode.ShowDialog();
                break;

            case CE_GoodsType.工装:
                工装编号录入窗体 form = new 工装编号录入窗体(m_billNo, intGoodsID, CE_BusinessBillType.领料退库, lnqMaterialReturn.单据状态 == "等待仓管退库" ? true : false);
                form.StartPosition = FormStartPosition.CenterScreen;
                form.ShowDialog();
                break;

            case CE_GoodsType.量检具:
                量检具编号录入窗体 formLJY = new 量检具编号录入窗体(m_billNo, intGoodsID,
                                                  Convert.ToDecimal(dataGridView1.CurrentRow.Cells["退库数"].Value), CE_BusinessBillType.领料退库,
                                                  m_operateMode == CE_BusinessOperateMode.仓库核实 ? true : false);

                formLJY.ShowDialog();
                break;

            case CE_GoodsType.零件:
                break;

            case CE_GoodsType.未知物品:
                break;

            default:
                break;
            }
        }