예제 #1
0
 /// <summary>
 ///创建一个以已经入库的入库单
 /// </summary>
 /// <param name="model">入库实体</param>
 /// <param name="productLend">借货单 明细备注信息为对应的当前还货数量</param>
 /// <returns></returns>
 /// <remarks>2013-07-23 周唐炬 创建</remarks>
 private void CreateInStock(WhStockIn model, WhProductLend productLend)
 {
     if (null == productLend.ItemList || productLend.ItemList.Count <= 0)
     {
         return;
     }
     //来源编号为借货单编号
     model.SourceSysNO  = productLend.SysNo;
     model.Status       = (int)WarehouseStatus.入库单状态.已入库;
     model.SourceType   = (int)WarehouseStatus.入库单据类型.借货单;
     model.IsPrinted    = (int)WarehouseStatus.是否已经打印拣货单.否;
     model.DeliveryType = (int)WarehouseStatus.入库物流方式.还货;
     model.CreatedDate  = model.LastUpdateDate = DateTime.Now;
     model.ItemList     = new List <WhStockInItem>();
     foreach (var item in productLend.ItemList)
     {
         model.ItemList.Add(new WhStockInItem
         {
             CreatedBy           = model.CreatedBy,
             CreatedDate         = DateTime.Now,
             LastUpdateBy        = model.LastUpdateBy,
             LastUpdateDate      = DateTime.Now,
             ProductName         = item.ProductName,
             ProductSysNo        = item.ProductSysNo,
             SourceItemSysNo     = item.SysNo,              //记录入库单明细来源单号(借货单明细编号)
             StockInQuantity     = int.Parse(item.Remarks), //备注信息是当前还货数量,是一个中转参数 2014-04-08 朱成果
             RealStockInQuantity = int.Parse(item.Remarks)  //备注信息是当前还货数量,是一个中转参数 2014-04-08 朱成果
         });
     }
     InStockBo.Instance.CreateStockIn(model);
 }
예제 #2
0
 /// <summary>
 /// 创建借货单
 /// </summary>
 /// <param name="model">借货单实体</param>
 /// <returns>受影响的行</returns>
 /// <remarks>2013-07-09 周唐炬 创建</remarks>
 public override int CreateWhProductLend(WhProductLend model)
 {
     model.SysNo = Context.Insert <WhProductLend>("WHPRODUCTLEND", model)
                   .AutoMap(x => x.SysNo, x => x.ItemList)
                   .ExecuteReturnLastId <int>("SysNo");
     return(model.SysNo);
 }
예제 #3
0
        /// <summary>
        /// 更新借货单
        /// </summary>
        /// <param name="model">借货单实体</param>
        /// <returns>受影响的行</returns>
        /// <remarks>2013-07-09 周唐炬 创建</remarks>
        public override int UpdateWhProductLend(WhProductLend model)
        {
            var rowsAffected = 0;

            rowsAffected = Context.Update <WhProductLend>("WHPRODUCTLEND", model)
                           .AutoMap(x => x.SysNo, x => x.ItemList)
                           .Where(x => x.SysNo)
                           .Execute();
            return(rowsAffected);
        }
예제 #4
0
        /// <summary>
        /// 创建借货单
        /// </summary>
        /// <param name="model">借货单实体</param>
        /// <returns>受影响的行</returns>
        /// <remarks>2013-07-09 周唐炬 创建</remarks>
        public int CreateWhProductLend(WhProductLend model)
        {
            var price = decimal.Zero;
            var id    = IProductLendDao.Instance.CreateWhProductLend(model);

            if (id <= 0)
            {
                throw new HytException("创建借货单异常!");
            }
            CreateProductLendItem(id, model.DeliveryUserSysNo, model.CreatedBy, model.ItemList, ref price);
            //检查前台传入价格是否跟后台计算数据一致
            if (model.Amount != price)
            {
                model.Amount = price;
                UpdateWhProductLend(model);
            }
            //配送员借货额度结算
            DeliveryCreditCalculate(model.DeliveryUserSysNo, model.WarehouseSysNo, model.Amount, id);

            var borrowInfos = (from item in model.ItemList
                               let product = PdProductBo.Instance.GetProduct(item.ProductSysNo)                        //商品
                                             let warehouse = WhWarehouseBo.Instance.GetWarehouse(model.WarehouseSysNo) //仓库
                                                             where product != null && warehouse != null
                                                             select new BorrowInfo()
            {
                ErpCode = product.ErpCode,
                Quantity = item.LendQuantity,
                WarehouseNumber = warehouse.ErpCode,
                Amount = model.Amount,
                Remark = item.Remarks,
                WarehouseSysNo = model.WarehouseSysNo
            }).ToList();

            var syUser = SyUserBo.Instance.GetSyUser(model.DeliveryUserSysNo);
            var client = EasProviderFactory.CreateProvider();

            //销售出库接口的摘要格式:JC[Hyt借货单系统编号]-[借货员姓名]
            client.Borrow(borrowInfos, string.Format("JC[{0}]-[{1}]", id, syUser != null ? syUser.UserName : model.DeliveryUserSysNo.ToString()), id.ToString());

            return(id);
        }
예제 #5
0
 /// <summary>
 /// 更新借货单
 /// </summary>
 /// <param name="model">借货单实体</param>
 /// <returns>受影响的行</returns>
 /// <remarks>2013-07-09 周唐炬 创建</remarks>
 public int UpdateWhProductLend(WhProductLend model)
 {
     return(IProductLendDao.Instance.UpdateWhProductLend(model));;
 }
예제 #6
0
 /// <summary>
 /// 更新借货单
 /// </summary>
 /// <param name="model">借货单实体</param>
 /// <returns>受影响的行</returns>
 /// <remarks>2013-07-09 周唐炬 创建</remarks>
 public abstract int UpdateWhProductLend(WhProductLend model);
예제 #7
0
 /// <summary>
 /// 创建借货单
 /// </summary>
 /// <param name="model">借货单实体</param>
 /// <returns>受影响的行</returns>
 /// <remarks>2013-07-09 周唐炬 创建</remarks>
 public abstract int CreateWhProductLend(WhProductLend model);