Esempio n. 1
0
        public bool AddDrugsBreakageByFlowID(DrugsBreakage value, Guid flowTypeID, string changeNote)
        {
            try
            {
                var c = RepositoryProvider.Db.DrugsUnqualications.Where(r => r.DocumentNumber == value.UnqualificationDocumentNumber);
                var d = c.FirstOrDefault();
                d.unqualificationType = 2;
                d.Specific            = value.Specific;
                value.createTime      = DateTime.Now;
                value.updateTime      = DateTime.Now;
                this.Add(value);
                BusinessHandlerFactory.DrugsUnqualicationBusinessHandler.Save(d);

                value.DocumentNumber = new BillDocumentCodeBusinessHandler(BusinessHandlerFactory.RepositoryProvider, null).GenerateBillDocumentCodeByTypeValue((int)BillDocumentType.DrugBreakage).Code;

                //增加审批流程
                ApprovalFlow af = BusinessHandlerFactory.ApprovalFlowBusinessHandler.GetApproveFlowInstance(flowTypeID, value.flowID, value.createUID, changeNote);
                BusinessHandlerFactory.ApprovalFlowBusinessHandler.Add(af);

                //增加审批流程记录
                ApprovalFlowRecord afr = BusinessHandlerFactory.ApprovalFlowRecordBusinessHandler.GetApproveFlowRecordInstance(af, value.createUID, changeNote);
                BusinessHandlerFactory.ApprovalFlowRecordBusinessHandler.Add(afr);

                this.Save();
                return(true);
            }
            catch (Exception e)
            {
                this.HandleException("新增报损药品审批流程记录失败", e);
                return(false);
            }
        }
        private DrugsBreakage sumbitToBreak(int rdx)
        {
            drugsUnqualication d  = bList[rdx];
            DrugsBreakage      db = new DrugsBreakage();

            db.ApprovalStatus        = ApprovalStatus.Waitting;
            db.batchNo               = d.batchNo;
            db.createUID             = AppClient.Common.AppClientContext.CurrentUser.Id;
            db.Description           = d.Description;
            db.DrugInventoryRecordID = Guid.Parse(d.DrugInventoryRecordID.ToString());
            db.drugName              = d.drugName;
            db.flowID   = Guid.NewGuid();
            db.Id       = Guid.NewGuid();
            db.quantity = d.quantity;
            db.source   = d.source;
            db.UnqualificationDocumentNumber = d.DocumentNumber;
            db.unqualificationType           = d.unqualificationType;
            db.DosageType                  = d.DosageType;
            db.Specific                    = d.Specific;
            db.ExpireDate                  = d.ExpireDate;
            db.produceDate                 = d.produceDate;
            db.DrugInfoId                  = d.DrugInfo;
            db.Origin                      = d.Origin;
            db.PurchasePrice               = d.PurchasePrice;
            db.DrugUnqualityId             = d.Id;
            db.PurchaseOrderDocumentNumber = d.PurchaseOrderDocumentNumber;
            db.PurchaseOrderId             = d.PurchaseOrderId;
            db.Supplyer                    = d.Supplyer;
            db.FactoryName                 = d.factoryName;
            db.PurchaseOrderId             = d.PurchaseOrderId;

            return(db);
        }
Esempio n. 3
0
        public DrugsBreakage GetDrugsBreakageByFlowID(Guid flowID)
        {
            var           c  = RepositoryProvider.Db.DrugsBreakages.AsQueryable();
            DrugsBreakage db = c.Where(r => r.flowID == flowID).ToList().FirstOrDefault();

            return(db);
        }
