/// <summary>
        ///  修改一条供货商和审批流程记录
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns
        public void ModifySupplyUnitApproveFlow(SupplyUnit su, Guid approvalFlowTypeID, Guid userID, string changeNote)
        {
            try
            {
                this.Save(su);

                if (changeNote.Contains("审批后修改"))
                {
                    ApprovalFlow af = BusinessHandlerFactory.ApprovalFlowBusinessHandler.GetApproveFlowInstance(approvalFlowTypeID, su.FlowID, userID, changeNote);
                    BusinessHandlerFactory.ApprovalFlowBusinessHandler.Add(af);

                    ApprovalFlowRecord afr = BusinessHandlerFactory.ApprovalFlowRecordBusinessHandler.GetApproveFlowRecordInstance(af, userID, changeNote);
                    BusinessHandlerFactory.ApprovalFlowRecordBusinessHandler.Add(afr);
                }
                else
                {
                    var c = BusinessHandlerFactory.ApprovalFlowBusinessHandler.GetApproveFlowsByFlowID(su.FlowID);
                    if (c == null || c.ApprovalFlowTypeId.Equals(Guid.Empty) || c.ApprovalFlowTypeId != approvalFlowTypeID)
                    {
                        ApprovalFlow af = BusinessHandlerFactory.ApprovalFlowBusinessHandler.GetApproveFlowInstance(approvalFlowTypeID, su.FlowID, userID, changeNote);
                        BusinessHandlerFactory.ApprovalFlowBusinessHandler.Add(af);

                        ApprovalFlowRecord afr = BusinessHandlerFactory.ApprovalFlowRecordBusinessHandler.GetApproveFlowRecordInstance(af, userID, changeNote);
                        BusinessHandlerFactory.ApprovalFlowRecordBusinessHandler.Add(afr);
                    }
                }

                this.Save();
            }
            catch (Exception ex)
            {
                this.HandleException("方法AddSupplyUnitApproveFlow出错!!!", ex);
            }
        }
Пример #2
0
        /// <summary>
        /// 采购退货添加配送信息
        /// </summary>
        /// <param name="por"></param>
        public bool SaveDeliveryByPurchaseReturn(Models.PurchaseOrderReturn por, System.Guid createUid)
        {
            try
            {
                if (por == null)
                {
                    return(false);
                }
                por.OrderStatusValue  = (int)OrderReturnStatus.Over;
                por.CheckerUserId     = createUid;
                por.CheckerUpdateTime = DateTime.Now;
                por.CheckerSuggest    = "质量合格,可以采购退货出库";
                BusinessHandlerFactory.PurchaseOrderReturnBusinessHandler.Save(por);
                por.PurchaseOrderReturnDetails = RepositoryProvider.Db.PurchaseOrderReturnDetails.Where(r => r.PurchaseOrderReturnId == por.Id).ToArray();

                Delivery delivery = new Delivery();
                delivery.Id = Guid.NewGuid();
                delivery.DeliveryStatusValue = (int)DeliveryStatus.Reservation;//配送预约

                PurchaseOrder po = BusinessHandlerFactory.PurchaseOrderBusinessHandler.Get(por.PurchaseOrderId);
                SupplyUnit    su = BusinessHandlerFactory.SupplyUnitBusinessHandler.Get(po.SupplyUnitId);

                delivery.ReceivingCompasnyID = po.SupplyUnitId;
                delivery.ShippingAddress     = PharmacyFileBusinessHandler.CurrentStore.Address;
                delivery.DeliveryAddress     = su.ReceiveAddress;

                delivery.DrugsCount = por.PurchaseOrderReturnDetails.Sum(r => r.ReturnAmount);

                delivery.CreateTime     = delivery.UpdateTime = DateTime.Now;
                delivery.CreateUserId   = createUid;
                delivery.UpdateUserId   = createUid;
                delivery.OrderID        = por.Id;
                delivery.OutInventoryID = new Guid();
                delivery.Memo           = "销退配送";
                delivery.SalesOrder     = por.DocumentNumber;
                BusinessHandlerFactory.DeliveryBusinessHandler.Add(delivery);


                this.Save();

                su = null;
                po = null;
                por.PurchaseOrderReturnDetails = null;
                return(true);
            }
            catch (Exception e)
            {
                throw new Exception("创建出库配送单失败!", e);
            }
        }
 /// <summary>
 /// 供货商的经营范围的Code集合
 /// </summary>
 /// <param name="supplyUnitGuid"></param>
 /// <returns></returns>
 public List <string> GetBusinessScopeCodesBySupplyUnitGuid(Guid supplyUnitGuid)
 {
     try
     {
         SupplyUnit supplyUnit = this.Get(supplyUnitGuid);
         if (supplyUnit == null)
         {
             throw new Exception("供货商不存在");
         }
         return(GetBusinessScopeCodesBySupplyUnit(supplyUnit));
     }
     catch (Exception ex)
     {
         return(this.HandleException <List <string> >("方法GetBusinessScopeCodesBySupplyUnitGuid出错!!!", ex));
     }
 }
 /// <summary>
 /// 供货商的管理分类的Code集合
 /// </summary>
 /// <param name="supplyUnitGuid"></param>
 /// <returns></returns>
 public List <string> GetManageCategoryDetailBySupplyUnitGuid(Guid supplyUnitGuid)
 {
     try
     {
         SupplyUnit supplyUnit = this.Get(supplyUnitGuid);
         if (supplyUnit == null)
         {
             throw new Exception("供货商不存在");
         }
         return(GetManageCategoryDetailBySupplyUnit(supplyUnit));
     }
     catch (Exception ex)
     {
         return(this.HandleException <List <string> >("方法GetManageCategoryDetailBySupplyUnitGuid出错!!!", ex));
     }
 }
        /// <summary>
        /// 供货商的管理分类的Code集合
        /// </summary>
        /// <param name="supplyUnit"></param>
        /// <returns></returns>
        public List <string> GetManageCategoryDetailBySupplyUnit(SupplyUnit supplyUnit)
        {
            try
            {
                //  var gMSPLicense = BusinessHandlerFactory.GMSPLicenseBusinessHandler
                //.Get(supplyUnit.GMSPLicenseId);
                //  return gMSPLicense.BusinessType.BusinessTypeManageCategoryDetails.Select(p => p.PurchaseManageCategoryDetail.Code).ToList();
                var gSPLicense = BusinessHandlerFactory.GSPLicenseBusinessHandler
                                 .Get(supplyUnit.GMPLicenseId);
                var bt = BusinessHandlerFactory.BusinessTypeBusinessHandler.Get(gSPLicense.BusinessTypeId);

                return(bt.BusinessTypeManageCategoryDetails.Select(p => p.PurchaseManageCategoryDetail.Code).ToList());
            }
            catch (Exception ex)
            {
                return(this.HandleException <List <string> >("方法GetManageCategoryDetailBySupplyUnit出错!!!", ex));
            }
        }
 /// <summary>
 /// 根据Name获取供应商单位
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 public SupplyUnit GetSupplyUnitByName(string name)
 {
     try
     {
         SupplyUnit a = this.Fetch(r => r.Name == name).FirstOrDefault();
         if (a != null)
         {
             return(a);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex)
     {
         this.HandleException("方法GetSupplyUnitByName出错!!!", ex);
         return(null);
     }
 }
 /// <summary>
 /// 查找供应商单位名称是否已存在
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 public bool IsExistSupplyUnitByName(string name)
 {
     try
     {
         SupplyUnit a = this.Fetch(r => r.Name == name).FirstOrDefault();
         if (a != null)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         this.HandleException("方法IsExistSupplyUnitByName出错!!!", ex);
         return(false);
     }
 }
        /// <summary>
        ///  新增一条供货商和审批流程记录
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns
        public void AddSupplyUnitApproveFlow(SupplyUnit su, Guid approvalFlowTypeID, Guid userID, string changeNote)
        {
            try
            {
                //增加供货商记录
                this.Add(su);

                //增加审批流程
                ApprovalFlow af = BusinessHandlerFactory.ApprovalFlowBusinessHandler.GetApproveFlowInstance(approvalFlowTypeID, su.FlowID, userID, changeNote);
                BusinessHandlerFactory.ApprovalFlowBusinessHandler.Add(af);

                //增加审批流程记录
                ApprovalFlowRecord afr = BusinessHandlerFactory.ApprovalFlowRecordBusinessHandler.GetApproveFlowRecordInstance(af, userID, changeNote);
                BusinessHandlerFactory.ApprovalFlowRecordBusinessHandler.Add(afr);
                this.Save();
            }
            catch (Exception ex)
            {
                this.HandleException("方法AddSupplyUnitApproveFlow出错!!!", ex);
            }
        }
        //查看供货商信息
        private void GetSupplyUnitInfo()
        {
            if (_SupplyID == null || _SupplyID == Guid.Empty)
            {
                return;
            }
            SupplyUnit su = this.PharmacyDatabaseService.GetSupplyUnit(out msg, _SupplyID);

            UserControls.ucSupplyUnit us = new UserControls.ucSupplyUnit(su, false);
            Form f = new Form();

            f.Text         = su.Name;
            f.AutoSize     = true;
            f.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
            Panel p = new Panel();

            p.AutoSize = true;
            p.Controls.Add(us);
            f.Controls.Add(p);
            f.ShowDialog();
        }
Пример #10
0
        private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.Button != System.Windows.Forms.MouseButtons.Right)
            {
                return;
            }
            dataGridView1.ClearSelection();
            if (e.RowIndex < 0)
            {
                return;
            }
            dataGridView1.Rows[e.RowIndex].Selected = true;
            var c = this.dataGridView1.Rows[e.RowIndex].DataBoundItem as bool2String;

            dataGridView1.CurrentCell = this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];

            SupplyUnit su = this._listSupplyUnit.Where(r => r.Id == c.id).FirstOrDefault();

            if (su == null)
            {
                return;
            }
            ToolStripMenuItem ti = cms.Items["资质查看"] as ToolStripMenuItem;

            ti.DropDownItems[0].Enabled  = !Guid.Empty.Equals(su.MedicineBusinessLicenseId);
            ti.DropDownItems[1].Enabled  = !Guid.Empty.Equals(su.GMPLicenseId);
            ti.DropDownItems[2].Enabled  = !Guid.Empty.Equals(su.MedicineProductionLicenseId);
            ti.DropDownItems[3].Enabled  = !Guid.Empty.Equals(su.BusinessLicenseId);
            ti.DropDownItems[4].Enabled  = !Guid.Empty.Equals(su.InstrumentsProductionLicenseId);
            ti.DropDownItems[5].Enabled  = !Guid.Empty.Equals(su.InstrumentsBusinessLicenseId);
            ti.DropDownItems[6].Enabled  = !Guid.Empty.Equals(su.OrganizationCodeLicenseId);
            ti.DropDownItems[7].Enabled  = !Guid.Empty.Equals(su.HealthLicenseId);
            ti.DropDownItems[8].Enabled  = !Guid.Empty.Equals(su.LnstitutionLegalPersonLicenseId);
            ti.DropDownItems[9].Enabled  = !Guid.Empty.Equals(su.TaxRegisterLicenseId);
            ti.DropDownItems[10].Enabled = !Guid.Empty.Equals(su.FoodCirculateLicenseId);
            ti.DropDownItems[11].Enabled = !Guid.Empty.Equals(su.GSPLicenseId);
            ti.DropDownItems[12].Enabled = !Guid.Empty.Equals(su.MmedicalInstitutionPermitId);

            cms.Show(MousePosition.X, MousePosition.Y);
        }
