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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
/**  
* PrintAwbOrder.aspx.cs
*
* 功 能: 打印送货单
* 类 名: PrintAwbOrder
*
* Ver    变更日期             负责人  变更内容
* ───────────────────────────────────
* V0.01  2013-5-17 17:54      吴崎均    初版
*
*
*
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CY.BLL.EC;
using CY.BLL;
using CY.Model;
using CY.Infrastructure.Common;
using System.Text;
using CY.BLL.Sys;
using System.Transactions;
using CY.Model.Inquiry;
 
namespace CY.WebForm.Pages.business
{
    public partial class DeliverOrderPrint : BasePage
    {
        EC_OrderBasicBLL _eC_OrderBasicBLL = null;
        OA_CorporateClientsBLL _oA_CorporateClientsBLL = null;
        EC_MemberBasicBLL _eC_MemberBasicBLL = null;
        OA_StaffBLL oA_StaffBLL = null;
        OA_DeliverPlanBLL _OA_DeliverPlanBLL = null;
        OA_DeliverPlanBLL oA_DeliverPlanBLL = null;
        EC_OrderPrintParameterBLL eC_OrderPrintParameterBLL = null;
        Sys_DictionaryBLL dictionaryBLL = null;
        /// <summary>
        /// 初始化构造
        /// </summary>
        public DeliverOrderPrint()
        {
            _eC_OrderBasicBLL = new EC_OrderBasicBLL();
            _oA_CorporateClientsBLL = new OA_CorporateClientsBLL();
            _eC_MemberBasicBLL = new EC_MemberBasicBLL();
            oA_StaffBLL = new OA_StaffBLL();
            _OA_DeliverPlanBLL = new OA_DeliverPlanBLL();
            oA_DeliverPlanBLL = new OA_DeliverPlanBLL();
            eC_OrderPrintParameterBLL = new EC_OrderPrintParameterBLL();
            dictionaryBLL = new Sys_DictionaryBLL();
        }
 
        /// <summary>
        /// 界面加载事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
 
 
 
 
           
            Guid deliverorderId = Request["deliverorderId"].ToGuid2();
 
 
 
           
            
 
        
 
            List<EC_AcceptWayByOrder> eC_AcceptWayByOrders = null;
            //OA_CorporateClients oA_CorporateClients = null;
            OA_CorporateClients oA_CorporateClientsBiddingcompany = null;
            OA_DeliverPlan oA_DeliverPlan = null;
 
            try
            {
                oA_DeliverPlan = _OA_DeliverPlanBLL.GetModelByKeyid(deliverorderId, null, null);
               // oA_CorporateClients = _oA_CorporateClientsBLL.SelectModelByFirmIdandMemberId(CurrentUser.MemberId, oA_DeliverPlan.BuyerId);
                 
                    oA_CorporateClientsBiddingcompany = _oA_CorporateClientsBLL.SelectBiddingcompanyByFirmId(CurrentUser.MemberId).Where(x => x.Keyid1 == oA_DeliverPlan.Biddingcompany).FirstOrDefault();
                    if (oA_CorporateClientsBiddingcompany != null)
                    {
                        this.spnD.InnerText = oA_CorporateClientsBiddingcompany.CompanyName;
                    }
                
                   
                OA_Staff oA_Staff = oA_StaffBLL.GetModelByKeyid(oA_DeliverPlan.BusinessManagerId);
                if (oA_Staff != null)
                {
                    this.spnB.InnerText = oA_Staff.Name;
                }
                OA_Staff oA_Staffsss = oA_StaffBLL.GetModelByMemberId(oA_DeliverPlan.Creater.Value);
                if (oA_Staffsss != null)
                {
                    this.spnC.InnerText = oA_Staffsss.Name;
                }
                this.spnBuyerName.InnerText = oA_DeliverPlan.CompanyName;
 
                this.spnBuyerAddress.InnerText = oA_DeliverPlan.Dizhi;
                this.spnNowTime.InnerText = oA_DeliverPlan.DeliverTime.Value.ToString("yyyy-MM-dd");
                this.SellerOrderId.InnerText = oA_DeliverPlan.SellerOrderId;
                this.spnBuyerPhone.InnerText = oA_DeliverPlan.Dianhua;
 
 
 
 
 
 
 
                this.spnRemark.InnerText = oA_DeliverPlan.Remark;
 
 
 
 
 
 
                List<Model.EC_OrderBasic> eC_OrderBasics  = _eC_OrderBasicBLL.GetEC_OrderBasicListBydeliverorderId(deliverorderId,CurrentUser.MemberId).ToList();
                decimal SumPrice = 0;
 
                if (eC_OrderBasics != null && eC_OrderBasics.Count > 0)
                {
                    for (int i = 0; i < eC_OrderBasics.Count; i++)
                    {
                        if (i == 0)
                        {
                            EC_AwbInfo m_EC_AwbInfo = _eC_OrderBasicBLL.SelectAwbInfoById(eC_OrderBasics[i].Keyid.Value);
 
 
                            if (m_EC_AwbInfo != null)
                            {
                                if (string.IsNullOrWhiteSpace(this.spnRemark.InnerText))
                                {
                                    this.spnRemark.InnerText = m_EC_AwbInfo.Remark;
                                }
                                
 
                            }
                        }
                        SumPrice += eC_OrderBasics[i].SumPrice.Value;
                        EC_OrderPrintParameter _eC_OrderPrintParameter = eC_OrderPrintParameterBLL.GetModel(eC_OrderBasics[i].Keyid.Value);
                        InquiryCommonModel _inquiryCommonModel = null;
                        if (null == _eC_OrderPrintParameter)
                        {
                            _inquiryCommonModel = new InquiryCommonModel();
                        }
                        else
                        {
                            _inquiryCommonModel = SerializationHelper.DeSerialize(typeof(InquiryCommonModel), _eC_OrderPrintParameter.PrintParameter) as InquiryCommonModel;
                        }
 
                        eC_OrderBasics[i].PrintSizeName = _inquiryCommonModel.PrintSizeName;
                        var sss = dictionaryBLL.GetDataByType("印刷单位").Where(x=>x.MeanValue == eC_OrderBasics[i].OrderExtend.printunit).FirstOrDefault();
                        if (sss != null)
                        {
                            eC_OrderBasics[i].yssldw = sss.Name;
                        }
                    }
                }
                 
                rptData.DataSource = eC_OrderBasics;
                rptData.DataBind();
               
                this.spnSumPrice.InnerText = SumPrice.ToString("#0.00");
                this.spnSumPriceUpper.InnerText = GetChinaMoney(SumPrice); 
 
 
 
 
 
 
 
 
 
 
 
            }
            catch (Exception ex)
            {
                PAGEHandleException(ex);
                Response.Clear();
                Response.Write("<script>alert('数据错误!');</script>");
                Response.End();
            }
 
 
 
        }
 
        public static string GetChinaMoney(decimal money)
        {
            string[] strArray;
            string str = "";
            string str2 = "";
            string str3 = money.ToString("0.00");
            switch (str3.Trim().Length)
            {
                case 4:
                    strArray = new string[] { str3[0].ToString(), "y", str3[2].ToString(), "j", str3[3].ToString(), "f" };
                    str = string.Concat(strArray);
                    break;
 
                case 5:
                    strArray = new string[] { str3[0].ToString(), "s", str3[1].ToString(), "y", str3[3].ToString(), "j", str3[4].ToString(), "f" };
                    str = string.Concat(strArray);
                    break;
 
                case 6:
                    strArray = new string[] { str3[0].ToString(), "b", str3[1].ToString(), "s", str3[2].ToString(), "y", str3[4].ToString(), "j", str3[5].ToString(), "f" };
                    str = string.Concat(strArray);
                    break;
 
                case 7:
                    strArray = new string[] { str3[0].ToString(), "q", str3[1].ToString(), "b", str3[2].ToString(), "s", str3[3].ToString(), "y", str3[5].ToString(), "j", str3[6].ToString(), "f" };
                    str = string.Concat(strArray);
                    break;
 
                case 8:
                    strArray = new string[] { str3[0].ToString(), "w", str3[1].ToString(), "q", str3[2].ToString(), "b", str3[3].ToString(), "s", str3[4].ToString(), "y", str3[6].ToString(), "j", str3[7].ToString(), "f" };
                    str = string.Concat(strArray);
                    break;
 
                case 9:
                    strArray = new string[] { str3[0].ToString(), "s", str3[1].ToString(), "w", str3[2].ToString(), "q", str3[3].ToString(), "b", str3[4].ToString(), "s", str3[5].ToString(), "y", str3[7].ToString(), "j", str3[8].ToString(), "f" };
                    str = string.Concat(strArray);
                    break;
 
                case 10:
                    strArray = new string[] {
                        str3[0].ToString(), "b", str3[1].ToString(), "s", str3[2].ToString(), "w", str3[3].ToString(), "q", str3[4].ToString(), "b", str3[5].ToString(), "s", str3[6].ToString(), "y", str3[8].ToString(), "j",
                        str3[9].ToString(), "f"
                     };
                    str = string.Concat(strArray);
                    break;
 
                case 11:
                    strArray = new string[] {
                        str3[0].ToString(), "q", str3[1].ToString(), "b", str3[2].ToString(), "s", str3[3].ToString(), "w", str3[4].ToString(), "q", str3[5].ToString(), "b", str3[6].ToString(), "s", str3[7].ToString(), "y",
                        str3[9].ToString(), "j", str3[10].ToString(), "f"
                     };
                    str = string.Concat(strArray);
                    break;
 
                case 12:
                    strArray = new string[] {
                        str3[0].ToString(), "m", str3[1].ToString(), "q", str3[2].ToString(), "b", str3[3].ToString(), "s", str3[4].ToString(), "w", str3[5].ToString(), "q", str3[6].ToString(), "b", str3[7].ToString(), "s",
                        str3[8].ToString(), "y", str3[10].ToString(), "j", str3[11].ToString(), "f"
                     };
                    str = string.Concat(strArray);
                    break;
            }
            for (int i = 0; i < str.Trim().Length; i++)
            {
                switch (str[i])
                {
                    case '0':
                        str2 = str2 + "零";
                        break;
 
                    case '1':
                        str2 = str2 + "壹";
                        break;
 
                    case '2':
                        str2 = str2 + "贰";
                        break;
 
                    case '3':
                        str2 = str2 + "叁";
                        break;
 
                    case '4':
                        str2 = str2 + "肆";
                        break;
 
                    case '5':
                        str2 = str2 + "伍";
                        break;
 
                    case '6':
                        str2 = str2 + "陆";
                        break;
 
                    case '7':
                        str2 = str2 + "柒";
                        break;
 
                    case '8':
                        str2 = str2 + "捌";
                        break;
 
                    case '9':
                        str2 = str2 + "玖";
                        break;
 
                    case 'b':
                        str2 = str2 + "佰";
                        break;
 
                    case 'f':
                        str2 = str2 + "分";
                        break;
 
                    case 'j':
                        str2 = str2 + "角";
                        break;
 
                    case 'm':
                        str2 = str2 + "亿";
                        break;
 
                    case 'q':
                        str2 = str2 + "仟";
                        break;
 
                    case 's':
                        str2 = str2 + "拾";
                        break;
 
                    case 'w':
                        str2 = str2 + "万";
                        break;
 
                    case 'y':
                        str2 = str2 + "元";
                        break;
                }
            }
            return str2;
        }
 
 
    }
}