baseline: 小军 WMS 二开代码原始快照(含 SynOABusiness.cs Debugger.Break)
This commit is contained in:
commit
c2b0e7be0d
6522 files changed
+3530643
No files matched your search
+476
@@ -0,0 +1,476 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Opsoft.NetCore.O3App.Domain;
|
||||
using Opsoft.NetCore.O3App.Domain.Interface;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.IPadReport.IRepositories;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.IPadReport.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.IPadReport.Model;
|
||||
using Opsoft.Data;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using Opsoft.NetCore.O3App.Services.CommonFunction;
|
||||
using System.Linq;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.Services.IPadReport
|
||||
{
|
||||
[MapTo(typeof(IInspectionService), ServiceLifetime.Transient)]
|
||||
public class InspectionService : ServiceBase<BaseEntity, IInspectionRepository>, IInspectionService
|
||||
{
|
||||
public InspectionService(IInspectionRepository repository) : base(repository)
|
||||
{
|
||||
Init(repository);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 工序首检列表接口(状态查询:已完成、未完成)
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<object>> GetFirstInspection(GetFirstInspection SData)
|
||||
{
|
||||
if (SData.Resource == null)
|
||||
{
|
||||
throw new O3AppException( "传参信息错误,资源未定义",400);
|
||||
}
|
||||
if (SData.Page == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,页数未定义",400);
|
||||
}
|
||||
if (SData.Size== null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,页显示数量未定义",400);
|
||||
}
|
||||
if (SData.Status == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,状态未定义",400);
|
||||
}
|
||||
return await (repository as IInspectionRepository).GetFirstInspection(SData);
|
||||
}
|
||||
|
||||
|
||||
public async Task<object> GetFirstInspections(GetFirstInspection SData)
|
||||
{
|
||||
if (SData.Resource == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,资源未定义", 400);
|
||||
}
|
||||
if (SData.Page == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,页数未定义", 400);
|
||||
}
|
||||
if (SData.Size == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,页显示数量未定义", 400);
|
||||
}
|
||||
if (SData.Status == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,状态未定义", 400);
|
||||
}
|
||||
return await(repository as IInspectionRepository).GetFirstInspections(SData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 首检数据保存
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> SaveFirstInspection(SaveFirstInspection SData)
|
||||
{
|
||||
if (SData.FInterID == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,单据内码未定义",400);
|
||||
}
|
||||
if (SData.FTestType == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,检验方式未定义", 400);
|
||||
}
|
||||
if (SData.FQty.ToString() == "")
|
||||
{
|
||||
throw new O3AppException("传参信息错误,检验数量未定义", 400);
|
||||
}
|
||||
if (SData.FCount.ToString() == "")
|
||||
{
|
||||
throw new O3AppException("传参信息错误,送检数量未定义", 400);
|
||||
}
|
||||
if (SData.FAcceptQty.ToString() == "")
|
||||
{
|
||||
throw new O3AppException("传参信息错误,合格数量未定义", 400);
|
||||
}
|
||||
if (SData.FUnAcceptQty.ToString() == "")
|
||||
{
|
||||
throw new O3AppException("传参信息错误,不合格数量未定义", 400);
|
||||
}
|
||||
if (SData.FTestResult == 0)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,检验结果未定义", 400);
|
||||
}
|
||||
return await (repository as IInspectionRepository).SaveFirstInspection(SData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 工序巡检列表接口(状态查询:已完成、未完成)
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<object>> GetProcessInspection(GetFirstInspection SData)
|
||||
{
|
||||
if (SData.Resource == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,资源未定义", 400);
|
||||
}
|
||||
if (SData.Page == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,页数未定义", 400);
|
||||
}
|
||||
if (SData.Size == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,页显示数量未定义", 400);
|
||||
}
|
||||
if (SData.Status == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,状态未定义", 400);
|
||||
}
|
||||
return await (repository as IInspectionRepository).GetProcessInspection(SData);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 工序巡检列表接口(状态查询:已完成、未完成)
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<object> GetProcessInspections(GetFirstInspection SData)
|
||||
{
|
||||
if (SData.Resource == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,资源未定义", 400);
|
||||
}
|
||||
if (SData.Page == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,页数未定义", 400);
|
||||
}
|
||||
if (SData.Size == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,页显示数量未定义", 400);
|
||||
}
|
||||
if (SData.Status == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,状态未定义", 400);
|
||||
}
|
||||
return await (repository as IInspectionRepository).GetProcessInspections(SData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 巡检条码扫入验证获取数据
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<object> ScanProcessCode(ScanProcessCode SData)
|
||||
{
|
||||
if (SData.Barcode == null)
|
||||
{
|
||||
throw new O3AppException("请先扫描条码!", 400);
|
||||
}
|
||||
if (SData.Barcode== "")
|
||||
{
|
||||
throw new O3AppException("扫入条码不能为空!!", 400);
|
||||
}
|
||||
return await (repository as IInspectionRepository).ScanProcessCode(SData);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 巡检数据保存
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<object> SaveProcessInspection(SaveProcessInspection SData)
|
||||
{
|
||||
if (SData.FInterID == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,单据内码未定义", 400);
|
||||
}
|
||||
if (SData.FTestType.ToString() == "")
|
||||
{
|
||||
throw new O3AppException("传参信息错误,检验方式未定义", 400);
|
||||
}
|
||||
if (SData.FQty.ToString() == "")
|
||||
{
|
||||
throw new O3AppException("传参信息错误,检验数量未定义", 400);
|
||||
}
|
||||
if (SData.FCount.ToString() == "")
|
||||
{
|
||||
throw new O3AppException("传参信息错误,送检数量未定义", 400);
|
||||
}
|
||||
if (SData.FAcceptQty.ToString() == "")
|
||||
{
|
||||
throw new O3AppException("传参信息错误,合格数量未定义", 400);
|
||||
}
|
||||
if (SData.FUnAcceptQty.ToString() == "")
|
||||
{
|
||||
throw new O3AppException("传参信息错误,不合格数量未定义", 400);
|
||||
}
|
||||
if (SData.FTestResult.IsNullOrEmpty())
|
||||
{
|
||||
throw new O3AppException("传参信息错误,检验结果未定义或检验结果未选择", 400);
|
||||
}
|
||||
//新增状态验证一下参数
|
||||
if (string.IsNullOrEmpty(SData.FInterID))
|
||||
{
|
||||
if (SData.FUnitID == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,单位码未定义", 400);
|
||||
}
|
||||
if (SData.FMaterialID == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,物料码未定义", 400);
|
||||
}
|
||||
|
||||
if (SData.FProcessID == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,工序码未定义", 400);
|
||||
}
|
||||
if (SData.FFlowCardID == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,工序流转卡内码未定义", 400);
|
||||
}
|
||||
if (SData.FCode == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,工序识别码未定义", 400);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SData.FTestType.ToString()=="")
|
||||
{
|
||||
throw new O3AppException("检验方式为空",400);
|
||||
}
|
||||
if (SData.FQty.ToString()=="")
|
||||
{
|
||||
throw new O3AppException("检验数量为空",400);
|
||||
}
|
||||
if (SData.FCount.ToString()=="")
|
||||
{
|
||||
throw new O3AppException("送检数量为空",400);
|
||||
}
|
||||
if (SData.FAcceptQty.ToString()=="")
|
||||
{
|
||||
throw new O3AppException("合格数量为空",400);
|
||||
}
|
||||
}
|
||||
return await (repository as IInspectionRepository).SaveProcessInspection(SData);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 文档查看功能
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<object> GetAssignDocument(GetAssignDocument SData)
|
||||
{
|
||||
//if (SData.FProcessID == null)
|
||||
//{
|
||||
// throw new O3AppException("传参信息错误,工序内码未定义",400);
|
||||
//}
|
||||
//if (SData.FItemID == null)
|
||||
//{
|
||||
// throw new O3AppException("传参信息错误,产品内码未定义", 400);
|
||||
//}
|
||||
//if (SData.FProcessID.ToString() == "")
|
||||
//{
|
||||
// throw new O3AppException("工序码为空", 400);
|
||||
//}
|
||||
//if (SData.FItemID.ToString() == "")
|
||||
//{
|
||||
// throw new O3AppException("产品码为空", 400);
|
||||
//}
|
||||
return await (repository as IInspectionRepository).GetAssignDocument(SData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 下载作业文档并查看
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<object> DownAssignDocument(DownAssignDocument SData)
|
||||
{
|
||||
using APPServerContext context = new APPServerContext(LoginInfo.DBAias, LoginInfo.UserID);
|
||||
|
||||
#region 自定义AND传参
|
||||
object returnData = new { };
|
||||
//单据编号
|
||||
string FBillNO = SData.FBillNO.ToStringEx();
|
||||
//文件名
|
||||
string FFileName = SData.FFileName.ToStringEx();
|
||||
#endregion
|
||||
|
||||
//文件下载绝对路径
|
||||
string fileAbsoluteDownPath = Directory.GetCurrentDirectory() + "\\wwwroot\\DownAssignDocument\\" + FBillNO + "\\" + FFileName;
|
||||
//相对路径
|
||||
string fileRelativeDownPath = GetCompleteUrl() + "/src/DownAssignDocument/" + FBillNO + "/" + FFileName;
|
||||
|
||||
//判断文件是否已经存在了
|
||||
if (!File.Exists(fileAbsoluteDownPath))
|
||||
{
|
||||
//上传服务器IP地址
|
||||
string serverIP = context.Database.SqlQueryString("SELECT FVALUE FROM SYS_DEPARAMETERS WHERE FNUMBER = 'FileServerUrl' ");
|
||||
if (serverIP.IsNullOrEmpty())
|
||||
{
|
||||
serverIP = "http://127.0.0.1";
|
||||
}
|
||||
|
||||
//获取系统配置
|
||||
Hashtable PBCursor = context.PBValue("WFMUpload,C,;");
|
||||
//文件所在文件夹路径
|
||||
string filePath = PBCursor["WFMUpload"].ToStringEx();
|
||||
|
||||
//FileUpDownInfo
|
||||
FileUpDownInfo myDownInfo = new FileUpDownInfo()
|
||||
{
|
||||
SourceFileName = FFileName,
|
||||
SourceFilePath = Path.Combine(filePath, FBillNO),
|
||||
TargetFileName = FFileName,
|
||||
TargetFilePath = Directory.GetCurrentDirectory() + "\\wwwroot\\DownAssignDocument\\" + FBillNO,
|
||||
ServerIP = serverIP
|
||||
};
|
||||
//下载文件
|
||||
FileHelper.WebDownLoadFile(myDownInfo);
|
||||
}
|
||||
returnData = new
|
||||
{
|
||||
fullFilePath = fileRelativeDownPath
|
||||
};
|
||||
|
||||
return await Task.Run(() => returnData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前请求完整的Url地址 q
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private string GetCompleteUrl()
|
||||
{
|
||||
return new StringBuilder()
|
||||
.Append(Context.Request.Scheme)
|
||||
.Append("://")
|
||||
.Append(Context.Request.Host)
|
||||
.Append(Context.Request.PathBase)
|
||||
.ToString();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 安灯异常呼叫列表接口
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<object> GetAbnormalCall(GetAbnormalCall SData)
|
||||
{
|
||||
if (SData.Resource== null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,资源未定义",400);
|
||||
}
|
||||
if (SData.Page == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,页数未定义", 400);
|
||||
}
|
||||
if (SData.Size == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,页显示数量未定义", 400);
|
||||
}
|
||||
return await (repository as IInspectionRepository).GetAbnormalCall(SData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 安灯异常呼叫列表接口
|
||||
/// +数据数量 by liujie
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<object> GetAbnormalCalls(GetAbnormalCall SData)
|
||||
{
|
||||
if (SData.Resource == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,资源未定义", 400);
|
||||
}
|
||||
if (SData.Page == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,页数未定义", 400);
|
||||
}
|
||||
if (SData.Size == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,页显示数量未定义", 400);
|
||||
}
|
||||
return await (repository as IInspectionRepository).GetAbnormalCalls(SData);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 安灯异常呼叫处理
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> DoAbnormalCall(DoAbnormalCall SData)
|
||||
{
|
||||
if (SData.DoType== null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,操作类型未定义",400);
|
||||
}
|
||||
if (SData.ListFInterID == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,内码列表未定义",400);
|
||||
}
|
||||
//安灯内码列表
|
||||
List<string> listFInterID = SData.ListFInterID;
|
||||
if (listFInterID.Count==0)
|
||||
{
|
||||
throw new O3AppException("未勾选需要操作的数据",400);
|
||||
}
|
||||
//判断值是否为空
|
||||
if (SData.DoType.ToStringEx()=="")
|
||||
{
|
||||
throw new O3AppException("操作类型为空",400);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SData.DoType.ToStringEx() == "2")
|
||||
{
|
||||
if (SData.IsDule == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,是否处理未定义",400);
|
||||
}
|
||||
if (SData.IsDule.ToStringEx().ToBoolean())
|
||||
{
|
||||
//需要处理的操作,需要处理人等信息
|
||||
if (SData.DuleUserID == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,处理人未定义",400);
|
||||
}
|
||||
if (SData.DuleTime == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,处理时间未定义",400);
|
||||
}
|
||||
if (SData.DuleResult == null)
|
||||
{
|
||||
throw new O3AppException("传参信息错误,处理结果未定义",400);
|
||||
}
|
||||
if (SData.DuleTime.ToStringEx().IsNullOrEmpty())
|
||||
{
|
||||
throw new O3AppException("处理时间为空",400);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return await (repository as IInspectionRepository).DoAbnormalCall(SData);
|
||||
}
|
||||
}
|
||||
}
|
||||
+919
@@ -0,0 +1,919 @@
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Opsoft.Data;
|
||||
using Opsoft.NetCore.O3App.Domain;
|
||||
using Opsoft.NetCore.O3App.Domain.Enums.ReportCodes;
|
||||
using Opsoft.NetCore.O3App.Domain.Interface;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.IPadReport.IRepositories;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.IPadReport.IServices;
|
||||
using Opsoft.NetCore.O3App.Domain.UnitOfWork.IPadReport.Model;
|
||||
using Opsoft.NetCore.O3App.Shared;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.Services.IPadReport
|
||||
{
|
||||
/// <summary>
|
||||
/// 汇报信息查询服务层实现
|
||||
/// </summary>
|
||||
[MapTo(typeof(IReportInfoLoadService), ServiceLifetime.Transient)]
|
||||
public class ReportInfoLoadService : ServiceBase<BaseEntity, IReportInfoLoadRepository>, IReportInfoLoadService
|
||||
{
|
||||
private IMemoryCache _cache;
|
||||
/// <summary>
|
||||
/// 带注入的构造函数
|
||||
/// </summary>
|
||||
/// <param name="repository"></param>
|
||||
public ReportInfoLoadService(IReportInfoLoadRepository repository, IMemoryCache memoryCache) : base(repository)
|
||||
{
|
||||
Init(repository);
|
||||
_cache = memoryCache;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按工作中心代码获取资源信息
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<Basic>> QueryResourceByWorkCenter(Dictionary<string, string> paramaters)
|
||||
{
|
||||
//工作中心代码集合
|
||||
if (!paramaters.ContainsKey("data"))
|
||||
{
|
||||
throw new O3AppException("【工作中心】传参信息错误,未定义", 400);
|
||||
}
|
||||
return await (repository as IReportInfoLoadRepository).QueryResourceByWorkCenter(paramaters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 依据班组=>员工信息/员工信息=>班组
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<Basic>> GetTeamEmpTwo(Dictionary<string, string> paramaters)
|
||||
{
|
||||
#region 参数验证
|
||||
//获取数据的类型
|
||||
if (!paramaters.ContainsKey("basicType"))
|
||||
{
|
||||
throw new O3AppException("【数据类型】传参信息错误,未定义", 400);
|
||||
}
|
||||
//判断数据类型
|
||||
if (!int.TryParse(paramaters["basicType"].ToStringEx(), out int basicType))
|
||||
{
|
||||
throw new O3AppException("【数据类型】传参类型错误,值设定有误", 400);
|
||||
}
|
||||
//判断手机ID是否传参
|
||||
if (!paramaters.ContainsKey("basicNO"))
|
||||
{
|
||||
throw new O3AppException("【代码】传参信息错误,未定义", 400);
|
||||
}
|
||||
|
||||
if (paramaters["basicNO"].IsNullOrEmpty())
|
||||
{
|
||||
throw new O3AppException("【代码】信息为空", 400);
|
||||
}
|
||||
#endregion
|
||||
|
||||
return await (repository as IReportInfoLoadRepository).GetTeamEmpTwo(paramaters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载历史汇报信息
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ProductionAct>> ReloadReportHisReport(Dictionary<string, string> paramaters)
|
||||
{
|
||||
#region 参数验证
|
||||
//获取数据的类型
|
||||
if (!paramaters.ContainsKey("basicType"))
|
||||
{
|
||||
throw new O3AppException("【数据类型】传参信息错误,未定义", 400);
|
||||
}
|
||||
//判断数据类型
|
||||
if (!int.TryParse(paramaters["basicType"], out int basicType))
|
||||
{
|
||||
throw new O3AppException("【数据类型】传参类型错误,值设定有误", 400);
|
||||
}
|
||||
//判断手机ID是否传参
|
||||
if (!paramaters.ContainsKey("phoneID"))
|
||||
{
|
||||
throw new O3AppException("【手机ID】传参信息错误,未定义", 400);
|
||||
}
|
||||
|
||||
if (paramaters["phoneID"].IsNullOrEmpty())
|
||||
{
|
||||
throw new O3AppException("【手机ID】信息为空", 400);
|
||||
}
|
||||
//资源信息验证
|
||||
if (!paramaters.ContainsKey("data"))
|
||||
{
|
||||
throw new O3AppException("【资源】传参信息错误,未定义", 400);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 数据获取
|
||||
//缓存名称
|
||||
string cacheName = LoginInfo.DBAias + paramaters["phoneID"];
|
||||
//选择的资源列表
|
||||
List<string> resourceList = JsonOperator.JsonDeserialize<List<string>>(paramaters["data"]);
|
||||
//需要返回的查询数据
|
||||
List<ProductionAct> listPro = new List<ProductionAct>();
|
||||
//汇报大类
|
||||
ReportData reportData = null;
|
||||
|
||||
//数据获取方式
|
||||
switch (basicType)
|
||||
{
|
||||
case 1:
|
||||
#region 从数据库加载汇报信息
|
||||
try
|
||||
{
|
||||
List<ProductionAct> reportList = await (repository as IReportInfoLoadRepository).GetReportDataFromDB(paramaters["phoneID"], string.Empty);
|
||||
if (reportList.Count > 0)
|
||||
{
|
||||
//缓存做更新
|
||||
if (_cache.TryGetValue(cacheName, out reportData))
|
||||
{
|
||||
reportData.AllReport.Clear();
|
||||
reportData.AllReport.AddRange(reportList);
|
||||
_cache.Remove(cacheName);
|
||||
}
|
||||
else
|
||||
{
|
||||
reportData = new ReportData(paramaters["phoneID"], LoginInfo.UserID, DateTime.Now);
|
||||
reportData.AllReport.AddRange(reportList);
|
||||
}
|
||||
//汇报的数据添加进缓存 默认添加60分钟的缓存
|
||||
_cache.Set(cacheName, reportData, TimeSpan.FromMinutes(60));
|
||||
}
|
||||
else
|
||||
{
|
||||
//没有查到数据时,不在需要提示
|
||||
//throw new O3AppException("当前设备汇报信息为空", 2);
|
||||
reportData = new ReportData(paramaters["phoneID"], LoginInfo.UserID, DateTime.Now);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
break;
|
||||
#endregion
|
||||
case 2:
|
||||
#region 从缓存加载汇报信息
|
||||
if (!_cache.TryGetValue(cacheName, out reportData))
|
||||
{
|
||||
throw new O3AppException("当前设备缓存信息为空,请刷新界面!", 2);
|
||||
}
|
||||
break;
|
||||
#endregion
|
||||
}
|
||||
|
||||
//过滤资源信息
|
||||
if (resourceList.Count > 0)
|
||||
{
|
||||
listPro = (from item in reportData.AllReport
|
||||
where resourceList.Contains(item.ResourcesNO)
|
||||
select item).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
//资源为空时,取出缓存中的全部汇报数据返回
|
||||
listPro = reportData.AllReport;
|
||||
}
|
||||
#endregion
|
||||
|
||||
return listPro;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载历史汇报信息
|
||||
/// +数据数量
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<object> ReloadReportHisReports(Dictionary<string, string> paramaters)
|
||||
{
|
||||
#region 参数验证
|
||||
//获取数据的类型
|
||||
if (!paramaters.ContainsKey("basicType"))
|
||||
{
|
||||
throw new O3AppException("【数据类型】传参信息错误,未定义", 400);
|
||||
}
|
||||
//判断数据类型
|
||||
if (!int.TryParse(paramaters["basicType"], out int basicType))
|
||||
{
|
||||
throw new O3AppException("【数据类型】传参类型错误,值设定有误", 400);
|
||||
}
|
||||
//判断手机ID是否传参
|
||||
if (!paramaters.ContainsKey("phoneID"))
|
||||
{
|
||||
throw new O3AppException("【手机ID】传参信息错误,未定义", 400);
|
||||
}
|
||||
|
||||
if (paramaters["phoneID"].IsNullOrEmpty())
|
||||
{
|
||||
throw new O3AppException("【手机ID】信息为空", 400);
|
||||
}
|
||||
//资源信息验证
|
||||
if (!paramaters.ContainsKey("data"))
|
||||
{
|
||||
throw new O3AppException("【资源】传参信息错误,未定义", 400);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 数据获取
|
||||
//缓存名称
|
||||
string cacheName = LoginInfo.DBAias + paramaters["phoneID"];
|
||||
//选择的资源列表
|
||||
List<string> resourceList = JsonOperator.JsonDeserialize<List<string>>(paramaters["data"]);
|
||||
//需要返回的查询数据
|
||||
List<ProductionAct> listPro = new List<ProductionAct>();
|
||||
//汇报大类
|
||||
ReportData reportData = null;
|
||||
|
||||
//数据获取方式
|
||||
switch (basicType)
|
||||
{
|
||||
case 1:
|
||||
#region 从数据库加载汇报信息
|
||||
try
|
||||
{
|
||||
List<ProductionAct> reportList = await (repository as IReportInfoLoadRepository).GetReportDataFromDB(paramaters["phoneID"], string.Empty);
|
||||
if (reportList.Count > 0)
|
||||
{
|
||||
//缓存做更新
|
||||
if (_cache.TryGetValue(cacheName, out reportData))
|
||||
{
|
||||
reportData.AllReport.Clear();
|
||||
reportData.AllReport.AddRange(reportList);
|
||||
_cache.Remove(cacheName);
|
||||
}
|
||||
else
|
||||
{
|
||||
reportData = new ReportData(paramaters["phoneID"], LoginInfo.UserID, DateTime.Now);
|
||||
reportData.AllReport.AddRange(reportList);
|
||||
}
|
||||
//汇报的数据添加进缓存 默认添加60分钟的缓存
|
||||
_cache.Set(cacheName, reportData, TimeSpan.FromMinutes(60));
|
||||
}
|
||||
else
|
||||
{
|
||||
//没有查到数据时,不在需要提示
|
||||
//throw new O3AppException("当前设备汇报信息为空", 2);
|
||||
reportData = new ReportData(paramaters["phoneID"], LoginInfo.UserID, DateTime.Now);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
break;
|
||||
#endregion
|
||||
case 2:
|
||||
#region 从缓存加载汇报信息
|
||||
if (!_cache.TryGetValue(cacheName, out reportData))
|
||||
{
|
||||
throw new O3AppException("当前设备缓存信息为空,请刷新界面!", 2);
|
||||
}
|
||||
break;
|
||||
#endregion
|
||||
}
|
||||
|
||||
//过滤资源信息
|
||||
if (resourceList.Count > 0)
|
||||
{
|
||||
listPro = (from item in reportData.AllReport
|
||||
where resourceList.Contains(item.ResourcesNO)
|
||||
select item).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
//资源为空时,取出缓存中的全部汇报数据返回
|
||||
listPro = reportData.AllReport;
|
||||
}
|
||||
#endregion
|
||||
return new
|
||||
{
|
||||
listPro = listPro,
|
||||
totalCount = listPro.Count
|
||||
};
|
||||
}
|
||||
/// <summary>
|
||||
/// 单资源汇报信息加载
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ProductionAct> ReloadSingeleResource(Dictionary<string, string> paramaters)
|
||||
{
|
||||
#region 参数验证
|
||||
//判断手机ID是否传参
|
||||
if (!paramaters.ContainsKey("phoneID"))
|
||||
{
|
||||
throw new O3AppException("【手机ID】传参信息错误,未定义", 400);
|
||||
}
|
||||
|
||||
if (paramaters["phoneID"].IsNullOrEmpty())
|
||||
{
|
||||
throw new O3AppException("【手机ID】信息为空", 400);
|
||||
}
|
||||
//资源信息为空
|
||||
if (!paramaters.ContainsKey("resourceID"))
|
||||
{
|
||||
throw new O3AppException("【资源】传参信息错误,未定义", 400);
|
||||
}
|
||||
|
||||
if (paramaters["resourceID"].IsNullOrEmpty())
|
||||
{
|
||||
throw new O3AppException("【资源】信息为空", 400);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 数据获取
|
||||
//缓存名称
|
||||
string cacheName = LoginInfo.DBAias + paramaters["phoneID"];
|
||||
//需要返回的查询数据
|
||||
List<ProductionAct> listPro = new List<ProductionAct>();
|
||||
//汇报大类
|
||||
ReportData reportData = null;
|
||||
|
||||
if (!_cache.TryGetValue(cacheName, out reportData))
|
||||
{
|
||||
//重新实例化汇报大类
|
||||
reportData = new ReportData(paramaters["phoneID"], LoginInfo.UserID, DateTime.Now);
|
||||
//重新获取资源汇报数据
|
||||
List<ProductionAct> reportList = await (repository as IReportInfoLoadRepository).GetReportDataFromDB(paramaters["phoneID"], paramaters["resourceID"]);
|
||||
//判断数据是否存在
|
||||
if (reportList.Count == 0)
|
||||
{
|
||||
throw new O3AppException("当前资源汇报信息未找到,请重新加载", 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
reportData.AllReport.Add(reportList[0]);
|
||||
//设置汇报信息缓存 默认添加60分钟的缓存
|
||||
_cache.Set(cacheName, reportData, TimeSpan.FromMinutes(60));
|
||||
}
|
||||
}
|
||||
|
||||
//数据取得
|
||||
ProductionAct reportInfo = reportData.AllReport.FirstOrDefault(o => o.ResourcesID.Equals(paramaters["resourceID"]));
|
||||
if (reportInfo == null)
|
||||
{
|
||||
throw new O3AppException("当前资源汇报信息未找到,请重新加载", 2);
|
||||
}
|
||||
|
||||
return reportInfo;
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Web版页面切换获取最新单资源汇报信息加载(因为在安灯预警平台页签做响应没有更新后台缓存,开工台加载的还是原缓存信息)
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ProductionAct> ReloadSingeleResourceWeb(Dictionary<string, string> paramaters)
|
||||
{
|
||||
#region 参数验证
|
||||
//判断手机ID是否传参
|
||||
if (!paramaters.ContainsKey("phoneID"))
|
||||
{
|
||||
throw new O3AppException("【手机ID】传参信息错误,未定义", 400);
|
||||
}
|
||||
|
||||
if (paramaters["phoneID"].IsNullOrEmpty())
|
||||
{
|
||||
throw new O3AppException("【手机ID】信息为空", 400);
|
||||
}
|
||||
//资源信息为空
|
||||
if (!paramaters.ContainsKey("resourceID"))
|
||||
{
|
||||
throw new O3AppException("【资源】传参信息错误,未定义", 400);
|
||||
}
|
||||
|
||||
if (paramaters["resourceID"].IsNullOrEmpty())
|
||||
{
|
||||
throw new O3AppException("【资源】信息为空", 400);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 数据获取
|
||||
//缓存名称
|
||||
string cacheName = LoginInfo.DBAias + paramaters["phoneID"];
|
||||
//汇报大类
|
||||
ReportData reportData = null;
|
||||
//重新获取资源汇报数据
|
||||
List<ProductionAct> reportList = await (repository as IReportInfoLoadRepository).GetReportDataFromDB(paramaters["phoneID"], paramaters["resourceID"]);
|
||||
//判断数据是否存在
|
||||
if (reportList.Count == 0)
|
||||
{
|
||||
throw new O3AppException("当前资源汇报信息未找到,请重新加载", 2);
|
||||
}
|
||||
if (!_cache.TryGetValue(cacheName, out reportData))
|
||||
{
|
||||
//重新实例化汇报大类
|
||||
reportData = new ReportData(paramaters["phoneID"], LoginInfo.UserID, DateTime.Now);
|
||||
reportData.AllReport.Add(reportList[0]);
|
||||
//设置汇报信息缓存 默认添加60分钟的缓存
|
||||
_cache.Set(cacheName, reportData, TimeSpan.FromMinutes(60));
|
||||
}
|
||||
|
||||
//数据取得
|
||||
ProductionAct reportInfo = reportList[0];
|
||||
return reportInfo;
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 提交资源信息
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ProductionAct>> SubmitResouces(JObject paramaters)
|
||||
{
|
||||
#region 参数验证
|
||||
//判断手机ID是否传参
|
||||
if (!paramaters.ContainsKey("phoneID"))
|
||||
{
|
||||
throw new O3AppException("【手机ID】传参信息错误,未定义", 400);
|
||||
}
|
||||
|
||||
if (paramaters["phoneID"].ToStringEx().IsNullOrEmpty())
|
||||
{
|
||||
throw new O3AppException("【手机ID】信息为空", 400);
|
||||
}
|
||||
//资源信息为空
|
||||
if (!paramaters.ContainsKey("data"))
|
||||
{
|
||||
throw new O3AppException("【资源】传参信息错误,未定义", 400);
|
||||
}
|
||||
List<string> resourceList = JsonOperator.JsonDeserialize<List<string>>(paramaters["data"].ToStringEx());
|
||||
if (resourceList == null || resourceList.Count <= 0)
|
||||
{
|
||||
throw new O3AppException("【资源】信息为空", 400);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 检查资源信息
|
||||
//缓存名称
|
||||
string cacheName = LoginInfo.DBAias + paramaters["phoneID"].ToStringEx();
|
||||
//需要重新更新的资源信息
|
||||
List<string> idList = new List<string>();
|
||||
List<ProductionAct> reportList = new List<ProductionAct>();
|
||||
if (_cache.TryGetValue(cacheName, out ReportData reportData))
|
||||
{
|
||||
foreach (var sub in resourceList)
|
||||
{
|
||||
if (reportData.AllReport.Exists(o => o.ResourcesNO.Equals(sub)))
|
||||
{
|
||||
//已经存在的资源汇报信息,不需要再次 提交,直接使用
|
||||
reportList.Add(reportData.AllReport.FirstOrDefault(o => o.ResourcesNO.Equals(sub)));
|
||||
}
|
||||
else
|
||||
{
|
||||
//添加新的资源 卉鳌信息
|
||||
idList.Add(sub);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//缓存中不存在的情况,添加全部
|
||||
idList = resourceList;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 数据处理
|
||||
//有新资源时进行处理
|
||||
if (idList.Count > 0)
|
||||
{
|
||||
reportList.AddRange(await (repository as IReportInfoLoadRepository).SubmitResouces(paramaters["phoneID"].ToStringEx(), idList));
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region 更新缓存
|
||||
//需要提交新的资源时再更新缓存信息
|
||||
if (idList.Count > 0)
|
||||
{
|
||||
//更新缓存中资源中设备信息
|
||||
string sourceCacheName = LoginInfo.DBAias + (BasicTableName)6;
|
||||
if (_cache.TryGetValue(sourceCacheName, out List<Basic> listSourceData))
|
||||
{
|
||||
foreach (var sub in resourceList)
|
||||
{
|
||||
var subBasic = listSourceData.FirstOrDefault(o => o.FNO == sub);
|
||||
if (subBasic != null)
|
||||
{
|
||||
subBasic.FPHONEID = paramaters["phoneID"].ToStringEx();
|
||||
}
|
||||
}
|
||||
//更新缓存中的值
|
||||
_cache.Remove(sourceCacheName);
|
||||
_cache.Set(sourceCacheName, listSourceData, TimeSpan.FromMinutes(10));
|
||||
}
|
||||
//更新缓存中汇报信息
|
||||
if (_cache.TryGetValue(cacheName, out ReportData reportDataCache))
|
||||
{
|
||||
foreach (ProductionAct sub in reportList)
|
||||
{
|
||||
//移除已有汇报信息,重新添加
|
||||
var subProductionAct = reportDataCache.AllReport.FirstOrDefault(o => o.ResourcesID.Equals(sub.ResourcesID));
|
||||
if (subProductionAct != null)
|
||||
{
|
||||
reportDataCache.AllReport.Remove(subProductionAct);
|
||||
}
|
||||
}
|
||||
_cache.Remove(cacheName);
|
||||
}
|
||||
else
|
||||
{
|
||||
reportDataCache = new ReportData(paramaters["phoneID"].ToStringEx(), LoginInfo.UserID, DateTime.Now);
|
||||
}
|
||||
//数据添加到缓存中
|
||||
reportDataCache.AllReport.AddRange(reportList);
|
||||
_cache.Set(cacheName, reportDataCache, TimeSpan.FromMinutes(60));
|
||||
}
|
||||
#endregion
|
||||
|
||||
return reportList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除资源信息
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<string>> DeleteResources(JObject paramaters)
|
||||
{
|
||||
#region 参数验证
|
||||
//判断手机ID是否传参
|
||||
if (!paramaters.ContainsKey("phoneID"))
|
||||
{
|
||||
throw new O3AppException("【手机ID】传参信息错误,未定义", 400);
|
||||
}
|
||||
|
||||
if (paramaters["phoneID"].ToStringEx().IsNullOrEmpty())
|
||||
{
|
||||
throw new O3AppException("【手机ID】信息为空", 400);
|
||||
}
|
||||
//资源信息为空
|
||||
if (!paramaters.ContainsKey("data"))
|
||||
{
|
||||
throw new O3AppException("【资源】传参信息错误,未定义", 400);
|
||||
}
|
||||
List<string> resourceList = JsonOperator.JsonDeserialize<List<string>>(paramaters["data"].ToStringEx());
|
||||
if (resourceList == null || resourceList.Count <= 0)
|
||||
{
|
||||
throw new O3AppException("【资源】信息为空", 400);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 数据验证及处理
|
||||
Dictionary<string, List<string>> returnData = await (repository as IReportInfoLoadRepository).DeleteResources(paramaters["phoneID"].ToStringEx(), resourceList);
|
||||
#endregion
|
||||
|
||||
#region 更新缓存
|
||||
//更新缓存中资源中设备信息
|
||||
//缓存名称
|
||||
string sourceCacheName = LoginInfo.DBAias + (BasicTableName)6;
|
||||
if (_cache.TryGetValue(sourceCacheName, out List<Basic> listSourceData))
|
||||
{
|
||||
foreach (var sub in resourceList)
|
||||
{
|
||||
var subBasic = listSourceData.FirstOrDefault(o => o.FNO == sub);
|
||||
if (subBasic != null)
|
||||
{
|
||||
subBasic.FPHONEID = string.Empty;
|
||||
}
|
||||
}
|
||||
//更新缓存中的值
|
||||
_cache.Remove(sourceCacheName);
|
||||
_cache.Set(sourceCacheName, listSourceData, TimeSpan.FromMinutes(10));
|
||||
}
|
||||
//更新缓存中汇报信息
|
||||
string cacheName = LoginInfo.DBAias + paramaters["phoneID"].ToStringEx();
|
||||
if (_cache.TryGetValue(cacheName, out ReportData reportDataCache))
|
||||
{
|
||||
//移除已有汇报信息
|
||||
reportDataCache.AllReport.RemoveAll(o => returnData["delResourceIdList"].Exists(p => p == o.ResourcesID));
|
||||
//数据重新添加到缓存中
|
||||
_cache.Remove(cacheName);
|
||||
_cache.Set(cacheName, reportDataCache, TimeSpan.FromMinutes(60));
|
||||
}
|
||||
#endregion
|
||||
|
||||
return returnData["isreportList"];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询条码类型及信息
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Dictionary<string, object>> GetBarcodeInfo(Dictionary<string, string> paramaters)
|
||||
{
|
||||
#region 参数验证
|
||||
//barType 1=开工扫描条码,2=物料条码,3=第三方条码
|
||||
//获取数据的类型
|
||||
if (!paramaters.ContainsKey("basicType"))
|
||||
{
|
||||
throw new O3AppException("【数据类型】传参信息错误,未定义", 400);
|
||||
}
|
||||
//判断数据类型
|
||||
if (!int.TryParse(paramaters["basicType"], out int basicType))
|
||||
{
|
||||
throw new O3AppException("【数据类型】传参类型错误,值设定有误", 400);
|
||||
}
|
||||
//判断条码是否传参
|
||||
if (!paramaters.ContainsKey("barCode"))
|
||||
{
|
||||
throw new O3AppException("【条码】传参信息错误,未定义", 400);
|
||||
}
|
||||
|
||||
if (paramaters["barCode"].IsNullOrEmpty())
|
||||
{
|
||||
throw new O3AppException("【扫描条码】信息为空", 400);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 数据验证及处理
|
||||
//返回值
|
||||
Dictionary<string, object> returnDic = new Dictionary<string, object>();
|
||||
//barType 1=开工扫描条码,2=物料条码,3=第三方条码
|
||||
//判断操作数据类型
|
||||
switch (basicType)
|
||||
{
|
||||
case 1:
|
||||
returnDic = await (repository as IReportInfoLoadRepository).GetBarcodeType(paramaters["barCode"]);
|
||||
break;
|
||||
case 2:
|
||||
returnDic = await (repository as IReportInfoLoadRepository).GetMaterialInfoByBarcode(false, paramaters["barCode"]);
|
||||
break;
|
||||
case 3:
|
||||
returnDic = await (repository as IReportInfoLoadRepository).GetMaterialInfoByBarcode(true, paramaters["barCode"]);
|
||||
break;
|
||||
}
|
||||
|
||||
if(returnDic.Keys.Count <= 0)
|
||||
{
|
||||
throw new O3AppException("条码信息未找到!", 404);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
return returnDic;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询SN汇报扫描条码信息
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> CheckSNReportBarcode(Dictionary<string, string> paramaters)
|
||||
{
|
||||
#region 参数验证
|
||||
//获取数据的类型
|
||||
if (!paramaters.ContainsKey("flowCardId"))
|
||||
{
|
||||
throw new O3AppException("【流转卡】传参信息错误,未定义", 400);
|
||||
}
|
||||
//判断数据类型
|
||||
if (paramaters["flowCardId"].IsNullOrEmpty())
|
||||
{
|
||||
throw new O3AppException("【流转卡】信息为空", 400);
|
||||
}
|
||||
//判断条码是否传参
|
||||
if (!paramaters.ContainsKey("barCode"))
|
||||
{
|
||||
throw new O3AppException("【条码】传参信息错误,未定义", 400);
|
||||
}
|
||||
|
||||
if (paramaters["barCode"].IsNullOrEmpty())
|
||||
{
|
||||
throw new O3AppException("【扫描条码】信息为空", 400);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 数据验证
|
||||
bool res = await (repository as IReportInfoLoadRepository).CheckSNReportBarcodeInfo(paramaters["flowCardId"], paramaters["barCode"]);
|
||||
#endregion
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询周转码汇报数量
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<decimal> GetConutByTCCode(Dictionary<string, string> paramaters)
|
||||
{
|
||||
#region 参数验证
|
||||
//获取数据的类型
|
||||
if (!paramaters.ContainsKey("flowCardId"))
|
||||
{
|
||||
throw new O3AppException("【流转卡】传参信息错误,未定义", 400);
|
||||
}
|
||||
//判断数据类型
|
||||
if (paramaters["flowCardId"].IsNullOrEmpty())
|
||||
{
|
||||
throw new O3AppException("【流转卡】信息为空", 400);
|
||||
}
|
||||
//判断条码是否传参
|
||||
if (!paramaters.ContainsKey("tcBarCode"))
|
||||
{
|
||||
throw new O3AppException("【条码】传参信息错误,未定义", 400);
|
||||
}
|
||||
|
||||
if (paramaters["tcBarCode"].IsNullOrEmpty())
|
||||
{
|
||||
throw new O3AppException("【扫描条码】信息为空", 400);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 数据验证
|
||||
decimal res = await (repository as IReportInfoLoadRepository).GetConutByTCCode(paramaters["flowCardId"], paramaters["tcBarCode"]);
|
||||
#endregion
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重置汇报系统参数
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<Dictionary<string, object>> ReLoadReportSystemParam()
|
||||
{
|
||||
#region 数据获取
|
||||
//获取系统参数
|
||||
Hashtable PBCursor = await (repository as IReportInfoLoadRepository).InitSystemParam();
|
||||
//CJ_REPORTTYPE 汇报数据种类: 依次为 换型,调机,首检,工休,用餐,跳过首检,换型结束 1表示显示 0 表示不显示
|
||||
string value = PBCursor["CJ-CJ_REPORTTYPE"].ToString();
|
||||
for (int i = 0; i < value.Length; i++)
|
||||
{
|
||||
char myChar = value[i];
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
ReportParams.ShowSetup = myChar == '1';
|
||||
break;
|
||||
case 1:
|
||||
ReportParams.ShowDebugMachine = myChar == '1';
|
||||
break;
|
||||
case 2:
|
||||
ReportParams.ShowFirstOff = myChar == '1';
|
||||
break;
|
||||
case 3:
|
||||
ReportParams.ShowBreakTime = myChar == '1';
|
||||
break;
|
||||
case 4:
|
||||
ReportParams.ShowMealTime = myChar == '1';
|
||||
break;
|
||||
case 5:
|
||||
ReportParams.ShowSkipFirstOff = myChar == '1';
|
||||
break;
|
||||
case 6:
|
||||
ReportParams.ShowReSetup = myChar == '1';
|
||||
break;
|
||||
}
|
||||
}
|
||||
ReportParams.CJ_FORMAT1 = PBCursor["CJ-CJ_FORMAT1"].ToString(); //物料停工单模板编号
|
||||
ReportParams.CJ_FORMAT2 = PBCursor["CJ-CJ_FORMAT2"].ToString(); //质量停工单模板编号
|
||||
ReportParams.CJ_FORMAT3 = PBCursor["CJ-CJ_FORMAT3"].ToString(); //复位停工单模板编号
|
||||
ReportParams.CJ_FORMAT4 = PBCursor["CJ-CJ_FORMAT4"].ToString(); //过程流转条码模板编号
|
||||
ReportParams.CJ_FORMAT5 = PBCursor["CJ-CJ_FORMAT5"].ToString(); //产品条码模板编号
|
||||
ReportParams.CR_TIME = Convert.ToInt32(PBCursor["PB-CR_TIME"]); //任务临界比预警临界值(CR值)
|
||||
ReportParams.PB_LINEWAHO = PBCursor["PB-PB_LINEWAHO"].ToString(); //现场线边仓
|
||||
ReportParams.FileServerIP = PBCursor["WO-WO_DOWNLOADIP"].ToString();
|
||||
ReportParams.FNeedWorkInProcessYN = Convert.ToBoolean(PBCursor["FNeedWorkInProcessYN"]);//是否启用车间在制品管理
|
||||
ReportParams.DefaultInStock = Convert.ToBoolean(PBCursor["DefaultInStock"]); //成品条码默认入库
|
||||
ReportParams.WA_TIME = Convert.ToInt32(PBCursor["CJ-WA_TIME"]);
|
||||
ReportParams.WA_TIME = ReportParams.WA_TIME <= 0 ? 3 : ReportParams.WA_TIME;//最小3分钟
|
||||
ReportParams.WorkToStopTime = ReportParams.WA_TIME;
|
||||
ReportParams.FTradeType = PBCursor["FTradeType"].ToString(); //行业类型
|
||||
ReportParams.HX_TIMEA = Convert.ToInt32(PBCursor["PB-HX_TIMEA"]); //换型准备预警提前时间(分钟)
|
||||
ReportParams.HX_TIMEB = Convert.ToInt32(PBCursor["PB-HX_TIMEB"]); //换型临界预警提前时间(分钟)
|
||||
ReportParams.FIsCloseToReport = Convert.ToBoolean(PBCursor["FIsCloseToReport"]); //完工时是否汇报
|
||||
ReportParams.FIsInputForPPbom = Convert.ToBoolean(PBCursor["FIsInputForPPbom"]);//投料方式是否以投料单判断
|
||||
ReportParams.FIsInputAfterStart = Convert.ToBoolean(PBCursor["FIsInputAfterStart"]); ///是否开工后直接投料
|
||||
ReportParams.FIsWipTrack = Convert.ToBoolean(PBCursor["FIsWipTrack"]); ///是否启用在制品追溯
|
||||
ReportParams.FIsStartWip = Convert.ToBoolean(PBCursor["FIsStartWip"]); ///是否启用在制品
|
||||
ReportParams.FIsContrlShift = Convert.ToBoolean(PBCursor["FIsContrlShift"]);
|
||||
ReportParams.FIsContrlTeam = Convert.ToBoolean(PBCursor["FIsContrlTeam"]);
|
||||
ReportParams.FIsCheckProcess = Convert.ToBoolean(PBCursor["FIsCheckProcess"]);
|
||||
ReportParams.FIsPrintLabel = Convert.ToBoolean(PBCursor["FIsPrintLabel"]);
|
||||
ReportParams.FIsMustDule = Convert.ToBoolean(PBCursor["FIsMustDule"]);
|
||||
ReportParams.FIsInputloginUser = Convert.ToBoolean(PBCursor["FIsInputloginUser"]);
|
||||
ReportParams.FIsInputTimeForReportBeginTime = Convert.ToBoolean(PBCursor["FIsInputTimeForReportBeginTime"]);
|
||||
ReportParams.FIsWorkCenterOnlyLogin = Convert.ToBoolean(PBCursor["FIsWorkCenterOnlyLogin"]);
|
||||
ReportParams.FIsCloseAfterReport = Convert.ToBoolean(PBCursor["FIsCloseAfterReport"]);
|
||||
ReportParams.RT01A1 = PBCursor["RT01A1"].ToString();
|
||||
ReportParams.GZList = new Dictionary<string, string>();
|
||||
if (!string.IsNullOrEmpty(ReportParams.RT01A1) && ReportParams.RT01A1.Contains(";"))
|
||||
{
|
||||
List<string> idList = ReportParams.RT01A1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
foreach (var sub in idList)
|
||||
{
|
||||
if (sub.Contains("="))
|
||||
{
|
||||
string[] idArr = sub.Split('=');
|
||||
if (!ReportParams.GZList.Keys.Contains(idArr[0]))
|
||||
{
|
||||
ReportParams.GZList.Add(idArr[0], idArr[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ReportParams.FIsShowOPCErr = Convert.ToBoolean(PBCursor["FIsShowOPCErr"]);
|
||||
ReportParams.FIsShowMESInfoServerErr = Convert.ToBoolean(PBCursor["FIsShowMESInfoServerErr"]);
|
||||
ReportParams.FIsClearLSW = Convert.ToBoolean(PBCursor["FIsClearLSW"]);
|
||||
string str = PBCursor["PB-FA_IP"].ToString();
|
||||
if (str.Contains(":"))
|
||||
{
|
||||
string[] splitstr = PBCursor["PB-FA_IP"].ToString().Split(';');
|
||||
ReportParams.wIP = splitstr[0];
|
||||
ReportParams.wPort = Convert.ToInt32(splitstr[1]);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ReportParams.wIP = "127.0.0.1";
|
||||
ReportParams.wPort = 5555;
|
||||
}
|
||||
str = PBCursor["FMateralInputWay"].ToString();
|
||||
switch (str)
|
||||
{ ///汇报物料投入方式 1=条码;2=物料编码
|
||||
case "1":
|
||||
ReportParams.FMateralInputWay = 1;
|
||||
break;
|
||||
case "2":
|
||||
ReportParams.FMateralInputWay = 2;
|
||||
break;
|
||||
default:
|
||||
ReportParams.FMateralInputWay = 1;
|
||||
break;
|
||||
}
|
||||
ReportParams.UploadIP = PBCursor["UploadIP"].ToString();
|
||||
ReportParams.BarcodeRule = PBCursor["RFIDRule"].ToString();
|
||||
ReportParams.CheckInspectionTime = Convert.ToInt32(PBCursor["CheckInspectionTime"]);
|
||||
ReportParams.FCreateRepair = Convert.ToBoolean(PBCursor["FCreateRepair"]);
|
||||
//返回数据处理
|
||||
ReportParams.IsIni = true;
|
||||
Dictionary<string, object> returnDic = new Dictionary<string, object>
|
||||
{
|
||||
{"ShowSetup",ReportParams.ShowSetup},
|
||||
{"ShowDebugMachine",ReportParams.ShowDebugMachine},
|
||||
{"ShowFirstOff",ReportParams.ShowFirstOff},
|
||||
{"ShowBreakTime",ReportParams.ShowBreakTime},
|
||||
{"ShowMealTime",ReportParams.ShowMealTime},
|
||||
{"ShowReSetup",ReportParams.ShowReSetup},
|
||||
{"ShowSkipFirstOff",ReportParams.ShowSkipFirstOff},
|
||||
{"FIsContrlShift",ReportParams.FIsContrlShift},
|
||||
{"FIsContrlTeam",ReportParams.FIsContrlTeam},
|
||||
{"FIsCloseToReport",ReportParams.FIsCloseToReport},
|
||||
{"FIsInputloginUser",ReportParams.FIsInputloginUser},
|
||||
{"FIsPrintLabel",ReportParams.FIsPrintLabel}
|
||||
};
|
||||
#endregion
|
||||
|
||||
return returnDic;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取生产信息
|
||||
/// </summary>
|
||||
/// <param name="paramaters"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="O3AppException"></exception>
|
||||
public async Task<object> GetReportMessage(Dictionary<string, string> paramaters)
|
||||
{
|
||||
#region 参数验证
|
||||
if (!paramaters.ContainsKey("loginId"))
|
||||
{
|
||||
throw new O3AppException("【登录人】传参信息错误,未定义", 400);
|
||||
}
|
||||
if (paramaters["loginId"].IsNullOrEmpty())
|
||||
{
|
||||
throw new O3AppException("【登录人】信息为空", 400);
|
||||
}
|
||||
if (!paramaters.ContainsKey("page"))
|
||||
{
|
||||
throw new O3AppException("【页数】传参信息错误,未定义", 400);
|
||||
}
|
||||
|
||||
if (paramaters["size"].IsNullOrEmpty())
|
||||
{
|
||||
throw new O3AppException("【页显示数量】信息为空", 400);
|
||||
}
|
||||
#endregion
|
||||
return await (repository as IReportInfoLoadRepository).GetReportMessage(paramaters["loginId"], paramaters["page"].ToInt(), paramaters["size"].ToInt());
|
||||
}
|
||||
}
|
||||
}
|
||||
+3043
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user