//修改审核状态 public ActionResult UpdtStatus(MoveReport i, string status) { var ss = moveReport.GetByWhere(item => item.Id == i.Id).SingleOrDefault(); i.MoveNum = ss.MoveNum; i.MoveTypeId = ss.MoveTypeId; 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 moveReports = new MoveReportManager(); var s = moveReports.Update(i); if (status.Equals("审核通过")) { var d = moveReportDetail.GetByWhere(item => item.MoveId == ss.MoveNum); 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.LocationId = Convert.ToInt32(item.MoveLocationId); var pdu = product.Update(pdu1); } } var result = new { ActionResult = s }; return(Json(result, JsonRequestBehavior.AllowGet)); }
//修改移库单 public ActionResult UpdtInfo(List <MoveReportDetail> detail, int MoveTypeId, string Remark, string movSNum) { //先删除明细 bool val_1 = true; var moveReportDetails = new MoveReportDetailManager(); var mx = moveReportDetails.GetByWhere(i => i.MoveId == movSNum); foreach (var item in mx) { val_1 = moveReportDetails.Delete(item); } //获取明细表最大编号 string detailNumBig = moveReportDetail.GetByWhere(item => true).OrderByDescending(item => item.DetailNum).Take(1).Select(item => item.DetailNum).FirstOrDefault(); string detailNum = ""; if (detailNumBig == null) { detailNumBig = "000001"; } else { detailNum = "00000" + (int.Parse(detailNumBig) + 1); int num1 = int.Parse(detailNumBig); if (num1 >= 9) { detailNumBig = "0000" + (int.Parse(detailNumBig) + 1); } else if (num1 >= 99) { detailNumBig = "000" + (int.Parse(detailNumBig) + 1); } } string msg = ""; bool val = true; foreach (var item in detail) { item.DetailNum = detailNum; item.CreateTime = DateTime.Now; item.MoveId = movSNum; val = moveReportDetail.Add(item); } if (val) { var num = moveReportDetail.GetByWhere(item => item.MoveId == movSNum).Sum(item => item.Quantity); var moveReport_1 = new MoveReportManager(); var s = moveReport_1.GetByWhere(i => i.MoveNum == movSNum).SingleOrDefault(); s.DetailNum = detailNum; s.MoveTypeId = MoveTypeId; s.Remark = Remark; s.Num = Convert.ToInt32(num); bool vall = moveReport.Update(s); if (vall) { msg = "修改成功"; } else { msg = "修改失败"; } msg = "修改成功"; } else { msg = "修改失败"; } return(Json(msg, JsonRequestBehavior.AllowGet)); }