public async Task <IActionResult> Add([FromBody] GetInStockNoticeModel model) { return(await Task.Run(() => { var Message = _service.InsUpdateInStockNotice(GetTableData(model)); ReturnModel @return = Message as ReturnModel; if (@return.r == 1) { return Ok(new { Status = true, Message = "添加成功" }); } return Ok(new { Status = false, Message = @return.msg }); })); }
/// <summary> /// 添加或修改到货单 /// </summary> /// <param name="model"></param> /// <returns></returns> public static DataSet GetTableData(GetInStockNoticeModel model) { DataSet ds = GetData(); DataRow dr = ds.Tables[0].NewRow(); var info = model.info; dr["OrderNo"] = string.IsNullOrEmpty(info.OrderNo) ? string.Empty : info.OrderNo; dr["CustomerId"] = info.CustomerId; dr["WarehouseId"] = info.WarehouseId; dr["SrTypeId"] = info.SrTypeId; dr["OwnerId"] = info.OwnerId; dr["Type"] = info.Type; dr["Maker"] = info.Maker; dr["Date"] = info.Date.ToString(); dr["Status"] = info.Status; dr["AllPrice"] = info.AllPrice; dr["Define1"] = info.Define1; dr["Define2"] = info.Define2; dr["Define3"] = info.Define3; dr["Define4"] = info.Define4; dr["Define5"] = info.Define5; dr["Define6"] = info.Define6; dr["Define7"] = info.Define7; dr["Define8"] = info.Define8; dr["Define9"] = info.Define9; dr["Define10"] = info.Define10; dr["Description"] = info.Description; ds.Tables[0].Rows.Add(dr); var order = ds.Tables[0].Rows[0]["ORDERNO"].ToString(); for (int i = 0; i < model.dInfo.Count; i++) { dr = ds.Tables[1].NewRow(); var dInfo = model.dInfo[i]; dr["RowNo"] = (i + 1).ToString(); dr["HeadId"] = info.Id; dr["OrderNo"] = order; dr["WarehouseId"] = info.WarehouseId; dr["PositionId"] = dInfo.PositionId; dr["ProductId"] = dInfo.ProductId; dr["Batch"] = dInfo.Batch; dr["MadeDate"] = dInfo.MadeDate.ToString() == "0001/1/1 0:00:00"?"": dInfo.MadeDate.ToString(); dr["ExpiryDate"] = dInfo.ExpiryDate.ToString() == "0001/1/1 0:00:00" ? "" : dInfo.ExpiryDate.ToString(); dr["Quantity"] = dInfo.Quantity; dr["Price"] = dInfo.Price; dr["Define1"] = dInfo.Define1; dr["Define2"] = dInfo.Define2; dr["Define3"] = dInfo.Define3; dr["Define4"] = dInfo.Define4; dr["Define5"] = dInfo.Define5; dr["Define6"] = dInfo.Define6; dr["Define7"] = dInfo.Define7; dr["Define8"] = dInfo.Define8; dr["Define9"] = dInfo.Define9; dr["Define10"] = dInfo.Define10; dr["BoxNo"] = dInfo.BoxNo; dr["Description"] = dInfo.Description; ds.Tables[1].Rows.Add(dr); } return(ds); }