Пример #1
0
        /// <summary>
        /// 导入付款单据
        /// </summary>
        /// <param name="model">付款明细</param>
        /// <param name="customer">往来账客户编号</param>
        /// <param name="isUpgrades">是否为升舱</param>
        /// <param name="description">单据摘要(请备注订单号(升舱:备注淘宝订单号))</param>
        /// <param name="flowIdentify"></param>
        /// <returns></returns>
        /// <remarks>2013-9-25 杨浩 创建</remarks>
        public Result Payment(List <Model.Receiving.ReceivingInfo> model, string customer, bool isUpgrades,
                              string description, string flowIdentify)
        {
            var status = LiJiaCore.ReceivingBillFacade(0, model, 收款单类型.退销售回款, customer, description, flowIdentify);

            return(status);
        }
Пример #2
0
        /// <summary>
        /// 获取Kis同步数据
        /// </summary>
        /// <param name="model">Kis</param>
        /// <returns></returns>
        /// <remarks>2013-9-27 杨浩 添加</remarks>
        public Result <string> GetData(CBLiJiaSyncLog model)
        {
            var easModel = new Hyt.Model.LiJiaSyncLog
            {
                SysNo   = model.SysNo,
                Data    = model.Data,
                DataMd5 = model.DataMd5
            };
            var iType  = (接口类型)(model.InterfaceType);
            var result = new Result <string> {
            };

            switch (iType)
            {
            case 接口类型.配送员借货还货:
                var borrow = model.Data.ToObject <BorrowInfoWraper>();
                result = LiJiaCore.OtherIssueBillFacade(borrow.Model, borrow.Type, borrow.Description, "", model.DataMd5, true, true, true);
                break;

            case 接口类型.销售出库退货:
                //var sale = model.Data.ToObject<SaleInfoWraper>();
                result = LiJiaCore.SaleIssueBillFacade(easModel, false, true, true, true);
                break;

            case 接口类型.收款单据导入:
                var receiving = model.Data.ToObject <ReceivingInfoWraper>();
                result = LiJiaCore.ReceivingBillFacade(0, receiving.Model, receiving.ReceivingType, receiving.Customer, receiving.Description, "", model.DataMd5, true, true, true);
                break;
            }
            return(result);
        }
Пример #3
0
        /// <summary>
        /// 库存查询
        /// </summary>
        /// <param name="storageOrgNumber"></param>
        /// <param name="erpCode">商品编码</param>
        /// <param name="erpWarehouseSysNo">仓库编号</param>
        /// <param name="warehouseSysNo"></param>
        /// <returns>库存</returns>
        /// <remarks>2013-9-27 杨浩 添加</remarks>
        public Result <IList <Inventory> > GetInventory(string storageOrgNumber, string[] erpCode, string erpWarehouseSysNo, int warehouseSysNo)
        {
            //return new Result<IList<Inventory>> { Data = null, Message = Model.EasConstant.EAS_MESSAGE_CLOSE, Status = false };
            var data = LiJiaCore.WebInventory(storageOrgNumber, erpCode, erpWarehouseSysNo, warehouseSysNo);

            return(data);
        }
Пример #4
0
        /// <summary>
        /// 销售退货
        /// </summary>
        /// <param name="model">退货明细</param>
        /// <param name="customer">分销商erp编号</param>
        /// <param name="description">单据摘要(商城订单号/升舱订单号)</param>
        /// <param name="flowIdentify"></param>
        /// <returns></returns>
        /// <remarks>2013-9-27 杨浩 添加</remarks>
        public Result SaleInStock(List <SaleInfo> model, string customer, string description, string flowIdentify)
        {
            var datajson = new SaleInfoWraper
            {
                Model       = model,
                Type        = 出库状态.退货,
                Customer    = customer,
                Description = description
            }.ToJson();

            var easModel = new Hyt.Model.LiJiaSyncLog
            {
                Data         = datajson,
                FlowIdentify = flowIdentify
            };
            var status = LiJiaCore.SaleIssueBillFacade(easModel);

            return(status);
        }
