成品添加字母工单更新功能;优化烘房界面;成品登录修改

master
zhaoaomin 2 years ago
parent 70242d2c2a
commit f9f2d65e33

Binary file not shown.

@ -49,7 +49,7 @@
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" /> <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms> </dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" /> <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>Po3RXPWGZu4mUxH1jVsl/Rdx6vzD+7hH//g0gawb1HM=</dsig:DigestValue> <dsig:DigestValue>qnFKF+/3YlPAODyAGRSFG761uj8zOHLBVY6MUaXwrHc=</dsig:DigestValue>
</hash> </hash>
</dependentAssembly> </dependentAssembly>
</dependency> </dependency>

@ -55,7 +55,7 @@ namespace XGL.Data.DBService
//DataSet dtsetresult = Utils.netClientDBHelper.getDataSet(sqlHF); //DataSet dtsetresult = Utils.netClientDBHelper.getDataSet(sqlHF);
//string adwdwad = dtsetresult.Tables[0].Rows[7].ToString(); //string adwdwad = dtsetresult.Tables[0].Rows[7].ToString();
//int number = Convert.ToInt32(); //int number = Convert.ToInt32();
string sql = $@"SELECT TOP 23 ROW_NUMBER() OVER (ORDER BY dry.create_time) AS RowNumber,rfid_no,device_code,type,dry.create_time,dry.update_time,factory_no,dry.workorder_code,material_code,product_name FROM [dbo].[mes_dryinghouse_info] dry string sql = $@"SELECT TOP 23 ROW_NUMBER() OVER (ORDER BY dry.create_time desc) AS RowNumber,rfid_no,device_code,type,dry.create_time,dry.update_time,factory_no,dry.workorder_code,material_code,product_name FROM [dbo].[mes_dryinghouse_info] dry
LEFT JOIN pro_order_workorder workorder on dry.workorder_code = workorder.workorder_code where device_code = '{devicecode}' and type = '{inout}' and dry.del_flag='0' order by dry.create_time desc ;"; LEFT JOIN pro_order_workorder workorder on dry.workorder_code = workorder.workorder_code where device_code = '{devicecode}' and type = '{inout}' and dry.del_flag='0' order by dry.create_time desc ;";
//获取绑定中且RFID没有出烘房在烘房内的数据 //获取绑定中且RFID没有出烘房在烘房内的数据
// string sql = $@"SELECT rfid,workorder_code,product_name,product_code,isnull(car_num,0) as car_num,isnull([begin],'1900-01-01 08:00:00') as [begin],ord.status FROM [dbo].[mes_material_transfer_result] res // string sql = $@"SELECT rfid,workorder_code,product_name,product_code,isnull(car_num,0) as car_num,isnull([begin],'1900-01-01 08:00:00') as [begin],ord.status FROM [dbo].[mes_material_transfer_result] res

@ -334,7 +334,6 @@ where CONVERT(VARCHAR(10), upload_time , 120)= CONVERT(VARCHAR(10), GetDate() ,
} }
/// <summary> /// <summary>
/// 获取库位内物料明细 /// 获取库位内物料明细
/// </summary> /// </summary>
@ -490,7 +489,24 @@ product_spc,shifts.shift_desc,prod_line_code,workorder.status,route_code,quantit
from pro_order_workorder workorder from pro_order_workorder workorder
left JOIN base_shifts_t shifts on workorder.shift_id = shifts.shift_id left JOIN base_shifts_t shifts on workorder.shift_id = shifts.shift_id
where 1=1 and where 1=1 and
workorder.parent_order ='0' "; workorder.parent_order ='0' and CONVERT(VARCHAR(10), workorder.product_date , 120)= CONVERT(VARCHAR(10), '{date}' , 120) and workorder.prod_line_code like '%{deviceCode}%'";
DataSet dtset = Utils.netClientDBHelper.getDataSet(sql);
if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
{
return dtset.Tables[0];
}
return null;
}
public DataTable GetSubOrderInfo(string workorderID)
{
string sql = $@"select workorder.factory_code,workorder.product_date as plan_time, workorder.workorder_id,workorder.workorder_code, product_code,product_name,
product_spc,shifts.shift_desc,prod_line_code,workorder.status,route_code,quantity_split,unit,workorder.shift_id
from pro_order_workorder workorder
left JOIN base_shifts_t shifts on workorder.shift_id = shifts.shift_id
where 1=1 and
workorder.parent_order ='{workorderID}'";
DataSet dtset = Utils.netClientDBHelper.getDataSet(sql); DataSet dtset = Utils.netClientDBHelper.getDataSet(sql);
if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0) if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
{ {
@ -660,7 +676,7 @@ where pre.workorder_code = '{processid}'"; //where CONVERT(VARCHAR(10), wet.pla
/// <returns></returns> /// <returns></returns>
public bool UpdateSycnFlag(string workOrderID) public bool UpdateSycnFlag(string workOrderID)
{ {
string sql1 = $@"update pro_order_workorder set status = 'w2', update_by = '{LoginUser.UserName}',update_time = GETDATE() where workorder_id = '{workOrderID}' "; string sql1 = $@"update pro_order_workorder set status = 'w2', update_by = '{LoginUser.UserName}',update_time = GETDATE() where workorder_code = '{workOrderID}' ";
return Utils.netClientDBHelper.executeUpdate(sql1) > 0 ? true : false; return Utils.netClientDBHelper.executeUpdate(sql1) > 0 ? true : false;

@ -12,7 +12,7 @@
<!--设备编码--> <!--设备编码-->
<add key="DeviceCode" value="C3" /> <add key="DeviceCode" value="C3" />
<!--上位机类型 0:工单准备1成型机\shoupei2烘房,3:人员登录--> <!--上位机类型 0:工单准备1成型机\shoupei2烘房,3:人员登录-->
<add key="ClientMode" value="1" /> <add key="ClientMode" value="2" />
<add key="SerialPort" value="COM5" /> <add key="SerialPort" value="COM5" />
<add key="DryingHouseList" value="H16,H17,H18" /> <add key="DryingHouseList" value="H16,H17,H18" />
<!--线体编码--> <!--线体编码-->

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -57,51 +57,60 @@
Margin="2,0,0,0" Margin="2,0,0,0"
Style="{DynamicResource ListBoxItemNormalBackground_Border_Style}"> Style="{DynamicResource ListBoxItemNormalBackground_Border_Style}">
<Grid > <Grid >
<Image Source="../Resources/leaf.png" Margin="223,-82,0,0" Width="50"/>
<TextBlock Text="{Binding RowNumber}"
VerticalAlignment="top"
Margin="250,8,0,0" FontWeight="Bold" Foreground="White"
Style="{DynamicResource ListBoxItemContent_TextBlock_Style}"/>
<TextBlock Text="{Binding product_name}" <TextBlock Text="{Binding product_name}"
VerticalAlignment="top" VerticalAlignment="top"
Margin="80,22,0,0" Margin="45,22,0,0"
Style="{DynamicResource ListBoxItemContent_TextBlock_Style}"/> Style="{DynamicResource ListBoxItemContent_TextBlock_Style}"/>
<TextBlock Text="{Binding workorder_code}" <TextBlock Text="{Binding workorder_code}"
Margin="80,42,0,0" Margin="45,42,0,0"
HorizontalAlignment="left" HorizontalAlignment="left"
TextAlignment="left" TextAlignment="left"
Style="{DynamicResource ListBoxItemName_TextBlock_Style}"/> Style="{DynamicResource ListBoxItemName_TextBlock_Style}"/>
<WrapPanel Orientation="Horizontal"> <WrapPanel Orientation="Horizontal">
<TextBlock Margin="80,60,0,0" Text="RFID" FontSize="14"/> <TextBlock Margin="45,62,0,0" Text="RFID" FontSize="14"/>
<TextBlock Text="{Binding rfid_no}" <TextBlock Text="{Binding rfid_no}"
Style="{DynamicResource ListBoxItemContent_TextBlock_Style}" Style="{DynamicResource ListBoxItemContent_TextBlock_Style}"
Margin="0,59,0,0"/> Margin="0,62,0,0"/>
</WrapPanel> </WrapPanel>
<WrapPanel> <WrapPanel>
<TextBlock Text="{Binding update_time,StringFormat=yyyy-MM-dd HH:mm:ss}" <TextBlock Text="{Binding update_time,StringFormat=yyyy-MM-dd HH:mm:ss}"
Margin="80,78,0,0" Margin="45,82,0,0"
Style="{DynamicResource ListBoxItemContent_TextBlock_Style}"/> Style="{DynamicResource ListBoxItemContent_TextBlock_Style}"/>
</WrapPanel> </WrapPanel>
<WrapPanel> <!--<WrapPanel>
<TextBlock Text="{Binding RowNumber}" <TextBlock Text="{Binding RowNumber}"
VerticalAlignment="top" VerticalAlignment="top"
Margin="130,96,0,0" Margin="225,-80,0,0"
Style="{DynamicResource ListBoxItemContent_TextBlock_Style}"/> Style="{DynamicResource ListBoxItemContent_TextBlock_Style}"/>
</WrapPanel> </WrapPanel>
<TextBlock Text="#" <TextBlock Text="#"
Margin="148,96,0,0" Margin="148,96,0,0"
Style="{DynamicResource ListBoxItemContent_TextBlock_Style}"/> Style="{DynamicResource ListBoxItemContent_TextBlock_Style}"/>-->
<Border <Grid
Margin="0,12,0,0" Margin="-15,12,0,0"
Width="90" Width="90"
Height="102" Height="102"
VerticalAlignment="Top" VerticalAlignment="Top"
HorizontalAlignment="Left" > HorizontalAlignment="Left" >
<Image Source="../Resources/lanjuLogo.png" VerticalAlignment="Stretch"/> <Image Source="../Resources/circular.png" Width="10" Height="10" Margin="0,-62,0,0"/>
<Image Source="../Resources/circular.png" Width="10" Height="10" Margin="0,-22,0,0"/>
<Image Source="../Resources/circular.png" Width="10" Height="10" Margin="0,18,0,0"/>
<Image Source="../Resources/circular.png" Width="10" Height="10" Margin="0,56,0,0"/>
<!--<Image Source="../Resources/lanjuLogo.png" VerticalAlignment="Stretch"/>-->
<!--<StackPanel Orientation="Vertical"> <!--<StackPanel Orientation="Vertical">
<TextBlock Text="{Binding rfid_no}" FontSize="18" <TextBlock Text="{Binding rfid_no}" FontSize="18"
Foreground="{Binding rfid_no,Converter={StaticResource ForeGroundBatchType}}" VerticalAlignment="Center" HorizontalAlignment="Center"/> Foreground="{Binding rfid_no,Converter={StaticResource ForeGroundBatchType}}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<Image Source="..\Img\1.png"></Image> <Image Source="..\Img\1.png"></Image>
</StackPanel>--> </StackPanel>-->
</Border> </Grid>
</Grid> </Grid>
</Border> </Border>
@ -223,7 +232,7 @@
<Setter Property="TextWrapping" Value="Wrap"/> <Setter Property="TextWrapping" Value="Wrap"/>
</Style> </Style>
<Style x:Key="ListBoxItemContent_TextBlock_Style" TargetType="{x:Type TextBlock}"> <Style x:Key="ListBoxItemContent_TextBlock_Style" TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="14"/> <Setter Property="FontSize" Value="14"/>
<Setter Property="FontFamily" Value="微软雅黑"/> <Setter Property="FontFamily" Value="微软雅黑"/>
<Setter Property="Foreground" Value="#333333"/> <Setter Property="Foreground" Value="#333333"/>
<Setter Property="TextWrapping" Value="Wrap"/> <Setter Property="TextWrapping" Value="Wrap"/>
@ -396,9 +405,12 @@
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!-- 标题部分 --> <StackPanel Orientation="Horizontal">
<TextBlock Text="{TemplateBinding Header}" Margin="8,0,0,0" FontWeight="Bold"/> <Image Source="../Resources/icon-title.png" Margin="10,5,10,0"/>
<!-- 标题部分 -->
<TextBlock Text="{TemplateBinding Header}" Margin="0,5,0,0" FontWeight="Bold"/>
</StackPanel>
<!-- 内容部分带滚动条 --> <!-- 内容部分带滚动条 -->
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto" PreviewMouseWheel ="ScrollViewer_PreviewMouseWheel"> <ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto" PreviewMouseWheel ="ScrollViewer_PreviewMouseWheel">
<ContentPresenter ContentSource="Content"/> <ContentPresenter ContentSource="Content"/>

@ -175,7 +175,7 @@
Grid.Column="0" Grid.Column="0"
Width="175" Width="175"
Height="37" Height="37"
Margin="26,0,0,0" Margin="18,0,0,0"
HorizontalAlignment="Left"> HorizontalAlignment="Left">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center"> <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<Image Source="../Resources/icon-title.png" Margin="0,5,10,0"/> <Image Source="../Resources/icon-title.png" Margin="0,5,10,0"/>

@ -1070,12 +1070,14 @@
<EmbeddedResource Include="Resources\lanjuLogoNew.ico"> <EmbeddedResource Include="Resources\lanjuLogoNew.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource> </EmbeddedResource>
<Resource Include="Resources\circular.png" />
<Content Include="Resources\hongfang.png"> <Content Include="Resources\hongfang.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Resource Include="Resources\factory.png" /> <Resource Include="Resources\factory.png" />
<Resource Include="Resources\device.png" /> <Resource Include="Resources\device.png" />
<Resource Include="Resources\icon-title.png" /> <Resource Include="Resources\icon-title.png" />
<Resource Include="Resources\leaf.png" />
<Content Include="Resources\nitsos.png"> <Content Include="Resources\nitsos.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>

@ -1,4 +1,4 @@
#pragma checksum "..\..\..\..\Views\LanJu_Prepare.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "37CEFA4A0AAF06BC553642AFA7E0F8D390F0FFA260D58943F57C160C6027736A" #pragma checksum "..\..\..\..\Views\LanJu_Prepare.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "A0549B58D56B50DC7E166E9B6D9A30427539AE148E0B5412D73119145C150BC5"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// 此代码由工具生成。 // 此代码由工具生成。

@ -1,4 +1,4 @@
#pragma checksum "..\..\..\..\Views\LanJu_Prepare.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "37CEFA4A0AAF06BC553642AFA7E0F8D390F0FFA260D58943F57C160C6027736A" #pragma checksum "..\..\..\..\Views\LanJu_Prepare.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "A0549B58D56B50DC7E166E9B6D9A30427539AE148E0B5412D73119145C150BC5"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// 此代码由工具生成。 // 此代码由工具生成。

@ -10,9 +10,9 @@
<!--车间编码--> <!--车间编码-->
<add key="SiteCode" value="1000" /> <add key="SiteCode" value="1000" />
<!--设备编码--> <!--设备编码-->
<add key="DeviceCode" value="XL01" /> <add key="DeviceCode" value="XL04" />
<!--上位机类型 0:工单准备1成型机\shoupei2烘房,3:人员登录--> <!--上位机类型 0:工单准备1成型机\shoupei2烘房,3:人员登录-->
<add key="ClientMode" value="1" /> <add key="ClientMode" value="0" />
<add key="SerialPort" value="COM5" /> <add key="SerialPort" value="COM5" />

@ -44,15 +44,23 @@
<Grid Width="280" Height="240" VerticalAlignment="Bottom" Margin="0,150"> <Grid Width="280" Height="240" VerticalAlignment="Bottom" Margin="0,150">
<!--<TextBlock Text="模具管理系统" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="5" Foreground="Gray" FontSize="18"></TextBlock>--> <!--<TextBlock Text="模具管理系统" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="5" Foreground="Gray" FontSize="18"></TextBlock>-->
<StackPanel VerticalAlignment="Center" Margin="10"> <StackPanel VerticalAlignment="Center" Margin="10">
<!--<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<TextBlock Text="" <TextBlock Text="用户: " VerticalAlignment="Center"/>
</StackPanel>--> <TextBox x:Name="username" materialDesign:HintAssist.Hint="账号" Margin="0,5" FontFamily="Champagne &amp; Limousines" FontSize="18" Width="210"></TextBox>
<TextBox x:Name="username" materialDesign:HintAssist.Hint="账号" Margin="0,5" FontFamily="Champagne &amp; Limousines" FontSize="18"></TextBox> </StackPanel>
<StackPanel Orientation="Horizontal">
<PasswordBox x:Name="userpwd" materialDesign:HintAssist.Hint="密码" Margin="0,10" FontFamily="Champagne &amp; Limousines" FontSize="18"></PasswordBox> <TextBlock Text="密码: " VerticalAlignment="Center"/>
<!--<ComboBox x:Name="comboBoxTeam" Margin="0,5"/>--> <PasswordBox x:Name="userpwd" materialDesign:HintAssist.Hint="密码" Margin="0,10" FontFamily="Champagne &amp; Limousines" FontSize="18" Width="210"></PasswordBox>
<ComboBox x:Name="comboBoxShift" Margin="0,5"/> </StackPanel>
<DatePicker x:Name="datepickerWorkDate" Margin="0,5"/> <StackPanel Orientation="Horizontal">
<TextBlock Text="班次: " VerticalAlignment="Center"/>
<ComboBox x:Name="comboBoxShift" Margin="0,5" Width="210"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="工作日: " VerticalAlignment="Center"/>
<DatePicker x:Name="datepickerWorkDate" Margin="0,8" Width="210"/>
</StackPanel>
<!--<ComboBox x:Name="comboBoxTeam" Margin="0,5" Width="210"/>-->
</StackPanel> </StackPanel>
</Grid> </Grid>

@ -110,76 +110,76 @@ namespace XGLFinishPro.Views
{ {
List<FoamingMacModel> orderList = new List<FoamingMacModel>(); List<FoamingMacModel> orderList = new List<FoamingMacModel>();
int currHour = DateTime.Now.Hour; //int currHour = DateTime.Now.Hour;
int currMinute = DateTime.Now.Minute; //int currMinute = DateTime.Now.Minute;
//modelWareHouse = new List<WorkOrder>(); ////modelWareHouse = new List<WorkOrder>();
//userDbWareHouse = new DBService(); ////userDbWareHouse = new DBService();
int shiftId = 0; //int shiftId = 0;
DataTable shiftlist = formingMachineService.GetShiftList(); //DataTable shiftlist = formingMachineService.GetShiftList();
string endTimeRecord = ""; //string endTimeRecord = "";
string startTimeRecord = ""; //string startTimeRecord = "";
foreach (DataRow shift in shiftlist.Rows) //foreach (DataRow shift in shiftlist.Rows)
{ //{
string[] timeStart = shift["Shift_Start_Time"].ToString().Split(':'); // string[] timeStart = shift["Shift_Start_Time"].ToString().Split(':');
string[] timeEnd = shift["Shift_End_Time"].ToString().Split(':'); // string[] timeEnd = shift["Shift_End_Time"].ToString().Split(':');
// 创建两个不带日期的时间点 // // 创建两个不带日期的时间点
TimeSpan currTime = new TimeSpan(currHour, currMinute, 0); // 获取当前小时+分钟数 // TimeSpan currTime = new TimeSpan(currHour, currMinute, 0); // 获取当前小时+分钟数
TimeSpan startTime = new TimeSpan(Convert.ToInt32(timeStart[0]), Convert.ToInt32(timeStart[1]), 0); // 表示9小时45分钟0秒 // TimeSpan startTime = new TimeSpan(Convert.ToInt32(timeStart[0]), Convert.ToInt32(timeStart[1]), 0); // 表示9小时45分钟0秒
TimeSpan endTime = new TimeSpan(Convert.ToInt32(timeEnd[0]), Convert.ToInt32(timeEnd[1]), 0); // TimeSpan endTime = new TimeSpan(Convert.ToInt32(timeEnd[0]), Convert.ToInt32(timeEnd[1]), 0);
// 比较当前时间点和班次开始的时间点 // // 比较当前时间点和班次开始的时间点
int comparisonResultStart = TimeSpan.Compare(currTime, startTime); // int comparisonResultStart = TimeSpan.Compare(currTime, startTime);
// 比较当前时间点和班次结束的时间点 // // 比较当前时间点和班次结束的时间点
int comparisonResultEnd = TimeSpan.Compare(currTime, endTime); // int comparisonResultEnd = TimeSpan.Compare(currTime, endTime);
//if (comparisonResultStart > 0) { Console.WriteLine("time1 大于 time2"); } // //if (comparisonResultStart > 0) { Console.WriteLine("time1 大于 time2"); }
if (comparisonResultStart >= 0 && comparisonResultEnd < 0) // if (comparisonResultStart >= 0 && comparisonResultEnd < 0)
{ // {
endTimeRecord = shift["Shift_Start_Time"].ToString(); // endTimeRecord = shift["Shift_Start_Time"].ToString();
startTimeRecord = shift["Shift_End_Time"].ToString(); // startTimeRecord = shift["Shift_End_Time"].ToString();
shiftId = Convert.ToInt32(shift["shift_id"].ToString()); // shiftId = Convert.ToInt32(shift["shift_id"].ToString());
break; // break;
} // }
else if (comparisonResultStart >= 0 || comparisonResultEnd < 0) // else if (comparisonResultStart >= 0 || comparisonResultEnd < 0)
{ // {
endTimeRecord = shift["Shift_Start_Time"].ToString(); // endTimeRecord = shift["Shift_Start_Time"].ToString();
startTimeRecord = shift["Shift_End_Time"].ToString(); // startTimeRecord = shift["Shift_End_Time"].ToString();
shiftId = Convert.ToInt32(shift["shift_id"].ToString()); // shiftId = Convert.ToInt32(shift["shift_id"].ToString());
break; // break;
} // }
//if (Convert.ToInt32(timeStart[0]) <= currHourWithDecimal && currHourWithDecimal < Convert.ToInt32(timeEnd[0])) // //if (Convert.ToInt32(timeStart[0]) <= currHourWithDecimal && currHourWithDecimal < Convert.ToInt32(timeEnd[0]))
//{ // //{
// shiftId = shift.shiftId; // // shiftId = shift.shiftId;
// break; // // break;
//} // //}
//else if (currHourWithDecimal >= Convert.ToInt32(timeStart[0]) || currHourWithDecimal < Convert.ToInt32(timeEnd[0])) // //else if (currHourWithDecimal >= Convert.ToInt32(timeStart[0]) || currHourWithDecimal < Convert.ToInt32(timeEnd[0]))
//{ // //{
// shiftId = shift.shiftId; // // shiftId = shift.shiftId;
// break; // // break;
//} // //}
} //}
string[] endTimeReally = endTimeRecord.Split(':'); //string[] endTimeReally = endTimeRecord.Split(':');
string[] startTimeReally = startTimeRecord.Split(':'); //string[] startTimeReally = startTimeRecord.Split(':');
DateTime currShiftDate = DateTime.Now.Date; //DateTime currShiftDate = DateTime.Now.Date;
TimeSpan currTimeNew = new TimeSpan(currHour, currMinute, 0); // 获取当前小时+分钟数 //TimeSpan currTimeNew = new TimeSpan(currHour, currMinute, 0); // 获取当前小时+分钟数
TimeSpan startTimeNew = new TimeSpan(Convert.ToInt32(startTimeReally[0]), Convert.ToInt32(startTimeReally[1]), 0); // 表示9小时45分钟0秒 //TimeSpan startTimeNew = new TimeSpan(Convert.ToInt32(startTimeReally[0]), Convert.ToInt32(startTimeReally[1]), 0); // 表示9小时45分钟0秒
TimeSpan endTimeNew = new TimeSpan(Convert.ToInt32(endTimeReally[0]), Convert.ToInt32(endTimeReally[1]), 0); // 表示9小时45分钟0秒 //TimeSpan endTimeNew = new TimeSpan(Convert.ToInt32(endTimeReally[0]), Convert.ToInt32(endTimeReally[1]), 0); // 表示9小时45分钟0秒
//计算白夜班工作日期用 ////计算白夜班工作日期用
int resultstart = TimeSpan.Compare(currTimeNew, startTimeNew); //int resultstart = TimeSpan.Compare(currTimeNew, startTimeNew);
// 比较当前时间点和班次结束的时间点 //// 比较当前时间点和班次结束的时间点
int resultEnd = TimeSpan.Compare(currTimeNew, endTimeNew); //int resultEnd = TimeSpan.Compare(currTimeNew, endTimeNew);
//夜班、 ////夜班、
if (resultstart < 0 && resultEnd < 0) //if (resultstart < 0 && resultEnd < 0)
{ //{
currShiftDate = DateTime.Now.Date.AddDays(-1); // currShiftDate = DateTime.Now.Date.AddDays(-1);
} //}
//modelWareHouse = new List<WorkOrder>(); //modelWareHouse = new List<WorkOrder>();
DataTable dt = userDbWareHouse.GetWetPlanInfo(deviceCode, currShiftDate.ToString());//formingMachineService.GetFormingMachineInfo(deviceCode, currShiftDate.ToString()); DataTable dt = userDbWareHouse.GetWetPlanInfo(deviceCode, LoginUser.WorkDate);//formingMachineService.GetFormingMachineInfo(deviceCode, currShiftDate.ToString());
if (dt == null) return; if (dt == null) return;
if (orderList != null) if (orderList != null)
@ -208,76 +208,76 @@ namespace XGLFinishPro.Views
{ {
List<FoamingMacModel> orderList = new List<FoamingMacModel>(); List<FoamingMacModel> orderList = new List<FoamingMacModel>();
int currHour = DateTime.Now.Hour; //int currHour = DateTime.Now.Hour;
int currMinute = DateTime.Now.Minute; //int currMinute = DateTime.Now.Minute;
//modelWareHouse = new List<WorkOrder>(); ////modelWareHouse = new List<WorkOrder>();
//userDbWareHouse = new DBService(); ////userDbWareHouse = new DBService();
int shiftId = 0; //int shiftId = 0;
DataTable shiftlist = formingMachineService.GetShiftList(); //DataTable shiftlist = formingMachineService.GetShiftList();
string endTimeRecord = ""; //string endTimeRecord = "";
string startTimeRecord = ""; //string startTimeRecord = "";
foreach (DataRow shift in shiftlist.Rows) //foreach (DataRow shift in shiftlist.Rows)
{ //{
string[] timeStart = shift["Shift_Start_Time"].ToString().Split(':'); // string[] timeStart = shift["Shift_Start_Time"].ToString().Split(':');
string[] timeEnd = shift["Shift_End_Time"].ToString().Split(':'); // string[] timeEnd = shift["Shift_End_Time"].ToString().Split(':');
// 创建两个不带日期的时间点 // // 创建两个不带日期的时间点
TimeSpan currTime = new TimeSpan(currHour, currMinute, 0); // 获取当前小时+分钟数 // TimeSpan currTime = new TimeSpan(currHour, currMinute, 0); // 获取当前小时+分钟数
TimeSpan startTime = new TimeSpan(Convert.ToInt32(timeStart[0]), Convert.ToInt32(timeStart[1]), 0); // 表示9小时45分钟0秒 // TimeSpan startTime = new TimeSpan(Convert.ToInt32(timeStart[0]), Convert.ToInt32(timeStart[1]), 0); // 表示9小时45分钟0秒
TimeSpan endTime = new TimeSpan(Convert.ToInt32(timeEnd[0]), Convert.ToInt32(timeEnd[1]), 0); // TimeSpan endTime = new TimeSpan(Convert.ToInt32(timeEnd[0]), Convert.ToInt32(timeEnd[1]), 0);
// 比较当前时间点和班次开始的时间点 // // 比较当前时间点和班次开始的时间点
int comparisonResultStart = TimeSpan.Compare(currTime, startTime); // int comparisonResultStart = TimeSpan.Compare(currTime, startTime);
// 比较当前时间点和班次结束的时间点 // // 比较当前时间点和班次结束的时间点
int comparisonResultEnd = TimeSpan.Compare(currTime, endTime); // int comparisonResultEnd = TimeSpan.Compare(currTime, endTime);
//if (comparisonResultStart > 0) { Console.WriteLine("time1 大于 time2"); } // //if (comparisonResultStart > 0) { Console.WriteLine("time1 大于 time2"); }
if (comparisonResultStart >= 0 && comparisonResultEnd < 0) // if (comparisonResultStart >= 0 && comparisonResultEnd < 0)
{ // {
endTimeRecord = shift["Shift_Start_Time"].ToString(); // endTimeRecord = shift["Shift_Start_Time"].ToString();
startTimeRecord = shift["Shift_End_Time"].ToString(); // startTimeRecord = shift["Shift_End_Time"].ToString();
shiftId = Convert.ToInt32(shift["shift_id"].ToString()); // shiftId = Convert.ToInt32(shift["shift_id"].ToString());
break; // break;
} // }
else if (comparisonResultStart >= 0 || comparisonResultEnd < 0) // else if (comparisonResultStart >= 0 || comparisonResultEnd < 0)
{ // {
endTimeRecord = shift["Shift_Start_Time"].ToString(); // endTimeRecord = shift["Shift_Start_Time"].ToString();
startTimeRecord = shift["Shift_End_Time"].ToString(); // startTimeRecord = shift["Shift_End_Time"].ToString();
shiftId = Convert.ToInt32(shift["shift_id"].ToString()); // shiftId = Convert.ToInt32(shift["shift_id"].ToString());
break; // break;
} // }
//if (Convert.ToInt32(timeStart[0]) <= currHourWithDecimal && currHourWithDecimal < Convert.ToInt32(timeEnd[0])) // //if (Convert.ToInt32(timeStart[0]) <= currHourWithDecimal && currHourWithDecimal < Convert.ToInt32(timeEnd[0]))
//{ // //{
// shiftId = shift.shiftId; // // shiftId = shift.shiftId;
// break; // // break;
//} // //}
//else if (currHourWithDecimal >= Convert.ToInt32(timeStart[0]) || currHourWithDecimal < Convert.ToInt32(timeEnd[0])) // //else if (currHourWithDecimal >= Convert.ToInt32(timeStart[0]) || currHourWithDecimal < Convert.ToInt32(timeEnd[0]))
//{ // //{
// shiftId = shift.shiftId; // // shiftId = shift.shiftId;
// break; // // break;
//} // //}
} //}
string[] endTimeReally = endTimeRecord.Split(':'); //string[] endTimeReally = endTimeRecord.Split(':');
string[] startTimeReally = startTimeRecord.Split(':'); //string[] startTimeReally = startTimeRecord.Split(':');
DateTime currShiftDate = DateTime.Now.Date; //DateTime currShiftDate = DateTime.Now.Date;
TimeSpan currTimeNew = new TimeSpan(currHour, currMinute, 0); // 获取当前小时+分钟数 //TimeSpan currTimeNew = new TimeSpan(currHour, currMinute, 0); // 获取当前小时+分钟数
TimeSpan startTimeNew = new TimeSpan(Convert.ToInt32(startTimeReally[0]), Convert.ToInt32(startTimeReally[1]), 0); // 表示9小时45分钟0秒 //TimeSpan startTimeNew = new TimeSpan(Convert.ToInt32(startTimeReally[0]), Convert.ToInt32(startTimeReally[1]), 0); // 表示9小时45分钟0秒
TimeSpan endTimeNew = new TimeSpan(Convert.ToInt32(endTimeReally[0]), Convert.ToInt32(endTimeReally[1]), 0); // 表示9小时45分钟0秒 //TimeSpan endTimeNew = new TimeSpan(Convert.ToInt32(endTimeReally[0]), Convert.ToInt32(endTimeReally[1]), 0); // 表示9小时45分钟0秒
//计算白夜班工作日期用 ////计算白夜班工作日期用
int resultstart = TimeSpan.Compare(currTimeNew, startTimeNew); //int resultstart = TimeSpan.Compare(currTimeNew, startTimeNew);
// 比较当前时间点和班次结束的时间点 //// 比较当前时间点和班次结束的时间点
int resultEnd = TimeSpan.Compare(currTimeNew, endTimeNew); //int resultEnd = TimeSpan.Compare(currTimeNew, endTimeNew);
//夜班、 ////夜班、
if (resultstart < 0 && resultEnd < 0) //if (resultstart < 0 && resultEnd < 0)
{ //{
currShiftDate = DateTime.Now.Date.AddDays(-1); // currShiftDate = DateTime.Now.Date.AddDays(-1);
} //}
//modelWareHouse = new List<WorkOrder>(); //modelWareHouse = new List<WorkOrder>();
DataTable dt = userDbWareHouse.GetWetPlanInfo(deviceCode, currShiftDate.ToString()); DataTable dt = userDbWareHouse.GetWetPlanInfo(deviceCode, LoginUser.WorkDate);
if (dt == null) return; if (dt == null) return;
this.dgWorkOrderInfo.ItemsSource = null; this.dgWorkOrderInfo.ItemsSource = null;
@ -316,9 +316,7 @@ namespace XGLFinishPro.Views
PauseOrderWin pauseOrderWin = new PauseOrderWin(); PauseOrderWin pauseOrderWin = new PauseOrderWin();
if (pauseOrderWin.ShowDialog() == true) if (pauseOrderWin.ShowDialog() == true)
{ {
PauseRecoverOrderS(workordercode,"w4", pauseOrderWin);
formingMachineService.UpdateWorkOrder(workordercode, "w4", pauseOrderWin.remark, pauseOrderWin.type, deviceCode);
GetWorkOrderInfo(); GetWorkOrderInfo();
} }
//MessageBoxResult result = MessageBox.Show("你确定要暂停该工单吗?", "温馨提示", MessageBoxButton.YesNo, MessageBoxImage.Information); //MessageBoxResult result = MessageBox.Show("你确定要暂停该工单吗?", "温馨提示", MessageBoxButton.YesNo, MessageBoxImage.Information);
@ -327,6 +325,26 @@ namespace XGLFinishPro.Views
} }
private bool PauseRecoverOrderS(string workordercode,string status, PauseOrderWin pauseOrderWin)
{
bool updatestatus = formingMachineService.UpdateWorkOrder(workordercode, status, pauseOrderWin.remark, pauseOrderWin.type, deviceCode);
if (!updatestatus)
{
CustomMessageBox.Show("操作失败!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
}
DataTable dtSubOrders = userDbWareHouse.GetSubOrderInfo(workordercode);
if (dtSubOrders != null)
{
// 递归更新子单状态
foreach (DataRow subOrder in dtSubOrders.Rows)
{
UpdateOrderStatus(subOrder["workorder_code"].ToString());
}
}
return true;
}
private void btnRecover_Click(object sender, RoutedEventArgs e) private void btnRecover_Click(object sender, RoutedEventArgs e)
{ {
//var selectedRow = dgWorkOrderInfo.SelectedItem as FoamingMacModel; //var selectedRow = dgWorkOrderInfo.SelectedItem as FoamingMacModel;
@ -349,7 +367,8 @@ namespace XGLFinishPro.Views
PauseOrderWin pauseOrderWin = new PauseOrderWin(); PauseOrderWin pauseOrderWin = new PauseOrderWin();
if (pauseOrderWin.ShowDialog() == true) if (pauseOrderWin.ShowDialog() == true)
{ {
formingMachineService.UpdateWorkOrder(workordercode, "w2", pauseOrderWin.remark, pauseOrderWin.type, deviceCode); PauseRecoverOrderS(workordercode, "w2", pauseOrderWin);
//formingMachineService.UpdateWorkOrder(workordercode, "w2", pauseOrderWin.remark, pauseOrderWin.type, deviceCode);
GetWorkOrderInfo(); GetWorkOrderInfo();
} }
@ -439,12 +458,7 @@ namespace XGLFinishPro.Views
newReportCode = (Convert.ToInt64(dtNewReportCode.Rows[0]["report_code"].ToString()) + 1).ToString(); newReportCode = (Convert.ToInt64(dtNewReportCode.Rows[0]["report_code"].ToString()) + 1).ToString();
} }
} }
newReportCode = DateTime.Now.ToString("yyyyMMdd")+"0001";
}
else
{
newReportCode = (Convert.ToInt64(dtNewReportCode.Rows[0]["report_code"].ToString()) + 1).ToString();
}
ExecReportWorkWin execReport = new ExecReportWorkWin(selectedRow["workorder_code"].ToString(), selectedRow["quantity_split"].ToString()); ExecReportWorkWin execReport = new ExecReportWorkWin(selectedRow["workorder_code"].ToString(), selectedRow["quantity_split"].ToString());
@ -535,7 +549,7 @@ namespace XGLFinishPro.Views
return; return;
} }
string workorderID = (dgWorkOrderInfo.SelectedItem as DataRowView)["workorder_id"].ToString(); string workorderID = (dgWorkOrderInfo.SelectedItem as DataRowView)["workorder_code"].ToString();
string status = (dgWorkOrderInfo.SelectedItem as DataRowView)["status"].ToString(); string status = (dgWorkOrderInfo.SelectedItem as DataRowView)["status"].ToString();
@ -547,9 +561,8 @@ namespace XGLFinishPro.Views
return; return;
} }
} }
//更新工单状态 //更新工单状态
var updatestatus = userDbWareHouse.UpdateSycnFlag(workorderID); if (!UpdateOrderStatus(workorderID))
if (!updatestatus)
{ {
CustomMessageBox.Show("开始工单失败!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning); CustomMessageBox.Show("开始工单失败!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
} }
@ -558,6 +571,26 @@ namespace XGLFinishPro.Views
TimerDeciveState_Elapsed(null,null); TimerDeciveState_Elapsed(null,null);
} }
} }
private bool UpdateOrderStatus(string workorderID)
{
//更新工单状态
var updatestatus = userDbWareHouse.UpdateSycnFlag(workorderID);
if (!updatestatus)
{
CustomMessageBox.Show("开始工单失败!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
}
DataTable dtSubOrders = userDbWareHouse.GetSubOrderInfo(workorderID);
if (dtSubOrders != null)
{
// 递归更新子单状态
foreach (DataRow subOrder in dtSubOrders.Rows)
{
UpdateOrderStatus(subOrder["workorder_code"].ToString());
}
}
return true;
}
} }
public class ReportWork public class ReportWork
{ {

@ -171,7 +171,7 @@
Grid.Column="0" Grid.Column="0"
Width="175" Width="175"
Height="37" Height="37"
Margin="26,0,0,0" Margin="18,0,0,0"
HorizontalAlignment="Left"> HorizontalAlignment="Left">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center"> <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<Image Source="../Resources/icon-title.png" Margin="0,5,10,0"/> <Image Source="../Resources/icon-title.png" Margin="0,5,10,0"/>

@ -156,7 +156,7 @@ namespace XGLFinishPro.Views
private void UserControl_Loaded(object sender, RoutedEventArgs e) private void UserControl_Loaded(object sender, RoutedEventArgs e)
{ {
this.dateStart.SelectedDate = DateTime.Now; this.dateStart.SelectedDate = Convert.ToDateTime(LoginUser.WorkDate);//DateTime.Now;
timerDeciveState.Interval = Utils.GetAppSetting("GetDeviceStateInterval") == "" ? 15000 : Convert.ToInt32(Utils.GetAppSetting("GetDeviceStateInterval")); timerDeciveState.Interval = Utils.GetAppSetting("GetDeviceStateInterval") == "" ? 15000 : Convert.ToInt32(Utils.GetAppSetting("GetDeviceStateInterval"));
timerDeciveState.Elapsed += TimerDeciveState_Elapsed; timerDeciveState.Elapsed += TimerDeciveState_Elapsed;
//timerDeciveState.Start(); //timerDeciveState.Start();
@ -217,7 +217,7 @@ namespace XGLFinishPro.Views
return; return;
} }
string workorderID = (WorkOrder.SelectedItem as DataRowView)["workorder_id"].ToString(); string workorderID = (WorkOrder.SelectedItem as DataRowView)["workorder_code"].ToString();
string status = (WorkOrder.SelectedItem as DataRowView)["status"].ToString(); string status = (WorkOrder.SelectedItem as DataRowView)["status"].ToString();
@ -244,8 +244,8 @@ namespace XGLFinishPro.Views
//更新工单状态 //更新工单状态
var updatestatus = userDbWareHouse.UpdateSycnFlag(workorderID); //var updatestatus = userDbWareHouse.UpdateSycnFlag(workorderID);
if (!updatestatus) if (!UpdateOrderStatus(workorderID))
{ {
CustomMessageBox.Show("开始工单失败!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning); CustomMessageBox.Show("开始工单失败!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
} }
@ -353,6 +353,27 @@ namespace XGLFinishPro.Views
} }
private bool UpdateOrderStatus(string workorderID)
{
//更新工单状态
var updatestatus = userDbWareHouse.UpdateSycnFlag(workorderID);
if (!updatestatus)
{
CustomMessageBox.Show("开始工单失败!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
}
DataTable dtSubOrders = userDbWareHouse.GetSubOrderInfo(workorderID);
if (dtSubOrders != null)
{
// 递归更新子单状态
foreach (DataRow subOrder in dtSubOrders.Rows)
{
UpdateOrderStatus(subOrder["workorder_code"].ToString());
}
}
return true;
}
private void Flow_Click(object sender, RoutedEventArgs e) private void Flow_Click(object sender, RoutedEventArgs e)
{ {

Loading…
Cancel
Save