160 lines
4.7 KiB
Plaintext
160 lines
4.7 KiB
Plaintext
<?xml version="1.0" encoding="gb2312"?>
|
|
<%@ page contentType="text/xml; charset=GBK" %>
|
|
<%@ page import="java.util.*"%>
|
|
<%@ page import="com.wxzd.wms.util.ServerUtil"%>
|
|
<%@ page import="com.zcsoft.stock.StockCell"%>
|
|
<%@ page import="com.zcsoft.stock.Instruction"%>
|
|
<%@ page import="com.zcsoft.purview.data.UserInfoData"%>
|
|
<%@ page import="com.zcsoft.dbvisit.DB"%>
|
|
<%@ page import="com.zcsoft.client.*"%>
|
|
<%@ page import="com.usun.web.http.ParameterConvertor"%>
|
|
<jsp:useBean id="db1" scope="application" class="com.zcsoft.dbvisit.DB" />
|
|
<%
|
|
String errorInfo = null, ckkw = null, tpbh = null, zlbh = null, remark = null
|
|
, table = null, field = null, pzbh = null;
|
|
session = request.getSession(false);
|
|
if (session != null && session.getAttribute("userInfo") != null)
|
|
{
|
|
ckkw = request.getParameter("ckkw");
|
|
if (ckkw != null && ckkw.length() == 6)
|
|
{
|
|
try
|
|
{
|
|
tpbh = request.getParameter("tpbh");
|
|
zlbh = request.getParameter("zlbh");
|
|
table = request.getParameter("table");
|
|
field = request.getParameter("field");
|
|
Map kwxx = db1.getSingleRow("SELECT xnkw,zsl,sfwzzl FROM kwjbxx WHERE kwbh=?", ckkw);
|
|
if (kwxx == null)
|
|
{
|
|
throw new IllegalStateException("不存在的库位 " + ckkw);
|
|
}
|
|
if ("1".equals(kwxx.get("xnkw")))
|
|
{
|
|
throw new IllegalStateException("虚拟库位不能出库");
|
|
}
|
|
String zsl = (String)kwxx.get("zsl");
|
|
if ("0".equals(zsl))
|
|
{
|
|
throw new IllegalStateException("目标库位是空库位");
|
|
}
|
|
if ("T".equals(kwxx.get("sfwzzl")))
|
|
{
|
|
//需要自动生成空托盘出库指令
|
|
UserInfoData uid = (UserInfoData)session.getAttribute("userInfo");
|
|
String czr = uid.getYhm();
|
|
if (zlbh == null || zlbh.length() == 0 || "0".equals(zlbh))
|
|
{
|
|
zlbh = ServerUtil.nextInstNo(db1, 1).toString();
|
|
}
|
|
table = "qtzl";
|
|
field = "zt";
|
|
|
|
String insertStmt = DB.prepareInsertStmt(table
|
|
, new String[]{"zlbh", "lx", "ckdm", "kwbh", "tpbh", "sl", "ykcs", "czr"});
|
|
Object[] fieldsValue = new Object[]{zlbh, "0", "LTCK", ckkw, tpbh, zsl, zsl, czr};
|
|
|
|
db1.preparedUpdate(insertStmt, fieldsValue, false);
|
|
}
|
|
remark = request.getParameter("remark");
|
|
remark = ParameterConvertor.convertString(request, remark, response);
|
|
pzbh = request.getParameter("pzbh");
|
|
pzbh = ParameterConvertor.convertString(request, pzbh, response);
|
|
String entrance = request.getParameter("ckk");
|
|
entrance = ParameterConvertor.convertString(request, entrance, response);
|
|
//直接下发拣选出库指令给监控系统执行
|
|
Instruction inst = new Instruction();
|
|
if (zlbh != null) inst.setNo(ServerUtil.getInt(zlbh));
|
|
if ("T".equals(kwxx.get("sfwzzl")))
|
|
{
|
|
inst.setType(Instruction.OUT);
|
|
}
|
|
else
|
|
{
|
|
inst.setType(Instruction.PICK_OUT);
|
|
}
|
|
inst.setFrom(new StockCell(ckkw));
|
|
inst.setCarrier(tpbh);
|
|
inst.setRemark(remark);
|
|
|
|
if (table != null && field != null)
|
|
{
|
|
inst.setFootprint(new Object[]{table, field,pzbh});
|
|
}
|
|
if (entrance != null && entrance.length() > 0)
|
|
{
|
|
inst.setProducer(entrance);
|
|
}
|
|
//向立体仓库监控系统提交执行指令请求
|
|
if (RemoteAccesser.countServletURLs() == 0)
|
|
{
|
|
RemoteAccesser.setUser("");
|
|
String wmcsServer = (String)db1.getSingleField("SELECT dqz FROM sys_config WHERE ID_pzx=?", "wmcs-server");
|
|
if (wmcsServer == null || wmcsServer.length() == 0)
|
|
{
|
|
wmcsServer = "localhost";
|
|
}
|
|
String port = (String)db1.getSingleField("SELECT dqz FROM sys_config WHERE ID_pzx=?", "wmcs-server-port");
|
|
if (port == null || port.length() == 0)
|
|
{
|
|
port = "8080";
|
|
}
|
|
RemoteAccesser.setRootServlet("http://" + wmcsServer + ":" + port + "/wmcs/servlet/wmcs");
|
|
}
|
|
ObjectFromServlet ofs = RemoteAccesser.commitRequest(99
|
|
, 5
|
|
, inst);
|
|
if (!ofs.isSuccess())
|
|
{
|
|
errorInfo = ((String)ofs.getReturnedValue());
|
|
//System.out.println(errorInfo);
|
|
}
|
|
else if (table != null && field != null)
|
|
{
|
|
try
|
|
{
|
|
db1.preparedUpdate(DB.prepareUpdateStmt(table, field, "zlbh"),
|
|
new Object[]{Instruction.BUSY, zlbh},
|
|
true);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
System.err.println(ex);
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
errorInfo = ex.getMessage();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
errorInfo = "非法参数传递";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
errorInfo = "未登录";
|
|
}
|
|
%>
|
|
<%
|
|
out.write("<result status=\"");
|
|
if (errorInfo != null)
|
|
{
|
|
out.write("false\" exception=\"");
|
|
out.write(errorInfo.replace("\"", """));
|
|
}
|
|
else
|
|
{
|
|
out.write("true");
|
|
if (field != null)
|
|
{
|
|
out.write("\" field=\"");
|
|
out.write(field);
|
|
}
|
|
}
|
|
out.write("\"></result>");
|
|
%>
|
|
|