Пример #1
0
        /// <summary>
        /// 退货入库
        /// </summary>
        /// <param name="model">入库单</param>
        /// <remarks>2016-10-31 杨浩 创建</remarks>
        public void ReturnsIntoWarehouse(WhStockIn model)
        {
            var result = new Result();

            try
            {
                var warehouse = BLL.Warehouse.WhWarehouseBo.Instance.GetWarehouse(model.WarehouseSysNo);

                var 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 = 0;
                sheetMaster.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 model.ItemList)
                {
                    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.RealStockInQuantity;
                    sheetDetail.large_qty   = item.RealStockInQuantity;
                    sheetDetail.valid_price = 0;
                    sheetDetail.sale_price  = 0;
                    sheetDetail.sub_amt     = 0;
                    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 model1 = new ReducedPOSInventoryQueue();
                    //    model.OrderSysNo = orderSysNo;
                    //    model.JsonData = json;
                    //    this.AddToReducedPOSInventoryQueue(model);
                    //}

                    BLL.Log.SysLog.Instance.Error(Model.WorkflowStatus.LogStatus.系统日志来源.前台, "POS系统加库存失败:ReturnsIntoWarehouse", new Exception());
                }
            }
            catch (Exception ex)
            {
                //// 扣减库存失败,添加到队列表
                //ReducedPOSInventoryQueue model1 = new ReducedPOSInventoryQueue();
                //model.OrderSysNo = orderSysNo;
                //model.Remark = ex.ToString();
                //this.AddToReducedPOSInventoryQueue(model);

                BLL.Log.SysLog.Instance.Error(Model.WorkflowStatus.LogStatus.系统日志来源.前台, "POS系统加库存失败:ReturnsIntoWarehouse", ex);
            }
        }