public void RefreshPosition() { List <string> status = new List <string>(Status.Split('|')); if (status[status.Count - 1] == "在库") { CurrentWhereOrganization = ""; CurrentWhereSpot = Department + "仓库"; } else if (status[status.Count - 1] == "维修") { List <RepairSlip> RepairSlips = RepairSlip.GetBy(AssetID); CurrentWhereOrganization = RepairSlips[RepairSlips.Count - 1].Organization; CurrentWhereSpot = RepairSlips[RepairSlips.Count - 1].Spot; } else if (status[status.Count - 1] == "领用") { List <LendSlip> LendSlips = LendSlip.GetBy(AssetID); CurrentWhereOrganization = LendSlips[LendSlips.Count - 1].ReceiverDepartment; CurrentWhereSpot = LendSlips[LendSlips.Count - 1].WhereUsing; } else if (status[status.Count - 1] == "在校") { List <GageAdjustSlip> AdjustSlips = GageAdjustSlip.GetBy(AssetID); CurrentWhereOrganization = AdjustSlips[AdjustSlips.Count - 1].Organization; CurrentWhereSpot = AdjustSlips[AdjustSlips.Count - 1].Spot; } }
public bool ArchiveAdjustSlip(GageAdjustSlip paras) { using (SqlConnection conn = new SqlConnection(Common.SQLHelper.Asset_strConn)) { conn.Open(); SqlTransaction sqlTransaction = conn.BeginTransaction(); try { GageAdjustSlip adjustSlip = GageAdjustSlip.GetBy(paras.ID); paras.CopyTo(adjustSlip, false); adjustSlip.SysArchiveTime = DateTime.Now; Asset gage = Asset.GetBy(adjustSlip.AssetID); if (gage == null) { throw new Exception("资产不存在"); } if (!gage.Status.Contains("在校")) { throw new Exception("资产未处于在校状态"); } gage.RemoveStatus("在校"); gage.RefreshPosition(); gage.sqlTransaction = adjustSlip.sqlTransaction = sqlTransaction; gage.Update(); adjustSlip.Update(); sqlTransaction.Commit(); return(true); } catch { sqlTransaction.Rollback(); throw; } } }
public IEnumerable <GageAdjustSlip> GetAdjustSlipsOf(string AssetID) { return(GageAdjustSlip.GetBy(AssetID)); }