Exemplo n.º 1
0
    void onLoadInventory(NetworkMessage msg)
    {
        InventoryInfo info = msg.ReadMessage <InventoryInfo>();

        player.setInventory(info.items);
        Debug.Log("inventory loaded");
        Debug.Log(info.items.Length);
    }
Exemplo n.º 2
0
		public int Insert(InventoryInfo oParam)
		{
			string sql = @"INSERT INTO Inventory
                            (
                            ProductSysNo, AccountQty, AvailableQty, 
                            AllocatedQty, OrderQty, PurchaseQty, VirtualQty
                            )
                            VALUES (
                            @ProductSysNo, @AccountQty, @AvailableQty, 
                            @AllocatedQty, @OrderQty, @PurchaseQty, @VirtualQty
                            )";
			SqlCommand cmd = new SqlCommand(sql);

			SqlParameter paramProductSysNo = new SqlParameter("@ProductSysNo", SqlDbType.Int,4);
			SqlParameter paramAccountQty = new SqlParameter("@AccountQty", SqlDbType.Int,4);
			SqlParameter paramAvailableQty = new SqlParameter("@AvailableQty", SqlDbType.Int,4);
			SqlParameter paramAllocatedQty = new SqlParameter("@AllocatedQty", SqlDbType.Int,4);
			SqlParameter paramOrderQty = new SqlParameter("@OrderQty", SqlDbType.Int,4);
			SqlParameter paramPurchaseQty = new SqlParameter("@PurchaseQty", SqlDbType.Int,4);
			SqlParameter paramVirtualQty = new SqlParameter("@VirtualQty", SqlDbType.Int,4);

			paramProductSysNo.Value = oParam.ProductSysNo;

			if ( oParam.AccountQty != AppConst.IntNull)
				paramAccountQty.Value = oParam.AccountQty;
			else
				paramAccountQty.Value = System.DBNull.Value;
			if ( oParam.AvailableQty != AppConst.IntNull)
				paramAvailableQty.Value = oParam.AvailableQty;
			else
				paramAvailableQty.Value = System.DBNull.Value;
			if ( oParam.AllocatedQty != AppConst.IntNull)
				paramAllocatedQty.Value = oParam.AllocatedQty;
			else
				paramAllocatedQty.Value = System.DBNull.Value;
			if ( oParam.OrderQty != AppConst.IntNull)
				paramOrderQty.Value = oParam.OrderQty;
			else
				paramOrderQty.Value = System.DBNull.Value;
			if ( oParam.PurchaseQty != AppConst.IntNull)
				paramPurchaseQty.Value = oParam.PurchaseQty;
			else
				paramPurchaseQty.Value = System.DBNull.Value;
			if ( oParam.VirtualQty != AppConst.IntNull)
				paramVirtualQty.Value = oParam.VirtualQty;
			else
				paramVirtualQty.Value = System.DBNull.Value;

			cmd.Parameters.Add(paramProductSysNo);
			cmd.Parameters.Add(paramAccountQty);
			cmd.Parameters.Add(paramAvailableQty);
			cmd.Parameters.Add(paramAllocatedQty);
			cmd.Parameters.Add(paramOrderQty);
			cmd.Parameters.Add(paramPurchaseQty);
			cmd.Parameters.Add(paramVirtualQty);

			return SqlHelper.ExecuteNonQuery(cmd);
		}
