yibo 6 years ago
parent
commit
a15650e77c
34 changed files with 1686 additions and 470 deletions
  1. +30
    -3
      B3DealerClient/B3DealerClient.csproj
  2. +3
    -0
      B3DealerClient/BL/BaseInfoBL.cs
  3. +3
    -3
      B3DealerClient/BL/CarcassInStoreBL.cs
  4. +92
    -0
      B3DealerClient/BL/CarcassSaleOutBL.cs
  5. +92
    -0
      B3DealerClient/BL/FreshInStoreBL.cs
  6. +0
    -88
      B3DealerClient/BO/CarcassInStore.cs
  7. +43
    -0
      B3DealerClient/BO/CarcassInStore/CarcassInStore.cs
  8. +58
    -0
      B3DealerClient/BO/CarcassInStore/CarcassInStore_Detail.cs
  9. +52
    -0
      B3DealerClient/BO/CarcassInStore/CarcassInStore_Receive.cs
  10. +0
    -103
      B3DealerClient/BO/CarcassInStore_Detail.cs
  11. +0
    -127
      B3DealerClient/BO/CarcassInStore_Receive.cs
  12. +73
    -0
      B3DealerClient/BO/CarcassSaleOut/CarcassSaleOut.cs
  13. +52
    -0
      B3DealerClient/BO/CarcassSaleOut/CarcassSaleOut_Record.cs
  14. +33
    -0
      B3DealerClient/BO/CarcassSaleOut/CustomerObj.cs
  15. +43
    -0
      B3DealerClient/BO/FreshInStore/FreshInStore.cs
  16. +54
    -0
      B3DealerClient/BO/FreshInStore/FreshInStore_Detail.cs
  17. +24
    -0
      B3DealerClient/BO/FreshInStore/FreshInStore_Record.cs
  18. +3
    -0
      B3DealerClient/Dialogs/BaseInfoDialog.xaml.cs
  19. +3
    -2
      B3DealerClient/Utils/ValueConverter.cs
  20. +1
    -4
      B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreWindow.xaml
  21. +8
    -8
      B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreWindow.xaml.cs
  22. +16
    -0
      B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutConfig.cs
  23. +137
    -0
      B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutContext.cs
  24. +94
    -91
      B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutWindow.xaml
  25. +277
    -1
      B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutWindow.xaml.cs
  26. +17
    -0
      B3DealerClient/Windows/CarcassSaleOutWindow_/RecordViewDialog.xaml
  27. +36
    -0
      B3DealerClient/Windows/CarcassSaleOutWindow_/RecordViewDialog.xaml.cs
  28. +27
    -0
      B3DealerClient/Windows/CarcassSaleOutWindow_/SelfValueConvert.cs
  29. +16
    -0
      B3DealerClient/Windows/FreshInStoreWindow_/FreshInStoreConfig.cs
  30. +74
    -0
      B3DealerClient/Windows/FreshInStoreWindow_/FreshInStoreContext.cs
  31. +54
    -39
      B3DealerClient/Windows/FreshInStoreWindow_/FreshInStoreWindow.xaml
  32. +184
    -1
      B3DealerClient/Windows/FreshInStoreWindow_/FreshInStoreWindow.xaml.cs
  33. +43
    -0
      B3DealerClient/Windows/Test.xaml
  34. +44
    -0
      B3DealerClient/Windows/Test.xaml.cs

+ 30
- 3
B3DealerClient/B3DealerClient.csproj View File

@ -78,10 +78,18 @@
</Compile>
<Compile Include="BL\BaseInfoBL.cs" />
<Compile Include="BL\CarcassInStoreBL.cs" />
<Compile Include="BL\CarcassSaleOutBL.cs" />
<Compile Include="BL\FreshInStoreBL.cs" />
<Compile Include="BL\LoginBL.cs" />
<Compile Include="BO\CarcassInStore.cs" />
<Compile Include="BO\CarcassInStore_Detail.cs" />
<Compile Include="BO\CarcassInStore_Receive.cs" />
<Compile Include="BO\CarcassInStore\CarcassInStore.cs" />
<Compile Include="BO\CarcassInStore\CarcassInStore_Detail.cs" />
<Compile Include="BO\CarcassInStore\CarcassInStore_Receive.cs" />
<Compile Include="BO\CarcassSaleOut\CarcassSaleOut.cs" />
<Compile Include="BO\CarcassSaleOut\CarcassSaleOut_Record.cs" />
<Compile Include="BO\CarcassSaleOut\CustomerObj.cs" />
<Compile Include="BO\FreshInStore\FreshInStore.cs" />
<Compile Include="BO\FreshInStore\FreshInStore_Detail.cs" />
<Compile Include="BO\FreshInStore\FreshInStore_Record.cs" />
<Compile Include="BO\NameIDPair.cs" />
<Compile Include="BO\NotificationObject.cs" />
<Compile Include="Control\DataFormat\DataFormat.cs" />
@ -125,15 +133,26 @@
<Compile Include="Windows\CarcassInStoreWindow_\RecordViewDialog.xaml.cs">
<DependentUpon>RecordViewDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Windows\CarcassSaleOutWindow_\CarcassSaleOutConfig.cs" />
<Compile Include="Windows\CarcassSaleOutWindow_\CarcassSaleOutContext.cs" />
<Compile Include="Windows\CarcassSaleOutWindow_\CarcassSaleOutWindow.xaml.cs">
<DependentUpon>CarcassSaleOutWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Windows\CarcassSaleOutWindow_\RecordViewDialog.xaml.cs">
<DependentUpon>RecordViewDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Windows\CarcassSaleOutWindow_\SelfValueConvert.cs" />
<Compile Include="Windows\FreshInStoreWindow_\FreshInStoreConfig.cs" />
<Compile Include="Windows\FreshInStoreWindow_\FreshInStoreContext.cs" />
<Compile Include="Windows\FreshInStoreWindow_\FreshInStoreWindow.xaml.cs">
<DependentUpon>FreshInStoreWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Windows\FreshSaleOutWindow_\FreshSaleOutWindow.xaml.cs">
<DependentUpon>FreshSaleOutWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Windows\Test.xaml.cs">
<DependentUpon>Test.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
@ -240,6 +259,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Windows\CarcassSaleOutWindow_\RecordViewDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Windows\FreshInStoreWindow_\FreshInStoreWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@ -248,6 +271,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Windows\Test.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Resource Include="app.ico" />


+ 3
- 0
B3DealerClient/BL/BaseInfoBL.cs View File

@ -23,6 +23,9 @@ namespace B3DealerClient.BL
case "Store":
dataKind = "授权仓库";
break;
case "DriverGoodsLine":
dataKind = "B3Dealer_送货线路";
break;
default:
throw new Exception(string.Format("未知的数据源类型:{0}", typeName));
}


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

@ -26,7 +26,7 @@ namespace B3DealerClient.BL
{
var method = MethodPath + "GetPayBillDetails";
var json = RpcFacade.Call<string>(method, id);
var list= JsonConvert.DeserializeObject<List<CarcassInStore_Detail>>(json);
var list = JsonConvert.DeserializeObject<List<CarcassInStore_Detail>>(json);
FillAlreadyInfo(list);
return list;
}
@ -40,11 +40,11 @@ namespace B3DealerClient.BL
query.Columns.Add(DQSelectColumn.Sum("NetWeight"));
query.Columns.Add(DQSelectColumn.Sum("Pics"));
query.GroupBy.Expressions.Add(DQExpression.Field("DetailID"));
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("MainID", details.First().PayBill_ID), DQCondition.InList(DQExpression.Field("DetailID"), details.Select(x => DQExpression.Value(x.ID)).ToArray())));
query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("DetailID"), details.Select(x => DQExpression.Value(x.ID)).ToArray()));
var list = query.EExecuteList<long, decimal, decimal>();
foreach (var item in list)
{
var first = details.FirstOrDefault(x => x.ID == item.Item1);
var first = details.First(x => x.ID == item.Item1);
first.AlreadyNumber = item.Item2;
first.AlreadySecondNumber = item.Item3;
}


+ 92
- 0
B3DealerClient/BL/CarcassSaleOutBL.cs View File

@ -0,0 +1,92 @@
using B3DealerClient.BO;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.JsonRpc.Client;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using B3DealerClient.Utils;
using Forks.EnterpriseServices.DomainObjects2;
namespace B3DealerClient.BL
{
public static class CarcassSaleOutBL
{
const string MethodPath = @"/MainSystem/B3Dealer/Rpcs/SaleOutStoreRpc/";
public static List<CarcassSaleOut> GetDmoList(object condition)
{
var method = MethodPath + "GetSaleOutStoreList";
var json = RpcFacade.Call<string>(method, JsonConvert.SerializeObject(condition));
var list = JsonConvert.DeserializeObject<List<CarcassSaleOut>>(json);
FillAlreadyInfo(list);
return list;
}
private static void FillAlreadyInfo(List<CarcassSaleOut> list)
{
if (list.Count == 0)
return;
var query = new DQueryDom(new JoinAlias(typeof(CarcassSaleOut_Record)));
query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("DetailID"), list.Select(x => DQExpression.Value(x.ID)).ToArray()));
query.Columns.Add(DQSelectColumn.Field("DetailID"));
query.Columns.Add(DQSelectColumn.Sum("NetWeight"));
query.Columns.Add(DQSelectColumn.Sum("SecondNumber"));
query.GroupBy.Expressions.Add(DQExpression.Field("DetailID"));
var records = query.EExecuteList<long, decimal, decimal>();
foreach (var item in records)
{
var f = list.First(x => x.DetailID == item.Item1);
f.AlreadyNumber = item.Item2;
f.AlreadySecondNumber = item.Item3;
}
}
public static List<CustomerObj> GetCustomers(object condition)
{
var method = MethodPath + "GetCustomers";
var json = RpcFacade.Call<string>(method, JsonConvert.SerializeObject(condition));
return JsonConvert.DeserializeObject<List<CustomerObj>>(json);
}
public static IEnumerable<CarcassSaleOut_Record> GetDetailRecords(long detailID)
{
var query = new DmoQuery(typeof(CarcassSaleOut_Record));
query.Where.Conditions.Add(DQCondition.EQ("DetailID", detailID));
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID"));
return query.EExecuteList().Cast<CarcassSaleOut_Record>();
}
public static void Delete(long id)
{
var del = new DQDeleteDom(typeof(CarcassSaleOut_Record));
del.Where.Conditions.Add(DQCondition.EQ("ID", id));
del.EExecute();
}
public static void InsertRecord(CarcassSaleOut_Record record)
{
using (var session = DmoSession.New())
{
session.Insert(record);
session.Commit();
}
}
public static void FinishAssign(long id)
{
var target = GetBillRecords(id);
RpcFacade.Call<int>(MethodPath + "FinishAssign", JsonConvert.SerializeObject(target), id);
}
public static IEnumerable<CarcassSaleOut_Record> GetBillRecords(long billID)
{
var query = new DmoQuery(typeof(CarcassSaleOut_Record));
query.Where.Conditions.Add(DQCondition.EQ("MainID", billID));
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID"));
return query.EExecuteList().Cast<CarcassSaleOut_Record>();
}
}
}

+ 92
- 0
B3DealerClient/BL/FreshInStoreBL.cs View File

@ -0,0 +1,92 @@
using B3DealerClient.BO;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.JsonRpc.Client;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using B3DealerClient.Utils;
using System.Collections;
namespace B3DealerClient.BL
{
public static class FreshInStoreBL
{
const string MethodPath = @"/MainSystem/B3Dealer/Rpcs/PayBillRpc/";
public static List<FreshInStore> GetDmoList(object condition)
{
var method = MethodPath + "GetPayBillList";
var json = RpcFacade.Call<string>(method, JsonConvert.SerializeObject(condition));
return JsonConvert.DeserializeObject<List<FreshInStore>>(json);
}
public static List<FreshInStore_Detail> GetDmoDetailList(long id)
{
var method = MethodPath + "GetPayBillDetails";
var json = RpcFacade.Call<string>(method, id);
var list = JsonConvert.DeserializeObject<List<FreshInStore_Detail>>(json);
FillAlreadyInfo(list);
return list;
}
static void FillAlreadyInfo(List<FreshInStore_Detail> details)
{
if (details.Count == 0)
return;
var query = new DQueryDom(new JoinAlias(typeof(FreshInStore_Record)));
query.Columns.Add(DQSelectColumn.Field("DetailID"));
query.Columns.Add(DQSelectColumn.Sum("Weight"));
query.Columns.Add(DQSelectColumn.Sum("Number"));
query.GroupBy.Expressions.Add(DQExpression.Field("DetailID"));
query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("DetailID"), details.Select(x => DQExpression.Value(x.ID)).ToArray()));
var list = query.EExecuteList<long, decimal?, decimal?>();
foreach (var item in list)
{
var first = details.First(x => x.ID == item.Item1);
first.AlreadyNumber = item.Item2;
first.AlreadySecondNumber = item.Item3;
}
}
public static long FinishInStore(long id)
{
var target = GetReceiveInfo(id);
return RpcFacade.Call<long>(MethodPath + "FreshFinishInStore", JsonConvert.SerializeObject(target));
}
private static IList GetReceiveInfo(long id)
{
var query = new DmoQuery(typeof(FreshInStore_Record));
query.Where.Conditions.Add(DQCondition.EQ("BillID",id));
return query.EExecuteList();
}
public static void InsertRecord(FreshInStore_Record record)
{
using (var session = DmoSession.New())
{
var id = GetExistID(session, record);
if (id.HasValue)
{
record.ID = id.Value;
session.Update(record);
}
else
session.Insert(record);
session.Commit();
}
}
static long? GetExistID(IDmoSession session, FreshInStore_Record record)
{
var query = new DQueryDom(new JoinAlias(typeof(FreshInStore_Record)));
query.Columns.Add(DQSelectColumn.Field("ID"));
query.Where.Conditions.Add(DQCondition.EQ("DetailID", record.DetailID));
return query.EExecuteScalar<long?>(session);
}
}
}

+ 0
- 88
B3DealerClient/BO/CarcassInStore.cs View File

@ -1,88 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace B3DealerClient.BO
{
public class CarcassInStore : NotificationObject
{
private long mID;
public long ID
{
get { return mID; }
set
{
mID = value;
RaisePropertyChanged("ID");
}
}
private string mSupplier_Name;
public string Supplier_Name
{
get { return mSupplier_Name; }
set
{
mSupplier_Name = value;
RaisePropertyChanged("Supplier_Name");
}
}
private DateTime? mDate;
public DateTime? Date
{
get { return mDate; }
set
{
mDate = value;
RaisePropertyChanged("Date");
}
}
private DateTime? mArrivedDate;
public DateTime? ArrivedDate
{
get { return mArrivedDate; }
set
{
mArrivedDate = value;
RaisePropertyChanged("ArrivedDate");
}
}
private string mStore_Name;
public string Store_Name
{
get { return mStore_Name; }
set
{
mStore_Name = value;
RaisePropertyChanged("Store_Name");
}
}
private bool mSelected;
public bool Selected
{
get { return mSelected; }
set
{
mSelected = value;
RaisePropertyChanged("Selected");
}
}
private List<CarcassInStore_Detail> mDetails = new List<CarcassInStore_Detail>();
public List<CarcassInStore_Detail> Details
{
get { return mDetails; }
set
{
mDetails = value;
RaisePropertyChanged("Details");
}
}
}
}

+ 43
- 0
B3DealerClient/BO/CarcassInStore/CarcassInStore.cs View File

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace B3DealerClient.BO
{
public class CarcassInStore : NotificationObject
{
public long ID { get; set; }
public string Supplier_Name { get; set; }
public DateTime? Date { get; set; }
public DateTime? ArrivedDate { get; set; }
public string Store_Name { get; set; }
private bool mSelected;
public bool Selected
{
get { return mSelected; }
set
{
mSelected = value;
RaisePropertyChanged("Selected");
}
}
private List<CarcassInStore_Detail> mDetails = new List<CarcassInStore_Detail>();
public List<CarcassInStore_Detail> Details
{
get { return mDetails; }
set
{
mDetails = value;
RaisePropertyChanged("Details");
}
}
}
}

+ 58
- 0
B3DealerClient/BO/CarcassInStore/CarcassInStore_Detail.cs View File

@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace B3DealerClient.BO
{
public class CarcassInStore_Detail : NotificationObject
{
public long ID { get; set; }
public long PayBill_ID { get; set; }
public string Goods_Name { get; set; }
public decimal? Number { get; set; }
public decimal? SecondNumber { get; set; }
private decimal? mAlreadyNumber;
public decimal? AlreadyNumber
{
get { return mAlreadyNumber; }
set
{
mAlreadyNumber = value;
RaisePropertyChanged("AlreadyNumber");
}
}
private decimal? mAlreadySecondNumber;
public decimal? AlreadySecondNumber
{
get { return mAlreadySecondNumber; }
set
{
mAlreadySecondNumber = value;
RaisePropertyChanged("AlreadySecondNumber");
}
}
private bool mSelected;
public bool Selected
{
get { return mSelected; }
set
{
mSelected = value;
RaisePropertyChanged("Selected");
}
}
private readonly ObservableCollection<CarcassInStore_Receive> mDetails = new ObservableCollection<CarcassInStore_Receive>();
public ObservableCollection<CarcassInStore_Receive> Details { get { return mDetails; } }
}
}

+ 52
- 0
B3DealerClient/BO/CarcassInStore/CarcassInStore_Receive.cs View File

@ -0,0 +1,52 @@
using Forks.EnterpriseServices.DomainObjects2;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace B3DealerClient.BO
{
[MapToTable("B3DealerClient_CarcassInStore_Receive")]
[KeyField("ID", KeyGenType.identity)]
public class CarcassInStore_Receive : NotificationObject
{
[JsonIgnore]
public long ID{get;set;}
public long DetailID{get;set;}
public long MainID{get;set;}
public string Goods_Name{get;set;}
public decimal Weight{get;set;}
public decimal Discont{get;set;}
public decimal NetWeight{get;set;}
public decimal Pics{get;set;}
private DateTime mDate = DateTime.Now;
public DateTime Date
{
get { return mDate; }
set { mDate = value; }
}
private bool mSelected;
[NonDmoProperty]
[JsonIgnore]
public bool Selected
{
get { return mSelected; }
set
{
mSelected = value;
RaisePropertyChanged("Selected");
}
}
}
}

