Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -94,6 +94,10 @@ namespace Tnb.BasicData
|
|||||||
/// /模具保养
|
/// /模具保养
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string MOLDMAINTENANCE_CODE = "MoldMaintenance";
|
public const string MOLDMAINTENANCE_CODE = "MoldMaintenance";
|
||||||
|
/// <summary>
|
||||||
|
/// 质量暂控处理单
|
||||||
|
/// </summary>
|
||||||
|
public const string QCCONTROLTEMP_CODE = "QcControlTempH";
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using JNPF.DependencyInjection;
|
using JNPF.DependencyInjection;
|
||||||
using JNPF.DynamicApiController;
|
using JNPF.DynamicApiController;
|
||||||
|
using JNPF.FriendlyException;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.BasicData.Entities;
|
using Tnb.BasicData.Entities;
|
||||||
@@ -48,5 +49,37 @@ namespace Tnb.BasicData
|
|||||||
List<BasLocation> items = await _db.Queryable<BasLocation>().Where(it => locIds.Contains(it.id)).ToListAsync();
|
List<BasLocation> items = await _db.Queryable<BasLocation>().Where(it => locIds.Contains(it.id)).ToListAsync();
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据库位编码,清空库位
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dic"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<string> ModifyClearLocation(Dictionary<string,string> dic)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var location_code = dic["code"].ToString();
|
||||||
|
if (string.IsNullOrEmpty(location_code))
|
||||||
|
throw Oops.Bah("库位编码不能为空");
|
||||||
|
|
||||||
|
var location = await _db.Queryable<BasLocation>().Where(r => r.location_code == location_code).FirstAsync();
|
||||||
|
if (location == null)
|
||||||
|
throw Oops.Bah($"库位编号{location_code}不存在");
|
||||||
|
await _db.Ado.BeginTranAsync();
|
||||||
|
//把状态改为空闲
|
||||||
|
await _db.Updateable<BasLocation>().SetColumns(r => r.is_use == "0").Where(r=>r.id==location.id).ExecuteCommandAsync();
|
||||||
|
await _db.Ado.CommitTranAsync();
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
await _db.Ado.RollbackTranAsync();
|
||||||
|
throw Oops.Bah(e.Message);
|
||||||
|
}
|
||||||
|
return "成功";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ namespace Tnb.EquipMgr
|
|||||||
eqpRepairApply.org_id = (string)input.data["org_id"];
|
eqpRepairApply.org_id = (string)input.data["org_id"];
|
||||||
eqpRepairApply.remark = input.data.ContainsKey("remark") ? (string)input.data["remark"] : "";
|
eqpRepairApply.remark = input.data.ContainsKey("remark") ? (string)input.data["remark"] : "";
|
||||||
eqpRepairApply.description = input.data.ContainsKey("description") ? (string)input.data["description"] : "";
|
eqpRepairApply.description = input.data.ContainsKey("description") ? (string)input.data["description"] : "";
|
||||||
eqpRepairApply.status = RepairApplyStatus.TOBEEXECUTED;
|
eqpRepairApply.status = RepairApplyStatus.TOBERECEIVED;
|
||||||
|
|
||||||
_ = await _repository.InsertAsync(eqpRepairApply);
|
_ = await _repository.InsertAsync(eqpRepairApply);
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ namespace Tnb.EquipMgr
|
|||||||
{
|
{
|
||||||
throw Oops.Bah("状态错误");
|
throw Oops.Bah("状态错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
@@ -194,7 +194,7 @@ namespace Tnb.EquipMgr
|
|||||||
|
|
||||||
string id = dic["id"];
|
string id = dic["id"];
|
||||||
EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x => x.id == id);
|
EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x => x.id == id);
|
||||||
if (eqpRepairApply.status == RepairApplyStatus.TOBEEXECUTED)
|
if (eqpRepairApply.status == RepairApplyStatus.TOBERECEIVED)
|
||||||
{
|
{
|
||||||
if (await _repository.AsSugarClient().Queryable<UserRelationEntity>().AnyAsync(x => x.UserId == _userManager.UserId && x.ObjectId == "26586914497557"))
|
if (await _repository.AsSugarClient().Queryable<UserRelationEntity>().AnyAsync(x => x.UserId == _userManager.UserId && x.ObjectId == "26586914497557"))
|
||||||
{
|
{
|
||||||
@@ -364,7 +364,7 @@ namespace Tnb.EquipMgr
|
|||||||
switch (input.status)
|
switch (input.status)
|
||||||
{
|
{
|
||||||
case "1":
|
case "1":
|
||||||
statusList.Add(RepairApplyStatus.TOBEEXECUTED);
|
statusList.Add(RepairApplyStatus.TOBERECEIVED);
|
||||||
statusList.Add(RepairApplyStatus.REFUSE);
|
statusList.Add(RepairApplyStatus.REFUSE);
|
||||||
break;
|
break;
|
||||||
case "2":
|
case "2":
|
||||||
@@ -374,6 +374,7 @@ namespace Tnb.EquipMgr
|
|||||||
statusList.Add(RepairApplyStatus.APPROVEPASS);
|
statusList.Add(RepairApplyStatus.APPROVEPASS);
|
||||||
statusList.Add(RepairApplyStatus.APPROVENOTPASS);
|
statusList.Add(RepairApplyStatus.APPROVENOTPASS);
|
||||||
statusList.Add(RepairApplyStatus.TOBEOUTAPPLY);
|
statusList.Add(RepairApplyStatus.TOBEOUTAPPLY);
|
||||||
|
statusList.Add(RepairApplyStatus.REFUSE);
|
||||||
break;
|
break;
|
||||||
case "3":
|
case "3":
|
||||||
statusList.Add(RepairApplyStatus.COMPLETED);
|
statusList.Add(RepairApplyStatus.COMPLETED);
|
||||||
@@ -436,7 +437,7 @@ namespace Tnb.EquipMgr
|
|||||||
EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x => x.id == input.id);
|
EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x => x.id == input.id);
|
||||||
if (eqpRepairApply.status == RepairApplyStatus.REPEATCHECKING)
|
if (eqpRepairApply.status == RepairApplyStatus.REPEATCHECKING)
|
||||||
{
|
{
|
||||||
string status = input.repeat_result=="1" ? RepairApplyStatus.COMPLETED : RepairApplyStatus.TOBEEXECUTED;
|
string status = input.repeat_result=="1" ? RepairApplyStatus.COMPLETED : RepairApplyStatus.TOBERECEIVED;
|
||||||
await _repository.AsSugarClient().Updateable<EqpRepairApply>()
|
await _repository.AsSugarClient().Updateable<EqpRepairApply>()
|
||||||
.SetColumns(x => x.repeat_result == input.repeat_result)
|
.SetColumns(x => x.repeat_result == input.repeat_result)
|
||||||
.SetColumns(x => x.repeat_descrip == input.repeat_descrip)
|
.SetColumns(x => x.repeat_descrip == input.repeat_descrip)
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ namespace Tnb.ProductionMgr.Entities.Dto
|
|||||||
public string workstation_id { get; set; }
|
public string workstation_id { get; set; }
|
||||||
public string workline_id { get; set; }
|
public string workline_id { get; set; }
|
||||||
public string act_start_date { get; set; }
|
public string act_start_date { get; set; }
|
||||||
|
|
||||||
|
public string eqp_code { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建时间(入库时间)
|
/// 创建时间(入库时间)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using JNPF.Common.Contracts;
|
||||||
|
using JNPF.Common.Security;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace Tnb.ProductionMgr.Entities.Entity
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 生产报废记录子表
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("prd_mo_task_defect_record_d")]
|
||||||
|
public partial class PrdMoTaskDefectRecordD:BaseEntity<string>
|
||||||
|
{
|
||||||
|
public PrdMoTaskDefectRecordD()
|
||||||
|
{
|
||||||
|
id=SnowflakeIdHelper.NextId();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 主表id
|
||||||
|
/// </summary>
|
||||||
|
public string bill_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 来源单据id
|
||||||
|
/// </summary>
|
||||||
|
public string source_id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 料箱id
|
||||||
|
/// </summary>
|
||||||
|
public string carry_id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 料箱code
|
||||||
|
/// </summary>
|
||||||
|
public string carry_code { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 报废数量
|
||||||
|
/// </summary>
|
||||||
|
public string scrap_qty { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 提报人
|
||||||
|
/// </summary>
|
||||||
|
public string submiter_id { get;set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 处理人
|
||||||
|
/// </summary>
|
||||||
|
public string maker_id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 处理时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? make_time { get;set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -82,13 +82,14 @@ namespace Tnb.ProductionMgr
|
|||||||
.LeftJoin<PrdMo>((a, b, c, d) => a.mo_id == d.id)
|
.LeftJoin<PrdMo>((a, b, c, d) => a.mo_id == d.id)
|
||||||
.LeftJoin<DictionaryDataEntity>((a, b, c, d, e) => e.DictionaryTypeId == DictConst.PrdTaskStatusTypeId && a.mo_task_status == e.EnCode)
|
.LeftJoin<DictionaryDataEntity>((a, b, c, d, e) => e.DictionaryTypeId == DictConst.PrdTaskStatusTypeId && a.mo_task_status == e.EnCode)
|
||||||
.LeftJoin<OrganizeEntity>((a, b, c, d, e, f) => a.workline_id == f.Id)
|
.LeftJoin<OrganizeEntity>((a, b, c, d, e, f) => a.workline_id == f.Id)
|
||||||
|
.LeftJoin<EqpEquipment>((a,b,c,d,e,f,g)=>a.eqp_id==g.id)
|
||||||
.WhereIF(!string.IsNullOrEmpty(mo_task_code), a => a.mo_task_code.Contains(mo_task_code))
|
.WhereIF(!string.IsNullOrEmpty(mo_task_code), a => a.mo_task_code.Contains(mo_task_code))
|
||||||
.WhereIF(!string.IsNullOrEmpty(mo_code), (a, b, c, d, e) => d.mo_code.Contains(mo_code))
|
.WhereIF(!string.IsNullOrEmpty(mo_code), (a, b, c, d, e) => d.mo_code.Contains(mo_code))
|
||||||
.WhereIF(!string.IsNullOrEmpty(mo_type),(a,b,c,d,e)=>d.mo_type==mo_type)
|
.WhereIF(!string.IsNullOrEmpty(mo_type),(a,b,c,d,e)=>d.mo_type==mo_type)
|
||||||
.WhereIF(!string.IsNullOrEmpty(name),(a,b,c,d,e)=>b.name.Contains(name))
|
.WhereIF(!string.IsNullOrEmpty(name),(a,b,c,d,e)=>b.name.Contains(name))
|
||||||
.Where(a => a.act_start_date != null)
|
.Where(a => a.act_start_date != null)
|
||||||
.OrderBy($"{input.sidx} {input.sort}")
|
.OrderBy($"{input.sidx} {input.sort}")
|
||||||
.Select((a, b, c, d, e, f) => new PrdInstockRecordUpListOutPut()
|
.Select((a, b, c, d, e, f,g) => new PrdInstockRecordUpListOutPut()
|
||||||
{
|
{
|
||||||
id = a.id,
|
id = a.id,
|
||||||
mo_task_code = a.mo_task_code,
|
mo_task_code = a.mo_task_code,
|
||||||
@@ -97,18 +98,21 @@ namespace Tnb.ProductionMgr
|
|||||||
workstation_id = c.FullName,
|
workstation_id = c.FullName,
|
||||||
mo_task_status = e.FullName,
|
mo_task_status = e.FullName,
|
||||||
workline_id = f.FullName,
|
workline_id = f.FullName,
|
||||||
|
eqp_code=g.code,
|
||||||
act_start_date = a.act_start_date == null ? "" : a.act_start_date.Value.ToString(DbTimeFormat.SS),
|
act_start_date = a.act_start_date == null ? "" : a.act_start_date.Value.ToString(DbTimeFormat.SS),
|
||||||
create_time = a.create_time.HasValue ? a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
|
create_time = a.create_time.HasValue ? a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
|
||||||
tablefield102 = SqlFunc.Subqueryable<PrdInstockH>()
|
tablefield102 = SqlFunc.Subqueryable<PrdInstockH>()
|
||||||
.LeftJoin<UserEntity>((x, y) => x.create_id == y.Id)
|
.LeftJoin<UserEntity>((x, y) => x.create_id == y.Id)
|
||||||
.LeftJoin<DictionaryDataEntity>((x, y, z) => x.bill_type == z.Id)
|
.LeftJoin<DictionaryDataEntity>((x, y, z) => x.bill_type == z.Id)
|
||||||
.Where(x => x.mo_task_id == a.id).ToList((x, y, z) => new PrdInstockRecordUpListChildOutPut()
|
.LeftJoin<WmsCarryH>((x,y,z,j)=>x.carry_code==j.id)
|
||||||
|
.LeftJoin<BasLocation>((x,y,z,j,k)=>x.location_code==k.id)
|
||||||
|
.Where(x => x.mo_task_id == a.id).ToList((x, y, z,j,k) => new PrdInstockRecordUpListChildOutPut()
|
||||||
{
|
{
|
||||||
id = x.id,
|
id = x.id,
|
||||||
code = x.code,
|
code = x.code,
|
||||||
bill_type = z.FullName,
|
bill_type = z.FullName,
|
||||||
carry_code = x.carry_code,
|
carry_code = j.carry_code,
|
||||||
location_code = x.location_code,
|
location_code = k.location_code,
|
||||||
create_id = y.RealName,
|
create_id = y.RealName,
|
||||||
bill_date = x.bill_date == null ? "" : x.bill_date.ToString(DbTimeFormat.SS),
|
bill_date = x.bill_date == null ? "" : x.bill_date.ToString(DbTimeFormat.SS),
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -2758,6 +2758,7 @@ namespace Tnb.ProductionMgr
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
await db.Ado.RollbackTranAsync();
|
||||||
Log.Error("提报入库任务下发失败:"+e.Message, e);
|
Log.Error("提报入库任务下发失败:"+e.Message, e);
|
||||||
throw new Exception("提报入库任务下发失败:"+e.Message);
|
throw new Exception("提报入库任务下发失败:"+e.Message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -220,7 +220,7 @@
|
|||||||
|
|
||||||
|
|
||||||
public List<List<Checktype>>? checktypes { get; set; }
|
public List<List<Checktype>>? checktypes { get; set; }
|
||||||
public CheckCarry carryInfo { get; set; }
|
public List<CheckCarry> carryInfo { get; set; }
|
||||||
}
|
}
|
||||||
public class Checktype
|
public class Checktype
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -281,10 +281,23 @@ namespace Tnb.QcMgr.Entities.Dto
|
|||||||
/// 单位
|
/// 单位
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string unit_code { get; set; }
|
public string unit_code { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class QcTempControlPickQualifiedQtyOutput
|
||||||
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 暂控数量
|
/// 暂控数量
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public decimal? control_qty { get; set; }
|
public string temp_control_qty { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 合格数量
|
||||||
|
/// </summary>
|
||||||
|
public string qualified_qty { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 不合格数量
|
||||||
|
/// </summary>
|
||||||
|
public string unQualified_qty { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
103
QcMgr/Tnb.QcMgr.Entities/Entity/QcTempControlD.cs
Normal file
103
QcMgr/Tnb.QcMgr.Entities/Entity/QcTempControlD.cs
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using JNPF.Common.Contracts;
|
||||||
|
using JNPF.Common.Security;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace Tnb.QcMgr.Entities.Entity
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 质量暂控处理子表
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("qc_temp_control_d")]
|
||||||
|
public partial class QcTempControlD:BaseEntity<string>
|
||||||
|
{
|
||||||
|
public QcTempControlD() {
|
||||||
|
id=SnowflakeIdHelper.NextId();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 暂控表单id
|
||||||
|
/// </summary>
|
||||||
|
public string bill_id { get;set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 载具id
|
||||||
|
/// </summary>
|
||||||
|
public string carry_id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 载具编号
|
||||||
|
/// </summary>
|
||||||
|
public string carry_code { get;set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 仓库id
|
||||||
|
/// </summary>
|
||||||
|
public string warehouse_id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 仓库编号
|
||||||
|
/// </summary>
|
||||||
|
public string warehouse_code { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 库位id
|
||||||
|
/// </summary>
|
||||||
|
public string location_id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 库位编号
|
||||||
|
/// </summary>
|
||||||
|
public string location_code { get;set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 数量
|
||||||
|
/// </summary>
|
||||||
|
public string qty { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 提报人
|
||||||
|
/// </summary>
|
||||||
|
public string submiter { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 处理人id
|
||||||
|
/// </summary>
|
||||||
|
public string maker_id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建人id
|
||||||
|
/// </summary>
|
||||||
|
public string create_id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? create_time { get; set;}
|
||||||
|
/// <summary>
|
||||||
|
/// 修改人id
|
||||||
|
/// </summary>
|
||||||
|
public string modify_id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 修改时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? modify_time { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 检验状态(暂控,让步接收)
|
||||||
|
/// </summary>
|
||||||
|
public string check_status { get;set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 呼叫状态
|
||||||
|
/// </summary>
|
||||||
|
public string call_status { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 不合格数量
|
||||||
|
/// </summary>
|
||||||
|
public string unqualified_qty { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 合格数量
|
||||||
|
/// </summary>
|
||||||
|
public string qualified_qty { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 挑选状态(未挑选,已挑选)
|
||||||
|
/// </summary>
|
||||||
|
public string pick_status { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 暂控料入库预任务id
|
||||||
|
/// </summary>
|
||||||
|
public string pre_task_id { get;set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
97
QcMgr/Tnb.QcMgr.Entities/Entity/QcTempControlH.cs
Normal file
97
QcMgr/Tnb.QcMgr.Entities/Entity/QcTempControlH.cs
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using JNPF.Common.Contracts;
|
||||||
|
using JNPF.Common.Security;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace Tnb.QcMgr.Entities.Entity
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 质量暂控处理单主表
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("qc_temp_control_h")]
|
||||||
|
public partial class QcTempControlH:BaseEntity<string>
|
||||||
|
{
|
||||||
|
public QcTempControlH() {
|
||||||
|
id = SnowflakeIdHelper.NextId();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 单据编号
|
||||||
|
/// </summary>
|
||||||
|
public string bill_code { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 来源单据编号
|
||||||
|
/// </summary>
|
||||||
|
public string source_code { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 生产任务单号
|
||||||
|
/// </summary>
|
||||||
|
public string pro_task_code { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 出库仓库id
|
||||||
|
/// </summary>
|
||||||
|
public string out_warehouse_id { get; set;}
|
||||||
|
/// <summary>
|
||||||
|
/// 入库仓库id
|
||||||
|
/// </summary>
|
||||||
|
public string in_warehouse_id { get; set;}
|
||||||
|
/// <summary>
|
||||||
|
/// 物料id
|
||||||
|
/// </summary>
|
||||||
|
public string material_id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 物料名称
|
||||||
|
/// </summary>
|
||||||
|
public string material_code { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 暂控料箱数
|
||||||
|
/// </summary>
|
||||||
|
public string control_lx_qty { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 暂控数量
|
||||||
|
/// </summary>
|
||||||
|
public string control_qty { get;set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 结论(暂控,让步接收)
|
||||||
|
/// </summary>
|
||||||
|
public string result { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 记录人id
|
||||||
|
/// </summary>
|
||||||
|
public string loger_id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 确认人id
|
||||||
|
/// </summary>
|
||||||
|
public string confirmer_id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 状态
|
||||||
|
/// </summary>
|
||||||
|
public string status { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 已呼叫箱数
|
||||||
|
/// </summary>
|
||||||
|
public string called_box_qty { get;set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 已呼叫数量
|
||||||
|
/// </summary>
|
||||||
|
public string called_qty { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 剩余呼叫箱数
|
||||||
|
/// </summary>
|
||||||
|
public string leave_call_box_qty { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 剩余呼叫数量
|
||||||
|
/// </summary>
|
||||||
|
public string leave_call_qty { get; set; }
|
||||||
|
|
||||||
|
public string create_id { get; set; }
|
||||||
|
public DateTime? create_time { get; set; }
|
||||||
|
|
||||||
|
public string modify_id { get; set; }
|
||||||
|
|
||||||
|
public DateTime? modify_time { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
20
QcMgr/Tnb.QcMgr.Entities/Enums/EnumTempControlStatus.cs
Normal file
20
QcMgr/Tnb.QcMgr.Entities/Enums/EnumTempControlStatus.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Tnb.QcMgr.Entities.Enums
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 暂控处理单状态
|
||||||
|
/// </summary>
|
||||||
|
public enum EnumTempControlStatus
|
||||||
|
{
|
||||||
|
待确认=1,
|
||||||
|
待下发=2,
|
||||||
|
已下发=3,
|
||||||
|
执行中=4,
|
||||||
|
已同步=5
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,6 +29,11 @@ using Tnb.WarehouseMgr.Entities.Enums;
|
|||||||
using Tnb.ProductionMgr.Entities.Dto.PrdManage;
|
using Tnb.ProductionMgr.Entities.Dto.PrdManage;
|
||||||
using Tnb.WarehouseMgr.Entities;
|
using Tnb.WarehouseMgr.Entities;
|
||||||
using JNPF.Common.Extension;
|
using JNPF.Common.Extension;
|
||||||
|
using Tnb.QcMgr.Entities.Entity;
|
||||||
|
using Tnb.BasicData;
|
||||||
|
using JNPF.Systems.Interfaces.System;
|
||||||
|
using NPOI.SS.Formula.Functions;
|
||||||
|
using Tnb.QcMgr.Entities.Enums;
|
||||||
|
|
||||||
namespace Tnb.QcMgr
|
namespace Tnb.QcMgr
|
||||||
{
|
{
|
||||||
@@ -46,13 +51,15 @@ namespace Tnb.QcMgr
|
|||||||
private readonly IWmsSaleService _wmsSaleService;
|
private readonly IWmsSaleService _wmsSaleService;
|
||||||
private readonly IWmsPurchaseService _wmsPurchaseService;
|
private readonly IWmsPurchaseService _wmsPurchaseService;
|
||||||
private readonly IPrdMoTaskService _prdMoTaskService;
|
private readonly IPrdMoTaskService _prdMoTaskService;
|
||||||
|
private readonly IBillRullService _billRullService;
|
||||||
private static SemaphoreSlim prdreportSemaphore = new(1);
|
private static SemaphoreSlim prdreportSemaphore = new(1);
|
||||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||||
public QcCheckTaskService(ISqlSugarRepository<QcCheckExecH> repository,
|
public QcCheckTaskService(ISqlSugarRepository<QcCheckExecH> repository,
|
||||||
IUserManager userManager,
|
IUserManager userManager,
|
||||||
IWmsSaleService wmsSaleService,
|
IWmsSaleService wmsSaleService,
|
||||||
IPrdMoTaskService prdMoTaskService,
|
IPrdMoTaskService prdMoTaskService,
|
||||||
IWmsPurchaseService wmsPurchaseService)
|
IWmsPurchaseService wmsPurchaseService,
|
||||||
|
IBillRullService billRullService)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
@@ -60,6 +67,7 @@ namespace Tnb.QcMgr
|
|||||||
_wmsSaleService= wmsSaleService;
|
_wmsSaleService= wmsSaleService;
|
||||||
_prdMoTaskService = prdMoTaskService;
|
_prdMoTaskService = prdMoTaskService;
|
||||||
_wmsPurchaseService= wmsPurchaseService;
|
_wmsPurchaseService= wmsPurchaseService;
|
||||||
|
_billRullService = billRullService;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<dynamic> GetListAsync(VisualDevModelListQueryInput input)
|
private async Task<dynamic> GetListAsync(VisualDevModelListQueryInput input)
|
||||||
@@ -259,6 +267,7 @@ namespace Tnb.QcMgr
|
|||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task SaveData(CheckTaskInput CheckTaskInput)
|
public async Task SaveData(CheckTaskInput CheckTaskInput)
|
||||||
{
|
{
|
||||||
|
//CheckTaskInput.startEndTime = new long[] { 1730084456000, 1730170856000 };
|
||||||
await prdreportSemaphore.WaitAsync();
|
await prdreportSemaphore.WaitAsync();
|
||||||
ISqlSugarClient db = _repository.AsSugarClient();
|
ISqlSugarClient db = _repository.AsSugarClient();
|
||||||
try
|
try
|
||||||
@@ -289,7 +298,7 @@ namespace Tnb.QcMgr
|
|||||||
#region 质检结论不合格, 需要记录暂控时间区间,并且记录载具信息
|
#region 质检结论不合格, 需要记录暂控时间区间,并且记录载具信息
|
||||||
if (CheckTaskInput.result == "no")//质检结论不合格,记录暂控时间
|
if (CheckTaskInput.result == "no")//质检结论不合格,记录暂控时间
|
||||||
{
|
{
|
||||||
if(CheckTaskInput.startEndTime==null || CheckTaskInput.startEndTime.Length <= 1)
|
if (CheckTaskInput.startEndTime == null || CheckTaskInput.startEndTime.Length <= 1)
|
||||||
{
|
{
|
||||||
throw Oops.Bah("不合格时,请选择时间区间");
|
throw Oops.Bah("不合格时,请选择时间区间");
|
||||||
}
|
}
|
||||||
@@ -315,10 +324,10 @@ namespace Tnb.QcMgr
|
|||||||
{
|
{
|
||||||
foreach (ExecItemInput item in exextype.items)
|
foreach (ExecItemInput item in exextype.items)
|
||||||
{
|
{
|
||||||
if (item.postItemForm == null)
|
//if (item.postItemForm == null)
|
||||||
{
|
//{
|
||||||
throw Oops.Oh("执行失败");
|
// throw Oops.Oh("执行失败");
|
||||||
}
|
//}
|
||||||
|
|
||||||
QcCheckExecD? QcCheckExecD = QcCheckExecDs.Where(p => p.id == item.itemdid).FirstOrDefault();
|
QcCheckExecD? QcCheckExecD = QcCheckExecDs.Where(p => p.id == item.itemdid).FirstOrDefault();
|
||||||
if (QcCheckExecD == null)
|
if (QcCheckExecD == null)
|
||||||
@@ -376,6 +385,8 @@ namespace Tnb.QcMgr
|
|||||||
.SetColumns(x => x.attachment == QcCheckExecH.attachment)
|
.SetColumns(x => x.attachment == QcCheckExecH.attachment)
|
||||||
.SetColumns(x => x.qty == QcCheckExecH.qty)
|
.SetColumns(x => x.qty == QcCheckExecH.qty)
|
||||||
.SetColumns(x => x.rqty == QcCheckExecH.rqty)
|
.SetColumns(x => x.rqty == QcCheckExecH.rqty)
|
||||||
|
.SetColumns(x => x.control_start_time == QcCheckExecH.control_start_time)
|
||||||
|
.SetColumns(x => x.control_end_time == QcCheckExecH.control_end_time)
|
||||||
.Where(x => x.id == CheckTaskInput.mainid)
|
.Where(x => x.id == CheckTaskInput.mainid)
|
||||||
.ExecuteCommandAsync();
|
.ExecuteCommandAsync();
|
||||||
_ = await db.Deleteable(QcCheckExecDdel).ExecuteCommandAsync();
|
_ = await db.Deleteable(QcCheckExecDdel).ExecuteCommandAsync();
|
||||||
@@ -395,9 +406,10 @@ namespace Tnb.QcMgr
|
|||||||
mesCheckdCallbackUpinput.maintableid = QcCheckExecH.extras;
|
mesCheckdCallbackUpinput.maintableid = QcCheckExecH.extras;
|
||||||
mesCheckdCallbackUpinput.check_conclusion = dic.Where(p => p.Key == CheckTaskInput.result).Any() ? dic.Where(p => p.Key == CheckTaskInput.result).First().Value : 0;
|
mesCheckdCallbackUpinput.check_conclusion = dic.Where(p => p.Key == CheckTaskInput.result).Any() ? dic.Where(p => p.Key == CheckTaskInput.result).First().Value : 0;
|
||||||
await _wmsPurchaseService.MesCheckdPurchaseCallback(mesCheckdCallbackUpinput);
|
await _wmsPurchaseService.MesCheckdPurchaseCallback(mesCheckdCallbackUpinput);
|
||||||
}else if (QcCheckExecH.checktype == WmsWareHouseConst.LINGBUJIANZUIZHONGJIANYAN_ID)
|
}
|
||||||
|
else if (QcCheckExecH.checktype == WmsWareHouseConst.LINGBUJIANZUIZHONGJIANYAN_ID)
|
||||||
{
|
{
|
||||||
PrdReport prdReport = await db.Queryable<PrdReport>().SingleAsync(x=>x.id==QcCheckExecH.report_id);
|
PrdReport prdReport = await db.Queryable<PrdReport>().SingleAsync(x => x.id == QcCheckExecH.report_id);
|
||||||
decimal pqty = prdReport.reported_qty.Value - rqty;
|
decimal pqty = prdReport.reported_qty.Value - rqty;
|
||||||
if (rqty > Decimal.Parse(QcCheckExecH.checknum))
|
if (rqty > Decimal.Parse(QcCheckExecH.checknum))
|
||||||
{
|
{
|
||||||
@@ -411,18 +423,19 @@ namespace Tnb.QcMgr
|
|||||||
.SetColumns(x => x.is_check == isCheck)
|
.SetColumns(x => x.is_check == isCheck)
|
||||||
.Where(x => x.carry_code == prdReport.material_box_code)
|
.Where(x => x.carry_code == prdReport.material_box_code)
|
||||||
.ExecuteCommandAsync();
|
.ExecuteCommandAsync();
|
||||||
|
|
||||||
await _prdMoTaskService.ReportInstock(new CheckCompleteInput()
|
await _prdMoTaskService.ReportInstock(new CheckCompleteInput()
|
||||||
{
|
{
|
||||||
report_id = QcCheckExecH.report_id,
|
report_id = QcCheckExecH.report_id,
|
||||||
pqty = pqty,
|
pqty = pqty,
|
||||||
rqty = rqty,
|
rqty = rqty,
|
||||||
check_result = ((EnumCheckConclusion)dic[CheckTaskInput.result]).ToString(),
|
check_result = ((EnumCheckConclusion)dic[CheckTaskInput.result]).ToString(),
|
||||||
},prdReport,db);
|
}, prdReport, db);
|
||||||
}
|
}
|
||||||
}else if (QcCheckExecH.checktype == WmsWareHouseConst.XUNJIAN_ID || QcCheckExecH.checktype == WmsWareHouseConst.SHOUJIAN_ID || QcCheckExecH.checktype == WmsWareHouseConst.MOJIAN_ID )
|
}
|
||||||
|
else if (QcCheckExecH.checktype == WmsWareHouseConst.XUNJIAN_ID || QcCheckExecH.checktype == WmsWareHouseConst.SHOUJIAN_ID || QcCheckExecH.checktype == WmsWareHouseConst.MOJIAN_ID)
|
||||||
{
|
{
|
||||||
PrdMoTask prdMoTask = await db.Queryable<PrdMoTask>().Where(x=>x.mo_task_code==QcCheckExecH.mo_task_code && x.id!=null).FirstAsync();
|
PrdMoTask prdMoTask = await db.Queryable<PrdMoTask>().Where(x => x.mo_task_code == QcCheckExecH.mo_task_code && x.id != null).FirstAsync();
|
||||||
if (CheckTaskInput.result == "no")
|
if (CheckTaskInput.result == "no")
|
||||||
{
|
{
|
||||||
string pauseReason = QcCheckExecH.checktype == WmsWareHouseConst.XUNJIAN_ID ? "巡检不合格" : QcCheckExecH.checktype == WmsWareHouseConst.SHOUJIAN_ID ? "首检不合格" : "末检不合格";
|
string pauseReason = QcCheckExecH.checktype == WmsWareHouseConst.XUNJIAN_ID ? "巡检不合格" : QcCheckExecH.checktype == WmsWareHouseConst.SHOUJIAN_ID ? "首检不合格" : "末检不合格";
|
||||||
@@ -431,57 +444,186 @@ namespace Tnb.QcMgr
|
|||||||
TaskIds = NPOI.Util.Arrays.AsList(prdMoTask.id),
|
TaskIds = NPOI.Util.Arrays.AsList(prdMoTask.id),
|
||||||
Behavior = "Pause",
|
Behavior = "Pause",
|
||||||
PauseReeson = pauseReason
|
PauseReeson = pauseReason
|
||||||
},db);
|
}, db);
|
||||||
await _prdMoTaskService.SelfTestScrapped2(new SelfTestScrappedInput()
|
|
||||||
|
#region 没看懂逻辑,暂时注释
|
||||||
|
//await _prdMoTaskService.SelfTestScrapped2(new SelfTestScrappedInput()
|
||||||
|
//{
|
||||||
|
// mo_task_id = prdMoTask.id,
|
||||||
|
// scrap_qty = rqty,
|
||||||
|
// remark = "抽样不合格报废",
|
||||||
|
// categoryItems = new List<SelfTestScrappedInputItem>()
|
||||||
|
// {
|
||||||
|
// new SelfTestScrappedInputItem()
|
||||||
|
// {
|
||||||
|
// category_id = "25574005966629",
|
||||||
|
// items = new List<defectItem>()
|
||||||
|
// {
|
||||||
|
// new defectItem()
|
||||||
|
// {
|
||||||
|
// defective_item = "抽样不合格报废",
|
||||||
|
// defective_item_qty = rqty
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}, db);
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//载具需要在中储仓和暂存仓才需要暂控
|
||||||
|
List<PrdReport> prdReports = await db.Queryable<PrdReport>().LeftJoin<WmsCarryH>((a, b) => a.material_box_code == b.carry_code).LeftJoin<BasLocation>((a, b, c) => b.location_id == c.id).LeftJoin<BasWarehouse>((a, b, c, d) => c.wh_id == d.id).Where((a, b, c, d) => a.mo_task_id == prdMoTask.id && a.create_time >= CheckTaskInput.startEndTime[0].TimeStampToDateTime() && a.create_time <= CheckTaskInput.startEndTime[1].TimeStampToDateTime() && (c.wh_id == WmsWareHouseConst.WAREHOUSE_ZC_ID || c.wh_id == WmsWareHouseConst.WAREHOUSE_ZCC_ID)).ToListAsync();
|
||||||
|
if (prdReports != null)
|
||||||
{
|
{
|
||||||
mo_task_id = prdMoTask.id,
|
var carryCodes = prdReports.Select(r => r.material_box_code).Distinct().ToList();
|
||||||
scrap_qty = rqty,
|
if (carryCodes != null && carryCodes.Count > 0)
|
||||||
remark = "抽样不合格报废",
|
|
||||||
categoryItems = new List<SelfTestScrappedInputItem>()
|
|
||||||
{
|
{
|
||||||
new SelfTestScrappedInputItem()
|
await db.Updateable<WmsCarryH>()
|
||||||
|
.SetColumns(x => x.is_check == ((int)EnumCheckConclusion.暂控).ToString())
|
||||||
|
.SetColumns(x => x.carry_status == "6")//把料架状态改为退料状态,会自动触发把料架上的子载具从二楼暂存仓退回一楼中储仓任务
|
||||||
|
.Where(x => carryCodes.Contains(x.carry_code))
|
||||||
|
.ExecuteCommandAsync();
|
||||||
|
|
||||||
|
#region 记录被暂控的载具信息
|
||||||
|
//var qcCheckExecCarrys = new List<QcCheckExecCarry>();
|
||||||
|
//foreach(var carryCode in carryCodes)
|
||||||
|
//{
|
||||||
|
// var wmsCarryH = await db.Queryable<WmsCarryH>().Where(r => r.carry_code == carryCode).FirstAsync();
|
||||||
|
// if (wmsCarryH == null)
|
||||||
|
// continue;
|
||||||
|
|
||||||
|
// WmsCarryCode wmsCarryCode = await db.Queryable<WmsCarryCode>().FirstAsync(x => x.carry_id == wmsCarryH.id);
|
||||||
|
// BasLocation basLocation = await db.Queryable<BasLocation>().Where(r => r.location_code == wmsCarryH.location_code).FirstAsync();
|
||||||
|
// WmsCarryMat wmsCarryMat = await db.Queryable<WmsCarryMat>().Where(r => r.carry_id == wmsCarryH.id).FirstAsync();
|
||||||
|
|
||||||
|
// var qcCheckExecCarry = new QcCheckExecCarry()
|
||||||
|
// {
|
||||||
|
// qc_check_exec_id = QcCheckExecH.id,
|
||||||
|
// carry_id = wmsCarryH.id,
|
||||||
|
// carry_code = wmsCarryH.carry_code,
|
||||||
|
// warehouse_id = basLocation != null ? basLocation.wh_id : "",
|
||||||
|
// qty = wmsCarryCode != null ? wmsCarryCode.codeqty.ToString() : "",
|
||||||
|
// status = wmsCarryH.is_check,
|
||||||
|
// location_id = basLocation != null ? basLocation.id : "",
|
||||||
|
// location_code = basLocation != null ? basLocation.location_code : "",
|
||||||
|
// material_id= wmsCarryMat?.material_id,
|
||||||
|
// create_id = _userManager.UserId,
|
||||||
|
// create_time = DateTime.Now
|
||||||
|
// };
|
||||||
|
// qcCheckExecCarrys.Add(qcCheckExecCarry);
|
||||||
|
//}
|
||||||
|
//_ = await db.Insertable(qcCheckExecCarrys).ExecuteCommandAsync();
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 记录暂控处理单主/子表信息
|
||||||
|
|
||||||
|
if (carryCodes != null && carryCodes.Count > 0)
|
||||||
{
|
{
|
||||||
category_id = "25574005966629",
|
|
||||||
items = new List<defectItem>()
|
var basMaterial = await db.Queryable<BasMaterial>().Where(r => r.id == prdMoTask.material_id).FirstAsync();
|
||||||
|
string outWHid = ""; string inWHid = "";
|
||||||
|
if (basMaterial.category_id.Contains("DGJCJ") || basMaterial.category_id.Contains("ZSJ"))
|
||||||
{
|
{
|
||||||
new defectItem()
|
outWHid = WmsWareHouseConst.WAREHOUSE_ZC_ID;
|
||||||
{
|
inWHid = "中储不合格品仓id";
|
||||||
defective_item = "抽样不合格报废",
|
|
||||||
defective_item_qty = rqty
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else if (basMaterial.category_id.Contains("CGJCJ"))
|
||||||
|
{
|
||||||
|
outWHid = WmsWareHouseConst.WAREHOUSE_HCC_ID;
|
||||||
|
inWHid = "长管不合格品仓id";
|
||||||
|
}
|
||||||
|
|
||||||
|
var carryIds = await db.Queryable<WmsCarryH>().Where(r => carryCodes.Contains(r.carry_code)).Select(r => r.id).ToListAsync();
|
||||||
|
var wmsCarryCodes = await db.Queryable<WmsCarryCode>().Where(r => carryIds.Contains(r.carry_id) && r.material_id == QcCheckExecH.materialid).ToListAsync();
|
||||||
|
var codeQty = wmsCarryCodes == null ? 0 : wmsCarryCodes.Sum(r => r.codeqty);
|
||||||
|
var qcTempControlH = new QcTempControlH()
|
||||||
|
{
|
||||||
|
id = SnowflakeIdHelper.NextId(),
|
||||||
|
bill_code = await _billRullService.GetBillNumber(CodeTemplateConst.QCCONTROLTEMP_CODE),
|
||||||
|
source_code = QcCheckExecH.bill_code,
|
||||||
|
pro_task_code = QcCheckExecH.mo_task_code,
|
||||||
|
out_warehouse_id = outWHid,
|
||||||
|
in_warehouse_id = inWHid,
|
||||||
|
material_id = QcCheckExecH.materialid,
|
||||||
|
material_code = basMaterial.code,
|
||||||
|
control_lx_qty = carryCodes.Count.ToString(),
|
||||||
|
control_qty = codeQty.ToString(),
|
||||||
|
result = "暂控",
|
||||||
|
loger_id = _userManager.UserId,
|
||||||
|
confirmer_id = "",
|
||||||
|
status = ((int)EnumTempControlStatus.待确认).ToString(),
|
||||||
|
called_box_qty = "0",
|
||||||
|
called_qty = "0",
|
||||||
|
leave_call_box_qty = carryCodes.Count.ToString(),
|
||||||
|
leave_call_qty = codeQty.ToString(),
|
||||||
|
create_id = _userManager.UserId,
|
||||||
|
create_time = DateTime.Now,
|
||||||
|
};
|
||||||
|
|
||||||
|
await db.Insertable(qcTempControlH).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
var qcTempControlDs = new List<QcTempControlD>();
|
||||||
|
foreach (var carryCode in carryCodes)
|
||||||
|
{
|
||||||
|
var wmsCarryH = await db.Queryable<WmsCarryH>().Where(r => r.carry_code == carryCode).FirstAsync();
|
||||||
|
if (wmsCarryH == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
WmsCarryCode wmsCarryCode = await db.Queryable<WmsCarryCode>().FirstAsync(x => x.carry_id == wmsCarryH.id);
|
||||||
|
BasLocation basLocation = await db.Queryable<BasLocation>().Where(r => r.location_code == wmsCarryH.location_code).FirstAsync();
|
||||||
|
if (basLocation == null)
|
||||||
|
throw Oops.Bah($"未找到编号为{wmsCarryH.location_code}的库位");
|
||||||
|
WmsCarryMat wmsCarryMat = await db.Queryable<WmsCarryMat>().Where(r => r.carry_id == wmsCarryH.id).FirstAsync();
|
||||||
|
BasWarehouse basWarehouse = await db.Queryable<BasWarehouse>().Where(r => r.id == basLocation.wh_id).FirstAsync();
|
||||||
|
var _prdReports = prdReports.Where(r => r.material_box_code == carryCode).First();
|
||||||
|
var qcTempConD = new QcTempControlD()
|
||||||
|
{
|
||||||
|
bill_id = qcTempControlH.id,
|
||||||
|
carry_id = wmsCarryH.id,
|
||||||
|
carry_code = carryCode,
|
||||||
|
warehouse_id = basLocation?.wh_id,
|
||||||
|
warehouse_code = basWarehouse.whcode,
|
||||||
|
location_code = basLocation?.location_code,
|
||||||
|
location_id = basLocation?.id,
|
||||||
|
qty = wmsCarryCode?.codeqty.ToString(),
|
||||||
|
submiter = _prdReports == null ? null : _prdReports.create_id,
|
||||||
|
maker_id = "",
|
||||||
|
create_id = _userManager.UserId,
|
||||||
|
create_time = DateTime.Now,
|
||||||
|
check_status = "暂控",
|
||||||
|
call_status = "未呼叫"
|
||||||
|
};
|
||||||
|
qcTempControlDs.Add(qcTempConD);
|
||||||
|
}
|
||||||
|
await db.Insertable(qcTempControlDs).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
},db);
|
}
|
||||||
List<string> carryCodes = await db.Queryable<PrdReport>().Where(x=>x.mo_task_id==prdMoTask.id).Select(x=>x.material_box_code).Distinct().ToListAsync();
|
else
|
||||||
await db.Updateable<WmsCarryH>()
|
|
||||||
.SetColumns(x => x.is_check == ((int)EnumCheckConclusion.暂控).ToString())
|
|
||||||
.Where(x => carryCodes.Contains(x.carry_code))
|
|
||||||
.ExecuteCommandAsync();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//末检自动完工
|
|
||||||
if (QcCheckExecH.checktype == WmsWareHouseConst.MOJIAN_ID)
|
|
||||||
{
|
{
|
||||||
await _prdMoTaskService.PrdTaskRelease2(new PrdTaskReleaseUpInput()
|
//末检自动完工
|
||||||
|
if (QcCheckExecH.checktype == WmsWareHouseConst.MOJIAN_ID)
|
||||||
{
|
{
|
||||||
TaskIds = NPOI.Util.Arrays.AsList(prdMoTask.id),
|
await _prdMoTaskService.PrdTaskRelease2(new PrdTaskReleaseUpInput()
|
||||||
Behavior = "Compled",
|
{
|
||||||
},db);
|
TaskIds = NPOI.Util.Arrays.AsList(prdMoTask.id),
|
||||||
|
Behavior = "Compled",
|
||||||
|
}, db);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
await db.Ado.CommitTranAsync();
|
await db.Ado.CommitTranAsync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
await db.Ado.RollbackTranAsync();
|
await db.Ado.RollbackTranAsync();
|
||||||
Log.Error(e.Message,e);
|
JNPF.Logging.Log.Error(e.Message, e);
|
||||||
throw Oops.Oh("执行失败:"+e.Message);
|
throw Oops.Oh("执行失败:" + e.Message);
|
||||||
}
|
}
|
||||||
finally{
|
finally
|
||||||
|
{
|
||||||
prdreportSemaphore.Release();
|
prdreportSemaphore.Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -531,21 +673,43 @@ namespace Tnb.QcMgr
|
|||||||
attachment = a.attachment,
|
attachment = a.attachment,
|
||||||
}).FirstAsync();
|
}).FirstAsync();
|
||||||
Result.checktypes = new List<List<Checktype>>();
|
Result.checktypes = new List<List<Checktype>>();
|
||||||
if (!string.IsNullOrEmpty(QcCheckExecH.carry_code))
|
|
||||||
{
|
//var qcCheckExecCarrys = await db.Queryable<QcCheckExecCarry>().Where(r => r.qc_check_exec_id == QcCheckExecH.id).ToListAsync();
|
||||||
WmsCarryH carryH = await db.Queryable<WmsCarryH>().FirstAsync(x => x.carry_code == QcCheckExecH.carry_code);
|
//if(qcCheckExecCarrys!=null && qcCheckExecCarrys.Count > 0)
|
||||||
WmsCarryCode carryCode = await db.Queryable<WmsCarryCode>().FirstAsync(x => x.carry_id == carryH.id);
|
//{
|
||||||
string materialId = carryCode?.id ?? "";
|
// var checkCarrys = new List<CheckCarry>();
|
||||||
BasMaterial basMaterial = await db.Queryable<BasMaterial>().SingleAsync(x=>x.id==materialId);
|
// foreach(var acec in qcCheckExecCarrys)
|
||||||
Result.carryInfo = new CheckCarry()
|
// {
|
||||||
{
|
// WmsCarryH carryH = await db.Queryable<WmsCarryH>().FirstAsync(x => x.id == acec.carry_id);
|
||||||
carry_name = carryH.carry_name,
|
// BasMaterial basMaterial = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == acec.material_id);
|
||||||
location_id = carryH.location_id,
|
// var carry = new CheckCarry()
|
||||||
location_code = carryH.location_code,
|
// {
|
||||||
material_name = basMaterial?.name,
|
// carry_name = carryH.carry_name,
|
||||||
qty = carryCode?.codeqty ?? 0,
|
// location_id = acec.location_id,
|
||||||
};
|
// location_code = acec.location_code,
|
||||||
}
|
// material_name = basMaterial?.name,
|
||||||
|
// qty = string.IsNullOrEmpty(acec.qty) ? 0 : Convert.ToDecimal(acec.qty),
|
||||||
|
// is_check=acec.status
|
||||||
|
// };
|
||||||
|
// checkCarrys.Add(carry);
|
||||||
|
// }
|
||||||
|
// Result.carryInfo= checkCarrys;
|
||||||
|
//}
|
||||||
|
//if (!string.IsNullOrEmpty(QcCheckExecH.carry_code))
|
||||||
|
//{
|
||||||
|
// WmsCarryH carryH = await db.Queryable<WmsCarryH>().FirstAsync(x => x.carry_code == QcCheckExecH.carry_code);
|
||||||
|
// WmsCarryCode carryCode = await db.Queryable<WmsCarryCode>().FirstAsync(x => x.carry_id == carryH.id);
|
||||||
|
// string materialId = carryCode?.id ?? "";
|
||||||
|
// BasMaterial basMaterial = await db.Queryable<BasMaterial>().SingleAsync(x=>x.id==materialId);
|
||||||
|
// Result.carryInfo = new CheckCarry()
|
||||||
|
// {
|
||||||
|
// carry_name = carryH.carry_name,
|
||||||
|
// location_id = carryH.location_id,
|
||||||
|
// location_code = carryH.location_code,
|
||||||
|
// material_name = basMaterial?.name,
|
||||||
|
// qty = carryCode?.codeqty ?? 0,
|
||||||
|
// };
|
||||||
|
//}
|
||||||
List<string?> groupkeys = QcCheckExecDs.Select(p => p.checkindex).Distinct().ToList();
|
List<string?> groupkeys = QcCheckExecDs.Select(p => p.checkindex).Distinct().ToList();
|
||||||
foreach (string? key in groupkeys)
|
foreach (string? key in groupkeys)
|
||||||
{
|
{
|
||||||
|
|||||||
721
QcMgr/Tnb.QcMgr/QcTempControlHService.cs
Normal file
721
QcMgr/Tnb.QcMgr/QcTempControlHService.cs
Normal file
@@ -0,0 +1,721 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Aop.Api.Domain;
|
||||||
|
using DingTalk.Api.Request;
|
||||||
|
using JNPF.Common.Core.Manager;
|
||||||
|
using JNPF.Common.Extension;
|
||||||
|
using JNPF.Common.Filter;
|
||||||
|
using JNPF.Common.Security;
|
||||||
|
using JNPF.DependencyInjection;
|
||||||
|
using JNPF.DynamicApiController;
|
||||||
|
using JNPF.FriendlyException;
|
||||||
|
using JNPF.Logging;
|
||||||
|
using JNPF.Systems.Entitys.System;
|
||||||
|
using JNPF.Systems.Interfaces.System;
|
||||||
|
using JNPF.VisualDev;
|
||||||
|
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.ClearScript.JavaScript;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using SqlSugar;
|
||||||
|
using Tnb.BasicData.Entities;
|
||||||
|
using Tnb.EquipMgr.Entities;
|
||||||
|
using Tnb.ProductionMgr.Entities;
|
||||||
|
using Tnb.ProductionMgr.Entities.Entity;
|
||||||
|
using Tnb.QcMgr.Entities;
|
||||||
|
using Tnb.QcMgr.Entities.Dto;
|
||||||
|
using Tnb.QcMgr.Entities.Entity;
|
||||||
|
using Tnb.QcMgr.Entities.Enums;
|
||||||
|
using Tnb.WarehouseMgr;
|
||||||
|
using Tnb.WarehouseMgr.Entities;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Consts;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Dto;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Enums;
|
||||||
|
using Tnb.WarehouseMgr.Interfaces;
|
||||||
|
|
||||||
|
namespace Tnb.QcMgr
|
||||||
|
{
|
||||||
|
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 800)]
|
||||||
|
[Route("api/[area]/[controller]/[action]")]
|
||||||
|
public class QcTempControlHService : BaseWareHouseService, IDynamicApiController, ITransient
|
||||||
|
{
|
||||||
|
private readonly ISqlSugarRepository<QcTempControlH> _repository;
|
||||||
|
private readonly IUserManager _userManager;
|
||||||
|
private readonly IWareHouseService _wareHouseService;
|
||||||
|
private readonly IBillRullService _billRullService;
|
||||||
|
private readonly ISqlSugarClient _db;
|
||||||
|
public QcTempControlHService(ISqlSugarRepository<QcTempControlH> repository, IUserManager userManager, IWareHouseService wareHouseService,IBillRullService billRullService)
|
||||||
|
{
|
||||||
|
_db = repository.AsSugarClient();
|
||||||
|
_userManager = userManager;
|
||||||
|
_wareHouseService = wareHouseService;
|
||||||
|
_billRullService = billRullService;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取质检暂控处理单
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<object> AllList(VisualDevModelListQueryInput input)
|
||||||
|
{
|
||||||
|
var bill_code = ""; //单据号
|
||||||
|
var pro_task_code = ""; //生产任务单号
|
||||||
|
var status = "";//状态
|
||||||
|
if (!input.queryJson.IsNullOrWhiteSpace())
|
||||||
|
{
|
||||||
|
bill_code = JObject.Parse(input.queryJson).Value<string>("bill_code");
|
||||||
|
pro_task_code = JObject.Parse(input.queryJson).Value<string>("pro_task_code");
|
||||||
|
status = JObject.Parse(input.queryJson).Value<string>("status");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _db.Queryable<QcTempControlH>().LeftJoin<BasWarehouse>((a, b) => a.in_warehouse_id == b.id)
|
||||||
|
.LeftJoin<BasWarehouse>((a, b, c) => a.out_warehouse_id == c.id)
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(bill_code), (a, b, c) => a.bill_code.Contains(bill_code))
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(pro_task_code), (a, b, c) => a.pro_task_code.Contains(pro_task_code))
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(status), (a, b, c) => a.status == status)
|
||||||
|
.OrderByDescending((a, b, c) => a.create_time)
|
||||||
|
.Select((a, b, c) => new QcTempControlHOutput()
|
||||||
|
{
|
||||||
|
id = a.id,
|
||||||
|
bill_code = a.bill_code,
|
||||||
|
source_code = a.source_code,
|
||||||
|
pro_task_code = a.pro_task_code,
|
||||||
|
out_warehouse_id = a.out_warehouse_id,
|
||||||
|
out_warehouse_name = c.whname,
|
||||||
|
in_warehouse_id = a.in_warehouse_id,
|
||||||
|
in_warehouse_name = b.whname,
|
||||||
|
material_id = a.material_id,
|
||||||
|
material_code = a.material_code,
|
||||||
|
control_lx_qty = a.control_lx_qty,
|
||||||
|
control_qty = a.control_qty,
|
||||||
|
result = a.result,
|
||||||
|
loger_id = a.loger_id,
|
||||||
|
confirmer_id = a.confirmer_id,
|
||||||
|
status = a.status,
|
||||||
|
called_box_qty = a.called_box_qty,
|
||||||
|
called_qty = a.called_qty,
|
||||||
|
leave_call_box_qty = a.leave_call_box_qty,
|
||||||
|
leave_call_qty = a.leave_call_qty,
|
||||||
|
|
||||||
|
details = SqlFunc.Subqueryable<QcTempControlD>().Where(r => r.bill_id == a.id).OrderByDesc(r => r.create_time).ToList((x) => new QcTempControlDsOutput
|
||||||
|
{
|
||||||
|
id = x.id,
|
||||||
|
bill_id = x.bill_id,
|
||||||
|
carry_id = x.carry_id,
|
||||||
|
carry_code = x.carry_code,
|
||||||
|
warehouse_code = x.warehouse_code,
|
||||||
|
warehouse_id = x.warehouse_id,
|
||||||
|
location_code = x.location_code,
|
||||||
|
location_id = x.location_id,
|
||||||
|
qty = x.qty,
|
||||||
|
submiter = x.submiter,
|
||||||
|
maker_id = x.maker_id,
|
||||||
|
})
|
||||||
|
|
||||||
|
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||||
|
|
||||||
|
return PageResult<QcTempControlHOutput>.SqlSugarPageResult(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 确认暂控料处理单结论
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dic"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<dynamic> ModifyResult(Dictionary<string, string> dic)
|
||||||
|
{
|
||||||
|
string id = dic["id"];
|
||||||
|
string qcRes = dic["result"];
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var qcTempControlH = await _db.Queryable<QcTempControlH>().Where(r => r.id == id).FirstAsync();
|
||||||
|
if(qcTempControlH==null)
|
||||||
|
{
|
||||||
|
throw Oops.Bah("暂控处理单数据不存在");
|
||||||
|
}
|
||||||
|
await _db.Ado.BeginTranAsync();
|
||||||
|
|
||||||
|
await _db.Updateable<QcTempControlH>().SetColumns(x => x.result == qcRes).SetColumns(x=>x.status==((int)EnumTempControlStatus.待下发).ToString()).Where(x => x.id == id).ExecuteCommandAsync();
|
||||||
|
await _db.Updateable<QcTempControlD>().SetColumns(x => x.check_status == qcRes).Where(x => x.bill_id == qcTempControlH.bill_code).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
await _db.Ado.CommitTranAsync();
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
await _db.Ado.RollbackTranAsync();
|
||||||
|
Log.Error(e.Message, e);
|
||||||
|
throw Oops.Bah(e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return "修改成功";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 下发暂控料处理单
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dic"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<string> QcTempControlIssued(Dictionary<string, string> dic)
|
||||||
|
{
|
||||||
|
string id = dic["id"];
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var qcTempControlH = await _db.Queryable<QcTempControlH>().Where(r => r.id == id).FirstAsync();
|
||||||
|
if (qcTempControlH == null)
|
||||||
|
{
|
||||||
|
throw Oops.Bah("暂控处理单数据不存在");
|
||||||
|
}
|
||||||
|
//所有暂控的料箱必须都进入中储仓才能进行下发
|
||||||
|
var qcTempControlDs = await _db.Queryable<QcTempControlD>().Where(r => r.bill_id == qcTempControlH.id).ToListAsync();
|
||||||
|
if (qcTempControlDs!=null && qcTempControlDs.Count > 0)
|
||||||
|
{
|
||||||
|
var carrys = await _db.Queryable<WmsCarryCode>().Where(r => qcTempControlDs.Select(r => r.carry_id).Contains(r.carry_id)).ToListAsync();
|
||||||
|
var noInStockCarrys = carrys.Where(r => r.warehouse_id != WmsWareHouseConst.WAREHOUSE_ZC_ID);
|
||||||
|
if (noInStockCarrys.Any())
|
||||||
|
{
|
||||||
|
var carryCodes=string.Join(",", noInStockCarrys.Distinct().Select(r=>r.carry_code));
|
||||||
|
throw Oops.Bah($"{carryCodes}等料箱还没入中储仓,不能下发");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await _db.Ado.BeginTranAsync();
|
||||||
|
|
||||||
|
await _db.Updateable<QcTempControlH>().SetColumns(x => x.status == ((int)EnumTempControlStatus.已下发).ToString()).Where(x => x.id == id).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
await _db.Ado.CommitTranAsync();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
await _db.Ado.RollbackTranAsync();
|
||||||
|
Log.Error(e.Message, e);
|
||||||
|
throw Oops.Bah(e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return "修改成功";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取质检单 for APP
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<object> GetQcTempControlList(PageInputBase input)
|
||||||
|
{
|
||||||
|
Dictionary<string, object> queryJson = string.IsNullOrEmpty(input.queryJson) ? new Dictionary<string, object>() : input.queryJson.ToObject<Dictionary<string, object>>();
|
||||||
|
string? bill_code = queryJson.ContainsKey("bill_code") ? queryJson["bill_code"].ToString() : "";
|
||||||
|
string? status = queryJson.ContainsKey("status") ? queryJson["status"].ToString() : "";
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(input.sidx))
|
||||||
|
{
|
||||||
|
input.sidx = "create_time";
|
||||||
|
input.sort = "desc";
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _db.Queryable<QcTempControlH>().LeftJoin<BasWarehouse>((a, b) => a.in_warehouse_id == b.id)
|
||||||
|
.LeftJoin<BasWarehouse>((a, b, c) => a.out_warehouse_id == c.id)
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(bill_code), (a, b, c) => a.bill_code.Contains(bill_code))
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(status), (a, b, c) => a.status == status)
|
||||||
|
.OrderByDescending((a, b, c) => a.create_time)
|
||||||
|
.Select((a, b, c) => new QcTempControlHAppOutput()
|
||||||
|
{
|
||||||
|
id = a.id,
|
||||||
|
bill_code = a.bill_code,
|
||||||
|
source_code = a.source_code,
|
||||||
|
pro_task_code = a.pro_task_code,
|
||||||
|
out_warehouse_id = a.out_warehouse_id,
|
||||||
|
out_warehouse_name = c.whname,
|
||||||
|
in_warehouse_id = a.in_warehouse_id,
|
||||||
|
in_warehouse_name = b.whname,
|
||||||
|
material_id = a.material_id,
|
||||||
|
material_code = a.material_code,
|
||||||
|
control_lx_qty = a.control_lx_qty,
|
||||||
|
control_qty = a.control_qty,
|
||||||
|
result = a.result,
|
||||||
|
loger_id = a.loger_id,
|
||||||
|
confirmer_id = a.confirmer_id,
|
||||||
|
status = a.status,
|
||||||
|
called_box_qty = a.called_box_qty,
|
||||||
|
called_qty = a.called_qty,
|
||||||
|
leave_call_box_qty = a.leave_call_box_qty,
|
||||||
|
leave_call_qty = a.leave_call_qty,
|
||||||
|
|
||||||
|
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||||
|
|
||||||
|
return PageResult<QcTempControlHAppOutput>.SqlSugarPageResult(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// PDA暂控料呼叫
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<string> TempControlCall(QcTempControlCallInput input)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(input.id))
|
||||||
|
throw Oops.Bah("主键id不能为空");
|
||||||
|
if (string.IsNullOrEmpty(input.destination_location_code))
|
||||||
|
throw Oops.Bah("目标库位不能为空");
|
||||||
|
if (input.box_qty <= 0)
|
||||||
|
throw Oops.Bah("呼叫箱数不能小于1");
|
||||||
|
|
||||||
|
var qcTempControlH = await _db.Queryable<QcTempControlH>().Where(r => r.id == input.id).FirstAsync();
|
||||||
|
if (qcTempControlH == null)
|
||||||
|
throw Oops.Bah("暂控处理单数据不存在");
|
||||||
|
|
||||||
|
var basLocation=await _db.Queryable<BasLocation>().Where(r=>r.location_code==input.destination_location_code).FirstAsync();
|
||||||
|
if (basLocation == null)
|
||||||
|
throw Oops.Bah($"目标库位{input.destination_location_code}不存在");
|
||||||
|
|
||||||
|
var qcTempControlDs = await _db.Queryable<QcTempControlD>().Where(r => r.bill_id == input.id && r.call_status == "未呼叫").Take(input.box_qty).ToListAsync();
|
||||||
|
if (qcTempControlDs == null || qcTempControlDs.Count <= 0)
|
||||||
|
throw Oops.Bah("不存在未下发的料箱");
|
||||||
|
|
||||||
|
await _db.Ado.BeginTranAsync();
|
||||||
|
|
||||||
|
decimal callqty = 0;//当前呼叫物料总数量
|
||||||
|
foreach(var item in qcTempControlDs)
|
||||||
|
{
|
||||||
|
callqty += (string.IsNullOrEmpty(item.qty) ? 0 : Convert.ToDecimal(item.qty));
|
||||||
|
|
||||||
|
// 计算路径,插入预任务申请
|
||||||
|
WmsPointH sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id ==item.location_id);
|
||||||
|
WmsPointH ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == basLocation.id);
|
||||||
|
|
||||||
|
if (sPoint == null)
|
||||||
|
throw Oops.Bah($"载具编号{item.carry_code}未找到起始点位");
|
||||||
|
if (ePoint == null)
|
||||||
|
throw Oops.Bah($"载具编号{item.carry_code}未找到终点点位");
|
||||||
|
|
||||||
|
List<WmsPointH> points = new List<WmsPointH>();
|
||||||
|
if (sPoint.area_code != ePoint.area_code)
|
||||||
|
{
|
||||||
|
points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||||
|
if (points.Count <= 2)
|
||||||
|
{
|
||||||
|
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
points.Add(sPoint);
|
||||||
|
points.Add(ePoint);
|
||||||
|
}
|
||||||
|
if (points.Count <= 0)
|
||||||
|
throw Oops.Bah("点位不存在");
|
||||||
|
|
||||||
|
List<WmsPretaskH> preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||||
|
{
|
||||||
|
WmsPointH? sPoint = it.FirstOrDefault();
|
||||||
|
WmsPointH? ePoint = it.LastOrDefault();
|
||||||
|
|
||||||
|
WmsPretaskH preTask = new()
|
||||||
|
{
|
||||||
|
org_id = _userManager!.User.OrganizeId,
|
||||||
|
startlocation_id = sPoint?.location_id!,
|
||||||
|
startlocation_code = sPoint?.location_code!,
|
||||||
|
endlocation_id = ePoint?.location_id!,
|
||||||
|
endlocation_code = ePoint?.location_code!,
|
||||||
|
start_floor = sPoint?.floor.ToString(),
|
||||||
|
end_floor = ePoint?.floor.ToString(),
|
||||||
|
startpoint_id = sPoint?.id!,
|
||||||
|
startpoint_code = sPoint?.point_code!,
|
||||||
|
endpoint_id = ePoint?.id!,
|
||||||
|
endpoint_code = ePoint?.point_code!,
|
||||||
|
bill_code = _billRullService!.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(),
|
||||||
|
status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID,
|
||||||
|
biz_type = WmsWareHouseConst.BIZTYPE_WMSTRANSFERINSTOCK_ID,
|
||||||
|
task_type = WmsWareHouseConst.WMS_PRETASK_TRANSFER_TYPE_ID
|
||||||
|
};
|
||||||
|
preTask.area_id = sPoint?.area_id!;
|
||||||
|
preTask.area_code = it.Key;
|
||||||
|
preTask.require_id = qcTempControlH.id;
|
||||||
|
preTask.require_code = qcTempControlH.bill_code;
|
||||||
|
preTask.create_id = _userManager.UserId;
|
||||||
|
preTask.create_time = DateTime.Now;
|
||||||
|
return preTask;
|
||||||
|
}).ToList();
|
||||||
|
bool isOk = await _wareHouseService.GenPreTask(preTasks, null!);
|
||||||
|
if (!isOk)
|
||||||
|
throw Oops.Bah($"载具编号{item.carry_code}生成预任务失败");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
await _db.Updateable(qcTempControlDs).SetColumns(x=>x.call_status=="已呼叫").ExecuteCommandAsync();
|
||||||
|
|
||||||
|
//已呼叫料箱数量
|
||||||
|
var called_box_qty = qcTempControlDs.Count + (string.IsNullOrEmpty(qcTempControlH.called_box_qty) ? 0 : Convert.ToDecimal(qcTempControlH.called_box_qty));
|
||||||
|
//已呼叫物料数量
|
||||||
|
var called_qty = callqty + (string.IsNullOrEmpty(qcTempControlH.called_qty) ? 0 : Convert.ToDecimal(qcTempControlH.called_qty));
|
||||||
|
//剩余呼叫料箱数量
|
||||||
|
var leave_call_box_qty = (string.IsNullOrEmpty(qcTempControlH.control_lx_qty) ? 0 : Convert.ToDecimal(qcTempControlH.control_lx_qty)) - called_box_qty;
|
||||||
|
//剩余呼叫数量
|
||||||
|
var leave_call_qty = (string.IsNullOrEmpty(qcTempControlH.control_qty) ? 0 : Convert.ToDecimal(qcTempControlH.control_qty)) - called_qty;
|
||||||
|
|
||||||
|
await _db.Updateable(qcTempControlH).SetColumns(x => x.called_box_qty == called_box_qty.ToString())
|
||||||
|
.SetColumns(x => x.called_qty == called_qty.ToString())
|
||||||
|
.SetColumns(x => x.leave_call_box_qty == leave_call_box_qty.ToString())
|
||||||
|
.SetColumns(x => x.leave_call_qty == leave_call_qty.ToString())
|
||||||
|
.SetColumns(x=>x.status==((int)EnumTempControlStatus.执行中).ToString())
|
||||||
|
.ExecuteCommandAsync();
|
||||||
|
|
||||||
|
await _db.Ado.CommitTranAsync();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
await _db.Ado.RollbackTranAsync();
|
||||||
|
Log.Error(e.Message, e);
|
||||||
|
throw Oops.Bah(e.Message);
|
||||||
|
}
|
||||||
|
return "呼叫成功";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// PDA扫描料箱获取暂控处理单详情
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dic"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
|
||||||
|
public async Task<object> GetQcTempControlDetail(Dictionary<string,string> dic)
|
||||||
|
{
|
||||||
|
var id = dic["id"].ToString();
|
||||||
|
var carryCode = dic["carryCode"].ToString();
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(carryCode))
|
||||||
|
throw Oops.Bah("料箱号不能为空");
|
||||||
|
|
||||||
|
var qcTempControlH = await _db.Queryable<QcTempControlH>().Where(r => r.id == id).FirstAsync();
|
||||||
|
if (qcTempControlH == null)
|
||||||
|
throw Oops.Bah("未找到暂控料处理单数据");
|
||||||
|
|
||||||
|
var carry = await _db.Queryable<WmsCarryCode>().Where(r => r.carry_code == carryCode).FirstAsync();
|
||||||
|
if (carry == null)
|
||||||
|
throw Oops.Bah($"料箱号:{carryCode}不存在");
|
||||||
|
|
||||||
|
var qcTempControlD = await _db.Queryable<QcTempControlD>().Where(r => r.bill_id == qcTempControlH.id && r.carry_id == carry.id).FirstAsync();
|
||||||
|
if (qcTempControlD == null)
|
||||||
|
throw Oops.Bah($"料箱号:{carryCode}不在此暂控料处理单的暂控料箱列表中");
|
||||||
|
|
||||||
|
var material= await _db.Queryable<BasMaterial>().Where(r => r.id == qcTempControlH.material_id).FirstAsync();
|
||||||
|
var result = new QcTempControlScanCodeOutput();
|
||||||
|
result.id = qcTempControlD.id;
|
||||||
|
result.material_code = material?.code;
|
||||||
|
result.material_name = material?.name;
|
||||||
|
result.container_no=material?.container_no;
|
||||||
|
result.material_standard = material?.material_standard;
|
||||||
|
result.material_specification = material?.material_specification;
|
||||||
|
result.unit_code = material?.unit_id;
|
||||||
|
result.code_qty = qcTempControlD.qty;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存挑选合格数量
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dic"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
|
||||||
|
public async Task<string> SaveQualifiedQty(Dictionary<string, string> dic)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var id = dic["id"].ToString();
|
||||||
|
var qualifiedQty = dic["qualifiedQty"].ToString();
|
||||||
|
if (string.IsNullOrEmpty(qualifiedQty))
|
||||||
|
throw Oops.Bah("合格数量不能为空");
|
||||||
|
|
||||||
|
//先保存不合格数量,修改状态为让步接收,改变对应载具台账的检验状态为合格,并生成对应料箱的8号线入库任务
|
||||||
|
var qcTempControlD = await _db.Queryable<QcTempControlD>().Where(r => r.id == id).FirstAsync();
|
||||||
|
if (qcTempControlD == null)
|
||||||
|
throw Oops.Bah($"数据不存在");
|
||||||
|
|
||||||
|
if (qcTempControlD.pick_status == "已挑选")
|
||||||
|
throw Oops.Bah("已挑选,不能重复挑选");
|
||||||
|
|
||||||
|
var qctempControlH=await _db.Queryable<QcTempControlH>().Where(r=>r.id==qcTempControlD.bill_id).FirstAsync();
|
||||||
|
//计算不合格数量
|
||||||
|
var unQualifiedQty = (string.IsNullOrEmpty(qcTempControlD.qty) ? 0 : Convert.ToDecimal(qcTempControlD.qty)) - (Convert.ToDecimal(qualifiedQty));
|
||||||
|
await _db.Ado.BeginTranAsync();
|
||||||
|
//修改对应暂控子表的不合格数量和挑选状态
|
||||||
|
await _db.Updateable<QcTempControlD>()
|
||||||
|
.SetColumns(r => r.qualified_qty == qualifiedQty)
|
||||||
|
.SetColumns(r=>r.unqualified_qty== unQualifiedQty.ToString())
|
||||||
|
.SetColumns(r => r.pick_status == "已挑选")
|
||||||
|
.SetColumns(r=>r.check_status=="让步接收")
|
||||||
|
.Where(r => r.id == qcTempControlD.id).ExecuteCommandAsync();
|
||||||
|
//更新对应载具台账的检验状态为合格
|
||||||
|
await _db.Updateable<WmsCarryH>().SetColumns(r => r.is_check == ((int)EnumCheckConclusion.合格).ToString()).Where(r => r.id == qcTempControlD.carry_id).ExecuteCommandAsync();
|
||||||
|
//更新对应载具条码表的条码数量为挑选好的合格数量
|
||||||
|
await _db.Updateable<WmsCarryCode>().SetColumns(r => r.codeqty == Convert.ToDecimal(qualifiedQty)).Where(r => r.carry_id == qcTempControlD.carry_id && r.material_id == qctempControlH.material_id).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
#region 生成8号线入库任务
|
||||||
|
|
||||||
|
//入库取终点
|
||||||
|
InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = qcTempControlD.warehouse_id, Size = 1 };
|
||||||
|
List<BasLocation> endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
|
||||||
|
WmsPointH? sPoint = null;
|
||||||
|
WmsPointH? ePoint = null;
|
||||||
|
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == qcTempControlD.warehouse_id);
|
||||||
|
if (sPoint == null)
|
||||||
|
throw Oops.Bah($"起始库位不可用");
|
||||||
|
if (endLocations?.Count > 0)
|
||||||
|
{
|
||||||
|
WmsCarryH carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == qcTempControlD.carry_id);
|
||||||
|
BasLocation loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == endLocations[0].id);
|
||||||
|
bool isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc);
|
||||||
|
if (!isMatch)
|
||||||
|
{
|
||||||
|
throw new AppFriendlyException("库位与载具规格不匹配", 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == endLocations[0].id);
|
||||||
|
}
|
||||||
|
if (ePoint == null)
|
||||||
|
throw Oops.Bah("无可用的目标库位");
|
||||||
|
|
||||||
|
List<WmsPointH> points = new List<WmsPointH>();
|
||||||
|
if (sPoint.area_code != ePoint.area_code)
|
||||||
|
{
|
||||||
|
points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||||
|
if (points.Count <= 2)
|
||||||
|
{
|
||||||
|
throw new AppFriendlyException($"sPoint {sPoint.point_code} ePoint{ePoint.point_code}该路径不存在", 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
points.Add(sPoint);
|
||||||
|
points.Add(ePoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
|
||||||
|
|
||||||
|
List<WmsPretaskH> preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||||
|
{
|
||||||
|
WmsPointH? sPoint = it.FirstOrDefault();
|
||||||
|
WmsPointH? ePoint = it.LastOrDefault();
|
||||||
|
|
||||||
|
WmsPretaskH preTask = new()
|
||||||
|
{
|
||||||
|
org_id = _userManager.User.OrganizeId,
|
||||||
|
startlocation_id = sPoint?.location_id!,
|
||||||
|
startlocation_code = sPoint?.location_code!,
|
||||||
|
endlocation_id = ePoint?.location_id!,
|
||||||
|
endlocation_code = ePoint?.location_code!,
|
||||||
|
start_floor = sPoint?.floor.ToString(),
|
||||||
|
end_floor = ePoint?.floor.ToString(),
|
||||||
|
startpoint_id = sPoint?.id!,
|
||||||
|
startpoint_code = sPoint?.point_code!,
|
||||||
|
endpoint_id = ePoint?.id!,
|
||||||
|
endpoint_code = ePoint?.point_code!,
|
||||||
|
bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(),
|
||||||
|
status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID,
|
||||||
|
biz_type = WmsWareHouseConst.BIZTYPE_TEMPCONTROLINSTOCK_ID,
|
||||||
|
task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID,
|
||||||
|
carry_id = qcTempControlD.carry_id,
|
||||||
|
carry_code = qcTempControlD.carry_code,
|
||||||
|
area_id = sPoint?.area_id!,
|
||||||
|
area_code = it.Key,
|
||||||
|
require_id = qctempControlH?.id,
|
||||||
|
require_code = qctempControlH?.bill_code,
|
||||||
|
create_id = _userManager.UserId,
|
||||||
|
create_time = DateTime.Now,
|
||||||
|
};
|
||||||
|
|
||||||
|
return preTask;
|
||||||
|
}).ToList();
|
||||||
|
bool isOk = await _wareHouseService.GenPreTask(preTasks, null!);
|
||||||
|
if (!isOk)
|
||||||
|
throw Oops.Bah($"生成暂控料入库预任务失败");
|
||||||
|
|
||||||
|
await _db.Updateable<QcTempControlD>().SetColumns(r => r.pre_task_id == preTasks.FirstOrDefault().id).Where(r => r.id == id).ExecuteCommandAsync();
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
await _db.Ado.CommitTranAsync();
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
await _db.Ado.RollbackTranAsync();
|
||||||
|
Log.Error(e.Message, e);
|
||||||
|
throw Oops.Bah(e.Message);
|
||||||
|
}
|
||||||
|
return "保存成功";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 显示已挑选合格数量
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dic"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
|
||||||
|
public async Task<dynamic> ShowPickQualifiedQty(Dictionary<string, string> dic)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var id = dic["id"].ToString();
|
||||||
|
var qcTempControlH = await _db.Queryable<QcTempControlH>().Where(r => r.id == id).FirstAsync();
|
||||||
|
if (qcTempControlH == null)
|
||||||
|
throw Oops.Bah($"数据不存在");
|
||||||
|
|
||||||
|
var qcTempControlDs = await _db.Queryable<QcTempControlD>().Where(r => r.bill_id == id).ToListAsync();
|
||||||
|
|
||||||
|
QcTempControlPickQualifiedQtyOutput result = new QcTempControlPickQualifiedQtyOutput();
|
||||||
|
if (qcTempControlDs != null)
|
||||||
|
{
|
||||||
|
result.temp_control_qty = qcTempControlH.control_qty;
|
||||||
|
result.qualified_qty = qcTempControlDs.Sum(r => (string.IsNullOrEmpty(r.qualified_qty) ? 0 : Convert.ToDecimal(r.qualified_qty))).ToString();
|
||||||
|
result.unQualified_qty = ((string.IsNullOrEmpty(qcTempControlH.control_qty) ? 0 : Convert.ToDecimal(qcTempControlH.control_qty)) - Convert.ToDecimal(result.qualified_qty)).ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result.temp_control_qty = qcTempControlH.control_qty;
|
||||||
|
result.qualified_qty = "0";
|
||||||
|
result.unQualified_qty = "0";
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Log.Error(e.Message, e);
|
||||||
|
throw Oops.Bah(e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 挑选不合格数量完成
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dic"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
|
||||||
|
public async Task<string> SavePickComplete(Dictionary<string, string> dic)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var id = dic["id"].ToString();
|
||||||
|
|
||||||
|
//保存暂控处理单状态为挑选完成之前,需要确保所有的8号线入库任务全部完成,挑选完成之后,对接bip(暂时不对接),把不合格总数量传给BIP;
|
||||||
|
//并且生成一个其它出库(从中储仓出到次品仓),其他入库(从中储仓入到次品仓)任务
|
||||||
|
var qcTempControlH = await _db.Queryable<QcTempControlH>().Where(r => r.id == id).FirstAsync();
|
||||||
|
if (qcTempControlH == null)
|
||||||
|
throw Oops.Bah($"数据不存在");
|
||||||
|
//质检任务主表
|
||||||
|
var qcCheckExecH = await _db.Queryable<QcCheckExecH>().Where(r => r.bill_code == qcTempControlH.source_code).FirstAsync();
|
||||||
|
|
||||||
|
var qcTempControlDs = await _db.Queryable<QcTempControlD>().Where(r => r.bill_id == qcTempControlH.id).ToListAsync();
|
||||||
|
//找到所有的预任务id
|
||||||
|
var pre_task_ids = qcTempControlDs.Where(r => !string.IsNullOrEmpty(r.pre_task_id)).Select(r => r.pre_task_id).Distinct();
|
||||||
|
|
||||||
|
//查找到未完成的任务
|
||||||
|
var wmsDistasks = await _db.Queryable<WmsDistaskH>().Where(r => pre_task_ids.Contains(r.pretask_id) && r.status != WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID).ToListAsync();
|
||||||
|
if (wmsDistasks != null && wmsDistasks.Count > 0)
|
||||||
|
throw Oops.Bah($"还存在未完成的入库任务,挑选完成失败");
|
||||||
|
|
||||||
|
//计算所有合格数量
|
||||||
|
var qualifiedQty = qcTempControlDs.Sum(r => (string.IsNullOrEmpty(r.qualified_qty) ? 0 : Convert.ToDecimal(r.qualified_qty)));
|
||||||
|
|
||||||
|
#region 生产报废记录
|
||||||
|
|
||||||
|
//新增生产报废记录
|
||||||
|
var prdTaskDefect = new PrdMoTaskDefectRecord();
|
||||||
|
//生产工单
|
||||||
|
var prdMo = await _db.Queryable<PrdMo>().LeftJoin<PrdMoTask>((a, b) => a.id == b.mo_id).Where((a, b) => b.mo_task_code == qcTempControlH.pro_task_code).FirstAsync();
|
||||||
|
var prdMoTask = await _db.Queryable<PrdMoTask>().Where(r => r.mo_task_code == qcTempControlH.pro_task_code).FirstAsync();
|
||||||
|
prdTaskDefect.mo_code=prdMo?.mo_code;
|
||||||
|
prdTaskDefect.mo_task_id = prdMoTask?.id;
|
||||||
|
prdTaskDefect.mo_task_code=qcTempControlH.pro_task_code;
|
||||||
|
prdTaskDefect.mo_task_type = prdMo?.mo_type;
|
||||||
|
|
||||||
|
var basMaterial = await _db.Queryable<BasMaterial>().Where(r => r.id == qcTempControlH.material_id).FirstAsync();
|
||||||
|
prdTaskDefect.material_code = basMaterial?.code;
|
||||||
|
prdTaskDefect.material_name=basMaterial?.name;
|
||||||
|
prdTaskDefect.estimated_start_date = prdMoTask?.estimated_start_date;
|
||||||
|
prdTaskDefect.estimated_end_date=prdMoTask?.estimated_end_date;
|
||||||
|
prdTaskDefect.plan_qty = prdMoTask?.plan_qty;
|
||||||
|
prdTaskDefect.scrap_qty = (string.IsNullOrEmpty(qcTempControlH.control_qty) ? 0 : Convert.ToDecimal(qcTempControlH.control_qty)) - qualifiedQty;//暂控数量-合格数量
|
||||||
|
prdTaskDefect.status = prdMoTask?.mo_task_status;
|
||||||
|
prdTaskDefect.eqp_code = prdMoTask == null ? "" : (await _db.Queryable<EqpEquipment>().FirstAsync(it => it.id == prdMoTask.eqp_id))?.code!;
|
||||||
|
prdTaskDefect.mold_name = prdMoTask == null ? "" : (await _db.Queryable<ToolMolds>().FirstAsync(it => it.id == prdMoTask.mold_id))?.mold_name!;
|
||||||
|
prdTaskDefect.create_time = DateTime.Now;
|
||||||
|
prdTaskDefect.create_id = _userManager.UserId;
|
||||||
|
|
||||||
|
await _db.Insertable(prdTaskDefect).ExecuteCommandAsync();
|
||||||
|
//新增生产报废记录子表
|
||||||
|
var prdMoTaskDefectRecordDs = new List<PrdMoTaskDefectRecordD>();
|
||||||
|
foreach(var item in qcTempControlDs)
|
||||||
|
{
|
||||||
|
var prdMoTaskDefectRecordD = new PrdMoTaskDefectRecordD
|
||||||
|
{
|
||||||
|
bill_id = prdTaskDefect.id,
|
||||||
|
source_id = item.id,
|
||||||
|
carry_id = item.carry_id,
|
||||||
|
carry_code = item.carry_code,
|
||||||
|
scrap_qty = ((string.IsNullOrEmpty(item.qty) ? 0 : Convert.ToDecimal(item.qty)) - (string.IsNullOrEmpty(item.qualified_qty) ? 0 : Convert.ToDecimal(item.qualified_qty))).ToString(),
|
||||||
|
submiter_id= item.submiter,
|
||||||
|
maker_id =item.maker_id,
|
||||||
|
make_time= prdTaskDefect.create_time
|
||||||
|
};
|
||||||
|
prdMoTaskDefectRecordDs.Add(prdMoTaskDefectRecordD);
|
||||||
|
}
|
||||||
|
|
||||||
|
await _db.Insertable(prdMoTaskDefectRecordDs).ExecuteCommandAsync();
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//载具台账变为空载具(载具状态:空闲、库位ID清空、检验状态:待检、子表数据清空)
|
||||||
|
|
||||||
|
foreach(var item in qcTempControlDs)
|
||||||
|
{
|
||||||
|
var wmsCarryH = await _db.Queryable<WmsCarryH>().Where(r => r.id == item.carry_id).FirstAsync();
|
||||||
|
wmsCarryH.carry_status = ((int)EnumCarryStatus.空闲).ToString();
|
||||||
|
wmsCarryH.is_check = ((int)EnumCheckConclusion.待检).ToString();
|
||||||
|
wmsCarryH.location_code = "";
|
||||||
|
wmsCarryH.location_id = "";
|
||||||
|
wmsCarryH.is_lock = 0;
|
||||||
|
await _db.Updateable(wmsCarryH).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
await _db.Updateable<WmsCarryH>()
|
||||||
|
.SetColumns(r => r.carry_status == ((int)EnumCarryStatus.空闲).ToString())
|
||||||
|
.SetColumns(r => r.is_check == ((int)EnumCheckConclusion.待检).ToString())
|
||||||
|
.SetColumns(r => r.location_code == "")
|
||||||
|
.SetColumns(r => r.location_id == "")
|
||||||
|
.SetColumns(r => r.is_lock == 0)
|
||||||
|
.Where(r=>r.id==item.carry_id)
|
||||||
|
.ExecuteCommandAsync();
|
||||||
|
|
||||||
|
await _db.Deleteable<WmsCarryCode>().Where(r => r.carry_id == item.carry_id).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
await _db.Ado.CommitTranAsync();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
await _db.Ado.RollbackTranAsync();
|
||||||
|
Log.Error(e.Message, e);
|
||||||
|
throw Oops.Bah(e.Message);
|
||||||
|
}
|
||||||
|
return "保存成功";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
<ProjectReference Include="..\..\taskschedule\Tnb.TaskScheduler\Tnb.TaskScheduler.csproj" />
|
<ProjectReference Include="..\..\taskschedule\Tnb.TaskScheduler\Tnb.TaskScheduler.csproj" />
|
||||||
<ProjectReference Include="..\..\visualdev\Tnb.VisualDev.Engine\Tnb.VisualDev.Engine.csproj" />
|
<ProjectReference Include="..\..\visualdev\Tnb.VisualDev.Engine\Tnb.VisualDev.Engine.csproj" />
|
||||||
<ProjectReference Include="..\..\WarehouseMgr\Tnb.WarehouseMgr.Interfaces\Tnb.WarehouseMgr.Interfaces.csproj" />
|
<ProjectReference Include="..\..\WarehouseMgr\Tnb.WarehouseMgr.Interfaces\Tnb.WarehouseMgr.Interfaces.csproj" />
|
||||||
|
<ProjectReference Include="..\..\WarehouseMgr\Tnb.WarehouseMgr\Tnb.WarehouseMgr.csproj" />
|
||||||
<ProjectReference Include="..\Tnb.QcMgr.Interfaces\Tnb.QcMgr.Interfaces.csproj" />
|
<ProjectReference Include="..\Tnb.QcMgr.Interfaces\Tnb.QcMgr.Interfaces.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -426,6 +426,11 @@ namespace Tnb.WarehouseMgr.Entities.Consts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public const string BIZTYPE_TEMPCONTROLOUTSTOCK_ID = "38027183728661";
|
public const string BIZTYPE_TEMPCONTROLOUTSTOCK_ID = "38027183728661";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 预任务生成业务类型-暂控料入库
|
||||||
|
/// </summary>
|
||||||
|
public const string BIZTYPE_TEMPCONTROLINSTOCK_ID = "38065450570261";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 成品调拨入库
|
/// 成品调拨入库
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -62,6 +62,10 @@ namespace Tnb.WarehouseMgr.Entities.Dto.ErpInputs
|
|||||||
/// 应到货日期
|
/// 应到货日期
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime arrival_date { get; set; }
|
public DateTime arrival_date { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 转库单类型(人工线,自动线)
|
||||||
|
/// </summary>
|
||||||
|
public string transfer_type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 主表主键
|
/// 主表主键
|
||||||
|
|||||||
@@ -10,4 +10,142 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
|||||||
{
|
{
|
||||||
public string? id { get; set; }
|
public string? id { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class TransferInstockDListOutput
|
||||||
|
{
|
||||||
|
public string id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 所属组织
|
||||||
|
/// </summary>
|
||||||
|
public string? org_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 入库单ID
|
||||||
|
/// </summary>
|
||||||
|
public string? bill_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 执行状态
|
||||||
|
/// </summary>
|
||||||
|
public string? status { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物品ID
|
||||||
|
/// </summary>
|
||||||
|
public string? material_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物品代码
|
||||||
|
/// </summary>
|
||||||
|
public string? material_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 单位ID
|
||||||
|
/// </summary>
|
||||||
|
public string? unit_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 单位代码
|
||||||
|
/// </summary>
|
||||||
|
public string? unit_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 入库需求数量
|
||||||
|
/// </summary>
|
||||||
|
public decimal? pr_qty { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 已下发数量
|
||||||
|
/// </summary>
|
||||||
|
public decimal? xf_qty { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 实际入库数量
|
||||||
|
/// </summary>
|
||||||
|
public decimal? qty { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 流程任务Id
|
||||||
|
/// </summary>
|
||||||
|
public string? f_flowtaskid { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 流程引擎Id
|
||||||
|
/// </summary>
|
||||||
|
public string? f_flowid { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 规格型号
|
||||||
|
/// </summary>
|
||||||
|
public string? material_desc { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建用户
|
||||||
|
/// </summary>
|
||||||
|
public string? create_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? create_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改用户
|
||||||
|
/// </summary>
|
||||||
|
public string? modify_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? modify_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 批号
|
||||||
|
/// </summary>
|
||||||
|
public string? pi_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 库存地点
|
||||||
|
/// </summary>
|
||||||
|
public string? stock_location { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// erp_line_pk
|
||||||
|
/// </summary>
|
||||||
|
public string? erp_line_pk { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 行号
|
||||||
|
/// </summary>
|
||||||
|
public string? lineno { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料名称
|
||||||
|
/// </summary>
|
||||||
|
public string? material_name { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 辅助属性
|
||||||
|
/// </summary>
|
||||||
|
public string auxprop { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 辅助属性 供应商
|
||||||
|
/// </summary>
|
||||||
|
public string auxprop_gys { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 辅助属性 小批号
|
||||||
|
/// </summary>
|
||||||
|
public string auxprop_xph { get; set; }
|
||||||
|
public string udi_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料规格
|
||||||
|
/// </summary>
|
||||||
|
public string? material_specification { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料型号(箱号)
|
||||||
|
/// </summary>
|
||||||
|
public string? material_standard { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1019,7 +1019,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
WmsMaterialTransfer wmsMaterialTransfer = new WmsMaterialTransfer();
|
WmsMaterialTransfer wmsMaterialTransfer = new WmsMaterialTransfer();
|
||||||
string Code = await _billRuleService.GetBillNumber("MaterialTransfer");
|
string Code = await _billRuleService.GetBillNumber("MaterialTransfer");
|
||||||
wmsMaterialTransfer.bill_code = Code;
|
wmsMaterialTransfer.bill_code = Code;
|
||||||
wmsMaterialTransfer.status = WmsWareHouseConst.BILLSTATUS_ADD_ID;
|
wmsMaterialTransfer.status = input.transfer_type == "0001H11000000000D32H" ? WmsWareHouseConst.BILLSTATUS_COMPLETE_ID : WmsWareHouseConst.BILLSTATUS_ADD_ID;//转库单类型是人工线的,直接是完成状态
|
||||||
wmsMaterialTransfer.bill_date = DateTime.Now;
|
wmsMaterialTransfer.bill_date = DateTime.Now;
|
||||||
wmsMaterialTransfer.warehouse_outstock = warehouse_outstock.id;
|
wmsMaterialTransfer.warehouse_outstock = warehouse_outstock.id;
|
||||||
wmsMaterialTransfer.warehouse_instock = warehouse_instock.id;
|
wmsMaterialTransfer.warehouse_instock = warehouse_instock.id;
|
||||||
@@ -1088,7 +1088,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
WmsPrdReturnH wmsPrdReturnH = new WmsPrdReturnH();
|
WmsPrdReturnH wmsPrdReturnH = new WmsPrdReturnH();
|
||||||
string Code = await _billRuleService.GetBillNumber("WMSPRDRETURN");
|
string Code = await _billRuleService.GetBillNumber("WMSPRDRETURN");
|
||||||
wmsPrdReturnH.bill_code = Code;
|
wmsPrdReturnH.bill_code = Code;
|
||||||
wmsPrdReturnH.status = WmsWareHouseConst.BILLSTATUS_ADD_ID;
|
wmsPrdReturnH.status = input.transfer_type == "0001H11000000000D32H" ? WmsWareHouseConst.BILLSTATUS_COMPLETE_ID : WmsWareHouseConst.BILLSTATUS_ADD_ID;//转库单类型是人工线的,直接是完成状态
|
||||||
wmsPrdReturnH.warehouse_id = warehouse_instock.id;
|
wmsPrdReturnH.warehouse_id = warehouse_instock.id;
|
||||||
wmsPrdReturnH.create_id = WmsWareHouseConst.ErpUserId;
|
wmsPrdReturnH.create_id = WmsWareHouseConst.ErpUserId;
|
||||||
wmsPrdReturnH.create_time = DateTime.Now;
|
wmsPrdReturnH.create_time = DateTime.Now;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ using Newtonsoft.Json.Linq;
|
|||||||
using NPOI.SS.Formula.Functions;
|
using NPOI.SS.Formula.Functions;
|
||||||
using Senparc.Weixin.MP.AdvancedAPIs.Card;
|
using Senparc.Weixin.MP.AdvancedAPIs.Card;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
|
using Tnb.BasicData.Entities;
|
||||||
using Tnb.EquipMgr;
|
using Tnb.EquipMgr;
|
||||||
using Tnb.EquipMgr.Entities;
|
using Tnb.EquipMgr.Entities;
|
||||||
using Tnb.WarehouseMgr.Entities;
|
using Tnb.WarehouseMgr.Entities;
|
||||||
@@ -75,7 +76,39 @@ namespace Tnb.WarehouseMgr
|
|||||||
var data = JsonConvert.DeserializeObject<dynamic>(json);
|
var data = JsonConvert.DeserializeObject<dynamic>(json);
|
||||||
JArray mainTable = data.list;
|
JArray mainTable = data.list;
|
||||||
|
|
||||||
ISugarQueryable<WmsTransferInstockD> wmsTransferInstockDs = _db.Queryable<WmsTransferInstockD>().Where(r => mainTable.Select(r => r["id"].ToString()).ToList().Contains(r.bill_id));
|
var wmsTransferInstockDs = _db.Queryable<WmsTransferInstockD>().LeftJoin<BasMaterial>((a, b) => a.material_id == b.id).Where((a, b) => mainTable.Select(r => r["id"].ToString()).ToList().Contains(a.bill_id)).Select((a, b) => new TransferInstockDListOutput
|
||||||
|
{
|
||||||
|
id = a.id,
|
||||||
|
org_id = a.org_id,
|
||||||
|
bill_id = a.bill_id,
|
||||||
|
status = a.status,
|
||||||
|
material_id = a.material_id,
|
||||||
|
material_code = a.material_code,
|
||||||
|
unit_id = a.unit_id,
|
||||||
|
unit_code = a.unit_code,
|
||||||
|
pr_qty = a.pr_qty,
|
||||||
|
xf_qty = a.xf_qty,
|
||||||
|
qty = a.qty,
|
||||||
|
f_flowid = a.f_flowid,
|
||||||
|
f_flowtaskid = a.f_flowtaskid,
|
||||||
|
material_desc = a.material_desc,
|
||||||
|
create_id = a.create_id,
|
||||||
|
create_time = a.create_time,
|
||||||
|
modify_id = a.modify_id,
|
||||||
|
modify_time = a.modify_time,
|
||||||
|
pi_code = a.pi_code,
|
||||||
|
stock_location = a.stock_location,
|
||||||
|
erp_line_pk = a.erp_line_pk,
|
||||||
|
lineno = a.lineno,
|
||||||
|
material_name = a.material_name,
|
||||||
|
auxprop = a.auxprop,
|
||||||
|
auxprop_gys = a.auxprop_gys,
|
||||||
|
auxprop_xph = a.auxprop_xph,
|
||||||
|
udi_code = a.udi_code,
|
||||||
|
material_specification = b.material_specification,
|
||||||
|
material_standard = b.material_standard
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
foreach (JObject wmsTransferInstockH in mainTable)
|
foreach (JObject wmsTransferInstockH in mainTable)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -340,6 +340,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
bindCarryCodeInput.location_code = endLocations[0].location_code;
|
bindCarryCodeInput.location_code = endLocations[0].location_code;
|
||||||
bindCarryCodeInput.code_batch = wmsTransferInstockD.pi_code;
|
bindCarryCodeInput.code_batch = wmsTransferInstockD.pi_code;
|
||||||
bindCarryCodeInput.unit_id = basMaterial.unit_id;
|
bindCarryCodeInput.unit_id = basMaterial.unit_id;
|
||||||
|
bindCarryCodeInput.material_specification = wmsTransferInstockD.material_desc;
|
||||||
|
bindCarryCodeInput.container_no=basMaterial.container_no;
|
||||||
|
|
||||||
await _wmsCarryService.BindCarryMaterial(bindCarryCodeInput);
|
await _wmsCarryService.BindCarryMaterial(bindCarryCodeInput);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,8 +142,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
|
|
||||||
List<WmsInstockD> allInstockDetails = await _db.Queryable<WmsInstockD>().Where(it => instock_mains.Select(r => r.id).Contains(it.bill_id)
|
List<WmsInstockD> allInstockDetails = await _db.Queryable<WmsInstockD>().Where(it => instock_mains.Select(r => r.id).Contains(it.bill_id)
|
||||||
&& it.material_id == wmsPurchaseD.material_id && it.code_batch == wmsPurchaseD.code_batch
|
&& it.material_id == wmsPurchaseD.material_id && it.code_batch == wmsPurchaseD.code_batch
|
||||||
&& (!string.IsNullOrEmpty(it.source_detail_id) && it.source_detail_id == wmsPurchaseD.id)).OrderBy(x=>x.id).ToListAsync();
|
&& (string.IsNullOrEmpty(it.source_detail_id) || (!string.IsNullOrEmpty(it.source_detail_id) && it.source_detail_id == wmsPurchaseD.id))).OrderBy(x => x.id).ToListAsync();
|
||||||
|
|
||||||
List<Dictionary<string, object>> requestData = new List<Dictionary<string, object>>();
|
List<Dictionary<string, object>> requestData = new List<Dictionary<string, object>>();
|
||||||
List<string> carryIds = instock_mains.Select(x => x.carry_id).ToList();
|
List<string> carryIds = instock_mains.Select(x => x.carry_id).ToList();
|
||||||
|
|||||||
@@ -190,7 +190,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
["crowno"] = item.lineno,
|
["crowno"] = item.lineno,
|
||||||
["csourcebillhid"] = wmsTransferInstockH?.erp_pk ?? "",
|
["csourcebillhid"] = wmsTransferInstockH?.erp_pk ?? "",
|
||||||
["csourcebillbid"] = wmsTransferInstockD?.erp_line_pk ?? "",
|
["csourcebillbid"] = wmsTransferInstockD?.erp_line_pk ?? "",
|
||||||
["cunitid"] = erpExtendFields.Find(x => x.table_id == item.unit_id)?.cunitid ?? "",
|
//["cunitid"] = erpExtendFields.Find(x => x.table_id == item.unit_id)?.cunitid ?? "",
|
||||||
|
["cunitid"] = null,
|
||||||
["cvendorid"] = erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_id ?? "",
|
["cvendorid"] = erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_id ?? "",
|
||||||
["cvendorvid"] = erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_vid ?? "",
|
["cvendorvid"] = erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_vid ?? "",
|
||||||
["dbizdate"] = date,
|
["dbizdate"] = date,
|
||||||
|
|||||||
Reference in New Issue
Block a user