| | |
| | | using CY.WebForm.Pages.common; |
| | | using CY.BLL.EC; |
| | | using CY.Model.Inquiry; |
| | | using System.Transactions; |
| | | |
| | | namespace CY.WebForm.Pages.business |
| | | { |
| | |
| | | OA_DeliverPlanBLL _OA_DeliverPlanBLL = null; |
| | | OA_StaffBLL bll_OA_StaffBLL = null; |
| | | OA_CarManageBll _OA_CarManageBll = null; |
| | | OA_DeliverPlanPaicheBLL _OA_DeliverPlanPaicheBLL = null; |
| | | |
| | | |
| | | //初始化 |
| | |
| | | _OA_DeliverPlanBLL = new OA_DeliverPlanBLL(); |
| | | bll_OA_StaffBLL = new OA_StaffBLL(); |
| | | _OA_CarManageBll = new OA_CarManageBll(); |
| | | _OA_DeliverPlanPaicheBLL = new OA_DeliverPlanPaicheBLL(); |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | |
| | | this.selDriverId.DataSource = bll_OA_StaffBLL.SelectListByFirmId(CurrentUser.MemberId, null, null).Where(x => x.BF_IsDriver == true);//.Where(x => x.SM_Post.Equals("驾驶员")) ; |
| | | this.selDriverId.DataTextField = "Name"; |
| | | this.selDriverId.DataValueField = "Keyid"; |
| | | this.selDriverId.DataBind(); |
| | | this.selDriverId.Items.Insert(0, new ListItem("请选择", "")); |
| | | this.selCarId.DataSource = _OA_CarManageBll.SelectListByFirmId(CurrentUser.MemberId); |
| | | this.selCarId.DataTextField = "CarNumber"; |
| | | this.selCarId.DataValueField = "Keyid"; |
| | | this.selCarId.DataBind(); |
| | | this.selCarId.Items.Insert(0, new ListItem("请选择", "")); |
| | | |
| | | |
| | | string keyid = Request["keyid"]; |
| | | |
| | | |
| | | var ids = Request["ids"].ToString().Trim(',').Split(','); |
| | | //var dizhi = ""; |
| | | for (int i = 0; i < ids.Length; i++) |
| | | { |
| | | var deliverPlan = _OA_DeliverPlanBLL.GetModelByKeyid(ids[i].ToGuid2(), null, null); |
| | | if(i == 0) |
| | | { |
| | | //dizhi = deliverPlan.Dizhi; |
| | | if (deliverPlan.DeliverTime.HasValue) |
| | | { |
| | | this.txtDeliverTime.Value = deliverPlan.DeliverTime.Value.ToString("yyyy-MM-dd"); |
| | | } |
| | | } |
| | | //else |
| | | //{ |
| | | // if(deliverPlan.Dizhi != dizhi) |
| | | // { |
| | | // //操作成功 |
| | | // JavaScript.MessageBox("不同地址的订单不能统一派车", this, true, false); |
| | | // return; |
| | | // } |
| | | //} |
| | | if(deliverPlan.CarId.HasValue && deliverPlan.CarId.Value > 0) |
| | | { |
| | | //操作成功 |
| | | JavaScript.MessageBox("已经派车的送货单不能重复派车", this, true, false); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | bool isWin = false; |
| | | using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, |
| | | new TransactionOptions |
| | | { |
| | | IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted, |
| | | Timeout = TransactionManager.MaximumTimeout |
| | | } |
| | | ) |
| | | ) |
| | | { |
| | | try |
| | | { |
| | | |
| | | var ids = Request["ids"].ToString().Trim(',').Split(','); |
| | | |
| | | |
| | | OA_DeliverPlan oA_DeliverPlanPaiche = null; |
| | | var Keyid = Guid.NewGuid(); |
| | | int DriverId = 0; |
| | | var i = 0; |
| | | var carManage = _OA_CarManageBll.GetModelByKeyid(this.selCarId.Value.ToInt32()); |
| | | if (carManage != null) |
| | | { |
| | | DriverId = carManage.StaffID ?? 0; |
| | | } |
| | | else |
| | | { |
| | | DriverId = 0; |
| | | } |
| | | var dingdanhao = "送货单:"; |
| | | |
| | | foreach (var keyid in ids) |
| | | { |
| | | var deliverPlan = _OA_DeliverPlanBLL.GetModelByKeyid(keyid.ToGuid2(), null, null); |
| | | |
| | | deliverPlan.DriverId = this.selDriverId.Value.ToInt32(); |
| | | |
| | | var carManage = _OA_CarManageBll.SelectListByFirmId(CurrentUser.MemberId).Where(x => x.StaffID == deliverPlan.DriverId).FirstOrDefault(); |
| | | if (carManage != null) |
| | | if (i == 0) |
| | | { |
| | | deliverPlan.CarId = carManage.Keyid ?? 0; |
| | | oA_DeliverPlanPaiche = deliverPlan; |
| | | } |
| | | dingdanhao += deliverPlan.SellerOrderId + ","; |
| | | deliverPlan.CarId = this.selCarId.Value.ToInt32(); |
| | | deliverPlan.DriverId = DriverId; |
| | | deliverPlan.DeliverPlanPaicheid = Keyid; |
| | | deliverPlan.Updater = CurrentUser.TrueMemberId; |
| | | deliverPlan.LastUpdateTime = DateTime.Now; |
| | | isWin = _OA_DeliverPlanBLL.UpdateModel(deliverPlan); |
| | | } |
| | | oA_DeliverPlanPaiche.Keyid = Keyid; |
| | | oA_DeliverPlanPaiche.DeliverTime = this.txtDeliverTime.Value.ToDateTime2(); |
| | | oA_DeliverPlanPaiche.Remark = dingdanhao.Trim(',')+"。" + this.txtZhuyishixiang.Value; |
| | | oA_DeliverPlanPaiche.shuliang = ids.Length; |
| | | var oA_DeliverPlans = _OA_DeliverPlanPaicheBLL.GetModelByDeliveredTime(CurrentUser.MemberId, oA_DeliverPlanPaiche.DeliverTime.Value).Max(x=>x.Sort); |
| | | if (oA_DeliverPlans.HasValue) |
| | | { |
| | | oA_DeliverPlanPaiche.Sort = oA_DeliverPlans.Value + 1; |
| | | } |
| | | else |
| | | { |
| | | deliverPlan.CarId = 0; |
| | | } |
| | | isWin = _OA_DeliverPlanBLL.UpdateModel(deliverPlan); |
| | | oA_DeliverPlanPaiche.Sort = 1; |
| | | } |
| | | |
| | | |
| | | |
| | | isWin = _OA_DeliverPlanPaicheBLL.InsertModel(oA_DeliverPlanPaiche); |
| | | scope.Complete(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | isWin = false; |
| | | |
| | | PAGEHandleException(ex); |
| | | JavaScript.MessageBox("操作失败", this); |
| | | } |
| | | finally |
| | | { |
| | | // 释放资源 |
| | | scope.Dispose(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |