Пример #1
0
        public ActionResult Add([ModelBinder(typeof(JsonBinder <LocationEntity>))] LocationEntity entity)
        {
            LocationProvider provider = new LocationProvider();

            if (entity.LocalNum.IsEmpty())
            {
                entity.LocalNum     = SequenceProvider.GetSequence(typeof(LocationEntity));
                entity.LocalBarCode = entity.LocalBarCode.IsEmpty() ? entity.LocalNum : entity.LocalBarCode;
                entity.IsForbid     = (int)EBool.No;
                entity.IsDelete     = (int)EIsDelete.NotDelete;
                entity.UnitNum      = "";
                entity.UnitName     = "";
                entity.CreateTime   = DateTime.Now;
                int line = provider.Add(entity);
                if (line > 0)
                {
                    this.ReturnJson.AddProperty("d", "success");
                }
            }
            else
            {
                entity.LocalBarCode = entity.LocalBarCode.IsEmpty() ? entity.LocalNum : entity.LocalBarCode;
                entity.Include(a => new { a.LocalName, a.LocalBarCode, a.StorageNum, a.LocalType, a.IsDefault });
                entity.Where(a => a.LocalNum == entity.LocalNum);
                int line = provider.Update(entity);
                if (line > 0)
                {
                    this.ReturnJson.AddProperty("d", "success");
                }
            }
            return(Content(this.ReturnJson.ToString()));
        }
Пример #2
0
        public ActionResult AddEquipment([ModelBinder(typeof(JsonBinder <EquipmentEntity>))] EquipmentEntity entity)
        {
            EquipmentProvider provider = new EquipmentProvider();

            entity.CreateTime = DateTime.Now;
            int line = 0;

            if (entity.SnNum.IsEmpty())
            {
                string barcode = SequenceProvider.GetSequence(typeof(EquipmentEntity));
                entity.SnNum        = barcode;
                entity.EquipmentNum = barcode;
                entity.CreateUser   = this.LoginUserCode;
                line = provider.AddEquipment(entity);
            }
            else
            {
                line = provider.Update(entity);
            }
            if (line > 0)
            {
                this.ReturnJson.AddProperty("d", "success");
            }
            else
            {
                this.ReturnJson.AddProperty("d", "");
            }
            return(Content(this.ReturnJson.ToString()));
        }
Пример #3
0
        public ActionResult Create()
        {
            int      InType        = WebUtil.GetFormValue <int>("InType", 0);
            int      ProductType   = WebUtil.GetFormValue <int>("ProductType", 0);
            string   ContractOrder = WebUtil.GetFormValue <string>("ContractOrder", string.Empty);
            string   SupNum        = WebUtil.GetFormValue <string>("SupNum", string.Empty);
            string   SupName       = WebUtil.GetFormValue <string>("SupName", string.Empty);
            string   ContactName   = WebUtil.GetFormValue <string>("ContactName", string.Empty);
            string   Phone         = WebUtil.GetFormValue <string>("Phone", string.Empty);
            DateTime OrderTime     = WebUtil.GetFormValue <DateTime>("OrderTime", DateTime.Now);
            string   Remark        = WebUtil.GetFormValue <string>("Remark", string.Empty);

            InStorageEntity entity = new InStorageEntity();

            entity.OrderNum      = SequenceProvider.GetSequence(typeof(InStorageEntity));
            entity.InType        = InType;
            entity.ProductType   = ProductType;
            entity.SupNum        = SupNum;
            entity.SupName       = SupName;
            entity.ContactName   = ContactName;
            entity.Phone         = Phone;
            entity.Address       = "";
            entity.ContractOrder = ContractOrder;
            entity.Status        = (int)EAudite.Wait;
            entity.IsDelete      = (int)EIsDelete.NotDelete;
            entity.OrderTime     = OrderTime;
            entity.CreateTime    = DateTime.Now;
            entity.CreateUser    = this.LoginUserCode;
            entity.AuditUser     = string.Empty;
            entity.AuditeTime    = DateTime.MinValue;
            entity.PrintUser     = string.Empty;
            entity.PrintTime     = DateTime.MinValue;
            entity.Reason        = string.Empty;
            entity.OperateType   = (int)EOpType.PC;
            entity.EquipmentNum  = string.Empty;
            entity.EquipmentCode = string.Empty;
            entity.Remark        = Remark;
            entity.StorageNum    = this.DefaultStore;

            List <InStorDetailEntity> list = Session[CacheKey.TEMPDATA_CACHE_INSTORDETAIL] as List <InStorDetailEntity>;

            if (list.IsNullOrEmpty())
            {
                this.ReturnJson.AddProperty("Key", "1001");
                this.ReturnJson.AddProperty("Value", "请选择要入库的产品以及数量");
                return(Content(this.ReturnJson.ToString()));
            }
            entity.Num    = list.Sum(a => a.Num);
            entity.Amount = list.Sum(a => a.Amount);
            Bill <InStorageEntity, InStorDetailEntity> bill = new InStorageOrder();
            string returnValue = bill.Create(entity, list);

            if (returnValue == EnumHelper.GetEnumDesc <EReturnStatus>(EReturnStatus.Success))
            {
                Session[CacheKey.TEMPDATA_CACHE_INSTORDETAIL] = null;
                this.ReturnJson.AddProperty("Key", "1000");
                this.ReturnJson.AddProperty("Value", "入库单创建成功");
            }
            return(Content(this.ReturnJson.ToString()));
        }