Пример #11
0
        private void GetSupplyUnitInfo()
        {
            if (this.CurrentPurchaseOrder.SupplyUnitId == Guid.Empty)
            {
                this.SearchSupplyUnit();
                return;
            }
            SupplyUnit su = this.PharmacyDatabaseService.GetSupplyUnit(out msg, this.CurrentPurchaseOrder.SupplyUnitId);

            UserControls.ucSupplyUnit us = new UserControls.ucSupplyUnit(su, false);
            Form f = new Form();

            f.Text         = su.Name;
            f.AutoSize     = true;
            f.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
            Panel p = new Panel();

            p.AutoSize = true;
            p.Controls.Add(us);
            f.Controls.Add(p);
            f.ShowDialog();
        }
        private void 查看供货商信息ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.toolStripComboBox1.ComboBox.SelectedValue == null)
            {
                return;
            }
            Guid sid = Guid.Parse(this.toolStripComboBox1.ComboBox.SelectedValue.ToString());

            SupplyUnit su = this.PharmacyDatabaseService.GetSupplyUnit(out msg, sid);

            UserControls.ucSupplyUnit us = new UserControls.ucSupplyUnit(su, false);
            Form f = new Form();

            f.Text         = su.Name;
            f.AutoSize     = true;
            f.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
            Panel p = new Panel();

            p.AutoSize = true;
            p.Controls.Add(us);
            f.Controls.Add(p);
            f.ShowDialog();
        }
        /// <summary>
        /// 供货商的经营范围的Code集合
        /// </summary>
        /// <param name="supplyUnit"></param>
        /// <returns></returns>
        public List <string> GetBusinessScopeCodesBySupplyUnit(SupplyUnit supplyUnit)
        {
            try
            {
                List <string> l = new List <string>();

                var gSPLicense = BusinessHandlerFactory.GSPLicenseBusinessHandler.Get(supplyUnit.GSPLicenseId);
                if (gSPLicense == null)
                {
                    return(null);
                }

                foreach (var c in gSPLicense.GMSPLicenseBusinessScopes)
                {
                    l.Add(c.BusinessScopeCode);
                }
                return(l);
            }
            catch (Exception ex)
            {
                return(this.HandleException <List <string> >("方法GetBusinessScopeCodesBySupplyUnit出错!!!", ex));
            }
        }
        private void comboBoxSupplyUnitId_SelectedValueChanged(object sender, EventArgs e)
        {
            Guid supplyunitId = (System.Guid)(this.comboBoxSupplyUnitId.SelectedValue);

            //GSPLicense=
            if (supplyunitId != Guid.Empty)
            {
                //this.ucBusinessScopeEditor.
                //var d = from i in WarehouseZone where i.WarehouseId == (Guid)(comboBoxWarehouse.SelectedValue) select i;
                //this.comboBoxWarehouseZone.DataSource = d.ToArray();
                //this.comboBoxWarehouseZone.ValueMember = "id";
                //this.comboBoxWarehouseZone.DisplayMember = "name";
                //MessageBox.Show(supplyunitId.ToString());


                string     msg        = String.Empty;
                SupplyUnit supplyUnit = this.PharmacyDatabaseService.GetSupplyUnit(out msg, supplyunitId);
                GMSPLicenseBusinessScopes = this.PharmacyDatabaseService.AllGMSPLicenseBusinessScopes(out msg).ToList();
                var d = from i in GMSPLicenseBusinessScopes where i.GSPLicenseId == supplyUnit.GSPLicenseId select i;
                //MessageBox.Show(supplyUnit.GSPLicenseId.ToString());
                //var d= from i in GMSPLicenseBusinessScope where i.
            }
        }
Пример #15
0
        /// <summary>
        /// 查询供应商有权限的药品
        /// </summary>
        /// <param name="purchaseUnitGuid"></param>
        /// <returns></returns>
        public IEnumerable <DrugInfo> GetDrugInfoBySupplyUnit(Guid supplyUnitGuid)
        {
            try
            {
                SupplyUnit supplyUnit = BusinessHandlerFactory.SupplyUnitBusinessHandler.Get(supplyUnitGuid);
                if (supplyUnit == null)
                {
                    throw new Exception("供应商不存在");
                }
                if (!supplyUnit.Enabled)
                {
                    throw new Exception("供应商未开启");
                }
                if (!supplyUnit.Valid)
                {
                    throw new Exception("供应商被锁定");
                }
                List <string> businessScope = BusinessHandlerFactory.SupplyUnitBusinessHandler.GetBusinessScopeCodesBySupplyUnit(supplyUnit);
                if (businessScope == null)
                {
                    return(null);
                }

                //List<string> manageCategoryDetail = BusinessHandlerFactory.SupplyUnitBusinessHandler.GetManageCategoryDetailBySupplyUnit(supplyUnit);
                var result = this.Fetch(p => p.Valid && p.Enabled && businessScope.Contains(p.BusinessScopeCode));

                return(result);
            }
            catch (Exception ex)
            {
                return(this.HandleException <List <DrugInfo> >("查询供应商有权限的药品结果为0", ex));
            }
            finally
            {
                this.Dispose();
            }
        }
        /// <summary>
        /// 供货商的经营范围的Code集合
        /// </summary>
        /// <param name="supplyUnit"></param>
        /// <returns></returns>
        public List <string> GetBusinessScopeCodesBySupplyUnit(SupplyUnit supplyUnit)
        {
            try
            {
                //var gMSPLicense = BusinessHandlerFactory.GMSPLicenseBusinessHandler
                // .Get(supplyUnit.GMSPLicenseId);
                //return gMSPLicense.GMSPLicenseBusinessScopes.Select(p => p.BusinessScope.Code).ToList();
                List <string> l = new List <string>();

                var gSPLicense = BusinessHandlerFactory.GSPLicenseBusinessHandler.Get(supplyUnit.GSPLicenseId);
                if (gSPLicense == null)
                {
                    return(null);
                }
                List <GMSPLicenseBusinessScope> gms = gSPLicense.GMSPLicenseBusinessScopes.ToList();
                List <BusinessScope>            bs  = BusinessHandlerFactory.BusinessScopeBusinessHandler.Queryable.ToList();
                string s  = string.Empty;
                var    dd = gms.Join(bs, r => r.BusinessScopeId, o => o.Id, (r, o) => new{ Name = o.Name }).ToList();
                if (dd == null)
                {
                    return(null);
                }
                foreach (var c in dd)
                {
                    l.Add(c.Name);
                }
                BusinessHandlerFactory.UserLogBusinessHandler.LogUserLog(new UserLog {
                    Content = ConnectedInfoProvider.User.Account + "成功读取供货商经营范围:"
                });
                return(l);
            }
            catch (Exception ex)
            {
                return(this.HandleException <List <string> >("方法GetBusinessScopeCodesBySupplyUnit出错!!!", ex));
            }
        }
