高章伟
2022-03-18 4bfe21c4b5ddc089ae5a95f4b10f6cff148b690d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<apex:page Controller="ConsumEquipmentSetReturnController" 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)}"/>
<style type="text/css">
div#out_Div_L {
  position:relative;
  overflow: hidden;
  float:left;
  width: 30px;
}
div#in_Div_L {
  position:relative;
  overflow: hidden;
  float:left;
  height: 100px;
  width: 30px;
}
.apexp .bPageBlock .pbHeader .btn
{
    padding: 6px;
    font-size: 110%;
    margin-right: 20px;
}
/* add by yc 202202-17 **/
.col_EquipmentManagementCode_OldData__c {display: none;}
.col_Scroll{display: none;}
</style>
 
<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 onclick="blockme();" action="{!save}" value="保存" rerender="checEventFrame,allForm" oncomplete="unblockUI();checEventFrame()"/>
                <apex:commandButton onclick="blockme();" action="{!cancel}" value="取消" rerender="checEventFrame,allForm" oncomplete="unblockUI();checEventFrame()"/>
            </apex:pageBlockButtons>
             <table>
                <tr>
                    <td width="20px"/>
                    <td width="35%">
                      <apex:outputLabel for="slipNo" value="回寄-运输单号:" />
                      <apex:inputField id="slipNo" value="{!slip.Name}"/>
                      <apex:commandButton style="padding: 6px;font-size: 110%;" action="{!searchSlip}" value="检索" rerender="allForm,checEventFrame"  oncomplete="checEventFrame()"/>
                    </td>
                    <td width="10px"></td>
                    <td width="30%">
                      <apex:outputLabel for="deliveryType" value="回寄-运输单种类:" />
                      <apex:inputField required="false" id="deliveryType" value="{!slip.DeliveryType__c}"/>
                    </td>
                    <td width="10px"></td>
                    <td width="30%">
                      <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></td>
                </tr>
            </table>
            
            <div style="clear:both;"></div>
 
        </apex:pageBlock>
        <apex:pageMessages id="message"/>
        <c:RelationListPagingCmp id="cmpid" pgController="{!this}" hasCheckbox="true"/>
    </apex:outputPanel>
</apex:form>
<apex:outputPanel id="checEventFrame">
<script type="text/javascript" >
    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();
 
    // 【待消耗件数】随【回寄件数】变化
    j$("td.dataCellBorder1.col_Hui_Ji_Jia__c input").change(function(){
        var names = this.name.split(':');
        var i = names[names.length - 4];
        j$("input.rowchkcls")[i].checked = true;
        refreshLine(i);
    });
    checkMessage();
 
    function refreshLine(i){
        var Dao_Huo_OK_Jia__c =parseInt( j$(j$("td.dataCellBorder1.col_Dao_Huo_OK_Jia__c span")[i]).text());
        var Dao_Huo_NG_Jia__c = parseInt(j$(j$("td.dataCellBorder1.col_Dao_Huo_NG_Jia__c span")[i]).text());
        var Yi_Xiao_Hao_Jia__c = parseInt(j$(j$("td.dataCellBorder1.col_Yi_Xiao_Hao_Jia__c span")[i]).text());
        var Hui_Ji_Jia__c = parseInt(j$(j$("td.dataCellBorder1.col_Hui_Ji_Jia__c input")[i]).val());
        if(isNaN(Hui_Ji_Jia__c)){
            Hui_Ji_Jia__c = 0;
        }
        var total = Dao_Huo_OK_Jia__c + Dao_Huo_NG_Jia__c - Yi_Xiao_Hao_Jia__c;
        var Dai_Xiao_Hao_Jia__c = total - Hui_Ji_Jia__c;
        if(Hui_Ji_Jia__c > total){
            alert("回寄件数不可超过 "+(total).toString());
            j$(j$("td.dataCellBorder1.col_Hui_Ji_Jia__c input")[i]).val(null);
        }
        else{
            j$(j$("td.dataCellBorder1.col_Dai_Xiao_Hao_Jia__c span")[i]).text(Dai_Xiao_Hao_Jia__c);
        }
        return;
    }
 
    function checkMessage() {
        if (j$(escapeVfId('allPage:allForm:done_flg')).val() == 'true') {
            alert("保存成功");
            j$(escapeVfId('allPage:allForm:done_flg')).val('false');
            // 清除url里的save_flag (This can now be done in Chrome, Safari, Firefox 4+, and Internet Explorer 10pp4+!)
            if (window.history.pushState)
                window.history.pushState({},"", window.location.href.replace('&save=1',''));
        }
    }
    var inputBoxs = j$("td.dataCellBorder1.col_Hui_Ji_Jia__c input");
    for(var i = 0;i<inputBoxs.length;i++){
        refreshLine(i);
    }
 
</script>
</apex:outputPanel>
 
</apex:page>