Пример #4
0
        public ActionResult Add([ModelBinder(typeof(JsonBinder <StorageEntity>))] StorageEntity entity)
        {
            StorageProvider provider = new StorageProvider();
            int             line     = 0;

            if (entity.StorageNum.IsEmpty())
            {
                entity.CreateTime = DateTime.Now;
                entity.StorageNum = entity.StorageNum.IsEmpty() ? SequenceProvider.GetSequence(typeof(StorageEntity)) : entity.StorageNum;
                entity.IsDelete   = (int)EIsDelete.NotDelete;
                entity.IsForbid   = (int)EBool.No;
                line = provider.Add(entity);
            }
            else
            {
                entity.Include(a => new { a.StorageName, a.StorageType, a.Length, a.Width, a.Height, a.Action, a.Status, a.IsDefault, a.Remark });
                entity.Where(a => a.StorageNum == entity.StorageNum);
                line = provider.Update(entity);
            }
            if (line > 0)
            {
                this.ReturnJson.AddProperty("d", "success");
            }
            else
            {
                this.ReturnJson.AddProperty("d", "");
            }
            return(Content(this.ReturnJson.ToString()));
        }
Пример #5
0
        /// <summary>
        /// 创建盘点单据
        /// 1. 将单据信息数据和单据详细信息数据保存到数据库
        /// 2. 统计盘点当期的账面数据
        /// 3. 备份当前的库存数据
        /// 4. 生成盘差准备表数据
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="list"></param>
        /// <returns></returns>
        public override string Create(CheckStockEntity entity, List <CheckStockInfoEntity> list)
        {
            int line = 0;

            using (TransactionScope ts = new TransactionScope())
            {
                entity.OrderNum = entity.OrderNum.IsEmpty() ? SequenceProvider.GetSequence(typeof(CheckStockEntity)) : entity.OrderNum;
                entity.IncludeAll();
                if (!list.IsNullOrEmpty())
                {
                    list.ForEach(a =>
                    {
                        a.IncludeAll();
                        a.OrderNum = entity.OrderNum;
                    });

                    line  = this.CheckStock.Add(entity);
                    line += this.CheckStockInfo.Add(list);
                }
                ts.Complete();
            }
            //调用存储过程备份数据 生成盘点差异表
            Proc_CreateCheckEntity checkEntity = new Proc_CreateCheckEntity();

            checkEntity.OrderNum   = entity.OrderNum;
            checkEntity.CreateUser = entity.CreateUser;
            checkEntity.CreateName = "";
            this.Proc_CreateCheck.ExecuteNonQuery(checkEntity);
            return(line > 0 && checkEntity.ReturnValue == "1000" ? EnumHelper.GetEnumDesc <EReturnStatus>(EReturnStatus.Success) : string.Empty);
        }
Пример #6
0
        public ActionResult AddAddress([ModelBinder(typeof(JsonBinder <CusAddressEntity>))] CusAddressEntity entity)
        {
            List <CusAddressEntity> list = Session[CacheKey.JOOSHOW_CUSADDRESS_CACHE] as List <CusAddressEntity>;

            list = list == null ? new List <CusAddressEntity>() : list;
            if (entity.SnNum.IsEmpty())
            {
                entity.CreateTime = DateTime.Now;
                entity.SnNum      = SequenceProvider.GetSequence(typeof(CusAddressEntity));
                list.Add(entity);
                this.ReturnJson.AddProperty("d", "success");
            }
            else
            {
                list.ForEach(a =>
                {
                    if (a.SnNum == entity.SnNum)
                    {
                        a.Address = entity.Address;
                        a.Contact = entity.Contact;
                        a.Phone   = entity.Phone;
                    }
                });
                this.ReturnJson.AddProperty("d", "success");
            }

            Session[CacheKey.JOOSHOW_CUSADDRESS_CACHE] = list;
            return(Content(this.ReturnJson.ToString()));
        }