Пример #17
0
        ///导入数据库
        private void Import()
        {
            string result;

            int i = 0;

            foreach (DataRow reader in datatable.Rows)
            {
                try
                {
                    if (reader["传真"].ToString().Trim().Length == 0)
                    {
                        dtState.Rows.Add(i, "导入失败", "失败原因:'传真'不能为空");
                        continue;
                    }
                    if (reader["邮箱"].ToString().Trim().Length == 0)
                    {
                        dtState.Rows.Add(i, "导入失败", "失败原因:'邮箱'不能为空");
                        continue;
                    }
                    if (reader["网站"].ToString().Trim().Length == 0)
                    {
                        dtState.Rows.Add(i, "导入失败", "失败原因:'网站'不能为空");
                        continue;
                    }
                    Guid     UnitTypeId;
                    UnitType item = PharmacyDatabaseService.QueryUnitTypes(out result, reader["企业类型"].ToString(), true, true, null, null).FirstOrDefault();
                    if (item != null)
                    {
                        UnitTypeId = item.Id;
                    }
                    else
                    {
                        dtState.Rows.Add(i, "导入失败", "失败原因:企业类型'" + reader["企业类型"].ToString() + "'不存在");
                        continue;
                    }

                    SupplyUnit info;

                    bool IsExist = PharmacyDatabaseService.IsExistSupplyUnitByName(out result, reader["单位名称"].ToString());
                    //更新
                    if (IsExist)
                    {
                        info = PharmacyDatabaseService.GetSupplyUnitByName(out result, reader["单位名称"].ToString());
                    }
                    else //新增
                    {
                        info              = new SupplyUnit();
                        info.Id           = Guid.NewGuid();
                        info.CreateTime   = DateTime.Now;
                        info.CreateUserId = Guid.Empty;
                        info.Enabled      = true;
                        info.Name         = reader["单位名称"].ToString();
                    }

                    info.QualityAgreementOutdate  = Convert.ToDateTime(reader["质量协议书有效期止"]);
                    info.AttorneyAattorneyOutdate = Convert.ToDateTime(reader["法人委托书有效期止"]);
                    info.SupplyProductClass       = reader["拟供品种"].ToString();
                    info.QualityCharger           = reader["质量负责人"].ToString();

                    info.BankAccountName = reader["开户户名"].ToString();
                    info.Bank            = reader["银行"].ToString();
                    info.BankAccount     = reader["银行帐号"].ToString();

                    info.Code          = reader["唯一编码"].ToString();
                    info.PinyinCode    = reader["拼音码"].ToString();
                    info.ContactName   = reader["联系人"].ToString();
                    info.ContactTel    = reader["联系电话"].ToString();
                    info.Description   = reader["说明"].ToString();
                    info.LegalPerson   = reader["法人"].ToString();
                    info.BusinessScope = reader["生产经营范围"].ToString();
                    info.SalesAmount   = reader["年销售额"].ToString();
                    info.Fax           = reader["传真"].ToString();
                    info.Email         = reader["邮箱"].ToString();
                    info.WebAddress    = reader["网站"].ToString();
                    info.OutDate       = Convert.ToDateTime(reader["过期日"]);
                    //info.GSPGMPLicCode = reader["GSMP证书号"].ToString();
                    //info.GSPGMPLicOutdate = Convert.ToDateTime(reader["GSP/GMP证书有效期止"]);
                    //info.BusinessLicCode = reader["营业执照编号"].ToString();
                    //info.BusinessLicOutdate = Convert.ToDateTime(reader["营业执照有效期止"]);
                    //info.PharmaceuticalTradingLicCode = reader["药品经营许可证号"].ToString();
                    //info.PharmaceuticalTradingLicOutdate = Convert.ToDateTime(reader["药品经营许可证有效期止"]);
                    info.TaxRegistrationCode = reader["税务登记号"].ToString();
                    info.LastAnnualDte       = Convert.ToDateTime(reader["最新年检日期"]);
                    info.UnitTypeId          = UnitTypeId;



                    if (IsExist)
                    {
                        PharmacyDatabaseService.UpdateSupplyUnitByName(out result, reader["单位名称"].ToString(), info);
                        dtState.Rows.Add(i, "更新成功", result);
                    }
                    else
                    {
                        PharmacyDatabaseService.AddSupplyUnit(out result, info);
                        dtState.Rows.Add(i, "导入成功", result);
                    }
                }
                catch (Exception ex)
                {
                    dtState.Rows.Add(i, "导入失败", "失败原因:" + ex.Message);
                }
                finally
                {
                    progressValue++;
                    i++;
                }
            }
        }
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            string msg = null;

            try
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(AppDomain.CurrentDomain.BaseDirectory + "BugsBox.Pharmacy.AppClient.SalePriceType.xml");
                XmlNode xmlNode = doc.SelectSingleNode("SalePriceType/SupplyDrugType");
                if (xmlNode == null)
                {
                    XmlNode    SPTNode = doc.SelectSingleNode("SalePriceType");
                    XmlElement NewNode = doc.CreateElement("SupplyDrugType");
                    var        result  = MessageBox.Show("需要启用拟供药品过滤功能吗?如果启用,则需要在首营供货企业中填写拟供品种资料,并提交审核。(本功仅能针对生产企业,只提示一次,设置后无提示。)", "提示", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes;
                    NewNode.SetAttribute("Type", result ? "1" : "0");
                    NewNode.InnerText = "设为1时根据拟供品种过滤,同时决定是否需要增加采购收货扫描图片";
                    SPTNode.AppendChild(NewNode);
                    xmlNode = NewNode;
                    doc.Save(AppDomain.CurrentDomain.BaseDirectory + "BugsBox.Pharmacy.AppClient.SalePriceType.xml");
                }

                supplyDrugType = Convert.ToInt16(xmlNode.Attributes["Type"].Value);
            }
            catch (Exception ex)
            { MessageBox.Show("配置文件读取错误,请联系管理员!"); }

            if (this.toolStripComboBox1.ComboBox.Items.Count == 0)
            {
                return;
            }
            SupplyUnit su  = (SupplyUnit)this.toolStripComboBox1.ComboBox.SelectedItem;
            Guid       uid = su.Id;
            var        all = PharmacyDatabaseService.GetDrugInfoBySupplyUnit(out msg, uid);

            if (all == null)
            {
                MessageBox.Show("无该供货商可销售药品,请查询其经营资质是否过期或其经营范围是否正确。");
                this.dataGridView1.DataSource = null;
                return;
            }
            all = all.Where(r => r.Valid).ToArray();
            //控制医疗器械
            if (this.GoodsType == Common.GoodsTypeClass.医疗器械)
            {
                all = all.Where(r => r.BusinessScopeCode == "医疗器械" ||
                                r.BusinessScopeCode.Contains("I类") ||
                                r.BusinessScopeCode.Contains("II类") ||
                                r.BusinessScopeCode.Contains("III类")
                                )
                      .ToArray();
            }
            else
            {
                all = all.Where(r => r.BusinessScopeCode != "医疗器械"
                                //&& r.BusinessScopeCode!="I类"
                                //&& r.BusinessScopeCode!="II类"
                                //&& r.BusinessScopeCode!="III类"
                                )
                      .ToArray();
            }

            if (all == null)
            {
                MessageBox.Show("无该供货商可销售药品,请查询其经营资质是否过期或其经营范围是否正确。");
                this.dataGridView1.DataSource = null;
                return;
            }
            all = all.Except(addBL, new compareD()).ToArray();
            bList.Clear();

            string unitTypeName = PharmacyDatabaseService.GetUnitType(out msg, su.UnitTypeId).Name;

            if (supplyDrugType == 1 && unitTypeName == "生产企业")
            {
                //拟供品种过滤
                string drugStr = su.SupplyProductClass;
                if (drugStr.IsNullOrTrimEmpty())
                {
                    MessageBox.Show("请检查该生产企业的拟供品种。");
                    return;
                }
                foreach (var c in all)
                {
                    if (drugStr.Contains(c.ProductGeneralName))
                    {
                        bList.Add(c);
                    }
                }
            }
            else
            {
                foreach (var c in all)
                {
                    bList.Add(c);
                }
            }
            this.dataGridView1.DataSource = bList;
            this.Supplyer = su.Name;
            this.Text     = su.Name + " 入库品种选择";

            this.SupplyerID = su.Id.ToString();
        }
