185 lines
4.1 KiB
JavaScript
185 lines
4.1 KiB
JavaScript
function check(onstart)
|
||
{
|
||
var ckbjxx = document.forms["ckbjxx"];
|
||
if(ckbjxx.barcode)
|
||
{
|
||
var barcode = ckbjxx.barcode.value;
|
||
if (onstart || (barcode.length == 0 && ckbjxx.jhs.value.length == 0))
|
||
{
|
||
focusInput(ckbjxx.barcode);
|
||
if (onstart) ckbjxx.jhs.value = "";
|
||
return onstart;
|
||
}
|
||
if (barcode.length > 0 && isInvalidCode(barcode))
|
||
{
|
||
focusInput(ckbjxx.barcode);
|
||
return false;
|
||
}
|
||
//处理扫入到的条码。
|
||
var jhs = ckbjxx.jhs.value;
|
||
if (jhs.indexOf("|" + barcode + "|") >= 0)
|
||
{
|
||
alert("重复扫入条码:" + barcode);
|
||
}
|
||
else
|
||
{//追加条码
|
||
var wsslInfo = document.getElementById("wssl");
|
||
var newValue = parseInt(wsslInfo.innerHTML);
|
||
if (newValue == 0)
|
||
{
|
||
alert("超出安排数量");
|
||
focusInput(ckbjxx.barcode);
|
||
return false;
|
||
}
|
||
if (barcode.length > 0)
|
||
{
|
||
ckbjxx.jh.value = barcode;
|
||
ckbjxx.jhs.value = (jhs.length > 1?jhs:"|") + barcode + "|";
|
||
var countInfo = document.getElementById("count");
|
||
var oldCount = countInfo.getAttribute("total");
|
||
var newCount = parseInt(oldCount) + 1;
|
||
countInfo.setAttribute("total", newCount)
|
||
countInfo.innerHTML = scanedCntTip + newCount + removeLastButtonElement;
|
||
newValue = newValue - 1;
|
||
wsslInfo.innerHTML = newValue;
|
||
//ckbjxx.cmdSave.disabled = null;
|
||
}
|
||
//if (newValue == 0 || box || salver)//最好立即保存,之后检查比较麻烦
|
||
{//未扫入数量等于0,才提交保存
|
||
//ckbjxx.cmdSave.disabled = "true";
|
||
smwcqr(ckbjxx.ckdh.value, ckbjxx.zlbhAndTpbh.value, ckbjxx.jhs.value);
|
||
}
|
||
}
|
||
ckbjxx.barcode.value = "";
|
||
focusInput(ckbjxx.barcode);
|
||
return false;
|
||
}
|
||
var x;
|
||
x = ckbjxx.zlbh;
|
||
if(x)
|
||
{
|
||
focusInput(x);
|
||
if (!onstart)
|
||
{
|
||
if (getFieldValue(x).length == 0)
|
||
{
|
||
return false;
|
||
}
|
||
}
|
||
return true;
|
||
}
|
||
x = ckbjxx.ckdh;
|
||
if(x)
|
||
{
|
||
focusInput(x);
|
||
if (!onstart)
|
||
{
|
||
if (getFieldValue(x).length == 0)
|
||
{
|
||
return false;
|
||
}
|
||
}
|
||
return true;
|
||
}
|
||
return false;
|
||
}
|
||
|
||
//取托盘操作
|
||
function qctp(zlbh, ckkw, tpbh)
|
||
{
|
||
var argument = new Array("zlbh", zlbh, "tpbh", tpbh, "ckkw", ckkw, "remark", "表计出库", "table", "ckzl", "field", "qczt");
|
||
postRequest("qtp.jsp", argument, successQctp);
|
||
}
|
||
|
||
//取托盘操作 回调函数
|
||
function successQctp(result)
|
||
{
|
||
finishProcess();
|
||
|
||
//alert("成功下发取托盘作业指令");
|
||
var ckbjxx = document.forms["ckbjxx"];
|
||
focusInput(ckbjxx.barcode);
|
||
var zlbhAndTpbh = ckbjxx.zlbhAndTpbh.value;
|
||
var indexSeparator = zlbhAndTpbh.indexOf('|');
|
||
var tpbh = zlbhAndTpbh.substring(1 + indexSeparator);
|
||
var tpbhNode = document.getElementById("tpbh");
|
||
tpbhNode.innerHTML = tpbh;
|
||
}
|
||
|
||
/**
|
||
* 扫描完成确认操作
|
||
* @param ckdh 出库单号
|
||
* @param zlbh 出库指令号
|
||
* @param jhs |表计条码1|表计条码2|....|表计条码n|
|
||
*/
|
||
function smwcqr(ckdh, zlbh, jhs)
|
||
{
|
||
var ckbjxx = document.forms[0];
|
||
var qxsm = ckbjxx.qxsm.checked?"1":"0";
|
||
var argument = new Array("ckdh", ckdh, "zlbh", zlbh, "jhs", jhs, "qxsm", qxsm);
|
||
postRequest("ckqr.jsp", argument, successSmwcqr);
|
||
}
|
||
|
||
/**
|
||
* 提交扫描结果
|
||
*/
|
||
function save()
|
||
{
|
||
try
|
||
{
|
||
var ckbjxx = document.forms[0];
|
||
var jhs = ckbjxx.jhs.value;
|
||
var barcode = ckbjxx.barcode.value;
|
||
if (barcode.length > 1 && !isInvalidCode(barcode))
|
||
{
|
||
check(false);
|
||
jhs = ckbjxx.jhs.value;
|
||
}
|
||
if (jhs.length < 1)
|
||
{
|
||
alert("至少要一个条码");
|
||
return false;
|
||
}
|
||
smwcqr(ckbjxx.ckdh.value, ckbjxx.zlbhAndTpbh.value, jhs);
|
||
}
|
||
catch(e)
|
||
{
|
||
alert("程序错误:" + e);
|
||
}
|
||
}
|
||
|
||
//装盘操作确认完成 回调函数
|
||
function successSmwcqr(result)
|
||
{
|
||
finishProcess();
|
||
|
||
var wsmsl = result.getAttribute("wsmsl");
|
||
var sl = parseInt(wsmsl);
|
||
var ckbjxx = document.forms[0];
|
||
ckbjxx.jhs.value = "";
|
||
if (sl >= 0)
|
||
{
|
||
var wsslInfo = document.getElementById("wssl");
|
||
wsslInfo.innerHTML = sl;
|
||
var countInfo = document.getElementById("count");
|
||
var newCount = result.getAttribute("ysmsl");
|
||
countInfo.innerHTML = scanedCntTip + newCount;
|
||
ckbjxx.barcode.focus();
|
||
}
|
||
if (sl == 0)
|
||
{//对应的指令或出库单扫描操作结束,单还有其它指令或出库单
|
||
history.go("0" == zlbh?-2:-1);
|
||
window.location.href = "0" == zlbh?"ck.jsp":("ck.jsp?ckdh=" + ckbjxx.ckdh.value);
|
||
}
|
||
else if (sl == -1)
|
||
{//没有其它出库指令
|
||
history.go(-2);
|
||
window.location.href = "ck.jsp";
|
||
}
|
||
else if (sl == -2)
|
||
{//没有其它出库单
|
||
history.go(-2);
|
||
window.location.href = "index.jsp";
|
||
}
|
||
}
|