+ 0
- 103
B3DealerClient/BO/CarcassInStore_Detail.cs View File

@ -1,103 +0,0 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace B3DealerClient.BO
{
public class CarcassInStore_Detail : NotificationObject
{
private long mID;
public long ID
{
get { return mID; }
set
{
mID = value;
RaisePropertyChanged("ID");
}
}
private long mPayBill_ID;
public long PayBill_ID
{
get { return mPayBill_ID; }
set
{
mPayBill_ID = value;
RaisePropertyChanged("PayBill_ID");
}
}
private string mGoods_Name;
public string Goods_Name
{
get { return mGoods_Name; }
set
{
mGoods_Name = value;
RaisePropertyChanged("Goods_Name");
}
}
private decimal? mNumber;
public decimal? Number
{
get { return mNumber; }
set
{
mNumber = value;
RaisePropertyChanged("Number");
}
}
private decimal? mSecondNumber;
public decimal? SecondNumber
{
get { return mSecondNumber; }
set
{
mSecondNumber = value;
RaisePropertyChanged("SecondNumber");
}
}
private decimal? mAlreadyNumber;
public decimal? AlreadyNumber
{
get { return mAlreadyNumber; }
set
{
mAlreadyNumber = value;
RaisePropertyChanged("AlreadyNumber");
}
}
private decimal? mAlreadySecondNumber;
public decimal? AlreadySecondNumber
{
get { return mAlreadySecondNumber; }
set
{
mAlreadySecondNumber = value;
RaisePropertyChanged("AlreadySecondNumber");
}
}
private bool mSelected;
public bool Selected
{
get { return mSelected; }
set
{
mSelected = value;
RaisePropertyChanged("Selected");
}
}
private readonly ObservableCollection<CarcassInStore_Receive> mDetails=new ObservableCollection<CarcassInStore_Receive>();
public ObservableCollection<CarcassInStore_Receive> Details { get { return mDetails; } }
}
}

+ 0
- 127
B3DealerClient/BO/CarcassInStore_Receive.cs View File

@ -1,127 +0,0 @@
using Forks.EnterpriseServices.DomainObjects2;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace B3DealerClient.BO
{
[MapToTable("B3DealerClient_CarcassInStore_Receive")]
[KeyField("ID", KeyGenType.identity)]
public class CarcassInStore_Receive : NotificationObject
{
private long mID;
[JsonIgnore]
public long ID
{
get { return mID; }
set
{
mID = value;
RaisePropertyChanged("ID");
}
}
private long mDetailID;
public long DetailID
{
get { return mDetailID; }
set
{
mDetailID = value;
RaisePropertyChanged("DetailID");
}
}
private long mMainID;
public long MainID
{
get { return mMainID; }
set
{
mMainID = value;
RaisePropertyChanged("MainID");
}
}
private string mGoods_Name;
public string Goods_Name
{
get { return mGoods_Name; }
set
{
mGoods_Name = value;
RaisePropertyChanged("Goods_Name");
}
}
private decimal mWeight;
public decimal Weight
{
get { return mWeight; }
set
{
mWeight = value;
RaisePropertyChanged("Weight");
}
}
private decimal mDiscont;
public decimal Discont
{
get { return mDiscont; }
set
{
mDiscont = value;
RaisePropertyChanged("Discont");
}
}
private decimal mNetWeight;
public decimal NetWeight
{
get { return mNetWeight; }
set
{
mNetWeight = value;
RaisePropertyChanged("NetWeight");
}
}
private decimal mPics;
public decimal Pics
{
get { return mPics; }
set
{
mPics = value;
RaisePropertyChanged("Pics");
}
}
private DateTime mDate = DateTime.Now;
public DateTime Date
{
get { return mDate; }
set
{
mDate = value;
RaisePropertyChanged("Date");
}
}
private bool mSelected;
[NonDmoProperty]
public bool Selected
{
get { return mSelected; }
set
{
mSelected = value;
RaisePropertyChanged("Selected");
}
}
}
}

+ 73
- 0
B3DealerClient/BO/CarcassSaleOut/CarcassSaleOut.cs View File

@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace B3DealerClient.BO
{
public class CarcassSaleOut : NotificationObject
{
public long ID { get; set; }
public string Customer_Name { get; set; }
public string Driver_Name { get; set; }
public string Store_Name { get; set; }
public DateTime? LoadTime { get; set; }
public long DetailID { get; set; }
public string Goods_Name { get; set; }
public decimal? Number { get; set; }
public decimal? SecondNumber { get; set; }
private decimal? mAlreadyNumber;
public decimal? AlreadyNumber
{
get { return mAlreadyNumber; }
set
{
mAlreadyNumber = value;
RaisePropertyChanged("AlreadyNumber");
}
}
private decimal? mAlreadySecondNumber;
public decimal? AlreadySecondNumber
{
get { return mAlreadySecondNumber; }
set
{
mAlreadySecondNumber = value;
RaisePropertyChanged("AlreadySecondNumber");
}
}
private bool mAssignFinished;
public bool AssignFinished
{
get { return mAssignFinished; }
set
{
mAssignFinished = value;
RaisePropertyChanged("AssignFinished");
}
}
private bool mSelected;
public bool Selected
{
get { return mSelected; }
set
{
mSelected = value;
RaisePropertyChanged("Selected");
}
}
}
}

+ 52
- 0
B3DealerClient/BO/CarcassSaleOut/CarcassSaleOut_Record.cs View File

@ -0,0 +1,52 @@
using Forks.EnterpriseServices.DomainObjects2;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace B3DealerClient.BO
{
[MapToTable("B3DealerClient_CarcassSaleOut_Record")]
[KeyField("ID", KeyGenType.identity)]
public class CarcassSaleOut_Record : NotificationObject
{
[JsonIgnore]
public long ID { get; set; }
public long DetailID { get; set; }
public long MainID { get; set; }
public string Goods_Name { get; set; }
public decimal Weight { get; set; }
public decimal Discont { get; set; }
public decimal NetWeight { get; set; }
public decimal SecondNumber { get; set; }
private DateTime mDate = DateTime.Now;
public DateTime Date
{
get { return mDate; }
set { mDate = value; }
}
private bool mSelected;
[NonDmoProperty]
[JsonIgnore]
public bool Selected
{
get { return mSelected; }
set
{
mSelected = value;
RaisePropertyChanged("Selected");
}
}
}
}

+ 33
- 0
B3DealerClient/BO/CarcassSaleOut/CustomerObj.cs View File

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace B3DealerClient.BO
{
public class CustomerObj : NotificationObject
{
public long ID { get; set; }
public string Name { get; set; }
public bool Finished { get; set; }
private bool mSelected;
public bool Selected
{
get { return mSelected; }
set
{
mSelected = value;
RaisePropertyChanged("Selected");
}
}
public bool Equals(CustomerObj obj)
{
return this.ID == obj.ID && this.Finished == obj.Finished;
}
}
}

+ 43
- 0
B3DealerClient/BO/FreshInStore/FreshInStore.cs View File

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace B3DealerClient.BO
{
public class FreshInStore : NotificationObject
{
public long ID { get; set; }
public string Supplier_Name { get; set; }
public DateTime? Date { get; set; }
public DateTime? ArrivedDate { get; set; }
public string Store_Name { get; set; }
private bool mSelected;
public bool Selected
{
get { return mSelected; }
set
{
mSelected = value;
RaisePropertyChanged("Selected");
}
}
private List<FreshInStore_Detail> mDetails = new List<FreshInStore_Detail>();
public List<FreshInStore_Detail> Details
{
get { return mDetails; }
set
{
mDetails = value;
RaisePropertyChanged("Details");
}
}
}
}

+ 54
- 0
B3DealerClient/BO/FreshInStore/FreshInStore_Detail.cs View File

@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace B3DealerClient.BO
{
public class FreshInStore_Detail : NotificationObject
{
public long ID { get; set; }
public long PayBill_ID { get; set; }
public string Goods_Name { get; set; }
public decimal? Number { get; set; }
public decimal? SecondNumber { get; set; }
private decimal? mAlreadyNumber;
public decimal? AlreadyNumber
{
get { return mAlreadyNumber; }
set
{
mAlreadyNumber = value;
RaisePropertyChanged("AlreadyNumber");
}
}
private decimal? mAlreadySecondNumber;
public decimal? AlreadySecondNumber
{
get { return mAlreadySecondNumber; }
set
{
mAlreadySecondNumber = value;
RaisePropertyChanged("AlreadySecondNumber");
}
}
private bool mSelected;
public bool Selected
{
get { return mSelected; }
set
{
mSelected = value;
RaisePropertyChanged("Selected");
}
}
}
}

+ 24
- 0
B3DealerClient/BO/FreshInStore/FreshInStore_Record.cs View File

