生成物料需求计划

This commit is contained in:
qianhao.xu 2024-09-27 10:56:01 +08:00
parent 23af8061c1
commit 885a936d44
5 changed files with 41 additions and 9 deletions

View File

@ -129,12 +129,28 @@ namespace DOAN.WebApi.Controllers.JobKanban
{
if ( string.IsNullOrEmpty(line_code) || handleDate < DateTime.MinValue.AddMonths(1))
{
return SUCCESS(null);
return ToResponse(new ApiResult(210, "paramter is null",-1));
}
var response = workorderProgressService.GetProductingWorkorder( line_code, handleDate);
if (response == null)
{
return ToResponse(new ApiResult(200, "There is no ongoing any workorder, please contact doan","no_workorder"));
}
return SUCCESS(response);
}
//TODO 添加标签日志 上位机接口
[HttpGet("add_label_log")]
public IActionResult AddLabelLog(string labelContext, string workOrder)
{
if (string.IsNullOrEmpty(labelContext) || string.IsNullOrEmpty(workOrder))
{
return ToResponse(new ApiResult(210, "paramter is null", -1));
}
var response = workorderProgressService.AddLabelLog(labelContext, workOrder);
return SUCCESS(response);
}
//TODO 扫码校验判断标签是否与当前工单匹配 0 不匹配 1匹配
[HttpGet("label_workorder_match")]

View File

@ -27,14 +27,14 @@ namespace DOAN.Service.JobKanban.IService
KanbanInfo GetKanbanNum(DateTime today, string line_code, string group_code);
int StartWorkOrder(string workorder);
int FinishWorkOrder(string workorder);
ProWorkorder GetProductingWorkorder( string line_code, DateTime handleDate);
ProWorkorder GetProductingWorkorder(string line_code, DateTime handleDate);
int AddLabelLog(string labelContext, string workOrder);
int LabelWorkOrderMatch(string LabelContext, string workOrder);
int LabelWorkOrderMatch(string LabelContext, string workOrder);
int FinishAndReportWorkorder(string workorder, int finish_num);
}

View File

@ -211,6 +211,19 @@ namespace DOAN.Service.JobKanban
}
public int AddLabelLog(string labelContext, string workOrder)
{
ProLabelTraceLog log = new ProLabelTraceLog();
log.Id = XueHua;
log.LabelContext = labelContext;
log.Workorder = workOrder;
log.Status = 1;
log.CreatedTime = DateTime.Now;
log.CreatedBy = "MES";
return Context.Insertable(log).ExecuteCommand();
}
public int LabelWorkOrderMatch(string LabelContext, string workOrder)
{

View File

@ -337,7 +337,7 @@ namespace DOAN.Service.MES.mm
{
var predicte1 = Expressionable.Create<MmPreparationTaskLine>()
.AndIF(parm.searchDate != null && parm.searchDate.Length >= 2 && parm.searchDate[0] > DateTime.MinValue, it => it.TaskDate >= parm.searchDate[0].ToLocalTime().Date)
.AndIF(parm.searchDate != null && parm.searchDate.Length >= 2 && parm.searchDate[1] > DateTime.MinValue, it => it.TaskDate >= parm.searchDate[1].ToLocalTime().Date)
.AndIF(parm.searchDate != null && parm.searchDate.Length >= 2 && parm.searchDate[1] > DateTime.MinValue, it => it.TaskDate <= parm.searchDate[1].ToLocalTime().Date)
.AndIF(!string.IsNullOrEmpty(parm.route_code), it => it.LineCode == parm.route_code);
var query1 = Context.Queryable<MmPreparationTaskLine>().Where(predicte1.ToExpression());

View File

@ -41,6 +41,8 @@ namespace DOAN.Service.group
List<MmRequirePlan> mmRequirePlans = new List<MmRequirePlan>();
//获取当天所有工单
List<ProWorkorder> ProWorkorderList = Context.Queryable<ProWorkorder>().Where(it => it.WorkorderDate == plan_date).ToList();
//优化获取BOM
List<BaseMaterialBom> boms_All = Context.Queryable<BaseMaterialBom>().Where(it => SqlFunc.Subqueryable<ProWorkorder>().Where(pw => pw.ProductionCode == it.InvCode).Any()).ToList();
if (ProWorkorderList != null && ProWorkorderList.Count > 0)
{
foreach (var workorder_item in ProWorkorderList)
@ -52,7 +54,8 @@ namespace DOAN.Service.group
//每个产品的原材料 BOM
//var query= Context.Queryable<BaseMaterialBom>().Where(it => it.InvCode == workorder_item.ProductionCode);
List<BaseMaterialBom> boms = Context.Queryable<BaseMaterialBom>().Where(it => it.InvCode == workorder_item.ProductionCode).ToList();
List<BaseMaterialBom> boms = boms_All.Where(it => it.InvCode == workorder_item.ProductionCode).ToList();
if (boms != null && boms.Count > 0)
{
@ -369,7 +372,7 @@ namespace DOAN.Service.group
mmRequirePlan.Color = item.Color;
mmRequirePlan.Specification = item.Specification;
mmRequirePlan.Unit= item.Unit;
mmRequirePlan.Unit = item.Unit;
mmRequirePlan.CreatedBy = CreatedBy;
mmRequirePlan.CreatedTime = DateTime.Now;