|
这是源码部分 <input component="$UI/system/components/justep/input/input" class="form-control" xid="tel" oninput="telChange"/>
这事js部分 Model.prototype.telChange = function(event){
var me = this;
var mobilephone = $.trim(me.comp('tel').val());
console.log("mobilephone:"+mobilephone);
event.async = true;
var db = DB.getDatabase();
// 执行SQL查询:先查询数据库,确认是否存在改数据。
var selectSql = "select stid,StockPiciNo,EmName,TiaoMaNum,BoxNo,BxTmpS,xflag,BoxTiaoM,BNumber,JIZhuangNo from T_ScanMainChild where BoxTiaoM = "+mobilephone+";";
SqliteUtil.executeSql(db, selectSql, null, onSuccess_select, onError);
//查找fID中包含"E"或者"e"的第一条数据
function onSuccess_select(res){
// 转换返回数据结果
var table = SqliteUtil.rowsToTable(res.rows);
if(table.rows.length > 0){
if(table.rows[0].xflag == 0){
// 执行SQL更新:存在该数据,然后更新该数据的状态值。
var updataSql = "update T_ScanMainChild set xflag=1 where xflag=0 and BoxTiaoM = "+mobilephone+";";
SqliteUtil.executeSql(db, updataSql, null, onSuccess_update, onError);
} else {
justep.Util.hint("该箱子已经扫描过了!", {
"tyep" : "info",
"delay" : 1500,
"position" : "top",
"style" : "background-image : -webkit-linear-gradient(top, #FFFFFF 0, #FFFFFF 50%);text-align: center;font-size: 17px;width:200px;"
});
}
} else {
justep.Util.hint("该箱子,不存在装货清单中!", {
"tyep" : "info",
"delay" : 1500,
"position" : "top",
"style" : "background-image : -webkit-linear-gradient(top, #FFFFFF 0, #FFFFFF 50%);text-align: center;font-size: 17px;width:200px;"
});
}
}
function onSuccess_update(res){
justep.Util.hint("扫描成功!", {
"tyep" : "success",
"delay" : 1000,
"position" : "top",
"style" : "background-image : -webkit-linear-gradient(top, #FFFFFF 0, #FFB90F 50%);text-align: center;font-size: 17px;width:230px;"
});
var aa=$(me.getElementByXid("numberCount1")).text();
var bb=$(me.getElementByXid("numberCount1")).text(parseInt(aa)+1);
var cc=$(me.getElementByXid("tel")).val();
var dd=$(me.getElementByXid("tel")).val("");
}
//失败
function onError(msg) {
console.log("失败",msg);
}
};
|
|