ERP仓库管理系统(九)
ERP仓库管理系统(九)
需求分析:
1.设计库房表,至少包括两个字段,库房名称,库房所属公司的ID(在客户资质审批表中找到对应公司的ID)
2.设计增、删、改、查一套程序,其中的删除要做限制,只要有库存数据存在则不允许删除对应库房的记录。
3.库房管理权限为高级权限,程序开发开始后,到配一个新的权限值。
新增的原理:
仓库管理员的新增和修改:
ALTER PROCEDURE [dbo].[BioErpStockUsers_ADD]@StockID int,@UserID int AS INSERT INTO [BioErpStockUsers]( [StockID],[UserID] )VALUES( @StockID,@UserID )
ALTER PROCEDURE [dbo].[BioErpStockUsers_Update]@ID int,@StockID int,@UserID int AS UPDATE [BioErpStockUsers] SET [StockID] = @StockID,[UserID] = @UserID WHERE ID=@ID
仓库信息的新增和修改存储过程:
--修改:删除了LeaderUserID字段,新增加@ID输出参数------------------------------------ALTER PROCEDURE [dbo].[BioErpStockTable_ADD]--输出的参数@ID int output,@StockName nvarchar(80),@FarhterCompany int,@StockAddress nvarchar(100),@IsDel bit AS INSERT INTO [BioErpStockTable]( [StockName],[FarhterCompany],[StockAddress],[IsDel] )VALUES( @StockName,@FarhterCompany,@StockAddress,@IsDel ) --赋值 @@为全局变量 获取当前表的最大表示列(与下面的是等效的) SET @ID=@@IDENTITY-- SELECT @ID=MAX(ID) FROM BioErpStockTable
修改的存储过程:
ALTER PROCEDURE [dbo].[BioErpStockTable_Update]@ID int,@StockName nvarchar(80),@FarhterCompany int,@StockAddress nvarchar(100),@IsDel bit AS UPDATE [BioErpStockTable] SET [StockName] = @StockName,[FarhterCompany] = @FarhterCompany,[StockAddress] = @StockAddress,[IsDel] = @IsDel WHERE ID=@ID
实现的效果图:
前台界面:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="StockAdd.aspx.cs" Inherits="BioErpWeb.StockSystem.StockAdd" %><%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>