LAPTOP-NLSJV9RB\91647 2 years ago
commit 9801ccec14

@ -13,6 +13,17 @@ namespace Khd.Core.Application.Interface
ReponseagvCallbackDto AgvCallback(agvCallbackDto agvCallbackDto); 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; 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(); var task = dbContext.WcsTask.Where(t => t.containerNo == RFID001Value.ToString() && t.taskStatus < 1).FirstOrDefault();
if (task == null) if (task == null)
{ {
//根据托盘号获取物料码 List<int?> Itpyes=new List<int?>();
var material = dbContext.MesBasePalletInfo.Where(t => t.palletInfoCode == RFID001Value.ToString()).FirstOrDefault(); Itpyes.Add(1);
if (material != null) 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(); var warehouseId = dbContext.WmsWarehouseMaterial.Where(t => t.storageType == "1" && t.storageId == material.materialId).FirstOrDefault()?.warehouseId;
if (TargetFloor != null) if (warehouseId != null)
{ {
//插入task表 var TargetFloor = dbContext.WmsBaseWarehouse.Where(t => t.warehouseId == warehouseId).FirstOrDefault();
IWcsTaskApplication wcsTaskApplication=new WcsTaskApplication(scope.ServiceProvider); if (TargetFloor != null)
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(), //插入task表
serialNo = Convert.ToInt32(serialno01Value), IWcsTaskApplication wcsTaskApplication = new WcsTaskApplication(scope.ServiceProvider);
equipmentNo = "F01", Jc.SnowId.JcSnowId id = new Jc.SnowId.JcSnowId(1, 1);
taskType = Convert.ToInt32(dic.dicValue), var dic = StaticData.BaseDictionary.Where(t => t.dicKey == "TaskType" && t.ud1 == "I" && t.dicField == TargetFloor.warehouseInstockType).FirstOrDefault();
taskStatus = 0,
containerNo = RFID001Value.ToString(), WcsTask newTask = new WcsTask()
materialNo = material.materialCode, {
materialId = material.materialId, objid = id.NextId(),
qty = Convert.ToInt32(material.bindAmount), serialNo = Convert.ToInt32(serialno01Value),
startPointId = F01, equipmentNo = "F01",
startPointNo = "F01", taskType = Convert.ToInt32(dic.dicValue),
currPointId = F01, taskStatus = 0,
currPointNo = "F01", containerNo = RFID001Value.ToString(),
nextPointId = T01, materialNo = material.materialCode,
nextPointNo = "T01", materialId = material.materialId,
endPointId= warehouseId, qty = Convert.ToInt32(material.bindAmount),
floorNo=1, startPointId = F01,
useFlag=1, startPointNo = "F01",
createBy= "一楼接驳位", currPointId = F01,
createTime =DateTime.Now, currPointNo = "F01",
remark="一楼创建入库任务" nextPointId = T01,
}; nextPointNo = "T01",
wcsTaskApplication.Add(newTask); endPointId = warehouseId,
//下发去向 floorNo = 1,
this._plc.Write(this.wcsrun01.plcpointAddress, 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> </Style>
</ResourceDictionary> </ResourceDictionary>
</Window.Resources> </Window.Resources>
<Grid Background="#172557"> <Grid Background="#172557">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
@ -381,7 +382,50 @@
></Border> ></Border>
<TextBox x:Name="lba_ThrifTtitle1" Style="{StaticResource XingHaoBianMaYangShi}" IsEnabled="true" <TextBox x:Name="lba_ThrifTtitle1" Style="{StaticResource XingHaoBianMaYangShi}" IsEnabled="true"
Width="180" Height="50" Margin="-1150,-8,0,-100"></TextBox> 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 > <Button.Template >
<ControlTemplate TargetType="{x:Type Button}" > <ControlTemplate TargetType="{x:Type Button}" >
<Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="1" CornerRadius="4,4,4,4"> <Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="1" CornerRadius="4,4,4,4">
@ -446,7 +490,7 @@
IsReadOnly="True" /> IsReadOnly="True" />
<DataGridTextColumn <DataGridTextColumn
Width="300*" Width="250*"
Binding="{Binding equipmentNo}" Binding="{Binding equipmentNo}"
CanUserSort="False" CanUserSort="False"
ElementStyle="{StaticResource dgCell}" ElementStyle="{StaticResource dgCell}"
@ -455,7 +499,7 @@
IsReadOnly="True" /> IsReadOnly="True" />
<DataGridTextColumn <DataGridTextColumn
Width="300*" Width="250*"
Binding="{Binding containerNo}" Binding="{Binding containerNo}"
CanUserSort="False" CanUserSort="False"
ElementStyle="{StaticResource dgCell}" ElementStyle="{StaticResource dgCell}"
@ -464,6 +508,14 @@
IsReadOnly="True" /> IsReadOnly="True" />
<DataGridTextColumn <DataGridTextColumn
Width="200*" Width="200*"
Binding="{Binding taskType}"
CanUserSort="False"
ElementStyle="{StaticResource dgCell}"
FontSize="20"
Header="任务类型"
IsReadOnly="True" />
<DataGridTextColumn
Width="200*"
Binding="{Binding taskStatus}" Binding="{Binding taskStatus}"
CanUserSort="False" CanUserSort="False"
ElementStyle="{StaticResource dgCell}" ElementStyle="{StaticResource dgCell}"
@ -577,6 +629,28 @@
Width="1714" Width="1714"
Height="1060" Height="1060"
Background="#213269" Margin="0,-15,0,0"> 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 Width="1711" Height="1070" HorizontalAlignment="Left">
@ -711,6 +785,10 @@
</DataGrid> </DataGrid>
</Grid> </Grid>
</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> </StackPanel>
</TabItem> </TabItem>
<TabItem Header="库存信息" Foreground="White" FontSize="25" Width="160" Height="125" Margin="0,46,8,-46" > <TabItem Header="库存信息" Foreground="White" FontSize="25" Width="160" Height="125" Margin="0,46,8,-46" >
@ -721,7 +799,40 @@
Width="1714" Width="1714"
Height="1060" Height="1060"
Background="#213269" Margin="0,-15,0,0" > 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 Width="1711" Height="1070" HorizontalAlignment="Left">
<Grid.RowDefinitions> <Grid.RowDefinitions>
@ -1307,5 +1418,8 @@
</Grid> </Grid>
</Grid> </Grid>
</Grid> </Grid>
</Window> </Window>

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