Esempio n. 4
0
        void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0 || e.ColumnIndex < 0)
            {
                return;
            }


            if (this.dataGridView1.Columns[e.ColumnIndex].Name != this.Clm7.Name)
            {
                var  c = this.dataGridView1.Rows[e.RowIndex].DataBoundItem as DrugsBreakage;
                Guid approvalFlowId = c.flowID;
                using (FormUnqualificationApprovalDetail f = new FormUnqualificationApprovalDetail())
                {
                    var af = this.PharmacyDatabaseService.GetApproveFlowsByFlowID(out msg, approvalFlowId);
                    UserControls.UcDrugBreakage ucf = new UserControls.UcDrugBreakage(c, af);
                    f.Height += ucf.Height;
                    f.Controls.Add(ucf);
                    ucf.Dock = DockStyle.Fill;
                    f.Text   = "品种报损单:" + c.drugName;
                    f.ShowDialog();
                }
            }
            else
            {
                DrugsBreakage db = bList[e.RowIndex];
                FormDrugUnqualificationDestroy frm = new FormDrugUnqualificationDestroy(db);
                frm.ShowDialog();
                if (frm.DialogResult == System.Windows.Forms.DialogResult.OK)
                {
                    toolStripButton1_Click(sender, e);
                }
            }
        }
Esempio n. 5
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            DrugsBreakage db = new DrugsBreakage();

            db.ApprovalStatusValue = 2;
            this.loadData(db);
        }
Esempio n. 6
0
        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            string        t  = this.toolStripTextBox1.Text.Trim();
            DrugsBreakage db = new DrugsBreakage();

            db.drugName = t;
            loadData(db);
        }
Esempio n. 7
0
        private void DestroyApply_Load(object sender, EventArgs e)
        {
            DrugsBreakage db = new DrugsBreakage();

            db.ApprovalStatusValue = 2;
            this.loadData(db);
            this.dataGridView1.DataSource = bList;
        }
Esempio n. 8
0
        private void loadData(DrugsBreakage db)
        {
            bList.Clear();
            var c = PharmacyDatabaseService.GetDrugsBreakagesPassed(db, out msg);

            foreach (var i in c)
            {
                bList.Add(i);
            }
        }