@ -0,0 +1,24 @@
using Forks.EnterpriseServices.DomainObjects2;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace B3DealerClient.BO
{
[MapToTable("B3DealerClient_FreshInStore_Record")]
[KeyField("ID", KeyGenType.identity)]
public class FreshInStore_Record
{
[JsonIgnore]
public long ID { get; set; }
public long BillID { get; set; }
public long DetailID { get; set; }
public decimal? Weight { get; set; }
public decimal? Number { get; set; }
}
}

+ 3
- 0
B3DealerClient/Dialogs/BaseInfoDialog.xaml.cs View File

@ -40,6 +40,9 @@ namespace B3DealerClient.Dialogs
case "Store":
this.Title = "仓库";
break;
case "DriverGoodsLine":
this.Title="送货线路";
break;
default:
break;
}


+ 3
- 2
B3DealerClient/Utils/ValueConverter.cs View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -9,12 +10,12 @@ namespace B3DealerClient.Utils
{
public class NullToBoolConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value != null;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}


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

@ -129,7 +129,6 @@
</MultiDataTrigger>-->
<DataTrigger Binding="{Binding Selected}" Value="True">
<Setter Property="Background" Value="#1581ED"/>
<Setter Property="Foreground" Value="White"/>
</DataTrigger>
</Style.Triggers>
</Style>
@ -173,7 +172,6 @@
</MultiDataTrigger>-->
<DataTrigger Binding="{Binding Selected}" Value="True">
<Setter Property="Background" Value="#1581ED"/>
<Setter Property="Foreground" Value="White"/>
</DataTrigger>
</Style.Triggers>
</Style>
@ -211,7 +209,6 @@
</MultiDataTrigger>-->
<DataTrigger Binding="{Binding Selected}" Value="True">
<Setter Property="Background" Value="#1581ED"/>
<Setter Property="Foreground" Value="White"/>
</DataTrigger>
</Style.Triggers>
</Style>
@ -253,7 +250,7 @@
<Button Content="删除选中" Style="{StaticResource deleteBtn}" IsEnabled="{Binding Receive ,Converter={StaticResource NullIsFalseConverter}}" PreviewMouseDown="DeleteBtn_PreviewMouseDown"/>
<TextBlock Text="件数录入:" VerticalAlignment="Center"/>
<TextBox x:Name="pics" Text="{Binding Pics,StringFormat=\{0:0.######\}}" Margin="10,0" PreviewMouseDown="NumberBox_PreviewMouseDown"/>
<Button Content="确认" IsEnabled="{Binding CanSave}" PreviewMouseDown="SaveBtn_PreviewMouseDown"/>
<Button Content="确认" IsEnabled="{Binding CanSave}" PreviewMouseDown="SaveBtn_PreviewMouseDown"/>
</WrapPanel>
</Grid>
</Border>


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

@ -30,15 +30,15 @@ namespace B3DealerClient.Windows.CarcassInStoreWindow_
{
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)


+ 16
- 0
B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutConfig.cs View File

@ -0,0 +1,16 @@
using B3DealerClient.BO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace B3DealerClient.Windows.CarcassSaleOutWindow_
{
public class CarcassSaleOutConfig
{
public NameIDPair Store { get; set; }
public decimal? HookWeight { get; set; }
}
}

+ 137
- 0
B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutContext.cs View File

@ -0,0 +1,137 @@
using B3DealerClient.BO;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace B3DealerClient.Windows.CarcassSaleOutWindow_
{
public class CarcassSaleOutContext : NotificationObject
{
private DateTime? mDate = DateTime.Today;
public DateTime? Date
{
get { return mDate; }
set
{
mDate = value;
RaisePropertyChanged("Date");
}
}
private NameIDPair mDriverGoodsLine = new NameIDPair() { Name = "请选择" };
public NameIDPair DriverGoodsLine { get { return mDriverGoodsLine; } }
private NameIDPair mStore = new NameIDPair();
public NameIDPair Store { get { return mStore; } }
private decimal? mHookWeight;
public decimal? HookWeight
{
get { return mHookWeight; }
set
{
mHookWeight = value;
RaisePropertyChanged("HookWeight");
}
}
private string mStrNumber;
public string StrNumber
{
get { return mStrNumber; }
set
{
mStrNumber = value;
RaisePropertyChanged("StrNumber");
RaisePropertyChanged("CanSave");
}
}
public decimal Number
{
get
{
decimal d;
decimal.TryParse(mStrNumber, out d);
if (d == 0)
throw new Exception("头数输入不正确");
return d;
}
}
decimal number
{
get
{
decimal d;
decimal.TryParse(mStrNumber, out d);
return d;
}
}
private decimal mWeight;
public decimal Weight
{
get { return mWeight; }
set
{
mWeight = value;
RaisePropertyChanged("CanSave");
}
}
public bool Finish
{
get
{
return mDmo == null ? true : mDmo.AssignFinished;
}
set
{
RaisePropertyChanged("CanSave");
RaisePropertyChanged("CanDelete");
}
}
private CarcassSaleOut mDmo = null;
public CarcassSaleOut Dmo
{
get { return mDmo; }
set
{
mDmo = value;
RaisePropertyChanged("Dmo");
RaisePropertyChanged("CanSave");
}
}
private List<CarcassSaleOut> mDmoList = null;
public List<CarcassSaleOut> DmoList { get { return mDmoList; } set { mDmoList = value; RaisePropertyChanged("DmoList"); } }
private readonly ObservableCollection<CarcassSaleOut_Record> mDetails = new ObservableCollection<CarcassSaleOut_Record>();
public ObservableCollection<CarcassSaleOut_Record> Details { get { return mDetails; } }
private CarcassSaleOut_Record mDetail = null;
public CarcassSaleOut_Record Detail
{
get { return mDetail; }
set
{
mDetail = value;
//RaisePropertyChanged("Detail");
RaisePropertyChanged("CanDelete");
}
}
private List<CustomerObj> mCustomerList = null;
public List<CustomerObj> CustomerList { get { return mCustomerList; } set { mCustomerList = value; RaisePropertyChanged("CustomerList"); } }
public bool CanSave { get { return number > 0 && Weight > 0 && mDmo != null && !Finish; } }
public bool CanDelete { get { return mDetail != null && mDmo != null && !Finish; } }
}
}

+ 94
- 91
B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutWindow.xaml View File

