From 260dd5d19539469415d5e58fb20a0b883dbbfc6b Mon Sep 17 00:00:00 2001 From: majian <780924089@qq.com> Date: Thu, 30 May 2024 11:19:11 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=BD=E5=85=B7=E7=BB=91=E5=AE=9A=E7=89=A9?= =?UTF-8?q?=E6=96=99=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dto/Inputs/BindCarryCodeInput.cs | 21 ++++++++++ .../IWmsCarryService.cs | 3 ++ .../Tnb.WarehouseMgr/WareHouseService.cs | 5 +++ .../Tnb.WarehouseMgr/WmsCarryService.cs | 42 +++++++++++++++++++ .../WmsPDACarryBindService.cs | 1 + .../Configurations/ConnectionStrings.json | 4 +- 6 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/BindCarryCodeInput.cs diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/BindCarryCodeInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/BindCarryCodeInput.cs new file mode 100644 index 00000000..59b0a9e2 --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/BindCarryCodeInput.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tnb.WarehouseMgr.Entities.Dto.Inputs +{ + public class BindCarryCodeInput + { + public string carry_id { get; set; } + public string barcode { get; set; } + public decimal codeqty { get; set; } + public string material_id { get; set; } + public string material_code { get; set; } + public string material_name { get; set; } + public string location_id { get; set; } = ""; + public string location_code { get; set; } = ""; + public string code_batch { get; set; } + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryService.cs index f2d67966..4b4b03b1 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryService.cs @@ -1,4 +1,5 @@ using Tnb.WarehouseMgr.Entities; +using Tnb.WarehouseMgr.Entities.Dto.Inputs; namespace Tnb.WarehouseMgr.Interfaces { @@ -13,5 +14,7 @@ namespace Tnb.WarehouseMgr.Interfaces /// /// Task> UpdateNullCarry(WmsCarryH carryObj, Func>? updateTask = null); + + Task BindCarryMaterial(BindCarryCodeInput input); } } \ No newline at end of file diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index 7f59377c..bb5a1ff7 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -288,6 +288,11 @@ namespace Tnb.WarehouseMgr SqlSugarClient cyDb = _db.CopyNew(); + string sss = cyDb.Queryable().LeftJoin((a, b) => a.id == b.carry_id) + .LeftJoin((a, b, c) => a.location_id == c.id) + .Where(whereExpr) + //.OrderByIF((a,b,c)=>SqlFunc.IsNullOrEmpty()) + .OrderBy("a.location_code,layers,loc_line,loc_column").ToSqlString(); List> items = cyDb.Queryable().LeftJoin((a, b) => a.id == b.carry_id) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs index d7e250f7..12bfc821 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs @@ -14,13 +14,16 @@ using JNPF.VisualDev.Interfaces; using Mapster; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; using SqlSugar; +using Tnb.BasicData.Entities; using Tnb.Common.Utils; using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; using Tnb.WarehouseMgr.Entities.Dto.Inputs; using Tnb.WarehouseMgr.Entities.Dto.Outputs; +using Tnb.WarehouseMgr.Entities.Entity; using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Interfaces; @@ -299,5 +302,44 @@ namespace Tnb.WarehouseMgr input.barCodes = input.barCodes.OrderBy(o => o).ToList(); base.BarCodePrint(input.barCodes, input.copies,""); } + + + /// + /// 载具绑定物料 + /// + /// + /// + [HttpPost] + public async Task BindCarryMaterial(BindCarryCodeInput input) + { + try + { + WmsCarryCode wmsCarryCode = new WmsCarryCode(); + wmsCarryCode.org_id = WmsWareHouseConst.AdministratorOrgId; + wmsCarryCode.create_time = DateTime.Now; + wmsCarryCode.carry_id = input.carry_id; + wmsCarryCode.barcode = input.barcode; + wmsCarryCode.codeqty = input.codeqty; + wmsCarryCode.material_id = input.material_id; + wmsCarryCode.material_code = input.material_code; + wmsCarryCode.material_name = input.material_name; + wmsCarryCode.location_id = input.location_id; + wmsCarryCode.location_code = input.location_code; + wmsCarryCode.code_batch = input.code_batch; + await _db.Insertable(wmsCarryCode).ExecuteCommandAsync(); + + // todo 绑定记录表 + + + return await ToApiResult(HttpStatusCode.OK, "成功"); + } + catch (Exception ex) + { + Logger.LogInformation(ex.Message); + Logger.LogInformation(ex.StackTrace); + return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message); + } + } + } } \ No newline at end of file diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs index 52b540bd..3f9fc9f2 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs @@ -308,6 +308,7 @@ namespace Tnb.WarehouseMgr BasMaterial basMaterial = await _db.Queryable().FirstAsync(it => it.id == input.material_id); WmsCarryCode wmsCarryCode = new WmsCarryCode(); + wmsCarryCode.create_time = DateTime.Now; wmsCarryCode.carry_id = wmsCarryH.id; wmsCarryCode.barcode = wmsCarryH.carry_code; wmsCarryCode.codeqty = input.qty; diff --git a/apihost/Tnb.API.Entry/Configurations/ConnectionStrings.json b/apihost/Tnb.API.Entry/Configurations/ConnectionStrings.json index 3195bfb6..cedc7a1b 100644 --- a/apihost/Tnb.API.Entry/Configurations/ConnectionStrings.json +++ b/apihost/Tnb.API.Entry/Configurations/ConnectionStrings.json @@ -2,8 +2,8 @@ "ConnectionStrings": { "ConfigId": "default", "DBType": "PostgreSQL", //MySql;SqlServer;Oracle;PostgreSQL;Dm;Kdbndp;Sqlite; - "Host": "192.168.11.109", - //"Host": "127.0.0.1", + //"Host": "192.168.11.109", + "Host": "127.0.0.1", "Port": "5432", //"DBName": "tianyi_db", //"UserName": "postgres",