| | |
| | | { |
| | | private GwOrderDao _Dao = new GwOrderDao(); |
| | | private GwSpDao _GwSpDao = new GwSpDao(); |
| | | private GwClientDao _GwClientDao = new GwClientDao(); |
| | | private GwOpGroupDao _GwOpGroupDao = new GwOpGroupDao(); |
| | | private GwProductDao _GwProductDao = new GwProductDao(); |
| | | private SysXhDao _SysXhDao = new SysXhDao(); |
| | |
| | | string orderId = context.GetString("orderId"); |
| | | int basicNum = context.GetInt("basicNum"); |
| | | int givingNum = context.GetInt("givingNum"); |
| | | string clientId = ""; |
| | | int payAmount = 0; |
| | | int tmpPayAmount = Math.Max((int) (context.GetDecimal("payAmount", new Decimal(4, 0, 0, false, (byte) 2)) * new Decimal(1000)), 1); |
| | | payAmount = tmpPayAmount; |
| | | //double price = context.GetDecimal(price); |
| | | int num = Math.Max((int) (context.GetDecimal("price", new Decimal(4, 0, 0, false, (byte) 2)) * new Decimal(1000)), 1); |
| | | string remark = context.GetString("remark"); |
| | |
| | | if (gwOrder.Status !=0 && gwOrder.Status !=1) |
| | | throw new ArgumentException("该订单已处理,操作失败!"); |
| | | |
| | | |
| | | clientId = gwOrder.ClientId; |
| | | |
| | | //获取订单审核流程 |
| | | string flowGroup = null; //流程组合 |
| | |
| | | } |
| | | else if(status==1) |
| | | { |
| | | int beforeBasicNum = 0; |
| | | int beforeGivingNum = 0; |
| | | int balance = 0; |
| | | if(string.IsNullOrEmpty(nextFlowCode)) |
| | | int beforeBasicNum = 0; |
| | | int beforeGivingNum = 0; |
| | | int balance = 0; |
| | | int topUpAmountTotal = 0; |
| | | if (string.IsNullOrEmpty(nextFlowCode)) |
| | | { |
| | | orderStatus = 2; |
| | | |
| | |
| | | |
| | | beforeBasicNum = gwSp.BasicNum; |
| | | beforeGivingNum = gwSp.GivingNum; |
| | | balance = Convert.ToInt32(gwSp.Balance); |
| | | //balance = Convert.ToInt32(gwSp.Balance); |
| | | |
| | | //为1-预付费 |
| | | if (gwSp.ChargeType.Equals("1") && gwSp.Balance < num * basicNum ) |
| | | //获取客户信息 |
| | | GwClient gwClient = _GwClientDao.Get(gwSp.ClientID); |
| | | balance = int.Parse(gwClient.Balance.ToString() ); |
| | | topUpAmountTotal = int.Parse(gwClient.Top_up_Amount_Total.ToString() ); |
| | | |
| | | //为1-预付费 |
| | | if (gwSp.ChargeType==1 && (balance + payAmount) < num * basicNum) |
| | | { |
| | | throw new ArgumentException("账号余额不足,请联系管理员!"); |
| | | throw new ArgumentException("客户余额及充值金额不足购买,请调整后提交!"); |
| | | } |
| | | |
| | | //gwSp.Balance = balance - num * basicNum; |
| | |
| | | , beforeGivingNum + givingNum |
| | | , spId |
| | | ); |
| | | |
| | | |
| | | //有充值金额时,更新客户累计充值金额(厘) |
| | | if (payAmount > 0) { |
| | | //GwClient gwClient = new GwClient(); |
| | | gwClient = new GwClient(); |
| | | gwClient.Top_up_Amount_Total = topUpAmountTotal + payAmount; //累计金额:单位(厘) |
| | | gwClient.Balance = ((balance + payAmount) - num * basicNum) ; //账户余额:单位(厘) |
| | | gwClient.ClientID = clientId; |
| | | |
| | | _GwClientDao.UpdateClientAmount(gwClient); |
| | | } |
| | | } |
| | | else |
| | | { |
| | |
| | | //newGwOrder.OrderAmountTotal = basicNum * num ; |
| | | //newGwOrder.BeforeBalanceNum = beforeGivingNum + beforeGivingNum; |
| | | //newGwOrder.Status = orderStatus; |
| | | //更新订单 |
| | | _Dao.UpdateBalanceAndStatus(basicNum, givingNum, basicNum + givingNum, basicNum * num, beforeGivingNum + beforeGivingNum,orderStatus, orderId ); |
| | | //更新订单 |
| | | _Dao.UpdateBalanceAndStatus(basicNum, givingNum, basicNum + givingNum, basicNum * num, payAmount, beforeGivingNum + beforeGivingNum, orderStatus, orderId ); |
| | | |
| | | //Dao.Update(newGwOrder); |
| | | |
| | |
| | | |
| | | int orderNumTotal = context.GetInt("orderNumTotal", 0); |
| | | int orderAmountTotal = context.GetInt("orderAmountTotal", 0); |
| | | int payAmount = 0; |
| | | int beforeBalanceNum = context.GetInt("beforeBalanceNum", 0); |
| | | //客服人员提交订单时的状态为1-审核中。 |
| | | int status = 1; //0-待审核(已提交);1-审核中;2-审核通过;3-审核不通过;4-取消;申请订单在未审核情况下可以取消。 |
| | |
| | | DateTime createTime = DateTime.Now; |
| | | string creator = context.OperatorID; |
| | | |
| | | int tmpPayAmount = Math.Max((int) (context.GetDecimal("payAmount", new Decimal(4, 0, 0, false, (byte) 2)) * new Decimal(1000)), 1); |
| | | payAmount = tmpPayAmount; |
| | | int num = Math.Max((int) (context.GetDecimal("price", new Decimal(4, 0, 0, false, (byte) 2)) * new Decimal(1000)), 1); |
| | | price = num; |
| | | |
| | |
| | | throw new ArgumentException("账号不能为空!"); |
| | | } |
| | | |
| | | if (basicNum<=0 && givingNum <= 0) |
| | | if (basicNum<=0 && givingNum <= 0 && payAmount <=0) |
| | | { |
| | | throw new ArgumentException("基本条数或赠送条数必须大于零!"); |
| | | throw new ArgumentException("充值金额或基本条数或赠送条数必须大于零!"); |
| | | } |
| | | |
| | | //获取账号信息 |
| | | GwSp gwSp = _GwSpDao.Get(spId); |
| | | int balance = 0; |
| | | if (gwSp == null) |
| | | { |
| | | throw new ArgumentException("账号不存在!"); |
| | | } |
| | | else if (gwSp.Status==0) |
| | | { |
| | | throw new ArgumentException("账号已禁用!"); |
| | | } |
| | | |
| | | |
| | | //获取客户信息 |
| | | GwClient gwClient = _GwClientDao.Get(gwSp.ClientID); |
| | | balance = int.Parse(gwClient.Balance.ToString() ); |
| | | |
| | | //为1-预付费 |
| | | if (gwSp.ChargeType==1 && (balance + payAmount) < num * basicNum) |
| | | { |
| | | throw new ArgumentException("客户余额及充值金额不足购买,请调整后提交!"); |
| | | } |
| | | |
| | | //获取订单审核流程 |
| | |
| | | throw new ArgumentException("用户没有充值权限,请联系管理员!"); |
| | | } |
| | | |
| | | |
| | | //获取订单信息 |
| | | GwSp gwSp = _GwSpDao.Get(spId); |
| | | if (gwSp == null) |
| | | { |
| | | throw new ArgumentException("账号不存在!"); |
| | | } |
| | | else if (gwSp.Status==0) |
| | | { |
| | | throw new ArgumentException("账号已禁用!"); |
| | | } |
| | | |
| | | productId = gwSp.ProductId; |
| | | price = gwSp.Price; |
| | | |
| | |
| | | Price = price, //单价换算 |
| | | OrderNumTotal = orderNumTotal, |
| | | OrderAmountTotal = orderAmountTotal, |
| | | PayAmount = payAmount, |
| | | BeforeBalanceNum = beforeBalanceNum, |
| | | Status = status, |
| | | Remark = remark, |
| | |
| | | |
| | | }); |
| | | |
| | | |
| | | string auditId = _SysXhDao.getXh("GW_ORDER_AUDIT"); //获取生成订单审核ID |
| | | this._GwOrderAuditDao.Add(new GwOrderAudit() |
| | | //流程组合为空时 |
| | | if (!string.IsNullOrEmpty(flowGroup)) |
| | | { |
| | | AuditId = auditId, |
| | | OrderId = orderId, |
| | | AuditSort = sort, |
| | | AuditStatus = status, |
| | | Auditor = creator, |
| | | //AuditReason = null, |
| | | AuditTime = createTime |
| | | string auditId = _SysXhDao.getXh("GW_ORDER_AUDIT"); //获取生成订单审核ID |
| | | this._GwOrderAuditDao.Add(new GwOrderAudit() |
| | | { |
| | | AuditId = auditId, |
| | | OrderId = orderId, |
| | | AuditSort = sort, |
| | | AuditStatus = status, |
| | | Auditor = creator, |
| | | //AuditReason = null, |
| | | AuditTime = createTime |
| | | |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | |
| | | return new JsonPageResult(true, "生成订单信息成功!"); |
| | |
| | | |
| | | int orderNumTotal = context.GetInt("orderNumTotal", 0); |
| | | int orderAmountTotal = context.GetInt("orderAmountTotal", 0); |
| | | int payAmount = 0; |
| | | int beforeBalanceNum = context.GetInt("beforeBalanceNum", 0); |
| | | int status = 0; |
| | | string remark = context.GetString("remark"); |
| | | DateTime createTime = DateTime.Now; |
| | | string creator = context.OperatorID; |
| | | |
| | | int tmpPayAmount = Math.Max((int) (context.GetDecimal("payAmount", new Decimal(4, 0, 0, false, (byte) 2)) * new Decimal(1000)), 1); |
| | | payAmount = tmpPayAmount; |
| | | |
| | | int num = Math.Max((int) (context.GetDecimal("price", new Decimal(4, 0, 0, false, (byte) 2)) * new Decimal(1000)), 1); |
| | | price = num; |
| | |
| | | Price = price, //单价换算 |
| | | OrderNumTotal = orderNumTotal, |
| | | OrderAmountTotal = orderAmountTotal, |
| | | PayAmount = payAmount, |
| | | BeforeBalanceNum = beforeBalanceNum, |
| | | Status = status, |
| | | Remark = remark, |