插入工单、新增工单
This commit is contained in:
parent
77cbaf3f7b
commit
4bf757527c
@ -11,6 +11,8 @@ using DOAN.Model.System;
|
||||
using MiniExcelLibs;
|
||||
using DOAN.Model.System.Dto;
|
||||
using DOAN.Model;
|
||||
using DOAN.Model.MES.base_.Dto;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
//创建时间:2024-07-16
|
||||
namespace DOAN.Admin.WebApi.Controllers
|
||||
@ -127,7 +129,7 @@ namespace DOAN.Admin.WebApi.Controllers
|
||||
return SUCCESS(response);
|
||||
}
|
||||
/// <summary>
|
||||
/// 插入工单
|
||||
/// 插入工单/或者新增工单
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns>1成功 0失败</returns>
|
||||
@ -218,5 +220,17 @@ namespace DOAN.Admin.WebApi.Controllers
|
||||
return ExportExcel(result.Item2, result.Item1);
|
||||
}
|
||||
|
||||
//TODO 获取物料
|
||||
[HttpPost("get_material")]
|
||||
public IActionResult GetMaterialInfo([FromBody] BaseMaterialListQueryDto query)
|
||||
{
|
||||
if (query == null)
|
||||
{
|
||||
return SUCCESS(null);
|
||||
}
|
||||
var response = _ProWorkorderService.GetMaterialInfo(query);
|
||||
return SUCCESS(response);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -147,7 +147,7 @@ namespace DOAN.Model.MES.product.Dto
|
||||
/// <summary>
|
||||
/// 下一个工单号
|
||||
/// </summary>
|
||||
[Required]
|
||||
|
||||
public string next_id { get; set; }
|
||||
public string Id { get; set; }
|
||||
|
||||
|
||||
@ -7,6 +7,8 @@ using DOAN.Model.System.Dto;
|
||||
using DOAN.Model.System;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using DOAN.Model.MES.base_;
|
||||
using DOAN.Model.MES.base_.Dto;
|
||||
|
||||
|
||||
namespace DOAN.Service.MES.product.IService
|
||||
@ -34,5 +36,7 @@ namespace DOAN.Service.MES.product.IService
|
||||
|
||||
public PagedInfo<ProWorkorder> WorkOrderExport(DateTime exportTime, PagerInfo pager);
|
||||
|
||||
List<BaseMaterialList> GetMaterialInfo(BaseMaterialListQueryDto query);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,6 +26,8 @@ using Microsoft.AspNetCore.Components.Forms;
|
||||
using System.Globalization;
|
||||
using System.ComponentModel;
|
||||
using NPOI.Util;
|
||||
using DOAN.Model.MES.base_.Dto;
|
||||
using Aliyun.OSS;
|
||||
|
||||
namespace DOAN.Service.MES.product
|
||||
{
|
||||
@ -69,8 +71,8 @@ namespace DOAN.Service.MES.product
|
||||
|
||||
MaterialName = m.Name,
|
||||
|
||||
Specification= m.Specification,
|
||||
Unit= m.Unit,
|
||||
Specification = m.Specification,
|
||||
Unit = m.Unit,
|
||||
}, true);
|
||||
var query2 = Context.Queryable(query1).LeftJoin<BaseWorkRoute>((q, r) => q.RouteId == r.Code)
|
||||
.Select((q, r) => new ProWorkorderDto3()
|
||||
@ -187,7 +189,7 @@ namespace DOAN.Service.MES.product
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 插入工单
|
||||
/// 插入工单、新增工单
|
||||
/// </summary>
|
||||
/// <param name="proWorkorder"></param>
|
||||
/// <param name="next_id"></param>
|
||||
@ -197,20 +199,36 @@ namespace DOAN.Service.MES.product
|
||||
int result = 0;
|
||||
proWorkorder.Id = XueHua;
|
||||
proWorkorder.WorkorderDate = proWorkorder.WorkorderDate.Value.Date;
|
||||
UseTran2(() =>
|
||||
if(!string.IsNullOrEmpty(next_id))
|
||||
{
|
||||
int sortNum = Context.Queryable<ProWorkorder>().Where(it => it.Id == next_id).Select(it => it.Sort.Value).First();
|
||||
Context.Updateable<ProWorkorder>()
|
||||
.Where(it => it.WorkorderDate == proWorkorder.WorkorderDate)
|
||||
.Where(it => it.Sort >= sortNum)
|
||||
.SetColumns(it => new ProWorkorder() { Sort = it.Sort + 10 })
|
||||
.ExecuteCommand();
|
||||
proWorkorder.Sort = sortNum;
|
||||
UseTran2(() =>
|
||||
{
|
||||
|
||||
int sortNum = Context.Queryable<ProWorkorder>().Where(it => it.Id == next_id).Select(it => it.Sort.Value).First();
|
||||
Context.Updateable<ProWorkorder>()
|
||||
.Where(it => it.WorkorderDate == proWorkorder.WorkorderDate)
|
||||
.Where(it => it.Sort >= sortNum)
|
||||
.SetColumns(it => new ProWorkorder() { Sort = it.Sort + 10 })
|
||||
.ExecuteCommand();
|
||||
proWorkorder.Sort = sortNum;
|
||||
proWorkorder.Status = 1;
|
||||
|
||||
Context.Insertable(proWorkorder).ExecuteCommand();
|
||||
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
int sortNum = Context.Queryable<ProWorkorder>().Max(it => it.Sort.Value);
|
||||
|
||||
proWorkorder.Sort = sortNum+10;
|
||||
proWorkorder.Status = 1;
|
||||
|
||||
Context.Insertable(proWorkorder).ExecuteCommand();
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
Generate_workorder(new ProWorkorderQueryDto2()
|
||||
{
|
||||
WorkorderDate = proWorkorder.WorkorderDate.Value
|
||||
@ -474,7 +492,7 @@ namespace DOAN.Service.MES.product
|
||||
//NPOI.SS.UserModel.ICell currentCell_04 = currentRow.GetCell(3);
|
||||
//workorder.Unit = currentCell_04.ToString();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
NPOI.SS.UserModel.ICell currentCell_06 = currentRow.GetCell(5);
|
||||
@ -531,6 +549,22 @@ namespace DOAN.Service.MES.product
|
||||
return Context.Queryable<ProWorkorder>().Where(it => it.WorkorderDate == exportTime).ToPage(pager);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取物料信息
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
public List<BaseMaterialList> GetMaterialInfo(BaseMaterialListQueryDto parm)
|
||||
{
|
||||
var predicate = Expressionable.Create<BaseMaterialList>()
|
||||
.AndIF(!string.IsNullOrEmpty(parm.Name), it => it.Name.Contains(parm.Name))
|
||||
.AndIF(!string.IsNullOrEmpty(parm.Code), it => it.Code.Contains(parm.Code))
|
||||
.AndIF(!string.IsNullOrEmpty(parm.FkMaterialTypeCode), it => it.FkMaterialTypeCode.Contains(parm.FkMaterialTypeCode));
|
||||
|
||||
|
||||
return Context.Queryable<BaseMaterialList>()
|
||||
.Where(predicate.ToExpression()).ToList();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user