1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.AspNetCore.Http;
- using Microsoft.Extensions.Logging;
- using Microsoft.Extensions.Options;
- using Microsoft.AspNetCore.Authorization;
- using System.Web;
- using MySystem.MainModels;
- using LitJson;
- using Library;
- namespace MySystem.Areas.Api.Controllers.v1.pos
- {
- [Area("Api")]
- [Route("Api/v1/pos/[controller]/[action]")]
- public class StoreChangeHistoryController : BaseController
- {
- public StoreChangeHistoryController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
- {
- }
- #region 首页-客小爽产品-机具管理-拨出记录
- [Authorize]
- public JsonResult OutRecords(string value)
- {
- value = DesDecrypt(value);
- JsonData data = JsonMapper.ToObject(value);
- List<Dictionary<string, object>> dataList = OutRecordsDo(value);
- return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
- }
- public List<Dictionary<string, object>> OutRecordsDo(string value)
- {
- JsonData data = JsonMapper.ToObject(value);
- int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
- int BrandId = int.Parse(function.CheckInt(data["BrandId"].ToString())); //产品类型
- string SnNo = data["SnNo"].ToString(); //SN编号
- int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
- int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
- List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
- List<UserStoreChange> query = new List<UserStoreChange>();
- if (!string.IsNullOrEmpty(SnNo))
- {
- query = maindb.UserStoreChange.Where(m => m.SnNo == SnNo).ToList();
- }
- else
- {
- query = UserStoreChangeDbconn.Instance.GetList(UserId, BrandId, PageNum, PageSize);
- }
- foreach (var subdata in query)
- {
- Dictionary<string, object> curData = new Dictionary<string, object>();
- curData.Add("SnNo", subdata.SnNo); //SN编号
- curData.Add("SnType", RelationClass.GetPosSnTypeInfo(subdata.SnType)); //SN机具类型
- curData.Add("FromDate", subdata.FromDate == null ? "" : subdata.FromDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //出库时间
- curData.Add("Id", subdata.Id); //Id
- Users user = UsersDbconn.Instance.Get(subdata.ToUserId) ?? new Users();
- curData.Add("MakerCode", user.MakerCode); //收货创客编号
- curData.Add("MakerName", user.RealName); //收货创客名称
- dataList.Add(curData);
- }
- return dataList;
- }
- #endregion
- #region 检查签名是否合法,合法返回1,不合法返回提示信息
- /// <summary>
- /// 检查签名是否合法,合法返回1,不合法返回提示信息
- /// </summary>
- /// <param name="value">请求的参数(json字符串)</param>
- /// <param name="signField">要签名的字段</param>
- /// <returns></returns>
- private string CheckSign(string value, string[] signField)
- {
- JsonData json = JsonMapper.ToObject(value);
- Dictionary<string, string> dic = new Dictionary<string, string>();
- for (int i = 0; i < signField.Length; i++)
- {
- dic.Add(signField[i], json[signField[i]].ToString());
- }
- string sign = json["sign"].ToString(); //客户端签名字符串
- return new Sign().sign(dic, sign);
- }
- #endregion
- }
- }
|