Browse Source

客户端调整。

master
yibo 6 years ago
parent
commit
4971c5ce4e
18 changed files with 380 additions and 296 deletions
  1. +2
    -2
      B3DealerClient/BL/CarcassInStoreBL.cs
  2. +3
    -3
      B3DealerClient/BL/FreshInStoreBL.cs
  3. +1
    -1
      B3DealerClient/BO/CarcassInStore/CarcassInStore.cs
  4. +1
    -1
      B3DealerClient/BO/FreshInStore/FreshInStore.cs
  5. +3
    -38
      B3DealerClient/BO/NameIDPair.cs
  6. +2
    -0
      B3DealerClient/BO/NotificationObject.cs
  7. +2
    -0
      B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreConfig.cs
  8. +35
    -5
      B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreContext.cs
  9. +7
    -4
      B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreWindow.xaml
  10. +27
    -17
      B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreWindow.xaml.cs
  11. +19
    -3
      B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutContext.cs
  12. +198
    -198
      B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutWindow.xaml.cs
  13. +1
    -0
      B3DealerClient/Windows/FreshInStoreWindow_/FreshInStoreConfig.cs
  14. +33
    -4
      B3DealerClient/Windows/FreshInStoreWindow_/FreshInStoreContext.cs
  15. +3
    -3
      B3DealerClient/Windows/FreshInStoreWindow_/FreshInStoreWindow.xaml
  16. +19
    -9
      B3DealerClient/Windows/FreshInStoreWindow_/FreshInStoreWindow.xaml.cs
  17. +19
    -3
      B3DealerClient/Windows/FreshSaleOutWindow_/FreshSaleOutContext.cs
  18. +5
    -5
      B3DealerClient/Windows/FreshSaleOutWindow_/FreshSaleOutWindow.xaml.cs

+ 2
- 2
B3DealerClient/BL/CarcassInStoreBL.cs View File

@ -80,11 +80,11 @@ namespace B3DealerClient.BL
del.EExecute(); del.EExecute();
} }
public static long FinishInStore(long id)
public static long FinishInStore(long id,long inStoreID)
{ {
var target = GetBillReceive(id); var target = GetBillReceive(id);
return RpcFacade.Call<long>(MethodPath + "FinishInStore", JsonConvert.SerializeObject(target));
return RpcFacade.Call<long>(MethodPath + "FinishInStore", JsonConvert.SerializeObject(target), inStoreID);
} }
} }
} }

+ 3
- 3
B3DealerClient/BL/FreshInStoreBL.cs View File

@ -50,17 +50,17 @@ namespace B3DealerClient.BL
} }
} }
public static long FinishInStore(long id)
public static long FinishInStore(long id, long inStoreID)
{ {
var target = GetReceiveInfo(id); var target = GetReceiveInfo(id);
return RpcFacade.Call<long>(MethodPath + "FreshFinishInStore", JsonConvert.SerializeObject(target));
return RpcFacade.Call<long>(MethodPath + "FreshFinishInStore", JsonConvert.SerializeObject(target), inStoreID);
} }
private static IList GetReceiveInfo(long id) private static IList GetReceiveInfo(long id)
{ {
var query = new DmoQuery(typeof(FreshInStore_Record)); var query = new DmoQuery(typeof(FreshInStore_Record));
query.Where.Conditions.Add(DQCondition.EQ("BillID",id));
query.Where.Conditions.Add(DQCondition.EQ("BillID", id));
return query.EExecuteList(); return query.EExecuteList();
} }


+ 1
- 1
B3DealerClient/BO/CarcassInStore/CarcassInStore.cs View File

@ -16,7 +16,7 @@ namespace B3DealerClient.BO
public DateTime? ArrivedDate { get; set; } public DateTime? ArrivedDate { get; set; }
public string Store_Name { get; set; }
//public string Store_Name { get; set; }
private bool mSelected; private bool mSelected;
public bool Selected public bool Selected


+ 1
- 1
B3DealerClient/BO/FreshInStore/FreshInStore.cs View File

@ -16,7 +16,7 @@ namespace B3DealerClient.BO
public DateTime? ArrivedDate { get; set; } public DateTime? ArrivedDate { get; set; }
public string Store_Name { get; set; }
//public string Store_Name { get; set; }
private bool mSelected; private bool mSelected;
public bool Selected public bool Selected


+ 3
- 38
B3DealerClient/BO/NameIDPair.cs View File

@ -6,45 +6,10 @@ using System.Threading.Tasks;
namespace B3DealerClient.BO namespace B3DealerClient.BO
{ {
public class NameIDPair : NotificationObject
public class NameIDPair
{ {
private long? mID;
public long? ID
{
get { return mID; }
set
{
mID = value;
RaisePropertyChanged("ID");
}
}
public long ID { get; set; }
private string mName;
public string Name
{
get { return mName; }
set
{
mName = value;
RaisePropertyChanged("Name");
}
}
public void Clear()
{
Fill(null, null);
}
public void Fill(long? id, string name)
{
ID = id;
Name = name;
}
public void Fill(NameIDPair copy)
{
ID = copy.ID;
Name = copy.Name;
}
public string Name { get; set; }
} }
} }

+ 2
- 0
B3DealerClient/BO/NotificationObject.cs View File

@ -18,5 +18,7 @@ namespace B3DealerClient.BO
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName)); this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
} }
} }
public static readonly long? NullLong = null;
} }
} }

+ 2
- 0
B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreConfig.cs View File

