public void BathcUseOrder(string jsondata, string version, string equType, string equName) { if (string.IsNullOrEmpty(jsondata)) { Context.Response.Write("{\"status\":\"false\",\"data\":\"参数不能为空!\"}"); HttpContext.Current.ApplicationInstance.CompleteRequest(); return; } try { JavaScriptSerializer serializer = new JavaScriptSerializer(); Dictionary<string, object> json = (Dictionary<string, object>)serializer.DeserializeObject(jsondata); string order_no = json["order_no"].ToString(); if (string.IsNullOrEmpty(order_no)) { Context.Response.Write("{\"status\":\"false\",\"data\":\"对不起,订单号不能为空!\"}"); HttpContext.Current.ApplicationInstance.CompleteRequest(); return; } BLL.orders bll_order = new BLL.orders(); //验证票的状态是否可以进行消费 if (bll_order.ValidateOrder(order_no) == 0) { Context.Response.Write("{\"status\":\"false\",\"data\":\"定单未支付!\"}"); HttpContext.Current.ApplicationInstance.CompleteRequest(); return; } int menpiao_type = 0; int count = 0; object[] arrlist = ((object[])json["order_lst"]); Dictionary<string, object> d = null; string json_result = string.Empty; foreach (var _item in arrlist) { d = (Dictionary<string, object>)_item; int.TryParse(d["menpiao_type"].ToString(), out menpiao_type); int.TryParse(d["count"].ToString(), out count); //查未消费的count int unCount = bll_order.GetCountByOrderNO(order_no, menpiao_type); if (unCount < count) { //Context.Response.Write("{\"status\":\"true\",\"data\":\"" + GetMenPiaoTypeName(menpiao_type) + "的余票数量不足!" + (string.IsNullOrEmpty(json_result) ? "" : "消费明细:" + json_result.Remove(json_result.LastIndexOf(','))) + "\"}"); // HttpContext.Current.ApplicationInstance.CompleteRequest(); //return; json_result += GetMenPiaoTypeName(menpiao_type) + "的余票数量不足!,"; continue; } int result = bll_order.BathcUseOrder(order_no, menpiao_type, count); json_result += GetMenPiaoTypeName(menpiao_type) + "消费成功:" + count + "张,"; } WriteWebServiceLog(version, equType, equName, "BathcUseOrder", ""); Context.Response.Write("{\"status\":\"true\",\"data\":\"消费明细:" + json_result.Remove(json_result.LastIndexOf(',')) + "\"}"); HttpContext.Current.ApplicationInstance.CompleteRequest(); } catch (Exception ex) { WriteWebServiceLog(version, equType, equName, "BathcUseOrder", ""); Context.Response.Write("{\"status\":\"false\",\"data\":\"消费失败,请联系管理员!\"}"); HttpContext.Current.ApplicationInstance.CompleteRequest(); return; } }