Пример #7
0
        /// <summary>
        /// 修改报表格式
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="list"></param>
        /// <returns></returns>
        public int Update(ReportsEntity entity, List <ReportParamsEntity> list)
        {
            int line = 0;

            using (TransactionScope ts = new TransactionScope())
            {
                ReportParamsEntity param = new ReportParamsEntity();
                param.Where(a => a.ReportNum == entity.ReportNum);
                line += this.ReportParams.Delete(param);

                entity.Include(a => new { a.ReportName, a.ReportType, a.Remark, a.DataSource, a.DsType, a.FileName });
                entity.Where(a => a.ReportNum == entity.ReportNum);
                line += this.Reports.Update(entity);

                if (!list.IsNullOrEmpty())
                {
                    foreach (ReportParamsEntity item in list)
                    {
                        item.ParamNum  = item.ParamNum.IsEmpty() ? SequenceProvider.GetSequence(typeof(ReportParamsEntity)) : item.ParamNum;
                        item.ReportNum = entity.ReportNum;
                        item.IncludeAll();
                    }
                    this.ReportParams.Add(list);
                }
                ts.Complete();
            }

            return(line);
        }
Пример #8
0
        public ActionResult AddCustomer([ModelBinder(typeof(JsonBinder <CustomerEntity>))] CustomerEntity entity)
        {
            List <CusAddressEntity> list = Session[CacheKey.JOOSHOW_CUSADDRESS_CACHE] as List <CusAddressEntity>;

            list = list == null ? new List <CusAddressEntity>() : list;
            CustomerProvider provider = new CustomerProvider();
            int line = 0;

            if (entity.CusNum.IsEmpty())
            {
                entity.CreateTime = DateTime.Now;
                entity.CusNum     = SequenceProvider.GetSequence(typeof(CustomerEntity));
                line = provider.AddCustomer(entity, list);
            }
            else
            {
                line = provider.Update(entity, list);
            }
            if (line > 0)
            {
                this.ReturnJson.AddProperty("d", "success");
            }
            else
            {
                this.ReturnJson.AddProperty("d", "");
            }
            return(Content(this.ReturnJson.ToString()));
        }
Пример #9
0
        public ActionResult Add([ModelBinder(typeof(JsonBinder <SysRoleEntity>))] SysRoleEntity entity)
        {
            SysRoleProvider provider = new SysRoleProvider();

            if (entity.RoleNum.IsEmpty())
            {
                entity.RoleNum    = SequenceProvider.GetSequence(typeof(SysRoleEntity));
                entity.IsDelete   = (int)EIsDelete.NotDelete;
                entity.CreateTime = DateTime.Now;
                int line = provider.AddRole(entity);
                if (line > 0)
                {
                    this.ReturnJson.AddProperty("d", "success");
                }
            }
            else
            {
                entity.IsDelete = (int)EIsDelete.NotDelete;
                int line = provider.UpdateRole(entity);
                if (line > 0)
                {
                    this.ReturnJson.AddProperty("d", "success");
                }
            }
            return(Content(this.ReturnJson.ToString()));
        }
Пример #10
0
        /// <summary>
        /// 创建报表文件格式
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="list"></param>
        /// <returns></returns>
        public int Create(ReportsEntity entity, List <ReportParamsEntity> list)
        {
            if (!entity.ReportNum.IsEmpty())
            {
                return(Update(entity, list));
            }
            int line = 0;

            using (TransactionScope ts = new TransactionScope())
            {
                entity.ReportNum = entity.ReportNum.IsEmpty() ? SequenceProvider.GetSequence(typeof(ReportsEntity)) : entity.ReportNum;
                entity.IncludeAll();
                line += this.Reports.Add(entity);

                if (!list.IsNullOrEmpty())
                {
                    foreach (ReportParamsEntity item in list)
                    {
                        item.ParamNum  = item.ParamNum.IsEmpty() ? SequenceProvider.GetSequence(typeof(ReportParamsEntity)) : item.ParamNum;
                        item.ReportNum = entity.ReportNum;
                        item.IncludeAll();
                    }
                    this.ReportParams.Add(list);
                }
                ts.Complete();
            }

            return(line);
        }
