/// <summary> /// 条件报损订单信息 /// </summary> /// <param name="parm"></param> /// <returns></returns> public async Task <ApiResult <string> > AddAsync(ErpSkuLossOrder parm) { var res = new ApiResult <string>() { data = "1", statusCode = (int)ApiEnum.Error }; try { var skuList = Utils.StrToListString(parm.SkuList); parm.Guid = Guid.NewGuid().ToString(); var result = Db.Ado.UseTran(() => { Db.Insertable(parm).ExecuteCommand(); //更改报损信息为销售状态,并修改订单编号 Db.Updateable <ErpSkuLoss>() .UpdateColumns(m => new ErpSkuLoss() { Types = 1, OrderGuid = parm.Guid }) .Where(m => skuList.Contains(m.Guid)).ExecuteCommand(); }); res.statusCode = (int)ApiEnum.Status; if (!result.IsSuccess) { res.message = result.ErrorMessage; } } catch (Exception ex) { res.message = ApiEnum.Error.GetEnumText() + ex.Message; } return(await Task.Run(() => res)); }
public void OnGet(string guid, string sku) { OrderModel = _lossOrderService.GetByGuidAsync(guid).Result.data; if (string.IsNullOrEmpty(guid)) { OrderModel.SkuList = sku; } }
/// <summary> /// 获得一条信息 /// </summary> /// <param name="parm"></param> /// <returns></returns> public async Task <ApiResult <ErpSkuLossOrder> > GetByGuidAsync(string parm) { var model = ErpSkuLossOrderDb.GetSingle(m => m.Guid == parm); if (model == null) { var dayCount = ErpSkuLossOrderDb.Count(m => SqlFunc.DateIsSame(m.AddDate, DateTime.Now)); model = new ErpSkuLossOrder() { Number = "SL-" + DateTime.Now.ToString("yyyyMMdd") + "-" + (1001 + dayCount) }; } var res = new ApiResult <ErpSkuLossOrder> { statusCode = 200, data = model ?? new ErpSkuLossOrder() { } }; return(await Task.Run(() => res)); }
/// <summary> /// 修改一条数据 /// </summary> /// <param name="parm"></param> /// <returns></returns> public async Task <ApiResult <string> > ModifyAsync(ErpSkuLossOrder parm) { var res = new ApiResult <string>() { statusCode = 200 }; try { var dbres = ErpSkuLossOrderDb.Update(parm); if (!dbres) { res.statusCode = (int)ApiEnum.Error; res.message = "修改数据失败~"; } } catch (Exception ex) { res.statusCode = (int)ApiEnum.Error; res.message = ApiEnum.Error.GetEnumText() + ex.Message; } return(await Task.Run(() => res)); }
public async Task <ApiResult <string> > ModifyLossOrder(ErpSkuLossOrder parm) { return(await _lossOrderService.ModifyAsync(parm)); }