songnan.zhang
2 years ago
17 changed files with 992 additions and 9 deletions
@ -0,0 +1,204 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using QMAPP.BLL; |
||||
|
|
||||
|
using QMFrameWork.Data; |
||||
|
|
||||
|
using QMAPP.Entity; |
||||
|
using QMFrameWork.Log; |
||||
|
using System.Data; |
||||
|
using QMAPP.MD.Entity; |
||||
|
using QMAPP.MD.DAL; |
||||
|
using QMAPP.FJC.Entity.BZD; |
||||
|
using QMAPP.FJC.DAL.BZD; |
||||
|
|
||||
|
namespace QMAPP.FJC.BLL.BZD |
||||
|
{ |
||||
|
/// </summary>
|
||||
|
/// 模块名称:条码替换记录
|
||||
|
/// 作 者:张松男
|
||||
|
/// 编写日期:2022年11月07日
|
||||
|
/// </summary>
|
||||
|
public class BarCodeReplaceBLL : BaseBLL |
||||
|
{ |
||||
|
|
||||
|
#region 获取信息
|
||||
|
/// <summary>
|
||||
|
/// 获取信息
|
||||
|
/// </summary>
|
||||
|
/// <param name="">条件</param>
|
||||
|
/// <returns>信息</returns>
|
||||
|
public DataResult<BarCodeReplace> Get(BarCodeReplace model) |
||||
|
{ |
||||
|
DataResult<BarCodeReplace> result = new DataResult<BarCodeReplace>(); |
||||
|
try |
||||
|
{ |
||||
|
result.Result = new BarCodeReplaceDAL().Get(model); |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
result.IsSuccess = false; |
||||
|
result.Msg = Resource.SystemException; |
||||
|
throw ex; |
||||
|
} |
||||
|
result.IsSuccess = true; |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
#region 获取列表(分页)
|
||||
|
/// <summary>
|
||||
|
/// 获取列表
|
||||
|
/// </summary>
|
||||
|
/// <param name="condition">条件</param>
|
||||
|
/// <param name="page">数据页</param>
|
||||
|
/// <returns>数据页</returns>
|
||||
|
public DataResult<DataPage> GetList(BarCodeReplace condition, DataPage page) |
||||
|
{ |
||||
|
DataResult<DataPage> result = new DataResult<DataPage>(); |
||||
|
try |
||||
|
{ |
||||
|
//获取物料信息列表
|
||||
|
DataPage dataPage = new BarCodeReplaceDAL().GetList(condition, page); |
||||
|
|
||||
|
result.Result = dataPage; |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
result.IsSuccess = false; |
||||
|
result.Msg = Resource.SystemException; |
||||
|
throw ex; |
||||
|
} |
||||
|
result.IsSuccess = true; |
||||
|
return result; |
||||
|
|
||||
|
} |
||||
|
/// <summary>
|
||||
|
/// 获取全部条码格式规则
|
||||
|
/// </summary>
|
||||
|
/// <returns></returns>
|
||||
|
public List<BarCodeReplace> GetAllList(string str) |
||||
|
{ |
||||
|
return new BarCodeReplaceDAL().GetAllList(); |
||||
|
} |
||||
|
#endregion
|
||||
|
|
||||
|
#region 插入信息
|
||||
|
/// <summary>
|
||||
|
/// 插入信息(单表)
|
||||
|
/// </summary>
|
||||
|
/// <param name="">信息</param>
|
||||
|
/// <returns>插入行数</returns>
|
||||
|
public DataResult<int> Insert(BarCodeReplace info) |
||||
|
{ |
||||
|
DataResult<int> result = new DataResult<int>(); |
||||
|
try |
||||
|
{ |
||||
|
//基本信息
|
||||
|
info.PID = Guid.NewGuid().ToString(); |
||||
|
info.CREATEDATE = DateTime.Now; |
||||
|
info.FLGDEL = "0"; |
||||
|
BarCodeReplaceDAL cmdDAL = new BarCodeReplaceDAL(); |
||||
|
result.Result = new BarCodeReplaceDAL().Insert(info); |
||||
|
result.IsSuccess = true; |
||||
|
return result; |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
throw ex; |
||||
|
} |
||||
|
} |
||||
|
#endregion
|
||||
|
|
||||
|
#region 更新信息
|
||||
|
/// <summary>
|
||||
|
/// 更新信息
|
||||
|
/// </summary>
|
||||
|
/// <param name="">信息</param>
|
||||
|
/// <returns>更新行数</returns>
|
||||
|
public DataResult<int> Update(BarCodeReplace info) |
||||
|
{ |
||||
|
DataResult<int> result = new DataResult<int>(); |
||||
|
try |
||||
|
{ |
||||
|
info.FLGDEL = "0"; |
||||
|
result.Result = new BarCodeReplaceDAL().Update(info); |
||||
|
result.IsSuccess = true; |
||||
|
return result; |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
throw ex; |
||||
|
} |
||||
|
} |
||||
|
#endregion
|
||||
|
|
||||
|
#region 删除
|
||||
|
/// <summary>
|
||||
|
/// 删除信息
|
||||
|
/// </summary>
|
||||
|
/// <param name="">主键串</param>
|
||||
|
/// <returns>删除个数</returns>
|
||||
|
public DataResult<int> Delete(string strs) |
||||
|
{ |
||||
|
int count = 0; |
||||
|
DataResult<int> result = new DataResult<int>(); |
||||
|
string[] list = strs.Split(":".ToCharArray()); |
||||
|
try |
||||
|
{ |
||||
|
foreach (string str in list) |
||||
|
{ |
||||
|
count += this.DeleteBarcodeRules(new BarCodeReplace { PID = str }); |
||||
|
} |
||||
|
result.Result = count; |
||||
|
result.IsSuccess = true; |
||||
|
return result; |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
throw ex; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 删除信息
|
||||
|
/// </summary>
|
||||
|
/// <param name="">信息</param>
|
||||
|
/// <returns>删除个数</returns>
|
||||
|
public int DeleteBarcodeRules(BarCodeReplace info) |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
return new BarCodeReplaceDAL().Delete(info); |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
throw ex; |
||||
|
} |
||||
|
} |
||||
|
#endregion
|
||||
|
|
||||
|
#region 导出数据
|
||||
|
/// <summary>
|
||||
|
/// 获取导出的数据
|
||||
|
/// </summary>
|
||||
|
/// <param name="">查询条件</param>
|
||||
|
/// <returns>数据</returns>
|
||||
|
public DataTable GetExportData(BarCodeReplace info) |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
return new BarCodeReplaceDAL().GetExportData(info); |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
throw ex; |
||||
|
} |
||||
|
} |
||||
|
#endregion
|
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,255 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using QMAPP.MD.Entity; |
||||
|
using QMFrameWork.Data; |
||||
|
using System.Data; |
||||
|
using QMAPP.Entity; |
||||
|
using QMAPP.FJC.Entity.BZD; |
||||
|
|
||||
|
namespace QMAPP.FJC.DAL.BZD |
||||
|
{ |
||||
|
/// </summary>
|
||||
|
/// 模块名称:条码替换记录
|
||||
|
/// 作 者:张松男
|
||||
|
/// 编写日期:2022年11月07日
|
||||
|
/// </summary>
|
||||
|
public class BarCodeReplaceDAL |
||||
|
{ |
||||
|
|
||||
|
#region 获取信息
|
||||
|
/// <summary>
|
||||
|
/// 获取信息
|
||||
|
/// </summary>
|
||||
|
/// <param name="">条件</param>
|
||||
|
/// <returns>*信息</returns>
|
||||
|
public BarCodeReplace Get(BarCodeReplace info) |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
using (IDataSession session = AppDataFactory.CreateMainSession()) |
||||
|
{ |
||||
|
//获取信息
|
||||
|
info = session.Get<BarCodeReplace>(info); |
||||
|
} |
||||
|
return info; |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
throw ex; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
#region 获取列表
|
||||
|
/// <summary>
|
||||
|
/// 获取列表
|
||||
|
/// </summary>
|
||||
|
/// <param name="condition">条件</param>
|
||||
|
/// <param name="page">数据页</param>
|
||||
|
/// <returns>数据页</returns>
|
||||
|
public DataPage GetList(BarCodeReplace condition, DataPage page) |
||||
|
{ |
||||
|
string sql = null; |
||||
|
List<DataParameter> parameters = new List<DataParameter>(); |
||||
|
try |
||||
|
{ |
||||
|
sql = this.GetQuerySql(condition, ref parameters); |
||||
|
//分页关键字段及排序
|
||||
|
page.KeyName = "PID"; |
||||
|
if (string.IsNullOrEmpty(page.SortExpression)) |
||||
|
page.SortExpression = "CREATEDATE DESC"; |
||||
|
using (IDataSession session = AppDataFactory.CreateMainSession()) |
||||
|
{ |
||||
|
// 对应多种数据库
|
||||
|
//string sqlChange = this.ChangeSqlByDB(sql, session);
|
||||
|
page = session.GetDataPage<BarCodeReplace>(sql, parameters.ToArray(), page); |
||||
|
} |
||||
|
return page; |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
throw ex; |
||||
|
} |
||||
|
} |
||||
|
/// <summary>
|
||||
|
/// 获取全部规则
|
||||
|
/// </summary>
|
||||
|
/// <returns></returns>
|
||||
|
public List<BarCodeReplace> GetAllList() |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
string sql = "SELECT * FROM [T_AW_BarCodeReplace]"; |
||||
|
List<DataParameter> parameters = new List<DataParameter>(); |
||||
|
using (IDataSession session = AppDataFactory.CreateMainSession()) |
||||
|
{ |
||||
|
return session.GetList<BarCodeReplace>(sql, parameters.ToArray()).ToList(); |
||||
|
} |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
throw ex; |
||||
|
} |
||||
|
} |
||||
|
#endregion
|
||||
|
|
||||
|
#region 获取查询语句
|
||||
|
/// <summary>
|
||||
|
/// 获取查询语句
|
||||
|
/// </summary>
|
||||
|
/// <param name="user">查询条件</param>
|
||||
|
/// <param name="parameters">参数</param>
|
||||
|
/// <returns>查询语句</returns>
|
||||
|
private string GetQuerySql(BarCodeReplace condition, ref List<DataParameter> parameters) |
||||
|
{ |
||||
|
StringBuilder sqlBuilder = new StringBuilder(); |
||||
|
StringBuilder whereBuilder = new StringBuilder(); |
||||
|
try |
||||
|
{ |
||||
|
//构成查询语句//[PID],[MPID],[barcodeFist],[Company_code],[Vehicle_type],[MATERIALCODDE],[configColor],[CREATEUSER],[CREATEDATE],[FLGDEL]
|
||||
|
sqlBuilder.Append("SELECT * "); |
||||
|
sqlBuilder.Append("FROM [T_AW_BarCodeReplace] "); |
||||
|
whereBuilder.Append(" AND FLGDEL<> '1' "); |
||||
|
//查询条件
|
||||
|
|
||||
|
////查询条件
|
||||
|
if (string.IsNullOrEmpty(condition.NewProductCode) == false) |
||||
|
{ |
||||
|
whereBuilder.Append(" AND NewProductCode LIKE @NewProductCode "); |
||||
|
parameters.Add(new DataParameter { ParameterName = "NewProductCode", DataType = DbType.String, Value = "%" + condition.NewProductCode + "%" }); |
||||
|
} |
||||
|
if (string.IsNullOrEmpty(condition.OldProductCode) == false) |
||||
|
{ |
||||
|
whereBuilder.Append(" AND OldProductCode LIKE @OldProductCode "); |
||||
|
parameters.Add(new DataParameter { ParameterName = "OldProductCode", DataType = DbType.String, Value = "%" + condition.OldProductCode + "%" }); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
if (whereBuilder.Length > 0) |
||||
|
{ |
||||
|
sqlBuilder.Append(" WHERE " + whereBuilder.ToString().Substring(4)); |
||||
|
} |
||||
|
return sqlBuilder.ToString(); |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
throw ex; |
||||
|
} |
||||
|
} |
||||
|
#endregion
|
||||
|
|
||||
|
#region 获取导出的数据
|
||||
|
/// <summary>
|
||||
|
/// 获取导出的数据
|
||||
|
/// </summary>
|
||||
|
/// <param name="user">查询条件</param>
|
||||
|
/// <returns>数据</returns>
|
||||
|
public DataTable GetExportData(BarCodeReplace info) |
||||
|
{ |
||||
|
DataTable dt = null; |
||||
|
string sql = null; |
||||
|
List<DataParameter> parameters = new List<DataParameter>(); |
||||
|
try |
||||
|
{ |
||||
|
//构成查询语句
|
||||
|
sql = this.GetQuerySql(info, ref parameters); |
||||
|
using (IDataSession session = AppDataFactory.CreateMainSession()) |
||||
|
{ |
||||
|
dt = session.GetTable(sql, parameters.ToArray()); |
||||
|
dt.TableName = "BarCodeReplace"; |
||||
|
} |
||||
|
return dt; |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
throw ex; |
||||
|
} |
||||
|
} |
||||
|
#endregion
|
||||
|
|
||||
|
#region 插入信息
|
||||
|
/// <summary>
|
||||
|
/// 插入信息(单表)
|
||||
|
/// </summary>
|
||||
|
/// <param name="">信息</param>
|
||||
|
/// <returns>插入行数</returns>
|
||||
|
public int Insert(BarCodeReplace info) |
||||
|
{ |
||||
|
int count = 0; |
||||
|
try |
||||
|
{ |
||||
|
using (IDataSession session = AppDataFactory.CreateMainSession()) |
||||
|
{ |
||||
|
//插入基本信息
|
||||
|
count = session.Insert<BarCodeReplace>(info); |
||||
|
} |
||||
|
return count; |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
throw ex; |
||||
|
} |
||||
|
} |
||||
|
#endregion
|
||||
|
|
||||
|
#region 更新信息
|
||||
|
/// <summary>
|
||||
|
/// 更新信息
|
||||
|
/// </summary>
|
||||
|
/// <param name=""></param>
|
||||
|
/// <returns>更新行数</returns>
|
||||
|
public int Update(BarCodeReplace info) |
||||
|
{ |
||||
|
int count = 0; |
||||
|
try |
||||
|
{ |
||||
|
using (IDataSession session = AppDataFactory.CreateMainSession()) |
||||
|
{ |
||||
|
//更新基本信息
|
||||
|
count = session.Update<BarCodeReplace>(info); |
||||
|
} |
||||
|
return count; |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
throw ex; |
||||
|
} |
||||
|
} |
||||
|
#endregion
|
||||
|
|
||||
|
#region 逻辑删除
|
||||
|
/// <summary>
|
||||
|
/// 逻辑删除信息
|
||||
|
/// </summary>
|
||||
|
/// <param name=""></param>
|
||||
|
/// <returns>删除个数</returns>
|
||||
|
public int Delete(BarCodeReplace info) |
||||
|
{ |
||||
|
StringBuilder sqlBuilder = new StringBuilder(); |
||||
|
List<DataParameter> parameters = new List<DataParameter>(); |
||||
|
int count = 0; |
||||
|
try |
||||
|
{ |
||||
|
using (IDataSession session = AppDataFactory.CreateMainSession()) |
||||
|
{ |
||||
|
//删除基本信息
|
||||
|
sqlBuilder.Append("UPDATE T_AW_BarCodeReplace "); |
||||
|
sqlBuilder.Append("SET FLGDEL = '1' "); |
||||
|
sqlBuilder.Append("WHERE PID = @PID "); |
||||
|
parameters.Add(new DataParameter { ParameterName = "PID", DataType = DbType.String, Value = info.PID }); |
||||
|
count = session.ExecuteSql(sqlBuilder.ToString(), parameters.ToArray()); |
||||
|
} |
||||
|
return count; |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
throw ex; |
||||
|
} |
||||
|
} |
||||
|
#endregion
|
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,52 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using QMFrameWork.Data.Attributes; |
||||
|
using QMAPP.Entity; |
||||
|
using System.ComponentModel; |
||||
|
using System.Data; |
||||
|
|
||||
|
namespace QMAPP.FJC.Entity.BZD |
||||
|
{ |
||||
|
/// </summary>
|
||||
|
/// 模块名称:条码替换记录
|
||||
|
/// 作 者:张松男
|
||||
|
/// 编写日期:2022年11月07日
|
||||
|
/// </summary>
|
||||
|
[DBTable(TableName = "T_AW_BarCodeReplace")] |
||||
|
public class BarCodeReplace : BaseEntity |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 主键
|
||||
|
/// </summary>
|
||||
|
[DBColumn(ColumnName = "PID", DataType = DbType.String, IsKey = true)] |
||||
|
public string PID { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 新条码
|
||||
|
/// </summary>
|
||||
|
[DBColumn(ColumnName = "NewProductCode", DataType = DbType.String)] |
||||
|
public string NewProductCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 旧条码
|
||||
|
/// </summary>
|
||||
|
[DBColumn(ColumnName = "OldProductCode", DataType = DbType.String)] |
||||
|
public string OldProductCode { get; set; } |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建日期
|
||||
|
/// </summary>
|
||||
|
[DBColumn(ColumnName = "CREATEDATE", DataType = DbType.DateTime)] |
||||
|
public DateTime CREATEDATE { get; set; } |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 有效标志
|
||||
|
/// </summary>
|
||||
|
[DBColumn(ColumnName = "FLGDEL", DataType = DbType.String)] |
||||
|
public string FLGDEL { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,204 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Web; |
||||
|
using System.Web.Mvc; |
||||
|
using QMAPP.Common.Web.Controllers; |
||||
|
using QMFrameWork.WebUI.Attribute; |
||||
|
using QMAPP.FJC.Web.Models.Basic; |
||||
|
using QMFrameWork.Data; |
||||
|
using QMAPP.FJC.Entity.Basic; |
||||
|
using QMAPP.ServicesAgent; |
||||
|
using QMAPP.Entity; |
||||
|
using QMAPP.MD.Entity; |
||||
|
using QMAPP.MD.Web.Models; |
||||
|
using QMFrameWork.WebUI.DataSource; |
||||
|
using QMFrameWork.Common.Serialization; |
||||
|
using QMAPP.FJC.Web.Models.BZD; |
||||
|
using QMAPP.FJC.Entity.BZD; |
||||
|
|
||||
|
namespace QMAPP.FJC.Web.Controllers |
||||
|
{ |
||||
|
|
||||
|
public class BarCodeReplaceController : QController |
||||
|
{ |
||||
|
#region 获取信息
|
||||
|
/// <summary>
|
||||
|
/// 加载列表
|
||||
|
/// </summary>
|
||||
|
/// <returns>结果</returns>
|
||||
|
[HandleException] |
||||
|
public ActionResult List(bool? callback) |
||||
|
{ |
||||
|
BarCodeReplaceModel seachModel = new BarCodeReplaceModel(); |
||||
|
if (callback == true) |
||||
|
TryGetSelectBuffer<BarCodeReplaceModel>(out seachModel); |
||||
|
seachModel.rownumbers = false; |
||||
|
seachModel.url = "/BarCodeReplace/GetList"; |
||||
|
return View("BarCodeReplaceList", seachModel); |
||||
|
} |
||||
|
#endregion
|
||||
|
|
||||
|
#region 获取列表
|
||||
|
/// <summary>
|
||||
|
/// 获取列表
|
||||
|
/// </summary>
|
||||
|
/// <param name="callBack">是否回调</param>
|
||||
|
/// <returns>列表</returns>
|
||||
|
[HandleException] |
||||
|
public ActionResult GetList(bool? callBack) |
||||
|
{ |
||||
|
BarCodeReplaceModel seachModel = null; |
||||
|
DataPage page = null; |
||||
|
ServiceAgent wcfAgent = this.GetServiceAgent(); |
||||
|
BarCodeReplace condition = null; |
||||
|
DataResult<DataPage> pageResult = new DataResult<DataPage>(); |
||||
|
try |
||||
|
{ |
||||
|
//获取查询对象
|
||||
|
seachModel = GetModel<BarCodeReplaceModel>(); |
||||
|
#region 获取缓存值
|
||||
|
if (callBack != null) |
||||
|
{ |
||||
|
TryGetSelectBuffer<BarCodeReplaceModel>(out seachModel); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
//保存搜索条件
|
||||
|
SetSelectBuffer<BarCodeReplaceModel>(seachModel); |
||||
|
} |
||||
|
#endregion
|
||||
|
//获取前台分页设置信息
|
||||
|
page = this.GetDataPage(seachModel); |
||||
|
condition = CopyToModel<BarCodeReplace, BarCodeReplaceModel>(seachModel); |
||||
|
#region wcf服务统一接口
|
||||
|
|
||||
|
pageResult = wcfAgent.InvokeServiceFunction<DataResult<DataPage>>("BarCodeReplaceBLL_GetList", condition, page); |
||||
|
if (pageResult.IsSuccess == false) |
||||
|
{ |
||||
|
SetMessage(pageResult.Msg); |
||||
|
return List(true); |
||||
|
} |
||||
|
DateGridResult<BarCodeReplace> result = new DateGridResult<BarCodeReplace>(); |
||||
|
result.Total = pageResult.Result.RecordCount; |
||||
|
result.Rows = JsonConvertHelper.GetDeserialize<List<BarCodeReplace>>(pageResult.Result.Result.ToString()); |
||||
|
#endregion
|
||||
|
return Content(result.GetJsonSource()); |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
throw ex; |
||||
|
} |
||||
|
} |
||||
|
#endregion
|
||||
|
|
||||
|
#region 编辑
|
||||
|
/// <summary>
|
||||
|
/// 编辑载入
|
||||
|
/// </summary>
|
||||
|
/// <returns>处理结果</returns>
|
||||
|
[HandleException] |
||||
|
public ActionResult Edit() |
||||
|
{ |
||||
|
BarCodeReplaceModel model = new BarCodeReplaceModel(); |
||||
|
string ID = Request.Params["PID"]; |
||||
|
BarCodeReplace Entity = new BarCodeReplace(); |
||||
|
ServiceAgent wcfAgent = this.GetServiceAgent(); |
||||
|
DataResult<BarCodeReplace> result = new DataResult<BarCodeReplace>(); |
||||
|
try |
||||
|
{ |
||||
|
if (string.IsNullOrEmpty(ID) == false) |
||||
|
{ |
||||
|
//修改获取原数据
|
||||
|
Entity.PID = ID; |
||||
|
result = wcfAgent.InvokeServiceFunction<DataResult<BarCodeReplace>>("BarCodeReplaceBLL_Get", Entity); |
||||
|
if (result.IsSuccess == false) |
||||
|
{ |
||||
|
SetMessage(result.Msg); |
||||
|
return View("BarCodeReplaceEdit", model); |
||||
|
} |
||||
|
model = CopyToModel<BarCodeReplaceModel, BarCodeReplace>(result.Result); |
||||
|
} |
||||
|
return View("BarCodeReplaceEdit", model); |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
throw ex; |
||||
|
} |
||||
|
} |
||||
|
/// <summary>
|
||||
|
/// 保存
|
||||
|
/// </summary>
|
||||
|
/// <param name="model"></param>
|
||||
|
/// <returns>处理结果</returns>
|
||||
|
[HttpPost] |
||||
|
[HandleException] |
||||
|
[ValidateInput(false)] |
||||
|
public ActionResult Save(BarCodeReplaceModel saveModel) |
||||
|
{ |
||||
|
BarCodeReplace Entity = null; |
||||
|
ServiceAgent wcfAgent = this.GetServiceAgent(); |
||||
|
DataResult<int> result = new DataResult<int>(); |
||||
|
try |
||||
|
{ |
||||
|
Entity = CopyToModel<BarCodeReplace, BarCodeReplaceModel>(saveModel); |
||||
|
if (string.IsNullOrEmpty(Entity.PID) == true) |
||||
|
{ |
||||
|
//新增
|
||||
|
result = wcfAgent.InvokeServiceFunction<DataResult<int>>(QMAPP.ServicesAgent.DictService.BarCodeReplaceBLL_Insert.ToString(), Entity); |
||||
|
if (result.IsSuccess == false) |
||||
|
{ |
||||
|
SetMessage("条码已存在!"); |
||||
|
return View("BarCodeReplaceEdit", saveModel); |
||||
|
} |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
//修改
|
||||
|
result = wcfAgent.InvokeServiceFunction<DataResult<int>>(QMAPP.ServicesAgent.DictService.BarCodeReplaceBLL_Update.ToString(), Entity); |
||||
|
if (result.IsSuccess == false) |
||||
|
{ |
||||
|
SetMessage("条码已存在!"); |
||||
|
return View("BarCodeReplaceEdit", saveModel); |
||||
|
} |
||||
|
} |
||||
|
return this.GetJsViewResult(string.Format("parent.List(1);parent.showTitle('{0}');parent.closeAppWindow1();", AppResource.SaveMessge)); |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
throw ex; |
||||
|
} |
||||
|
} |
||||
|
#endregion
|
||||
|
|
||||
|
#region 删除
|
||||
|
/// <summary>
|
||||
|
/// 删除
|
||||
|
/// </summary>
|
||||
|
/// <returns>结果</returns>
|
||||
|
[HttpPost] |
||||
|
[HandleException] |
||||
|
public ActionResult Delete(BarCodeReplace model) |
||||
|
{ |
||||
|
string selectKey = Request.Form["selectKey"]; |
||||
|
ServiceAgent wcfAgent = this.GetServiceAgent(); |
||||
|
|
||||
|
try |
||||
|
{ |
||||
|
var result = wcfAgent.InvokeServiceFunction<DataResult<int>>(QMAPP.ServicesAgent.DictService.BarCodeReplaceBLL_Delete.ToString(), selectKey); |
||||
|
if (result.Result == 0) |
||||
|
{ |
||||
|
SetMessage("信息有关联,删除失败!"); |
||||
|
return List(true); |
||||
|
} |
||||
|
SetMessage(AppResource.DeleteMessage); |
||||
|
return List(true); |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
throw ex; |
||||
|
} |
||||
|
} |
||||
|
#endregion
|
||||
|
} |
||||
|
} |
@ -0,0 +1,63 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Web; |
||||
|
using System.Web.Mvc.Html; |
||||
|
using QMFrameWork.WebUI.Attribute; |
||||
|
using QMFrameWork.WebUI; |
||||
|
|
||||
|
namespace QMAPP.FJC.Web.Models.BZD |
||||
|
{ |
||||
|
/// </summary>
|
||||
|
/// 模块名称:条码替换记录
|
||||
|
/// 作 者:张松男
|
||||
|
/// 编写日期:2022年11月07日
|
||||
|
/// </summary>
|
||||
|
public class BarCodeReplaceModel : QDGModel |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 主键
|
||||
|
/// </summary>
|
||||
|
[Description("主键")] |
||||
|
[HTMLInput(UpdateRead = false, required = true, MaxLength = 36)] |
||||
|
[DGColumn(Hidden = true, PrimaryKey = true)] |
||||
|
public string PID { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 新条码
|
||||
|
/// </summary>
|
||||
|
[Description("新条码")] |
||||
|
[HTMLInput(UpdateRead = false, required = true, MaxLength = 200)] |
||||
|
[InputType(inputType.text)] |
||||
|
[DGColumn(frozenColumns = true, Sortable = true, Width = 200, DataAlign = DataAlign.center)] |
||||
|
public string NewProductCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 旧条码
|
||||
|
/// </summary>
|
||||
|
[Description("旧条码")] |
||||
|
[HTMLInput(UpdateRead = false, required = true, MaxLength = 200)] |
||||
|
[InputType(inputType.text)] |
||||
|
[DGColumn(frozenColumns = true, Sortable = true, Width = 200, DataAlign = DataAlign.center)] |
||||
|
public string OldProductCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 是否可用
|
||||
|
/// </summary>
|
||||
|
[Description("是否可用")] |
||||
|
[HTMLInput(UpdateRead = false, required = true, MaxLength = 200)] |
||||
|
[InputType(inputType.text)] |
||||
|
[DGColumn(frozenColumns = true, Sortable = true, Width = 100, DataAlign = DataAlign.center,Hidden = true)] |
||||
|
public string FLGDEL { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建日期
|
||||
|
/// </summary>
|
||||
|
[Description("创建时间")] |
||||
|
[HTMLInput(UpdateRead = true, MaxLength = 20)] |
||||
|
[InputType(inputType.hidden)] |
||||
|
[DGColumn(Sortable = true, Width = 150, DataAlign = DataAlign.center, FormatDate = "yyyy-MM-dd hh:mm:ss")] |
||||
|
public DateTime CREATEDATE { get; set; } |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,60 @@ |
|||||
|
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/AppMaster.Master" |
||||
|
Inherits="System.Web.Mvc.ViewPage<QMAPP.FJC.Web.Models.BZD.BarCodeReplaceModel>" %> |
||||
|
|
||||
|
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> |
||||
|
设备信息编辑 |
||||
|
</asp:Content> |
||||
|
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> |
||||
|
<%=Html.QPEdit("条码规则信息编辑", string.IsNullOrEmpty(Model.PID) ? QMFrameWork.WebUI.panelType.Add : QMFrameWork.WebUI.panelType.Update)%> |
||||
|
<table id="editTable" cellpadding="0" cellspacing="0"> |
||||
|
<tr> |
||||
|
<td> |
||||
|
<table> |
||||
|
<tr> |
||||
|
<th align="right"> |
||||
|
<%=Html.QV(p=>p.NewProductCode) %> |
||||
|
</th> |
||||
|
<td> |
||||
|
<%=Html.QC(p => p.NewProductCode)%> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<th align="right"> |
||||
|
<%=Html.QV(p=>p.OldProductCode) %> |
||||
|
</th> |
||||
|
<td> |
||||
|
<%=Html.QC(p => p.OldProductCode)%> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</table> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</table> |
||||
|
<%=Html.HiddenFor(p => p.PID)%> |
||||
|
<%=Html.HiddenFor(p => p.CREATEDATE)%> |
||||
|
<%=Html.HiddenFor(p => p.FLGDEL)%> |
||||
|
<%=Html.QPEnd() %> |
||||
|
|
||||
|
|
||||
|
|
||||
|
</asp:Content> |
||||
|
<asp:Content ID="Content3" ContentPlaceHolderID="ToolContent" runat="server"> |
||||
|
<table width="100%" cellpadding="0" cellspacing="0"> |
||||
|
<tr> |
||||
|
<td> |
||||
|
<%=Html.QTButtonSave("User", "Save", "return Save();")%> |
||||
|
<%=Html.QTButtonBack("close", "List", "parent.closeAppWindow1();return false;")%> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</table> |
||||
|
<script type="text/javascript"> |
||||
|
|
||||
|
function Save() { |
||||
|
if (isValidate() == false) { |
||||
|
return false; |
||||
|
} |
||||
|
submitByButton("Save"); |
||||
|
} |
||||
|
</script> |
||||
|
</asp:Content> |
||||
|
|
@ -0,0 +1,94 @@ |
|||||
|
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/AppMaster.Master" |
||||
|
Inherits="System.Web.Mvc.ViewPage<QMAPP.FJC.Web.Models.BZD.BarCodeReplaceModel>" %> |
||||
|
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> |
||||
|
条码规则信息列表 |
||||
|
</asp:Content> |
||||
|
|
||||
|
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> |
||||
|
<%=Html.QPSeach(100,true) %> |
||||
|
<table id="condiTable"> |
||||
|
<tr> |
||||
|
<th align="right"> |
||||
|
<%=Html.QV(p=>p.NewProductCode) %> |
||||
|
</th> |
||||
|
<td> |
||||
|
<%=Html.QC(p => p.NewProductCode)%> |
||||
|
</td> |
||||
|
|
||||
|
<th align="right"> |
||||
|
<%=Html.QV(p => p.OldProductCode)%> |
||||
|
</th> |
||||
|
<td> |
||||
|
<%=Html.QC(p => p.OldProductCode)%> |
||||
|
</td> |
||||
|
|
||||
|
</tr> |
||||
|
|
||||
|
</table> |
||||
|
<div style="left: 1px; position: relative;"></div> |
||||
|
|
||||
|
<%=Html.QPEnd()%> |
||||
|
<%=Html.QPList() %> |
||||
|
<%=Html.QDateGrid<QMAPP.FJC.Web.Models.BZD.BarCodeReplaceModel>(Model)%> |
||||
|
<%=Html.QPEnd() %> |
||||
|
<%=Html.Hidden("PID")%> |
||||
|
<%=Html.Hidden("selectKey")%> |
||||
|
<script language="javascript" type="text/javascript"> |
||||
|
//添加 |
||||
|
function Add() { |
||||
|
openAppWindow1('条码替换记录添加', 'Edit', '400', '400'); |
||||
|
} |
||||
|
//修改 |
||||
|
function Update() { |
||||
|
var ids = getSelectKey(); |
||||
|
if (ids == "") { |
||||
|
MSI("提示", "请选择修改记录。"); |
||||
|
return; |
||||
|
} |
||||
|
if (ids.indexOf(":") > 0) { |
||||
|
MSI("提示", "每次只能修改一条记录。"); |
||||
|
return; |
||||
|
} |
||||
|
document.getElementById("selectKey").value = ids; |
||||
|
openAppWindow1('条码替换记录修改', 'Edit?PID=' + ids, '400', '400'); |
||||
|
} |
||||
|
//删除 |
||||
|
function Delete() { |
||||
|
var ids = getSelectKey(); |
||||
|
if (ids == "") { |
||||
|
MSI("错误", "至少选择一条记录"); |
||||
|
} |
||||
|
else { |
||||
|
document.getElementById("selectKey").value = ids; |
||||
|
MSQ("提示", |
||||
|
"确定要删除选中的记录吗?", |
||||
|
function() { |
||||
|
submitByButton("Delete"); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
$(function () { |
||||
|
|
||||
|
$('#FACTORY_CODE').combobox({ |
||||
|
panelWidth: '350' |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
</script> |
||||
|
</asp:Content> |
||||
|
<asp:Content ID="Content3" ContentPlaceHolderID="ToolContent" runat="server"> |
||||
|
<table cellpadding="0" cellspacing="0"> |
||||
|
<tr> |
||||
|
<td align="center"> |
||||
|
<%=Html.QTButtonSearch("BarCodeReplace", "List", "List(1)", QMAPP.Common.Web.SystemLimit.isLimt)%> |
||||
|
<%=Html.QTButtonAdd("BarCodeReplace", "Add", "Add()", QMAPP.Common.Web.SystemLimit.isLimt)%> |
||||
|
<%=Html.QTButtonUpdate("BarCodeReplace", "Edit", "Update()", QMAPP.Common.Web.SystemLimit.isLimt)%> |
||||
|
<%=Html.QTButtonDelete("BarCodeReplace", "Delete", "Delete()", QMAPP.Common.Web.SystemLimit.isLimt)%> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</table> |
||||
|
</asp:Content> |
||||
|
|
Loading…
Reference in new issue