/// <summary> /// 减库存失败的订单将存放在此表中,等待再次扣减库存 /// </summary> /// <param name="entity"></param> /// <returns></returns> /// <remarks>2016-05-24 陈海裕 创建</remarks> public override int AddToReducedPOSInventoryQueue(ReducedPOSInventoryQueue entity) { return(Context.Insert("ReducedPOSInventoryQueue", entity).AutoMap(o => o.SysNo).Execute()); }
/// <summary> /// 减库存失败的订单将存放在此表中,等待再次扣减库存 /// </summary> /// <param name="entity"></param> /// <remarks>2016-05-24 陈海裕 创建</remarks> public void AddToReducedPOSInventoryQueue(ReducedPOSInventoryQueue entity) { entity.CreateDate = DateTime.Now; DataAccess.Extra.IPosServiceDao.Instance.AddToReducedPOSInventoryQueue(entity); }
/// <summary> /// 减库存失败的订单将存放在此表中,等待再次扣减库存 /// </summary> /// <param name="entity"></param> /// <returns></returns> /// <remarks>2016-05-24 陈海裕 创建</remarks> public abstract int AddToReducedPOSInventoryQueue(ReducedPOSInventoryQueue entity);
/// <summary> /// POS系统减库存(维嘉项目) /// </summary> /// <param name="orderSysNo"></param> /// <param name="orderAmount"></param> /// <param name="db_no">单据标示</param> /// <remarks>2016-05-20 陈海裕 创建</remarks> public void ReducedPOSInventory(int orderSysNo, decimal orderAmount, string db_no = null) { Result result = new Result(); try { SoOrder order = BLL.Order.SoOrderBo.Instance.GetEntity(orderSysNo); IList <SoOrderItem> orderItems = BLL.Order.SoOrderBo.Instance.GetOrderItemsByOrderId(orderSysNo); CBWhWarehouse warehouse = BLL.Warehouse.WhWarehouseBo.Instance.GetWarehouse(order.DefaultWarehouseSysNo); Grand.Platform.Api.Contract.DataContract.LessProductStockRequest request = new Grand.Platform.Api.Contract.DataContract.LessProductStockRequest(); Grand.Platform.Api.Contract.Model.SheetMaster sheetMaster = new Grand.Platform.Api.Contract.Model.SheetMaster(); sheetMaster.trans_no = "00"; sheetMaster.branch_no = warehouse.ErpCode; sheetMaster.oper_date = DateTime.Now; sheetMaster.sheet_amt = orderAmount; sheetMaster.db_no = db_no; IList <Grand.Platform.Api.Contract.Model.SheetDetail> sheetDetailList = new List <Grand.Platform.Api.Contract.Model.SheetDetail>(); Grand.Platform.Api.Contract.Model.SheetDetail sheetDetail = null; foreach (var item in orderItems) { sheetDetail = new Grand.Platform.Api.Contract.Model.SheetDetail(); var tempProduct = BLL.Product.PdProductBo.Instance.GetProduct(item.ProductSysNo); sheetDetail.item_no = tempProduct.ErpCode; sheetDetail.real_qty = item.Quantity; sheetDetail.large_qty = item.Quantity; sheetDetail.valid_price = item.SalesUnitPrice; sheetDetail.sale_price = item.OriginalPrice; sheetDetail.sub_amt = item.SalesAmount; sheetDetailList.Add(sheetDetail); } request.SheetMaster = sheetMaster; request.SheetDetails = sheetDetailList; string json = Util.Serialization.JsonUtil.ToJson2(request); result.Status = this.LessProductStock(request); if (result.Status == false) { var queObj = DataAccess.Extra.IPosServiceDao.Instance.GetEntityByOrderSysNo(orderSysNo); if (queObj == null) { // 扣减库存失败,添加到队列表 ReducedPOSInventoryQueue model = new ReducedPOSInventoryQueue(); model.OrderSysNo = orderSysNo; model.JsonData = json; this.AddToReducedPOSInventoryQueue(model); } BLL.Log.SysLog.Instance.Error(Model.WorkflowStatus.LogStatus.系统日志来源.前台, "POS系统减库存失败:ReducedPOSInventory", new Exception()); } } catch (Exception ex) { // 扣减库存失败,添加到队列表 ReducedPOSInventoryQueue model = new ReducedPOSInventoryQueue(); model.OrderSysNo = orderSysNo; model.Remark = ex.ToString(); this.AddToReducedPOSInventoryQueue(model); BLL.Log.SysLog.Instance.Error(Model.WorkflowStatus.LogStatus.系统日志来源.前台, "POS系统减库存失败:ReducedPOSInventory", ex); } }