/// <summary> /// 增加一条订单运单数据 /// </summary> /// <param name="arrOrderID"></param> /// <param name="model"></param> /// <returns></returns> public bool AddOrderExpress(string[] arrOrderNum, WX_ZZSCOrderExpressInfo model) { //DAL WX_ZZSCOrderExpressDAL dal = new WX_ZZSCOrderExpressDAL(); List<string> listSql = new List<string>(); List<object> listPar = new List<object>(); //校验 IEnumerable<WX_ZZSCOrderExpressInfo> list = dal.Query<WX_ZZSCOrderExpressInfo>(string.Format(" OrderNum IN ('{0}')", string.Join("','", arrOrderNum))); IEnumerable<string> listOrderNum = arrOrderNum.Where(x => list.FirstOrDefault(y => y.OrderNum.Equals(x)) == null); foreach (var item in listOrderNum) { model.ID = Guid.NewGuid().ToString("N"); model.OrderNum = item; model.ExpressCode = string.Empty; model.ExpressNum = string.Empty; model.ExpressType = string.Empty; model.Flag = 0; model.NowState = 0; model.State = 0; model.Remark = string.Empty; listSql.Add(dal.AddSQL()); listPar.Add(model); } return dal.ExecuteTran(listSql, listPar); }
/// <summary> /// 填写快递单号实现业务逻辑方法 /// </summary> /// <param name="orderNum"></param> /// <param name="expCode"></param> /// <param name="expNum"></param> /// <param name="expType"></param> /// <returns></returns> public bool WriteExpressOpe(string orderNum, string expCode, string expNum, string expType) { //Result bool flag = false; //DAL WX_ZZSCOrderExpressDAL dal = new WX_ZZSCOrderExpressDAL(); //Query WX_ZZSCOrderExpressInfo info = dal.Query<WX_ZZSCOrderExpressInfo>(" OrderNum = @OrderNum ", new { OrderNum = orderNum }).FirstOrDefault(); if (info != null) { info.ExpressCode = expCode; info.ExpressNum = expNum; info.ExpressType = expType; info.State = 1; //已发货 info.Flag = 1; //已生效 info.NowState = 1; //已发货 List<string> listSql = new List<string>(); List<object> listPar = new List<object>(); //Update listSql.Add(dal.UpdateSQL()); listPar.Add(info); //填写快递单号后:BeOrder + Order表更新状态 AdminOrderDAL adminDal = new AdminOrderDAL(); listSql.Add(adminDal.OrderLogisticsStateOpeSQL()); listPar.Add(new { OrderNum = info.OrderNum, LogisticsState = 1 }); flag = dal.ExecuteTran(listSql, listPar); } return flag; }