Beispiel #1
0
        internal bool CreateErrorOrderSortingLog(List <ThreadSortOrder> ThreadSortOrderList, UserInfo userInfo, int operationType)
        {
            try
            {
                //记录分拣日志

                using (var db = new OrderSortingDBEntities())
                {
                    foreach (ThreadSortOrder entity in ThreadSortOrderList)
                    {
                        for (int i = 0; i < entity.TargetLattice.Count; i++)
                        {
                            OrderSortingLog sortingLog = NewOrderSortingLog(entity.OrderInfo, entity.TargetLattice[i], entity.ResultLattice, userInfo, operationType, 3);
                            db.OrderSortingLog.Add(sortingLog);
                        }
                    }
                    db.SaveChanges();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                SaveErrLogHelper.SaveErrorLog(string.Empty, ex.ToString());
                return(false);
            }
        }
Beispiel #2
0
        private OrderSortingLog NewOrderSortingLog(OrderInfo info, LatticeSetting targetLattice, LatticeSetting resultLattice, UserInfo userInfo, int operationType, int status)
        {
            var sortingLog = new OrderSortingLog()
            {
                ID              = Guid.NewGuid().ToString(),
                OrderId         = info.OrderId,
                TargetCabinetId = targetLattice.CabinetId.ToString(),
                TargetLatticeId = targetLattice.LatticeId,
                ResultCabinetId = "",
                ResultLatticeId = "",
                OperationType   = operationType,
                OperationTime   = DateTime.Now,
                Status          = status,
                UserId          = userInfo.UserId,
                UserName        = userInfo.UserName,
                Weight          = info.Weight
            };

            if (resultLattice != null)
            {
                sortingLog.ResultCabinetId = resultLattice.CabinetId.ToString();
                sortingLog.ResultLatticeId = resultLattice.LatticeId;
            }
            return(sortingLog);
        }
Beispiel #3
0
        /// <summary>
        /// 创建分拣记录
        /// </summary>
        /// <param name="info">订单信息</param>
        /// <param name="targetLattice">目标柜格</param>
        /// <param name="resultLattice">投入柜格</param>
        /// <param name="operationType">操作类型:1扫描,2投递,3异常恢复</param>
        /// <param name="status">状态:1待投递,2已投递,3投递异常,4重复扫描</param>
        internal bool CreateOrderSortingLog(OrderInfo info, LatticeSetting targetLattice, LatticeSetting resultLattice, UserInfo userInfo, int operationType, int status)
        {
            try
            {
                //记录分拣日志
                OrderSortingLog sortingLog = NewOrderSortingLog(info, targetLattice, resultLattice, userInfo, operationType, status);
                using (var db = new OrderSortingDBEntities())
                {
                    db.OrderSortingLog.Add(sortingLog);
                    //正确投入,计数
                    if (status == 2 && !db.LatticeOrdersCache.Any(o => o.OrderId == info.OrderId))
                    {
                        var countryEnName = db.Countrys.Where(cntr => cntr.ID == info.CountryId || cntr.EnShorting == info.CountryId).Select(cnt => cnt.EnName).FirstOrDefault();
                        db.LatticeOrdersCache.Add(new LatticeOrdersCache()
                        {
                            LatticesettingId = resultLattice.ID,
                            OrderId          = info.OrderId,
                            TraceId          = info.TraceId,
                            Weight           = info.Weight,
                            CountryId        = info.CountryId,
                            CountryName      = countryEnName,
                            PostId           = info.PostId,
                            PostName         = info.PostName
                        });

                        db.SaveChanges();
                        //重新统计分拣信息
                        LoadTotalSortingDataList(db);
                    }
                    else
                    {
                        db.SaveChanges();
                    }
                    return(true);
                }
            }
            catch (Exception ex)
            {
                SaveErrLogHelper.SaveErrorLog(string.Empty, ex.ToString());
                return(false);
            }
        }