⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 save_outward.asp

📁 1.多种查询方式
💻 ASP
字号:
<%@ LANGUAGE="VBSCRIPT" %>
<%const title="确认数据"%>
<% 
response.buffer=true
Response.Expires = 0
Response.CacheControl = "Private" 
%>
<!-- #include file=../data/username.inc-->
<!-- #include file=../data/connect.asp-->
<!--#include file=../data/myPrg.asp-->
<head>
<meta http-equiv="Content-Type"content="text/html; charset=gb_2312-80">
<title><%=title%></title>
<link rel="stylesheet" type="text/css" href="../data/forum.css">
</head>
<body topmargin=0>
<%
newcompanyid = request("companyid")
if newcompanyid = "" then
	call closedatabase
	Response.Write "<script language=javascript>"
	Response.Write "alert(""请先选择公司再做此步操作!"");"
	Response.write "history.go(-1);"
	Response.Write "</script>"
	Response.End
elseif not isnumeric(newcompanyid) then
	call closedatabase
	Response.Write "<script language=javascript>"
	Response.Write "alert(""companyid必须为整数!"");history.go(-1);"
	Response.Write "</script>"
	Response.End
else
	newcompanyid = cint(newcompanyid)  
end if
inve_last_date = now()
arra = split(session("username"),";")
UserCompanyid = arra(0)
flag = arra(1)
User = arra(2)
userno = arra(4)
if flag > 4 then
	call closedatabase
	Response.End 
end if
msg=""

dc_id = request("dc_id")
dc_id = replace(dc_id,"'","")
prod_id = request("smalllocation")
prod_id = replace(prod_id,"'","")
'出库数量outw_no
outw_no = trim(Request.Form("outw_no"))

sql = "select inve_id,inve_maysent,inve_total from inventory where inve_dc_id = "&dc_id&" and inve_prod_id = "&prod_id&" and inve_disabled = 0 and inve_companyid = "&newcompanyid&""
'Response.Write sql
'Response.End 
set rs_inve = conn.execute(sql)
if not rs_inve.eof then
	id = rs_inve("inve_id")
	inve_maysent = rs_inve("inve_maysent")
	inve_total = rs_inve("inve_total")
	'response.write inve_total
	'response.end
	
'填写日期outw_date,日期consign_date,时间consign_time
'SRA号outw_sra,出库方式outw_type
'目的地outw_where,takeman_id,时限要求yuji_time
'出库摘要outw_beizu
outw_date = trim(Request.Form("outw_date"))
consign_date = trim(Request.Form("consign_date"))
consign_time = trim(Request.Form("consign_time"))
outw_sra = trim(Request.Form("outw_sra"))
outw_sra = replace(outw_sra,"'","’")
outw_type = request("outw_type")
outw_where = trim(Request.Form("outw_where"))
takeman_id = trim(Request.Form("takeman_id"))
takeman_id = replace(takeman_id,"'","’")
guest_code=Request.Form("guest_code")
guest_code = replace(guest_code,"'","’")
yuji_time = trim("2006-6-6 18:18")
outw_beizu = trim(Request("outw_beizu"))
outw_beizu = replace(outw_beizu,"'","’")

direct = request("direct")
'if isnumeric(direct) then
if direct = 1 then
		direct = 1 		
		inwa_take_address = Request.Cookies("take_address")
		inwa_line_no = trim(Request.Cookies("line_no"))
		if inwa_line_no = "" then inwa_line_no = " "
		inwa_take_no = trim(Request.Cookies("take_no"))
		if inwa_take_no = "" then inwa_take_no = " "
else
		direct = 0
		inwa_take_address = " "
		inwa_line_no = " "
		inwa_take_no = " "
end if
if cint(direct) = 0 then
	if clng(inve_maysent) <= 0 then
		rs_inve.close
		set rs_inve = nothing
		call closedatabase
		Response.Write "<script language=javascript>"
		response.write "alert(""现在的总库存是 " & inve_total & " ,\n可分发数量是" & inve_maysent & " ,\n由于可分发数量不大于0 \n所以你不能做该产品的出库操作!"");"
		response.write "history.back();"
		response.write "</script>"
		response.end
	end if
	if (clng(outw_no) > clng(inve_maysent)) then
		rs_inve.close
		set rs_inve = nothing
		call closedatabase
		Response.Write "<script language=javascript>"
		response.write "alert(""现在的总库存是 " & inve_total & " \n可分发数量是 " & inve_maysent & " \n出库数量是" & outw_no & "\n由于出库数量大与可分发数量!\n所以你不能做该产品的出库操作!"");"
		response.write "history.back();"
		response.write "</script>"
		response.end
		'msg = msg + "出库数量不得大与可分发数量!<br>"
	end if 
