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 ...
随机推荐
- 【原创】大叔经验分享(21)yarn中查看每个应用实时占用的内存和cpu资源
在yarn中的application详情页面 http://resourcemanager/cluster/app/$applicationId 或者通过application命令 yarn appl ...
- maven无法下依赖jar文件的解决方案
问题描述: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be ...
- 将LibreOffice文档转换为豆瓣日记
豆瓣日记的编辑器一直以来都只支持纯文本的,因此无法将原先在LibreOffice中写的带有简单格式的文章导出.由于我在豆瓣主要写一些随笔性的内容,所以它们在LibreOffice中排版时也并未用到什么 ...
- matplotlib坐标轴刻度-【老鱼学matplotlib】
本节主要讲述如何对坐标轴的刻度字体大小以及背景色进行修改. 例如: import numpy as np import pandas as pd import matplotlib.pyplot as ...
- vuejs2.0如何获取dom元素自定义属性值
1.设置定义属性值 :data-value=".." <ul class="header-ul"> <li class="flex ...
- windows server 简化设置
win2012任务管理器显示磁盘管理员运行命令提示符,diskperf -y 不要开机密码 运行 netplwiz 勾去掉 运行 gpedit.msc 计算机设置-Windows设置 -安全设置-帐户 ...
- Java Web 禁用Cookie对Session的影响
如果客户端禁用了Cookie,那么服务端就不能得到Session了.因为通过Session ID来确定当前会话对应的服务端Session,而Session ID通过Cookie来传递,所以禁用Cook ...
- HtmlHelper使用示例
在使用Razor时,有时想要在页面内知道对象的完整信息,或服务器的详细信息,可以通过HtmlHelper. 具体使用示例如下: <div>测试一: @ServerInfo.GetHtml( ...
- 搭建自己的Webpack项目
五,搭建自己的Webpack项目 https://www.jianshu.com/p/42e11515c10f
- 小甲鱼Python第二十一讲课后习题
测试题: 0. 递归在编程上的形式是如何表现的呢? 在编程上,递归表现为函数调用本身这么一个行为. 1. 递归必须满足哪两个基本条件? 一. 函数调用自身二. 设置了正 ...