@@ -120,6 +120,21 @@ | |||
工艺状态 | |||
</summary> | |||
</member> | |||
<member name="F:BPA.MES.Base.Application.Const.OrderStatusEnum.NotStarted"> | |||
<summary> | |||
未开始 | |||
</summary> | |||
</member> | |||
<member name="F:BPA.MES.Base.Application.Const.OrderStatusEnum.Ongoing"> | |||
<summary> | |||
进行中 | |||
</summary> | |||
</member> | |||
<member name="F:BPA.MES.Base.Application.Const.OrderStatusEnum.Completed"> | |||
<summary> | |||
完成 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.WorkOrderStatusEnum"> | |||
<summary> | |||
名 称 :工单枚举 | |||
@@ -4476,6 +4491,16 @@ | |||
数量 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.Services.OrderService.Dtos.OrderWorkLimit"> | |||
<summary> | |||
成品数量限制 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Services.OrderService.Dtos.OrderWorkLimit.FinalslId"> | |||
<summary> | |||
成品 | |||
</summary> | |||
</member> | |||
<member name="M:BPA.MES.Base.Application.Services.OrderService.Service.IOrderService.PagedList(BPA.MES.Base.Application.Services.OrderService.Dtos.OrderQueryPageInput)"> | |||
<summary> | |||
分页列表 | |||
@@ -4510,6 +4535,13 @@ | |||
<param name="inputDto"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.MES.Base.Application.Services.OrderService.Service.IOrderService.GetFinalslLImit(System.String)"> | |||
<summary> | |||
获取成品剩余制作数量 | |||
</summary> | |||
<param name="id"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.MES.Base.Application.Services.OrderService.Service.OrderService.PagedList(BPA.MES.Base.Application.Services.OrderService.Dtos.OrderQueryPageInput)"> | |||
<summary> | |||
分页列表 | |||
@@ -4551,6 +4583,19 @@ | |||
<param name="inputDto"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.MES.Base.Application.Services.OrderService.Service.OrderService.VerifyOrderProduct(System.Collections.Generic.List{BPA.MES.Base.Application.Services.OrderService.Dtos.OrderInfoBaseDto})"> | |||
<summary> | |||
生成工单时验证成品数量 | |||
</summary> | |||
<param name="inputDto"></param> | |||
</member> | |||
<member name="M:BPA.MES.Base.Application.Services.OrderService.Service.OrderService.GetFinalslLImit(System.String)"> | |||
<summary> | |||
获取成品剩余制作数量 | |||
</summary> | |||
<param name="id"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.Services.GroupInfoDto"> | |||
<summary> | |||
名 称 :产品分组 | |||
@@ -61,4 +61,18 @@ namespace BPA.MES.Base.Application.Services.OrderService.Dtos | |||
public decimal Number { get; set; } | |||
public WorkOrderStatusEnum? Status { get; set; } | |||
} | |||
/// <summary> | |||
/// 成品数量限制 | |||
/// </summary> | |||
public class OrderWorkLimit | |||
{ | |||
/// <summary> | |||
/// 成品 | |||
/// </summary> | |||
public string FinalslId { get; set; } | |||
public decimal Limit { get; set; } | |||
} | |||
} |
@@ -45,6 +45,13 @@ namespace BPA.MES.Base.Application.Services.OrderService.Service | |||
/// <returns></returns> | |||
Task<bool> OrderAssociationWork(List<OrderInfoBaseDto> inputDto); | |||
/// <summary> | |||
/// 获取成品剩余制作数量 | |||
/// </summary> | |||
/// <param name="id"></param> | |||
/// <returns></returns> | |||
Task<List<OrderWorkLimit>> GetFinalslLImit(string OrderId); | |||
Task<bool> CodeFirst(); | |||
} | |||
} |
@@ -220,6 +220,8 @@ namespace BPA.MES.Base.Application.Services.OrderService.Service | |||
{ | |||
var result = false; | |||
var orderId = inputDto.Select(x => x.OrderId).First(); | |||
//验证 | |||
VerifyOrderProduct(inputDto); | |||
_dbContext.Ado.BeginTran(); | |||
try | |||
@@ -292,6 +294,72 @@ namespace BPA.MES.Base.Application.Services.OrderService.Service | |||
return true; | |||
} | |||
/// <summary> | |||
/// 生成工单时验证成品数量 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
private void VerifyOrderProduct(List<OrderInfoBaseDto> inputDto) | |||
{ | |||
var orderId = inputDto.Select(x => x.OrderId).First(); | |||
var data=_dbContext.Queryable<OrderInfoEntity, Pztj_FinalsInfoEntity>((a,b)=>new JoinQueryInfos( | |||
JoinType.Left,a.FinalslId==b.Id | |||
)).Where((a,b)=>a.OrderId==orderId). | |||
Select((a,b)=>new | |||
{ | |||
orderId = a.OrderId, | |||
ProductId = a.FinalslId, | |||
productName = b.Name, | |||
a.Number | |||
}).ToList(); | |||
foreach (var item in data) | |||
{ | |||
var productCount = inputDto.Where(x => x.FinalslId == item.ProductId).Sum(x => x.Number); | |||
var count= item.Number - productCount; | |||
if (count<0) | |||
{ | |||
throw Oops.Bah($"{item.productName}成品生成工单数量大于订单数量,多【{System.Math.Abs(count)}】"); | |||
} | |||
if (count>0) | |||
{ | |||
throw Oops.Bah($"{item.productName}成品生成工单数量小于订单数量,差【{count}】"); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取成品剩余制作数量 | |||
/// </summary> | |||
/// <param name="id"></param> | |||
/// <returns></returns> | |||
public async Task<List<OrderWorkLimit>> GetFinalslLImit(string OrderId) | |||
{ | |||
var result = new List<OrderWorkLimit>(); | |||
var orderInfo=_dbContext.Queryable<OrderInfoEntity>().Where(x=>x.OrderId==OrderId).ToList(); | |||
var list=_dbContext.Queryable<OrderWorkEntity , Pztj_WorkInfoEntity>((a,b)=>new JoinQueryInfos( | |||
JoinType.Left,a.WorkId==b.Id)) | |||
.Where((a, b) => a.OrderId==OrderId) | |||
.Select((a,b)=>new OrderWorkLimit() | |||
{ | |||
FinalslId=b.FinalId, | |||
Limit=0 | |||
}).ToList(); | |||
foreach (var item in orderInfo) | |||
{ | |||
var data=list.Where(x=>x.FinalslId==item.FinalslId).ToList(); | |||
result.Add(new OrderWorkLimit() | |||
{ | |||
FinalslId=item.FinalslId, | |||
Limit=item.Number-data.Sum(x=>x.Limit), | |||
}); | |||
} | |||
return result; | |||
} | |||
[HttpGet] | |||
public Task<bool> CodeFirst() | |||
@@ -76,6 +76,17 @@ export default { | |||
}); | |||
}, | |||
/** | |||
* 获取成品可制造数量 | |||
* @param parms | |||
* @returns | |||
*/ | |||
getFinalslLImit(parms:string) { | |||
return request('/api/order/getfinalsllimit/'+parms, { | |||
method: 'get', | |||
}); | |||
}, | |||
} | |||
@@ -222,7 +222,7 @@ export default () => { | |||
if (res.data) { | |||
message.success('添加成功'); | |||
actionRef.current?.reload(); | |||
setIsModalOpen(false); | |||
setIsWorkModalOpen(false); | |||
} else { | |||
message.error(res.errors || '添加失败'); | |||
} | |||
@@ -478,7 +478,7 @@ export default () => { | |||
}, | |||
]} | |||
> | |||
<Select style={{ width: 200, }} disabled > | |||
<Select style={{ width: 200, }} > | |||
{productSelect.map((item) => ( | |||
<Select.Option key={item.key} value={item.key}> | |||
{item.value} | |||
@@ -522,10 +522,16 @@ export default () => { | |||
labelCol={{ span: 8 }} | |||
rules={[{ required: true, message: '请输入数量!', },]} | |||
> | |||
<Input type="number" disabled style={{ width: '110px' }} /> | |||
<Input type="number" style={{ width: '110px' }} /> | |||
</Form.Item> | |||
<MinusCircleOutlined hidden={isRead} onClick={() => remove(name)} /> | |||
</Space> | |||
))} | |||
<Form.Item> | |||
<Button type="dashed" onClick={() => add()} block icon={<PlusOutlined />}> | |||
添加产品 | |||
</Button> | |||
</Form.Item> | |||
</> | |||
)} | |||
</Form.List> | |||