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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user