示例#1
0
        /// <summary>
        /// 保存到合包表
        /// </summary>
        /// <returns></returns>
        public Result <bool> SaveEpcCombine(EpcCombineModel model, List <string> orders)
        {
            var result = new Result <bool>()
            {
                HasError = false
            };
            string sql  = @"insert into [EPC_CombinedPackage]([BarCode],[ExchangeNumber],[CombineId],[pdf_10_lcl_url],[pdf_a4_en_url],[pdf_a4_lcl_url],[pdf_10_en_url],
[label_format],[carrier],[Weight],[Piece],[PackageLabelsType],[CreateTime])values (@BarCode,@ExchangeNumber,@CombineId,@pdf_10_lcl_url,@pdf_a4_en_url,@pdf_a4_lcl_url,@pdf_10_en_url,
@label_format,@carrier,@Weight,@Piece,@PackageLabelsType,getdate())";
            string sql1 = @"insert into  [dbo].[EPC_CombinedPackageDetail] (BarCode,ExchangeNumber,TrackingNumber) values(@BarCode,@ExchangeNumber,@TrackingNumber)";

            using (var conn = OpenConnection("Yanwen_EPC"))
            {
                try
                {
                    var count = conn.Execute(sql, new
                    {
                        BarCode           = model.BarCode,
                        ExchangeNumber    = model.ExchangeNumber,
                        CombineId         = model.CombineId,
                        pdf_10_lcl_url    = model.pdf_10_lcl_url,
                        pdf_a4_en_url     = model.pdf_a4_en_url,
                        pdf_a4_lcl_url    = model.pdf_a4_lcl_url,
                        pdf_10_en_url     = model.pdf_10_en_url,
                        label_format      = model.label_format,
                        carrier           = model.carrier,
                        Weight            = model.Weight,
                        PackageLabelsType = model.PackageLabelsType,
                        Piece             = model.Piece
                    }) > 0;
                    foreach (string t in orders)
                    {
                        //保存明细
                        conn.Execute(sql1, new { BarCode = model.BarCode, ExchangeNumber = model.ExchangeNumber, TrackingNumber = t });
                    }
                    //保存到MQ任务表
                    EpcMqPushTakDal.Instance.SaveMaTask(model.BarCode, "EPC_CombinedPackage", "EpcCombinedPackage", "Add");
                    if (!count)
                    {
                        result.HasError = true;
                        result.ErrorMsg = "修改行数返回为0";
                        return(result);
                    }
                }
                catch (Exception e)
                {
                    result.HasError = true;
                    result.ErrorMsg = "执行语句时出错!详情:" + e.Message;
                    return(result);
                }
            }
            return(result);
        }
示例#2
0
        /// <summary>
        /// 类型转换
        /// </summary>
        /// <param name="model"></param>
        /// <param name="orders"></param>
        /// <param name="item"></param>
        /// <param name="exchangeNumber"></param>
        /// <returns></returns>
        public EpcCombineModel ConversionModel(EpcCombineResponseModel model, List <string> orders, CombineResponsePushModel item, string exchangeNumber)
        {
            var reslut = new EpcCombineModel {
            };

            reslut.ExchangeNumber    = exchangeNumber;
            reslut.BarCode           = model.barcode;
            reslut.CombineId         = item.Number;
            reslut.Weight            = EpcDal.Instance.GetEpcCombineWeight(orders, item.Parameter, item.Parameter1);
            reslut.carrier           = model.carrier;
            reslut.Piece             = orders.Count;
            reslut.pdf_10_en_url     = model.pdf_10_en_url;
            reslut.pdf_10_lcl_url    = model.pdf_10_lcl_url;
            reslut.pdf_a4_en_url     = model.pdf_a4_en_url;
            reslut.pdf_a4_lcl_url    = model.pdf_a4_lcl_url;
            reslut.label_format      = model.label_format;
            reslut.PackageLabelsType = item.Parameter;
            return(reslut);
        }
示例#3
0
        /// <summary>
        /// 非燕文货物也存临时表
        /// </summary>
        /// <param name="model"></param>
        /// <param name="orders"></param>
        /// <returns></returns>
        public Result <bool> SaveExpress(EpcCombineModel model, List <string> orders)
        {
            var result = new Result <bool>()
            {
                HasError = false
            };
            var value        = GetCombineOrderModel(orders).total_value;
            var carrierModel = GetCarrier(model.carrier.ToString(), 0);

            if (carrierModel == null)
            {
                result.HasError = true;
                result.ErrorMsg = $"没有找到对应carrier[{model.carrier}]的服务配置!请配置";
                return(result);
            }
            using (var conn = OpenConnection())
            {
                using (var tx = conn.BeginTransaction())
                {
                    try
                    {
                        var express = new ExpressModel()
                        {
                        };
                        express.WaybillNumber         = model.BarCode;
                        express.OrderCode             = "";
                        express.ExchangeNumber        = model.BarCode;
                        express.Piece                 = orders.Count;
                        express.Weight                = model.Weight;
                        express.SupplierWeight        = model.Weight;
                        express.TrueWeight            = model.Weight;
                        express.ApSpecialAmount       = value;
                        express.ApDeclaredValue       = value;
                        express.ArDeclaredValue       = value;
                        express.ArDeclaredValue       = value;
                        express.CompanyCode           = "10";
                        express.SourceId              = 12;
                        express.CreateId              = "92315";
                        express.CustomerCode          = 30045174;
                        express.RegionId              = 2860;
                        express.PostCode              = "523000";
                        express.CreateTime            = DateTime.Now;
                        express.AscanTime             = DateTime.Now;
                        express.ReceiveDate           = DateTime.Now;
                        express.PlatformOrderTime     = DateTime.Now;
                        express.EPReceiveDate         = DateTime.Now;
                        express.CustomerDiscountLevel = "0";
                        express.AreaCode              = "1003";

                        express.ServiceCode           = carrierModel.ServiceCode;
                        express.SupplierCode          = carrierModel.SupplierCode;
                        express.ProductCode           = carrierModel.YanWenProductCode;
                        express.PrintSortingCode      = $"{express.CompanyCode}-{express.SupplierCode}-{express.ServiceCode}-{carrierModel.RuleCode}";
                        express.SettlementCompanyCode = "10";
                        express.OutWarehouse          = "10";
                        //快件信息临时表保存
                        SaveTamExpressDal.Instance.Insert(express, conn, tx);
                        tx.Commit();
                    }
                    catch (Exception e)
                    {
                        tx.Rollback();
                        result.HasError = true;
                        result.ErrorMsg = "保存快件临时表出错 " + e.Message;
                        return(result);
                    }
                }
            }
            return(result);
        }