Browse Source

新增

master
wugang 7 years ago
parent
commit
526fd27800
10 changed files with 149 additions and 32 deletions
  1. +18
    -0
      CowOutputClient/AutoCloseWindow.xaml
  2. +45
    -0
      CowOutputClient/AutoCloseWindow.xaml.cs
  3. +7
    -0
      CowOutputClient/CowOutputClient.csproj
  4. +8
    -8
      CowOutputClient/OperateWindow.xaml
  5. +20
    -4
      CowOutputClient/OperateWindow.xaml.cs
  6. +1
    -1
      CowOutputClient/app.config
  7. +1
    -1
      FireBirdUtil/SqlHelper/CreateTableHelper.cs
  8. +46
    -18
      WeighBusiness/BL/WeightInfoBL.cs
  9. +1
    -0
      WeighBusiness/BO/CreateTables/CreateWeightInfo.cs
  10. +2
    -0
      WeighBusiness/BO/WeightInfo.cs

+ 18
- 0
CowOutputClient/AutoCloseWindow.xaml View File

@ -0,0 +1,18 @@
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:cc="clr-namespace:CowOutputClient"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="CowOutputClient.AutoCloseWindow"
Title="AutoCloseWindow" Height="100" Width="500" Loaded="Window_Loaded" WindowStyle="None" AllowsTransparency="True" Background="#0fff" WindowStartupLocation="CenterScreen" >
<Grid>
<Border CornerRadius="20" Background="#ccc">
<Border Margin="20" Background="White">
</Border>
</Border>
<Label Name="lblInfo" Content="" FontSize="20px" HorizontalAlignment="Center" Margin="0,0,0,0" VerticalAlignment="Center"/>
</Grid>
</Window>

+ 45
- 0
CowOutputClient/AutoCloseWindow.xaml.cs View File

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Threading;
namespace CowOutputClient
{
/// <summary>
/// Interaction logic for AutoCloseWindow.xaml
/// </summary>
public partial class AutoCloseWindow : Window
{
private DispatcherTimer mShowTimer;
private string mInfo;
public AutoCloseWindow(string info)
{
InitializeComponent();
mInfo = info;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
lblInfo.Content = mInfo;
mShowTimer = new DispatcherTimer();
mShowTimer.Tick += new EventHandler(CloseWindow);
mShowTimer.Interval = new TimeSpan(0, 0, 0, 2, 0);
mShowTimer.Start();
}
public void CloseWindow(object sender, EventArgs e)
{
this.Close();
}
}
}

+ 7
- 0
CowOutputClient/CowOutputClient.csproj View File

@ -61,6 +61,9 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</ApplicationDefinition> </ApplicationDefinition>
<Compile Include="AutoCloseWindow.xaml.cs">
<DependentUpon>AutoCloseWindow.xaml</DependentUpon>
</Compile>
<Compile Include="CalendarSelecterWindow.xaml.cs"> <Compile Include="CalendarSelecterWindow.xaml.cs">
<DependentUpon>CalendarSelecterWindow.xaml</DependentUpon> <DependentUpon>CalendarSelecterWindow.xaml</DependentUpon>
</Compile> </Compile>
@ -74,6 +77,10 @@
<DependentUpon>SelectedProductWindow.xaml</DependentUpon> <DependentUpon>SelectedProductWindow.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Utils\WindowUtil.cs" /> <Compile Include="Utils\WindowUtil.cs" />
<Page Include="AutoCloseWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="CalendarSelecterWindow.xaml"> <Page Include="CalendarSelecterWindow.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>


+ 8
- 8
CowOutputClient/OperateWindow.xaml View File