Exemplo n.º 3
0
 private void initView()
 {
     if (mode == mode.Add)
     {
         btnOK.ButtonText      = "新增";
         txtCount.Text         = "1";
         btnOK.IdleFillColor   = Color.FromArgb(33, 166, 117);
         btnOK.IdleLineColor   = Color.FromArgb(33, 166, 117);
         btnOK.ActiveFillColor = Color.FromArgb(33, 166, 117);
         btnOK.ActiveLineColor = Color.FromArgb(33, 166, 117);
         dpkImportDTTM.Value   = DateTime.Today;
     }
     else if (mode == mode.Edit)
     {
         btnOK.ButtonText      = "修改";
         btnOK.IdleFillColor   = Color.FromArgb(255, 161, 0);
         btnOK.IdleLineColor   = Color.FromArgb(255, 161, 0);
         btnOK.ActiveFillColor = Color.FromArgb(255, 161, 0);
         btnOK.ActiveLineColor = Color.FromArgb(255, 161, 0);
         btnItemAdd.Visible    = false;
         btnItemDel.Visible    = false;
         btnClear.Visible      = false;
         lblTotalAmt.Visible   = false;
         InventoryInfo view = new InventoryInfo(APConfig.Conn);
         view.Conditions  = " 1=1 ";
         view.Conditions += " AND " + view.getCondition(InventoryInfo.ncConditions.serno.ToString(), serno);
         view.load();
         if (view.load())
         {
             txtName.Text        = view.INV_NAME;
             txtAmount.Text      = view.INV_POSTAMT.ToString();
             txtComment.Text     = view.INV_POSTCOMMENT;
             dpkImportDTTM.Value = view.INV_POSTDTTM;
             txtCount.Text       = "1";
         }
     }
     else if (mode == mode.View)
     {
         DisableControls();
         btnOK.ButtonText    = "確認";
         btnItemAdd.Visible  = false;
         btnItemDel.Visible  = false;
         btnClear.Visible    = false;
         lblTotalAmt.Visible = false;
         InventoryInfo view = new InventoryInfo(APConfig.Conn);
         view.Conditions  = " 1=1 ";
         view.Conditions += " AND " + view.getCondition(InventoryInfo.ncConditions.serno.ToString(), serno);
         view.load();
         if (view.load())
         {
             txtName.Text        = view.INV_NAME;
             txtAmount.Text      = view.INV_POSTAMT.ToString();
             txtComment.Text     = view.INV_POSTCOMMENT;
             dpkImportDTTM.Value = view.INV_POSTDTTM;
             txtCount.Text       = "1";
         }
     }
 }
Exemplo n.º 4
0
        public InventoryInfo GetInventoryByKey(long gid)
        {
            InventoryInfo result  = new InventoryInfo();
            DataCommand   command = new DataCommand(ConnectionString, GetDbCommand(InventoryStatement.GetInventoryByKey, "Text"));

            command.AddInputParameter("@InventoryID", DbType.String, gid);
            result = command.ExecuteEntity <InventoryInfo>();
            return(result);
        }
Exemplo n.º 5
0
            /// <summary>
            /// Serializes the specified inventory info.
            /// </summary>
            /// <param name="inventoryInfo">The inventory info.</param>
            /// <returns>Serialized string for inventoryInfo.</returns>
            public static string Serialize(InventoryInfo inventoryInfo)
            {
                if (inventoryInfo == null)
                {
                    return(null);
                }

                return(SerializationHelper.SerializeObjectToXml <InventoryInfo>(inventoryInfo));
            }
Exemplo n.º 6
0
        public int ModifyInventoryQuantity(InventoryInfo Inventory)
        {
            DataCommand command = new DataCommand(ConnectionString, GetDbCommand(InventoryStatement.ModifyInventoryQuantity, "Text"));

            command.AddInputParameter("@Quantity", DbType.Int32, Inventory.Quantity);
            command.AddInputParameter("@ChangeDate", DbType.DateTime, Inventory.ChangeDate);
            command.AddInputParameter("@InventoryID", DbType.Int64, Inventory.InventoryID);
            return(command.ExecuteNonQuery());
        }
Exemplo n.º 7
0
    //# INVENTORY

    void onLoadInventory(NetworkMessage msg)
    {
        Debug.Log("loaded inventory outside");
        InventoryInfo inf = msg.ReadMessage <InventoryInfo>();

        inf.items = getInventoryFromDatabase(inf.name);
        Debug.Log(inf.items.Length);
        NetworkServer.SendToClient(msg.conn.connectionId, PacketTypes.LOAD_INVENTORY, inf);
    }
Exemplo n.º 8
0
    void onSaveInventory(NetworkMessage netMsg)
    {
        //string connectionString = "Server=" + host + ";Database=" + database + ";Uid=Gerry;Pwd=pass;";
        MySqlConnection mysqlConn;

        mysqlNonQuerySelector(out mysqlConn, "");
        mysqlConn.Close();
        InventoryInfo packet = netMsg.ReadMessage <InventoryInfo>();
    }
Exemplo n.º 9
0
 public InventoryInfo UpsertInventory(InventoryInfo inventoryInfo)
 {
     if (inventoryInfo == null)
     {
         throw new ArgumentNullException(nameof(inventoryInfo));
     }
     UpsertInventories(new[] { inventoryInfo });
     return(inventoryInfo);
 }
