/// <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) { } }
/// <summary> /// 审核外协来料单 /// </summary> /// <param name="MainID"></param> /// <param name="IsVerify"></param> /// <param name="VerifyManID"></param> /// <returns></returns> public int VerifyWXIn(int MainID, bool IsVerify, int VerifyManID) { try { Hownet.Model.StockBack modSB = GetModel(MainID); if (IsVerify) { modSB.IsVerify = 3; modSB.VerifyDate = DateTime.Now; modSB.VerifyMan = VerifyManID; } else { modSB.IsVerify = 1; modSB.VerifyDate = Convert.ToDateTime("1900-1-1"); modSB.VerifyMan = 0; } Update(modSB); Hownet.BLL.StockBackInfo bllSBI = new StockBackInfo(); Hownet.BLL.MaterielList bllML = new MaterielList(); Hownet.Model.MaterielList modML = new Hownet.Model.MaterielList(); Hownet.Model.StockBackInfo modSBI; List <Hownet.Model.StockBackInfo> li = bllSBI.DataTableToList(bllSBI.GetList("(MainID=" + modSB.ID + ")").Tables[0]); Hownet.BLL.Repertory bllR = new Repertory(); Hownet.Model.Repertory modR; if (li.Count > 0) { for (int i = 0; i < li.Count; i++) { if (li[i].StockInfoID > 0) { modSBI = bllSBI.GetModel(li[i].StockInfoID); if (IsVerify) { modSBI.NotPriceAmount += li[i].Amount; modSBI.NotAmount -= li[i].Amount; } else { modSBI.NotPriceAmount -= li[i].Amount; modSBI.NotAmount += li[i].Amount; } li[i].NotPriceAmount = modSBI.NotPriceAmount; li[i].NotAmount = modSBI.NotAmount; bllSBI.Update(li[i]); bllSBI.Update(modSBI); } if (li[i].MListID == 0) { modML.BrandID = li[i].BrandID; modML.ColorID = li[i].ColorID; modML.ColorOneID = li[i].ColorOneID; modML.ColorTwoID = li[i].ColorTwoID; modML.SizeID = li[i].SizeID; modML.MaterielID = li[i].MaterielID; modML.MeasureID = li[i].CompanyMeasureID; modML.SpecID = 0; li[i].MListID = bllML.GetID(modML); bllSBI.Update(li[i]); } modR = new Hownet.Model.Repertory(); modR.Amount = li[i].Amount; modR.MListID = li[i].MListID; modR.MeasureID = li[i].CompanyMeasureID; modR.DepartmentID = modSB.DepotID; modR.BrandID = li[i].BrandID; modR.BrandName = li[i].BrandName; modR.ColorID = li[i].ColorID; modR.ColorName = li[i].ColorName; modR.ColorOneID = li[i].ColorOneID; modR.ColorOneName = li[i].ColorOneName; modR.ColorTwoID = li[i].ColorTwoID; modR.ColorTwoName = li[i].ColorTwoName; modR.CompanyID = li[i].CompanyID; modR.CompanyName = string.Empty; modR.DeparmentName = string.Empty; modR.DepartmentID = modSB.DepotID; modR.DepotInfoID = 0; modR.DepotInfoName = string.Empty; modR.ID = 0; modR.MaterielID = li[i].MaterielID; modR.MaterielName = li[i].MaterielName; modR.MeasureName = string.Empty; modR.PlanID = 0; modR.Remark = string.Empty; modR.SizeID = li[i].SizeID; modR.SizeName = li[i].SizeName; modR.SpecID = li[i].SpecID; modR.SpecName = li[i].SpecName; modR.SupplierID = 0; modR.SupplierName = string.Empty; modR.SupplierSN = string.Empty; bllR.InOrOut(modR, IsVerify); } } return(1); } catch (Exception ex) { return(0); } }
/// <summary> /// 审核外协领料单 /// </summary> /// <param name="MainID"></param> /// <param name="IsVerify">真为入库,假为出库</param> /// <param name="VerifyManID"></param> /// <returns></returns> public int VerifyWXOut(int MainID, bool IsVerify, int VerifyManID) { try { Hownet.Model.StockBack modSB = GetModel(MainID); if (IsVerify) { modSB.IsVerify = 3; modSB.VerifyDate = DateTime.Now; modSB.VerifyMan = VerifyManID; } else { modSB.IsVerify = 1; modSB.VerifyDate = Convert.ToDateTime("1900-1-1"); modSB.VerifyMan = 0; } Update(modSB); Hownet.BLL.StockBackInfo bllSBI = new StockBackInfo(); Hownet.Model.StockBackInfo modSBI; List <Hownet.Model.StockBackInfo> li = bllSBI.DataTableToList(bllSBI.GetList("(MainID=" + modSB.ID + ")").Tables[0]); Hownet.BLL.Repertory bllR = new Repertory(); Hownet.Model.Repertory modR; if (li.Count > 0) { for (int i = 0; i < li.Count; i++) { if (li[i].StockInfoID > 0) { modSBI = bllSBI.GetModel(li[i].StockInfoID); if (IsVerify) { modSBI.NotPriceAmount += li[i].Amount; modSBI.NotAmount -= li[i].Amount; } else { modSBI.NotPriceAmount -= li[i].Amount; modSBI.NotAmount += li[i].Amount; } li[i].NotPriceAmount = modSBI.NotPriceAmount; li[i].NotAmount = modSBI.NotAmount; bllSBI.Update(li[i]); bllSBI.Update(modSBI); } if (li[i].DemandID > 0) { modR = bllR.GetModel(li[i].DemandID); if (IsVerify) { modR.Amount -= li[i].Amount; if (modR.Amount < 0) { modR.Amount = 0; } } else { modR.Amount += li[i].Amount; } bllR.Update(modR); } } } return(1); } catch (Exception ex) { return(0); } }
/// <summary> /// 审核外协加工单 /// </summary> /// <param name="MainID"></param> /// <param name="IsVerify"></param> /// <param name="VerifyManID"></param> /// <returns></returns> public int VerifyWX(int MainID, bool IsVerify, int VerifyManID) { try { Hownet.Model.StockBack modSB = GetModel(MainID); if (IsVerify) { modSB.IsVerify = 3; modSB.VerifyDate = DateTime.Now; modSB.VerifyMan = VerifyManID; } else { modSB.IsVerify = 1; modSB.VerifyDate = Convert.ToDateTime("1900-1-1"); modSB.VerifyMan = 0; } Update(modSB); Hownet.BLL.StockBackInfo bllSBI = new StockBackInfo(); List <Hownet.Model.StockBackInfo> li = bllSBI.DataTableToList(bllSBI.GetList("(MainID=" + modSB.ID + ") And (MListID=0)").Tables[0]); Hownet.BLL.MaterielList bllML = new MaterielList(); Hownet.Model.MaterielList modML; if (li.Count > 0) { for (int i = 0; i < li.Count; i++) { modML = new Hownet.Model.MaterielList(); modML.BrandID = li[i].BrandID; modML.ColorID = li[i].ColorID; modML.ColorOneID = li[i].ColorOneID; modML.ColorTwoID = li[i].ColorTwoID; modML.MaterielID = li[i].MaterielID; modML.MeasureID = li[i].CompanyMeasureID; modML.SizeID = li[i].SizeID; modML.SpecID = 0; li[i].MListID = bllML.GetID(modML); bllSBI.Update(li[i]); } } li = bllSBI.DataTableToList(bllSBI.GetList("(MainID=" + modSB.ID * -1 + ") And (MListID=0)").Tables[0]); if (li.Count > 0) { for (int i = 0; i < li.Count; i++) { modML = new Hownet.Model.MaterielList(); modML.BrandID = li[i].BrandID; modML.ColorID = li[i].ColorID; modML.ColorOneID = li[i].ColorOneID; modML.ColorTwoID = li[i].ColorTwoID; modML.MaterielID = li[i].MaterielID; modML.MeasureID = li[i].CompanyMeasureID; modML.SizeID = li[i].SizeID; modML.SpecID = 0; li[i].MListID = bllML.GetID(modML); bllSBI.Update(li[i]); } } return(1); } catch (Exception ex) { return(0); } }
/// <summary> /// 审核/弃审入库单 /// </summary> /// <param name="ID">入库单ID</param> /// <param name="t">真为审核入库,假为弃审出库</param> public void Verify(int ID, bool t, int Depot) { Hownet.BLL.SysTem bllST = new SysTem(); Hownet.Model.SysTem modST = bllST.GetModel(bllST.GetMaxId() - 1); Hownet.BLL.StockBackInfo bllSBI = new StockBackInfo(); Hownet.BLL.MaterielList bllML = new MaterielList(); Hownet.Model.MaterielList modML = new Hownet.Model.MaterielList(); Hownet.BLL.Repertory bllRep = new Repertory(); Hownet.BLL.StockBackInfoList bllSBIL = new StockBackInfoList(); Hownet.BLL.RepertoryList bllRL = new RepertoryList(); List <Hownet.Model.StockBackInfoList> liSBIL; Hownet.Model.RepertoryList modRL; Hownet.Model.Repertory modRep; Hownet.Model.StockBackInfo modSBI; Hownet.Model.StockBack modSB = GetModel(ID); List <Hownet.Model.StockBackInfo> li = bllSBI.DataTableToList(bllSBI.GetList("(MainID=" + ID + ")").Tables[0]); for (int i = 0; i < li.Count; i++) { if (li[i].StockInfoID > 0) { modSBI = bllSBI.GetModel(li[i].StockInfoID); modSBI.NotAmount -= li[i].Amount; //if (dt.Rows[i]["NeedIsEnd"] != null && dt.Rows[i]["NeedIsEnd"] != DBNull.Value && dt.Rows[i]["NeedIsEnd"].ToString() != string.Empty) // modSBI.IsEnd = Convert.ToInt32(dt.Rows[i]["NeedIsEnd"]); bllSBI.Update(modSBI); } if (li[i].MListID == 0) { modML.BrandID = li[i].BrandID; modML.ColorID = li[i].ColorID; modML.ColorOneID = li[i].ColorOneID; modML.ColorTwoID = li[i].ColorTwoID; modML.SizeID = li[i].SizeID; modML.MaterielID = li[i].MaterielID; modML.MeasureID = li[i].CompanyMeasureID; li[i].MListID = bllML.GetID(modML); bllSBI.Update(li[i]); } liSBIL = bllSBIL.DataTableToList(bllSBIL.GetList("(InfoID=" + li[i].ID + ")").Tables[0]); if (liSBIL.Count > 0) { for (int j = 0; j < liSBIL.Count; j++) { if (t) { liSBIL[j].BatchNumber = li[i].MListID; bllSBIL.Update(liSBIL[j]); modRL = new Hownet.Model.RepertoryList(); modRL.A = 1; modRL.Amount = modRL.NotAmount = liSBIL[j].Amount; modRL.BatchNumber = liSBIL[j].BatchNumber; modRL.DateTime = DateTime.Now; modRL.DepotInfoID = liSBIL[j].DepotInfoID; modRL.DepotInfoName = string.Empty; modRL.ID = 0; modRL.IsEnd = false; modRL.MainID = ID; modRL.Remark = liSBIL[j].Remark; modRL.SpecID = liSBIL[j].SpecID; modRL.SpecName = string.Empty; modRL.StockListID = liSBIL[j].ID; modRL.QRID = liSBIL[j].ID.ToString(); bllRL.Add(modRL); } else { bllRL.DeleteByStockInfoID(liSBIL[j].ID); } } } if ((!modST.MaterielByTask) && (modSB.State != (int)Hownet.BLL.Enums.TableType._采购部收货)) { modRep = new Hownet.Model.Repertory(); modRep.BrandID = li[i].BrandID; modRep.ColorID = li[i].ColorID; modRep.ColorOneID = li[i].ColorOneID; modRep.ColorTwoID = li[i].ColorTwoID; modRep.SizeID = li[i].SizeID; modRep.MaterielID = li[i].MaterielID; modRep.MeasureID = li[i].CompanyMeasureID; modRep.MListID = li[i].MListID; modRep.Amount = li[i].Amount; modRep.DepartmentID = Depot; modRep.Price = li[i].Price; modRep.Money = li[i].Money; bllRep.InOrOut(modRep, t); } if (modSB.State == (int)Hownet.BLL.Enums.TableType._采购部收货) { modRep = new Hownet.Model.Repertory(); modRep.BrandID = li[i].BrandID; modRep.ColorID = li[i].ColorID; modRep.ColorOneID = li[i].ColorOneID; modRep.ColorTwoID = li[i].ColorTwoID; modRep.SizeID = li[i].SizeID; modRep.MaterielID = li[i].MaterielID; modRep.MeasureID = li[i].CompanyMeasureID; modRep.MListID = li[i].MListID; modRep.Amount = li[i].Amount; modRep.DepartmentID = Depot; modRep.Price = li[i].Price; modRep.Money = li[i].Money; bllRep.InOrOut(modRep, t); } } // Hownet.Model.StockBack modSB = GetModel(ID); if (modSB.State == (int)Hownet.BLL.Enums.TableType.P2D) { if (modSB.CompanyID > 0) { Hownet.BLL.Company bllCom = new Company(); Hownet.Model.Company modCom = bllCom.GetModel(modSB.CompanyID); if (t)//收货 { modCom.Weight -= modSB.Weight; } else { modCom.Weight += modSB.Weight; } bllCom.Update(modCom); } } }
/// <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); } }