Init wms goodlocation data
insert goodlocation:
CREATE PROCEDURE [dbo].[sp_insert_goodlocation]
-- Add the parameters for the stored procedure here
@the_plattoon int,
@the_column int,
@the_floor int
AS
begin try
begin tran
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON; declare @count int
declare @cargo_space_id varchar()
declare @storagenum varchar() --仓库代码
declare @localnum varchar() --库区代码
declare @goodlocationname varchar() --货位名称
declare @goodlocationtype varchar() --货位类型
declare @goodlocationnum varchar() --货位代码
declare @roadway_num varchar()
declare @cargo_area_id varchar()
declare @cargo_space_name varchar()
begin
--取得仓库代码
SELECT @storagenum=F_StorageNum FROM [dbo].[Sys_Storage]
--取得库区代码
select @localnum=F_LocalNum from Sys_Location where F_StorageNum=@storagenum
--取得货位名称
select @goodlocationname=concat(right(cast(''+rtrim(@the_plattoon) as varchar()),),'排',right(cast(''+rtrim(@the_column) as varchar()),),'列',right(cast(''+rtrim(@the_floor) as varchar()),),'层')
--取得巷道代码
select @roadway_num=cast(round(cast(cast(@the_plattoon as decimal(,))/ as decimal(,)),) as int)
--判断该条记录是否已存在
select @count=count(*) from [dbo].[Sys_GoodLocation] where F_GoodLocationName=@goodlocationname
--取得货位代码
select @goodlocationnum= concat('',right(cast(''+rtrim(@the_plattoon) as varchar()),),right(cast(''+rtrim(@the_column) as varchar()),),right(cast(''+rtrim(@the_floor) as varchar()),)) --插入语句
if @count=
begin
INSERT INTO [dbo].[Sys_GoodLocation]
([F_GoodLocationNum]
,[F_StorageNum]
,[F_RoadWayNum]
,[F_LocalNum]
,[F_GoodLocationType]
,[F_GoodLocationName]
,[F_Platoon]
,[F_Column]
,[F_Floor]
,[F_Status]
,[F_Locked]
,[F_TrayCode]
,[F_TrayInTime]
,[F_JobId]
,[F_TaskNo]
,[F_JobInTime]
,[F_SortCode]
,[F_DeleteMark]
,[F_EnabledMark]
,[F_Description]
,[F_CreatorTime]
,[F_CreatorUserId]
,[F_LastModifyTime]
,[F_LastModifyUserId]
,[F_DeleteTime]
,[F_DeleteUserId])
VALUES
(@goodlocationnum
,@storagenum
,@roadway_num
,@localnum
,
,@goodlocationname
,@the_plattoon
,@the_column
,@the_floor
,
,'N'
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL)
end
end
END
commit tran
END try
begin catch
rollback tran
end catch
sp_batchinsert_goodlocation:
CREATE PROCEDURE [dbo].[sp_batchinsert_goodlocation]
-- Add the parameters for the stored procedure here
@the_plattoon int,
@the_column int,
@the_floor int
AS
begin try
BEGIN TRANSACTION
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON; declare @initplatoon int
declare @initcolumn int
declare @initfloor int begin
set @initplatoon=
while @initplatoon<=@the_plattoon --循环排
begin
set @initcolumn=
while @initcolumn<=@the_column --循环列
begin
set @initfloor=
while @initfloor<=@the_floor --循环层
begin
print concat(@initplatoon,@initcolumn,@initfloor)
exec [dbo].[sp_insert_goodlocation] @initplatoon,@initcolumn,@initfloor --插入
set @initfloor=@initfloor+
end
set @initcolumn=@initcolumn+
end
set @initplatoon=@initplatoon+
end
end
END
commit tran
END try
begin catch
rollback tran
end catch
Execute:
exec sp_batchinsert_goodlocation ,,
Result:

