/// <summary> /// 记录编号 /// </summary> /// <returns></returns> public ActionResult getEmpCodef() { string Std = ""; var listy = (from tbem in myModels.B_SellCheckBatchList orderby tbem.Remember select tbem).ToList(); if (listy.Count > 0) { int intcoun = listy.Count; B_SellCheckBatchList mymodell = listy[intcoun - 1]; int inemp = Convert.ToInt32(mymodell.Remember.Substring(1, 8)); inemp++; Std = inemp.ToString(); for (int i = 0; i < 5; i++) { Std = Std.Length < 5 ? "0" + Std : Std; } } else { Std = "00001"; } return(Json(Std, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 删除(调整单) /// </summary> /// <returns></returns> public ActionResult DeleteWareHert(int allocateID) { string strMsg = "fail"; try { B_SellCheckBatchList conver = (from tbWarHouser in myModels.B_SellCheckBatchList where tbWarHouser.SellCheckBatchID == allocateID select tbWarHouser).Single(); myModels.B_SellCheckBatchList.Remove(conver); int waDetialid = (int)conver.SellCheckBatchID; //查询对应对应明细(总数量) var converDetial = (from tbWarHouserDetial in myModels.B_SellCheckBatchDetaiList where tbWarHouserDetial.SellCheckBatchID == waDetialid select tbWarHouserDetial).ToList(); int thyCount = converDetial.Count(); if (thyCount > 0) { for (int i = 0; i < thyCount; i++) { myModels.B_SellCheckBatchDetaiList.Remove(converDetial[i]); myModels.SaveChanges(); strMsg = "success"; } } } catch (Exception e) { Console.WriteLine(e); } return(Json(strMsg, JsonRequestBehavior.AllowGet)); }
public ActionResult ShenHeZaiDan(B_SellCheckBatchList OK, B_SellCheckBatchDetaiList OKDetai, bool state) { string strMag = "fali"; ReturnJsonVo returnJson = new ReturnJsonVo(); try { B_SellCheckBatchList MyB_ConverList = new B_SellCheckBatchList(); MyB_ConverList.SellCheckBatchID = OK.SellCheckBatchID; MyB_ConverList.Remember = OK.Remember; MyB_ConverList.MaiChangID = OK.MaiChangID; MyB_ConverList.SpouseBRanchID = OK.SpouseBRanchID; MyB_ConverList.DrugTypeID = OK.DrugTypeID; MyB_ConverList.StaffID = OK.StaffID; MyB_ConverList.RegisterTime = OK.RegisterTime; MyB_ConverList.StaffIDTwo = OK.StaffIDTwo; MyB_ConverList.ExamineTime = OK.ExamineTime; myModels.Entry(MyB_ConverList).State = System.Data.Entity.EntityState.Modified; myModels.SaveChanges(); if (MyB_ConverList.SellCheckBatchID > 0) { strMag = "succsee"; B_SellCheckBatchList wafrtbool = (from tbbool in myModels.B_SellCheckBatchList where tbbool.SellCheckBatchID == OK.SellCheckBatchID select tbbool).Single(); //查询原状态 wafrtbool.ExamineNot = state; //改变是否为冲红单状态 myModels.Entry(wafrtbool).State = EntityState.Modified; if (myModels.SaveChanges() > 0)//保存 { returnJson.State = true; returnJson.Text = "修改成功"; } else { returnJson.State = false; returnJson.Text = "修改失败"; } } } catch (Exception e) { Console.WriteLine(e); } return(Json(new { strMag, returnJson }, JsonRequestBehavior.AllowGet)); }
public ActionResult UpterDiaoBa(B_SellCheckBatchList OK, B_SellCheckBatchDetaiList OKDetai) { string strMag = "fali"; try { B_SellCheckBatchList MyB_ConverList = new B_SellCheckBatchList(); MyB_ConverList.SellCheckBatchID = OK.SellCheckBatchID; MyB_ConverList.Remember = OK.Remember; MyB_ConverList.MaiChangID = OK.MaiChangID; MyB_ConverList.SpouseBRanchID = OK.SpouseBRanchID; MyB_ConverList.DrugTypeID = OK.DrugTypeID; MyB_ConverList.StaffID = OK.StaffID; MyB_ConverList.RegisterTime = OK.RegisterTime; myModels.Entry(MyB_ConverList).State = System.Data.Entity.EntityState.Modified; myModels.SaveChanges(); B_SellCheckBatchDetaiList ConverDeTailList = new B_SellCheckBatchDetaiList(); ConverDeTailList.SellCheckBatchDetailD = OKDetai.SellCheckBatchDetailD; ConverDeTailList.SellCheckBatchID = OK.SellCheckBatchID; ConverDeTailList.MumberOfPackages = OKDetai.MumberOfPackages; ConverDeTailList.ConverDeTaiID = OKDetai.ConverDeTaiID; myModels.Entry(ConverDeTailList).State = System.Data.Entity.EntityState.Modified; myModels.SaveChanges(); strMag = "succsee"; } catch (Exception e) { Console.WriteLine(e); } return(Json(strMag, JsonRequestBehavior.AllowGet)); }