Exemplo n.º 10
0
        public static InventoryEntity GetInventoryById(long gid)
        {
            InventoryEntity     result = new InventoryEntity();
            InventoryRepository mr     = new InventoryRepository();
            InventoryInfo       info   = mr.GetInventoryByKey(gid);

            result = TranslateInventoryEntity(info);
            return(result);
        }
Exemplo n.º 11
0
 private void loadData()
 {
     if (tabControl1.SelectedIndex == 0)
     {
         dgvItem.Rows.Clear();
         DataGridViewRowCollection rows = dgvItem.Rows;
         InventoryInfo             view = new InventoryInfo(APConfig.Conn);
         view.Conditions  = " 1=1 ";
         view.Conditions += " AND " + view.getCondition(InventoryInfo.ncConditions.status.ToString(), InventoryStatus.庫存中.ToString());
         if (!string.IsNullOrEmpty(txtCode.Text))
         {
             view.Conditions += " AND " + view.getCondition(InventoryInfo.ncConditions.LKcode.ToString(), txtCode.Text);
         }
         if (!string.IsNullOrEmpty(txtName.Text))
         {
             view.Conditions += " AND " + view.getCondition(InventoryInfo.ncConditions.LKname.ToString(), txtName.Text);
         }
         if (!string.IsNullOrEmpty(sernolist))
         {
             view.Conditions += " AND " + view.getCondition(InventoryInfo.ncConditions.NINsernolist.ToString(), sernolist);
         }
         view.load();
         while (!view.IsEof)
         {
             rows.Add(new Object[] { view.INV_SERNO, view.INV_CODE });
             view.next();
         }
     }
     else if (tabControl1.SelectedIndex == 1)
     {
         dgvPost.Rows.Clear();
         DataGridViewRowCollection rows = dgvPost.Rows;
         InventoryInfo             view = new InventoryInfo(APConfig.Conn);
         view.Conditions  = " 1=1 ";
         view.Conditions += " AND " + view.getCondition(InventoryInfo.ncConditions.status.ToString(), InventoryStatus.寄庫品.ToString());
         if (!string.IsNullOrEmpty(txtCode.Text))
         {
             view.Conditions += " AND " + view.getCondition(InventoryInfo.ncConditions.LKcode.ToString(), txtCode.Text);
         }
         if (!string.IsNullOrEmpty(txtName.Text))
         {
             view.Conditions += " AND " + view.getCondition(InventoryInfo.ncConditions.LKname.ToString(), txtName.Text);
         }
         if (!string.IsNullOrEmpty(sernolist))
         {
             view.Conditions += " AND " + view.getCondition(InventoryInfo.ncConditions.NINsernolist.ToString(), sernolist);
         }
         view.OrderBy = view.getOptionOrderBy(InventoryInfo.ncOrderBy.ODBname.ToString());
         view.load();
         while (!view.IsEof)
         {
             rows.Add(new Object[] { view.INV_SERNO, view.INV_NAME, view.INV_POSTAMT, view.INV_POSTDTTM.ToShortDateString() });
             view.next();
         }
     }
 }
Exemplo n.º 12
0
        public NormalResult WriteTagInfo(
            string reader_name,
            TagInfo old_tag_info,
            TagInfo new_tag_info)
        {
            // TODO: 对 old_tag_info 和 new_tag_info 合法性进行一系列检查

            foreach (Reader reader in Program.Rfid.Readers)
            {
#if NO
                if (reader_name == "*" || reader.Name == reader_name)
                {
                }
                else
                {
                    continue;
                }
#endif

                if (Reader.MatchReaderName(reader_name, reader.Name, out string antenna_list) == false)
                {
                    continue;
                }


                InventoryInfo info = new InventoryInfo
                {
                    UID       = old_tag_info.UID,
                    AntennaID = old_tag_info.AntennaID  // 2019/9/27
                };
                GetTagInfoResult result0 = Program.Rfid.GetTagInfo(reader.Name, info);

                if (result0.Value == -1 && result0.ErrorCode == "errorFromReader=4")
                {
                    continue;
                }

                if (result0.Value == -1)
                {
                    return(new NormalResult(result0));
                }

                // TODO: 是否对照检查 old_tag_info 和 result0.TagInfo ?

                return(Program.Rfid.WriteTagInfo(reader.Name,
                                                 old_tag_info,
                                                 new_tag_info));
            }

            return(new NormalResult
            {
                Value = -1,
                ErrorInfo = $"没有找到 UID 为 {old_tag_info.UID} 的标签",
                ErrorCode = "notFound"
            });
        }
        public static IChangeToken CreateChangeToken(InventoryInfo inventory)
        {
            if (inventory == null)
            {
                throw new ArgumentNullException(nameof(inventory));
            }
            var cancellationTokenSource = _inventoryRegionTokenLookup.GetOrAdd(inventory.ProductId, new CancellationTokenSource());

            return(new CompositeChangeToken(new[] { CreateChangeToken(), new CancellationChangeToken(cancellationTokenSource.Token) }));
        }
