Commit 31d4ae2f by yiyu.li
parents 03004e87 657f60cf
......@@ -721,6 +721,9 @@ export default {
'9000496': 'ID重复',
'9000497': '父级和子级不能相同',
'9000498': '该类型绑定了工装,不能删除',
'9000499': '储位层级错误',
'9000500': '该类别绑定了储位,不能删除',
'9000501': '该仓库绑定了储位,不能删除',
'9100000': 'Departments cannot be empty',
'9100001': 'Position cannot be empty',
......
......@@ -748,6 +748,9 @@ export default {
'9000496': 'ID重复',
'9000497': '父级和子级不能相同',
'9000498': '该类型绑定了工装,不能删除',
'9000499': '储位层级错误',
'9000500': '该类别绑定了储位,不能删除',
'9000501': '该仓库绑定了储位,不能删除',
'9100000': '部门不能为空',
......
......@@ -292,6 +292,27 @@ export default {
},
//添加提交
addPost(){
if(!this.stid){
this.$Message.error("请填写ID");
return false;
}
if(!this.whid1){
this.$Message.error("请选择仓库");
return false;
}
if(!this.sTypes || this.sTypes.length === 0){
this.$Message.error("请填写储位层级");
return false;
}
else{
for(var i = 0;i<this.sTypes.length;i++){
if(!this.sTypes[i].val){
this.$Message.error("请填写"+this.sTypes[i].name);
return false;
}
}
}
let code = 0;
if(!this.stid){
code = 1;
......
......@@ -48,9 +48,16 @@ namespace Siger.ApiACC.Controllers
[HttpGet]
public IActionResult GetPageList(string wavehouseid, string locationid, int page, int pagesize, string toexcel)
{
var data = _autoLocationRepository.GetPagedList(wavehouseid.ToInt(), locationid.ToInt(), ProjectId, page, pagesize, toexcel);
var list = new List<ResponseAutomationLocation>();
var locations = _autoLocationRepository.GetLocationList(ProjectId);
var locationids = new List<int>();
if(locationid.ToInt() > 0)
{
var searchLocations = GetSonLocations(locationid.ToInt(), locations);
locationids = searchLocations.Select(q => q.id).ToList();
locationids.Add(locationid.ToInt());
}
var data = _autoLocationRepository.GetPagedList(wavehouseid.ToInt(), locationids, ProjectId, page, pagesize, toexcel);
var list = new List<ResponseAutomationLocation>();
var categorys = _toolsCategoryRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid).ToList();
foreach (var item in data.Data)
{
......@@ -182,6 +189,13 @@ namespace Siger.ApiACC.Controllers
return query.ToList().Concat(query.ToList().SelectMany(t => GetParentLocations(t.parentid, types)));
}
private IEnumerable<siger_wms_storage_location> GetSonLocations(int id, IEnumerable<siger_wms_storage_location> types)
{
var query = from c in types where c.parentid == id select c;
return query.ToList().Concat(query.ToList().SelectMany(t => GetSonLocations(t.id, types)));
}
[HttpPost]
public IActionResult Add([FromBody]RequestAddAutomationLocation req)
{
......
......@@ -69,6 +69,10 @@ namespace Siger.ApiACC.Controllers
var models = new List<ResponseAumationFixtureToolsAssembly>();
var details = _toolsAssemblyRepository.GetDetailList(item.fixtureguid, category.ToInt(), code, name, state, ProjectId);
if (!details.Any())
{
details = _toolsAssemblyRepository.GetDetailList(item.fixtureguid, 0, "", "", "", ProjectId);//这里是为了符合测试的逻辑,当父级找到,子级找不到时,也把子级全部显示出来
}
foreach(var model in details)
{
var cates1 = GetParentCategoryList(model.cate_guid, categorys);
......
......@@ -21,6 +21,7 @@ using Siger.Middlelayer.WmsRepository.Repositories.Interface;
using Siger.Middlelayer.WmsRepository.Request;
using Siger.Middlelayer.WmsRepository.Response;
using Siger.Middlelayer.Common.Extensions;
using Siger.Middlelayer.Log;
namespace Siger.ApiWMS.Controllers
{
......@@ -237,6 +238,10 @@ namespace Siger.ApiWMS.Controllers
throw new BadRequestException(CommonEnum.LayerNotClean);
}
//存在此列表记录
if (location.GetList(q => q.projectid == ProjectId && q.status == (int)RowState.Valid && q.typeid == req.id).Any())
{
throw new BadRequestException(RequestEnum.CategoryBindLocationData);
}
entity.status = (int)RowState.Invalid;
entity.update_time = DateTime.Now;
......@@ -396,7 +401,7 @@ namespace Siger.ApiWMS.Controllers
locationData = locationAllData.Where(f => typeids.Contains(f.typeid)).Skip((page - 1) * pageSize).Take(pageSize).ToList();
}
Dictionary<int, string> waveHouseDic = new Dictionary<int, string>();
storage.GetList(f => f.status == (int)RowState.Valid && f.projectid == ProjectId).Select(f => new { f.id, f.name }).ToList().ForEach(f =>
storage.GetList(f => f.projectid == ProjectId).Select(f => new { f.id, f.name }).ToList().ForEach(f =>
{
waveHouseDic.Add(f.id, f.name);
});
......@@ -413,7 +418,7 @@ namespace Siger.ApiWMS.Controllers
{
id = item.id,
pid = item.parentid,
storageName = waveHouseDic[item.storageid],
storageName = waveHouseDic.ContainsKey(item.storageid) ? waveHouseDic[item.storageid] : "",
serialNumber = item.serial_number,
state = item.status,
field = new List<FiledName>(),
......@@ -458,8 +463,9 @@ namespace Siger.ApiWMS.Controllers
}
result.Add(tmp);
}
catch (Exception)
catch (Exception e)
{
Logger.WriteLineError(e.Message);
}
}
......@@ -927,6 +933,20 @@ namespace Siger.ApiWMS.Controllers
throw new BadRequestException(RequestEnum.LocationTypeNotFound);
}
var sonLocationTypes = GetSonTypes(0, locationTypes).ToList();
if(req.storeArr.Count != sonLocationTypes.Count)
{
throw new BadRequestException(RequestEnum.LocationLevelError);
}
foreach(var store in req.storeArr)
{
if (string.IsNullOrEmpty(store.val))
{
throw new BadRequestException(RequestEnum.ParameterMiss);
}
}
var locationTypeId = sonLocationTypes.LastOrDefault()?.id ?? 0;
var waveHouse = storage.Get(q => q.projectid == ProjectId && q.status == (int)RowState.Valid && q.id == req.warehouseid);
if (waveHouse == null)
......@@ -1060,6 +1080,20 @@ namespace Siger.ApiWMS.Controllers
throw new BadRequestException(RequestEnum.LocationTypeNotFound);
}
var sonLocationTypes = GetSonTypes(0, locationTypes).ToList();
if (req.storeArr.Count != sonLocationTypes.Count)
{
throw new BadRequestException(RequestEnum.LocationLevelError);
}
foreach (var store in req.storeArr)
{
if (string.IsNullOrEmpty(store.val))
{
throw new BadRequestException(RequestEnum.ParameterMiss);
}
}
var locationTypeId = sonLocationTypes.LastOrDefault()?.id ?? 0;
var waveHouse = storage.Get(q => q.projectid == ProjectId && q.status == (int)RowState.Valid && q.id == req.warehouseid);
if (waveHouse == null)
......
......@@ -188,6 +188,11 @@ namespace Siger.ApiWMS.Controllers
if (entity == null)
throw new BadRequestException(CommonEnum.NoData);
if (location.GetList(q => q.projectid == ProjectId && q.status == (int)RowState.Valid && q.storageid == req.id).Any())
{
throw new BadRequestException(RequestEnum.WavehouseBindLocationData);
}
entity.status = (int)RowState.Valid;
storage.Update(entity);
if (_unitOfWork.Commit() > 0)
......
......@@ -1479,5 +1479,14 @@ namespace Siger.Middlelayer.Common
[Description("该类型绑定了工装,不能删除")]
CategoryBindFixtureToolData,
[Description("储位层级错误")]
LocationLevelError,
[Description("该类别绑定了储位,不能删除")]
CategoryBindLocationData,
[Description("该仓库绑定了储位,不能删除")]
WavehouseBindLocationData,
}
}
......@@ -24,7 +24,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
_context = context;
}
public IPagedCollectionResult<ResponseAutomationLocation> GetPagedList(int wavehouseid, int locationid, int projectid, int page, int pagesize, string toexcel)
public IPagedCollectionResult<ResponseAutomationLocation> GetPagedList(int wavehouseid, IEnumerable<int> locationid, int projectid, int page, int pagesize, string toexcel)
{
var query = from q in _context.siger_automation_location
join t in _context.siger_automation_fixture_tools on q.fixturetools equals t.guid
......@@ -67,9 +67,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories
wavehouseidExpression = q => q.wavehouseid == wavehouseid;
}
Expression<Func<ResponseAutomationLocation, bool>> locationidExpression = f => true;
if (locationid > 0)
if (locationid.Any())
{
locationidExpression = q => q.locationid == locationid;
locationidExpression = q => locationid.Contains(q.locationid);
}
var expression = wavehouseidExpression.And(locationidExpression);
if(toexcel.ToInt() == 1)
......
......@@ -9,7 +9,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
public interface IAutomationLocationRepository : IAccRepositoryBase<siger_automation_location>
{
IPagedCollectionResult<ResponseAutomationLocation> GetPagedList(int wavehouseid, int locationid, int projectid, int page, int pagesize, string toexcel);
IPagedCollectionResult<ResponseAutomationLocation> GetPagedList(int wavehouseid, IEnumerable<int> locationid, int projectid, int page, int pagesize, string toexcel);
siger_wms_storage_location GetLocation(int id, int projectid);
......
......@@ -32,10 +32,8 @@ namespace Siger.Middlelayer.CncRepository.Request
public int yieldratio { get; set; }
[Required(ErrorMessage = "StartTimeNotNull")]
public string start_time { get; set; }
[Required(ErrorMessage = "EndTimeNotNull")]
public string end_time { get; set; }
}
......@@ -63,10 +61,8 @@ namespace Siger.Middlelayer.CncRepository.Request
public int yieldratio { get; set; }
[Required(ErrorMessage = "StartTimeNotNull")]
public string start_time { get; set; }
[Required(ErrorMessage = "EndTimeNotNull")]
public string end_time { 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