Beispiel #1
0
        public ActionResult GetOrderDetailByOrderNumber(string OrderNumber)
        {
            List <OrderDetailForRedisRF> lists = new List <OrderDetailForRedisRF>();

            try
            {
                if (RCommon.RedisOperation.Exists("Check:" + OrderNumber))
                {
                    lists = RCommon.RedisOperation.GetList <List <OrderDetailForRedisRF> >("Check:" + OrderNumber);
                }
                else
                {
                    var response = new OrderManagementService().GetOrderDetailListByOrderNumber(OrderNumber, Session["CustomerID"].ToString());
                    if (response.Count() > 0)
                    {
                        lists = response.ToList();
                        RCommon.RedisOperation.SetList("Check:" + OrderNumber, lists);
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(Json(lists, JsonRequestBehavior.AllowGet));
            //recModelList;
        }
Beispiel #2
0
        public ActionResult GetOrderDetail2(string OrderNumber)
        {
            IEnumerable <OrderDetailInfo> orderModelList;

            orderModelList = new OrderManagementService().GetOrderDetailList2(OrderNumber, Session["CustomerID"].ToString(), Session["WareHouseName"].ToString());
            return(Json(orderModelList.ToList(), JsonRequestBehavior.AllowGet));
            //recModelList;
        }
        //public virtual Invoice Invoice { get; set; }

        public OrderModel()
        {
            _orderManagementService   = new OrderManagementService();
            _itemManagementService    = new ItemManagementService();
            _invoiceManagementService = new InvoiceManagementService();
            //Invoice = new Invoice();
            //Items = new List<Item>();
        }
        public DashboardViewModel()
        {
            _orderManagementService   = new OrderManagementService();
            _itemManagementService    = new ItemManagementService();
            _invoiceManagementService = new InvoiceManagementService();

            OrderCount          = _orderManagementService.GetAllOrder();
            ItemCount           = _itemManagementService.GetAllItem();
            TotalInvoiceCreated = _invoiceManagementService.GetAllInvoice();
            TotalAmount         = _invoiceManagementService.TotalAmount();
        }
Beispiel #5
0
        public ActionResult GetOrderListMain(OrderViewModel vm, string Action)
        {
            ViewBag.UserName      = Session["Name"].ToString();
            ViewBag.CustomerID    = Session["CustomerID"];
            ViewBag.WareHouseName = Session["WareHouseName"];
            ViewBag.WareHouseID   = Session["WareHouseIDs"];
            var response = new OrderManagementService().GetOrderList(Session["CustomerID"].ToString(), Session["WareHouseName"].ToString(), vm.SearchCondition.ExternOrderNumber);

            vm.OrderCollection = response;
            return(View(vm));
        }
Beispiel #6
0
        //声明一个全局的空箱子将装不下的先暂存
        //List<CalculateBoxModel> boxModels = new List<CalculateBoxModel>();
        public bool preOrderDetailsFun(GetOrderByConditionRequest Request)
        {
            c_LogWriter.Init((LogType)Enum.Parse(typeof(LogType), "SysLog"));
            c_LogWriter.Error("发送错误,线程退出,客户端ID  ex.Message");
            CustomerId = Request.SearchCondition.CustomerID.ToString();
            var preOrderDetails = new OrderManagementService().GetOrderDetailBox(Request.SearchCondition).Result.calculateBoxModels;

            boxTypeModels = new PreOrderService().GetBoxType(CustomerId).Result.boxTypeModels.ToList();
            var GetPuductInfo = new ProductService().GetPuductInfo(Request.SearchCondition);

            foreach (var item in GetPuductInfo.Result)
            {
                item.SKUvolume = item.SKUlength * item.SKUwidth * item.SKUhigh;
                RedisCacheHelper.Set(CustomerId + "_" + item.SKU, item, DateTime.Now.AddMonths(3));
            }
            //var preOrderDetailsGroup = preOrderDetails.GroupBy(a => new { a.SKU, a.ExternOrderNumber, a.GoodsName, a.GoodsType, a.PreOrderNumber, a.Warehouse })
            //     .Select(a => new { AllocatedQty = a.Sum(b => b.AllocatedQty), a }).ToList();
            //List<CalculateBoxModel> calculateBoxModels = new List<CalculateBoxModel>();
            //calculateBoxModels.AddRange(preOrderDetails.Where(a => !string.IsNullOrEmpty(a.BoxNumber)).ToList());
            foreach (var item in preOrderDetails.Where(a => !string.IsNullOrEmpty(a.BoxNumber)).ToList())
            {
                boxs.Add(new List <CalculateBoxModel> {
                    item
                });
            }
            //var wholeBox = preOrderDetails.Where(a => a.AllocatedQty / a.SKUBoxspecifications >= 1).ToList();
            var scatteredBox = preOrderDetails.Where(a => string.IsNullOrEmpty(a.BoxNumber)).ToList();



            //先对SKU分组
            foreach (var item in scatteredBox.GroupBy(a => new { a.ExternOrderNumber, a.SKU }))
            {
                //规格
                //int SKUBoxspecifications = 6;

                geyBox(item.ToList());
                //获取到SKU
            }
            //boxs
            List <CalculateBoxModel> calculates = new List <CalculateBoxModel>();

            for (int i = 0; i < boxs.Count; i++)
            {
                boxs[i].Each((a, b) =>
                {
                    b.BoxCode = b.ExternOrderNumber + i;
                    calculates.Add(b);
                });
            }

            return(true);
        }
Beispiel #7
0
        public string Package(long ID, string JsonPackage, int flag)
        {
            var      responseJsonFieldsets = jsonlist <PackageDetailInfo>(JsonPackage);
            DateTime d = DateTime.Now;
            AddPackageAndDetailRequest request        = new AddPackageAndDetailRequest();
            IList <PackageInfo>        packages       = new List <PackageInfo>();
            IList <PackageDetailInfo>  packageDetails = new List <PackageDetailInfo>();

            responseJsonFieldsets.Each((i, package) =>
            {
                packages.Add(new PackageInfo()
                {
                    Creator       = Session["Name"].ToString(),
                    CreateTime    = d,
                    Updator       = Session["Name"].ToString(),
                    UpdateTime    = d,
                    PackageNumber = package.PackageNumber,
                    PackageType   = package.PackageType,
                    ExpressNumber = package.ExpressNumber,
                    Length        = package.Length,
                    Width         = package.Width,
                    Height        = package.Height,
                    NetWeight     = package.NetWeight,
                    GrossWeight   = package.GrossWeight,
                    PackageTime   = d,
                    OID           = ID
                });

                packageDetails.Add(new PackageDetailInfo()
                {
                    Creator       = Session["Name"].ToString(),
                    CreateTime    = d,
                    Updator       = Session["Name"].ToString(),
                    UpdateTime    = d,
                    PackageNumber = package.PackageNumber,
                    SKU           = package.SKU,
                    UPC           = package.UPC,
                    GoodsName     = package.GoodsName,
                    GoodsType     = package.GoodsType,
                    Qty           = package.Qty
                });
            });
            request.packages       = packages;
            request.packageDetails = packageDetails;
            var response = new OrderManagementService().AddPackageAndDetail(ID, request, flag);

            return(response.Result);
        }
        //
        // GET: /WMS/NikeNFSPrint/

        public ActionResult Index(string id, string type)
        {
            if (type == "1")
            {
                GetOrderByConditionResponse PackageModel = new OrderManagementService().GetPackageByCondition(int.Parse(id.ToString())).Result;
                return(View(PackageModel));
            }
            else if (type == "0")
            {
                return(View());
            }
            else
            {
                return(View());
            }
        }
Beispiel #9
0
        public ActionResult GetOrderListMain(string CustomerID, string WareHouseName, string WareHouseID)
        {
            OrderViewModel vm = new OrderViewModel();

            if (Session[Constants.USER_INFO_KEY] == null || CustomerID == null || WareHouseName == null || WareHouseID == null)
            {
                return(RedirectToAction("", "login"));
            }
            Session["CustomerID"]    = CustomerID;
            Session["WareHouseName"] = WareHouseName;
            Session["WareHouseIDs"]  = WareHouseID;
            ViewBag.WareHouseID      = WareHouseID;
            ViewBag.UserName         = Session["Name"].ToString();
            var response = new OrderManagementService().GetOrderList(CustomerID, WareHouseName, "");

            vm.OrderCollection = response;
            return(View(vm));
        }
Beispiel #10
0
        /// <summary>
        /// 拣货完成同步redis中数据到数据库,同时删除redis
        /// </summary>
        /// <param name="OrderNumber"></param>
        /// <returns></returns>
        public string SaveRecDataFromRedis(string OrderNumber)
        {
            List <OrderDetailForRedisRF> redisList = new List <OrderDetailForRedisRF>();
            List <WMS_Log_Operation>     logs      = new List <WMS_Log_Operation>();
            string msg = "";

            try
            {
                if (RCommon.RedisOperation.Exists(OrderNumber))
                {
                    redisList = RCommon.RedisOperation.GetList <List <OrderDetailForRedisRF> >(OrderNumber);
                    var response = new OrderManagementService().InsertPick(redisList, Session["Name"].ToString());
                    if (response)
                    {
                        WMS_Log_Operation operation = new WMS_Log_Operation();
                        operation.MenuName          = "出库单管理";
                        operation.Operation         = "出库单-" + "拣货";
                        operation.OrderType         = "Order";
                        operation.Controller        = Request.RawUrl;
                        operation.Creator           = Session["Name"].ToString();
                        operation.CreateTime        = DateTime.Now;
                        operation.ProjectID         = Convert.ToInt32(Session["ProjectID"]);
                        operation.ProjectName       = Session["ProjectName"].ToString();
                        operation.OrderNumber       = OrderNumber;
                        operation.ExternOrderNumber = RCommon.RedisOperation.GetList <List <OrderDetailForRedisRF> >(OrderNumber).Select(c => c.ExternOrderNumber).FirstOrDefault().ToString();
                        operation.OrderID           = RCommon.RedisOperation.GetList <List <OrderDetailForRedisRF> >(OrderNumber).Select(c => c.OID).FirstOrDefault().ToString();
                        operation.WarehouseName     = Session["WareHouseName"].ToString();
                        operation.WarehouseID       = Convert.ToInt32(Session["WareHouseIDs"]);
                        operation.CustomerID        = Convert.ToInt32(Session["CustomerID"]);
                        logs.Add(operation);
                        new LogOperationService().AddLogOperation(logs);
                        RCommon.RedisOperation.Del(OrderNumber);
                        msg = "1";
                    }
                }
            }
            catch (Exception ex)
            {
                msg = "0";
            }
            return(msg);
        }
        public async void TestCreateOrder()
        {
            DbContextOptions <CreaturesDbcontext> options = new DbContextOptionsBuilder <CreaturesDbcontext>().UseInMemoryDatabase("CreateOrder").Options;

            using (CreaturesDbcontext context = new CreaturesDbcontext(options))
            {
                Order testOrder5 = new Order();
                testOrder5.ID         = 1;
                testOrder5.UserID     = "aUserID";
                testOrder5.Totalprice = 30;

                OrderManagementService orderService = new OrderManagementService(context);

                await orderService.CreateOrder(testOrder5);

                var order1Answer = context.OrderTable.FirstOrDefault(c => c.ID == testOrder5.ID);

                Assert.Equal(testOrder5, order1Answer);
            }
        }
        public async void TestGetOrder()
        {
            DbContextOptions <CreaturesDbcontext> options = new DbContextOptionsBuilder <CreaturesDbcontext>().UseInMemoryDatabase("GetOrder").Options;

            using (CreaturesDbcontext context = new CreaturesDbcontext(options))
            {
                Order testOrder6 = new Order();
                testOrder6.ID         = 1;
                testOrder6.UserID     = "aUserID";
                testOrder6.Totalprice = 300;

                OrderManagementService orderService = new OrderManagementService(context);

                await orderService.CreateOrder(testOrder6);

                var order2Answer = await orderService.GetOrder("aUserID");

                Assert.Equal(testOrder6, order2Answer[0]);
            }
        }
Beispiel #13
0
        /// <summary>
        /// 点击完成同步redis中数据到拣货表
        /// </summary>
        /// <param name="OrderNumber"></param>
        /// <returns></returns>
        public string InsertIntoPickFromRedis(string OrderNumber, string ID)
        {
            List <OrderDetailForRedisRF> picklistredis = new List <OrderDetailForRedisRF>();
            List <WMS_Log_Operation>     logs          = new List <WMS_Log_Operation>();

            try
            {
                if (RCommon.RedisOperation.Exists(OrderNumber))
                {
                    picklistredis = RCommon.RedisOperation.GetList <List <OrderDetailForRedisRF> >(OrderNumber);
                }
                else
                {
                    return("2");
                }
                var response = new OrderManagementService().InsertPick(picklistredis, Session["Name"].ToString());

                if (response)
                {
                    WMS_Log_Operation operation = new WMS_Log_Operation();
                    operation.MenuName    = "出库单管理";
                    operation.Operation   = "出库单-" + "拣货";
                    operation.OrderType   = "Order";
                    operation.Controller  = Request.RawUrl;
                    operation.Creator     = Session["Name"].ToString();
                    operation.CreateTime  = DateTime.Now;
                    operation.ProjectID   = Convert.ToInt32(Session["ProjectID"]);
                    operation.ProjectName = Session["ProjectName"].ToString();
                    operation.OrderID     = ID;
                    logs.Add(operation);
                    new LogOperationService().AddLogOperation(logs);
                    RCommon.RedisOperation.Del(OrderNumber);
                    return("1");
                }
            }
            catch (Exception ex)
            {
                return("0");
            }
            return("0");
        }
        public Task StartAsync(CancellationToken cancellationToken)
        {
            return(Task.Factory.StartNew(() =>
            {
                _server = new Grpc.Core.Server
                {
                    Ports =
                    {
                        new ServerPort("192.168.0.5", 5001, ServerCredentials.Insecure)
                    },
                    Services =
                    {
                        OrderManagementService.BindService(new OrderManagementServiceImpl())
                    }
                };

                _server.Start();

                Console.WriteLine("Order management Server is running");
            }));
        }
Beispiel #15
0
        /// <summary>
        /// 检测快递单号
        /// </summary>
        /// <param name="ExpressNumber"></param>
        /// <returns></returns>
        //public string CheckExpress(string ExpressNumber,)
        //{
        //    ExpressPackageResponse EPR = new ExpressPackageResponse();
        //    ExpressPackageModel EP = new ExpressPackageModel();

        //    OrderManagementService o = new OrderManagementService();
        //    string WarehouseName = ApplicationConfigHelper.GetAllProjectCustomersWarehouse().Where(a => a.WarehouseID == base.UserInfo.WarehouseID).Select(b => b.WarehouseName).FirstOrDefault();
        //    EPR = o.CheckExpress(ExpressNumber, base.UserInfo.CustomerID, WarehouseName);
        //    EP.PackageCollection = EPR.PackageCollection;
        //    EP.OrderDetailCollection = EPR.OrderDetailCollection;

        //    string s = "";
        //    DataSet dt = new DataSet();
        //    dt = o.CheckExpress(ExpressNumber, base.UserInfo.CustomerID, WarehouseName, s);

        //    //return DataSetToJson(dt,"");
        //    return DataTableToJsonWithJsonNet(dt.Tables[0]);
        //}
        /// <summary>
        /// 检测快递单号和订单号
        /// </summary>
        /// <param name="Number"></param>
        /// <param name="Type">区分快递单号还是订单号</param>
        /// <returns></returns>
        public string CheckExpressOrder(string Number, string Type, long CustomerID, long WarehouseID)
        {
            //ExpressPackageResponse EPR = new ExpressPackageResponse();
            //ExpressPackageModel EP = new ExpressPackageModel();

            string WarehouseName     = ApplicationConfigHelper.GetAllProjectCustomersWarehouse().Where(a => a.WarehouseID == WarehouseID).Select(b => b.WarehouseName).FirstOrDefault();
            OrderManagementService o = new OrderManagementService();
            //EPR = o.CheckExpress(Number, CustomerID, WarehouseName);
            //EP.PackageCollection = EPR.PackageCollection;
            //EP.OrderDetailCollection = EPR.OrderDetailCollection;

            DataSet dt = new DataSet();

            dt = o.CheckExpress(Number, CustomerID, WarehouseName, Type);

            //return DataSetToJson(dt,"");
            if (Type == "Order")
            {
                return(DataTableToJsonWithJsonNet(dt.Tables[1]));
            }
            return(DataTableToJsonWithJsonNet(dt.Tables[0]));
        }
Beispiel #16
0
 public ActionResult Index(string CustomerID, string WareHouseName, string WareHouseID, string OrderNumber)
 {
     if (Session[Constants.USER_INFO_KEY] == null || CustomerID == null || WareHouseName == null)
     {
         return(RedirectToAction("", "login"));
     }
     Session["CustomerID"]    = CustomerID;
     Session["WareHouseName"] = WareHouseName;
     Session["WareHouseIDs"]  = WareHouseID;
     ViewBag.OrderNumber      = OrderNumber;
     ViewBag.CustomerID       = Session["CustomerID"];
     ViewBag.WareHouseName    = Session["WareHouseName"];
     ViewBag.WareHouseID      = Session["WareHouseIDs"];
     if (!RCommon.RedisOperation.Exists(OrderNumber))
     {
         List <OrderDetailForRedisRF> orderDetails = new List <OrderDetailForRedisRF>();
         var response = new OrderManagementService().GetOrderDetailList(OrderNumber, CustomerID, WareHouseName);
         orderDetails = response.ToList();
         RCommon.RedisOperation.SetList(OrderNumber, orderDetails);
     }
     return(View());
 }
Beispiel #17
0
        /// <summary>
        /// 保存快递包装数据
        /// </summary>
        /// <param name="uu"></param>
        /// <returns></returns>
        public string SaveExpressPackage(long CustomerID, string WarehouseName, long OrderID, string ExpressNumber, string PackageType)
        {
            DataSet dt = new DataSet();
            OrderManagementService o = new OrderManagementService();

            dt = o.SaveExpressPackage(ExpressNumber, PackageType, CustomerID, WarehouseName);
            #region 操作日志
            List <WMS_Log_Operation> logs      = new List <WMS_Log_Operation>();
            WMS_Log_Operation        operation = new WMS_Log_Operation();
            operation.MenuName    = "快递包装管理";
            operation.Operation   = "快递包装-保存";
            operation.OrderType   = "ExpressPackage";
            operation.Controller  = Request.RawUrl;
            operation.Creator     = Session["Name"].ToString();
            operation.CreateTime  = DateTime.Now;
            operation.ProjectID   = Convert.ToInt32(Session["ProjectID"]);
            operation.ProjectName = Session["ProjectName"].ToString();
            operation.OrderID     = OrderID.ToString();
            logs.Add(operation);
            new LogOperationService().AddLogOperation(logs);
            #endregion
            return(DataTableToJsonWithJsonNet(dt.Tables[0]));
        }
Beispiel #18
0
        public string SaveRecData(string ReceiptNumber, string Type)
        {
            //SaveData
            //recModelList;
            bool resualt = new OrderManagementService().UpdateOrderStatus(ReceiptNumber, Session["CustomerID"].ToString(), Session["WareHouseName"].ToString(), Session["Name"].ToString(), Type);

            if (resualt)
            {
                try
                {
                    if (RCommon.RedisOperation.Exists(ReceiptNumber))
                    {
                        RCommon.RedisOperation.Del(ReceiptNumber);
                    }
                    return("1");
                }
                catch (Exception ex)
                {
                    return("0");
                }
            }
            return("0");
        }
        /// <summary>
        /// 导出箱清单
        /// </summary>
        /// <param name="id">orderid</param>
        /// <param name="type">1</param>
        /// <param name="OrderID">0</param>
        public void ExportBoxDetail(string id, string type, string OrderID)
        {
            DataSet   ds = new OrderManagementService().ExportBoxDetailsYXDR(id.ToString());
            DataTable dt = ds.Tables[0];

            //这段代码我承认写的很lj
            if (dt.Rows.Count > 0)
            {
                DataTable dtheader    = new DataTable(); //订单主信息
                DataTable dtBoxdetail = new DataTable(); //箱明细信息

                dtheader.Columns.Add("dc1", typeof(string));
                dtheader.Columns.Add("dc2", typeof(string));
                dtheader.Columns.Add("dc3", typeof(string));
                dtheader.Columns.Add("dc4", typeof(string));
                dtheader.Columns.Add("dc5", typeof(string));
                dtheader.Columns.Add("dc6", typeof(string));
                dtheader.Columns.Add("dc7", typeof(string));
                dtheader.Columns.Add("dc8", typeof(string));
                dtheader.Columns.Add("dc9", typeof(string));
                dtheader.Columns.Add("dc10", typeof(string));
                dtheader.Columns.Add("dc11", typeof(string));
                dtheader.Columns.Add("dc12", typeof(string));
                dtheader.Columns.Add("dc13", typeof(string));

                #region 先把一单的头信息加上
                //第一行
                DataRow dr = dtheader.NewRow();
                dr["dc1"]  = "箱清单";
                dr["dc2"]  = "订单号:";
                dr["dc3"]  = dt.Rows[0]["ExternOrderNumber"].ToString().Trim();
                dr["dc4"]  = "货主:";
                dr["dc5"]  = "Haddad";
                dr["dc6"]  = "门店代码:";
                dr["dc7"]  = dt.Rows[0]["str4"].ToString().Trim();
                dr["dc8"]  = "门店名称:";
                dr["dc9"]  = dt.Rows[0]["Company"].ToString();
                dr["dc10"] = "门店地址:";
                dr["dc11"] = dt.Rows[0]["AddressLine1"].ToString();
                dr["dc12"] = "出货日期:";
                dr["dc13"] = DateTime.Now;
                dtheader.Rows.Add(dr);
                //第二行明细列
                DataRow dr2 = dtheader.NewRow();
                dr2["dc1"]  = "箱唛号";
                dr2["dc2"]  = "箱号";
                dr2["dc3"]  = "款号";
                dr2["dc4"]  = "描述";
                dr2["dc5"]  = "尺码";
                dr2["dc6"]  = "数量";
                dr2["dc7"]  = "订单号";
                dr2["dc8"]  = "条形码";
                dr2["dc9"]  = "";
                dr2["dc10"] = "";
                dr2["dc11"] = "";
                dtheader.Rows.Add(dr2);
                #endregion

                List <string> list          = new List <string>();
                int           boxnumber     = 1;  //箱号
                int           packageSumQty = 0;  //每箱总数
                string        packagenumber = ""; //箱唛号


                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DataRow dr3 = dtheader.NewRow();
                    if (i == 0)
                    {
                        packagenumber = dt.Rows[i]["PackageNumber"].ToString();
                        dr3["dc1"]    = dt.Rows[i]["ShippingMark"].ToString();
                        dr3["dc2"]    = boxnumber.ToString();
                        dr3["dc3"]    = dt.Rows[i]["Atrcle"].ToString();
                        dr3["dc4"]    = dt.Rows[i]["GoodsName"].ToString();
                        dr3["dc5"]    = dt.Rows[i]["Size"].ToString();
                        dr3["dc6"]    = dt.Rows[i]["Qty"].ToString();
                        dr3["dc7"]    = dt.Rows[i]["ExternOrderNumber"].ToString();
                        dr3["dc8"]    = dt.Rows[i]["SKU"].ToString();
                    }
                    else
                    {
                        if (packagenumber != dt.Rows[i]["PackageNumber"].ToString())
                        {
                            DataRow dr4 = dtheader.NewRow();
                            dr4["dc1"] = "箱总数:";
                            dr4["dc2"] = packageSumQty.ToString(".00");
                            dr4["dc3"] = "";
                            dr4["dc4"] = "";
                            dr4["dc5"] = "";
                            dr4["dc6"] = "";
                            dr4["dc7"] = "";
                            dr4["dc8"] = "";
                            dtheader.Rows.Add(dr4);
                            packagenumber = dt.Rows[i]["PackageNumber"].ToString();
                            packageSumQty = 0;
                            boxnumber++;
                        }

                        dr3["dc1"] = dt.Rows[i]["ShippingMark"].ToString();
                        dr3["dc2"] = boxnumber;
                        dr3["dc3"] = dt.Rows[i]["Atrcle"].ToString();
                        dr3["dc4"] = dt.Rows[i]["GoodsName"].ToString();
                        dr3["dc5"] = dt.Rows[i]["Size"].ToString();
                        dr3["dc6"] = dt.Rows[i]["Qty"].ToString();
                        dr3["dc7"] = dt.Rows[i]["ExternOrderNumber"].ToString();
                        dr3["dc8"] = dt.Rows[i]["SKU"].ToString();
                    }
                    dtheader.Rows.Add(dr3);
                    packageSumQty += Convert.ToInt32(Convert.ToDouble(dt.Rows[i]["Qty"].ToString()));
                }
                DataRow dr5 = dtheader.NewRow();
                dr5["dc1"] = "箱总数:";
                dr5["dc2"] = packageSumQty.ToString(".00");
                dr5["dc3"] = "";
                dr5["dc4"] = "";
                dr5["dc5"] = "";
                dr5["dc6"] = "";
                dr5["dc7"] = "";
                dr5["dc8"] = "";
                dtheader.Rows.Add(dr5);
                //ExportDataToExcelHelper.ExportDataSetToExcel(dtheader, "箱清单" + DateTime.Now.ToString("yyyy-MM-dd"), "");
                EPPlusOperation.ExportByEPPlus(dtheader, "箱清单" + DateTime.Now.ToString("yyyy-MM-dd"));
            }
            else
            {
                //ExportDataToExcelHelper.ExportDataSetToExcel(dt, "箱清单" + DateTime.Now.ToString("yyyy-MM-dd"), "");
                EPPlusOperation.ExportByEPPlus(dt, "箱清单" + DateTime.Now.ToString("yyyy-MM-dd"));
            }
        }
 public HomeController()
 {
     _orderManagementService     = new OrderManagementService();
     this._bookManagementService = new BookManagementService();
     this._notificationService   = new NotificationService();
 }
 public OrderListModel()
 {
     _orderManagementService   = new OrderManagementService();
     _itemManagementService    = new ItemManagementService();
     _invoiceManagementService = new InvoiceManagementService();
 }
Beispiel #22
0
        /// <summary>
        /// 取订单包装信息。一个loadkey下的多个订单组成一个文件
        /// </summary>
        public void BuildPack()
        {
            try
            {
                //查询已出库的包装信息
                GetOrderByConditionResponse response = new GetOrderByConditionResponse();
                response = new OrderManagementService().GetReturnSFTPPackage(0);
                if (response != null && response.OrderCollection != null && response.OrderCollection.Any() && response.packages != null && response.packages.Any() && response.packageDetails != null && response.packageDetails.Any())
                {
                    //List<WMS_NikeReturnSFTP_Log> logs = new List<WMS_NikeReturnSFTP_Log>();

                    //一个loadkey为一个文件
                    List <string> loadkeylist = response.OrderCollection.Select(m => m.str9).Distinct().ToList();
                    foreach (var loadkeyitem in loadkeylist)
                    {
                        WMS_NikeReturnSFTP_Log log = new WMS_NikeReturnSFTP_Log();
                        log.Type = "WMSPACK";
                        log.Str1 = loadkeyitem;
                        string msg = "";
                        try
                        {
                            List <string> wmspacktxtlist = new List <string>();
                            //文档头
                            string WMSPAC = "";
                            WMSPAC += "WMSPAC".TxtPadRightstring(10) + "I".TxtPadRightstring(2) + DateTime.Now.ToString("yyyyMMddHHmmss") + "NIKECN".TxtPadRightstring(20) +
                                      "CN".TxtPadRightstring(5) + "Pack Inbound".TxtPadRightstring(30) + "".TxtPadRightstring(20);
                            wmspacktxtlist.Add(WMSPAC);
                            //得到loadkey下的订单
                            IEnumerable <OrderInfo> orders = response.OrderCollection.Where(m => m.str9 == loadkeyitem).ToList();
                            foreach (var orderitem in orders)
                            {
                                string PACHD = "";//订单头
                                PACHD += "PACHDA" + orderitem.str11.TxtPadRightstring(10) + "NIKECN".TxtPadRightstring(20) + "".TxtPadRightstring(10) + orderitem.str9.TxtPadRightstring(10)
                                         + "".TxtPadRightstring(18) + "".TxtPadRightstring(15) + "0" + "".TxtPadRightstring(110);
                                //订单的包装信息
                                IEnumerable <PackageInfo> packages = response.packages.Where(m => m.OID == orderitem.ID).ToList();
                                if (packages == null || !packages.Any())
                                {
                                    msg = "LoadKey:" + loadkeyitem + " 对应的订单:" + orderitem.ExternOrderNumber + " 没有包装信息";
                                    break;
                                }
                                //计算总重量,体积
                                decimal TotCtnWeight = 0;
                                decimal TotCtnCube   = 0;
                                packages.ToList().ForEach((m) =>
                                {
                                    TotCtnWeight += m.GrossWeight.ObjectToDecimal();
                                    TotCtnCube   += m.NetWeight.ObjectToDecimal();
                                });
                                PACHD += TotCtnWeight.ToString().TxtPadRightstring(16) + TotCtnCube.ToString().TxtPadRightstring(16) + "NIKECN".TxtPadRightstring(10) + "".TxtPadRightstring(290);
                                wmspacktxtlist.Add(PACHD);

                                #region 包装信息
                                int packindex = 0;//包装箱号索引
                                foreach (var packitem in packages)
                                {
                                    //得到明细
                                    IEnumerable <PackageDetailInfo> packageDetails = response.packageDetails.Where(m => m.PID == packitem.ID).ToList();
                                    if (packageDetails == null || !packageDetails.Any())
                                    {
                                        msg = "LoadKey:" + loadkeyitem + " 对应的订单:" + orderitem.ExternOrderNumber + " 没有包装明细信息";
                                        break;
                                    }
                                    packindex++;
                                    //包装头信息
                                    string PACIF = "";
                                    PACIF += "PACIFA" + orderitem.str11.TxtPadRightstring(10) + packindex.ToString().TxtPadRightstring(10) + packitem.GrossWeight.ToString().TxtPadRightstring(16) +
                                             packitem.NetWeight.ToString().TxtPadRightstring(16) + "".TxtPadRightstring(20) + packindex.ToString().TxtPadRightstring(40);
                                    PACIF += packitem.Length.TxtPadRightstring(16) + packitem.Width.TxtPadRightstring(16) + packitem.Height.TxtPadRightstring(16) + "".TxtPadRightstring(170);
                                    wmspacktxtlist.Add(PACIF);
                                    foreach (var packdetailitem in packageDetails)
                                    {
                                        string PACDT = "";//包装明细
                                        PACDT += "PACDTA" + orderitem.str11.TxtPadRightstring(10) + packindex.ToString().TxtPadRightstring(10) + packindex.ToString().TxtPadRightstring(20)
                                                 + packindex.ToString().TxtPadLeftstring(5, '0') + "NIKECN".TxtPadRightstring(15);
                                        string sku = packdetailitem.str10.Replace("-", "").ToString() + packdetailitem.str9.ToString();
                                        PACDT += sku.TxtPadRightstring(20) + packdetailitem.Qty.ObjectToNullableInt32().ToString().TxtPadRightstring(10) + "runbow".TxtPadRightstring(20) +
                                                 "".TxtPadRightstring(10) + "".TxtPadRightstring(50) + packindex.ToString().TxtPadRightstring(30) + "".TxtPadRightstring(150);
                                        wmspacktxtlist.Add(PACDT);
                                    }
                                }

                                #endregion
                                if (!string.IsNullOrEmpty(msg))
                                {
                                    break;
                                }
                            }
                            if (!string.IsNullOrEmpty(msg))
                            {
                                log.Flag       = "N";
                                log.ResultDesc = "生成包装信息反馈文件失败:" + msg;
                                new LogOperationService().AddNikeReturnSFTPLog(log);
                                //下一个loadkey
                                continue;
                            }
                            //loadkey级别生成完毕
                            string PACTR = "";
                            PACTR += "PACTR" + (wmspacktxtlist.Count - 1).ToString().TxtPadLeftstring(10, '0');
                            wmspacktxtlist.Add(PACTR);
                            //生成文件到发送文件夹
                            string filepath = SFTPConstants.SendFilePath + @"\" + "WMSPACK_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".txt";
                            TextHelper.WriteListToTextFile(wmspacktxtlist, filepath);
                            log.Flag       = "Y";
                            log.ResultDesc = "生成包装反馈文件成功";
                            log.ToFileName = filepath;
                            //更新订单反馈状态
                            string ids = "";
                            orders.ToList().ForEach((o) =>
                            {
                                ids += o.ID + ",";
                            });
                            ids = ids.Substring(0, ids.Length - 1);
                            new OrderManagementService().UpdateReturnSFTPOrderFlag(ids, 1);
                            new LogOperationService().AddNikeReturnSFTPLog(log);
                        }
                        catch (Exception el)
                        {
                            //这个loadkey报错了不影响其他loadkey发送
                            log.Flag       = "N";
                            log.ResultDesc = "生成包装信息反馈文件失败:" + el.Message.ToString();
                            new LogOperationService().AddNikeReturnSFTPLog(log);
                        }
                    }
                }
                else
                {
                    //没有待回传信息
                }
            }
            catch (Exception ex)
            {
                WMS_NikeReturnSFTP_Log log = new WMS_NikeReturnSFTP_Log()
                {
                    Type       = "WMSPACK",
                    Flag       = "N",
                    ResultDesc = "生成包装信息反馈文件失败:" + ex.Message.ToString()
                };
                new LogOperationService().AddNikeReturnSFTPLog(log);
            }
        }
Beispiel #23
0
        public string SaveRecDataFromRedisSecond(string OrderNumber)
        {
            List <OrderDetailForRedisRF> redisList      = new List <OrderDetailForRedisRF>();
            List <WMS_Log_Operation>     logs           = new List <WMS_Log_Operation>();
            IList <PackageInfo>          packages       = new List <PackageInfo>();
            IList <PackageDetailInfo>    packageDetails = new List <PackageDetailInfo>();
            AddPackageAndDetailRequest   request        = new AddPackageAndDetailRequest();
            string msg = "";

            try
            {
                var BoxSizeData = ApplicationConfigHelper.GetWMS_Config("BoxSize").Where(c => c.Str5 == "NIKEB2C");
                if (RCommon.RedisOperation.Exists("Check:" + OrderNumber))
                {
                    redisList = RCommon.RedisOperation.GetList <List <OrderDetailForRedisRF> >("Check:" + OrderNumber);
                    DateTime d = DateTime.Now;
                    packages.Add(new PackageInfo()
                    {
                        Creator       = Session["Name"].ToString(),
                        CreateTime    = d,
                        Updator       = Session["Name"].ToString(),
                        UpdateTime    = d,
                        OrderNumber   = OrderNumber,
                        PackageType   = redisList.Select(c => c.BoxNum).FirstOrDefault(),
                        PackageNumber = redisList.Select(c => c.ExpressNumber).FirstOrDefault(),
                        Length        = BoxSizeData.Where(c => c.Code == redisList.Select(a => a.BoxNum).FirstOrDefault()).Select(a => a.Str1).FirstOrDefault(),
                        Width         = BoxSizeData.Where(c => c.Code == redisList.Select(a => a.BoxNum).FirstOrDefault()).Select(a => a.Str2).FirstOrDefault(),
                        Height        = BoxSizeData.Where(c => c.Code == redisList.Select(a => a.BoxNum).FirstOrDefault()).Select(a => a.Str3).FirstOrDefault(),
                        NetWeight     = "0",
                        GrossWeight   = "0",
                        PackageTime   = d,
                        OID           = redisList.Select(c => c.OID).FirstOrDefault()
                    });
                    foreach (var item in redisList)
                    {
                        packageDetails.Add(new PackageDetailInfo()
                        {
                            Creator       = Session["Name"].ToString(),
                            CreateTime    = d,
                            Updator       = Session["Name"].ToString(),
                            UpdateTime    = d,
                            PackageNumber = item.ExpressNumber,
                            SKU           = item.SKU,
                            UPC           = item.UPC,
                            GoodsName     = item.GoodsName,
                            GoodsType     = "A品",
                            Qty           = item.QtyPicked
                        });
                    }



                    request.packages       = packages;
                    request.packageDetails = packageDetails;
                    bool resualt = new OrderManagementService().UpdateOrderStatusByOrderNumber(OrderNumber, Session["Name"].ToString(), request, Session["CustomerID"].ToString());
                    if (resualt)
                    {
                        WMS_Log_Operation operation = new WMS_Log_Operation();
                        operation.MenuName    = "出库单管理";
                        operation.Operation   = "出库单-" + "复检包装";
                        operation.OrderType   = "Order";
                        operation.Controller  = Request.RawUrl;
                        operation.Creator     = Session["Name"].ToString();
                        operation.CreateTime  = DateTime.Now;
                        operation.ProjectID   = Convert.ToInt32(Session["ProjectID"]);
                        operation.ProjectName = Session["ProjectName"].ToString();
                        operation.OrderID     = redisList.Select(c => c.OID).FirstOrDefault().ToString();
                        logs.Add(operation);
                        new LogOperationService().AddLogOperation(logs);
                        RCommon.RedisOperation.Del("Check:" + OrderNumber);
                        msg = "1";
                    }
                }
            }
            catch (Exception ex)
            {
                msg = "0";
            }
            return(msg);
        }