public FormInInventory()
        {
            InitializeComponent();

            #region 电子标签控制
            this.EleModel = SearialiserHelper <Ele_Lab> .DeSerializeFileToObj("EleSetup.bin");

            if (this.EleModel.IsEnabled)
            {
                this.toolStripButton1.Visible = true;//点亮按钮显示,配置标签后,可以显示
                if (elelab.unart_manage.com_manage.FirstOrDefault() == null)
                {
                    int[] ss = new int[] { int.Parse(this.EleModel.PortName.Substring(3)) };
                    elelab.unart_manage.init_com_sys(ss);//初始化串口
                }
            }
            #endregion

            this.Bcms = new BaseForm.BasicInfoRightMenu(this.dataGridView1);
            this.Bcms.InsertDrugBasicInfo();
            this.Bcms.InsertSupplyUnitBasicInfo();
            this.dataGridView1.RowPostPaint   += delegate(object o, DataGridViewRowPostPaintEventArgs ex) { DataGridViewOperator.SetRowNumber((DataGridView)o, ex); };
            this.dataGridView1.CellMouseClick += new DataGridViewCellMouseEventHandler(dataGridView1_CellMouseClick);
        }
Exemple #2
0
        TreeNode NodeHeader1 = new TreeNode();                                     //树头部

        public FormInstrument_CategoryIndexManagement()
        {
            InitializeComponent();
            NodeHeader1.Text        = "医疗器械分类树";
            NodeHeader1.Name        = "topNode";
            NodeHeader1.ToolTipText = "请选择分类目录";
            NodeHeader1.Checked     = true;
            this.treeView1.Nodes.Add(NodeHeader1);
            #region 第二层,3个管理类别
            codeList1.Add(new Tuple <int, string>(1, "I级管理"));
            codeList1.Add(new Tuple <int, string>(2, "II级管理"));
            codeList1.Add(new Tuple <int, string>(3, "III级管理"));
            codeList1.Add(new Tuple <int, string>(4, "其他"));
            #endregion
            this.comboBox1.SelectedIndex = 0;

            #region 器械分类文件读入
            if (!File.Exists("InstCategories.bin"))
            {
                MessageBox.Show("医疗器械分类文件丢失,请联系管理员!"); return;
            }
            this._instCategory = SearialiserHelper <InstCategoryIdx.NewInstCategory> .DeSerializeFileToObj("InstCategories.bin");

            #endregion


            #region 组织分类树:loadCateData
            Action <List <NewCategory> > loadCateData = CreateTree;
            #endregion

            #region 控件Load事件,装载TreeView
            this.Load += (s, e) =>
            {
                loadCateData(_instCategory.ListCategory);
            };
            #endregion

            #region 单击节点事件
            this.treeView1.NodeMouseClick += (s, e) =>
            {
                this.toolStripButton2.Enabled = e.Node.Tag != null;
                if (e.Node.Tag == null)
                {
                    return;
                }
                var d = e.Node.Tag as NewCategory;
                if (d == null)
                {
                    return;
                }

                this.CurrentImptClass        = (NewCategory)e.Node.Tag;
                this.comboBox1.SelectedIndex = this.CurrentImptClass.Category - 1;
                this.fs.FStatus       = FormStatusEnum.Edit;
                this.CurrentImptClass = (NewCategory)e.Node.Tag;
                this.imptClassBindingSource.Clear();
                this.imptClassBindingSource.Add(this.CurrentImptClass);
            };
            #endregion

            #region 保存和关闭按钮
            this.button1.Click += (s, e) =>
            {
                var re = MessageBox.Show("确定需要保存吗?", "提示", MessageBoxButtons.OKCancel);
                if (re == System.Windows.Forms.DialogResult.Cancel)
                {
                    return;
                }

                if (!this.ValidateRequiredTextBox())
                {
                    return;
                }

                this.CurrentImptClass.Category = this.comboBox1.SelectedIndex + 1;
                if (this.fs.FStatus == FormStatusEnum.New)
                {
                    this._instCategory.ListCategory.Add(this.CurrentImptClass);
                }

                SearialiserHelper <NewInstCategory> .SerializeObjToFile(this._instCategory, "InstCategories.bin");

                MessageBox.Show("保存成功!");
                this.CurrentImptClass = new NewCategory
                {
                    Category = 1,
                };
                this.imptClassBindingSource.Clear();
                this.imptClassBindingSource.Add(this.CurrentImptClass);
                this.comboBox1.SelectedIndex = 0;
                loadCateData(_instCategory.ListCategory);
            };

            this.button2.Click += (s, e) =>
            {
                this.Close();
            };
            #endregion

            #region  除按钮
            this.toolStripButton2.Click += (s, e) =>
            {
                if (this.treeView1.SelectedNode == null)
                {
                    return;
                }
                if (((NewCategory)this.treeView1.SelectedNode.Tag) == null)
                {
                    return;
                }
                var re = MessageBox.Show("删除分类节点吗?", "提示", MessageBoxButtons.OKCancel);
                if (re == System.Windows.Forms.DialogResult.Cancel)
                {
                    return;
                }
                var selectedImpt = (NewCategory)this.treeView1.SelectedNode.Tag;
                this._instCategory.ListCategory.Remove(selectedImpt);

                SearialiserHelper <NewInstCategory> .SerializeObjToFile(this._instCategory, "Category.data");

                MessageBox.Show("删除成功!");
                loadCateData(_instCategory.ListCategory);
                this.CurrentImptClass = new NewCategory
                {
                    Category = 1
                };
                this.comboBox1.SelectedIndex = 0;
                this.imptClassBindingSource.Clear();
                this.imptClassBindingSource.Add(this.CurrentImptClass);
            };
            #endregion

            this.imptClassBindingSource.Add(this.CurrentImptClass);
        }
        public FormWareHouseZonePosition()
        {
            InitializeComponent();

            #region 右键打印单条货位条码
            RightMenu = new Pharmacy.UI.Common.BaseRightMenu(this.dataGridView1);
            RightMenu.InsertMenuItem("打印该货位的条码", delegate()
            {
                var re = MessageBox.Show("需要打印该行货位条码码?", "提示", MessageBoxButtons.OKCancel);
                if (re == System.Windows.Forms.DialogResult.Cancel)
                {
                    return;
                }

                if (!System.IO.File.Exists("resources\\名称.lbx"))
                {
                    MessageBox.Show("条码打印模板文件不存在,请增加一个!");
                    return;
                }

                bpac.DocumentClass doc = new DocumentClass();

                doc.Open("resources\\名称.lbx");

                Business.Models.WareHouseZonePositionModel m = this.dataGridView1.CurrentRow.DataBoundItem as Business.Models.WareHouseZonePositionModel;
                doc.GetObject("Title").Text = m.WareHouseZoneName + "  " + m.Name;
                doc.SetBarcodeData(0, m.BarCode);
                doc.StartPrint("", PrintOptionConstants.bpoDefault);
                doc.PrintOut(1, PrintOptionConstants.bpoDefault);

                doc.EndPrint();
                doc.Close();
            });
            #endregion

            this.EleModel = SearialiserHelper <Ele_Lab> .DeSerializeFileToObj("EleSetup.bin");

            if (this.EleModel.IsEnabled)
            {
                if (elelab.unart_manage.com_manage.FirstOrDefault() == null)
                {
                    int[] ss = new int[] { int.Parse(this.EleModel.PortName.Substring(3)) };
                    elelab.unart_manage.init_com_sys(ss);
                }
            }
            this.button2.Visible = this.EleModel.IsEnabled;

            this.dataGridView1.RowPostPaint       += delegate(object o, DataGridViewRowPostPaintEventArgs ex) { DataGridViewOperator.SetRowNumber((DataGridView)o, ex); };
            this.dataGridView1.ReadOnly            = true;
            this.dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;

            #region 插入仓库数据到combo和事件
            this.comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
            this.comboBox2.DropDownStyle = ComboBoxStyle.DropDownList;

            var w = this.PharmacyDatabaseService.AllWarehouses(out msg).Where(r => r.Deleted == false).OrderBy(r => r.Name).ToList();
            w.Insert(0, new Models.Warehouse
            {
                Name = "全部",
                Id   = Guid.Empty,
            });
            this.comboBox1.ValueMember   = "Id";
            this.comboBox1.DisplayMember = "Name";
            this.comboBox1.DataSource    = w;
            this.comboBox1.SelectedIndex = 0;

            var wz  = this.PharmacyDatabaseService.AllWarehouseZones(out msg).Where(r => r.Deleted == false).OrderBy(r => r.Name).ToList();
            var wzt = new List <Models.WarehouseZone>();
            wzt.Add(
                new Models.WarehouseZone
            {
                Name = "全部",
                Id   = Guid.Empty,
            });

            this.comboBox2.ValueMember   = "Id";
            this.comboBox2.DisplayMember = "Name";
            this.comboBox2.DataSource    = wzt;
            this.comboBox2.SelectedIndex = 0;

            this.comboBox1.SelectedIndexChanged += (sender, e) =>
            {
                var wzs = wz.Where(r => r.WarehouseId == (Guid)this.comboBox1.SelectedValue).OrderBy(r => r.Name).ToList();

                wzs.Insert(0, new Models.WarehouseZone
                {
                    Name = "全部",
                    Id   = Guid.Empty,
                });
                this.comboBox2.ValueMember   = "Id";
                this.comboBox2.DisplayMember = "Name";
                this.comboBox2.DataSource    = wzs;
                this.comboBox2.SelectedIndex = 0;
            };
            #endregion


            //批量创建
            this.toolStripButton2.Click += (sender, e) =>
            {
                FormWareHouseZonePosition_Editor frm = new FormWareHouseZonePosition_Editor(w, wz);
                frm.Show(this);
            };

            #region 修改ACTION
            Action <object, EventArgs> EditPostionAction = (sender, e) =>
            {
                if (this.dataGridView1.CurrentRow == null)
                {
                    return;
                }
                var c = this.dataGridView1.CurrentRow.DataBoundItem as Business.Models.WareHouseZonePositionModel;
                using (FormWareHouseZonePositionEdit frm = new FormWareHouseZonePositionEdit(w, wz, c))
                {
                    var re = frm.ShowDialog();
                    if (re == System.Windows.Forms.DialogResult.OK)
                    {
                        this.toolStripButton1_Click(null, null);
                    }
                }
            };
            #endregion

            //修改
            this.toolStripButton3.Click += (sender, e) => EditPostionAction(sender, e);
            //Datagridview双击修该货位
            this.dataGridView1.CellDoubleClick += (sender, e) =>
            {
                if (e.RowIndex < 0 || e.ColumnIndex < 0)
                {
                    return;
                }
                EditPostionAction(null, null);
            };
        }
        /// <summary>
        /// 初始化画面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FormOutInventory_Load(object sender, EventArgs e)
        {
            //提交出库
            this.btnSubmit.Visible = this.Authorize(ModuleKeys.SubmitOutInventoryForOrder);
            //this.toolStripButton1.Visible = this.btnSubmit.Visible;

            //出库审核
            this.tsbtnAccept.Visible = this.Authorize(ModuleKeys.ApprovalOutInventoryForOrder);
            //销退申请
            this.tsbtnOrderReturn.Visible = this.Authorize(ModuleKeys.SubmitOrderReturn);
            //清空现有tab
            tabContorl.TabPages.Clear();

            #region 电子标签控制
            EleModel = SearialiserHelper <Ele_Lab> .DeSerializeFileToObj("EleSetup.bin");

            if (EleModel.IsEnabled)
            {
                this.toolStripButton1.Visible = true;//点亮按钮显示,配置标签后,可以显示
                if (elelab.unart_manage.com_manage.FirstOrDefault() == null)
                {
                    int[] ss = new int[] { int.Parse(EleModel.PortName.Substring(3)) };
                    elelab.unart_manage.init_com_sys(ss);//初始化串口
                }
            }
            #endregion

            string message = string.Empty;
            try
            {
                _salesOrder = PharmacyDatabaseService.GetSalesOrder(out message, _orderID);

                //获取现有的出库信息
                var list = PharmacyDatabaseService.GetOutInventoryByOrderID(out message, _salesOrder.Id);
                if (_outID != Guid.Empty)
                {
                    //此时应该只初始化一个
                    list = list.Where(p => p.Id == _outID).ToArray();
                }

                foreach (var item in list)
                {
                    string tabTitle = string.Empty;
                    if (item.Id != Guid.Empty)
                    {
                        string status = Utility.getEnumTypeDisplayName <OutInventoryStatus>((OutInventoryStatus)item.OutInventoryStatusValue);
                        tabTitle = string.Format("{0}[{1}]", item.CreateTime.ToString("yyyy年MM月dd日"), status);
                    }
                    else
                    {
                        tabTitle = "*新建拣货单";
                    }

                    InitTabPage(0, tabTitle, _salesOrder, item);
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                MessageBox.Show("拣货单窗体加载初始化失败!!!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            tabContorl_SelectedIndexChanged(null, null);
        }
        /// <summary>
        /// 初始化方法-需设定读写FSE、实体entity
        /// </summary>
        public FormInstrument()
        {
            InitializeComponent();

            this.Text = this.FSE == FormStatusEnum.New ? "新建医疗器械信息" : this.FSE == FormStatusEnum.Edit ? "编辑医疗器械信息" : "查看医疗器械信息";


            #region 验证文本框
            this.AddTextBoxToValidator(this);
            #endregion

            #region 绑定实体

            int _count = 0;
            if (this.entity == null)
            {
                this.entity         = InitEntity();
                _count              = PharmacyDatabaseService.GetDrugInfoCount(string.Empty);
                this.entity.DocCode = "SPDA" + _count.ToString().PadLeft(6, '0');
                this.entity.Code    = "SPBH" + _count.ToString().PadLeft(6, '0');
            }
            #endregion

            #region 生成注记码和产品编号
            this.textBox1.LostFocus += (sender, e) =>
            {
                entity.Pinyin           = this.textBox1.Text.Trim() == string.Empty ? string.Empty : CreateChineseSpell.CreatePY(this.textBox1.Text.Trim());
                this.textBox2.Text      = entity.Pinyin;
                this.entity.ProductName = this.textBox1.Text.Trim();
            };
            #endregion

            #region 绑定存储条件
            this.comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
            var storageList = this.PharmacyDatabaseService.AllDictionaryStorageTypes(out msg).Where(r => !r.Deleted).OrderBy(r => r.Name).ToList();
            this.comboBox1.DisplayMember = "Name";
            this.comboBox1.ValueMember   = "Name";
            this.comboBox1.DataSource    = storageList;
            if (storageList.Count() > 0)
            {
                this.comboBox1.SelectedIndex = 0;
            }
            #endregion

            #region 绑定审批流程
            this.comboBox2.DropDownStyle = ComboBoxStyle.DropDownList;
            var ApprovalProceedureList = this.PharmacyDatabaseService.GetApprovalFlowTypeByBusiness(out msg, Models.ApprovalType.DrugInfoApproval).OrderBy(r => r.Name).ToList();

            this.comboBox2.DisplayMember = "Name";
            this.comboBox2.ValueMember   = "Id";
            this.comboBox2.DataSource    = ApprovalProceedureList;
            if (ApprovalProceedureList.Count() > 0)
            {
                comboBox2.SelectedIndex = 0;
            }
            #endregion

            #region 绑定仓库和库位
            this.comboBox3.DropDownStyle = ComboBoxStyle.DropDownList;
            this.comboBox4.DropDownStyle = ComboBoxStyle.DropDownList;
            var warehouseList = this.PharmacyDatabaseService.AllWarehouses(out msg).Where(r => !r.Deleted && r.Enabled).OrderBy(r => r.Name).ToList();
            this.comboBox3.DisplayMember = "Name";
            this.comboBox3.ValueMember   = "Id";
            this.comboBox3.DataSource    = warehouseList;
            if (warehouseList.Count() > 0)
            {
                this.comboBox3.SelectedIndex = 0;
            }

            var warehousezoneList = this.PharmacyDatabaseService.AllWarehouseZones(out msg).Where(r => !r.Deleted && r.Enabled).OrderBy(r => r.Name).ToList();
            this.comboBox4.DisplayMember = "Name";
            this.comboBox4.ValueMember   = "Id";

            var wz = warehousezoneList.Where(r => r.WarehouseId == (Guid)this.comboBox3.SelectedValue).ToList();
            this.comboBox4.DataSource = wz;
            if (wz.Count() > 0)
            {
                this.comboBox4.SelectedIndex = 0;
            }

            this.comboBox3.SelectedIndexChanged += (sender, e) =>
            {
                wz = warehousezoneList.Where(r => r.WarehouseId == (Guid)this.comboBox3.SelectedValue).ToList();
                this.comboBox4.DataSource = wz;
                if (wz.Count() > 0)
                {
                    this.comboBox4.SelectedIndex = 0;
                }
            };

            #endregion

            #region 器械分类判定码
            FormInstrument_CategoryTable frm = null;

            Func <string, bool> CheckInstrumentTypeStr = (s) =>
            {
                if (s == string.Empty)
                {
                    return(true);
                }
                if (s.Length < 6 || s.Length > 7)
                {
                    return(false);
                }
                if (!s.Contains("-"))
                {
                    return(false);
                }
                if (s.Substring(s.Length - 3, 1) != "-")
                {
                    return(false);
                }
                if (s[0] != 'A' && s[0] != 'B')
                {
                    return(false);
                }
                if (s[1] != 'A' && s[1] != 'B')
                {
                    return(false);
                }
                if (int.Parse(s[s.Length - 1].ToString()) > 3 || int.Parse(s[s.Length - 1].ToString()) < 1)
                {
                    return(false);
                }
                if (int.Parse(s[s.Length - 2].ToString()) > 3 || int.Parse(s[s.Length - 2].ToString()) < 1)
                {
                    return(false);
                }
                return(true);
            };

            this.linkLabel1.Click += (sender, e) =>
            {
                string str = this.entity.StandardCode.Trim();

                if (!CheckInstrumentTypeStr(str))
                {
                    if (MessageBox.Show("分类码错误!需要清空,并且重新设定吗?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
                    {
                        return;
                    }
                    else
                    {
                        this.entity.StandardCode = string.Empty;
                    }
                }

                if (frm == null || frm.IsDisposed)
                {
                    frm = new FormInstrument_CategoryTable(str);
                    frm.SelectInstrumentType += (sender1, e1) =>
                    {
                        this.entity.StandardCode = e1.InstrumentTypeStr;//设定为经营范围
                        drugInfoBindingSource.ResetBindings(false);
                        this.label35.Text = InstTypeInference.InstTypeInfereces(e1.InstrumentTypeStr);
                    };
                }
                frm.Hide();
                frm.Show(this);
            };
            #endregion

            #region 器械分类目录选择代码
            this.linkLabel2.Click += (s, e) =>
            {
                FormInstrument_CategoryIndex frmCateIdx = new FormInstrument_CategoryIndex(this._instCategory);
                frmCateIdx.Show(this);
                frmCateIdx.SelectInstrumentIndexCode += (s1, ev) =>
                {
                    this.textBox11.Text          = ev.InstrumentIndexCode;
                    this.entity.StandardCode     = ev.InstrumentIndexCode;
                    label35.Text                 = ev.Description;
                    this.comboBox5.SelectedIndex = ev.Category - 1;
                };
            };
            #endregion

            #region 管理分类combo
            this.comboBox5.DropDownStyle = ComboBoxStyle.DropDownList;
            this.comboBox5.SelectedIndex = 0;
            #endregion

            #region 录入人
            this.label21.Text = BugsBox.Pharmacy.AppClient.Common.AppClientContext.currentUser.Employee.Name;
            #endregion

            #region Form_Load事件

            this.Load += (sender, e) =>
            {
                #region 器械分类文件读入
                if (!File.Exists("InstCategories.bin"))
                {
                    MessageBox.Show("医疗器械分类文件丢失,请联系管理员!"); return;
                }
                this._instCategory = SearialiserHelper <InstCategoryIdx.NewInstCategory> .DeSerializeFileToObj("InstCategories.bin");

                this.drugInfoBindingSource.Add(entity);
                #endregion

                #region 初始化工具条按钮显示
                if (FSE == FormStatusEnum.New)
                {
                    this.toolStripButton3.Visible = false;
                }
                if (FSE == FormStatusEnum.Edit)
                {
                    this.toolStripButton1.Visible = false;
                    this.toolStripButton3.Visible = true;
                }
                if (FSE == FormStatusEnum.Read)
                {
                    this.toolStripButton1.Visible = false;
                    this.toolStripButton3.Visible = false;
                }
                #endregion

                #region 审核Combo
                if (this.entity.FlowID != null && this.entity.FlowID != Guid.Empty)
                {
                    var ApprovalFlow = this.PharmacyDatabaseService.GetApproveFlowsByFlowID(out msg, entity.FlowID);

                    var AllApprovalTypes = this.PharmacyDatabaseService.AllApprovalFlowTypes(out msg).ToList();
                    if (entity.IsApproval)//如果审批结束
                    {
                        AllApprovalTypes             = AllApprovalTypes.Where(r => r.ApprovalType == Models.ApprovalType.DrugInfoEditApproval).ToList();
                        this.comboBox2.DataSource    = null;
                        this.comboBox2.DisplayMember = "Name";
                        this.comboBox2.ValueMember   = "Id";
                        this.comboBox2.DataSource    = AllApprovalTypes;
                        this.comboBox2.SelectedIndex = 0;
                    }
                    else//如果审批未结束
                    {
                        this.comboBox2.DataSource    = null;
                        this.comboBox2.DisplayMember = "Name";
                        this.comboBox2.ValueMember   = "Id";
                        this.comboBox2.DataSource    = AllApprovalTypes;
                        this.comboBox2.Enabled       = false;
                        this.comboBox2.SelectedValue = ApprovalFlow.ApprovalFlowTypeId;
                    }
                }
                #endregion

                #region 实体数据
                if (!string.IsNullOrEmpty(this.entity.DrugStorageTypeCode))
                {
                    this.comboBox1.SelectedValue = this.entity.DrugStorageTypeCode;
                }
                if (this.entity.WareHouses != null && this.entity.WareHouses != Guid.Empty)
                {
                    this.comboBox3.SelectedValue = entity.WareHouses;
                }
                if (!string.IsNullOrEmpty(this.entity.WareHouseZones))
                {
                    this.comboBox4.SelectedValue = Guid.Parse(entity.WareHouseZones);
                }

                if (!string.IsNullOrEmpty(this.entity.DrugCategoryCode))
                {
                    this.comboBox5.SelectedItem = entity.DrugCategoryCode;
                }

                var imptClasse = this._instCategory.ListCategory.FirstOrDefault(r => r.StandardCode == entity.StandardCode);
                this.label35.Text = imptClasse == null ? string.Empty : imptClasse.Description;
                #endregion
            };
            #endregion

            #region 提交事件
            this.toolStripButton1.Click += (sender, e) =>
            {
                if (MessageBox.Show("确定需要提交该医疗器械信息吗?", "", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.Cancel)
                {
                    return;
                }
                this.Validate();

                if (!this.ValidateRequiredTextBox())
                {
                    return;                                   //验证文本框
                }
                if (this.comboBox1.SelectedItem == null)
                {
                    MessageBox.Show("请选择存储方式!"); return;
                }
                this.entity.DrugStorageTypeCode = ((Models.DictionaryStorageType) this.comboBox1.SelectedItem).Name;

                this.entity.WareHouses = (Guid)this.comboBox3.SelectedValue;
                if (warehousezoneList.Count <= 0)
                {
                    MessageBox.Show("您所选择的仓库没有设定库位(货架),请选择其他仓库!");
                    return;
                }
                this.entity.WareHouseZones = this.comboBox4.SelectedValue.ToString();

                this.entity.DrugCategoryCode = this.comboBox5.SelectedItem.ToString();

                this.entity.FlowID = Guid.NewGuid();

                this.toolStripButton3.Enabled = !this.toolStripButton3.Enabled;//开始提交

                var b = this.PharmacyDatabaseService.AddDrugInfoApproveFlow(this.entity, (Guid)this.comboBox2.SelectedValue, BugsBox.Pharmacy.AppClient.Common.AppClientContext.currentUser.Id, "新增医疗器械:" + this.entity.ProductGeneralName);

                if (b == string.Empty)
                {
                    MessageBox.Show("新增医疗器械:" + this.entity.ProductGeneralName + "成功!");
                    this.PharmacyDatabaseService.WriteLog(BugsBox.Pharmacy.AppClient.Common.AppClientContext.currentUser.Id, "新增医疗器械:" + this.entity.ProductGeneralName);

                    this.drugInfoBindingSource.Clear();
                    this.entity = default(Models.DrugInfo);
                    this.entity = InitEntity();
                    this.drugInfoBindingSource.Add(this.entity);
                    _count = PharmacyDatabaseService.GetDrugInfoCount(string.Empty);

                    this.entity.DocCode           = "SPDA" + _count.ToString().PadLeft(6, '0');
                    this.textBox3.Text            = this.entity.DocCode;
                    this.entity.Code              = "SPBH" + _count.ToString().PadLeft(6, '0');
                    this.textBox18.Text           = this.entity.Code;
                    this.toolStripButton3.Enabled = !this.toolStripButton3.Enabled;//结束提交
                }
                else
                {
                    MessageBox.Show("提交失败,请稍后重试!");
                    this.toolStripButton3.Enabled = !this.toolStripButton3.Enabled;//结束提交
                }
            };

            #endregion

            #region 保存编辑数据按钮
            this.toolStripButton3.Click += (sender, e) =>
            {
                if (this.FSE != FormStatusEnum.Edit)
                {
                    return;
                }
                if (MessageBox.Show("确定需要保存该医疗器械信息吗?", "", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.Cancel)
                {
                    return;
                }
                this.Validate();

                if (!this.ValidateRequiredTextBox())
                {
                    return;                                   //验证文本框
                }
                if (this.comboBox1.SelectedItem == null)
                {
                    MessageBox.Show("请选择存储方式!"); return;
                }
                this.entity.DrugStorageTypeCode = ((Models.DictionaryStorageType) this.comboBox1.SelectedItem).Name;

                this.entity.WareHouses     = (Guid)this.comboBox3.SelectedValue;
                this.entity.WareHouseZones = this.comboBox4.SelectedValue.ToString();
                this.entity.PermitOutDate  = DateTime.Now.AddYears(50).Date;

                this.entity.DrugCategoryCode = this.comboBox5.SelectedItem.ToString();
                this.entity.Valid            = false;
                Guid typeid = (Guid)this.comboBox2.SelectedValue;
                if (entity.IsApproval || entity.ApprovalStatusValue == (int)Models.ApprovalStatus.Reject)
                {
                    entity.ApprovalStatus = Models.ApprovalStatus.Waitting;
                    entity.IsApproval     = false;
                    entity.FlowID         = Guid.NewGuid();

                    this.toolStripButton3.Enabled = !this.toolStripButton3.Enabled;//开始提交
                    msg = PharmacyDatabaseService.ModifyDrugInfoApproveFlow(entity, typeid, BugsBox.Pharmacy.AppClient.Common.AppClientContext.CurrentUser.Id, "审核后修改医疗器械信息:" + entity.ProductGeneralName);
                    if (string.IsNullOrEmpty(msg))
                    {
                        MessageBox.Show("提交成功!");
                        if (this.InstrumentInfoSubmit != null)
                        {
                            this.InstrumentInfoSubmit(this, true);
                        }
                        this.Dispose();
                    }
                    else
                    {
                        MessageBox.Show("提交失败,请稍后再试!");
                        this.toolStripButton3.Enabled = !this.toolStripButton3.Enabled;
                        return;
                    }
                }
                else
                {
                    entity.ApprovalStatus         = Models.ApprovalStatus.Waitting;
                    this.toolStripButton3.Enabled = !this.toolStripButton3.Enabled;//开始提交

                    msg = PharmacyDatabaseService.ModifyDrugInfoApproveFlow(entity, typeid, BugsBox.Pharmacy.AppClient.Common.AppClientContext.CurrentUser.Id, "审核前修改医疗器械信息" + entity.ProductGeneralName);
                    if (string.IsNullOrEmpty(msg))
                    {
                        MessageBox.Show("提交成功!");
                        if (this.InstrumentInfoSubmit != null)
                        {
                            this.InstrumentInfoSubmit(this, true);
                        }
                        this.Dispose();
                    }
                    else
                    {
                        MessageBox.Show("提交失败,请稍后再试!");
                        this.toolStripButton3.Enabled = !this.toolStripButton3.Enabled;
                        return;
                    }
                }
            };
            #endregion
        }
Exemple #6
0
        TreeNode NodeHeader = new TreeNode();                                     //树头部
        public FormGSPLicense(Guid guid, string legalPerson, string qualityCharger, string name, string address, string wareHouseAddress)
        {
            InitializeComponent();
            this._gspLiscenceId = guid;

            #region 读入分类目录数据文件
            this._instCategory = SearialiserHelper <InstCategoryIdx.NewInstCategory> .DeSerializeFileToObj("InstCategories.bin");

            NodeHeader.Text        = "医疗器械分类树";
            NodeHeader.Name        = "topNode";
            NodeHeader.ToolTipText = "请选择分类目录";
            NodeHeader.Checked     = true;
            this.treeView1.Nodes.Add(NodeHeader);

            #region 第二层,3个管理类别
            codeList.Add(new Tuple <int, string>(1, "I级管理"));
            codeList.Add(new Tuple <int, string>(2, "II级管理"));
            codeList.Add(new Tuple <int, string>(3, "III级管理"));
            #endregion

            #endregion

            #region 经营方式
            var bussinesstypes = this.PharmacyDatabaseService.AllBusinessTypes(out msg).OrderBy(r => r.Name).ToList();
            this.comboBoxBusinessTypeId.DisplayMember = "Name";
            this.comboBoxBusinessTypeId.ValueMember   = "Id";
            this.comboBoxBusinessTypeId.DataSource    = bussinesstypes;
            #endregion

            #region 初始化gsp对象和分类码列表
            if (this._gspLiscenceId != Guid.Empty)
            {
                this._gspLiscence = PharmacyDatabaseService.GetGSPLicense(out msg, this._gspLiscenceId);
                this._fs.FStatus  = FormStatusEnum.Edit;

                foreach (var i in this._instCategory.ListCategory)
                {
                    i.IsChecked = false;
                }

                foreach (var row in this._gspLiscence.GMSPLicenseBusinessScopes.OrderBy(r => r.BusinessScopeCode).Where(r => r.Deleted == false))
                {
                    this._instCategory.ListCategory.FirstOrDefault(r => r.StandardCode == row.BusinessScopeCode).IsChecked = true;
                }
            }
            else
            {
                this._gspLiscence = new GSPLicense
                {
                    Name             = "分类控制中心",
                    RegAddress       = address,
                    WarehouseAddress = wareHouseAddress,
                    LegalPerson      = legalPerson,
                    QualityHeader    = qualityCharger,
                    BusinessTypeId   = bussinesstypes.FirstOrDefault().Id,
                    Header           = legalPerson,
                    Code             = "无",
                    ChangeRecord     = DateTime.Now.Date.ToLongDateString(),
                    DocNumber        = "无",
                    IssuanceDate     = DateTime.Now.Date,
                    IssuanceOrg      = "无",
                    LicenseCode      = "无",
                    LicenseType      = LicenseType.GSP,
                    OutDate          = DateTime.Now.Date.AddYears(50),
                    StartDate        = DateTime.Now.Date,
                    StoreId          = BugsBox.Pharmacy.Config.PharmacyServiceConfig.Config.CurrentStore.Id,
                    Valid            = true,
                    UnitName         = name,
                    Id = Guid.NewGuid(),
                    GMSPLicenseBusinessScopes = new List <GMSPLicenseBusinessScope>()
                };
            }
            this.gSPLicenseBindingSource.Clear();
            this.gSPLicenseBindingSource.Add(this._gspLiscence);
            #endregion

            #region 分类树双击加入代码列表
            this.treeView1.NodeMouseClick += (s, e) =>
            {
            };
            #endregion
        }