Exemplo n.º 1
0
        public static List <ChargeableItem> GetChargeables(this EntityInventory inventory)
        {
            var list = new List <ChargeableItem>();

            for (var i = 0; i < inventory.SlotCount(); i++)
            {
                var stack = inventory.GetItemStack(i);

                if (!stack.IsNull())
                {
                    if (stack.Item != Item.NullItem)
                    {
                        var item = stack.SingularItem();

                        if (item is ChargeableItem chargeable)
                        {
                            if (chargeable is BatteryItem == false && chargeable is CapacitorItem == false)
                            {
                                list.Add(chargeable);
                            }
                        }
                    }
                }
            }

            return(list);
        }
Exemplo n.º 2
0
    void Start()
    {
        entityInventory = EntityInventory.instance;
        playerInventory = PlayerInventory.instance;

        slotHolderBuy  = shopSet.transform.Find("Buy").GetChild(0).GetChild(0);
        slotHolderSell = shopSet.transform.Find("Sell").GetChild(0).GetChild(0);

        buyUI  = shopSet.transform.Find("Buy").gameObject;
        sellUI = shopSet.transform.Find("Sell").gameObject;

        slotsBuy  = slotHolderBuy.GetComponentsInChildren <ShopSlot>();
        slotsSell = slotHolderSell.GetComponentsInChildren <ShopSlot>();

        entityInventory.onSlotCountChange += slotChange;
        entityInventory.onChangeItem      += redrawSlotUI;

        playerInventory.onSlotCountChange += slotChange;
        playerInventory.onChangeItem      += redrawSlotUI;

        shopSet.SetActive(false);
        shopInformation.SetActive(false);

        shopNotice.gameObject.SetActive(false);
    }
Exemplo n.º 3
0
 public TargetEntity(Region tregion) :
     base(tregion)
 {
     model     = "players/human_male_004";
     mod_zrot  = 270;
     mod_scale = 1.5f;
     Damageable().SetMaxHealth(100);
     Damageable().SetHealth(100);
     SetMass(70);
     Items = new EntityInventory(tregion, this);
     // TODO: Better way to gather item details!
     Items.GiveItem(TheServer.Items.GetItem("weapons/rifles/m4"));
     Items.GiveItem(new ItemStack("bullet", "rifle_ammo", TheServer, 1000, "items/weapons/ammo/rifle_round_ico", "Assault Rifle Ammo", "Very rapid!", Color4F.White, "items/weapons/ammo/rifle_round", false, 0));
     Items.cItem = 1;
     Items.Items[0].Info.PrepItem(this, Items.Items[0]);
     ShouldShine = true;
     Damageable().EffectiveDeathEvent.AddEvent((e) =>
     {
         if (Removed)
         {
             return;
         }
         TheRegion.Explode(GetPosition(), 5);
         RemoveMe();
     }, this, 0);
 }
Exemplo n.º 4
0
 public void UpdateInventory(EntityInventory inventory)
 {
     foreach (EntityInventory.InventorySlot itemSlot in inventory.IntentorySlots)
     {
         m_buttonsDict[itemSlot.SlotNumber].UpdateInventoryItem(itemSlot.Item, ItemClicked);
     }
 }
Exemplo n.º 5
0
 private void Awake()
 {
     if (instance != null)
     {
         Destroy(gameObject);
         return;
     }
     instance = this;
 }
Exemplo n.º 6
0
    /// <summary>
    /// Sets the initial values needed by all entities. Takes in an entity object definition.
    /// The entity object definition takes health, and base stats.
    /// </summary>
    protected virtual void SetInitialValues()
    {
        entityStats = new EntityStats(10);
        maxHealth  += entityStats.vitality;

        inventory = new EntityInventory(8);

        level  = 1;
        health = maxHealth;
    }
Exemplo n.º 7
0
    protected void SetInitialValues()
    {
        entityStats = new EntityStats(10);
        maxHealth  += entityStats.vitality;

        inventory = new EntityInventory(invSize);
        playerInventory.SetupUI();

        level  = 1;
        health = maxHealth;
    }
Exemplo n.º 8
0
        public ActionResult EditInv() //Populate Inventory details
        {
            EntityInventory inv = DbContext.EntityInventories.OrderByDescending(t => t.EntityId).FirstOrDefault();

            if (inv == null)
            {
                inv = new EntityInventory();
            }
            ViewBag.InvDtls = inv;
            return(View());
        }