Пример #19
0
        /// <summary>
        /// GetObjectEntityInstance
        /// </summary>
        /// <returns></returns>
        object GetObjectEntityInstance(int ApproveCategory, Guid flowid, ApprovalStatus action)
        {
            string msg = string.Empty;

            switch (ApproveCategory)
            {
            case (int)ApprovalType.SupplyUnitApproval:
            case (int)ApprovalType.SupplyUnitEditApproval:
            case (int)ApprovalType.SupplyUnitLockApproval:
                SupplyUnit su = BusinessHandlerFactory.SupplyUnitBusinessHandler.GetSupplyUnitByFlowID(flowid);
                if (su != null)    //测试时可能为NULL
                {
                    su.ApprovalStatus = action;
                }
                return(su);

            case (int)ApprovalType.DrugInfoApproval:
            case (int)ApprovalType.DrugInfoEditApproval:
            case (int)ApprovalType.DrugInfoLockApproval:
                DrugInfo di = BusinessHandlerFactory.DrugInfoBusinessHandler.GetDrugInfoByFlowID(flowid);
                if (di != null)    //测试时可能为NULL
                {
                    di.ApprovalStatus = action;
                }
                return(di);

            case (int)ApprovalType.PurchaseUnitApproval:
            case (int)ApprovalType.PurchaseUnitEditApproval:
            case (int)ApprovalType.PurchaseUnitLockApproval:
                PurchaseUnit pu = BusinessHandlerFactory.PurchaseUnitBusinessHandler.GetPurchaseUnitByFlowID(flowid);
                if (pu != null)    //测试时可能为NULL
                {
                    pu.ApprovalStatus = action;
                }
                return(pu);

            case (int)ApprovalType.drugsUnqualityApproval:
                drugsUnqualificationCondition dc = new drugsUnqualificationCondition();
                dc.FlowID = flowid;
                dc.dtFrom = DateTime.MinValue;
                dc.dtTo   = DateTime.MaxValue;
                DrugsUnqualication du = BusinessHandlerFactory.DrugsUnqualicationBusinessHandler.GetDrugsUnqualificationByCondition(dc).FirstOrDefault();
                if (du != null)
                {
                    du.ApprovalStatus = action;
                }
                return(du);

            case (int)ApprovalType.drugsBreakageApproval:
                DrugsBreakage db = BusinessHandlerFactory.DrugsBreakageBusinessHandler.GetDrugsBreakageByFlowID(flowid);
                if (db != null)
                {
                    db.ApprovalStatus = action;
                    if (action == ApprovalStatus.Reject)
                    {
                        var c = BusinessHandlerFactory.DrugsUnqualicationBusinessHandler.Get(db.DrugUnqualityId);
                        if (c != null)
                        {
                            c.unqualificationType = 0;
                            BusinessHandlerFactory.DrugsUnqualicationBusinessHandler.Save(c);
                        }
                    }
                }
                return(db);

            case (int)ApprovalType.drugsInventoryMove:
                DrugsInventoryMove dim = BusinessHandlerFactory.DrugsInventoryMoveBusinessHandler.GetDrugsInventoryMoveByFlowID(flowid);
                if (dim != null)
                {
                    dim.ApprovalStatus = action;
                }
                return(dim);

            case (int)ApprovalType.VehicleApproval:
                Vehicle v = BusinessHandlerFactory.VehicleBusinessHandler.GetVehicleByFlowID(flowid);
                if (v != null)
                {
                    v.ApprovalStatusValue = (int)action;
                }
                return(v);

            case (int)ApprovalType.DirectSalesApproval:
                Models.DirectSalesOrder dso = BusinessHandlerFactory.DirectSalesOrderBusinessHandler.GetDirectSalesOrderByFlowId(flowid);
                dso.ApprovalStatusValue = (int)action;
                return(dso);
            }
            return(null);
        }
