public static int Add(ReturnOrderStock b) { WarehouseEntities entity = new WarehouseEntities(); entity.ReturnOrderStock.Add(b); return(entity.SaveChanges()); }
public ActionResult Add2(ReturnOrderStock b) { b.DetailNum = "1"; b.IsDelete = 0; b.Operation = "电脑"; return(Json(ReturnOrderStockManager.Add2(b), JsonRequestBehavior.AllowGet)); }
//全选单选删除 public ActionResult DeleteOther(List <ReturnOrderStock> list) { string msg = ""; foreach (var item in list) { ReturnOrderStock ins = returnOrderStock.GetByWhere(i => i.Id == item.Id).SingleOrDefault(); List <ReturnOrderDetail> listDetail = returnOrderdetail.GetByWhere(i => i.ReturnId == ins.ReturnNum); bool val = true; foreach (var listd in listDetail) { listd.IsDelete = 1; val = returnOrderdetail.Update(listd); } if (val) { ins.IsDelete = 1; bool vall = returnOrderStock.Update(ins); if (vall) { msg = "删除成功"; } else { msg = "删除失败"; } } } return(Json(msg, JsonRequestBehavior.AllowGet)); }
public ActionResult QueryByIdMinXiInfo(int id) { ReturnOrderStock ins = returnOrderStock.GetByWhere(i => i.Id == id).SingleOrDefault(); var mx = returnOrderdetail.GetByWhere(i => i.ReturnId == ins.ReturnNum && i.IsDelete == 0); return(Json(mx, JsonRequestBehavior.AllowGet)); }
public static int ReturnOrderStockEdit(ReturnOrderStock p) { WarehouseEntities entity = new WarehouseEntities(); //先修改主表数据 var obj = entity.ReturnOrderStock.Find(p.Id); obj.ReturnTypeId = p.ReturnTypeId; obj.ProductId = p.ProductId; obj.Num = p.Num; obj.Status = p.Status; obj.Operation = p.Operation; obj.AuditUser = p.AuditUser; obj.AuditTime = p.AuditTime; return(entity.SaveChanges()); }
//修改审核状态 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)); }
//退货修改 public ActionResult ReturnOrderStockEdit(ReturnOrderStock bad) { return(Json(ReturnOrderStockManager.ReturnOrderStockEdit(bad), JsonRequestBehavior.AllowGet)); }
public static int Add2(ReturnOrderStock b) { return(ReturnOrderStockService.Add(b)); }
public static int ReturnOrderStockEdit(ReturnOrderStock p) { return(ReturnOrderStockService.ReturnOrderStockEdit(p)); }
public ActionResult Insert(List <ReturnOrderDetail> detail, int ReturnTypeId, int SupplierId, string Remark, string AuditUser) { string detailNum = ""; //获取明细表最大编号 string detailNumBig = returnOrderdetail.GetByWhere(i => true).OrderByDescending(i => i.DetailNum).Take(1).Select(i => i.DetailNum).FirstOrDefault(); if (string.IsNullOrEmpty(detailNumBig)) { detailNum = "000001"; } else { detailNum = "00000" + (int.Parse(detailNumBig) + 1); int num_1 = int.Parse(detailNumBig); if (num_1 >= 9) { detailNum = "0000" + (int.Parse(detailNumBig) + 1); } if (num_1 >= 99) { detailNum = "000" + (int.Parse(detailNumBig) + 1); } } string returnNum = ""; //获取退货表最大编号 string returnNumBig = returnOrderStock.GetByWhere(i => true).OrderByDescending(i => i.ReturnNum).Take(1).Select(i => i.ReturnNum).FirstOrDefault(); if (returnNumBig == null) { returnNum = "000001"; } else { returnNum = "00000" + (int.Parse(returnNumBig) + 1); int num_2 = int.Parse(returnNumBig); if (num_2 >= 9) { returnNum = "0000" + (int.Parse(returnNumBig) + 1); } if (num_2 >= 99) { returnNum = "000" + (int.Parse(returnNumBig) + 1); } } bool val = true; string msg = ""; foreach (var item in detail) { item.CreateTime = DateTime.Now; item.DetailNum = detailNum; item.ReturnId = returnNum; val = returnOrderdetail.Add(item); } if (val) { var num = returnOrderdetail.GetByWhere(i => i.ReturnId == returnNum).Sum(i => i.Sum); //获取总出货数 ReturnOrderStock ost = new ReturnOrderStock(); ost.ReturnNum = returnNum; ost.ReturnTypeId = ReturnTypeId; ost.SupplierId = SupplierId; ost.DetailNum = detailNum; ost.Num = Convert.ToInt32(num); ost.Status = "待审核"; ost.AuditTime = DateTime.Now; ost.AuditUser = AuditUser; ost.Remark = Remark; ost.IsDelete = 0; bool val1 = returnOrderStock.Add(ost); if (val1) { msg = "新增成功"; } else { msg = "新增失败"; } msg = "新增成功"; } else { msg = "新增失败"; } return(Json(msg, JsonRequestBehavior.AllowGet)); }