username@email.com
2025-04-23 d34ca25b9754e49b2d1220ff9f0de6af9b734d99
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CY.Infrastructure.Common;
using CY.BLL.EC;
using CY.Model;
using CY.BLL.Sys;
using CY.BLL;
 
namespace CY.WebForm.Pages.business
{
    public partial class DeliverWork : BasePage
    {
        private EC_OrderBasicBLL _eC_OrderBasicBLL = new EC_OrderBasicBLL();
        private Sys_DictionaryBLL _bll_Sys_DictionaryBLL = new Sys_DictionaryBLL();
        private EC_AcceptWayByOrderBLL _AcceptWayByOrderBLL = new EC_AcceptWayByOrderBLL();
        //public int orderId
        //{
        //    get
        //    {
        //        if (Request["id"] != null)
        //        {
        //            return Request["id"].ToString().ToInt32().Value;
        //        }
        //        else
        //        {
        //            return 0;
        //        }
        //    }
        //}
 
        /// <summary>
        /// 绑定收货方式
        /// </summary>
        private void BindAcceptType()
        {
            IEnumerable<Sys_Dictionary> types = _bll_Sys_DictionaryBLL.GetDataByType("收货方式");
            this.ddlAcceptType.DataSource = types;
            this.ddlAcceptType.DataTextField = "Name";
            this.ddlAcceptType.DataValueField = "Keyid";
            this.ddlAcceptType.DataBind();
 
        }
 
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindAcceptType();
 
