Commit b2984210 by jiawei.su

someupdate

parent 2da17f65
......@@ -333,7 +333,10 @@ namespace Siger.ApiACC.Controllers
updatetime = DateTime.Now
});
}
if (machineStatus.status!=(int)Automation.MachineStatus.Waiting)
{
throw new BadRequestException(AccEnum.MachineDisable);
}
var plandts = _planDetails.Get(f => f.projectId == ProjectId && f.OrderNumber == loading.code);
if (plandts==null)
{
......@@ -401,47 +404,6 @@ namespace Siger.ApiACC.Controllers
});
if (monitor==null)
{
_automationFixtureMonitor.Insert(new siger_automation_fixture_tools_monitor
{
fixtureguid = fixtureToolsObj.FixtureGuid,
fixturename = fixtureToolsObj.FixtureCode,
projectId = ProjectId,
section = loading.section,
sn = sn,
createtime = DateTime.Now,
updatetime = DateTime.Now,
status = (int)Automation.MachineStatus.Produce,
productId = plan.product_id,
productCode = plan.product_code,
productName = plan.product_name,
ordernumber = plandts.OrderNumber,
locationId = fixtureToolsObj.Location,
unixtime = unixtime,
route= route.id,
taskno=taskNo
});
}
else
{
monitor.sn = sn;
monitor.section = loading.section;
monitor.updatetime = DateTime.Now;
monitor.status = (int)Automation.MachineStatus.Produce;
monitor.productId = plan.product_id;
monitor.productName = plan.product_name;
monitor.productCode = plan.product_code;
monitor.ordernumber = plandts.OrderNumber;
monitor.locationId = fixtureToolsObj.Location;
monitor.unixtime = unixtime;
monitor.route = route.id;
monitor.taskno = taskNo;
_automationFixtureMonitor.Update(monitor);
}
if (_unitOfWork.Commit() > 0)
{
Logger.WriteLineError($"准备上料任务:{taskNo}创建成功-{EnumHelper.GetEnumDesc(Automation.TaskAction.Step_LK_SXLW)}");
......@@ -471,11 +433,6 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(AccEnum.MachineDisable);
}
if (machineStatus.auto == 0)
{
machineStatus.status = (int)Automation.MachineStatus.Waiting;
}
var monitor = _automationFixtureMonitor.Get(f => f.projectId == ProjectId && f.section == assemble.section);
if (monitor==null)
{
......@@ -607,45 +564,9 @@ namespace Siger.ApiACC.Controllers
processid = 0,
programnumber = "",
remark =lineMode.inspect==1? "准备下料-》抽检台":"准备下料",
extend1= unixtime.ToStr()
extend1= section.ToStr()
});
var monitor = _automationFixtureMonitor.Get(f => f.section == section);
if (monitor == null)
{
_automationFixtureMonitor.Insert(new siger_automation_fixture_tools_monitor
{
fixtureguid = location.fixturetools,
fixturename = location.fixturename,
projectId = ProjectId,
section = 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,
unixtime= unixtime,
taskno= taskNo
});
}
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;
monitor.unixtime = unixtime;
monitor.taskno = taskNo;
_automationFixtureMonitor.Update(monitor);
}
if (_unitOfWork.Commit() > 0)
{
......@@ -681,19 +602,11 @@ namespace Siger.ApiACC.Controllers
{
throw new BadRequestException(AccEnum.MachineDisable);
}
var location = _automationLocation.Get(f => f.id == monitor.locationId);
var location = _automationLocation.Get(f => f.locationid == monitor.locationId);
if (location==null)
{
throw new BadRequestException(AccEnum.LocationNoSn);
}
if (string.IsNullOrEmpty(location.sn))
{
throw new BadRequestException(AccEnum.LocationNoSn);
}
if(location.status== (int)LocationStatus.Out)
{
throw new BadRequestException(AccEnum.LocationNoSn);
}
if (location!=null)
{
......
......@@ -126,6 +126,7 @@ namespace Siger.ApiACC.Controllers
}
var dataList = new List<AutomationStateList>();
foreach (var item in data)
{
var model = Mapper<ResponseAutomationTasklist, AutomationStateList>.Map(item);
......@@ -147,6 +148,7 @@ namespace Siger.ApiACC.Controllers
model.status_value = "";
break;
}
dataList.Add(model);
}
if (dataList.Any())
......
......@@ -266,7 +266,11 @@ namespace Siger.ApiACC.Controllers
{
try
{
//还有未完成任务 退出 等待任务下发
if (!_automationTaskList.CanTask(ProjectId, req.sectionid))
{
return new ObjectResult(CommonEnum.Succefull);
}
CreateTaskList(req.sectionid, req.productid, product.code, req.sn, req.routeid.ToInt());
AddSnList(req.materialid.ToInt(), inspection, product.code, section.parentid);//把二维码插入到 sn_list表
}
......@@ -325,6 +329,7 @@ namespace Siger.ApiACC.Controllers
private void CreateTaskList(int section, int productid, string productcode, string sn, int routeid)
{
var monitor = _fixtureMonitor.Get(f => f.section == section);
if (monitor==null)
{
......@@ -356,7 +361,9 @@ namespace Siger.ApiACC.Controllers
projectId = ProjectId,
productid = productid,
sn = sn,
ordercode = "",
ordercode = monitor.ordernumber,
fixturename=monitor.fixturename,
productname=monitor.productName,
fixtureguid = monitor.fixtureguid,
locationid = monitor.locationId,
productcode = productcode,
......
......@@ -171,5 +171,7 @@ namespace Siger.Middlelayer.AccRepository
public DbSet<siger_check_sn_trace_inspection> siger_check_sn_trace_inspection { get; set; }
public DbSet<siger_check_sn_trace_detail> siger_check_sn_trace_detail { get; set; }
public DbSet<siger_check_sn_list> siger_check_sn_list { get; set; }
}
}
......@@ -110,7 +110,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
complatevalue=q.completetime,
complatetime=q.completetime==DateTime.MinValue?"":q.completetime.ToString(),
action=EnumHelper.GetEnumDesc(q.action),
actionType=EnumHelper.GetEnumDesc(q.actiontype),
actionType= EnumHelper.GetEnumDesc(q.actiontype),
fixtureCode=t.code,
fixtureName=t.name,
location=q.locationid.ToString(),
......@@ -178,12 +178,12 @@ namespace Siger.Middlelayer.AccRepository.Repositories
if (toexcel.ToInt() == 1)
{
var entities = query.Where(expression).AsNoTracking().ToList();
return new PagedCollectionResult<ResponseAutomationTasklist>(entities, entities.Count);
var entities = query.Where(expression).OrderByDescending(d => d.id).AsNoTracking();
return new PagedCollectionResult<ResponseAutomationTasklist>(entities, entities.Count());
}
else
{
var entities = query.Where(expression).Skip((page - 1) * pagesize).Take(pagesize).AsNoTracking().ToList();
var entities = query.Where(expression).Skip((page - 1) * pagesize).Take(pagesize).OrderByDescending(d=>d.id).AsNoTracking();
var totalCount = query.Where(expression).Count();
return new PagedCollectionResult<ResponseAutomationTasklist>(entities, totalCount);
}
......
......@@ -6,6 +6,7 @@ namespace Siger.Middlelayer.AccRepository.Response
{
public class ResponseAutomationMachineStatus
{
public int id { get; set; }
public int sectionid { get; set; }
public string section { get; set; }
// public string machine { 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