@ -11,6 +11,8 @@ namespace B3DealerClient.Windows.CarcassInStoreWindow_
{ {
public NameIDPair Store { get; set; } public NameIDPair Store { get; set; }
public NameIDPair InStore { get; set; }
public decimal? HookWeight { get; set; } public decimal? HookWeight { get; set; }
public decimal? Pics { get; set; } public decimal? Pics { get; set; }


+ 35
- 5
B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreContext.cs View File

@ -33,11 +33,39 @@ namespace B3DealerClient.Windows.CarcassInStoreWindow_
} }
} }
private NameIDPair mSupplier = new NameIDPair();
public NameIDPair Supplier { get { return mSupplier; } }
private NameIDPair mSupplier;
public NameIDPair Supplier
{
get { return mSupplier; }
set
{
mSupplier = value;
RaisePropertyChanged("Supplier");
}
}
private NameIDPair mStore = new NameIDPair();
public NameIDPair Store { get { return mStore; } }
private NameIDPair mStore;
public NameIDPair Store
{
get { return mStore; }
set
{
mStore = value;
RaisePropertyChanged("Store");
}
}
private NameIDPair mInStore;
public NameIDPair InStore
{
get { return mInStore; }
set
{
mInStore = value;
RaisePropertyChanged("InStore");
RaisePropertyChanged("CanInStore");
}
}
private decimal? mHookWeight; private decimal? mHookWeight;
public decimal? HookWeight public decimal? HookWeight
@ -74,7 +102,7 @@ namespace B3DealerClient.Windows.CarcassInStoreWindow_
} }
private CarcassInStore mDmo = null; private CarcassInStore mDmo = null;
public CarcassInStore Dmo { get { return mDmo; } set { mDmo = value; RaisePropertyChanged("Dmo"); } }
public CarcassInStore Dmo { get { return mDmo; } set { mDmo = value; RaisePropertyChanged("Dmo"); RaisePropertyChanged("CanInStore"); } }
private CarcassInStore_Detail mDetail = null; private CarcassInStore_Detail mDetail = null;
public CarcassInStore_Detail Detail { get { return mDetail; } set { mDetail = value; RaisePropertyChanged("Detail"); RaisePropertyChanged("CanSave"); } } public CarcassInStore_Detail Detail { get { return mDetail; } set { mDetail = value; RaisePropertyChanged("Detail"); RaisePropertyChanged("CanSave"); } }
@ -95,5 +123,7 @@ namespace B3DealerClient.Windows.CarcassInStoreWindow_
public CarcassInStore_Receive Receive { get { return mReceive; } set { mReceive = value; RaisePropertyChanged("Receive"); } } public CarcassInStore_Receive Receive { get { return mReceive; } set { mReceive = value; RaisePropertyChanged("Receive"); } }
public bool CanSave { get { return Pics > 0 && Weight > 0 && mDetail != null; } } public bool CanSave { get { return Pics > 0 && Weight > 0 && mDetail != null; } }
public bool CanInStore { get { return InStore != null && mDmo != null; } }
} }
} }

+ 7
- 4
B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreWindow.xaml View File

@ -14,6 +14,9 @@
<Setter Property="IsReadOnly" Value="True"/> <Setter Property="IsReadOnly" Value="True"/>
<Setter Property="Cursor" Value="Hand"/> <Setter Property="Cursor" Value="Hand"/>
</Style> </Style>
<Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Style TargetType="DatePicker" BasedOn="{StaticResource DatePickerStyle1}"> <Style TargetType="DatePicker" BasedOn="{StaticResource DatePickerStyle1}">
<Setter Property="Width" Value="130"/> <Setter Property="Width" Value="130"/>
<Setter Property="Height" Value="35"/> <Setter Property="Height" Value="35"/>
@ -47,14 +50,14 @@
<local:WeightControl x:Name="weightControl" HorizontalAlignment="Left" Width="250" Margin="2,5,0,5"/> <local:WeightControl x:Name="weightControl" HorizontalAlignment="Left" Width="250" Margin="2,5,0,5"/>
<WrapPanel HorizontalAlignment="Right" Margin="0,10,10,0"> <WrapPanel HorizontalAlignment="Right" Margin="0,10,10,0">
<TextBlock Text="扣钩重:"/> <TextBlock Text="扣钩重:"/>
<TextBox x:Name="hook" Margin="0,-5,0,0" Text="{Binding HookWeight,StringFormat=\{0:0.######\}}" PreviewMouseDown="NumberBox_PreviewMouseDown"/>
<TextBox x:Name="hook" Text="{Binding HookWeight,StringFormat=\{0:0.######\}}" PreviewMouseDown="NumberBox_PreviewMouseDown"/>
</WrapPanel> </WrapPanel>
<WrapPanel Grid.Column="1" HorizontalAlignment="Center" Margin="0,10"> <WrapPanel Grid.Column="1" HorizontalAlignment="Center" Margin="0,10">
<TextBlock Text="供应商:"/> <TextBlock Text="供应商:"/>
<TextBlock Text="{Binding Dmo.Supplier_Name}" Width="200" TextWrapping="Wrap" Margin="0,0,10,0" Foreground="Red"/> <TextBlock Text="{Binding Dmo.Supplier_Name}" Width="200" TextWrapping="Wrap" Margin="0,0,10,0" Foreground="Red"/>
<TextBlock Text="仓库:"/>
<TextBlock Text="{Binding Dmo.Store_Name}" Width="120" TextWrapping="Wrap" Foreground="Red"/>
<TextBlock Text="收货仓库:" Foreground="Red"/>
<TextBox x:Name="InStore" Text="{Binding InStore.Name}" PreviewMouseDown="BaseInfoBox_PreviewMouseDown" Foreground="Red"/>
</WrapPanel> </WrapPanel>
</Grid> </Grid>
</Border> </Border>
@ -238,7 +241,7 @@
</Style> </Style>
</WrapPanel.Resources> </WrapPanel.Resources>
<Button Content="称重记录" IsEnabled="{Binding Dmo, Converter={StaticResource NullIsFalseConverter}}" PreviewMouseDown="ViewBtn_PreviewMouseDown"/> <Button Content="称重记录" IsEnabled="{Binding Dmo, Converter={StaticResource NullIsFalseConverter}}" PreviewMouseDown="ViewBtn_PreviewMouseDown"/>
<Button Content="入库完成" IsEnabled="{Binding Dmo, Converter={StaticResource NullIsFalseConverter}}" PreviewMouseDown="FinishBtn_PreviewMouseDown"/>
<Button Content="入库完成" IsEnabled="{Binding CanInStore}" PreviewMouseDown="FinishBtn_PreviewMouseDown"/>
</WrapPanel> </WrapPanel>
<WrapPanel Grid.Column="1" HorizontalAlignment="Right"> <WrapPanel Grid.Column="1" HorizontalAlignment="Right">