@ -129,14 +129,14 @@ Property="HorizontalContentAlignment" Value="Center">
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> </DataGridTemplateColumn>
<DataGridTextColumn Binding="{Binding Number}" IsReadOnly="True" Header="序号" Width="1*"/>
<DataGridTextColumn Binding="{Binding Goods_Name}" IsReadOnly="True" Header="产品名称" Width="3*"/>
<DataGridTextColumn Binding="{Binding Goods_Spec}" IsReadOnly="True" Header="规格" Width="2*"/>
<DataGridTextColumn IsReadOnly="True" Binding="{Binding NetWeight}" Header="净重" Width="1*"/>
<DataGridTextColumn IsReadOnly="True" Binding="{Binding Weight}" Header="毛重" Width="1*"/>
<DataGridTextColumn IsReadOnly="True" Binding="{Binding SubWeight}" Header="皮重" Width="1*"/>
<DataGridTextColumn IsReadOnly="True" Binding="{Binding SecondNum}" Header="辅数量" Width="1.5*"/>
<DataGridTemplateColumn Header="操作" Width="1.5*">
<DataGridTextColumn Binding="{Binding DetailSequence}" IsReadOnly="True" Header="序号" Width="1*" CanUserSort="False"/>
<DataGridTextColumn Binding="{Binding Goods_Name}" IsReadOnly="True" Header="产品名称" Width="3*" CanUserSort="False"/>
<DataGridTextColumn Binding="{Binding Goods_Spec}" IsReadOnly="True" Header="规格" Width="2*" CanUserSort="False"/>
<DataGridTextColumn IsReadOnly="True" Binding="{Binding NetWeight}" Header="净重" Width="1*" CanUserSort="False"/>
<DataGridTextColumn IsReadOnly="True" Binding="{Binding Weight}" Header="毛重" Width="1*" CanUserSort="False"/>
<DataGridTextColumn IsReadOnly="True" Binding="{Binding SubWeight}" Header="皮重" Width="1*" CanUserSort="False"/>
<DataGridTextColumn IsReadOnly="True" Binding="{Binding SecondNum}" Header="辅数量" Width="1.5*" CanUserSort="False"/>
<DataGridTemplateColumn Header="操作" Width="1.5*" CanUserSort="False">
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
<DataTemplate> <DataTemplate>
<Button Content="删除" <Button Content="删除"


+ 20
- 4
CowOutputClient/OperateWindow.xaml.cs View File

@ -39,6 +39,7 @@ namespace CowOutputClient
bool IsLoad = true; bool IsLoad = true;
decimal? tare = null; decimal? tare = null;
public OperateWindow() public OperateWindow()
{ {
InitializeComponent(); InitializeComponent();
@ -89,6 +90,7 @@ namespace CowOutputClient
inputDetail.Set<long?>("Goods_ID", item.Goods_ID); inputDetail.Set<long?>("Goods_ID", item.Goods_ID);
inputDetail.Set<decimal?>("Number", item.NetWeight); inputDetail.Set<decimal?>("Number", item.NetWeight);
inputDetail.Set<long?>("ButcDetailID", item.ButcDetailID); inputDetail.Set<long?>("ButcDetailID", item.ButcDetailID);
inputDetail.Set<decimal?>("ProductNum", item.ProductNum);
details.Add(inputDetail); details.Add(inputDetail);
} }
output.Set("Details", details); output.Set("Details", details);
@ -260,12 +262,19 @@ namespace CowOutputClient
return; return;
weight.SecondNum = goodsWeight; weight.SecondNum = goodsWeight;
} else { } else {
if (!SetStandardWeight(floatData, detail, goodsWeight??0, weight))
if (!SetStandardWeight(floatData, detail, goodsWeight ?? 0, weight))
return; return;
} }
//var keypadWindow2 = new Keypad(this);
//if (keypadWindow2.ShowDialog() == true && !string.IsNullOrEmpty(keypadWindow2.Result)) {
// goodsWeight = decimal.Parse(keypadWindow2.Result);
//}
//weight.Weight = goodsWeight.Value;
weight.SubWeight = tare; weight.SubWeight = tare;
weight.NetWeight = weight.Weight - (weight.SubWeight??0); weight.NetWeight = weight.Weight - (weight.SubWeight??0);
weight.CreateTime = DateTime.Now; weight.CreateTime = DateTime.Now;
if (rbSingleWeight.IsChecked == true)
weight.ProductNum = 1;
decimal? finishNum = null; decimal? finishNum = null;
using (var she = new SqlHelperEx()) { using (var she = new SqlHelperEx()) {
she.CreateTransaction(); she.CreateTransaction();
@ -275,6 +284,7 @@ namespace CowOutputClient
if (finishNum > mButcherDetailData.PlanNumber) if (finishNum > mButcherDetailData.PlanNumber)
throw new ApplicationException("计划数量【"+mButcherDetailData.PlanNumber+"】完工数量【"+finishNum+"】超出【"+(finishNum-mButcherDetailData.PlanNumber)+"】"); throw new ApplicationException("计划数量【"+mButcherDetailData.PlanNumber+"】完工数量【"+finishNum+"】超出【"+(finishNum-mButcherDetailData.PlanNumber)+"】");
ProductPlanBL.UpdateButhcerDetailFinishNum(finishNum, mButcherDetailData.DetailID, mButcherDetailData.Goods_ID, she); ProductPlanBL.UpdateButhcerDetailFinishNum(finishNum, mButcherDetailData.DetailID, mButcherDetailData.Goods_ID, she);
//weight.DetailSequence = WeightInfoBL.GetCurrentSequence(mButcherDetailData.DetailID);
} }
WeightInfoBL.Insert(weight,she); WeightInfoBL.Insert(weight,she);
she.Commit(); she.Commit();
@ -284,8 +294,12 @@ namespace CowOutputClient
mButcherDetailData.FinishNum = finishNum; mButcherDetailData.FinishNum = finishNum;
mButcherDetailData.SurplusNum = (mButcherDetailData.PlanNumber ?? 0) - (mButcherDetailData.FinishNum ?? 0); mButcherDetailData.SurplusNum = (mButcherDetailData.PlanNumber ?? 0) - (mButcherDetailData.FinishNum ?? 0);
} }
BindGridWeightInfo();
BindGridWeightInfo(weight.ButcDetailID);
gridWeightInfo.ScrollIntoView(gridWeightInfo.Items[0]); gridWeightInfo.ScrollIntoView(gridWeightInfo.Items[0]);
var items = gridWeightInfo.ItemsSource as List<WeightInfo>;
var closeWindow = new AutoCloseWindow("【" + weight.Goods_Name + "】序号【" + items.Where(x=>x.ButcDetailID == weight.ButcDetailID).FirstOrDefault().DetailSequence + "】");
closeWindow.ShowDialog();
} }
private static bool CheckGoodsWeight(ProCataGoods detail, decimal? num, GoodsWeightFloat_Detail floatData) private static bool CheckGoodsWeight(ProCataGoods detail, decimal? num, GoodsWeightFloat_Detail floatData)
@ -345,9 +359,9 @@ namespace CowOutputClient
} }
} }
private void BindGridWeightInfo()
private void BindGridWeightInfo(long? detailId = null)
{ {
var details = WeightInfoBL.GetWeightInfos();
var details = WeightInfoBL.GetWeightInfos(false,detailId);
gridWeightInfo.ItemsSource = details; gridWeightInfo.ItemsSource = details;
} }
@ -432,6 +446,7 @@ namespace CowOutputClient
WindowUtil.Inf("生成产出单No." + outputId); WindowUtil.Inf("生成产出单No." + outputId);
} }
mButcherDetailData = null;
//var num = RpcFacade.Call<int>("/MainSystem/B3_HaoYue/Rpcs/B3CowButcherManageRpc/FinishButcherDetail", selectedItem.DetailID); //var num = RpcFacade.Call<int>("/MainSystem/B3_HaoYue/Rpcs/B3CowButcherManageRpc/FinishButcherDetail", selectedItem.DetailID);
//if (num == 1) { //if (num == 1) {
// ProductPlanBL.UpdateButhcerDetailFinish(selectedItem.DetailID); // ProductPlanBL.UpdateButhcerDetailFinish(selectedItem.DetailID);
@ -513,6 +528,7 @@ namespace CowOutputClient
} }
} }
} }
BindGridWeightInfo(mButcherDetailData.DetailID);
gridProductPlan.SelectedIndex = -1; gridProductPlan.SelectedIndex = -1;
} }
} }


