コード例 #1
0
        public void addDrugsUnqualityApproval(drugsUnqualication value, Guid approvalFlowTypeID, Guid userID, string changeNote)
        {
            try
            {
                if (value.ApprovalStatusValue != -1)
                {
                    value.DocumentNumber = new BillDocumentCodeBusinessHandler(BusinessHandlerFactory.RepositoryProvider, null).GenerateBillDocumentCodeByTypeValue((int)BillDocumentType.DrugUnqualification).Code;
                    value.updateTime     = DateTime.Now;
                    this.Save(value);

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

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

                    this.Save();
                }
            }
            catch (Exception e)
            {
                this.HandleException("新增不合格药品审批流程记录失败", e);
            }
        }
コード例 #2
0
        void dgvDrugDetailList_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            string msg            = string.Empty;
            int    rIdx           = e.RowIndex;
            Guid   itemId         = new Guid(this.dgvDrugDetailList.Rows[rIdx].Cells["id"].Value.ToString());
            Guid   approvalFlowId = new Guid(this.dgvDrugDetailList.Rows[rIdx].Cells["FlowId"].Value.ToString());

            item = PharmacyDatabaseService.GetDrugsUnqualificationByID(out msg, itemId);
            if (PharmacyDatabaseService.GetFinishApproveFlowsRecord(out msg, approvalFlowId, 0).Count() > 1)
            {
                FormUnqualificationApprovalDetail         f   = new FormUnqualificationApprovalDetail();
                Business.Models.drugsUnqualificationQuery dq  = PharmacyDatabaseService.getDrugsUnqualificationQueryByFlowID(approvalFlowId, out msg);
                UserControls.ucDrugsUnqualification       ucf = new UserControls.ucDrugsUnqualification(dq);
                f.Height += ucf.Height;
                f.Controls.Add(ucf);
                ucf.Dock = DockStyle.Fill;
                f.ShowDialog();
                f   = null;
                dq  = null;
                ucf = null;
            }
            if (item != null)
            {
                textBox1.Text       = item.drugName;
                this.textBox2.Text  = item.quantity.ToString();
                this.txtRemark.Text = item.Description;
            }
            flag = true;
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        private void dgvDrugDetailList_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            this.currentDU = this.dgvDrugDetailList.Rows[e.RowIndex].DataBoundItem as drugsUnqualication;;
            if (this.currentDU.source.Contains("质量复核"))
            {
                MessageBox.Show("该单据已被质量复核,确定为不合格品,不得修改,请提交不合格审核!");
                return;
            }

            toolStripButton8.Enabled  = toolStripButton2.Enabled = true;
            toolStripButton10.Enabled = tsbtnSave.Enabled = toolStripButton10.Enabled = false;

            textBox1.Enabled = false;

            this.textBox2.Text = this.currentDU.quantity.ToString();
            this.textBox5.Text = this.currentDU.drugName;
            var inventoryInof = this.PharmacyDatabaseService.GetDrugInventoryRecord(out msg, this.currentDU.DrugInventoryRecordID);

            this.textBox3.Text  = (inventoryInof.CanSaleNum + currentDU.quantity).ToString();
            this.textBox4.Text  = inventoryInof.DrugInfo.FactoryName;
            this.textBox6.Text  = this.currentDU.Specific;
            this.textBox7.Text  = this.currentDU.batchNo;
            this.textBox8.Text  = this.currentDU.Origin;
            this.textBox9.Text  = this.currentDU.DosageType;
            this.textBox10.Text = this.currentDU.PurchasePrice.ToString();

            this.txtRemark.Text = this.currentDU.Description;
        }
