高章伟
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
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
<apex:page Controller="InventoryController" tabStyle="InventoryView__tab" showHeader="true"
    sidebar="true" id="allPage" action="{!init}" title="盘点" >
    <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}" />
    <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}" />
    <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}" />
 
    <script>
function checkAll() {
    var productCount = j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsCnt')).value();
    if (j$(escapeVfId('checker')).attr('checked') == 'checked') {
        var outer = 0;
        for (var i = 0; i < productCount; i++) {
            outer = Math.floor(i / 1000);
            j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTableOuter:' + outer + ':ConsumableorderdetailsTable:' + (i-(1000*outer)) + ':proRowCheckbox')).attr('checked',true);
        }
    } else {
        var outer = 0;
        for (var i = 0; i < productCount; i++) {
            outer = Math.floor(i / 1000);
            j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTableOuter:' + outer + ':ConsumableorderdetailsTable:' + (i-(1000*outer)) + ':proRowCheckbox')).attr('checked',false);
        }
    }
}
 
function refreshPageSizeJs() {
    refreshPageSize();
}
 
//function sortTableJs(key) {
//    blockme();
//    SortStore(key);
//}
function PraseToCSVJs(){
    //打印成csv、
    
    window.open("/customer/InventoryCSV");
}
 
function saveJs() {
    blockme();
    save();
}
 
function searchProductJs() {
    blockme();
    searchConsumableorderdetails();
}
 
function setDisabled() {
    var productCount = j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsCnt')).value();
    var outer = 0;
    for (var i = 0; i < productCount; i++) {
        outer = Math.floor(i / 1000);
        var canselect = j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTableOuter:' + outer + ':ConsumableorderdetailsTable:' + i + ':canSelect')).value();
        if (canselect == 'false') {
            j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTableOuter:' + outer + ':ConsumableorderdetailsTable:' + i + ':shelfnumber')).attr('disabled',true);
        }
    }
}
function calonLoad() {
}
window.sfdcPage.appendToOnloadQueue(function() { calonLoad() });
</script>
    <style>
    .dateFormat {
        display: none;
    }
    td.dataRowCFDA {
        background-color:red;
    }
</style>
    <apex:form id="allForm">
        <apex:actionFunction name="refreshPageSize" action="{!refreshPageSize}" status="fetchStatus" reRender="ConsumableorderdetailsSection1" />
        <apex:actionFunction name="save" action="{!save}"
            rerender="ConsumableorderdetailsSection,ConsumableorderdetailsSection1, message"
            onComplete="unblockUI();">
        </apex:actionFunction>
        <!--<apex:actionFunction name="SortStore" action="{!SortStore}"
            rerender="ConsumableorderdetailsSection,ConsumableorderdetailsSection1, message"
            onComplete="unblockUI();">
        </apex:actionFunction>-->
        <apex:actionFunction name="saveAndSearch" action="{!save}"
            rerender="ConsumableorderdetailsSection,ConsumableorderdetailsSection1, message"
            onComplete="unblockUI();">
            <apex:param name="firstParam" assignTo="{!saveType}" value="" />
        </apex:actionFunction>
        <apex:actionFunction name="saveAndSort" action="{!save}"
            rerender="ConsumableorderdetailsSection,ConsumableorderdetailsSection1, message"
            onComplete="unblockUI();">
            <apex:param name="firstParam" assignTo="{!saveType}" value="" />
            <apex:param name="secondParam" assignTo="{!sortKey}" value="" />
        </apex:actionFunction>
        <apex:actionFunction name="searchConsumableorderdetails"
            action="{!searchConsumableorderdetails}"
            rerender="ConsumableorderdetailsSection,ConsumableorderdetailsSection1,ConsumableorderdetailsSection2, message"
            onComplete="unblockUI();">
        </apex:actionFunction>
        <apex:outputPanel id="allPanel">
            <apex:pageBlock title="库存盘点" id="allBlock">
                <apex:pageBlockButtons location="top">
                    <apex:commandButton onclick="saveJs();" value="盘点确认" rerender="dummy" style="width: 150px;"  />
                </apex:pageBlockButtons>
                <apex:pageBlock id="searchBlock">
                    <table>
                        <colgroup>
                            <col width="160px" />
                            <col width="100px" />
                            <col width="10px" />
                            <col width="70px" />
                            <col width="100px" />
                            <col width="10px" />
                            <col width="90px" />
                            <col width="100px" />
                            <col width="10px" />
                            <col width="85px" />
                            <col width="100px" />
                            <col width="10px" />
                            <col width="70px" />
                            <col width="100px" />
                        </colgroup>
                        <tr>
                            <td align="right">Barcode</td>
                            <td><apex:inputTextarea value="{!barcode}" style="width:600px" /></td>
                            <td />
                            <td align="right"></td>
                            <td><apex:commandButton value="BarCode录入" style="width: 150px;"
                                    onclick="searchProductJs(); return false;" /></td>
                            <td />
                        </tr>
                        <tr>
                            <td></td>
                        </tr>
                    </table>
                </apex:pageBlock>
 
                <apex:outputPanel id="message">
                    <apex:pageMessages />
                </apex:outputPanel>
                <apex:pageBlock title="在库商品库存一览" id="ConsumableorderdetailsSection">
                <input type="hidden" id="allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsCnt" value="{!consumableorderdetailsCount}" />
                    <table class="list" border="0" cellpadding="0" cellspacing="0" >
                    <!--<apex:inputHidden id="ConsumableorderdetailsCnt" value="{!ConsumableorderdetailsCount}" />-->
                        <tr class="headerRow">
                            <th><input type='checkbox' onClick='checkAll()' id='checker'/>是否盘点</th>
                            <th>消耗品名称</th>
                            <th>规格</th>
                            <th>单位</th>
                            <th>有效期内库存</th>
                            <th>过期库存</th>
                        <!--    <th><a href="#" onclick="sortTableJs('1');return false;" style="text-decoration: underline;">库存</a>{!sortOrder[1]}</th>-->
                            <th>盘点</th>
                            <th>丢失</th>
                            <th>寻回</th>
                            <th>差异原因</th>
                                </tr>
        <apex:repeat value="{!ConsumableorderdetailsRecordsview}" var="records" id="ConsumableorderdetailsTableOuter" >
            <apex:repeat value="{!records}" var="m" id="ConsumableorderdetailsTable">
                        <tr class="dataRow">
                            <td>
                                <apex:inputCheckbox value="{!m.check}" id="proRowCheckbox" styleClass="proRowCheckbox"/>
                            </td>
                            <td Class="dataCell">{!m.Prod.Name__c}</td>
                            <td class="dataCell" style="text-align: center;">{!m.Prod.Packing_list_manual__c}</td>
                            <td class="dataCell">{!m.boxPiece}</td>
                            <td class="dataCell" style="text-align: center;">{!m.limitCount}</td>
                            <td class="dataCell" style="text-align: center;">{!m.overlimitCount}</td>
                        <!--    <td class="dataCell" style="text-align: right;">{!m.Countid}</td>-->
                            <td class="dataCell" style="text-align: center;">{!m.Pandian}</td>
                            <td class="dataCell" style="text-align: center;">{!m.Diff}</td>
                            <td class="dataCell" style="text-align: center;">{!m.refind}</td>
                            <td><apex:inputText value="{!m.DiffReason}" /></td>
                        </tr>
            </apex:repeat>
        </apex:repeat>
                    </table>
                </apex:pageBlock>
                <apex:pageBlock id="ConsumableorderdetailsSection1" title="调整明细">
                <apex:pageBlockButtons location="top" rendered="{!done}">
                    <apex:commandButton value="下载本次盘点库存变化明细" style="width: 200px;" action="{!doClick}" />
                </apex:pageBlockButtons>
                    <apex:pageblocktable value="{!codPageRecords}" var="records" id="ConsumableorderdetailsTable1">
                         <apex:column width="80">
                             <apex:facet name="header">消耗品名称</apex:facet>
                             <apex:outputField value="{!records.Prod.Name__c}"/>
                         </apex:column>
                          <apex:column width="80">
                             <apex:facet name="header">单位</apex:facet>
                             <apex:outputField value="{!records.orderdetails2.Box_Piece__c}" />
                         </apex:column>
                          <apex:column width="80">
                             <apex:facet name="header">BarCode</apex:facet>
                             <apex:outputField value="{!records.orderdetails2.Bar_Code__c}"/>
                         </apex:column>
                         <apex:column width="80">
                             <apex:facet name="header">调整原因</apex:facet>
                             <apex:outputText value="{!records.DiffReason}" />
                         </apex:column>
                    </apex:pageblocktable>
                    <table style="width: 100%">
                         <tr>
                            <td>
                                <!-- Page X of Y -->
                                <!-- PageNumber:当前页面所在位置,ResultSize:记录总条数,PageSize:每页记录条数 -->
                                <apex:outputText value="{!(setCon.pageNumber * size)+1-size}-{!IF((setCon.pageNumber * size)>noOfRecords, noOfRecords,
                                 (setCon.pageNumber * size))} 共 {!noOfRecords} 个" />
                                 <!--<apex:outputPanel >
                                    <apex:actionStatus id="fetchStatus" >
                                        <apex:facet name="start" >
                                          <img src="/img/loading.gif" />
                                        </apex:facet>
                                    </apex:actionStatus>
                                </apex:outputPanel>-->
                            </td>
                            <td align="center">
                                <div class="paginator line1">
                                <span class="prevNextLinks">
                                <span class="prevNext">
                                <apex:commandLink status="fetchStatus" reRender="ConsumableorderdetailsSection" action="{!setCon.first}" oncomplete="refreshPageSizeJs();" title="首页" >
                                <img src="/s.gif" title="首页" alt="首页" class="{!if((setCon.hasPrevious),'first','firstoff')}"/>
                                </apex:commandLink>
                                </span>
                                <span class="prevNext">
                                <apex:commandLink status="fetchStatus" reRender="ConsumableorderdetailsSection"  action="{!setCon.previous}" oncomplete="refreshPageSizeJs();"  title="上一页">
                                <img src="/s.gif" title="上一页" alt="上一页" class="{!if((setCon.hasPrevious),'prev','prevoff')}"/>上一页
                                </apex:commandLink>
                                </span>
                                <span class="prevNext">
                                <apex:commandLink status="fetchStatus" reRender="ConsumableorderdetailsSection" action="{!setCon.next}" oncomplete="refreshPageSizeJs();" title="下一页">下一页
                                <img src="/s.gif" title="下一页" alt="下一页" class="{!if((setCon.hasNext),'next','nextoff')}"/>
                                </apex:commandLink>
                                </span>
                                <span class="prevNext">
                                <apex:commandLink status="fetchStatus" reRender="ConsumableorderdetailsSection" action="{!setCon.last}"  oncomplete="refreshPageSizeJs();" title="尾页">
                                <img src="/s.gif" title="尾页" alt="尾页" class="{!if((setCon.hasNext),'last','lastoff')}"/>
                                </apex:commandLink>
                                </span>
                                </span>
                                </div>
                             </td>
                             <td align="right" width="20%">
                            </td>
                        </tr>
                    </table>
                </apex:pageBlock>
            </apex:pageBlock>
        </apex:outputPanel>
    </apex:form>
</apex:page>