                List<EC_OrderBasic> m_EC_OrderBasicList = _eC_OrderBasicBLL.GetEC_OrderBasicListByKeyid(Request["ids"].ToString2().Trim(','), CurrentUser.MemberId) as List<EC_OrderBasic>;
                this.RepClientList.DataSource = m_EC_OrderBasicList;
                this.RepClientList.DataBind();
 
 
                EC_AwbInfo model = _eC_OrderBasicBLL.SelectAwbInfoById(m_EC_OrderBasicList[0].Keyid.Value);
                    if (model != null)
                    {
                        this.txtTheAwb.Text = model.TheAwb;
                        this.txtDeliverPerson.Text = model.DeliverPerson;
                        if (model.DeliverTime.HasValue)
                            this.txtDeliverTime.Text = model.DeliverTime.Value.ToShortDateString();
                        this.txtRemark.Text = model.Remark;
                        this.ddlAcceptType.SelectedValue = model.AcceptTypeId.ToString();
                        switch (model.AcceptTypeId)
                        {
                            case 105:
                                this.txtAppointCourierCompany.Text = model.AppointCourierCompany.ToString();
                                this.txtFetchContacts.Text=model.FetchContacts;
                                this.txtFetchAddress.Text = model.FetchAddress.ToString();
                                this.txtFetchPhoneNum.Text = model.FetchPhoneNum.ToString();
                                break;
                            case 107:
                                this.txtAppointCourierCompany.Text = model.AppointCourierCompany.ToString();
                                this.txtFetchContacts.Text=model.FetchContacts;
                                this.txtFetchAddress.Text = model.FetchAddress.ToString();
                                this.txtFetchPhoneNum.Text = model.FetchPhoneNum.ToString();
                                break;
                            case 106:
                                this.txtAcceptPerson.Text = model.FetchContacts;
                                this.txtAcceptPhoneNum.Text = model.FetchPhoneNum;
                                break;
                        }
                       
                        
                    }
                    else
                    {
                        this.txtDeliverTime.Text = DateTime.Now.ToShortDateString();
                        EC_AcceptWayByOrder acceptWayByOrder = _AcceptWayByOrderBLL.GetModelByTargetId(m_EC_OrderBasicList[0].Keyid.Value);
                        if (acceptWayByOrder != null)
                        {
                            this.ddlAcceptType.SelectedValue = acceptWayByOrder.AcceptTypeId.ToString();
                            this.txtAppointCourierCompany.Text = acceptWayByOrder.AppointCourierCompany;
                            this.txtFetchContacts.Text = acceptWayByOrder.FetchContacts;
                            this.txtFetchAddress.Text = acceptWayByOrder.FetchAddress;
                            this.txtFetchPhoneNum.Text = acceptWayByOrder.FetchPhoneNum;
                            this.txtAcceptPerson.Text = acceptWayByOrder.AcceptContacts;
                            this.txtAcceptPhoneNum.Text = acceptWayByOrder.AccepterPhoneNum;
                        }
                    }
                    if (Request["OrderState"] != null)
                    {
                        int orderState = Request["OrderState"].ToString().ToInt32().Value;
                        if (orderState == -1)
                        {
                            this.radDeliverType.SelectedValue = "1";
                            this.radDeliverType.Enabled = false;
                        }
                        else
                        {
                            if (orderState == 5)
                            {
                                this.radDeliverType.SelectedValue = "-1";
                            }
                            else
                            {
                                this.radDeliverType.SelectedValue = "1";
                            }
                        }
                    }
                 
            }
        }
 
        
 
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            bool isSuccess = false;
            string[] ids = Request["ids"].ToString2().Trim(',').Split(',');
 
            foreach (var item in ids)
            {
                EC_AwbInfo eC_AwbInfo = new EC_AwbInfo();
                eC_AwbInfo.Keyid = item.ToInt32();
                eC_AwbInfo.TheAwb = this.txtTheAwb.Text;
                eC_AwbInfo.DeliverPerson = this.txtDeliverPerson.Text;
                if (this.txtDeliverTime.Text != string.Empty)
                    eC_AwbInfo.DeliverTime = this.txtDeliverTime.Text.ToDateTime2();
 
                eC_AwbInfo.AcceptTypeId = ddlAcceptType.SelectedValue.ToString().ToInt32().Value;
                switch (eC_AwbInfo.AcceptTypeId)
                {
                    case 104:
                        eC_AwbInfo.AppointCourierCompany = string.Empty;
                        eC_AwbInfo.FetchAddress = string.Empty;
                        eC_AwbInfo.FetchContacts = string.Empty;
                        eC_AwbInfo.FetchPhoneNum = string.Empty;
                        break;
                    case 105:
                        eC_AwbInfo.AppointCourierCompany = this.txtAppointCourierCompany.Text;
                        eC_AwbInfo.FetchAddress = this.txtFetchAddress.Text;
                        eC_AwbInfo.FetchContacts = this.txtFetchContacts.Text;
                        eC_AwbInfo.FetchPhoneNum = this.txtFetchPhoneNum.Text;
                        break;
                    case 106:
                        eC_AwbInfo.AppointCourierCompany = string.Empty;
                        eC_AwbInfo.FetchAddress = string.Empty;
                        eC_AwbInfo.FetchContacts = this.txtAcceptPerson.Text;
                        eC_AwbInfo.FetchPhoneNum = this.txtAcceptPhoneNum.Text;
                        break;
                    case 107:
                        eC_AwbInfo.AppointCourierCompany = this.txtAppointCourierCompany.Text;
                        eC_AwbInfo.FetchAddress = this.txtFetchAddress.Text;
                        eC_AwbInfo.FetchContacts = this.txtFetchContacts.Text;
                        eC_AwbInfo.FetchPhoneNum = this.txtFetchPhoneNum.Text;
                        break;
                }
                eC_AwbInfo.Remark = this.txtRemark.Text;
                eC_AwbInfo.Operate.OrderId = eC_AwbInfo.Keyid;
                eC_AwbInfo.Operate.Remark = eC_AwbInfo.Remark;
                eC_AwbInfo.Operate.Operator = CurrentUser.ShortName;
                //int orderState = Request["OrderState"].ToString().ToInt32().Value;
               var order = _eC_OrderBasicBLL.SelectModelById(item.ToInt32().Value);
                int orderState = order.OrderState.Value;
                if (orderState == -1)
                {
                    eC_AwbInfo.Operate.OperateType = -1;
                }
                else if (this.radDeliverType.SelectedValue == "1")
                {
                    eC_AwbInfo.Operate.OperateType = 5;
                }
                else
                {
                    eC_AwbInfo.Operate.OperateType = 4;
                }
 
                isSuccess = _eC_OrderBasicBLL.DeliverPresswork(eC_AwbInfo);
                if (isSuccess)
                {
                    EC_OrderBasic m_EC_OrderBasic_Out = _eC_OrderBasicBLL.SelectFromOutOrderById(eC_AwbInfo.Keyid.ToInt32() ?? 0);
                    if (m_EC_OrderBasic_Out != null)
                    {
                        EC_AwbInfo m_EC_AwbInfoOut = new EC_AwbInfo();
                        m_EC_AwbInfoOut = eC_AwbInfo;
                        m_EC_AwbInfoOut.Keyid = m_EC_OrderBasic_Out.Keyid;
                        m_EC_AwbInfoOut.Operate.OrderId = eC_AwbInfo.Keyid;
                        isSuccess = _eC_OrderBasicBLL.DeliverPresswork(m_EC_AwbInfoOut);
                        if (!isSuccess)
                        {
                            JavaScript.MessageBox("操作失败", this);
                        }
                    }
 
                }
                else
                {
                    JavaScript.MessageBox("操作失败", this);
                }
            }
               
           
            
 
 
            if (isSuccess)
            {
                JavaScript.MessageBox("操作成功", this, true, true);
            }
            else
            {
                JavaScript.MessageBox("操作失败", this);
            }
        }
    }
}