示例#1
0
        /// <summary>
        /// 注意:此方法是服务自动调用,WEB页面请用Declare
        /// </summary>
        public void AutoDeclare(DateTime endTime, ref StringBuilder failMessage)
        {
            var canUseWarehouses = WMSSao.GetAllCanUseWarehouseDics();

            foreach (var warehouseInfo in canUseWarehouses)
            {
                Guid warehouseId = warehouseInfo.Key;
                if (warehouseId != Guid.Empty)
                {
                    //获取该仓库下的全部进货申报数据
                    var data = WMSSao.GetStockDeclareDtos(warehouseId, new List <Guid>());
                    if (data == null || data.Count == 0)
                    {
                        failMessage.AppendLine(warehouseInfo.Value + "没有可生成的数据!");
                        continue;
                    }
                    var purchasingSets      = _purchaseSet.GetPurchaseSetListByWarehouseId(warehouseId);
                    var realGoodsInfos      = _goodsCenterSao.GetStockDeclareGridList(data.Keys.ToList()).ToDictionary(k => k.RealGoodsId, v => v);
                    var purchasingGoodsDics = _purchasingDetailManager.GetStockDeclarePursingGoodsDicsWithFiliale(warehouseId, new List <Guid>(),
                                                                                                                  new[] { PurchasingState.NoSubmit, PurchasingState.Purchasing, PurchasingState.PartComplete, PurchasingState.StockIn, PurchasingState.WaitingAudit, PurchasingState.Refusing }, data.Keys.ToList());
                    var details = GetDataList(warehouseId, data, purchasingGoodsDics, realGoodsInfos, purchasingSets);
                    if (details.Count == 0)
                    {
                        failMessage.AppendLine(warehouseInfo.Value + "没有可生成的数据!");
                        continue;
                    }
                    failMessage.AppendLine(warehouseInfo.Value + "开始生成采购单!");
                    BuilderPurchasing(details, purchasingSets, warehouseId, null, "进货申报服务", ref failMessage);
                    failMessage.AppendLine(warehouseInfo.Value + "结束生成采购单!");
                }
            }
        }
示例#2
0
        /// <summary> ADD:2013.7.27 阮剑锋
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static string GetName(Guid id)
        {
            var dic = WMSSao.GetAllCanUseWarehouseDics();

            if (dic == null)
            {
                return(string.Empty);
            }

            if (dic.ContainsKey(id))
            {
                return(dic[id]);
            }
            return(string.Empty);
        }
示例#3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                AllCompanyList              = _companyCussent.GetCompanyCussentList();
                AllCompanyBalanceList       = _companyCussent.GetCompanyBalanceList();
                AllCompanyClassList         = _companyClass.GetCompanyClassList();
                AllCompanyBalanceDetailList = _companyCussent.GetCompanyBalanceDetailList();

                Dictionary <Guid, string> dataSource = new Dictionary <Guid, string> {
                    { Guid.Empty, "--所有--" }
                };
                RCB_Warehouse.DataSource = dataSource.Union(WMSSao.GetAllCanUseWarehouseDics());

                var filialeList = FilialeList.Where(f => f.FilialeTypes.Contains((int)FilialeType.SaleCompany) || f.FilialeTypes.Contains((int)FilialeType.LogisticsCompany) && !f.FilialeTypes.Contains((int)FilialeType.EntityShop));

                RCB_FilialeList.DataSource = filialeList;
                var personnelInfo = CurrentSession.Personnel.Get();
                if (personnelInfo.CurrentFilialeId == Guid.Empty)
                {
                    personnelInfo.CurrentFilialeId = filialeList.First().ID;
                    CurrentSession.Personnel.Set(personnelInfo);
                }
                SelectFilialeId = personnelInfo.CurrentFilialeId;
                GetCompanyCussent();

                RCB_Warehouse.DataBind();
                RCB_FilialeList.DataTextField  = "Name";
                RCB_FilialeList.DataValueField = "ID";
                RCB_FilialeList.DataBind();
                RCB_FilialeList.SelectedValue = string.Format("{0}", personnelInfo.CurrentFilialeId);


                RDP_StartDate.SelectedDate = DateTime.Now.AddDays(-30);
                RDP_EndDate.SelectedDate   = DateTime.Now;
            }

            if (GetPowerOperationPoint("CBIsOut") && !string.IsNullOrWhiteSpace(RCB_FilialeList.SelectedValue) && new Guid(RCB_FilialeList.SelectedValue) != Guid.Empty)
            {
                CB_IsOut.Visible = true;
            }
            else
            {
                CB_IsOut.Visible = false;
            }
        }
示例#4
0
        public static void RunTask()
        {
            var pg                      = DataAccessor.GetPurchasingGoodsList(TaskType.All);
            var goodsIdList             = pg.Select(w => w.GoodsId).Distinct().ToList();
            IList <GoodsInfo> goodsList = _goodsCenterSao.GetGoodsListByGoodsIds(goodsIdList).ToList();
            var warehouses              = WMSSao.GetAllCanUseWarehouseDics();

            foreach (var p in pg)
            {
                bool     isRun;
                TaskType taskType;
                bool     hasSaveLastPurchasingDate;
                int      avgStockDays;
                DateTime nextStockDate;
                DateTime nextPurchasingDate;
                int      step;

                GoodsInfo goodsInfo = goodsList.FirstOrDefault(w => w.GoodsId == p.GoodsId);
                if (goodsInfo == null)
                {
                    continue;
                }

                p.GoodsName = goodsInfo.GoodsName;
                p.GoodsCode = goodsInfo.GoodsCode;
                p.Units     = goodsInfo.Units;
                if (goodsInfo.ExpandInfo != null)
                {
                    p.PackQuantity = goodsInfo.ExpandInfo.PackCount;
                }

                //计算报备日期是否匹配
                CalculateStockDay(p, p.LastPurchasingDate, p.FilingDay, p.StockingDays, out isRun, out taskType, out avgStockDays, out nextStockDate, out step, out hasSaveLastPurchasingDate, out nextPurchasingDate);

                if (isRun)
                {
                    Routine.DoPurchasing(p, goodsInfo, avgStockDays, nextStockDate, taskType, step, nextPurchasingDate, warehouses);
                }

                if (hasSaveLastPurchasingDate)
                {
                    //记录最后的采购运行时间
                    DataAccessor.UpdateLastPurchasingDate(p.WarehouseId, p.HostingFilialeId, p.GoodsId, DateTime.Now);
                }
            }
        }
示例#5
0
 /// <summary> 获得仓库列表
 /// ADD:2013.7.27 阮剑锋
 /// </summary>
 /// <returns></returns>
 public static Dictionary <Guid, string> GetWarehouseDic()
 {
     return(WMSSao.GetAllCanUseWarehouseDics());
 }