Init wms goodlocation data的更多相关文章
- Get all static wms goodlocation data
sql function and store process: create function [dbo].[fun_splitin](@c varchar(),@split varchar()) r ...
- JS组件系列——使用HTML标签的data属性初始化JS组件
前言:最近使用bootstrap组件的时候发现一个易用性问题,很多简单的组件初始化都需要在JS里面写很多的初始化代码,比如一个简单的select标签,因为仅仅只是需要从后台获取数据填充到option里 ...
- openwrt_ipsec_racoon.init 分析
racoon.init 脚本分析,基于openwrt 官方的脚本分析 #!/bin/sh /etc/rc.common # 包含了文件, 这个会继续分析 # # Copyright (C) Vital ...
- MVC5 网站开发之八 栏目功能 添加、修改和删除
本次实现栏目的浏览.添加.修改和删除. 栏目一共有三种类型. 常规栏目-可以添加子栏目,也可以添加内容模型.当不选择内容模型时,不能添加内容. 单页栏目-栏目只有一个页面,可以设置视图. 链接栏目-栏 ...
- Linux内核启动过程概述
版权声明:本文原创,转载需声明作者ID和原文链接地址. Hi!大家好,我是CrazyCatJack.今天给大家带来的是Linux内核启动过程概述.希望能够帮助大家更好的理解Linux内核的启动,并且创 ...
- Linux内核配置、编译及Makefile简述
Hi,大家好!我是CrazyCatJack.最近在学习Linux内核的配置.编译及Makefile文件.今天总结一下学习成果,分享给大家^_^ 1.解压缩打补丁 首先是解压缩你获取到的Linux内核. ...
- iOS-集成支付宝支付、微信支付简单总结
支付宝快捷支付: 官方文档中,支付宝说建议我们使用支付时要讲签名过程放在服务器端,这样安全.同时给的demo中签名是在本地移动端做的...不过支付宝的集成还是较简单的. 为了安全签名当然放后台做了.我 ...
- C#进阶系列——一步一步封装自己的HtmlHelper组件:BootstrapHelper(三:附源码)
前言:之前的两篇封装了一些基础的表单组件,这篇继续来封装几个基于bootstrap的其他组件.和上篇不同的是,这篇的有几个组件需要某些js文件的支持. 本文原创地址:http://www.cnblog ...
- iOS开发之使用Runtime给Model类赋值
本篇博客算是给网络缓存打个基础吧,本篇博客先给出简单也是最容易使用的把字典转成实体类的方法,然后在给出如何使用Runtime来给Model实体类赋值.本篇博客会介绍一部分,主要是字典的key与Mode ...
随机推荐
- 006_设置执行命令提示和unset shell function
一.unset不能unset只读变量 问题: [root@zb1-bdwaimai-inf-wfe-28 ~]# source ~/.bash_profile bash: PROMPT_COMMAND ...
- Mysql -- 外键的变种 三种关系
一.介绍 因为有foreign key的约束, 使得两张表形成了三种关系 多对一 多对多 一对一 二.如果找出两张表之间的关系 #.先站在左表的角度去找 是否左表的多条记录可以对应右 ...
- prototype、proto、constructor 之间的关系
- Reveal.js一个用来做WEB演示文稿的框架
reveal.js是一个能够帮助我们很轻易地使用HTML来创建漂亮的演示效果,也就是我们常见的PPT幻灯片.reveal.js不依赖其他任何javascript库,是一个独立的javascript插件 ...
- seata-server安装、运行(ubuntu)
seata-server为seata中的事务协调器. seata的wiki https://github.com/seata/seata/wiki/Home_Chinese 一.下载并安装 wget ...
- C# 集合已修改 可能无法执行枚举操作 zz
今天编写程序时 修改了list集合 在foreach时报 “集合已修改:可能无法执行枚举操作.”错误. 首先想到的是没有锁定集合对象. 增加了 private readonly object sync ...
- [CF566A]Matching Names
[CF566A]Matching Names 题目大意: A组和B组各\(n(n\le10^5)\)个字符串\((\sum|S|\le8\times10^5)\),将它们两两匹配,使得每组两个字符串的 ...
- HTML5_提供的 新功能_less 编译_
HTML5_提供的 新功能 class 操作 ele.classList(注意: 高版本的 IE 都不支持) 获取 <div id="ele" class="... ...
- 07_ for 练习 _ sumOfOdd
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title&g ...
- mobile_轮播图_style_left 版本
mobile 轮播图 小圆点逻辑(排他) 1. 统一给所有 span 元素加 class=""; 2. 切换到谁,谁的 class="active"; 移动端轮 ...