Exemplo n.º 9
0
        public ActionResult Editfacility() // Populate Entity Name
        {
            EntityInventory inv = DbContext.EntityInventories.OrderByDescending(t => t.EntityId).FirstOrDefault();

            if (inv == null)
            {
                inv = new EntityInventory();
            }
            ViewBag.EntityName = string.IsNullOrEmpty(inv?.EntityName) ? "" : inv.EntityName;
            ViewBag.Facilities = inv.Facilities;
            return(View());
        }
Exemplo n.º 10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <param name="mapId"></param>
        /// <param name="cellId"></param>
        /// <param name="grade"></param>
        public MonsterGroupEntity(long id, int mapId, int cellId)
            : base(EntityTypeEnum.TYPE_MONSTER_GROUP, id)
        {
            m_monsters      = new List <MonsterEntity>();
            m_nextMonsterId = -1;

            AlignmentId = -2;
            Resurect    = true;
            MapId       = mapId;
            CellId      = cellId;

            Inventory = new EntityInventory(this, (int)EntityTypeEnum.TYPE_MONSTER_GROUP, Id);
        }
Exemplo n.º 11
0
 public TargetEntity(Region tregion) :
     base(tregion)
 {
     model     = "players/human_male_004";
     mod_zrot  = 270;
     mod_scale = 1.5f;
     SetMaxHealth(100);
     SetHealth(100);
     SetMass(70);
     Items = new EntityInventory(tregion, this);
     // TODO: Better way to gather item details!
     Items.GiveItem(TheServer.Items.GetItem("weapons/rifles/m4"));
     Items.GiveItem(new ItemStack("bullet", "rifle_ammo", TheServer, 1000, "items/weapons/ammo/rifle_round_ico", "Assault Rifle Ammo", "Very rapid!", System.Drawing.Color.White, "items/weapons/ammo/rifle_round", false, 0));
     Items.cItem = 1;
     Items.Items[0].Info.PrepItem(this, Items.Items[0]);
 }
