pc端生产领料 齐套出库 物料签收 生产入库 的工位由用户选择的工位带出来导致的逻辑变更
This commit is contained in:
@@ -235,7 +235,7 @@ namespace Tnb.ProductionMgr
|
||||
throw new Exception("该物料不是生产bom投入物料,不能签收");
|
||||
|
||||
var detail = await db.Queryable<PrdMaterialReceiptD>()
|
||||
.Where(x => x.carry_id == carry.id && x.is_all_feeding == 0).FirstAsync();
|
||||
.Where(x => x.member_carry_code == input.carry_code && x.is_all_feeding == 0).FirstAsync();
|
||||
decimal num = Convert.ToDecimal(item["num"]);
|
||||
list.Add(new PrdFeedingD
|
||||
{
|
||||
@@ -283,8 +283,8 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
|
||||
|
||||
// await db.Insertable<PrdFeedingH>(prdFeedingH).ExecuteCommandAsync();
|
||||
// await db.Insertable<PrdFeedingD>(list).ExecuteCommandAsync();
|
||||
await db.Insertable<PrdFeedingH>(prdFeedingH).ExecuteCommandAsync();
|
||||
await db.Insertable<PrdFeedingD>(list).ExecuteCommandAsync();
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -27,6 +27,10 @@ using Tnb.EquipMgr.Entities;
|
||||
using Tnb.ProductionMgr.Entities.Dto.PrdManage;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Interfaces.Permission;
|
||||
using SQLitePCL;
|
||||
using SqlSugar.Extensions;
|
||||
|
||||
namespace Tnb.ProductionMgr
|
||||
{
|
||||
@@ -40,15 +44,18 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
private readonly ISqlSugarRepository<PrdInstockH> _repository;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IOrganizeService _organizeService;
|
||||
private const string ModuleId = "25572529329173";
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
|
||||
public PrdInstockService(
|
||||
ISqlSugarRepository<PrdInstockH> repository,
|
||||
IOrganizeService organizeService,
|
||||
IUserManager userManager
|
||||
)
|
||||
{
|
||||
_repository = repository;
|
||||
_organizeService = organizeService;
|
||||
_userManager = userManager;
|
||||
OverideFuncs.GetListAsync = GetList;
|
||||
}
|
||||
@@ -100,8 +107,18 @@ namespace Tnb.ProductionMgr
|
||||
PrdInstockH prdInstockH = null;
|
||||
List<PrdInstockD> prdInstockDs = new List<PrdInstockD>() { };
|
||||
DbResult<bool> result2 = new DbResult<bool>();
|
||||
|
||||
if (string.IsNullOrEmpty(input.station_id))
|
||||
{
|
||||
throw Oops.Bah("请先选择工位");
|
||||
}
|
||||
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(input.station_id, DictConst.RegionCategoryWorklineCode);
|
||||
OrganizeEntity workshop = await _organizeService.GetAnyParentByWorkstationId(input.station_id, DictConst.RegionCategoryWorkshopCode);
|
||||
|
||||
|
||||
prdInstockH = new PrdInstockH()
|
||||
{
|
||||
bill_type = input.bill_type,
|
||||
@@ -111,8 +128,8 @@ namespace Tnb.ProductionMgr
|
||||
carry_code = input.carry_code,
|
||||
is_check = input.is_check,
|
||||
station_id = input.station_id,
|
||||
workline_id = input.workline_id,
|
||||
workshop_id = input.workshop_id,
|
||||
workline_id = workline?.Id ?? "",
|
||||
workshop_id = workshop?.Id ?? "",
|
||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||
warehouse_id = location?.wh_id,
|
||||
status = 0,
|
||||
@@ -127,8 +144,10 @@ namespace Tnb.ProductionMgr
|
||||
material_id = item.ContainsKey("material_id") ? item["material_id"] : "",
|
||||
material_code = item.ContainsKey("material_code") ? item["material_code"] : "",
|
||||
unit_id = item.ContainsKey("unit_id") ? item["unit_id"] : "",
|
||||
code_batch = item.ContainsKey("batch") ? item["batch"] : "",
|
||||
barcode = item.ContainsKey("batch") ? item["batch"]+"0001" : "",
|
||||
// code_batch = item.ContainsKey("batch") ? item["batch"] : "",
|
||||
// barcode = item.ContainsKey("batch") ? item["batch"]+"0001" : "",
|
||||
barcode = item.ContainsKey("barcode") ? item["barcode"] : "",
|
||||
code_batch = item.ContainsKey("barcode") ? item["barcode"]+"0001" : "",
|
||||
quantity = Convert.ToInt32(item.ContainsKey("quantity") ? item["quantity"] : "0"),
|
||||
});
|
||||
}
|
||||
@@ -166,7 +185,7 @@ namespace Tnb.ProductionMgr
|
||||
material_id = item.ContainsKey("material_id") ? item["material_id"] : "",
|
||||
material_code = item.ContainsKey("material_code") ? item["material_code"] : "",
|
||||
unit_id = item.ContainsKey("unit_id") ? item["unit_id"] : "",
|
||||
code_batch = item.ContainsKey("batch") ? item["batch"] : "",
|
||||
code_batch = item.ContainsKey("barcode") ? item["barcode"]+"0001" : "",
|
||||
pr_qty = Convert.ToInt32(item.ContainsKey("quantity") ? item["quantity"] : "0"),
|
||||
});
|
||||
|
||||
@@ -175,8 +194,10 @@ namespace Tnb.ProductionMgr
|
||||
material_id = item.ContainsKey("material_id") ? item["material_id"] : "",
|
||||
material_code = item.ContainsKey("material_code") ? item["material_code"] : "",
|
||||
unit_id = item.ContainsKey("unit_id") ? item["unit_id"] : "",
|
||||
code_batch = item.ContainsKey("batch") ? item["batch"] : "",
|
||||
barcode = item.ContainsKey("batch") ? item["batch"]+"0001" : "",
|
||||
// code_batch = item.ContainsKey("batch") ? item["batch"] : "",
|
||||
// barcode = item.ContainsKey("batch") ? item["batch"]+"0001" : "",
|
||||
barcode = item.ContainsKey("barcode") ? item["barcode"] : "",
|
||||
code_batch = item.ContainsKey("barcode") ? item["barcode"]+"0001" : "",
|
||||
codeqty = Convert.ToInt32(item.ContainsKey("quantity") ? item["quantity"] : "0"),
|
||||
});
|
||||
}
|
||||
@@ -188,7 +209,7 @@ namespace Tnb.ProductionMgr
|
||||
var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK,JsonConvert.SerializeObject(mesCreateInstockInput),header);
|
||||
Log.Information(sendResult);
|
||||
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
|
||||
if (authResponse.code != 200)
|
||||
if (authResponse.code != 200 || !authResponse.data.ObjToBool())
|
||||
{
|
||||
throw Oops.Bah(authResponse.msg);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ 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.Permission;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
@@ -37,15 +39,21 @@ namespace Tnb.ProductionMgr
|
||||
private readonly IRunService _runService;
|
||||
private readonly IVisualDevService _visualDevService;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IOrganizeService _organizeService;
|
||||
private readonly IBillRullService _billRullService;
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
|
||||
public PrdKittingOutService(ISqlSugarRepository<PrdKittingOutH> repository, IRunService runService, IBillRullService billRullService,IUserManager userManager,IVisualDevService visualDevService)
|
||||
public PrdKittingOutService(ISqlSugarRepository<PrdKittingOutH> repository, IRunService runService,
|
||||
IBillRullService billRullService,
|
||||
IUserManager userManager,
|
||||
IOrganizeService organizeService,
|
||||
IVisualDevService visualDevService)
|
||||
{
|
||||
_runService = runService;
|
||||
_visualDevService = visualDevService;
|
||||
_repository = repository;
|
||||
_userManager = userManager;
|
||||
_organizeService = organizeService;
|
||||
_billRullService = billRullService;
|
||||
// OverideFuncs.CreateAsync = Create;
|
||||
}
|
||||
@@ -161,7 +169,9 @@ namespace Tnb.ProductionMgr
|
||||
try
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
|
||||
OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(kittingOutInput.workstation_id, DictConst.RegionCategoryWorklineCode);
|
||||
kittingOutInput.workline_id = workline?.Id ?? "";
|
||||
|
||||
List<MESKittingOutStkInput> input = new List<MESKittingOutStkInput>();
|
||||
input.Add(new MESKittingOutStkInput()
|
||||
{
|
||||
|
||||
@@ -8,6 +8,8 @@ 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.Permission;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
@@ -38,17 +40,20 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
private readonly ISqlSugarRepository<PrdMaterialReceiptH> _repository;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IOrganizeService _organizeService;
|
||||
private readonly IBillRullService _billRullService;
|
||||
|
||||
|
||||
public PrdMaterialReceiptService(
|
||||
ISqlSugarRepository<PrdMaterialReceiptH> repository,
|
||||
IBillRullService billRullService,
|
||||
IOrganizeService organizeService,
|
||||
IUserManager userManager
|
||||
)
|
||||
{
|
||||
_repository = repository;
|
||||
_userManager = userManager;
|
||||
_organizeService = organizeService;
|
||||
_billRullService = billRullService;
|
||||
}
|
||||
|
||||
@@ -148,6 +153,9 @@ namespace Tnb.ProductionMgr
|
||||
.ToListAsync();
|
||||
|
||||
string code = await _billRullService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.MATERIAL_RECEIPT_CODE);
|
||||
OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(input.station_id, DictConst.RegionCategoryWorklineCode);
|
||||
OrganizeEntity workshop = await _organizeService.GetAnyParentByWorkstationId(input.station_id, DictConst.RegionCategoryWorkshopCode);
|
||||
|
||||
prdMaterialReceiptH = new PrdMaterialReceiptH()
|
||||
{
|
||||
code = code,
|
||||
@@ -155,9 +163,9 @@ namespace Tnb.ProductionMgr
|
||||
mo_task_id = input.mo_task_id,
|
||||
process_id = input.process_id,
|
||||
equip_id = input.equip_id,
|
||||
workshop_id = input.workshop_id,
|
||||
workshop_id = workshop?.Id ?? "",
|
||||
carry_id = input.carry_id,
|
||||
workline_id = input.workline_id,
|
||||
workline_id = workline?.Id ?? "",
|
||||
carry_code = input.carry_code,
|
||||
remark = input.remark,
|
||||
mbom_process_id = input.mbom_process_id,
|
||||
@@ -186,9 +194,9 @@ namespace Tnb.ProductionMgr
|
||||
member_carry_id = item["member_carry_id"]?.ToString(),
|
||||
member_carry_code = item["member_carry_code"]?.ToString(),
|
||||
feeding_num = 0,
|
||||
supplier_id = item["supplier_id"]?.ToString(),
|
||||
instock_time = (DateTime)item["instock_time"],
|
||||
check_conclusion = item["check_conclusion"]?.ToString()
|
||||
supplier_id = item.ContainsKey("supplier_id") ? item["supplier_id"]?.ToString() : "",
|
||||
instock_time = item.ContainsKey("instock_time") ? (DateTime)item["instock_time"] : DateTime.Now,
|
||||
check_conclusion = item.ContainsKey("check_conclusion") ? item["check_conclusion"]?.ToString() : "",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -888,8 +888,8 @@ namespace Tnb.ProductionMgr
|
||||
.Where((a, b) => a.barcode == barcode).SumAsync((a, b) => b.num);
|
||||
output.list[0].material_name = basMaterial.name;
|
||||
output.list[0].material_standard = basMaterial.material_standard;
|
||||
output.list[0].supplier_name = basSupplier.supplier_name;
|
||||
output.list[0].unit_name = unit.FullName;
|
||||
output.list[0].supplier_name = basSupplier?.supplier_name ?? "";
|
||||
output.list[0].unit_name = unit?.FullName ?? "";
|
||||
|
||||
return output.list[0];
|
||||
}
|
||||
@@ -913,11 +913,11 @@ namespace Tnb.ProductionMgr
|
||||
.LeftJoin<PrdFeedingH>((a, b, c) => b.feeding_id == c.id)
|
||||
.Where(a => a.barcode == barcode)
|
||||
.Select((a, b, c) => c.mo_task_id).ToListAsync();
|
||||
|
||||
return await _db.Queryable<PrdMoTask>()
|
||||
|
||||
var result = await _db.Queryable<PrdMoTask>()
|
||||
.LeftJoin<PrdMo>((a, b) => a.mo_id == b.id)
|
||||
.LeftJoin<BasMaterial>((a,b,c)=>a.material_id==c.id)
|
||||
.Where((a,b,c)=>ids.Contains(a.id))
|
||||
.LeftJoin<BasMaterial>((a, b, c) => a.material_id == c.id)
|
||||
.Where((a, b, c) => ids.Contains(a.id))
|
||||
.Select((a, b, c) => new PrdMoReverseFromFeedingOutput
|
||||
{
|
||||
mo_task_id = a.id,
|
||||
@@ -927,22 +927,28 @@ namespace Tnb.ProductionMgr
|
||||
material_name = c.name,
|
||||
material_standard = c.material_standard,
|
||||
children = SqlFunc.Subqueryable<PrdFeedingD>()
|
||||
.LeftJoin<PrdFeedingH>((x,y)=>x.feeding_id==y.id)
|
||||
.LeftJoin<UserEntity>((x,y,z)=>y.create_id==z.Id)
|
||||
.LeftJoin<OrganizeEntity>((x,y,z,org)=>y.station_id==org.Id)
|
||||
.LeftJoin<BasProcess>((x,y,z,org,process)=>y.process_id==process.id)
|
||||
.LeftJoin<PrdMaterialReceiptD>((x,y,z,org,process,mp)=>x.material_receipt_detail_id==mp.id)
|
||||
.Where((x,y,z)=>y.mo_task_id==a.id).ToList((x,y,z,org,process,mp)=>new PrdMoReverseFromFeedingDetailOutput
|
||||
{
|
||||
feeding_detail_id = x.id,
|
||||
feeding_time = y.create_time==null ? "" : y.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
num = x.num,
|
||||
check_conclusion = mp.check_conclusion,
|
||||
feeding_name = z.RealName,
|
||||
station_name = org.FullName,
|
||||
process_name = process.process_name
|
||||
}),
|
||||
.LeftJoin<PrdFeedingH>((x, y) => x.feeding_id == y.id)
|
||||
.LeftJoin<UserEntity>((x, y, z) => y.create_id == z.Id)
|
||||
.LeftJoin<OrganizeEntity>((x, y, z, org) => y.station_id == org.Id)
|
||||
.LeftJoin<BasProcess>((x, y, z, org, process) => y.process_id == process.id)
|
||||
.LeftJoin<PrdMaterialReceiptD>((x, y, z, org, process, mp) =>
|
||||
x.material_receipt_detail_id == mp.id)
|
||||
.Where((x, y, z) => y.mo_task_id == a.id).ToList((x, y, z, org, process, mp) =>
|
||||
new PrdMoReverseFromFeedingDetailOutput
|
||||
{
|
||||
feeding_detail_id = x.id,
|
||||
feeding_time = y.create_time == null
|
||||
? ""
|
||||
: y.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
num = x.num,
|
||||
check_conclusion = mp.check_conclusion,
|
||||
feeding_name = z.RealName,
|
||||
station_name = org.FullName,
|
||||
process_name = process.process_name
|
||||
}),
|
||||
}).ToListAsync();
|
||||
return result;
|
||||
// return PageResult<PrdMoReverseFromFeedingOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -65,7 +65,8 @@ namespace Tnb.ProductionMgr
|
||||
BasLocation location = await db.Queryable<BasLocation>().SingleAsync(x => x.id == locationId);
|
||||
|
||||
input.outstock.bill_type = visualDevModelDataCrInput.data.ContainsKey("bill_type") ? visualDevModelDataCrInput.data["bill_type"].ToString() : "";
|
||||
input.outstock.bill_date = visualDevModelDataCrInput.data.ContainsKey("bill_date") ? Convert.ToDateTime(visualDevModelDataCrInput.data["bill_date"].ToString()) : DateTime.Now;
|
||||
// input.outstock.bill_date = visualDevModelDataCrInput.data.ContainsKey("bill_date") ? Convert.ToDateTime(visualDevModelDataCrInput.data["bill_date"].ToString()) : DateTime.Now;
|
||||
input.outstock.bill_date = DateTime.Now;
|
||||
input.outstock.org_id = _userManager.GetUserInfo().Result.organizeId;
|
||||
input.outstock.warehouse_id = visualDevModelDataCrInput.data.ContainsKey("warehouse_id") ? visualDevModelDataCrInput.data["warehouse_id"].ToString() : "";
|
||||
input.outstock.create_id = _userManager.UserId;
|
||||
|
||||
Reference in New Issue
Block a user