Exemplo n.º 14
0
 public HeadsUpDisplay(Game1 game, int rectX, int rectY)
 {
     this.game     = game;
     Size          = new Point(rectX, rectY);
     pausedPos     = new Vector2(rectX / 2f, rectY / 2f);
     normalPos     = new Vector2(rectX / 2f, -rectY / 2f + 190);
     Position      = normalPos;
     headerInfo    = new HeaderInfo(game, this);
     inventoryInfo = new InventoryInfo(game, this);
 }
Exemplo n.º 15
0
 /// <summary>
 /// 设置SQL参数表
 /// </summary>
 /// <param name="Inventory">Inventory对象</param>
 /// <returns>Inventory参数数组</returns>
 private SqlParameter[] Set_Inventory_Parameters(InventoryInfo inventoryInfo)
 {
     SqlParameter[] paramArray = new SqlParameter[] { new SqlParameter("@ID", inventoryInfo.ID),
                                                      new SqlParameter("@ItemID", inventoryInfo.ItemID),
                                                      new SqlParameter("@Qty", inventoryInfo.Qty),
                                                      new SqlParameter("@OrderQty", inventoryInfo.OrderQty),
                                                      new SqlParameter("@CreatedBy", string.IsNullOrEmpty(inventoryInfo.CreatedBy)?"":inventoryInfo.CreatedBy),
                                                      new SqlParameter("@UpdatedBy", string.IsNullOrEmpty(inventoryInfo.UpdatedBy)?"":inventoryInfo.UpdatedBy) };
     return(paramArray);
 }
Exemplo n.º 16
0
 void Awake()
 {
     instance   = this;
     tween      = GetComponent <TweenPosition>();
     equipment  = transform.Find("equipment_info/equipment_bg").GetComponent <EquipmentInfo>();
     inventory  = transform.Find("inventory_info/inventory_bg").GetComponent <InventoryInfo>();
     priceLabel = transform.Find("inventory/price_bg/price").GetComponent <UILabel>();
     sellBtn    = transform.Find("inventory/sell_btn").GetComponent <UIButton>();
     closeBtn   = transform.Find("close_btn").GetComponent <UIButton>();
 }
Exemplo n.º 17
0
 public void LocalStart()
 {
     gameManager = GameManager.instance;
     inventory   = gameManager.player.GetComponent <PlayerController>().inventory;
     for (int i = 0; i < inventorySlotsParent.childCount; i++)
     {
         inventorySlots[i] = inventorySlotsParent.GetChild(i);
     }
     DisplayUpdate();
 }
Exemplo n.º 18
0
        // 2019/9/25
        // 新版本。根据 InventoryInfo 获得标签详细信息
        // result.Value
        //      -1
        //      0
        public GetTagInfoResult GetTagInfo(string reader_name,
                                           InventoryInfo info)
        {
            if (Program.MainForm.ErrorState != "normal")
            {
                return new GetTagInfoResult
                       {
                           Value     = -1,
                           ErrorInfo = $"{Program.MainForm.ErrorStateInfo}",
                           ErrorCode = $"state:{Program.MainForm.ErrorState}"
                       }
            }
            ;

            List <GetTagInfoResult> errors = new List <GetTagInfoResult>();

            foreach (Reader reader in Program.Rfid.Readers)
            {
                if (Reader.MatchReaderName(reader_name, reader.Name, out string antenna_list) == false)
                {
                    continue;
                }

                // result.Value
                //      -1
                //      0
                GetTagInfoResult result0 = Program.Rfid.GetTagInfo(reader.Name, info);

                // 继续尝试往后寻找
                if (result0.Value == -1
                    // && result0.ErrorCode == "errorFromReader=4"
                    )
                {
                    errors.Add(result0);
                    continue;
                }

                if (result0.Value == -1)
                {
                    return(result0);
                }

                // found
                return(result0);
            }

            if (errors.Count > 0)
            {
                return(errors[0]);
            }

            return(new GetTagInfoResult {
                ErrorCode = "notFoundReader"
            });
        }