Пример #20
0
        /// <summary>
        /// 根据审核结果更新实体审核信息
        /// 对业务表的操作:审批同意且审批节点流完,需要更新业务表 后者审批拒绝需要更新业务表
        /// </summary>
        /// <param name="flowTypeIndex"></param>
        /// <param name="flowId"></param>
        /// <param name="status"></param>
        private void UpdateEntityByApprovalStatus(int flowTypeIndex, Guid flowId, ApprovalStatus status)
        {
            try
            {
                switch (flowTypeIndex)
                {
                case (int)ApprovalType.SupplyUnitApproval:
                case (int)ApprovalType.SupplyUnitEditApproval:
                case (int)ApprovalType.SupplyUnitLockApproval:
                    SupplyUnit su = new SupplyUnit();
                    su = (SupplyUnit)GetObjectEntityInstance(flowTypeIndex, flowId, status);
                    if (su == null)     //测试时可能为NULL
                    {
                        BusinessHandlerFactory.SupplyUnitBusinessHandler.Save(su);
                    }
                    break;

                case (int)ApprovalType.DrugInfoApproval:
                case (int)ApprovalType.DrugInfoEditApproval:
                case (int)ApprovalType.DrugInfoLockApproval:
                    DrugInfo di = new DrugInfo();
                    di = (DrugInfo)GetObjectEntityInstance(flowTypeIndex, flowId, status);
                    if (di == null)     //测试时可能为NULL
                    {
                        BusinessHandlerFactory.DrugInfoBusinessHandler.Save(di);
                    }
                    break;

                case (int)ApprovalType.PurchaseUnitApproval:
                case (int)ApprovalType.PurchaseUnitEditApproval:
                case (int)ApprovalType.PurchaseUnitLockApproval:
                    PurchaseUnit pu = new PurchaseUnit();
                    pu = (PurchaseUnit)GetObjectEntityInstance(flowTypeIndex, flowId, status);
                    if (pu == null)     //测试时可能为NULL
                    {
                        BusinessHandlerFactory.PurchaseUnitBusinessHandler.Save(pu);
                    }
                    break;

                case (int)ApprovalType.drugsUnqualityApproval:
                    DrugsUnqualication du = (DrugsUnqualication)GetObjectEntityInstance(flowTypeIndex, flowId, status);
                    BusinessHandlerFactory.DrugsUnqualicationBusinessHandler.Save(du);
                    break;

                case (int)ApprovalType.drugsBreakageApproval:
                    DrugsBreakage db = (DrugsBreakage)GetObjectEntityInstance(flowTypeIndex, flowId, status);
                    if (db == null)     //测试时可能为NULL
                    {
                        if (status == ApprovalStatus.Reject)
                        {
                            db.Deleted        = true;
                            db.DeleteTime     = DateTime.Now;
                            db.ApprovalStatus = ApprovalStatus.Reject;
                        }
                        BusinessHandlerFactory.DrugsBreakageBusinessHandler.Save(db);
                    }
                    break;

                case (int)ApprovalType.drugsInventoryMove:
                    DrugsInventoryMove dim = (DrugsInventoryMove)GetObjectEntityInstance(flowTypeIndex, flowId, status);
                    if (status == ApprovalStatus.Approvaled)
                    {
                        DrugInventoryRecord dir = BusinessHandlerFactory.DrugInventoryRecordBusinessHandler.Get(dim.inventoryRecordID);
                        dir.WarehouseZoneId = dim.WareHouseID;
                        BusinessHandlerFactory.DrugInventoryRecordBusinessHandler.Save(dir);
                    }
                    BusinessHandlerFactory.DrugsInventoryMoveBusinessHandler.Save(dim);
                    break;

                case (int)ApprovalType.VehicleApproval:
                    Vehicle v = (Vehicle)GetObjectEntityInstance(flowTypeIndex, flowId, status);
                    BusinessHandlerFactory.VehicleBusinessHandler.Save(v);
                    break;

                case (int)ApprovalType.DirectSalesApproval:
                    DirectSalesOrder dso = (Models.DirectSalesOrder)GetObjectEntityInstance(flowTypeIndex, flowId, status);
                    BusinessHandlerFactory.DirectSalesOrderBusinessHandler.Save(dso);
                    break;
                }
            }
            catch (Exception ex)
            {
                this.HandleException("根据审核结果更新实体审核信息失败", ex);
            }
        }
        /// <summary>
        /// 根据Name更新供应商单位
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public bool UpdateSupplyUnitByName(string name, SupplyUnit item)
        {
            try
            {
                SupplyUnit a = this.Fetch(r => r.Name == name).FirstOrDefault();
                if (a != null)
                {
                    a.QualityAgreementOutdate  = item.QualityAgreementOutdate;
                    a.AttorneyAattorneyOutdate = item.AttorneyAattorneyOutdate;
                    a.SupplyProductClass       = item.SupplyProductClass;
                    a.QualityCharger           = item.QualityCharger;
                    a.BankAccountName          = item.BankAccountName;
                    a.Bank          = item.Bank;
                    a.BankAccount   = item.BankAccount;
                    a.Code          = item.Code;
                    a.PinyinCode    = item.PinyinCode;
                    a.ContactName   = item.ContactName;
                    a.ContactTel    = item.ContactTel;
                    a.Description   = item.Description;
                    a.LegalPerson   = item.LegalPerson;
                    a.BusinessScope = item.BusinessScope;
                    a.SalesAmount   = item.SalesAmount;
                    a.Fax           = item.Fax;
                    a.Email         = item.Email;
                    a.WebAddress    = item.WebAddress;
                    a.OutDate       = item.OutDate;

                    //a.GSPGMPLicCode = item.GSPGMPLicCode;
                    //a.GSPGMPLicOutdate = item.GSPGMPLicOutdate;
                    //a.BusinessLicCode = item.BusinessLicCode;
                    //a.BusinessLicOutdate = item.BusinessLicOutdate;
                    //a.PharmaceuticalTradingLicCode = item.PharmaceuticalTradingLicCode;
                    //a.PharmaceuticalTradingLicOutdate = item.PharmaceuticalTradingLicOutdate;

                    a.GSPLicenseOutDate                   = item.GSPLicenseOutDate;
                    a.GMPLicenseOutDate                   = item.GMPLicenseOutDate;
                    a.BusinessLicenseeOutDate             = item.BusinessLicenseeOutDate;
                    a.MedicineProductionLicenseOutDate    = item.MedicineProductionLicenseOutDate;
                    a.MedicineBusinessLicenseOutDate      = item.MedicineBusinessLicenseOutDate;
                    a.InstrumentsProductionLicenseOutDate = item.InstrumentsProductionLicenseOutDate;
                    a.InstrumentsBusinessLicenseOutDate   = item.InstrumentsBusinessLicenseOutDate;

                    a.TaxRegistrationCode = item.TaxRegistrationCode;
                    a.LastAnnualDte       = item.LastAnnualDte;
                    a.UnitTypeId          = item.UnitTypeId;

                    BusinessHandlerFactory.UserLogBusinessHandler.LogUserLog(new UserLog {
                        Content = ConnectedInfoProvider.User.Account + "根据名称成功更新供货商"
                    });
                    //抽空测试
                    //a.InjectFrom(item);
                    this.Save();
                    return(true);
                }
                else
                {
                    throw new BusinessException("不存在单位名称为'" + name + "'的供应商");
                }
            }
            catch (Exception ex)
            {
                this.HandleException("方法UpdateSupplyUnitByName出错!!!", ex);
                return(false);
            }
        }
