/** * OrderList.aspx.cs * * 功 能: 订单列表 * 类 名: OrderList * * Ver 变更日期 负责人 变更内容 * ─────────────────────────────────── * V0.01 2013-5-6 9:16 吴崎均 初版 * V0.02 2013-5-6 18:02 吴崎均 完成分页查询 * V0.03 2013-5-7 17:28 吴崎均 增加订单状态设置(置为:生产、完成)并加上以限制(如:线上订单不可置为完成)、 * 增加批量删除并予以限制(只能删除未受理的厂商新增订单)、 * 增加受理操作并加以限制(只有未受理的订单才能受理) * * * * */ 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.Model; using CY.BLL.Sys; using CY.Infrastructure.Common; using CY.BLL; using CY.WebForm.Pages.common; using System.Transactions; using CY.Infrastructure.Query; using NPOI.SS.UserModel; using NPOI.XSSF.UserModel; using System.IO; namespace CY.WebForm.Pages.business { public partial class InvoicingConfirm : BasePage { EC_OrderBasicBLL _eC_OrderBasicBLL = null; OA_StaffBLL bll_OA_StaffBLL = null; LF_OrderFileBLL _lF_OrderFileBLL = null; EC_OrderBLL _eC_OrderBLL = null; OA_KaipiaoshenqingBLL oA_KaipiaoshenqingBLL = null; /// /// 初始化构造 /// public InvoicingConfirm() { _eC_OrderBasicBLL = new EC_OrderBasicBLL(); bll_OA_StaffBLL = new OA_StaffBLL(); _lF_OrderFileBLL = new LF_OrderFileBLL(); _eC_OrderBLL = new EC_OrderBLL(); oA_KaipiaoshenqingBLL = new OA_KaipiaoshenqingBLL(); } /// /// 加载事件 /// /// /// protected void Page_Load(object sender, EventArgs e) { try { if (Request["downId"] != null) { int iDownId = Convert.ToInt32(Request["downId"]); LF_OrderFile model = _lF_OrderFileBLL.GetModel(iDownId); model.FileState = 1; _lF_OrderFileBLL.UpdateModel(model); string fileName = "";//客户端保存的文件名 string filePath = "";//路径 if (model != null) { fileName = model.FileName;//客户端保存的文件名 filePath = model.FilePath;//路径 } else { JavaScript.MessageBox("文件不存在", this); return; } System.IO.FileInfo fileInfo = new System.IO.FileInfo(filePath); if (fileInfo.Exists == true) { const long ChunkSize = 102400;//100K 每次读取文件,只读取100K,这样可以缓解服务器的压力 byte[] buffer = new byte[ChunkSize]; Response.Clear(); System.IO.FileStream iStream = System.IO.File.OpenRead(filePath); long dataLengthToRead = iStream.Length;//获取下载的文件总大小 Response.ContentType = "application/octet-stream"; Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName)); while (dataLengthToRead > 0 && Response.IsClientConnected) { int lengthRead = iStream.Read(buffer, 0, Convert.ToInt32(ChunkSize));//读取的大小 Response.OutputStream.Write(buffer, 0, lengthRead); Response.Flush(); dataLengthToRead = dataLengthToRead - lengthRead; } Response.Close(); } Response.Redirect("/Pages/business/OrderListBatchOperation.aspx"); return; } switch (Request["Target"]) { case "deleteOrderAll2": AcceptAll2(); break; case "deleteOrderAll3": AcceptAll3(); break; case "AcceptOrder": Accept(); break; case "AcceptOrderAll": AcceptAll(); break; case "ChangeState": //ChangeOrderState(); break; case "BatchDelete": CY.WebForm.cs.WebUtil.DeleteData(_eC_OrderBasicBLL.DeleteDataByIds, CurrentUser.ShortName);//调用通用删除方法 break; case "BatchToOver": UpdataState(-1);//设置状态为完成(不能是1'未受理'或2'已受理') break; case "BatchToProduction": //UpdataState(3);//设置状态为生产中(不能是1'未受理'或2'已受理') break; case "BatchToSend": UpdataState(4);//设置状态为已完工 (不能是1'未受理'或2'已受理') break; case "ToAccountDelay": Delay(1);//请求打款延期 break; case "DeliveryDelay": Delay(2);//请求交货延期 break; case "OrderRepeal": Delay(3);//请求撤单 break; case "ReplyRequest"://答复订单请求 RequestReply(); break; case "RetireOrderBySeller": //卖家直接撤单,或者 RetireOrderBySeller(); break; case "CanPrintAwb": CanPrintAwb(); break; default: Page_Load_Default(); return; } } catch (Exception ex) { PAGEHandleException(ex); Response.Clear(); //Response.Write("参数错误"); Response.Write(ex.Message); } Response.End(); } /// /// 判断是否可以批量打印送货单 /// public void CanPrintAwb() { EC_AcceptWayByOrderBLL _AcceptWayByOrderBLL = new EC_AcceptWayByOrderBLL(); string orderIds = Request["orderIds"].ToString(); string[] orderIdArry = orderIds.Split(','); bool IsFirst = true; string firstAccepterAddress = string.Empty; string result = string.Empty; string jsonStr = "IsCan:'true'"; string msg = "只有送货上门且送货地址相同的订单才能打印送货单"; foreach (string orderIdStr in orderIdArry) { int orderId = orderIdStr.ToInt32().Value; EC_AcceptWayByOrder model = _AcceptWayByOrderBLL.GetModelByTargetId(orderId); if (model == null) continue; if (IsFirst) { firstAccepterAddress = model.AccepterAddress.Trim(); } if (model.AcceptTypeId.Value != 106) { jsonStr = "IsCan:'false',Msg:'" + msg + "'"; break; } if (model.AccepterAddress.Trim() != firstAccepterAddress) { jsonStr = "IsCan:'false',Msg:'" + msg + "'"; break; } IsFirst = false; } result = "{" + jsonStr + "}"; Response.Write(result); } /// /// 更新状态 /// private void UpdataState(int stateId) { Response.Clear(); if (1 == stateId || 2 == stateId) { HttpContext.Current.Response.Write(-2); return; } string paramValue = HttpContext.Current.Request["ids"]; //string stateStr=HttpContext.Current.Request["state"]; string remark = string.Format("{0}", Request["remark"]); int? tempId; //tempId = string.IsNullOrEmpty(stateStr)?null:MyConvert.ConvertToInt32(stateStr); if (string.IsNullOrEmpty(paramValue)/*||!tempId.HasValue*/) { HttpContext.Current.Response.Write(-2); return; } else { } //int stateId=tempId.Value; string[] splitResult = paramValue.Split(','); int i = -1; List oprates = new List(); while (++i < splitResult.Length) { tempId = MyConvert.ConvertToInt32(splitResult[i]); if (!tempId.HasValue) { HttpContext.Current.Response.Write(-2); return; } else { } oprates.Add(new EC_OrderOperate() { OperateType = stateId, OrderId = tempId.Value, Operator = CurrentUser.ShortName, Remark = remark }); } HttpContext.Current.Response.Write((_eC_OrderBasicBLL.UpdateOrderState(oprates.ToArray()) ? 1 : 0)); } /// /// 受理订单(全部订单受理) /// private void Accept() { Response.Clear(); var orderId = string.IsNullOrEmpty(Request["id"]) ? Guid.Empty : MyConvert.ConvertToGuid(Request["id"]); if ( orderId == Guid.Empty) { Response.Write("-2"); return; } var a_Kaipiaoshenqing = oA_KaipiaoshenqingBLL.GetModelByKeyid(orderId); if (a_Kaipiaoshenqing !=null ) { if(a_Kaipiaoshenqing.Kaipiaoshenqing == 3) { Response.Write("已开票,无法撤回!"); return; } if(a_Kaipiaoshenqing.Shenqingleixing == "订单开票") { Dictionary searchParam = new Dictionary(); SetParamValue(searchParam, 1, CurrentUser.MemberId); SetParamValue(searchParam, 2, ""); SetParamValue(searchParam, 3, ""); SetParamValue(searchParam, 4, ""); SetParamValue(searchParam, 5, ""); SetParamValue(searchParam, 6, ""); SetParamValue(searchParam, 7, ""); SetParamValue(searchParam, 8, ""); SetParamValue(searchParam, 9, ""); SetParamValue(searchParam, 10, ""); SetParamValue(searchParam, 11, ""); SetParamValue(searchParam, 12, ""); SetParamValue(searchParam, 13, ""); SetParamValue(searchParam, 14, ""); SetParamValue(searchParam, 15, ""); SetParamValue(searchParam, 16, ""); SetParamValue(searchParam, 18, 0); SetParamValue(searchParam, 19, CurrentUser.TrueMemberId); SetParamValue(searchParam, 20, CurrentUser.StaffId); SetParamValue(searchParam, 21, CurrentUser.TrueName); SetParamValue(searchParam, 22, ""); SetParamValue(searchParam, 23, ""); SetParamValue(searchParam, 24, ""); SetParamValue(searchParam, 25, ""); SetParamValue(searchParam, 26, a_Kaipiaoshenqing.Keyid); SetParamValue(searchParam, 29, ""); SearchParam = searchParam; Infrastructure.Query.Pagination pagination = new Infrastructure.Query.Pagination() { PageSize = 1000, PageIndex = 1 }; IEnumerable result = _eC_OrderBasicBLL.SelectModelPage_Seller(pagination, SearchParam); var PayedMoney = result.Sum(x => x.TradingSingle.PayedMoney); if (PayedMoney.HasValue && PayedMoney > 0) { Response.Write("已经有回款记录,无法撤回!"); return; } } else { if (a_Kaipiaoshenqing.Kehumoney.HasValue && a_Kaipiaoshenqing.Kehumoney.Value > 0) { Response.Write("已经有回款记录,无法撤回!"); return; } } var sss = oA_KaipiaoshenqingBLL.DeleteModel(a_Kaipiaoshenqing); if (!sss) { Response.Write("撤回失败!"); return; } if (a_Kaipiaoshenqing.Shenqingleixing == "订单开票") { EC_OrderExtend model = new EC_OrderExtend(); model.KaipiaoshenqingId = a_Kaipiaoshenqing.Keyid; model.KaipiaoshenqingTime = null; model.Kaipiaoshenqing = 2; model.KaipiaoshenqingCreater = Guid.Empty; sss = _eC_OrderBLL.NewUpdateKaipiaoshenqings(model); if (!sss) { Response.Write("撤回失败!"); return; } } } else { Response.Write("撤回失败!"); return; } Response.Write( "1"); } /// /// 批量受理订单 /// public void AcceptAll() { Response.Clear(); PayAbout payAbout = new PayAbout(); payAbout.LoadNewestPaymentAccount(true); double? commission = MyConvert.ConvertToDouble(CY.Config.WebInfo.Instance.FirmOrderAgencyFee); string orderIds = string.Empty; ; if (Request["ids"] != null) { orderIds = Request["ids"].ToString(); } if (string.IsNullOrEmpty(orderIds) || !commission.HasValue) { Response.Write("-2"); return; } else { } Response.Write(_eC_OrderBasicBLL.AcceptOrderAll(orderIds, commission.Value) ? "1" : "0"); } /// /// 改变订单状态(暂时不启用) /// private void ChangeOrderState() { Response.Clear(); string idsStr = Request["ids"]; string stateIdStr = Request["stateId"]; string remark = string.Format("{0}", Request["remark"]); int? stateId = string.IsNullOrEmpty(stateIdStr) ? null : MyConvert.ConvertToInt32(stateIdStr); if (string.IsNullOrEmpty(idsStr) || !stateId.HasValue) { Response.Write("-2"); return; } else { } string[] ids = idsStr.Split(','); int i = -1; int? tempId = null; List operaters = new List(); while (++i < ids.Length) { tempId = string.IsNullOrEmpty(ids[i]) ? null : MyConvert.ConvertToInt32(ids[i]); if (!tempId.HasValue) { operaters = null; break; } else { } operaters.Add(new EC_OrderOperate() { OrderId = tempId.Value, Operator = CurrentUser.ShortName, OperateType = stateId.Value, Remark = remark }); } if (null == operaters) { Response.Write("-2"); return; } else { } Response.Write(_eC_OrderBasicBLL.UpdateOrderState(operaters.ToArray()) ? "1" : "0"); } /// /// 卖家退单 /// public void RetireOrderBySeller() { string orderidStr = Request["orderid"]; string tovalueStr = Request["tovalue"]; int orderId = orderidStr.ToInt32().Value; decimal retireMony = tovalueStr.ToDecimal2().Value; string operatorName = CurrentUser.ShortName; Response.Write(_eC_OrderBasicBLL.RetireOrderBySeller(orderId, retireMony, operatorName)); } /// /// 请求延期 /// /// 请求类型 private void Delay(int typeId) { Response.Clear(); string receiverStr = Request["receiver"]; string orderidStr = Request["orderid"]; string tovalueStr = Request["tovalue"]; if (string.IsNullOrEmpty(receiverStr) || string.IsNullOrEmpty(orderidStr) || string.IsNullOrEmpty(tovalueStr)) { Response.Write(0); return; } else { } int? orderid = MyConvert.ConvertToInt32(orderidStr); int? tovalue = MyConvert.ConvertToInt32(tovalueStr); Guid receiver = MyConvert.ConvertToGuid(receiverStr); if (Guid.Empty == receiver || !orderid.HasValue || !tovalue.HasValue) { Response.Write(0); return; } else { } EC_OrderDialogue _eC_OrderDialogue = new EC_OrderDialogue(); _eC_OrderDialogue.ReceiverId = receiver; _eC_OrderDialogue.TargetOrder = orderid; _eC_OrderDialogue.TargetValue = tovalue; _eC_OrderDialogue.DialogueTypeId = typeId; _eC_OrderDialogue.InitiatorId = CurrentUser.MemberId; _eC_OrderDialogue.DialogueContent = string.Format("{0}", Request["dialoguecontent"]); //开始请求 Response.Write(_eC_OrderBasicBLL.OrderPropertyChangeRequest(_eC_OrderDialogue)); } /// /// 答复清单请求 /// private void RequestReply() { Response.Clear(); string ridStr = Request["did"]; string isAllowStr = Request["isAllow"]; Guid rid = MyConvert.ConvertToGuid(ridStr); bool? isAllow = Convert.ToBoolean(isAllowStr); if (Guid.Empty == rid || !isAllow.HasValue) { Response.Write(0); return; } else { } Response.Write(_eC_OrderBasicBLL.OrderPropertyChangeReply(rid, CurrentUser.MemberId, isAllow.Value)); } private void ToBatchRemove() { string orderidStr = Request["orderid"]; string tovalueStr = Request["tovalue"]; int orderId = orderidStr.ToInt32().Value; decimal retireMony = tovalueStr.ToDecimal2().Value; string operatorName = CurrentUser.ShortName; Response.Write(_eC_OrderBasicBLL.RetireOrderBySeller(orderId, retireMony, operatorName)); } /// /// 默认执行方法 /// private void Page_Load_Default() { UCPager1.AspNetPager.PageChanged += AspNetPager_PageChanged; btn_Search.Click += btn_Search_Click; // txtCommission.Value = CY.Config.WebInfo.Instance.FirmOrderAgencyFee; List dialogues = _eC_OrderBasicBLL.SelectPropertyChangeRequest(CurrentUser.MemberId) as List; if (!IsPostBack && !IsCallback) { Sys_DictionaryBLL _sys_DictionaryBLL = new Sys_DictionaryBLL();//字典业务逻辑操作类对象 SysInquiry_PrintingTypeBLL _sysInquiry_PrintingTypeBLL = new SysInquiry_PrintingTypeBLL();//印刷业务类型业务逻辑操作类对象 //this.selPayStates.DataSource = _sys_DictionaryBLL.GetDataByType("EC_订单支付状态"); //this.selPayStates.DataBind(); //this.selPayStates.Items.Insert(0, new ListItem("全部", "")); this.selKehuqianshou.DataSource = _sys_DictionaryBLL.GetDataByType("EC_发票签收"); this.selKehuqianshou.DataBind(); this.selKehuqianshou.Items.Insert(0, new ListItem("全部", "")); this.selKaipiaoshenqing.DataSource = _sys_DictionaryBLL.GetDataByType("EC_开票申请"); this.selKaipiaoshenqing.DataBind(); this.selKaipiaoshenqing.Items.Insert(0, new ListItem("全部", "")); //this.selKaipiaoshenqing.Value = "1"; //this.selPayStates.Value = "1"; this.selHuikuanStates.Value = "1"; this.selBusinessManager.DataSource = bll_OA_StaffBLL.SelectListByFirmId(CurrentUser.MemberId, true, false); this.selBusinessManager.DataTextField = "Name"; this.selBusinessManager.DataValueField = "Keyid"; this.selBusinessManager.DataBind(); this.selBusinessManager.Items.Insert(0, new ListItem("全部", "")); //this.selBusinessManager.Items.Insert(1, new ListItem(CurrentUser.ShortName, CurrentUser.ShortName)); //this.txtSQBeginDate.Value = DateTime.Now.AddDays(-14).ToString("yyyy-MM-dd"); //this.txtSQEndDate.Value = DateTime.Now.ToString("yyyy-MM-dd"); //初次数据加载 btn_Search_Click(btn_Search, new EventArgs()); } } #region 查询 /// /// 搜索按钮点击事件 /// /// /// private void btn_Search_Click(object sender, EventArgs e) { /* if (this.txtCustormerName.Value.Trim() == "") { Response.Write("客户名称不能为空,请输入客户名称再查询……"); return; }*/ //Dictionary searchParam = new Dictionary(); //SetParamValue(searchParam, 1, CurrentUser.MemberId); //SetParamValue(searchParam, 2, ""); //SetParamValue(searchParam, 3, this.txtCustormerName.Value.Trim()); //SetParamValue(searchParam, 4, ""); //SetParamValue(searchParam, 5, ""); //SetParamValue(searchParam, 6, ""); //SetParamValue(searchParam, 7, ""); //SetParamValue(searchParam, 8, ""); //SetParamValue(searchParam, 9, this.selPayStates.Value); //SetParamValue(searchParam, 10, ""); //SetParamValue(searchParam, 11, ""); //SetParamValue(searchParam, 12, ""); //SetParamValue(searchParam, 13, this.selBusinessManager.Value); //SetParamValue(searchParam, 14, ""); //SetParamValue(searchParam, 15, ""); //SetParamValue(searchParam, 16, ""); //SetParamValue(searchParam, 18, (CurrentUser.StaffId > 0 ? 1 : 0)); //SetParamValue(searchParam, 19, CurrentUser.TrueMemberId); //SetParamValue(searchParam, 20, CurrentUser.StaffId); //SetParamValue(searchParam, 21, CurrentUser.TrueName); //SetParamValue(searchParam, 22, this.txtSQBeginDate.Value); //SetParamValue(searchParam, 23, this.txtSQEndDate.Value); //SetParamValue(searchParam, 24, this.selKaipiaoshenqing.Value); //SetParamValue(searchParam, 25, this.selKehuqianshou.Value); //SearchParam = searchParam; UCPager1.AspNetPager.CurrentPageIndex = 1;//重置页数 //再次查询 AspNetPager_PageChanged(UCPager1.AspNetPager, new EventArgs()); } /// /// 设置查询参数方法 /// /// 设置目标 /// 键 /// 值 private static void SetParamValue(Dictionary target, int key, object value) { if (string.IsNullOrEmpty(string.Format("{0}", value))) return; else { } if (target.ContainsKey(key)) { target[key] = value; } else { target.Add(key, value); } } /// /// 分页事件 /// /// /// private void AspNetPager_PageChanged(object sender, EventArgs e) { // UCPager1.AspNetPager.PageSize = 3; Infrastructure.Query.Pagination pagination = new Infrastructure.Query.Pagination() { PageSize = UCPager1.AspNetPager.PageSize, PageIndex = UCPager1.AspNetPager.CurrentPageIndex }; IEnumerable result = oA_KaipiaoshenqingBLL.SelectModelPage(pagination, CurrentUser.MemberId, this.txtSQBeginDate.Value, this.txtSQEndDate.Value, this.selKaipiaoshenqing.Value, this.selKehuqianshou.Value, this.selBusinessManager.Value, this.txtCustormerName.Value, this.selPayStates.Value, this.selHuikuanStates.Value ); rptData.DataSource = result; rptData.DataBind(); if (pagination.heji1.HasValue) { this.AllMoney.InnerText = pagination.heji1.Value.ToString("0.00"); } else { this.AllMoney.InnerText = 0.ToString("0.00"); } if (pagination.heji2.HasValue) { this.ZengMoney.InnerText = pagination.heji2.Value.ToString("0.00"); } else { this.ZengMoney.InnerText = 0.ToString("0.00"); } if (pagination.heji3.HasValue) { this.HuiMoney.InnerText = pagination.heji3.Value.ToString("0.00"); } else { this.HuiMoney.InnerText = 0.ToString("0.00"); } UCPager1.AspNetPager.RecordCount = pagination.RecordCount; } //查询事件 protected void btn_Daochu_Click(object src, EventArgs e) { byte[] fileBytes = ExportToExcel(); if (fileBytes != null) { Response.Clear(); Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; Response.AppendHeader("Content-Disposition", "attachment; filename=开票管理导出.xlsx"); Response.BinaryWrite(fileBytes); Response.End(); } else { // 处理导出失败的情况 Response.Write("导出失败,请稍后重试!"); } } public byte[] ExportToExcel() { byte[] bt = null; try { Pagination pa = new Pagination(); pa.PageSize = 1000; pa.PageIndex = 1; IEnumerable results = oA_KaipiaoshenqingBLL.SelectModelPage(pa, CurrentUser.MemberId, this.txtSQBeginDate.Value, this.txtSQEndDate.Value, this.selKaipiaoshenqing.Value, this.selKehuqianshou.Value, this.selBusinessManager.Value, this.txtCustormerName.Value, this.selPayStates.Value, this.selHuikuanStates.Value); // 创建工作簿 IWorkbook workbook = new XSSFWorkbook(); ISheet sheet = workbook.CreateSheet("导出数据"); // 创建表头 IRow headerRow = sheet.CreateRow(0); headerRow.CreateCell(0).SetCellValue("编号"); headerRow.CreateCell(1).SetCellValue("申请开票时间"); headerRow.CreateCell(2).SetCellValue("申请类型"); headerRow.CreateCell(3).SetCellValue("业务经理"); headerRow.CreateCell(4).SetCellValue("客户名称"); headerRow.CreateCell(5).SetCellValue("发票号码"); headerRow.CreateCell(6).SetCellValue("订单数量"); headerRow.CreateCell(7).SetCellValue("金额"); headerRow.CreateCell(8).SetCellValue("增减金额"); headerRow.CreateCell(9).SetCellValue("回款金额"); headerRow.CreateCell(10).SetCellValue("最近催款"); headerRow.CreateCell(11).SetCellValue("开票状态"); // 添加数据 int rowIndex = 1; foreach (var oA_Kaipiaoshenqing in results) { IRow row = sheet.CreateRow(rowIndex++); row.CreateCell(0).SetCellValue((rowIndex - 1).ToString()); row.CreateCell(1).SetCellValue(oA_Kaipiaoshenqing.CreateTime.Value.ToString("yyyy-MM-dd")); row.CreateCell(2).SetCellValue(oA_Kaipiaoshenqing.Shenqingleixing); row.CreateCell(3).SetCellValue(oA_Kaipiaoshenqing.BusinessManager); row.CreateCell(4).SetCellValue(oA_Kaipiaoshenqing.BuyerName); row.CreateCell(5).SetCellValue(oA_Kaipiaoshenqing.Fapiaohao); row.CreateCell(6).SetCellValue(oA_Kaipiaoshenqing.Dingdanshu.HasValue? oA_Kaipiaoshenqing.Dingdanshu.Value.ToString():""); row.CreateCell(7).SetCellValue(oA_Kaipiaoshenqing.kpmoney.HasValue ? oA_Kaipiaoshenqing.kpmoney.Value.ToString() : "0"); row.CreateCell(8).SetCellValue(oA_Kaipiaoshenqing.Zengjianmoney.HasValue ? oA_Kaipiaoshenqing.Zengjianmoney.Value.ToString() : "0"); row.CreateCell(9).SetCellValue(oA_Kaipiaoshenqing.Huikuanmoney.HasValue ? oA_Kaipiaoshenqing.Huikuanmoney.Value.ToString() : "0"); row.CreateCell(10).SetCellValue(oA_Kaipiaoshenqing.ShoukuanTime.HasValue? oA_Kaipiaoshenqing.ShoukuanTime.Value.ToString("MM-dd HH:mm") : ""); row.CreateCell(11).SetCellValue(oA_Kaipiaoshenqing.KaipiaoshenqingName); } // 将工作簿写入内存流 using (var ms = new MemoryStream()) { workbook.Write(ms); bt = ms.ToArray(); } } catch (Exception e) { bt = null; // 记录日志 } return bt; } /// /// 查询参数 /// private Dictionary SearchParam { get { return ViewState["SearchParam"] as Dictionary; } set { ViewState["SearchParam"] = value; } } /// /// 是否可以操作 /// /// /// /// /// public bool IsCanOpearte(object keyidObj, object orderStateObj, object outIdObj, object opTypeObj) { bool isCan = false; int keyid = (int)keyidObj; int orderState = (int)orderStateObj; string opType = (string)opTypeObj; int outId = (int)outIdObj; if (orderState == -2) { return false; } if (opType == "回访" || opType == "评价" || opType == "投诉") { if (orderState == 1) { isCan = false; } else { isCan = true; } } else { if (outId > 0) { return false; } if (orderState == 0) { isCan = false; } else if (orderState == -1) { if (opType != "送货") { isCan = false; } else { isCan = true; } } else { if (opType == "受理") { if (orderState == 1) { isCan = true; } } else { if (orderState == 1) { isCan = false; } else { if (opType == "撤单") { if (orderState == 4 || orderState == 5) { isCan = false; } else { isCan = true; } } else { isCan = true; } } } } } return isCan; } /// /// 是否已经操作 /// /// /// /// /// public bool IsOpearted(object keyidObj, object orderStateObj, object opTypeObj) { int keyid = (int)keyidObj; int orderState = (int)orderStateObj; string opType = (string)opTypeObj; return _eC_OrderBasicBLL.IsOpearted(keyid, orderState, opType); } /// /// 批量去除订单 /// public void AcceptAll2() { Response.Clear(); string ids = string.Empty; if (Request["ids"] != null) { ids = Request["ids"].ToString(); } string[] idsArray = ids.Split(','); using (TransactionScope scope = new TransactionScope()) { if (idsArray != null && idsArray.Length > 0) { for (int i = 0; i < idsArray.Length; i++) { bool result = true; EC_OrderExtend model = new EC_OrderExtend(); model.Keyid = idsArray[i].ToInt32(); model.QuchudingdanCreater = CurrentUser.TrueMemberId; model.QuchudingdanTime = DateTime.Now; model.Quchudingdan = 1; result = _eC_OrderBLL.OldUpdateQuchudingdan(model); if (!result) { //Page_Load_Default(); Response.Write("-2"); return; } } } scope.Complete(); } // Page_Load_Default(); Response.Write("1"); } /// /// 批量开票申请 /// public void AcceptAll3() { Response.Clear(); string ids = string.Empty; if (Request["ids"] != null) { ids = Request["ids"].ToString(); } string[] idsArray = ids.Split(','); using (TransactionScope scope = new TransactionScope()) { if (idsArray != null && idsArray.Length > 0) { DateTime kaipiaoshenqing = DateTime.Now; for (int i = 0; i < idsArray.Length; i++) { bool result = true; EC_OrderExtend model = new EC_OrderExtend(); model.Keyid = idsArray[i].ToInt32(); model.KaipiaoshenqingCreater = CurrentUser.TrueMemberId; model.KaipiaoshenqingTime = kaipiaoshenqing; model.Kaipiaoshenqing = 1; result = _eC_OrderBLL.OldUpdateKaipiaoshenqing(model); if (!result) { //Page_Load_Default(); Response.Write("-2"); return; } } } scope.Complete(); } // Page_Load_Default(); Response.Write("1"); } #endregion } }