baseline: 小军 WMS 二开代码原始快照(含 SynOABusiness.cs Debugger.Break)
This commit is contained in:
commit
c2b0e7be0d
6522 files changed
+3530643
No files matched your search
Vendored
BIN
Binary file not shown.
Executable
+12
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"dotnet-ef": {
|
||||
"version": "5.0.8",
|
||||
"commands": [
|
||||
"dotnet-ef"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using Opsoft.NetCore.O3App.Domain.Models;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi
|
||||
{
|
||||
public interface IAuthenticateService
|
||||
{
|
||||
bool IsAuthenticated(LoginRequest request, out string token);
|
||||
}
|
||||
}
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Opsoft.Data.Model;
|
||||
using Opsoft.NetCore.O3App.Domain.Models;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi
|
||||
{
|
||||
public interface IUserService
|
||||
{
|
||||
bool IsValid(LoginRequest req);
|
||||
JObject GetUser(string userId, string dbAias);
|
||||
}
|
||||
}
|
||||
Executable
+933
@@ -0,0 +1,933 @@
|
||||
using Opsoft.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Management;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
internal static class SecurityManage
|
||||
{
|
||||
private static string _lkey = "$ta|RT~#";
|
||||
|
||||
private static string strKeyList = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
// 取得设备硬盘的卷标号
|
||||
private static string GetDiskVolumeSerialNumber()
|
||||
{
|
||||
ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
|
||||
ManagementObject disk = new ManagementObject("win32_logicaldisk.deviceid=\"d:\"");
|
||||
disk.Get();
|
||||
return disk.GetPropertyValue("VolumeSerialNumber").ToString();
|
||||
}
|
||||
|
||||
|
||||
//获得CPU的序列号
|
||||
private static string getCpu(bool isServer)
|
||||
{
|
||||
string strCpu = string.Empty;
|
||||
string strPC = string.Empty;
|
||||
try
|
||||
{
|
||||
if (isServer)
|
||||
{
|
||||
ManagementClass myCpu = new ManagementClass("win32_Processor");
|
||||
ManagementObjectCollection myCpuConnection = myCpu.GetInstances();
|
||||
foreach (ManagementObject myObject in myCpuConnection)
|
||||
{
|
||||
strPC = myObject.ToString();
|
||||
strCpu = myObject.Properties["Processorid"].Value.ToString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
strCpu = getPCSystem();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
strCpu = strPC + GetIP();
|
||||
}
|
||||
return strCpu;
|
||||
}
|
||||
|
||||
private static string getPCSystem()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Environment.MachineName + GetIP() + GetMacAddress();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "unknow";
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetDiskID()
|
||||
{
|
||||
try
|
||||
{
|
||||
//获取硬盘ID
|
||||
String HDid = "";
|
||||
ManagementClass mc = new ManagementClass("Win32_DiskDrive");
|
||||
ManagementObjectCollection moc = mc.GetInstances();
|
||||
foreach (ManagementObject mo in moc)
|
||||
{
|
||||
HDid = (string)mo.Properties["Model"].Value;
|
||||
}
|
||||
moc = null;
|
||||
mc = null;
|
||||
return HDid;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "unknow";
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static string GetIP()
|
||||
{
|
||||
try
|
||||
{
|
||||
//获取IP地址
|
||||
string st = "";
|
||||
ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
|
||||
ManagementObjectCollection moc = mc.GetInstances();
|
||||
foreach (ManagementObject mo in moc)
|
||||
{
|
||||
if ((bool)mo["IPEnabled"])
|
||||
{
|
||||
Array ar;
|
||||
ar = (Array)mo.Properties["IpAddress"].Value;
|
||||
st = ar.GetValue(0).ToString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
moc = null;
|
||||
mc = null;
|
||||
return st;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "unknow";
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static string GetMacAddress()
|
||||
{
|
||||
try
|
||||
{
|
||||
//获取网卡硬件地址
|
||||
string mac = "";
|
||||
ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
|
||||
ManagementObjectCollection moc = mc.GetInstances();
|
||||
foreach (ManagementObject mo in moc)
|
||||
{
|
||||
if ((bool)mo["IPEnabled"])
|
||||
{
|
||||
mac = mo["MacAddress"].ToString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
moc = null;
|
||||
mc = null;
|
||||
return mac;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "unknow";
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 得到客户序列号
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetCustomerKey()
|
||||
{
|
||||
bool isServer = GetServerMode() == 1;//获取服务器模式
|
||||
string TempKey = getCpu(isServer);//获得Cpu序列号
|
||||
string LastKey = "";
|
||||
int[] strid = new int[TempKey.Length * 2];//
|
||||
for (int i = 0; i < TempKey.Length; i++)//把字符赋给数组
|
||||
{
|
||||
strid[i] = (((int)TempKey[i]) + i) % strKeyList.Length;
|
||||
}
|
||||
for (int i = TempKey.Length - 1; i >= 0; i--)//把字符赋给数组
|
||||
{
|
||||
strid[TempKey.Length + i - 1] = (((int)TempKey[i]) + i) % strKeyList.Length;
|
||||
}
|
||||
for (int i = 0; i < strid.Length; i++)//从数组随机抽取24个字符组成新的字符生成机器码
|
||||
{
|
||||
LastKey += strKeyList[strid[i]].ToString();
|
||||
}
|
||||
return LastKey.Substring(0, 6) + "-" + LastKey.Substring(6, 6) + "-" + LastKey.Substring(12, 6) + "-" + LastKey.Substring(18, 6);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 得到客户序列号
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetLocalCustomerKey(string ProID)
|
||||
{
|
||||
string wLicenseInfo = "";
|
||||
ManagerLicenseInfo myInfo = new ManagerLicenseInfo();
|
||||
wLicenseInfo = myInfo.GetMacID();
|
||||
wLicenseInfo = DecryptDES(wLicenseInfo, _lkey);
|
||||
return wLicenseInfo;
|
||||
}
|
||||
|
||||
// 默认密钥向量
|
||||
private static byte[] Keys = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF };
|
||||
|
||||
/// <summary>
|
||||
/// DES加密字符串
|
||||
/// </summary>
|
||||
/// <param name="encryptString">待加密的字符串</param>
|
||||
/// <param name="encryptKey">加密密钥,8位</param>
|
||||
/// <returns>成功返回加密后的字符串,失敗返回源串</returns>
|
||||
public static string EncryptDES(string encryptString, string encryptKey)
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] rgbKey = Encoding.UTF8.GetBytes(encryptKey.Substring(0, 8));
|
||||
byte[] rgbIV = Keys;
|
||||
byte[] inputByteArray = Encoding.UTF8.GetBytes(encryptString);
|
||||
DESCryptoServiceProvider dCSP = new DESCryptoServiceProvider();
|
||||
MemoryStream mStream = new MemoryStream();
|
||||
CryptoStream cStream = new CryptoStream(mStream, dCSP.CreateEncryptor(rgbKey, rgbIV), CryptoStreamMode.Write);
|
||||
cStream.Write(inputByteArray, 0, inputByteArray.Length);
|
||||
cStream.FlushFinalBlock();
|
||||
return Convert.ToBase64String(mStream.ToArray());
|
||||
}
|
||||
catch
|
||||
{
|
||||
return encryptString;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DES解密字符串
|
||||
/// </summary>
|
||||
/// <param name="decryptString">待解密的字符串</param>
|
||||
/// <param name="decryptKey">解密密鑰,8位</param>
|
||||
/// <returns>成功返回解密后的字符串,失敗返回源串</returns>
|
||||
public static string DecryptDES(string decryptString, string decryptKey)
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] rgbKey = Encoding.UTF8.GetBytes(decryptKey);
|
||||
byte[] rgbIV = Keys;
|
||||
byte[] inputByteArray = Convert.FromBase64String(decryptString);
|
||||
DESCryptoServiceProvider DCSP = new DESCryptoServiceProvider();
|
||||
MemoryStream mStream = new MemoryStream();
|
||||
CryptoStream cStream = new CryptoStream(mStream, DCSP.CreateDecryptor(rgbKey, rgbIV), CryptoStreamMode.Write);
|
||||
cStream.Write(inputByteArray, 0, inputByteArray.Length);
|
||||
cStream.FlushFinalBlock();
|
||||
return Encoding.UTF8.GetString(mStream.ToArray());
|
||||
}
|
||||
catch
|
||||
{
|
||||
return decryptString;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="strLicense"></param>
|
||||
/// <returns></returns>
|
||||
public static LicenseInfo GetLicenseInfo(string strLicense)
|
||||
{
|
||||
string strMAC = GetCustomerKey().Replace("-", "");
|
||||
return GetLicenseInfo(strLicense, strMAC, "");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="strLicense"></param>
|
||||
/// <returns></returns>
|
||||
public static LicenseInfo GetLicenseInfo(string strLicense, string strMAC)
|
||||
{
|
||||
return GetLicenseInfo(strLicense, strMAC, "");
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="strLicense"></param>
|
||||
/// <param name="strMAC"></param>
|
||||
/// <returns></returns>
|
||||
public static LicenseInfo GetLicenseInfo(string strLicense, string strMAC, string wCustomerName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(strMAC))
|
||||
{
|
||||
strMAC = GetCustomerKey().Replace("-", "");
|
||||
}
|
||||
string LastString = "";
|
||||
LicenseInfo myInfo = new LicenseInfo();
|
||||
StringBuilder mySB = new StringBuilder();
|
||||
strLicense = SecurityManage.DecryptDES(strLicense, _lkey);
|
||||
mySB.Append(strLicense);
|
||||
try
|
||||
{
|
||||
|
||||
myInfo.CustomerName = string.IsNullOrEmpty(wCustomerName) ? "" : SecurityManage.DecryptDES(wCustomerName, _lkey);
|
||||
|
||||
int iLen = strLicense.Length - 1;
|
||||
LastString = "";
|
||||
for (int i = 4; i >= 0; i--)
|
||||
{
|
||||
int ii = ((int)strMAC[i]) % iLen;
|
||||
LastString = mySB[ii].ToString() + LastString;
|
||||
mySB.Remove(ii, 1);
|
||||
iLen--;
|
||||
}
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(LastString))
|
||||
myInfo.MaxUsers = 0;
|
||||
else
|
||||
myInfo.MaxUsers = Convert.ToInt16(LastString);
|
||||
}
|
||||
catch (System.Exception)
|
||||
{
|
||||
myInfo.MaxUsers = 0;
|
||||
}
|
||||
LastString = "";
|
||||
for (int i = 7; i >= 0; i--)
|
||||
{
|
||||
int ii = ((int)strMAC[i]) % iLen;
|
||||
LastString = GetKeyChar(mySB[ii].ToString()) + LastString;
|
||||
mySB.Remove(ii, 1);
|
||||
iLen--;
|
||||
}
|
||||
myInfo.LicenseDays = new DateTime(int.Parse(LastString.Substring(0, 4)), int.Parse(LastString.Substring(4, 2)), int.Parse(LastString.Substring(6, 2)));
|
||||
LastString = "";
|
||||
for (int i = 3; i >= 0; i--)
|
||||
{
|
||||
int ii = ((int)strMAC[i]) % iLen;
|
||||
LastString = GetKeyChar(mySB[ii].ToString()) + LastString;
|
||||
mySB.Remove(ii, 1);
|
||||
iLen--;
|
||||
}
|
||||
|
||||
//myInfo.ProductVer = "V" + int.Parse(LastString.Substring(0, 2)).ToString() + "." + int.Parse(LastString.Substring(2, 2)).ToString();
|
||||
//
|
||||
LastString = "";
|
||||
for (int i = 7; i >= 0; i--)
|
||||
{
|
||||
int ii = ((int)strMAC[i]) % iLen;
|
||||
LastString = GetKeyChar(mySB[ii].ToString()) + LastString;
|
||||
mySB.Remove(ii, 1);
|
||||
iLen--;
|
||||
}
|
||||
myInfo.SerialDate = new DateTime(int.Parse(LastString.Substring(0, 4)), int.Parse(LastString.Substring(4, 2)), int.Parse(LastString.Substring(6, 2)));
|
||||
LastString = "";
|
||||
for (int i = strMAC.Length - 1; i >= 0; i--)
|
||||
{
|
||||
int ii = ((int)strMAC[i]) % iLen;
|
||||
LastString = mySB[ii].ToString() + LastString;
|
||||
mySB.Remove(ii, 1);
|
||||
iLen--;
|
||||
}
|
||||
if (LastString == strMAC)
|
||||
{
|
||||
myInfo.SerialNumber = LastString = LastString.Substring(0, 6) + "-" + LastString.Substring(6, 6) + "-" + LastString.Substring(12, 6) + "-" + LastString.Substring(18, 6);
|
||||
}
|
||||
else
|
||||
{
|
||||
myInfo.SerialNumber = "";
|
||||
}
|
||||
for (int i = 2; i >= 0; i--)
|
||||
{
|
||||
int ii = ((int)strMAC[i]) % iLen;
|
||||
LastString = mySB[ii].ToString() + LastString;
|
||||
mySB.Remove(ii, 1);
|
||||
iLen--;
|
||||
}
|
||||
myInfo.SoftMode = LastString;
|
||||
//myInfo.ProductID = LastString;
|
||||
//myInfo.ProductName = GetProductID(LastString);
|
||||
}
|
||||
catch (System.Exception)
|
||||
{
|
||||
myInfo.SerialNumber = "";
|
||||
}
|
||||
return myInfo;
|
||||
}
|
||||
|
||||
private static string GetKeyChar(string key)
|
||||
{
|
||||
int iKey = (int)key[0];
|
||||
string _Seed = "0";
|
||||
if (iKey >= (int)'A' && iKey <= (int)'B')
|
||||
{
|
||||
return "0";
|
||||
}
|
||||
if (iKey >= (int)'C' && iKey <= (int)'D')
|
||||
{
|
||||
return "1";
|
||||
}
|
||||
if (iKey >= (int)'E' && iKey <= (int)'F')
|
||||
{
|
||||
return "2";
|
||||
}
|
||||
if (iKey >= (int)'G' && iKey <= (int)'I')
|
||||
{
|
||||
return "3";
|
||||
}
|
||||
if (iKey >= (int)'J' && iKey <= (int)'L')
|
||||
{
|
||||
return "4";
|
||||
}
|
||||
if (iKey >= (int)'M' && iKey <= (int)'O')
|
||||
{
|
||||
return "5";
|
||||
}
|
||||
if (iKey >= (int)'P' && iKey <= (int)'R')
|
||||
{
|
||||
return "6";
|
||||
}
|
||||
if (iKey >= (int)'S' && iKey <= (int)'U')
|
||||
{
|
||||
return "7";
|
||||
}
|
||||
if (iKey >= (int)'V' && iKey <= (int)'X')
|
||||
{
|
||||
return "8";
|
||||
}
|
||||
if (iKey >= (int)'Y' && iKey <= (int)'Z')
|
||||
{
|
||||
return "9";
|
||||
}
|
||||
return _Seed;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="wMacID"></param>
|
||||
/// <returns></returns>
|
||||
public static List<LicenseInfo> GetLocalSystemLicenseInfo(string wMacID)
|
||||
{
|
||||
// 改写成文件形式,不再写入注册表
|
||||
if (string.IsNullOrEmpty(wMacID))
|
||||
wMacID = SecurityManage.GetCustomerKey();
|
||||
string mMacID = wMacID.Replace("-", "");
|
||||
|
||||
List<LicenseInfo> myList = new List<LicenseInfo>();
|
||||
ManagerLicenseInfo myInfo = new ManagerLicenseInfo();
|
||||
List<tagLicenseString> infoList = myInfo.GetLocalSystemLicenseInfo();
|
||||
foreach (tagLicenseString strInfo in infoList)
|
||||
{
|
||||
string wLicenseInfo = DecryptDES(strInfo.LiInfo, _lkey);
|
||||
string wCU = strInfo.CuInfo;
|
||||
LicenseInfo subInfo = GetLicenseInfo(wLicenseInfo, mMacID, wCU);
|
||||
if (subInfo.SerialNumber == wMacID)
|
||||
{
|
||||
myList.Add(subInfo);
|
||||
}
|
||||
}
|
||||
return myList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="wLicenseInfo"></param>
|
||||
/// <param name="wMacID"></param>
|
||||
/// <param name="wCustomerName">没有加密的客户识别码</param>
|
||||
/// <param name="wMode">没有加密的客户识别码</param>
|
||||
public static void WriteLicenseInfo(string wLicenseInfo, string wMacID, string wCustomerName, string wMode)
|
||||
{
|
||||
wMacID = SecurityManage.EncryptDES(wMacID, _lkey);
|
||||
ManagerLicenseInfo myInfo = new ManagerLicenseInfo();
|
||||
myInfo.WriteLicenseInfo(wLicenseInfo, wMacID, wCustomerName, wMode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询服务器注册模式
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static int GetServerMode()
|
||||
{
|
||||
ManagerLicenseInfo myInfo = new ManagerLicenseInfo();
|
||||
return myInfo.GetServerMode();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新服务器注册模式
|
||||
/// <param name="wMode">服务器注册模式</param>
|
||||
public static string WriteServerMode(string wMode)
|
||||
{
|
||||
ManagerLicenseInfo myInfo = new ManagerLicenseInfo();
|
||||
myInfo.WriteModeInfo(wMode);
|
||||
string key = GetCustomerKey();
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
internal static class LicenseFunction
|
||||
{
|
||||
/// <summary>
|
||||
/// 得到版本号
|
||||
/// </summary>
|
||||
/// <param name="Ver1">主版本号</param>
|
||||
/// <param name="Ver2">次版本号</param>
|
||||
/// <returns></returns>
|
||||
public static string GetVer(int Ver1, int Ver2)
|
||||
{
|
||||
string strVer1 = Ver1.ToString().PadLeft(2, '0');
|
||||
string strVer2 = Ver2.ToString().PadLeft(2, '0');
|
||||
string rtnCode = "";
|
||||
rtnCode += GetKeyChar(strVer1.Substring(0, 1));
|
||||
rtnCode += GetKeyChar(strVer1.Substring(1, 1));
|
||||
rtnCode += GetKeyChar(strVer2.Substring(0, 1));
|
||||
rtnCode += GetKeyChar(strVer2.Substring(1, 1));
|
||||
return rtnCode;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 得到使用期限
|
||||
/// </summary>
|
||||
/// <param name="wKey"></param>
|
||||
/// <param name="wPDate"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetDays(string wKey, DateTime wPDate)
|
||||
{
|
||||
DateTime wToday = DateTime.Today;
|
||||
switch (wKey)
|
||||
{
|
||||
case "A":
|
||||
// 1 年
|
||||
wPDate = wToday.AddYears(1);
|
||||
break;
|
||||
case "B":
|
||||
// 2 年
|
||||
wPDate = wToday.AddYears(2);
|
||||
break;
|
||||
case "C":
|
||||
// 3 年
|
||||
wPDate = wToday.AddYears(3);
|
||||
break;
|
||||
case "E":
|
||||
break;
|
||||
case "F":
|
||||
//无期限 + 100年
|
||||
wPDate = new DateTime(2099, 12, 31);
|
||||
break;
|
||||
}
|
||||
return wPDate.Year.ToString().PadLeft(4, '0') + wPDate.Month.ToString().PadLeft(2, '0') + wPDate.Day.ToString().PadLeft(2, '0');
|
||||
}
|
||||
|
||||
private static string GetKeyChar(string key)
|
||||
{
|
||||
int _Seed = 65;
|
||||
switch (key)
|
||||
{
|
||||
case "0":
|
||||
_Seed = GetSeed((int)'A', (int)'B');
|
||||
break;
|
||||
|
||||
case "1":
|
||||
_Seed = GetSeed((int)'C', (int)'D');
|
||||
break;
|
||||
|
||||
case "2":
|
||||
_Seed = GetSeed((int)'E', (int)'F');
|
||||
break;
|
||||
|
||||
case "3":
|
||||
_Seed = GetSeed((int)'G', (int)'I');
|
||||
break;
|
||||
|
||||
case "4":
|
||||
_Seed = GetSeed((int)'J', (int)'L');
|
||||
break;
|
||||
|
||||
case "5":
|
||||
_Seed = GetSeed((int)'M', (int)'O');
|
||||
break;
|
||||
|
||||
case "6":
|
||||
_Seed = GetSeed((int)'P', (int)'R');
|
||||
break;
|
||||
|
||||
case "7":
|
||||
_Seed = GetSeed((int)'S', (int)'U');
|
||||
break;
|
||||
|
||||
case "8":
|
||||
_Seed = GetSeed((int)'V', (int)'X');
|
||||
break;
|
||||
|
||||
case "9":
|
||||
_Seed = GetSeed((int)'Y', (int)'Z');
|
||||
break;
|
||||
}
|
||||
return ((char)_Seed).ToString();
|
||||
}
|
||||
|
||||
private static int GetSeed(int fromN, int toN)
|
||||
{
|
||||
DateTime dt = new DateTime();
|
||||
dt = DateTime.Now;
|
||||
Random rnd = new Random(dt.Millisecond);
|
||||
return rnd.Next(fromN, toN);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 产生注册码
|
||||
/// </summary>
|
||||
/// <param name="Days">使用限限</param>
|
||||
/// <param name="MacKey">机器码</param>
|
||||
/// <returns></returns>
|
||||
public static string GetProductKey(string ProID, string Days, string MacKey, int MaxUsers)
|
||||
{
|
||||
string Ver = GetVer(7, 0);
|
||||
//string Ver = LicenseFunction.GetVer(7,0);
|
||||
string strMAC = MacKey.Replace("-", ""); //分开机器码
|
||||
string ProductKey = Guid.NewGuid().ToString().ToUpper();
|
||||
StringBuilder mySB = new StringBuilder();
|
||||
mySB.Append(ProductKey);
|
||||
int iLen = ProductKey.Length; //总长度
|
||||
for (int i = 0; i < ProID.Length; i++)
|
||||
{
|
||||
int ii = ((int)strMAC[i]) % iLen;
|
||||
mySB.Insert(ii, ProID[i]);
|
||||
iLen++;
|
||||
}
|
||||
for (int i = 0; i < strMAC.Length; i++)
|
||||
{
|
||||
int ii = ((int)strMAC[i]) % iLen;
|
||||
mySB.Insert(ii, strMAC[i]);
|
||||
iLen++;
|
||||
}
|
||||
string wToDay = DateTime.Now.Year.ToString().PadLeft(4, '0') + DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Day.ToString().PadLeft(2, '0');
|
||||
for (int i = 0; i < wToDay.Length; i++)
|
||||
{
|
||||
int ii = ((int)strMAC[i]) % iLen;
|
||||
mySB.Insert(ii, GetKeyChar(wToDay[i].ToString()));
|
||||
iLen++;
|
||||
}
|
||||
for (int i = 0; i < Ver.Length; i++)
|
||||
{
|
||||
int ii = ((int)strMAC[i]) % iLen;
|
||||
mySB.Insert(ii, Ver[i]);
|
||||
iLen++;
|
||||
}
|
||||
for (int i = 0; i < Days.Length; i++)
|
||||
{
|
||||
int ii = ((int)strMAC[i]) % iLen;
|
||||
mySB.Insert(ii, GetKeyChar(Days[i].ToString()));
|
||||
iLen++;
|
||||
}
|
||||
string strMaxUsers = MaxUsers.ToString().PadLeft(5, '0').Left(5);
|
||||
for (int i = 0; i < strMaxUsers.Length; i++)
|
||||
{
|
||||
int ii = ((int)strMAC[i]) % iLen;
|
||||
mySB.Insert(ii, strMaxUsers[i]);
|
||||
iLen++;
|
||||
}
|
||||
return mySB.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
internal class ManagerLicenseInfo : XmlDocument
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// XML 文件路径
|
||||
/// </summary>
|
||||
private string tXMLPath
|
||||
{
|
||||
get
|
||||
{
|
||||
return Path.Combine(DBConnectionInfo.DBFilename);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public ManagerLicenseInfo()
|
||||
{
|
||||
Init(this.tXMLPath);
|
||||
}
|
||||
|
||||
private void Init(string FileNameAll)
|
||||
{
|
||||
if (!File.Exists(FileNameAll))
|
||||
{
|
||||
//如果文件不存,先创建文件
|
||||
XmlDocument myFile = new XmlDocument();
|
||||
myFile.LoadXml(
|
||||
"<?xml version=\"1.0\" encoding=\"utf-8\"?> \r\n" +
|
||||
"<DBManage> " + "\r\n" +
|
||||
"<DBGroup></DBGroup>" + "\r\n" +
|
||||
"<DBInfo></DBInfo>" + "\r\n" +
|
||||
"<UserInfo >" + "\r\n" +
|
||||
"<User ID='" + SymmetricMethod.Decrypt("admin") + "' Pwd='" + SymmetricMethod.Decrypt("admin") + "' />" + "\r\n" +
|
||||
"</UserInfo>" + "\r\n" +
|
||||
"<LicenseList>" + "\r\n" +
|
||||
"</LicenseList>" + "\r\n" +
|
||||
"<MacCodeInfo></MacCodeInfo>" + "\r\n" +
|
||||
"<ServerMode></ServerMode>" + "\r\n" +
|
||||
"</DBManage>");
|
||||
myFile.Save(FileNameAll);
|
||||
}
|
||||
this.Load(FileNameAll);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 写入LicenseInfo
|
||||
/// </summary>
|
||||
/// <param name="wLicenseInfo"></param>
|
||||
/// <param name="ProID"></param>
|
||||
/// <param name="wMacID"></param>
|
||||
public void WriteLicenseInfo(string wLicenseInfo, string wMacID, string wCustomerName, string wMode)
|
||||
{
|
||||
WriteMode(wMode);
|
||||
WriteMacID(wMacID);
|
||||
WriteLicense(wLicenseInfo, wCustomerName);
|
||||
this.Save(tXMLPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 写入Mode
|
||||
/// <param name="wMode"></param>
|
||||
public void WriteModeInfo(string wMode)
|
||||
{
|
||||
WriteMode(wMode);
|
||||
this.Save(tXMLPath);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<tagLicenseString> GetLocalSystemLicenseInfo()
|
||||
{
|
||||
List<tagLicenseString> myList = new List<tagLicenseString>();
|
||||
XmlNode rootNode = this.FindNode("DBManage/LicenseList");
|
||||
if (rootNode != null)
|
||||
{
|
||||
if (rootNode.HasChildNodes)
|
||||
{
|
||||
for (int i = 0; i < rootNode.ChildNodes.Count; i++)
|
||||
{
|
||||
XmlAttribute subA = rootNode.ChildNodes[i].Attributes["CustomerName"];
|
||||
string wCU = "";
|
||||
if (subA != null)
|
||||
{
|
||||
wCU = subA.InnerXml;
|
||||
}
|
||||
tagLicenseString mSub = new tagLicenseString() { LiInfo = rootNode.ChildNodes[i].InnerXml, CuInfo = wCU };
|
||||
myList.Add(mSub);
|
||||
}
|
||||
}
|
||||
}
|
||||
return myList;
|
||||
}
|
||||
|
||||
private void WriteMode(string mode)
|
||||
{
|
||||
XmlNode xmlMode = this.FindNode("DBManage/ServerMode");
|
||||
if (xmlMode == null)
|
||||
{
|
||||
XmlNode Root = FindNode("DBManage");
|
||||
this.CreateNode(Root, "ServerMode", mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlMode.InnerXml = mode;
|
||||
}
|
||||
}
|
||||
|
||||
private void WriteMacID(string wMacID)
|
||||
{
|
||||
XmlNode xmlMacID = this.FindNode("DBManage/MacCodeInfo");
|
||||
if (xmlMacID == null)
|
||||
{
|
||||
XmlNode Root = FindNode("DBManage");
|
||||
this.CreateNode(Root, "MacCodeInfo", wMacID);
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlMacID.InnerXml = wMacID;
|
||||
}
|
||||
}
|
||||
|
||||
private void WriteLicense(string wLicenseInfo, string wCustomerName)
|
||||
{
|
||||
string ProID = "WE";
|
||||
|
||||
XmlNode xmlLicenseList = this.FindNode("DBManage/LicenseList");
|
||||
if (xmlLicenseList == null)
|
||||
{
|
||||
XmlNode Root = FindNode("DBManage");
|
||||
xmlLicenseList = this.CreateNode(Root, "LicenseList", "");
|
||||
}
|
||||
XmlNode xmlProID = this.FindNode("DBManage/LicenseList/" + ProID);
|
||||
if (xmlProID == null)
|
||||
{
|
||||
XmlNode Root = FindNode("DBManage/LicenseList");
|
||||
XmlNode subNote = this.CreateNode(Root, ProID, wLicenseInfo);
|
||||
|
||||
XmlAttribute subAttribute = this.CreateAttribute("CustomerName");
|
||||
subAttribute.InnerXml = wCustomerName;
|
||||
subNote.Attributes.Append(subAttribute);
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlProID.InnerXml = wLicenseInfo;
|
||||
XmlAttribute subAttribute = xmlProID.Attributes["CustomerName"];
|
||||
if (subAttribute == null)
|
||||
{
|
||||
subAttribute = this.CreateAttribute("CustomerName");
|
||||
subAttribute.InnerXml = wCustomerName;
|
||||
xmlProID.Attributes.Append(subAttribute);
|
||||
}
|
||||
else
|
||||
{
|
||||
subAttribute.InnerXml = wCustomerName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 得到授权模式
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public int GetServerMode()
|
||||
{
|
||||
XmlNode xmlMode = this.FindNode("DBManage/ServerMode");
|
||||
if (xmlMode == null)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (xmlMode.InnerXml.ToStringEx().Equals("2"))
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 得到机器码
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string GetMacID()
|
||||
{
|
||||
XmlNode xmlMacID = this.FindNode("DBManage/MacCodeInfo");
|
||||
if (xmlMacID == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
else
|
||||
{
|
||||
return xmlMacID.InnerXml;
|
||||
}
|
||||
}
|
||||
|
||||
private XmlNode CreateNode(XmlNode ParaNode, string Name, string Value)
|
||||
{
|
||||
XmlNode objNodeChild = this.CreateElement(Name);
|
||||
objNodeChild.InnerXml = Value;
|
||||
ParaNode.AppendChild(objNodeChild);
|
||||
return objNodeChild;
|
||||
}
|
||||
|
||||
private XmlNode FindNode(string xPath)
|
||||
{
|
||||
XmlNode xmlNode = this.SelectSingleNode(xPath);
|
||||
return xmlNode;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 用于保存LicenseInfo
|
||||
/// </summary>
|
||||
internal class tagLicenseString
|
||||
{
|
||||
public string LiInfo { get; set; }
|
||||
public string CuInfo { get; set; }
|
||||
}
|
||||
|
||||
internal class LicenseInfo
|
||||
{
|
||||
public LicenseInfo()
|
||||
{
|
||||
}
|
||||
|
||||
public string CustomerName { get; set; }
|
||||
public string ErrType { get; set; }
|
||||
public bool HaveLicense
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(SerialNumber))
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public DateTime LicenseDays { get; set; }
|
||||
/// <summary>
|
||||
/// 软件期限
|
||||
/// </summary>
|
||||
public string LicenseString
|
||||
{
|
||||
get
|
||||
{
|
||||
if (SerialDate.AddYears(100) == LicenseDays)
|
||||
{
|
||||
return "终身使用";
|
||||
}
|
||||
else
|
||||
{
|
||||
return LicenseDays.ToLongDateString();
|
||||
}
|
||||
}
|
||||
}
|
||||
public int MaxUsers { get; set; }
|
||||
public DateTime SerialDate { get; set; }
|
||||
public string SerialNumber { get; set; }
|
||||
public string SoftMode { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi
|
||||
{
|
||||
public static class MD5Help
|
||||
{
|
||||
//这样容易解的密码变的更难解=无解
|
||||
const string MD5Key = "r16TD&*~12{]?[+3";
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static string MD5Encrypt(string source, string hStrText = MD5Key)
|
||||
{
|
||||
MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
|
||||
byte[] buffer = md5.ComputeHash(Encoding.UTF8.GetBytes(source));
|
||||
string strMD5Value = string.Empty;
|
||||
for (int i = 0; i < buffer.Length; i++)
|
||||
{
|
||||
int a = 0xf & buffer[i] >> 4;
|
||||
int b = buffer[i] & 0xf;
|
||||
strMD5Value += hStrText.Substring(a, 1) + hStrText[b];//0xf & buffer[i] >> 4 buffer[i] & 0xf
|
||||
}
|
||||
return strMD5Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
using Microsoft.Extensions.Options;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Newtonsoft.Json;
|
||||
using Opsoft.NetCore.O3App.Domain.Models;
|
||||
using Opsoft.NetCore.O3App.WebApi.Model;
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
using Opsoft.Data;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi
|
||||
{
|
||||
public class TokenAuthenticationService : IAuthenticateService
|
||||
{
|
||||
private readonly IUserService _userService;
|
||||
private readonly TokenManagement _tokenManagement;
|
||||
|
||||
public TokenAuthenticationService(IUserService userService, IOptions<TokenManagement> tokenManagement)
|
||||
{
|
||||
_userService = userService;
|
||||
_tokenManagement = tokenManagement.Value;
|
||||
}
|
||||
|
||||
public bool IsAuthenticated(LoginRequest request, out string token)
|
||||
{
|
||||
token = string.Empty;
|
||||
if (!_userService.IsValid(request))
|
||||
return false;
|
||||
var claims = new[]
|
||||
{
|
||||
new Claim(ClaimTypes.Name,request.UserID),
|
||||
new Claim(ClaimTypes.UserData,"{\"UserName\": \""+ request.UserName +"\",\"DBaias\": \""+ request.DBAias +"\"}")
|
||||
};
|
||||
var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_tokenManagement.Secret));
|
||||
var credentials = new SigningCredentials(key, SecurityAlgorithms.HmacSha256);
|
||||
var jwtToken = new JwtSecurityToken(_tokenManagement.Issuer, _tokenManagement.Audience, claims, expires: DateTime.Now.AddMinutes(_tokenManagement.AccessExpiration), signingCredentials: credentials);
|
||||
|
||||
token = new JwtSecurityTokenHandler().WriteToken(jwtToken);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static LoginRequest GetLoinInfo(string Token)
|
||||
{
|
||||
JwtSecurityToken jwtToken = new JwtSecurityTokenHandler().ReadJwtToken(Token);
|
||||
LoginRequest myInfo = new LoginRequest();
|
||||
myInfo.UserID = jwtToken.Claims.First(o => o.Type == ClaimTypes.Name).Value;
|
||||
dynamic temType = JsonConvert.DeserializeObject<dynamic>(jwtToken.Claims.First(o => o.Type == ClaimTypes.UserData).Value);
|
||||
myInfo.UserName = temType.UserName;
|
||||
myInfo.DBAias = temType.DBaias;
|
||||
using APPServerContext context = new APPServerContext(myInfo.DBAias, myInfo.UserID);
|
||||
var loginUserInfo = context.Database
|
||||
.SqlQuery($"SELECT * FROM dbo.SYS_LOGINUSER WHERE USER_ID='{myInfo.UserID}'").Rows[0];
|
||||
myInfo.PAType = loginUserInfo["PATYPE"].ToStringEx();
|
||||
myInfo.PAID = loginUserInfo["PA_ID"].ToStringEx();
|
||||
myInfo.IsPDA = loginUserInfo["IS_PDA"].ToBoolean();
|
||||
myInfo.EMAIL = loginUserInfo["EMAIL"].ToStringEx();
|
||||
myInfo.ERPID = loginUserInfo["ERPID"].ToStringEx();
|
||||
myInfo.ISDEFAULT = loginUserInfo["ISDEFAULT"].ToBoolean();
|
||||
myInfo.CARDID = loginUserInfo["CARDID"].ToStringEx();
|
||||
myInfo.DOMAINUSER = loginUserInfo["DOMAINUSER"].ToStringEx();
|
||||
myInfo.LASTLOGINTIME = loginUserInfo["LASTLOGINTIME"].ToStringEx();
|
||||
myInfo.PHOTO = loginUserInfo["PHOTO"]==DBNull.Value?null:(byte[])loginUserInfo["PHOTO"];
|
||||
var operatorInfo = context.Database.SqlQuery(
|
||||
@$"SELECT
|
||||
T1.FOPERATORTYPE,
|
||||
T2.FDETAILID
|
||||
FROM dbo.T_BD_OPERATOR T1
|
||||
LEFT JOIN dbo.T_BD_OPERATORENTRY T2
|
||||
ON T2.FINTERID = T1.FINTERID
|
||||
LEFT JOIN dbo.T_HR_EMPINFO T3
|
||||
ON T3.FSTAFFID = T2.FSTAFFID
|
||||
WHERE T3.FNUMBER='{myInfo.PAID}'");
|
||||
if (operatorInfo.Rows.Count > 0)
|
||||
{
|
||||
var operatorInfoGroup = operatorInfo
|
||||
.AsEnumerable()
|
||||
.GroupBy(o => o["FOPERATORTYPE"].ToStringEx())
|
||||
.ToList();
|
||||
foreach (var group in operatorInfoGroup)
|
||||
{
|
||||
if (!group.All(o => o["FDETAILID"].ToStringEx().IsNullOrEmpty()))
|
||||
{
|
||||
myInfo.OperatorIdDic.Add(group.Key, group.First(o => !o["FDETAILID"].ToStringEx().IsNullOrEmpty())["FDETAILID"].ToStringEx());
|
||||
}
|
||||
}
|
||||
}
|
||||
return myInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+135
@@ -0,0 +1,135 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Opsoft.Data;
|
||||
using Opsoft.Data.Model;
|
||||
using Opsoft.NetCore.O3App.Domain.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi
|
||||
{
|
||||
public class UserService : IUserService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 验证用户是否可以登录成功
|
||||
/// </summary>
|
||||
/// <param name="req"></param>
|
||||
/// <returns></returns>
|
||||
public bool IsValid(LoginRequest req)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (APPServerContext DBContext = new APPServerContext(req.DBAias, req.UserID))
|
||||
{
|
||||
SYS_LOGINUSER myUser = DBContext.Database.SqlQuery<SYS_LOGINUSER>(
|
||||
" select USER_ID,USER_NAME,PR_PASSWORD,FDELETED " +
|
||||
" from SYS_LOGINUSER " +
|
||||
" where USER_ID=" + DBContext.GetDBParName("@PA1"),
|
||||
DBContext.CreateParameter("@PA1", req.UserID)).SingleOrDefault();
|
||||
if (myUser != null)
|
||||
{
|
||||
var pass = myUser.GetPassWord();
|
||||
var encryptPass = MD5Help.MD5Encrypt(pass);
|
||||
req.UserName = myUser.USER_NAME;
|
||||
if (req.IsFaceLogin || encryptPass.Equals(req.Password))
|
||||
{
|
||||
LicenseInfo PPermissions = this.GetLicense();
|
||||
if (PPermissions.HaveLicense)
|
||||
{
|
||||
if (PPermissions.LicenseDays >= PPermissions.SerialDate)
|
||||
{
|
||||
if (PPermissions.LicenseDays < PPermissions.SerialDate.AddDays(30))
|
||||
{
|
||||
req.errtype = "3";//软件将过服务到期日,请提前申请或购买下一年度服务
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
req.errtype = "8";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
req.errtype = "4"; //软件服务到期日已过,请申请或购买下一年度服务!
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
req.errtype = "5"; //软件未注册,请先注册再使用!
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
req.errtype = "2"; //密码不正确
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
req.errtype = "1"; //用户名不存在
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
req.errtype = ex.Message;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public JObject GetUser(string userId, string dbAias)
|
||||
{
|
||||
using APPServerContext DBContext = new APPServerContext(dbAias, userId);
|
||||
var parameter = DBContext.CreateParameter("@UserId", userId);
|
||||
string sql = $" SELECT T01.*,T03.FROLETYPE FROM SYS_LOGINUSER T01 LEFT JOIN SYS_USERROLERELATION T02 ON T01.USER_ID = T02.USER_ID LEFT JOIN SYS_USERROLE T03 ON T03.FROLENUMBER = T02.FROLEID WHERE T01.USER_ID = {parameter.ParameterName} ";
|
||||
DataTable userMessage = DBContext.Database.SqlQuery(sql, parameter);
|
||||
string fRoleType = "1";
|
||||
JObject returnJObject = new JObject();
|
||||
foreach (DataRow userRow in userMessage.Rows)
|
||||
{
|
||||
if (returnJObject.Property("USER_ID") == null)
|
||||
{
|
||||
returnJObject.Add("USER_ID", userRow["USER_ID"].ToStringEx());
|
||||
returnJObject.Add("USER_NAME", userRow["USER_NAME"].ToStringEx());
|
||||
returnJObject.Add("PR_PASSWORD", userRow["PR_PASSWORD"].ToStringEx());
|
||||
returnJObject.Add("FDELETED", userRow["FDELETED"].ToStringEx());
|
||||
returnJObject.Add("DBAias", dbAias);
|
||||
}
|
||||
if (userRow["FROLETYPE"].ToStringEx().Equals("0"))
|
||||
{
|
||||
fRoleType = "0";
|
||||
}
|
||||
}
|
||||
returnJObject.Add("FROLETYPE", fRoleType);
|
||||
DBContext.Database.SqlNonQueryAsync(sql, parameter);
|
||||
return returnJObject;
|
||||
}
|
||||
|
||||
private LicenseInfo GetLicense()
|
||||
{
|
||||
LicenseInfo myInfo = new LicenseInfo() { SerialNumber = "" };
|
||||
try
|
||||
{
|
||||
//强制执行抓机器码
|
||||
string Maction = "";//SecurityManage.GetLocalCustomerKey(wProductCode);
|
||||
List<LicenseInfo> myList = SecurityManage.GetLocalSystemLicenseInfo(Maction);
|
||||
foreach (LicenseInfo subinfo in myList)
|
||||
{
|
||||
//如果产品及版本有注册,那么就看使用日期是否已经有到
|
||||
subinfo.SerialDate = DateTime.Now;
|
||||
return subinfo;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
return myInfo;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
using System.Threading.Tasks;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.Assets.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.Assets.Model;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.Assets
|
||||
{
|
||||
[Authorize]
|
||||
public class AssetInventoryController : BaseApiController<AssetInventoryController>
|
||||
{
|
||||
private readonly IAssetInventoryService service;
|
||||
public AssetInventoryController(IMapper mapper, ILogger<AssetInventoryController> logger, IAssetInventoryService spotcheckService)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
service = spotcheckService;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取盘点方案信息及暂存信息
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<GetAssetInventory>>> GetAssetInventory(Inventory SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.GetAssetInventory(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取资产信息
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<GetAssets>>> GetAssets(Inventory SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.GetAssets(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 资产盘点暂存
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<string>> TemporaryStorage([FromBody] Temporary SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.TemporaryStorage(SData);
|
||||
}, SData);
|
||||
}
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Opsoft.NetCore.O3App.Domain.Models;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers
|
||||
{
|
||||
[EnableCors("any")]
|
||||
public class AuthenticationController : Controller
|
||||
{
|
||||
private readonly IAuthenticateService _authService;
|
||||
public AuthenticationController(IAuthenticateService authService)
|
||||
{
|
||||
this._authService = authService;
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpPost]
|
||||
public ActionResult RequestToken([FromBody] LoginRequest request)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest("Invalid Request");
|
||||
}
|
||||
string token;
|
||||
if (_authService.IsAuthenticated(request, out token))
|
||||
{
|
||||
return Ok(new { ErrCode = 0, Data = new {request.UserName, request.errtype, token } });
|
||||
}
|
||||
else
|
||||
{
|
||||
return Ok(new { ErrCode = 0, Data = new { request.UserName, request.errtype, token = "" } });
|
||||
}
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpPost]
|
||||
public ActionResult FaceRequestToken([FromBody] LoginRequest request)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest("Invalid Request");
|
||||
}
|
||||
string token;
|
||||
if (_authService.IsAuthenticated(request, out token))
|
||||
{
|
||||
return Ok(new { ErrCode = 0, Data = new { request.UserName, request.errtype, token } });
|
||||
}
|
||||
else
|
||||
{
|
||||
return Ok(new { ErrCode = 0, Data = new { request.UserName, request.errtype, token = "" } });
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult Index()
|
||||
{
|
||||
return Ok("AuthenticationController");
|
||||
}
|
||||
}
|
||||
}
|
||||
+1702
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,33 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.BaseData.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.BaseData.Model;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.BaseData
|
||||
{
|
||||
[Authorize]
|
||||
public class AssetinventoryController : BaseApiController<AssetinventoryController>
|
||||
{
|
||||
private readonly IAssetinventoryServices _service;
|
||||
public AssetinventoryController(IMapper mapper, ILogger<AssetinventoryController> logger, IAssetinventoryServices Service)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
_service = Service;
|
||||
}
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<IAS_ASSETSINVENTORY>>> GetAllAssetinventoryUnRead(int pageNum, int pageCount)
|
||||
{
|
||||
|
||||
var data = new { pageNum = pageNum, pageCount = pageCount };
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.GetAllAssetinventoryUnRead(data.ToJson());
|
||||
}, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.BaseData.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.BaseData.Model;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.BaseData
|
||||
{
|
||||
/// <summary>
|
||||
/// 系统配置数据
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
public class PersonalMessageController : BaseApiController<PersonalMessageController>
|
||||
{
|
||||
private readonly IPersonalMessageService _service;
|
||||
public PersonalMessageController(IMapper mapper, ILogger<PersonalMessageController> logger, IPersonalMessageService Service)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
_service = Service;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取当前登录用户的所有消息
|
||||
/// </summary>
|
||||
/// <param name="userId">
|
||||
/// <param name="pageNum"></param>
|
||||
/// <param name="pageCount"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<GetPersonalMessage>> GetAllPersonalMessage(string userId, int pageNum, int pageCount)
|
||||
{
|
||||
var data = new { userId= userId, pageNum = pageNum, pageCount = pageCount };
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.GetAllPersonalMessage(data.ToJson());
|
||||
}, data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新个人消息已读或者删除状态
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<GetPersonalMessage>> UpdatePersonalMessage([FromBody] UpdatePersonalMeaasge data)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.UpdatePersonalMessage(data);
|
||||
}, data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取个人未读的消息数量
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<BaseResponse<object>> GetCountUnReadPersonalMessage(string userId)
|
||||
{
|
||||
var data = new { userId = userId};
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.GetCountUnReadPersonalMessage(data.ToJson());
|
||||
}, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,218 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Opsoft.NetCore.O3App.Domain.Models;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.BaseData.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.BaseData.Model;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.IPadReport.Model;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.BaseData
|
||||
{
|
||||
/// <summary>
|
||||
/// 系统配置数据
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
public class SysConfigDataController : BaseApiController<SysConfigDataController>
|
||||
{
|
||||
private readonly ISysConfigDataService _service;
|
||||
public SysConfigDataController(IMapper mapper, ILogger<SysConfigDataController> logger, ISysConfigDataService Service)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
_service = Service;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取APK版本
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<TBdAppversion>> GetLatestAppInfo(int appType)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.GetLatestAppInfo(appType);
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取轮播图信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<BaseResponse<List<T_BAS_IMAGEPAGEVIEW>>> CarouselMap()
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.GetAllImagePageView();
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取仓库信息
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<T_BD_STOCK>>> SearchStock([FromQuery] Dictionary<string, string> paramaters)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.GetAllStock(input);
|
||||
}, paramaters);
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取仓位信息
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<BD_FLEXVALUES>>> SearchStockPlace([FromQuery] Dictionary<string, string> paramaters)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.GetAllFlexValues(input);
|
||||
}, paramaters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询个人日志信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<T_BD_PERSONDIARY>>> PersonDiary([FromQuery] Dictionary<string, string> paramaters)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.GetAllPersonDiary(input);
|
||||
}, paramaters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑个人日志信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<List<T_BD_PERSONDIARY>>> EditPersonDiary([FromBody] T_BD_PERSONDIARY diary)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.UpdatePersonDiary(input);
|
||||
}, diary);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除个人日志信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<string>> DelPersonDiary([FromQuery] string interId)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.DeletePersonDiary(input);
|
||||
}, interId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询个人事项
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<T_BD_PERSONALMATTERS>>> PersonalMatters()
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.GetAllPersonalMatters();
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询个人事项返回
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<List<T_BD_PERSONALMATTERS>>> PersonalMatter([FromBody] JObject data)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.UpdatePersonalMatters(data);
|
||||
}, data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取系统使用的基本信息
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<Basic>>> QueryResource([FromQuery] Dictionary<string, string> paramaters)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.QueryALLResource(input);
|
||||
}, paramaters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户信息
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<LoginRequest>> QueryLoginUserInfo(string useNO)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.QueryLoginUserInfo(input);
|
||||
}, useNO);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 上传图片
|
||||
/// </summary>
|
||||
/// <param name="file"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<string>> Upload(IFormFile file)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.Upload(input);
|
||||
}, file);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取系统打印参数
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<SysPrintData>>> SysPrintIteam(SysPrintIteam SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.SysPrintIteam(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取全部蓝牙打印机设置
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<Basic>>> QueryBluetooth(SysPrintIteam SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.SysPrintBluetooth(SData);
|
||||
}, LoginInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.BaseData.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.BaseData.Model;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.BaseData
|
||||
{
|
||||
[Authorize]
|
||||
public class SysMessageController : BaseApiController<SysMessageController>
|
||||
{
|
||||
private readonly IUserMessageService _service;
|
||||
public SysMessageController(IMapper mapper, ILogger<SysMessageController> logger, IUserMessageService Service)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
_service = Service;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有消息
|
||||
/// </summary>
|
||||
/// <param name="pageNum"></param>
|
||||
/// <param name="pageCount"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<UserMessages>>> GetAllUserMessage(int pageNum, int pageCount)
|
||||
{
|
||||
var data = new { pageNum= pageNum, pageCount = pageCount };
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.GetAllUserMessageRead(data.ToJson());
|
||||
}, data);
|
||||
}
|
||||
|
||||
|
||||
/// 获取未读信息数量
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<GetAllUserMessageUnReadCountDto>>> GetAllUserMessageUnReadCount()
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.GetAllUserMessageUnReadCount();
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 已读消息返回
|
||||
/// </summary>
|
||||
/// <param name="pageNum"></param>
|
||||
/// <param name="pageCount"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<BaseResponse<List<UserMessages>>> GetAllUserMessageRead(int pageNum, int pageCount)
|
||||
{
|
||||
var data = new { pageNum = pageNum, pageCount = pageCount };
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.GetAllUserMessageRead(data.ToJson());
|
||||
}, data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 消息标记为已读
|
||||
/// </summary>
|
||||
/// <param name="fInterid">前端穿内码字段</param>
|
||||
/// <returns></returns>
|
||||
public async Task<BaseResponse<List<UpdateMessageStatus>>> UpdateMessageStatus(string fInterid)
|
||||
{
|
||||
var data = new { fInterid=fInterid};
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.UpdateMessageStatus(data.ToJson());
|
||||
}, data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新闻列表显示方法
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<SYS_NEWS>>> GetAllNewsBulletinUnRead(int pageNum, int pageCount)
|
||||
{
|
||||
|
||||
var data = new { pageNum = pageNum, pageCount = pageCount };
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.GetAllNewsBulletinUnRead(data.ToJson());
|
||||
}, data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取新闻公告
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<EnAnnou>>> Notice(GetNotice SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.Notice(SData);
|
||||
}, SData);
|
||||
}
|
||||
}
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Opsoft.NetCore.O3App.Domain.Models.ESOP;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.ESOP.ESOP;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.ESOP.IServices;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.ESOP
|
||||
{
|
||||
/// <summary>
|
||||
/// ESOP
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
public class ESOPController : BaseApiController<ESOPController>
|
||||
{
|
||||
//服务层变量
|
||||
private readonly IESOPService service;
|
||||
public ESOPController(IMapper mapper, ILogger<ESOPController> logger, IESOPService service)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取文件信息
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> GetAnnounceAndFile([FromBody] ESOPRequest request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.GetAnnounceAndFile(input);
|
||||
}, request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据工位编码获取资源以及工序识别码信息
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<ESopStationResponse>> GetSourceAndCode(string stationCode)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.GetSourceAndCode(input);
|
||||
}, stationCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
+185
@@ -0,0 +1,185 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Opsoft.NetCore.O3App.Domain;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.Energy.IServices;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.Energy
|
||||
{
|
||||
public class ElectricityController : BaseApiController<ElectricityController>
|
||||
{
|
||||
private readonly IElectricityService _ElectricityService;
|
||||
public ElectricityController(IMapper mapper, ILogger<ElectricityController> logger, IElectricityService ElectricityService)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
_ElectricityService = ElectricityService;
|
||||
}
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<object>> getTreeList(int eType)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _ElectricityService.getTreeList(eType);
|
||||
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<object>> getElectricityOverView([FromQuery] string id)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _ElectricityService.getElectricityOverView(id);
|
||||
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<object>> getUnitByPointNbr([FromQuery] string PointNbr) //
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _ElectricityService.getUnitByPointNbr(PointNbr);
|
||||
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
|
||||
}
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<object>> getWaterOverView([FromQuery] string id)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _ElectricityService.getWaterOverView(id);
|
||||
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<object>> getGasOverView([FromQuery] string id)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _ElectricityService.getGasOverView(id);
|
||||
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<object>> getElectList([FromQuery] string id, [FromQuery] string startdate, [FromQuery] string enddate )
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _ElectricityService.getElectList(id, startdate, enddate);
|
||||
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<object>> getHistoryData([FromQuery] string boxNbr)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _ElectricityService.getHistoryData(boxNbr);
|
||||
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<object>> getWaterList([FromQuery] string id, [FromQuery] string startdate, [FromQuery] string enddate)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _ElectricityService.getWaterList(id, startdate, enddate);
|
||||
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<object>> getGasList([FromQuery] string id, [FromQuery] string startdate, [FromQuery] string enddate)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _ElectricityService.getGasList(id, startdate, enddate);
|
||||
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.Equipment.IServices;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.Equipment.Model;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.Equipment
|
||||
{
|
||||
[Authorize]
|
||||
public class RepairOrederController : BaseApiController<RepairOrederController>
|
||||
{
|
||||
private readonly IRepairOrderService service;
|
||||
public RepairOrederController(IMapper mapper, ILogger<RepairOrederController> logger, IRepairOrderService spotcheckService)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
service = spotcheckService;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取设备信息、故障类别、故障程度、设备部位、设备供应商、备件出入库类型(basicType:1=维修,2=保养)
|
||||
/// </summary>
|
||||
/// <param name="data" basicType获取列表类型></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<GetEquipmentBasic>>> GetEquipmentBasicData(string basicType, string fNO, string fName, string type )
|
||||
{
|
||||
var data = new { basicType, fNO, fName,type };
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.GetEquipmentBasicData(data.ToJson());
|
||||
}, data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取维修,保养工单列表(basicType:1=维修,2=保养)(statusType:1=未验收,2=已验收)
|
||||
/// </summary>
|
||||
/// <param name="data" pageIndex页数 pageSize每页显示数量 basicType获取列表类型></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<GetRpairOrder>>> RepairOrder(string PageNumber,string BarNumber,string basicType, string fNO,string statusType)
|
||||
{
|
||||
var data = new { PageNumber, BarNumber, basicType, fNO, statusType };
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.RepairOrder(data.ToJson());
|
||||
}, data);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 按单据编号获取维修,保养工单详情(basicType:1=维修,2=保养)
|
||||
/// </summary>
|
||||
/// <param name="data"basicType获取列表类型></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<GetMaintenanceOrder>>> MaintenanceOrder(string basicType, string billNO)
|
||||
{
|
||||
var data = new { basicType, billNO };
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.MaintenanceOrder(data.ToJson());
|
||||
}, data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按单据表体内码获取维修,保养工单部位信息(basicType:1=维修,2=保养)
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<Dictionary<string, object>>> MaintenanceOrderEntry(string basicType, string detailID)
|
||||
{
|
||||
var data = new { basicType, detailID };
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.MaintenanceOrderEntry(data.ToJson());
|
||||
}, data);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 修改维修,保养工单部位信息(完工提交)
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<string>> MaintenanceReport([FromBody] UpdateMaintenanceReport SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.MaintenanceReport(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改维修,保养工单部位信息(验收提交)
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<string>> PartReportAcceptance([FromBody] UpdatePartReportAcceptance SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.PartReportAcceptance(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 修改维修,保养工单信息(验收提交)
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<string>> OrderReportAcceptance([FromBody] UpdatePartReportAcceptance SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.OrderReportAcceptance(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 按单据表体内码删除工单部位信息
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<string>> DelBodyAndSparePart([FromBody] DeleteBill SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.DelBodyAndSparePart(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 按内码删除维修、保养工单
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<string>> DelOrderService([FromBody] DeleteBill SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.DelOrderService(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 按内码删除维修、保养工单
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<string>> CreateOrder([FromBody] CreateOrder SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.CreateOrder(SData);
|
||||
}, SData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.Equipment.IServices;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.Equipment.Model;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.Equipment
|
||||
{
|
||||
|
||||
[Authorize]
|
||||
/// <summary>
|
||||
/// 设备管理系统——备件
|
||||
/// </summary>
|
||||
public class SparePartController : BaseApiController<SparePartController>
|
||||
{
|
||||
private readonly ISpareParService service;
|
||||
public SparePartController(IMapper mapper, ILogger<SparePartController> logger, ISpareParService sparepartService)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
service = sparepartService;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取备件列表
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<GetSparePart>>> GetSparePart(string basicType, string equipID, string sparePartName)
|
||||
{
|
||||
var data = new { basicType, equipID, sparePartName};
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.GetSparePart(data.ToJson());
|
||||
}, data);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 备件入库提交
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<string>> SparePartStorage([FromBody] SparePartStorage SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.SparePartStorage(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 备件盘点提交
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<string>> SparePartInventory([FromBody] SparePartStorage SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.SparePartInventory(SData);
|
||||
}, SData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.Equipment.IServices;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.Equipment.Model;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.Equipment
|
||||
{
|
||||
[Authorize]
|
||||
public class SpotCheckController : BaseApiController<SpotCheckController>
|
||||
{
|
||||
private readonly IDspotcheckService service;
|
||||
public SpotCheckController(IMapper mapper, ILogger<SpotCheckController> logger, IDspotcheckService spotcheckService)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
service = spotcheckService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设备点检列表信息(FFTYYPE:1=未执行,2=已完成,3=已逾期)
|
||||
/// </summary>
|
||||
/// <param name="data" pageIndex页数 pageSize每页显示数量 searchType获取列表类型></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<GETSPOTCHECK>>> SpotTaskSearch(string pageIndex, string pageSize, string searchType,string type,string searchData)
|
||||
{
|
||||
var data = new {pageIndex, pageSize, searchType,type,searchData};
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.SpotTaskSearch(data.ToJson());
|
||||
}, data);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 设备点检表体检验明细
|
||||
/// </summary>
|
||||
/// <param name="data" finterid点击的点检任务内码></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<GETSPOTCHECK>>> SpotTaskSearchDetail(string finterid)
|
||||
{
|
||||
var data = new {finterid};
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.SpotTaskSearchDetail(data.ToJson());
|
||||
}, data);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 点检任务提交
|
||||
/// </summary>
|
||||
/// <param name="SData" IsCreateRepair是否产生维修单 RepairNote情况简述 SData更新的检验项目></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<Dictionary<string, object>>> SpotTaskSubmit([FromBody] SpotCheckType SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.SpotTaskSubmit(input);
|
||||
}, SData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
using System.Threading.Tasks;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.IPadReport.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.IPadReport.Model;
|
||||
using System.Collections.Generic;
|
||||
using Opsoft.NetCore.O3App.WebApi.Filters;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.IPadReport
|
||||
{
|
||||
[Authorize]
|
||||
public class InspectionController : BaseApiController<InspectionController>
|
||||
{
|
||||
private readonly IInspectionService service;
|
||||
public InspectionController(IMapper mapper, ILogger<InspectionController> logger, IInspectionService spotcheckService)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
service = spotcheckService;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 工序首检列表接口(状态查询:已完成、未完成)
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<object>>> GetFirstInspection(GetFirstInspection SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.GetFirstInspection(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工序首检列表接口(状态查询:已完成、未完成)
|
||||
/// +带数据数量 by liujie
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<object>> GetFirstInspections(GetFirstInspection SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.GetFirstInspections(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 首检数据保存
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<string>> SaveFirstInspection([FromBody] SaveFirstInspection SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.SaveFirstInspection(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 工序巡检列表接口(状态查询:已完成、未完成)
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<object>>> GetProcessInspection(GetFirstInspection SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.GetProcessInspection(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工序巡检列表接口(状态查询:已完成、未完成)
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<object>> GetProcessInspections(GetFirstInspection SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.GetProcessInspections(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 巡检条码扫入验证获取数据
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<object>> ScanProcessCode(ScanProcessCode SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.ScanProcessCode(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 巡检数据保存
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Idempotent]
|
||||
public async Task<BaseResponse<object>> SaveProcessInspection([FromBody] SaveProcessInspection SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.SaveProcessInspection(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 文档查看功能
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<object>> GetAssignDocument(GetAssignDocument SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.GetAssignDocument(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 下载作业文档并查看
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<object>> DownAssignDocument(DownAssignDocument SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.DownAssignDocument(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 安灯异常呼叫列表接口
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<object>> GetAbnormalCall(GetAbnormalCall SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.GetAbnormalCall(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 安灯异常呼叫列表接口
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<object>> GetAbnormalCalls(GetAbnormalCall SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.GetAbnormalCalls(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 安灯异常呼叫处理
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<string>> DoAbnormalCall([FromBody]DoAbnormalCall SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.DoAbnormalCall(SData);
|
||||
}, SData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.IPadReport.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.IPadReport.Model;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.IPadReport
|
||||
{
|
||||
/// <summary>
|
||||
/// 汇报信息查询控制层
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
public class ReportInfoLoadController : BaseApiController<ReportInfoLoadController>
|
||||
{
|
||||
//服务层变量
|
||||
private readonly IReportInfoLoadService service;
|
||||
public ReportInfoLoadController(IMapper mapper, ILogger<ReportInfoLoadController> logger, IReportInfoLoadService reportInfoLoadService)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
service = reportInfoLoadService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按工作中心代码获取资源信息
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<Basic>>> QueryResourceByWorkCenter([FromQuery] Dictionary<string, string> paramaters)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.QueryResourceByWorkCenter(input);
|
||||
}, paramaters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 依据班组=>员工信息/员工信息=>班组
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<Basic>>> GetTeamFromEmp([FromQuery] Dictionary<string, string> paramaters)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.GetTeamEmpTwo(input);
|
||||
}, paramaters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 历史汇报信息加载
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<ProductionAct>>> ReloadHisReport([FromQuery] Dictionary<string, string> paramaters)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.ReloadReportHisReport(input);
|
||||
}, paramaters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 历史汇报信息加载
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<object>> ReloadHisReports([FromQuery] Dictionary<string, string> paramaters)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.ReloadReportHisReports(input);
|
||||
}, paramaters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 单资源汇报信息加载
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<ProductionAct>> ReloadSingeleResource([FromQuery] Dictionary<string, string> paramaters)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.ReloadSingeleResource(input);
|
||||
}, paramaters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 单资源汇报信息加载(Web)
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<ProductionAct>> ReloadSingeleResourceWeb([FromQuery] Dictionary<string, string> paramaters)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.ReloadSingeleResourceWeb(input);
|
||||
}, paramaters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 提交资源信息
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<List<ProductionAct>>> SubmitResouces([FromBody] JObject paramaters)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.SubmitResouces(input);
|
||||
}, paramaters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除资源信息
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<List<string>>> DeleteResources([FromBody] JObject paramaters)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.DeleteResources(input);
|
||||
}, paramaters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询条码类型及信息
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<Dictionary<string, object>>> GetBarcodeInfo([FromQuery] Dictionary<string, string> paramaters)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.GetBarcodeInfo(input);
|
||||
}, paramaters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询SN汇报扫描条码信息
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<bool>> CheckSNReportBarcode([FromQuery] Dictionary<string, string> paramaters)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.CheckSNReportBarcode(input);
|
||||
}, paramaters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询周转码汇报数量
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<decimal>> GetConutByTCCode([FromQuery] Dictionary<string, string> paramaters)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.GetConutByTCCode(input);
|
||||
}, paramaters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重置汇报系统参数
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<Dictionary<string, object>>> ReLoadReportSystemParam()
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.ReLoadReportSystemParam();
|
||||
}, string.Empty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取生产信息
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<object>> GetReportMessage([FromQuery] Dictionary<string, string> paramaters)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.GetReportMessage(input);
|
||||
}, paramaters);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.IPadReport.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.IPadReport.Model;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.IPadReport
|
||||
{
|
||||
/// <summary>
|
||||
/// 汇报信息操作控制层
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
public class ReportProduceController : BaseApiController<ReportInfoLoadController>
|
||||
{
|
||||
//服务层变量
|
||||
private readonly IReportProduceService _service;
|
||||
public ReportProduceController(IMapper mapper, ILogger<ReportInfoLoadController> logger, IReportProduceService reportProduceService)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
_service = reportProduceService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 员工上岗/下岗
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<ProductionAct>> SubmitEmployee([FromBody] JObject paramaters)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.SubmitEmployee(input);
|
||||
}, paramaters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 员工上岗/下岗
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<string>> SubmitEmployeeWeb([FromBody] JObject paramaters)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.SubmitEmployeeWeb(input);
|
||||
}, paramaters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绑定/解绑设备
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<ProductionAct>> SubmitEmquipment([FromBody] JObject paramaters)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.SubmitEmquipment(input);
|
||||
}, paramaters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工序开工
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<ProductionAct>> ProcessStart([FromBody] JObject paramaters)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.ProcessStartServices(input);
|
||||
|
||||
}, paramaters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工序开工(Web)
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<string>> ProcessStartWeb([FromBody] JObject paramaters)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.ProcessStartServicesWeb(input);
|
||||
}, paramaters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工序上下模
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<ProductionAct>> ProcessInputMould([FromBody] JObject paramaters)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.ProcessInputMould(input);
|
||||
}, paramaters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工序投料
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<ProductionAct>> ProcessInputMaterial([FromBody] JObject paramaters)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.ProcessInputMaterialServices(input);
|
||||
}, paramaters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 安灯呼叫
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<ProductionAct>> ProcessWarningCall([FromBody] JObject paramaters)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.ProcessWarningCallServices(input);
|
||||
}, paramaters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 安灯异常呼叫处理(Web)
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<string>> DoAbnormalCallWeb([FromBody] DoAbnormalCall SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.DoAbnormalCallWeb(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工序汇报前验证检验状态
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<string>> CheckInspectionStatus([FromQuery] Dictionary<string, string> paramaters)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.CheckInspectionStatusServices(input);
|
||||
}, paramaters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工序换型,工序调机,工序暂停
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<ProductionAct>> ProcessChangeState([FromBody] JObject paramaters)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.ProcessChangeStateServices(input);
|
||||
}, paramaters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 完工注销
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<ProductionAct>> ProcessAllCancel([FromBody] JObject paramaters)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.ProcessAllCancelServices(input);
|
||||
}, paramaters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 完工注销(Web)
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<string>> ProcessAllCancelWeb([FromBody] JObject paramaters)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.ProcessAllCancelServicesWeb(input);
|
||||
}, paramaters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工序汇报
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<ProductionAct>> ProcessReport([FromBody] JObject paramaters)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _service.ProcessReportServices(input);
|
||||
}, paramaters);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public BaseResponse<string> GetComputerId()
|
||||
{
|
||||
return new BaseResponse<string>() { Data = Guid.NewGuid().ToString(), Message = "", Success = true, StatusCode = 200 };
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Opsoft.NetCore.O3App.Domain;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.MES.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.MES.Model;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.Model;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Filters;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.MES
|
||||
{
|
||||
/// <summary>
|
||||
/// 质检
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
public class QualityCheckController : BaseApiController<QualityCheckController>
|
||||
{
|
||||
private readonly IQualityCheckService service;
|
||||
public QualityCheckController(IMapper mapper, ILogger<QualityCheckController> logger, IQualityCheckService Service)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
service = Service;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询质检单
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> SearchQualityBill([FromBody] JObject request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.SearchQualityBill(input);
|
||||
}, request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得质检单信息
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> GetQualityBill([FromBody] JObject request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.GetQualityBill(input);
|
||||
}, request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存质检单信息
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> SaveQualityBill([FromBody] T_SFC_QUALITY request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.SaveQualityBill(input);
|
||||
}, request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存质检单信息
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> QualityBillInspectionCompleted([FromBody] T_SFC_QUALITY request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.QualityBillInspectionCompleted(input);
|
||||
}, request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存质检单信息
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> OpenWin([FromBody] JObject request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.OpenWin(input);
|
||||
}, request);
|
||||
}
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.Public.IServices;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers
|
||||
{
|
||||
// <summary>
|
||||
/// 公共控制
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
public class PublicController : BaseApiController<PublicController>
|
||||
{
|
||||
private readonly IPublicService service;
|
||||
public PublicController(IMapper mapper, ILogger<PublicController> logger, IPublicService Service)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
service = Service;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 保存质检单信息
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> OpenWin([FromBody] JObject request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.OpenWin(input);
|
||||
}, request);
|
||||
}
|
||||
}
|
||||
}
|
||||
+726
@@ -0,0 +1,726 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Opsoft.Data;
|
||||
using Opsoft.Data.Model;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Filters;
|
||||
using Opsoft.NetCore.O3App.WebApi.Model;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers
|
||||
{
|
||||
[EnableCors("any")]
|
||||
public partial class ServiceController : BaseApiController<ServiceController>
|
||||
{
|
||||
private static List<string> _testList = new List<string>();
|
||||
|
||||
private readonly IUserService userService;
|
||||
public ServiceController(
|
||||
IMapper mapper,
|
||||
ILogger<ServiceController> logger,
|
||||
IUserService service)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
userService = service;
|
||||
}
|
||||
[HttpPost]
|
||||
public IActionResult version_update([FromBody] CVersionIno request)
|
||||
{
|
||||
try
|
||||
{
|
||||
//读取最新版本
|
||||
JsonFileHelper JHelper = new JsonFileHelper("LastAppVersionInfo");
|
||||
LastVersion myVer = JHelper.Read<LastVersion>("LastVersion");
|
||||
if (request.version.CompareTo(myVer.version) < 0)
|
||||
{
|
||||
return Ok(new
|
||||
{
|
||||
isUpdate = true,
|
||||
downloadIOSUrl = myVer.downloadIOSUrl,
|
||||
downloadAndroidUrl = myVer.downloadAndroidUrl
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
return Ok(new
|
||||
{
|
||||
isUpdate = false,
|
||||
downloadIOSUrl = "",
|
||||
downloadAndroidUrl = "",
|
||||
});
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return Ok(new
|
||||
{
|
||||
isUpdate = false,
|
||||
downloadIOSUrl = "",
|
||||
downloadAndroidUrl = "",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public IActionResult GetDBInfo()
|
||||
{
|
||||
try
|
||||
{
|
||||
List<CDBInfo> dbInfo = DBConnectionInfo.GetDBInfo();
|
||||
return Ok(new { ErrCode = 0, Data = dbInfo });
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
return Ok(new { ErrCode = 400, Data = ex.Message });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按人员获取组织
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Authorize]
|
||||
public IActionResult GetUserInfo()
|
||||
{
|
||||
try
|
||||
{
|
||||
var user = userService.GetUser(LoginInfo.UserID, LoginInfo.DBAias);
|
||||
if (user == null)
|
||||
{
|
||||
throw new ApplicationException($"cannot find current user with id : {LoginInfo.UserID}");
|
||||
}
|
||||
return Ok(new { ErrCode = 0, Data = user });
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
return Ok(new { ErrCode = 400, Data = ex.Message });
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Authorize]
|
||||
public IActionResult GetNews()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (APPServerContext DBContext = new APPServerContext(LoginInfo.DBAias, LoginInfo.UserID))
|
||||
{
|
||||
List<SYS_ENANNOU> myArr = DBContext.SYS_ENANNOUS.Where(o => o.FSTATUS == 40).OrderByDescending(o => o.FCHECKDATE).Take(5).ToList();
|
||||
|
||||
return Ok(new { ErrCode = 0, Data = myArr });
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
return Ok(new
|
||||
{
|
||||
ErrCode = 400,
|
||||
Data = ex.Message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#region ============处理我的收藏 =========================================
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Authorize]
|
||||
public IActionResult GetAllMenu([FromBody] JObject request)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (APPServerContext DBContext = new APPServerContext(LoginInfo.DBAias, LoginInfo.UserID))
|
||||
{
|
||||
string wUserID = LoginInfo.UserID;
|
||||
// 第一步,得到此用户的所有功能权限
|
||||
List<PermissionInfo> AllPermissionInfo = this.GetPermissionsAll(wUserID, DBContext);
|
||||
//1=WinForm;2=WebForm;3=App;4=TV;5=Win+Web
|
||||
string FieldNmae = "[KEY]";
|
||||
if (DBContext.IsOracle)
|
||||
FieldNmae = "KEY";
|
||||
string sqlQuery =
|
||||
" select T2.FNUMBER as " + FieldNmae + ",T2.FNAME as NAME,T2.FINTERID as ID, " + "\r\n" +
|
||||
" T3.FWEBBILL, T2.FTYPE AS PrgType " + "\r\n" +
|
||||
" from SYS_PRGWORKBENCH T1 " + "\r\n" +
|
||||
" JOIN SYS_PROGRAMCYCLE T2 on T1.FID = T2.FINTERID " + "\r\n" +
|
||||
" JOIN SYS_BILLTEMPLATE T3 on T2.FNUMBER = T3.FNUMBER " + "\r\n" +
|
||||
" where T2.FPRTYPE in ( '3') and T1.USER_ID=" + DBContext.GetDBParName("@PA1") + " " + "\r\n";
|
||||
// 测试先用 '1' 后面用 3
|
||||
sqlQuery +=
|
||||
" and ( T2.SHOW_YN='Y' ) " + "\r\n ";
|
||||
|
||||
sqlQuery +=
|
||||
" Order by T2.RO_CSEQ ";
|
||||
|
||||
// 所有我的收藏
|
||||
List<ODKMenu> MainMenu = DBContext.Database.SqlQuery<ODKMenu>(
|
||||
sqlQuery,
|
||||
DBContext.CreateParameter("@PA1", wUserID));
|
||||
// 取得有权限的我的收藏的资料
|
||||
List<ODKMenu> FavoritesList = new List<ODKMenu>();
|
||||
foreach (ODKMenu sub in MainMenu)
|
||||
{
|
||||
//判断循环,模组,程式都有权限,才可以有限权
|
||||
if (AllPermissionInfo.Any(o => o.Code == sub.ID.ToUpper() && o.HasPermission && o.Type == "Program"))
|
||||
{
|
||||
FavoritesList.Add(sub);
|
||||
}
|
||||
}
|
||||
// 所有菜单
|
||||
List<string> fPRTypes = new List<string>();
|
||||
if (request!=null&&request["fPRTypes"] != null)
|
||||
{
|
||||
foreach (JToken token in request["fPRTypes"])
|
||||
{
|
||||
fPRTypes.Add(token.ToStringEx());
|
||||
}
|
||||
}
|
||||
MainMenu = this.GetSystemMenu(DBContext, fPRTypes);
|
||||
|
||||
List<ODKMenu> MainMenuList = GetMenuWithPermission(MainMenu, AllPermissionInfo);
|
||||
|
||||
return Ok(
|
||||
new
|
||||
{
|
||||
ErrCode = 0,
|
||||
Data = new { Favorites = FavoritesList, MainMenu = MainMenuList }
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
return Ok(new
|
||||
{
|
||||
ErrCode = 400,
|
||||
Data = ex.Message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按账套信息获取组织
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public IActionResult GetSysOrgForDB([FromBody] string DBAias)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (APPServerContext DBContext = new APPServerContext(DBAias, ""))
|
||||
{
|
||||
var mArr = DBContext.SYS_ORGSTRUCTURE.Select(o => new
|
||||
{
|
||||
o.FINTERID,
|
||||
o.FNUMBER,
|
||||
o.FNAME
|
||||
}).ToList();
|
||||
return Ok(new { ErrCode = 0, Data = mArr });
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
return Ok(new { ErrCode = 400, Data = ex.Message });
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按人员获取组织
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Authorize]
|
||||
public IActionResult GetSysOrgForUser()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (APPServerContext DBContext = new APPServerContext(LoginInfo.DBAias, LoginInfo.UserID))
|
||||
{
|
||||
var mArr = DBContext.Database.SqlQuery(@$" SELECT
|
||||
S2.FINTERID
|
||||
,S2.FNUMBER
|
||||
,S2.FNAME
|
||||
FROM SYS_USERORG S
|
||||
LEFT JOIN SYS_ORGSTRUCTURE S2 ON S2.FINTERID=S.FORGID
|
||||
WHERE S.USER_ID='{LoginInfo.UserID}'
|
||||
ORDER BY S2.FNUMBER");
|
||||
return Ok(new { ErrCode = 0, Data = mArr });
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
return Ok(new { ErrCode = 400, Data = ex.Message });
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询全部组织
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Authorize]
|
||||
public IActionResult GetSysOrg()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (APPServerContext DBContext = new APPServerContext(LoginInfo.DBAias, LoginInfo.UserID))
|
||||
{
|
||||
var mArr = DBContext.SYS_ORGSTRUCTURE.Select(o => new
|
||||
{
|
||||
o.FINTERID,
|
||||
o.FNUMBER,
|
||||
o.FNAME
|
||||
}).ToList();
|
||||
return Ok(new { ErrCode = 0, Data = mArr });
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
return Ok(new { ErrCode = 400, Data = ex.Message });
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据权限取得菜单,且只返回两层菜单
|
||||
/// </summary>
|
||||
/// <param name="MainMenu"></param>
|
||||
/// <param name="AllPermissionInfo"></param>
|
||||
/// <returns></returns>
|
||||
private List<ODKMenu> GetMenuWithPermission(List<ODKMenu> MainMenu, List<PermissionInfo> AllPermissionInfo)
|
||||
{
|
||||
List<ODKMenu> MainMenuList = new List<ODKMenu>();
|
||||
for (int i = 0; i < MainMenu.Count; i++)
|
||||
{
|
||||
ODKMenu CYMenu = MainMenu[i].Copy();
|
||||
for (int i2 = 0; i2 < MainMenu[i].SubMenus.Count; i2++) //
|
||||
{
|
||||
ODKMenu sub2 = MainMenu[i].SubMenus[i2];
|
||||
if (AllPermissionInfo.Any(o => o.Code == sub2.ID.ToUpper() && o.HasPermission && o.Type.ToUpperEx() == "PROGRAM"))
|
||||
{
|
||||
CYMenu.SubMenus.Add(sub2.Copy());
|
||||
}
|
||||
}
|
||||
// 只增加最底层菜单,因为PDA 只考虑两阶菜单
|
||||
if (CYMenu.SubMenus.Count > 0)
|
||||
{
|
||||
MainMenuList.Add(CYMenu);
|
||||
}
|
||||
}
|
||||
return MainMenuList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Authorize]
|
||||
public IActionResult GetMainMenu()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (APPServerContext DBContext = new APPServerContext(LoginInfo.DBAias, LoginInfo.UserID))
|
||||
{
|
||||
string wUserID = LoginInfo.UserID;
|
||||
// 第一步,得到此用户的所有功能权限
|
||||
List<PermissionInfo> AllPermissionInfo = this.GetPermissionsAll(wUserID, DBContext);
|
||||
//1=WinForm;2=WebForm;3=App;4=TV;5=Win+Web
|
||||
// 所有菜单
|
||||
List<ODKMenu> MainMenu = this.GetSystemMenu(DBContext);
|
||||
|
||||
List<ODKMenu> MainMenuList = GetMenuWithPermission(MainMenu, AllPermissionInfo);
|
||||
return Ok(new { ErrCode = 0, Data = MainMenuList });
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
return Ok(new
|
||||
{
|
||||
ErrCode = 400,
|
||||
Data = ex.Message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Authorize]
|
||||
public IActionResult GetFavoritesMenu()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (APPServerContext DBContext = new APPServerContext(LoginInfo.DBAias, LoginInfo.UserID))
|
||||
{
|
||||
string wUserID = LoginInfo.UserID;
|
||||
// 第一步,得到此用户的所有功能权限
|
||||
List<PermissionInfo> AllPermissionInfo = this.GetPermissionsAll(wUserID, DBContext);
|
||||
//1=WinForm;2=WebForm;3=App;4=TV;5=Win+Web
|
||||
string FieldNmae = "[KEY]";
|
||||
if (DBContext.IsOracle)
|
||||
FieldNmae = "KEY";
|
||||
string sqlQuery =
|
||||
" select T2.FNUMBER as " + FieldNmae + ",T2.FNAME as NAME,T2.FINTERID as ID, " + "\r\n" +
|
||||
" T3.FWEBBILL, T2.FTYPE AS PrgType " + "\r\n" +
|
||||
" from SYS_PRGWORKBENCH T1 " + "\r\n" +
|
||||
" JOIN SYS_PROGRAMCYCLE T2 on T1.FID = T2.FINTERID " + "\r\n" +
|
||||
" JOIN SYS_BILLTEMPLATE T3 on T2.FNUMBER = T3.FNUMBER " + "\r\n" +
|
||||
" where T2.FPRTYPE in ( '3') and T1.USER_ID=" + DBContext.GetDBParName("@PA1") + " " + "\r\n";
|
||||
// 测试先用 '1' 后面用 3
|
||||
sqlQuery +=
|
||||
" and ( T2.SHOW_YN='Y' ) " + "\r\n ";
|
||||
|
||||
sqlQuery +=
|
||||
" Order by T2.RO_CSEQ ";
|
||||
|
||||
// 所有我的收藏
|
||||
List<ODKMenu> MainMenu = DBContext.Database.SqlQuery<ODKMenu>(
|
||||
sqlQuery,
|
||||
DBContext.CreateParameter("@PA1", wUserID));
|
||||
// 取得有权限的我的收藏的资料
|
||||
List<ODKMenu> FavoritesList = new List<ODKMenu>();
|
||||
foreach (ODKMenu sub in MainMenu)
|
||||
{
|
||||
//判断循环,模组,程式都有权限,才可以有限权
|
||||
if (AllPermissionInfo.Any(o => o.Code == sub.ID.ToUpper() && o.HasPermission && o.Type == "Program"))
|
||||
{
|
||||
FavoritesList.Add(sub);
|
||||
}
|
||||
}
|
||||
return Ok(new { ErrCode = 0, Data = FavoritesList });
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
return Ok(new
|
||||
{
|
||||
ErrCode = 400,
|
||||
Data = ex.Message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="UserID"></param>
|
||||
/// <returns></returns>
|
||||
private List<PermissionInfo> GetPermissionsAll(string UserID, APPServerContext DBContext)
|
||||
{
|
||||
List<PermissionInfo> mArr = new List<PermissionInfo>();
|
||||
string sqlQuery = "";
|
||||
byte[] PR_MAP1 = ConvertByte(new byte[] { 0x00 });
|
||||
|
||||
|
||||
#region =========== 程序权限 ======================================
|
||||
sqlQuery = "SELECT FNUMBER,FNAME,FINTERID FROM SYS_PROGRAMCYCLE";
|
||||
DataTable TT = DBContext.Database.SqlQuery(sqlQuery);
|
||||
foreach (DataRow reader in TT.Rows)
|
||||
{
|
||||
mArr.Add(new PermissionInfo()
|
||||
{
|
||||
Type = "Program",
|
||||
Key = reader["FNUMBER"].ToString().ToUpper(),
|
||||
Code = reader["FINTERID"].ToString().ToUpper(),
|
||||
Name = reader["FNAME"].ToString(),
|
||||
PrgKey = reader["FNUMBER"].ToString().ToUpper(),
|
||||
HasPermission = false,
|
||||
});
|
||||
}
|
||||
|
||||
sqlQuery =
|
||||
"SELECT UPPER(PRG_ID) AS PRG_ID FROM SYS_USERPERMISSION " +
|
||||
" WHERE FROLEID IN (SELECT FROLEID FROM SYS_USERROLERELATION WHERE UPPER(USER_ID) ='" + UserID.ToUpper() + "') AND PR_CODE='P' ";
|
||||
|
||||
//再来更新有没有权限
|
||||
TT = DBContext.Database.SqlQuery(sqlQuery);
|
||||
IEnumerable<string> PrgList = TT.AsEnumerable().Select(r => r["PRG_ID"].ToString()).ToList();
|
||||
string[] strArr = PrgList.ToArray();
|
||||
for (int i = 0; i < mArr.Count; i++)
|
||||
{
|
||||
if (mArr[i].Type != "Program")
|
||||
continue;
|
||||
if (strArr.Contains(mArr[i].Key))
|
||||
{
|
||||
mArr[i].HasPermission = true;
|
||||
}
|
||||
}
|
||||
#endregion =========== 程序权限 ======================================
|
||||
|
||||
return mArr;
|
||||
}
|
||||
|
||||
byte[] ConvertByte(byte[] bytes)
|
||||
{
|
||||
//if (bytes.Length >= 32) return bytes;
|
||||
byte[] tempByte = new byte[] {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //1
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //2
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //3
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //4
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //5
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //6
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //7
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //8
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //9
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //10
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //11
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //12
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
/*0x00, 0x00, //13
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //14
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //15
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //16
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //17
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //18
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //19
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //20
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //21
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //22
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //23
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //24
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //25
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
*/
|
||||
for (int i = 0; (i < tempByte.Length && i < bytes.Length); i++)
|
||||
{
|
||||
tempByte[i] = bytes[i];
|
||||
}
|
||||
return tempByte;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 只得到两阶菜单(带参数筛选)
|
||||
/// </summary>
|
||||
/// <param name="DBContext"></param>
|
||||
/// <returns></returns>
|
||||
private List<ODKMenu> GetSystemMenu(APPServerContext DBContext, List<string> fPRTypes = null)
|
||||
{
|
||||
string strWhere1 = "";
|
||||
//1=WinForm;2=WebForm;3=App;4=TV;5=Win+Web
|
||||
|
||||
if (fPRTypes ==null|| fPRTypes.Count <= 0)
|
||||
{
|
||||
strWhere1 = " where T1.FPRTYPE in ( '3') and T1.SHOW_YN='Y' ";//数据看板和其它界面显示在菜单上
|
||||
}
|
||||
else
|
||||
{
|
||||
strWhere1 = $" where T1.FPRTYPE in ({string.Join(",", fPRTypes.Select(o => "'"+o+"'"))}) and T1.SHOW_YN='Y' ";//数据看板和其它界面显示在菜单上
|
||||
}
|
||||
List<string> mArr = new List<string>();
|
||||
|
||||
mArr.Add(
|
||||
" select T1.*, " + "\r\n" +
|
||||
" case T1.FGNAME when N'' then T1.FNAME else T1.FGNAME end FGROUPNAME, " + "\r\n" +
|
||||
" T2.FTNAME, T2.FCNAME, T2.FENAME, " + "\r\n" +
|
||||
" T2.FASNAME, T2.FASBILLNAME, T2.FASLISTNAME, " + "\r\n" +
|
||||
" T2.FWEBBILL, T2.FWEBLIST " + "\r\n" +
|
||||
" from SYS_PROGRAMCYCLE T1 " + "\r\n" +
|
||||
" join SYS_BILLTEMPLATE T2 on T1.FNUMBER = T2.FNUMBER " + "\r\n" +
|
||||
strWhere1); //明细功能及分组
|
||||
|
||||
DataSet MainDataSet = DBContext.Database.SqlQuery(mArr);
|
||||
|
||||
List<ODKMenu> MainMenu = new List<ODKMenu>();
|
||||
string wName = "FNAME";
|
||||
// 主模块
|
||||
var Query = MainDataSet.Tables[0].AsEnumerable().GroupBy(o => new
|
||||
{
|
||||
KEY = o["FPARENT"].ToStringEx(),
|
||||
NAME = o["FPARENTNA"].ToStringEx(),
|
||||
SEQ = o["FPARENTSEQ"].ToStringEx(),
|
||||
}).OrderBy(p => p.Key.SEQ);
|
||||
foreach (var sub in Query)
|
||||
{
|
||||
//主模块
|
||||
ODKMenu Menu1 = new ODKMenu()
|
||||
{
|
||||
KEY = sub.Key.KEY,
|
||||
NAME = sub.Key.NAME,
|
||||
MenuType = "Rotate",
|
||||
PrgType = "NormalMenu",
|
||||
ID = sub.Key.KEY,
|
||||
FIMAGE = "",
|
||||
};
|
||||
foreach (DataRow SubRow in MainDataSet.Tables[0].AsEnumerable().Where(o =>
|
||||
o["FPARENT"].ToStringEx().Equals(sub.Key.KEY)).OrderBy(o => o["RO_CSEQ"].ToStringEx()))
|
||||
{
|
||||
string wFWEBBILL = SubRow["FWEBBILL"].ToStringEx(), wFWEBBILL1 = "";
|
||||
string wFWEBLIST = SubRow["FWEBLIST"].ToStringEx(), wFWEBLIST1 = "";
|
||||
//2021/09/23 陆磊,自定义看板,需通过单据URL这个字段获取全部轮播的看板编号,注释掉暂时无用的代码,
|
||||
//string[] arrURL = wFWEBBILL.Split(',');
|
||||
//if (arrURL.Length > 1)
|
||||
//{
|
||||
// wFWEBBILL = arrURL[0].Trim();
|
||||
// wFWEBBILL1 = arrURL[1].Trim();
|
||||
//}
|
||||
//arrURL = wFWEBLIST.Split(',');
|
||||
//if (arrURL.Length > 1)
|
||||
//{
|
||||
// wFWEBLIST = arrURL[0].Trim();
|
||||
// wFWEBLIST1 = arrURL[1].Trim();
|
||||
//}
|
||||
ODKMenu Menu4 = new ODKMenu()
|
||||
{
|
||||
KEY = SubRow["FNUMBER"].ToStringEx(),
|
||||
NAME = SubRow[wName].ToStringEx(),
|
||||
MenuType = "Program",
|
||||
FTYPE = SubRow["FTYPE"].ToStringEx(),
|
||||
PrgType = SubRow["FPRTYPE"].ToStringEx(),
|
||||
//FTYPE = SubRow2["FTYPE"].ToStringEx(),
|
||||
//FASNAME = SubRow2["FASNAME"].ToStringEx(),
|
||||
//FASBILLNAME = SubRow2["FASBILLNAME"].ToStringEx(),
|
||||
//FASLISTNAME = SubRow2["FASLISTNAME"].ToStringEx(),
|
||||
FWEBBILL = wFWEBBILL,
|
||||
//FWEBBILL1 = wFWEBBILL1,
|
||||
//FWEBLIST = wFWEBLIST,
|
||||
//FWEBLIST1 = wFWEBLIST1,
|
||||
ID = SubRow["FINTERID"].ToStringEx(),
|
||||
//FSHOWTYPE = SubRow2["FSHOWTYPE"].ToStringEx()
|
||||
};
|
||||
if (Menu4.KEY.Split('-')[0].ToUpper().Equals("AUTO"))//检测是否是自定义看板,如果是的话,从T_AUTOKB_HEAD获得缩略图的URL
|
||||
{
|
||||
DataTable autoKanBan = DBContext.Database.SqlQuery(string.Format("SELECT FTHUMBNAIL FROM T_AUTOKB_HEAD WHERE FBILLNO='{0}'", Menu4.KEY));
|
||||
if (autoKanBan != null && autoKanBan.Rows.Count > 0)
|
||||
Menu4.FIMAGE = autoKanBan.Rows[0]["FTHUMBNAIL"].ToStringEx();
|
||||
}
|
||||
//Menu4.ParentMenu = Menu3.KEY;
|
||||
Menu1.SubMenus.Add(Menu4);
|
||||
}
|
||||
if (Menu1.SubMenus.Count > 0)
|
||||
MainMenu.Add(Menu1);
|
||||
}
|
||||
return MainMenu;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Authorize]
|
||||
public IActionResult SetFavorites([FromBody] string ID)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (APPServerContext DBContext = new APPServerContext(LoginInfo.DBAias, LoginInfo.UserID))
|
||||
{
|
||||
string UserID = LoginInfo.UserID;
|
||||
try
|
||||
{
|
||||
bool IsAdd = true;
|
||||
sysPrgWorkbench IAPRecordSet = DBContext.SYS_PRGWORKBENCH.SingleOrDefault(o => o.USER_ID.Equals(UserID) && o.FID.Equals(ID));
|
||||
if (IAPRecordSet == null)
|
||||
{
|
||||
IAPRecordSet = new sysPrgWorkbench();
|
||||
IAPRecordSet.UID = Guid.NewGuid().ToString();
|
||||
IAPRecordSet.C_USER = UserID;
|
||||
IAPRecordSet.USER_ID = UserID;
|
||||
IAPRecordSet.M_USER = UserID;
|
||||
IAPRecordSet.FINTERID = IAPRecordSet.UID;
|
||||
IAPRecordSet.FID = ID;
|
||||
IAPRecordSet.FBILLNO = this.CreateBilllNO(JsonConvert.SerializeObject(IAPRecordSet), "WESYSA05", "SYS_PRGWORKBENCH", "FBILLNO", "", "");
|
||||
IsAdd = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
IsAdd = false;
|
||||
IAPRecordSet.M_USER = UserID;
|
||||
IAPRecordSet.M_YMD = DateTime.Now;
|
||||
}
|
||||
if (IsAdd)
|
||||
DBContext.Add(IAPRecordSet);
|
||||
else
|
||||
DBContext.Update(IAPRecordSet);
|
||||
|
||||
DBContext.SaveChanges();
|
||||
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
return Ok(new { ErrCode = 0, Data = "" });
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
return Ok(new
|
||||
{
|
||||
ErrCode = 400,
|
||||
Data = ex.Message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Authorize]
|
||||
public IActionResult DelFavorites([FromBody] string ID)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (APPServerContext DBContext = new APPServerContext(LoginInfo.DBAias, LoginInfo.UserID))
|
||||
{
|
||||
try
|
||||
{
|
||||
sysPrgWorkbench myEntity = DBContext.SYS_PRGWORKBENCH.SingleOrDefault(o => o.USER_ID.Equals(LoginInfo.UserID) && o.FID.Equals(ID));
|
||||
if (myEntity != null)
|
||||
DBContext.Remove(myEntity);
|
||||
DBContext.SaveChanges();
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
return Ok(new { ErrCode = 0, Data = "" });
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
return Ok(new
|
||||
{
|
||||
ErrCode = 400,
|
||||
Data = ex.Message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#endregion ============处理我的收藏 =========================================
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Index()
|
||||
{
|
||||
//var client = new RestSharpClient("http://localhost:51211/");
|
||||
//IRestResponse<AA> myMsg = await client.ExecuteAsync<AA>(new RestRequest("DataService/Index",Method.GET));
|
||||
return Ok("你看到的是一个WebApi");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Idempotent]
|
||||
public async Task<BaseResponse<object>> IdempotentTest()
|
||||
{
|
||||
_testList.Add(DateTime.Now.ToString());
|
||||
await Task.Delay(5000);
|
||||
return new BaseResponse<object>
|
||||
{
|
||||
Success = true,
|
||||
StatusCode = StatusCodes.Status200OK,
|
||||
Message = "幂等性测试!!!",
|
||||
Data = _testList
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Opsoft.NetCore.O3App.Domain;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WIPBarCode.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WIPBarCode.Model;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.WIPBarCode
|
||||
{
|
||||
/// <summary>
|
||||
/// 在制品盘点
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
public class WIPInventoryController : BaseApiController<WIPInventoryController>
|
||||
{
|
||||
private readonly IWIPInventoryService service;
|
||||
public WIPInventoryController(IMapper mapper, ILogger<WIPInventoryController> logger, IWIPInventoryService WIPInventoryService)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
service = WIPInventoryService;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询在制品盘点方案
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<GetWIPSchemeTo>> GetWIPScheme(GetWIPSchemeFrom SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.GetWIPScheme(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询条码
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> GetWIPBarcode([FromBody] JObject data)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMess = await service.GetWIPBarcode(data);
|
||||
if (retMess == null || retMess.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMess.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMess.Data["data"];
|
||||
}
|
||||
}, data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 提交按钮
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> UpdateWIPBarcode([FromBody] GetWIPSchemeFrom SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.UpdateWIPBarcode(SData);
|
||||
}, SData);
|
||||
}
|
||||
}
|
||||
}
|
||||
+298
@@ -0,0 +1,298 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Opsoft.Data;
|
||||
using Opsoft.NetCore.O3App.Domain;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.Model;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.WMS
|
||||
{
|
||||
[Authorize]
|
||||
public class BarcodeController : BaseApiController<BarcodeController>
|
||||
{
|
||||
private readonly IBarcodeService _barcodeService;
|
||||
public BarcodeController(IMapper mapper, ILogger<BarcodeController> logger,IBarcodeService barcodeService)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
_barcodeService = barcodeService;
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="barcode"></param>
|
||||
/// <param name="orgId"></param>
|
||||
/// <param name="billType">哪个功能调用</param>
|
||||
/// <returns></returns>
|
||||
public async Task<BaseResponse<BarCodeMsg>> GetBarcodeMsg([FromQuery] string barcode, [FromQuery] string orgId,
|
||||
[FromQuery] string billType)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _barcodeService.GetBarCodeMsg(barcode, orgId,billType);
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MES扫描随工单二维码获取信息
|
||||
/// </summary>
|
||||
/// <param name="barcode">条码</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<object>> GetMESWorkOrderInfo([FromQuery] string barcode)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _barcodeService.GetMESWorkOrderInfo(barcode);
|
||||
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 盘点扫描条码获取信息
|
||||
/// </summary>
|
||||
/// <param name="barcode">条码</param>
|
||||
/// <param name="billType">单据类型</param>
|
||||
/// <param name="orgId">组织ID</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<object>> GetStockTakingBarcodeInfo([FromQuery] string barcode, [FromQuery] string orgId)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _barcodeService.GetStockTakingBarcodeInfo(barcode, orgId);
|
||||
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 盘点条码录入
|
||||
/// </summary>
|
||||
/// <param name="inputDto">参数实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> ImportStockTakingBarCode([FromBody] ImportBarcodeDto inputDto)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _barcodeService.ImportStockTakingBarCode(inputDto);
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 扫描条码获取信息
|
||||
/// </summary>
|
||||
/// <param name="barcode">条码</param>
|
||||
/// <param name="billType">单据类型</param>
|
||||
/// <param name="orgId">组织ID</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<object>> GetBarcodeInfo([FromQuery] string barcode, [FromQuery] int billType, [FromQuery] string orgId, [FromQuery] bool isMix=false)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _barcodeService.GetBarcodeInfo(barcode, billType, orgId, isMix);
|
||||
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 扫描条码获取信息(追加装箱箱码扫描用)
|
||||
/// </summary>
|
||||
/// <param name="barcode">条码</param>
|
||||
/// <param name="billType">单据类型</param>
|
||||
/// <param name="orgId">组织ID</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<RetMessage>> GetBarcodeInfoIsAdd([FromQuery] string barcode,[FromQuery] string orgId, [FromQuery] bool isMix = false)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _barcodeService.GetBarcodeInfoIsAdd(barcode,orgId, isMix);
|
||||
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg;
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 条码拆分
|
||||
/// </summary>
|
||||
/// <param name="inputDto">参数实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> SplitBarcode([FromBody] SplitInputDto inputDto)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _barcodeService.SplitBarcode(inputDto);
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(inputDto.TranType.ToStringEx().ToUpperEx()== "STK_BARCODESPLIT")
|
||||
{
|
||||
return retMsg.Data["datainfo"];
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 条码合并
|
||||
/// </summary>
|
||||
/// <param name="inputDto">参数实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> MergeBarcode([FromBody] MergeInputDto inputDto)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _barcodeService.MergeBarcode(inputDto);
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 条码变更
|
||||
/// </summary>
|
||||
/// <param name="inputDto">参数实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> UpBarcodeInfo([FromBody] UpBarCodeInfoDto inputDto)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _barcodeService.UpBarcodeInfo(inputDto);
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 外部条码导入
|
||||
/// </summary>
|
||||
/// <param name="inputDto">参数实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> ImportBarCode([FromBody] ImportBarcodeDto inputDto)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _barcodeService.ImportBarCode(inputDto);
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 条码装箱
|
||||
/// </summary>
|
||||
/// <param name="inputDto">参数实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> InBox([FromBody] InBoxInputDto inputDto)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _barcodeService.InBox(inputDto);
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 条码拆箱
|
||||
/// </summary>
|
||||
/// <param name="inputDto">参数实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> OutBox([FromBody] OutBoxInputDto inputDto)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _barcodeService.OutBox(inputDto);
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Opsoft.NetCore.O3App.Domain;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.Model;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.WMS
|
||||
{
|
||||
[Authorize]
|
||||
public class BillHandleController : BaseApiController<BillHandleController>
|
||||
{
|
||||
private readonly IBillHandleService _Service;
|
||||
public BillHandleController(IMapper mapper, ILogger<BillHandleController> logger, IBillHandleService Service)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
_Service = Service;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询需要进行复核的单据信息
|
||||
/// </summary>
|
||||
/// <param name="fNO"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<TRAN_INFO>>> QuerySelBill()
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await _Service.QuerySelBill();
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 扫描单据编号,查询单据信息
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> QueryBillInfo([FromBody] JObject data)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMess = await _Service.QueryBillInfo(data);
|
||||
if (retMess == null || retMess.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMess.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMess.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 扫描条码,查询条码信息
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> QueryBarCode([FromBody] JObject data)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMess = await _Service.QueryBarCode(data);
|
||||
if (retMess == null || retMess.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMess.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMess.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 出入库复核提交
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> CheckSubmit([FromBody] CheckBarCode<BD_BARCODERS2> request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMess = await _Service.CheckSubmit(request.orgID, request.tranType, request.fbillNo, request.barcodeList);
|
||||
if (retMess == null || retMess.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMess.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMess.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Opsoft.NetCore.O3App.Domain;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.Model;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.WMS
|
||||
{
|
||||
public class CallMaterialController : BaseApiController<CallMaterialController>
|
||||
{
|
||||
private ICallMaterialService _callMaterialService;
|
||||
public CallMaterialController(IMapper mapper, ILogger<CallMaterialController> logger, ICallMaterialService callMaterialService) : base(mapper, logger)
|
||||
{
|
||||
_callMaterialService = callMaterialService;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse> GetCallBillInfo([FromBody] GetCallMaterialBillInfoPara para)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg =
|
||||
await _callMaterialService.GetCallBillInfo(para);
|
||||
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse> CallMaterialSubmit([FromBody] List<CallMaterialSubmitHead> callBills)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg =
|
||||
await _callMaterialService.CallMaterialSubmit(callBills);
|
||||
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse> CallMaterialQueryBarcode([FromQuery] string barcode)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg =
|
||||
await _callMaterialService.CallMaterialQueryBarcode(barcode);
|
||||
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse> StartSend([FromQuery] string billNo)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg =
|
||||
await _callMaterialService.StartSend(billNo);
|
||||
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse> SendTo([FromBody] List<string> billNo)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg =
|
||||
await _callMaterialService.SendTo(billNo);
|
||||
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Opsoft.NetCore.O3App.Domain;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.Model;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Filters;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.WMS
|
||||
{
|
||||
/// <summary>
|
||||
/// 生产入库,退库
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
public class InStockController : BaseApiController<SelBillController>
|
||||
{
|
||||
private readonly IInStockService service;
|
||||
public InStockController(IMapper mapper, ILogger<SelBillController> logger, IInStockService Service)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
service = Service;
|
||||
}
|
||||
/// <summary>
|
||||
/// 生产入库信息
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Idempotent]
|
||||
public async Task<BaseResponse<object>> InStockSubmit([FromBody] InputBarCode<BD_BARCODERS2> request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMess = await service.InStockSubmit(request);
|
||||
if (retMess == null || retMess.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMess.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMess.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
/// <summary>
|
||||
/// 生产退库信息
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Idempotent]
|
||||
public async Task<BaseResponse<object>> RetStockSubmit([FromBody] InputBarCode<BD_BARCODERS2> request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMess = await service.RetStockSubmit(request);
|
||||
if (retMess == null || retMess.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMess.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMess.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Opsoft.NetCore.O3App.Domain;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.Model;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Filters;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.WMS
|
||||
{
|
||||
/// <summary>
|
||||
/// 其他入库、出库
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
public class MisInStockController : BaseApiController<MisInStockController>
|
||||
{
|
||||
private readonly IMisInStockService service;
|
||||
public MisInStockController(IMapper mapper, ILogger<MisInStockController> logger, IMisInStockService Service)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
service = Service;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 其他入库信息
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Idempotent]
|
||||
public async Task<BaseResponse<object>> MisInStockSubmit([FromBody] InputBarCode<BD_BARCODERS2> request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMess = await service.MisInStockSubmit(request);
|
||||
if (retMess == null || retMess.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMess.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMess.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 其他出库信息
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Idempotent]
|
||||
public async Task<BaseResponse<Dictionary<string, object>>> MisRetStockSubmit([FromBody] InputBarCode<BD_BARCODERS2> request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMess = await service.MisRetStockSubmit(request);
|
||||
if (retMess == null || retMess.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMess.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMess.Data;
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Opsoft.NetCore.O3App.Domain;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.Model;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Filters;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.WMS
|
||||
{
|
||||
/// <summary>
|
||||
/// 受托加工入库、出库
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
public class OEMInStockController : BaseApiController<OEMInStockController>
|
||||
{
|
||||
private readonly IOEMInStockService service;
|
||||
public OEMInStockController(IMapper mapper, ILogger<OEMInStockController> logger, IOEMInStockService Service)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
service = Service;
|
||||
}
|
||||
/// <summary>
|
||||
/// 受托入库信息
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Idempotent]
|
||||
public async Task<BaseResponse<object>> InStockSubmit([FromBody] InputBarCode<BD_BARCODERS5> request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMess = await service.InStockSubmit(request);
|
||||
if (retMess == null || retMess.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMess.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMess.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
/// <summary>
|
||||
/// 受托出库信息
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Idempotent]
|
||||
public async Task<BaseResponse<object>> RetStockSubmit([FromBody] InputBarCode<BD_BARCODERS5> request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMess = await service.RetStockSubmit(request);
|
||||
if (retMess == null || retMess.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMess.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMess.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
+207
@@ -0,0 +1,207 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Opsoft.NetCore.O3App.Domain;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.Model;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Filters;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.WMS
|
||||
{
|
||||
/// <summary>
|
||||
/// 销售出库
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
public class OutStockController : BaseApiController<SelBillController>
|
||||
{
|
||||
private readonly IOutStockService service;
|
||||
public OutStockController(IMapper mapper, ILogger<SelBillController> logger, IOutStockService spotcheckService)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
service = spotcheckService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 销售出库信息
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Idempotent]
|
||||
public async Task<BaseResponse<object>> SaleOutStockSubmit([FromBody] InputBarCode<BD_BARCODERS2> request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMess = await service.SaleOutStockSubmit(request);
|
||||
if (retMess == null || retMess.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMess.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMess.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 销售退货信息
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Idempotent]
|
||||
public async Task<BaseResponse<object>> SaleInStockSubmit([FromBody] InputBarCode<BD_BARCODERS2> request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMess = await service.SaleInStockSubmit(request);
|
||||
if (retMess == null || retMess.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMess.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMess.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 销售出库(套件)信息
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Idempotent]
|
||||
public async Task<BaseResponse<object>> SaleOutStockSuitSubmit([FromBody] InputBarCode<BD_BARCODERS2> request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMess = await service.SaleOutStockSuitSubmit(request);
|
||||
if (retMess == null || retMess.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMess.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMess.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 销售退库(套件)信息
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Idempotent]
|
||||
public async Task<BaseResponse<object>> SaleInStockSuitSubmit([FromBody] InputBarCode<BD_BARCODERS2> request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMess = await service.SaleInStockSuitSubmit(request);
|
||||
if (retMess == null || retMess.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMess.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMess.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 销售复核(扫源单)
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> SaleCheckScanSourceBill([FromBody] JObject request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMess = await service.SaleCheckScanSourceBill(request);
|
||||
if (retMess == null || retMess.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMess.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMess.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 销售复核(暂存)
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> SaleCheckScanCode([FromBody] JObject request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMess = await service.SaleCheckScanCode(request);
|
||||
if (retMess == null || retMess.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMess.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMess.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 销售复核(暂存)
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> SaleCheckTemporaryStorage([FromBody] InputSalCheck<BD_BARCODERS2> request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMess = await service.SaleCheckTemporaryStorage(request.FBILLNO, request.orgID, request.barcodeList);
|
||||
if (retMess == null || retMess.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMess.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMess.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 销售复核(提交)
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> SaleCheckSubmit([FromBody] InputSalCheck<BD_BARCODERS2> request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMess = await service.SaleCheckSubmit(request.FBILLNO,request.orgID,request.barcodeList);
|
||||
if (retMess == null || retMess.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMess.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMess.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
+276
@@ -0,0 +1,276 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Opsoft.NetCore.O3App.Domain;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.Model;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.WMS
|
||||
{
|
||||
/// <summary>
|
||||
/// 销售拣货
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
public class PickInventoryController : BaseApiController<PickInventoryController>
|
||||
{
|
||||
private readonly IPickInventoryService _pickInventoryService;
|
||||
private readonly IBarcodeService _barcodeService;
|
||||
|
||||
public PickInventoryController(
|
||||
IMapper mapper, ILogger<PickInventoryController> logger,
|
||||
IPickInventoryService pickInventoryService,
|
||||
IBarcodeService barcodeService)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
_pickInventoryService = pickInventoryService;
|
||||
_barcodeService = barcodeService;
|
||||
}
|
||||
|
||||
#region 旧销售拣货接口
|
||||
|
||||
/// <summary>
|
||||
/// 获取拣货信息
|
||||
/// </summary>
|
||||
/// <param name="para"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> GetPickInventoryDetail([FromBody] PickInventoryParameter para)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _pickInventoryService.GetPickInventoryDetail(para);
|
||||
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 条码操作(扫码/删除)
|
||||
/// </summary>
|
||||
/// <param name="para"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> BarcodeOperate([FromBody] PickInventoryBarcodeParameter para)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _pickInventoryService.ScanOrRemoveBarcode(para);
|
||||
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 条码拆分
|
||||
/// </summary>
|
||||
/// <param name="para"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> SplitBarcode([FromBody] SplitInputDto para)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _barcodeService.SplitBarcode(para);
|
||||
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 新拣货
|
||||
|
||||
/// <summary>
|
||||
/// 获取拣货任务列表
|
||||
/// </summary>
|
||||
/// <param name="companyId">组织</param>
|
||||
/// <param name="type">拣货类型</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<object>> GetPickTaskList(string companyId, int type)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _pickInventoryService.GetPickTaskList(companyId, type);
|
||||
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 认领拣货任务
|
||||
/// </summary>
|
||||
/// <param name="companyId">组织</param>
|
||||
/// <param name="billNo">单号</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<object>> TakePickTask(string companyId, string billNo)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _pickInventoryService.TakePickTask(companyId, billNo);
|
||||
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取容器信息
|
||||
/// </summary>
|
||||
/// <param name="companyId">组织</param>
|
||||
/// <param name="containerNo">容器号</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<object>> GetContainerInfo(string companyId, string containerNo)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _pickInventoryService.GetContainerInfo(companyId, containerNo);
|
||||
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取库存信息
|
||||
/// </summary>
|
||||
/// <param name="taskSubRowDetailId">当前任务单明细行detailId</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<object>> PickTaskGetInventoryInfo(string taskSubRowDetailId)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _pickInventoryService.GetInventoryInfo(taskSubRowDetailId);
|
||||
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 扫码获取条码信息
|
||||
/// </summary>
|
||||
/// <param name="companyId">组织</param>
|
||||
/// <param name="barcode">条码</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<object>> PickTaskQueryBarcode(string companyId, string barcode)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _pickInventoryService.QueryBarcode(companyId, barcode);
|
||||
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 扫码回车
|
||||
/// </summary>
|
||||
/// <param name="para">参数</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> PickTaskScanBarcode([FromBody] PickTaskScanBarcodePara para)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _pickInventoryService.ScanBarcode(para);
|
||||
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异常上报
|
||||
/// </summary>
|
||||
/// <param name="para">参数</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> PickTaskErrorReport([FromBody] PickTaskErrorReportPara para)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _pickInventoryService.ErrorReport(para);
|
||||
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Opsoft.NetCore.O3App.Domain;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.Model;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Filters;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.WMS
|
||||
{
|
||||
/// <summary>
|
||||
/// 生产领料,生产退料
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
public class PickMtrlController : BaseApiController<SelBillController>
|
||||
{
|
||||
private readonly IPickMtrlService _pickMtrlService;
|
||||
public PickMtrlController(IMapper mapper, ILogger<SelBillController> logger,IPickMtrlService pickMtrlService)
|
||||
:base(mapper, logger)
|
||||
{
|
||||
_pickMtrlService = pickMtrlService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生产领料提交
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Idempotent]
|
||||
public async Task<BaseResponse<object>> PickMtrlSubmit([FromBody] InputBarCode<BD_BARCODERS2> request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _pickMtrlService.PickMtrlSubmit(request);
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生产退料提交
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Idempotent]
|
||||
public async Task<BaseResponse<object>> ReturnMtrlSubmit([FromBody] InputBarCode<BD_BARCODERS2> request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _pickMtrlService.ReturnMtrlSubmit(request);
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 生产补料提交
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Idempotent]
|
||||
public async Task<BaseResponse<object>> FeedMtrlSubmit([FromBody] InputBarCode<BD_BARCODERS2> request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _pickMtrlService.FeedMtrlSubmit(request);
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
+556
@@ -0,0 +1,556 @@
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Opsoft.Data;
|
||||
using Opsoft.NetCore.O3App.Domain;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.Model;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.WMS
|
||||
{
|
||||
[EnableCors("any")]
|
||||
public class PrintServicesController : BaseApiController<PrintServicesController>
|
||||
{
|
||||
public PrintServicesController(IMapper mapper, ILogger<PrintServicesController> logger) : base(mapper, logger)
|
||||
{
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public IActionResult GetPrintTemplateInfo([FromBody] PrintModel data)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (APPServerContext DBContext = new APPServerContext(data.DBAias, data.UserID))
|
||||
{
|
||||
string sql = @$" SELECT
|
||||
t2.FNUMBER as FPRGKEY,
|
||||
t2.FNAME as FPRGNAME,
|
||||
t1.FNUMBER as FPRINTKEY,
|
||||
t1.FCAPTION,
|
||||
t1.FDETAILID,
|
||||
t1.FTEMPLATE
|
||||
FROM SYS_BILLTEMPLATEENTRY5 t1
|
||||
LEFT JOIN SYS_BILLTEMPLATE t2 ON t1.FINTERID = t2.FINTERID
|
||||
WHERE t2.FNUMBER='MATERIAL_MODEL' AND t1.FNUMBER='{data.FMOULD}'";
|
||||
var retData = DBContext.Database.SqlQuery(sql);
|
||||
return Ok(new { ErrCode = 0, Data = retData });
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
return Ok(new
|
||||
{
|
||||
ErrCode = 400,
|
||||
Data = ex.Message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public IActionResult GetPrintBarcodeInfo([FromBody] PrintModel data)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (APPServerContext DBContext = new APPServerContext(data.DBAias, data.UserID))
|
||||
{
|
||||
//string sql = @" SELECT
|
||||
// T01.*,
|
||||
// T03.FNUMBER AS FMANUMBER
|
||||
// ,T03.FNAME AS FMANAME
|
||||
// ,T03.FSPECIFICATION
|
||||
// ,T05.FNAME AS FUNITNAME
|
||||
// FROM T_BD_BARCODERS T01
|
||||
// LEFT JOIN T_BD_MATERIAL T03 ON T01.FMATERIALID = T03.FINTERID
|
||||
// LEFT JOIN T_BD_UNIT T05 ON T01.FUNITID = T05.FINTERID
|
||||
// WHERE T01.FBARCODE IN ('" + string.Join("','", data.FBarcode) + "')";
|
||||
|
||||
string sql = @" select T01.*,
|
||||
T03.FNUMBER as FMANUMBER , T03.FNAME as FMANAME , T03.FSPECIFICATION as FSPECIFICATION , T03.FPICTURE as FPICTURE , T03.FDESCEN as FDESCEN ,
|
||||
T05.FNAME as FUNITNAME ,
|
||||
T04.FPURBILLNO as FPURBILLNO , T04.FPOBILLNO as FPOBILLNO ,
|
||||
T07.FNUMBER as FSUPNUMBER , T07.FNAME as FSUPNAME ,
|
||||
T06.FMOBILLNO as FMOBILLNO , T06.FMODELNO as FMODELNO , T06.FSN as FSN
|
||||
from T_BD_BARCODERS T01
|
||||
LEFT JOIN T_BD_MATERIAL T03 on T01.FMATERIALID = T03.FINTERID
|
||||
LEFT JOIN T_BD_UNIT T05 on T01.FUNITID = T05.FINTERID
|
||||
LEFT JOIN T_BD_BARCODERS1 T04 on T01.FBARCODE = T04.FBARCODE
|
||||
LEFT JOIN T_BD_SUPPLIER T07 on T04.FSUPPLIERID = T07.FINTERID
|
||||
LEFT JOIN T_BD_BARCODERS2 T06 on T01.FBARCODE = T06.FBARCODE
|
||||
WHERE T01.FBARCODE IN ('" + string.Join("','", data.FBarcode) + "')";
|
||||
var retData = DBContext.Database.SqlQuery(sql);
|
||||
return Ok(new { ErrCode = 0, Data = retData });
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
return Ok(new
|
||||
{
|
||||
ErrCode = 400,
|
||||
Data = ex.Message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<DataTable>> QueryBluetooth([FromQuery] string orgId, [FromQuery] string printerBrand = "")
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
await using APPServerContext dbContext = new APPServerContext(LoginInfo.DBAias, LoginInfo.UserID);
|
||||
string sql =
|
||||
$@"SELECT
|
||||
FINTERID
|
||||
, FNUMBER
|
||||
, FNAME
|
||||
, FCOMPANYID
|
||||
FROM dbo.T_BAS_BTPRINTER
|
||||
WHERE FTYPE='{printerBrand}' ";
|
||||
if (!orgId.IsNullOrEmpty())
|
||||
{
|
||||
sql += $" AND FCOMPANYID='{orgId}'";
|
||||
}
|
||||
DataTable configDataTable = dbContext.Database.SqlQuery(sql);
|
||||
if (configDataTable.Rows.Count <= 0)
|
||||
{
|
||||
throw new O3AppException("未取得蓝牙打印机配置");
|
||||
}
|
||||
return configDataTable;
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> QueryBluetoothByBill([FromBody] QueryPrintConfigModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
await using APPServerContext dbContext = new APPServerContext(LoginInfo.DBAias, LoginInfo.UserID);
|
||||
var queryBarcodeInfoSql =
|
||||
$@"SELECT
|
||||
T01.FCOMPANYID
|
||||
, T01.FBARCODE
|
||||
, T02.FNUMBER AS FMATERIALNUMBER
|
||||
, T02.FNAME AS FMATERIALNAME
|
||||
, T02.FSPECIFICATION
|
||||
, T02.FISBATCHMANAGE
|
||||
, T01.FLOT
|
||||
, T08.FNAME AS FAUXPROPNAME
|
||||
, T01.FQTY
|
||||
, T03.FNAME AS FUNITNAME
|
||||
, T01.FBASEQTY
|
||||
, T04.FNAME AS FBASEUNITNAME
|
||||
, T01.FSECUNITQTY
|
||||
, T05.FNAME AS FSECUNITNAME
|
||||
, T06.FNAME AS FSTOCKNAME
|
||||
, T06.FISOPENLOCATION
|
||||
, T07.FNAME AS FSTOCKLOCNAME
|
||||
, T01.FKFDATE
|
||||
, T02.FISKFPERIOD
|
||||
, T01.FDELETED
|
||||
, CASE T02.FISKFPERIOD
|
||||
WHEN 1 THEN
|
||||
CASE T02.FKFUNIT
|
||||
WHEN 0 THEN
|
||||
DATEADD(DAY, T02.FKFPERIOD, T01.FKFDATE)
|
||||
WHEN 1 THEN
|
||||
DATEADD(MONTH, T02.FKFPERIOD, T01.FKFDATE)
|
||||
WHEN 2 THEN
|
||||
DATEADD(YEAR, T02.FKFPERIOD, T01.FKFDATE)
|
||||
END
|
||||
ELSE
|
||||
NULL
|
||||
END AS FEXPIREDATE
|
||||
, T09.FNAME AS FCOMPANYNAME
|
||||
FROM dbo.T_BD_BARCODERS T01
|
||||
LEFT JOIN dbo.T_BD_MATERIAL T02
|
||||
ON T02.FINTERID = T01.FMATERIALID
|
||||
LEFT JOIN dbo.T_BD_UNIT T03
|
||||
ON T03.FINTERID = T01.FUNITID
|
||||
LEFT JOIN dbo.T_BD_UNIT T04
|
||||
ON T04.FINTERID = T01.FBASEUNITID
|
||||
LEFT JOIN dbo.T_BD_UNIT T05
|
||||
ON T05.FINTERID = T01.FSECUNITID
|
||||
LEFT JOIN dbo.T_BD_STOCK T06
|
||||
ON T06.FINTERID = T01.FSTOCKID
|
||||
LEFT JOIN dbo.T_BAS_FLEXVALUESDETAIL T07
|
||||
ON T07.FINTERID = T01.FSTOCKLOCID
|
||||
LEFT JOIN dbo.T_BD_FLEXSITEMDETAILV T08
|
||||
ON T08.FINTERID = T01.FAUXPROPID
|
||||
LEFT JOIN dbo.SYS_ORGSTRUCTURE T09
|
||||
ON T09.FINTERID = T01.FCOMPANYID
|
||||
WHERE T01.FBARCODE IN ({string.Join(",", model.BarcodeList.Select(o => "'" + o + "'").ToList())})";
|
||||
DataTable barcodeInfoTable = dbContext.Database.SqlQuery(queryBarcodeInfoSql);
|
||||
if (barcodeInfoTable.Rows.Count <= 0)
|
||||
{
|
||||
return new BaseResponse<object>
|
||||
{
|
||||
Data = null,
|
||||
Message = "获取蓝牙打印配置失败:未查询任条码信息!",
|
||||
StatusCode = 400,
|
||||
Success = false
|
||||
};
|
||||
}
|
||||
|
||||
foreach (var barcode in model.BarcodeList)
|
||||
{
|
||||
var barcodeCount = barcodeInfoTable
|
||||
.AsEnumerable()
|
||||
.Count(o => o["FBARCODE"].ToStringEx() == barcode);
|
||||
if (barcodeCount <= 0)
|
||||
{
|
||||
return new BaseResponse<object>
|
||||
{
|
||||
Data = null,
|
||||
Message = $"获取蓝牙打印配置失败:条码[{barcode}]信息未找到!",
|
||||
StatusCode = 400,
|
||||
Success = false
|
||||
};
|
||||
}
|
||||
|
||||
if (barcodeCount > 1)
|
||||
{
|
||||
return new BaseResponse<object>
|
||||
{
|
||||
Data = null,
|
||||
Message = $"获取蓝牙打印配置失败:条码[{barcode}]在条码主档中有多条记录!",
|
||||
StatusCode = 500,
|
||||
Success = false
|
||||
};
|
||||
}
|
||||
|
||||
var barcodeInfo = barcodeInfoTable
|
||||
.AsEnumerable()
|
||||
.FirstOrDefault(o => o["FBARCODE"].ToStringEx() == barcode);
|
||||
if (!model.OrgId.IsNullOrEmpty() && barcodeInfo["FCOMPANYID"].ToStringEx() != model.OrgId)
|
||||
{
|
||||
return new BaseResponse<object>
|
||||
{
|
||||
Data = null,
|
||||
Message = $"获取蓝牙打印配置失败:条码[{barcode}]的组织[{barcodeInfo["FCOMPANYNAME"].ToStringEx()}]与当前组织不同!",
|
||||
StatusCode = 500,
|
||||
Success = false
|
||||
};
|
||||
}
|
||||
if (barcodeInfo["FDELETED"].ToBoolean())
|
||||
{
|
||||
return new BaseResponse<object>
|
||||
{
|
||||
Data = null,
|
||||
Message = $"获取蓝牙打印配置失败:条码[{barcode}]已被禁用!",
|
||||
StatusCode = 500,
|
||||
Success = false
|
||||
};
|
||||
}
|
||||
}
|
||||
switch (model.PrinterBrand)
|
||||
{
|
||||
case "DT":
|
||||
{
|
||||
string queryConfigSql =
|
||||
$@"SELECT
|
||||
T1.FNAME AS FCONFIGNAME
|
||||
, T1.FNUMBER AS FCONFIGNUMBER
|
||||
, T1.FPRINTCOUNT
|
||||
, T1.FWIDTH AS FLABELWIDTH
|
||||
, T1.FHEIGHT AS FLABELHEIGHT
|
||||
, T1.FORIENTATION AS FLAYOUTORIENTATION
|
||||
, T2.FELEMENTTYPE
|
||||
, T2.FX
|
||||
, T2.FY
|
||||
, T2.FHEIGHT AS FELEMENTHEIGHT
|
||||
, T2.FWIDTH AS FELEMENTWIDTH
|
||||
, T2.FORIENTATION AS FELEMENTORIENTATION
|
||||
, T2.FBINDINGFIELD
|
||||
, T2.FFONTSTYLE
|
||||
, T2.FFONTHEIGHT
|
||||
, T2.FLINEWIDTH
|
||||
, T2.FTEXTHEIGHT
|
||||
, T2.FAUTORETURN
|
||||
, T2.FISDEFAULTVALUE
|
||||
, T2.FFIELDVALUE
|
||||
, T2.FNOTE
|
||||
, T2.FISINTERCEPTTEXT
|
||||
, T2.FINTERCEPTLENTH
|
||||
FROM dbo.T_BAS_BTPRINTER T1
|
||||
LEFT JOIN dbo.T_BAS_BTPRINTER_ENTRY_DT T2
|
||||
ON T2.FINTERID = T1.FINTERID
|
||||
WHERE T1.FSTATUS=40 AND T1.FDELETED=0 AND T1.FNUMBER='{model.ConfigNumber}' ";
|
||||
if (!model.OrgId.IsNullOrEmpty())
|
||||
{
|
||||
queryConfigSql += $" AND T1.FCOMPANYID='{model.OrgId}'";
|
||||
}
|
||||
DataTable configDataTable = dbContext.Database.SqlQuery(queryConfigSql);
|
||||
if (configDataTable.Rows.Count <= 0)
|
||||
{
|
||||
return new BaseResponse<object>
|
||||
{
|
||||
Data = null,
|
||||
Message = "获取蓝牙打印配置失败:未找到指定的蓝牙打印机配置!",
|
||||
StatusCode = 400,
|
||||
Success = false
|
||||
};
|
||||
}
|
||||
|
||||
var configGroups = configDataTable.AsEnumerable().GroupBy(o => new
|
||||
{
|
||||
ConfigName = o["FCONFIGNAME"].ToStringEx(),
|
||||
ConfigNumber = o["FCONFIGNUMBER"].ToStringEx(),
|
||||
PrintCount = o["FPRINTCOUNT"].ToInt(),
|
||||
LabelWidth = o["FLABELWIDTH"].ToDecimal(),
|
||||
LabelHeight = o["FLABELHEIGHT"].ToDecimal(),
|
||||
Orientation = o["FLAYOUTORIENTATION"].ToDecimal()
|
||||
});
|
||||
var configGroup = configGroups.FirstOrDefault();
|
||||
if (configGroup == null)
|
||||
{
|
||||
return new BaseResponse<object>
|
||||
{
|
||||
Data = null,
|
||||
Message = "获取蓝牙打印配置失败:未找到指定的蓝牙打印机配置!",
|
||||
StatusCode = 400,
|
||||
Success = false
|
||||
};
|
||||
}
|
||||
IBluetoothPrintConfig config = new BluetoothPrintConfig_DT
|
||||
{
|
||||
ConfigName = configGroup.Key.ConfigName,
|
||||
ConfigNumber = configGroup.Key.ConfigNumber,
|
||||
LabelWidth = configGroup.Key.LabelWidth,
|
||||
LabelHeight = configGroup.Key.LabelHeight,
|
||||
PrintCount = configGroup.Key.PrintCount,
|
||||
Orientation = configGroup.Key.Orientation,
|
||||
};
|
||||
config.ConfigDetails = new List<IBluetoothPrintDetailConfig>();
|
||||
|
||||
List<string> noInfoBarcodeList = new List<string>();
|
||||
foreach (var barcode in model.BarcodeList)
|
||||
{
|
||||
var barcodeInfo = barcodeInfoTable
|
||||
.AsEnumerable()
|
||||
.FirstOrDefault(o => o["FBARCODE"].ToStringEx() == barcode);
|
||||
if (barcodeInfo != null)
|
||||
{
|
||||
BluetoothPrintDetailConfig_DT detailConfig = new BluetoothPrintDetailConfig_DT
|
||||
{
|
||||
Barcode = barcode
|
||||
};
|
||||
foreach (var configRow in configGroup)
|
||||
{
|
||||
switch (configRow["FELEMENTTYPE"].ToInt())
|
||||
{
|
||||
case 2:
|
||||
BoxConfig boxConfig = new BoxConfig
|
||||
{
|
||||
ElementType = 2,
|
||||
X = configRow["FX"].ToDecimal(),
|
||||
Y = configRow["FY"].ToDecimal(),
|
||||
Width = configRow["FELEMENTWIDTH"].ToDecimal(),
|
||||
Height = configRow["FELEMENTHEIGHT"].ToDecimal(),
|
||||
LineWidth = configRow["FLINEWIDTH"].ToDecimal(),
|
||||
Note = configRow["FNOTE"].ToStringEx()
|
||||
};
|
||||
detailConfig.ElementConfigs.Add(boxConfig);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
TextConfig textConfig = new TextConfig
|
||||
{
|
||||
ElementType = 3,
|
||||
X = configRow["FX"].ToDecimal(),
|
||||
Y = configRow["FY"].ToDecimal(),
|
||||
Width = configRow["FELEMENTWIDTH"].ToDecimal(),
|
||||
Height = configRow["FELEMENTHEIGHT"].ToDecimal(),
|
||||
FontStyle = configRow["FFONTSTYLE"].ToStringEx(),
|
||||
FontHeight = configRow["FFONTHEIGHT"].ToDecimal(),
|
||||
Orientation = configRow["FELEMENTORIENTATION"].ToDecimal(),
|
||||
BindingField = configRow["FBINDINGFIELD"].ToStringEx(),
|
||||
AutoReturn = configRow["FAUTORETURN"].ToBoolean(),
|
||||
IsInterceptText = configRow["FISINTERCEPTTEXT"].ToBoolean(),
|
||||
InterceptLength = configRow["FINTERCEPTLENTH"].ToInt(),
|
||||
Note = configRow["FNOTE"].ToStringEx()
|
||||
};
|
||||
SetFieldValue(textConfig, configRow, barcodeInfo);
|
||||
detailConfig.ElementConfigs.Add(textConfig);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
BarcodeConfig barcodeConfig = new BarcodeConfig
|
||||
{
|
||||
ElementType = 4,
|
||||
X = configRow["FX"].ToDecimal(),
|
||||
Y = configRow["FY"].ToDecimal(),
|
||||
Width = configRow["FELEMENTWIDTH"].ToDecimal(),
|
||||
Height = configRow["FELEMENTHEIGHT"].ToDecimal(),
|
||||
TextHeight = configRow["FTEXTHEIGHT"].ToDecimal(),
|
||||
Orientation = configRow["FELEMENTORIENTATION"].ToDecimal(),
|
||||
BindingField = configRow["FBINDINGFIELD"].ToStringEx(),
|
||||
Note = configRow["FNOTE"].ToStringEx()
|
||||
};
|
||||
SetFieldValue(barcodeConfig, configRow, barcodeInfo);
|
||||
detailConfig.ElementConfigs.Add(barcodeConfig);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
QRCodeConfig qrCodeConfig = new QRCodeConfig
|
||||
{
|
||||
ElementType = 5,
|
||||
X = configRow["FX"].ToDecimal(),
|
||||
Y = configRow["FY"].ToDecimal(),
|
||||
Width = configRow["FELEMENTWIDTH"].ToDecimal(),
|
||||
Orientation = configRow["FELEMENTORIENTATION"].ToDecimal(),
|
||||
BindingField = configRow["FBINDINGFIELD"].ToStringEx(),
|
||||
Note = configRow["FNOTE"].ToStringEx()
|
||||
};
|
||||
SetFieldValue(qrCodeConfig, configRow, barcodeInfo);
|
||||
detailConfig.ElementConfigs.Add(qrCodeConfig);
|
||||
break;
|
||||
|
||||
case 6:
|
||||
LineConfig lineConfig = new LineConfig
|
||||
{
|
||||
ElementType = 6,
|
||||
X1 = configRow["FX"].ToDecimal(),
|
||||
Y1 = configRow["FY"].ToDecimal(),
|
||||
X2 = configRow["FELEMENTWIDTH"].ToDecimal(),
|
||||
Y2 = configRow["FELEMENTHEIGHT"].ToDecimal(),
|
||||
LineWidth = configRow["FLINEWIDTH"].ToDecimal(),
|
||||
Note = configRow["FNOTE"].ToStringEx()
|
||||
};
|
||||
detailConfig.ElementConfigs.Add(lineConfig);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
config.ConfigDetails.Add(detailConfig);
|
||||
}
|
||||
else
|
||||
{
|
||||
noInfoBarcodeList.Add(barcode);
|
||||
}
|
||||
}
|
||||
return new BaseResponse<object>
|
||||
{
|
||||
Data = new
|
||||
{
|
||||
PrintConfig = config,
|
||||
NoConfigBarcodes = noInfoBarcodeList
|
||||
},
|
||||
Message = "获取蓝牙打印配置成功",
|
||||
StatusCode = 200,
|
||||
Success = true
|
||||
};
|
||||
}
|
||||
default:
|
||||
{
|
||||
IBluetoothPrintConfig config = null;
|
||||
string queryConfigSql =
|
||||
$@"SELECT
|
||||
T1.FNAME AS FCONFIGNAME
|
||||
, T1.FNUMBER AS FCONFIGNUMBER
|
||||
, T1.FPRINTCOUNT
|
||||
, T1.FWIDTH AS FLABELWIDTH
|
||||
, T1.FHEIGHT AS FLABELHEIGHT
|
||||
, T2.FBINDNAME
|
||||
, T2.FXDATA
|
||||
, T2.FYDATA
|
||||
, T2.FHEIGHT AS FBARCODEHEIGHT
|
||||
, T2.FWIDTH AS FBARCODEWIDTH
|
||||
, T2.FROTATION
|
||||
, T2.FNARROW
|
||||
, T2.FWIDE
|
||||
, T2.FTYPE
|
||||
, T2.FXMULTIPLICATION
|
||||
, T2.FYMULTIPLICATION
|
||||
, T2.FMODE
|
||||
FROM dbo.T_BAS_BTPRINTER T1
|
||||
LEFT JOIN dbo.T_BAS_BTPRINTER_ENTRY T2
|
||||
ON T2.FINTERID = T1.FINTERID
|
||||
WHERE T1.FSTATUS=40 AND T1.FDELETED=0 AND T1.FNUMBER='{model.ConfigNumber}' AND T1.FCOMPANYID='{model.OrgId}'";
|
||||
DataTable configDataTable = dbContext.Database.SqlQuery(queryConfigSql);
|
||||
if (configDataTable.Rows.Count <= 0)
|
||||
{
|
||||
throw new O3AppException("未找到对应的蓝牙打印机配置");
|
||||
}
|
||||
|
||||
var configGroups = configDataTable.AsEnumerable().GroupBy(o => new
|
||||
{
|
||||
ConfigName = o["FCONFIGNAME"].ToStringEx(),
|
||||
ConfigNumber = o["FCONFIGNUMBER"].ToStringEx(),
|
||||
PrintCount = o["FPRINTCOUNT"].ToInt(),
|
||||
LabelWidth = o["FLABELWIDTH"].ToDecimal(),
|
||||
LabelHeight = o["FLABELHEIGHT"].ToDecimal()
|
||||
});
|
||||
var configGroup = configGroups.FirstOrDefault();
|
||||
config = new BluetoothPrintConfig
|
||||
{
|
||||
ConfigName = configGroup.Key.ConfigName,
|
||||
ConfigNumber = configGroup.Key.ConfigNumber,
|
||||
LabelWidth = configGroup.Key.LabelWidth,
|
||||
LabelHeight = configGroup.Key.LabelHeight,
|
||||
PrintCount = configGroup.Key.PrintCount
|
||||
};
|
||||
List<IBluetoothPrintConfig> configList = new List<IBluetoothPrintConfig>();
|
||||
foreach (var row in configGroup)
|
||||
{
|
||||
config.ConfigDetails.Add(new BluetoothPrintDetailConfig
|
||||
{
|
||||
ElementType = row["FTYPE"].ToInt(),
|
||||
BindingFieldName = row["FBINDNAME"].ToStringEx(),
|
||||
EncodeMode = row["FMODE"].ToBoolean(),
|
||||
XAxisLeftBeginPosition = row["FXDATA"].ToDecimal(),
|
||||
YAxisTopBeginPosition = row["FYDATA"].ToDecimal(),
|
||||
XAxisMultiplication = row["FXMULTIPLICATION"].ToDecimal(),
|
||||
YAxisMultiplication = row["FYMULTIPLICATION"].ToDecimal(),
|
||||
BarcodeHeight = row["FBARCODEHEIGHT"].ToDecimal(),
|
||||
BarcodeWidth = row["FBARCODEWIDTH"].ToDecimal(),
|
||||
NarrowBarcodeLineHeight = row["FNARROW"].ToDecimal(),
|
||||
NarrowBarcodeLineWidth = row["FWIDE"].ToDecimal(),
|
||||
BarcodeRotationAngle = row["FROTATION"].ToDecimal()
|
||||
});
|
||||
}
|
||||
|
||||
configList.Add(config);
|
||||
return new BaseResponse<object>
|
||||
{
|
||||
Data = configList,
|
||||
Message = "获取蓝牙打印配置成功",
|
||||
StatusCode = 200,
|
||||
Success = true
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return new BaseResponse<object>
|
||||
{
|
||||
Data = null,
|
||||
Message = $"获取蓝牙打印配置失败:{e.Message}",
|
||||
StatusCode = 500,
|
||||
Success = false
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private void SetFieldValue(BluetoothPrintElementConfigBase_DT elementConfig, DataRow configRow, DataRow barcodeInfo)
|
||||
{
|
||||
if (configRow["FISDEFAULTVALUE"].ToBoolean())
|
||||
{
|
||||
elementConfig.IsDefaultValue = true;
|
||||
elementConfig.FieldValue = configRow["FFIELDVALUE"].ToStringEx();
|
||||
}
|
||||
else
|
||||
{
|
||||
elementConfig.IsDefaultValue = false;
|
||||
if (!configRow["FBINDINGFIELD"].ToStringEx().IsNullOrEmpty())
|
||||
{
|
||||
elementConfig.FieldValue = barcodeInfo[configRow["FBINDINGFIELD"].ToStringEx()].ToStringEx();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Opsoft.NetCore.O3App.Domain;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.Model;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.WMS
|
||||
{
|
||||
[Authorize]
|
||||
public class ProductBarcodeCheckController : BaseApiController<ProductBarcodeCheckController>
|
||||
{
|
||||
private readonly IProductBarcodeCheckService productBarcodeCheckService;
|
||||
public ProductBarcodeCheckController(IMapper mapper,
|
||||
ILogger<ProductBarcodeCheckController> logger,
|
||||
IProductBarcodeCheckService productBarcodeCheckService) : base(mapper, logger)
|
||||
{
|
||||
this.productBarcodeCheckService = productBarcodeCheckService;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<bool>> CheckBarcode([FromBody] ProductBarcodeCheckRequest request)
|
||||
{
|
||||
return await TryProcess(input =>
|
||||
{
|
||||
if (input.Inner.IsNullOrWhiteSpace() || input.Outer.IsNullOrWhiteSpace())
|
||||
{
|
||||
throw new O3AppException("内屏条码/外包装条码必录,不能为空");
|
||||
}
|
||||
if (request.Middle.IsNullOrWhiteSpace())
|
||||
{
|
||||
if (!(input.Inner.Equals(input.Outer)))
|
||||
{
|
||||
throw new O3AppException("内屏条码和外包装条码为不同条码!!");
|
||||
}
|
||||
return Task.FromResult(input.Inner.Equals(input.Outer));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(input.Inner.Equals(input.Outer) && input.Inner.Equals(input.Middle) && input.Middle.Equals(input.Outer)))
|
||||
{
|
||||
throw new O3AppException("内屏条码、中包装条码和外包装条码为不同条码!!");
|
||||
}
|
||||
return Task.FromResult(input.Inner.Equals(input.Outer) && input.Inner.Equals(input.Middle) && input.Middle.Equals(input.Outer));
|
||||
}
|
||||
}, request);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<bool>> SubmitSave([FromBody] List<ProductBarcodeCheckRequest> barcodes)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await productBarcodeCheckService.SubmitSave(input);
|
||||
}, barcodes);
|
||||
}
|
||||
}
|
||||
}
|
||||
+188
@@ -0,0 +1,188 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.IServices;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using System.Data;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.Model;
|
||||
using Opsoft.NetCore.O3App.Domain;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.WMS
|
||||
{
|
||||
/// <summary>
|
||||
/// 在库检验单
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
public class STKAPPINSPECTController : BaseApiController<STKAPPINSPECTController>
|
||||
{
|
||||
private readonly ISTKAPPINSPECTService service;
|
||||
public STKAPPINSPECTController(IMapper mapper, ILogger<STKAPPINSPECTController> logger, ISTKAPPINSPECTService spotcheckService)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
service = spotcheckService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取AQL
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<object>> GetAQL(getAQL SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.GetAQL(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取检验项目
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<DataTable>> GetTestItems(GetTestItems SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.GetTestItems(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 测试值是否合格
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<Boolean>> ValueIsQualified(ValueIsQualified SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.ValueIsQualified(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取检验单列表
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<DataTable>> InStockInspectionList(InStockInspectionListRequest SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.InStockInspectionList(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取抽样数量、AC、RE
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<FSampleQtyACRE>> GetACRE(GetACRE SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.GetACRE(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取基本资料列表
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<GetBDInformation>>> GetBDInformation(GetBDInformationParameter SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.GetBDInformation(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证条码
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<Boolean>> TestBarcode(TestBarcode SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.TestBarcode(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取检验项目详细信息
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<InspectionItemsDetails>>> InspectionItems(InspectionItems SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.InspectionItems(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 检验单提交
|
||||
/// </summary>
|
||||
/// <param name="SData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<string>> InspectionItemsSubmit([FromBody] InspectionItemsSubmit SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.InspectionItemsSubmit(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 请检单提交
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse> SubmitSTKAPPInspect([FromBody] StkAppInspectSubmitRequest request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
await service.SubmitSTKAPPInspect(input);
|
||||
}, request);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 上传图片
|
||||
/// </summary>
|
||||
/// <param name="file"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<string>> UploadTestFile([FromForm] UploadTestFile SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.UploadTestFile(SData);
|
||||
}, SData);
|
||||
}
|
||||
}
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Opsoft.NetCore.O3App.Domain;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.Model;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Filters;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.WMS
|
||||
{
|
||||
/// <summary>
|
||||
/// 外购入库、退料
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
public class STKInStockController : BaseApiController<STKInStockController>
|
||||
{
|
||||
private readonly ISTKInStockService service;
|
||||
public STKInStockController(IMapper mapper, ILogger<STKInStockController> logger, ISTKInStockService Service)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
service = Service;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 外购入库信息
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Idempotent]
|
||||
public async Task<BaseResponse<object>> STKInStockSubmit([FromBody] InputBarCode<BD_BARCODERS1> request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMess = await service.STKInStockSubmit(request);
|
||||
if (retMess == null || retMess.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMess.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMess.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 外购退料信息
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Idempotent]
|
||||
public async Task<BaseResponse<object>> PURRetStockSubmit([FromBody] InputBarCode<BD_BARCODERS1> request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMess = await service.PURRetStockSubmit(request);
|
||||
if (retMess == null || retMess.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMess.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMess.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Opsoft.NetCore.O3App.Domain;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.BaseData.Model;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.Model;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.WMS
|
||||
{
|
||||
/// <summary>
|
||||
/// 库存查询
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
public class STKInventoryController : BaseApiController<SelBillController>
|
||||
{
|
||||
private readonly ISTKInventoryService service;
|
||||
public STKInventoryController(IMapper mapper, ILogger<SelBillController> logger, ISTKInventoryService Service)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
service = Service;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<Dictionary<string, object>>> QueryInventory([FromBody] JObject request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.QueryInventory(request);
|
||||
}, request);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.Model;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.WMS
|
||||
{
|
||||
/// <summary>
|
||||
/// 盘点方案
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
public class STKStockSchemeController : BaseApiController<STKStockSchemeController>
|
||||
{
|
||||
private readonly ISTKStockSchemeService service;
|
||||
public STKStockSchemeController(IMapper mapper, ILogger<STKStockSchemeController> logger, ISTKStockSchemeService STKStockSchemeService)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
service = STKStockSchemeService;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询盘点方案
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<QuerySourceInvPrgReturnDto>> QuerySourceInvPrg(STKStockScheme SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.QuerySourceInvPrg(SData);
|
||||
}, SData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 盘点方案提交
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<string>> SubmitBill([FromBody] Barcode_Inv SData)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.SubmitBill(SData);
|
||||
}, SData);
|
||||
}
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Opsoft.NetCore.O3App.Domain;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.Model;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.WMS
|
||||
{
|
||||
/// <summary>
|
||||
/// 调拨管理
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
public class STKTransferController : BaseApiController<STKTransferController>
|
||||
{
|
||||
private readonly ISTKTransferService service;
|
||||
public STKTransferController(IMapper mapper, ILogger<STKTransferController> logger, ISTKTransferService Service)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
service = Service;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> STKTransferSubmit([FromBody] InputBarCode<BD_BARCODERS2> request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMess = await service.STKTransferSubmit(request);
|
||||
if (retMess == null || retMess.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMess.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMess.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Opsoft.NetCore.O3App.Domain;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.Model;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Filters;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.WMS
|
||||
{
|
||||
/// <summary>
|
||||
/// 委外入库/委外退货
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
public class SUBInStkPickmtlController : BaseApiController<SelBillController>
|
||||
{
|
||||
private readonly ISUBInStkPickmtlService service;
|
||||
public SUBInStkPickmtlController(IMapper mapper, ILogger<SelBillController> logger, ISUBInStkPickmtlService spotcheckService)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
service = spotcheckService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 委外入库
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Idempotent]
|
||||
public async Task<BaseResponse<object>> SUBInStkPickmtl([FromBody] InputBarCode<BD_BARCODERS2> request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMess = await service.SUBInStkPickmtl(request);
|
||||
if (retMess == null || retMess.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMess.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMess.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 委外退货
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Idempotent]
|
||||
public async Task<BaseResponse<object>> SUBOutStkPickmtl([FromBody] InputBarCode<BD_BARCODERS2> request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMess = await service.SUBOutStkPickmtl(request);
|
||||
if (retMess == null || retMess.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMess.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMess.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Opsoft.NetCore.O3App.Domain;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.Model;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Filters;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.WMS
|
||||
{
|
||||
/// <summary>
|
||||
/// 委外领料/委外退料
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
public class SUBPICKMTRLController : BaseApiController<SelBillController>
|
||||
{
|
||||
private readonly ISUBPICKMTRLService service;
|
||||
public SUBPICKMTRLController(IMapper mapper, ILogger<SelBillController> logger, ISUBPICKMTRLService SUBPICKMTRLService)
|
||||
: base(mapper, logger)
|
||||
{
|
||||
service = SUBPICKMTRLService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 委外领料
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Idempotent]
|
||||
public async Task<BaseResponse<object>> SUBPICKMTRL([FromBody] InputBarCode<BD_BARCODERS2> request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMess = await service.SUBPICKMTRL(request);
|
||||
if (retMess == null || retMess.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMess.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMess.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 委外退料
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Idempotent]
|
||||
public async Task<BaseResponse<object>> SUBRETURNMTRL([FromBody] InputBarCode<BD_BARCODERS2> request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMess = await service.SUBRETURNMTRL(request);
|
||||
if (retMess == null || retMess.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMess.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMess.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+128
@@ -0,0 +1,128 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Opsoft.NetCore.O3App.Domain;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.Model;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.WMS
|
||||
{
|
||||
/// <summary>
|
||||
/// WMS基本资料信息
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
public class SelBillController : BaseApiController<SelBillController>
|
||||
{
|
||||
private readonly ISelBillService service;
|
||||
public SelBillController(IMapper mapper, ILogger<SelBillController> logger, ISelBillService Service)
|
||||
:base(mapper, logger)
|
||||
{
|
||||
service = Service;
|
||||
}
|
||||
/// <summary>
|
||||
/// 查询出入库流程配置
|
||||
/// </summary>
|
||||
/// <param name="fNO"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<List<BOS_SELBILL>>> QuerySelBill(string orgID,string fNO)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
return await service.QuerySelBill(orgID, fNO);
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 扫描源单编号,查询源单信息
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<List<object>>> QuerySourceBillInfo([FromBody]JObject data)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMess= await service.QuerySourceBillInfo(data);
|
||||
if (retMess == null || retMess.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMess.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new List<object> { retMess.Data["data1"], retMess.Data["data2"] };
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 扫描条码信息,验证条码状态
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> QueryBarCode([FromBody]JObject data)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMess = await service.QueryBarCode(data);
|
||||
if (retMess == null || retMess.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMess.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMess.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 扫描位置信息,查询仓库仓位
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> QueryStockData([FromBody] JObject data)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMess = await service.QueryStockData(data);
|
||||
if (retMess == null || retMess.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMess.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMess.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询仓库库存状态
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<BaseResponse<object>> QueryStockStatus([FromBody] JObject data)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMess = await service.QueryStockStatus(data);
|
||||
if (retMess == null || retMess.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMess.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMess.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Opsoft.NetCore.O3App.Domain;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.Model;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Filters;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Controllers.WMS
|
||||
{
|
||||
/// <summary>
|
||||
/// 简单生产领料,退料,入库
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
public class SimpleProductionController : BaseApiController<SimpleProductionController>
|
||||
{
|
||||
private readonly ISimpleProductionService _service;
|
||||
|
||||
public SimpleProductionController(IMapper mapper, ILogger<SimpleProductionController> logger, ISimpleProductionService service) : base(mapper, logger)
|
||||
{
|
||||
_service = service;
|
||||
}
|
||||
/// <summary>
|
||||
/// 简单生产领料
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Idempotent]
|
||||
public async Task<BaseResponse<Dictionary<string, object>>> SimplePickMtrl([FromBody] InputBarCode<BD_BARCODERS2> request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _service.SimplePickMtrlSubmit(request);
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data;
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
/// <summary>
|
||||
/// 简单生产退料
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Idempotent]
|
||||
public async Task<BaseResponse<object>> SimpleReturnMtrl([FromBody] InputBarCode<BD_BARCODERS2> request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _service.SimpleReturnMtrlSubmit(request);
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
/// <summary>
|
||||
/// 简单生产入库
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Idempotent]
|
||||
public async Task<BaseResponse<object>> SimpleInStock([FromBody] InputBarCode<BD_BARCODERS2> request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _service.SimpleInStockSubmit(request);
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 简单生产退库
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Idempotent]
|
||||
public async Task<BaseResponse<object>> SimpleOutStock([FromBody] InputBarCode<BD_BARCODERS2> request)
|
||||
{
|
||||
return await TryProcess(async input =>
|
||||
{
|
||||
RetMessage retMsg = await _service.SimpleOutStockSubmit(request);
|
||||
if (retMsg == null || retMsg.Status == 0)
|
||||
{
|
||||
throw new O3AppException(retMsg.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
return retMsg.Data["data"];
|
||||
}
|
||||
}, LoginInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi
|
||||
{
|
||||
public class CustomResponseHeaderMiddleware
|
||||
{
|
||||
private readonly RequestDelegate _next;
|
||||
|
||||
public CustomResponseHeaderMiddleware(RequestDelegate next)
|
||||
{
|
||||
_next = next;
|
||||
}
|
||||
|
||||
public async Task Invoke(HttpContext context)
|
||||
{
|
||||
//To add Headers AFTER everything you need to do this
|
||||
context.Response.OnStarting(state =>
|
||||
{
|
||||
var httpContext = (HttpContext)state;
|
||||
httpContext.Response.Headers.Add("Strict-Transport-Security", "max-age=31536000");
|
||||
httpContext.Response.Headers.Add("X-Content-Type-Options", "nosniff");
|
||||
httpContext.Response.Headers.Add("X-Xss-Protection", "1");
|
||||
httpContext.Response.Headers.Add("X-Frame-Options", "SAMEORIGIN");
|
||||
httpContext.Response.Headers.Add("Content-Security-Policy", "default-src 'self'");
|
||||
|
||||
//... and so on
|
||||
return Task.CompletedTask;
|
||||
}, context);
|
||||
|
||||
await _next(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Routing;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Extensions
|
||||
{
|
||||
public static class MvcOptionsExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 扩展方法
|
||||
/// </summary>
|
||||
/// <param name="opts"></param>
|
||||
/// <param name="routeAttribute"></param>
|
||||
public static void UseCentralRoutePrefix(this MvcOptions opts, IRouteTemplateProvider routeAttribute)
|
||||
{
|
||||
// 添加我们自定义 实现IApplicationModelConvention的RouteConvention
|
||||
opts.Conventions.Insert(0, new RouteConvention(routeAttribute));
|
||||
}
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi
|
||||
{
|
||||
public sealed class GlobalExceptionFilterAttribute : ExceptionFilterAttribute
|
||||
{
|
||||
public IErrorFormatter ErrorFormatter { get; }
|
||||
public ILogger Logger;
|
||||
|
||||
public GlobalExceptionFilterAttribute(
|
||||
IErrorFormatter errorFormatter,
|
||||
ILogger<GlobalExceptionFilterAttribute> logger)
|
||||
{
|
||||
ErrorFormatter = errorFormatter ?? throw new ArgumentNullException(nameof(errorFormatter));
|
||||
Logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
}
|
||||
public override Task OnExceptionAsync(ExceptionContext context)
|
||||
{
|
||||
Console.Error.WriteLine($"系统出现异常:{Environment.NewLine}{ErrorFormatter.Format(context.Exception)}");
|
||||
Logger.Error(context.Exception, ErrorFormatter.Format(context.Exception), context.ActionDescriptor.DisplayName, context.Exception.GetType().Name);
|
||||
var response = new BaseResponse() { Message = $"系统出现异常:{context.Exception.Message},请联系管理员。" };
|
||||
context.Result = new ObjectResult(response)
|
||||
{
|
||||
StatusCode = (int)System.Net.HttpStatusCode.InternalServerError
|
||||
};
|
||||
return HandleExceptionAsync(context);
|
||||
}
|
||||
|
||||
private Task HandleExceptionAsync(ExceptionContext context)
|
||||
{
|
||||
//Place your exception handling operation here.
|
||||
return base.OnExceptionAsync(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Filters
|
||||
{
|
||||
public class IdempotentAttribute : Attribute, IFilterFactory
|
||||
{
|
||||
public bool IsReusable => false;
|
||||
public IFilterMetadata CreateInstance(IServiceProvider serviceProvider)
|
||||
{
|
||||
var memoryCache = (IMemoryCache)serviceProvider.GetService(typeof(IMemoryCache));
|
||||
var filter = new IdempotentAttributeFilter(memoryCache);
|
||||
return filter;
|
||||
}
|
||||
}
|
||||
}
|
||||
+232
@@ -0,0 +1,232 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Microsoft.Extensions.Primitives;
|
||||
using Newtonsoft.Json;
|
||||
using Opsoft.Data;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.Model;
|
||||
using Opsoft.NetCore.O3App.WebApi.Models;
|
||||
using System;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using StatusCodes = Microsoft.AspNetCore.Http.StatusCodes;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Filters
|
||||
{
|
||||
public class IdempotentAttributeFilter : IActionFilter, IResultFilter, IResourceFilter
|
||||
{
|
||||
private readonly IMemoryCache _memoryCache;
|
||||
private string _idempotentKey;
|
||||
private string _idempotentBillTypeKey;
|
||||
private string _tranType;
|
||||
private string _date;
|
||||
private bool _doCheck = false;
|
||||
private const string IdempotentIpKeyHeaderName = "IdempotencyKey_IP";
|
||||
private const string IdempotentIdKeyHeaderName = "IdempotencyKey_ID";
|
||||
|
||||
public IdempotentAttributeFilter(IMemoryCache memoryCache)
|
||||
{
|
||||
_memoryCache = memoryCache;
|
||||
}
|
||||
|
||||
public void OnResultExecuted(ResultExecutedContext context)
|
||||
{
|
||||
//清除单据处理缓存
|
||||
if (!_idempotentBillTypeKey.IsNullOrEmpty() && _doCheck && _memoryCache.TryGetValue(_idempotentBillTypeKey, out string value))
|
||||
{
|
||||
_memoryCache.Remove(_idempotentBillTypeKey);
|
||||
}
|
||||
//清除唯一幂等
|
||||
if (_doCheck && _memoryCache.TryGetValue(_idempotentKey, out IdempotentCacheData cacheData))
|
||||
{
|
||||
var contextResult = JsonConvert.DeserializeObject<BaseResponse<object>>(JsonConvert.SerializeObject((context.Result as JsonResult).Value));
|
||||
if (cacheData.ProcessStatus == 2)
|
||||
{
|
||||
_memoryCache.Remove(_idempotentKey);
|
||||
}
|
||||
else if (cacheData.ProcessStatus == 1 && contextResult.StatusCode != StatusCodes.Status200OK)
|
||||
{
|
||||
_memoryCache.Remove(_idempotentKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnResultExecuting(ResultExecutingContext context)
|
||||
{
|
||||
if (_doCheck && _memoryCache.TryGetValue(_idempotentKey, out IdempotentCacheData cacheData))
|
||||
{
|
||||
var contextResult = JsonConvert.DeserializeObject<BaseResponse<object>>(JsonConvert.SerializeObject((context.Result as JsonResult).Value));
|
||||
if (cacheData.ProcessStatus == 1 && contextResult.StatusCode == StatusCodes.Status200OK)
|
||||
{
|
||||
cacheData.ProcessStatus = 2;
|
||||
cacheData.Result = contextResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnActionExecuted(ActionExecutedContext context)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnActionExecuting(ActionExecutingContext context)
|
||||
{
|
||||
if (context.HttpContext.Request.Headers.TryGetValue(IdempotentIpKeyHeaderName, out StringValues ip)
|
||||
&&
|
||||
context.HttpContext.Request.Headers.TryGetValue(IdempotentIdKeyHeaderName, out StringValues id))
|
||||
{
|
||||
_doCheck = true;
|
||||
_idempotentKey = ip + ":" + id;
|
||||
if (!_memoryCache.TryGetValue(_idempotentKey, out IdempotentCacheData cacheData))
|
||||
{
|
||||
//记录状态
|
||||
cacheData = new IdempotentCacheData
|
||||
{
|
||||
IdempotentKey = _idempotentKey,
|
||||
ProcessStatus = 1,
|
||||
Result = null
|
||||
};
|
||||
|
||||
var cacheEntryOptions = new MemoryCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromHours(1));
|
||||
_memoryCache.Set(_idempotentKey, cacheData, cacheEntryOptions);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cacheData.ProcessStatus == 1)
|
||||
{
|
||||
context.Result = new ObjectResult(new BaseResponse<object>
|
||||
{
|
||||
Success = false,
|
||||
StatusCode = StatusCodes.Status102Processing,
|
||||
Message = "提交失败!操作执行中,请勿重复提交!",
|
||||
Data = "提交失败!操作执行中,请勿重复提交!"
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (cacheData.ProcessStatus == 2)
|
||||
{
|
||||
context.Result = new ObjectResult(new BaseResponse<object>
|
||||
{
|
||||
Success = true,
|
||||
StatusCode = StatusCodes.Status200OK,
|
||||
Message = "执行成功!",
|
||||
Data = (cacheData.Result as BaseResponse<object>).Data
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnResourceExecuted(ResourceExecutedContext context)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnResourceExecuting(ResourceExecutingContext context)
|
||||
{
|
||||
//参数获取
|
||||
context.HttpContext.Request.EnableBuffering();
|
||||
context.HttpContext.Request.Body.Position = 0;
|
||||
var reader = new StreamReader(context.HttpContext.Request.Body);
|
||||
string body = reader.ReadToEnd();
|
||||
context.HttpContext.Request.Body.Position = 0;
|
||||
//获取传递的参数
|
||||
InputBarCode<object> inputData = JsonConvert.DeserializeObject<InputBarCode<object>>(body);
|
||||
if (inputData != null)
|
||||
{
|
||||
_tranType = inputData.TranType;
|
||||
_date = inputData.FDate;
|
||||
}
|
||||
if (_date.IsNullOrEmpty())
|
||||
{
|
||||
_date = DateTime.Now.ToString("yyyy/MM/dd");
|
||||
}
|
||||
|
||||
//关帐、月结限制
|
||||
string token = context.HttpContext.Request.Headers["Authorization"].ToStringEx().Substring(7);
|
||||
JwtSecurityToken jwtToken = new JwtSecurityTokenHandler().ReadJwtToken(token);
|
||||
var userId = jwtToken.Claims.First(o => o.Type == ClaimTypes.Name).Value;
|
||||
dynamic temType = JsonConvert.DeserializeObject<dynamic>(jwtToken.Claims.First(o => o.Type == ClaimTypes.UserData).Value);
|
||||
string dbAias = temType.DBaias;
|
||||
using APPServerContext dbContext = new APPServerContext(dbAias, userId);
|
||||
var closeAccountTable = dbContext.Database.SqlQuery(
|
||||
@"SELECT T01.FDATE
|
||||
FROM T_STK_CLOSEACCOUNTENTRY T01
|
||||
LEFT JOIN T_STK_CLOSEACCOUNT T02 ON T01.FINTERID = T02.FINTERID
|
||||
WHERE UPPER(T02.FBILLNO)='STK_CLOSEACCOUNT' AND T01.FBILLTYPE='A'");
|
||||
if (closeAccountTable != null && closeAccountTable.Rows.Count > 0)
|
||||
{
|
||||
if (Convert.ToDateTime(_date).ToString("yyyyMMdd").ToInt() <= Convert.ToDateTime(closeAccountTable.Rows[0]["FDATE"]).ToString("yyyyMMdd").ToInt())
|
||||
{
|
||||
context.Result = new ObjectResult(new BaseResponse<object>
|
||||
{
|
||||
Success = false,
|
||||
StatusCode = StatusCodes.Status403Forbidden,
|
||||
Message = "现已关账,当前单据提交失败!",
|
||||
Data = "现已关账,当前单据提交失败!"
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var settleMonthTable =
|
||||
dbContext.Database.SqlQuery(
|
||||
"SELECT FYEAR,FPERIOD FROM T_GL_CLOSEACCOUNT ORDER BY FYEAR DESC,FPERIOD DESC");
|
||||
if (settleMonthTable != null && settleMonthTable.Rows.Count > 0)
|
||||
{
|
||||
var closeYear = settleMonthTable.Rows[0]["FYEAR"].ToInt32();
|
||||
var closeMonth = settleMonthTable.Rows[0]["FPERIOD"].ToInt32();
|
||||
if (Convert.ToDateTime(_date).Year < closeYear)
|
||||
{
|
||||
context.Result = new ObjectResult(new BaseResponse<object>
|
||||
{
|
||||
Success = false,
|
||||
StatusCode = StatusCodes.Status403Forbidden,
|
||||
Message = "已月结,当前单据提交失败!",
|
||||
Data = "已月结,当前单据提交失败!"
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (Convert.ToDateTime(_date).Year == closeYear)
|
||||
{
|
||||
if (Convert.ToDateTime(_date).Month <= closeMonth)
|
||||
{
|
||||
context.Result = new ObjectResult(new BaseResponse<object>
|
||||
{
|
||||
Success = false,
|
||||
StatusCode = StatusCodes.Status403Forbidden,
|
||||
Message = "已月结,当前单据提交失败!",
|
||||
Data = "已月结,当前单据提交失败!"
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (context.HttpContext.Request.Headers.TryGetValue(IdempotentIpKeyHeaderName, out StringValues ip)
|
||||
&&
|
||||
context.HttpContext.Request.Headers.TryGetValue(IdempotentIdKeyHeaderName, out StringValues id))
|
||||
{
|
||||
_idempotentBillTypeKey = ip + ":" + _tranType;
|
||||
|
||||
//判断是否重复提交
|
||||
if (_memoryCache.TryGetValue(_idempotentBillTypeKey, out string value))
|
||||
{
|
||||
context.Result = new ObjectResult(new BaseResponse<object>
|
||||
{
|
||||
Success = false,
|
||||
StatusCode = StatusCodes.Status102Processing,
|
||||
Message = "提交失败!当前设备有未处理完成的当前单据,请勿重复提交!",
|
||||
Data = "提交失败!当前设备有未处理完成的当前单据,请勿重复提交!"
|
||||
});
|
||||
return;
|
||||
}
|
||||
_memoryCache.Set(_idempotentBillTypeKey, _idempotentBillTypeKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi
|
||||
{
|
||||
public class ResultConvertFilterAttribute : ActionFilterAttribute
|
||||
{
|
||||
public override void OnActionExecuted(ActionExecutedContext context)
|
||||
{
|
||||
if (context.Result is ObjectResult)
|
||||
{
|
||||
context.Result = new JsonResult((context.Result as ObjectResult).Value);
|
||||
}
|
||||
base.OnActionExecuted(context);
|
||||
}
|
||||
public override void OnResultExecuting(ResultExecutingContext context)
|
||||
{
|
||||
if (context.Result is ObjectResult)
|
||||
{
|
||||
context.Result = new JsonResult((context.Result as ObjectResult).Value);
|
||||
}
|
||||
base.OnResultExecuting(context);
|
||||
}
|
||||
public override Task OnResultExecutionAsync(ResultExecutingContext context, ResultExecutionDelegate next)
|
||||
{
|
||||
if (context.Result is ObjectResult)
|
||||
{
|
||||
context.Result = new JsonResult((context.Result as ObjectResult).Value);
|
||||
}
|
||||
return base.OnResultExecutionAsync(context, next);
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"LastVersion": {
|
||||
"version": "1.0.3",
|
||||
"downloadIOSUrl": "http://127.0.0.1/APPServer/wmsapp.1.0.3.wgt",
|
||||
"downloadAndroidUrl": "http://127.0.0.1/APPServer/wmsapp.1.0.3.wgt"
|
||||
}
|
||||
}
|
||||
Executable
+45
@@ -0,0 +1,45 @@
|
||||
using Opsoft.NetCore.O3App.Domain;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using System;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Models
|
||||
{
|
||||
public class BaseResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否成功
|
||||
/// </summary>
|
||||
public bool Success { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 信息
|
||||
/// </summary>
|
||||
public string Message { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 错误码
|
||||
/// </summary>
|
||||
public int StatusCode { get; set; }
|
||||
|
||||
public BaseResponse() { }
|
||||
|
||||
public BaseResponse(Enum statusCode)
|
||||
{
|
||||
StatusCode = statusCode.ToInt32();
|
||||
Message = statusCode.GetDesc();
|
||||
Success = StatusCode == StatusCodes.OK.ToInt32();
|
||||
}
|
||||
}
|
||||
|
||||
public class BaseResponse<T> : BaseResponse
|
||||
{
|
||||
public BaseResponse() { }
|
||||
|
||||
public BaseResponse(Enum statusCode) : base(statusCode) { }
|
||||
|
||||
/// <summary>
|
||||
/// 数据对象
|
||||
/// </summary>
|
||||
public T Data { get; set; }
|
||||
}
|
||||
}
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Model
|
||||
{
|
||||
public class CVersionIno
|
||||
{
|
||||
public string version { get; set; }
|
||||
}
|
||||
public class LastVersion
|
||||
{
|
||||
public string version { get; set; }
|
||||
public string downloadIOSUrl { get; set; }
|
||||
public string downloadAndroidUrl { get; set; }
|
||||
}
|
||||
}
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Models
|
||||
{
|
||||
public class IdempotentCacheData
|
||||
{
|
||||
/// <summary>
|
||||
/// 缓存Key
|
||||
/// </summary>
|
||||
public string IdempotentKey { get; set; }
|
||||
/// <summary>
|
||||
/// 处理状态 1=处理中;2=处理完成
|
||||
/// </summary>
|
||||
public int ProcessStatus { get; set; }
|
||||
/// <summary>
|
||||
/// 处理结果
|
||||
/// </summary>
|
||||
public object Result { get; set; }
|
||||
/// <summary>
|
||||
/// 成功结果是否被缓存
|
||||
/// </summary>
|
||||
public bool IsOkResultCached { get; set; }
|
||||
|
||||
public IdempotentCacheData()
|
||||
{
|
||||
ProcessStatus = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+56
@@ -0,0 +1,56 @@
|
||||
using Microsoft.AspNetCore.Mvc.ApplicationModels;
|
||||
using Microsoft.AspNetCore.Mvc.Routing;
|
||||
using System.Linq;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// 全局路由前缀配置
|
||||
/// </summary>
|
||||
public class RouteConvention : IApplicationModelConvention
|
||||
{
|
||||
/// <summary>
|
||||
/// 定义一个路由前缀变量
|
||||
/// </summary>
|
||||
private readonly AttributeRouteModel _centralPrefix;
|
||||
/// <summary>
|
||||
/// 调用时传入指定的路由前缀
|
||||
/// </summary>
|
||||
/// <param name="routeTemplateProvider"></param>
|
||||
public RouteConvention(IRouteTemplateProvider routeTemplateProvider)
|
||||
{
|
||||
_centralPrefix = new AttributeRouteModel(routeTemplateProvider);
|
||||
}
|
||||
|
||||
//接口的Apply方法
|
||||
public void Apply(ApplicationModel application)
|
||||
{
|
||||
//遍历所有的 Controller
|
||||
foreach (var controller in application.Controllers)
|
||||
{
|
||||
// 1、已经标记了 RouteAttribute 的 Controller
|
||||
//这一块需要注意,如果在控制器中已经标注有路由了,则会在路由的前面再添加指定的路由内容。
|
||||
var matchedSelectors = controller.Selectors.Where(x => x.AttributeRouteModel != null).ToList();
|
||||
if (matchedSelectors.Any())
|
||||
{
|
||||
foreach (var selectorModel in matchedSelectors)
|
||||
{
|
||||
// 在 当前路由上 再 添加一个 路由前缀
|
||||
selectorModel.AttributeRouteModel = AttributeRouteModel.CombineAttributeRouteModel(_centralPrefix, selectorModel.AttributeRouteModel);
|
||||
}
|
||||
}
|
||||
|
||||
//2、 没有标记 RouteAttribute 的 Controller
|
||||
var unmatchedSelectors = controller.Selectors.Where(x => x.AttributeRouteModel == null).ToList();
|
||||
if (unmatchedSelectors.Any())
|
||||
{
|
||||
foreach (var selectorModel in unmatchedSelectors)
|
||||
{
|
||||
// 添加一个 路由前缀
|
||||
selectorModel.AttributeRouteModel = _centralPrefix;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi.Model
|
||||
{
|
||||
public class TokenManagement
|
||||
{
|
||||
[JsonProperty("secret")]
|
||||
public string Secret { get; set; }
|
||||
|
||||
[JsonProperty("issuer")]
|
||||
public string Issuer { get; set; }
|
||||
|
||||
[JsonProperty("audience")]
|
||||
public string Audience { get; set; }
|
||||
|
||||
[JsonProperty("accessExpiration")]
|
||||
public int AccessExpiration { get; set; }
|
||||
|
||||
[JsonProperty("refreshExpiration")]
|
||||
public int RefreshExpiration { get; set; }
|
||||
}
|
||||
}
|
||||
Executable
+95
@@ -0,0 +1,95 @@
|
||||
using Microsoft.AspNetCore;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Opsoft.NetCore.O3App.Infrastructure;
|
||||
using Serilog;
|
||||
using Serilog.Events;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
ThreadPool.GetMaxThreads(out var workerThreads, out var ioThreads);
|
||||
Console.WriteLine("MaxThreads \t workerThreads:{0} \t ioThreads:{1}", workerThreads, ioThreads);
|
||||
ThreadPool.GetMinThreads(out workerThreads, out ioThreads);
|
||||
workerThreads *= 8;
|
||||
ioThreads *= 8;
|
||||
ThreadPool.SetMinThreads(workerThreads, ioThreads);
|
||||
Console.WriteLine("MinThreads \t workerThreads:{0} \t ioThreads:{1}", workerThreads, ioThreads);
|
||||
|
||||
var builder = new HostBuilder();
|
||||
builder.ConfigureWebHostDefaults(webBuilder =>
|
||||
{
|
||||
webBuilder
|
||||
.ConfigureServices(ServiceRegister.RegisteServices)
|
||||
.ConfigureAppConfiguration(ConfigureAppConfiguration)
|
||||
.UseSerilog(UseSkynetLogger)
|
||||
//.UseDefaultServiceProvider((context, options) => options.ValidateScopes = context.HostingEnvironment.IsDevelopment())
|
||||
.UseStartup<Startup>();
|
||||
});
|
||||
builder
|
||||
//.ConfigureEnvironment()
|
||||
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||
//.UseServiceDegradation()
|
||||
;
|
||||
|
||||
builder.Build().Run();
|
||||
|
||||
//WebHost.CreateDefaultBuilder(args)
|
||||
// .ConfigureServices(s => s.AddHostedService<TurboMQConsumerHostService>())
|
||||
// .UseDaokeEnvironment()
|
||||
// .UseApm()
|
||||
// .UseContentRoot(Directory.GetCurrentDirectory())
|
||||
// .UseKestrel()
|
||||
// .ConfigureAppConfiguration(ConfigureAppConfiguration)
|
||||
// .ConfigureServices(ServiceRegister.RegisteServices)
|
||||
// .UseDefaultServiceProvider((context, options) => options.ValidateScopes = context.HostingEnvironment.IsDevelopment())
|
||||
// .UseHealthCheck(HealthStatus.Online)
|
||||
// .UseSerilog(UseSkynetLogger)
|
||||
// .UseStartup<Startup>()
|
||||
// .Build()
|
||||
// .Run();
|
||||
}
|
||||
|
||||
private static void UseSkynetLogger(WebHostBuilderContext context, LoggerConfiguration configuration)
|
||||
{
|
||||
string logPath = $"/data/logs/skynet-{context.HostingEnvironment.EnvironmentName}/logs/app.log";
|
||||
long? fileSizeLimitBytes = 104857600;
|
||||
bool buffered = false;
|
||||
bool shared = true;
|
||||
TimeSpan? flushToDiskInterval = null;
|
||||
bool rollOnFileSizeLimit = true;
|
||||
int? retainedFileCountLimit = 640;
|
||||
configuration
|
||||
.MinimumLevel.Verbose()
|
||||
.MinimumLevel.Override(nameof(System), LogEventLevel.Error)
|
||||
.MinimumLevel.Override(nameof(Microsoft), LogEventLevel.Error);
|
||||
configuration.Filter.With(new SkynetLoggerFilter(context.Configuration));
|
||||
configuration.Enrich.With(new SkynetEnricher())
|
||||
.WriteTo.File(new SkynetLoggerFormatter(), logPath, LogEventLevel.Verbose,
|
||||
fileSizeLimitBytes, null, buffered, shared,
|
||||
flushToDiskInterval, RollingInterval.Day, rollOnFileSizeLimit,
|
||||
retainedFileCountLimit);
|
||||
}
|
||||
|
||||
private static void ConfigureAppConfiguration(WebHostBuilderContext context, IConfigurationBuilder builder)
|
||||
{
|
||||
var env = context.HostingEnvironment.EnvironmentName;
|
||||
builder
|
||||
.AddEnvironmentVariables()
|
||||
.SetBasePath(Directory.GetCurrentDirectory())
|
||||
.AddJsonFile($"appsettings.json", optional: false, reloadOnChange: true)
|
||||
.AddJsonFile($"appsettings.{env}.json", optional: true, reloadOnChange: true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<DeleteExistingFiles>true</DeleteExistingFiles>
|
||||
<ExcludeApp_Data>false</ExcludeApp_Data>
|
||||
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
|
||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||
<PublishProvider>FileSystem</PublishProvider>
|
||||
<PublishUrl>D:\AppTest</PublishUrl>
|
||||
<WebPublishMethod>FileSystem</WebPublishMethod>
|
||||
<SiteUrlToLaunchAfterPublish />
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<ProjectGuid>175404a8-1628-46eb-a094-e5948238693c</ProjectGuid>
|
||||
<SelfContained>false</SelfContained>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
此文件由 Web 项目的发布/打包过程使用。可以通过编辑此 MSBuild 文件
|
||||
自定义此过程的行为。为了解与此相关的更多内容,请访问 https://go.microsoft.com/fwlink/?LinkID=208121。
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<_PublishTargetUrl>D:\AppTest</_PublishTargetUrl>
|
||||
<History>True|2025-08-27T01:32:02.7764641Z||;True|2025-08-27T09:19:59.3218303+08:00||;True|2023-07-06T14:13:32.5588452+08:00||;True|2023-07-05T17:17:51.7828702+08:00||;True|2023-06-30T16:45:27.1633519+08:00||;True|2023-06-30T16:25:21.2592942+08:00||;True|2023-06-27T14:24:58.2923186+08:00||;True|2023-06-17T09:22:15.7349585+08:00||;True|2023-06-13T17:03:10.3121624+08:00||;True|2023-06-02T16:48:02.2109057+08:00||;True|2023-05-25T14:34:18.5208997+08:00||;True|2023-05-19T11:15:26.5002883+08:00||;</History>
|
||||
<LastFailureDetails />
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<DeleteExistingFiles>False</DeleteExistingFiles>
|
||||
<ExcludeApp_Data>False</ExcludeApp_Data>
|
||||
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
|
||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||
<PublishProvider>FileSystem</PublishProvider>
|
||||
<PublishUrl>C:\Users\Administrator\Desktop\部署\Publish</PublishUrl>
|
||||
<WebPublishMethod>FileSystem</WebPublishMethod>
|
||||
<SiteUrlToLaunchAfterPublish />
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<ProjectGuid>175404a8-1628-46eb-a094-e5948238693c</ProjectGuid>
|
||||
<SelfContained>false</SelfContained>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<DeleteExistingFiles>false</DeleteExistingFiles>
|
||||
<ExcludeApp_Data>false</ExcludeApp_Data>
|
||||
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
|
||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||
<PublishProvider>FileSystem</PublishProvider>
|
||||
<PublishUrl>\\10.6.29.1\O3CoreApi</PublishUrl>
|
||||
<WebPublishMethod>FileSystem</WebPublishMethod>
|
||||
<SiteUrlToLaunchAfterPublish />
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<ProjectGuid>175404a8-1628-46eb-a094-e5948238693c</ProjectGuid>
|
||||
<SelfContained>false</SelfContained>
|
||||
<PublishReadyToRun>false</PublishReadyToRun>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "O3/v1/service/index",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"WebApi": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "O3/v1/service/index",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "http://127.0.0.1:5000"
|
||||
}
|
||||
},
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://127.0.0.1:5000/",
|
||||
"sslPort": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
using AutoMapper;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Opsoft.NetCore.O3App
|
||||
{
|
||||
public static class ServiceRegister
|
||||
{
|
||||
public static void RegisteServices(WebHostBuilderContext builderContext, IServiceCollection services)
|
||||
{
|
||||
var @namespace = typeof(ServiceRegister).Namespace;
|
||||
var rootPath = Path.GetDirectoryName(typeof(ServiceRegister).Assembly.Location);
|
||||
var rootDir = new DirectoryInfo(rootPath);
|
||||
var dllFiles = rootDir.EnumerateFiles("*.dll", SearchOption.TopDirectoryOnly);
|
||||
Console.WriteLine($"Finded DllFiles: \n\t{string.Join("\n\t", dllFiles)}");
|
||||
var localAssemblies = (from file in dllFiles where file.Name.StartsWith(@namespace) || file.Name.StartsWith("opsoft", StringComparison.CurrentCultureIgnoreCase) select Assembly.LoadFrom(file.FullName));
|
||||
foreach (var assembly in localAssemblies)
|
||||
{
|
||||
services.AddEnumerable(builderContext, assembly);
|
||||
}
|
||||
services.AddSingleton<IConfigurationProvider>(new MapperConfiguration(cfg => cfg.AddMaps(localAssemblies)));
|
||||
services.AddSingleton<IMapper>(sp => new Mapper(sp.GetRequiredService<IConfigurationProvider>(), sp.GetService));
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+203
@@ -0,0 +1,203 @@
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.Features;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Opsoft.NetCore.O3App.Infrastructure;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.Shared.Extensions;
|
||||
using Opsoft.NetCore.O3App.WebApi.Extensions;
|
||||
using Opsoft.NetCore.O3App.WebApi.Model;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.WebApi
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
private IServiceCollection _services;
|
||||
public IConfiguration Configuration { get; }
|
||||
|
||||
public Startup(IConfiguration configuration)
|
||||
{
|
||||
Configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
|
||||
}
|
||||
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
//后面配置为 所有 控制器转 Json 时不改变 属性的 大小写
|
||||
services.AddControllers().AddJsonOptions(opt => { opt.JsonSerializerOptions.PropertyNamingPolicy = null; });
|
||||
services.Configure<FormOptions>(options =>
|
||||
{
|
||||
// Set the limit to 256 MB
|
||||
options.MultipartBodyLengthLimit = 1024 * 1024 * 2000;
|
||||
options.MultipartHeadersCountLimit = 10;
|
||||
});
|
||||
//Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead
|
||||
services.Configure<KestrelServerOptions>(options =>
|
||||
{
|
||||
options.AllowSynchronousIO = true;
|
||||
});
|
||||
services.Configure<IISServerOptions>(options =>
|
||||
{
|
||||
options.AllowSynchronousIO = true;
|
||||
});
|
||||
|
||||
services.Configure<TokenManagement>(Configuration.GetSection("tokenManagement"));
|
||||
var token = Configuration.GetSection("tokenManagement").Get<TokenManagement>();
|
||||
services.AddAuthentication(opt =>
|
||||
{
|
||||
opt.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||
opt.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||
})
|
||||
.AddJwtBearer(con =>
|
||||
{
|
||||
con.RequireHttpsMetadata = false;
|
||||
con.SaveToken = true;
|
||||
con.TokenValidationParameters = new TokenValidationParameters
|
||||
{
|
||||
ValidateIssuerSigningKey = true,
|
||||
IssuerSigningKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(token.Secret)),
|
||||
ValidIssuer = token.Issuer,
|
||||
ValidAudience = token.Audience,
|
||||
ValidateIssuer = false,
|
||||
ValidateAudience = false
|
||||
};
|
||||
});
|
||||
services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy("any", builder =>
|
||||
{
|
||||
builder.AllowAnyMethod()
|
||||
.SetIsOriginAllowed(_ => true)
|
||||
.AllowAnyHeader()
|
||||
.AllowCredentials();
|
||||
});
|
||||
});
|
||||
services.AddAntiforgery(o => o.SuppressXFrameOptionsHeader = false);
|
||||
services
|
||||
.AddOptions()
|
||||
.AddLogging(config => config.AddConfiguration(Configuration.GetSection("Logging")).AddConsole().AddDebug())
|
||||
.AddHttpClient()
|
||||
.AddCustomHttpClient()
|
||||
.AddSkynetLogger()
|
||||
.AddTraceId()
|
||||
.AddMvc(opt =>
|
||||
{
|
||||
opt.UseCentralRoutePrefix(new RouteAttribute("O3/v1/[controller]/[action]"));
|
||||
opt.Filters.Add<GlobalExceptionFilterAttribute>();
|
||||
opt.Filters.Add<ResultConvertFilterAttribute>();
|
||||
})
|
||||
.AddNewtonsoftJson(options =>
|
||||
{
|
||||
options.SerializerSettings.DateFormatString = Constants.DateTimeFormats.DateTime;
|
||||
options.SerializerSettings.ContractResolver = new DefaultContractResolver();
|
||||
});
|
||||
|
||||
services.AddScoped<IAuthenticateService, TokenAuthenticationService>();
|
||||
services.AddScoped<IUserService, UserService>();
|
||||
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
||||
//services.AddSwaggerGen(c =>
|
||||
// {
|
||||
// c.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo { Title = "O3App API", Version = "v1" });
|
||||
// c.CustomSchemaIds(s => s.FullName);
|
||||
// });
|
||||
|
||||
#region 缓存处理
|
||||
//启用MemoryCache缓存
|
||||
/*基础数据部分缓存时间为20分钟
|
||||
*汇报的数据默认添加60分钟的缓存
|
||||
*/
|
||||
services.AddMemoryCache();
|
||||
#endregion
|
||||
|
||||
_services = services;
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
ListAllRegisteredServices(app);
|
||||
app.UseTraceId();
|
||||
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
}
|
||||
|
||||
//配置HttpContext
|
||||
app.UseStaticHttpContext();
|
||||
app.UseMiddleware(typeof(CustomResponseHeaderMiddleware));
|
||||
//app.UseSwagger();
|
||||
//app.UseSwaggerUI(c =>
|
||||
//{
|
||||
// c.SwaggerEndpoint("/swagger/v1/swagger.json", "O3App API V1");
|
||||
// c.RoutePrefix = string.Empty;
|
||||
//});
|
||||
|
||||
//启用验证
|
||||
app.UseAuthentication();
|
||||
|
||||
app.UsePathBase(new PathString(Constants.RoutePrefix));
|
||||
app.UseRouting();
|
||||
|
||||
app.UseCors("any");
|
||||
//app.UseHttpsRedirection();
|
||||
app.UseAuthorization();
|
||||
|
||||
app.UseStaticFiles(new StaticFileOptions
|
||||
{
|
||||
ServeUnknownFileTypes = true,
|
||||
FileProvider = new PhysicalFileProvider(
|
||||
Path.Combine(Directory.GetCurrentDirectory(), "wwwroot")),//wwwroot相当于真实目录
|
||||
RequestPath = new PathString("/src") //src相当于别名,为了安全
|
||||
});
|
||||
app.UseDirectoryBrowser();
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapControllerRoute(name: "default", pattern: "{controller=Service}/{action=Index}");
|
||||
});
|
||||
|
||||
app.Use(next => new RequestDelegate(
|
||||
async context =>
|
||||
{
|
||||
context.Request.EnableBuffering();
|
||||
await next(context);
|
||||
}
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
private void ListAllRegisteredServices(IApplicationBuilder app)
|
||||
{
|
||||
app.Map($"{Constants.RoutePrefix}/allservices", builder => builder.Run(async context =>
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("<h1>All Services</h1>");
|
||||
sb.Append("<table><thead>");
|
||||
sb.Append("<tr><th>Type</th><th>Lifetime</th><th>Instance</th></tr>");
|
||||
sb.Append("</thead><tbody>");
|
||||
foreach (var svc in _services)
|
||||
{
|
||||
sb.Append("<tr>");
|
||||
sb.Append($"<td>{svc.ServiceType.FullName}</td>");
|
||||
sb.Append($"<td>{svc.Lifetime}</td>");
|
||||
sb.Append($"<td>{svc.ImplementationType?.FullName}</td>");
|
||||
sb.Append("</tr>");
|
||||
}
|
||||
sb.Append("</tbody></table>");
|
||||
await context.Response.WriteAsync(sb.ToString());
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+6110
File diff suppressed because it is too large.
Load diff
Binary file not shown.
|
After Width: | Height: | Size: 36 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 36 KiB |
Binary file not shown.
Executable
+35
@@ -0,0 +1,35 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<AssemblyName>Opsoft.NetCore.O3App.WebApi</AssemblyName>
|
||||
<RootNamespace>Opsoft.NetCore.O3App.WebApi</RootNamespace>
|
||||
<UserSecretsId>aeddbf20-a8a9-4ce7-aee1-854285cb423d</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.15" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.15" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="Opsoft.Data" Version="0.1.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.1.4" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.1.4" />
|
||||
<PackageReference Include="System.Management" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Domain\Domain.csproj" />
|
||||
<ProjectReference Include="..\Infrastructure\Infrastructure.csproj" />
|
||||
<ProjectReference Include="..\Repositories\Repositories.csproj" />
|
||||
<ProjectReference Include="..\Services\Services.csproj" />
|
||||
<ProjectReference Include="..\Shared\Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Controllers\FixedAssets\" />
|
||||
<Folder Include="Controllers\QualityTest\" />
|
||||
<Folder Include="Controllers\TVBoard\" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
</Project>
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<NameOfLastUsedPublishProfile>FolderProfile</NameOfLastUsedPublishProfile>
|
||||
<ActiveDebugProfile>WebApi</ActiveDebugProfile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"ConnectionStrings": {
|
||||
"PDAServerContext": "Server=(localdb)\\mssqllocaldb;Database=PDAServerContext-2edf0b95-ae4f-4a14-ac56-6c32f0ad5504;Trusted_Connection=True;MultipleActiveResultSets=true"
|
||||
},
|
||||
"tokenManagement": {
|
||||
"secret": "123456123456123456",
|
||||
"issuer": "webapi.cn",
|
||||
"audience": "WebApi",
|
||||
"accessExpiration": 3000,
|
||||
"refreshExpiration": 60
|
||||
}
|
||||
}
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"ConnectionStrings": {
|
||||
"PDAServerContext": "Server=(localdb)\\mssqllocaldb;Database=PDAServerContext-2edf0b95-ae4f-4a14-ac56-6c32f0ad5504;Trusted_Connection=True;MultipleActiveResultSets=true"
|
||||
},
|
||||
"tokenManagement": {
|
||||
"secret": "123456123456123456",
|
||||
"issuer": "webapi.cn",
|
||||
"audience": "WebApi",
|
||||
"accessExpiration": 3000,
|
||||
"refreshExpiration": 60
|
||||
},
|
||||
"Log4Net": {
|
||||
"RepositoryName": "NETCoreRepository",
|
||||
"ConfigFilePath": "log4net.config"
|
||||
}
|
||||
}
|
||||
Executable
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"LastVersion": {
|
||||
"version": "1.0.3",
|
||||
"downloadIOSUrl": "http://127.0.0.1/APPServer/wmsapp.1.0.3.wgt",
|
||||
"downloadAndroidUrl": "http://127.0.0.1/APPServer/wmsapp.1.0.3.wgt"
|
||||
}
|
||||
}
|
||||
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Loaded 100 of 6522 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user