Commit 245ebee1 by yiyu.li
parents 510acdf2 853b014c
...@@ -6661,6 +6661,8 @@ export default { ...@@ -6661,6 +6661,8 @@ export default {
'8220': '未备模', '8220': '未备模',
'8221': '备模中', '8221': '备模中',
'8222': '备模完成', '8222': '备模完成',
'8223': '请填写项次',
'8224': '项次必须是正整数',
'120001': '模具未找到', '120001': '模具未找到',
'120002': '模具类型不能为空', '120002': '模具类型不能为空',
......
...@@ -2109,6 +2109,8 @@ export default { ...@@ -2109,6 +2109,8 @@ export default {
'3000174': '储位不存在', '3000174': '储位不存在',
'3000175': '工序加工未完成', '3000175': '工序加工未完成',
'3000176': '工序未开始加工', '3000176': '工序未开始加工',
'3000177': '同步报表记录失败',
'3000178': '请勿重复提交任务',
'400000': '设备状态', '400000': '设备状态',
'400002': '更改状态', '400002': '更改状态',
...@@ -6952,6 +6954,8 @@ export default { ...@@ -6952,6 +6954,8 @@ export default {
'8220': '未备模', '8220': '未备模',
'8221': '备模中', '8221': '备模中',
'8222': '备模完成', '8222': '备模完成',
'8223': '请填写项次',
'8224': '项次必须是正整数',
// ims专用,不要接着写 // ims专用,不要接着写
'120001': '模具未找到', '120001': '模具未找到',
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
{{ {{
item.status == 1 item.status == 1
? "待上料" ? "待上料"
: orderDetail.status == 2 : item.status == 2
? "运行中" ? "运行中"
: "待下料" : "待下料"
}} }}
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
? "执行中" ? "执行中"
: orderDetail.status == 3 : orderDetail.status == 3
? "执行完毕" ? "执行完毕"
: "未下发" : ""
}}</span> }}</span>
</p> </p>
<p class="flex"> <p class="flex">
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
:data="data2" :data="data2"
:columns="columns2" :columns="columns2"
:max-height="200" :max-height="200"
style="width: 500px" style="width: 680px"
highlight-row highlight-row
@on-current-change="handleRowChange1" @on-current-change="handleRowChange1"
></Table> ></Table>
...@@ -200,7 +200,7 @@ ...@@ -200,7 +200,7 @@
? "执行中" ? "执行中"
: orderDetail2.status == 3 : orderDetail2.status == 3
? "执行完毕" ? "执行完毕"
: "未下发" : ""
}}</span> }}</span>
</p> </p>
<p class="flex"> <p class="flex">
...@@ -324,18 +324,30 @@ export default { ...@@ -324,18 +324,30 @@ export default {
}, },
width: 70, width: 70,
}, },
{
title: "仓库",
key: "wavehouse",
width: 70,
},
{ {
title: "储位编号", title: "储位",
key: "locationid", key: "locationid",
width: 70,
}, },
{ {
title: "工装编号", title: "工装编号",
key: "code", key: "code",
width: 160,
}, },
{ {
title: "工件编号", title: "工件编号",
key: "materialsn", key: "materialsn",
}, },
{
title: "下一工序",
key: "route",
width: 100,
},
], ],
data2: [], data2: [],
orderDetail: {}, orderDetail: {},
...@@ -403,6 +415,7 @@ export default { ...@@ -403,6 +415,7 @@ export default {
this.sectionid = this.stationList[index].section; this.sectionid = this.stationList[index].section;
this.orderDetail = {}; this.orderDetail = {};
this.code="";
// status = 2; // status = 2;
// if (status == 3) { // if (status == 3) {
// this.attr1 = true; // this.attr1 = true;
...@@ -421,6 +434,7 @@ export default { ...@@ -421,6 +434,7 @@ export default {
this.tabindex = name; this.tabindex = name;
if (this.tabindex == "2") { if (this.tabindex == "2") {
this.orderDetail2 = {}; this.orderDetail2 = {};
} }
this.getStorages(); this.getStorages();
}, },
...@@ -432,7 +446,8 @@ export default { ...@@ -432,7 +446,8 @@ export default {
: ""; : "";
let data = { let data = {
fillsn: this.tabindex == "1" ? 0 : 1, fillsn: this.tabindex == "1" ? 0 : 1,
productcode: code, // productcode: code,
productcode: this.tabindex == "1" ? code:"",
}; };
this.request("/acc/AutomationLocation/GetLocationList", data, "get") this.request("/acc/AutomationLocation/GetLocationList", data, "get")
.then((res) => { .then((res) => {
...@@ -449,6 +464,7 @@ export default { ...@@ -449,6 +464,7 @@ export default {
getWorkOrderInfo() { getWorkOrderInfo() {
let data = { let data = {
code: this.code, code: this.code,
section:this.sectionid
}; };
this.request("/acc/AutomationOperate/ScanCode", data, "get") this.request("/acc/AutomationOperate/ScanCode", data, "get")
.then((res) => { .then((res) => {
...@@ -640,7 +656,7 @@ export default { ...@@ -640,7 +656,7 @@ export default {
if (this.locationobj.id) { if (this.locationobj.id) {
// this.getRunningDetail(); // this.getRunningDetail();
this.request( this.request(
"/acc/AutomationOperate/ScanCode?id=" + this.locationobj.id, "/acc/AutomationOperate/ScanCode?id=" + this.locationobj.id +"&section="+this.sectionids,
"", "",
"get" "get"
) )
......
...@@ -22,13 +22,13 @@ ...@@ -22,13 +22,13 @@
@click="search()" @click="search()"
>{{ $t("1001") }}</Button >{{ $t("1001") }}</Button
> >
<Button <!-- <Button
type="primary" type="primary"
class="twoWord" class="twoWord"
icon="ios-search" icon="ios-search"
@click="exportExcel()" @click="exportExcel()"
>导出</Button >导出</Button
> > -->
</div> </div>
</div> </div>
</div> </div>
...@@ -187,7 +187,7 @@ export default { ...@@ -187,7 +187,7 @@ export default {
}, },
{ {
title: "最后更新时间", title: "最后更新时间",
key: "workpiece_sn", key: "lastupdate",
}, },
], ],
data1: [], data1: [],
......
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
<Option :value="1">待执行</Option> <Option :value="1">待执行</Option>
<Option :value="2">执行中</Option> <Option :value="2">执行中</Option>
<Option :value="3">执行完成</Option> <Option :value="3">执行完成</Option>
<Option :value="4">取消</Option>
</Select> </Select>
</div> </div>
<div class="filter"> <div class="filter">
...@@ -193,58 +193,70 @@ export default { ...@@ -193,58 +193,70 @@ export default {
params.index + (this.page - 1) * this.pagesize + 1 params.index + (this.page - 1) * this.pagesize + 1
); );
}, },
width: 70, width: 50,
}, },
{ {
title: "任务编号", title: "任务编号",
key: "taskno", key: "taskno",
width: 150, width: 150,
}, },
{
title: "发起工站",
key: "fromsection",
width: 100,
},
{ {
title: "产线层级", title: "目标工站",
key: "section", key: "section",
width: 150, width: 170,
}, },
{ {
title: "触发方", title: "触发方",
key: "trigger", key: "trigger",
width: 100,
}, },
{ {
title: "任务类型", title: "任务类型",
key: "tasktype", key: "tasktype",
width: 100,
}, },
{ {
title: "工件编号", title: "工件编号",
key: "sn", key: "sn",
width: 150, width: 230,
}, },
{ {
title: "工单编号", title: "工单编号",
key: "ordernumber", key: "ordernumber",
width: 100,
}, },
{ {
title: "产品编号", title: "产品编号",
key: "productCode", key: "productCode",
width: 130,
}, },
{ // {
title: "工序编号", // title: "工序编号",
key: "routeNo", // key: "routeNo",
}, // },
{ {
title: "工序名称", title: "工序名称",
key: "route", key: "route",
width: 90,
}, },
{ {
title: "程序号", title: "程序号",
key: "program", key: "program",
}, },
{ {
title: "储位位置", title: "储位",
key: "location", key: "location",
width: 70,
}, },
{ {
title: "工装编号", title: "工装编号",
key: "fixtureCode", key: "fixtureCode",
width: 160,
}, },
{ {
title: "动作", title: "动作",
...@@ -256,34 +268,69 @@ export default { ...@@ -256,34 +268,69 @@ export default {
key: "actionType", key: "actionType",
}, },
{ {
title: "下发状态",
key: "send",
width: 100,
render: (h, params) => {
let str = "",bgc="";
switch (params.row.send) {
case 0:
str = "未下发";
bgc='Olive'
break;
case 1:
str = "已下发";
bgc='Green'
break;
}
return h("div",{
style:{
'background':bgc,
'color':'#fff'
}
} ,str);
},
},
{
title: "状态", title: "状态",
key: "status", key: "status",
render: (h, params) => { render: (h, params) => {
let str = ""; let str = "",bgc="";
switch (params.row.status) { switch (params.row.status) {
case 1: case 1:
str = "待执行"; str = "待执行";
bgc='Olive'
break; break;
case 2: case 2:
str = "执行中"; str = "执行中";
bgc='Orange'
break; break;
case 3: case 3:
str = "执行完成"; str = "执行完成";
bgc='Green'
break; break;
case 4: case 4:
str = "取消"; str = "取消";
bgc='Silver'
break; break;
} }
return h("div", str); return h("div",{
style:{
'background':bgc,
'color':'#fff'
}
} ,str);
}, },
}, },
{ {
title: "触发时间", title: "触发时间",
key: "triggerTime", key: "triggerTime",
width: 160,
}, },
{ {
title: "完成时间", title: "完成时间",
key: "complatetime", key: "complatetime",
width: 160,
}, },
], ],
data1: [], data1: [],
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
IIS configuration sections. IIS configuration sections.
...@@ -163,7 +163,7 @@ ...@@ -163,7 +163,7 @@
</site> </site>
<site name="Siger.ApiConfig" id="2"> <site name="Siger.ApiConfig" id="2">
<application path="/" applicationPool="Siger.ApiConfig AppPool"> <application path="/" applicationPool="Siger.ApiConfig AppPool">
<virtualDirectory path="/" physicalPath="E:\gitlabcode\Laisi_AutoMES2\Server\Apis\Siger.ApiConfig" /> <virtualDirectory path="/" physicalPath="D:\Code\20210208\Laisi_AutoMES2\Server\Apis\Siger.ApiConfig" />
</application> </application>
<bindings> <bindings>
<binding protocol="http" bindingInformation="*:9002:localhost" /> <binding protocol="http" bindingInformation="*:9002:localhost" />
...@@ -171,7 +171,7 @@ ...@@ -171,7 +171,7 @@
</site> </site>
<site name="Siger.ApiQMS" id="3"> <site name="Siger.ApiQMS" id="3">
<application path="/" applicationPool="Siger.ApiQMS AppPool"> <application path="/" applicationPool="Siger.ApiQMS AppPool">
<virtualDirectory path="/" physicalPath="D:\Code\20201209\siger-main\Server\Apis\Siger.ApiQMS" /> <virtualDirectory path="/" physicalPath="D:\Code\20210208\Laisi_AutoMES2\Server\Apis\Siger.ApiQMS" />
</application> </application>
<bindings> <bindings>
<binding protocol="http" bindingInformation="*:9013:localhost" /> <binding protocol="http" bindingInformation="*:9013:localhost" />
...@@ -179,7 +179,7 @@ ...@@ -179,7 +179,7 @@
</site> </site>
<site name="Siger.ApiACC" id="4"> <site name="Siger.ApiACC" id="4">
<application path="/" applicationPool="Siger.ApiACC AppPool"> <application path="/" applicationPool="Siger.ApiACC AppPool">
<virtualDirectory path="/" physicalPath="D:\Code\20201209\siger-main\Server\Apis\Siger.ApiACC" /> <virtualDirectory path="/" physicalPath="D:\Code\20210208\Laisi_AutoMES2\Server\Apis\Siger.ApiACC" />
</application> </application>
<bindings> <bindings>
<binding protocol="http" bindingInformation="*:9003:localhost" /> <binding protocol="http" bindingInformation="*:9003:localhost" />
...@@ -187,7 +187,7 @@ ...@@ -187,7 +187,7 @@
</site> </site>
<site name="Siger.ApiCNC" id="5"> <site name="Siger.ApiCNC" id="5">
<application path="/" applicationPool="Siger.ApiCNC AppPool"> <application path="/" applicationPool="Siger.ApiCNC AppPool">
<virtualDirectory path="/" physicalPath="D:\Code\20201209\siger-main\Server\Apis\Siger.ApiCNC" /> <virtualDirectory path="/" physicalPath="D:\Code\20210208\Laisi_AutoMES2\Server\Apis\Siger.ApiCNC" />
</application> </application>
<bindings> <bindings>
<binding protocol="http" bindingInformation="*:9008:localhost" /> <binding protocol="http" bindingInformation="*:9008:localhost" />
...@@ -1030,7 +1030,7 @@ ...@@ -1030,7 +1030,7 @@
<handlers> <handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" /> <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers> </handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" stdoutLogEnabled="false" hostingModel="InProcess" startupTimeLimit="3600" requestTimeout="23:00:00" /> <aspNetCore processPath="%LAUNCHER_PATH%" stdoutLogEnabled="false" hostingModel="InProcess" startupTimeLimit="3600" requestTimeout="23:00:00" arguments="%LAUNCHER_ARGS%" />
<httpCompression> <httpCompression>
<dynamicTypes> <dynamicTypes>
<add mimeType="text/event-stream" enabled="false" /> <add mimeType="text/event-stream" enabled="false" />
......
...@@ -44,10 +44,12 @@ namespace Siger.ApiACC.Controllers ...@@ -44,10 +44,12 @@ namespace Siger.ApiACC.Controllers
private readonly IProductRouteRepository _productRoute; private readonly IProductRouteRepository _productRoute;
private readonly IAutomationSectionPropertyRepository _automationSectionProperty; private readonly IAutomationSectionPropertyRepository _automationSectionProperty;
private readonly IAutomationProduceHistoryRepository _automationProduceHistory; private readonly IAutomationProduceHistoryRepository _automationProduceHistory;
private readonly ISigerProjectProductReport _sigerProjectProduct;
public AutomationController(IUnitOfWork unitOfWork, ISigerProjectLevelSectionRepository sigerProjectLevelSection, IAutomationLineMode automationLineMode, IAutomationMachineStatus automationMachineStatus, ISigerDict sigerDict, IAutomationTaskListRepository automationTaskList, public AutomationController(IUnitOfWork unitOfWork, ISigerProjectLevelSectionRepository sigerProjectLevelSection, IAutomationLineMode automationLineMode, IAutomationMachineStatus automationMachineStatus, ISigerDict sigerDict, IAutomationTaskListRepository automationTaskList,
ISigerProjectMachineAttributionRepository sigerProjectMachineAttribution, IAutomationFixtureMonitor automationFixtureMonitor, IAutomationLocationRepository automationLocation, IProductionBeatSetRepository productionBeatSet, IAutomationFixtureToolsProductRepository automationFixtureToolsProduct, ISigerProjectMachineAttributionRepository sigerProjectMachineAttribution, IAutomationFixtureMonitor automationFixtureMonitor, IAutomationLocationRepository automationLocation, IProductionBeatSetRepository productionBeatSet, IAutomationFixtureToolsProductRepository automationFixtureToolsProduct,
IAutomationFixtureToolsRepository automationFixtureTools, IProductRouteRepository productRoute, IAutomationSectionPropertyRepository automationSectionProperty, IAutomationProduceHistoryRepository automationProduceHistory) IAutomationFixtureToolsRepository automationFixtureTools, IProductRouteRepository productRoute, IAutomationSectionPropertyRepository automationSectionProperty, IAutomationProduceHistoryRepository automationProduceHistory, ISigerProjectProductReport sigerProjectProduct,IProductPlanDetails planDetails)
{ {
_unitOfWork = unitOfWork; _unitOfWork = unitOfWork;
_sigerProjectLevelSection = sigerProjectLevelSection; _sigerProjectLevelSection = sigerProjectLevelSection;
...@@ -64,6 +66,8 @@ namespace Siger.ApiACC.Controllers ...@@ -64,6 +66,8 @@ namespace Siger.ApiACC.Controllers
_productRoute = productRoute; _productRoute = productRoute;
_automationSectionProperty = automationSectionProperty; _automationSectionProperty = automationSectionProperty;
_automationProduceHistory = automationProduceHistory; _automationProduceHistory = automationProduceHistory;
_sigerProjectProduct = sigerProjectProduct;
} }
/// <summary> /// <summary>
...@@ -286,9 +290,6 @@ namespace Siger.ApiACC.Controllers ...@@ -286,9 +290,6 @@ namespace Siger.ApiACC.Controllers
} }
} }
//PLC 反馈结束. //PLC 反馈结束.
if (status == (int)TaskResultStatus.Complated) if (status == (int)TaskResultStatus.Complated)
{ {
...@@ -309,7 +310,7 @@ namespace Siger.ApiACC.Controllers ...@@ -309,7 +310,7 @@ namespace Siger.ApiACC.Controllers
if (sectionProperty.propertytype == 1) if (sectionProperty.propertytype == 1)
{ {
var download = false; var download = false;
if (sectionProperty.down > 2) if (sectionProperty.down > 1)
{ {
// 是拆卸 // 是拆卸
download = true; download = true;
...@@ -332,9 +333,15 @@ namespace Siger.ApiACC.Controllers ...@@ -332,9 +333,15 @@ namespace Siger.ApiACC.Controllers
sectionProperty.down = 0; sectionProperty.down = 0;
_automationSectionProperty.Update(sectionProperty); _automationSectionProperty.Update(sectionProperty);
//上下料位状态 为后台控制
var machineStatusObj = _automationMachineStatus.Get(f => f.section == taskObj.extend1.ToInt());
if (machineStatusObj != null)
{
machineStatusObj.status = (int)Automation.MachineStatus.Waiting;
_automationMachineStatus.Update(machineStatusObj);
}
} }
//从立库储位拿SN 工件到上料位 ////从立库储位拿SN 工件到上料位
if (taskObj.action == TaskAction.Step_LK_SXLW) if (taskObj.action == TaskAction.Step_LK_SXLW)
{ {
location.sn = taskObj.sn; location.sn = taskObj.sn;
...@@ -347,20 +354,38 @@ namespace Siger.ApiACC.Controllers ...@@ -347,20 +354,38 @@ namespace Siger.ApiACC.Controllers
location.status = (int)LocationStatus.Out; location.status = (int)LocationStatus.Out;
_automationLocation.Update(location); _automationLocation.Update(location);
//上下料位状态 为后台控制
var machineStatusObj = _automationMachineStatus.Get(f => f.section == taskObj.extend1.ToInt());
if (machineStatusObj != null)
{
machineStatusObj.status = (int)Automation.MachineStatus.Produce;
_automationMachineStatus.Update(machineStatusObj);
}
} }
//需要抽检时(准备下料) ,立库到抽检台
//上料中 if (taskObj.action == TaskAction.Step_LK_CJT)
if (sectionProperty.upload != 0)
{
sectionProperty.upload += 1;
_automationSectionProperty.Update(sectionProperty);
}
if (sectionProperty.down != 0)
{ {
sectionProperty.down += 1; //QC 设备状态 为后台控制
_automationSectionProperty.Update(sectionProperty); var machineStatusObj = _automationMachineStatus.Get(f => f.section == taskObj.sectionid);
if (machineStatusObj != null)
{
machineStatusObj.status = (int)Automation.MachineStatus.Produce;
_automationMachineStatus.Update(machineStatusObj);
}
location.status = (int)LocationStatus.Out;
_automationLocation.Update(location);
} }
////准备下料 不经过抽检台
//if (sectionProperty.down != 0)
//{
// sectionProperty.down += 1;
// _automationSectionProperty.Update(sectionProperty);
//}
} }
// CNC 设备 // CNC 设备
if (sectionProperty.propertytype == 2) if (sectionProperty.propertytype == 2)
...@@ -370,11 +395,44 @@ namespace Siger.ApiACC.Controllers ...@@ -370,11 +395,44 @@ namespace Siger.ApiACC.Controllers
location.status = (int)LocationStatus.Out; location.status = (int)LocationStatus.Out;
_automationLocation.Update(location); _automationLocation.Update(location);
} }
if(taskObj.action== TaskAction.Step_JGZX_QXJ)
{
//插入报工记录
//var entity = new siger_project_product_report
//{
// draw_number = "",
// plan_id = 0,
// product_name = taskObj.productname,
// code = taskObj.ordercode,
// end_time = UnixTimeHelper.GetNow(),
// station = taskObj.sectionid,
// industrial_waste = 0,
// material_waste = 0,
// start_time = UnixTimeHelper.GetNow(),
// worker_code = "",
// worker_name = "",
// uid = 0,
// projectid = PID,
// time = UnixTimeHelper.GetNow(),
// processid = 0,
// nok_number = 0,
// output = 1,
// actual_output = 1,
// product_code = taskObj.productcode
//};
//if (_sigerProjectProduct.InsertProductReportData(entity) < 0)
//{
// throw new BadRequestException(AccEnum.SyncSnReportErro);
//}
}
} }
//抽检台 //抽检台
if (sectionProperty.propertytype == 3) if (sectionProperty.propertytype == 3)
{ {
if (taskObj.action == TaskAction.Step_LK_CJT) if (taskObj.action == TaskAction.Step_LK_CJT)
{ {
location.status = (int)LocationStatus.Out; location.status = (int)LocationStatus.Out;
...@@ -382,6 +440,34 @@ namespace Siger.ApiACC.Controllers ...@@ -382,6 +440,34 @@ namespace Siger.ApiACC.Controllers
} }
if (taskObj.action == TaskAction.Step_CJT_SXLW) if (taskObj.action == TaskAction.Step_CJT_SXLW)
{ {
//抽检台 空闲
var qcStatusObj = _automationMachineStatus.Get(f => f.section == taskObj.extend1.ToInt());
if (qcStatusObj != null)
{
qcStatusObj.status = (int)Automation.MachineStatus.Waiting;
_automationMachineStatus.Update(qcStatusObj);
}
//上料位加工中
var machineStatusObj = _automationMachineStatus.Get(f => f.section == taskObj.sectionid);
if (machineStatusObj != null)
{
machineStatusObj.status = (int)Automation.MachineStatus.Produce;
_automationMachineStatus.Update(machineStatusObj);
}
var _Property = _automationSectionProperty.Get(f => f.sectionid == taskObj.sectionid);
if (_Property == null)
{
Logger.WriteLineInfo($"PlCfeeback 未找到该工装储位信息");
throw new BadRequestException(AccEnum.MachineDisable);
}
//准备下料,经过抽检台
//if (_Property.down != 0)
//{
// _Property.down += 1;
// _automationSectionProperty.Update(_Property);
//}
} }
...@@ -410,11 +496,69 @@ namespace Siger.ApiACC.Controllers ...@@ -410,11 +496,69 @@ namespace Siger.ApiACC.Controllers
location.routeid = route; location.routeid = route;
location.route = route.ToString(); location.route = route.ToString();
location.status = (int)LocationStatus.In; location.status = (int)LocationStatus.In;
location.updatetime = DateTime.Now;
_automationLocation.Update(location); _automationLocation.Update(location);
Logger.WriteLineInfo($"PlCfeeback 工装储位{taskObj.locationid} 工序{location.routeid} 下一工序{route}更新完成"); Logger.WriteLineInfo($"PlCfeeback 工装储位{taskObj.locationid} 工序{location.routeid} 下一工序{route}更新完成");
} }
} }
//立库
if (sectionProperty.propertytype==5)
{
//上下料位状态 为后台控制
var machineStatusObj = _automationMachineStatus.Get(f => f.section == taskObj.sectionid);
//从立库储位拿SN 工件到上料位
if (taskObj.action == TaskAction.Step_LK_SXLW)
{
location.sn = taskObj.sn;
location.ordernumber = taskObj.ordercode;
location.productcode = taskObj.productcode;
location.productid = taskObj.productid;
location.productname = taskObj.productname;
location.route = taskObj.route.ToString();
location.routeid = taskObj.route;
location.status = (int)LocationStatus.Out;
_automationLocation.Update(location);
if (machineStatusObj != null)
{
machineStatusObj.status = (int)Automation.MachineStatus.Produce;
_automationMachineStatus.Update(machineStatusObj);
}
}
//需要抽检时(准备下料) ,立库到抽检台
if (taskObj.action == TaskAction.Step_LK_CJT)
{
if (machineStatusObj != null)
{
machineStatusObj.status = (int)Automation.MachineStatus.Produce;
_automationMachineStatus.Update(machineStatusObj);
}
}
if (taskObj.action == TaskAction.Step_LK_JGZX)
{
location.status = (int)LocationStatus.Out;
_automationLocation.Update(location);
}
var _Property = _automationSectionProperty.Get(f => f.sectionid == taskObj.sectionid);
if (_Property==null)
{
Logger.WriteLineInfo($"PlCfeeback 未找到该工装储位信息");
throw new BadRequestException(AccEnum.MachineDisable);
}
//上料中
//if (_Property.upload != 0)
//{
// _Property.upload += 1;
// _automationSectionProperty.Update(_Property);
//}
//if (_Property.down != 0)
//{
// _Property.down += 1;
// _automationSectionProperty.Update(_Property);
//}
}
//添加当前监控 //添加当前监控
if (monitor == null) if (monitor == null)
...@@ -602,10 +746,11 @@ namespace Siger.ApiACC.Controllers ...@@ -602,10 +746,11 @@ namespace Siger.ApiACC.Controllers
Logger.WriteLineError($"AutoProcess CNC加工中心空闲,上一个任务与本次任务指令重复"); Logger.WriteLineError($"AutoProcess CNC加工中心空闲,上一个任务与本次任务指令重复");
return; //任务已经创建 return; //任务已经创建
} }
var _sectProperty = _automationSectionProperty.Get(f => f.propertytype == 5);
Logger.WriteLineInfo($"自动化业务流转--AutoProcess section{location.section} task:{TaskAction.Step_LK_JGZX.ToStr()} sn {location.sn}"); Logger.WriteLineInfo($"自动化业务流转--AutoProcess section{location.section} task:{TaskAction.Step_LK_JGZX.ToStr()} sn {location.sn}");
if (TargetFree(location.section, location.section, TaskAction.Step_LK_JGZX)) if (TargetFree(location.section, location.section, TaskAction.Step_LK_JGZX))
{ {
CreateTask(location.section, location.section, TaskActionType.Load, TaskAction.Step_LK_JGZX, location.fixture, location.fixturename, location.ordernumber, location.sn, location.pn, location.productId, location.productCode, location.productName, location.location, location.route); CreateTask(location.section, _sectProperty!=null? _sectProperty.sectionid: location.section, TaskActionType.Load, TaskAction.Step_LK_JGZX, location.fixture, location.fixturename, location.ordernumber, location.sn, location.pn, location.productId, location.productCode, location.productName, location.location, location.route);
} }
} }
...@@ -619,6 +764,7 @@ namespace Siger.ApiACC.Controllers ...@@ -619,6 +764,7 @@ namespace Siger.ApiACC.Controllers
if (fullAllMachine.Any() && cleanMachine.status == (int)Automation.MachineStatus.Waiting) if (fullAllMachine.Any() && cleanMachine.status == (int)Automation.MachineStatus.Waiting)
{ {
Logger.WriteLineError($"AutoProcess 清洗机空闲,创建普通设备下料到清洗机Task "); Logger.WriteLineError($"AutoProcess 清洗机空闲,创建普通设备下料到清洗机Task ");
//清洗机上料 为 任务触发 触发 //清洗机上料 为 任务触发 触发
if (tasklist != null && fullAllMachine.Where(p => p.section == tasklist.sectionid).Any()) if (tasklist != null && fullAllMachine.Where(p => p.section == tasklist.sectionid).Any())
{ {
......
...@@ -19,6 +19,7 @@ using Siger.Middlelayer.Utility.ImportEntities; ...@@ -19,6 +19,7 @@ using Siger.Middlelayer.Utility.ImportEntities;
using Siger.Middlelayer.Utility.Helpers; using Siger.Middlelayer.Utility.Helpers;
using System.IO; using System.IO;
using Siger.Middlelayer.Log; using Siger.Middlelayer.Log;
using Siger.Middlelayer.Common.ModuleEnum;
namespace Siger.ApiACC.Controllers namespace Siger.ApiACC.Controllers
{ {
...@@ -267,6 +268,10 @@ namespace Siger.ApiACC.Controllers ...@@ -267,6 +268,10 @@ namespace Siger.ApiACC.Controllers
{ {
throw new BadRequestException(CommonEnum.RecordNotFound); throw new BadRequestException(CommonEnum.RecordNotFound);
} }
if (!string.IsNullOrEmpty(entity.sn))
{
throw new BadRequestException(AccEnum.LocationSnExits);
}
var fixturetool = _toolsRepository.Get(q => q.id == req.fixturetoolid.ToInt() && q.projectId == ProjectId); var fixturetool = _toolsRepository.Get(q => q.id == req.fixturetoolid.ToInt() && q.projectId == ProjectId);
if (fixturetool == null) if (fixturetool == null)
{ {
...@@ -315,7 +320,10 @@ namespace Siger.ApiACC.Controllers ...@@ -315,7 +320,10 @@ namespace Siger.ApiACC.Controllers
{ {
throw new BadRequestException(CommonEnum.RecordNotFound); throw new BadRequestException(CommonEnum.RecordNotFound);
} }
if (!string.IsNullOrEmpty(entity.sn))
{
throw new BadRequestException(AccEnum.LocationSnExits);
}
entity.status = (int)RowState.Invalid; entity.status = (int)RowState.Invalid;
_autoLocationRepository.Update(entity); _autoLocationRepository.Update(entity);
if (_unitOfWork.Commit() > 0) if (_unitOfWork.Commit() > 0)
......
...@@ -46,10 +46,12 @@ namespace Siger.ApiACC.Controllers ...@@ -46,10 +46,12 @@ namespace Siger.ApiACC.Controllers
private readonly IProductRouteRepository _productRoute; private readonly IProductRouteRepository _productRoute;
private readonly IAutomationSectionPropertyRepository _sectionPropertyRepository; private readonly IAutomationSectionPropertyRepository _sectionPropertyRepository;
private readonly IAutomationProduceHistoryRepository _automationProduceHistory; private readonly IAutomationProduceHistoryRepository _automationProduceHistory;
private readonly ISigerProjectProductRepository _sigerProjectProduct;
private readonly IProductionBeatSetRepository _productionBeatSet;
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,IAutomationFixtureMonitor automationFixtureMonitor ,IAutomationFixtureToolsProductRepository automationFixtureToolsProduct,IAutomationFixtureToolsRepository automationFixtureTools, IAutomationLocationRepository automationLocation, IProductPlanDetails planDetails,IProductPlanRepository productPlan,IAutomationFixtureMonitor automationFixtureMonitor ,IAutomationFixtureToolsProductRepository automationFixtureToolsProduct,IAutomationFixtureToolsRepository automationFixtureTools, IAutomationLocationRepository automationLocation,
IAutomationLineMode automationLine, IProductRouteRepository productRoute, IAutomationSectionPropertyRepository sectionPropertyRepository,IAutomationProduceHistoryRepository automationProduceHistory) IAutomationLineMode automationLine, IProductRouteRepository productRoute, IAutomationSectionPropertyRepository sectionPropertyRepository,IAutomationProduceHistoryRepository automationProduceHistory,ISigerProjectProductRepository sigerProjectProduct,IProductionBeatSetRepository productionBeatSet )
{ {
_unitOfWork = unitOfWork; _unitOfWork = unitOfWork;
_sigerProjectLevelSection = sigerProjectLevelSection; _sigerProjectLevelSection = sigerProjectLevelSection;
...@@ -67,6 +69,8 @@ namespace Siger.ApiACC.Controllers ...@@ -67,6 +69,8 @@ namespace Siger.ApiACC.Controllers
_productRoute = productRoute; _productRoute = productRoute;
_sectionPropertyRepository = sectionPropertyRepository; _sectionPropertyRepository = sectionPropertyRepository;
_automationProduceHistory = automationProduceHistory; _automationProduceHistory = automationProduceHistory;
_sigerProjectProduct = sigerProjectProduct;
_productionBeatSet = productionBeatSet;
} }
/// <summary> /// <summary>
...@@ -82,7 +86,7 @@ namespace Siger.ApiACC.Controllers ...@@ -82,7 +86,7 @@ namespace Siger.ApiACC.Controllers
//上下料 //上下料
if (type==0) if (type==0)
{ {
var sectionProperty = _sectionPropertyRepository.GetList(f => f.propertytype == 1); var sectionProperty = _sectionPropertyRepository.GetList(f => f.propertytype == 1).ToList();
var sections = sectionProperty.Select(s => s.sectionid).ToList(); var sections = sectionProperty.Select(s => s.sectionid).ToList();
var levelSection = _sigerProjectLevelSection.GetList(f => f.parentid == line && sections.Contains(f.id)); var levelSection = _sigerProjectLevelSection.GetList(f => f.parentid == line && sections.Contains(f.id));
if (!levelSection.Any()) if (!levelSection.Any())
...@@ -92,12 +96,16 @@ namespace Siger.ApiACC.Controllers ...@@ -92,12 +96,16 @@ namespace Siger.ApiACC.Controllers
var result = new List<ResponseLoadStation>(); var result = new List<ResponseLoadStation>();
foreach (var lv in levelSection) foreach (var lv in levelSection)
{ {
var machineStatus = _automationMachineStatus.Get(f => f.section == lv.id);
var _property = sectionProperty.Find(f => f.sectionid == lv.id);
result.Add(new ResponseLoadStation result.Add(new ResponseLoadStation
{ {
section=lv.id, section=lv.id,
status=1, status= machineStatus != null? machineStatus.status:1,
title=lv.title, title=lv.title,
upload=_property!=null? _property.upload:0,
download= _property != null ? _property.down:0,
}); });
} }
return new ObjectResult(result); return new ObjectResult(result);
...@@ -147,16 +155,23 @@ namespace Siger.ApiACC.Controllers ...@@ -147,16 +155,23 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(CommonEnum.RecordNotFound); throw new BadRequestException(CommonEnum.RecordNotFound);
} }
var monitor = _automationTaskList.GetList(f =>f.sectionid==section ,"id",true).FirstOrDefault(); var monitor = _automationTaskList.GetList(f =>f.sectionid==section ,"id",true).FirstOrDefault();
var img = string.Empty;
if (monitor!=null)
{
var pd = _sigerProjectProduct.Get(f => f.code == monitor.productcode);
img = pd != null ? pd.image : "";
}
var result = new ResponsePlanlFixtureInfo var result = new ResponsePlanlFixtureInfo
{ {
OrderNumber = monitor!=null? monitor.ordercode:"", OrderNumber = monitor!=null? monitor.ordercode:"",
FixtureGuid = monitor != null ? monitor.fixtureguid:"", FixtureGuid = monitor != null ? monitor.fixtureguid:"",
FixtureName = monitor != null ? monitor.fixturename:"", FixtureCode = monitor != null ? monitor.fixturename:"",
ProductCode = monitor != null ? monitor.productcode:"", ProductCode = monitor != null ? monitor.productcode:"",
ProductName = monitor != null ? monitor.productname:"", ProductName = monitor != null ? monitor.productname:"",
Sn = monitor != null ? monitor.sn:"", Sn = monitor != null ? monitor.sn:"",
status = monitor != null ? monitor.status : 0, status = monitor != null ? monitor.status : 0,
Location = monitor != null ? monitor.locationid:0, Location = monitor != null ? monitor.locationid:0,
Url=img
}; };
return new ObjectResult(result); return new ObjectResult(result);
} }
...@@ -189,7 +204,7 @@ namespace Siger.ApiACC.Controllers ...@@ -189,7 +204,7 @@ namespace Siger.ApiACC.Controllers
} }
var section = taskobj.extend1.ToInt(); var section = taskobj.extend1.ToInt();
//抽检台-》上料位特殊逻辑 //抽检台-》上料位特殊逻辑
if (taskobj.action == Automation.TaskAction.Step_LK_CJT || taskobj.action == Automation.TaskAction.Step_CJT_SXLW) if (taskobj.action == Automation.TaskAction.Step_LK_CJT || taskobj.action == Automation.TaskAction.Step_CJT_SXLW || taskobj.action == TaskAction.Step_LK_JGZX || taskobj.action == TaskAction.Step_LK_SXLW)
{ {
section = taskobj.sectionid; section = taskobj.sectionid;
} }
...@@ -199,6 +214,7 @@ namespace Siger.ApiACC.Controllers ...@@ -199,6 +214,7 @@ namespace Siger.ApiACC.Controllers
{ {
throw new BadRequestException(CommonEnum.RecordNotFound); throw new BadRequestException(CommonEnum.RecordNotFound);
} }
var host = GetHost(); var host = GetHost();
if (string.IsNullOrEmpty(host)) if (string.IsNullOrEmpty(host))
{ {
...@@ -209,6 +225,7 @@ namespace Siger.ApiACC.Controllers ...@@ -209,6 +225,7 @@ namespace Siger.ApiACC.Controllers
{ {
throw new BadRequestException(AccEnum.FixtureToolsIsNone); throw new BadRequestException(AccEnum.FixtureToolsIsNone);
} }
Logger.WriteLineInfo($"自动下发->PLC : {EnumHelper.GetEnumDesc(taskobj.action)}Section:{section} machine:{attr.machine}");
var sendToPLC = new RequestPLC var sendToPLC = new RequestPLC
{ {
ProductCode=taskobj.productcode, ProductCode=taskobj.productcode,
...@@ -229,6 +246,7 @@ namespace Siger.ApiACC.Controllers ...@@ -229,6 +246,7 @@ namespace Siger.ApiACC.Controllers
return new ImportObjectResult((int)CommonEnum.Fail, message); return new ImportObjectResult((int)CommonEnum.Fail, message);
} }
taskobj.send = 1; taskobj.send = 1;
taskobj.actiontype = ExcueType.Manual;
_automationTaskList.Update(taskobj); _automationTaskList.Update(taskobj);
if (_unitOfWork.Commit() > 0) if (_unitOfWork.Commit() > 0)
{ {
...@@ -277,8 +295,9 @@ namespace Siger.ApiACC.Controllers ...@@ -277,8 +295,9 @@ namespace Siger.ApiACC.Controllers
/// <param name="id"></param> /// <param name="id"></param>
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
public IActionResult ScanCode(string code,int id) public IActionResult ScanCode(string code,int id,int section)
{ {
var monitor = _automationFixtureMonitor.Get(f => f.section == section);
if (!string.IsNullOrEmpty(code)) if (!string.IsNullOrEmpty(code))
{ {
var result = _automationFixtureToolsProduct.GetPlanFixtureInfo(ProjectId, code); var result = _automationFixtureToolsProduct.GetPlanFixtureInfo(ProjectId, code);
...@@ -286,8 +305,14 @@ namespace Siger.ApiACC.Controllers ...@@ -286,8 +305,14 @@ namespace Siger.ApiACC.Controllers
{ {
throw new BadRequestException(AccEnum.FixtureOrderNulll); throw new BadRequestException(AccEnum.FixtureOrderNulll);
} }
var machineStaus = _automationMachineStatus.Get(f => f.section == section);
if (machineStaus.status==(int)Automation.MachineStatus.Produce)
{
return new ObjectResult(CommonEnum.Succefull);
}
var sn = _automationTaskList.CreateRandonSn(result.ProductCode); var sn = _automationTaskList.CreateRandonSn(result.ProductCode);
result.Sn = sn; result.Sn = sn;
result.status = monitor != null ? monitor.status : 1;
return new ObjectResult(result); return new ObjectResult(result);
} }
if (id==0) if (id==0)
...@@ -296,7 +321,7 @@ namespace Siger.ApiACC.Controllers ...@@ -296,7 +321,7 @@ namespace Siger.ApiACC.Controllers
} }
//下料 //下料
var unload = _automationFixtureToolsProduct.GetPlanFixtureInfoByLocation(ProjectId, id); var unload = _automationFixtureToolsProduct.GetPlanFixtureInfoByLocation(ProjectId, id);
unload.status = monitor != null ? monitor.status : 1;
return new ObjectResult(unload); return new ObjectResult(unload);
} }
...@@ -320,7 +345,7 @@ namespace Siger.ApiACC.Controllers ...@@ -320,7 +345,7 @@ namespace Siger.ApiACC.Controllers
} }
if (upload.upload!=0) if (upload.upload!=0)
{ {
throw new BadRequestException(AccEnum.TaskProcessing); throw new BadRequestException(AccEnum.TaskCreateDone);
} }
var location = _automationLocation.Get(f => f.locationid == loading.locationid); var location = _automationLocation.Get(f => f.locationid == loading.locationid);
if (location==null) if (location==null)
...@@ -341,6 +366,11 @@ namespace Siger.ApiACC.Controllers ...@@ -341,6 +366,11 @@ namespace Siger.ApiACC.Controllers
{ {
throw new BadRequestException(CncEnum.PlanHasExist); throw new BadRequestException(CncEnum.PlanHasExist);
} }
var beatSets = _productionBeatSet.GetList(f=>f.product_name==plan.product_id.ToString() && f.status==(int)RowState.Valid);
if (!beatSets.Any())
{
throw new BadRequestException(CncEnum.RouteIsEmpty);
}
//检查工装 //检查工装
var fixtureToolsObj = _automationFixtureTools.GetProductFixtureLocation(ProjectId,loading.guid,loading.locationid); var fixtureToolsObj = _automationFixtureTools.GetProductFixtureLocation(ProjectId,loading.guid,loading.locationid);
if (fixtureToolsObj == null) if (fixtureToolsObj == null)
...@@ -397,11 +427,12 @@ namespace Siger.ApiACC.Controllers ...@@ -397,11 +427,12 @@ namespace Siger.ApiACC.Controllers
fixturename=fixtureToolsObj.FixtureCode, fixturename=fixtureToolsObj.FixtureCode,
locationid=fixtureToolsObj.Location, locationid=fixtureToolsObj.Location,
productcode=plan.product_code, productcode=plan.product_code,
productname=plan.product_name,
processid=0, processid=0,
programnumber="", programnumber="",
remark ="手动任务-准备上料", remark ="手动任务-准备上料",
route=route.id, route=route.id,
extend1= loading.section.ToStr(), extend1= invenProperty.sectionid.ToStr(),
}); });
...@@ -443,9 +474,9 @@ namespace Siger.ApiACC.Controllers ...@@ -443,9 +474,9 @@ namespace Siger.ApiACC.Controllers
{ {
throw new BadRequestException(AccEnum.MachineOnFree); throw new BadRequestException(AccEnum.MachineOnFree);
} }
if (upload.upload !=2 ) if (upload.upload >1 )
{ {
throw new BadRequestException(AccEnum.TaskProcessing); throw new BadRequestException(AccEnum.TaskCreateDone);
} }
upload.upload += 1; upload.upload += 1;
_sectionPropertyRepository.Update(upload); _sectionPropertyRepository.Update(upload);
...@@ -535,7 +566,7 @@ namespace Siger.ApiACC.Controllers ...@@ -535,7 +566,7 @@ namespace Siger.ApiACC.Controllers
} }
if (upload.down != 0) if (upload.down != 0)
{ {
throw new BadRequestException(AccEnum.TaskProcessing); throw new BadRequestException(AccEnum.TaskCreateDone);
} }
upload.down += 1; upload.down += 1;
_sectionPropertyRepository.Update(upload); _sectionPropertyRepository.Update(upload);
...@@ -545,7 +576,7 @@ namespace Siger.ApiACC.Controllers ...@@ -545,7 +576,7 @@ namespace Siger.ApiACC.Controllers
{ {
throw new BadRequestException(CommonEnum.RecordNotFound); throw new BadRequestException(CommonEnum.RecordNotFound);
} }
if (string.IsNullOrEmpty( location.sn)) if (string.IsNullOrEmpty(location.sn))
{ {
throw new BadRequestException(AccEnum.LocationNoSn); throw new BadRequestException(AccEnum.LocationNoSn);
} }
...@@ -571,17 +602,7 @@ namespace Siger.ApiACC.Controllers ...@@ -571,17 +602,7 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(AccEnum.LineModeNotfound); throw new BadRequestException(AccEnum.LineModeNotfound);
} }
var machineAttr = _sigerProjectMachineAttribution.Get(f => f.station == unloading.section && f.status == (int)RowState.Valid);
if (machineAttr == null)
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
var machineStatus = _automationMachineStatus.Get(f => f.machineid == machineAttr.machine);
if (machineStatus.status != (int)Automation.MachineStatus.Waiting)
{
throw new BadRequestException(AccEnum.MachineBusy);
}
var unixtime = UnixTimeHelper.GetNow(); var unixtime = UnixTimeHelper.GetNow();
//TODO //TODO
...@@ -598,18 +619,42 @@ namespace Siger.ApiACC.Controllers ...@@ -598,18 +619,42 @@ namespace Siger.ApiACC.Controllers
var toSection = upload.sectionid; var toSection = upload.sectionid;
if (lineMode.inspect==1) if (lineMode.inspect==1)
{ {
//下料 去抽检台
var QcProperty = _sectionPropertyRepository.Get(f => f.propertytype == 3); var QcProperty = _sectionPropertyRepository.Get(f => f.propertytype == 3);
if(QcProperty == null) if(QcProperty == null)
{ {
throw new BadRequestException(AccEnum.SectionPropertyNull); throw new BadRequestException(AccEnum.SectionPropertyNull);
} }
toSection = QcProperty.sectionid;
var machineQCAttr = _sigerProjectMachineAttribution.Get(f => f.station == toSection && f.status == (int)RowState.Valid);
if (machineQCAttr == null)
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
var machineQCStatus = _automationMachineStatus.Get(f => f.machineid == machineQCAttr.machine);
if (machineQCStatus.status != (int)Automation.MachineStatus.Waiting)
{
Logger.WriteLineError($"抽检台正在生产中");
throw new BadRequestException(AccEnum.MachineBusy);
}
}else // 正常下料
{
var machineAttr = _sigerProjectMachineAttribution.Get(f => f.station == unloading.section && f.status == (int)RowState.Valid);
if (machineAttr == null)
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
toSection = QcProperty.sectionid; var machineStatus = _automationMachineStatus.Get(f => f.machineid == machineAttr.machine);
if (machineStatus.status != (int)Automation.MachineStatus.Waiting)
{
Logger.WriteLineError($"上下料位正在生产中");
throw new BadRequestException(AccEnum.MachineBusy);
}
} }
var tasklst = _automationTaskList.GetList(f => f.sectionid == toSection && f.action == action && f.status!=(int)TaskResultStatus.Complated);
var tasklst = _automationTaskList.GetList(f => f.sectionid == unloading.section && f.action == action && f.status!=(int)TaskResultStatus.Complated);
if (tasklst.Any()) if (tasklst.Any())
{ {
throw new BadRequestException(AccEnum.TaskProcessing); throw new BadRequestException(AccEnum.TaskProcessing);
...@@ -637,9 +682,10 @@ namespace Siger.ApiACC.Controllers ...@@ -637,9 +682,10 @@ namespace Siger.ApiACC.Controllers
fixturename=location.fixturename, fixturename=location.fixturename,
locationid = location.locationid, locationid = location.locationid,
productcode = location.productcode, productcode = location.productcode,
productname=location.productname,
processid = 0, processid = 0,
programnumber = "", programnumber = "",
remark =lineMode.inspect==1? "准备下料-》抽检台":"准备下料", remark =EnumHelper.GetEnumDesc(action)+"准备下料",
extend1 = upload.sectionid.ToString() extend1 = upload.sectionid.ToString()
}); });
...@@ -677,9 +723,9 @@ namespace Siger.ApiACC.Controllers ...@@ -677,9 +723,9 @@ namespace Siger.ApiACC.Controllers
{ {
throw new BadRequestException(AccEnum.MachineOnFree); throw new BadRequestException(AccEnum.MachineOnFree);
} }
if (upload.down != 2) if (upload.down >1)
{ {
throw new BadRequestException(AccEnum.TaskProcessing); throw new BadRequestException(AccEnum.TaskCreateDone);
} }
upload.down += 1; upload.down += 1;
_sectionPropertyRepository.Update(upload); _sectionPropertyRepository.Update(upload);
...@@ -718,9 +764,10 @@ namespace Siger.ApiACC.Controllers ...@@ -718,9 +764,10 @@ namespace Siger.ApiACC.Controllers
fixtureguid = monitor.fixtureguid, fixtureguid = monitor.fixtureguid,
locationid = monitor.locationId, locationid = monitor.locationId,
productcode = monitor.productCode, productcode = monitor.productCode,
productname=monitor.productName,
processid = 0, processid = 0,
programnumber = "", programnumber = "",
remark = "手动任务-拆卸完成", remark =EnumHelper.GetEnumDesc(TaskAction.Step_SXLW_LK)+ "-拆卸完成",
extend1= disassemble.section.ToStr() extend1= disassemble.section.ToStr()
}); });
......
...@@ -17,6 +17,8 @@ using Siger.Middlelayer.Common.Helpers; ...@@ -17,6 +17,8 @@ using Siger.Middlelayer.Common.Helpers;
using Siger.Middlelayer.Utility.Helpers; using Siger.Middlelayer.Utility.Helpers;
using Siger.Middlelayer.Utility.ImportEntities; using Siger.Middlelayer.Utility.ImportEntities;
using System.IO; using System.IO;
using Siger.Middlelayer.Common.ModuleEnum;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 // For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace Siger.ApiACC.Controllers namespace Siger.ApiACC.Controllers
...@@ -28,14 +30,19 @@ namespace Siger.ApiACC.Controllers ...@@ -28,14 +30,19 @@ namespace Siger.ApiACC.Controllers
private readonly IAutomationMachineStatus _automationMachineStatus; private readonly IAutomationMachineStatus _automationMachineStatus;
private readonly IAutomationTaskListRepository _automationTaskList; private readonly IAutomationTaskListRepository _automationTaskList;
private readonly IAutomationFixtureMonitor _automationFixtureMonitor; private readonly IAutomationFixtureMonitor _automationFixtureMonitor;
private readonly IAutomationLineMode _automationLineMode;
private readonly IAutomationSectionPropertyRepository _automationSectionProperty;
public AutomationStateController(IUnitOfWork unitOfWork, ISigerProjectLevelSectionRepository sigerProjectLevelSection, IAutomationMachineStatus automationMachineStatus, IAutomationTaskListRepository automationTaskList, IAutomationFixtureMonitor automationFixtureMonitor) public AutomationStateController(IUnitOfWork unitOfWork, ISigerProjectLevelSectionRepository sigerProjectLevelSection, IAutomationMachineStatus automationMachineStatus, IAutomationTaskListRepository automationTaskList, IAutomationFixtureMonitor automationFixtureMonitor
, IAutomationLineMode automationLineMode, IAutomationSectionPropertyRepository automationSectionProperty)
{ {
_unitOfWork = unitOfWork; _unitOfWork = unitOfWork;
_sigerProjectLevelSection = sigerProjectLevelSection; _sigerProjectLevelSection = sigerProjectLevelSection;
_automationMachineStatus = automationMachineStatus; _automationMachineStatus = automationMachineStatus;
_automationTaskList = automationTaskList; _automationTaskList = automationTaskList;
_automationFixtureMonitor = automationFixtureMonitor; _automationFixtureMonitor = automationFixtureMonitor;
_automationLineMode = automationLineMode;
_automationSectionProperty = automationSectionProperty;
} }
/// <summary> /// <summary>
...@@ -82,6 +89,7 @@ namespace Siger.ApiACC.Controllers ...@@ -82,6 +89,7 @@ namespace Siger.ApiACC.Controllers
item.fixtureName = fixture.fixturename; item.fixtureName = fixture.fixturename;
item.machineStatus = d.status; item.machineStatus = d.status;
item.status = fixture.status; item.status = fixture.status;
item.lastupdate = fixture.createtime.ToString();
} }
result.Add(item); result.Add(item);
...@@ -100,6 +108,17 @@ namespace Siger.ApiACC.Controllers ...@@ -100,6 +108,17 @@ namespace Siger.ApiACC.Controllers
return new ObjectResult(output); return new ObjectResult(output);
} }
[HttpGet] [HttpGet]
public IActionResult GetSnDts(string sn)
{
return new ObjectResult(1);
}
[HttpGet]
public IActionResult GetFixtureDts(string fixture)
{
return new ObjectResult(1);
}
[HttpGet]
public IActionResult GetTasklist(int section, int tasktype, string productCode, string taskno, string sn, int status, int actionType, string triggerbegin,string triggerend, string complatebegin,string complatend,int page,int pageSize, string toexcel) public IActionResult GetTasklist(int section, int tasktype, string productCode, string taskno, string sn, int status, int actionType, string triggerbegin,string triggerend, string complatebegin,string complatend,int page,int pageSize, string toexcel)
{ {
var ids = new List<int>(); var ids = new List<int>();
...@@ -148,7 +167,7 @@ namespace Siger.ApiACC.Controllers ...@@ -148,7 +167,7 @@ namespace Siger.ApiACC.Controllers
model.status_value = ""; model.status_value = "";
break; break;
} }
model.send = item.send==0 ? "未下发" : "已下发";
dataList.Add(model); dataList.Add(model);
} }
if (dataList.Any()) if (dataList.Any())
...@@ -182,6 +201,44 @@ namespace Siger.ApiACC.Controllers ...@@ -182,6 +201,44 @@ namespace Siger.ApiACC.Controllers
{ {
throw new BadRequestException(CommonEnum.RecordNotFound); throw new BadRequestException(CommonEnum.RecordNotFound);
} }
if (record.send != 0)
{
throw new BadRequestException(AccEnum.TaskIsSend);
}
var _property = _automationSectionProperty.GetList(f => f.propertytype == 1 && (f.upload > 0 || f.down > 0));
if (_property.Any())
{
foreach (var perperty in _property)
{
if (perperty.upload > 0)
{
//重置上料位状态
if (record.sectionid==perperty.sectionid && record.action == Automation.TaskAction.Step_LK_SXLW)
{
perperty.upload = 0;
_automationSectionProperty.Update(perperty);
}
}
if (perperty.down > 0)
{
//重置下料位置
//去抽检台
if (record.extend1.ToInt()==perperty.sectionid && record.action == Automation.TaskAction.Step_LK_CJT)
{
perperty.upload = 0;
_automationSectionProperty.Update(perperty);
}
//去下料位
if (record.extend1.ToInt()==perperty.sectionid && record.action== Automation.TaskAction.Step_LK_SXLW)
{
perperty.upload = 0;
_automationSectionProperty.Update(perperty);
}
}
}
}
_automationTaskList.Delete(record); _automationTaskList.Delete(record);
if (_unitOfWork.Commit() > 0) if (_unitOfWork.Commit() > 0)
......
...@@ -21,6 +21,7 @@ using System.IO; ...@@ -21,6 +21,7 @@ using System.IO;
using Siger.Middlelayer.Log; using Siger.Middlelayer.Log;
using Siger.Middlelayer.Common.ModuleEnum; using Siger.Middlelayer.Common.ModuleEnum;
using Siger.Middlelayer.Share.Enum.ModuleEnum; using Siger.Middlelayer.Share.Enum.ModuleEnum;
using static Siger.Middlelayer.Share.Enum.ModuleEnum.Automation;
namespace Siger.ApiACC.Controllers namespace Siger.ApiACC.Controllers
{ {
...@@ -267,11 +268,27 @@ namespace Siger.ApiACC.Controllers ...@@ -267,11 +268,27 @@ namespace Siger.ApiACC.Controllers
try try
{ {
//还有未完成任务 退出 等待任务下发 //还有未完成任务 退出 等待任务下发
if (!_automationTaskList.CanTask(ProjectId, req.sectionid)) //if (!_automationTaskList.CanTask(ProjectId, req.sectionid))
//{
// return new ObjectResult(CommonEnum.Succefull);
//}
var lastTask = _automationTaskList.GetList(f => f.projectId == ProjectId && f.action == TaskAction.Step_CJT_SXLW, "id", true).FirstOrDefault();
if (lastTask != null)
{ {
return new ObjectResult(CommonEnum.Succefull); if (lastTask.status != (int)TaskResultStatus.Complated)
{
Logger.WriteLineError($"重复检验提交数据,无需创建Task任务");
return new ObjectResult(CommonEnum.Succefull);
}
}
var tasklist = _automationTaskList.GetList(f => f.sectionid == req.sectionid && f.action == Automation.TaskAction.Step_LK_CJT).LastOrDefault();
if (tasklist == null)
{
throw new BadRequestException(CommonEnum.Fail);
} }
CreateTaskList(req.sectionid, req.productid, product.code, req.sn, req.routeid.ToInt());
inspection.workorder = tasklist.ordercode;
CreateTaskList(tasklist, req.sectionid, req.productid, product.code, req.sn, req.routeid.ToInt());
AddSnList(req.materialid.ToInt(), inspection, product.code, section.parentid);//把二维码插入到 sn_list表 AddSnList(req.materialid.ToInt(), inspection, product.code, section.parentid);//把二维码插入到 sn_list表
} }
catch(Exception ex) catch(Exception ex)
...@@ -327,13 +344,9 @@ namespace Siger.ApiACC.Controllers ...@@ -327,13 +344,9 @@ namespace Siger.ApiACC.Controllers
} }
} }
private void CreateTaskList(int section, int productid, string productcode, string sn, int routeid) private void CreateTaskList(siger_automation_task_list tasklist, int section, int productid, string productcode, string sn, int routeid)
{ {
var tasklist = _automationTaskList.GetList(f => f.sectionid == section && f.action == Automation.TaskAction.Step_LK_CJT).LastOrDefault();
if (tasklist == null)
{
throw new BadRequestException(CommonEnum.Fail);
}
//找到上下料位 //找到上下料位
...@@ -344,7 +357,7 @@ namespace Siger.ApiACC.Controllers ...@@ -344,7 +357,7 @@ namespace Siger.ApiACC.Controllers
action = Automation.TaskAction.Step_CJT_SXLW, action = Automation.TaskAction.Step_CJT_SXLW,
actiontype = Automation.ExcueType.None, actiontype = Automation.ExcueType.None,
triggertime = DateTime.Now, triggertime = DateTime.Now,
tasktype = Automation.TaskActionType.Unload, tasktype = TaskActionType.Unload,
operater = UserId, operater = UserId,
operatetime = DateTime.Now, operatetime = DateTime.Now,
sectionid = tasklist.extend1.ToInt(), sectionid = tasklist.extend1.ToInt(),
......
...@@ -11,6 +11,7 @@ using System; ...@@ -11,6 +11,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using static Siger.Middlelayer.Share.Enum.ModuleEnum.Automation;
namespace Siger.ApiACC.Tasks namespace Siger.ApiACC.Tasks
{ {
...@@ -48,7 +49,7 @@ namespace Siger.ApiACC.Tasks ...@@ -48,7 +49,7 @@ namespace Siger.ApiACC.Tasks
var section = task.extend1.ToInt(); var section = task.extend1.ToInt();
//抽检台-》上料位特殊逻辑 //抽检台-》上料位特殊逻辑
if (task.action==Automation.TaskAction.Step_LK_CJT || task.action == Automation.TaskAction.Step_CJT_SXLW) if (task.action==Automation.TaskAction.Step_LK_CJT || task.action == Automation.TaskAction.Step_CJT_SXLW || task.action==TaskAction.Step_LK_JGZX || task.action==TaskAction.Step_LK_SXLW)
{ {
section = task.sectionid; section = task.sectionid;
} }
...@@ -58,7 +59,7 @@ namespace Siger.ApiACC.Tasks ...@@ -58,7 +59,7 @@ namespace Siger.ApiACC.Tasks
var attr = dbhelper.GetAttribution(section); var attr = dbhelper.GetAttribution(section);
if (attr == null) if (attr == null)
return; return;
Logger.WriteLineInfo($"自动下发->PLC : {EnumHelper.GetEnumDesc(task.action)}Section:{section} machine:{attr.machine}");
var fixtrue = dbhelper.GetFixture(task.fixtureguid); var fixtrue = dbhelper.GetFixture(task.fixtureguid);
if (fixtrue==null) if (fixtrue==null)
{ {
...@@ -87,6 +88,7 @@ namespace Siger.ApiACC.Tasks ...@@ -87,6 +88,7 @@ namespace Siger.ApiACC.Tasks
return; return;
} }
task.send = 1; task.send = 1;
task.actiontype = ExcueType.Auto;
if (!dbhelper.UpdateTask(task)) if (!dbhelper.UpdateTask(task))
{ {
Logger.WriteLineError($"更新TASK 下发状态失败"); Logger.WriteLineError($"更新TASK 下发状态失败");
......
...@@ -357,7 +357,11 @@ namespace Siger.Middlelayer.Common.ModuleEnum ...@@ -357,7 +357,11 @@ namespace Siger.Middlelayer.Common.ModuleEnum
[Description("工序加工未完成")] [Description("工序加工未完成")]
RouteProcessing, RouteProcessing,
[Description("工序未开始加工")] [Description("工序未开始加工")]
RouteNotStart RouteNotStart,
[Description("同步报工记录失败")]
SyncSnReportErro,
[Description("请勿重复提交任务")]
TaskCreateDone
} }
public enum SeriNumCfg public enum SeriNumCfg
......
...@@ -257,9 +257,11 @@ namespace Siger.Middlelayer.Utility.ImportEntities ...@@ -257,9 +257,11 @@ namespace Siger.Middlelayer.Utility.ImportEntities
{ {
[ExcelColumn("任务编号")] [ExcelColumn("任务编号")]
public string taskno { get; set; } public string taskno { get; set; }
[ExcelColumn("产线层级")] [ExcelColumn("发起工站")]
public string fromsection { get; set; }
[ExcelColumn("目标工站")]
public string section { get; set; } public string section { get; set; }
[ExcelColumn("触发方")] [ExcelColumn("触发方")]
public string trigger { get; set; } public string trigger { get; set; }
[ExcelColumn("任务类型")] [ExcelColumn("任务类型")]
public string tasktype { get; set; } public string tasktype { get; set; }
...@@ -269,8 +271,8 @@ namespace Siger.Middlelayer.Utility.ImportEntities ...@@ -269,8 +271,8 @@ namespace Siger.Middlelayer.Utility.ImportEntities
public string ordernumber { get; set; } public string ordernumber { get; set; }
[ExcelColumn("产品编号")] [ExcelColumn("产品编号")]
public string productCode { get; set; } public string productCode { get; set; }
[ExcelColumn("工序编号")] //[ExcelColumn("工序编号")]
public string routeNo { get; set; } //public string routeNo { get; set; }
[ExcelColumn("工序名称")] [ExcelColumn("工序名称")]
public string route { get; set; } public string route { get; set; }
[ExcelColumn("程序号")] [ExcelColumn("程序号")]
...@@ -281,6 +283,8 @@ namespace Siger.Middlelayer.Utility.ImportEntities ...@@ -281,6 +283,8 @@ namespace Siger.Middlelayer.Utility.ImportEntities
public string fixtureCode { get; set; } public string fixtureCode { get; set; }
[ExcelColumn("动作")] [ExcelColumn("动作")]
public string action { get; set; } public string action { get; set; }
[ExcelColumn("下发状态")]
public string send { get; set; }
[ExcelColumn("执行类型")] [ExcelColumn("执行类型")]
public string actionType { get; set; } public string actionType { get; set; }
[ExcelColumn("状态")] [ExcelColumn("状态")]
......
...@@ -221,7 +221,7 @@ namespace Siger.Middlelayer.Utility.ImportEntities ...@@ -221,7 +221,7 @@ namespace Siger.Middlelayer.Utility.ImportEntities
public string unhealthy_code { get; set; } public string unhealthy_code { get; set; }
[ExcelColumn("项次*")] [ExcelColumn("项次*")]
public int seq { get; set; } public string seq { get; set; }
[ExcelColumn("是否送检*(1=>人工检验2=>送检检验)*")] [ExcelColumn("是否送检*(1=>人工检验2=>送检检验)*")]
public string isinpect { get; set; } public string isinpect { get; set; }
......
...@@ -19,11 +19,11 @@ namespace Siger.Middlelayer.AccRepository.Entities ...@@ -19,11 +19,11 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// </summary> /// </summary>
public int propertytype { get; set; } public int propertytype { get; set; }
/// <summary> /// <summary>
/// 上料状态 1 当前是上料 2 上料中 3 安装完成 /// 上料状态 1 当前是上料 2 安装完成
/// </summary> /// </summary>
public int upload { get; set; } public int upload { get; set; }
/// <summary> /// <summary>
/// 下料状态 1 当前是下料 2 下料中 3 拆卸完成 /// 下料状态 1 当前是下料 2 拆卸完成
/// </summary> /// </summary>
public int down { get; set; } public int down { get; set; }
......
...@@ -88,7 +88,7 @@ namespace Siger.Middlelayer.AccRepository.Entities ...@@ -88,7 +88,7 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// <summary> /// <summary>
/// 完成时间 /// 完成时间
/// </summary> /// </summary>
public DateTime? completetime { get; set; } public DateTime completetime { get; set; }
/// <summary> /// <summary>
/// 操作人 /// 操作人
/// </summary> /// </summary>
......
...@@ -233,6 +233,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -233,6 +233,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
&& q.status == (int)RowState.Valid && t.status == (int)RowState.Valid && q.status == (int)RowState.Valid && t.status == (int)RowState.Valid
select new ResponsePlanlFixtureInfo select new ResponsePlanlFixtureInfo
{ {
OrderNumber = d.OrderNumber, OrderNumber = d.OrderNumber,
ProductName = p.product_name, ProductName = p.product_name,
Url = pd.image, Url = pd.image,
......
...@@ -35,7 +35,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -35,7 +35,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
from u in uu.DefaultIfEmpty() from u in uu.DefaultIfEmpty()
join r in _context.siger_project_product_route on q.routeid equals r.id into rr join r in _context.siger_project_product_route on q.routeid equals r.id into rr
from r in rr.DefaultIfEmpty() from r in rr.DefaultIfEmpty()
where q.projectId == projectid && q.status == (int)RowState.Valid where q.projectId == projectid && q.status != (int)RowState.Invalid
select new ResponseAutomationLocation select new ResponseAutomationLocation
{ {
id = q.id, id = q.id,
...@@ -251,7 +251,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -251,7 +251,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
join r in _context.siger_project_product_route on q.routeid equals r.id into rtemp join r in _context.siger_project_product_route on q.routeid equals r.id into rtemp
from r in rtemp.DefaultIfEmpty() from r in rtemp.DefaultIfEmpty()
where q.projectId == projectId where q.projectId == projectId
&& q.status == (int)RowState.Valid && t.status == (int)RowState.Valid && q.status == (int)RowState.Valid
&& t.status == (int)RowState.Valid
&& l.status == (int)RowState.Valid && w.status == (int)RowState.Valid && l.status == (int)RowState.Valid && w.status == (int)RowState.Valid
select new ResponseAutomationLocationList select new ResponseAutomationLocationList
......
...@@ -142,6 +142,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -142,6 +142,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
from r in rtemp.DefaultIfEmpty() from r in rtemp.DefaultIfEmpty()
join s in _context.siger_project_level_section on q.sectionid equals s.id join s in _context.siger_project_level_section on q.sectionid equals s.id
join lv in _context.siger_project_level_section on s.parentid equals lv.id join lv in _context.siger_project_level_section on s.parentid equals lv.id
join fs in _context.siger_project_level_section on q.extend1 equals fs.id.ToString() into fstemp
from fs in fstemp.DefaultIfEmpty()
where q.projectId == projectid where q.projectId == projectid
select new ResponseAutomationTasklist select new ResponseAutomationTasklist
{ {
...@@ -153,7 +155,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -153,7 +155,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
triggervalue = q.triggertime, triggervalue = q.triggertime,
triggerTime = q.triggertime == DateTime.MinValue ? "" : q.triggertime.ToString(), triggerTime = q.triggertime == DateTime.MinValue ? "" : q.triggertime.ToString(),
complatevalue = q.completetime, complatevalue = q.completetime,
complatetime = q.completetime == DateTime.MinValue ? "" : q.completetime.ToString(), complatetime = q.completetime == DateTime.MinValue ? "" : q.completetime.ToString(UnixTimeHelper.DateTimeFormat),
action = EnumHelper.GetEnumDesc(q.action), action = EnumHelper.GetEnumDesc(q.action),
actionType = EnumHelper.GetEnumDesc(q.actiontype), actionType = EnumHelper.GetEnumDesc(q.actiontype),
fixtureCode = t.code, fixtureCode = t.code,
...@@ -168,7 +170,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -168,7 +170,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories
tasktype = EnumHelper.GetEnumDesc(q.tasktype), tasktype = EnumHelper.GetEnumDesc(q.tasktype),
tasktypeid = Convert.ToInt32(q.tasktype), tasktypeid = Convert.ToInt32(q.tasktype),
status = q.status, status = q.status,
actionTypeid = Convert.ToInt32(q.actiontype) actionTypeid = Convert.ToInt32(q.actiontype),
productName=q.productname,
fromsection = fs != null ? fs.title : "",
}; };
Expression<Func<ResponseAutomationTasklist, bool>> sectonsExpression = f => true; Expression<Func<ResponseAutomationTasklist, bool>> sectonsExpression = f => true;
......
using System;
using System.Collections.Generic;
using System.Text;
namespace Siger.Middlelayer.AccRepository.Response
{
public class ResponseAutomationFixtureDetails
{
/// <summary>
/// 父工装类别
/// </summary>
public string parentType { get; set; }
/// <summary>
/// 父工装编号
/// </summary>
public string parentCode { get; set; }
/// <summary>
/// 父级工装名称
/// </summary>
public string parentName { get; set; }
/// <summary>
/// 父级工装类别
/// </summary>
public string parentSpecl { get; set; }
public string child { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Siger.Middlelayer.AccRepository.Response
{
public class ResponseAutomationSnhistory
{
public string productCode { get; set; }
public string productName { get; set; }
public string section { get; set; }
public string fixtureCode { get; set; }
public string sn { get; set; }
public string program { get; set; }
public string route { get; set; }
public string datetime { get; set; }
}
}
...@@ -47,5 +47,11 @@ namespace Siger.Middlelayer.AccRepository.Response ...@@ -47,5 +47,11 @@ namespace Siger.Middlelayer.AccRepository.Response
public DateTime? complatevalue { get; set; } public DateTime? complatevalue { get; set; }
public string complatetime { get; set; } public string complatetime { get; set; }
public int send { get; set; } public int send { get; set; }
//0 自动,1,手动执行
public int excute { get; set; }
/// <summary>
/// 发起工站
/// </summary>
public string fromsection { get; set; }
} }
} }
...@@ -219,6 +219,17 @@ namespace Siger.Middlelayer.QmsRepository.Repositories ...@@ -219,6 +219,17 @@ namespace Siger.Middlelayer.QmsRepository.Repositories
return new CommonImportResult(0, string.Join(";", errors)); return new CommonImportResult(0, string.Join(";", errors));
} }
if (string.IsNullOrEmpty(item.seq))
{
errors.Add($"{rowIndex},{8223}");
return new CommonImportResult(0, string.Join(";", errors));
}
if (!int.TryParse(item.seq, out int intSeq) || item.seq.ToInt() <= 0)
{
errors.Add($"{rowIndex},{8224}");
return new CommonImportResult(0, string.Join(";", errors));
}
var itemPinYin = PinYinHelper.ToPinYin(item.item); var itemPinYin = PinYinHelper.ToPinYin(item.item);
if (string.IsNullOrWhiteSpace(itemPinYin)) if (string.IsNullOrWhiteSpace(itemPinYin))
{ {
...@@ -262,7 +273,7 @@ namespace Siger.Middlelayer.QmsRepository.Repositories ...@@ -262,7 +273,7 @@ namespace Siger.Middlelayer.QmsRepository.Repositories
errors.Add($"{rowIndex},{(int)RequestEnum.MaxMinError}"); errors.Add($"{rowIndex},{(int)RequestEnum.MaxMinError}");
} }
if ((p.value_category.ToInt() == (int)ValueCategory.Maxmin && string.IsNullOrEmpty(p.range)) || p.seq <= 0 || if ((p.value_category.ToInt() == (int)ValueCategory.Maxmin && string.IsNullOrEmpty(p.range)) || p.seq.ToInt() <= 0 ||
(p.value_type.ToInt() == (int)ValueTypeStatus.V && p.value_category.ToInt() <= 0) || (p.value_type.ToInt() == (int)ValueTypeStatus.V && p.value_category.ToInt() <= 0) ||
string.IsNullOrWhiteSpace(p.lcl) && !string.IsNullOrWhiteSpace(p.ucl) || string.IsNullOrWhiteSpace(p.lcl) && !string.IsNullOrWhiteSpace(p.ucl)) string.IsNullOrWhiteSpace(p.lcl) && !string.IsNullOrWhiteSpace(p.ucl) || string.IsNullOrWhiteSpace(p.lcl) && !string.IsNullOrWhiteSpace(p.ucl))
{ {
...@@ -277,7 +288,7 @@ namespace Siger.Middlelayer.QmsRepository.Repositories ...@@ -277,7 +288,7 @@ namespace Siger.Middlelayer.QmsRepository.Repositories
errors.Add($"{rowIndex},{(int)RequestEnum.InspectItemRepeat}"); errors.Add($"{rowIndex},{(int)RequestEnum.InspectItemRepeat}");
} }
var querySeq = _context.siger_qms_inspection_standard.FirstOrDefault(t => t.seq == p.seq && var querySeq = _context.siger_qms_inspection_standard.FirstOrDefault(t => t.seq == p.seq.ToInt() &&
t.projectid == projectid && t.status == (int)RowState.Valid && t.productid == p.productid && t.projectid == projectid && t.status == (int)RowState.Valid && t.productid == p.productid &&
t.sectionid == p.sectionid && t.standard_type == p.isinpect.ToInt()); t.sectionid == p.sectionid && t.standard_type == p.isinpect.ToInt());
if (querySeq != null || standardList.Count(t => t.seq == p.seq && if (querySeq != null || standardList.Count(t => t.seq == p.seq &&
...@@ -302,10 +313,10 @@ namespace Siger.Middlelayer.QmsRepository.Repositories ...@@ -302,10 +313,10 @@ namespace Siger.Middlelayer.QmsRepository.Repositories
{ {
if (p.value_type == "3") if (p.value_type == "3")
{ {
var standard = _context.siger_qms_inspection_standard.Where(q => q.value_type == 3 && q.productcode == p.productcode && q.sectionid == p.sectionid && q.seq == p.seq).FirstOrDefault(); var standard = _context.siger_qms_inspection_standard.Where(q => q.value_type == 3 && q.productcode == p.productcode && q.sectionid == p.sectionid && q.seq == p.seq.ToInt()).FirstOrDefault();
if (standard == null) if (standard == null)
{ {
var data = entities.Where(q => q.value_type == 3 && q.productcode == p.productcode && q.sectionid == p.sectionid && q.seq == p.seq).FirstOrDefault(); var data = entities.Where(q => q.value_type == 3 && q.productcode == p.productcode && q.sectionid == p.sectionid && q.seq == p.seq.ToInt()).FirstOrDefault();
if (data != null) if (data != null)
{ {
continue; continue;
...@@ -317,7 +328,7 @@ namespace Siger.Middlelayer.QmsRepository.Repositories ...@@ -317,7 +328,7 @@ namespace Siger.Middlelayer.QmsRepository.Repositories
productcode = p.productcode, productcode = p.productcode,
sectionid = p.sectionid, sectionid = p.sectionid,
standard = p.standard, standard = p.standard,
seq = p.seq, seq = p.seq.ToInt(),
item = p.item ?? "", item = p.item ?? "",
item_en = p.item_en, item_en = p.item_en,
unit = p.unit ?? "", unit = p.unit ?? "",
...@@ -352,7 +363,7 @@ namespace Siger.Middlelayer.QmsRepository.Repositories ...@@ -352,7 +363,7 @@ namespace Siger.Middlelayer.QmsRepository.Repositories
productcode = p.productcode, productcode = p.productcode,
sectionid = p.sectionid, sectionid = p.sectionid,
standard = p.standard, standard = p.standard,
seq = p.seq, seq = p.seq.ToInt(),
item = p.item ?? "", item = p.item ?? "",
item_en = p.item_en, item_en = p.item_en,
unit = p.unit ?? "", unit = p.unit ?? "",
...@@ -386,7 +397,7 @@ namespace Siger.Middlelayer.QmsRepository.Repositories ...@@ -386,7 +397,7 @@ namespace Siger.Middlelayer.QmsRepository.Repositories
{ {
if (p.value_type=="3") if (p.value_type=="3")
{ {
var standard = _context.siger_qms_inspection_standard.Where(q => q.value_type == 3 && q.productcode == p.productcode && q.sectionid == p.sectionid && q.seq == p.seq && q.status==(int)RowState.Valid).FirstOrDefault(); var standard = _context.siger_qms_inspection_standard.Where(q => q.value_type == 3 && q.productcode == p.productcode && q.sectionid == p.sectionid && q.seq == p.seq.ToInt() && q.status==(int)RowState.Valid).FirstOrDefault();
var option = new siger_qms_inspection_standard_option var option = new siger_qms_inspection_standard_option
{ {
standardid= standard.id, standardid= standard.id,
......
...@@ -20,8 +20,13 @@ namespace Siger.Middlelayer.Repository.Response ...@@ -20,8 +20,13 @@ namespace Siger.Middlelayer.Repository.Response
public int status { get; set; } public int status { get; set; }
/// <summary> /// <summary>
/// 1 :可以上料 2:可以下料 /// 上料状态
/// </summary> /// </summary>
public int upload { get; set; } public int upload { get; set; }
/// <summary>
/// 下料状态
/// </summary>
public int download { get; set; }
} }
} }
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