Esempio n. 9
0
        public DrugsBreakage[] GetDrugsBreakagesPassed(DrugsBreakage db)
        {
            var c = RepositoryProvider.Db.DrugsBreakages.Where(r => r.ApprovalStatusValue == 2);

            if (db.ApprovalStatusValue != 0)
            {
                c = c.Where(r => r.ApprovalStatusValue == db.ApprovalStatusValue);
            }
            if (db.drugName != null && db.drugName != string.Empty)
            {
                c = c.Where(r => r.drugName.Contains(db.drugName) || r.batchNo.Contains(db.drugName) || r.source.Contains(db.drugName));
            }
            return(c.ToArray());
        }
        private void toolStripButton8_Click(object sender, EventArgs e)
        {
            this.dgvDrugDetailList.EndEdit();
            List <drugsUnqualication> s = new List <drugsUnqualication>();

            if (MessageBox.Show("需要提交选中的记录吗?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
            {
                return;
            }
            foreach (DataGridViewRow r in this.dgvDrugDetailList.Rows)
            {
                if (!Convert.ToBoolean(r.Cells[0].EditedFormattedValue))
                {
                    continue;
                }
                int rdx = r.Index;
                drugsUnqualication d  = bList[rdx];
                DrugsBreakage      db = sumbitToBreak(rdx);

                if (!this.PharmacyDatabaseService.AddDrugsBreakageByFlowID(db, Guid.Parse(comboBox1.SelectedValue.ToString()), "新增报损审批", out msg))
                {
                    MessageBox.Show("不合格药品报损提交失败!失败记录:\n药品名称:" + bList[rdx].drugName + ",批次号:" + bList[rdx].batchNo + "\n请稍候再试!"); continue;
                }
                s.Add(d);
            }

            foreach (var c in s)
            {
                bList.Remove(c);
                list.Remove(c);
            }

            if (s.Count > 0)
            {
                MessageBox.Show("新建报损申请成功!");
                this.PharmacyDatabaseService.WriteLog(AppClientContext.CurrentUser.Id, "批量新建报损申请成功");
            }
            else
            {
                MessageBox.Show("新建报损申请失败!");
                this.PharmacyDatabaseService.WriteLog(AppClientContext.CurrentUser.Id, "批量新建报损申请失败");
            }
            s = null;
        }
        private void toolStripButton9_Click(object sender, EventArgs e)
        {
            if (this.dgvDrugDetailList.CurrentRow == null)
            {
                MessageBox.Show("请选择要提交报损处理的不合格药品记录!");
                return;
            }
            drugsUnqualication u = bList[this.dgvDrugDetailList.CurrentRow.Index];

            if (MessageBox.Show("需要提交报损审批吗?", "提示", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK)
            {
                int           rdx = this.dgvDrugDetailList.CurrentRow.Index;
                DrugsBreakage db  = this.sumbitToBreak(rdx);
                if (this.PharmacyDatabaseService.AddDrugsBreakageByFlowID(db, Guid.Parse(comboBox1.SelectedValue.ToString()), "新增报损审批:" + db.drugName, out msg))
                {
                    MessageBox.Show("提交成功!");
                    this.PharmacyDatabaseService.WriteLog(AppClientContext.CurrentUser.Id, "提交新增报损审批操作成功" + db.drugName);
                    bList.Remove(u);
                    list.Remove(u);
                }
            }
        }
Esempio n. 12
0
 private void GetDrugBreakageInfo(DrugsBreakage d)
 {
     dq                 = d;
     t1.Text            = d.drugName;
     t2.Text            = d.batchNo;
     t3.Text            = d.quantity.ToString();
     t4.Text            = d.PurchasePrice.ToString() + "元";
     t5.Text            = d.Specific;
     t6.Text            = d.DosageType;
     t7.Text            = d.FactoryName;
     t8.Text            = d.produceDate.ToLongDateString();
     t9.Text            = d.ExpireDate.ToLongDateString();
     t10.Text           = d.Supplyer;
     t11.Text           = "不合格库区";
     t13.Text           = (d.quantity * d.PurchasePrice).ToString();
     this.textBox1.Text = "不合格库";
     this.textBox3.Text = d.Origin;
     this.textBox4.Text = d.source;
     this.textBox2.Text = d.PurchaseOrderDocumentNumber;
     this.textBox5.Text = d.UnqualificationDocumentNumber;
     this.textBox6.Text = d.DocumentNumber;
     Forms.Common.SetControls.SetControlReadonly(this.groupBox3, true);
 }
Esempio n. 13
0
        public FormDrugUnqualificationDestroy(DrugsUnqualificationDestroy d)
        {
            InitializeComponent();
            this.toolStripButton1.Enabled = true;
            DrugsBreakage dbk = this.PharmacyDatabaseService.GetDrugsBreakage(d.DrugsUnqualicationID, out msg);

            this.GetDrugBreakageInfo(dbk);

            q1.Text = d.DestroyPlace;
            q2.Text = d.DestroyTime.ToLongDateString();
            q3.Text = d.DestroyCargo;
            q4.Text = d.Destroyer;
            q5.Text = d.DestroyMan;
            q6.Text = d.DestroyMethod;
            q7.Text = d.DestroyReason;
            q8.Text = d.DestroyState;
            q9.Text = d.SupervisorOpinion;

            Forms.Common.SetControls.SetControlReadonly(this.groupBox2, true);

            toolStrip1.Enabled       = false;
            button1.Visible          = false;
            toolStripButton3.Enabled = true;
        }
Esempio n. 14
0
 public FormDrugUnqualificationDestroy(DrugsBreakage d)
 {
     InitializeComponent();
     this.GetDrugBreakageInfo(d);
     ListDrugBreakage.Add(d);
 }
Esempio n. 15
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);
        }
Esempio n. 16
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);
            }
        }