Пример #11
0
        public ActionResult AddDepart([ModelBinder(typeof(JsonBinder <SysDepartEntity>))] SysDepartEntity entity)
        {
            DepartProvider provider = new DepartProvider();
            int            line     = 0;

            if (entity.DepartNum.IsEmpty())
            {
                entity.DepartNum  = SequenceProvider.GetSequence(typeof(SysDepartEntity));
                entity.IsDelete   = (int)EIsDelete.NotDelete;
                entity.CreateTime = DateTime.Now;
                line = provider.Add(entity);
            }
            else
            {
                line = provider.UpdateDepart(entity);
            }
            if (line > 0)
            {
                this.ReturnJson.AddProperty("d", "success");
            }
            else
            {
                this.ReturnJson.AddProperty("d", "");
            }
            return(Content(this.ReturnJson.ToString()));
        }
Пример #12
0
 public ActionResult EditProduct([ModelBinder(typeof(JsonBinder <ProductEntity>))] ProductEntity entity)
 {
     if (entity.SnNum.IsEmpty())
     {
         entity.SnNum = SequenceProvider.GetSequence(typeof(ProductEntity));
         if (entity.CusNum.IsEmpty())
         {
             entity.CusName = "";
         }
         entity.Num        = 0;
         entity.IsDelete   = (int)EIsDelete.NotDelete;
         entity.CreateTime = DateTime.Now;
         entity.CreateUser = this.LoginUserCode;
         int line = new ProductProvider().Add(entity);
         if (line > 0)
         {
             this.ReturnJson.AddProperty("d", "success");
         }
     }
     else
     {
         if (entity.CusNum.IsEmpty())
         {
             entity.CusName = "";
         }
         entity.Num = 0;
         int line = new ProductProvider().Update(entity);
         if (line > 0)
         {
             this.ReturnJson.AddProperty("d", "success");
         }
     }
     return(Content(this.ReturnJson.ToString()));
 }
Пример #13
0
        public ActionResult AddProduct()
        {
            string ProductNum  = WebUtil.GetFormValue <string>("SnNum", string.Empty);
            string BarCode     = WebUtil.GetFormValue <string>("BarCode", string.Empty);
            string ProductName = WebUtil.GetFormValue <string>("ProductName", string.Empty);
            string BatchNum    = WebUtil.GetFormValue <string>("ProductBatch", string.Empty);
            string LocalNum    = WebUtil.GetFormValue <string>("LocalNum", string.Empty);
            string Size        = WebUtil.GetFormValue <string>("Size", string.Empty);
            string Color       = WebUtil.GetFormValue <string>("Color", string.Empty);
            string Count       = WebUtil.GetFormValue <string>("Count", string.Empty);
            double LocalQty    = WebUtil.GetFormValue <double>("LocalQty", 0);
            double Num         = WebUtil.GetFormValue <double>("Num", 0);
            double InPrice     = WebUtil.GetFormValue <double>("Price", 0);
            double Cl          = WebUtil.GetFormValue <double>("Cl", 0);
            double Ca          = WebUtil.GetFormValue <double>("Ca", 0);
            double Cb          = WebUtil.GetFormValue <double>("Cb", 0);

            InStorDetailEntity entity = new InStorDetailEntity();

            entity.SnNum       = SequenceProvider.GetSequence(typeof(InStorDetailEntity));
            entity.OrderNum    = string.Empty;
            entity.ProductName = ProductName;
            entity.BarCode     = BarCode;
            entity.ProductNum  = ProductNum;
            entity.Color       = Color;
            entity.Count       = Count;
            entity.Size        = Size;
            entity.Num         = Num;
            entity.IsPick      = (int)EBool.No;
            entity.RealNum     = 0;
            entity.InPrice     = InPrice;
            entity.CreateTime  = DateTime.Now;
            entity.LocalNum    = LocalNum;
            entity.Cl          = Cl;
            entity.Ca          = Ca;
            entity.Cb          = Cb;
            entity.RGB         = ColorHelper.GetRgb16Color(LabRgb.LabToRgb(new double[] { Cl, Ca, Cb }));
            LocationEntity localtion = new LocationProvider().GetSingleByNumCache(LocalNum);

            if (localtion != null)
            {
                entity.LocalName = new LocationProvider().GetSingleByNumCache(LocalNum).LocalName;
            }
            else
            {
                entity.LocalName = "";
            }
            entity.Amount     = entity.InPrice * entity.Num;
            entity.StorageNum = this.DefaultPStore;

            entity.BatchNum   = BatchNum;
            entity.TotalPrice = entity.Num * entity.InPrice;
            List <InStorDetailEntity> list = Session[CacheKey.TEMPDATA_CACHE_INSTORDETAIL] as List <InStorDetailEntity>;

            list = list.IsNull() ? new List <InStorDetailEntity>() : list;
            list.Add(entity);
            Session[CacheKey.TEMPDATA_CACHE_INSTORDETAIL] = list;

            return(Content(string.Empty));
        }