@ -1,9 +1,13 @@
<Window x:Class="B3DealerClient.Windows.CarcassSaleOutWindow_.CarcassSaleOutWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:B3DealerClient.Control"
Title="白条发货" Height="800" Width="1200" FontSize="17">
xmlns:local="clr-namespace:B3DealerClient.Control"
xmlns:util="clr-namespace:B3DealerClient.Utils"
xmlns:self="clr-namespace:B3DealerClient.Windows.CarcassSaleOutWindow_"
Title="白条发货" Height="800" Width="1200" FontSize="17" WindowState="Maximized">
<Window.Resources>
<util:NullToBoolConverter x:Key="NullIsFalseConverter"/>
<self:TrueToFalseConverter x:Key="TrueToFalseConverter"/>
<Style TargetType="TextBlock">
<Setter Property="Margin" Value="5,20"/>
<Setter Property="Width" Value="80"/>
@ -15,6 +19,11 @@
<Setter Property="TextAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
</Style>
<Style x:Key="deleteBtn" TargetType="Button" BasedOn="{StaticResource RedButton}">
<Setter Property="Width" Value="120"/>
<Setter Property="Height" Value="55"/>
<Setter Property="Margin" Value="10,0"/>
</Style>
</Window.Resources>
<Grid Margin="5">
<Grid.ColumnDefinitions>
@ -29,55 +38,43 @@
<RowDefinition Height="80"/>
</Grid.RowDefinitions>
<Border Grid.RowSpan="3" Margin="0,2" Style="{StaticResource DefaultBorder}">
<StackPanel>
<StackPanel.Resources>
<ListBox x:Name="customerPanel" ItemsSource="{Binding CustomerList}" ScrollViewer.HorizontalScrollBarVisibility="Hidden" BorderThickness="0">
<ListBox.Resources>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<EventSetter Event="PreviewMouseDown" Handler="CustomerBtn_PriviewMouseDown"/>
</Style>
<Style TargetType="Button" BasedOn="{StaticResource DefaultButton}">
<Setter Property="Margin" Value="5"/>
<Setter Property="Margin" Value="0,5"/>
<Setter Property="Width" Value="150"/>
<Setter Property="Height" Value="50"/>
<Style.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Selected}" Value="False" />
<Condition Binding="{Binding Finished}" Value="True" />
</MultiDataTrigger.Conditions>
<Setter Property="Background" Value="DarkGreen"/>
</MultiDataTrigger>
<DataTrigger Binding="{Binding Selected}" Value="True">
<Setter Property="Background" Value="Orange"/>
</DataTrigger>
</Style.Triggers>
</Style>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap"/>
</Style>
</StackPanel.Resources>
<Button Content="东台五烈"/>
<Button Content="东台五烈"/>
<Button Content="郭涛"/>
<Button Content="东台刘家宾"/>
<Button Content="浦东刘老板"/>
<Button Content="建湖钱大方"/>
<Button Content="柏庐小陈"/>
<Button>
<Button.Content>
<TextBlock>大丰高丽苑13328121551</TextBlock>
</Button.Content>
</Button>
<Button>
<Button.Content>
<TextBlock>胡传俊</TextBlock>
</Button.Content>
</Button>
<Button>
<Button.Content>
<TextBlock>胡传俊</TextBlock>
</Button.Content>
</Button>
<Button>
<Button.Content>
<TextBlock>胡传俊</TextBlock>
</Button.Content>
</Button>
<Button>
<Button.Content>
<TextBlock>胡传俊</TextBlock>
</Button.Content>
</Button>
<Button>
<Button.Content>
<TextBlock>胡传俊</TextBlock>
</Button.Content>
</Button>
</StackPanel>
</ListBox.Resources>
<ListBox.ItemTemplate>
<DataTemplate>
<Button>
<Button.Content>
<TextBlock Text="{Binding Name}"/>
</Button.Content>
</Button>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
<WrapPanel Grid.Row="3" HorizontalAlignment="Center" VerticalAlignment="Center">
@ -86,10 +83,11 @@
<Setter Property="Margin" Value="2,0"/>
<Setter Property="Width" Value="75"/>
<Setter Property="Height" Value="40"/>
<EventSetter Event="PreviewMouseDown" Handler="PageBtn_PreviewMouseDown"/>
</Style>
</WrapPanel.Resources>
<Button Content="上一页"/>
<Button Content="下一页"/>
<Button Content="上一页" Tag="0"/>
<Button Content="下一页" Tag="1"/>
</WrapPanel>
<Grid Grid.Column="1">
@ -98,7 +96,7 @@
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<local:WeightControl x:Name="weightControl" HorizontalAlignment="Left" Width="250" Margin="2,5,0,5"/>
<Grid Grid.Column="1" HorizontalAlignment="Center">
<Grid Grid.Column="1">
<Grid.Resources>
<Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
@ -106,36 +104,38 @@
</Style>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="0.6*"/>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="0.6*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock Text="客户:"/>
<TextBlock Grid.Column="1" Text="这里"/>
<TextBlock Grid.Column="2" Text="司机"/>
<TextBlock Grid.Column="3" Text="这里"/>
<TextBlock Grid.Row="1" Text="仓库:"/>
<TextBlock Grid.Row="1" Grid.Column="1" Text="这里"/>
<TextBlock Grid.Column="1" Text="客户:"/>
<TextBlock Grid.Column="2" Text="{Binding Dmo.Customer_Name}"/>
<TextBlock Grid.Column="3" Text="司机:"/>
<TextBlock Grid.Column="4" Text="{Binding Dmo.Driver_Name}"/>
<TextBlock Grid.Column="1" Grid.Row="1" Text="仓库:"/>
<TextBlock Grid.Column="2" Grid.Row="1" Text="{Binding Dmo.Store_Name}"/>
</Grid>
</Grid>
<Border Grid.Row="1" Grid.Column="1" Margin="2" Style="{StaticResource DefaultBorder}">
<DataGrid Margin="5">
<DataGrid Margin="5" ItemsSource="{Binding DmoList}">
<DataGrid.RowStyle>
<Style TargetType="DataGridRow" BasedOn="{StaticResource DefaultDataGridRow}">
<!--<EventSetter Event="PreviewMouseDown" Handler="TangGridFocus"/>-->
<EventSetter Event="PreviewMouseDown" Handler="MainGridFocus "/>
<Style.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Selected}" Value="False" />
<Condition Binding="{Binding Finish}" Value="True" />
<Condition Binding="{Binding AssignFinished}" Value="True" />
</MultiDataTrigger.Conditions>
<Setter Property="Background">
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
<GradientStop Offset="0.0" Color="#9ACD32"/>
@ -147,35 +147,34 @@
</MultiDataTrigger>
<DataTrigger Binding="{Binding Selected}" Value="True">
<Setter Property="Background" Value="#1581ED"/>
<Setter Property="Foreground" Value="White"/>
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding WeightID}" Header="单号" Width="0.6*"/>
<DataGridTextColumn Binding="{Binding Order}" Header="存货名称" Width="1.0*"/>
<DataGridTextColumn Binding="{Binding Number ,StringFormat=\{0:yyyy-MM-dd\}}" Header="出库时间" Width="0.8*"/>
<DataGridTextColumn Binding="{Binding TotalWeight, StringFormat=\{0:0.######\}}" Header="主数量" Width="0.6*"/>
<DataGridTextColumn Binding="{Binding TotalWeight, StringFormat=\{0:0.######\}}" Header="辅数量" Width="0.6*"/>
<DataGridTextColumn Binding="{Binding Number ,StringFormat=\{0:0.######\}}" Header="已配主数量" Width="0.8*"/>
<DataGridTextColumn Binding="{Binding Already,StringFormat=\{0:0.######\}}" Header="已配辅数量" Width="0.8*"/>
<DataGridTextColumn Binding="{Binding ID}" Header="单号" Width="0.6*"/>
<DataGridTextColumn Binding="{Binding Goods_Name}" Header="存货名称" Width="1.0*"/>
<DataGridTextColumn Binding="{Binding LoadTime ,StringFormat=\{0:yyyy-MM-dd\}}" Header="出库时间" Width="0.8*"/>
<DataGridTextColumn Binding="{Binding Number, StringFormat=\{0:0.######\}}" Header="主数量" Width="0.6*"/>
<DataGridTextColumn Binding="{Binding SecondNumber, StringFormat=\{0:0.######\}}" Header="辅数量" Width="0.6*"/>
<DataGridTextColumn Binding="{Binding AlreadyNumber ,StringFormat=\{0:0.######\}}" Header="已配主数量" Width="0.8*"/>
<DataGridTextColumn Binding="{Binding AlreadySecondNumber,StringFormat=\{0:0.######\}}" Header="已配辅数量" Width="0.8*"/>
</DataGrid.Columns>
</DataGrid>
</Border>
<Border Grid.Row="2" Grid.Column="1" Margin="2" Style="{StaticResource DefaultBorder}">
<DataGrid Margin="5">
<DataGrid Margin="5" ItemsSource="{Binding Details}">
<DataGrid.RowStyle>
<Style TargetType="DataGridRow" BasedOn="{StaticResource DefaultDataGridRow}">
<!--<EventSetter Event="PreviewMouseDown" Handler="TangGridFocus"/>-->
<EventSetter Event="PreviewMouseDown" Handler="DetailGridFocus"/>
<Style.Triggers>
<MultiDataTrigger>
<!--<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Selected}" Value="False" />
<Condition Binding="{Binding Finish}" Value="True" />
</MultiDataTrigger.Conditions>
<Setter Property="Background">
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
<GradientStop Offset="0.0" Color="#9ACD32"/>
@ -184,21 +183,20 @@
</Setter.Value>
</Setter>
<Setter Property="Foreground" Value="Black"/>
</MultiDataTrigger>
</MultiDataTrigger>-->
<DataTrigger Binding="{Binding Selected}" Value="True">
<Setter Property="Background" Value="#1581ED"/>
<Setter Property="Foreground" Value="White"/>
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Order}" Header="存货名称" Width="1.0*"/>
<DataGridTextColumn Binding="{Binding Number ,StringFormat=\{0:HH:mm\}}" Header="称重时间" Width="0.8*"/>
<DataGridTextColumn Binding="{Binding TotalWeight, StringFormat=\{0:0.######\}}" Header="称重重量" Width="0.6*"/>
<DataGridTextColumn Binding="{Binding TotalWeight, StringFormat=\{0:0.######\}}" Header="辅数量" Width="0.6*"/>
<DataGridTextColumn Binding="{Binding Number ,StringFormat=\{0:0.######\}}" Header="扣重" Width="0.6*"/>
<DataGridTextColumn Binding="{Binding Already,StringFormat=\{0:0.######\}}" Header="净重" Width="0.6*"/>
<DataGridTextColumn Binding="{Binding Goods_Name}" Header="存货名称" Width="1.0*"/>
<DataGridTextColumn Binding="{Binding Date ,StringFormat=\{0:HH:mm\}}" Header="称重时间" Width="0.8*"/>
<DataGridTextColumn Binding="{Binding Weight, StringFormat=\{0:0.######\}}" Header="称重重量" Width="0.6*"/>
<DataGridTextColumn Binding="{Binding SecondNumber, StringFormat=\{0:0.######\}}" Header="辅数量" Width="0.6*"/>
<DataGridTextColumn Binding="{Binding Discont ,StringFormat=\{0:0.######\}}" Header="扣重" Width="0.6*"/>
<DataGridTextColumn Binding="{Binding NetWeight,StringFormat=\{0:0.######\}}" Header="净重" Width="0.6*"/>
</DataGrid.Columns>
</DataGrid>
</Border>
@ -206,22 +204,22 @@
<StackPanel Grid.Row="1" Grid.Column="2" HorizontalAlignment="Center">
<WrapPanel>
<TextBlock Text="发货日期"/>
<TextBox Text="2019/01/25"/>
<DatePicker SelectedDate="{Binding Date}" Width="150" Height="40" Margin="-0.2,0,0,0"/>
</WrapPanel>
<WrapPanel>
<TextBlock Text="仓库"/>
<TextBox Text="白条库"/>
<TextBox x:Name="Store" Text="{Binding Store.Name}" PreviewMouseDown="BaseInfoBox_PreviewMouseDown"/>
</WrapPanel>
<WrapPanel>
<TextBlock Text="扣钩重"/>
<TextBox Text="2.4"/>
<TextBox x:Name="hook" Text="{Binding HookWeight,StringFormat=\{0:0.######\}}" PreviewMouseDown="NumberBox_PreviewMouseDown"/>
</WrapPanel>
</StackPanel>
<StackPanel Grid.Row="2" Grid.Column="2">
<WrapPanel HorizontalAlignment="Center">
<TextBlock Text="称重头数"/>
<TextBox Text="4"/>
<TextBox Text="{Binding StrNumber}"/>
</WrapPanel>
<WrapPanel>
<WrapPanel.Resources>
@ -229,6 +227,7 @@
<Setter Property="Width" Value="95"/>
<Setter Property="Height" Value="75"/>
<Setter Property="Margin" Value="5"/>
<EventSetter Event="PreviewMouseDown" Handler="NumberBtn_PreviewMouseDown"/>
</Style>
</WrapPanel.Resources>
<Button Content="1"/>
@ -237,7 +236,7 @@
<Button Content="4"/>
<Button Content="5"/>
<Button Content="6"/>
<Button Content="0" Width="190"/>
<Button Content="0" Width="200"/>
<Button Content="./点"/>
</WrapPanel>
</StackPanel>
@ -250,7 +249,11 @@
</Style>
</WrapPanel.Resources>
<TextBlock Text="送货线路" VerticalAlignment="Center" Margin="20,0,10,0"/>
<Button Content="沙河一线"/>
<Button x:Name="DriverGoodsLine" PreviewMouseDown="BaseInfoBox_PreviewMouseDown">
<Button.Content>
<TextBlock Text="{Binding DriverGoodsLine.Name}" Style="{x:Null}"/>
</Button.Content>
</Button>
</WrapPanel>
<WrapPanel Grid.Row="3" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right">
<WrapPanel.Resources>
@ -260,10 +263,10 @@
<Setter Property="Margin" Value="10,0"/>
</Style>
</WrapPanel.Resources>
<Button Content="删除选中"/>
<Button Content="称重记录"/>
<Button Content="配货完成"/>
<Button Content="删除选中" Style="{StaticResource deleteBtn}" IsEnabled="{Binding CanDelete}" PreviewMouseDown="DeleteBtn_PreviewMouseDown"/>
<Button Content="称重记录" IsEnabled="{Binding Dmo ,Converter={StaticResource NullIsFalseConverter}}" PreviewMouseDown="ViewBtn_PreviewMouseDown"/>
<Button Content="配货完成" IsEnabled="{Binding Dmo ,Converter={StaticResource TrueToFalseConverter}}" PreviewMouseDown="FinishBtn_PreviewMouseDown"/>
</WrapPanel>
<Button Grid.Row="3" Grid.Column="2" Content="称重/读取" Width="120" Height="55"/>
<Button Grid.Row="3" Grid.Column="2" Content="称重/读取" Width="120" Height="55" IsEnabled="{Binding CanSave}" PreviewMouseDown="SaveBtn_PreviewMouseDown"/>
</Grid>
</Window>

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