コード例 #5
0
        private void dgvDrugDetailList_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (bList == null)
            {
                return;
            }
            if (e.RowIndex < 0)
            {
                return;
            }
            if (this.dgvDrugDetailList.Columns[e.ColumnIndex].Name == this.submit.Name)
            {
                if (MessageBox.Show("确定要提交至不合格审批流程吗?", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
                {
                    drugsUnqualication du = bList[e.RowIndex];
                    du.ApprovalStatusValue = 0;
                    du.updateTime          = DateTime.Now;

                    if (PharmacyDatabaseService.addDrugsUnqualityApproval(du, Guid.Parse(this.cmbApprovalSelector.ComboBox.SelectedValue.ToString()), du.createUID, "新增不合格审批:" + du.drugName, out msg))
                    {
                        MessageBox.Show("已提交至不合格审批流程!");
                        this.PharmacyDatabaseService.WriteLog(AppClientContext.CurrentUser.Id, "成功提交不合格药品信息至审批流程:" + du.drugName);
                        this.GetUnqualificationData();
                    }
                }
            }
        }
コード例 #6
0
        private bool ModUnq(drugsUnqualication du)
        {
            du.updateTime = DateTime.Now;
            if (du.DrugInventoryRecordID != Guid.Empty)
            {
                drugsUnqualication  duOld = BusinessHandlerFactory.DrugsUnqualificationHandler.Get(du.Id);
                DrugInventoryRecord dir   = BusinessHandlerFactory.DrugInventoryRecordBusinessHandler.Get(du.DrugInventoryRecordID);

                if (dir == null)
                {
                    du  = null;
                    dir = null;
                    throw new Exception("库存出错,无法保存!");
                }
                dir.drugsUnqualicationNum -= duOld.quantity;
                dir.drugsUnqualicationNum += du.quantity;
                if (dir.CanSaleNum < 0)
                {
                    du  = null;
                    dir = null;
                    throw new Exception("库存不足,无法保存!建议修改不合格数量!");
                }
                dir.Valid = dir.CanSaleNum > 0 ? true : false;
                BusinessHandlerFactory.DrugInventoryRecordBusinessHandler.Save(dir);
            }
            BusinessHandlerFactory.DrugsUnqualificationHandler.Save(du);
            return(true);
        }
コード例 #7
0
        private bool AddUnq(drugsUnqualication du)
        {
            du.createTime = DateTime.Now;
            if (du.DrugInventoryRecordID != Guid.Empty)
            {
                DrugInventoryRecord dir = BusinessHandlerFactory.DrugInventoryRecordBusinessHandler.Get(du.DrugInventoryRecordID);
                if (du.source.Contains("新建"))
                {
                    if (du.quantity > dir.CanSaleNum)
                    {
                        du  = null;
                        dir = null;

                        throw new Exception("库存不足,新增失败,请修改不合格数量!");
                    }
                    dir.drugsUnqualicationNum += du.quantity;
                    dir.Valid = dir.CanSaleNum > 0 ? true : false;
                    BusinessHandlerFactory.DrugInventoryRecordBusinessHandler.Save(dir);
                }
                dir = null;
            }

            du.createTime = DateTime.Now;
            BusinessHandlerFactory.DrugsUnqualificationHandler.Add(du);
            du = null;
            return(true);
        }
コード例 #8
0
        public drugsUnqualication GetDrugsUnqualificationByID(Guid ItemGUID)
        {
            try
            {
                drugsUnqualication d = this.Fetch(r => r.Id == ItemGUID).FirstOrDefault();

                return(d);
            }
            catch (Exception ex)
            {
                return(this.HandleException <drugsUnqualication>("获取实体药品不合格信息失败", ex));
            }
        }
コード例 #9
0
        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;
        }
コード例 #10
0
 //窗体清除
 private void ClearCurrent()
 {
     this.currentDU                 = null;
     this.CurrentIM                 = null;
     this.checkBox1.Checked         = false;
     toolStripButton10.Enabled      = tsbtnSave.Enabled = true;
     this.textBox1.Enabled          = true;
     this.toolStripButton8.Enabled  = this.toolStripButton2.Enabled = false;
     this.toolStripButton11.Enabled = true;
     foreach (Control control in this.groupBox2.Controls)
     {
         if (control.GetType() == typeof(TextBox))
         {
             ((TextBox)control).Text = string.Empty;
         }
     }
     this.txtRemark.Text = "质量问题,需复查或者提交不合格审查";
     this.toolStripComboBox1.SelectedIndex = 0;
 }