Пример #5
0
        /// <summary>
        /// 还货
        /// </summary>
        /// <param name="model">还货明细</param>
        /// <param name="description">单据摘要</param>
        /// <param name="flowIdentify"></param>
        /// <returns></returns>
        /// <remarks>2013-9-27 杨浩 添加</remarks>
        public Result Return(List <BorrowInfo> model, string description, string flowIdentify)
        {
            var result = LiJiaCore.OtherIssueBillFacade(model, 借货状态.还货, description, flowIdentify);

            return(result);
        }
Пример #6
0
        /// <summary>
        /// 获取Kis全部计量单位
        /// </summary>
        /// <returns></returns>
        /// <remarks>2016-11-22 杨浩 添加</remarks>
        public Result <IList <KisUnit> > GetAllUnit()
        {
            var result = LiJiaCore.GetAllUnit();

            return(result);
        }
Пример #7
0
        /// <summary>
        /// 库存查询
        /// </summary>
        /// <param name="storageOrgNumber">组织结构编码</param>
        /// <param name="erpCode">商品编码</param>
        /// <param name="erpWarehouseSysNo">Eas仓库编号</param>
        /// <param name="warehouseSysNo"></param>
        /// <returns></returns>
        /// <remarks>2013-9-27 杨浩 添加</remarks>
        public Result <IList <Inventory> > GetInventory(string storageOrgNumber, string[] erpCode, string erpWarehouseSysNo, int warehouseSysNo)
        {
            var data = LiJiaCore.WebInventory(storageOrgNumber, erpCode, erpWarehouseSysNo, warehouseSysNo);

            return(data);
        }
