<apex:page Controller="ConsumEquipmentSetShipmentController" showHeader="false" sidebar="false" id="allPage" action="{!init}">
|
<head>
|
<meta name="format-detection" content="telephone=no"/>
|
<meta name="viewport" content="width=device-width,initial-scale=1"/>
|
</head>
|
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
|
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
|
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
|
<apex:includeScript value="{!URLFOR($Resource.RelationListPagingCmpJS)}"/>
|
<apex:includeScript value="/soap/ajax/46.0/connection.js"/>
|
<apex:includeScript value="/soap/ajax/46.0/apex.js"/>
|
<apex:stylesheet value="{!URLFOR($Resource.jquery_confirm, 'jquery-confirm.min.css')}"/>
|
<apex:includeScript value="{!URLFOR($Resource.jquery_confirm, 'jquery-confirm.min.js')}"/>
|
<style type="text/css">
|
div#out_Div_L {
|
position:relative;
|
overflow: hidden;
|
float:left;
|
width: 30px;
|
}
|
.apexp .bPageBlock .pbHeader .btn
|
{
|
padding: 6px;
|
font-size: 110%;
|
margin-right: 20px;
|
}
|
.col_Barcode_F__c
|
{
|
display: none;
|
}
|
table.list td input {width: 85%;}
|
div#in_Div_L {
|
position:relative;
|
overflow: hidden;
|
float:left;
|
height: 100px;
|
width: 30px;
|
}
|
</style>
|
<script type="text/javascript">
|
sforce.connection.sessionId = "{!$Api.Session_ID}";
|
var JANCODEMap = {};
|
</script>
|
|
<apex:form id="allForm">
|
<apex:inputHidden value="{!done_flg}" id="done_flg"/>
|
<apex:outputPanel id="pageallPanel">
|
<apex:pageBlock id="searchBlock" tabStyle="Report">
|
<apex:pageBlockButtons location="top">
|
<apex:commandButton style="float:left;" action="{!save}" onclick="blockme();" value="保存" rerender="allForm" oncomplete="unblockUI();checkMessage();checEventFrame()" />
|
<apex:commandButton action="{!cancel}" value="取消" rerender="allForm" oncomplete="checEventFrame()"/>
|
<apex:commandButton onclick="qrsacn(0);return false;" value="扫一扫耗材" rerender="allForm"/>
|
<apex:commandButton onclick="qrsacn(1);return false;" value="扫一扫物流单" rerender="allForm"/>
|
<apex:commandButton onclick="blockme();" action="{!send}" value="发货" rerender="allForm" oncomplete="unblockUI();checkMessage();checEventFrame()"/>
|
</apex:pageBlockButtons>
|
|
<table>
|
<tr>
|
<td width="20px"/>
|
<td width="35%">
|
<apex:outputLabel for="applyNo" value="申请单号:" />
|
<apex:outputText id="applyNo" value="{!c_apply_no}"/>
|
</td>
|
<td width="10px"></td>
|
<td width="30%">
|
<apex:outputLabel for="keyword" value="型号:" />
|
<apex:inputText id="keyword" value="{!keyword}"/>
|
</td>
|
<td width="10px"></td>
|
<td width="35%">
|
<apex:outputLabel for="keywordDate" value="有效期至:" />
|
<apex:inputText id="keywordDate" value="{!keywordDate}" size="12" onfocus="DatePicker.pickDate(true, '{!$Component.keywordDate}', false)" />
|
<apex:commandButton style="margin-left: 20px; padding: 6px;font-size: 110%;" value="检索" action="{!searchOpp}" onclick="blockme();" rerender="allForm" oncomplete="unblockUI();checEventFrame()"/>
|
<div style="display:none;">
|
<apex:inputField value="{!slip.Shippment_loaner_time__c}" />
|
</div>
|
</td>
|
</tr>
|
<tr>
|
<td width="20px"/>
|
<td >
|
<apex:outputLabel for="slipNo" value="发货-运输单号:" />
|
<apex:inputField id="slipNo" value="{!slip.Name}"/>
|
<apex:commandButton action="{!searchSlip}" value="检索" style="padding: 6px;font-size: 110%;" rerender="allForm" oncomplete="checEventFrame()"/>
|
</td>
|
<td width="10px"></td>
|
<td >
|
<apex:outputLabel for="deliveryType" value="发货-运输单种类:" />
|
<span><apex:inputField required="false" id="deliveryType" value="{!slip.DeliveryType__c}"/></span>
|
</td>
|
<td width="10px"></td>
|
<td>
|
<apex:outputLabel for="distributorMethod" value="发货-运输方式:" />
|
<apex:inputField required="false" id="distributorMethod" value="{!slip.Distributor_method__c}"/>
|
</td>
|
</tr>
|
<tr>
|
<td width="20px"/>
|
<td >
|
<apex:outputLabel for="deliveryCompany" value="发货-物流公司:" />
|
<apex:inputField required="false" id="deliveryCompany" value="{!slip.DeliveryCompany__c}"/>
|
</td>
|
<td width="10px"></td>
|
<td >
|
<apex:outputLabel for="whStaff" value="发货-担当者:" style="float:left;"/>
|
<apex:inputField required="false" id="whStaff" value="{!slip.Wh_Staff__c}" style="float:left;"/>
|
</td>
|
<td width="10px"></td>
|
<td>
|
<apex:outputLabel for="combinePack" value="发货-合包信息:" />
|
<apex:inputField required="false" id="combinePack" value="{!slip.Combine_Pack__c}"/>
|
</td>
|
</tr>
|
</table>
|
|
<div style="clear:both;"></div>
|
|
<apex:outputPanel id="message">
|
<apex:pageMessages />
|
</apex:outputPanel>
|
</apex:pageBlock>
|
<c:RelationListPagingCmp id="cmpid" pgController="{!this}" hasCheckbox="true" />
|
<apex:outputPanel id="checEventFrame">
|
<script>
|
function checEventFrame() {
|
j$('select[name$="deliveryType"]').val('发货');
|
j$('select[name$="deliveryType"]').prop('disabled', true);
|
|
// j$('select[name$="distributorMethod"]').children('option[value="空运"]').remove();
|
j$('select[name$="deliveryCompany"]').children('option[value="莱比特"],option[value="嘉里大通"]').remove();
|
}
|
checEventFrame();
|
|
var tbwidth = j$('#tableHeader').css('width');
|
tbwidth = parseInt(tbwidth.slice(0, -2)) - 76;
|
j$('#tableHeader').css('width', tbwidth+'px');
|
j$('#tableData').css('width', tbwidth+'px');
|
|
j$("#tableData input[type=text]").on('change', function() {
|
let rownum = j$(this)[0].id.match(/oppTable\:(\d*)/)[1];
|
j$('input[name$="oppTable_L:'+rownum+':rowCheck"]').prop('checked', true).trigger("change");
|
})
|
|
if (j$('.messageText').text().indexOf('取得了') != -1) {
|
if ('{!changeMessage}' == '取消') {
|
j$('.messageText').text('取消成功')
|
} else {
|
j$('.messageText').text('取得了 {!changeMessage} 条数据')
|
}
|
}
|
</script>
|
</apex:outputPanel>
|
</apex:outputPanel>
|
</apex:form>
|
<script type="text/javascript">
|
// j$(document).ready(function(){
|
// j$('select[name$="deliveryType"]').val('发货');
|
// j$('select[name$="deliveryType"]').prop('disabled', true)
|
// // j$( '#qrcode' ).unbind();
|
// // j$( '#qrcode' ).keypress( function ( e ) {
|
// // if ( e.which == 13 ) {
|
// // filljsQR(j$( '#qrcode' ).val());
|
// // return false;
|
// // }
|
// // });
|
// });
|
function checkMessage() {
|
if (j$(escapeVfId('allPage:allForm:done_flg')).val() == 'true') {
|
alert("保存成功");
|
}
|
}
|
|
var standalone = window.navigator.standalone,
|
userAgent = window.navigator.userAgent.toLowerCase(),
|
safari = /safari/.test( userAgent ),
|
ios = /iphone|ipod|ipad/.test( userAgent );
|
var scanType;
|
function filljsQR(content) {
|
if (scanType == 1) {
|
j$("input[name$='slipNo']").val(content);
|
} else {
|
var tracingCode = content.substr(-8);
|
if (tracingCode.indexOf('250') == 0) {
|
content = content.slice(0, -8);
|
}
|
let rownum = [];
|
var $Col_Scroll = j$(".dataRow.col_Scroll");
|
j$(".col_Barcode_F__c span").each(function(index) {
|
if (j$(this).text() && (content.indexOf(j$(this).text()) == 0)) {
|
rownum.push(this.id.match(/oppTable\:(\d*)/)[1]);
|
return;
|
}
|
var JANCODE = content.substr(3, 12);
|
var GTINCODE = content.substr(3, 12);
|
// var yyyyMMdd = "20" + content.substr(18, 6);
|
// 到2100年 就需要下面的logic了
|
// var now = new Date();
|
// var current_yyyyMMdd = now.getFullYear()
|
// + ("0" + (now.getMonth() + 1)).slice(-2)
|
// + ("0" + now.getDate()).slice(-2);
|
// var currentYear = new Date().getFullYear();
|
// var yyyyMMdd = Math.floor(currentYear / 100) + content.substr(18, 6);
|
// if (yyyyMMdd < currentYear) yyyyMMdd = yyyyMMdd + 1000000; // 使用期限 应该是未来的日期
|
var result = extractDateSerial(content);
|
var yyyyMMdd = result['yyyyMMdd'];
|
var serial = result['serial'];
|
|
if (JANCODEMap[JANCODE]) {
|
} else {
|
var query = "Select ProductCode From Product2 WHERE JANCODE__c LIKE '" + JANCODE + "%' OR Device_GTIN_2_13_F__c = '" + GTINCODE + "' LIMIT 1";
|
var records = sforce.connection.query(query).getArray('records');
|
if (records.length > 0) {
|
JANCODEMap[JANCODE] = records[0].ProductCode;
|
}
|
}
|
if (JANCODEMap[JANCODE]) {
|
var content2 = JANCODEMap[JANCODE] + ":" + serial + "(" + yyyyMMdd + ")";
|
var $prdSerialNo = $Col_Scroll.find("input[name=Product_Serial_No_F__c]");
|
if ($prdSerialNo[index].value.startsWith(content2)) {
|
if(this.id != undefined){
|
rownum.push(this.id.match(/oppTable\:(\d*)/)[1]);
|
return;
|
}
|
}
|
}
|
})
|
if (rownum.length == 0) {
|
alert('扫描的耗材不存在!')
|
} else if (rownum.length > 1) {
|
let optStr = "";
|
rownum.forEach(function (rn) {
|
j$(".col_Salesdepartment__c").each(function () {
|
if (j$(this).children()[0] && j$(this).children()[0].id.indexOf('oppTable:'+rn+':') !== -1) {
|
optStr += '<option value="'+rn+'">'+j$(this).text()+'</option>';
|
return;
|
}
|
})
|
})
|
j$.confirm({
|
title: '扫描的耗材有复数存在',
|
boxWidth: '50%',
|
useBootstrap: false,
|
content: '' +
|
'<form action="" class="formName">' +
|
'<div style="overflow: hidden;">' +
|
'<label for="salesDept">请选择所在地区(本部):</label>' +
|
'<select id="salesDept" name="salesDept">'+optStr+'</select>' +
|
'</div>' +
|
'</form>',
|
buttons: {
|
formSubmit: {
|
text: '确认',
|
btnClass: 'btn-blue',
|
action: function () {
|
var rn = this.$content.find('#salesDept').val();
|
var leftobj = j$("input[name$='oppTable_L:"+rn+":rowCheck']:not(:disabled)")
|
moveToTop(leftobj);
|
leftobj.prop('checked', true).trigger("change");
|
|
j$(".col_Inspection_Cnt_Jia__c").each(function () {
|
if (j$(this).children()[0] && j$(this).children()[0].id.indexOf('oppTable:'+rn+':') !== -1) {
|
// j$(this).find("input").attr('autofocus', 'autofocus');
|
var rightObj = j$(this).find("input:not(:disabled)");
|
moveToTop(rightObj);
|
rightObj.focus();
|
return;
|
}
|
})
|
}
|
},
|
cancel: {
|
text: '取消'
|
}
|
}
|
});
|
}else {
|
var leftobj = j$("input[name$='oppTable_L:"+rownum[0]+":rowCheck']:not(:disabled)")
|
moveToTop(leftobj);
|
leftobj.prop('checked', true).trigger("change");
|
|
j$(".col_Inspection_Cnt_Jia__c").each(function () {
|
if (j$(this).children()[0] && j$(this).children()[0].id.indexOf('oppTable:'+rownum[0]+':') !== -1) {
|
// j$(this).find("input").attr('autofocus', 'autofocus');
|
var rightObj = j$(this).find("input:not(:disabled)");
|
moveToTop(rightObj);
|
rightObj.focus();
|
return;
|
}
|
})
|
}
|
}
|
}
|
function extractDateSerial(content){
|
var yyyyMMdd = '';
|
var noJancodeContent = content.slice(16);
|
var n1 = noJancodeContent.search(/17\d{6}/);
|
var n2 = noJancodeContent.slice(8).search(/17\d{6}/);
|
var m1 = noJancodeContent.search(/11\d{6}/);
|
var m2 = noJancodeContent.slice(8).search(/11\d{6}/);
|
|
var k = 0;
|
if(n1 % 8 == 0){
|
yyyyMMdd = '20'+noJancodeContent.substr(n1+2,6);
|
k += 1;
|
}
|
else if(n2 == 0) {
|
yyyyMMdd = '20'+noJancodeContent.substr(8+2,6);
|
k += 1;
|
}
|
if(m1 % 8 == 0 || m2 == 0){
|
k += 1;
|
}
|
var serial = noJancodeContent.slice(k*8+2);
|
var y = yyyyMMdd.substring(0, 4);
|
var m = yyyyMMdd.substring(4, 6);
|
var d = yyyyMMdd.substring(6);
|
// 00表示月末
|
if(d == '00'){
|
d = '' + (new Date(y, m, d)).getDate();
|
}
|
yyyyMMdd = y + m + d;
|
return {'yyyyMMdd':yyyyMMdd, 'serial':serial};
|
}
|
function moveToTop(obj) {
|
let row = obj.parents("tr:first");
|
let toprow = row.parent().children('tr:first');
|
if (!row.is(toprow))
|
row.insertBefore(toprow);
|
}
|
|
function qrsacn(stype) {
|
scanType = stype;
|
if (!standalone && !safari && ios) {
|
window.location.href="sfqr://scan";
|
} else {
|
alert('扫描条形码请使用App');
|
}
|
}
|
</script>
|
</apex:page>
|