Exemplo n.º 19
0
        public static void ModifyQuantity(InventoryEntity inventory)
        {
            //库存更新
            InventoryRepository mr         = new InventoryRepository();
            InventoryInfo       inventinfo = new InventoryInfo();

            inventinfo.Quantity    = inventory.Quantity;//仓库库存减去订单明细中出库库存
            inventinfo.InventoryID = inventory.InventoryID;
            inventinfo.ChangeDate  = DateTime.Now;
            mr.ModifyInventoryQuantity(inventinfo);
        }
Exemplo n.º 20
0
        /// <summary>
        /// 盘点使用 更新库存状态
        /// </summary>
        /// <param name="InventoryID"></param>
        /// <param name="isLock">T/F</param>
        /// <param name="InventoryStatus">库存状态(盘点中)</param>
        /// <returns></returns>
        public static bool ModifyInventoryStatus(int InventoryID, string isLock, string InventoryStatus)
        {
            InventoryRepository mr   = new InventoryRepository();
            InventoryInfo       info = new InventoryInfo();

            info.InventoryID     = InventoryID;
            info.IsLock          = isLock;
            info.InventoryStatus = isLock;
            info.ChangeDate      = DateTime.Now;
            return(mr.ModifyInventoryStatus(info) > 0);
        }
Exemplo n.º 21
0
        /// <summary>
        /// 新增一条Inventory记录
        /// </summary>
        /// <param name="inventory">Inventory对象</param>
        /// <param name="whLoginID">要查询的仓库的前缀</param>
        /// <returns>执行新增对数据库影响的行数</returns>
        public int InsertInventory(InventoryInfo inventoryInfo)
        {
            int result = 0;

            SqlParameter[] paras = Set_Inventory_Parameters(inventoryInfo);
            if (paras != null)
            {
                result = DBHelper.ExecuteNonQuery(CommandType.Text, SQL_INSERT_INVENTORY, paras);
            }
            return(result);
        }
Exemplo n.º 22
0
        /// <summary>
        /// 更新一条Inventory记录
        /// </summary>
        /// <param name="db">DataBase对象</param>
        /// <param name="tran">一个有效的DbTransaction</param>
        /// <param name="inventory">Inventory对象</param>
        /// <param name="whLoginID">要查询的仓库的前缀</param>
        /// <returns>执行更新对数据库影响的行数</returns>
        public int UpdateInventory(Database db, DbTransaction tran, InventoryInfo inventoryInfo)
        {
            int result = 0;

            SqlParameter[] paras = Set_Inventory_Parameters(inventoryInfo);
            if (paras != null)
            {
                result += DBHelper.ExecuteNonQuery(db, tran, CommandType.Text, SQL_UPDATE_INVENTORY, paras);
            }
            return(result);
        }
Exemplo n.º 23
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);

            Back.Draw(spriteBatch);

            InventoryInfo.Draw(spriteBatch);
            CraftingInfo.Draw(spriteBatch);

            SceneManager.mapScene.ThePlayer.DrawInventory(spriteBatch);
        }
Exemplo n.º 24
0
 public ActionResult Edit(InventoryInfo inventoryInfo)
 {
     if (inventoryInfo.ID == 0)
     {
         return(Insert(inventoryInfo));
     }
     else
     {
         return(Update(inventoryInfo));
     }
 }
Exemplo n.º 25
0
    public virtual InventoryInfo Remove(int slot)
    {
        if (slot < 0 || slot >= size)
        {
            return(new InventoryInfo(null, 0));
        }
        InventoryInfo temp = itemList[slot];

        itemList[slot] = new InventoryInfo(null, 0);
        return(temp);
    }
Exemplo n.º 26
0
        private void lvPurchas_DoubleClick(object sender, EventArgs e)
        {
            if (this.lvPurchas.SelectedItems == null || this.lvPurchas.SelectedItems.Count == 0)
            {
                return;
            }
            InventoryInfo o = new InventoryInfo(ModeType.Purchas,
                                                Convert.ToInt32(this.lvPurchas.SelectedItems[0].Tag.ToString()), m_SystemUser);

            o.ShowDialog(this.ParentForm);
        }