+ 27
- 17
B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreWindow.xaml.cs View File

@ -30,15 +30,15 @@ namespace B3DealerClient.Windows.CarcassInStoreWindow_
{ {
InitializeComponent(); InitializeComponent();
// 全屏设置 // 全屏设置
Rect rc = SystemParameters.WorkArea;//获取工作区大小
this.Width = rc.Width;
this.Height = rc.Height;
context = new CarcassInStoreContext();
this.DataContext = context;
Rect rc = SystemParameters.WorkArea;//获取工作区大小
this.Width = rc.Width;
this.Height = rc.Height;
context = new CarcassInStoreContext();
this.DataContext = context;
this.Loaded += CarcassInStoreWindow_Loaded;
this.weightControl.ReceivedValue += weightControl_ReceivedValue;
weightControl.weightSwitch.Click += weightSwitch_Click;
this.Loaded += CarcassInStoreWindow_Loaded;
this.weightControl.ReceivedValue += weightControl_ReceivedValue;
weightControl.weightSwitch.Click += weightSwitch_Click;
} }
void weightSwitch_Click(object sender, RoutedEventArgs e) void weightSwitch_Click(object sender, RoutedEventArgs e)
@ -56,7 +56,9 @@ namespace B3DealerClient.Windows.CarcassInStoreWindow_
{ {
config = XmlUtil.DeserializeFromFile<CarcassInStoreConfig>(); config = XmlUtil.DeserializeFromFile<CarcassInStoreConfig>();
if (config.Store != null) if (config.Store != null)
context.Store.Fill(config.Store);
context.Store = config.Store;
if (config.InStore != null)
context.InStore = config.InStore;
context.HookWeight = config.HookWeight; context.HookWeight = config.HookWeight;
context.Pics = config.Pics; context.Pics = config.Pics;
} }
@ -89,19 +91,27 @@ namespace B3DealerClient.Windows.CarcassInStoreWindow_
private void BaseInfoBox_PreviewMouseDown(object sender, MouseButtonEventArgs e) private void BaseInfoBox_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{ {
var tb = sender as TextBox; var tb = sender as TextBox;
var dig = new BaseInfoDialog(tb.Name);
var dataKind = tb.Name;
if (tb.Name == "InStore")
dataKind = "Store";
var dig = new BaseInfoDialog(dataKind);
if (dig.ShowDialog() == true) if (dig.ShowDialog() == true)
{ {
switch (tb.Name) switch (tb.Name)
{ {
case "Supplier": case "Supplier":
context.Supplier.Fill(dig.Result);
context.Supplier = dig.Result;
break; break;
case "Store": case "Store":
context.Store.Fill(dig.Result);
context.Store = dig.Result;
config.Store = dig.Result; config.Store = dig.Result;
XmlUtil.SerializerObjToFile(config); XmlUtil.SerializerObjToFile(config);
break; break;
case "InStore":
context.InStore = dig.Result;
config.InStore = dig.Result;
XmlUtil.SerializerObjToFile(config);
break;
} }
} }
} }
@ -186,8 +196,8 @@ namespace B3DealerClient.Windows.CarcassInStoreWindow_
{ {
Date = context.Date, Date = context.Date,
ArrivedDate = context.ArrivedDate, ArrivedDate = context.ArrivedDate,
Supplier_ID = context.Supplier.ID,
Store_ID = context.Store.ID
Supplier_ID = context.Supplier == null ? NotificationObject.NullLong : context.Supplier.ID,
Store_ID = context.Store == null ? NotificationObject.NullLong : context.Store.ID
}); });
context.Dmo = null; context.Dmo = null;
context.Detail = null; context.Detail = null;
@ -196,8 +206,8 @@ namespace B3DealerClient.Windows.CarcassInStoreWindow_
case "qc": case "qc":
context.Date = null; context.Date = null;
context.ArrivedDate = null; context.ArrivedDate = null;
context.Supplier.Clear();
context.Store.Clear();
context.Supplier = null;
context.Store = null;
break; break;
} }
} }
@ -249,7 +259,7 @@ namespace B3DealerClient.Windows.CarcassInStoreWindow_
if (!target.Any()) if (!target.Any())
throw new Exception("没有收获明细!"); throw new Exception("没有收获明细!");
var id = CarcassInStoreBL.FinishInStore(context.Dmo.ID);
var id = CarcassInStoreBL.FinishInStore(context.Dmo.ID, context.InStore.ID);
MessageBox.Show("生成采购收货单No." + id); MessageBox.Show("生成采购收货单No." + id);
} }
} }


+ 19
- 3
B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutContext.cs View File

@ -23,10 +23,26 @@ namespace B3DealerClient.Windows.CarcassSaleOutWindow_
} }
private NameIDPair mDriverGoodsLine = new NameIDPair() { Name = "请选择" }; private NameIDPair mDriverGoodsLine = new NameIDPair() { Name = "请选择" };
public NameIDPair DriverGoodsLine { get { return mDriverGoodsLine; } }
public NameIDPair DriverGoodsLine
{
get { return mDriverGoodsLine; }
set
{
mDriverGoodsLine = value;
RaisePropertyChanged("DriverGoodsLine");
}
}
private NameIDPair mStore = new NameIDPair();
public NameIDPair Store { get { return mStore; } }
private NameIDPair mStore;
public NameIDPair Store
{
get { return mStore; }
set
{
mStore = value;
RaisePropertyChanged("Store");
}
}
private decimal? mHookWeight; private decimal? mHookWeight;
public decimal? HookWeight public decimal? HookWeight


+ 198
- 198
B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutWindow.xaml.cs View File

@ -57,247 +57,247 @@ namespace B3DealerClient.Windows.CarcassSaleOutWindow_
{ {
config = XmlUtil.DeserializeFromFile<CarcassSaleOutConfig>(); config = XmlUtil.DeserializeFromFile<CarcassSaleOutConfig>();
if (config.Store != null) if (config.Store != null)
context.Store.Fill(config.Store);
context.Store = config.Store;
context.HookWeight = config.HookWeight; context.HookWeight = config.HookWeight;
pageSize = (int)customerPanel.ActualHeight / 60; pageSize = (int)customerPanel.ActualHeight / 60;
} }
private void NumberBox_PreviewMouseDown(object sender, MouseButtonEventArgs e)
private void NumberBox_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
var numberPad = new NumberPad(this);
if (numberPad.ShowDialog() == true)
{ {
var numberPad = new NumberPad(this);
if (numberPad.ShowDialog() == true)
{
decimal value = 0;
if (!string.IsNullOrEmpty(numberPad.Result) && !decimal.TryParse(numberPad.Result, out value))
throw new Exception("输入错误");
decimal value = 0;
if (!string.IsNullOrEmpty(numberPad.Result) && !decimal.TryParse(numberPad.Result, out value))
throw new Exception("输入错误");
var name = (sender as TextBox).Name;
switch (name)
{
case "hook":
context.HookWeight = value;
config.HookWeight = value;
break;
//case "number":
// context.Number = value;
// config.Number = value;
// break;
}
XmlUtil.SerializerObjToFile(config);
var name = (sender as TextBox).Name;
switch (name)
{
case "hook":
context.HookWeight = value;
config.HookWeight = value;
break;
//case "number":
// context.Number = value;
// config.Number = value;
// break;
} }
XmlUtil.SerializerObjToFile(config);
} }
}
private void BaseInfoBox_PreviewMouseDown(object sender, MouseButtonEventArgs e)
private void BaseInfoBox_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
var tb = sender as FrameworkElement;
var dig = new BaseInfoDialog(tb.Name);
if (dig.ShowDialog() == true)
{ {
var tb = sender as FrameworkElement;
var dig = new BaseInfoDialog(tb.Name);
if (dig.ShowDialog() == true)
switch (tb.Name)
{ {
switch (tb.Name)
{
case "DriverGoodsLine":
context.DriverGoodsLine.Fill(dig.Result);
pageIndex = 0;
BindCustomerPanel();
break;
case "Store":
context.Store.Fill(dig.Result);
config.Store = dig.Result;
XmlUtil.SerializerObjToFile(config);
break;
}
case "DriverGoodsLine":
context.DriverGoodsLine = dig.Result;
pageIndex = 0;
BindCustomerPanel();
break;
case "Store":
context.Store = dig.Result;
config.Store = dig.Result;
XmlUtil.SerializerObjToFile(config);
break;
} }
} }
}
void BindCustomerPanel()
{
context.CustomerList = CarcassSaleOutBL.GetCustomers(new
{
Date = context.Date,
Store_ID = context.Store.ID,
DeliverGoodsLine_ID = context.DriverGoodsLine.ID,
PageIndex = pageIndex,
PageSize = pageSize
});
}
void BindCustomerPanel()
{
context.CustomerList = CarcassSaleOutBL.GetCustomers(new
{
Date = context.Date,
Store_ID = context.Store == null ? NotificationObject.NullLong : context.Store.ID,
DeliverGoodsLine_ID = context.DriverGoodsLine.ID,
PageIndex = pageIndex,
PageSize = pageSize
});
}
private void PageBtn_PreviewMouseDown(object sender, MouseButtonEventArgs e)
private void PageBtn_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
var tag = (sender as Button).Tag.ToString();
if (tag == "0")
{ {
var tag = (sender as Button).Tag.ToString();
if (tag == "0")
{
if (pageIndex == 0)
return;
pageIndex -= 1;
BindCustomerPanel();
}
else
{
if (context.CustomerList == null || context.CustomerList.Count < pageSize)
return;
pageIndex += 1;
BindCustomerPanel();
}
if (pageIndex == 0)
return;
pageIndex -= 1;
BindCustomerPanel();
} }
private void NumberBtn_PreviewMouseDown(object sender, MouseButtonEventArgs e)
else
{ {
var c = (sender as Button).Content.ToString();
switch (c)
{
case "0":
context.StrNumber = "0";
break;
case "./点":
if (string.IsNullOrEmpty(context.StrNumber))
context.StrNumber = "0.";
else if (context.StrNumber.Contains('.'))
return;
else
context.StrNumber += ".";
break;
default:
if (context.StrNumber == "0")
context.StrNumber = c;
else
context.StrNumber += c;
break;
}
if (context.CustomerList == null || context.CustomerList.Count < pageSize)
return;
pageIndex += 1;
BindCustomerPanel();
} }
}
private void CustomerBtn_PriviewMouseDown(object sender, MouseButtonEventArgs e)
private void NumberBtn_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
var c = (sender as Button).Content.ToString();
switch (c)
{ {
if (context.Dmo != null)
context.Dmo = null;
if (context.Detail != null)
context.Detail = null;
if (context.Details.Any())
context.Details.Clear();
var obj = (sender as ListBoxItem).DataContext as CustomerObj;
context.DmoList = CarcassSaleOutBL.GetDmoList(new
{
Date = context.Date,
Customer_ID = obj.ID,
Store_ID = context.Store.ID,
AssignFinished = obj.Finished
});
foreach (var item in context.CustomerList)
{
if (item.Selected && !item.Equals(obj))
item.Selected = false;
else if (!item.Selected && item.Equals(obj))
item.Selected = true;
}
case "0":
context.StrNumber = "0";
break;
case "./点":
if (string.IsNullOrEmpty(context.StrNumber))
context.StrNumber = "0.";
else if (context.StrNumber.Contains('.'))
return;
else
context.StrNumber += ".";
break;
default:
if (context.StrNumber == "0")
context.StrNumber = c;
else
context.StrNumber += c;
break;
} }
}
private void MainGridFocus(object sender, MouseButtonEventArgs e)
private void CustomerBtn_PriviewMouseDown(object sender, MouseButtonEventArgs e)
{
if (context.Dmo != null)
context.Dmo = null;
if (context.Detail != null)
context.Detail = null;
if (context.Details.Any())
context.Details.Clear();
var obj = (sender as ListBoxItem).DataContext as CustomerObj;
context.DmoList = CarcassSaleOutBL.GetDmoList(new
{ {
var row = sender as DataGridRow;
context.Dmo = row.Item as CarcassSaleOut;
foreach (var item in context.DmoList)
{
if (item.Selected && item.ID != context.Dmo.ID)
item.Selected = false;
else if (item.Selected && item.ID == context.Dmo.ID)
context.Dmo.Selected = true;
}
MainSelected();
}
Date = context.Date,
Customer_ID = obj.ID,
Store_ID = context.Store == null ? NotificationObject.NullLong : context.Store.ID,
AssignFinished = obj.Finished
});
void MainSelected()
foreach (var item in context.CustomerList)
{ {
context.Details.Clear();
var details = CarcassSaleOutBL.GetDetailRecords(context.Dmo.DetailID);
foreach (var item in details)
context.Details.Add(item);
context.Detail = context.Details.FirstOrDefault();
DetailSelected();
if (item.Selected && !item.Equals(obj))
item.Selected = false;
else if (!item.Selected && item.Equals(obj))
item.Selected = true;
} }
}
private void DetailGridFocus(object sender, MouseButtonEventArgs e)
private void MainGridFocus(object sender, MouseButtonEventArgs e)
{
var row = sender as DataGridRow;
context.Dmo = row.Item as CarcassSaleOut;
foreach (var item in context.DmoList)
{ {
var row = sender as DataGridRow;
context.Detail = row.Item as CarcassSaleOut_Record;
DetailSelected();
if (item.Selected && item.ID != context.Dmo.ID)
item.Selected = false;
else if (item.Selected && item.ID == context.Dmo.ID)
context.Dmo.Selected = true;
} }
MainSelected();
}
void DetailSelected()
{
if (context.Detail == null)
return;
void MainSelected()
{
context.Details.Clear();
var details = CarcassSaleOutBL.GetDetailRecords(context.Dmo.DetailID);
foreach (var item in details)
context.Details.Add(item);
context.Detail = context.Details.FirstOrDefault();
DetailSelected();
}
foreach (var item in context.Details)
{
if (item.Selected && item.ID != context.Detail.ID)
item.Selected = false;
else if (!item.Selected && item.ID == context.Detail.ID)
item.Selected = true;
}
}
private void DetailGridFocus(object sender, MouseButtonEventArgs e)
{
var row = sender as DataGridRow;
context.Detail = row.Item as CarcassSaleOut_Record;
DetailSelected();
}
private void DeleteBtn_PreviewMouseDown(object sender, MouseButtonEventArgs e)
void DetailSelected()
{
if (context.Detail == null)
return;
foreach (var item in context.Details)
{ {
var confirm = MessageBox.Show("确定要删除选中记录吗?", "删除确认", MessageBoxButton.OKCancel, MessageBoxImage.Question);
if (confirm == MessageBoxResult.OK)
{
CarcassSaleOutBL.Delete(context.Detail.ID);
context.Details.Remove(context.Detail);
context.Dmo.AlreadyNumber = (context.Dmo.AlreadyNumber ?? 0) - context.Detail.NetWeight;
context.Dmo.AlreadySecondNumber = (context.Dmo.AlreadySecondNumber ?? 0) - context.Detail.SecondNumber;
context.Detail = context.Details.FirstOrDefault();
DetailSelected();
}
if (item.Selected && item.ID != context.Detail.ID)
item.Selected = false;
else if (!item.Selected && item.ID == context.Detail.ID)
item.Selected = true;
} }
}
private void SaveBtn_PreviewMouseDown(object sender, MouseButtonEventArgs e)
private void DeleteBtn_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
var confirm = MessageBox.Show("确定要删除选中记录吗?", "删除确认", MessageBoxButton.OKCancel, MessageBoxImage.Question);
if (confirm == MessageBoxResult.OK)
{ {
var record = new CarcassSaleOut_Record();
record.MainID = context.Dmo.ID;
record.DetailID = context.Dmo.DetailID;
record.Goods_Name = context.Dmo.Goods_Name;
record.Weight = context.Weight;
record.SecondNumber = context.Number;
record.Discont = (context.HookWeight ?? 0) * Math.Ceiling(record.SecondNumber);
record.NetWeight = record.Weight - record.Discont;
record.Date = DateTime.Now;
record.Selected = true;
CarcassSaleOutBL.InsertRecord(record);
context.Details.Add(record);
context.Dmo.AlreadyNumber = (context.Dmo.AlreadyNumber ?? 0) + record.NetWeight;
context.Dmo.AlreadySecondNumber = (context.Dmo.AlreadySecondNumber ?? 0) + record.SecondNumber;
context.Detail = record;
CarcassSaleOutBL.Delete(context.Detail.ID);
context.Details.Remove(context.Detail);
context.Dmo.AlreadyNumber = (context.Dmo.AlreadyNumber ?? 0) - context.Detail.NetWeight;
context.Dmo.AlreadySecondNumber = (context.Dmo.AlreadySecondNumber ?? 0) - context.Detail.SecondNumber;
context.Detail = context.Details.FirstOrDefault();
DetailSelected(); DetailSelected();
weightControl.Weight = 0;
context.Weight = 0;
context.StrNumber = string.Empty;
} }
}
private void ViewBtn_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
new RecordViewDialog(context.Dmo.ID).ShowDialog();
}
private void SaveBtn_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
var record = new CarcassSaleOut_Record();
record.MainID = context.Dmo.ID;
record.DetailID = context.Dmo.DetailID;
record.Goods_Name = context.Dmo.Goods_Name;
record.Weight = context.Weight;
record.SecondNumber = context.Number;
record.Discont = (context.HookWeight ?? 0) * Math.Ceiling(record.SecondNumber);
record.NetWeight = record.Weight - record.Discont;
record.Date = DateTime.Now;
record.Selected = true;
CarcassSaleOutBL.InsertRecord(record);
context.Details.Add(record);
context.Dmo.AlreadyNumber = (context.Dmo.AlreadyNumber ?? 0) + record.NetWeight;
context.Dmo.AlreadySecondNumber = (context.Dmo.AlreadySecondNumber ?? 0) + record.SecondNumber;
context.Detail = record;
DetailSelected();
weightControl.Weight = 0;
context.Weight = 0;
context.StrNumber = string.Empty;
}
private void FinishBtn_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
private void ViewBtn_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
new RecordViewDialog(context.Dmo.ID).ShowDialog();
}
var targets = context.DmoList.Where(x => x.ID == context.Dmo.ID);
var needConfirm = targets.Any(x => (x.AlreadyNumber ?? 0) == 0 || (x.SecondNumber ?? 0) == 0);
if (needConfirm)
{
var confirm = MessageBox.Show("存在未配货的明细,确认配货完成?", "配货完成确认", MessageBoxButton.OKCancel, MessageBoxImage.Question);
if (confirm != MessageBoxResult.OK)
return;
}
var r = MessageBox.Show("确认配货完成?", "配货完成确认", MessageBoxButton.OKCancel, MessageBoxImage.Question);
if (r != MessageBoxResult.OK)
private void FinishBtn_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
var targets = context.DmoList.Where(x => x.ID == context.Dmo.ID);
var needConfirm = targets.Any(x => (x.AlreadyNumber ?? 0) == 0 || (x.SecondNumber ?? 0) == 0);
if (needConfirm)
{
var confirm = MessageBox.Show("存在未配货的明细,确认配货完成?", "配货完成确认", MessageBoxButton.OKCancel, MessageBoxImage.Question);
if (confirm != MessageBoxResult.OK)
return; return;
CarcassSaleOutBL.FinishAssign(context.Dmo.ID);
foreach (var item in targets)
item.AssignFinished = true;
context.Dmo = context.Dmo;
MessageBox.Show("配货完成");
} }
var r = MessageBox.Show("确认配货完成?", "配货完成确认", MessageBoxButton.OKCancel, MessageBoxImage.Question);
if (r != MessageBoxResult.OK)
return;
CarcassSaleOutBL.FinishAssign(context.Dmo.ID);
foreach (var item in targets)
item.AssignFinished = true;
context.Dmo = context.Dmo;
MessageBox.Show("配货完成");
}
} }
} }

+ 1
- 0
B3DealerClient/Windows/FreshInStoreWindow_/FreshInStoreConfig.cs View File

@ -10,5 +10,6 @@ namespace B3DealerClient.Windows.FreshInStoreWindow_
public class FreshInStoreConfig public class FreshInStoreConfig
{ {
public NameIDPair Store { get; set; } public NameIDPair Store { get; set; }
public NameIDPair InStore { get; set; }
} }
} }

+ 33
- 4
B3DealerClient/Windows/FreshInStoreWindow_/FreshInStoreContext.cs View File

@ -33,11 +33,39 @@ namespace B3DealerClient.Windows.FreshInStoreWindow_
} }
} }
private NameIDPair mSupplier = new NameIDPair();
public NameIDPair Supplier { get { return mSupplier; } }
private NameIDPair mSupplier;
public NameIDPair Supplier
{
get { return mSupplier; }
set
{
mSupplier = value;
RaisePropertyChanged("Supplier");
}
}
private NameIDPair mStore = new NameIDPair();
public NameIDPair Store { get { return mStore; } }
private NameIDPair mStore;
public NameIDPair Store
{
get { return mStore; }
set
{
mStore = value;
RaisePropertyChanged("Store");
}
}
private NameIDPair mInStore;
public NameIDPair InStore
{
get { return mInStore; }
set
{
mInStore = value;
RaisePropertyChanged("InStore");
RaisePropertyChanged("CanInStore");
}
}
private decimal? mPics; private decimal? mPics;
public decimal? Pics public decimal? Pics
@ -82,5 +110,6 @@ namespace B3DealerClient.Windows.FreshInStoreWindow_
} }
public bool CanSave { get { return Pics > 0 && mDetail != null; } } public bool CanSave { get { return Pics > 0 && mDetail != null; } }
public bool CanInStore { get { return InStore != null && mDmo != null; } }
} }
} }

+ 3
- 3
B3DealerClient/Windows/FreshInStoreWindow_/FreshInStoreWindow.xaml View File

@ -129,8 +129,8 @@
<WrapPanel HorizontalAlignment="Center" VerticalAlignment="Center"> <WrapPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="供应商:"/> <TextBlock Text="供应商:"/>
<TextBlock Text="{Binding Dmo.Supplier_Name}" Width="200" TextWrapping="Wrap" Margin="0,0,10,0" Foreground="Red"/> <TextBlock Text="{Binding Dmo.Supplier_Name}" Width="200" TextWrapping="Wrap" Margin="0,0,10,0" Foreground="Red"/>
<TextBlock Text="仓库:"/>
<TextBlock Text="{Binding Dmo.Store_Name}" Width="120" TextWrapping="Wrap" Foreground="Red"/>
<TextBlock Text="入库仓库:" Foreground="Red"/>
<TextBox x:Name="InStore" Text="{Binding InStore.Name}" PreviewMouseDown="BaseInfoBox_PreviewMouseDown" Foreground="Red"/>
</WrapPanel> </WrapPanel>
</Border> </Border>
<GroupBox Grid.Row="1" Header="装车明细" Margin="1"> <GroupBox Grid.Row="1" Header="装车明细" Margin="1">
@ -174,7 +174,7 @@
<WrapPanel Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Right"> <WrapPanel Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Right">
<Button Content="按装货入库" IsEnabled="{Binding Dmo, Converter={StaticResource NullIsFalseConverter}}" PreviewMouseDown="FillByBillBtn_PreviewMouseDown"/> <Button Content="按装货入库" IsEnabled="{Binding Dmo, Converter={StaticResource NullIsFalseConverter}}" PreviewMouseDown="FillByBillBtn_PreviewMouseDown"/>
<Button Content="入库完成" IsEnabled="{Binding Dmo, Converter={StaticResource NullIsFalseConverter}}" PreviewMouseDown="FinishBtn_PreviewMouseDown"/>
<Button Content="入库完成" IsEnabled="{Binding CanInStore}" PreviewMouseDown="FinishBtn_PreviewMouseDown"/>
</WrapPanel> </WrapPanel>
<WrapPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right"> <WrapPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right">


