载具库存报表导出加规格型号字段;bip异常信息对接接口
This commit is contained in:
@@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||||
|
{
|
||||||
|
public class DeletePrdMoInput
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 工单代码
|
||||||
|
/// </summary>
|
||||||
|
public string mo_code { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 行号
|
||||||
|
/// </summary>
|
||||||
|
public string erp_lineno { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,6 +17,7 @@ using SqlSugar;
|
|||||||
using Tnb.BasicData;
|
using Tnb.BasicData;
|
||||||
using Tnb.BasicData.Entities;
|
using Tnb.BasicData.Entities;
|
||||||
using Tnb.ProductionMgr.Entities;
|
using Tnb.ProductionMgr.Entities;
|
||||||
|
using Tnb.ProductionMgr.Entities.Dto.PrdManage;
|
||||||
using Tnb.ProductionMgr.Entities.Entity;
|
using Tnb.ProductionMgr.Entities.Entity;
|
||||||
using Tnb.WarehouseMgr.Entities.Consts;
|
using Tnb.WarehouseMgr.Entities.Consts;
|
||||||
|
|
||||||
@@ -189,5 +190,210 @@ namespace Tnb.ProductionMgr
|
|||||||
|
|
||||||
return !result.IsSuccess ? result.ErrorMessage : "保存成功";
|
return !result.IsSuccess ? result.ErrorMessage : "保存成功";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 删除生产订单
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[AllowAnonymous]
|
||||||
|
public async Task<string> DelPrdMo(DeletePrdMoInput input)
|
||||||
|
{
|
||||||
|
Log.Information($"删除生产订单接收参数:{JsonConvert.SerializeObject(input)}");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(input.mo_code))
|
||||||
|
throw Oops.Bah("工单代码不能为空");
|
||||||
|
if (string.IsNullOrEmpty(input.erp_lineno))
|
||||||
|
throw Oops.Bah("行号不能为空");
|
||||||
|
var mo_code= input.mo_code + "-" + input.erp_lineno;
|
||||||
|
await _db.Ado.BeginTranAsync();
|
||||||
|
|
||||||
|
PrdMo existMo = await _db.Queryable<PrdMo>().Where(x => x.mo_code == mo_code).FirstAsync();
|
||||||
|
if (existMo != null)
|
||||||
|
{
|
||||||
|
if (existMo.mo_status != DictConst.ToBeScheduledId)
|
||||||
|
{
|
||||||
|
throw Oops.Bah($"【DelPrdMo】生产工单{input.mo_code}状态不是待下发无法删除");
|
||||||
|
}
|
||||||
|
|
||||||
|
await _db.Deleteable<PrdMo>().Where(r => r.id == existMo.id).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw Oops.Bah($"【DelPrdMo】生产工单{input.mo_code}数据不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
await _db.Ado.CommitTranAsync();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
await _db.Ado.RollbackTranAsync();
|
||||||
|
throw Oops.Bah($"{e.Message}");
|
||||||
|
}
|
||||||
|
return "删除成功";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改生产订单
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[AllowAnonymous]
|
||||||
|
public async Task<string> ModifyPrdMo(PrdMo input)
|
||||||
|
{
|
||||||
|
Log.Information($"删除生产订单接收参数:{JsonConvert.SerializeObject(input)}");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(input.mo_code))
|
||||||
|
{
|
||||||
|
Log.Error("【ModifyPrdMo】工单代码不能为空");
|
||||||
|
throw Oops.Bah("工单代码不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(input.mo_type))
|
||||||
|
{
|
||||||
|
Log.Error("【ModifyPrdMo】工单类型不能为空");
|
||||||
|
throw Oops.Bah("工单类型不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input.plan_start_date == null)
|
||||||
|
{
|
||||||
|
Log.Error("【ModifyPrdMo】计划开始日期不能为空");
|
||||||
|
throw Oops.Bah("计划开始日期不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input.plan_end_date == null)
|
||||||
|
{
|
||||||
|
Log.Error("【ModifyPrdMo】计划结束日期不能为空");
|
||||||
|
throw Oops.Bah("计划结束日期不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(input.material_code))
|
||||||
|
{
|
||||||
|
Log.Error("【ModifyPrdMo】物料编号不能为空");
|
||||||
|
throw Oops.Bah("物料编号不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(input.unit_id))
|
||||||
|
{
|
||||||
|
Log.Error("【ModifyPrdMo】单位不能为空");
|
||||||
|
throw Oops.Bah("单位不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input.plan_qty == null || input.plan_qty <= 0)
|
||||||
|
{
|
||||||
|
Log.Error("【ModifyPrdMo】计划数量不能为空");
|
||||||
|
throw Oops.Bah("计划数量不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(input.dept_id))
|
||||||
|
{
|
||||||
|
Log.Error("【ModifyPrdMo】生产部门id不能为空");
|
||||||
|
throw Oops.Bah("生产部门id不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input.ebom_version == null || input.ebom_version.IsEmpty())
|
||||||
|
{
|
||||||
|
Log.Error("【ModifyPrdMo】物料清单版本不能为空");
|
||||||
|
throw Oops.Bah("物料清单版本不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
BasMaterial basMaterial = await _db.Queryable<BasMaterial>().SingleAsync(x => x.code == input.material_code);
|
||||||
|
if (basMaterial == null)
|
||||||
|
{
|
||||||
|
Log.Error($"【ModifyPrdMo】未找到物料编号为{input.material_code}的物料");
|
||||||
|
throw Oops.Bah($"未找到物料编号为{input.material_code}的物料");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<BasMaterialUnit> basMaterialUnits = await _db.Queryable<BasMaterialUnit>().Where(x => x.material_id == basMaterial.id).ToListAsync();
|
||||||
|
List<String> units = basMaterialUnits.Select(x => x.auxiliary_unit_id).Distinct().ToList();
|
||||||
|
if (units != null && !string.IsNullOrEmpty(basMaterial.unit_id)) units.Add(basMaterial.unit_id);
|
||||||
|
|
||||||
|
if (!units.Contains(input.unit_id))
|
||||||
|
{
|
||||||
|
Log.Error($"【ModifyPrdMo】{basMaterial.name}不存在{input.unit_id}该单位");
|
||||||
|
throw Oops.Bah($"{basMaterial.name}不存在{input.unit_id}该单位");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!await _db.Queryable<BasEbomH>().AnyAsync(x => x.material_id == basMaterial.id && x.version == input.ebom_version))
|
||||||
|
{
|
||||||
|
Log.Error($"【ModifyPrdMo】系统中无法找到物料清单{input.ebom_version}版本");
|
||||||
|
throw Oops.Bah($"系统中无法找到物料清单{input.ebom_version}版本");
|
||||||
|
}
|
||||||
|
|
||||||
|
DictionaryDataEntity unitDic = await _db.Queryable<DictionaryDataEntity>().Where(x => x.DictionaryTypeId == WmsWareHouseConst.UNITTYPEID && x.EnCode == input.unit_id).FirstAsync();
|
||||||
|
|
||||||
|
string mocode = input.mo_code + "-" + input.erp_lineno;
|
||||||
|
PrdMo existMo = await _db.Queryable<PrdMo>().Where(x => x.mo_code == mocode).FirstAsync();
|
||||||
|
if (existMo == null)
|
||||||
|
throw Oops.Bah($"【ModifyPrdMo】生产工单{mocode}数据不存在");
|
||||||
|
if (existMo.mo_status != DictConst.ToBeScheduledId)
|
||||||
|
{
|
||||||
|
Log.Error($"【ModifyPrdMo】生产工单{mocode}状态不是待下发,无法修改");
|
||||||
|
throw Oops.Bah($"【ModifyPrdMo】生产工单{mocode}状态不是待下发,无法修改");
|
||||||
|
}
|
||||||
|
var unit_id= unitDic?.EnCode ?? input.unit_id;
|
||||||
|
|
||||||
|
existMo.org_id=input.org_id;
|
||||||
|
existMo.material_code=input.material_code;
|
||||||
|
existMo.mo_type = moTypeDic[input.mo_type];
|
||||||
|
existMo.mo_status = DictConst.ToBeScheduledId;
|
||||||
|
existMo.plan_qty=input.plan_qty;
|
||||||
|
existMo.input_qty=input.input_qty;
|
||||||
|
existMo.complete_qty=input.complete_qty;
|
||||||
|
existMo.reported_work_qty=input.reported_work_qty;
|
||||||
|
existMo.scrap_qty=input.scrap_qty;
|
||||||
|
existMo.plan_start_date=input.plan_start_date;
|
||||||
|
existMo.plan_end_date=input.plan_end_date;
|
||||||
|
existMo.act_start_date = input.act_start_date;
|
||||||
|
existMo.act_end_date = input.act_end_date;
|
||||||
|
existMo.dept_id=input.dept_id;
|
||||||
|
existMo.customer_code=input.customer_code;
|
||||||
|
existMo.order_no=input.order_no;
|
||||||
|
existMo.order_seq=input.order_seq;
|
||||||
|
existMo.bom_version=input.bom_version;
|
||||||
|
existMo.ebom_version=input.ebom_version;
|
||||||
|
existMo.relation_ratio=input.relation_ratio;
|
||||||
|
existMo.mo_down_user_id=input.mo_down_user_id;
|
||||||
|
existMo.mo_down_user_name=input.mo_down_user_name;
|
||||||
|
existMo.mo_down_date=input.mo_down_date;
|
||||||
|
existMo.remark=input.remark;
|
||||||
|
existMo.work_center_code=input.work_center_code;
|
||||||
|
existMo.parent_mo_code=input.parent_mo_code;
|
||||||
|
existMo.seduling_start_date=input.seduling_start_date;
|
||||||
|
existMo.seduling_end_date=input.seduling_end_date;
|
||||||
|
existMo.is_create_dispatch=input.is_create_dispatch;
|
||||||
|
existMo.seq=input.seq;
|
||||||
|
existMo.data_sources=input.data_sources;
|
||||||
|
existMo.production_linecode=input.production_linecode;
|
||||||
|
existMo.is_merge=input.is_merge;
|
||||||
|
existMo.combine_mo_code=existMo.combine_mo_code;
|
||||||
|
existMo.time_stamp=input.time_stamp;
|
||||||
|
existMo.extras=input.extras;
|
||||||
|
existMo.material_id = basMaterial.id;
|
||||||
|
existMo.scheduled_qty=input.scheduled_qty;
|
||||||
|
existMo.parent_id=input.parent_id;
|
||||||
|
existMo.unit_id = unit_id;
|
||||||
|
existMo.mo_source = "1";
|
||||||
|
existMo.erp_lineno=input.erp_lineno;
|
||||||
|
existMo.erp_line_pk=input.erp_line_pk;
|
||||||
|
existMo.erp_mo_pk=input.erp_mo_pk;
|
||||||
|
existMo.mo_category=input.mo_category;
|
||||||
|
|
||||||
|
await _db.Updateable(existMo).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
await _db.Ado.CommitTranAsync();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
await _db.Ado.RollbackTranAsync();
|
||||||
|
throw Oops.Bah($"修改失败:{e.Message}");
|
||||||
|
}
|
||||||
|
return "修改成功";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -100,4 +100,12 @@ namespace Tnb.WarehouseMgr.Entities.Dto.ErpInputs
|
|||||||
public string? warehouse_instock_id { get; set; }
|
public string? warehouse_instock_id { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class TransferOrderDelInput
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 主表主键
|
||||||
|
/// </summary>
|
||||||
|
public string erp_pk { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using JNPF.Common.Contracts;
|
using JNPF.Common.Contracts;
|
||||||
using JNPF.Common.Security;
|
using JNPF.Common.Security;
|
||||||
|
using NPOI.OpenXmlFormats.Dml;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
|
|
||||||
namespace Tnb.WarehouseMgr.Entities;
|
namespace Tnb.WarehouseMgr.Entities;
|
||||||
@@ -412,7 +413,14 @@ public partial class WmsCarryStockReportExcel
|
|||||||
/// 绑定时间
|
/// 绑定时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? bind_time { get; set; }
|
public string? bind_time { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 物料规格
|
||||||
|
/// </summary>
|
||||||
|
public string? material_specification { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 物料型号
|
||||||
|
/// </summary>
|
||||||
|
public string? container_no { get;set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2461,6 +2461,53 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 删除调拨订单
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="AppFriendlyException"></exception>
|
||||||
|
[HttpPost, NonUnify, AllowAnonymous]
|
||||||
|
public async Task<Entities.Dto.Outputs.Result> DelTransferOrder(TransferOrderDelInput input)
|
||||||
|
{
|
||||||
|
LoggerErp2Mes.LogInformation($"【TransferOrderDelInput】ERP传入数据:{JsonConvert.SerializeObject(input)}");
|
||||||
|
var db = _repository.AsSugarClient();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(input.erp_pk))
|
||||||
|
{
|
||||||
|
_LoggerErp2Mes.LogWarning($"【TransferOrderDelInput】主表主键不能为空!");
|
||||||
|
throw new AppFriendlyException($@"主表主键不能为空!", 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
await db.Ado.BeginTranAsync();
|
||||||
|
|
||||||
|
// 判断调拨订单主表是否存在
|
||||||
|
WmsTransferOrderH wmsTransferOrderH = await db.Queryable<WmsTransferOrderH>().Where(r => r.erp_pk == input.erp_pk).FirstAsync();
|
||||||
|
if (wmsTransferOrderH != null)
|
||||||
|
{
|
||||||
|
await db.Deleteable<WmsTransferOrderH>().Where(r => r.id == wmsTransferOrderH.id).ExecuteCommandAsync();
|
||||||
|
await db.Deleteable<WmsTransferOrderD>().Where(r => r.bill_id == wmsTransferOrderH.id).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
await db.Ado.CommitTranAsync();
|
||||||
|
|
||||||
|
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LoggerErp2Mes.LogError($"【TransferOrderDelInput】{ex.Message}");
|
||||||
|
LoggerErp2Mes.LogError($"【TransferOrderDelInput】{ex.StackTrace}");
|
||||||
|
await db.Ado.RollbackTranAsync();
|
||||||
|
return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 材料出库单
|
/// 材料出库单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -272,7 +272,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
material_name = f.name,
|
material_name = f.name,
|
||||||
unit = e.unit_id,
|
unit = e.unit_id,
|
||||||
creator = e.create_id,
|
creator = e.create_id,
|
||||||
bind_time = e.create_time != null ? e.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""
|
bind_time = e.create_time != null ? e.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
|
||||||
|
material_specification= f.material_specification,
|
||||||
|
container_no= f.container_no,
|
||||||
})
|
})
|
||||||
.OrderBy((a) => a.location_code)
|
.OrderBy((a) => a.location_code)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
@@ -314,7 +316,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
material_name = g.name,
|
material_name = g.name,
|
||||||
unit = f.unit_id,
|
unit = f.unit_id,
|
||||||
creator = f.create_id,
|
creator = f.create_id,
|
||||||
bind_time = f.create_time != null ? f.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""
|
bind_time = f.create_time != null ? f.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
|
||||||
|
material_specification=g.material_specification,
|
||||||
|
container_no=g.container_no
|
||||||
})
|
})
|
||||||
.OrderBy((a) => a.location_code)
|
.OrderBy((a) => a.location_code)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
@@ -345,6 +349,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
wmsCarryStockReportCode.unit = x.unit;
|
wmsCarryStockReportCode.unit = x.unit;
|
||||||
//wmsCarryStockReportCode.创建用户 = x.操作用户;
|
//wmsCarryStockReportCode.创建用户 = x.操作用户;
|
||||||
wmsCarryStockReportCode.bind_time = x.bind_time;
|
wmsCarryStockReportCode.bind_time = x.bind_time;
|
||||||
|
wmsCarryStockReportCode.material_specification= x.material_specification;
|
||||||
|
wmsCarryStockReportCode.container_no = x.container_no;
|
||||||
wmsCarryStockReportExcels.Add(wmsCarryStockReportCode);
|
wmsCarryStockReportExcels.Add(wmsCarryStockReportCode);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user