/// <summary> /// 采购退货审核 /// </summary> /// <param name="MainID"></param> /// <param name="t">真为入库,假为出库</param> public void VerifyBack(int MainID, bool t) { try { Hownet.BLL.StockBack bllSB = new StockBack(); Hownet.BLL.StockBackInfo bllSBI = new StockBackInfo(); Hownet.Model.StockBack modSB = bllSB.GetModel(MainID); Hownet.Model.StockBackInfo modSBI = new Hownet.Model.StockBackInfo(); List <Hownet.Model.StockBackInfo> li = bllSBI.DataTableToList(bllSBI.GetList("(MainID=" + MainID + ")").Tables[0]); if (li.Count > 0) { Hownet.Model.Repertory modRep = new Hownet.Model.Repertory(); for (int i = 0; i < li.Count; i++) { if (li[i].DemandID > 0) { modRep = GetModel(li[i].DemandID); modRep.Amount = li[i].Amount; InOrOut(modRep, t); } if (li[i].StockInfoID > 0) { modSBI = bllSBI.GetModel(li[i].StockInfoID); if (!t) { modSBI.NotAmount += li[i].Amount; modSBI.NotPriceAmount += li[i].Amount; } else { modSBI.NotAmount -= li[i].Amount; modSBI.NotPriceAmount -= li[i].Amount; } bllSBI.Update(modSBI); } } } } catch (Exception ex) { } }
/// <param name="t">真为审核入库,假为弃审出库</param> public bool VerifyStock(int MainID, int PackID, bool t, int VerifyMan) { try { Hownet.BLL.StockBack bllSB = new StockBack(); Hownet.BLL.StockBackInfo bllSBI = new StockBackInfo(); Hownet.BLL.Repertory bllRep = new Repertory(); Hownet.BLL.Deparment bllDep = new Deparment(); Hownet.BLL.PackAmount bllPA = new PackAmount(); Hownet.BLL.MaterielList bllML = new MaterielList(); Hownet.BLL.Materiel bllMat = new Materiel(); Hownet.Model.PackAmount modPA = new Hownet.Model.PackAmount(); Hownet.Model.MaterielList modML = new Hownet.Model.MaterielList(); Hownet.Model.StockBack modSB = bllSB.GetModel(MainID); Hownet.Model.StockBackInfo modSBI = new Hownet.Model.StockBackInfo(); Hownet.Model.Repertory modRep = new Hownet.Model.Repertory(); Hownet.Model.Deparment modDep = bllDep.GetModel(PackID); List <Hownet.Model.StockBackInfo> li = bllSBI.DataTableToList(bllSBI.GetList("(MainID=" + MainID + ")").Tables[0]); modPA.DepartmentID = PackID; for (int i = 0; i < li.Count; i++) { modRep.BrandID = modPA.BrandID = modML.BrandID = li[i].BrandID; modRep.ColorID = modPA.ColorID = modML.ColorID = li[i].ColorID; modRep.ColorOneID = modPA.ColorOneID = modML.ColorOneID = li[i].ColorOneID; modRep.ColorTwoID = modPA.ColorTwoID = modML.ColorTwoID = li[i].ColorTwoID; modRep.SizeID = modPA.SizeID = modML.SizeID = li[i].SizeID; modRep.MaterielID = modPA.MaterielID = modML.MaterielID = li[i].MaterielID; modRep.MeasureID = modPA.MeasureID = modML.MeasureID = bllMat.GetModel(li[i].MaterielID).MeasureID; modRep.PlanID = modPA.PlanID = 0; modRep.Remark = modPA.Remark = string.Empty; modRep.DepartmentID = modPA.DepartmentID = modSB.DepotID; modRep.Amount = modPA.Amount = li[i].Amount; modSBI = bllSBI.GetModel(li[i].StockInfoID); if (modSBI != null) { if (t) { modSBI.NotAmount -= li[i].Amount; } else { modSBI.NotAmount += li[i].Amount; } bllSBI.Update(modSBI); } if (li[i].MListID == 0) { modRep.MListID = modPA.MListID = li[i].MListID = bllML.GetID(modML); bllSBI.Update(li[i]); } else { modRep.MListID = modPA.MListID = li[i].MListID; } if (modDep.TypeID == 39) { bllPA.InOrOut(modPA, t); } else if (modDep.TypeID == 42) { bllRep.InOrOut(modRep, t); } } if (t) { modSB.IsVerify = 3; modSB.VerifyDate = DateTime.Today; modSB.VerifyMan = VerifyMan; } else { modSB.IsVerify = 1; modSB.VerifyDate = DateTime.Parse("1900-1-1"); modSB.VerifyMan = 0; } bllSB.Update(modSB); return(true); } catch (Exception ex) { return(false); } }