Commit b9a88432 by xin.yang
parents 4cf60917 77fcff6a
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
</div> </div>
</div> </div>
<div slot="footer"> <div slot="footer">
<Button type="text" size="large" @click="this.addmodal=false">{{$t('1033')}}</Button> <Button type="text" size="large" @click="addmodal=false">{{$t('1033')}}</Button>
<Button type="primary" size="large" @click="addPost()">{{$t('1011')}}</Button> <Button type="primary" size="large" @click="addPost()">{{$t('1011')}}</Button>
</div> </div>
</Modal> </Modal>
......
...@@ -143,7 +143,7 @@ ...@@ -143,7 +143,7 @@
</div> </div>
</div> </div>
<div slot="footer"> <div slot="footer">
<Button type="text" size="large" @click="this.addmodal=false">{{$t('1033')}}</Button> <Button type="text" size="large" @click="addmodal=false">{{$t('1033')}}</Button>
<Button type="primary" size="large" @click="addPost()">{{$t('1011')}}</Button> <Button type="primary" size="large" @click="addPost()">{{$t('1011')}}</Button>
</div> </div>
</Modal> </Modal>
......
...@@ -3,6 +3,7 @@ using System.Collections.Generic; ...@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime;
using Siger.Middlelayer.AccRepository.Entities; using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Repositories.Interface; using Siger.Middlelayer.AccRepository.Repositories.Interface;
using Siger.Middlelayer.AccRepository.Request; using Siger.Middlelayer.AccRepository.Request;
...@@ -30,9 +31,11 @@ namespace Siger.ApiACC.Controllers ...@@ -30,9 +31,11 @@ namespace Siger.ApiACC.Controllers
private readonly IAutomationTaskListRepository _automationTaskList; private readonly IAutomationTaskListRepository _automationTaskList;
private readonly IProductPlanDetails _planDetails; private readonly IProductPlanDetails _planDetails;
private readonly IProductPlanRepository _productPlan; private readonly IProductPlanRepository _productPlan;
private readonly IAutomationFixtureMonitor _automationFixtureMonitor;
private readonly IAutomationFixtureToolsProductRepository _automationFixtureToolsProduct;
public AutomationOperateController(IUnitOfWork unitOfWork,ISigerProjectLevelSectionRepository sigerProjectLevelSection , ISigerDict sigerDict,IAutomationMachineStatus automationMachineStatus,ISigerProjectMachineAttributionRepository sigerProjectMachineAttribution,IAutomationTaskListRepository automationTaskList, public AutomationOperateController(IUnitOfWork unitOfWork,ISigerProjectLevelSectionRepository sigerProjectLevelSection , ISigerDict sigerDict,IAutomationMachineStatus automationMachineStatus,ISigerProjectMachineAttributionRepository sigerProjectMachineAttribution,IAutomationTaskListRepository automationTaskList,
IProductPlanDetails planDetails,IProductPlanRepository productPlan) IProductPlanDetails planDetails,IProductPlanRepository productPlan,IAutomationFixtureMonitor automationFixtureMonitor ,IAutomationFixtureToolsProductRepository automationFixtureToolsProduct)
{ {
_unitOfWork = unitOfWork; _unitOfWork = unitOfWork;
_sigerProjectLevelSection = sigerProjectLevelSection; _sigerProjectLevelSection = sigerProjectLevelSection;
...@@ -42,6 +45,8 @@ namespace Siger.ApiACC.Controllers ...@@ -42,6 +45,8 @@ namespace Siger.ApiACC.Controllers
_automationTaskList = automationTaskList; _automationTaskList = automationTaskList;
_planDetails = planDetails; _planDetails = planDetails;
_productPlan = productPlan; _productPlan = productPlan;
_automationFixtureMonitor = automationFixtureMonitor;
_automationFixtureToolsProduct = automationFixtureToolsProduct;
} }
/// <summary> /// <summary>
...@@ -130,15 +135,38 @@ namespace Siger.ApiACC.Controllers ...@@ -130,15 +135,38 @@ namespace Siger.ApiACC.Controllers
[HttpGet] [HttpGet]
public IActionResult GetLoadingState(int section) public IActionResult GetLoadingState(int section)
{ {
var data = new ResponseAutomationInfo var monitor = _automationFixtureMonitor.Get(f => f.section == section);
var result = new ResponsePlanlFixtureInfo
{ {
sn = "sn0001", OrderNumber = monitor.ordernumber,
wo = "wo123123" ProductCode=monitor.productCode,
ProductName=monitor.productName,
Sn=monitor.sn,
status=monitor.status,
Location=monitor.locationId,
}; };
return new ObjectResult(data); return new ObjectResult(result);
}
/// <summary>
/// 扫描
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
[HttpGet]
public IActionResult ScanCode(string code)
{
var result = _automationFixtureToolsProduct.GetPlanFixtureInfo(ProjectId, code);
if (result==null)
{
throw new BadRequestException(CncEnum.PlanHasExist);
}
var sn = _automationTaskList.CreateRandonSn(result.ProductCode);
result.Sn = sn;
return new ObjectResult(result);
} }
/// <summary> /// <summary>
/// 准备上料 -生成指令 /// 准备上料 -生成指令 load
/// </summary> /// </summary>
/// <param name="loading"></param> /// <param name="loading"></param>
/// <returns></returns> /// <returns></returns>
...@@ -179,13 +207,18 @@ namespace Siger.ApiACC.Controllers ...@@ -179,13 +207,18 @@ namespace Siger.ApiACC.Controllers
{ {
throw new BadRequestException(CncEnum.PlanHasExist); throw new BadRequestException(CncEnum.PlanHasExist);
} }
//检查工装
var fixtureToolsObj = _automationFixtureToolsProduct.GetFixtureInfoByProductCode(ProjectId, plan.product_code);
if (fixtureToolsObj == null)
{
throw new BadRequestException(AccEnum.FixtureToolsIsNone);
}
var taskNo = _automationTaskList.CrateTaskNumber(Automation.TaskTrigerType.Manual); var taskNo = _automationTaskList.CrateTaskNumber(Automation.TaskTrigerType.Manual);
var sn = _automationTaskList.CreateRandonSn(plan.product_code); var sn = _automationTaskList.CreateRandonSn(plan.product_code);
_automationTaskList.Insert(new siger_automation_task_list _automationTaskList.Insert(new siger_automation_task_list
{ {
guid=taskNo, no=taskNo,
action= Automation.TaskAction.Step_LK_SXLW, action= Automation.TaskAction.Step_LK_SXLW,
actiontype= Automation.ExcueType.None, actiontype= Automation.ExcueType.None,
triggertime=DateTime.MinValue, triggertime=DateTime.MinValue,
...@@ -201,10 +234,46 @@ namespace Siger.ApiACC.Controllers ...@@ -201,10 +234,46 @@ namespace Siger.ApiACC.Controllers
productid=plan.product_id, productid=plan.product_id,
sn=sn, sn=sn,
ordercode=plandts.OrderNumber, ordercode=plandts.OrderNumber,
remark="手动任务", fixtureguid= fixtureToolsObj.FixtureGuid,
locationid=fixtureToolsObj.Location,
remark ="手动任务",
}); });
var monitor = _automationFixtureMonitor.Get(f => f.fixtureguid == fixtureToolsObj.FixtureGuid);
if (monitor==null)
{
_automationFixtureMonitor.Insert(new siger_automation_fixture_tools_monitor
{
fixtureguid=fixtureToolsObj.FixtureGuid,
projectId=ProjectId,
section=loading.section,
sn=sn,
createtime=DateTime.Now,
updatetime=DateTime.Now,
status=(int)Automation.MachineStatus.Produce,
productCode=plan.product_code,
productName=plan.product_name,
ordernumber=plandts.OrderNumber,
locationId= fixtureToolsObj.Location
});
}
else
{
monitor.sn = sn;
monitor.section = loading.section;
monitor.updatetime = DateTime.Now;
monitor.status = (int)Automation.MachineStatus.Produce;
monitor.productName = plan.product_name;
monitor.productCode = plan.product_code;
monitor.ordernumber = plandts.OrderNumber;
monitor.locationId = fixtureToolsObj.Location;
_automationFixtureMonitor.Update(monitor);
}
if (_unitOfWork.Commit() > 0) if (_unitOfWork.Commit() > 0)
return new ObjectResult(CommonEnum.Succefull); return new ObjectResult(CommonEnum.Succefull);
else else
...@@ -212,7 +281,7 @@ namespace Siger.ApiACC.Controllers ...@@ -212,7 +281,7 @@ namespace Siger.ApiACC.Controllers
} }
/// <summary> /// <summary>
/// 安装完成 -生成指令 /// 安装完成 -生成指令 unload
/// </summary> /// </summary>
/// <param name="assemble"></param> /// <param name="assemble"></param>
/// <returns></returns> /// <returns></returns>
......
...@@ -324,7 +324,9 @@ namespace Siger.Middlelayer.Common.ModuleEnum ...@@ -324,7 +324,9 @@ namespace Siger.Middlelayer.Common.ModuleEnum
[Description("设备正在使用中")] [Description("设备正在使用中")]
MachineBusy, MachineBusy,
[Description("任务进行中")] [Description("任务进行中")]
TaskProcessing TaskProcessing,
[Description("产品工装未找到")]
FixtureToolsIsNone,
} }
public enum SeriNumCfg public enum SeriNumCfg
......
...@@ -9,7 +9,7 @@ namespace Siger.Middlelayer.AccRepository.Entities ...@@ -9,7 +9,7 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// <summary> /// <summary>
/// 工装ID /// 工装ID
/// </summary> /// </summary>
public int fixtureId { get; set; } public string fixtureguid { get; set; }
/// <summary> /// <summary>
/// 当前工站ID /// 当前工站ID
/// </summary> /// </summary>
...@@ -34,5 +34,12 @@ namespace Siger.Middlelayer.AccRepository.Entities ...@@ -34,5 +34,12 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// 更新时间 /// 更新时间
/// </summary> /// </summary>
public DateTime updatetime { get; set; } public DateTime updatetime { get; set; }
public string ordernumber { get; set; }
/// <summary>
///
/// </summary>
public string productCode { get; set; }
public string productName { get; set; }
public int locationId { get; set; }
} }
} }
...@@ -19,6 +19,10 @@ namespace Siger.Middlelayer.AccRepository.Entities ...@@ -19,6 +19,10 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// </summary> /// </summary>
public int productid { get; set; } public int productid { get; set; }
/// <summary> /// <summary>
/// 产品CODE
/// </summary>
public string productcode { get; set; }
/// <summary>
/// 备注 /// 备注
/// </summary> /// </summary>
public string remark { get; set; } public string remark { get; set; }
......
...@@ -10,7 +10,11 @@ namespace Siger.Middlelayer.AccRepository.Entities ...@@ -10,7 +10,11 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// </summary> /// </summary>
public class siger_automation_task_list : AccEntityBase public class siger_automation_task_list : AccEntityBase
{ {
public string guid { get; set; } /// <summary>
/// 任务编号
/// </summary>
public string no { get; set; }
/// <summary> /// <summary>
/// 工位ID /// 工位ID
/// </summary> /// </summary>
...@@ -50,7 +54,7 @@ namespace Siger.Middlelayer.AccRepository.Entities ...@@ -50,7 +54,7 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// <summary> /// <summary>
/// 工装GUID /// 工装GUID
/// </summary> /// </summary>
public int fixturetools { get; set; } public string fixtureguid { get; set; }
/// <summary> /// <summary>
/// Task 执行动作类型 1 手动 2 自动 /// Task 执行动作类型 1 手动 2 自动
......
...@@ -20,6 +20,22 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -20,6 +20,22 @@ namespace Siger.Middlelayer.AccRepository.Repositories
_context = context; _context = context;
} }
public ResponseProductFixtureInfo GetFixtureInfoByProductCode(int projectId, string productCode)
{
var query = from q in _context.siger_automation_fixture_tools_product
join t in _context.siger_automation_fixture_tools on q.fixturetools equals t.guid
join l in _context.siger_automation_location on t.guid equals l.fixturetools
where q.projectId == projectId && q.productcode==productCode && q.status == (int)RowState.Valid && t.status == (int)RowState.Valid
select new ResponseProductFixtureInfo
{
FixtureId=t.id,
FixtureGuid=t.guid,
ProductCode=q.productcode,
Location=l.locationid,
};
return query.FirstOrDefault();
}
public IPagedCollectionResult<ResponseAumationFixtureToolsProduct> GetPagedList(int category, int tool, int product, int projectid, int page, int pagesize) public IPagedCollectionResult<ResponseAumationFixtureToolsProduct> GetPagedList(int category, int tool, int product, int projectid, int page, int pagesize)
{ {
var query = from q in _context.siger_automation_fixture_tools_product var query = from q in _context.siger_automation_fixture_tools_product
...@@ -67,5 +83,25 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -67,5 +83,25 @@ namespace Siger.Middlelayer.AccRepository.Repositories
var totalCount = query.Where(expression).Count(); var totalCount = query.Where(expression).Count();
return new PagedCollectionResult<ResponseAumationFixtureToolsProduct>(entities, totalCount); return new PagedCollectionResult<ResponseAumationFixtureToolsProduct>(entities, totalCount);
} }
public ResponsePlanlFixtureInfo GetPlanFixtureInfo(int projectId, string ordernumber)
{
var query = from d in _context.siger_project_product_plan_detail
join p in _context.siger_project_product_plan on d.PlanId equals p.id
join q in _context.siger_automation_fixture_tools_product on p.product_code equals q.productcode
join t in _context.siger_automation_fixture_tools on q.fixturetools equals t.guid
join l in _context.siger_automation_location on t.guid equals l.fixturetools
where q.projectId == projectId && d.OrderNumber == ordernumber && q.status == (int)RowState.Valid && t.status == (int)RowState.Valid
select new ResponsePlanlFixtureInfo
{
OrderNumber = ordernumber,
ProductName = p.product_name,
ProductCode = q.productcode,
Location = l.locationid,
};
return query.FirstOrDefault();
}
} }
} }
...@@ -8,5 +8,16 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface ...@@ -8,5 +8,16 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
public interface IAutomationFixtureToolsProductRepository : IAccRepositoryBase<siger_automation_fixture_tools_product> public interface IAutomationFixtureToolsProductRepository : IAccRepositoryBase<siger_automation_fixture_tools_product>
{ {
IPagedCollectionResult<ResponseAumationFixtureToolsProduct> GetPagedList(int category, int tool, int product, int projectid, int page, int pagesize); IPagedCollectionResult<ResponseAumationFixtureToolsProduct> GetPagedList(int category, int tool, int product, int projectid, int page, int pagesize);
ResponseProductFixtureInfo GetFixtureInfoByProductCode(int projectId, string productCode);
/// <summary>
/// 工令单获取 工装信息
/// </summary>
/// <param name="ordernumber"></param>
/// <returns></returns>
ResponsePlanlFixtureInfo GetPlanFixtureInfo(int projectId, string ordernumber);
} }
} }
using System;
using System.Collections.Generic;
using System.Text;
namespace Siger.Middlelayer.AccRepository.Response
{
public class ResponseProductFixtureInfo
{
/// <summary>
/// 工装ID
/// </summary>
public int FixtureId { get; set; }
/// <summary>
/// GUID
/// </summary>
public string FixtureGuid { get; set; }
/// <summary>
/// 产品名称
/// </summary>
public string ProductCode { get; set; }
/// <summary>
/// 储位
/// </summary>
public int Location { get; set; }
}
public class ResponsePlanlFixtureInfo
{
/// <summary>
/// 工令单号
/// </summary>
public string OrderNumber { get; set; }
public string ProductCode { get; set; }
public string ProductName { get; set; }
public int status { get; set; }
public int Location { get; set; }
public string Sn { get; set; }
}
}
...@@ -247,6 +247,7 @@ CREATE TABLE IF NOT EXISTS `siger_automation_fixture_tools_product` ( ...@@ -247,6 +247,7 @@ CREATE TABLE IF NOT EXISTS `siger_automation_fixture_tools_product` (
`guid` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `guid` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`fixturetools` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'siger_automation_fixture_tools.guid', `fixturetools` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'siger_automation_fixture_tools.guid',
`productid` int(11) NOT NULL DEFAULT 0 COMMENT '产品ID', `productid` int(11) NOT NULL DEFAULT 0 COMMENT '产品ID',
`productcode` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品CODE',
`remark` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', `remark` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
`attachment` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '附件', `attachment` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '附件',
`filename` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '附件名称', `filename` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '附件名称',
...@@ -325,7 +326,8 @@ CREATE TABLE IF NOT EXISTS `siger_automation_section_route` ( ...@@ -325,7 +326,8 @@ CREATE TABLE IF NOT EXISTS `siger_automation_section_route` (
-- ---------------------------- -- ----------------------------
CREATE TABLE IF NOT EXISTS `siger_automation_task_list` ( CREATE TABLE IF NOT EXISTS `siger_automation_task_list` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`guid` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `no` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`fixtureguid` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`sectionid` int(11) NOT NULL DEFAULT 0 COMMENT '工位ID', `sectionid` int(11) NOT NULL DEFAULT 0 COMMENT '工位ID',
`trigger` int(1) NOT NULL DEFAULT 0 COMMENT '触发方', `trigger` int(1) NOT NULL DEFAULT 0 COMMENT '触发方',
`tasktype` int(1) NOT NULL DEFAULT 0 COMMENT '任务类型', `tasktype` int(1) NOT NULL DEFAULT 0 COMMENT '任务类型',
...@@ -382,7 +384,7 @@ CREATE TABLE `siger_automation_line_mode` ( ...@@ -382,7 +384,7 @@ CREATE TABLE `siger_automation_line_mode` (
) 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;
-- ---------------------------- -- ----------------------------
-- 生产线模式 -- 生产操作记录
-- Table structure for siger_automation_produce_history -- Table structure for siger_automation_produce_history
-- ---------------------------- -- ----------------------------
...@@ -404,4 +406,28 @@ CREATE TABLE `siger_automation_produce_history` ( ...@@ -404,4 +406,28 @@ CREATE TABLE `siger_automation_produce_history` (
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;
-- ----------------------------
-- 工装实时状态
-- Table structure for siger_automation_fixture_tools_moniter
-- ----------------------------
DROP TABLE IF EXISTS `siger_automation_fixture_tools_moniter`;
CREATE TABLE `siger_automation_fixture_tools_moniter` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`projectid` int(11) NOT NULL DEFAULT 0,
`fixtureguid` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工装ID',
`section` int(11) NOT NULL DEFAULT 0 COMMENT '当前工站ID',
`sn` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '当前绑定工件',
`route` int(1) NOT NULL DEFAULT 1 COMMENT '工序ID',
`routedesc` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '当前工序',
`createtime` datetime(0) NULL DEFAULT NULL COMMENT '添加时间',
`updatetime` datetime(0) NULL DEFAULT NULL COMMENT '操作时间',
`ordernumber` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工令单',
`productCode` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品CODE',
`productName` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品名称',
`locationId` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1; SET FOREIGN_KEY_CHECKS = 1;
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