Пример #14
0
        public void WorldLoaded(World w, WorldRenderer wr)
        {
            world   = w;
            tiles   = new Dictionary <CPos, Smudge>();
            dirty   = new Dictionary <CPos, Smudge>();
            smudges = new Dictionary <string, Sprite[]>();

            var types = SequenceProvider.Sequences(Info.Sequence);

            foreach (var t in types)
            {
                var seq     = SequenceProvider.GetSequence(Info.Sequence, t);
                var sprites = Exts.MakeArray(seq.Length, x => seq.GetSprite(x));
                smudges.Add(t, sprites);
            }

            // Add map smudges
            foreach (var s in w.Map.Smudges.Value.Where(s => smudges.Keys.Contains(s.Type)))
            {
                var smudge = new Smudge
                {
                    Type   = s.Type,
                    Depth  = s.Depth,
                    Sprite = smudges[s.Type][s.Depth]
                };

                tiles.Add((CPos)s.Location, smudge);
            }
        }
Пример #15
0
        public ActionResult AddUser([ModelBinder(typeof(JsonBinder <AdminEntity>))] AdminEntity entity)
        {
            AdminProvider provider = new AdminProvider();

            entity.UpdateTime = DateTime.Now;
            int line = 0;

            if (entity.UserCode.IsEmpty())
            {
                bool isExist = provider.IsExist(entity.UserName);
                if (isExist)
                {
                    this.ReturnJson.AddProperty("d", "该用户名已经存在!");
                    return(Content(this.ReturnJson.ToString()));
                }
                entity.UserCode = SequenceProvider.GetSequence(typeof(AdminEntity));
                line            = provider.AddAdmin(entity);
            }
            else
            {
                line = provider.Update(entity);
            }
            if (line > 0)
            {
                this.ReturnJson.AddProperty("d", "success");
            }
            else
            {
                this.ReturnJson.AddProperty("d", "");
            }
            return(Content(this.ReturnJson.ToString()));
        }
Пример #16
0
        public ActionResult AddSupplier([ModelBinder(typeof(JsonBinder <SupplierEntity>))] SupplierEntity entity)
        {
            SupplierProvider provider = new SupplierProvider();

            entity.CreateTime = DateTime.Now;
            int line = 0;

            if (entity.SupNum.IsEmpty())
            {
                entity.SupNum = SequenceProvider.GetSequence(typeof(SupplierEntity));
                line          = provider.AddSupplier(entity);
            }
            else
            {
                line = provider.Update(entity);
            }
            if (line > 0)
            {
                this.ReturnJson.AddProperty("d", "success");
            }
            else
            {
                this.ReturnJson.AddProperty("d", "");
            }
            return(Content(this.ReturnJson.ToString()));
        }
Пример #17
0
        public Minelayer(Actor self)
        {
            this.self = self;

            var tileset = self.World.TileSet.Id.ToLower();

            tile = SequenceProvider.GetSequence("overlay", "build-valid-{0}".F(tileset)).GetSprite(0);
        }
Пример #18
0
 public SelectTarget(string order, SupportPowerManager manager, IronCurtainPower power)
 {
     this.manager = manager;
     this.order   = order;
     this.power   = power;
     this.range   = (power.Info as IronCurtainPowerInfo).Range;
     tile         = SequenceProvider.GetSequence("overlay", "target-select").GetSprite(0);
 }
Пример #19
0
        /// <summary>
        /// Gets a database sequence. This will always be a 'none' result.
        /// </summary>
        /// <param name="sequenceName">A database sequence name.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>A database sequence in the 'none' state.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="sequenceName"/> is <c>null</c>.</exception>
        public OptionAsync <IDatabaseSequence> GetSequence(Identifier sequenceName, CancellationToken cancellationToken = default)
        {
            if (sequenceName == null)
            {
                throw new ArgumentNullException(nameof(sequenceName));
            }

            return(SequenceProvider.GetSequence(sequenceName, cancellationToken));
        }
