去除引用common.props
This commit is contained in:
@@ -1,29 +1,18 @@
|
||||
using JNPF;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Extras.CollectiveOAuth.Models;
|
||||
using JNPF.Extras.CollectiveOAuth.Utils;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Logging;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.ClearScript.Util.Web;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
using Tnb.ProductionMgr.Entities.Dto;
|
||||
using Tnb.ProductionMgr.Interfaces;
|
||||
using Tnb.ProductionMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.BasicData;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
|
||||
namespace Tnb.ProductionMgr
|
||||
{
|
||||
@@ -39,7 +28,7 @@ namespace Tnb.ProductionMgr
|
||||
private readonly IPrdMoTaskService _prdMoTaskService;
|
||||
private readonly IBillRullService _billRullService;
|
||||
// private readonly WmsSignForDeliveryService _wmsSignForDeliveryService;
|
||||
|
||||
|
||||
|
||||
|
||||
public PrdFeedingService(
|
||||
@@ -57,7 +46,7 @@ namespace Tnb.ProductionMgr
|
||||
_billRullService = billRullService;
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpPost]
|
||||
public async Task<dynamic> SaveData(MaterialReceiptInput input)
|
||||
{
|
||||
@@ -67,7 +56,7 @@ namespace Tnb.ProductionMgr
|
||||
var moTask = await db.Queryable<PrdMoTask>().FirstAsync(x => x.id == input.mo_task_id);
|
||||
var inputMaterials = await db.Queryable<BasMbomInput>()
|
||||
.Where(x => x.mbom_id == moTask.bom_id && x.mbom_process_id == input.mbom_process_id)
|
||||
.Select(x=>x.material_id)
|
||||
.Select(x => x.material_id)
|
||||
.ToListAsync();
|
||||
|
||||
string code = await _billRullService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.FEEDING_CODE);
|
||||
@@ -94,7 +83,7 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
foreach (var item in input.details)
|
||||
{
|
||||
if(!inputMaterials.Contains(item["material_id"]))
|
||||
if (!inputMaterials.Contains(item["material_id"]))
|
||||
throw new Exception("该物料不是生产bom投入物料,不能签收");
|
||||
|
||||
var detail = await db.Queryable<PrdMaterialReceiptD>()
|
||||
@@ -115,10 +104,11 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
if (detail != null)
|
||||
{
|
||||
if(detail.feeding_num + num > detail.num)
|
||||
if (detail.feeding_num + num > detail.num)
|
||||
{
|
||||
throw new Exception("投料数量不能大于签收数量");
|
||||
}else if (detail.feeding_num + num == detail.num)
|
||||
}
|
||||
else if (detail.feeding_num + num == detail.num)
|
||||
{
|
||||
await db.Updateable<PrdMaterialReceiptD>()
|
||||
.SetColumns(x => x.feeding_num == x.feeding_num + num)
|
||||
@@ -164,7 +154,7 @@ namespace Tnb.ProductionMgr
|
||||
taskLog.mo_task_code = moTask.mo_task_code;
|
||||
taskLog.station_code = station?.EnCode;
|
||||
taskLog.process_code = process.code;
|
||||
|
||||
|
||||
await db.Insertable<PrdFeedingH>(prdFeedingH).ExecuteCommandAsync();
|
||||
await db.Insertable<PrdFeedingD>(list).ExecuteCommandAsync();
|
||||
await db.Insertable<PrdTaskLog>(taskLog).ExecuteCommandAsync();
|
||||
@@ -181,8 +171,8 @@ namespace Tnb.ProductionMgr
|
||||
// carry_code = input.carry_code ?? "",
|
||||
// });
|
||||
}
|
||||
|
||||
if(!result.IsSuccess) throw Oops.Oh(result.ErrorMessage);
|
||||
|
||||
if (!result.IsSuccess) throw Oops.Oh(result.ErrorMessage);
|
||||
return result.IsSuccess ? "投料成功" : result.ErrorMessage;
|
||||
}
|
||||
|
||||
@@ -204,13 +194,13 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
var carry = await db.Queryable<WmsCarryH>().SingleAsync(x => x.carry_code == input.carry_code);
|
||||
var workline = await db.Queryable<OrganizeEntity>().SingleAsync(x => x.Id == worklineId);
|
||||
var workshop = await db.Queryable<OrganizeEntity>().SingleAsync(x=>x.Id==workline.ParentId);
|
||||
var workshop = await db.Queryable<OrganizeEntity>().SingleAsync(x => x.Id == workline.ParentId);
|
||||
var inputMaterials = await db.Queryable<BasMbomInput>()
|
||||
.Where(x => x.mbom_id == moTask.bom_id && x.mbom_process_id == moTask.mbom_process_id)
|
||||
.Select(x=>x.material_id)
|
||||
.Select(x => x.material_id)
|
||||
.ToListAsync();
|
||||
|
||||
|
||||
|
||||
string code = await _billRullService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.FEEDING_CODE);
|
||||
prdFeedingH = new PrdFeedingH()
|
||||
{
|
||||
@@ -229,12 +219,12 @@ namespace Tnb.ProductionMgr
|
||||
create_time = DateTime.Now,
|
||||
org_id = _userManager.GetUserInfo().Result.organizeId
|
||||
};
|
||||
|
||||
|
||||
if (input.details != null && input.details.Count > 0)
|
||||
{
|
||||
foreach (var item in input.details)
|
||||
{
|
||||
if(!inputMaterials.Contains(item["material_id"]))
|
||||
if (!inputMaterials.Contains(item["material_id"]))
|
||||
throw new Exception("该物料不是生产bom投入物料,不能签收");
|
||||
|
||||
var detail = await db.Queryable<PrdMaterialReceiptD>()
|
||||
@@ -255,10 +245,11 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
if (detail != null)
|
||||
{
|
||||
if(detail.feeding_num + num > detail.num)
|
||||
if (detail.feeding_num + num > detail.num)
|
||||
{
|
||||
throw new Exception("投料数量不能大于签收数量");
|
||||
}else if (detail.feeding_num + num == detail.num)
|
||||
}
|
||||
else if (detail.feeding_num + num == detail.num)
|
||||
{
|
||||
await db.Updateable<PrdMaterialReceiptD>()
|
||||
.SetColumns(x => x.feeding_num == x.feeding_num + num)
|
||||
@@ -285,7 +276,7 @@ namespace Tnb.ProductionMgr
|
||||
throw new Exception("没有签收物料");
|
||||
}
|
||||
|
||||
|
||||
|
||||
await db.Insertable<PrdFeedingH>(prdFeedingH).ExecuteCommandAsync();
|
||||
await db.Insertable<PrdFeedingD>(list).ExecuteCommandAsync();
|
||||
|
||||
@@ -330,12 +321,12 @@ namespace Tnb.ProductionMgr
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
if(!result.IsSuccess) throw Oops.Bah(result.ErrorMessage);
|
||||
|
||||
if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage);
|
||||
return result.IsSuccess ? "签收成功" : result.ErrorMessage;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 生产投料
|
||||
/// </summary>
|
||||
@@ -366,13 +357,13 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
var carry = await db.Queryable<WmsCarryH>().SingleAsync(x => x.carry_code == input.carry_code);
|
||||
var workline = await db.Queryable<OrganizeEntity>().SingleAsync(x => x.Id == worklineId);
|
||||
var workshop = await db.Queryable<OrganizeEntity>().SingleAsync(x=>x.Id==workline.ParentId);
|
||||
var workshop = await db.Queryable<OrganizeEntity>().SingleAsync(x => x.Id == workline.ParentId);
|
||||
var inputMaterials = await db.Queryable<BasMbomInput>()
|
||||
.Where(x => x.mbom_id == moTask.bom_id && x.mbom_process_id == moTask.mbom_process_id)
|
||||
.Select(x=>x.material_id)
|
||||
.Select(x => x.material_id)
|
||||
.ToListAsync();
|
||||
|
||||
|
||||
|
||||
string code = await _billRullService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.FEEDING_CODE);
|
||||
prdFeedingH = new PrdFeedingH()
|
||||
{
|
||||
@@ -391,12 +382,12 @@ namespace Tnb.ProductionMgr
|
||||
create_time = DateTime.Now,
|
||||
org_id = _userManager.GetUserInfo().Result.organizeId
|
||||
};
|
||||
|
||||
|
||||
if (input.details != null && input.details.Count > 0)
|
||||
{
|
||||
foreach (var item in input.details)
|
||||
{
|
||||
if(!inputMaterials.Contains(item["material_id"]))
|
||||
if (!inputMaterials.Contains(item["material_id"]))
|
||||
throw new Exception("该物料不是生产bom投入物料,不能签收");
|
||||
|
||||
var detail = await db.Queryable<PrdMaterialReceiptD>()
|
||||
@@ -417,10 +408,11 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
if (detail != null)
|
||||
{
|
||||
if(detail.feeding_num + num > detail.num)
|
||||
if (detail.feeding_num + num > detail.num)
|
||||
{
|
||||
throw new Exception("投料数量不能大于签收数量");
|
||||
}else if (detail.feeding_num + num == detail.num)
|
||||
}
|
||||
else if (detail.feeding_num + num == detail.num)
|
||||
{
|
||||
await db.Updateable<PrdMaterialReceiptD>()
|
||||
.SetColumns(x => x.feeding_num == x.feeding_num + num)
|
||||
@@ -447,14 +439,14 @@ namespace Tnb.ProductionMgr
|
||||
throw new Exception("没有签收物料");
|
||||
}
|
||||
|
||||
|
||||
|
||||
await db.Insertable<PrdFeedingH>(prdFeedingH).ExecuteCommandAsync();
|
||||
await db.Insertable<PrdFeedingD>(list).ExecuteCommandAsync();
|
||||
|
||||
});
|
||||
|
||||
|
||||
if(!result.IsSuccess) throw Oops.Bah(result.ErrorMessage);
|
||||
|
||||
if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage);
|
||||
return result.IsSuccess ? "签收成功" : result.ErrorMessage;
|
||||
}
|
||||
|
||||
@@ -463,11 +455,11 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
var result = await db.Queryable<PrdMoTask>()
|
||||
.Where(a => a.schedule_type == 2 && a.parent_id!=null)
|
||||
.Where(a => a.schedule_type == 2 && a.parent_id != null)
|
||||
.Select(a => new FeedingRecordTreeOutput()
|
||||
{
|
||||
mo_task_code = a.mo_task_code,
|
||||
children = SqlFunc.Subqueryable<PrdFeedingH>().Where(b=>a.id==b.mo_task_id).ToList(b=>new FeedingRecordChildren()
|
||||
children = SqlFunc.Subqueryable<PrdFeedingH>().Where(b => a.id == b.mo_task_id).ToList(b => new FeedingRecordChildren()
|
||||
{
|
||||
id = b.id,
|
||||
code = b.code,
|
||||
@@ -491,7 +483,7 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
item.children = db.Queryable<PrdFeedingD>()
|
||||
.LeftJoin<BasMaterial>((c, d) => c.material_id == d.id)
|
||||
.Where((c, d) => item.id == c.feeding_id).Select((c,d) => new FeedingRecordMaterialChildren()
|
||||
.Where((c, d) => item.id == c.feeding_id).Select((c, d) => new FeedingRecordMaterialChildren()
|
||||
{
|
||||
material_code = d.code,
|
||||
material_name = d.name,
|
||||
|
||||
Reference in New Issue
Block a user