@ -1,4 +1,9 @@
using System;
using B3DealerClient.BL;
using B3DealerClient.BO;
using B3DealerClient.Control;
using B3DealerClient.Dialogs;
using B3DealerClient.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -19,9 +24,280 @@ namespace B3DealerClient.Windows.CarcassSaleOutWindow_
/// </summary>
public partial class CarcassSaleOutWindow : Window
{
CarcassSaleOutContext context;
CarcassSaleOutConfig config;
int pageSize;
int pageIndex;
public CarcassSaleOutWindow()
{
InitializeComponent();
Rect rc = SystemParameters.WorkArea;//获取工作区大小
this.Width = rc.Width;
this.Height = rc.Height;
context = new CarcassSaleOutContext();
this.DataContext = context;
this.Loaded += CarcassSaleOutWindow_Loaded;
this.weightControl.ReceivedValue += weightControl_ReceivedValue;
weightControl.weightSwitch.Click += weightSwitch_Click;
}
void weightSwitch_Click(object sender, RoutedEventArgs e)
{
if (!weightControl.SwitchOn)
context.Weight = 0;
}
void weightControl_ReceivedValue(decimal weight)
{
context.Weight = weight;
}
void CarcassSaleOutWindow_Loaded(object sender, RoutedEventArgs e)
{
config = XmlUtil.DeserializeFromFile<CarcassSaleOutConfig>();
if (config.Store != null)
context.Store.Fill(config.Store);
context.HookWeight = config.HookWeight;
pageSize = (int)customerPanel.ActualHeight / 60;
}
private void NumberBox_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
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("输入错误");
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)
{
var tb = sender as FrameworkElement;
var dig = new BaseInfoDialog(tb.Name);
if (dig.ShowDialog() == true)
{
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;
}
}
}
void BindCustomerPanel()
{
context.CustomerList = CarcassSaleOutBL.GetCustomers(new
{
Date = context.Date,
Store_ID = context.Store.ID,
DeliverGoodsLine_ID = context.DriverGoodsLine.ID,
PageIndex = pageIndex,
PageSize = pageSize
});
}
private void PageBtn_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
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();
}
}
private void NumberBtn_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
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;
}
}
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
{
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;
}
}
private void MainGridFocus(object sender, MouseButtonEventArgs e)
{
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();
}
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();
}
private void DetailGridFocus(object sender, MouseButtonEventArgs e)
{
var row = sender as DataGridRow;
context.Detail = row.Item as CarcassSaleOut_Record;
DetailSelected();
}
void DetailSelected()
{
if (context.Detail == null)
return;
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 DeleteBtn_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
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();
}
}
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 ViewBtn_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
new RecordViewDialog(context.Dmo.ID).ShowDialog();
}
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;
}
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.Finish = true;
MessageBox.Show("配货完成");
}
}
}

+ 17
- 0
B3DealerClient/Windows/CarcassSaleOutWindow_/RecordViewDialog.xaml View File

@ -0,0 +1,17 @@
<Window x:Class="B3DealerClient.Windows.CarcassSaleOutWindow_.RecordViewDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="称重记录" Height="500" Width="800" FontSize="17">
<Border Margin="5" Style="{StaticResource DefaultBorder}">
<DataGrid x:Name="grid" Margin="5">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Goods_Name}" Header="存货" Width="1.0*"/>
<DataGridTextColumn Binding="{Binding Weight, StringFormat=\{0:0.######\}}" Header="重量" Width="0.6*"/>
<DataGridTextColumn Binding="{Binding Discont, StringFormat=\{0:0.######\}}" Header="扣重" Width="0.6*"/>
<DataGridTextColumn Binding="{Binding NetWeight, StringFormat=\{0:0.######\}}" Header="净重" Width="0.6*"/>
<DataGridTextColumn Binding="{Binding SecondNumber, StringFormat=\{0:0.######\}}" Header="件数" Width="0.6*"/>
<DataGridTextColumn Binding="{Binding Date ,StringFormat=\{0:HH:mm:ss\}}" Header="确认时间" Width="0.8*"/>
</DataGrid.Columns>
</DataGrid>
</Border>
</Window>

+ 36
- 0
B3DealerClient/Windows/CarcassSaleOutWindow_/RecordViewDialog.xaml.cs View File

@ -0,0 +1,36 @@
using B3DealerClient.BL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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;
namespace B3DealerClient.Windows.CarcassSaleOutWindow_
{
/// <summary>
/// RecordViewDialog.xaml 的交互逻辑
/// </summary>
public partial class RecordViewDialog : Window
{
long BillID;
public RecordViewDialog(long id)
{
InitializeComponent();
BillID = id;
this.Loaded += RecordViewDialog_Loaded;
}
void RecordViewDialog_Loaded(object sender, RoutedEventArgs e)
{
grid.ItemsSource = CarcassSaleOutBL.GetBillRecords(BillID);
}
}
}

+ 27
- 0
B3DealerClient/Windows/CarcassSaleOutWindow_/SelfValueConvert.cs View File