Пример #20
0
            public MinefieldOrderGenerator(Actor self, CPos xy)
            {
                minelayer      = self;
                minefieldStart = xy;

                var tileset = self.World.TileSet.Id.ToLower();

                tileOk      = SequenceProvider.GetSequence("overlay", "build-valid-{0}".F(tileset)).GetSprite(0);
                tileBlocked = SequenceProvider.GetSequence("overlay", "build-invalid").GetSprite(0);
            }
Пример #21
0
        public PlaceBuildingOrderGenerator(Actor producer, string name)
        {
            Producer = producer;
            Building = name;
            var tileset = producer.World.TileSet.Id.ToLower();

            BuildingInfo = Rules.Info[Building].Traits.Get <BuildingInfo>();

            buildOk      = SequenceProvider.GetSequence("overlay", "build-valid-{0}".F(tileset)).GetSprite(0);
            buildBlocked = SequenceProvider.GetSequence("overlay", "build-invalid").GetSprite(0);
        }
Пример #22
0
        public ActionResult LoadProduct([ModelBinder(typeof(JsonBinder <List <LocalProductEntity> >))] List <LocalProductEntity> list)
        {
            List <BadReportDetailEntity> ListProducts = Session[CacheKey.TEMPDATA_CACHE_BADPRODUCTDETAIL] as List <BadReportDetailEntity>;

            ListProducts = ListProducts.IsNull() ? new List <BadReportDetailEntity>() : ListProducts;
            if (!list.IsNullOrEmpty())
            {
                LocationProvider localProvider = new LocationProvider();
                foreach (LocalProductEntity item in list)
                {
                    string BarCode      = item.BarCode;
                    string ProductNum   = item.ProductNum;
                    string StorageNum   = item.StorageNum;
                    string FromLocalNum = item.LocalNum;
                    string BatchNum     = item.BatchNum;
                    if (ListProducts.Exists(a => a.BarCode == BarCode && a.ProductNum == ProductNum && a.BatchNum == BatchNum && a.StorageNum == StorageNum && a.FromLocalNum == FromLocalNum))
                    {
                        BadReportDetailEntity entity = ListProducts.FirstOrDefault(a => a.BarCode == BarCode && a.ProductNum == ProductNum && a.BatchNum == BatchNum && a.StorageNum == StorageNum && a.FromLocalNum == FromLocalNum);
                        entity.Num += item.Num;
                    }
                    else
                    {
                        BadReportDetailEntity entity = new BadReportDetailEntity();
                        entity.SnNum = SequenceProvider.GetSequence(typeof(BadReportDetailEntity));
                        ProductProvider provider = new ProductProvider();
                        ProductEntity   product  = provider.GetProductBySn(ProductNum);
                        entity.ProductName  = product.ProductName;
                        entity.BarCode      = product.BarCode;
                        entity.ProductNum   = product.SnNum;
                        entity.BatchNum     = item.BatchNum;
                        entity.LocalNum     = item.Num;
                        entity.Num          = item.Qty;
                        entity.Amount       = product.InPrice * item.Num;
                        entity.InPrice      = product.InPrice;
                        entity.CreateTime   = DateTime.Now;
                        entity.StorageNum   = StorageNum;
                        entity.FromLocalNum = item.LocalNum;
                        LocationEntity fromLocal = localProvider.GetSingleByNumCache(item.LocalNum);
                        if (fromLocal != null)
                        {
                            entity.FromLocalName = fromLocal.LocalName;
                        }
                        LocationEntity localtion = localProvider.GetDefaultLocal(StorageNum, ELocalType.Bad);
                        if (localtion != null)
                        {
                            entity.ToLocalNum = localtion.LocalNum;
                        }
                        ListProducts.Add(entity);
                    }
                }
                Session[CacheKey.TEMPDATA_CACHE_BADPRODUCTDETAIL] = ListProducts;
            }
            return(Content(string.Empty));
        }
Пример #23
0
 public ResourceType(ResourceTypeInfo info)
 {
     this.Info = info;
     Variants  = new Dictionary <string, Sprite[]>();
     foreach (var v in info.Variants)
     {
         var seq     = SequenceProvider.GetSequence("resources", v);
         var sprites = Exts.MakeArray(seq.Length, x => seq.GetSprite(x));
         Variants.Add(v, sprites);
     }
 }
Пример #24
0
        public int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string race)
        {
            if (string.IsNullOrEmpty(Sequence))
            {
                throw new InvalidOperationException("Actor " + ai.Name + " is missing sequence to quantize facings from.");
            }

            var rsi = ai.TraitInfo <RenderSpritesInfo>();

            return(sequenceProvider.GetSequence(rsi.GetImage(ai, sequenceProvider, race), Sequence).Facings);
        }
