/// <summary> /// 根据ID返回 T_StockLogEntity实体类 单笔资料 (出入库日志) /// </summary> /// <param name="ID">ID 自增ID</param> /// <returns>返回 T_StockLogEntity实体类 ID为0则无记录</returns> public static T_StockLogEntity T_StockLogDisp(Int32 ID) { T_StockLogEntity fam = new T_StockLogEntity(); QueryParam qp = new QueryParam(); qp.PageIndex = 1; qp.PageSize = 1; qp.Where = string.Format(" Where {0}.{1} = {2}", "T_StockLog", "ID", ID); int RecordCount = 0; List<T_StockLogEntity> lst = T_StockLogList(qp, out RecordCount); if (RecordCount > 0) { fam = lst[0]; } return fam; }
protected void Button2_Click(object sender, EventArgs e) { string Checkbox_Value = (string)Common.sink("Checkbox", MethodType.Post, 2000, 1, DataType.Str); string[] Checkbox_Value_Array = Checkbox_Value.Split(','); Int32 IDX = 0; for (int i = 0; i < Checkbox_Value_Array.Length; i++) { if (Int32.TryParse(Checkbox_Value_Array[i], out IDX)) { T_StockLogEntity et = new T_StockLogEntity(); et.DataTable_Action_ = DataTable_Action.Delete; et.ID = IDX; BusinessFacadeShanlitech_Location.T_StockLogInsertUpdateDelete(et); } } EventMessage.MessageBox(1, "批量删除成功", string.Format("批量删除({0})成功!", Checkbox_Value), Icon_Type.OK, Common.GetHomeBaseUrl("default.aspx")); }
/// <summary> /// 初始化数据 /// </summary> /// <param name="ut"></param> private void OnStartData(T_StockLogEntity ut) { CodeNO_Input.Text = CodeNO_Disp.Text = ut.CodeNO.ToString(); DealType_Input.Text = DealType_Disp.Text = ut.DealType.ToString(); Number_Input.Text = Number_Disp.Text = ut.Number.ToString(); Handler_Input.Text = Handler_Disp.Text = ut.Handler.ToString(); StorID_Input.Text = StorID_Disp.Text = ut.StorID.ToString(); OutbID_Input.Text = OutbID_Disp.Text = ut.OutbID.ToString(); LogTime_Input.Text = LogTime_Disp.Text = ut.LogTime.ToString(); }
/// <summary> /// 新增/删除/修改 T_StockLogEntity (出入库日志) /// </summary> /// <param name="fam">T_StockLogEntity实体类</param> /// <returns>-1:存储过程执行失败,-2:存在相同的主键,Insert:返回插入自动ID,Update:返回更新记录数,Delete:返回删除记录数</returns> public static Int32 T_StockLogInsertUpdateDelete(T_StockLogEntity fam) { return DataProvider.Instance().T_StockLogInsertUpdateDelete(fam); }
/// <summary> /// 增加/修改事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click(object sender, EventArgs e) { int Approver_Value = UserData.GetUserDate.UserID; T_OutboundRecordEntity ut = BusinessFacadeShanlitech_Location.T_OutboundRecordDisp(IDX); ut.Approver = Approver_Value; ut.DataTable_Action_ = DataTable_Action.Update; Int32 rInt = BusinessFacadeShanlitech_Location.T_OutboundRecordInsertUpdateDelete(ut); if ( rInt> 0) { #region 插入出库日志 QueryParam qp = new QueryParam(); qp.Orderfld = "ID"; qp.OrderType = 1; int srecord = 0; List<T_OutboundRecordEntity> sentity = BusinessFacadeShanlitech_Location.T_OutboundRecordList(qp, out srecord); T_StockLogEntity logentity = new T_StockLogEntity(); logentity.DataTable_Action_ = DataTable_Action.Insert; logentity.CodeNO = ut.CodeNO; logentity.DealType = (int)DealType.SLCK; logentity.Handler = UserData.GetUserDate.UserID; logentity.LogTime = (DateTime?)DateTime.Now; logentity.Number = ut.OutboundNumber; logentity.StorID = sentity[0].ID; BusinessFacadeShanlitech_Location.T_StockLogInsertUpdateDelete(logentity); #endregion #region 更新库存 qp = new QueryParam(); qp.Where = string.Format("where id={0}", Convert.ToInt32(sentity[0].CodeNO)); srecord = 0; List<T_StockEntity> stocklist = BusinessFacadeShanlitech_Location.T_StockList(qp, out srecord); stocklist[0].DataTable_Action_ = DataTable_Action.Update; stocklist[0].StockNumber -= sentity[0].OutboundNumber; BusinessFacadeShanlitech_Location.T_StockInsertUpdateDelete(stocklist[0]); #endregion string OpTxt = string.Format("增加出库批准单成功!(ID:{0})", rInt); if (ut.DataTable_Action_ == DataTable_Action.Update) OpTxt = string.Format("修改出库批准单成功!(ID:{0})",IDX); EventMessage.MessageBox(1, "操作成功", OpTxt, Icon_Type.OK, Common.GetHomeBaseUrl("Default.aspx")); } else if (rInt == -2) { EventMessage.MessageBox(1, "操作失败", "操作失败,存在相同的键值(用户名/数据)!", Icon_Type.Alert, Common.GetHomeBaseUrl("Default.aspx")); } else { EventMessage.MessageBox(1, "操作失败", string.Format("操作失败,返回值:{0}!", rInt), Icon_Type.Error, Common.GetHomeBaseUrl("Default.aspx")); } }
/// <summary> /// 将记录集转为T_StockLogEntity实体类 (出入库日志) /// </summary> /// <param name="dr">记录集</param> /// <param name="Fileds">字段名列表</param> /// <returns>T_StockLogEntity</returns> protected T_StockLogEntity PopulateT_StockLogEntity(IDataReader dr, Dictionary<string, string> Fileds) { T_StockLogEntity nc = new T_StockLogEntity(); if (Fileds.ContainsKey("ID") && !Convert.IsDBNull(dr["ID"])) nc.ID = Convert.ToInt32(dr["ID"]); // 自增ID if (Fileds.ContainsKey("CodeNO") && !Convert.IsDBNull(dr["CodeNO"])) nc.CodeNO = Convert.ToString(dr["CodeNO"]).Trim(); // 库存资产编码号 if (Fileds.ContainsKey("DealType") && !Convert.IsDBNull(dr["DealType"])) nc.DealType = Convert.ToInt32(dr["DealType"]); // 处理类型(0为平衡入库,1为核销入库,2为受赠入库,10为平衡出库,11为申领出库,12为折旧出库) if (Fileds.ContainsKey("Number") && !Convert.IsDBNull(dr["Number"])) nc.Number = Convert.ToInt32(dr["Number"]); // 数量 if (Fileds.ContainsKey("Handler") && !Convert.IsDBNull(dr["Handler"])) nc.Handler = Convert.ToInt32(dr["Handler"]); // 操作者 if (Fileds.ContainsKey("StorID") && !Convert.IsDBNull(dr["StorID"])) nc.StorID = Convert.ToInt32(dr["StorID"]); // 入库单ID if (Fileds.ContainsKey("OutbID") && !Convert.IsDBNull(dr["OutbID"])) nc.OutbID = Convert.ToInt32(dr["OutbID"]); // 出库单ID if (Fileds.ContainsKey("LogTime") && !Convert.IsDBNull(dr["LogTime"])) nc.LogTime = Convert.ToDateTime(dr["LogTime"]); // 记录时间 return nc; }
/// <summary> /// 新增/删除/修改 T_StockLogEntity (出入库日志) /// </summary> /// <param name="fam">T_StockLog实体类</param> /// <returns>-1:存储过程执行失败,-2:存在相同的主键,Insert:返回插入自动ID,Update:返回更新记录数,Delete:返回删除记录数</returns> public abstract Int32 T_StockLogInsertUpdateDelete(T_StockLogEntity fam);
/// <summary> /// 初始化数据 /// </summary> /// <param name="ut"></param> private void OnStartData(T_StockLogEntity ut) { CodeNO_Input.Text = CodeNO_Disp.Text = ut.CodeNO.ToString(); DealType_Input.Text = DealType_Disp.Text = Innit(ut.DealType); Number_Input.Text = Number_Disp.Text = ut.Number.ToString(); Handler_Input.Text = Handler_Disp.Text = BusinessFacade.sys_UserDisp(ut.Handler).U_LoginName; StorID_Input.Text = StorID_Disp.Text = ut.StorID.ToString(); OutbID_Input.Text = OutbID_Disp.Text = ut.OutbID.ToString(); LogTime_Input.Text = LogTime_Disp.Text = ut.LogTime.ToString(); }
/// <summary> /// 增加/修改事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click(object sender, EventArgs e) { //int VeriID_Value = Convert.ToInt32(VeriID_Hidden.Value); //int VeritypeID_Value = Convert.ToInt32(BusinessFacadeShanlitech_Location.T_VerificationRecordDisp(VeriID_Value).ProjID); //string EquipmentName_Value = (string)Common.sink(EquipmentName_Input.UniqueID, MethodType.Post, 50, 0, DataType.Str); //string Model_Value = (string)Common.sink(Model_Input.UniqueID, MethodType.Post, 50, 0, DataType.Str); //int StorageNumber_Value = (int)Common.sink(StorageNumber_Input.UniqueID, MethodType.Post, 10, 0, DataType.Int); //double UnitPrice_Value = (double)Common.sink(UnitPrice_Input.UniqueID, MethodType.Post, 53, 0, DataType.Double); //DateTime? StorageTime_Value = (DateTime?)DateTime.Now; //int Applicant_Value = Convert.ToInt32(Applicant_Hidden.Value); int Approver_Value = UserData.GetUserDate.UserID; //double PayAmount_Value = (double)Convert.ToInt32(PayAmount_Hidden.Value); //string Remark_Value = (string)Common.sink(Remark_Input.UniqueID, MethodType.Post, 50, 0, DataType.Str); //string CodeNO_Value = (string)Common.sink(CodeNO_Input.UniqueID, MethodType.Post, 50, 0, DataType.Str); T_StorageRecordEntity ut = BusinessFacadeShanlitech_Location.T_StorageRecordDisp(IDX); //ut.VeriID = VeriID_Value; //ut.ProjectNO = VeritypeID_Value.ToString(); //ut.EquipmentName = EquipmentName_Value; //ut.Model = Model_Value; //ut.StorageNumber = StorageNumber_Value; //ut.UnitPrice = UnitPrice_Value; //ut.StorageTime = StorageTime_Value; //ut.Applicant = Applicant_Value; ut.Approver = Approver_Value; //ut.PayAmount = PayAmount_Value; //ut.Remark = Remark_Value; //ut.CodeNO = CodeNO_Value; //if (CMD == "New") //{ // ut.DataTable_Action_ = DataTable_Action.Insert; //} //else if (CMD == "Edit") //{ ut.DataTable_Action_ = DataTable_Action.Update; //} //else //{ // EventMessage.MessageBox(2, "不存在操作字符串!", "不存在操作字符串!", Icon_Type.Error, Common.GetHomeBaseUrl("Default.aspx")); //} Int32 rInt = BusinessFacadeShanlitech_Location.T_StorageRecordInsertUpdateDelete(ut); if ( rInt> 0) { #region 插入入库日志 QueryParam qp=new QueryParam(); qp.Orderfld="ID"; qp.OrderType=1; int srecord=0; List<T_StorageRecordEntity> sentity = BusinessFacadeShanlitech_Location.T_StorageRecordList(qp, out srecord); T_StockLogEntity logentity = new T_StockLogEntity(); logentity.DataTable_Action_ = DataTable_Action.Insert; logentity.CodeNO = ut.CodeNO; logentity.DealType =(int)DealType.PHRK; logentity.Handler = UserData.GetUserDate.UserID; logentity.LogTime = (DateTime?)DateTime.Now; logentity.Number = ut.StorageNumber; logentity.StorID = sentity[0].ID; BusinessFacadeShanlitech_Location.T_StockLogInsertUpdateDelete(logentity); #endregion #region 更新库存 qp = new QueryParam(); qp.Where = string.Format("where id={0}",Convert.ToInt32(sentity[0].CodeNO)); srecord = 0; List<T_StockEntity> stocklist = BusinessFacadeShanlitech_Location.T_StockList(qp, out srecord); stocklist[0].DataTable_Action_ = DataTable_Action.Update; stocklist[0].StockNumber += sentity[0].StorageNumber; BusinessFacadeShanlitech_Location.T_StockInsertUpdateDelete(stocklist[0]); #endregion string OpTxt = string.Format("增加待批准入库单成功!(ID:{0})", rInt); if (ut.DataTable_Action_ == DataTable_Action.Update) OpTxt = string.Format("修改待批准入库单成功!(ID:{0})",IDX); EventMessage.MessageBox(1, "操作成功", OpTxt, Icon_Type.OK, Common.GetHomeBaseUrl("Default.aspx")); } else if (rInt == -2) { EventMessage.MessageBox(1, "操作失败", "操作失败,存在相同的键值(用户名/数据)!", Icon_Type.Alert, Common.GetHomeBaseUrl("Default.aspx")); } else { EventMessage.MessageBox(1, "操作失败", string.Format("操作失败,返回值:{0}!", rInt), Icon_Type.Error, Common.GetHomeBaseUrl("Default.aspx")); } }