@ -0,0 +1,27 @@
using B3DealerClient.BO;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace B3DealerClient.Windows.CarcassSaleOutWindow_
{
public class TrueToFalseConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
return false;
var v = (CarcassSaleOut)value;
return !v.AssignFinished;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

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

@ -0,0 +1,16 @@
using B3DealerClient.BO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace B3DealerClient.Windows.FreshInStoreWindow_
{
public class FreshInStoreConfig
{
public NameIDPair Store { get; set; }
public decimal? Pics { get; set; }
}
}

+ 74
- 0
B3DealerClient/Windows/FreshInStoreWindow_/FreshInStoreContext.cs View File

@ -0,0 +1,74 @@
using B3DealerClient.BO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace B3DealerClient.Windows.FreshInStoreWindow_
{
class FreshInStoreContext : NotificationObject
{
private DateTime? mDate = DateTime.Today;
public DateTime? Date
{
get { return mDate; }
set
{
mDate = value;
RaisePropertyChanged("Date");
}
}
private DateTime? mArrivedDate;
public DateTime? ArrivedDate
{
get { return mArrivedDate; }
set
{
mArrivedDate = value;
RaisePropertyChanged("ArrivedDate");
}
}
private NameIDPair mSupplier = new NameIDPair();
public NameIDPair Supplier { get { return mSupplier; } }
private NameIDPair mStore = new NameIDPair();
public NameIDPair Store { get { return mStore; } }
private decimal? mPics;
public decimal? Pics
{
get { return mPics; }
set
{
mPics = value;
RaisePropertyChanged("Pics");
RaisePropertyChanged("CanSave");
}
}
private FreshInStore mDmo = null;
public FreshInStore Dmo { get { return mDmo; } set { mDmo = value; RaisePropertyChanged("Dmo"); } }
private FreshInStore_Detail mDetail = null;
public FreshInStore_Detail Detail { get { return mDetail; } set { mDetail = value; RaisePropertyChanged("Detail"); RaisePropertyChanged("CanSave"); } }
private List<FreshInStore> dmoList = new List<FreshInStore>();
public List<FreshInStore> DmoList
{
get { return dmoList; }
set
{
dmoList = value;
this.RaisePropertyChanged("DmoList");
}
}
public bool CanSave { get { return Pics > 0 && mDetail != null; } }
}
}

+ 54
- 39
B3DealerClient/Windows/FreshInStoreWindow_/FreshInStoreWindow.xaml View File

@ -1,15 +1,21 @@
<Window x:Class="B3DealerClient.Windows.FreshInStoreWindow_.FreshInStoreWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:B3DealerClient.Control"
Title="鲜品收货" Height="700" Width="1100" FontSize="17">
xmlns:local="clr-namespace:B3DealerClient.Control"
xmlns:util="clr-namespace:B3DealerClient.Utils"
Title="鲜品收货" Height="700" Width="1200" FontSize="17" WindowState="Maximized">
<Window.Resources>
<util:NullToBoolConverter x:Key="NullIsFalseConverter"/>
<Style TargetType="TextBox">
<Setter Property="Width" Value="120"/>
<Setter Property="Width" Value="130"/>
<Setter Property="Height" Value="35"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
</Style>
<Style TargetType="DatePicker" BasedOn="{StaticResource DatePickerStyle1}">
<Setter Property="Width" Value="130"/>
<Setter Property="Height" Value="35"/>
</Style>
<Style TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="VerticalAlignment" Value="Center"/>
@ -20,6 +26,12 @@
<Setter Property="Height" Value="50"/>
<Setter Property="Margin" Value="20,0"/>
</Style>
<Style x:Key="simpleBtn" TargetType="Button" BasedOn="{StaticResource DefaultButton}">
<Setter Property="Width" Value="120"/>
<Setter Property="Height" Value="50"/>
<Setter Property="Margin" Value="20,0"/>
</Style>
</Window.Resources>
<Grid Margin="5">
<Grid.RowDefinitions>
@ -50,28 +62,33 @@
<RowDefinition Height="60"/>
</Grid.RowDefinitions>
<TextBlock Text="装货日期"/>
<TextBox Grid.Column="1" Text="2019/01/25"/>
<DatePicker Grid.Column="1" SelectedDate="{Binding Date}"/>
<TextBlock Grid.Column="2" Text="供应商"/>
<TextBox Grid.Column="3" Text="龙达肉食"/>
<TextBox x:Name="Supplier" Grid.Column="3" Text="{Binding Supplier.Name}" PreviewMouseDown="BaseInfoBox_PreviewMouseDown"/>
<TextBlock Grid.Row="1" Text="计划到货日期"/>
<TextBox Grid.Row="1" Grid.Column="1" Text="2019/01/25"/>
<DatePicker Grid.Row="1" Grid.Column="1" SelectedDate="{Binding ArrivedDate}"/>
<TextBlock Grid.Row="1" Grid.Column="2" Text="仓库"/>
<TextBox Grid.Row="1" Grid.Column="3" Text="白条库"/>
<TextBox x:Name="Store" Grid.Row="1" Grid.Column="3" Text="{Binding Store.Name}" PreviewMouseDown="BaseInfoBox_PreviewMouseDown"/>
<WrapPanel Grid.Row="2" Grid.ColumnSpan="4" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button Content="查询"/>
<Button Content="清除条件"/>
<WrapPanel.Resources>
<Style TargetType="Button" BasedOn="{StaticResource simpleBtn}">
<EventSetter Event="PreviewMouseDown" Handler="SearchBtn_PreviewMouseDown"/>
</Style>
</WrapPanel.Resources>
<Button x:Name="cx" Content="查询"/>
<Button x:Name="qc" Content="清除条件"/>
</WrapPanel>
</Grid>
</Border>
<Border Grid.Row="1" Margin="2" Style="{StaticResource DefaultBorder}">
<DataGrid Margin="5">
<DataGrid Margin="5" ItemsSource="{Binding DmoList}">
<DataGrid.RowStyle>
<Style TargetType="DataGridRow" BasedOn="{StaticResource DefaultDataGridRow}">
<!--<EventSetter Event="PreviewMouseDown" Handler="TangGridFocus"/>-->
<EventSetter Event="PreviewMouseDown" Handler="MainGridFocus"/>
<Style.Triggers>
<MultiDataTrigger>
<!--<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Selected}" Value="False" />
<Condition Binding="{Binding Finish}" Value="True" />
@ -85,19 +102,18 @@
</Setter.Value>
</Setter>
<Setter Property="Foreground" Value="Black"/>
</MultiDataTrigger>
</MultiDataTrigger>-->
<DataTrigger Binding="{Binding Selected}" Value="True">
<Setter Property="Background" Value="#1581ED"/>
<Setter Property="Foreground" Value="White"/>
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding WeightID}" Header="单号" Width="0.6*"/>
<DataGridTextColumn Binding="{Binding Order}" Header="供应商" Width="1.2*"/>
<DataGridTextColumn Binding="{Binding Number ,StringFormat=\{0:yyyy/MM/dd\}}" Header="装货日期" Width="1.0*"/>
<DataGridTextColumn Binding="{Binding Already,StringFormat=\{0:yyyy/MM/dd\}}" Header="预计到货日期" Width="1.0*"/>
<DataGridTextColumn Binding="{Binding ID}" Header="单号" Width="0.6*"/>
<DataGridTextColumn Binding="{Binding Supplier_Name}" Header="供应商" Width="1.2*"/>
<DataGridTextColumn Binding="{Binding Date ,StringFormat=\{0:yyyy/MM/dd\}}" Header="装货日期" Width="1.0*"/>
<DataGridTextColumn Binding="{Binding ArrivedDate,StringFormat=\{0:yyyy/MM/dd\}}" Header="预计到货日期" Width="1.0*"/>
<!--<DataGridTextColumn Binding="{Binding TotalWeight, StringFormat=\{0:0.######\}}" Header="重量" Width="1*"/>-->
</DataGrid.Columns>
</DataGrid>
@ -106,24 +122,24 @@
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="60"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border Margin="2" Style="{StaticResource DefaultBorder}">
<WrapPanel HorizontalAlignment="Center" Margin="0,10">
<WrapPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="供应商:"/>
<TextBlock Text="龙达肉食" MinWidth="120"/>
<TextBlock Text="{Binding Dmo.Supplier_Name}" Width="200" TextWrapping="Wrap" Margin="0,0,10,0" Foreground="Red"/>
<TextBlock Text="仓库:"/>
<TextBlock Text="白条库" MinWidth="120"/>
<TextBlock Text="{Binding Dmo.Store_Name}" Width="120" TextWrapping="Wrap" Foreground="Red"/>
</WrapPanel>
</Border>
<GroupBox Grid.Row="1" Header="装车明细" Margin="1">
<DataGrid>
<DataGrid ItemsSource="{Binding Dmo.Details}">
<DataGrid.RowStyle>
<Style TargetType="DataGridRow" BasedOn="{StaticResource DefaultDataGridRow}">
<!--<EventSetter Event="PreviewMouseDown" Handler="TangGridFocus"/>-->
<EventSetter Event="PreviewMouseDown" Handler="DetailGridFocus"/>
<Style.Triggers>
<MultiDataTrigger>
<!--<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Selected}" Value="False" />
<Condition Binding="{Binding Finish}" Value="True" />
@ -137,36 +153,35 @@
</Setter.Value>
</Setter>
<Setter Property="Foreground" Value="Black"/>
</MultiDataTrigger>
</MultiDataTrigger>-->
<DataTrigger Binding="{Binding Selected}" Value="True">
<Setter Property="Background" Value="#1581ED"/>
<Setter Property="Foreground" Value="White"/>
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding WeightID}" Header="单号" Width="0.6*"/>
<DataGridTextColumn Binding="{Binding Order}" Header="存货" Width="1.0*"/>
<DataGridTextColumn Binding="{Binding TotalWeight, StringFormat=\{0:0.######\}}" Header="重量" Width="0.6*"/>
<DataGridTextColumn Binding="{Binding TotalWeight, StringFormat=\{0:0.######\}}" Header="件数" Width="0.6*"/>
<DataGridTextColumn Binding="{Binding Number ,StringFormat=\{0:0.######\}}" Header="已入库重量" Width="0.8*"/>
<DataGridTextColumn Binding="{Binding Already,StringFormat=\{0:0.######\}}" Header="已入库件数" Width="0.8*"/>
<DataGridTextColumn Binding="{Binding PayBill_ID}" Header="单号" Width="0.6*"/>
<DataGridTextColumn Binding="{Binding Goods_Name}" Header="存货" Width="1.0*"/>
<DataGridTextColumn Binding="{Binding Number, StringFormat=\{0:0.######\}}" Header="重量" Width="0.6*"/>
<DataGridTextColumn Binding="{Binding SecondNumber, StringFormat=\{0:0.######\}}" Header="件数" Width="0.6*"/>
<DataGridTextColumn Binding="{Binding AlreadyNumber ,StringFormat=\{0:0.######\}}" Header="已入库重量" Width="0.8*"/>
<DataGridTextColumn Binding="{Binding AlreadySecondNumber,StringFormat=\{0:0.######\}}" Header="已入库件数" Width="0.8*"/>
</DataGrid.Columns>
</DataGrid>
</GroupBox>
</Grid>
<WrapPanel Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Right">
<Button Content="按装货入库"/>
<Button Content="入库完成"/>
<Button Content="按装货入库" IsEnabled="{Binding Dmo, Converter={StaticResource NullIsFalseConverter}}" PreviewMouseDown="FillByBillBtn_PreviewMouseDown"/>
<Button Content="入库完成" IsEnabled="{Binding Dmo, Converter={StaticResource NullIsFalseConverter}}" PreviewMouseDown="FinishBtn_PreviewMouseDown"/>
</WrapPanel>
<WrapPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right">
<Button Content="按装货入库"/>
<Button Content="按装货入库" IsEnabled="{Binding Detail, Converter={StaticResource NullIsFalseConverter}}" PreviewMouseDown="FillByDetailBtn_PreviewMouseDown"/>
<TextBlock Text="件数录入"/>
<TextBox Text="2.5"/>
<Button Content="确认"/>
<TextBox x:Name="pics" Text="{Binding Pics,StringFormat=\{0:0.######\}}" Margin="10,0" PreviewMouseDown="NumberBox_PreviewMouseDown"/>
<Button Content="确认" IsEnabled="{Binding CanSave}" PreviewMouseDown="SaveBtn_PreviewMouseDown"/>
</WrapPanel>
</Grid>
</Window>

+ 184
- 1
B3DealerClient/Windows/FreshInStoreWindow_/FreshInStoreWindow.xaml.cs View File

@ -1,4 +1,9 @@
using System;
using B3DealerClient.BL;
using B3DealerClient.BO;
using B3DealerClient.Control;
using B3DealerClient.Dialogs;
using B3DealerClient.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -19,9 +24,187 @@ namespace B3DealerClient.Windows.FreshInStoreWindow_
/// </summary>
public partial class FreshInStoreWindow : Window
{
FreshInStoreContext context;
FreshInStoreConfig config;
public FreshInStoreWindow()
{
InitializeComponent();
Rect rc = SystemParameters.WorkArea;//获取工作区大小
this.Width = rc.Width;
this.Height = rc.Height;
context = new FreshInStoreContext();
this.DataContext = context;
this.Loaded += FreshInStoreWindow_Loaded;
}
private void FreshInStoreWindow_Loaded(object sender, RoutedEventArgs e)
{
config = XmlUtil.DeserializeFromFile<FreshInStoreConfig>();
if (config.Store != null)
context.Store.Fill(config.Store);
context.Pics = config.Pics;
}
private void BaseInfoBox_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
var tb = sender as TextBox;
var dig = new BaseInfoDialog(tb.Name);
if (dig.ShowDialog() == true)
{
switch (tb.Name)
{
case "Supplier":
context.Supplier.Fill(dig.Result);
break;
case "Store":
context.Store.Fill(dig.Result);
config.Store = dig.Result;
XmlUtil.SerializerObjToFile(config);
break;
}
}
}
private void NumberBox_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
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("输入错误");
var name = (sender as TextBox).Name;
switch (name)
{
//case "hook":
// context.HookWeight = value;
// config.HookWeight = value;
// break;
case "pics":
context.Pics = value;
config.Pics = value;
break;
}
XmlUtil.SerializerObjToFile(config);
}
}
private void SearchBtn_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
var btnName = (sender as Button).Name;
switch (btnName)
{
case "cx":
context.DmoList = FreshInStoreBL.GetDmoList(new
{
Date = context.Date,
ArrivedDate = context.ArrivedDate,
Supplier_ID = context.Supplier.ID,
Store_ID = context.Store.ID
});
context.Dmo = null;
context.Detail = null;
break;
case "qc":
context.Date = null;
context.ArrivedDate = null;
context.Supplier.Clear();
context.Store.Clear();
break;
}
}
private void MainGridFocus(object sender, MouseButtonEventArgs e)
{
var row = sender as DataGridRow;
context.Dmo = row.Item as FreshInStore;
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();
}
void MainSelected()
{
context.Dmo.Details = FreshInStoreBL.GetDmoDetailList(context.Dmo.ID);
context.Detail = context.Dmo.Details.FirstOrDefault();
DetailSelected();
}
private void DetailGridFocus(object sender, MouseButtonEventArgs e)
{
var row = sender as DataGridRow;
context.Detail = row.Item as FreshInStore_Detail;
DetailSelected();
}
void DetailSelected()
{
if (context.Detail == null)
return;
foreach (var item in context.Dmo.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 FillByBillBtn_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
foreach (var item in context.Dmo.Details)
{
var record = new FreshInStore_Record();
record.DetailID = item.ID;
record.Number = item.SecondNumber;
record.Weight = item.Number;
InsertRecord(record, false);
}
}
private void FillByDetailBtn_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
var record = new FreshInStore_Record();
record.DetailID = context.Detail.ID;
record.Number = context.Detail.SecondNumber;
record.Weight = context.Detail.Number;
InsertRecord(record, false);
}
private void FinishBtn_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
var target = context.Dmo.Details.Where(x => x.AlreadyNumber > 0 || x.AlreadySecondNumber > 0);
if (!target.Any())
throw new Exception("没有收获明细!");
var id = FreshInStoreBL.FinishInStore(context.Dmo.ID);
MessageBox.Show("生成采购收货单No." + id);
}
private void SaveBtn_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
var record = new FreshInStore_Record();
record.DetailID = context.Detail.ID;
record.Number = context.Pics.Value;
InsertRecord(record, true);
}
void InsertRecord(FreshInStore_Record record, bool convert)
{
record.BillID = context.Dmo.ID;
if (convert && context.Detail.SecondNumber != 0)
record.Weight = context.Detail.Number / context.Detail.SecondNumber * record.Number;
FreshInStoreBL.InsertRecord(record);
context.Detail.AlreadyNumber = record.Weight;
context.Detail.AlreadySecondNumber = record.Number;
}
}
}

+ 43
- 0
B3DealerClient/Windows/Test.xaml View File

@ -0,0 +1,43 @@
<Window x:Class="B3DealerClient.Windows.Test"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Test" Height="300" Width="300">
<Grid>
<ListBox x:Name="lb">
<ListBox.Resources>
<Style TargetType="Button" BasedOn="{StaticResource RedButton}">
<EventSetter Event="PreviewMouseDown" Handler="BtnClick"/>
</Style>
</ListBox.Resources>
<ListBox.ItemTemplate>
<DataTemplate>
<Button MinWidth="80" >
<Button.Content>
<TextBlock Text="{Binding Name}"/>
</Button.Content>
</Button>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<!--<ListView x:Name="lv">
<ListView.Resources>
<Style TargetType="Button" BasedOn="{StaticResource RedButton}">
<EventSetter Event="PreviewMouseDown" Handler="BtnClick"/>
</Style>
</ListView.Resources>
<ListView.ItemTemplate>
<DataTemplate>
<Button MinWidth="80" >
<Button.Content>
<TextBlock Text="{Binding Name}"/>
</Button.Content>
</Button>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>-->
</Grid>
</Window>

+ 44
- 0
B3DealerClient/Windows/Test.xaml.cs View File

@ -0,0 +1,44 @@
using B3DealerClient.BO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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;
namespace B3DealerClient.Windows
{
/// <summary>
/// Test.xaml 的交互逻辑
/// </summary>
public partial class Test : Window
{
List<NameIDPair> Items;
public Test()
{
InitializeComponent();
Items = new List<NameIDPair>();
Items.Add(new NameIDPair() { ID = 1, Name = "张三" });
Items.Add(new NameIDPair() { ID = 2, Name = "张1" });
Items.Add(new NameIDPair() { ID = 3, Name = "张2" });
Items.Add(new NameIDPair() { ID = 4, Name = "张4" });
Items.Add(new NameIDPair() { ID = 5, Name = "张5" });
Items.Add(new NameIDPair() { ID = 6, Name = "张6" });
lb .ItemsSource = Items;
}
private void BtnClick(object sender, MouseButtonEventArgs e)
{
var btn = sender as Button;
var tag = btn.Tag as NameIDPair;
MessageBox.Show(tag.ID.ToString());
}
}
}

Loading…
Cancel
Save