示例#1
0
        /// <summary>
        /// 审核
        /// </summary>
        public void Accept()
        {
            if (OutInventory.Id != Guid.Empty)
            {
                string msg = string.Empty;
                try
                {
                    //更新订单表
                    var tmpOrder = PharmacyDatabaseService.GetSalesOrder(out msg, SalesOrder.Id);
                    //更新出库表
                    var tmpOutInventory = PharmacyDatabaseService.GetOutInventory(out msg, OutInventory.Id);

                    tmpOutInventory.UpdateUserId = AppClientContext.CurrentUser.Id;
                    tmpOutInventory.Description  = this.txt备注.Text;

                    int  SpecialDrugsCount = 0;
                    bool isSecond          = false;
                    if (tmpOutInventory.OutInventoryStatusValue == (int)OutInventoryStatus.Outing)//首次复核
                    {
                        tmpOutInventory.ReviewerId = AppClientContext.CurrentUser.Id;

                        tmpOutInventory.OrderOutInventoryCheckUserID = AppClientContext.CurrentUser.Id;

                        var c = this.PharmacyDatabaseService.GetOutInventorySpecialDrugs(OutInventory, out msg);
                        SpecialDrugsCount = c.Count();
                        if (SpecialDrugsCount > 0)//需二次审核
                        {
                            MessageBox.Show("请注意,该销售单含有特殊管理药品,需经特殊管理药品二次复核过程方可执行配送申请!");
                            tmpOutInventory.OutInventoryStatusValue = (int)OutInventoryStatus.important;
                        }
                        else
                        {
                            tmpOutInventory.OutInventoryStatusValue = (int)OutInventoryStatus.Outed;
                        }
                    }
                    else//特殊药品复核
                    {
                        tmpOutInventory.OutInventoryStatusValue      = (int)OutInventoryStatus.Outed;
                        tmpOutInventory.OrderOutInventoryCheckUserID = AppClientContext.CurrentUser.Id;
                        isSecond = true;
                    }

                    PharmacyDatabaseService.AcceptOutInverntory(tmpOutInventory);
                    #region 写入日志
                    if (isSecond)
                    {
                        this.PharmacyDatabaseService.WriteLog(AppClientContext.CurrentUser.Id, "成功提交销售质量特殊药品第二次复核操作:" + SalesOrder.OrderCode);
                    }
                    else
                    {
                        this.PharmacyDatabaseService.WriteLog(AppClientContext.CurrentUser.Id, "成功提交销售质量复核操作:" + SalesOrder.OrderCode);
                    }
                    #endregion
                    //更新画面信息
                    this.lblOutStatus.Text = Utility.getEnumTypeDisplayName <OutInventoryStatus>((OutInventoryStatus)tmpOutInventory.OutInventoryStatusValue);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("出库审核失败,请联系管理员!" + msg + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("订单信息和出库信息不能为空!");
            }
        }