修改任务数量
This commit is contained in:
parent
dbdd8373ee
commit
ee7ed4c726
@ -76,7 +76,6 @@ namespace DOAN.WebApi.Controllers.MES.mm
|
||||
if (string.IsNullOrEmpty(task_code)) { return SUCCESS(null); }
|
||||
var response = preparantTaskService.GetTaskMaterialBOMContrast(task_code);
|
||||
return SUCCESS(response);
|
||||
|
||||
}
|
||||
|
||||
//TODO 新增任务
|
||||
@ -100,6 +99,18 @@ namespace DOAN.WebApi.Controllers.MES.mm
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
//TODO 修改任务数量
|
||||
[HttpPost("ModifyTask_num")]
|
||||
public IActionResult ModifyTaskNum([FromBody] MmTaskMaterialInfoDto2 parm)
|
||||
{
|
||||
if(parm == null) { return SUCCESS(null); };
|
||||
|
||||
int response = preparantTaskService.ModifyTaskNum(parm,HttpContext.GetName());
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -37,6 +37,7 @@ namespace DOAN.Model.MES.mm.Dto
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 任务及其配料详情
|
||||
/// </summary>
|
||||
|
||||
@ -42,6 +42,25 @@ namespace DOAN.Model.MES.mm.Dto
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改配料任务数量
|
||||
/// </summary>
|
||||
public class MmTaskMaterialInfoDto2
|
||||
{
|
||||
/// <summary>
|
||||
/// 任务code
|
||||
/// </summary>
|
||||
public string FkTaskCode { get; set; }
|
||||
/// <summary>
|
||||
/// 物料code
|
||||
/// </summary>
|
||||
public string MaterialCode { get; set; }
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
public decimal Quantity { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class MmTaskMaterialInfoANDBOmDto
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
using DOAN.Model.MES.base_;
|
||||
using DOAN.Model.MES.mm.Dto;
|
||||
using DOAN.Model.MES.product;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -27,6 +28,8 @@ namespace DOAN.Service.MES.mm.IService
|
||||
|
||||
int DeleteTask(string task_code);
|
||||
|
||||
int ModifyTaskNum(MmTaskMaterialInfoDto2 parm, string name);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ using Infrastructure.Attribute;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -31,7 +32,7 @@ namespace DOAN.Service.MES.mm
|
||||
.WhereIF(!string.IsNullOrEmpty(route_code), it => it.FkRouteCode == route_code)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取任务
|
||||
/// </summary>
|
||||
@ -177,6 +178,38 @@ namespace DOAN.Service.MES.mm
|
||||
}
|
||||
|
||||
|
||||
public int ModifyTaskNum(MmTaskMaterialInfoDto2 parm, string name)
|
||||
{
|
||||
int result = 0;
|
||||
MmTaskMaterialInfo info = new MmTaskMaterialInfo();
|
||||
info.FkTaskCode = parm.FkTaskCode;
|
||||
info.MaterialCode = parm.MaterialCode;
|
||||
BaseMaterialList material = null;
|
||||
if (parm.MaterialCode != null)
|
||||
{
|
||||
material = Context.Queryable<BaseMaterialList>().Where(it => it.Code == parm.MaterialCode).First();
|
||||
|
||||
|
||||
}
|
||||
info.MaterialName = material?.Name;
|
||||
info.Specification = material?.Specification;
|
||||
info.Quantity = parm.Quantity;
|
||||
|
||||
info.Unit = material?.Unit;
|
||||
info.CreatedBy = name;
|
||||
info.CreatedTime = DateTime.Now;
|
||||
info.UpdatedBy = name;
|
||||
info.UpdatedTime = DateTime.Now;
|
||||
var x = Context.Storageable(info)
|
||||
.WhereColumns(it => new { it.FkTaskCode, it.MaterialCode }).ToStorage();
|
||||
|
||||
|
||||
result += x.AsInsertable.ExecuteCommand();
|
||||
result += x.AsUpdateable.IgnoreColumns(z => new { z.CreatedBy, z.CreatedTime, z.MaterialName, z.Specification, z.Unit }).ExecuteCommand();
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user