Пример #25
0
            public SelectDestination(string order, SupportPowerManager manager, ChronoshiftPower power, int2 sourceLocation)
            {
                this.manager        = manager;
                this.order          = order;
                this.power          = power;
                this.sourceLocation = sourceLocation;
                this.range          = (power.Info as ChronoshiftPowerInfo).Range;

                validTile   = SequenceProvider.GetSequence("overlay", "target-valid").GetSprite(0);
                invalidTile = SequenceProvider.GetSequence("overlay", "target-invalid").GetSprite(0);
                sourceTile  = SequenceProvider.GetSequence("overlay", "target-select").GetSprite(0);
            }
        public PlaceBuildingOrderGenerator(Actor producer, string name)
        {
            Producer     = producer;
            Building     = name;
            BuildingInfo = Rules.Info[Building].Traits.Get <BuildingInfo>();

            Preview = Rules.Info[Building].Traits.Get <RenderBuildingInfo>()
                      .RenderPreview(Rules.Info[Building], producer.Owner);

            buildOk      = SequenceProvider.GetSequence("overlay", "build-valid").GetSprite(0);
            buildBlocked = SequenceProvider.GetSequence("overlay", "build-invalid").GetSprite(0);
        }
Пример #27
0
        public ActionResult AddProduct([ModelBinder(typeof(JsonBinder <List <LocalProductEntity> >))] List <LocalProductEntity> list)
        {
            List <OutStoDetailEntity> ListCache = Session[CacheKey.TEMPDATA_CACHE_OUTSTORDETAIL] as List <OutStoDetailEntity>;

            ListCache = ListCache.IsNull() ? new List <OutStoDetailEntity>() : ListCache;
            if (!list.IsNullOrEmpty())
            {
                List <ProductEntity> ListSource = new ProductProvider().GetListByCache();
                foreach (LocalProductEntity item in list)
                {
                    ProductEntity product = ListSource.FirstOrDefault(a => a.SnNum == item.ProductNum);
                    if (product.IsNotNull())
                    {
                        if (!ListCache.Exists(a => a.ProductNum == item.ProductNum && a.BatchNum == item.BatchNum && a.LocalNum == item.LocalNum))
                        {
                            OutStoDetailEntity entity = new OutStoDetailEntity();
                            entity.SnNum       = SequenceProvider.GetSequence(typeof(OutStoDetailEntity));
                            entity.ProductName = product.ProductName;
                            entity.BarCode     = product.BarCode;
                            entity.BatchNum    = item.BatchNum;
                            entity.ProductNum  = product.SnNum;
                            entity.LocalNum    = item.LocalNum;
                            entity.LocalName   = item.LocalName;
                            entity.Color       = item.Color;
                            entity.Count       = item.Count;
                            entity.StorageNum  = this.DefaultStore;
                            entity.Num         = item.Num;
                            entity.IsPick      = (int)EBool.No;
                            entity.Size        = item.Size;
                            entity.RealNum     = 0;
                            entity.OutPrice    = product.InPrice;
                            entity.Amount      = product.InPrice * entity.Num;
                            entity.CreateTime  = DateTime.Now;
                            ListCache.Add(entity);
                        }
                        else
                        {
                            OutStoDetailEntity entity = ListCache.First(a => a.ProductNum == item.ProductNum && a.BatchNum == item.BatchNum && a.LocalNum == item.LocalNum);
                            entity.Num       += item.Num;
                            entity.OutPrice   = product.InPrice;
                            entity.Amount     = product.InPrice * entity.Num;
                            entity.CreateTime = DateTime.Now;
                        }
                    }
                }
            }
            if (!ListCache.IsNullOrEmpty())
            {
                Session[CacheKey.TEMPDATA_CACHE_OUTSTORDETAIL] = ListCache;
            }
            return(Content(string.Empty));
        }
