/// <summary> /// 审核/弃审入库单 /// </summary> /// <param name="ID">入库单ID</param> /// <param name="t">真为审核入库,假为弃审出库</param> public void Verify(int ID, bool t, int VerifyMan, int DepotID, int TypeID) { if (TypeID == (int)Enums.TableType.P2D) { try { Hownet.BLL.Product2DepotInfo bllP2DI = new Product2DepotInfo(); Hownet.BLL.AmountInfo bllAI = new AmountInfo(); Hownet.BLL.Repertory bllRep = new Repertory(); Hownet.BLL.MaterielList bllML = new MaterielList(); Hownet.BLL.Materiel bllMat = new Materiel(); Hownet.Model.AmountInfo modAI = new Hownet.Model.AmountInfo(); Hownet.Model.Repertory modRep = new Model.Repertory(); Hownet.Model.MaterielList modML = new Hownet.Model.MaterielList(); Hownet.BLL.RepertoryList bllRL = new RepertoryList(); Hownet.Model.RepertoryList modRL = new Model.RepertoryList(); DataTable dtRL = new DataTable(); Hownet.Model.Product2Depot modP2D = GetModel(ID); DataTable dtP2DI = bllP2DI.GetList("(MainID=" + ID + ")").Tables[0]; List <Hownet.Model.Product2DepotInfo> li = bllP2DI.DataTableToList(bllP2DI.GetList("(MainID=" + ID + ")").Tables[0]); modAI.TableTypeID = 1; Hownet.BLL.OtherType bllOT = new Hownet.BLL.OtherType(); DataTable dtOT = bllOT.GetTypeList("成品单位").Tables[0]; decimal one = 1; decimal two = 1; int dM = 0; if (dtOT.Rows.Count > 0) { one = Convert.ToDecimal(dtOT.Select("(Name='车间换算')")[0]["Value"]); two = Convert.ToDecimal(dtOT.Select("(Name='仓储换算')")[0]["Value"]); dM = Convert.ToInt32(dtOT.Select("(Name='仓储单位')")[0]["Value"]); } for (int i = 0; i < li.Count; i++) { modRep = new Model.Repertory(); modRep.DepartmentID = DepotID; modRep.BrandName = modRep.ColorName = modRep.ColorOneName = modRep.ColorTwoName = modRep.CompanyName = modRep.DeparmentName = modRep.DepotInfoName = modRep.MaterielName = modRep.MeasureName = modRep.Remark = modRep.SizeName = modRep.SpecName = modRep.SupplierName = modRep.SupplierSN = string.Empty; modRep.BrandID = modML.BrandID = li[i].BrandID; modRep.ColorID = modML.ColorID = li[i].ColorID; modRep.ColorOneID = modML.ColorOneID = li[i].ColorOneID; modRep.ColorTwoID = modML.ColorTwoID = li[i].ColorTwoID; modRep.SizeID = modML.SizeID = li[i].SizeID; modRep.MaterielID = modML.MaterielID = li[i].MaterielID; modRep.MeasureID = modML.MeasureID = bllMat.GetModel(li[i].MaterielID).MeasureID; modAI.MainID = li[i].TaskID; modRep.Amount = modAI.NotAmount = li[i].Amount; modRep.MListID = modAI.MListID = li[i].MListID; if (li[i].MListID == 0) { modAI.MListID = li[i].MListID = bllML.GetID(modML); bllP2DI.Update(li[i]); if (dM > 0) { modML.MeasureID = dM; } modRep.MListID = bllML.GetID(modML); } else { if (dM > 0) { modML.MeasureID = dM; } modRep.MListID = bllML.GetID(modML); } if (li[i].TaskID > 0) { if (t) { if (one > 1 || two > 1) { modAI.Amount -= ((int)(li[i].Amount * two / one)); } else { modAI.Amount -= li[i].Amount; } if (modAI.Amount < 0) { modAI.Amount = 0; } } else { if (one > 1 || two > 1) { modAI.Amount += ((int)(li[i].Amount * two / one)); } else { modAI.Amount += li[i].Amount; } } bllAI.UpNotAmount(modAI, t); } if (dM > 0) { modRep.MeasureID = dM; } else { modRep.MeasureID = modML.MeasureID; } modRep.ID = bllRep.InOrOut(modRep, t); if (li[i].DepotInfoID > 0) { dtRL = bllRL.GetList("(BatchNumber=" + li[i].MListID + ") And (DepotInfoID=" + li[i].DepotInfoID + ")").Tables[0]; if (dtRL.Rows.Count == 0) { if (t) { modRL = new Model.RepertoryList(); modRL.A = 1; modRL.NotAmount = modRL.Amount = li[i].Amount; modRL.BatchNumber = li[i].MListID; modRL.DateTime = DateTime.Now; modRL.DepotInfoID = li[i].DepotInfoID; modRL.DepotInfoName = string.Empty; modRL.ID = 0; modRL.IsEnd = false; modRL.MainID = modRep.ID; modRL.PlanID = 0; modRL.QRID = li[i].MListID.ToString(); modRL.Remark = string.Empty; modRL.SpecID = 0; modRL.SpecName = string.Empty; modRL.StockListID = 0; bllRL.Add(modRL); } } else if (dtRL.Rows.Count == 1) { modRL = bllRL.GetModel(Convert.ToInt32(dtRL.Rows[0]["ID"])); if (t) { modRL.Amount += li[i].Amount; } else { modRL.Amount -= li[i].Amount; } bllRL.Update(modRL); } else if (dtRL.Rows.Count > 1) { List <Hownet.Model.RepertoryList> liRL = bllRL.DataTableToList(dtRL); for (int j = 1; j < liRL.Count; j++) { liRL[0].Amount += liRL[j].Amount; bllRL.Delete(liRL[j].ID); } if (t) { liRL[0].Amount += li[i].Amount; } else { liRL[0].Amount -= li[i].Amount; } bllRL.Update(liRL[0]); } } } if (t) { modP2D.IsVerify = 3; modP2D.VerifyDate = DateTime.Today; modP2D.VerifyMan = VerifyMan; } else { modP2D.IsVerify = 1; modP2D.VerifyDate = DateTime.Parse("1900-1-1"); modP2D.VerifyMan = 0; } Update(modP2D); } catch (Exception ex) { } } else if (TypeID == (int)Enums.TableType.P2Pack) { try { Hownet.BLL.Product2DepotInfo bllP2DI = new Product2DepotInfo(); Hownet.BLL.AmountInfo bllAI = new AmountInfo(); Hownet.BLL.PackAmount bllPA = new PackAmount(); Hownet.BLL.MaterielList bllML = new MaterielList(); Hownet.BLL.Materiel bllMat = new Materiel(); Hownet.Model.AmountInfo modAI = new Hownet.Model.AmountInfo(); Hownet.Model.PackAmount modPA = new Hownet.Model.PackAmount(); Hownet.Model.MaterielList modML = new Hownet.Model.MaterielList(); Hownet.Model.Product2Depot modP2D = GetModel(ID); Hownet.BLL.OtherType bllOT = new OtherType(); DataTable dtOT = bllOT.GetTypeList("成品单位").Tables[0]; int TaskMeasureID = 0; DataRow[] drs = dtOT.Select("(Name='车间单位')"); if (drs.Length == 1) { TaskMeasureID = Convert.ToInt32(drs[0]["Value"]); } List <Hownet.Model.Product2DepotInfo> li = bllP2DI.DataTableToList(bllP2DI.GetList("(MainID=" + ID + ")").Tables[0]); modAI.TableTypeID = 1; modPA.DepartmentID = DepotID; for (int i = 0; i < li.Count; i++) { if (li[i].MaterielID > 0) { modPA.BrandID = modML.BrandID = li[i].BrandID; modPA.ColorID = modML.ColorID = li[i].ColorID; modPA.ColorOneID = modML.ColorOneID = li[i].ColorOneID; modPA.ColorTwoID = modML.ColorTwoID = li[i].ColorTwoID; modPA.SizeID = modML.SizeID = li[i].SizeID; modPA.MaterielID = modML.MaterielID = li[i].MaterielID; modML.MeasureID = bllMat.GetModel(li[i].MaterielID).MeasureID; if (TaskMeasureID > 0) { modPA.MeasureID = TaskMeasureID; } else { modPA.MeasureID = modML.MeasureID; } modAI.MainID = li[i].TaskID; modPA.PlanID = li[i].TaskID; modPA.Remark = string.Empty; modPA.Amount = modAI.NotAmount = li[i].Amount; if (li[i].ColorID > 0 && li[i].SizeID > 0) { if (li[i].MListID == 0) { modAI.MListID = modPA.MListID = li[i].MListID = bllML.GetID(modML); bllP2DI.Update(li[i]); } else { modAI.MListID = modPA.MListID = li[i].MListID; } bllAI.UpNotAmount(modAI, t); bllPA.InOrOut(modPA, t); } } else { bllP2DI.Delete(li[i].ID); } } if (t) { modP2D.IsVerify = 3; modP2D.VerifyDate = DateTime.Today; modP2D.VerifyMan = VerifyMan; } else { modP2D.IsVerify = 1; modP2D.VerifyDate = DateTime.Parse("1900-1-1"); modP2D.VerifyMan = 0; } Update(modP2D); } catch (Exception ex) { } } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Hownet.Model.AmountInfo model) { dal.Update(model); }
public void InNoList(int MainID) { try { DataTable dt = new DataTable(); if (MainID == 0) { dt = dal.GetNoList().Tables[0]; } else { dt.Columns.Add("ID", typeof(int)); dt.Rows.Add(MainID); } if (dt.Rows.Count > 0) { Hownet.BLL.Size bllS = new Size(); Hownet.BLL.ClothAmount bllCA = new ClothAmount(); Hownet.BLL.ProductTaskMain bllPTM = new ProductTaskMain(); Hownet.BLL.Materiel bllMat = new Materiel(); Hownet.BLL.MaterielList bllML = new MaterielList(); Hownet.Model.AmountInfo modAI = new Hownet.Model.AmountInfo(); Hownet.Model.ProductTaskMain modPTM = new Hownet.Model.ProductTaskMain(); Hownet.Model.MaterielList modML = new Hownet.Model.MaterielList(); DataTable dtCA = new DataTable(); DataTable dtSize = bllS.GetAllList().Tables[0]; DataTable dtMat = bllMat.GetList("(AttributeID=4)").Tables[0]; DataTable dtTem = new DataTable(); int[] li = new int[15]; for (int i = 0; i < dt.Rows.Count; i++) { modPTM = bllPTM.GetModel(Convert.ToInt32(dt.Rows[i]["ID"])); if (GetList("(MainID=" + modPTM.ID + ") And (TableTypeID=1)").Tables[0].Rows.Count == 0) { dtCA = bllCA.GetList("(MainID=" + dt.Rows[i]["ID"] + ") order by ID").Tables[0]; //DelInfo(modPTM.ID, 1); if (dtCA.Rows.Count > 0) { for (int j = 0; j < dtCA.Rows.Count; j++) { if (Convert.ToInt32(dtCA.Rows[j]["ColorID"]) == 0)//颜色ID为0,查询出尺码ID { li = new int[15]; for (int s = 1; s < 16; s++) { if (dtCA.Rows[j]["Size" + s.ToString()].ToString() != string.Empty)//尺码不为空,查询尺码ID { DataRow[] drSize = dtSize.Select("(Name='" + dtCA.Rows[j]["Size" + s.ToString()] + "')"); if (drSize.Length > 0) { li[s - 1] = Convert.ToInt32(drSize[0]["ID"]); } else { li[s - 1] = 0; } } else { li[s - 1] = 0; } } } else { for (int m = 0; m < 15; m++) { if (li[m] > 0) { modAI = new Hownet.Model.AmountInfo(); modAI.A = 1; modAI.Amount = Convert.ToInt32(dtCA.Rows[j]["Size" + (m + 1).ToString()]); modML.ColorID = modAI.ColorID = Convert.ToInt32(dtCA.Rows[j]["ColorID"]); modML.BrandID = modPTM.BrandID; modML.ColorOneID = modAI.ColorOneID = 0; modML.ColorTwoID = modAI.ColorTwoID = 0; modML.MaterielID = modPTM.MaterielID; modML.SizeID = modAI.SizeID = li[m]; modML.MeasureID = Convert.ToInt32(dtMat.Select("(ID=" + modML.MaterielID + ")")[0]["MeasureID"]); modAI.ID = 0; modAI.MainID = Convert.ToInt32(dtCA.Rows[j]["MainID"]); modAI.MListID = bllML.GetID(modML); modAI.NotAmount = modAI.Amount; modAI.NotDepAmount = modAI.Amount; modAI.Remark = string.Empty; modAI.TableTypeID = 1; dtTem = GetList("(MainID=" + modPTM.ID + ") And (TableTypeID=1) And (MListID=" + modAI.MListID + ")").Tables[0]; if (dtTem.Rows.Count == 0) { Add(modAI); } else { Hownet.Model.AmountInfo modAAI = GetModel(Convert.ToInt32(dtTem.Rows[0]["ID"])); modAAI.Amount += modAI.Amount; modAAI.NotDepAmount += modAI.NotDepAmount; modAAI.NotAmount += modAI.NotAmount; Update(modAAI); } } } } } } } } } } catch (Exception ex) { } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Hownet.Model.AmountInfo model) { return(dal.Add(model)); }
/// <summary> /// 获得数据列表 /// </summary> public List <Hownet.Model.AmountInfo> DataTableToList(DataTable dt) { List <Hownet.Model.AmountInfo> modelList = new List <Hownet.Model.AmountInfo>(); try { int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Hownet.Model.AmountInfo model; for (int n = 0; n < rowsCount; n++) { model = new Hownet.Model.AmountInfo(); if (dt.Rows[n]["ID"].ToString() != "") { model.ID = int.Parse(dt.Rows[n]["ID"].ToString()); } if (dt.Rows[n]["MainID"].ToString() != "") { model.MainID = int.Parse(dt.Rows[n]["MainID"].ToString()); } if (dt.Rows[n]["TableTypeID"].ToString() != "") { model.TableTypeID = int.Parse(dt.Rows[n]["TableTypeID"].ToString()); } if (dt.Rows[n]["ColorID"].ToString() != "") { model.ColorID = int.Parse(dt.Rows[n]["ColorID"].ToString()); } if (dt.Rows[n]["ColorOneID"].ToString() != "") { model.ColorOneID = int.Parse(dt.Rows[n]["ColorOneID"].ToString()); } if (dt.Rows[n]["ColorTwoID"].ToString() != "") { model.ColorTwoID = int.Parse(dt.Rows[n]["ColorTwoID"].ToString()); } if (dt.Rows[n]["SizeID"].ToString() != "") { model.SizeID = int.Parse(dt.Rows[n]["SizeID"].ToString()); } if (dt.Rows[n]["MListID"].ToString() != "") { model.MListID = int.Parse(dt.Rows[n]["MListID"].ToString()); } if (dt.Rows[n]["Amount"].ToString() != "") { model.Amount = int.Parse(dt.Rows[n]["Amount"].ToString()); } if (dt.Rows[n]["NotAmount"].ToString() != "") { model.NotAmount = int.Parse(dt.Rows[n]["NotAmount"].ToString()); } if (dt.Rows[n]["NotDepAmount"].ToString() != "") { model.NotDepAmount = int.Parse(dt.Rows[n]["NotDepAmount"].ToString()); } model.Remark = dt.Rows[n]["Remark"].ToString(); model.A = int.Parse(dt.Rows[n]["A"].ToString()); modelList.Add(model); } } } catch (Exception ex) { } return(modelList); }