Пример #22
0
        private void GetResource(int i)
        {
            bool2String b  = this.dataGridView1.SelectedRows[0].DataBoundItem as bool2String;
            SupplyUnit  su = _listSupplyUnit.Where(r => r.Id == b.id).FirstOrDefault();

            switch (i)
            {
            case 0:
                FormMedicineBusinessLicense FormMedicineBusinessLicense = new FormMedicineBusinessLicense(su.MedicineBusinessLicenseId, true);
                SetControls.SetControlReadonly(FormMedicineBusinessLicense, true);
                FormMedicineBusinessLicense.ShowDialog();
                break;

            case 1:
                FormGMPLicense FormGMPLiscense = new FormGMPLicense(su.GMPLicenseId, string.Empty, string.Empty, true);
                SetControls.SetControlReadonly(FormGMPLiscense, true);
                FormGMPLiscense.ShowDialog();
                break;

            case 2:
                FormMedicineProductionLicense FormMedicineProductionLicense = new FormMedicineProductionLicense(su.MedicineProductionLicenseId, true);
                SetControls.SetControlReadonly(FormMedicineProductionLicense, true);
                FormMedicineProductionLicense.ShowDialog();
                break;

            case 3:
                FormBusinessLicense FormBusinessLicense = new FormBusinessLicense(su.BusinessLicenseId, string.Empty, string.Empty);
                SetControls.SetControlReadonly(FormBusinessLicense, true);
                FormBusinessLicense.ShowDialog();
                break;

            case 4:
                FormInstrumentsProductionLicense FormInstrumentsProductionLicense = new FormInstrumentsProductionLicense(su.InstrumentsProductionLicenseId, string.Empty, string.Empty, string.Empty);
                SetControls.SetControlReadonly(FormInstrumentsProductionLicense, true);
                FormInstrumentsProductionLicense.ShowDialog();
                break;

            case 5:
                FormInstrumentsBusinessLicense FormInstrumentsBusinessLicense = new FormInstrumentsBusinessLicense(su.InstrumentsBusinessLicenseId, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty);
                SetControls.SetControlReadonly(FormInstrumentsBusinessLicense, true);
                FormInstrumentsBusinessLicense.ShowDialog();
                break;

            case 6:
                FormOrganizationCodeLicense FormOrganizationCodeLicense = new FormOrganizationCodeLicense(su.OrganizationCodeLicenseId, string.Empty, string.Empty);
                SetControls.SetControlReadonly(FormOrganizationCodeLicense, true);
                FormOrganizationCodeLicense.ShowDialog();
                break;

            case 7:
                FormHealthLicense FormHealthLicense = new FormHealthLicense(su.HealthLicenseId, string.Empty, string.Empty, string.Empty);
                SetControls.SetControlReadonly(FormHealthLicense, true);
                FormHealthLicense.ShowDialog();
                break;

            case 8:
                LnstitutionLegalPersonLicense LegalPersonLicense = new LnstitutionLegalPersonLicense();
                LegalPersonLicense.Id = su.LnstitutionLegalPersonLicenseId;
                FormLegalPersonLicense FormLegalPersonLicense = new FormLegalPersonLicense(LegalPersonLicense, string.Empty, string.Empty, string.Empty);
                SetControls.SetControlReadonly(FormLegalPersonLicense, true);
                FormLegalPersonLicense.ShowDialog();
                break;

            case 9:
                FormTaxRegisterLicense FormTaxRegisterLicense = new FormTaxRegisterLicense(su.TaxRegisterLicenseId, string.Empty, string.Empty, string.Empty);
                SetControls.SetControlReadonly(FormTaxRegisterLicense, true);
                FormTaxRegisterLicense.ShowDialog();
                break;

            case 10:
                FormFoodCirculateLicense FormFoodCirculateLicense = new FormFoodCirculateLicense(su.FoodCirculateLicenseId, string.Empty, string.Empty, string.Empty);
                SetControls.SetControlReadonly(FormFoodCirculateLicense, true);
                FormFoodCirculateLicense.ShowDialog();
                break;

            case 11:
                FormGSPLicense FormGSPLicense = new FormGSPLicense(su.GSPLicenseId, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty);
                SetControls.SetControlReadonly(FormGSPLicense, true);
                FormGSPLicense.ShowDialog();
                break;

            case 12:
                MmedicalInstitutionPermit InstitutionPermit = new MmedicalInstitutionPermit();
                InstitutionPermit.Id = su.MmedicalInstitutionPermitId;
                FormMmedicalInstitutionPermit FormMmedicalInstitutionPermit = new FormMmedicalInstitutionPermit(InstitutionPermit, string.Empty, string.Empty, string.Empty, string.Empty);
                SetControls.SetControlReadonly(FormMmedicalInstitutionPermit, true);
                FormMmedicalInstitutionPermit.ShowDialog();
                break;
            }
        }
Пример #23
0
        void dgvDelivery_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex < 0 || e.ColumnIndex < 0)
                {
                    return;
                }

                var currentData = this.dgvDelivery.Rows[e.RowIndex].DataBoundItem as Business.Models.DeliveryTrasactionModel;

                //打开出库单
                if (this.dgvDelivery.Columns[e.ColumnIndex].Name == this.Column1.Name)
                {
                    if (currentData.Status == 0)
                    {
                        FormOutInventory frm = new FormOutInventory(currentData.SalesOrderId, currentData.OutInvetoryId, true);
                        frm.ShowDialog();
                    }
                    if (currentData.Status == 1)
                    {
                        PurchaseCommonEntity pce = this.PharmacyDatabaseService.GetPurchaseOrderReturnsByPurchaseOrderId(out msg, currentData.SalesOrderId).FirstOrDefault();
                        if (pce == null)
                        {
                            return;
                        }
                        PurchaseBusiness.FormReturnOrder frm = new PurchaseBusiness.FormReturnOrder(pce, true);
                        frm.ShowDialog();
                    }
                }

                #region 打开销售客户或者供货商信息
                if (this.dgvDelivery.Columns[e.ColumnIndex].Name == this.Column2.Name)
                {
                    if (currentData.Status == 1)//打开采购退货商基础信息
                    {
                        SupplyUnit su = this.PharmacyDatabaseService.GetSupplyUnit(out msg, currentData.ReceivingCompasnyID);
                        UserControls.ucSupplyUnit us = new UserControls.ucSupplyUnit(su, false);
                        Form f = new Form();
                        f.Text         = su.Name;
                        f.AutoSize     = true;
                        f.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
                        Panel p = new Panel();
                        p.AutoSize = true;
                        p.Controls.Add(us);
                        f.Controls.Add(p);
                        f.ShowDialog();
                    }
                    if (currentData.Status == 0)//打开销售客户基础信息
                    {
                        PurchaseUnit pu = this.PharmacyDatabaseService.GetPurchaseUnit(out msg, currentData.ReceivingCompasnyID);
                        if (pu == null)
                        {
                            return;
                        }
                        UserControls.ucPurchaseUnit us = new UserControls.ucPurchaseUnit(pu, false);
                        Form f = new Form();
                        f.Text          = pu.Name;
                        f.AutoSize      = true;
                        f.AutoSizeMode  = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
                        f.StartPosition = FormStartPosition.CenterScreen;
                        Panel p = new Panel();
                        p.AutoSize = true;
                        p.Controls.Add(us);
                        f.Controls.Add(p);
                        f.ShowDialog();
                    }
                }
                #endregion

                //打开发货处理画面
                if (this.dgvDelivery.Columns[e.ColumnIndex].Name == this.发货处理.Name)
                {
                    Delivery         Item     = this.PharmacyDatabaseService.GetDelivery(out msg, currentData.Id);
                    FormDeliveryEdit editForm = new FormDeliveryEdit(Item, (int)this.deliveryStatus, false);
                    editForm.ShowDialog();
                    //刷新画面
                    if (editForm.DialogResult == System.Windows.Forms.DialogResult.OK)
                    {
                        pager_DataPaging();
                    }
                }
                //打开订单
                if (this.dgvDelivery.Columns[e.ColumnIndex].Name == this.订单号.Name)
                {
                    string message = string.Empty;
                    if (currentData.Status == 0)
                    {
                        var order = this.PharmacyDatabaseService.GetSalesOrder(out message, currentData.SalesOrderId);
                        FormSalesOrderEdit editForm = new FormSalesOrderEdit(order, false);
                        editForm.ShowDialog();
                    }
                    if (currentData.Status == 1)
                    {
                        PurchaseCommonEntity pce = this.PharmacyDatabaseService.GetPurchaseOrderReturnsByPurchaseOrderId(out msg, currentData.SalesOrderId).FirstOrDefault();
                        if (pce == null)
                        {
                            return;
                        }
                        Forms.PurchaseBusiness.FormReturnOrder frm = new Forms.PurchaseBusiness.FormReturnOrder(pce, false);
                        frm.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }
        }