Exemplo n.º 27
0
        public static int insertInventory(List <ImportInventoryEntity> list, long operatorID)
        {
            int count = 0;
            InventoryRepository mr = new InventoryRepository();

            if (list != null && list.Count > 0)
            {
                List <InventoryInfo> listInv = new List <InventoryInfo>();
                foreach (ImportInventoryEntity entity in list)
                {
                    InventoryInfo info = new InventoryInfo();
                    if (entity != null)
                    {
                        count++;
                        //List<GoodsEntity> listGoods = GoodsService.GetGoodsByRule(entity.GoodsNo, -1);
                        //GoodsEntity entityGood = listGoods != null && listGoods.Count > 0 ? listGoods[0] : null;
                        List <StorageEntity> listStorage   = StorageService.GetStorageByRule(entity.StorageName, -1);
                        StorageEntity        entityStorage = listStorage != null && listStorage.Count > 0 ? listStorage[0] : null;

                        List <CustomerEntity> listCustomer   = CustomerService.GetCustomerByRule(entity.CustomerName, -1);
                        CustomerEntity        entityCustomer = listCustomer != null && listCustomer.Count > 0 ? listCustomer[0] : null;
                        info.GoodsID       = entity.GoodsID;
                        info.StorageID     = entityStorage != null ? entityStorage.StorageID : 0;
                        info.Quantity      = entity.Quantity.ToInt(0);
                        info.CustomerID    = entityCustomer != null ? entityCustomer.CustomerID : 0;
                        info.InventoryType = Common.InventoryType.入库.ToString();
                        info.BatchNumber   = entity.BatchNumber;
                        info.ProductDate   = DateTime.Parse(entity.ProductDate);
                        info.InventoryDate = DateTime.Now;
                        info.UnitPrice     = 0;
                        info.Remark        = "库存导入";
                        info.OperatorID    = operatorID;
                        info.CreateDate    = DateTime.Now;
                        info.ChangeDate    = DateTime.Now;
                        listInv.Add(info);
                    }
                }
                //生成入库单
                InventoryExecOrder orderExec = OrderService.CreateOrderByInventory(listInv);

                if (listInv != null && listInv.Count > 0)
                {
                    foreach (InventoryInfo info in listInv)
                    {
                        //插入库存
                        info.InventoryID = mr.CreateNew(info);
                        //库存明细保存
                        CreateInventoryDetail(info, orderExec, info.StorageID, info.InventoryDate, operatorID);
                    }
                }
            }
            return(count);
        }
Exemplo n.º 28
0
    //# INVENTORY

    public void sendInventory(Inventory invetory)
    {
        con = connectionToServer;
        //con.RegisterHandler (PacketTypes.SAVE_INVENTORY, OnSaveInventory);
        InventoryInfo msg = new InventoryInfo();

        msg.id = this.gameObject.GetComponent <NetworkIdentity> ().netId;
        Item[] items = invetory.getItems();
        msg.items = invetory.itemsToArray(items);
        msg.name  = player.playerName;
        con.Send(PacketTypes.SAVE_INVENTORY, msg);
    }
Exemplo n.º 29
0
 public InventoryInfoViewModel(InventoryInfo inventoryInfo)
 {
     this.inventoryInfo = inventoryInfo;
     if (this.inventoryInfo.Product == null)
     {
         throw new ArgumentNullException("inventoryInfo.Product", "The inventoryInfo's Product object is null");
     }
     else
     {
         this.product = new ProductViewModel() { Id = this.inventoryInfo.Product.Id, Name = this.inventoryInfo.Product.Name };
     }
 }
Exemplo n.º 30
0
        private void itemInfoAdd()
        {
            #region 判斷
            string msg = "";
            if (string.IsNullOrEmpty(serno))
            {
                msg = "請選取進貨單!";
            }
            else if (string.IsNullOrEmpty(txtExportAmount.Text))
            {
                msg = "請輸入出貨金額";
            }
            else if (!int.TryParse(txtExportAmount.Text, out int n))
            {
                msg = "出貨金額欄位請輸入數字";
            }
            else if (dpkExportDTTM.Value < dpkImportDTTM.Value)
            {
                msg = "出貨日期無法小於進貨日期!";
            }


            //條碼不行重複!!!!
            InventoryInfo view = new InventoryInfo(APConfig.Conn);
            view.Conditions  = " 1=1 ";
            view.Conditions += " AND " + view.getCondition(InventoryInfo.ncConditions.status.ToString(), InventoryStatus.已出貨.ToString());
            view.Conditions += " AND " + view.getCondition(InventoryInfo.ncConditions.code.ToString(), txtCode.Text);
            if (view.calculateCount() > 0)
            {
                msg = "該條碼已經被使用!";
            }

            foreach (DataGridViewRow row in dgvItem.Rows)
            {
                if (txtCode.Text == row.Cells["dgvItem_Code"].Value.ToString())
                {
                    msg = "該條碼已經被使用!";
                    break;
                }
            }


            if (!string.IsNullOrEmpty(msg))
            {
                APConfig.SweetAlert(ShowBoxType.alert, msg);
                return;
            }
            #endregion
            DataGridViewRowCollection rows = dgvItem.Rows;
            rows.Add(new Object[] { serno, txtCode.Text, txtName.Text, txtImportAmount.Text, txtExportAmount.Text, ddlDealer.SelectedItem.ToString(), dpkExportDTTM.Value.ToShortDateString(), txtExportComment.Text });
            clearTextBox();
            loadTotalAmount();
        }
