mirror of
https://gitee.com/ShopeX/OMS
synced 2026-04-04 14:36:50 +08:00
345 lines
14 KiB
HTML
345 lines
14 KiB
HTML
<!--
|
|
Copyright 2012-2026 ShopeX (https://www.shopex.cn)
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
-->
|
|
|
|
<{capture name="header"}>
|
|
<{css src="ome.css" app="ome"}>
|
|
<{/capture}>
|
|
<form method="post" id="eo_confirm" action="index.php?app=wms&ctl=admin_eo&act=save_eo_confirm">
|
|
<div class="tableform">
|
|
<h3>采购入库 - 传统方式</h3>
|
|
<div class="division">
|
|
<div style="margin-bottom: 10px;margin-top: 10px">
|
|
到货单号: <input type="text" name="arrival_no" value="" autocomplete="off" id="arrival_no"/>
|
|
</div>
|
|
按
|
|
<select id="purchase_type">
|
|
<option value="barcode">条码</option>
|
|
<!-- <option value="bn">基础物料编码</option> -->
|
|
</select>
|
|
<input type="text" id="purchase_search" />
|
|
<{button label="回车键确定" id="add_bn" app="desktop" icon="btn_add.gif"}>
|
|
<{button type="button" label="切换到条码入库方式" onclick="javascript:window.location='index.php?app=wms&ctl=admin_eo&act=Barcode_stock&p[0]={$po_id}&find_id={$env.get.find_id}';" }>
|
|
<div class="ome-stock" style="clear:both">
|
|
<input type="hidden" name="po_id" value="<{$po_id}>" id="po_id">
|
|
<input type="hidden" name="branch_id" value="<{$branch_id}>">
|
|
<table class="gridlist">
|
|
<thead>
|
|
<tr>
|
|
<th style="width:4%"><input name="checkAll" id="checkAll" type="checkbox" checked="checked" /> 选择 </th>
|
|
<th>基础物料名称</th>
|
|
<th style="width:10%">基础物料编码</th>
|
|
<th style="width:10%">条码</th>
|
|
<th style="width:4%">单位</th>
|
|
<th style="width:5%">采购数量</th>
|
|
<th style="width:6%" nowrap>已入库数量</th>
|
|
<th style="width:5%" nowrap>入库数量</th>
|
|
<th style="width:13%">操作</th>
|
|
<th style="width:13%">商品备注</th>
|
|
|
|
</tr>
|
|
</thead>
|
|
<tbody id="ome-stock-data">
|
|
<{foreach from=$Po_items item=items}>
|
|
<tr class="row" bn="<{$items.bn}>" barcode="<{$items.barcode}>" key="<{$items.item_id}>">
|
|
<td>
|
|
<{if $items.entry_num!=0}>
|
|
<input name="ids[]" type="checkbox" value="<{$items.item_id}>" <{if $items.entry_num!=0}>checked="checked"<{/if}> />
|
|
<{/if}>
|
|
</td>
|
|
<td><{$items.name}></td>
|
|
<td><{$items.bn}></td>
|
|
<td><{$items.barcode}></td>
|
|
<td><{$items.unit}></td>
|
|
<td data-num="<{$items.num}>"><{$items.num}></td>
|
|
<td data-in_num="<{$items.in_num}>" instock_storagelife=<{$items.instock_storagelife}> onmouseover=visibility(event,1);><{$items.in_num}></td>
|
|
<td class="ome-input" id="bm_num_<{$items.product_id}>" onmouseover=visibility(event,2);>
|
|
<{if $items.use_expire == 1}>
|
|
<{if $items.entry_num!=0}>
|
|
0
|
|
<{else}>
|
|
-
|
|
<{/if}>
|
|
<{else}>
|
|
<{if $items.entry_num!=0}>
|
|
<input type="number" class="number_input" min="0" max="<{$items.num - $items.in_num}>" name="entry_num[<{$items.item_id}>]" size="3" value="<{$items.entry_num}>" />
|
|
<{else}>
|
|
-
|
|
<{/if}>
|
|
<{/if}>
|
|
</td>
|
|
<td>
|
|
<{if $items.use_expire == 1}>
|
|
<{if $items.entry_num!=0}>
|
|
<a class="instock_sl" bm_id="<{$items.product_id}>" expire_bm_info='' style="color:#0066cc; text-decoration:none;" id="expire_bm_<{$items.product_id}>">关联保质期</a><input name="is_expire_bn[]" type="hidden" value="<{$items.product_id}>" />
|
|
<{else}>
|
|
-
|
|
<{/if}>
|
|
<{else}>-<{/if}>
|
|
</td>
|
|
<td class="ome-input">
|
|
<{if $items.entry_num!=0}>
|
|
<input type="text" name="item_memo[<{$items.item_id}>]" value="<{$items.memo}>">
|
|
<{/if}>
|
|
</td>
|
|
</tr>
|
|
<input type="hidden" name="is_new[<{$items.item_id}>]" value="<{$items.is_new}>">
|
|
<{/foreach}>
|
|
</tbody>
|
|
</table>
|
|
<div class="ome-stock-title ">共有<{$count}>件商品</div>
|
|
</div>
|
|
<div class="division">
|
|
<table border="0" cellspacing="0" cellpadding="0">
|
|
<tr>
|
|
<td width="5%">
|
|
经办人:
|
|
</td>
|
|
<td>
|
|
<input type="text" name="operator" vtype="required" value="<{$operator}>" size="8" />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>入库单备注: </td>
|
|
<td>
|
|
<textarea name="memo" rows="3" cols="60"></textarea>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</form>
|
|
<{capture name='footbar'}>
|
|
<div class="table-action">
|
|
<{button type="button" id="confirm_btn" label="收货入库" }>
|
|
<{button type="button" id="close_btn" label="关闭页面" }>
|
|
</div>
|
|
<{/capture}>
|
|
<script>
|
|
(function(){
|
|
attachEsayCheck($('ome-stock-data'),'td:nth-child(first)');
|
|
|
|
$('checkAll').addEvent('click',function(){
|
|
var itemIds = document.getElements('input[name^=ids]'),
|
|
num = itemIds.length;
|
|
|
|
if (this.checked) {
|
|
for (var i = 0; i < num; i++) {
|
|
itemIds[i].checked = "checked";
|
|
}
|
|
} else {
|
|
for (var i = 0; i < num; i++) {
|
|
itemIds[i].checked = "";
|
|
}
|
|
}
|
|
});
|
|
|
|
var dataNode = $('ome-stock-data');
|
|
|
|
dataNode.getElements('.isNew').each(function(item,i){
|
|
if(item.get('text').trim() == '是'){
|
|
item.setStyles({'background-color':'#ffc',color:'red'});
|
|
|
|
}
|
|
});
|
|
var entry = $$('#ome-stock-data input[name^=entry_num[]');
|
|
entry.addEvent('blur',function(){
|
|
this.value = (this.value.toInt()).limit(this.get('min'),this.get('max'));
|
|
});
|
|
|
|
//关闭页面
|
|
$('close_btn').addEvent('click', function(){
|
|
window.close();
|
|
});
|
|
|
|
$('purchase_search').addEvent('keyup',function(e){
|
|
if(e.code!==13)return;
|
|
var type=$('purchase_type').value,value=this.value,el;
|
|
if (type=='barcode' && value==''){
|
|
alert('请输入需定位的条形码');
|
|
$('purchase_search').focus();
|
|
return;
|
|
}
|
|
if (type=='bn' && value==''){
|
|
alert('请输入需定位的货号');
|
|
$('purchase_search').focus();
|
|
return;
|
|
}
|
|
$$('#ome-stock-data tr').each(function(tr){
|
|
if(tr.get(type)==value){el=tr;}
|
|
});
|
|
if(!el)return MessageBox.error('没找到相应数据');
|
|
if(preel=this.retrieve('height_el'))preel.removeClass('select');
|
|
el.addClass('select').getElement('input[type^=text]').focus();
|
|
this.store('height_el',el);
|
|
});
|
|
$('add_bn').addEvent('click',function(){
|
|
var type=$('purchase_type').value,el;
|
|
var value=$('purchase_search').get('value');
|
|
if (type=='barcode' && value==''){
|
|
alert('请输入需定位的条形码');
|
|
$('purchase_search').focus();
|
|
return;
|
|
}
|
|
if (type=='bn' && value==''){
|
|
alert('请输入需定位的货号');
|
|
$('purchase_search').focus();
|
|
return;
|
|
}
|
|
$$('#ome-stock-data tr').each(function(tr){
|
|
if(tr.get(type)==value){el=tr;}
|
|
});
|
|
if(!el)return MessageBox.error('没找到相应数据');
|
|
if(preel=this.retrieve('height_el'))preel.removeClass('select');
|
|
el.addClass('select').getElement('input[type^=text]').focus();
|
|
this.store('height_el',el);
|
|
});
|
|
$('purchase_search').focus();
|
|
|
|
|
|
$$('#ome-stock-data input[type=text]').addEvent('keyup',function(e){
|
|
if(this.getNext('.error')) this.getNext('.error').destroy();
|
|
if(e.code!==13)return;
|
|
var next_td=$(e.target).getParent('td').getNext('.ome-input');
|
|
if(next_td&&next_td.getElement('input[type=text]')) return next_td.getElement('input[type=text]').focus();
|
|
$('purchase_search').focus();
|
|
if(preel=$('purchase_search').retrieve('height_el'))preel.removeClass('select');
|
|
});
|
|
|
|
$('eo_confirm').store('target',{
|
|
onRequest:function(){
|
|
$('confirm_btn').set('disabled', 'true');
|
|
$('confirm_btn').getElements('span')[1].set('text','正在入库');
|
|
},
|
|
onComplete:function(jsontext){
|
|
var json = JSON.decode(jsontext);
|
|
if (typeof(json.error) != 'undefined'){
|
|
dataNode.getElements('tr:key').removeClass('highlight');
|
|
if(json.product_id){
|
|
dataNode.getElements('tr:key').each(function(tr,i){
|
|
json.product_id.each(function(v,i){
|
|
if(tr.get('key') == v){
|
|
var error = tr.getElement('span.error') || new Element('span.error').injectAfter(tr.getElement('input.ome-stock-store-input'));
|
|
error.setHTML('此商品所在的仓库上不存在该货位!');
|
|
if(i===0) tr.getElement('input.ome-stock-store-input').focus();
|
|
tr.addClass('highlight');
|
|
}
|
|
});
|
|
});
|
|
}
|
|
$('confirm_btn').set('disabled', false);
|
|
$('confirm_btn').getElements('span')[1].set('text','开始入库');
|
|
}else{
|
|
$('confirm_btn').set('disabled', true);
|
|
$('confirm_btn').getElements('span')[1].set('text','正在入库');
|
|
opener.finderGroup['<{$env.get.find_id}>'].refresh.delay(100,opener.finderGroup['<{$env.get.find_id}>']);
|
|
window.close();
|
|
}
|
|
|
|
}
|
|
});
|
|
|
|
$('confirm_btn').addEvent('click',function(e){
|
|
var flag = [];
|
|
entry.each(function(item,i){
|
|
if(item.value < item.getParent('tr').getElement('td:data-num').get('data-num') - item.getParent('tr').getElement('td:data-in_num').get('data-in_num')){
|
|
flag.push(item.getParent('tr'));
|
|
}
|
|
});
|
|
|
|
var value = '';
|
|
$$('.instock_sl').each(function(item){
|
|
if(item.getParent('td').getElement("input[name=expire_bm_info[]]")){
|
|
item.getParent('td').getElement("input[name=expire_bm_info[]]").destroy();
|
|
}
|
|
value = item.get('expire_bm_info');
|
|
new Element('input[type=hidden]', {'name': 'expire_bm_info[]', value: value}).inject(item.getParent('td'));
|
|
});
|
|
|
|
if(flag.length){
|
|
if(confirm('入库数量和采购数量不符,是否确认?')){
|
|
$('eo_confirm').fireEvent('submit',e);
|
|
}else{
|
|
$$('#ome-stock-data tr.highlight').removeClass('highlight');
|
|
flag.each(function(f,i){
|
|
f.addClass('highlight');
|
|
if(i===0) f.getElement('input[name^=entry_num[]').focus();
|
|
});
|
|
}
|
|
}else{
|
|
$('eo_confirm').fireEvent('submit',e);
|
|
}
|
|
});
|
|
|
|
$$('.ome-input input, .ome-stock-store-input').addEvent('keyup',function(e){
|
|
if(e.code==13) $('purchase_search').focus();
|
|
});
|
|
})();
|
|
|
|
function visibility(e,type){
|
|
var visiTips = new Tips({
|
|
onShow:function(tip,el){
|
|
el.addClass('active');
|
|
tip.setStyle('display','block');
|
|
},
|
|
text: function(element){
|
|
if(type == 1 && element.get('instock_storagelife')){
|
|
var jsontext = element.get('instock_storagelife');
|
|
var ex_bm_info = Json.evaluate(jsontext);
|
|
var show_str = '';
|
|
if(ex_bm_info){
|
|
ex_bm_info.each(function(item){
|
|
show_str += '批次号:'+item.expire_bn+',数量:'+item.nums+'<br/>';
|
|
});
|
|
}
|
|
return show_str;
|
|
}
|
|
else if(type == 2 && element.get('text').toInt() > 0){
|
|
var jsontext = element.getNext('td').getElement('a').get('expire_bm_info');
|
|
var ex_bm_info = Json.evaluate(jsontext);
|
|
var show_str = '';
|
|
if(ex_bm_info){
|
|
ex_bm_info.each(function(item){
|
|
show_str += '批次号:'+item.expire_bn+',数量:'+item.in_num+'<br/>';
|
|
});
|
|
}
|
|
return show_str;
|
|
}else{
|
|
return '';
|
|
}
|
|
}
|
|
});
|
|
|
|
var e = new Event(e), el = e.target;
|
|
if ((type == 1 && el.get('instock_storagelife'))|| (type == 2 && el.get('text').toInt() > 0))
|
|
{
|
|
visiTips.attach(el);
|
|
el.addEvent('mouseleave',function(){
|
|
el.removeClass('active');
|
|
});
|
|
el.fireEvent('mouseenter',e);
|
|
}
|
|
}
|
|
|
|
$$('.instock_sl').addEvent("click",function(){
|
|
var po_id = $('po_id').value;
|
|
var bm_id = this.get('bm_id');
|
|
var has_expire_bm_info = this.get('expire_bm_info');
|
|
new Dialog('index.php?ctl=admin_eo&act=storage_life_instock&app=wms',{width:700,height:500,title:'关联保质期',ajaxoptions:{data:{po_id:po_id,bm_id:bm_id,has_expire_bm_info:has_expire_bm_info},method:'post'}});
|
|
});
|
|
</script>
|