Commit b2e971e0 by xin.yang
parents bb18f836 048d2734
...@@ -116,7 +116,13 @@ ...@@ -116,7 +116,13 @@
<div class="flex"> <div class="flex">
<p class="infoLabel">产品图片:</p> <p class="infoLabel">产品图片:</p>
<div> <div>
<img :src="axios.publicPath+orderDetail.url" alt="" style="width:100%" /> <img
:src="
axios.publicPath + orderDetail.url
"
alt=""
style="width: 100%"
/>
</div> </div>
</div> </div>
<div> <div>
...@@ -137,6 +143,8 @@ ...@@ -137,6 +143,8 @@
:columns="columns2" :columns="columns2"
:max-height="200" :max-height="200"
style="width: 500px" style="width: 500px"
highlight-row
@on-current-change="handleRowChange1"
></Table> ></Table>
</div> </div>
<div> <div>
...@@ -326,6 +334,7 @@ export default { ...@@ -326,6 +334,7 @@ export default {
detailobj: {}, detailobj: {},
sectionid: 0, sectionid: 0,
tabindex: "1", tabindex: "1",
locationobj:{}
}; };
}, },
created() { created() {
...@@ -390,7 +399,7 @@ export default { ...@@ -390,7 +399,7 @@ export default {
}, },
//获取储位 //获取储位
getStorages() { getStorages() {
this.request("/acc/AutomationLocation/GetLocationList", "", "get") this.request("/acc/AutomationLocation/GetLocationList?fillsn=1", "", "get")
.then((res) => { .then((res) => {
console.log(res.data.data); console.log(res.data.data);
if (res.data.ret == 1) { if (res.data.ret == 1) {
...@@ -500,8 +509,13 @@ export default { ...@@ -500,8 +509,13 @@ export default {
this.$Message.error("请选择工位"); this.$Message.error("请选择工位");
return false; return false;
} }
if (!this.locationobj.id) {
this.$Message.error("请选择储位");
return false;
}
let data = { let data = {
section: this.sectionid, section: this.sectionid,
id:this.locationobj.id,
}; };
this.request("/acc/AutomationOperate/Unloading", data, "post").thne( this.request("/acc/AutomationOperate/Unloading", data, "post").thne(
(res) => { (res) => {
...@@ -539,6 +553,12 @@ export default { ...@@ -539,6 +553,12 @@ export default {
this.orderDetail.fixtureGuid = this.detailobj.fixtureguid; this.orderDetail.fixtureGuid = this.detailobj.fixtureguid;
this.orderDetail.location = this.detailobj.locationid; this.orderDetail.location = this.detailobj.locationid;
}, },
handleRowChange1(currentRow, oldCurrentRow) {
console.log(currentRow);
this.locationobj = currentRow;
this.orderDetail.fixtureGuid = this.detailobj.fixtureguid;
this.orderDetail.location = this.detailobj.locationid;
},
request(url, data, type) { request(url, data, type) {
if (type == "get") { if (type == "get") {
return this.axios return this.axios
......
...@@ -428,7 +428,7 @@ namespace Siger.ApiACC.Controllers ...@@ -428,7 +428,7 @@ namespace Siger.ApiACC.Controllers
return; //完成当前任务 退出 return; //完成当前任务 退出
} }
} }
//优先级3:其他设备下料 (加工中心 ->立库) //优先级3:其他设备下料 (加工中心 ->清洗机)
if (cleanMachine != null) if (cleanMachine != null)
{ {
var fullMachine = machineStatusList.FirstOrDefault(f => f.status == (int)Automation.MachineStatus.Complated); var fullMachine = machineStatusList.FirstOrDefault(f => f.status == (int)Automation.MachineStatus.Complated);
......
...@@ -345,10 +345,15 @@ namespace Siger.ApiACC.Controllers ...@@ -345,10 +345,15 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(CommonEnum.Fail); throw new BadRequestException(CommonEnum.Fail);
} }
/// <summary>
///
/// </summary>
/// <param name="fillsn">0:全部 1: 储位有SN</param>
/// <returns></returns>
[HttpGet] [HttpGet]
public IActionResult GetLocationList() public IActionResult GetLocationList(int fillsn=0)
{ {
return new ObjectResult(_autoLocationRepository.GetDataList(ProjectId).ToList()); return new ObjectResult(_autoLocationRepository.GetDataList(ProjectId, fillsn).ToList());
} }
} }
} }
...@@ -21,6 +21,7 @@ using Siger.Middlelayer.Share.Enum.ModuleEnum; ...@@ -21,6 +21,7 @@ using Siger.Middlelayer.Share.Enum.ModuleEnum;
using Siger.Middlelayer.Common.Configuration; using Siger.Middlelayer.Common.Configuration;
using Siger.Middlelayer.Common.Helpers; using Siger.Middlelayer.Common.Helpers;
using Newtonsoft.Json; using Newtonsoft.Json;
using NPOI.SS.Formula;
namespace Siger.ApiACC.Controllers namespace Siger.ApiACC.Controllers
{ {
...@@ -452,7 +453,7 @@ namespace Siger.ApiACC.Controllers ...@@ -452,7 +453,7 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(AccEnum.MonitorNotfound); throw new BadRequestException(AccEnum.MonitorNotfound);
} }
//移出 上料位 //移出 上料位
monitor.status = (int)Automation.MachineStatus.Waiting; monitor.section = 0;
var taskNo = _automationTaskList.CrateTaskNumber(Automation.TaskTrigerType.Manual); var taskNo = _automationTaskList.CrateTaskNumber(Automation.TaskTrigerType.Manual);
_automationTaskList.Insert(new siger_automation_task_list _automationTaskList.Insert(new siger_automation_task_list
{ {
...@@ -500,8 +501,109 @@ namespace Siger.ApiACC.Controllers ...@@ -500,8 +501,109 @@ namespace Siger.ApiACC.Controllers
[HttpPost] [HttpPost]
public IActionResult Unloading([FromBody]requestAutomationUnloading unloading) public IActionResult Unloading([FromBody]requestAutomationUnloading unloading)
{ {
//var monitor = _automationFixtureMonitor.Get(f => f.section == unloading.section);
//if (monitor == null)
//{
// Logger.WriteLineInfo($"AutoProcess 找不到CNC监控信息");
// return new ObjectResult(CommonEnum.RecordNotFound);
//}
//if (string.IsNullOrEmpty( monitor.sn))
//{
// Logger.WriteLineInfo($"AutoProcess 找不到CNC监控SN信息");
// return new ObjectResult(CommonEnum.RecordNotFound);
//}
var location = _automationLocation.Get(f => f.locationid == unloading.locationid);
if (location==null)
{
return new ObjectResult(CommonEnum.RecordNotFound);
}
if (string.IsNullOrEmpty( location.sn))
{
return new ObjectResult(AccEnum.LocationNoSn);
}
var levelSection = _sigerProjectLevelSection.Get(f => f.id == unloading.section);
var lineMode = _automationLine.Get(f => f.section ==levelSection.parentid);
if (lineMode==null)
{
return new ObjectResult(AccEnum.LineModeNotfound);
}
//TODO
//1. 有检验状态 (立库-》检验工位)
//2. 无检验状态 (立库-》上下料工位)
var taskNo = _automationTaskList.CrateTaskNumber(Automation.TaskTrigerType.Manual);
_automationTaskList.Insert(new siger_automation_task_list
{
no = taskNo,
action = lineMode.inspect==1?Automation.TaskAction.Step_LK_CJT: Automation.TaskAction.Step_LK_SXLW,
actiontype = Automation.ExcueType.None,
triggertime = DateTime.Now,
tasktype = Automation.TaskActionType.Load,
operater = UserId,
operatetime = DateTime.MinValue,
sectionid = unloading.section,
send = 0,
status = 1,
completetime = DateTime.MinValue,
trigger = Automation.TaskTrigerType.Manual,
projectId = ProjectId,
productid = location.productid,
sn = location.sn,
ordercode = location.ordernumber,
fixtureguid = location.fixturetools,
locationid = location.locationid,
productcode = location.productcode,
processid = 0,
programnumber = "",
remark = "手动任务-准备上料",
});
var monitor = _automationFixtureMonitor.Get(f => f.section == unloading.section);
if (monitor == null)
{
_automationFixtureMonitor.Insert(new siger_automation_fixture_tools_monitor
{
fixtureguid = location.fixturetools,
fixturename = location.fixturename,
projectId = ProjectId,
section = unloading.section,
sn = location.sn,
createtime = DateTime.Now,
updatetime = DateTime.Now,
status = (int)Automation.MachineStatus.Produce,
productId = location.productid,
productCode = location.productcode,
productName = location.productname,
ordernumber = location.ordernumber,
locationId = location.locationid
});
}
else
{
monitor.sn = location.sn;
monitor.updatetime = DateTime.Now;
monitor.status = (int)Automation.MachineStatus.Produce;
monitor.productId = location.productid;
monitor.productName = location.productname;
monitor.productCode = location.productcode;
monitor.ordernumber = location.ordernumber;
monitor.locationId = location.locationid;
_automationFixtureMonitor.Update(monitor);
}
return new ObjectResult(1); if (_unitOfWork.Commit() > 0)
{
return new ObjectResult(CommonEnum.Succefull);
}
else
{
throw new BadRequestException(CommonEnum.Fail);
}
} }
/// <summary> /// <summary>
...@@ -513,7 +615,64 @@ namespace Siger.ApiACC.Controllers ...@@ -513,7 +615,64 @@ namespace Siger.ApiACC.Controllers
public IActionResult Disassemble([FromBody]Requestdisassemble disassemble) public IActionResult Disassemble([FromBody]Requestdisassemble disassemble)
{ {
return new ObjectResult(1); var machineStatus = _automationMachineStatus.Get(f => f.section == disassemble.section);
if (machineStatus == null)
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
if (machineStatus.enable == 0)
{
throw new BadRequestException(AccEnum.MachineDisable);
}
if (!_automationTaskList.CanTask(ProjectId, disassemble.section))
{
throw new BadRequestException(AccEnum.TaskProcessing);
}
//创建 安装完成动作
var monitor = _automationFixtureMonitor.Get(f => f.projectId == ProjectId && f.section == disassemble.section);
if (monitor == null)
{
throw new BadRequestException(AccEnum.MonitorNotfound);
}
//移出 上料位
monitor.section = 0;
var taskNo = _automationTaskList.CrateTaskNumber(Automation.TaskTrigerType.Manual);
_automationTaskList.Insert(new siger_automation_task_list
{
no = taskNo,
action = Automation.TaskAction.Step_SXLW_LK,
actiontype = Automation.ExcueType.None,
triggertime = DateTime.Now,
tasktype = Automation.TaskActionType.Load,
operater = UserId,
operatetime = DateTime.Now,
sectionid = disassemble.section,
send = 0,
status = 1,
completetime = DateTime.MinValue,
trigger = Automation.TaskTrigerType.Manual,
projectId = ProjectId,
productid = monitor.productId,
sn = monitor.sn,
ordercode = monitor.ordernumber,
fixtureguid = monitor.fixtureguid,
locationid = monitor.locationId,
productcode = monitor.productCode,
processid = 0,
programnumber = "",
remark = "手动任务-拆卸完成",
});
if (_unitOfWork.Commit() > 0)
{
Logger.WriteLineError($"手动任务-拆卸完成-{Siger.Middlelayer.Common.Helpers.EnumHelper.GetEnumDesc(Automation.TaskAction.Step_SXLW_LK)}");
return new ObjectResult(CommonEnum.Succefull);
}
else
{
throw new BadRequestException(CommonEnum.Fail);
}
} }
} }
} }
...@@ -43,5 +43,10 @@ namespace Siger.Middlelayer.Share.Constant ...@@ -43,5 +43,10 @@ namespace Siger.Middlelayer.Share.Constant
/// </summary> /// </summary>
public const string WarehouseStation = "WarehouseStation"; public const string WarehouseStation = "WarehouseStation";
/// <summary>
/// 检验
/// </summary>
public const string InspectStation = "InspectStation";
} }
} }
...@@ -341,7 +341,9 @@ namespace Siger.Middlelayer.Common.ModuleEnum ...@@ -341,7 +341,9 @@ namespace Siger.Middlelayer.Common.ModuleEnum
[Description("产线当前为自动模式")] [Description("产线当前为自动模式")]
LineIsAutoMode, LineIsAutoMode,
[Description("该任务已经下发")] [Description("该任务已经下发")]
TaskIsSend TaskIsSend,
[Description("该储位无工件")]
LocationNoSn,
} }
public enum SeriNumCfg public enum SeriNumCfg
......
...@@ -95,7 +95,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -95,7 +95,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
return _context.siger_wms_storage_location.Where(q => q.projectId == projectid && q.status == (int)RowState.Valid); return _context.siger_wms_storage_location.Where(q => q.projectId == projectid && q.status == (int)RowState.Valid);
} }
public IEnumerable<ResponseAutomationLocationList> GetDataList(int projectid) public IEnumerable<ResponseAutomationLocationList> GetDataList(int projectid,int hasMaterial)
{ {
var query = from q in _context.siger_automation_location var query = from q in _context.siger_automation_location
join t in _context.siger_automation_fixture_tools on q.fixturetools equals t.guid join t in _context.siger_automation_fixture_tools on q.fixturetools equals t.guid
...@@ -119,7 +119,12 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -119,7 +119,12 @@ namespace Siger.Middlelayer.AccRepository.Repositories
materialsn = q.sn ?? "", materialsn = q.sn ?? "",
categoryid = c == null ? 0 : c.id categoryid = c == null ? 0 : c.id
}; };
var entities = query.AsNoTracking().ToList(); Expression<Func<ResponseAutomationLocationList, bool>> locationidExpression = f => true;
if (hasMaterial != 0)
{
locationidExpression = q =>!string.IsNullOrEmpty(q.materialsn);
}
var entities = query.Where(locationidExpression).AsNoTracking().ToList();
return entities; return entities;
} }
......
...@@ -14,7 +14,13 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface ...@@ -14,7 +14,13 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
siger_wms_storage_location GetLocation(int id, int projectid); siger_wms_storage_location GetLocation(int id, int projectid);
IEnumerable<ResponseAutomationLocationList> GetDataList(int projectid); /// <summary>
/// 获取储位
/// </summary>
/// <param name="projectid">项目ID</param>
/// <param name="hasMaterial">只查有SN</param>
/// <returns></returns>
IEnumerable<ResponseAutomationLocationList> GetDataList(int projectid, int hasMaterial);
IEnumerable<siger_wms_storage_location> GetLocationList(int projectid); IEnumerable<siger_wms_storage_location> GetLocationList(int projectid);
......
...@@ -31,6 +31,8 @@ namespace Siger.Middlelayer.AccRepository.Request ...@@ -31,6 +31,8 @@ namespace Siger.Middlelayer.AccRepository.Request
{ {
public int section { get; set; } public int section { get; set; }
public int locationid { get; set; }
} }
/// <summary> /// <summary>
......
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