コード例 #11
0
        private void toolStripComboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            drugsUnqualificationCondition duc = new drugsUnqualificationCondition();

            duc.dtFrom = DateTime.MinValue;
            duc.dtTo   = DateTime.MaxValue;
            duc.unqualificationType = -1;
            var c = this.PharmacyDatabaseService.GetDrugsUnqualificationByCondition(out msg, duc);

            bList.Clear();
            switch (toolStripComboBox1.SelectedIndex)
            {
            case 0:
                c = c.Where(r => r.ApprovalStatusValue == -1 || r.ApprovalStatusValue == 4).ToArray();
                bList.Clear();
                foreach (var a in c)
                {
                    bList.Add(a);
                }
                break;

            case 1:
                c = c.Where(r => r.ApprovalStatusValue == -1).ToArray();
                foreach (var a in c)
                {
                    bList.Add(a);
                }
                break;

            case 2:
                c = c.Where(r => r.ApprovalStatusValue == 4).ToArray();
                foreach (var a in c)
                {
                    bList.Add(a);
                }
                break;
            }
            currentDU = null;
            CurrentIM = null;
        }
コード例 #12
0
        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);
                }
            }
        }
コード例 #13
0
        void dgvDrugDetailList_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0 || e.ColumnIndex < 0)
            {
                return;
            }
            int rIdx = e.RowIndex;
            drugsUnqualication item = bList[e.RowIndex];

            if (this.dgvDrugDetailList.Columns[e.ColumnIndex].Name != this.Column9.Name)
            {
                Guid approvalFlowId = item.flowID;
                f = new FormUnqualificationApprovalDetail();
                Business.Models.drugsUnqualificationQuery dq = PharmacyDatabaseService.getDrugsUnqualificationQueryByFlowID(approvalFlowId, out msg);

                UserControls.ucDrugsUnqualification ucf = new UserControls.ucDrugsUnqualification(dq);
                f.Height += ucf.Height;
                f.Controls.Add(ucf);
                ucf.Dock = DockStyle.Fill;
                f.ShowDialog();
                f    = null;
                dq   = null;
                ucf  = null;
                flag = true;
            }
            else
            {
                if (MessageBox.Show("需要提交报损审批吗?", "提示", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK)
                {
                    item.unqualificationType = 1;
                    if (this.PharmacyDatabaseService.SaveDrugsUnqualification(out msg, item))
                    {
                        MessageBox.Show("提交成功!");
                        bList.Remove(item);
                        list.Remove(item);
                    }
                }
            }
        }
コード例 #14
0
        void dgvDrugDetailList_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            string msg            = string.Empty;
            int    rIdx           = e.RowIndex;
            Guid   itemId         = new Guid(this.dgvDrugDetailList.Rows[rIdx].Cells["id"].Value.ToString());
            Guid   approvalFlowId = new Guid(this.dgvDrugDetailList.Rows[rIdx].Cells["FlowId"].Value.ToString());

            item = PharmacyDatabaseService.GetDrugsUnqualificationByID(out msg, itemId);
            f    = new FormUnqualificationApprovalDetail();
            dq   = PharmacyDatabaseService.getDrugsUnqualificationQueryByFlowID(approvalFlowId, out msg);
            UserControls.ucDrugsUnqualification ucf = new UserControls.ucDrugsUnqualification(dq);
            f.Height += ucf.Height;
            f.Controls.Add(ucf);
            ucf.Dock = DockStyle.Fill;
            f.ShowDialog();
            f    = null;
            dq   = null;
            ucf  = null;
            flag = true;
        }
コード例 #15
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.DrugsUnqualificationHandler.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);
            }
        }
コード例 #16
0
        private void textBox1_KeyDown(object sender, KeyEventArgs e)
        {
            string py = textBox1.Text.Trim();

            if (py == string.Empty)
            {
                return;
            }
            if (e.KeyData == Keys.Return)
            {
                using (Form1 f1 = new Form1())
                {
                    f1.py = py;
                    f1.ShowDialog();
                    if (f1.DialogResult == DialogResult.OK)
                    {
                        var im = f1.iml;
                        this.CurrentIM         = f1.iml;
                        this.checkBox1.Checked = false;

                        this.textBox5.Text  = im.ProductGeneralName;
                        this.textBox3.Text  = im.CanSaleNum.ToString();
                        this.textBox4.Text  = im.FactoryName;
                        this.textBox6.Text  = im.DictionarySpecificationCode;
                        this.textBox7.Text  = im.BatchNumber;
                        this.textBox8.Text  = im.Origin;
                        this.textBox9.Text  = im.DictionaryDosageCode;
                        this.textBox10.Text = im.PurchasePrice.ToString();

                        if (im.IsOutDate.Contains("已过期"))
                        {
                            this.txtRemark.Text = "本品种:" + im.ProductGeneralName + ",已过期,需不合格审批后执行报损流程!";
                        }
                        else
                        {
                            this.txtRemark.Text = "本品种:" + im.ProductGeneralName + ",未过期,但存在质量问题,需不合格审批后执行报损流程!";
                        }

                        currentDU = new drugsUnqualication();
                        currentDU.ApprovalStatus        = ApprovalStatus.NonApproval;
                        currentDU.ApprovalStatusValue   = -1;
                        currentDU.batchNo               = im.BatchNumber;
                        currentDU.createTime            = DateTime.Now;
                        currentDU.createUID             = AppClientContext.CurrentUser.Id;
                        currentDU.Deleted               = false;
                        currentDU.Description           = string.Empty;
                        currentDU.DosageType            = im.DictionaryDosageCode;
                        currentDU.DrugInventoryRecordID = im.InventoryID;
                        currentDU.drugName              = im.ProductGeneralName;
                        currentDU.ExpireDate            = im.OutValidDate;
                        currentDU.flowID                      = Guid.NewGuid();
                        currentDU.Id                          = Guid.NewGuid();
                        currentDU.produceDate                 = im.PruductDate;
                        currentDU.source                      = "新建不合格";
                        currentDU.Specific                    = im.DictionarySpecificationCode;
                        currentDU.unqualificationType         = 0;
                        currentDU.updateTime                  = DateTime.Now;
                        currentDU.factoryName                 = im.FactoryName;
                        currentDU.DrugInfo                    = im.DrugInfoId;
                        currentDU.PurchasePrice               = im.PurchasePrice;
                        currentDU.Origin                      = im.Origin;
                        currentDU.Supplyer                    = im.SupplyUnitName;
                        currentDU.PurchaseOrderDocumentNumber = im.PurchaseOrderDocumentNumber;
                        currentDU.PurchaseOrderId             = im.PurchaseOrderId;
                        this.textBox2.Focus();
                    }
                }
            }
        }
コード例 #17
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.DrugsUnqualificationHandler.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.DrugsUnqualificationHandler.Get(db.DrugUnqualityId);
                        if (c != null)
                        {
                            c.unqualificationType = 0;
                            BusinessHandlerFactory.DrugsUnqualificationHandler.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);
        }
コード例 #18
0
        public bool SaveToNextProc(DrugsUndeterminate value, Guid userID)
        {
            string msg = string.Empty;

            try
            {
                if (value.proc == 1)
                {
                    this.Save(value, out msg);
                    return(true);
                }

                if (value.QualificationQuantity > 0)
                {
                    if (value.Source.Contains("其他") || value.Source.Contains("养护"))
                    {
                        var V = BusinessHandlerFactory.DrugInventoryRecordBusinessHandler.Get(value.InventoryID);
                        V.drugsUnqualicationNum -= value.QualificationQuantity;
                        BusinessHandlerFactory.DrugInventoryRecordBusinessHandler.Save(V);
                    }
                    else
                    {
                        var purchaseOrder = BusinessHandlerFactory.RepositoryProvider.Db.PurchaseOrders.Where(r => r.DocumentNumber == value.OrderDocumentID).FirstOrDefault();

                        PurchaseCheckingOrder pco = new PurchaseCheckingOrder();
                        pco.Id                         = Guid.NewGuid();
                        pco.DocumentNumber             = new BillDocumentCodeBusinessHandler(BusinessHandlerFactory.RepositoryProvider, null).GenerateBillDocumentCodeByTypeValue((int)BillDocumentType.PurchaseCheckingOrder).Code;
                        pco.OperateTime                = DateTime.Now;
                        pco.StoreId                    = BugsBox.Pharmacy.Config.PharmacyServiceConfig.Config.CurrentStore.Id;
                        pco.OperateUserId              = userID;
                        pco.OrderStatusValue           = 13;
                        pco.PurchaseOrderId            = purchaseOrder.Id;
                        pco.Decription                 = "待处理药品复核验收正常,可入库!";
                        pco.RelatedOrderDocumentNumber = value.DocumentNumber;
                        pco.RelatedOrderId             = value.Id;
                        pco.RelatedOrderType           = OrderType.Undeterminate;

                        //采购验收单更新
                        purchaseOrder.UpdateTime       = DateTime.Now;
                        purchaseOrder.UpdateUserId     = userID;
                        purchaseOrder.OrderStatusValue = 13;
                        BusinessHandlerFactory.PurchaseCheckingOrderBusinessHandler.Add(pco);
                        BusinessHandlerFactory.PurchaseOrderBusinessHandler.Save(purchaseOrder);

                        PurchaseCheckingOrderDetail purchaseOrderDetail = new PurchaseCheckingOrderDetail();
                        purchaseOrderDetail.ArrivalAmount           = value.QualificationQuantity;
                        purchaseOrderDetail.ArrivalDateTime         = pco.OperateTime;
                        purchaseOrderDetail.BatchNumber             = value.BatchNumber;
                        purchaseOrderDetail.CheckResult             = 0;
                        purchaseOrderDetail.Decription              = value.Origin;
                        purchaseOrderDetail.DrugInfoId              = value.DrugInfoID;
                        purchaseOrderDetail.OutValidDate            = value.ExpireDate;
                        purchaseOrderDetail.PruductDate             = value.produceDate;
                        purchaseOrderDetail.QualifiedAmount         = value.QualificationQuantity;
                        purchaseOrderDetail.PurchasePrice           = value.PurchasePrice;
                        purchaseOrderDetail.PurchaseCheckingOrderId = pco.Id;
                        purchaseOrderDetail.StoreId = pco.StoreId;
                        purchaseOrderDetail.Id      = Guid.NewGuid();
                        BusinessHandlerFactory.PurchaseCheckingOrderDetailBusinessHandler.Add(purchaseOrderDetail);
                    }
                }
                //如果不合格药品填写数量不为0,则将其写入不合格药品审批流程
                if (value.UnqualificationQuantity > 0)
                {
                    drugsUnqualication du = new drugsUnqualication();
                    du.Id                          = Guid.NewGuid();
                    du.createTime                  = DateTime.Now;
                    du.createUID                   = userID;
                    du.ApprovalStatusValue         = -1;
                    du.flowID                      = Guid.NewGuid();
                    du.Description                 = "质量部结论:" + value.conclusion;
                    du.quantity                    = value.UnqualificationQuantity;
                    du.drugName                    = value.drugName;
                    du.batchNo                     = value.BatchNumber;
                    du.DrugInventoryRecordID       = value.InventoryID;
                    du.DocumentNumber              = new BillDocumentCodeBusinessHandler(BusinessHandlerFactory.RepositoryProvider, null).GenerateBillDocumentCodeByTypeValue((int)BillDocumentType.DrugUnqualification).Code;
                    du.CheckDocumentNumber         = value.DocumentNumber;
                    du.source                      = "质量复核";
                    du.DosageType                  = value.DosageType;
                    du.Specific                    = value.Specific;
                    du.produceDate                 = value.produceDate;
                    du.ExpireDate                  = value.ExpireDate;
                    du.factoryName                 = value.DrugInfo.FactoryName;
                    du.PurchasePrice               = value.PurchasePrice;
                    du.unqualificationType         = -1; //养护流程不合格
                    du.updateTime                  = DateTime.Now;
                    du.Deleted                     = false;
                    du.DrugInfo                    = value.DrugInfoID;
                    du.Origin                      = value.Origin;
                    du.Supplyer                    = value.supplyer;
                    du.PurchaseOrderId             = value.PurchaseOrderID == null?Guid.Empty:(Guid)value.PurchaseOrderID;
                    du.PurchaseOrderDocumentNumber = value.OrderDocumentID;
                    BusinessHandlerFactory.DrugsUnqualificationHandler.EditDrugUnqualification(du, 0);
                }

                this.Save(value);
            }
            catch (Exception ex)
            {
                msg = "保存出错!";
                return(false);
            }
            this.Save();
            return(true);
        }