Commit e8eb7746 by jiawei.su

someupdate

parent acbf1f72
...@@ -263,12 +263,15 @@ namespace Siger.ApiACC.Controllers ...@@ -263,12 +263,15 @@ namespace Siger.ApiACC.Controllers
/// 扫描 /// 扫描
/// </summary> /// </summary>
/// <param name="code"></param> /// <param name="code"></param>
/// <param name="id"></param>
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
public IActionResult ScanCode(string code) public IActionResult ScanCode(string code,int id)
{
if (string.IsNullOrEmpty(code))
{ {
var result = _automationFixtureToolsProduct.GetPlanFixtureInfo(ProjectId, code); var result = _automationFixtureToolsProduct.GetPlanFixtureInfo(ProjectId, code);
if (result==null) if (result == null)
{ {
throw new BadRequestException(AccEnum.FixtureOrderNulll); throw new BadRequestException(AccEnum.FixtureOrderNulll);
} }
...@@ -276,6 +279,19 @@ namespace Siger.ApiACC.Controllers ...@@ -276,6 +279,19 @@ namespace Siger.ApiACC.Controllers
result.Sn = sn; result.Sn = sn;
return new ObjectResult(result); return new ObjectResult(result);
} }
if (id==0)
{
throw new BadRequestException(RequestEnum.ParameterMiss);
}
//下料
var unload = _automationFixtureToolsProduct.GetPlanFixtureInfoByLocation(ProjectId, id);
if (unload == null)
{
throw new BadRequestException(AccEnum.FixtureOrderNulll);
}
return new ObjectResult(unload);
}
/// <summary> /// <summary>
/// 准备上料 -生成指令 load (立库->上料位) /// 准备上料 -生成指令 load (立库->上料位)
/// </summary> /// </summary>
...@@ -676,5 +692,7 @@ namespace Siger.ApiACC.Controllers ...@@ -676,5 +692,7 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(CommonEnum.Fail); throw new BadRequestException(CommonEnum.Fail);
} }
} }
} }
} }
...@@ -136,7 +136,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -136,7 +136,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
ProductName = p.product_name, ProductName = p.product_name,
Url=pd.image, Url=pd.image,
FixtureName=t.name, FixtureName=t.name,
FixtureGuid=t.guid, FixtureGuid=t.code,
ProductCode =q!=null? q.productcode:"", ProductCode =q!=null? q.productcode:"",
Location =l!=null? l.locationid:0, Location =l!=null? l.locationid:0,
}; };
...@@ -218,5 +218,29 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -218,5 +218,29 @@ namespace Siger.Middlelayer.AccRepository.Repositories
throw; throw;
} }
} }
public ResponsePlanlFixtureInfo GetPlanFixtureInfoByLocation(int projectId, int id)
{
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
join pd in _context.siger_project_product on p.product_id equals pd.id
where q.projectId == projectId && l.id == id
&& q.status == (int)RowState.Valid && t.status == (int)RowState.Valid && l.status == (int)RowState.Valid
select new ResponsePlanlFixtureInfo
{
OrderNumber = d.OrderNumber,
ProductName = p.product_name,
Url = pd.image,
FixtureName = t.name,
FixtureGuid = t.code,
ProductCode = q != null ? q.productcode : "",
Location = l != null ? l.locationid : 0,
Sn=l.sn
};
return query.FirstOrDefault();
}
} }
} }
...@@ -41,28 +41,49 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -41,28 +41,49 @@ namespace Siger.Middlelayer.AccRepository.Repositories
} }
/// <summary>
/// 长度10 任务编号 PLC限制
/// </summary>
/// <param name="trigerType"></param>
/// <returns></returns>
public string CrateTaskNumber(TaskTrigerType trigerType) public string CrateTaskNumber(TaskTrigerType trigerType)
{ {
var date = DateTime.Now; var date = DateTime.Now;
var lable = date.ToString(UnixTimeHelper.DateTimeFormatYmd)+date.Hour + date.Minute + date.Second; var lable = date.Year+date.Day+date.Hour + date.Minute + date.Second;
var lableUnix = UnixTimeHelper.GetNow(); var lableUnix = UnixTimeHelper.GetNow();
var radon = new Random().Next(1000, 9999);
if (trigerType== TaskTrigerType.Auto) if (trigerType== TaskTrigerType.Auto)
{ {
return $"A{lableUnix}R{radon}T{lable}"; return $"{date.Year}{date.DayOfYear}A{lable}";
}else }else
{ {
return $"M{lableUnix}R{radon}T{lable}"; return $"{date.Year}{date.DayOfYear}M{lable}";
} }
} }
/// <summary>
/// 工件长度10 PLC 限制
/// </summary>
/// <param name="productCode"></param>
/// <returns></returns>
public string CreateRandonSn(string productCode) public string CreateRandonSn(string productCode)
{ {
var date = DateTime.Now; var date = DateTime.Now;
var serinum = date.DayOfYear+date.Hour + date.Minute + date.Second + date.Millisecond; var serinum = date.DayOfYear+date.Hour + date.Minute + date.Second + date.Millisecond;
var dayofyear = GetDayOfYear(date);
var lable = $"{date.Year}{dayofyear}{serinum}";
return lable;
}
private string GetDayOfYear(DateTime dt)
{
var lable = dt.DayOfYear.ToString();
var result = string.Empty;
for (int i = 0;i< 3- lable.Length;i++)
{
result +="0";
}
return $"{result}{lable}";
var randon = new Random().Next(1000, 9999);
return $"{productCode}{date.ToString(UnixTimeHelper.DateTimeFormatYmd)}{serinum}{randon}";
} }
public IPagedCollectionResult<ResponseAutomationTasklist> GetTasklistPagedList(List<int> sections, int taskType, string productCode, string TaskNo, string sn, int status, int actionType, string tiggertime, string comptime, int projectid, int page, int pagesize) public IPagedCollectionResult<ResponseAutomationTasklist> GetTasklistPagedList(List<int> sections, int taskType, string productCode, string TaskNo, string sn, int status, int actionType, string tiggertime, string comptime, int projectid, int page, int pagesize)
......
...@@ -21,6 +21,14 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface ...@@ -21,6 +21,14 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
/// <returns></returns> /// <returns></returns>
ResponsePlanlFixtureInfo GetPlanFixtureInfo(int projectId, string ordernumber); ResponsePlanlFixtureInfo GetPlanFixtureInfo(int projectId, string ordernumber);
/// <summary>
///
/// </summary>
/// <param name="projectId"></param>
/// <param name="ordernumber"></param>
/// <returns></returns>
ResponsePlanlFixtureInfo GetPlanFixtureInfoByLocation(int projectId, int id);
CommonImportResult ImportData(IEnumerable<FixtureToolsProductTemplate> list, int projectid, int userid); CommonImportResult ImportData(IEnumerable<FixtureToolsProductTemplate> list, int projectid, int userid);
/// <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