Ejemplo n.º 1
0
        public override ResponseBase Handler(CreatePurocumentPlanRequest request)
        {
            try
            {
                var permissionService = ServiceProvider.GetService <IPermissionService>();
                permissionService.CheckPermission(request.WechatID, "CreatePurocumentPlanRequest");

                var departmentService = ServiceProvider.GetService <IDepartmentService>();
                if (!departmentService.ValidateDepartment(new int[] { request.DepartmentID }))
                {
                    throw new Exception("部门错误");
                }
                var bizService = ServiceProvider.GetService <IBizTypeService>();
                if (!bizService.ValidateBizTypeID(new int[] { request.BizTypeID }))
                {
                    throw new Exception("业务类型无效");
                }
                var goodsService = ServiceProvider.GetService <IGoodsService>();
                if (!goodsService.ValidateGoodsID(request.Details.Select(s => s.GoodsID).ToArray()))
                {
                    throw new Exception("商品信息无效");
                }
                var model = new PurchasingPlan()
                {
                    BizType      = request.BizTypeID,
                    DepartmentID = request.DepartmentID,
                    CreateUser   = request.CreateUserID,
                    Details      = request.Details.GroupBy(g => g.GoodsID).Select(s => new PurchasingPlanDetail()
                    {
                        GoodsID             = s.Key,
                        PurchasingPlanCount = s.Sum(g => g.PurocumentCount)//?
                    })
                };
                var purchaasingPlanService = ServiceProvider.GetService <IPurchasingplanService>();
                purchaasingPlanService.CreatePlan(model);
                return(new ResponseBase()
                {
                    Result = 1, ResultInfo = ""
                });
            }
            catch (Exception ex)
            {
                return(new ResponseBase()
                {
                    Result = -1, ResultInfo = ex.Message
                });
            }
        }
Ejemplo n.º 2
0
 private void toolStripButton2_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("确实要提交冲差价审核吗?", "提示", MessageBoxButtons.OKCancel) != System.Windows.Forms.DialogResult.OK)
     {
         return;
     }
     foreach (DataGridViewRow dr in this.dataGridView1.Rows)
     {
         PurchasingPlan ppd = this.ListPlan.Where(r => r.AmountApprovalUserId == Guid.Parse(dr.Cells["id"].Value.ToString())).FirstOrDefault();
         ppd.InValidDays = 999;
     }
     if (this.PharmacyDatabaseService.SubmitRefunds(ListPlan.ToArray(), 1, out msg))
     {
         MessageBox.Show("审核成功!");
         this.PharmacyDatabaseService.WriteLog(AppClientContext.CurrentUser.Id, "执行审核采购冲差价单操作成功");
     }
     this.Dispose();
 }
Ejemplo n.º 3
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("确实要提交冲差价审核吗?", "提示", MessageBoxButtons.OKCancel) != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }
            List <PurchasingPlan> listPlan = new List <PurchasingPlan>();

            foreach (DataGridViewRow dr in this.dataGridView1.Rows)
            {
                //if (Convert.ToDecimal(dr.Cells[13].Value) == 0m) continue;
                PurchasingPlan ppd = new PurchasingPlan();
                ppd.AmountApprovalUserId = Guid.Parse(dr.Cells["id"].Value.ToString()); //作为purchaseorderdetail的ID
                ppd.AmountOfTaxMoney     = Convert.ToDecimal(dr.Cells[12].Value);       //作为冲差价当前药品单价
                ppd.ApprovalDecription   = this.label10.Text;                           //采购单位名称
                ppd.ApprovaledTime       = DateTime.Now;                                //审核时间
                ppd.ApprovalUserId       = new Guid();                                  //审核人ID
                ppd.CreateUserId         = AppClientContext.CurrentUser.Id;             //创建人ID
                ppd.Decription           = "创建采购冲差价单";
                ppd.Deleted         = false;
                ppd.DirectMarketing = true;
                ppd.DocumentNumber  = string.Empty;                            //冲差价单号
                ppd.InValidDays     = 9999;
                ppd.Id                      = Guid.NewGuid();                  //冲差价单id
                ppd.OrderStatus             = OrderStatus.purchaseRefund;      //冲差价状态
                ppd.OrderStatusValue        = (int)OrderStatus.purchaseRefund;
                ppd.PaymentForGoodsMoney    = Convert.ToDecimal(label13.Text); //冲差价
                ppd.PurchasedDate           = poe.PurchasedDate;               //采购日期
                ppd.ReleatedPurchaseOrderId = poe.Id;                          //采购单ID
                ppd.ShippingMethod          = poe.DocumentNumber;              //采购单号
                ppd.SupplyUnitId            = poe.SupplyUnitId;                //供货商ID
                ppd.TotalMoney              = Convert.ToDecimal(label6.Text);  //原定单总额
                ppd.UpdateTime              = DateTime.Now;
                listPlan.Add(ppd);
            }
            if (this.PharmacyDatabaseService.SubmitRefunds(listPlan.ToArray(), 0, out msg))
            {
                MessageBox.Show("写入成功!");
                this.PharmacyDatabaseService.WriteLog(AppClientContext.CurrentUser.Id, "执行新建采购冲差价单操作成功");
            }
            this.Dispose();
        }
Ejemplo n.º 4
0
        private void toolStripButton4_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("确实要修改冲差价吗?", "提示", MessageBoxButtons.OKCancel) != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }
            List <PurchasingPlan> listPlanAll = new List <PurchasingPlan>();

            foreach (DataGridViewRow dr in this.dataGridView1.Rows)
            {
                PurchasingPlan ppd = this.ListPlan.Where(r => r.AmountApprovalUserId == Guid.Parse(dr.Cells["id"].Value.ToString())).FirstOrDefault();
                ppd.AmountOfTaxMoney     = Convert.ToDecimal(dr.Cells[12].Value); //作为冲差价当前药品单价
                ppd.CreateUserId         = AppClientContext.CurrentUser.Id;       //创建人ID
                ppd.PaymentForGoodsMoney = Convert.ToDecimal(label13.Text);       //冲差价
                ppd.UpdateTime           = DateTime.Now;
                listPlanAll.Add(ppd);
            }
            if (this.PharmacyDatabaseService.SubmitRefunds(listPlanAll.ToArray(), 1, out msg))
            {
                MessageBox.Show("写入成功!");
                this.PharmacyDatabaseService.WriteLog(AppClientContext.CurrentUser.Id, "执行更新采购冲差价单操作成功");
            }
        }