Esempio n. 17
0
        /// <summary>
        /// 打开详细的审批对象信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvApprovalList_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex < 0)
                {
                    return;
                }

                //加入详细画面
                if (dgvApprovalList.Columns[e.ColumnIndex].Name == "查看详细")
                {
                    if (dgvApprovalList.Rows[e.RowIndex].Cells[4].Value != null)
                    {
                        string msg = string.Empty;
                        Models.ApprovalFlow flow     = _approveFlowList[e.RowIndex];
                        ApprovalFlowType    flowType = PharmacyDatabaseService.GetApprovalFlowType(out msg, flow.ApprovalFlowTypeId);
                        switch (flowType.ApprovalTypeValue)
                        {
                        case (int)BugsBox.Pharmacy.Models.ApprovalType.SupplyUnitApproval:
                        case (int)BugsBox.Pharmacy.Models.ApprovalType.SupplyUnitEditApproval:
                        case (int)BugsBox.Pharmacy.Models.ApprovalType.SupplyUnitLockApproval:
                            ucSupplyUnit uc = new ucSupplyUnit(flow.FlowId);
                            uc.Name = "DetailView";
                            this.plDetailView.Controls.Add(uc);
                            break;

                        case (int)BugsBox.Pharmacy.Models.ApprovalType.DrugInfoApproval:
                        case (int)BugsBox.Pharmacy.Models.ApprovalType.DrugInfoEditApproval:
                        case (int)BugsBox.Pharmacy.Models.ApprovalType.DrugInfoLockApproval:
                            DrugInfo di = this.PharmacyDatabaseService.GetDrugInfoByFlowID(out msg, flow.FlowId);
                            if (di.BusinessScopeCode.Contains("医疗器械"))
                            {
                                BaseDataManage.FormInstrument frmInstrument = new BaseDataManage.FormInstrument
                                {
                                    entity = di,
                                };
                                Common.SetControls.SetControlReadonly(frmInstrument, true);
                                frmInstrument.FSE = FormStatusEnum.Read;
                                frmInstrument.ShowDialog();
                                return;
                            }
                            else
                            {
                                ucGoodsInfo ucdi = new ucGoodsInfo(di);
                                Common.SetControls.SetControlReadonly(ucdi, true);
                                ucdi.Name = "DetailView";
                                this.plDetailView.Controls.Add(ucdi);
                            }
                            break;

                        case (int)BugsBox.Pharmacy.Models.ApprovalType.PurchaseUnitApproval:
                        case (int)BugsBox.Pharmacy.Models.ApprovalType.PurchaseUnitEditApproval:
                        case (int)BugsBox.Pharmacy.Models.ApprovalType.PurchaseUnitLockApproval:
                            ucPurchaseUnit ucpu = new ucPurchaseUnit(flow.FlowId);
                            ucpu.Name = "DetailView";
                            this.plDetailView.Controls.Add(ucpu);
                            break;

                        case (int)BugsBox.Pharmacy.Models.ApprovalType.drugsUnqualityApproval:
                            Business.Models.drugsUnqualificationQuery dq = PharmacyDatabaseService.getDrugsUnqualificationQueryByFlowID(flow.FlowId, out msg);
                            ucDrugsUnqualification ucdu = new ucDrugsUnqualification(dq);
                            ucdu.initApprovalDetail(flow.FlowId);
                            ucdu.Name = "DetailView";
                            this.plDetailView.Controls.Add(ucdu);
                            break;

                        case (int)ApprovalType.drugsBreakageApproval:
                            DrugsBreakage  db   = PharmacyDatabaseService.GetDrugsBreakageByFlowID(flow.FlowId, out msg);
                            UcDrugBreakage ucdb = new UcDrugBreakage(db, flow);
                            ucdb.Name = "DetailView";
                            this.plDetailView.Controls.Add(ucdb);
                            break;

                        case (int)ApprovalType.VehicleApproval:
                            Vehicle v = this.PharmacyDatabaseService.GetVehicleByFlowID(flow.FlowId, out msg);
                            if (v == null)
                            {
                                return;
                            }
                            DataDictionary.FormVehicleEdit frm = new DataDictionary.FormVehicleEdit(v, true);
                            frm.ShowDialog();
                            return;

                        case (int)ApprovalType.DirectSalesApproval:
                            DirectSalesOrder dso  = this.PharmacyDatabaseService.GetDirectSalesOrderByFlowId(flow.FlowId, out msg);
                            UCDirectSales    UCDS = new UCDirectSales(dso);
                            UCDS.Name = "DetailView";
                            this.plDetailView.Controls.Add(UCDS);
                            break;
                        }
                    }

                    //显示详细
                    this.plDetailView.BringToFront();
                    this.plDetailView.Visible = true;
                }
                else //打开详细流程记录, 审批流程表(上表)里的一条被选中后,把详细审批过程写入审批流程详细表(下表)
                {
                    dgvApprovalList_RowEnter(sender, e);
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }