Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
290
QcMgr/Tnb.QcMgr.Entities/Dto/QcTempControlHOutput.cs
Normal file
290
QcMgr/Tnb.QcMgr.Entities/Dto/QcTempControlHOutput.cs
Normal file
@@ -0,0 +1,290 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.Common.Filter;
|
||||
|
||||
namespace Tnb.QcMgr.Entities.Dto
|
||||
{
|
||||
public class QcTempControlHOutput
|
||||
{
|
||||
public string id { get; set; }
|
||||
/// <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>
|
||||
/// 出库仓库名
|
||||
/// </summary>
|
||||
public string out_warehouse_name { get;set; }
|
||||
/// <summary>
|
||||
/// 入库仓库id
|
||||
/// </summary>
|
||||
public string in_warehouse_id { get; set; }
|
||||
/// <summary>
|
||||
/// 入库仓库名
|
||||
/// </summary>
|
||||
public string in_warehouse_name { get; set; }
|
||||
/// <summary>
|
||||
/// 物料id
|
||||
/// </summary>
|
||||
public string material_id { get; set; }
|
||||
|
||||
public string material_name { get; set;}
|
||||
|
||||
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>
|
||||
/// 记录人名
|
||||
/// </summary>
|
||||
public string loger_name { get;set; }
|
||||
/// <summary>
|
||||
/// 确认人id
|
||||
/// </summary>
|
||||
public string confirmer_id { get; set; }
|
||||
/// <summary>
|
||||
/// 确认人名
|
||||
/// </summary>
|
||||
public string confirmer_name { 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 List<QcTempControlDsOutput> details { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class QcTempControlDsOutput
|
||||
{
|
||||
public string id { get; set; }
|
||||
/// <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>
|
||||
/// 提报人id
|
||||
/// </summary>
|
||||
public string submiter { get;set; }
|
||||
/// <summary>
|
||||
/// 处理人id
|
||||
/// </summary>
|
||||
public string maker_id { get; set; }
|
||||
}
|
||||
|
||||
public class QcTempControlHAppOutput
|
||||
{
|
||||
public string id { get; set; }
|
||||
/// <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>
|
||||
/// 出库仓库名
|
||||
/// </summary>
|
||||
public string out_warehouse_name { get; set; }
|
||||
/// <summary>
|
||||
/// 入库仓库id
|
||||
/// </summary>
|
||||
public string in_warehouse_id { get; set; }
|
||||
/// <summary>
|
||||
/// 入库仓库名
|
||||
/// </summary>
|
||||
public string in_warehouse_name { get; set; }
|
||||
/// <summary>
|
||||
/// 物料id
|
||||
/// </summary>
|
||||
public string material_id { get; set; }
|
||||
|
||||
public string material_name { get; set; }
|
||||
|
||||
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>
|
||||
/// 记录人名
|
||||
/// </summary>
|
||||
public string loger_name { get; set; }
|
||||
/// <summary>
|
||||
/// 确认人id
|
||||
/// </summary>
|
||||
public string confirmer_id { get; set; }
|
||||
/// <summary>
|
||||
/// 确认人名
|
||||
/// </summary>
|
||||
public string confirmer_name { 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 class QcTempControlCallInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 暂控料单据id
|
||||
/// </summary>
|
||||
public string id { get; set; }
|
||||
/// <summary>
|
||||
/// 目标库位
|
||||
/// </summary>
|
||||
public string destination_location_code { get; set; }
|
||||
/// <summary>
|
||||
/// 期望箱数
|
||||
/// </summary>
|
||||
public int box_qty { get; set; }
|
||||
}
|
||||
|
||||
public class QcTempControlScanCodeOutput
|
||||
{
|
||||
/// <summary>
|
||||
/// 暂控子表id
|
||||
/// </summary>
|
||||
public string id { get; set; }
|
||||
public string material_code { get; set; }
|
||||
|
||||
public string material_name { get; set; }
|
||||
/// <summary>
|
||||
/// 箱号
|
||||
/// </summary>
|
||||
public string container_no { get; set; }
|
||||
/// <summary>
|
||||
/// 规格规格
|
||||
/// </summary>
|
||||
public string material_specification { get; set; }
|
||||
/// <summary>
|
||||
/// 物料规格型号
|
||||
/// </summary>
|
||||
public string material_standard { get; set; }
|
||||
/// <summary>
|
||||
/// 条码数量
|
||||
/// </summary>
|
||||
public string code_qty { get; set; }
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
public string unit_code { get; set; }
|
||||
/// <summary>
|
||||
/// 暂控数量
|
||||
/// </summary>
|
||||
public decimal? control_qty { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -122,7 +122,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto.ErpInputs
|
||||
/// </summary>
|
||||
public string? erp_pk { get; set; }
|
||||
|
||||
public List<PurchaseOrderUpdateDetail> details { get; set; }
|
||||
public List<PurchaseOrderDetail> details { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -16,6 +16,6 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
||||
/// <summary>
|
||||
/// 条码数量
|
||||
/// </summary>
|
||||
public int code_qty { get; set; }
|
||||
public decimal code_qty { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,10 @@
|
||||
/// </summary>
|
||||
public string? startlocation_id { get; set; }
|
||||
/// <summary>
|
||||
/// 起点code
|
||||
/// </summary>
|
||||
public string? startlocation_code { get; set; }
|
||||
/// <summary>
|
||||
/// 需求单据
|
||||
/// </summary>
|
||||
public string? source_id { get; set; }
|
||||
|
||||
@@ -628,27 +628,95 @@ namespace Tnb.WarehouseMgr
|
||||
_LoggerErp2Mes.LogWarning($"【PurchaseOrderUpdateInput】未找到采购订单,erp_pk:{input.erp_pk}");
|
||||
throw new AppFriendlyException($@"未找到采购订单,erp_pk:{input.erp_pk}!", 500);
|
||||
}
|
||||
//先删除所有的子表数据
|
||||
await db.Deleteable<WmsPurchaseOrderD>().Where(r => r.fk_wms_purchase_order_id == wmsPurchaseOrderH.id).ExecuteCommandAsync();
|
||||
|
||||
if(input.details!=null && input.details.Count > 0)
|
||||
{
|
||||
foreach(var item in input.details)
|
||||
|
||||
List<WmsPurchaseOrderD> wmsPurchaseOrderDs = new List<WmsPurchaseOrderD>();
|
||||
foreach (var detail in input.details)
|
||||
{
|
||||
WmsPurchaseOrderD wmsPurchaseOrderD = await db.Queryable<WmsPurchaseOrderD>().Where(r => r.fk_wms_purchase_order_id == wmsPurchaseOrderH.id && r.erp_line_pk == item.erp_line_pk).FirstAsync();
|
||||
if(wmsPurchaseOrderD==null)
|
||||
WmsPurchaseOrderD wmsPurchaseOrderD = new WmsPurchaseOrderD();
|
||||
|
||||
wmsPurchaseOrderD.fk_wms_purchase_order_id = wmsPurchaseOrderH.id;
|
||||
wmsPurchaseOrderD.matcode = detail.material_code;
|
||||
wmsPurchaseOrderD.unit = detail.unit_code;
|
||||
|
||||
var erpExtendField = await db.Queryable<ErpExtendField>().InnerJoin<DictionaryDataEntity>((a, b) => a.table_id == b.Id).Where((a, b) => a.cunitid == detail.unit_code).Select((a, b) => b).FirstAsync();
|
||||
if (erpExtendField != null)
|
||||
{
|
||||
_LoggerErp2Mes.LogWarning($"【PurchaseOrderUpdateInput】未找到采购订单明细数据,erp_pk:{input.erp_pk},erp_line_pk:{item.erp_line_pk}");
|
||||
throw new AppFriendlyException($@"未找到采购订单明细数据,erp_pk:{input.erp_pk},erp_line_pk{item.erp_line_pk}!", 500);
|
||||
wmsPurchaseOrderD.unit_id = erpExtendField.Id;
|
||||
wmsPurchaseOrderD.unit = erpExtendField.EnCode;
|
||||
}
|
||||
else
|
||||
{
|
||||
await db.Updateable<WmsPurchaseOrderD>()
|
||||
.SetColumns(r => r.net_price == item.net_price)
|
||||
.SetColumns(r => r.purchase_quantity == item.purchase_quantity)
|
||||
.SetColumns(r => r.actual_quantity == item.actual_quantity)
|
||||
.Where(r => r.id == wmsPurchaseOrderD.id).ExecuteCommandAsync();
|
||||
_LoggerErp2Mes.LogWarning($@"【PurchaseOrder】表体明细中单位{detail.unit_code}在wms系统中未找到!");
|
||||
throw new AppFriendlyException($@"表体明细中单位{detail.unit_code}在wms系统中未找到!", 500);
|
||||
}
|
||||
|
||||
wmsPurchaseOrderD.purchase_quantity = detail.purchase_quantity;
|
||||
wmsPurchaseOrderD.stock_location = detail.stock_location;
|
||||
wmsPurchaseOrderD.code_batch = detail.code_batch;
|
||||
wmsPurchaseOrderD.delivery_date = detail.delivery_date.Value.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
wmsPurchaseOrderD.erp_line_pk = detail.erp_line_pk;
|
||||
wmsPurchaseOrderD.create_id = WmsWareHouseConst.ErpUserId;
|
||||
wmsPurchaseOrderD.create_time = DateTime.Now;
|
||||
wmsPurchaseOrderD.actual_quantity = 0;
|
||||
wmsPurchaseOrderD.lineno = detail.lineno;
|
||||
wmsPurchaseOrderD.gift = detail.gift;
|
||||
wmsPurchaseOrderD.production_unit = detail.production_unit;
|
||||
|
||||
var material = await db.Queryable<BasMaterial>().Where(p => p.code == detail.material_code).FirstAsync();
|
||||
if (material != null)
|
||||
{
|
||||
wmsPurchaseOrderD.matcode_id = material.id;
|
||||
wmsPurchaseOrderD.material_specification = material.material_specification;
|
||||
wmsPurchaseOrderD.material_standard = material.material_standard;
|
||||
}
|
||||
|
||||
var gys_erpExtendField = await db.Queryable<ErpExtendField>().Where(a => a.supplier_id == detail.auxprop_gys).FirstAsync();
|
||||
if (gys_erpExtendField != null)
|
||||
{
|
||||
wmsPurchaseOrderD.auxprop_gys = gys_erpExtendField.table_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
_LoggerErp2Mes.LogWarning($@"【PurchaseOrder】表体明细中组织{detail.auxprop_gys}在wms系统中未找到!");
|
||||
throw new AppFriendlyException($@"表体明细中组织{detail.auxprop_gys}在wms系统中未找到!", 500);
|
||||
}
|
||||
|
||||
wmsPurchaseOrderDs.Add(wmsPurchaseOrderD);
|
||||
}
|
||||
|
||||
await db.Insertable(wmsPurchaseOrderDs).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
|
||||
|
||||
////查出现有的所有子表数据
|
||||
//var nowWmsPurchaseOrderDs = await db.Queryable<WmsPurchaseOrderD>().Where(r => r.fk_wms_purchase_order_id == wmsPurchaseOrderH.id).ToListAsync();
|
||||
|
||||
//if(input.details!=null && input.details.Count > 0)
|
||||
//{
|
||||
// foreach(var item in input.details)
|
||||
// {
|
||||
// WmsPurchaseOrderD wmsPurchaseOrderD = await db.Queryable<WmsPurchaseOrderD>().Where(r => r.fk_wms_purchase_order_id == wmsPurchaseOrderH.id && r.erp_line_pk == item.erp_line_pk).FirstAsync();
|
||||
// if(wmsPurchaseOrderD==null)
|
||||
// {
|
||||
// _LoggerErp2Mes.LogWarning($"【PurchaseOrderUpdateInput】未找到采购订单明细数据,erp_pk:{input.erp_pk},erp_line_pk:{item.erp_line_pk}");
|
||||
// throw new AppFriendlyException($@"未找到采购订单明细数据,erp_pk:{input.erp_pk},erp_line_pk{item.erp_line_pk}!", 500);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// await db.Updateable<WmsPurchaseOrderD>()
|
||||
// .SetColumns(r => r.net_price == item.net_price)
|
||||
// .SetColumns(r => r.purchase_quantity == item.purchase_quantity)
|
||||
// .SetColumns(r => r.actual_quantity == item.actual_quantity)
|
||||
// .Where(r => r.id == wmsPurchaseOrderD.id).ExecuteCommandAsync();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
await db.Ado.CommitTranAsync();
|
||||
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||
|
||||
@@ -186,11 +186,15 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
throw new AppFriendlyException("成品调拨明细id不可为空", 500);
|
||||
}
|
||||
if (string.IsNullOrEmpty(input.startlocation_id))
|
||||
if (string.IsNullOrEmpty(input.startlocation_code))
|
||||
{
|
||||
throw new AppFriendlyException("起点不可为空", 500);
|
||||
}
|
||||
|
||||
var baseLocation = await _db.Queryable<BasLocation>().Where(r => r.location_code == input.startlocation_code).FirstAsync();
|
||||
if (baseLocation == null)
|
||||
throw new AppFriendlyException($"未找到编号{input.startlocation_code}的库位", 500);
|
||||
|
||||
WmsTransferInstockD wmsTransferInstockD = await _db.Queryable<WmsTransferInstockD>().Where(r => r.id == input.source_id).FirstAsync();
|
||||
if (wmsTransferInstockD.status == WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID)
|
||||
{
|
||||
@@ -208,7 +212,7 @@ namespace Tnb.WarehouseMgr
|
||||
WmsPointH sPoint = null!;
|
||||
WmsPointH ePoint = null!;
|
||||
|
||||
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.startlocation_id);
|
||||
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == baseLocation.id);
|
||||
if (endLocations?.Count > 0)
|
||||
{
|
||||
WmsCarryH carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.carry_code == input.carry_code);
|
||||
@@ -303,20 +307,20 @@ namespace Tnb.WarehouseMgr
|
||||
if (endLocationId != null)
|
||||
{
|
||||
//查询库位表
|
||||
BasLocation location = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == input.startlocation_id);
|
||||
BasLocation location = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == baseLocation.id);
|
||||
{
|
||||
//载具加锁,增加库位信息
|
||||
_ = await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH
|
||||
{
|
||||
carry_status = ((int)EnumCarryStatus.占用).ToString(),
|
||||
is_lock = 1,
|
||||
location_id = input.startlocation_id,
|
||||
location_id = baseLocation.id,
|
||||
location_code = location.location_code
|
||||
}).Where(it => it.id == wmsCarryH.id).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
//所有库位加锁
|
||||
string?[] ids = new[] { input.startlocation_id, endLocationId };
|
||||
string?[] ids = new[] { baseLocation.id, endLocationId };
|
||||
_ = await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync();
|
||||
|
||||
BasMaterial basMaterial = await _db.Queryable<BasMaterial>().FirstAsync(it => it.id == input.material_id);
|
||||
|
||||
Reference in New Issue
Block a user