Exemplo n.º 31
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="StorageID">仓库ID</param>
        /// <param name="inventoryDate">出入库时间</param>
        /// <param name="json">出入库明细数据</param>
        /// <param name="OperatorID">操作员ID</param>
        /// <param name="type">In/Out</param>
        /// <returns></returns>
        public static bool ModifyInventory(int StorageID, string inventoryDate, int needCount, string json, long OperatorID, string tempType, OperatorType type)
        {
            try
            {
                InvGoodsEntity jsonInfo = null;
                if (!string.IsNullOrEmpty(json))
                {
                    try
                    {
                        jsonInfo = (InvGoodsEntity)JsonHelper.FromJson(json, typeof(InvGoodsEntity));
                    }
                    catch (Exception ex)
                    {
                        string str = ex.ToString();
                    }
                }
                List <InventoryInfo> listInv = new List <InventoryInfo>();
                if (jsonInfo != null && jsonInfo.listGoods != null && jsonInfo.listGoods.Count > 0)
                {
                    foreach (InvGoodsDetailEntity entity in jsonInfo.listGoods)
                    {
                        InventoryInfo info = new InventoryInfo();
                        if (entity != null)
                        {
                            info.GoodsID       = entity.GoodsID;
                            info.StorageID     = StorageID;
                            info.Quantity      = entity.Quantity;
                            info.CustomerID    = entity.CustomerID;
                            info.InventoryType = type == OperatorType.IN ? Common.InventoryType.入库.ToString() : Common.InventoryType.出库.ToString();
                            info.BatchNumber   = entity.BatchNumber.Trim();
                            info.ProductDate   = DateTime.Parse(entity.ProductDate);
                            info.InventoryDate = DateTime.Parse(inventoryDate);
                            info.UnitPrice     = entity.UnitPrice;
                            info.Remark        = entity.Remark;
                            info.OperatorID    = OperatorID;
                            info.CreateDate    = DateTime.Now;
                            info.ChangeDate    = DateTime.Now;
                            listInv.Add(info);
                        }
                    }


                    InventoryProcess(listInv, tempType, StorageID, inventoryDate, OperatorID);
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteErrorLog("入库保存异常", ex.ToString());
                return(false);
            }
            return(true);
        }
Exemplo n.º 32
0
		public CsvProduct()
		{
			SeoInfos = new List<SeoInfo>();
			Reviews = new List<EditorialReview>();
			PropertyValues = new List<PropertyValue>();
			Images = new List<Image>();
			Assets = new List<Asset>();


			Price = new Price() { Currency = CurrencyCodes.USD };
			Inventory = new InventoryInfo();
			EditorialReview = new EditorialReview();
			Reviews = new List<EditorialReview>();
			Reviews.Add(EditorialReview);
			SeoInfo = new SeoInfo();
			SeoInfos = new List<SeoInfo>();
			SeoInfos.Add(SeoInfo);
		}
Exemplo n.º 33
0
		public CsvProduct()
		{
			SeoInfos = new List<SeoInfo>();
			Reviews = new List<EditorialReview>();
			PropertyValues = new List<PropertyValue>();
			Images = new List<Image>();
			Assets = new List<Asset>();


			Price = new Price() { Currency = "USD" };
			Inventory = new InventoryInfo();
			EditorialReview = new EditorialReview();
			Reviews = new List<EditorialReview>();
			Reviews.Add(EditorialReview);
			SeoInfo = new SeoInfo() { ObjectType = typeof(CatalogProduct).Name };
			SeoInfos = new List<SeoInfo>();
			SeoInfos.Add(SeoInfo);
		}
Exemplo n.º 34
0
		public CsvProduct(CatalogProduct product, IBlobUrlResolver blobUrlResolver, Price price, InventoryInfo inventory)
			: this()
		{
			_blobUrlResolver = blobUrlResolver;

			this.InjectFrom(product);
			PropertyValues = product.PropertyValues;
			Images = product.Images;
			Assets = product.Assets;
			Links = product.Links;
			Variations = product.Variations;
			SeoInfos = product.SeoInfos;
			Reviews = product.Reviews;
			Associations = product.Associations;
			if (price != null)
			{
				Price = price;
			}
			if (inventory != null)
			{
				Inventory = inventory;
			}
		
		}
Exemplo n.º 35
0
        public List<StoreWithInventory> GetInventoriesWithRequest(InventoryRequest request)
        {
            List<StoreWithInventory> result = new List<StoreWithInventory>();
            // The result dictionary - key is the store ID, value is the store
            Dictionary<int, StoreWithInventory> resultStores = new Dictionary<int, StoreWithInventory>();

            using (traceManager.StartTrace("General"))
            {
                var userEntity = this.GetUserEntity();
                var productsToFind = request.GetProductIdsToFind(userEntity);

                // Get the results from the LCBO website
                List<LcboInventoryData2> lcboInventory = this.lcboService.RetrieveMatches(productsToFind);

                // Detect new and changed stores
                this.DetectNewAndChangedStores(lcboService, lcboInventory);

                // Get the store Ids
                var storeids = request.GetStoreNumbersToFind(this.domainContext, userEntity);

                //TODO: filter by store/product selection

                Dictionary<int, ProductListItem> productDictionary = new Dictionary<int, ProductListItem>();

                // The LCBO results filtered by the stores in the request
                var lcboInventoriesFiltered = from l in lcboInventory where storeids.Contains(l.StoreNumber) select l;

                foreach (var lcboInventoryItem in lcboInventoriesFiltered)
                {
                    StoreWithInventory currentStoreWithInventory;
                    if (resultStores.ContainsKey(lcboInventoryItem.StoreNumber))
                    {
                        // The current store is in the result dictionary, so set currentStore to it.
                        currentStoreWithInventory = resultStores[lcboInventoryItem.StoreNumber];
                    }
                    else
                    {
                        // The current store is not in the result dictionary.
                        // Set currentStore to be a new store
                        var Store = this.domainContext.Stores.Single(s => s.Id == lcboInventoryItem.StoreNumber);
                        var store = new InvStore()
                        {
                            Address = Store.Address,
                            City = Store.City,
                            Hours = Store.Hours,
                            Latitude = Store.Latitude,
                            Longitude = Store.Longitude,
                            StoreNumber = Store.Id
                        };

                        currentStoreWithInventory = new StoreWithInventory() { Store = store };
                        resultStores.Add(lcboInventoryItem.StoreNumber, currentStoreWithInventory);
                    }

                    // Inventory.CreateInventory(lcboInventoryItem.StoreNumber, lcboInventoryItem.ProductId);
                    // Set its level to that of the lcbo result value
                    ProductListItem productsVm = null;
                    if (productDictionary.ContainsKey(lcboInventoryItem.ProductId))
                    {
                        // Current product ID is in the dictionary, so set currentProduct to it
                        productsVm = productDictionary[lcboInventoryItem.ProductId];
                    }
                    else
                    {
                        // Current product ID is not in the dictionary
                        var product = this.domainContext.Products.Where(p => p.Id == lcboInventoryItem.ProductId).Include("Substance").Include("Container").First();
                        productsVm = new ProductListItem() { Name = product.Name };
                        productDictionary.Add(lcboInventoryItem.ProductId, productsVm);
                    }

                    // Create an inventory item
                    InventoryInfo currentInventory = new InventoryInfo
                    {
                        NumberInStock = lcboInventoryItem.NumberInStock,
                        Product = productsVm
                    };

                    // Set the current inventory's product to a new product based on the current product
                    // Attach the inventory item to the current store.  So we have Store.Inventory.Product and Store.Inventory.InventoryLevel.
                    currentStoreWithInventory.Inventory.Add(currentInventory);
                }

            }

            result = new List<StoreWithInventory>(resultStores.Values);

            return result;
        }