end if
if outw_where  = 0 then
		msg = msg + "请选择领货人!<br>"
	end if
if msg<>"" then
rs_inve.close
set rs_inve = nothing
call closedatabase
 showerror(msg)
 Response.End 
 else

'将相应的日期格式转换成正确的日期格式
'并且将信息写入到cookies中以便用户在下次录入时不必输入
if outw_date = "" then outw_date = now()
if outw_yuji_time = "" then outw_yuji_time = now()
outw_date = replace(outw_date,":",":")
consign_date = replace(consign_date,":",":")
consign_time = replace(consign_time,":",":")
yuji_time = replace(yuji_time,":",":")
prod_flag = request("biglocation")
Response.Cookies("prod_flag") = prod_flag
Response.Cookies("dc_id") = dc_id
Response.Cookies("prod_id") = prod_id
Response.Cookies("outw_date") = outw_date
Response.Cookies("consign_date") = consign_date
Response.Cookies("consign_time") = consign_time
Response.Cookies("outw_sra") = outw_sra
Response.Cookies("info_type") = outw_type
Response.Cookies("outw_where") = outw_where
Response.Cookies("takeman_id") = takeman_id
Response.Cookies("yuji_time") = yuji_time
consign_datetime = consign_date&" "&consign_time
if takeman_id = "" then takeman_id = " "
if outw_beizu = "" then outw_beizu = " "
if trim(session("username")) = "" then
	rs_inve.close
	set rs_inve = nothing
	call closedatabase
	Response.Redirect "../user/defaut.asp"
	Response.End 
end if
'开始事务处理
'-------------
	set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from guest where guest_code='"&guest_code&"'", conn, 1, 3
if not rs.eof then
guest_id=rs("guest_id")
end if
rs.close
set rs=nothing
sql ="select * from outward where outw_sra = '"&outw_sra&"' and outw_companyid = "&newcompanyid&""
set rs_flag = conn.execute(sql)
if rs_flag.eof then

	
	set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from outward", conn, 1, 3
rs.AddNew
rs("outw_date")=outw_date
rs("outw_fact_date")=consign_date
rs("outw_sra")=outw_sra
rs("outw_dc_id")=dc_id
rs("outw_consign_date")=consign_datetime
rs("outw_take_address")=inwa_take_address
rs("outw_line_no")=inwa_line_no
rs("outw_take_no")=outw_no
rs("outw_service_man")=User
rs("outw_service_beizu")=outw_beizu
rs("outw_flag")=outw_flag
rs("outw_companyid")=newcompanyid
rs("outw_disabled")=0
rs("outw_dir_flag")=0
rs("attemper_flag")=0
rs("tiaoma_flag")=0
rs("stock_flag")=0
rs("cull_flag")=0
outwardid = rs("outw_id")
rs.Update
rs.close
	sql = "insert into outward_detail(detail_outw_id,detail_guest_id,detail_prod_id,detail_no,detail_companyid,detail_date,detail_man,detail_io_flag) values("&outwardid&","&guest_id&","&prod_id&","&outw_no&","&newcompanyid&",'"&outw_date&"','"&User&"',0)"
conn.execute(sql)
	set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from outward_detail where detail_outw_id="&outwardid&"", conn, 1, 3
if not rs.eof then 
detail_id=rs("detail_id")
end if
rs.close
set rs=nothing

'sql = "insert into detail_info(info_outw_id,info_takeman_id,info_yuji_time,info_order_beizu,info_order_man,info_detail_id) values("&outwardid&","&takeman_id&","&yuji_time&","&outw_beizu&",'"&user&"',"&detail_id&")"
'conn.execute(sql)
	set rs_info=server.CreateObject("adodb.recordset")
