/// <summary> /// 重置密码 /// </summary> /// <param name="account">账号</param> /// <param name="verifycode">验证码</param> /// <returns>密码是否重置成功</returns> /// <remarks>2014-1-8 黄波 创建</remarks> public JsonResult SetUserPassWord(string account, string verifycode) { //验证数据是否合法 Hyt.Util.Validator.VResult vResult = Hyt.Util.Validator.VHelper.ValidatorRule(new Hyt.Util.Validator.Rule.Rule_NotAllowNull(account, ""), new Rule_NotAllowNull(verifycode, "") ); //数据格式不合法提示 if (!vResult.IsPass) { return(Json(new { Status = false, Message = vResult.Message })); } if (Session["verifycode"] == null) { return(Json(new { Status = false, Message = "图片验证码过期,重新获取验证吗" })); } else { if (Session["verifycode"].ToString().ToLower() != verifycode.ToLower()) { return(Json(new { Status = false, Message = "图片验证码错误" })); } } //验证账号是否存在 Hyt.Model.SyUser model = BLL.Sys.SyUserBo.Instance.GetSyUser(account); if (model != null) { if (string.IsNullOrEmpty(model.MobilePhoneNumber)) { return(Json(new { Status = false, Message = "您还没有设置手机号!" })); } else { string password = Hyt.Util.WebUtil.Number(6, true); model.Password = Hyt.Util.EncryptionUtil.EncryptWithMd5AndSalt(password); string msg = "{0}您好!您的新密码是:{1}。服务热线:4006840668【任你比商城】"; if (Hyt.BLL.Web.CrCustomerBo.Instance.SendSyUserPassword(model.MobilePhoneNumber, string.Format(msg, model.Account, password))) { BLL.Sys.SyUserBo.Instance.UpdateSyUser(model); return(Json(new { Status = false, Message = "新密码已发送到您的手机,请查收!" })); } else { return(Json(new { Status = false, Message = "发送失败,请连接管理员!" })); } } } else { return(Json(new { Status = false, Message = "账户不存在!" })); } }
/// <summary> /// 门店自提出库单设为缺货 /// </summary> /// <param name="sysNo">出库单号</param> /// <param name="reason">缺货原因</param> /// <param name="user">操作人</param> /// <param name="joinPool">是否加入订单池</param> /// <returns></returns> /// <remarks>2013-07-06 朱成果 创建</remarks> public WhStockOut SetOutOfStock(int sysNo, string reason, Hyt.Model.SyUser user, bool joinPool = false) { var entity = Hyt.DataAccess.Warehouse.IOutStockDao.Instance.GetModel(sysNo); if (entity == null) { throw new Exception("出库单不存在"); } bool HaveReceivable = entity.Receivable > 0;//有应收金额 entity.Status = (int)WarehouseStatus.出库单自提状态.作废; entity.Remarks = reason; int c = Hyt.DataAccess.Warehouse.IOutStockDao.Instance.Update(entity);//更新出库单状态 if (c > 0) { Hyt.BLL.Order.SoOrderBo.Instance.UpdateSoStatusForSotckOutCancel(sysNo, user, reason); //更新订单状态 } if (HaveReceivable) //有收款金额,作废全部出库单,防止没付钱就提货 { var lst = Hyt.BLL.Warehouse.WhWarehouseBo.Instance.GetWhStockOutListByOrderID(entity.OrderSysNO); if (lst != null && lst.Count > 0) { foreach (WhStockOut item in lst) { if (item.Status != (int)Hyt.Model.WorkflowStatus.WarehouseStatus.出库单状态.作废 && item.Status != (int)Hyt.Model.WorkflowStatus.WarehouseStatus.出库单状态.已签收 && item.SysNo != sysNo) { item.Status = (int)WarehouseStatus.出库单自提状态.作废; item.Remarks = reason; c = Hyt.DataAccess.Warehouse.IOutStockDao.Instance.Update(item);//更新出库单状态 if (c > 0) { Hyt.BLL.Order.SoOrderBo.Instance.UpdateSoStatusForSotckOutCancel(item.SysNo, user, reason);//更新订单状态 } } } } } //写订单池记录 if (joinPool) { SyJobPoolPublishBo.Instance.OrderWaitStockOut(entity.OrderSysNO, null, null, null); SyJobDispatcherBo.Instance.WriteJobLog(string.Format("创建客服订单提交出库审核任务,销售单编号:{0}", entity.OrderSysNO), entity.OrderSysNO, null, user.SysNo); } return(entity); }
/// <summary> /// 门店自提(补充业务所需的配送单和结算单) /// </summary> /// <param name="entity">出库单</param> /// <param name="user">操作人</param> /// <param name="payMoney">收款金额,如为空表已付款</param> /// <param name="PaymentType">PaymentType.现金或者 PaymentType.刷卡</param> /// <returns></returns> /// <remarks>2013-08-21 朱成果 创建</remarks> private void GenerateOtherDataForPickUp(WhStockOut entity, Hyt.Model.SyUser user, decimal?payMoney, int PaymentType) { var f = Hyt.DataAccess.Finance.IFnReceiptVoucherDao.Instance.GetEntity((int)Hyt.Model.WorkflowStatus.FinanceStatus.收款来源类型.销售单, entity.OrderSysNO); decimal havePaid = 0; if (f != null && f.Status != (int)Hyt.Model.WorkflowStatus.FinanceStatus.收款单状态.作废) { havePaid = f.ReceivedAmount;//预付金额 } var delivery = new LgDelivery() { DeliveryUserSysNo = user.SysNo, DeliveryTypeSysNo = entity.DeliveryTypeSysNo, CreatedBy = user.SysNo, CreatedDate = DateTime.Now, Status = (int)LogisticsStatus.配送单状态.已结算, StockSysNo = entity.WarehouseSysNo, IsEnforceAllow = 0, PaidAmount = havePaid, CODAmount = payMoney.HasValue ? payMoney.Value : 0 }; var deliverySysNo = Hyt.DataAccess.Logistics.ILgDeliveryDao.Instance.CreateLgDelivery(delivery);//生成结算单 var deliveryItem = new LgDeliveryItem() { DeliverySysNo = deliverySysNo, NoteType = (int)Hyt.Model.WorkflowStatus.LogisticsStatus.配送单据类型.出库单, NoteSysNo = entity.SysNo, Status = (int)Hyt.Model.WorkflowStatus.LogisticsStatus.配送单明细状态.已签收, AddressSysNo = entity.ReceiveAddressSysNo, TransactionSysNo = entity.TransactionSysNo, StockOutAmount = entity.StockOutAmount, PaymentType = payMoney.HasValue ? (int)Hyt.Model.WorkflowStatus.BasicStatus.支付方式类型.到付 : (int)Hyt.Model.WorkflowStatus.BasicStatus.支付方式类型.预付, Receivable = payMoney.HasValue ? payMoney.Value : 0, IsCOD = payMoney.HasValue ? (int)Hyt.Model.WorkflowStatus.LogisticsStatus.是否到付.是 : (int)Hyt.Model.WorkflowStatus.LogisticsStatus.是否到付.否, Remarks = "【门店自提系统自动创建】", CreatedBy = user.SysNo, CreatedDate = DateTime.Now }; Hyt.DataAccess.Logistics.ILgDeliveryDao.Instance.AddDeliveryItem(deliveryItem); var settlement = new LgSettlement { AuditDate = DateTime.Now, AuditorSysNo = user.SysNo, CODAmount = payMoney.HasValue ? payMoney.Value : 0, CreatedBy = user.SysNo, CreatedDate = DateTime.Now, DeliveryUserSysNo = user.SysNo, PaidAmount = havePaid, TotalAmount = payMoney.HasValue ? payMoney.Value : 0, Status = (int)LogisticsStatus.结算单状态.已结算, WarehouseSysNo = entity.WarehouseSysNo, Remarks = "【门店自提系统自动创建】" }; int settlementSysNo = Hyt.DataAccess.Logistics.ILgSettlementDao.Instance.Create(settlement); var settlementItem = new LgSettlementItem { CreatedBy = user.SysNo, CreatedDate = DateTime.Now, DeliverySysNo = deliverySysNo, DeliveryItemStatus = (int)LogisticsStatus.结算单状态.已结算, PayAmount = payMoney.HasValue ? payMoney.Value : 0, SettlementSysNo = settlementSysNo, TransactionSysNo = entity.TransactionSysNo, Status = (int)Hyt.Model.WorkflowStatus.LogisticsStatus.结算单明细状态.已结算, StockOutSysNo = entity.SysNo, PayType = PaymentType }; Hyt.DataAccess.Logistics.ILgSettlementItemDao.Instance.Create(settlementItem); }
/// <summary> /// 门店提货 /// </summary> /// <param name="sysNo">出库单</param> /// <param name="payMoney">收款金额,如为空表已付款</param> /// <param name="PaymentType">PaymentType.现金或者 PaymentType.刷卡</param> /// <param name="user">操作人</param> /// <param name="invoice">发票 null表示不开发票</param> /// <param name="voucherNo">收款单明细-交易凭证号</param> /// <param name="withTran">是否事物方式提交</param> /// <param name="easReceiptCode">EAS收款科目编码</param> /// <returns></returns> /// <remarks> /// 2013-07-08 朱成果 创建 /// 2013/10/14 朱家宏 增加 voucherNo参数 /// </remarks> public void PickUp(int sysNo, decimal?payMoney, int PaymentType, Hyt.Model.SyUser user, FnInvoice invoice, string voucherNo, bool withTran = true, string easReceiptCode = null) { var entity = Hyt.DataAccess.Warehouse.IOutStockDao.Instance.GetModel(sysNo); if (entity == null) { throw new Exception("出库单不存在"); } if (entity.Status == (int)Hyt.Model.WorkflowStatus.WarehouseStatus.出库单自提状态.已自提) { throw new Exception("该出库单商品已被提货。"); } var mydel = new PickUpDel(delegate(WhStockOut xx) { if (invoice != null) //新开发票 { var fninvoice = Hyt.DataAccess.Order.IFnInvoiceDao.Instance.GetFnInvoiceByOrderID(entity.OrderSysNO); //是否已经设置了发票信息 if (fninvoice == null) { invoice.CreatedBy = user.SysNo; invoice.CreatedDate = DateTime.Now; invoice.Status = (int)Hyt.Model.WorkflowStatus.FinanceStatus.发票状态.已开票; //2013/10/21 朱家宏 添加 invoice.LastUpdateDate = DateTime.Now; invoice.LastUpdateBy = user.SysNo; invoice.TransactionSysNo = SoOrderBo.Instance.GetEntity(xx.OrderSysNO).TransactionSysNo; int newid = Hyt.DataAccess.Order.IFnInvoiceDao.Instance.InsertEntity(invoice); xx.InvoiceSysNo = newid; //出库单关联发票 SoOrderBo.Instance.UpdateOrderInvoice(entity.OrderSysNO, newid); //更新订单关联发票 余勇修改为调用业务方法 Hyt.DataAccess.Order.ISoOrderDao.Instance.UpdateInvoiceNo(entity.OrderSysNO, newid);//订单关联发票 } else { if (fninvoice.Status == (int)Hyt.Model.WorkflowStatus.FinanceStatus.发票状态.已开票) { throw new Exception("已经开具发票,不能重复开票"); } else { invoice.LastUpdateBy = user.SysNo; invoice.LastUpdateDate = DateTime.Now; invoice.InvoiceAmount = fninvoice.InvoiceAmount; invoice.Status = (int)Hyt.Model.WorkflowStatus.FinanceStatus.发票状态.已开票; invoice.SysNo = fninvoice.SysNo; Hyt.BLL.Order.SoOrderBo.Instance.UpdateOrderInvoice(invoice); //更新发票 余勇 修改 改为调用业务层方法 //Hyt.DataAccess.Order.IFnInvoiceDao.Instance.UpdateEntity(invoice); } } } xx.Status = (int)Hyt.Model.WorkflowStatus.WarehouseStatus.出库单自提状态.已自提; xx.StockOutBy = user.SysNo; xx.StockOutDate = DateTime.Now; xx.SignTime = DateTime.Now; if (payMoney.HasValue) { if (payMoney.Value > xx.Receivable) { throw new Exception("收款金额大于应收金额"); } // xx.Receivable = xx.Receivable - payMoney.Value; } Hyt.DataAccess.Warehouse.IOutStockDao.Instance.Update(xx); //更新出库单状态 GenerateOtherDataForPickUp(entity, user, payMoney, PaymentType); //创建已签收配送单,已结算结算单 //更新收款明细 if (payMoney.HasValue) { FnReceiptVoucherItem item = new FnReceiptVoucherItem() { Amount = payMoney.Value, CreatedBy = user.SysNo, CreatedDate = DateTime.Now, PaymentTypeSysNo = PaymentType, TransactionSysNo = entity.TransactionSysNo, Status = (int)Model.WorkflowStatus.FinanceStatus.收款单明细状态.效, VoucherNo = voucherNo, EasReceiptCode = easReceiptCode, ReceivablesSideType = (int)Hyt.Model.WorkflowStatus.FinanceStatus.收款方类型.仓库, //收款单仓库 ReceivablesSideSysNo = entity.WarehouseSysNo //仓库编号 }; Hyt.BLL.Finance.FnReceiptVoucherBo.Instance.InsertOrderReceiptVoucher(xx.OrderSysNO, item); } //同步支付时间的到订单主表 ISoOrderDao.Instance.UpdateOrderPayDteById(xx.OrderSysNO); Hyt.BLL.Order.SoOrderBo.Instance.UpdateSoStatusForSotckOutSign(xx, user); //订单完成,并加积分 }); //外层都使用了事务将此方法包含起来,所以注释掉此段代码 //if (withTran) //{ // using (var tran = new TransactionScope()) // { // mydel(entity); // tran.Complete(); // } //} //else //{ mydel(entity); //} try { //a) 门店下单(付现)提货动作后自动确认收款单 //b) 门店自提货到付款(付现)提货后自动确认收款单 // 自动确认收款单,并写Eas数据 if (payMoney.HasValue && (PaymentType == (int)Hyt.Model.SystemPredefined.PaymentType.现金 || PaymentType == (int)Hyt.Model.SystemPredefined.PaymentType.现金预付)) { Hyt.BLL.Finance.FnReceiptVoucherBo.Instance.AutoConfirmReceiptVoucher(entity.OrderSysNO, user); } //修改ERP库存 //Hyt.BLL.Warehouse.WhWarehouseBo.Instance.UpdateErpProductNumber(sysNo); //修改库存 //Hyt.BLL.Warehouse.WhWarehouseBo.Instance.UpdateWarehouseProductStock(sysNo); } catch (Exception ex) { Hyt.BLL.Log.SysLog.Instance.WriteLog(LogStatus.SysLogLevel.Error, LogStatus.系统日志来源.后台, "门店提货或者门店下单提货", LogStatus.系统日志目标类型.EAS, sysNo, ex, string.Empty, user.SysNo); } }