|
|
using Newtonsoft.Json; using Newtonsoft.Json.Linq; using NFine.Code; using NFine.Data.Extensions; using NFine.Domain._03_Entity.SRM; using NFine.Repository; using System; using System.Collections.Generic; using System.Data; using System.Data.Common;
namespace NFine.Application.WMS { public class ExpressageApp : RepositoryFactory<ICSVendor> {
/// <summary>
/// 扫描快递
/// </summary>
/// <param name="queryJson"></param>
/// <returns></returns>
public string InsertExpressage(string Code, string Expressage,string ExpressageCode) { string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode; string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName; string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location; string msg = ""; string StackSql = @"select * from ICSExpressage where Code='{0}' and WorkPoint='{1}'"; StackSql = string.Format(StackSql, Code, WorkPoint); DataTable dt = SqlHelper.GetDataTableBySql(StackSql); if (dt != null && dt.Rows.Count > 0) { msg = "快递单号已经录入"; //throw new Exception("快递单号已经录入");
return msg; } string sql = string.Empty; sql = @"INSERT INTO dbo.ICSExpressage
( ID ,Code ,Expressage ,ExpressageCode,ISNew ,MUSER , MUSERName ,MTIME ,WorkPoint ) Values(NEWID(),'{0}','{1}','{2}','0','{3}','{4}',GETDATE(),'{5}')";
sql = string.Format(sql, Code, Expressage, ExpressageCode, MUSER, MUSERNAME, WorkPoint); try { if (SqlHelper.ExecuteNonQuery(sql) > 0) {
} else { msg = "保存失败"; } } catch (Exception ex) { throw new Exception(ex.Message); } return msg; }
/// <summary>
/// 获取快递公司列表
/// </summary>
/// <returns></returns>
public DataTable GetExpressageList() { string sql = @"select b.F_ItemCode as Code ,b.F_ItemName as Name from Sys_SRM_Items a left join Sys_SRM_ItemsDetail b on a.F_Id=b.F_ItemId
where a.F_EnCode='Expressage' order by cast(b.F_SortCode as int) asc";
DataTable ListData = SqlHelper.GetDataTableBySql(sql); return ListData; }
/// <summary>
/// 查询快递录入信息
/// </summary>
/// <param name="jqgridparam"></param>
/// <returns></returns>
public DataTable GetExpressage(ref Pagination jqgridparam, string queryJson) { DataTable dt = new DataTable(); var queryParam = queryJson.ToJObject(); List<DbParameter> parameter = new List<DbParameter>(); string sql = @" select ID, Code, Expressage, ExpressageCode,
case when ISNew='0' then '否' else '是' end ISNew, UnpackMUSER, UnpackMUSERName, UnpackMTIME, MUSER, MUSERName, MTIME FROM ICSExpressage where ISDelete is null {0} ";
string wheresql = ""; if (!string.IsNullOrWhiteSpace(queryJson)) { if (!string.IsNullOrWhiteSpace(queryParam["ExpressageCode"].ToString())) { wheresql += " and ExpressageCode like '%" + queryParam["ExpressageCode"].ToString() + "%' "; } if (!string.IsNullOrWhiteSpace(queryParam["Code"].ToString())) { wheresql += " and Code like '%" + queryParam["Code"].ToString() + "%' "; } } sql = string.Format(sql, wheresql);
return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam); }
} }
|