//删除入库单 public ActionResult DeleteInfo(int id) { InStorage ins = inStorage.GetByWhere(item => item.Id == id).SingleOrDefault(); List <InStorageDetail> listDetail = inStorageDetail.GetByWhere(item => item.InStorageId == ins.InSNum); bool val = true; string msg = ""; foreach (var list in listDetail) { list.IsDelete = 1; val = inStorageDetail.Update(list); } if (val) { ins.IsDelete = 1; bool vall = inStorage.Update(ins); if (vall) { msg = "删除成功"; } else { msg = "删除失败"; } } return(Json(msg, JsonRequestBehavior.AllowGet)); }
//修改审核状态 public ActionResult UpdtStatus(ReturnOrderStock i, string status) { var ss = returnOrderStock.GetByWhere(item => item.Id == i.Id).SingleOrDefault(); i.ReturnNum = ss.ReturnNum; i.ReturnTypeId = ss.ReturnTypeId; i.SupplierId = ss.SupplierId; i.DetailNum = ss.DetailNum; i.Num = ss.Num; i.Status = status; i.AuditUser = ss.AuditUser; i.AuditTime = ss.AuditTime; i.IsDelete = ss.IsDelete; i.Remark = ss.Remark; var returnOrderStocks = new ReturnOrderStockManager(); var s = returnOrderStocks.Update(i); if (status.Equals("审核通过")) { var d = returnOrderdetail.GetByWhere(item => item.ReturnId == ss.ReturnNum); foreach (var item in d) { var pd = new ProductManager(); Expression <Func <Product, bool> > where = iss => iss.ProductNum == item.ProductNum; var pdu1 = pd.GetByWhere(where).SingleOrDefault(); pdu1.StockNum = Convert.ToInt32(pdu1.StockNum - item.Sum); var pdu = product.Update(pdu1); var instora = new InStorageDetailManager(); var ins = instora.GetByWhere(inss => inss.InStorageId == item.InSNum && inss.ProductNum == item.ProductNum).SingleOrDefault(); if (ins.THQuantity != 0) { ins.THQuantity = Convert.ToInt32(ins.THQuantity - item.Sum); if (ins.THQuantity == 0) { ins.IsReturnOrder = 1; } } var insta = instoragedetail.Update(ins); } } var result = new { ActionResult = s }; return(Json(result, JsonRequestBehavior.AllowGet)); }