+ 1
- 1
CowOutputClient/app.config View File

@ -35,7 +35,7 @@
<add key="Format" value="{0:0.000}" /> <add key="Format" value="{0:0.000}" />
<add key="Delay" value="4" /> <add key="Delay" value="4" />
<add key="NoBeginChar" value="false" /> <add key="NoBeginChar" value="false" />
<add key="Weight" value="5" />
<add key="Weight" value="3" />
<!--前腿勾重量配置--> <!--前腿勾重量配置-->
<add key="ForeLeg" value="1.4,2.8" /> <add key="ForeLeg" value="1.4,2.8" />
<!--后腿勾重量配置--> <!--后腿勾重量配置-->


+ 1
- 1
FireBirdUtil/SqlHelper/CreateTableHelper.cs View File

@ -38,7 +38,7 @@ namespace FireBirdUtil.SqlHelpers
if (tableName == "ProductCatalog") { if (tableName == "ProductCatalog") {
AddColumnToTable(database, "PRODUCTCATALOG", "SEQUENCE", "Integer"); AddColumnToTable(database, "PRODUCTCATALOG", "SEQUENCE", "Integer");
} else if (tableName == "ButcherDetail") { } else if (tableName == "ButcherDetail") {
AddColumnToTable(database, "BUTCHERDETAIL", "DELIVERYDATE", "TIMESTAMP");
AddColumnToTable(database, "WEIGHTINFO", "PRODUCTNUM", "Integer");
} }
//else if (tableName == "ProduceIntake") //else if (tableName == "ProduceIntake")
//{ //{


+ 46
- 18
WeighBusiness/BL/WeightInfoBL.cs View File