+ 19
- 9
B3DealerClient/Windows/FreshInStoreWindow_/FreshInStoreWindow.xaml.cs View File

@ -42,25 +42,35 @@ namespace B3DealerClient.Windows.FreshInStoreWindow_
{ {
config = XmlUtil.DeserializeFromFile<FreshInStoreConfig>(); config = XmlUtil.DeserializeFromFile<FreshInStoreConfig>();
if (config.Store != null) if (config.Store != null)
context.Store.Fill(config.Store);
context.Store = config.Store;
if (config.InStore != null)
context.InStore = config.InStore;
} }
private void BaseInfoBox_PreviewMouseDown(object sender, MouseButtonEventArgs e) private void BaseInfoBox_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{ {
var tb = sender as TextBox; var tb = sender as TextBox;
var dig = new BaseInfoDialog(tb.Name);
var dataKind = tb.Name;
if (tb.Name == "InStore")
dataKind = "Store";
var dig = new BaseInfoDialog(dataKind);
if (dig.ShowDialog() == true) if (dig.ShowDialog() == true)
{ {
switch (tb.Name) switch (tb.Name)
{ {
case "Supplier": case "Supplier":
context.Supplier.Fill(dig.Result);
context.Supplier = dig.Result;
break; break;
case "Store": case "Store":
context.Store.Fill(dig.Result);
context.Store = dig.Result;
config.Store = dig.Result; config.Store = dig.Result;
XmlUtil.SerializerObjToFile(config); XmlUtil.SerializerObjToFile(config);
break; break;
case "InStore":
context.InStore = dig.Result;
config.InStore = dig.Result;
XmlUtil.SerializerObjToFile(config);
break;
} }
} }
} }
@ -108,8 +118,8 @@ namespace B3DealerClient.Windows.FreshInStoreWindow_
{ {
Date = context.Date, Date = context.Date,
ArrivedDate = context.ArrivedDate, ArrivedDate = context.ArrivedDate,
Supplier_ID = context.Supplier.ID,
Store_ID = context.Store.ID
Supplier_ID = context.Supplier == null ? NotificationObject.NullLong : context.Supplier.ID,
Store_ID = context.Store == null ? NotificationObject.NullLong : context.Store.ID
}); });
context.Dmo = null; context.Dmo = null;
context.Detail = null; context.Detail = null;
@ -117,8 +127,8 @@ namespace B3DealerClient.Windows.FreshInStoreWindow_
case "qc": case "qc":
context.Date = null; context.Date = null;
context.ArrivedDate = null; context.ArrivedDate = null;
context.Supplier.Clear();
context.Store.Clear();
context.Supplier = null;
context.Store = null;
break; break;
} }
} }
@ -190,7 +200,7 @@ namespace B3DealerClient.Windows.FreshInStoreWindow_
if (!target.Any()) if (!target.Any())
throw new Exception("没有收获明细!"); throw new Exception("没有收获明细!");
var id = FreshInStoreBL.FinishInStore(context.Dmo.ID);
var id = FreshInStoreBL.FinishInStore(context.Dmo.ID, context.InStore.ID);
MessageBox.Show("生成采购收货单No." + id); MessageBox.Show("生成采购收货单No." + id);
} }


+ 19
- 3
B3DealerClient/Windows/FreshSaleOutWindow_/FreshSaleOutContext.cs View File

@ -23,10 +23,26 @@ namespace B3DealerClient.Windows.FreshSaleOutWindow_
} }
private NameIDPair mDriverGoodsLine = new NameIDPair() { Name = "请选择" }; private NameIDPair mDriverGoodsLine = new NameIDPair() { Name = "请选择" };
public NameIDPair DriverGoodsLine { get { return mDriverGoodsLine; } }
public NameIDPair DriverGoodsLine
{
get { return mDriverGoodsLine; }
set
{
mDriverGoodsLine = value;
RaisePropertyChanged("DriverGoodsLine");
}
}
private NameIDPair mStore = new NameIDPair();
public NameIDPair Store { get { return mStore; } }
private NameIDPair mStore;
public NameIDPair Store
{
get { return mStore; }
set
{
mStore = value;
RaisePropertyChanged("Store");
}
}
private decimal mNumber; private decimal mNumber;
public decimal Number public decimal Number


+ 5
- 5
B3DealerClient/Windows/FreshSaleOutWindow_/FreshSaleOutWindow.xaml.cs View File

@ -44,7 +44,7 @@ namespace B3DealerClient.Windows.FreshSaleOutWindow_
{ {
config = XmlUtil.DeserializeFromFile<FreshSaleOutConfig>(); config = XmlUtil.DeserializeFromFile<FreshSaleOutConfig>();
if (config.Store != null) if (config.Store != null)
context.Store.Fill(config.Store);
context.Store = config.Store;
pageSize = (int)customerPanel.ActualHeight / 60; pageSize = (int)customerPanel.ActualHeight / 60;
} }
@ -57,12 +57,12 @@ namespace B3DealerClient.Windows.FreshSaleOutWindow_
switch (tb.Name) switch (tb.Name)
{ {
case "DriverGoodsLine": case "DriverGoodsLine":
context.DriverGoodsLine.Fill(dig.Result);
context.DriverGoodsLine = dig.Result;
pageIndex = 0; pageIndex = 0;
BindCustomerPanel(); BindCustomerPanel();
break; break;
case "Store": case "Store":
context.Store.Fill(dig.Result);
context.Store = dig.Result;
config.Store = dig.Result; config.Store = dig.Result;
XmlUtil.SerializerObjToFile(config); XmlUtil.SerializerObjToFile(config);
break; break;
@ -108,7 +108,7 @@ namespace B3DealerClient.Windows.FreshSaleOutWindow_
context.CustomerList = FreshSaleOutBL.GetCustomers(new context.CustomerList = FreshSaleOutBL.GetCustomers(new
{ {
Date = context.Date, Date = context.Date,
Store_ID = context.Store.ID,
Store_ID = context.Store == null ? NotificationObject.NullLong : context.Store.ID,
DeliverGoodsLine_ID = context.DriverGoodsLine.ID, DeliverGoodsLine_ID = context.DriverGoodsLine.ID,
PageIndex = pageIndex, PageIndex = pageIndex,
PageSize = pageSize PageSize = pageSize
@ -146,7 +146,7 @@ namespace B3DealerClient.Windows.FreshSaleOutWindow_
{ {
Date = context.Date, Date = context.Date,
Customer_ID = obj.ID, Customer_ID = obj.ID,
Store_ID = context.Store.ID,
Store_ID = context.Store == null ? NotificationObject.NullLong : context.Store.ID,
AssignFinished = obj.Finished AssignFinished = obj.Finished
}); });


Loading…
Cancel
Save