diff --git a/QcMgr/Tnb.QcMgr.Entities/Dto/QcTempControlHOutput.cs b/QcMgr/Tnb.QcMgr.Entities/Dto/QcTempControlHOutput.cs
new file mode 100644
index 00000000..1e995ac5
--- /dev/null
+++ b/QcMgr/Tnb.QcMgr.Entities/Dto/QcTempControlHOutput.cs
@@ -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; }
+ ///
+ /// 单据号
+ ///
+ public string bill_code { get; set; }
+ ///
+ /// 来源单号
+ ///
+ public string source_code { get; set; }
+ ///
+ /// 任务单号
+ ///
+ public string pro_task_code { get; set; }
+ ///
+ /// 出库仓库id
+ ///
+ public string out_warehouse_id { get; set; }
+ ///
+ /// 出库仓库名
+ ///
+ public string out_warehouse_name { get;set; }
+ ///
+ /// 入库仓库id
+ ///
+ public string in_warehouse_id { get; set; }
+ ///
+ /// 入库仓库名
+ ///
+ public string in_warehouse_name { get; set; }
+ ///
+ /// 物料id
+ ///
+ public string material_id { get; set; }
+
+ public string material_name { get; set;}
+
+ public string material_code { get; set; }
+ ///
+ /// 暂控料箱数量
+ ///
+ public string control_lx_qty { get;set; }
+ ///
+ /// 暂控数量
+ ///
+ public string control_qty { get;set; }
+ ///
+ /// 结论
+ ///
+ public string result { get; set; }
+ ///
+ /// 记录人id
+ ///
+ public string loger_id { get; set; }
+ ///
+ /// 记录人名
+ ///
+ public string loger_name { get;set; }
+ ///
+ /// 确认人id
+ ///
+ public string confirmer_id { get; set; }
+ ///
+ /// 确认人名
+ ///
+ public string confirmer_name { get;set;}
+ ///
+ /// 状态
+ ///
+ public string status { get;set; }
+ ///
+ /// 已呼叫箱数
+ ///
+ public string called_box_qty { get; set;}
+ ///
+ /// 已呼叫数量
+ ///
+ public string called_qty { get; set; }
+ ///
+ /// 剩余呼叫箱数
+ ///
+ public string leave_call_box_qty { get;set;}
+
+ ///
+ /// 剩余呼叫数量
+ ///
+ public string leave_call_qty { get; set; }
+
+ public List details { get; set; }
+ }
+
+
+ public class QcTempControlDsOutput
+ {
+ public string id { get; set; }
+ ///
+ /// 主表id
+ ///
+ public string bill_id { get; set; }
+ ///
+ /// 载具id
+ ///
+ public string carry_id { get;set; }
+ ///
+ /// 载具编号
+ ///
+ public string carry_code { get; set; }
+ ///
+ /// 仓库id
+ ///
+ public string warehouse_id { get;set; }
+ ///
+ /// 仓库编号
+ ///
+ public string warehouse_code { get; set; }
+ ///
+ /// 库位id
+ ///
+ public string location_id { get; set; }
+ ///
+ /// 库位编码
+ ///
+ public string location_code { get; set; }
+ ///
+ /// 数量
+ ///
+ public string qty { get; set; }
+ ///
+ /// 提报人id
+ ///
+ public string submiter { get;set; }
+ ///
+ /// 处理人id
+ ///
+ public string maker_id { get; set; }
+ }
+
+ public class QcTempControlHAppOutput
+ {
+ public string id { get; set; }
+ ///
+ /// 单据号
+ ///
+ public string bill_code { get; set; }
+ ///
+ /// 来源单号
+ ///
+ public string source_code { get; set; }
+ ///
+ /// 任务单号
+ ///
+ public string pro_task_code { get; set; }
+ ///
+ /// 出库仓库id
+ ///
+ public string out_warehouse_id { get; set; }
+ ///
+ /// 出库仓库名
+ ///
+ public string out_warehouse_name { get; set; }
+ ///
+ /// 入库仓库id
+ ///
+ public string in_warehouse_id { get; set; }
+ ///
+ /// 入库仓库名
+ ///
+ public string in_warehouse_name { get; set; }
+ ///
+ /// 物料id
+ ///
+ public string material_id { get; set; }
+
+ public string material_name { get; set; }
+
+ public string material_code { get; set; }
+ ///
+ /// 暂控料箱数量
+ ///
+ public string control_lx_qty { get; set; }
+ ///
+ /// 暂控数量
+ ///
+ public string control_qty { get; set; }
+ ///
+ /// 结论
+ ///
+ public string result { get; set; }
+ ///
+ /// 记录人id
+ ///
+ public string loger_id { get; set; }
+ ///
+ /// 记录人名
+ ///
+ public string loger_name { get; set; }
+ ///
+ /// 确认人id
+ ///
+ public string confirmer_id { get; set; }
+ ///
+ /// 确认人名
+ ///
+ public string confirmer_name { get; set; }
+ ///
+ /// 状态
+ ///
+ public string status { get; set; }
+ ///
+ /// 已呼叫箱数
+ ///
+ public string called_box_qty { get; set; }
+ ///
+ /// 已呼叫数量
+ ///
+ public string called_qty { get; set; }
+ ///
+ /// 剩余呼叫箱数
+ ///
+ public string leave_call_box_qty { get; set; }
+
+ ///
+ /// 剩余呼叫数量
+ ///
+ public string leave_call_qty { get; set; }
+ }
+
+ public class QcTempControlCallInput
+ {
+ ///
+ /// 暂控料单据id
+ ///
+ public string id { get; set; }
+ ///
+ /// 目标库位
+ ///
+ public string destination_location_code { get; set; }
+ ///
+ /// 期望箱数
+ ///
+ public int box_qty { get; set; }
+ }
+
+ public class QcTempControlScanCodeOutput
+ {
+ ///
+ /// 暂控子表id
+ ///
+ public string id { get; set; }
+ public string material_code { get; set; }
+
+ public string material_name { get; set; }
+ ///
+ /// 箱号
+ ///
+ public string container_no { get; set; }
+ ///
+ /// 规格规格
+ ///
+ public string material_specification { get; set; }
+ ///
+ /// 物料规格型号
+ ///
+ public string material_standard { get; set; }
+ ///
+ /// 条码数量
+ ///
+ public string code_qty { get; set; }
+ ///
+ /// 单位
+ ///
+ public string unit_code { get; set; }
+ ///
+ /// 暂控数量
+ ///
+ public decimal? control_qty { get; set; }
+
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/ErpInputs/PurchaseOrderInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/ErpInputs/PurchaseOrderInput.cs
index 5af28969..5a52d303 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/ErpInputs/PurchaseOrderInput.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/ErpInputs/PurchaseOrderInput.cs
@@ -122,7 +122,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto.ErpInputs
///
public string? erp_pk { get; set; }
- public List details { get; set; }
+ public List details { get; set; }
}
///
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/BarCodeInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/BarCodeInput.cs
index 9ac3fbee..406a6d2b 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/BarCodeInput.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/BarCodeInput.cs
@@ -16,6 +16,6 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
///
/// 条码数量
///
- public int code_qty { get; set; }
+ public decimal code_qty { get; set; }
}
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/OutsourcedPartsInstockInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/OutsourcedPartsInstockInput.cs
index a954b603..6df2f9ad 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/OutsourcedPartsInstockInput.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/OutsourcedPartsInstockInput.cs
@@ -22,6 +22,10 @@
///
public string? startlocation_id { get; set; }
///
+ /// 起点code
+ ///
+ public string? startlocation_code { get; set; }
+ ///
/// 需求单据
///
public string? source_id { get; set; }
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/ErpToWmsService.cs b/WarehouseMgr/Tnb.WarehouseMgr/ErpToWmsService.cs
index ed53ce90..4ac61682 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/ErpToWmsService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/ErpToWmsService.cs
@@ -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().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 wmsPurchaseOrderDs = new List();
+ foreach (var detail in input.details)
{
- WmsPurchaseOrderD wmsPurchaseOrderD = await db.Queryable().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().InnerJoin((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()
- .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().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().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().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().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()
+ // .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, "成功");
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs
index 85e33fb6..23e4931d 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs
@@ -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().Where(r => r.location_code == input.startlocation_code).FirstAsync();
+ if (baseLocation == null)
+ throw new AppFriendlyException($"未找到编号{input.startlocation_code}的库位", 500);
+
WmsTransferInstockD wmsTransferInstockD = await _db.Queryable().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().FirstAsync(it => it.location_id == input.startlocation_id);
+ sPoint = await _db.Queryable().FirstAsync(it => it.location_id == baseLocation.id);
if (endLocations?.Count > 0)
{
WmsCarryH carry = await _db.Queryable().SingleAsync(it => it.carry_code == input.carry_code);
@@ -303,20 +307,20 @@ namespace Tnb.WarehouseMgr
if (endLocationId != null)
{
//查询库位表
- BasLocation location = await _db.Queryable().SingleAsync(it => it.id == input.startlocation_id);
+ BasLocation location = await _db.Queryable().SingleAsync(it => it.id == baseLocation.id);
{
//载具加锁,增加库位信息
_ = await _db.Updateable().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().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync();
BasMaterial basMaterial = await _db.Queryable().FirstAsync(it => it.id == input.material_id);