Commit 2525380d by lyy

Merge branch 'master' of http://test.siger-data.com:9000/jiawei.su/Laisi_AutoMES2 into master

parents 76c4f5d7 c26b36f0
...@@ -134,6 +134,7 @@ export default { ...@@ -134,6 +134,7 @@ export default {
created(){ created(){
this.initFrockType();//工装类型树形结构 this.initFrockType();//工装类型树形结构
this.tosearch(); this.tosearch();
this.tableColumns1 = this.$time.initTableTitle(this.tableColumns1);
}, },
methods:{ methods:{
//工装类型 //工装类型
......
...@@ -212,6 +212,7 @@ export default { ...@@ -212,6 +212,7 @@ export default {
}, },
created(){ created(){
this.initWarehouse();//仓库 this.initWarehouse();//仓库
this.tableColumns1 = this.$time.initTableTitle(this.tableColumns1);
}, },
methods:{ methods:{
//仓库下拉框 //仓库下拉框
......
...@@ -105,6 +105,7 @@ namespace Siger.ApiACC.Controllers ...@@ -105,6 +105,7 @@ namespace Siger.ApiACC.Controllers
/// <param name="line"></param> /// <param name="line"></param>
/// <param name="mode"></param> /// <param name="mode"></param>
/// <returns></returns> /// <returns></returns>
[HttpGet]
public IActionResult LineMode(int line, int mode) public IActionResult LineMode(int line, int mode)
{ {
var exitObj = _automationLineMode.Get(f => f.section == line); var exitObj = _automationLineMode.Get(f => f.section == line);
...@@ -148,10 +149,35 @@ namespace Siger.ApiACC.Controllers ...@@ -148,10 +149,35 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(CommonEnum.Fail); throw new BadRequestException(CommonEnum.Fail);
} }
} }
/// <summary>
/// 产线 需要检验
/// </summary>
/// <param name="line"></param>
/// <param name="enable"></param>
/// <returns></returns>
[HttpGet]
public IActionResult inspect(int line, int enable)
{
var exitObj = _automationLineMode.Get(f => f.section == line);
if (exitObj == null)
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
exitObj.updatetime = DateTime.Now;
exitObj.inspect = enable;
if (_unitOfWork.Commit() > 0)
return new ObjectResult(CommonEnum.Succefull);
else
throw new BadRequestException(CommonEnum.Fail);
}
/// <summary> /// <summary>
/// 任务状态接口 用于保存PLC 实时任务状态 () /// 任务状态接口 用于保存PLC 实时任务状态 ()
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost]
public IActionResult TaskResult([FromBody]RequestAutomationTaskResult request) public IActionResult TaskResult([FromBody]RequestAutomationTaskResult request)
{ {
//1.检查Tasklist //1.检查Tasklist
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Repositories.Interface;
using Siger.Middlelayer.AccRepository.Request;
using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.Common;
using Siger.Middlelayer.Common.Extensions;
using Siger.Middlelayer.Log;
using Siger.Middlelayer.Repository;
using Siger.Middlelayer.Repository.Repositories.Interface;
using Siger.Middlelayer.Repository.Response;
using Siger.Middlelayer.Share.Constant;
using Siger.Middlelayer.Share.Enum.ModuleEnum;
namespace Siger.ApiACC.Controllers
{
public class AutomationOperateController : BaseController
{
private readonly IUnitOfWork _unitOfWork;
private readonly ISigerProjectLevelSectionRepository _sigerProjectLevelSection;
private readonly ISigerDict _sigerDict;
private readonly IAutomationMachineStatus _automationMachineStatus;
private readonly ISigerProjectMachineAttributionRepository _sigerProjectMachineAttribution;
public AutomationOperateController(IUnitOfWork unitOfWork,ISigerProjectLevelSectionRepository sigerProjectLevelSection , ISigerDict sigerDict,IAutomationMachineStatus automationMachineStatus,ISigerProjectMachineAttributionRepository sigerProjectMachineAttribution)
{
_unitOfWork = unitOfWork;
_sigerProjectLevelSection = sigerProjectLevelSection;
_sigerDict = sigerDict;
_automationMachineStatus = automationMachineStatus;
_sigerProjectMachineAttribution = sigerProjectMachineAttribution;
}
public IActionResult Get()
{
return new ObjectResult(1);
}
/// <summary>
/// 获取字典配置
/// </summary>
/// <param name="line">产线</param>
/// <param name="type">类型:0:上料 1:检验</param>
/// <returns></returns>
[HttpGet]
public IActionResult GetloadStation(int line,int type)
{
var stationDicts = _sigerDict.GetDataByCat(AccDictCost.Automation, ProjectId);
if (!stationDicts.Any())
{
Logger.WriteLineInfo($"GetloadStation 未配置设备类型字典");
throw new BadRequestException(CommonEnum.RecordNotFound);
}
var loadStation=new List<string>();
if (type==0)
{
var dictLoad = stationDicts.Where(s => s.dkey == DictKeyValConst.UploadloadStation);
if (!dictLoad.Any())
{
Logger.WriteLineInfo($"GetloadStation 未配置上下料工站字典");
throw new BadRequestException(CommonEnum.RecordNotFound);
}
loadStation = dictLoad.Select(s => s.dval).ToList();
}else
{
var dictLoad = stationDicts.Where(s => s.dkey == DictKeyValConst.CleanStation);
if (!dictLoad.Any())
{
Logger.WriteLineInfo($"GetloadStation 未配置清洗工站字典");
throw new BadRequestException(CommonEnum.RecordNotFound);
}
loadStation = dictLoad.Select(s => s.dval).ToList();
}
var data = new List<ResponseLoadStation>();
foreach (var station in loadStation)
{
var section = _sigerProjectLevelSection.Get(f => f.id == station.ToInt() && f.parentid==line && f.status == (int)RowState.Valid);
if (section == null)
continue;
var machintAttr = _sigerProjectMachineAttribution.Get(f => f.station == section.id);
if(machintAttr==null)
{
Logger.WriteLineInfo($"GetloadStation 未配置清洗工站字典");
continue;
}
var loadStatus = (int)Automation.MachineStatus.Waiting;
var machineStatus = _automationMachineStatus.Get(f => f.section == station.ToInt() && f.status==(int)RowState.Valid);
if (machineStatus==null)
{
_automationMachineStatus.Insert(new siger_automation_machine_status
{
projectId=ProjectId,
enable=1,
machineid=machintAttr.machine,
section=section.id,
updatetime=DateTime.Now
});
}else
{
loadStatus = machineStatus.status;
}
data.Add(new ResponseLoadStation {
section=section.id,
title=section.title,
status=loadStatus
});
}
return new ObjectResult(data);
}
/// <summary>
/// 准备上料
/// </summary>
/// <param name="loading"></param>
/// <returns></returns>
[HttpPost]
public IActionResult Loading([FromBody]requestAutomationLoading loading)
{
var data = new ResponseAutomationInfo {
sn="sn0001",
wo="wo123123"
};
return new ObjectResult(data);
}
/// <summary>
/// 安装完成
/// </summary>
/// <param name="assemble"></param>
/// <returns></returns>
[HttpPost]
public IActionResult CompalateAssemble([FromBody]requestAutoCompalateAssemble assemble)
{
return new ObjectResult(1);
}
/// <summary>
/// 准备下料
/// </summary>
/// <param name="unloading"></param>
/// <returns></returns>
[HttpPost]
public IActionResult Unloading([FromBody]requestAutomationUnloading unloading)
{
return new ObjectResult(1);
}
/// <summary>
/// 拆卸完成
/// </summary>
/// <param name="disassemble"></param>
/// <returns></returns>
[HttpPost]
public IActionResult Disassemble([FromBody]Requestdisassemble disassemble)
{
return new ObjectResult(1);
}
}
}
...@@ -34,7 +34,7 @@ namespace Siger.ApiACC.Controllers ...@@ -34,7 +34,7 @@ namespace Siger.ApiACC.Controllers
} }
[HttpGet] [HttpGet]
public IActionResult GetPageList(string category, string code, string name, int projectid, int page, int pagesize) public IActionResult GetPageList(string category, string code, string name, int page, int pagesize)
{ {
var data = _toolsAssemblyRepository.GetPagedList(category.ToInt(), code, name, ProjectId, page, pagesize); var data = _toolsAssemblyRepository.GetPagedList(category.ToInt(), code, name, ProjectId, page, pagesize);
return new PagedObjectResult(data.Data, data.Total, page, pagesize); return new PagedObjectResult(data.Data, data.Total, page, pagesize);
......
...@@ -3,6 +3,7 @@ using System.IO; ...@@ -3,6 +3,7 @@ using System.IO;
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using System.Web;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Siger.ApiCommon.Filters; using Siger.ApiCommon.Filters;
using Siger.ApiCommon.Utilities; using Siger.ApiCommon.Utilities;
...@@ -312,5 +313,44 @@ namespace Siger.ApiConfig.Controller ...@@ -312,5 +313,44 @@ namespace Siger.ApiConfig.Controller
return new ObjectResult(new { content = FileUtility.GetText(truePath) }); return new ObjectResult(new { content = FileUtility.GetText(truePath) });
} }
/// <summary>
/// 下载文件
/// </summary>
/// <returns></returns>
[HttpGet]
[NoResultFilter]
public IActionResult DownloadFileByUrl(string url, string name)
{
if (!string.IsNullOrEmpty(url))
{
var file_url = url.Split("Files");
if (url.Length == 2)
{
url = "Files" + file_url[1];
}
}
var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, url).Replace("Files", "TemporaryFiles");
if (!System.IO.File.Exists(path))
{
return new NoContentResult();
}
try
{
var stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
var response = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StreamContent(stream) };
response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
{
FileName = name
};
return File(stream, "application/octet-stream");
}
catch (Exception e)
{
throw new BadRequestException(CommonEnum.Fail);
}
}
} }
} }
\ No newline at end of file
using System.Linq; using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Siger.Middlelayer.Common; using Siger.Middlelayer.Common;
using Siger.Middlelayer.Log;
using Siger.Middlelayer.Repository.Repositories.Interface; using Siger.Middlelayer.Repository.Repositories.Interface;
using Siger.Middlelayer.Repository.Response;
using Siger.Middlelayer.Share.Constant;
namespace Siger.ApiConfig.Controller namespace Siger.ApiConfig.Controller
{ {
public class PositionController : BaseController public class PositionController : BaseController
{ {
private readonly ISigerProjectLevelSectionRepository _projectLevelSection; private readonly ISigerProjectLevelSectionRepository _projectLevelSection;
public PositionController(ISigerProjectLevelSectionRepository projectLevelSection) private readonly ISigerDict _sigerDict;
public PositionController(ISigerProjectLevelSectionRepository projectLevelSection ,ISigerDict sigerDict)
{ {
_projectLevelSection = projectLevelSection; _projectLevelSection = projectLevelSection;
_sigerDict = sigerDict;
} }
[HttpGet] [HttpGet]
...@@ -30,6 +37,8 @@ namespace Siger.ApiConfig.Controller ...@@ -30,6 +37,8 @@ namespace Siger.ApiConfig.Controller
return new ObjectResult(obj); return new ObjectResult(obj);
throw new BadRequestException(CommonEnum.RecordNotFound); throw new BadRequestException(CommonEnum.RecordNotFound);
} }
} }
} }
\ No newline at end of file
...@@ -937,6 +937,10 @@ namespace Siger.ApiWMS.Controllers ...@@ -937,6 +937,10 @@ namespace Siger.ApiWMS.Controllers
foreach (var Location in req.storeArr) foreach (var Location in req.storeArr)
{ {
if (req.storeArr.Count(q => q.val == Location.val) > 1)
{
throw new BadRequestException(RequestEnum.DataExist);
}
var loca = location.Get(q => q.realname == Location.val && q.projectid == ProjectId); var loca = location.Get(q => q.realname == Location.val && q.projectid == ProjectId);
if (loca != null) if (loca != null)
{ {
...@@ -1056,6 +1060,10 @@ namespace Siger.ApiWMS.Controllers ...@@ -1056,6 +1060,10 @@ namespace Siger.ApiWMS.Controllers
foreach (var Location in req.storeArr) foreach (var Location in req.storeArr)
{ {
if (req.storeArr.Count(q => q.val == Location.val) > 1)
{
throw new BadRequestException(RequestEnum.DataExist);
}
var loca = location.Get(q => q.realname == Location.val && q.projectid == ProjectId && q.id != Location.locationid.ToInt()); var loca = location.Get(q => q.realname == Location.val && q.projectid == ProjectId && q.id != Location.locationid.ToInt());
if (loca != null) if (loca != null)
{ {
......
...@@ -67,7 +67,7 @@ namespace Siger.Middlelayer.Common ...@@ -67,7 +67,7 @@ namespace Siger.Middlelayer.Common
/// <summary> /// <summary>
/// MES 自动线类型 /// MES 自动线类型
/// </summary> /// </summary>
public const string Automation = "automation"; public const string Automation = "Automation";
} }
......
...@@ -34,12 +34,9 @@ namespace Siger.Middlelayer.Share.Constant ...@@ -34,12 +34,9 @@ namespace Siger.Middlelayer.Share.Constant
/// </summary> /// </summary>
public const string CleanStation = "CleanStation"; public const string CleanStation = "CleanStation";
/// <summary> /// <summary>
/// key:上料工站 /// key:上料下料工站
/// </summary> /// </summary>
public const string UploadloadStation = "UploadloadStation"; public const string UploadloadStation = "LoadStation";
/// <summary>
/// key:下料工站
/// </summary>
public const string DownloadStation = "DownloadStation";
} }
} }
...@@ -160,5 +160,8 @@ namespace Siger.Middlelayer.AccRepository ...@@ -160,5 +160,8 @@ namespace Siger.Middlelayer.AccRepository
public DbSet<siger_wms_storage> siger_wms_storage { get; set; } public DbSet<siger_wms_storage> siger_wms_storage { get; set; }
public DbSet<siger_wms_storage_location> siger_wms_storage_location { get; set; } public DbSet<siger_wms_storage_location> siger_wms_storage_location { get; set; }
public DbSet<siger_automation_line_mode> siger_automation_line_mode { get; set; }
public DbSet<siger_automation_machine_status> siger_automation_machine_status { get; set; }
} }
} }
...@@ -14,6 +14,11 @@ namespace Siger.Middlelayer.AccRepository.Entities ...@@ -14,6 +14,11 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// 生产线模式 0:手动 1 自动 /// 生产线模式 0:手动 1 自动
/// </summary> /// </summary>
public int mode { get; set; } public int mode { get; set; }
/// <summary>
/// 是否检验
/// </summary>
public int inspect { get; set; }
/// <summary> /// <summary>
/// 更新时间 /// 更新时间
/// </summary> /// </summary>
......
...@@ -39,7 +39,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -39,7 +39,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
productid = q.productid, productid = q.productid,
productname = p.name, productname = p.name,
remark = q.remark, remark = q.remark,
updator = q.updator, updator = u.name ?? "",
updatetime = q.updatetime.HasValue && q.updatetime > DateTime.MinValue ? q.updatetime.Value.ToString(ParameterConstant.DateTimeFormat) : "" updatetime = q.updatetime.HasValue && q.updatetime > DateTime.MinValue ? q.updatetime.Value.ToString(ParameterConstant.DateTimeFormat) : ""
}; };
Expression<Func<ResponseAumationFixtureToolsProduct, bool>> categoryExpression = f => true; Expression<Func<ResponseAumationFixtureToolsProduct, bool>> categoryExpression = f => true;
......
using System;
using System.Collections.Generic;
using System.Text;
namespace Siger.Middlelayer.AccRepository.Request
{
/// <summary>
/// 准备上料
/// </summary>
public class requestAutomationLoading
{
public int section { get; set; }
public string code { get; set; }
}
/// <summary>
/// 安装完成
/// </summary>
public class requestAutoCompalateAssemble
{
public int section { get; set; }
}
/// <summary>
/// 准备下料
/// </summary>
public class requestAutomationUnloading
{
public int section { get; set; }
}
/// <summary>
/// 拆卸
/// </summary>
public class Requestdisassemble
{
public int section { get; set; }
}
}
...@@ -103,7 +103,7 @@ namespace Siger.Middlelayer.AccRepository.Response ...@@ -103,7 +103,7 @@ namespace Siger.Middlelayer.AccRepository.Response
/// </summary> /// </summary>
public string remark { get; set; } public string remark { get; set; }
public int updator { get; set; } public string updator { get; set; }
public string updatetime { get; set; } public string updatetime { get; set; }
} }
......
using System;
using System.Collections.Generic;
using System.Text;
namespace Siger.Middlelayer.AccRepository.Response
{
public class ResponseAutomationInfo
{
/// <summary>
/// 工单信息
/// </summary>
public string wo { get; set; }
public string productCode { get; set; }
public string productName { get; set; }
/// <summary>
/// 工件编码
/// </summary>
public string sn { get; set; }
public int status { get; set; }
public int statusDesc { get; set; }
/// <summary>
/// 储位位置
/// </summary>
public string locationDesc { get; set; }
/// <summary>
/// 工装编号
/// </summary>
public string fixture { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Siger.Middlelayer.Repository.Response
{
public class ResponseLoadStation
{
/// <summary>
/// 工站ID
/// </summary>
public int section { get; set; }
/// <summary>
/// 工站名称
/// </summary>
public string title { get; set; }
/// <summary>
/// 上料位状态
/// </summary>
public int status { get; set; }
}
}
...@@ -373,7 +373,8 @@ CREATE TABLE `siger_automation_line_mode` ( ...@@ -373,7 +373,8 @@ CREATE TABLE `siger_automation_line_mode` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`section` int(11) NOT NULL DEFAULT 0 COMMENT '产线ID', `section` int(11) NOT NULL DEFAULT 0 COMMENT '产线ID',
`projectid` int(11) NOT NULL DEFAULT 0, `projectid` int(11) NOT NULL DEFAULT 0,
`mode` int(11) NOT NULL DEFAULT 1 COMMENT '0:手动模式 1:自动模式', `mode` int(1) NOT NULL DEFAULT 1 COMMENT '0:手动模式 1:自动模式',
`inspect` int(1) NOT NULL DEFAULT 1 COMMENT '0:不需要检验 1:检验',
`updatetime` datetime(0) NULL DEFAULT NULL COMMENT '操作时间', `updatetime` datetime(0) NULL DEFAULT NULL COMMENT '操作时间',
PRIMARY KEY (`id`) USING BTREE PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment