LAPTOP-NLSJV9RB\91647 2 years ago
commit 9801ccec14

@ -13,6 +13,17 @@ namespace Khd.Core.Application.Interface
ReponseagvCallbackDto AgvCallback(agvCallbackDto agvCallbackDto);
/// <summary>
/// 入库完成
/// </summary>
/// <returns></returns>
string InWare(long taskId);
/// <summary>
/// 出库完成
/// </summary>
/// <returns></returns>
string OutWare(long taskId);
}
}

@ -102,5 +102,21 @@ namespace Khd.Core.Application
return reponseagvCallbackDto;
}
/// <summary>
/// 入库完成
/// </summary>
/// <returns></returns>
public string InWare(long taskId)
{
return "";
}
/// <summary>
/// 出库完成
/// </summary>
/// <returns></returns>
public string OutWare(long taskId)
{
return "";
}
}
}

@ -222,51 +222,70 @@ namespace Khd.Core.Wcs.Wcs
var task = dbContext.WcsTask.Where(t => t.containerNo == RFID001Value.ToString() && t.taskStatus < 1).FirstOrDefault();
if (task == null)
{
//根据托盘号获取物料码
var material = dbContext.MesBasePalletInfo.Where(t => t.palletInfoCode == RFID001Value.ToString()).FirstOrDefault();
if (material != null)
List<int?> Itpyes=new List<int?>();
Itpyes.Add(1);
Itpyes.Add(3);
Itpyes.Add(5);
Itpyes.Add(7);
//入库
if (Itpyes.Contains(task.taskType))
{
var warehouseId = dbContext.WmsWarehouseMaterial.Where(t => t.storageType == "1" && t.storageId == material.materialId).FirstOrDefault()?.warehouseId;
if (warehouseId != null)
//根据托盘号获取物料码
var material = dbContext.MesBasePalletInfo.Where(t => t.palletInfoCode == RFID001Value.ToString()).FirstOrDefault();
if (material != null)
{
var TargetFloor = dbContext.WmsBaseWarehouse.Where(t => t.warehouseId == warehouseId).FirstOrDefault();
if (TargetFloor != null)
var warehouseId = dbContext.WmsWarehouseMaterial.Where(t => t.storageType == "1" && t.storageId == material.materialId).FirstOrDefault()?.warehouseId;
if (warehouseId != null)
{
//插入task表
IWcsTaskApplication wcsTaskApplication=new WcsTaskApplication(scope.ServiceProvider);
Jc.SnowId.JcSnowId id = new Jc.SnowId.JcSnowId(1, 1);
var dic = StaticData.BaseDictionary.Where(t => t.dicKey == "TaskType" && t.ud1 == "I" && t.dicField == TargetFloor.warehouseInstockType).FirstOrDefault();
WcsTask newTask = new WcsTask()
var TargetFloor = dbContext.WmsBaseWarehouse.Where(t => t.warehouseId == warehouseId).FirstOrDefault();
if (TargetFloor != null)
{
objid = id.NextId(),
serialNo = Convert.ToInt32(serialno01Value),
equipmentNo = "F01",
taskType = Convert.ToInt32(dic.dicValue),
taskStatus = 0,
containerNo = RFID001Value.ToString(),
materialNo = material.materialCode,
materialId = material.materialId,
qty = Convert.ToInt32(material.bindAmount),
startPointId = F01,
startPointNo = "F01",
currPointId = F01,
currPointNo = "F01",
nextPointId = T01,
nextPointNo = "T01",
endPointId= warehouseId,
floorNo=1,
useFlag=1,
createBy= "一楼接驳位",
createTime =DateTime.Now,
remark="一楼创建入库任务"
};
wcsTaskApplication.Add(newTask);
//下发去向
this._plc.Write(this.wcsrun01.plcpointAddress, 1);
//插入task表
IWcsTaskApplication wcsTaskApplication = new WcsTaskApplication(scope.ServiceProvider);
Jc.SnowId.JcSnowId id = new Jc.SnowId.JcSnowId(1, 1);
var dic = StaticData.BaseDictionary.Where(t => t.dicKey == "TaskType" && t.ud1 == "I" && t.dicField == TargetFloor.warehouseInstockType).FirstOrDefault();
WcsTask newTask = new WcsTask()
{
objid = id.NextId(),
serialNo = Convert.ToInt32(serialno01Value),
equipmentNo = "F01",
taskType = Convert.ToInt32(dic.dicValue),
taskStatus = 0,
containerNo = RFID001Value.ToString(),
materialNo = material.materialCode,
materialId = material.materialId,
qty = Convert.ToInt32(material.bindAmount),
startPointId = F01,
startPointNo = "F01",
currPointId = F01,
currPointNo = "F01",
nextPointId = T01,
nextPointNo = "T01",
endPointId = warehouseId,
floorNo = 1,
useFlag = 1,
createBy = "一楼接驳位",
createTime = DateTime.Now,
remark = "一楼创建入库任务"
};
wcsTaskApplication.Add(newTask);
//下发去向
this._plc.Write(this.wcsrun01.plcpointAddress, 1);
}
}
}
}
//出库
{
//清空托盘绑定
var material = dbContext.MesBasePalletInfo.Where(t => t.palletInfoCode == RFID001Value.ToString()).FirstOrDefault();
if (material != null)
{
dbContext.MesBasePalletInfo.Where(t => t.palletInfoCode == RFID001Value.ToString()).Delete();
dbContext.SaveChanges();
}
}
}
}
}

@ -343,6 +343,7 @@
</Style>
</ResourceDictionary>
</Window.Resources>
<Grid Background="#172557">
<Grid>
<Grid.RowDefinitions>
@ -381,7 +382,50 @@
></Border>
<TextBox x:Name="lba_ThrifTtitle1" Style="{StaticResource XingHaoBianMaYangShi}" IsEnabled="true"
Width="180" Height="50" Margin="-1150,-8,0,-100"></TextBox>
<Button Content="搜索" Margin="-800,-8,0,-100" Foreground="White" Height="50" Width="132" Click="Button_Click">
<Label
Width="125"
Height="70"
Margin="-800,20,0,-100"
Content="容器号 :"
FontSize="25"
Foreground="White"
/>
<Border
></Border>
<TextBox x:Name="lba_ThrifTtitle2" Style="{StaticResource XingHaoBianMaYangShi}" IsEnabled="true"
Width="180" Height="50" Margin="-500,-8,0,-100"></TextBox>
<Button Content="搜索" Margin="-100,-8,0,-100" Foreground="White" Height="50" Width="132" Click="Button_Click">
<Button.Template >
<ControlTemplate TargetType="{x:Type Button}" >
<Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="1" CornerRadius="4,4,4,4">
<Border.Background>#346DFF</Border.Background>
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" ></ContentPresenter>
</Border>
</ControlTemplate>
</Button.Template>
</Button>
<Button Content="创建任务" Margin="200,-8,0,-100" Foreground="White" Height="50" Width="132" Click="Button_Click">
<Button.Template >
<ControlTemplate TargetType="{x:Type Button}" >
<Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="1" CornerRadius="4,4,4,4">
<Border.Background>#346DFF</Border.Background>
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" ></ContentPresenter>
</Border>
</ControlTemplate>
</Button.Template>
</Button>
<Button Content="删除任务" Margin="500,-8,0,-100" Foreground="White" Height="50" Width="132" Click="Button_Click">
<Button.Template >
<ControlTemplate TargetType="{x:Type Button}" >
<Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="1" CornerRadius="4,4,4,4">
<Border.Background>#346DFF</Border.Background>
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" ></ContentPresenter>
</Border>
</ControlTemplate>
</Button.Template>
</Button>
<Button Content="手动完成" Margin="800,-8,0,-100" Foreground="White" Height="50" Width="132" Click="Button_Click">
<Button.Template >
<ControlTemplate TargetType="{x:Type Button}" >
<Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="1" CornerRadius="4,4,4,4">
@ -446,7 +490,7 @@
IsReadOnly="True" />
<DataGridTextColumn
Width="300*"
Width="250*"
Binding="{Binding equipmentNo}"
CanUserSort="False"
ElementStyle="{StaticResource dgCell}"
@ -455,7 +499,7 @@
IsReadOnly="True" />
<DataGridTextColumn
Width="300*"
Width="250*"
Binding="{Binding containerNo}"
CanUserSort="False"
ElementStyle="{StaticResource dgCell}"
@ -464,6 +508,14 @@
IsReadOnly="True" />
<DataGridTextColumn
Width="200*"
Binding="{Binding taskType}"
CanUserSort="False"
ElementStyle="{StaticResource dgCell}"
FontSize="20"
Header="任务类型"
IsReadOnly="True" />
<DataGridTextColumn
Width="200*"
Binding="{Binding taskStatus}"
CanUserSort="False"
ElementStyle="{StaticResource dgCell}"
@ -577,7 +629,29 @@
Width="1714"
Height="1060"
Background="#213269" Margin="0,-15,0,0">
<Label
Width="125"
Height="70"
Margin="-1500,20,0,-100"
Content="设备编号 :"
FontSize="25"
Foreground="White"
/>
<Border
></Border>
<TextBox x:Name="lba_ThrifTtitle3" Style="{StaticResource XingHaoBianMaYangShi}" IsEnabled="true"
Width="180" Height="50" Margin="-1150,-8,0,-100"></TextBox>
<Button Content="搜索" Margin="-700,-8,0,-100" Foreground="White" Height="50" Width="132" Click="Button_Click">
<Button.Template >
<ControlTemplate TargetType="{x:Type Button}" >
<Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="1" CornerRadius="4,4,4,4">
<Border.Background>#346DFF</Border.Background>
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" ></ContentPresenter>
</Border>
</ControlTemplate>
</Button.Template>
</Button>
<!-- 订单信息 -->
<Grid Width="1711" Height="1070" HorizontalAlignment="Left">
<Grid.RowDefinitions>
@ -711,6 +785,10 @@
</DataGrid>
</Grid>
</Grid>
<Label Content="Label"/>
<Label Content="Label"/>
<Label x:Name="_1111" Content="Label" Margin="1,0,1,0" HorizontalAlignment="Right" VerticalAlignment="Center" Foreground="#FFFBF5EC" Background="#FFECDADA"/>
<Label Content="Label"/>
</StackPanel>
</TabItem>
<TabItem Header="库存信息" Foreground="White" FontSize="25" Width="160" Height="125" Margin="0,46,8,-46" >
@ -721,7 +799,40 @@
Width="1714"
Height="1060"
Background="#213269" Margin="0,-15,0,0" >
<Label
Width="125"
Height="70"
Margin="-1500,20,0,-100"
Content="物料编码 :"
FontSize="25"
Foreground="White"
/>
<Border
></Border>
<TextBox x:Name="lba_ThrifTtitle5" Style="{StaticResource XingHaoBianMaYangShi}" IsEnabled="true"
Width="180" Height="50" Margin="-1150,-8,0,-100"></TextBox>
<Label
Width="125"
Height="70"
Margin="-800,20,0,-100"
Content="库位 :"
FontSize="25"
Foreground="White"
/>
<Border
></Border>
<TextBox x:Name="lba_ThrifTtitle6" Style="{StaticResource XingHaoBianMaYangShi}" IsEnabled="true"
Width="180" Height="50" Margin="-550,-8,0,-100"></TextBox>
<Button Content="搜索" Margin="-100,-8,0,-100" Foreground="White" Height="50" Width="132" Click="Button_Click">
<Button.Template >
<ControlTemplate TargetType="{x:Type Button}" >
<Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="1" CornerRadius="4,4,4,4">
<Border.Background>#346DFF</Border.Background>
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" ></ContentPresenter>
</Border>
</ControlTemplate>
</Button.Template>
</Button>
<!-- 订单信息 -->
<Grid Width="1711" Height="1070" HorizontalAlignment="Left">
<Grid.RowDefinitions>
@ -1307,5 +1418,8 @@
</Grid>
</Grid>
</Grid>
</Window>

@ -79,41 +79,41 @@ namespace Khd.Core.Wpf.Form
//加载dategrid信息
//LoadMaterial_GetMessage("");
//连接PLC判断
var plc = new Khd.Core.Plc.S7.Plc((CpuType)PlcConfig.CpuType, PlcConfig.IP, PlcConfig.Port,
PlcConfig.Rack, PlcConfig.Slot);
//plc.Open();
//if (!plc.IsConnected)
//{
// MessageBox.Show("PLC连接失败,重新连接");
//}
//else
//{
// this._plc = plc;
//}
// var plc = new Khd.Core.Plc.S7.Plc((CpuType)PlcConfig.CpuType, PlcConfig.IP, PlcConfig.Port,
// PlcConfig.Rack, PlcConfig.Slot);
// //plc.Open();
// //if (!plc.IsConnected)
// //{
// // MessageBox.Show("PLC连接失败,重新连接");
// //}
// //else
// //{
// // this._plc = plc;
// //}
using var scope = _host.Services.CreateScope();
using var dbContext = scope.ServiceProvider.GetRequiredService<DefaultDbContext>();
basePlcpoints = dbContext.BasePlcpoint.Where(t => t.isDelete == 0).ToList();
//var baseMaterials = dbContext.BaseMaterial.Where(t => t.IsDelete == 0).ToList();
//
// using var scope = _host.Services.CreateScope();
// using var dbContext = scope.ServiceProvider.GetRequiredService<DefaultDbContext>();
// basePlcpoints = dbContext.BasePlcpoint.Where(t => t.isDelete == 0).ToList();
// //var baseMaterials = dbContext.BaseMaterial.Where(t => t.IsDelete == 0).ToList();
////
PLCMessage = new DispatcherTimer();
PLCMessage.Tick += new EventHandler(PLCmessage); //委托获取点位方法
PLCMessage.Interval = new TimeSpan(0, 0, 0, 0, 1000);
PLCMessage.Start();
// PLCMessage = new DispatcherTimer();
// PLCMessage.Tick += new EventHandler(PLCmessage); //委托获取点位方法
// PLCMessage.Interval = new TimeSpan(0, 0, 0, 0, 1000);
// PLCMessage.Start();
UPMessageTimer = new DispatcherTimer();
UPMessageTimer.Tick += new EventHandler(UpMessage); //委托刷新上件记录
UPMessageTimer.Interval = new TimeSpan(0, 0, 0, 0, 2000);
UPMessageTimer.Start();
Button_Click_1(null, null);
SetTime();
List<string> list = new List<string>
{
"101上件点",
"102上件点",
"103上件点"
};
// UPMessageTimer = new DispatcherTimer();
// UPMessageTimer.Tick += new EventHandler(UpMessage); //委托刷新上件记录
// UPMessageTimer.Interval = new TimeSpan(0, 0, 0, 0, 2000);
// UPMessageTimer.Start();
// Button_Click_1(null, null);
// SetTime();
// List<string> list = new List<string>
// {
// "101上件点",
// "102上件点",
// "103上件点"
// };
}
catch (Exception ex)
@ -637,7 +637,13 @@ namespace Khd.Core.Wpf.Form
private void Button_Click(object sender, RoutedEventArgs e)
{
//
using var scope = _host.Services.CreateScope();
using var dbContext = scope.ServiceProvider.GetRequiredService<DefaultDbContext>();
var data = dbContext.WcsTask.Where(t => t.useFlag == 0).ToList();
this.LoadMaterial0.ItemsSource = null;
this.LoadMaterial0.ItemsSource = data;
this.LoadMaterial0.Items.Refresh();
//MessageBox.Show("查询");
}
}

@ -1,9 +1,9 @@
{
"ConnectionStrings": {
//mysql
"DefaultConnection": "server=localhost;port=3306;database=khd_jyhb;uid=root;pwd=root;charset='utf8';persistsecurityinfo=True;SslMode=none;Allow User Variables=True"
//"DefaultConnection": "server=106.12.13.113;port=3306;database=khd_jyhb;uid=root;pwd=root;charset='utf8';persistsecurityinfo=True;SslMode=none;Allow User Variables=True"
//khd
// "DefaultConnection": "server=106.12.13.113;port=3336;database=khd_suspension_chain;uid=khd;pwd=khd@123;charset='utf8';persistsecurityinfo=True;SslMode=none;Allow User Variables=True"
"DefaultConnection": "server=106.12.13.113;port=3336;database=khd_jyhb;uid=khd;pwd=khd@123;charset='utf8';persistsecurityinfo=True;SslMode=none;Allow User Variables=True"
//
//"DefaultConnection": "server=localhost;port=3306;database=khd_suspension_chain;uid=root;pwd=123456;charset='utf8';persistsecurityinfo=True;SslMode=none;Allow User Variables=True"
},

Loading…
Cancel
Save