Пример #8
0
        /// <summary>
        /// 重新同步数据
        /// </summary>
        /// <param name="sysNo">Eas同步系统编号</param>
        /// <param name="isSave">销售出库单是否传保存状态</param>
        /// <returns></returns>
        /// <remarks>2013-9-27 杨浩 添加</remarks>
        public Result Resynchronization(int sysNo, bool isSave = false)
        {
            //string key = "Hyt.EasLog." + sysNo;
            lock (_lockThis)
            {
                //判断是否有锁
                if (_synclist.Contains(sysNo))
                {
                    return new Result {
                               Status = false, Message = "正在同步,请稍后再试..."
                    }
                }
                ;
                //加锁
                _synclist.Add(sysNo);
            }
            var model = Hyt.DataAccess.Sys.ILiJiaDao.Instance.GetEntity(sysNo);

            if (model.Status == (int)步状态.成功)
            {
                return(new Result
                {
                    Message = "此信息已同步成功!",
                    Status = false
                });
            }
            //收款单
            bool isFull         = false;
            int  warehouseSysNo = 0;
            //
            var iType  = (接口类型)(model.InterfaceType);
            var result = new Result <string> {
            };
            var watch  = new Stopwatch();

            watch.Start();
            switch (iType)
            {
            case 接口类型.配送员借货还货:
                var borrow = model.Data.ToObject <BorrowInfoWraper>();
                result = LiJiaCore.OtherIssueBillFacade(borrow.Model, borrow.Type, borrow.Description, model.FlowIdentify, model.DataMd5, true);
                break;

            case 接口类型.销售出库退货:
                //var sale = model.Data.ToObject<SaleInfoWraper>();
                result = LiJiaCore.SaleIssueBillFacade(model, isSave, true);
                break;

            case 接口类型.收款单据导入:
                #region 收款单据导入
                var receiving = model.Data.ToObject <ReceivingInfoWraper>();
                if (model.Message.StartsWith(EasConstant.Information))
                {
                    isFull = true;

                    foreach (var item  in receiving.Model)
                    {
                        if (item.WarehouseSysNo == 0)
                        {
                            int orderSysNo = 0;
                            int.TryParse(item.OrderSysNo, out orderSysNo);
                            var wh = IOutStockDao.Instance.GetWhStockOutListByOrderID(orderSysNo, true);
                            if (wh != null && wh.Count > 0)
                            {
                                item.Remark         = "";
                                item.WarehouseSysNo = wh.FirstOrDefault().WarehouseSysNo;
                                warehouseSysNo      = item.WarehouseSysNo;
                                var warehouse = IWhWarehouseDao.Instance.GetWarehouse(warehouseSysNo);     //地区仓库
                                if (warehouse != null)
                                {
                                    item.WarehouseNumber = warehouse.ErpCode;
                                }
                            }
                        }
                        var oraganization = IOrganizationDao.Instance.GetOrganization(item.WarehouseSysNo);
                        if (oraganization != null)
                        {
                            item.OrganizationCode = oraganization.Code;
                        }
                        if (item.PayeeAccount != EasConstant.PayeeAccount && string.IsNullOrEmpty(item.PayeeAccount))
                        {
                            var pa =
                                IFnReceiptTitleAssociationDao.Instance.GetList(item.WarehouseSysNo, PaymentType.现金)
                                .OrderByDescending(m => m.IsDefault)
                                .FirstOrDefault();
                            if (pa != null)
                            {
                                item.PayeeAccount = pa.EasReceiptCode;
                            }
                        }
                    }
                }
                result = LiJiaCore.ReceivingBillFacade(model.SysNo, receiving.Model, receiving.ReceivingType, receiving.Customer, receiving.Description, model.FlowIdentify, model.DataMd5, true);
                break;
                #endregion
            }
            watch.Stop();
            if (result.Status || result.StatusCode == "105")// || result.StatusCode == "9999" || result.Message.Contains("当前单据已经同步成功"))
            {
                model.Status    = (int)步状态.成功;
                model.VoucherNo = result.Data;
                model.Message   = "同步成功";
                //消息特殊处理:销售出库单,外部系统id:1e65059916eb765b4b7d17496589c904,已经同步过,对应EAS单据ID为:XSCK2014052905193353,请不要重复同步...
                if (result.StatusCode == "105" && !string.IsNullOrEmpty(result.Message))
                {
                    var reg = new Regex(@"XSCK(\d*)");
                    var m   = reg.Match(result.Message);
                    model.VoucherNo = m.Value;
                }
                //消息特殊处理:当前单据已经同步成功,kis单据号为:XSCK2014081907917302
                else if (!string.IsNullOrEmpty(result.Message) && result.Message.Contains("单据重复"))
                {
                    Regex reg = new Regex(@"XSCK(\d*)");
                    var   m   = reg.Match(result.Message);
                    model.VoucherNo = m.Value;
                }
            }
            else
            {
                model.Status  = (int)步状态.失败;
                model.Message = result.Message;
            }
            model.SyncNumber     = model.SyncNumber + 1;
            model.StatusCode     = result.StatusCode;
            model.ElapsedTime    = (int)watch.ElapsedMilliseconds;
            model.LastsyncTime   = DateTime.Now;
            model.LastupdateDate = DateTime.Now;
            model.LastupdateBy   = Hyt.Model.SystemPredefined.User.SystemUser;
            //收款单资料不全,重新读取并更新
            if (isFull && warehouseSysNo != 0)
            {
                model.WarehouseSysNo = warehouseSysNo;
            }
            Hyt.DataAccess.Sys.ILiJiaDao.Instance.Update(model);

            _synclist.Remove(sysNo);

            return(result);
        }
Пример #9
0
        /// <summary>
        /// 导入收款单据
        /// </summary>
        /// <param name="model">收款明细</param>
        /// <param name="receivingType">收款单类型(5:商品收款单;10:服务收款单)</param>
        /// <param name="customer">往来账客户编号</param>
        /// <param name="isUpgrades">是否为升舱</param>
        /// <param name="description">单据摘要(请备注订单号、会员名称、收款仓库(在线支付订单:备注商城、升舱:备注淘宝))</param>
        /// <param name="flowIdentify"></param>
        /// <returns></returns>
        /// <remarks>2013-9-25 杨浩 创建</remarks>
        public Result Receiving(List <ReceivingInfo> model, 收款单类型 receivingType, string customer, bool isUpgrades, string description, string flowIdentify)
        {
            var status = LiJiaCore.ReceivingBillFacade(0, model, receivingType, customer, description, flowIdentify);

            return(status);
        }
Пример #10
0
 /// <summary>
 /// 销售单查询
 /// </summary>
 /// <param name="request">查询参数</param>
 /// <returns></returns>
 /// <remarks>2016-12-12 杨浩 创建</remarks>
 public Result <List <SaleSearchResponse> > SaleSearch(SaleSearchRequest request)
 {
     return(LiJiaCore.SaleSearch(request));
 }