zoukankan      html  css  js  c++  java
  • Netsuite 中 js 扫描枪应用 解读一

    function Syncdepartment(fieldspec, linenum, onlySlaveSelect, mach, addlparams)
    {
    var sel = document.forms['item_form'].elements['department'+linenum];
    var value = sel != null ? getSelectValue(sel) : -1;
    if (value == -1) {resetlist(sel);
    nlOpenWindow('/app/common/otherlists/departmenttype.nl?target=item:department'+linenum+'&label=Department', 'newitemdepartment','width=400,height=175,resizable=yes,scrollbars=no');
    return; }
    sizeLowerTabBGDiv('item');
    }
    function Listdepartment(fld, multi,linenum,addlparams) {
    var displayField = document.forms['item_form'].elements['department'+linenum];if ( displayField != null && !displayField.isvalid) { displayField.isvalid = true; window.isvalid = true; displayField.value = '';}NLPopupSelect_displayLoadingDiv('department', false);var serverUrl = '/app/accounting/transactions/itemship.nl?cp=T&nexus=1&memdoc=0&transform=salesord&advbilltransform=T&at=T&cf=305&purchase=F&fromtrnfrord=F&shipper=ns&e=T&q=department&id='+trim(document.forms['main_form'].elements['id'].value)+'&l=T&t=item:department&machine=item'+(multi ? '&multi=T' : '')+''+'&ln='+linenum+(addlparams?'&'+addlparams:'')+'';
    document.getElementById('server_commands').src=serverUrl; }

    //扫描枪自动回车以后查询扫描码的事件。

    function itemLocateField(val) {
    var frm = document.forms['item_form'];
    var linenum = findEncodedValue('item','itemname_selector',val);
    if (linenum < 0)
    linenum = findEncodedValue('item','itemupc',val);
    if (linenum >= 0)
    { frm.elements['quantity'+linenum].value = frm.elements['quantity'+linenum].value.length == 0 ? '1' : parseFloat(frm.elements['quantity'+linenum].value)+1;frm.elements['quantity'+linenum].onchange(); }
    else alert('No Match.'); }


    function findEncodedValue(machine_name, fieldname, value)
    {
    var i = getEncodedFieldPosition(machine_name, fieldname);
    if (i == -1)
    return -1;
    for (var linenum=0;linenum < getLineCount(machine_name);linenum++)
    {
    var linedata = getLineArrayLine(machine_name,linenum);
    if (value == linedata[i])
    return linenum+1;
    }
    return -1;
    }
    function getEncodedFieldPosition(machine_name, fieldname)
    {
    var fieldnames = getFieldNamesArray(machine_name);
    if ( fieldnames != null )
    {

    return fieldnames[fieldname] != null ? fieldnames[fieldname] : -1;

    }
    return -1;
    }


    货品编码不是动态去货品那里每次扫描去查询的,而在加载单据时,那么货品码早就在那里等待匹配了。这样效率就能有保证。 12:13 2010-03-03

    ----------------------------------------------------

    onblur

    <input type="text" id="item_autoenter" onblur="if (this.checkvalid == true) {this.isvalid=validate_field(this,'text',false,false);} if (this.isvalid == false) { selectAndFocusField(this); return this.isvalid;}" name="item_autoenter" size="15" onfocus="if (this.isvalid == true || this.isvalid == false) this.checkvalid=true;" onchange="setWindowChanged(window, true);this.isvalid=validate_field(this,'text',true,false);this.checkvalid=false;if (this.isvalid) {if (value.length > 0) {itemLocateField(value); value='';};}if (this.isvalid) this.isvalid=validate_textfield_maxlen(this,60,true,true);if (!this.isvalid) { selectAndFocusField(this);}return this.isvalid;" class="input" onkeypress="if( getEventKeypress(event) == 13) { event.cancelBubble = true; if (value.length > 0) {itemLocateField(value); value=''; } else {NLDoMainFormButtonAction('submitter');} return false;}" maxlength="60"/>

    event.cancelBubble = true 用来阻止enter键向父级传递(导致系统会认为要保存单据了),itemLocateField(value); 是回车以后查询扫描码的事件。

  • 相关阅读:
    greenplum表的distributed key值查看
    oracle dump的使用心得
    Linux du与df命令的差异
    从语言只是工具说起
    DDD领域模型
    同一个对象在另一个对象中容易出现重复引用造成map覆盖,HiJson出现严重漏洞自动删除了$ref和空值
    乒乓球相关
    字符串转xml
    最新版java题
    list集合进行分页
  • 原文地址:https://www.cnblogs.com/backuper/p/1677108.html
Copyright © 2011-2022 走看看