buli
2022-05-09 0953b3b5fcf19c627c6479a6b86648df653c40db
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<apex:page id="Page" Controller="SWOSearchProductContaroller" sidebar="false" showHeader="false" action="{!init}">
  <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
    <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
    <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
    <apex:includeScript value="{!URLFOR($Resource.connection20)}"/>
    <apex:includeScript value="{!URLFOR($Resource.apex20)}"/>
 
    <script>
       var QuoteEntryMaxLine = 150;
         
       function setProductList() {
  
            var nextLine = top.window.opener.getLastLineNoNext(window.opener.document);
 
            var hasCheckedCnt = 0;
         
            var checklist = j$("input[name='checklist']");
           
           
            for(var i=0; i<checklist.length; i++){
                
                    if (checklist[i].checked) {
                        
                        hasCheckedCnt++;
                        if (nextLine < QuoteEntryMaxLine) {
                            
                            SetProductId(nextLine, i);
                            nextLine++;
                        } else {
                            return false;
                        }
                    }
            }
            if (hasCheckedCnt == 0) {
                alert(top.window.opener.Error_Message34);
                return false;
            }
            top.window.close();
        }
 
        function setProductOne(lineno, i) {
            SetProductId(lineno, i);
            window.opener.doReroad();
            top.window.close();
        }
 
        function doSearch() {
            blockme();
            serProduct.call();
        }
 
        function SetProductId(lineno, i) {
          var ProductName = j$(escapeVfId("Page:allForm:allBlock:ProductList:theTable_content:"+ i +":ProductName")).text();
          var productId = j$(escapeVfId("Page:allForm:allBlock:ProductList:theTable_content:"+ i +":productId")).text();
          var ProductCode = j$(escapeVfId("Page:allForm:allBlock:ProductList:theTable_content:"+ i +":ProductCode")).text();            
            var Description = j$(escapeVfId("Page:allForm:allBlock:ProductList:theTable_content:"+ i +":Description")).value();
 
            if (Description.indexOf(";") != -1) {
                var array = Description.split(";");
                Description = '';
                for (var i = 0; i <array.length; i++) {
                    if (array[i] != '') {
                        Description += array[i] + ';\n';
                    }   
                }
            }
            var PART_NUMBER = j$(escapeVfId("Page:allForm:allBlock:ProductList:theTable_content:"+ i +":PART_NUMBER")).text();
            var ProductInventory = j$(escapeVfId("Page:allForm:allBlock:ProductList:theTable_content:"+ i +":ProductInventory")).text();
 
            var type = j$(escapeVfId("type")).value();
          
            if ("Quotes" == type) {
                window.opener.j$(escapeVfId("Page:allForm:allBlock:ProductInfoList:theTable_content:" + lineno  + ":ProductName")).val(ProductName);
                window.opener.j$(escapeVfId("Page:allForm:allBlock:ProductInfoList:theTable_content:" + lineno  + ":productId")).val(productId);
                window.opener.j$(escapeVfId("Page:allForm:allBlock:ProductInfoList:theTable_content:" + lineno  + ":ProductCode")).text(ProductCode);
                window.opener.j$(escapeVfId("Page:allForm:allBlock:ProductInfoList:theTable_content:" + lineno  + ":Description")).val(Description);
                window.opener.j$(escapeVfId("Page:allForm:allBlock:ProductInfoList:theTable_content:" + lineno  + ":PART_NUMBER")).text(PART_NUMBER);
                window.opener.j$(escapeVfId("Page:allForm:allBlock:ProductInfoList:theTable_content:" + lineno  + ":ProductInventory")).text(ProductInventory);
                window.opener.j$(escapeVfId("Page:allForm:allBlock:ProductInfoList:theTable_content:" + lineno  + ":quantity")).val(1);
           }else{
                window.opener.j$(escapeVfId("Page:mainForm:diagnosisList:" + lineno  + ":Name")).val(ProductName);
                window.opener.j$(escapeVfId("Page:mainForm:diagnosisList:" + lineno  + ":partNumber")).val(ProductCode);
                window.opener.j$(escapeVfId("Page:mainForm:diagnosisList:" + lineno  + ":productId")).val(productId);
                window.opener.j$(escapeVfId("Page:mainForm:diagnosisList:" + lineno  + ":description")).val(Description);
           }
            
        }
 
    </script>
    
    <style type="text/css">
        div#iframelike {
            color: #fff;
            height: 300px;
            overflow-y: auto;
            overflow-x: hidden;
        }
    </style>
    <apex:outputPanel id="all">
        <apex:outputPanel id="message1">
            <apex:messages styleClass="editListError"/>
        </apex:outputPanel>
        <apex:form id="allForm">
        <apex:actionFunction action="{!serProduct}" name="serProduct" reRender="ProductList,message1" oncomplete="unblockUI();"/>
        <input type="hidden" id="type" value="{!type}"/>
        <!-- <apex:actionFunction name="save" action="{!save}" rerender="allForm" onComplete="unblockUI();refreshPage();closeJs();"></apex:actionFunction> -->
        <!-- <input type="hidden" id="baseUrl" value="{!baseUrl}"/> -->
        <apex:pageBlock title="Product" id="allBlock">
            <apex:pageblocksection columns="1"  id="ProductList">
                <apex:outputPanel >
                    <DIV style="OVERFLOW-Y: hidden; OVERFLOW-X:auto;width:1260px">
                         
                        <div id="ProductList:tablediv" style="OVERFLOW-X: hidden; OVERFLOW-Y:auto;width:1800px; height:400px">
 
                            <apex:pageBlock id="idSearchSetProduct" title="{!$Label.Product_Search}">
                                <!-- <table width="900" border="0" style="background-color:#DCDCDC"> -->
                                <table width="900" border="0" >
 
                                    <colgroup>
                                        <col width="12" />
                                        <col width="20" />
                                        <col width="20" />
                                        <col width="200" />
                                        <col width="20" />
                                        <col width="100" />
                                        <col width="120" />
                                        <col width="208" />
                                    </colgroup>
                                    <tr>
                                        <td> </td>
                                        <th>{!$Label.Search_Condition}</th>
                                        <td> </td>
                                        <th>{!$Label.Asset_No}</th>
                                        <td> </td>
                                        <td> </td>
                                        <td> </td>
                                        <td> </td>
                                    </tr>
                                    <tr>
                                        <td> </td>
                                        <td> </td>
                                        <td> </td>
                                        <td><apex:inputText id="searchName" value="{!SearchName}" style="width:200px" required="false"/></td>
                                        <td><apex:commandButton value="{!$Label.Search}" onclick="doSearch();return false;" style="width:100px" /></td>
                                        
                                        <td> <apex:commandButton value="{!$Label.Add_Product}" style="width:100px;float:right;" rerender="dummy" onclick="setProductList();return false;"/></td>
                                    </tr>
                                    <!-- <tr>
                                        <td style="border-bottom: 1px solid #888;" colspan="15"> </td>
                                    </tr> -->
                                </table>
                            </apex:pageBlock>
                            <table id="theTable_header" border="0" style ="width:1800px;text-align: center;"   styleClass="list">
                            <thead>
                                <tr>
                                     <th>{!$Label.Search_Result}</th>
                                </tr>
                                <tr>
                                   <td style ="width: 1%;text-align: center" scope="col">选择</td>
                                    <td style ="width: 1%;text-align: center" scope="col">No</td>
 
                                    
                                    
                                    <td style ="width: 10%;text-align: center" scope="col">ProductName</td>
 
                                    <td style ="width: 10%;text-align: center" scope="col">OTCode</td>
                                    <td style ="width: 10%;text-align: center" scope="col">DESCRIPTION</td>
                                    <!-- <td style ="width: 10%;;text-align: center" scope="col">Part Number</td>
                                    <td style ="width: 10%;;text-align: center" scope="col">库存</td> -->
                                </tr>
                            </thead>
                        </table>
 
                            <apex:dataTable value="{!productInfoList}"  var="ProductInfo" id="theTable_content" border="0" 
                            style="width:1800px;border-bottom-width: 0px; font-size:11px; border-spacing:0;text-align: left;" styleClass="list"> 
                                <apex:column style="width: 2.3%" >
                                           
                                            <input type="checkbox" name="checklist" value="" />
                                        </apex:column>
                                <apex:column style="width: 1%">
                                    <apex:outputText value="{!ProductInfo.lineNumber}" id="lineNumber" style="resize:vertical;width: 95%"/>
                                </apex:column>
                                 
                                
                                <apex:column style="width: 10%">
                                    <apex:outputText value="{!ProductInfo.productPage.Name}" id="ProductName" style="resize:vertical;width: 95%"/>
                                    <apex:outputText id="productId" value="{!ProductInfo.productId}" style="display: none;"/>
                                </apex:column>
                                <apex:column style="width: 10%">
                                    <!-- <c:PDFWbr targetStr="{!ProductInfo.productPage.ProductCode}" id="ProductCode"/> -->
                                    <apex:outputText value="{!ProductInfo.productPage.ProductCode}" id="ProductCode" style="resize:vertical;width: 95%"/>
                                </apex:column>
                                <apex:column style="width: 10%">
                                    <!-- <c:PDFWbr targetStr="{!ProductInfo.productPage.Description}" id="Description"/> -->
                                    <apex:outputField value="{!ProductInfo.productPage.Description}" id="Description" style="resize:vertical;width: 95%"/>
                                </apex:column>
                                <!-- <apex:column style="width: 10%">
                                   
                                    <apex:outputText value="{!ProductInfo.productPage.PART_NUMBER__c}" id="PART_NUMBER" style="resize:vertical;width: 95%"/>
                                </apex:column>
 
                                <apex:column style="width: 10%">
                                    
                                    <apex:outputText value="{!ProductInfo.productPage.ProductInventory__c}" id="ProductInventory" style="resize:vertical;width: 95%"/>
                                </apex:column> -->
                                
                        </apex:dataTable>
                    </div>
                </DIV>
            </apex:outputPanel>
        </apex:pageblocksection>
    </apex:pageBlock>
</apex:form>
    </apex:outputPanel>
    <script type="text/javascript">
        // フォーカスセット
        j$(escapeVfId('Page:mainForm:idSearchSetProduct:searchName'))[0].focus();
        j$(escapeVfId('Page:mainForm:idSearchSetProduct:searchName')).val(j$(escapeVfId('Page:mainForm:idSearchSetProduct:searchName')).val());
 
    </script>
  
</apex:page>