Пример #24
0
        private void RightMenu()
        {
            ToolStripMenuItem tsmiR;
            ToolStripMenuItem tsmi;

            cms.Items.Add("查看审核详情", null, delegate(object sender, EventArgs e)
            {
                if (this.dataGridView1.CurrentRow.Index < 0)
                {
                    return;
                }
                if (this.dataGridView1.SelectedRows.Count <= 0)
                {
                    return;
                }
                var u         = this.dataGridView1.SelectedRows[0].DataBoundItem as bool2String;
                SupplyUnit su = this.PharmacyDatabaseService.GetSupplyUnit(out msg, u.id);
                Forms.Approval.FormApprovalFlowCenter form = new Forms.Approval.FormApprovalFlowCenter(null, su.FlowID, false);
                form.ShowDialog();
            });
            cms.Items.Add("-");

            tsmiR      = new ToolStripMenuItem("资质查看");
            tsmiR.Name = "资质查看";
            cms.Items.Add(tsmiR);
            cms.Items.Add("-");
            #region 资质查看
            tsmi = new ToolStripMenuItem("GSP证书", null, delegate(object sender, EventArgs e) { this.GetResource(0); });
            tsmiR.DropDownItems.Add(tsmi);
            tsmi = new ToolStripMenuItem("GMP证书", null, delegate(object sender, EventArgs e) { this.GetResource(1); });
            tsmiR.DropDownItems.Add(tsmi);
            tsmi = new ToolStripMenuItem("药品生产许可证", null, delegate(object sender, EventArgs e) { this.GetResource(2); });
            tsmiR.DropDownItems.Add(tsmi);
            tsmi = new ToolStripMenuItem("营业执照", null, delegate(object sender, EventArgs e) { this.GetResource(3); });
            tsmiR.DropDownItems.Add(tsmi);

            tsmi = new ToolStripMenuItem("器械生产许可证", null, delegate(object sender, EventArgs e) { this.GetResource(4); });
            tsmiR.DropDownItems.Add(tsmi);

            tsmi = new ToolStripMenuItem("器械经营许可证", null, delegate(object sender, EventArgs e) { this.GetResource(5); });
            tsmiR.DropDownItems.Add(tsmi);

            tsmi = new ToolStripMenuItem("组织机构代码证", null, delegate(object sender, EventArgs e) { this.GetResource(6); });
            tsmiR.DropDownItems.Add(tsmi);

            tsmi = new ToolStripMenuItem("卫生许可证", null, delegate(object sender, EventArgs e) { this.GetResource(7); });
            tsmiR.DropDownItems.Add(tsmi);

            tsmi = new ToolStripMenuItem("事业单位法人证书", null, delegate(object sender, EventArgs e) { this.GetResource(8); });
            tsmiR.DropDownItems.Add(tsmi);

            tsmi = new ToolStripMenuItem("税务登记证", null, delegate(object sender, EventArgs e) { this.GetResource(9); });
            tsmiR.DropDownItems.Add(tsmi);

            tsmi = new ToolStripMenuItem("食品流通许可证", null, delegate(object sender, EventArgs e) { this.GetResource(10); });
            tsmiR.DropDownItems.Add(tsmi);

            tsmi = new ToolStripMenuItem("品种许可范围", null, delegate(object sender, EventArgs e) { this.GetResource(11); });
            tsmiR.DropDownItems.Add(tsmi);

            tsmi = new ToolStripMenuItem("医疗机构执业许可证", null, delegate(object sender, EventArgs e) { this.GetResource(12); });
            tsmiR.DropDownItems.Add(tsmi);
            #endregion
            cms.Items.Add("查看供货单位信息", null, delegate(object sender, EventArgs e)
            {
                if (this.dataGridView1.SelectedRows.Count <= 0)
                {
                    return;
                }
                var u         = this.dataGridView1.SelectedRows[0].DataBoundItem as bool2String;
                SupplyUnit su = this.PharmacyDatabaseService.GetSupplyUnit(out msg, u.id);
                UserControls.ucSupplyUnit us = new UserControls.ucSupplyUnit(su, false);
                Form f         = new Form();
                f.Text         = su.Name;
                f.AutoSize     = true;
                f.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
                Panel p        = new Panel();
                p.AutoSize     = true;
                p.Controls.Add(us);
                f.Controls.Add(p);
                f.ShowDialog();
            });

            cms.Items.Add("-");
            cms.Items.Add("导出EXCEL表格", null, toolStripButton2_Click);

            cms.Items.Add("-");
            cms.Items.Add("刷新列表", null, this.toolStripButton1_Click);
        }