Example #1
0
        private void btnLoadDataFromMRRB_Click(object sender, EventArgs e)
        {
            if (!CheckData())
            {
                return;
            }

            FormQueryInfo dialog = QueryInfoDialog.GetMaterialRequisitionBillDialog(BasicInfo.LoginID, CE_BillTypeEnum.领料退库单);

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                string billNo = dialog.GetStringDataItem("退库单号");

                if (MessageDialog.ShowEnquiryMessage("您确定要导入 " + billNo
                                                     + " 领料单的信息吗?此过程需要一段时间,是否继续?") == DialogResult.No)
                {
                    return;
                }

                IMaterialReturnedInTheDepot     billServer  = ServerModuleFactory.GetServerModule <IMaterialReturnedInTheDepot>();
                IMaterialListReturnedInTheDepot goodsServer = ServerModuleFactory.GetServerModule <IMaterialListReturnedInTheDepot>();

                View_S_MaterialReturnedInTheDepot            bill       = billServer.GetBillView(billNo);
                List <View_S_MaterialListReturnedInTheDepot> lstMRGoods = (from r in goodsServer.GetGoods(billNo) select r).ToList();

                if (lstMRGoods.Count > 0)
                {
                    if (是否一次性物品.Checked && GlobalObject.GeneralFunction.IsNullOrEmpty(m_productNumber))
                    {
                        m_productNumber = cmbProductCode.Text;
                    }

                    List <StorageGoods> lstGoods = new List <StorageGoods>(lstMRGoods.Count);

                    foreach (var item in lstMRGoods)
                    {
                        StorageGoods goods = new StorageGoods();

                        goods.GoodsCode = item.图号型号;
                        goods.GoodsName = item.物品名称;
                        goods.Spec      = item.规格;
                        goods.Provider  = item.供应商;
                        goods.BatchNo   = item.批次号;
                        goods.Quantity  = -(decimal)item.退库数;
                        goods.StorageID = bill.库房代码;

                        lstGoods.Add(goods);
                    }

                    if (!m_mbpServer.AddFromBill(BasicInfo.LoginID, Convert.ToInt32(
                                                     cmbPurpose.SelectedValue), m_productNumber, billNo, lstGoods, out m_error))
                    {
                        MessageDialog.ShowErrorMessage(m_error);
                    }
                    else
                    {
                        MessageDialog.ShowPromptMessage("操作成功");

                        SearchData(0);
                    }
                }
            }
        }
        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;
            }
        }