Exemplo n.º 12
0
        /// <summary>
        /// 更新存货档案
        /// </summary>
        /// <param name="UserCode"></param>
        /// <param name="PlainPassword"></param>
        /// <param name="StrAccID"></param>
        /// <param name="AccYear"></param>
        /// <param name="Act"></param>
        /// <param name="entity"></param>
        /// <param name="success"></param>
        /// <returns></returns>
        public string UpdateInventory(EntityInventory entity)
        {
            if (entity == null)
            {
                throw new JRException("存货档案更新失败!没有数据!");
            }
            string sql = string.Format(@" Update Inventory 
Set cInvAddCode=@cInvAddCode,cInvName =@cInvName ,cInvStd=@cInvStd,cInvCCode = @cInvCCode,cGroupCode=@cGroupCode,cComUnitCode=@cComUnitCode,cPackingType=@cPackingType,iInvSPrice=@iInvSPrice,fRetailPrice=@fRetailPrice,bBarCode=@bBarCode,cBarCode=@cBarCode ,
cInvDefine1=@cInvDefine1,cInvDefine2=@cInvDefine2,cInvDefine3=@cInvDefine3,cInvDefine4=@cInvDefine4,cInvDefine5=@cInvDefine5,cInvDefine6=@cInvDefine6,cInvDefine7=@cInvDefine7,cInvDefine8=@cInvDefine8,cInvDefine9=@cInvDefine9,
cInvDefine10=@cInvDefine10,cInvDefine11=@cInvDefine11,cInvDefine12=@cInvDefine12,cInvDefine13=@cInvDefine13,cModifyPerson=@cMaker,dModifyDate=GetDate()
                                        Where cInvCode = @cInvCode");

            SqlParameter[] para =
            {
                new SqlParameter("@cInvName",     entity.cInvName),
                new SqlParameter("@cInvCode",     entity.cInvCode),
                new SqlParameter("@cInvCCode",    entity.cInvCCode),
                new SqlParameter("@cGroupCode",   entity.cGroupCode),
                new SqlParameter("@cComUnitCode", GetDBValue(entity.cComUnitCode)),
                new SqlParameter("@cPackingType", GetDBValue(entity.cPackingType)),
                new SqlParameter("@cInvStd",      GetDBValue(entity.cInvStd)),
                new SqlParameter("@iInvSPrice",   entity.iInvSPrice),
                new SqlParameter("@fRetailPrice", entity.fRetailPrice),
                new SqlParameter("@cBarCode",     GetDBValue(entity.cBarCode)),
                new SqlParameter("@bBarCode",     entity.bBarCode),
                new SqlParameter("@cMaker",       GetDBValue(entity.cMaker)),
                new SqlParameter("@cInvAddCode",  GetDBValue(entity.cInvAddCode)),
                new SqlParameter("@cInvDefine1",  GetDBValue(entity.cInvDefine1)),
                new SqlParameter("@cInvDefine2",  GetDBValue(entity.cInvDefine2)),
                new SqlParameter("@cInvDefine3",  GetDBValue(entity.cInvDefine3)),
                new SqlParameter("@cInvDefine4",  GetDBValue(entity.cInvDefine4)),
                new SqlParameter("@cInvDefine5",  GetDBValue(entity.cInvDefine5)),
                new SqlParameter("@cInvDefine6",  GetDBValue(entity.cInvDefine6)),
                new SqlParameter("@cInvDefine7",  GetDBValue(entity.cInvDefine7)),
                new SqlParameter("@cInvDefine8",  GetDBValue(entity.cInvDefine8)),
                new SqlParameter("@cInvDefine9",  GetDBValue(entity.cInvDefine9)),
                new SqlParameter("@cInvDefine10", GetDBValue(entity.cInvDefine10)),
                new SqlParameter("@cInvDefine11", SqlNull(entity.cInvDefine11)),
                new SqlParameter("@cInvDefine12", SqlNull(entity.cInvDefine12)),
                new SqlParameter("@cInvDefine13", entity.cInvDefine13 == null?entity.fRetailPrice:entity.cInvDefine13),
                //new SqlParameter("@cInvDefine14",entity.cInvDefine14==null?entity.iInvSPrice:entity.cInvDefine14),
            };
            int headCount = this.DB_SqlHelper.ExecuteNonQuery(sql, para);

            return(entity.cInvCode);;
        }
Exemplo n.º 13
0
        /// <summary>
        /// Collects the item and adds it to the inventory automatically.
        /// </summary>
        public virtual void CollectAndAdd(EntityInventory inventory)
        {
            if (data == null)
            {
                Printer.Throw($"No DropItem.data assigned ({transform.name}). Use the CopyFrom function to assign data.");
            }

            int rest = inventory.AddStack(data);

            if (rest > 0)
            {
                data = new ItemStack(data.itemId, rest);
            }
            else
            {
                Destroy(gameObject);
            }
        }
Exemplo n.º 14
0
    protected virtual void Start()
    {
        infoModule = GetComponent <EntityInfo>();

        animationModule = new EntityAnimation(this);
        inventoryModule = new EntityInventory(this);
        movementModule  = new EntityMovement(this);
        visualModule    = new EntityVisual(this);

        characterController = GetComponent <CharacterController>();

        Game.OnCreatedEntity(this);

        if (postStartAction != null)
        {
            postStartAction();
        }
    }
Exemplo n.º 15
0
        public string AddInventory(string UserCode, string PlainPassword,
                                   string StrAccID, int AccYear, string Act, EntityInventory entity, out int success)
        {
            success = 0;
            #region 验证

            // 字段必填项验证
            string msg = "";
            if (!entity.CheckEntity(out msg))
            {
                return(msg);
            }


            if (string.IsNullOrWhiteSpace(GetInventoryClass(entity.cInvCCode, true)))
            {
                return(string.Format("U8中不存在存货分类编码或非末级:{0}!", entity.cInvCCode));
            }

            EntityComputationUnit unit = new EntityComputationUnit();
            unit = GetComputationUnit(entity.cComUnitCode);
            if (string.IsNullOrWhiteSpace(unit.cComUnitCode))
            {
                return(string.Format("U8中没有维护计量单位:{0}!", entity.cComUnitCode));
            }
            #endregion
            entity.cComUnitCode = unit.cComUnitCode;
            entity.cGroupCode   = unit.cGroupCode;
            entity.cMaker       = GetUserName(UserCode);
            entity.bBarCode     = string.IsNullOrWhiteSpace(entity.cBarCode) ? 0 : 1;
            entity.cValueType   = string.IsNullOrWhiteSpace(entity.cValueType) ? "全月平均法" : entity.cValueType;
            string id = "";
            if (!string.IsNullOrWhiteSpace(GetInventory(entity.cInvCode)))
            {
                id = UpdateInventory(entity);
            }
            else
            {
                id = InsertInventory(entity);
            }
            success = string.IsNullOrWhiteSpace(id) ? 0 : 1;
            return(id);
        }
Exemplo n.º 16
0
    public void SetupUI()
    {
        inventory = GetComponent <PlayerEntity>().inventory;
        int slotAmount = inventory.GetInventorySize();
        int rows       = Mathf.CeilToInt(slotAmount / 6.0f);

        if (rows < 1)
        {
            rows = 1;
        }
        Debug.Log(rows);

        inventoryUI.GetComponent <RectTransform>().sizeDelta = new Vector2(645, (rows * 90) + ((rows + 1) * 15));

        for (int i = 0; i < slotAmount; i++)
        {
            Instantiate(slotPrefab, inventoryUI.transform);
        }
        slots = inventoryUI.GetComponentsInChildren <InventorySlot>();
        UpdateUi();
    }
Exemplo n.º 17
0
        public ActionResult EditInv(EntityInventory inventory) //Insert or Update Inventory
        {
            var tblP = (from c in DbContext.EntityInventories
                        where c.EntityId == inventory.EntityId
                        select c).SingleOrDefault();

            if (tblP == null)
            {
                DbContext.EntityInventories.Add(inventory);
                DbContext.SaveChanges();
                ViewBag.InvDtls = inventory;
            }
            else
            {
                tblP.EntityName   = inventory.EntityName;
                tblP.EmissionYear = inventory.EmissionYear;
                DbContext.SaveChanges();
                ViewBag.InvDtls = tblP;
            }

            return(View());
        }
Exemplo n.º 18
0
        public static List <BatteryItem> GetBatteries(this EntityInventory inventory)
        {
            var list = new List <BatteryItem>();

            for (var i = 0; i < inventory.SlotCount(); i++)
            {
                var stack = inventory.GetItemStack(i);

                if (!stack.IsNull())
                {
                    if (stack.Item != Item.NullItem)
                    {
                        var item = stack.SingularItem();

                        if (item is BatteryItem battery)
                        {
                            list.Add(battery);
                        }
                    }
                }
            }

            return(list);
        }
Exemplo n.º 19
0
        public string InsertInventory(EntityInventory entity)
        {
            if (entity == null)
            {
                throw new JRException("存货档案新增失败!没有数据!");
            }
            string sql = string.Format(@"INSERT INTO Inventory(
cInvCode,cInvAddCode,cInvName,cInvStd,cInvCCode,cVenCode,cReplaceItem,cPosition,bSale,bPurchase,bSelf,bComsume,bProducing,bService,bAccessary,iTaxRate,
iInvWeight,iVolume,iInvRCost,iInvSPrice,iInvSCost,iInvLSCost,iInvNCost,iInvAdvance,iInvBatch,iSafeNum,iTopSum,iLowSum,iOverStock,cInvABC,bInvQuality,bInvBatch,bInvEntrust,bInvOverStock,dSDate,dEDate,bFree1,bFree2,cInvDefine1,cInvDefine2,cInvDefine3,bInvType,iInvMPCost,cQuality,bFree3,bFree4,bFree5,bFree6,bFree7,bFree8,bFree9,bFree10,
cCreatePerson,cModifyPerson,dModifyDate,fSubscribePoint,fVagQuantity,cValueType,fOutExcess,fInExcess,iMassDate,iWarnDays,fExpensesExch,bTrack,bSerial,bBarCode,cBarCode,
cInvDefine4,cInvDefine5,cInvDefine6,cInvDefine7,cInvDefine8,cInvDefine9,cInvDefine10,cInvDefine11,cInvDefine12,cInvDefine13,cInvDefine14,cInvDefine15,cInvDefine16,
iGroupType,cGroupCode,cComUnitCode,cAssComUnitCode,cSAComUnitCode,cPUComUnitCode,cSTComUnitCode,cCAComUnitCode,
cFrequency,iFrequency,iDays,dLastDate,iWastage,bSolitude,cEnterprise,cAddress,cFile,cLabel,cCheckOut,cLicence,bSpecialties,
cDefWareHouse,iHighPrice,iExpSaleRate,cPriceGroup,cOfferGrade,iOfferRate,cCurrencyName,cProduceAddress,cProduceNation,cRegisterNo,
cEnterNo,cPackingType,cEnglishName,bPropertyCheck,cPreparationType,cCommodity,iRecipeBatch,cNotPatentName,iROPMethod,iBatchRule,
iAssureProvideDays,iTestStyle,iDTMethod,fDTRate,fDTNum,cDTUnit,iDTStyle,iQTMethod,bPlanInv,bProxyForeign,bATOModel,bCheckItem,
bPTOModel,bEquipment,cProductUnit,fOrderUpLimit,cMassUnit,fRetailPrice,cInvDepCode,iAlterAdvance,fAlterBaseNum,cPlanMethod,bMPS,
bROP,bRePlan,cSRPolicy,bBillUnite,iSupplyDay,fSupplyMulti,fMinSupply,bCutMantissa,cInvPersonCode,iInvTfId,cEngineerFigNo,
bInTotalCost,iSupplyType,bConfigFree1,bConfigFree2,bConfigFree3,bConfigFree4,bConfigFree5,bConfigFree6,bConfigFree7,bConfigFree8,
bConfigFree9,bConfigFree10,iDTLevel,cDTAQL,bPeriodDT,cDTPeriod,iBigMonth,iBigDay,iSmallMonth,iSmallDay,bOutInvDT,bBackInvDT,
iEndDTStyle,bDTWarnInv,cCIQCode,cWGroupCode,cWUnit,fGrossW,cVGroupCode,cVUnit,fLength,fWidth,fHeight,cShopUnit,cPurPersonCode,
bImportMedicine,bFirstBusiMedicine,bForeExpland,cInvPlanCode,fConvertRate,dReplaceDate,bInvModel,bKCCutMantissa,bReceiptByDT,
iImpTaxRate,bExpSale,iDrawBatch,bCheckBSATP,cInvProjectCode,iTestRule,cRuleCode,bCheckFree1,bCheckFree2,bCheckFree3,bCheckFree4,
bCheckFree5,bCheckFree6,bCheckFree7,bCheckFree8,bCheckFree9,bCheckFree10,bBomMain,bBomSub,bProductBill,iCheckATP,iInvATPId,iPlanTfDay,
iOverlapDay,bPiece,bSrvItem,bSrvFittings,fMaxSupply,fMinSplit,bSpecialOrder,bTrackSaleBill,cInvMnemCode)
VALUES
(@cInvCode,@cInvAddCode,@cInvName,@cInvStd,@cInvCCode,NULL,NULL,NULL,1,1,1,1,0,0,0,13,
NULL,NULL,NULL,@iInvSPrice,NULL,NULL,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,
0,GetDate(),NULL,0,0,@cInvDefine1,@cInvDefine12,@cInvDefine3,0,NULL,NULL,0,0,0,0,0,0,0,0,
@cMaker,@cMaker,GetDate(),NULL,NULL,@cValueType,NULL,NULL,NULL,NULL,NULL,0,0,@bBarCode,@cBarCode,
@cInvDefine4,@cInvDefine5,@cInvDefine6,@cInvDefine7,@cInvDefine8,@cInvDefine9,@cInvDefine10,@cInvDefine11,@cInvDefine12,@cInvDefine13,NULL,NULL,NULL,
0,@cGroupCode,@cComUnitCode,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
@cPackingType,NULL,0,NULL,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,0,0,NULL,NULL,
NULL,@fRetailPrice,NULL,NULL,NULL,N'R',0,0,0,N'PE',0,NULL,NULL,NULL,0,NULL,NULL,NULL,1,0,0,0,0,0,0,0,0,0,0,0,
NULL,NULL,0,NULL,NULL,NULL,NULL,NULL,0,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,@cComUnitCode,
NULL,0,0,0,NULL,1,NULL,0,0,0,13,0,NULL,0,NULL,NULL,NULL,0,0,0,0,0,0,0,0,0,0,1,1,1,0,NULL,NULL,NULL,0,0,0,NULL,NULL,0,0,NULL);
                        INSERT INTO Inventory_Sub(cInvSubCode,fBuyExcess,iSurenessType,iDateType,iDateSum,iDynamicSurenessType,
iBestrowSum,iPercentumSum,bIsAttachFile,bInByProCheck,iRequireTrackStyle,iExpiratDateCalcu,iBOMExpandUnitType,bPurPriceFree1,
bPurPriceFree2,bPurPriceFree3,bPurPriceFree4,bPurPriceFree5,bPurPriceFree6,bPurPriceFree7,bPurPriceFree8,bPurPriceFree9,bPurPriceFree10,
bOMPriceFree1,bOMPriceFree2,bOMPriceFree3,bOMPriceFree4,bOMPriceFree5,bOMPriceFree6,bOMPriceFree7,bOMPriceFree8,bOMPriceFree9,
bOMPriceFree10,bSalePriceFree1,bSalePriceFree2,bSalePriceFree3,bSalePriceFree4,bSalePriceFree5,bSalePriceFree6,bSalePriceFree7,
bSalePriceFree8,bSalePriceFree9,bSalePriceFree10,fInvOutUpLimit,bBondedInv,bBatchCreate,bBatchProperty1,bBatchProperty2,bBatchProperty3,
bBatchProperty4,bBatchProperty5,bBatchProperty6,bBatchProperty7,bBatchProperty8,bBatchProperty9,bBatchProperty10,bControlFreeRange1,
bControlFreeRange2,bControlFreeRange3,bControlFreeRange4,bControlFreeRange5,bControlFreeRange6,bControlFreeRange7,bControlFreeRange8,
bControlFreeRange9,bControlFreeRange10,fInvCIQExch,iWarrantyPeriod,iWarrantyUnit,bInvKeyPart,iAcceptEarlyDays,fCurLLaborCost,
fCurLVarManuCost,fCurLFixManuCost,fCurLOMCost,fNextLLaborCost,fNextLVarManuCost,fNextLFixManuCost,fNextLOMCost,dInvCreateDatetime,
bPUQuota,bInvROHS,bPrjMat,fPrjMatLimit,bInvAsset,bSrvProduct,iAcceptDelayDays,iPlanCheckDay,iMaterialsCycle,iDrawType,bSCkeyProjections,
iSupplyPeriodType,iTimeBucketId,iAvailabilityDate,fMaterialCost,bImport,iNearRejectDays,bCheckSubitemCost,fRoundFactor,bConsiderFreeStock,bSuitRetail)
VALUES
(@cInvCode,NULL,1,NULL,NULL,NULL,NULL,NULL,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,NULL,0,1,999,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
GetDate(),0,0,0,NULL,0,0,0,NULL,NULL,0,0,1,NULL,1,NULL,0,NULL,1,0,1,0);
                        INSERT INTO bas_part(partId,InvCode,bVirtual ,SafeQty,MinQty,MulQty,FixQty,cBasEngineerFigNo,
fBasMaxSupply,iSurenessType,iDateType,iDateSum,iDynamicSurenessType,iBestrowSum,iPercentumSum)
VALUES
(@PartId,@cInvCode,1,NULL,NULL,NULL,NULL,NULL,NULL,N'1',NULL,NULL,NULL,NULL,NULL)");

            SqlParameter[] para =
            {
                new SqlParameter("@cInvName",     entity.cInvName),
                new SqlParameter("@cInvCode",     entity.cInvCode),
                new SqlParameter("@cInvCCode",    entity.cInvCCode),
                new SqlParameter("@cGroupCode",   entity.cGroupCode),
                new SqlParameter("@cComUnitCode", GetDBValue(entity.cComUnitCode)),
                new SqlParameter("@cPackingType", GetDBValue(entity.cPackingType)),
                new SqlParameter("@cInvStd",      GetDBValue(entity.cInvStd)),
                new SqlParameter("@cValueType",   GetDBValue(entity.cValueType)),
                new SqlParameter("@iInvSPrice",   entity.iInvSPrice),
                new SqlParameter("@fRetailPrice", entity.fRetailPrice),
                new SqlParameter("@cBarCode",     GetDBValue(entity.cBarCode)),
                new SqlParameter("@bBarCode",     entity.bBarCode),
                new SqlParameter("@PartId",       GetPartId() + 1),
                new SqlParameter("@cMaker",       GetDBValue(entity.cMaker)),
                new SqlParameter("@cInvAddCode",  GetDBValue(entity.cInvAddCode)),
                new SqlParameter("@cInvDefine1",  GetDBValue(entity.cInvDefine1)),
                new SqlParameter("@cInvDefine2",  GetDBValue(entity.cInvDefine2)),
                new SqlParameter("@cInvDefine3",  GetDBValue(entity.cInvDefine3)),
                new SqlParameter("@cInvDefine4",  GetDBValue(entity.cInvDefine4)),
                new SqlParameter("@cInvDefine5",  GetDBValue(entity.cInvDefine5)),
                new SqlParameter("@cInvDefine6",  GetDBValue(entity.cInvDefine6)),
                new SqlParameter("@cInvDefine7",  GetDBValue(entity.cInvDefine7)),
                new SqlParameter("@cInvDefine8",  GetDBValue(entity.cInvDefine8)),
                new SqlParameter("@cInvDefine9",  GetDBValue(entity.cInvDefine9)),
                new SqlParameter("@cInvDefine10", GetDBValue(entity.cInvDefine10)),
                new SqlParameter("@cInvDefine11", SqlNull(entity.cInvDefine11)),
                new SqlParameter("@cInvDefine12", SqlNull(entity.cInvDefine12)),
                new SqlParameter("@cInvDefine13", entity.cInvDefine13 == null?entity.fRetailPrice:entity.cInvDefine13),
                //new SqlParameter("@cInvDefine14",entity.cInvDefine14==null?entity.iInvSPrice:entity.cInvDefine14),
            };
            int headCount = this.DB_SqlHelper.ExecuteNonQuery(sql, para);

            return(entity.cInvCode);
        }
Exemplo n.º 20
0
        public string AddModels(string UserCode, string CipherPassword, int ModelType,
                                string StrAccID, string Act, string Entity)
        {
            //Entity = System.Web.HttpUtility.UrlDecode(Entity);
            string plainPassword = DefineEncryptDecrypt.Decrypt(CipherPassword);
            int    AccYear       = U8BllBase.GetBeginYear(StrAccID);

            if (AccYear == 0)
            {
                return(ControllerHelp.GetReturnStr(0, string.Format("没有找到账套号:{0}", StrAccID)));
            }
            int        success = 0;
            ModelsType mt      = (ModelsType)ModelType;

            switch (mt)
            {
            case ModelsType.Sale:     // 销售订单
                lock (SaleLock)
                {
                    if (Act == "add")
                    {
                        EntitySaleHead entity = JsonConvert.DeserializeObject <EntitySaleHead>(Entity);
                        SoMainBll      bll    = new SoMainBll(StrAccID, AccYear, UserCode, plainPassword);
                        var            result = bll.AddSale(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.RdRecord09:     // 配送出库单(其他出库单)
                lock (RdRecord09Lock)
                {
                    if (Act == "add")
                    {
                        EntityRdRecord09Head entity = JsonConvert.DeserializeObject <EntityRdRecord09Head>(Entity);
                        RdRecord09Bll        bll    = new RdRecord09Bll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddRdRecord09(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.DispatchList1:    //销售退货单
            case ModelsType.DispatchList4:    //委托代销退货单
                lock (DispatchList1Lock)
                {
                    if (Act == "add")
                    {
                        EntityDispatchListHead entity = JsonConvert.DeserializeObject <EntityDispatchListHead>(Entity);
                        DispatchListBll        bll    = new DispatchListBll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddDispatchList(UserCode, plainPassword, StrAccID, AccYear, Act, ModelsType.DispatchList1 == mt ? 0 : 1, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.DispatchList2:    //销售发货单
            case ModelsType.DispatchList3:    //委托代销发货单
                lock (DispatchList2Lock)
                {
                    if (Act == "add")
                    {
                        EntityDispatchListHead entity = JsonConvert.DeserializeObject <EntityDispatchListHead>(Entity);
                        DispatchListBll        bll    = new DispatchListBll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddDispatchList(UserCode, plainPassword, ModelType, StrAccID, AccYear, Act, ModelsType.DispatchList2 == mt ? 0 : 1, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.Ap_CloseBill:    //收款单
                lock (Ap_CloseBillLock)
                {
                    if (Act == "add")
                    {
                        EntityAp_CloseBillHead entity = JsonConvert.DeserializeObject <EntityAp_CloseBillHead>(Entity);
                        Ap_CloseBillBll        bll    = new Ap_CloseBillBll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddAp_CloseBill(UserCode, plainPassword, StrAccID, AccYear, Act, ModelType, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.Ap_Vouch:    //其他应付款
                lock (Ap_VouchLock)
                {
                    if (Act == "add")
                    {
                        EntityAp_VouchHead entity = JsonConvert.DeserializeObject <EntityAp_VouchHead>(Entity);
                        Ap_VouchBll        bll    = new Ap_VouchBll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddAp_Vouch(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.PO_Pomain:    //采购订单
                lock (PO_PomainLock)
                {
                    if (Act == "add")
                    {
                        EntityPO_Pomain entity = JsonConvert.DeserializeObject <EntityPO_Pomain>(Entity);
                        PO_PomainBll    bll    = new PO_PomainBll(StrAccID, AccYear, UserCode, plainPassword);
                        var             result = bll.AddPO_Pomain(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.RdRecord01:    //采购入库单
                lock (RdRecord01Lock)
                {
                    if (Act == "add")
                    {
                        EntityRdRecord01Head entity = JsonConvert.DeserializeObject <EntityRdRecord01Head>(Entity);
                        RdRecord01Bll        bll    = new RdRecord01Bll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddRdRecord01(UserCode, plainPassword, StrAccID, AccYear, Act, 0, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.PayAp_CloseBill:     //付款单
                lock (PayAp_CloseBillLock)
                {
                    if (Act == "add")
                    {
                        EntityAp_CloseBillHead entity = JsonConvert.DeserializeObject <EntityAp_CloseBillHead>(Entity);
                        Ap_CloseBillBll        bll    = new Ap_CloseBillBll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddAp_CloseBill(UserCode, plainPassword, StrAccID, AccYear, Act, ModelType, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.ST_AppTransVouch:     //调拨申请单
                lock (ST_AppTransVouchLock)
                {
                    if (Act == "add")
                    {
                        EntityST_AppTransVouch entity = JsonConvert.DeserializeObject <EntityST_AppTransVouch>(Entity);
                        ST_AppTransVouchBll    bll    = new ST_AppTransVouchBll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddST_AppTransVouch(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.TransVouch:     //调拨单
                lock (TransVouchLock)
                {
                    if (Act == "add")
                    {
                        EntityTransVouch entity = JsonConvert.DeserializeObject <EntityTransVouch>(Entity);
                        TransVouchBll    bll    = new TransVouchBll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddTransVouch(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.Vendor:     //供应商
                lock (VendorLock)
                {
                    if (Act == "add")
                    {
                        EntityVendor entity = JsonConvert.DeserializeObject <EntityVendor>(Entity);
                        VendorBll    bll    = new VendorBll(StrAccID, AccYear, UserCode, plainPassword);
                        var          result = bll.AddVendor(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.CheckVouch:     //盘点单
                lock (VendorLock)
                {
                    if (Act == "add")
                    {
                        EntityCheckVouchHead entity = JsonConvert.DeserializeObject <EntityCheckVouchHead>(Entity);
                        CheckVouchBll        bll    = new CheckVouchBll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddCheckVouch(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.InventoryClass:     //存货分类
                lock (InventoryClassLock)
                {
                    if (Act == "add")
                    {
                        EntityInventoryClass entity = JsonConvert.DeserializeObject <EntityInventoryClass>(Entity);
                        InventoryClassBll    bll    = new InventoryClassBll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddInventoryClass(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.Inventory:     //存货档案
                lock (InventoryLock)
                {
                    if (Act == "add")
                    {
                        EntityInventory entity = JsonConvert.DeserializeObject <EntityInventory>(Entity);
                        InventoryBll    bll    = new InventoryBll(StrAccID, AccYear, UserCode, plainPassword);
                        var             result = bll.AddInventory(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.WareHouse:     //仓库档案
                lock (WareHouseLock)
                {
                    if (Act == "add")
                    {
                        EntityWareHouse entity = JsonConvert.DeserializeObject <EntityWareHouse>(Entity);
                        WareHouseBll    bll    = new WareHouseBll(StrAccID, AccYear, UserCode, plainPassword);
                        var             result = bll.AddWareHouse(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.Customer:     //客户档案
                lock (CustomerLock)
                {
                    if (Act == "add")
                    {
                        EntityCustomer entity = JsonConvert.DeserializeObject <EntityCustomer>(Entity);
                        CustomerBll    bll    = new CustomerBll(StrAccID, AccYear, UserCode, plainPassword);
                        var            result = bll.AddCustomer(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.RdRecord01T:    //红字采购入库单
                lock (RdRecord01TLock)
                {
                    if (Act == "add")
                    {
                        EntityRdRecord01Head entity = JsonConvert.DeserializeObject <EntityRdRecord01Head>(Entity);
                        RdRecord01Bll        bll    = new RdRecord01Bll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddRdRecord01(UserCode, plainPassword, StrAccID, AccYear, Act, 1, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }
            }

            return(ControllerHelp.GetReturnStr(0, "AddModels中没有找到可对应的操作项"));
        }
 public bool HasItem(EntityInventory value)
 {
     return((PlayerInventory & value) != 0);
 }
 public void RemoveItem()
 {
     PlayerInventory = 0;
 }
 public void RemoveItem(EntityInventory value)
 {
     PlayerInventory &= ~value;
 }
 public void AddItem(EntityInventory value)
 {
     PlayerInventory |= value;
 }