From 44cd0fcf8cec49c34814dbf99cb415a211cedead Mon Sep 17 00:00:00 2001 From: fei550 <1420031550@qq.com> Date: Mon, 18 May 2026 21:28:56 +0800 Subject: [PATCH] =?UTF-8?q?feat(clgl):=20=E6=96=B0=E5=A2=9E=E5=85=A5?= =?UTF-8?q?=E5=BA=93=E6=9D=90=E6=96=99=E6=9D=A1=E5=BD=A2=E7=A0=81=E6=89=93?= =?UTF-8?q?=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 生成入库单时同步生成入库材料条形码明细,并在入库单管理中支持整单和单条条形码打印。 --- ...B_V2026-05-18-lpf(Tw_InputDetailBarCode).sql | 18 ++ SGGL/BLL/BLL.csproj | 1 + SGGL/BLL/CLGL/TwInputdetailBarCodeService.cs | 123 +++++++++++++ SGGL/BLL/CLGL/TwInputdetailService.cs | 3 +- SGGL/BLL/CLGL/TwInputmasterService.cs | 4 +- SGGL/FineUIPro.Web/CLGL/InputMaster.aspx | 106 +++++++---- SGGL/FineUIPro.Web/CLGL/InputMaster.aspx.cs | 78 +++++++- .../CLGL/InputMaster.aspx.designer.cs | 40 +++- .../File/Fastreport/材料入库条码.frx | 41 +++++ SGGL/FineUIPro.Web/FineUIPro.Web.csproj | 3 +- .../Model/CLGL/Tw_InputDetailBarCodeOutput.cs | 14 ++ SGGL/Model/Model.cs | 172 +++++++++++++++++- SGGL/Model/Model.csproj | 3 +- 13 files changed, 563 insertions(+), 43 deletions(-) create mode 100644 DataBase/版本日志/SGGLDB_V2026-05-18-lpf(Tw_InputDetailBarCode).sql create mode 100644 SGGL/BLL/CLGL/TwInputdetailBarCodeService.cs create mode 100644 SGGL/FineUIPro.Web/File/Fastreport/材料入库条码.frx create mode 100644 SGGL/Model/CLGL/Tw_InputDetailBarCodeOutput.cs diff --git a/DataBase/版本日志/SGGLDB_V2026-05-18-lpf(Tw_InputDetailBarCode).sql b/DataBase/版本日志/SGGLDB_V2026-05-18-lpf(Tw_InputDetailBarCode).sql new file mode 100644 index 00000000..6044ce6a --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2026-05-18-lpf(Tw_InputDetailBarCode).sql @@ -0,0 +1,18 @@ +IF OBJECT_ID(N'dbo.Tw_InputDetailBarCode', N'U') IS NULL +BEGIN + CREATE TABLE dbo.Tw_InputDetailBarCode + ( + Id NVARCHAR(50) NOT NULL, + InputDetailId NVARCHAR(50) NOT NULL, + InputMasterId NVARCHAR(50) NOT NULL, + MaterialCode NVARCHAR(50) NULL, + BarCode NVARCHAR(500) NULL, + CONSTRAINT PK_Tw_InputDetailBarCode PRIMARY KEY CLUSTERED (Id ASC) + ); + + CREATE NONCLUSTERED INDEX IX_Tw_InputDetailBarCode_InputMasterId + ON dbo.Tw_InputDetailBarCode(InputMasterId); + + CREATE NONCLUSTERED INDEX IX_Tw_InputDetailBarCode_InputDetailId + ON dbo.Tw_InputDetailBarCode(InputDetailId); +END; diff --git a/SGGL/BLL/BLL.csproj b/SGGL/BLL/BLL.csproj index 4c850d36..a05334c6 100644 --- a/SGGL/BLL/BLL.csproj +++ b/SGGL/BLL/BLL.csproj @@ -292,6 +292,7 @@ + diff --git a/SGGL/BLL/CLGL/TwInputdetailBarCodeService.cs b/SGGL/BLL/CLGL/TwInputdetailBarCodeService.cs new file mode 100644 index 00000000..39b92a64 --- /dev/null +++ b/SGGL/BLL/CLGL/TwInputdetailBarCodeService.cs @@ -0,0 +1,123 @@ +using FineUIPro; +using Model; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace BLL +{ + public static class TwInputdetailBarCodeService + { + public static int Count + { + get; + set; + } + + public static IEnumerable GetListData(Tw_InputDetailBarCodeOutput table, Grid grid1) + { + List list = GetListData(table); + Count = list.Count; + if (Count == 0) + { + return null; + } + return list.Skip(grid1.PageSize * grid1.PageIndex).Take(grid1.PageSize); + } + + public static List GetListData(Tw_InputDetailBarCodeOutput table) + { + var q = from x in Funs.DB.Tw_InputDetailBarCode + join master in Funs.DB.Tw_InputMaster on x.InputMasterId equals master.Id into masters + from master in masters.DefaultIfEmpty() + join mat in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals mat.MaterialCode into mats + from mat in mats.DefaultIfEmpty() + where + (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && + (string.IsNullOrEmpty(table.InputDetailId) || x.InputDetailId.Contains(table.InputDetailId)) && + (string.IsNullOrEmpty(table.InputMasterId) || x.InputMasterId.Contains(table.InputMasterId)) && + (string.IsNullOrEmpty(table.MaterialCode) || x.MaterialCode.Contains(table.MaterialCode)) + orderby master.CusBillCode, x.MaterialCode, x.Id + select new Tw_InputDetailBarCodeOutput + { + Id = x.Id, + InputDetailId = x.InputDetailId, + InputMasterId = x.InputMasterId, + CusBillCode = master.CusBillCode, + MaterialCode = x.MaterialCode, + MaterialName = mat.MaterialName, + MaterialDef = mat.MaterialDef, + BarCode = x.BarCode + }; + + return q.ToList(); + } + + public static void AddByInputDetail(Tw_InputMaster inputMaster, Tw_InputDetail inputDetail) + { + if (inputMaster == null || inputDetail == null) + { + return; + } + if (IsExist(inputDetail.Id)) + { + return; + } + + string id = SQLHelper.GetNewID(); + Tw_InputDetailBarCode table = new Tw_InputDetailBarCode + { + Id = id, + InputDetailId = inputDetail.Id, + InputMasterId = inputMaster.Id, + MaterialCode = inputDetail.MaterialCode, + BarCode = BuildBarCode(inputMaster, inputDetail, id) + }; + Funs.DB.Tw_InputDetailBarCode.InsertOnSubmit(table); + Funs.DB.SubmitChanges(); + } + + public static void DeleteByInputMasterId(string inputMasterId) + { + if (string.IsNullOrEmpty(inputMasterId)) + { + return; + } + + var list = Funs.DB.Tw_InputDetailBarCode.Where(x => x.InputMasterId == inputMasterId).ToList(); + if (list.Count > 0) + { + Funs.DB.Tw_InputDetailBarCode.DeleteAllOnSubmit(list); + Funs.DB.SubmitChanges(); + } + } + + public static void DeleteByInputDetailId(string inputDetailId) + { + if (string.IsNullOrEmpty(inputDetailId)) + { + return; + } + + var list = Funs.DB.Tw_InputDetailBarCode.Where(x => x.InputDetailId == inputDetailId).ToList(); + if (list.Count > 0) + { + Funs.DB.Tw_InputDetailBarCode.DeleteAllOnSubmit(list); + Funs.DB.SubmitChanges(); + } + } + + private static bool IsExist(string inputDetailId) + { + return Funs.DB.Tw_InputDetailBarCode.Any(x => x.InputDetailId == inputDetailId); + } + /// + /// 入库材料条形码生成规则,后续调整条形码内容只需修改此方法。 + /// + public static string BuildBarCode(Tw_InputMaster inputMaster, Tw_InputDetail inputDetail, string barCodeDetailId) + { + return "IB" + barCodeDetailId.Replace("-", string.Empty).ToUpperInvariant(); + } + } +} + diff --git a/SGGL/BLL/CLGL/TwInputdetailService.cs b/SGGL/BLL/CLGL/TwInputdetailService.cs index a0c62e0e..4ac4a4e3 100644 --- a/SGGL/BLL/CLGL/TwInputdetailService.cs +++ b/SGGL/BLL/CLGL/TwInputdetailService.cs @@ -117,6 +117,7 @@ namespace BLL Model.Tw_InputDetail table = Funs.DB.Tw_InputDetail.FirstOrDefault(x => x.Id == Id); if (table != null) { + TwInputdetailBarCodeService.DeleteByInputDetailId(Id); Funs.DB.Tw_InputDetail.DeleteOnSubmit(table); Funs.DB.SubmitChanges(); } @@ -143,4 +144,4 @@ namespace BLL return q; } } -} \ No newline at end of file +} diff --git a/SGGL/BLL/CLGL/TwInputmasterService.cs b/SGGL/BLL/CLGL/TwInputmasterService.cs index 261f6d61..e835407a 100644 --- a/SGGL/BLL/CLGL/TwInputmasterService.cs +++ b/SGGL/BLL/CLGL/TwInputmasterService.cs @@ -288,6 +288,7 @@ namespace BLL SortIndex = detail.SortIndex, }; TwInputdetailService.Add(detailTable); + TwInputdetailBarCodeService.AddByInputDetail(master, detailTable); TwMaterialstockService.UpdateStockNum(master.ProjectId, detail.MaterialCode, master.WarehouseCode, TwConst.InOutType.入库, detailTable.ActNum); } @@ -319,6 +320,7 @@ namespace BLL { return; } + TwInputdetailBarCodeService.DeleteByInputMasterId(master.Id); DeleteById(master.Id); //删除入库单 //删除明细 Tw_InOutDetailOutput queryDetail = new Tw_InOutDetailOutput(); @@ -369,4 +371,4 @@ namespace BLL } } -} \ No newline at end of file +} diff --git a/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx b/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx index 6c2ec783..8a0923cd 100644 --- a/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx +++ b/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx @@ -98,6 +98,7 @@ FieldType="String" HeaderText="备注" TextAlign="Left" HeaderTextAlign="Center"> + @@ -125,40 +126,77 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx.cs b/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx.cs index 030755e4..a8f8f4ce 100644 --- a/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx.cs +++ b/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx.cs @@ -64,6 +64,8 @@ namespace FineUIPro.Web.CLGL Grid2.DataSource = null; Grid2.DataBind(); + Grid3.DataSource = null; + Grid3.DataBind(); } private void BindDetailGrid(string inputMasterId) { @@ -93,6 +95,15 @@ namespace FineUIPro.Web.CLGL Grid2.SummaryData = summary; } + + private void BindBarCodeGrid(string inputMasterId) + { + Model.Tw_InputDetailBarCodeOutput table = new Model.Tw_InputDetailBarCodeOutput(); + table.InputMasterId = inputMasterId; + var tb = BLL.TwInputdetailBarCodeService.GetListData(table, Grid3); + Grid3.DataSource = tb; + Grid3.DataBind(); + } #endregion #region GV 数据操作 @@ -134,6 +145,7 @@ namespace FineUIPro.Web.CLGL { string ID = Grid1.DataKeys[e.RowIndex][0].ToString(); BindDetailGrid(ID); + BindBarCodeGrid(ID); } } /// @@ -321,7 +333,71 @@ namespace FineUIPro.Web.CLGL { Print(e.RowID); } + else if (e.CommandName == "btnInputBarCodePrint") + { + PrintInputBarCode(e.RowID, string.Empty); + } } + + protected void Grid3_RowCommand(object sender, GridCommandEventArgs e) + { + if (e.CommandName == "btnBarCodePrint") + { + PrintInputBarCode(string.Empty, e.RowID); + } + } + + protected void TabStrip1_TabIndexChanged(object sender, EventArgs e) + { + if (!string.IsNullOrEmpty(Grid1.SelectedRowID)) + { + if (TabStrip1.ActiveTabIndex == 0) + { + BindDetailGrid(Grid1.SelectedRowID); + } + else if (TabStrip1.ActiveTabIndex == 1) + { + BindBarCodeGrid(Grid1.SelectedRowID); + } + } + } + + private void PrintInputBarCode(string inputMasterId, string barCodeId) + { + if (string.IsNullOrEmpty(inputMasterId) && string.IsNullOrEmpty(barCodeId)) + { + ShowNotify("请选择要打印的项", MessageBoxIcon.Warning); + return; + } + + BLL.FastReportService.ResetData(); + var query = new Tw_InputDetailBarCodeOutput + { + Id = barCodeId, + InputMasterId = inputMasterId + }; + var list = TwInputdetailBarCodeService.GetListData(query); + if (list == null || list.Count == 0) + { + ShowNotify("未找到入库条码明细,请确认已生成入库单并已创建条码明细表。", MessageBoxIcon.Warning); + return; + } + + DataTable table = LINQToDataTable(list); + if (table != null) + { + table.TableName = "Table1"; + } + BLL.FastReportService.AddFastreportTable(table); + + string rootPath = Server.MapPath("~/"); + string initTemplatePath = "File\\Fastreport\\材料入库条码.frx"; + if (File.Exists(rootPath + initTemplatePath)) + { + PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("~/Controls/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath))); + } + } + private void Print(string Id) { BLL.FastReportService.ResetData(); @@ -432,4 +508,4 @@ namespace FineUIPro.Web.CLGL } } } -} \ No newline at end of file +} diff --git a/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx.designer.cs b/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx.designer.cs index a6ae6de4..08d067ad 100644 --- a/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/CLGL/InputMaster.aspx.designer.cs @@ -159,13 +159,22 @@ namespace FineUIPro.Web.CLGL protected global::FineUIPro.Panel panelBottomRegion; /// - /// Panel3 控件。 + /// TabStrip1 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUIPro.Panel Panel3; + protected global::FineUIPro.TabStrip TabStrip1; + + /// + /// TabDetail 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Tab TabDetail; /// /// Grid2 控件。 @@ -185,6 +194,33 @@ namespace FineUIPro.Web.CLGL /// protected global::System.Web.UI.WebControls.Label Label1; + /// + /// TabInputDetailBarCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Tab TabInputDetailBarCode; + + /// + /// Grid3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid3; + + /// + /// Label2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Label2; + /// /// Window1 控件。 /// diff --git a/SGGL/FineUIPro.Web/File/Fastreport/材料入库条码.frx b/SGGL/FineUIPro.Web/File/Fastreport/材料入库条码.frx new file mode 100644 index 00000000..0df764c4 --- /dev/null +++ b/SGGL/FineUIPro.Web/File/Fastreport/材料入库条码.frx @@ -0,0 +1,41 @@ + + + using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Windows.Forms; +using System.Drawing; +using System.Data; +using FastReport; +using FastReport.Data; +using FastReport.Dialog; +using FastReport.Barcode; +using FastReport.Table; +using FastReport.Utils; + +namespace FastReport +{ + public class ReportScript + { + } +} + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj index b3d0f6e1..8bc11dec 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj @@ -377,6 +377,7 @@ + @@ -17059,4 +17060,4 @@ --> - \ No newline at end of file + diff --git a/SGGL/Model/CLGL/Tw_InputDetailBarCodeOutput.cs b/SGGL/Model/CLGL/Tw_InputDetailBarCodeOutput.cs new file mode 100644 index 00000000..e1477f3b --- /dev/null +++ b/SGGL/Model/CLGL/Tw_InputDetailBarCodeOutput.cs @@ -0,0 +1,14 @@ +namespace Model +{ + public class Tw_InputDetailBarCodeOutput + { + public string Id { get; set; } + public string InputDetailId { get; set; } + public string InputMasterId { get; set; } + public string CusBillCode { get; set; } + public string MaterialCode { get; set; } + public string MaterialName { get; set; } + public string MaterialDef { get; set; } + public string BarCode { get; set; } + } +} diff --git a/SGGL/Model/Model.cs b/SGGL/Model/Model.cs index abcb1d51..809ff083 100644 --- a/SGGL/Model/Model.cs +++ b/SGGL/Model/Model.cs @@ -1,5 +1,4 @@ - -#pragma warning disable 1591 +#pragma warning disable 1591 //------------------------------------------------------------------------------ // // 此代码由工具生成。 @@ -1797,6 +1796,9 @@ namespace Model partial void InsertTw_InputDetail(Tw_InputDetail instance); partial void UpdateTw_InputDetail(Tw_InputDetail instance); partial void DeleteTw_InputDetail(Tw_InputDetail instance); + partial void InsertTw_InputDetailBarCode(Tw_InputDetailBarCode instance); + partial void UpdateTw_InputDetailBarCode(Tw_InputDetailBarCode instance); + partial void DeleteTw_InputDetailBarCode(Tw_InputDetailBarCode instance); partial void InsertTw_InputMaster(Tw_InputMaster instance); partial void UpdateTw_InputMaster(Tw_InputMaster instance); partial void DeleteTw_InputMaster(Tw_InputMaster instance); @@ -6692,6 +6694,14 @@ namespace Model } } + public System.Data.Linq.Table Tw_InputDetailBarCode + { + get + { + return this.GetTable(); + } + } + public System.Data.Linq.Table Tw_InputMaster { get @@ -277196,6 +277206,164 @@ namespace Model } } + [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Tw_InputDetailBarCode")] + public partial class Tw_InputDetailBarCode : INotifyPropertyChanging, INotifyPropertyChanged + { + + private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); + + private string _Id; + + private string _InputDetailId; + + private string _InputMasterId; + + private string _MaterialCode; + + private string _BarCode; + + #region 可扩展性方法定义 + partial void OnLoaded(); + partial void OnValidate(System.Data.Linq.ChangeAction action); + partial void OnCreated(); + partial void OnIdChanging(string value); + partial void OnIdChanged(); + partial void OnInputDetailIdChanging(string value); + partial void OnInputDetailIdChanged(); + partial void OnInputMasterIdChanging(string value); + partial void OnInputMasterIdChanged(); + partial void OnMaterialCodeChanging(string value); + partial void OnMaterialCodeChanged(); + partial void OnBarCodeChanging(string value); + partial void OnBarCodeChanged(); + #endregion + + public Tw_InputDetailBarCode() + { + OnCreated(); + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Id", DbType="NVarChar(50) NOT NULL", CanBeNull=false, IsPrimaryKey=true)] + public string Id + { + get + { + return this._Id; + } + set + { + if ((this._Id != value)) + { + this.OnIdChanging(value); + this.SendPropertyChanging(); + this._Id = value; + this.SendPropertyChanged("Id"); + this.OnIdChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_InputDetailId", DbType="NVarChar(50) NOT NULL", CanBeNull=false)] + public string InputDetailId + { + get + { + return this._InputDetailId; + } + set + { + if ((this._InputDetailId != value)) + { + this.OnInputDetailIdChanging(value); + this.SendPropertyChanging(); + this._InputDetailId = value; + this.SendPropertyChanged("InputDetailId"); + this.OnInputDetailIdChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_InputMasterId", DbType="NVarChar(50) NOT NULL", CanBeNull=false)] + public string InputMasterId + { + get + { + return this._InputMasterId; + } + set + { + if ((this._InputMasterId != value)) + { + this.OnInputMasterIdChanging(value); + this.SendPropertyChanging(); + this._InputMasterId = value; + this.SendPropertyChanged("InputMasterId"); + this.OnInputMasterIdChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MaterialCode", DbType="NVarChar(50)")] + public string MaterialCode + { + get + { + return this._MaterialCode; + } + set + { + if ((this._MaterialCode != value)) + { + this.OnMaterialCodeChanging(value); + this.SendPropertyChanging(); + this._MaterialCode = value; + this.SendPropertyChanged("MaterialCode"); + this.OnMaterialCodeChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_BarCode", DbType="NVarChar(500)")] + public string BarCode + { + get + { + return this._BarCode; + } + set + { + if ((this._BarCode != value)) + { + this.OnBarCodeChanging(value); + this.SendPropertyChanging(); + this._BarCode = value; + this.SendPropertyChanged("BarCode"); + this.OnBarCodeChanged(); + } + } + } + + public event PropertyChangingEventHandler PropertyChanging; + + public event PropertyChangedEventHandler PropertyChanged; + + protected virtual void SendPropertyChanging() + { + if ((this.PropertyChanging != null)) + { + this.PropertyChanging(this, emptyChangingEventArgs); + } + } + + protected virtual void SendPropertyChanged(String propertyName) + { + if ((this.PropertyChanged != null)) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + } + [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Tw_InputMaster")] public partial class Tw_InputMaster : INotifyPropertyChanging, INotifyPropertyChanged { diff --git a/SGGL/Model/Model.csproj b/SGGL/Model/Model.csproj index 9e994fc2..e125345b 100644 --- a/SGGL/Model/Model.csproj +++ b/SGGL/Model/Model.csproj @@ -226,6 +226,7 @@ + @@ -328,4 +329,4 @@ --> - \ No newline at end of file +