From 28742d05d04ad9d914575858f43839deeee6b8ed Mon Sep 17 00:00:00 2001 From: majian <780924089@qq.com> Date: Fri, 20 Sep 2024 08:59:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B6=E4=BB=96=E5=87=BA=E5=BA=93=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E3=80=81=E5=8E=9F=E6=9D=90=E6=96=99=E5=88=B0=E4=B8=AD?= =?UTF-8?q?=E5=82=A8=E4=BB=93=E5=85=A5=E5=BA=93=E6=8E=A5=E5=8F=A3=E5=8F=98?= =?UTF-8?q?=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.ProductionMgr/RedisBackGround.cs | 2 +- .../Consts/ModuleConsts.cs | 4 + .../Dto/Inputs/CarryMaterialBindInput.cs | 8 ++ .../Dto/Inputs/OtherOutstockAddDetail.cs | 33 +++++ .../Dto/Inputs/QueryQTCKInput.cs | 24 ++++ .../Entity/OtherOutstockD.cs | 73 +++++++++++ .../Entity/OtherOutstockH.cs | 84 +++++++++++++ .../IOtherOutstockHService.cs | 15 +++ .../Tnb.WarehouseMgr/OtherOutstockHService.cs | 117 ++++++++++++++++++ .../WmsMaterialSignHService.cs | 47 ++++++- .../WmsMaterialTransferService.cs | 47 ++++++- 11 files changed, 448 insertions(+), 6 deletions(-) create mode 100644 WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/OtherOutstockAddDetail.cs create mode 100644 WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/QueryQTCKInput.cs create mode 100644 WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/OtherOutstockD.cs create mode 100644 WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/OtherOutstockH.cs create mode 100644 WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IOtherOutstockHService.cs create mode 100644 WarehouseMgr/Tnb.WarehouseMgr/OtherOutstockHService.cs diff --git a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs index 69fa34c9..ed3235f9 100644 --- a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs +++ b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs @@ -1123,7 +1123,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA // 获取下到输送线9和10的未完成的转库单 List WmsMaterialTransfers = db_Floor2UpMachinecodetimer.Queryable() .InnerJoin((a, b) => a.id == b.bill_id) - .Where((a, b) => (a.warehouse_instock == WmsWareHouseConst.WAREHOUSE_ZCC_ID || a.warehouse_instock == WmsWareHouseConst.WAREHOUSE_HCC_ID) && a.warehouse_outstock == "2" && a.remainbindracknum > 0 + .Where((a, b) => (a.warehouse_instock == WmsWareHouseConst.WAREHOUSE_ZCC_ID || a.warehouse_instock == WmsWareHouseConst.WAREHOUSE_HCC_ID || a.warehouse_instock == WmsWareHouseConst.WAREHOUSE_ZZXBK_ID) && a.warehouse_outstock == "2" && a.remainbindracknum > 0 && b.carry_code == barcode).ToList(); if (WmsMaterialTransfers.Count() == 0) diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ModuleConsts.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ModuleConsts.cs index 2c165edf..5052eca9 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ModuleConsts.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ModuleConsts.cs @@ -243,6 +243,10 @@ public class ModuleConsts /// public const string MODULE_WMSPURCHASE_ID = "29975280336405"; /// + /// 模块标识-其他出库 todo + /// + public const string MODULE_OtherOutstockH_ID = "MODULE_OtherOutstockH_ID"; + /// /// 模块标识-在库物料维护 /// public const string MODULE_WMSINSTKMIN_ID = "27124095468309"; diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/CarryMaterialBindInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/CarryMaterialBindInput.cs index 2f56d492..e89be0ff 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/CarryMaterialBindInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/CarryMaterialBindInput.cs @@ -21,6 +21,14 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs public decimal codeqty { get; set; } public int is_out { get; set; } public string? unit_id { get; set; } + /// + /// 辅助属性(供应商) + /// + public string? auxprop_gys { get; set; } + /// + /// 辅助属性(小批号) + /// + public string? auxprop_xph { get; set; } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/OtherOutstockAddDetail.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/OtherOutstockAddDetail.cs new file mode 100644 index 00000000..a5bd2d3a --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/OtherOutstockAddDetail.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tnb.WarehouseMgr.Entities.Dto.Inputs +{ + public class OtherOutstockAddDetailInput + { + public string? department { get; set; } + public string? salesman { get; set; } + public string? warehouse_code { get; set; } + public string source_id { get; set; } + public string source_detail_id { get; set; } + + public string source_bill_code { get; set; } + public List details { get; set; } + } + public class OtherOutstockAddDetailDetail + { + public string? material_id { get; set; } + public string? material_code { get; set; } + public string? material_name { get; set; } + public string? unit { get; set; } + public decimal? qty { get; set; } + public decimal? actual_outstock_qty { get; set; } + public string batchno { get; set; } + public string auxprop_xph { get; set; } + public string auxprop_gys { get; set; } + + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/QueryQTCKInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/QueryQTCKInput.cs new file mode 100644 index 00000000..747dcbdf --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/QueryQTCKInput.cs @@ -0,0 +1,24 @@ +namespace Tnb.WarehouseMgr.Entities.Dto +{ + /// + /// 库房业务更新输入参数 + /// + public class QueryQTCKInput + { + /// + /// 组织ID + /// + public string org_id { get; set; } + /// + /// 入库仓库 + /// + public string warehouse_instock { get; set; } + /// + /// 出库仓库 + /// + public string warehouse_outstock { get; set; } + + + + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/OtherOutstockD.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/OtherOutstockD.cs new file mode 100644 index 00000000..28a56a4b --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/OtherOutstockD.cs @@ -0,0 +1,73 @@ +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.WarehouseMgr.Entities.Entity +{ + [SugarTable("other_outstock_d")] + public partial class OtherOutstockD : BaseEntity + { + public OtherOutstockD() + { + id = SnowflakeIdHelper.NextId(); + } + + /// + /// 主表id + /// + public string? fk_id { get; set; } + + /// + /// 物料编号 + /// + public string? material_code { get; set; } + /// + /// 物料名称 + /// + public string? material_name { get; set; } + /// + /// 单位 + /// + public string? unit { get; set; } + /// + /// 数量 + /// + public decimal? qty { get; set; } + + /// + /// 实际出库数量 + /// + public decimal? actual_outstock_qty { get; set; } + /// + /// 仓库id + /// + public string? warehouse_id { get; set; } + /// + /// 物料id + /// + public string? material_id { get; set; } + /// + /// 批号 + /// + public string? batchno { get; set; } + /// + /// 辅助属性(小批号) + /// + public string? auxprop_xph { get; set; } + + /// + /// 供应商(辅助属性) + /// + public string? auxprop_gys { get; set; } + + /// + /// 入库数量 + /// + public decimal? rk_qty { get; set; } + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/OtherOutstockH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/OtherOutstockH.cs new file mode 100644 index 00000000..1a5761b3 --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/OtherOutstockH.cs @@ -0,0 +1,84 @@ +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.WarehouseMgr.Entities.Entity +{ + [SugarTable("other_outstock_h")] + public partial class OtherOutstockH : BaseEntity + { + public OtherOutstockH() + { + id = SnowflakeIdHelper.NextId(); + } + + /// + /// 创建用户 + /// + public string create_id { get; set; } = string.Empty; + + /// + /// 创建时间 + /// + public DateTime create_time { get; set; } = DateTime.Now; + + /// + /// 最后修改人员ID + /// + public string? modify_id { get; set; } + + /// + /// 最后修改时间 + /// + public DateTime? modify_time { get; set; } + + /// + /// 所属组织ID + /// + public string? org_id { get; set; } + /// + /// 出库类型 + /// + public string? outstock_type { get; set; } + /// + /// 部门 + /// + public string? department { get; set; } + /// + /// 业务员 + /// + public string? salesman { get; set; } + /// + /// 其他出库单号 + /// + public string? bill_code { get; set; } + /// + /// 下发状态 + /// + public string? issuance_status { get; set; } + /// + /// 出库仓库 + /// + public string? warehouse_code { get; set; } + + /// + /// + /// + public string? source_id { get; set; } + /// + /// + /// + public string? source_bill_code { get; set; } + /// + /// + /// + public string? source_detail_id { get; set; } + + + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IOtherOutstockHService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IOtherOutstockHService.cs new file mode 100644 index 00000000..321655a6 --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IOtherOutstockHService.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using SqlSugar; +using Tnb.WarehouseMgr.Entities.Dto.Inputs; + +namespace Tnb.WarehouseMgr.Interfaces +{ + public interface IOtherOutstockHService + { + Task AddDetail(OtherOutstockAddDetailInput input, ISqlSugarClient dbConn = null); + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr/OtherOutstockHService.cs b/WarehouseMgr/Tnb.WarehouseMgr/OtherOutstockHService.cs new file mode 100644 index 00000000..7e8cff04 --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr/OtherOutstockHService.cs @@ -0,0 +1,117 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; +using JNPF.Common.Core.Manager; +using JNPF.Common.Dtos.VisualDev; +using JNPF.Common.Security; +using JNPF.DependencyInjection; +using JNPF.FriendlyException; +using JNPF.Logging; +using JNPF.Systems.Entitys.System; +using JNPF.Systems.Interfaces.System; +using JNPF.VisualDev; +using Mapster; +using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; +using NPOI.OpenXmlFormats; +using NPOI.OpenXmlFormats.Dml.Diagram; +using Org.BouncyCastle.Utilities.Net; +using SqlSugar; +using Tnb.BasicData.Entities; +using Tnb.Common.Utils; +using Tnb.QcMgr.Entities; +using Tnb.QcMgr.Entities.Enums; +using Tnb.QcMgr.Interfaces; +using Tnb.WarehouseMgr.Entities; +using Tnb.WarehouseMgr.Entities.Consts; +using Tnb.WarehouseMgr.Entities.Dto; +using Tnb.WarehouseMgr.Entities.Dto.Inputs; +using Tnb.WarehouseMgr.Interfaces; +using Tnb.BasicData; +using Tnb.ProductionMgr.Entities.Entity; +using Tnb.WarehouseMgr.Entities.Entity; +using Microsoft.Extensions.Logging; +using Microsoft.AspNetCore.Authorization; +using JNPF.VisualDev.Interfaces; +using JNPF.VisualDev.Entitys; +using static NPOI.HSSF.Util.HSSFColor; + +namespace Tnb.WarehouseMgr +{ + /// + /// 其他出库 + /// + [OverideVisualDev(ModuleConsts.MODULE_OtherOutstockH_ID)] + public class OtherOutstockHService : BaseWareHouseService, IOtherOutstockHService + { + private readonly IBillRullService _billRullService; + private readonly ISqlSugarClient _db; + private readonly IUserManager _userManager; + private readonly IWareHouseService _wareHouseService; + private readonly IRunService _runService; + private readonly IVisualDevService _visualDevService; + public OtherOutstockHService(ISqlSugarRepository repo, IUserManager userManager, IQcCheckPlanService qcCheckPlanService, IBillRullService billRullService, + IWareHouseService wareHouseService, IRunService runService, + IVisualDevService visualDevService) + { + _db = repo.AsSugarClient(); + _userManager = userManager; + _billRullService = billRullService; + _wareHouseService = wareHouseService; + _runService = runService; + _visualDevService = visualDevService; + } + + public async Task AddDetail(OtherOutstockAddDetailInput input, ISqlSugarClient dbConn = null) + { + var db = dbConn; + if (dbConn == null) + db = _db; + + string Code = await _billRullService.GetBillNumber("OtherDeliverySlips"); + OtherOutstockH otherOutstockH = new OtherOutstockH(); + + otherOutstockH.org_id = WmsWareHouseConst.AdministratorOrgId; + otherOutstockH.outstock_type = "其它出库"; + otherOutstockH.bill_code = Code; + otherOutstockH.create_id = _userManager?.User?.Id; + otherOutstockH.create_time = DateTime.Now; + otherOutstockH.department = input.department; + otherOutstockH.salesman = input.salesman; + otherOutstockH.issuance_status = "未下发"; + otherOutstockH.warehouse_code = input.warehouse_code; + otherOutstockH.source_id = input.source_id; + otherOutstockH.source_bill_code = input.source_bill_code; + otherOutstockH.source_detail_id = input.source_detail_id; + + List otherOutstockDs = new List(); + foreach (var detail in input.details.GroupBy(g => new { g.material_id, g.material_code, g.material_name, g.unit, g.batchno })) + { + decimal? qty = detail.Sum(r => r.actual_outstock_qty); + + OtherOutstockD otherOutstockD = new OtherOutstockD(); + otherOutstockD.fk_id = otherOutstockH.id; + otherOutstockD.material_id = detail.Key.material_id; + otherOutstockD.material_code = detail.Key.material_code; + otherOutstockD.material_name = detail.Key.material_name; + otherOutstockD.unit = detail.Key.unit; + otherOutstockD.batchno = detail.Key.batchno; + otherOutstockD.actual_outstock_qty = qty; + otherOutstockD.rk_qty = 0; + otherOutstockD.qty = qty; + otherOutstockD.auxprop_gys = detail.ToList()[0].auxprop_gys; + otherOutstockD.auxprop_xph = detail.ToList()[0].auxprop_xph; + otherOutstockDs.Add(otherOutstockD); + } + + await _db.Insertable(otherOutstockH).ExecuteCommandAsync(); + await _db.Insertable(otherOutstockDs).ExecuteCommandAsync(); + + Logger.LogInformation($"转库单{input.source_bill_code} 生成其它出库单{Code}"); + return true; + } + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialSignHService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialSignHService.cs index 1eaa784b..340d83ca 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialSignHService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialSignHService.cs @@ -46,6 +46,7 @@ namespace Tnb.WarehouseMgr private readonly IWmsPDAScanInStockService _wmsPDAScanInStock; private readonly IWmsCarryUnbindService _wmsCarryUnbindService; private readonly IWareHouseService _wareHouseService; + private readonly IOtherOutstockHService _otherOutstockHService; public WmsMaterialSignHService( ISqlSugarRepository repository, IUserManager userManager, @@ -54,7 +55,8 @@ namespace Tnb.WarehouseMgr IVisualDevService visualDevService, IWmsPDAScanInStockService wmsPDAScanInStock, IWmsCarryUnbindService wmsCarryUnbindService, - IWareHouseService wareHouseService) + IWareHouseService wareHouseService, + IOtherOutstockHService otherOutstockHService) { _db = repository.AsSugarClient(); _userManager = userManager; @@ -64,6 +66,7 @@ namespace Tnb.WarehouseMgr _wmsPDAScanInStock = wmsPDAScanInStock; _wmsCarryUnbindService = wmsCarryUnbindService; _wareHouseService = wareHouseService; + _otherOutstockHService = otherOutstockHService; } /// @@ -125,7 +128,29 @@ namespace Tnb.WarehouseMgr throw new AppFriendlyException($"【MaterialSign】载具{input.carry_code}任务{wmsDistaskH.bill_code}的业务类型异常", 500); } wmsMaterialSignH.biz_type = wmsDistaskH.biz_type; + + // wms其它出库记录主表 + OtherOutstockAddDetailInput otherOutstockAddDetailInput = new OtherOutstockAddDetailInput(); + switch (wmsDistaskH.biz_type) + { + case WmsWareHouseConst.BIZTYPE_WMSMATERIALTRANSFER_ID: + { + WmsMaterialTransferD wmsMaterialTransferD = await _db.Queryable().Where(r => r.id == wmsDistaskH.source_id).FirstAsync(); + WmsMaterialTransfer wmsMaterialTransfer = await _db.Queryable().Where(r => r.id == wmsMaterialTransferD.bill_id).FirstAsync(); + + otherOutstockAddDetailInput.source_detail_id = wmsMaterialTransferD.id; + otherOutstockAddDetailInput.source_id = wmsMaterialTransfer.id; + otherOutstockAddDetailInput.source_bill_code = wmsMaterialTransfer.bill_code; + otherOutstockAddDetailInput.department = ""; + otherOutstockAddDetailInput.salesman = ""; + otherOutstockAddDetailInput.warehouse_code = wmsMaterialTransfer.warehouse_outstock; + break; + } + } + + List wmsMaterialSignDs = new List(); + List details = new List(); await _db.Ado.BeginTranAsync(); foreach (var item in input.details) { @@ -173,6 +198,26 @@ namespace Tnb.WarehouseMgr } await _db.Updateable().SetColumns(r => r.codeqty == wmsCarryCode.codeqty) .Where(r => r.barcode == wmsCarryCode.barcode).ExecuteCommandAsync(); + + // wms其他出库记录明细 + OtherOutstockAddDetailDetail otherOutstockAddDetailDetail = new OtherOutstockAddDetailDetail(); + otherOutstockAddDetailDetail.actual_outstock_qty = item.sign_qty; + otherOutstockAddDetailDetail.auxprop_xph = wmsCarryCode.auxprop_xph; + otherOutstockAddDetailDetail.auxprop_gys = wmsCarryCode.auxprop_gys; + otherOutstockAddDetailDetail.qty = item.sign_qty; + otherOutstockAddDetailDetail.unit = wmsCarryCode.unit_id; + otherOutstockAddDetailDetail.batchno = wmsCarryCode.code_batch; + otherOutstockAddDetailDetail.material_code = basMaterial.code; + otherOutstockAddDetailDetail.material_id = basMaterial.id; + otherOutstockAddDetailDetail.material_name = basMaterial.name; + + details.Add(otherOutstockAddDetailDetail); + } + + if (!string.IsNullOrEmpty(otherOutstockAddDetailInput.warehouse_code)) + { + otherOutstockAddDetailInput.details = details; + await _otherOutstockHService.AddDetail(otherOutstockAddDetailInput, _db); } // 如果没有条码 设置载具状态为空闲 diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs index dd0822b7..724ac44e 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs @@ -442,6 +442,34 @@ namespace Tnb.WarehouseMgr return await ToApiResult(HttpStatusCode.OK, "成功"); } + + [HttpPost, NonUnify, AllowAnonymous] + public async Task QtckList(QueryQTCKInput input) + { + var res = _db.Queryable() + .InnerJoin((a, b) => a.id == b.source_id) + .InnerJoin((a, b, c) => b.source_detail_id == c.id) + .InnerJoin((a, b, c, d) => b.id == d.fk_id) + .WhereIF(!string.IsNullOrEmpty(input.warehouse_outstock), (a, b, c) => a.warehouse_outstock == input.warehouse_outstock) + .WhereIF(!string.IsNullOrEmpty(input.warehouse_instock), (a, b, c) => a.warehouse_instock == input.warehouse_instock) + .Where((a, b, c,d) => d.rk_qty < d.actual_outstock_qty) + .Select((a, b, c, d) => new + { + materialtransfer_billcode = a.bill_code, + otheroutstock_id = b.id, + otheroutstock_billcode = b.bill_code, + outstock_time = b.create_time, + material_id=c.material_id, + material_code=c.material_code, + material_name=c.material_ex, + material_spec=c.material_specification, + unit_code = c.unit_id, + code_batch = c.code_batch, + remainqty = d.actual_outstock_qty - d.rk_qty + }).ToList(); + return await ToApiResult(HttpStatusCode.OK, "成功", res); + } + /// /// PDA操作(8线到中储仓) /// @@ -454,8 +482,17 @@ namespace Tnb.WarehouseMgr { if (string.IsNullOrEmpty(input.source_id)) { - throw new AppFriendlyException("来源单据id不可为空", 500); + throw new AppFriendlyException("来源其它出库单id不可为空", 500); } + + OtherOutstockH otherOutstockH = await _db.Queryable().Where(r => r.id == input.source_id).FirstAsync(); + if (string.IsNullOrEmpty(otherOutstockH.source_detail_id)) + { + throw new AppFriendlyException("来源其它出库单中的转库单明细id为空!", 500); + } + string materialtransferid = otherOutstockH.source_detail_id; + OtherOutstockD otherOutstockD_first = await _db.Queryable().Where(r => r.fk_id == input.source_id).FirstAsync(); + if (input.details.Count == 0) { throw new AppFriendlyException("请先扫描料箱", 500); @@ -474,7 +511,7 @@ namespace Tnb.WarehouseMgr }); await _s_taskExecuteSemaphore_F1ZCCInstock.WaitAsync(); - WmsMaterialTransferD wmsMaterialTransferD = await _db.Queryable().FirstAsync(it => it.id == input.source_id); + WmsMaterialTransferD wmsMaterialTransferD = await _db.Queryable().FirstAsync(it => it.id == materialtransferid); WmsMaterialTransfer wmsMaterialTransfer = await _db.Queryable().FirstAsync(it => it.id == wmsMaterialTransferD.bill_id); if (wmsMaterialTransferD.yxfqty_rk >= wmsMaterialTransferD.qty) @@ -518,7 +555,7 @@ namespace Tnb.WarehouseMgr commonCreatePretaskInput.endlocation_id = endLocation.id; commonCreatePretaskInput.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID; commonCreatePretaskInput.biz_type = WmsWareHouseConst.BIZTYPE_WMSMATERIALTRANSFER_ID; - commonCreatePretaskInput.source_id = input.source_id; + commonCreatePretaskInput.source_id = materialtransferid; commonCreatePretaskInput.carry_id = wmsCarryHs[index].id; commonCreatePretaskInput.carry_code = wmsCarryHs[index].carry_code; commonCreatePretaskInput.isExcuteMission = false; @@ -544,6 +581,8 @@ namespace Tnb.WarehouseMgr carryMaterialDetail.code_batch = wmsMaterialTransferD.code_batch; carryMaterialDetail.barcode = wmsCarryHs[index].carry_code; carryMaterialDetail.unit_id = wmsMaterialTransferD.unit_id; + carryMaterialDetail.auxprop_gys = otherOutstockD_first.auxprop_gys; + carryMaterialDetail.auxprop_xph = otherOutstockD_first.auxprop_xph; carryMaterialDetails.Add(carryMaterialDetail); carryMaterialBindInput.details = carryMaterialDetails; await _wmsCarryBindService.CarryMaterialBind(carryMaterialBindInput, _db); @@ -553,7 +592,7 @@ namespace Tnb.WarehouseMgr } // 更新子表已下发数量 - await _db.Updateable().SetColumns(r => r.yxfqty_rk == r.yxfqty_rk + qty).Where(r => r.id == input.source_id).ExecuteCommandAsync(); + await _db.Updateable().SetColumns(r => r.yxfqty_rk == r.yxfqty_rk + qty).Where(r => r.id == materialtransferid).ExecuteCommandAsync(); await _db.Ado.CommitTranAsync(); }