diff --git a/SlnMesnac.Business/MaterialBindBusiness.cs b/SlnMesnac.Business/MaterialBindBusiness.cs index 5b1fa78..b8b3ac4 100644 --- a/SlnMesnac.Business/MaterialBindBusiness.cs +++ b/SlnMesnac.Business/MaterialBindBusiness.cs @@ -27,8 +27,12 @@ namespace SlnMesnac.Business.@base { try { + var flag = false; var plc = base.GetPlcByKey("plc"); - var flag = plc.writeInt16ByAddress(PlcAddress, 1); + if (plc != null) + { + flag = plc.writeInt16ByAddress(PlcAddress, 1); + } return flag; } catch (Exception ex) @@ -38,12 +42,16 @@ namespace SlnMesnac.Business.@base } - public bool NG_BJSignal(String PlcAddress) + public bool NG_BJSignal(String PlcAddress,int value) { try { + var flag = false; var plc = base.GetPlcByKey("plc"); - var flag = plc.writeInt16ByAddress(PlcAddress, 2); + if (plc != null) + { + flag = plc.writeInt16ByAddress(PlcAddress, value); + } return flag; } catch (Exception ex) diff --git a/SlnMesnac.Model/domain/T_RP_InventoryConsume_Record.cs b/SlnMesnac.Model/domain/T_RP_InventoryConsume_Record.cs new file mode 100644 index 0000000..7183874 --- /dev/null +++ b/SlnMesnac.Model/domain/T_RP_InventoryConsume_Record.cs @@ -0,0 +1,93 @@ +using System; +using System.Linq; +using System.Text; +using SqlSugar; + +namespace SlnMesnac.Repository +{ + /// + ///物料库存消耗记录表 + /// + [SugarTable("T_RP_InventoryConsume_Record")] + public partial class T_RP_InventoryConsume_Record + { + public T_RP_InventoryConsume_Record(){ + + + } + /// + /// Desc:主键编号 + /// Default: + /// Nullable:False + /// + [SugarColumn(IsPrimaryKey = true,IsIdentity = true,ColumnName="objid")] + public int objid {get;set;} + + /// + /// Desc:子项物料编号 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="materialtypeid")] + public string materialtypeid {get;set;} + + /// + /// Desc:批次号 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="batchno")] + public string batchno {get;set;} + + [SugarColumn(ColumnName = "stationid")] + public int? stationid { get; set; } + /// + /// Desc:消耗数量 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="consumecount")] + public string consumecount {get;set;} + + /// + /// Desc:产品条码 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="productbarcode")] + public string productbarcode {get;set;} + + /// + /// Desc:创建人 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="create_by")] + public string createBy {get;set;} + + /// + /// Desc:创建时间 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="create_time")] + public DateTime? createTime {get;set;} + + /// + /// Desc:更新人 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="update_by")] + public string updateBy {get;set;} + + /// + /// Desc:更新时间 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="update_time")] + public DateTime? updateTime {get;set;} + + } +} diff --git a/SlnMesnac.Model/domain/T_RP_StationMaterialInventory.cs b/SlnMesnac.Model/domain/T_RP_StationMaterialInventory.cs new file mode 100644 index 0000000..83fb72e --- /dev/null +++ b/SlnMesnac.Model/domain/T_RP_StationMaterialInventory.cs @@ -0,0 +1,99 @@ +using System; +using System.Linq; +using System.Text; +using SqlSugar; + +namespace SlnMesnac.Repository +{ + /// + ///工位物料库存关系表 + /// + [SugarTable("T_RP_StationMaterialInventory")] + public partial class T_RP_StationMaterialInventory + { + public T_RP_StationMaterialInventory(){ + + + } + /// + /// Desc:主键 + /// Default: + /// Nullable:False + /// + [SugarColumn(IsPrimaryKey=true,IsIdentity=true,ColumnName="objid")] + public int objid {get;set;} + + /// + /// Desc:工位编号 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="stationid")] + public int? stationid {get;set;} + + /// + /// Desc:子项物料编号 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="material_type_id")] + public string materialTypeId {get;set;} + + /// + /// Desc:批次号 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="batchno")] + public string batchno {get;set;} + + /// + /// Desc:投入数量 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="inputcount")] + public int inputcount {get;set;} + + /// + /// Desc:备注 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="remark")] + public string remark {get;set;} + + /// + /// Desc:创建人 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="create_by")] + public string createBy {get;set;} + + /// + /// Desc:创建时间 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="create_time")] + public DateTime? createTime {get;set;} + + /// + /// Desc:更新人 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="update_by")] + public string updateBy {get;set;} + + /// + /// Desc:更新时间 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="update_time")] + public DateTime? updateTime {get;set;} + + } +} diff --git a/SlnMesnac.Repository/service/IT_RP_InventoryConsume_RecordService.cs b/SlnMesnac.Repository/service/IT_RP_InventoryConsume_RecordService.cs new file mode 100644 index 0000000..8467e04 --- /dev/null +++ b/SlnMesnac.Repository/service/IT_RP_InventoryConsume_RecordService.cs @@ -0,0 +1,14 @@ +using SlnMesnac.Model.domain; +using SlnMesnac.Repository.service.@base; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace SlnMesnac.Repository.service +{ + public interface IT_RP_InventoryConsume_RecordService: IBaseService + { + Task InsertAsync(T_RP_InventoryConsume_Record record); + } +} \ No newline at end of file diff --git a/SlnMesnac.Repository/service/IT_RP_StationMaterialInventoryService.cs b/SlnMesnac.Repository/service/IT_RP_StationMaterialInventoryService.cs new file mode 100644 index 0000000..5c70956 --- /dev/null +++ b/SlnMesnac.Repository/service/IT_RP_StationMaterialInventoryService.cs @@ -0,0 +1,24 @@ +using SlnMesnac.Model.domain; +using SlnMesnac.Repository.service.@base; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace SlnMesnac.Repository.service +{ + public interface IT_RP_StationMaterialInventoryService: IBaseService + { + /// + /// ѯBOM + /// + /// + List GetMaterialShip(int stationid); + + T_RP_StationMaterialInventory GetBatchNoByMaterialTypeID(string material_type_id, int stationid); + + Task UpdateAsync(T_RP_StationMaterialInventory record); + + + } +} \ No newline at end of file diff --git a/SlnMesnac.Repository/service/Impl/T_RP_InventoryConsume_RecordServiceImpl.cs b/SlnMesnac.Repository/service/Impl/T_RP_InventoryConsume_RecordServiceImpl.cs new file mode 100644 index 0000000..16db4f0 --- /dev/null +++ b/SlnMesnac.Repository/service/Impl/T_RP_InventoryConsume_RecordServiceImpl.cs @@ -0,0 +1,21 @@ +using SlnMesnac.Model.domain; +using SlnMesnac.Repository.service.@base; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace SlnMesnac.Repository.service.Impl +{ + public class T_RP_InventoryConsume_RecordServiceImpl : BaseServiceImpl, IT_RP_InventoryConsume_RecordService + { + public T_RP_InventoryConsume_RecordServiceImpl(Repository repository):base(repository) + { + } + + public async Task InsertAsync(T_RP_InventoryConsume_Record record) + { + bool result = await _rep.InsertAsync(record); + return result; + } + } +} \ No newline at end of file diff --git a/SlnMesnac.Repository/service/Impl/T_RP_StationMaterialInventoryServiceImpl.cs b/SlnMesnac.Repository/service/Impl/T_RP_StationMaterialInventoryServiceImpl.cs new file mode 100644 index 0000000..d764ced --- /dev/null +++ b/SlnMesnac.Repository/service/Impl/T_RP_StationMaterialInventoryServiceImpl.cs @@ -0,0 +1,54 @@ +using SlnMesnac.Model.domain; +using SlnMesnac.Repository.service.@base; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace SlnMesnac.Repository.service.Impl +{ + public class T_RP_StationMaterialInventoryServiceImpl : BaseServiceImpl, IT_RP_StationMaterialInventoryService + { + public T_RP_StationMaterialInventoryServiceImpl(Repository repository):base(repository) + { + + } + + public T_RP_StationMaterialInventory GetBatchNoByMaterialTypeID(string material_type_id, int stationid) + { + T_RP_StationMaterialInventory t_RP_StationMaterialInventory = null; + string sql = ""; + try + { + sql = "select objid,stationid,material_type_id, batchno ,inputcount,create_time from T_RP_StationMaterialInventory where material_type_id = '" + material_type_id + "' and inputcount > 0 and stationid = " + stationid+" order by create_time asc"; + t_RP_StationMaterialInventory = base._rep.AsTenant().GetConnection("mes").Ado.SqlQuerySingle(sql); + return t_RP_StationMaterialInventory; + } + catch (Exception) + { + return t_RP_StationMaterialInventory; + } + + } + + public List GetMaterialShip(int stationid) + { + List MaterialShipInfos = null; + try + { + String sql = "select t2.material_type_id,t3.working_procedure_id as remark from (select material_type_id from( select material_type_id from T_RP_StationMaterialInventory where stationid = " + stationid +") t1 group by material_type_id) t2 left join base_materialtype_info t3 on t2.material_type_id = t3.material_type_id "; + MaterialShipInfos = base._rep.AsTenant().GetConnection("mes").Ado.SqlQuery(sql); + } + catch (Exception ex) + { + //_logger.LogError($"ȡAGVϢ쳣:{ex.Message}"); + } + return MaterialShipInfos; + } + + public async Task UpdateAsync(T_RP_StationMaterialInventory record) + { + bool result = await _rep.UpdateAsync(record); + return result; + } + } +} \ No newline at end of file diff --git a/SlnMesnac.WPF/MainWindow.xaml b/SlnMesnac.WPF/MainWindow.xaml index 9c09c0b..323f37e 100644 --- a/SlnMesnac.WPF/MainWindow.xaml +++ b/SlnMesnac.WPF/MainWindow.xaml @@ -66,7 +66,7 @@