101 lines
		
	
	
		
			4.3 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			101 lines
		
	
	
		
			4.3 KiB
		
	
	
	
		
			C#
		
	
	
	
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.Linq;
 | |
| using System.Text;
 | |
| using System.Threading.Tasks;
 | |
| 
 | |
| namespace BLL
 | |
| {
 | |
|     /// <summary>
 | |
|     /// 物资管理
 | |
|     /// </summary>
 | |
|     public static class GoodsManageService
 | |
|     {
 | |
|         /// <summary>
 | |
|         /// 根据主键获取物资管理
 | |
|         /// </summary>
 | |
|         /// <param name="goodsManageId"></param>
 | |
|         /// <returns></returns>
 | |
|         public static Model.CostGoods_GoodsManage GetGoodsManageById(string goodsManageId)
 | |
|         {
 | |
|             return Funs.DB.CostGoods_GoodsManage.FirstOrDefault(e => e.GoodsManageId == goodsManageId);
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 添加物资管理
 | |
|         /// </summary>
 | |
|         /// <param name="goodsManage"></param>
 | |
|         public static void AddGoodsManage(Model.CostGoods_GoodsManage goodsManage)
 | |
|         {
 | |
|             Model.CostGoods_GoodsManage newGoodsManage = new Model.CostGoods_GoodsManage
 | |
|             {
 | |
|                 GoodsManageId = goodsManage.GoodsManageId,
 | |
|                 ProjectId = goodsManage.ProjectId,
 | |
|                 UnitId = goodsManage.UnitId,
 | |
|                 GoodsCategoryId = goodsManage.GoodsCategoryId,
 | |
|                 GoodsCode = goodsManage.GoodsCode,
 | |
|                 GoodsName = goodsManage.GoodsName,
 | |
|                 SizeModel = goodsManage.SizeModel,
 | |
|                 FactoryCode = goodsManage.FactoryCode,
 | |
|                 CheckDate = goodsManage.CheckDate,
 | |
|                 EnableYear = goodsManage.EnableYear,
 | |
|                 CheckPerson = goodsManage.CheckPerson,
 | |
|                 InTime = goodsManage.InTime,
 | |
|                 States = goodsManage.States,
 | |
|                 CompileMan = goodsManage.CompileMan,
 | |
|                 CompileDate = goodsManage.CompileDate,
 | |
|                 Remark = goodsManage.Remark
 | |
|             };
 | |
|             Funs.DB.CostGoods_GoodsManage.InsertOnSubmit(newGoodsManage);
 | |
|             Funs.DB.SubmitChanges();
 | |
| 
 | |
|             CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.GoodsManageMenuId, goodsManage.ProjectId, goodsManage.UnitId, goodsManage.GoodsManageId, goodsManage.CompileDate);
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 修改物资管理
 | |
|         /// </summary>
 | |
|         /// <param name="goodsManage"></param>
 | |
|         public static void UpdateGoodsManage(Model.CostGoods_GoodsManage goodsManage)
 | |
|         {
 | |
|             Model.CostGoods_GoodsManage newGoodsManage = Funs.DB.CostGoods_GoodsManage.FirstOrDefault(e => e.GoodsManageId == goodsManage.GoodsManageId);
 | |
|             if (newGoodsManage != null)
 | |
|             {
 | |
|                 newGoodsManage.UnitId = goodsManage.UnitId;
 | |
|                 newGoodsManage.GoodsCategoryId = goodsManage.GoodsCategoryId;
 | |
|                 newGoodsManage.GoodsCode = goodsManage.GoodsCode;
 | |
|                 newGoodsManage.GoodsName = goodsManage.GoodsName;
 | |
|                 newGoodsManage.SizeModel = goodsManage.SizeModel;
 | |
|                 newGoodsManage.FactoryCode = goodsManage.FactoryCode;
 | |
|                 newGoodsManage.CheckDate = goodsManage.CheckDate;
 | |
|                 newGoodsManage.EnableYear = goodsManage.EnableYear;
 | |
|                 newGoodsManage.CheckPerson = goodsManage.CheckPerson;
 | |
|                 newGoodsManage.InTime = goodsManage.InTime;
 | |
|                 newGoodsManage.States = goodsManage.States;
 | |
|                 newGoodsManage.CompileMan = goodsManage.CompileMan;
 | |
|                 newGoodsManage.CompileDate = goodsManage.CompileDate;
 | |
|                 newGoodsManage.Remark = goodsManage.Remark;
 | |
|                 Funs.DB.SubmitChanges();
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 根据主键删除物资管理
 | |
|         /// </summary>
 | |
|         /// <param name="goodsManageId"></param>
 | |
|         public static void DeleteGoodsManageById(string goodsManageId)
 | |
|         {
 | |
|             Model.CostGoods_GoodsManage goodsManage = Funs.DB.CostGoods_GoodsManage.FirstOrDefault(e => e.GoodsManageId == goodsManageId);
 | |
|             if (goodsManage != null)
 | |
|             {
 | |
|                 CodeRecordsService.DeleteCodeRecordsByDataId(goodsManageId);//删除编号
 | |
|                 ProjectDataFlowSetService.DeleteFlowSetByDataId(goodsManageId);//删除流程
 | |
|                 ////删除审核流程表
 | |
|                 BLL.CommonService.DeleteFlowOperateByID(goodsManageId);
 | |
|                 Funs.DB.CostGoods_GoodsManage.DeleteOnSubmit(goodsManage);
 | |
|                 Funs.DB.SubmitChanges();
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| }
 |