Пример #28
0
        public ActionResult Save()
        {
            int              Type          = WebUtil.GetFormValue <int>("Type", (int)ECheckType.Local);
            int              ProductType   = WebUtil.GetFormValue <int>("ProductType", (int)EProductType.Goods);
            string           ContractOrder = WebUtil.GetFormValue <string>("ContractOrder", string.Empty);
            DateTime         CreateTime    = WebUtil.GetFormValue <DateTime>("CreateTime", DateTime.Now);
            string           Remark        = WebUtil.GetFormValue <string>("Remark", string.Empty);
            string           TargetNum     = WebUtil.GetFormValue <string>("TargetNum", string.Empty);
            CheckStockEntity entity        = new CheckStockEntity();
            string           orderNum      = SequenceProvider.GetSequence(typeof(CheckStockEntity));

            entity.OrderNum      = orderNum;
            entity.Type          = Type;
            entity.ProductType   = ProductType;
            entity.ContractOrder = ContractOrder;
            entity.Status        = (int)EAudite.Wait;
            entity.IsDelete      = (int)EIsDelete.NotDelete;
            entity.CreateTime    = CreateTime;
            entity.CreateUser    = this.LoginUser.UserCode;
            entity.OperateType   = (int)EOpType.PC;
            entity.IsComplete    = (int)EBool.No;
            entity.Remark        = Remark;
            entity.StorageNum    = this.DefaultStore;

            List <ProductEntity> ListProducts = Session[CacheKey.JOOSHOW_CHECKDETAIL_CACHE] as List <ProductEntity>;

            ListProducts = ListProducts.IsNull() ? new List <ProductEntity>() : ListProducts;

            List <CheckStockInfoEntity> listDetail = new List <CheckStockInfoEntity>();
            string storageNum = this.DefaultStore;

            foreach (ProductEntity key in ListProducts)
            {
                CheckStockInfoEntity detail = new CheckStockInfoEntity();
                detail.OrderNum   = orderNum;
                detail.TargetNum  = key.SnNum;
                detail.StorageNum = storageNum;
                detail.CreateTime = DateTime.Now;
                listDetail.Add(detail);
            }

            Bill <CheckStockEntity, CheckStockInfoEntity> bill = new CheckOrder();
            string returnValue = bill.Create(entity, listDetail);

            if (returnValue == EnumHelper.GetEnumDesc <EReturnStatus>(EReturnStatus.Success))
            {
                this.ReturnJson.AddProperty("Key", "1000");
                this.ReturnJson.AddProperty("Value", "盘点单创建成功");
            }
            return(Content(this.ReturnJson.ToString()));
        }
Пример #29
0
        public ShroudRenderer(World world, ShroudRendererInfo info)
        {
            var map = world.Map;

            bounds           = map.Bounds;
            useExtendedIndex = info.UseExtendedIndex;

            tiles      = new ShroudTile[map.MapSize.X * map.MapSize.Y];
            tileStride = map.MapSize.X;

            // Force update on first render
            shroudHash = -1;

            // Load sprite variants
            sprites       = new Sprite[info.Variants.Length * info.Index.Length];
            variantStride = info.Index.Length;
            for (var j = 0; j < info.Variants.Length; j++)
            {
                var seq = SequenceProvider.GetSequence(info.Sequence, info.Variants[j]);
                for (var i = 0; i < info.Index.Length; i++)
                {
                    sprites[j * variantStride + i] = seq.GetSprite(i);
                }
            }

            // Mapping of shrouded directions -> sprite index
            spriteMap = new int[useExtendedIndex ? 256 : 16];
            for (var i = 0; i < info.Index.Length; i++)
            {
                spriteMap[info.Index[i]] = i;
            }

            // Set individual tile variants to reduce tiling
            for (var i = 0; i < tiles.Length; i++)
            {
                tiles[i].Variant = Game.CosmeticRandom.Next(info.Variants.Length);
            }

            // Synthesize unexplored tile if it isn't defined
            if (!info.Index.Contains(0))
            {
                var size = new Size(Game.modData.Manifest.TileSize, Game.modData.Manifest.TileSize);
                var data = Exts.MakeArray <byte>(size.Width * size.Height, _ => (byte)info.ShroudColor);
                var s    = Game.modData.SheetBuilder.Add(data, size);
                unexploredTile = new Sprite(s.sheet, s.bounds, s.offset, s.channel, info.ShroudBlend);
            }
            else
            {
                unexploredTile = sprites[spriteMap[0]];
            }
        }
Пример #30
0
            public SelectDestination(string order, SupportPowerManager manager, ChronoshiftPower power, CPos sourceLocation)
            {
                this.manager        = manager;
                this.order          = order;
                this.power          = power;
                this.sourceLocation = sourceLocation;
                this.range          = (power.Info as ChronoshiftPowerInfo).Range;

                var tileset = manager.self.World.TileSet.Id.ToLower();

                validTile   = SequenceProvider.GetSequence("overlay", "target-valid-{0}".F(tileset)).GetSprite(0);
                invalidTile = SequenceProvider.GetSequence("overlay", "target-invalid").GetSprite(0);
                sourceTile  = SequenceProvider.GetSequence("overlay", "target-select").GetSprite(0);
            }