/// <summary> /// 给大区创建 库位码 /// </summary> /// <returns></returns> public int CreateStoreZoneCode(StoreZone bigZone, ZoneOption option) { if (bigZone.Type != CommenClass.StoreZoneType.区.ToString()) { return(0); } int num = 0; if (option.RowNum > 0) { bigZone.CreateSubZone(option.RowNum); //创建排 } if (option.SheelfNum > 0) //需要创建 架 { DataSet ds = bigZone.ReadSubZone(CommenClass.StoreZoneType.排.ToString()); //读取排 foreach (DataRow row in ds.Tables[0].Rows) { StoreZone zone = new StoreZone(); zone.Id = DBTool.GetIntFromRow(row, "Id", 0); zone.Load(); zone.CreateSubZone(option.SheelfNum);//创建架 } } if (option.LayerNum > 0) //需要创建层 { DataSet ds = bigZone.ReadSubZone(CommenClass.StoreZoneType.架.ToString()); //读取架 foreach (DataRow row in ds.Tables[0].Rows) { StoreZone zone = new StoreZone(); zone.Id = DBTool.GetIntFromRow(row, "Id", 0); zone.Load(); zone.CreateSubZone(option.LayerNum);//创建架 } } if (option.PositionNum > 0) //创建位 { DataSet ds = bigZone.ReadSubZone(CommenClass.StoreZoneType.层.ToString()); //读取层 foreach (DataRow row in ds.Tables[0].Rows) { StoreZone zone = new StoreZone(); zone.Id = DBTool.GetIntFromRow(row, "Id", 0); zone.Load(); num = zone.CreateSubZone(option.PositionNum);//创建位 } } return(num); }
/// <summary> /// 创建子区域 /// </summary> /// <returns></returns> public int CreateSubZone(int maxNum) { int OK = 0; string type = GetSubType(); for (int i = 1; i <= maxNum; i++) { StoreZone sz = new StoreZone(); sz.StoreId = this.StoreId; sz.Type = type; sz.Name = this.Name + "-" + i.ToString(); sz.Code = this.Code + "-" + i.ToString(); sz.PCode = this.Code; if (sz.Save() > 0) { OK += 1; } } return(OK); }
/// <summary> /// 给仓库创建大区 /// </summary> /// <param name="StoreId"></param> /// <param name="NewZoneNum"></param> /// <returns>返回生成的大区数量</returns> public int CreateStoreZone(int StoreId, int NewZoneNum) { int curZoneNum = ReadStoreZone(StoreId).Tables[0].Rows.Count; LetterNumber ln = new LetterNumber(curZoneNum); List <string> newZone = ln.Add(NewZoneNum); int OK = 0; for (int i = 0; i < newZone.Count; i++) { //生成新的大区 StoreZone sz = new StoreZone(); sz.StoreId = StoreId; sz.Code = StoreId + newZone[i]; sz.Name = newZone[i]; sz.Type = CommenClass.StoreZoneType.区.ToString(); if (sz.Save() > 0) { OK += 1; } } return(OK); }