@ -18,8 +18,8 @@ namespace WeighBusiness.BL
public static bool Insert(WeightInfo weight,SqlHelperEx she2 = null) public static bool Insert(WeightInfo weight,SqlHelperEx she2 = null)
{ {
string insertSql = InsertUtil.GetInsertSql(TableNames., string insertSql = InsertUtil.GetInsertSql(TableNames.,
new string[] { "Goods_Name", "Goods_Spec", "Goods_ID", "Weight", "SubWeight", "NetWeight", "CreateTime", "ProductBatch", "IsSend", "SecondNum", "ButcDetailID" },
new string[] { weight.Goods_Name, weight.Goods_Spec, weight.Goods_ID.ToString(), weight.Weight.ToString(), weight.SubWeight == null ? "null" : weight.SubWeight.ToString(), weight.NetWeight == null ? "null" : weight.NetWeight.ToString(), weight.CreateTime == null ? "null" : weight.CreateTime.ToString(), weight.ProductBatch, weight.IsSelected ? "1" : "0", weight.SecondNum == null ? "null" : weight.SecondNum.ToString(), weight.ButcDetailID == null ? "null" : weight.ButcDetailID.ToString() });
new string[] { "Goods_Name", "Goods_Spec", "Goods_ID", "Weight", "SubWeight", "NetWeight", "CreateTime", "ProductBatch", "IsSend", "SecondNum", "ButcDetailID", "ProductNum"},
new string[] { weight.Goods_Name, weight.Goods_Spec, weight.Goods_ID.ToString(), weight.Weight.ToString(), weight.SubWeight == null ? "null" : weight.SubWeight.ToString(), weight.NetWeight == null ? "null" : weight.NetWeight.ToString(), weight.CreateTime == null ? "null" : weight.CreateTime.ToString(), weight.ProductBatch, weight.IsSelected ? "1" : "0", weight.SecondNum == null ? "null" : weight.SecondNum.ToString(), weight.ButcDetailID == null ? "null" : weight.ButcDetailID.ToString(), weight.ProductNum == null ? "null" : weight.ProductNum.ToString() });
bool success; bool success;
string errorMsg; string errorMsg;
if (she2 == null) { if (she2 == null) {
@ -70,14 +70,13 @@ namespace WeighBusiness.BL
} }
public static List<WeightInfo> GetWeightInfos(bool hasOutputId = false)
public static List<WeightInfo> GetWeightInfos(bool hasOutputId = false,long? detailID = null)
{ {
var sql = "select SecondNum,Weight,SubWeight,NetWeight,CreateTime,Goods_ID,ID,Goods_Name,Goods_Spec,ButcDetailID from {0} where 1=1 {1} order by ID desc".FormatWith(TableNames., hasOutputId ? "and Output_ID is not null" : "and Output_ID is null");
var sql = "select SecondNum,Weight,SubWeight,NetWeight,CreateTime,Goods_ID,ID,Goods_Name,Goods_Spec,ButcDetailID,ProductNum from {0} where 1=1 {1} order by ID desc".FormatWith(TableNames., hasOutputId ? "and Output_ID is not null" : "and Output_ID is null");
var table = SqlHelperEx.DoQuery(sql); var table = SqlHelperEx.DoQuery(sql);
if (table.Rows.Count == 0) if (table.Rows.Count == 0)
return new List<WeightInfo>(); return new List<WeightInfo>();
var list = new List<WeightInfo>(); var list = new List<WeightInfo>();
var i = table.Rows.Count;
foreach (DataRow row in table.Rows) { foreach (DataRow row in table.Rows) {
var detail = new WeightInfo(); var detail = new WeightInfo();
detail.SecondNum = DataTypeUtil.GetDecimalNum(row[0]); detail.SecondNum = DataTypeUtil.GetDecimalNum(row[0]);
@ -90,11 +89,40 @@ namespace WeighBusiness.BL
detail.Goods_Name = DataTypeUtil.ToStringEmptyIfNull(row[7]); detail.Goods_Name = DataTypeUtil.ToStringEmptyIfNull(row[7]);
detail.Goods_Spec = DataTypeUtil.ToStringEmptyIfNull(row[8]); detail.Goods_Spec = DataTypeUtil.ToStringEmptyIfNull(row[8]);
detail.ButcDetailID = DataTypeUtil.GetLongNullNum(row[9]); detail.ButcDetailID = DataTypeUtil.GetLongNullNum(row[9]);
detail.Number = i;
i--;
detail.ProductNum = DataTypeUtil.GetDecimalNullNum(row[10]);
list.Add(detail); list.Add(detail);
} }
return list;
var wList = new List<WeightInfo>();
var groups = list.GroupBy(x => x.ButcDetailID);
if (detailID != null) {
var resultGroups = groups.Where(x => x.Key == detailID);
if (resultGroups.Count() > 0) {
var currentGroup = resultGroups.FirstOrDefault().OrderByDescending(x => x.ID);
int i = currentGroup.Count();
currentGroup.ForEach(x => { x.DetailSequence = i--; wList.Add(x); });
}
foreach (var group in groups.Where(x => x.Key != detailID)) {
var orderList = group.OrderByDescending(x => x.ID);
int i = orderList.Count();
orderList.ForEach(x => { x.DetailSequence = i--; wList.Add(x); });
}
} else {
var results = list.Where(x => x.ButcDetailID == null);
if (results.Count() > 0) {
int i = results.Count();
var orderResults = results.OrderByDescending(x => x.ID);
orderResults.ForEach(x => { x.DetailSequence = i--; wList.Add(x); });
}
var notNullResults = list.Where(x => x.ButcDetailID != null);
var gps = notNullResults.GroupBy(x => x.ButcDetailID);
foreach (var group in gps) {
var orderList = group.OrderByDescending(x => x.ID);
int i = orderList.Count();
orderList.ForEach(x => { x.DetailSequence = i--; wList.Add(x); });
}
}
return wList;
} }
public static decimal? GetButcDetailIDWeight(long? butcDetailID,SqlHelperEx she2 = null) public static decimal? GetButcDetailIDWeight(long? butcDetailID,SqlHelperEx she2 = null)
@ -159,20 +187,20 @@ namespace WeighBusiness.BL
return num2 > 0 ? num1 + 1 : num1; return num2 > 0 ? num1 + 1 : num1;
} }
public static List<UnfinishedBatch> GetUnfinishedBatchPage(int pageIndex, int pageSize)
public static int GetCurrentSequence(long detailId)
{ {
var sql = "select * from(select ProductBatch,LegType from {0} where State=0) rows {1} to {2}".FormatWith(TableNames., pageIndex == 1 ? 1 : (pageIndex - 1) * pageSize + 1, pageIndex * pageSize);
var sql = "select max(DetailSequence) from {0} where ButcDetailID = {1} ".FormatWith(TableNames., detailId);
var table = SqlHelperEx.DoQuery(sql); var table = SqlHelperEx.DoQuery(sql);
if (table.Rows.Count == 0) if (table.Rows.Count == 0)
return new List<UnfinishedBatch>();
var list = new List<UnfinishedBatch>();
foreach (DataRow row in table.Rows) {
var detail = new UnfinishedBatch();
detail.ProductBatch = DataTypeUtil.ToStringEmptyIfNull(row[0]);
detail.LegType = row[1].ToString() == "前腿" ? LegType. : LegType.;
list.Add(detail);
return 1;
var result = table.Rows[0][0];
if (result == DBNull.Value) {
return 1;
} else {
var sequence = (int)(result);
sequence = sequence + 1;
return sequence;
} }
return list;
} }
public static List<WeightInfo> GetWeightInfoByIds(params long[] weightIds) public static List<WeightInfo> GetWeightInfoByIds(params long[] weightIds)


+ 1
- 0
WeighBusiness/BO/CreateTables/CreateWeightInfo.cs View File

@ -40,6 +40,7 @@ namespace WeighBusiness.BO.CreateTables
cth.AddField(new FieldInfo() { FieldName = "IsSend", FieldType = FBType.Boolean, IsNotNull = true }); cth.AddField(new FieldInfo() { FieldName = "IsSend", FieldType = FBType.Boolean, IsNotNull = true });
cth.AddField(new FieldInfo() { FieldName = "Output_ID", FieldType = FBType.Integer, IsNotNull = false }); cth.AddField(new FieldInfo() { FieldName = "Output_ID", FieldType = FBType.Integer, IsNotNull = false });
cth.AddField(new FieldInfo() { FieldName = "ButcDetailID", FieldType = FBType.Integer, IsNotNull = false }); cth.AddField(new FieldInfo() { FieldName = "ButcDetailID", FieldType = FBType.Integer, IsNotNull = false });
cth.AddField(new FieldInfo() {FieldName = "ProductNum", FieldType = FBType.Decimal, FieldTypeParams = "(18,6)",IsNotNull = false});
base.AddFields(cth); base.AddFields(cth);
} }


+ 2
- 0
WeighBusiness/BO/WeightInfo.cs View File

@ -24,6 +24,8 @@ namespace WeighBusiness.BO
public string Goods_Spec { get; set; } public string Goods_Spec { get; set; }
public int Number { get; set; } public int Number { get; set; }
public long? ButcDetailID { get; set; } public long? ButcDetailID { get; set; }
public int? DetailSequence { get; set; }
public decimal? ProductNum { get; set; }
public bool IsSelected public bool IsSelected
{ {
get { return mIsSelected; } get { return mIsSelected; }


Loading…
Cancel
Save