rs_info.Open "select * from detail_info", conn, 1, 3
rs_info.AddNew
rs_info("info_outw_id")=outwardid
rs_info("info_takeman_id")=takeman_id
rs_info("info_yuji_time")=yuji_time
rs_info("info_order_beizu")=outw_beizu
rs_info("info_order_man")=user
rs_info("info_detail_id")=detail_id
rs_info.Update
rs_info.close
if outw_flag = 0 then 'o为等待
   sql = "update inventory set inve_fenpei = inve_fenpei + " & outw_no & ",inve_last_date = '" & inve_last_date &"' where inve_dc_id = "&dc_id&" and inve_prod_id = "&prod_id&" and inve_companyid = "&newcompanyid&" and inve_disabled = 0"
   conn.execute(sql) 

'lseif inwa_flag = 1 then
'   sql = "update inventory set inve_ruku = inve_ruku + " & inwa_rec_no & ",inve_maysent = inve_maysent + " & inwa_rec_no & ",inve_total = inve_total +"&inwa_rec_no&",inve_last_date = '"&inve_last_date & "' where  inve_dc_id = "&dc_id&" and inve_prod_id = "&prod_id&" and inve_companyid = "&newcompanyid&" and inve_disabled = 0 "
'   conn.execute(sql)
end if
'结束事务处理
'update语句-----更新"已分配数量"数据
			if err.number <> 0 then
				rs_flag.close
				set rs_flag = nothing
				rs_inve.close
				set rs_inve = nothing
				call closedatabase
				response.write "<p>无法保存,数据库操作出错:" + err.description + "</p>"
				Response.Write "<p>请稍后再试!</p>"
				Response.End 
			end if
				rs_flag.close
				set rs_flag = nothing
				rs_inve.close
				set rs_inve = nothing
				call closedatabase
	Response.Write "<script language=javascript>"
	Response.Write "var myTime = new Date(); "
	Response.Write "var timeNow = myTime.getTime();"
	Response.Write "{if (confirm(""数据已确认,继续进行该笔单子的出库操作吗?""))"
	
	if direct = 0 then
		Response.Write "window.location ='outward_2.asp?id="&outwardid&"&companyid="&newcompanyid&"&inward_second=yes&tt='+timeNow;"
	elseif direct = 1 then
		Response.Write "window.location ='outward_2.asp?id="&outwardid&"&companyid="&newcompanyid&"&inward_second=yes&direct=1&tt='+timeNow;"
	end if
	Response.Write "else "
	Response.Write "{"
	Response.Write "window.location ='outward.asp?companyid="&newcompanyid&"&tt='+timeNow;"
	Response.Write "}"
	Response.Write "}"
	Response.Write "</script>"
	Response.End 
else
	outwardid = rs_flag("outw_id")
	cull_flag = rs_flag("cull_flag")
	rs_flag.close
	set rs_flag = nothing
	rs_inve.close
	set rs_inve = nothing
	call closedatabase
	if cull_flag = True then
		Response.Write "<script language=javascript>"
		Response.Write "alert(""由于该SRA的操作已完成,所以你不能进行派送操作!\n\n请在派送通知里填入其它的SRA号码进行操作!"");"
		Response.Write "history.back();"
		Response.Write "</script>"
		Response.End 
	end if
	Response.Write "<script language=javascript>"
	Response.Write "var myTime = new Date(); "
	Response.Write "var timeNow = myTime.getTime();"
	Response.Write "{if (confirm(""该SRA号码已存在,将该笔单子追加到以前的入库操作记录中吗?""))"
	Response.Write "window.location ='outward_2.asp?id="&outwardid&"&companyid="&newcompanyid&"&database=yes&inward_second=yes&tt='+timeNow;"
	Response.Write "else "
	Response.Write "{alert(""注意:系统中已有该SRA号码,请修改,以便将其录入到系统中!!!"");"
	Response.Write "history.go(-1);}"
	Response.Write "}"
	Response.Write "</script>"	
	Response.End 
end if

end if
else
	Response.Write "您没有权限对这个数据进行操作<br>"
	Response.Write "想要更多操作,请与管理员联系<br>"
	Response.Write "该产品可能尚未进行初始化!<br>"
	Response.Write "<a href=javascript:history.go(-1);>后退</a>"
end if
rs_inve.close
set rs_inve = nothing
call closedatabase
%>
<!--#include file=../data/copyright.asp-->

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -