diff --git a/B3DealerClient/B3DealerClient.csproj b/B3DealerClient/B3DealerClient.csproj
index 832648b..d0cfdfa 100644
--- a/B3DealerClient/B3DealerClient.csproj
+++ b/B3DealerClient/B3DealerClient.csproj
@@ -78,10 +78,18 @@
+
+
-
-
-
+
+
+
+
+
+
+
+
+
@@ -125,15 +133,26 @@
RecordViewDialog.xaml
+
+
CarcassSaleOutWindow.xaml
+
+ RecordViewDialog.xaml
+
+
+
+
FreshInStoreWindow.xaml
FreshSaleOutWindow.xaml
+
+ Test.xaml
+
@@ -240,6 +259,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
@@ -248,6 +271,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
diff --git a/B3DealerClient/BL/BaseInfoBL.cs b/B3DealerClient/BL/BaseInfoBL.cs
index c844949..6aa04f6 100644
--- a/B3DealerClient/BL/BaseInfoBL.cs
+++ b/B3DealerClient/BL/BaseInfoBL.cs
@@ -23,6 +23,9 @@ namespace B3DealerClient.BL
case "Store":
dataKind = "授权仓库";
break;
+ case "DriverGoodsLine":
+ dataKind = "B3Dealer_送货线路";
+ break;
default:
throw new Exception(string.Format("未知的数据源类型:{0}", typeName));
}
diff --git a/B3DealerClient/BL/CarcassInStoreBL.cs b/B3DealerClient/BL/CarcassInStoreBL.cs
index 1c359d4..9332d61 100644
--- a/B3DealerClient/BL/CarcassInStoreBL.cs
+++ b/B3DealerClient/BL/CarcassInStoreBL.cs
@@ -26,7 +26,7 @@ namespace B3DealerClient.BL
{
var method = MethodPath + "GetPayBillDetails";
var json = RpcFacade.Call(method, id);
- var list= JsonConvert.DeserializeObject>(json);
+ var list = JsonConvert.DeserializeObject>(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();
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;
}
diff --git a/B3DealerClient/BL/CarcassSaleOutBL.cs b/B3DealerClient/BL/CarcassSaleOutBL.cs
new file mode 100644
index 0000000..2db0038
--- /dev/null
+++ b/B3DealerClient/BL/CarcassSaleOutBL.cs
@@ -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 GetDmoList(object condition)
+ {
+ var method = MethodPath + "GetSaleOutStoreList";
+ var json = RpcFacade.Call(method, JsonConvert.SerializeObject(condition));
+ var list = JsonConvert.DeserializeObject>(json);
+ FillAlreadyInfo(list);
+ return list;
+ }
+
+ private static void FillAlreadyInfo(List 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();
+ 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 GetCustomers(object condition)
+ {
+ var method = MethodPath + "GetCustomers";
+ var json = RpcFacade.Call(method, JsonConvert.SerializeObject(condition));
+ return JsonConvert.DeserializeObject>(json);
+ }
+
+ public static IEnumerable 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();
+ }
+
+ 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(MethodPath + "FinishAssign", JsonConvert.SerializeObject(target), id);
+ }
+
+ public static IEnumerable 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();
+ }
+ }
+}
diff --git a/B3DealerClient/BL/FreshInStoreBL.cs b/B3DealerClient/BL/FreshInStoreBL.cs
new file mode 100644
index 0000000..a317a31
--- /dev/null
+++ b/B3DealerClient/BL/FreshInStoreBL.cs
@@ -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 GetDmoList(object condition)
+ {
+ var method = MethodPath + "GetPayBillList";
+ var json = RpcFacade.Call(method, JsonConvert.SerializeObject(condition));
+ return JsonConvert.DeserializeObject>(json);
+ }
+
+ public static List GetDmoDetailList(long id)
+ {
+ var method = MethodPath + "GetPayBillDetails";
+ var json = RpcFacade.Call(method, id);
+ var list = JsonConvert.DeserializeObject>(json);
+ FillAlreadyInfo(list);
+ return list;
+ }
+
+ static void FillAlreadyInfo(List 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();
+ 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(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(session);
+ }
+ }
+}
diff --git a/B3DealerClient/BO/CarcassInStore.cs b/B3DealerClient/BO/CarcassInStore.cs
deleted file mode 100644
index feda4ed..0000000
--- a/B3DealerClient/BO/CarcassInStore.cs
+++ /dev/null
@@ -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 mDetails = new List();
- public List Details
- {
- get { return mDetails; }
- set
- {
- mDetails = value;
- RaisePropertyChanged("Details");
- }
- }
- }
-}
diff --git a/B3DealerClient/BO/CarcassInStore/CarcassInStore.cs b/B3DealerClient/BO/CarcassInStore/CarcassInStore.cs
new file mode 100644
index 0000000..9a2d711
--- /dev/null
+++ b/B3DealerClient/BO/CarcassInStore/CarcassInStore.cs
@@ -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 mDetails = new List();
+ public List Details
+ {
+ get { return mDetails; }
+ set
+ {
+ mDetails = value;
+ RaisePropertyChanged("Details");
+ }
+ }
+ }
+}
diff --git a/B3DealerClient/BO/CarcassInStore/CarcassInStore_Detail.cs b/B3DealerClient/BO/CarcassInStore/CarcassInStore_Detail.cs
new file mode 100644
index 0000000..f194835
--- /dev/null
+++ b/B3DealerClient/BO/CarcassInStore/CarcassInStore_Detail.cs
@@ -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 mDetails = new ObservableCollection();
+ public ObservableCollection Details { get { return mDetails; } }
+ }
+}
diff --git a/B3DealerClient/BO/CarcassInStore/CarcassInStore_Receive.cs b/B3DealerClient/BO/CarcassInStore/CarcassInStore_Receive.cs
new file mode 100644
index 0000000..87cbcc2
--- /dev/null
+++ b/B3DealerClient/BO/CarcassInStore/CarcassInStore_Receive.cs
@@ -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");
+ }
+ }
+ }
+}
diff --git a/B3DealerClient/BO/CarcassInStore_Detail.cs b/B3DealerClient/BO/CarcassInStore_Detail.cs
deleted file mode 100644
index 01224df..0000000
--- a/B3DealerClient/BO/CarcassInStore_Detail.cs
+++ /dev/null
@@ -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 mDetails=new ObservableCollection();
- public ObservableCollection Details { get { return mDetails; } }
- }
-}
diff --git a/B3DealerClient/BO/CarcassInStore_Receive.cs b/B3DealerClient/BO/CarcassInStore_Receive.cs
deleted file mode 100644
index 4067b3e..0000000
--- a/B3DealerClient/BO/CarcassInStore_Receive.cs
+++ /dev/null
@@ -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");
- }
- }
- }
-}
diff --git a/B3DealerClient/BO/CarcassSaleOut/CarcassSaleOut.cs b/B3DealerClient/BO/CarcassSaleOut/CarcassSaleOut.cs
new file mode 100644
index 0000000..86a9a86
--- /dev/null
+++ b/B3DealerClient/BO/CarcassSaleOut/CarcassSaleOut.cs
@@ -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");
+ }
+ }
+ }
+}
diff --git a/B3DealerClient/BO/CarcassSaleOut/CarcassSaleOut_Record.cs b/B3DealerClient/BO/CarcassSaleOut/CarcassSaleOut_Record.cs
new file mode 100644
index 0000000..3d213f9
--- /dev/null
+++ b/B3DealerClient/BO/CarcassSaleOut/CarcassSaleOut_Record.cs
@@ -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");
+ }
+ }
+ }
+}
diff --git a/B3DealerClient/BO/CarcassSaleOut/CustomerObj.cs b/B3DealerClient/BO/CarcassSaleOut/CustomerObj.cs
new file mode 100644
index 0000000..c5bf413
--- /dev/null
+++ b/B3DealerClient/BO/CarcassSaleOut/CustomerObj.cs
@@ -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;
+ }
+ }
+}
diff --git a/B3DealerClient/BO/FreshInStore/FreshInStore.cs b/B3DealerClient/BO/FreshInStore/FreshInStore.cs
new file mode 100644
index 0000000..b7f4625
--- /dev/null
+++ b/B3DealerClient/BO/FreshInStore/FreshInStore.cs
@@ -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 mDetails = new List();
+ public List Details
+ {
+ get { return mDetails; }
+ set
+ {
+ mDetails = value;
+ RaisePropertyChanged("Details");
+ }
+ }
+ }
+}
diff --git a/B3DealerClient/BO/FreshInStore/FreshInStore_Detail.cs b/B3DealerClient/BO/FreshInStore/FreshInStore_Detail.cs
new file mode 100644
index 0000000..04567a9
--- /dev/null
+++ b/B3DealerClient/BO/FreshInStore/FreshInStore_Detail.cs
@@ -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");
+ }
+ }
+ }
+}
diff --git a/B3DealerClient/BO/FreshInStore/FreshInStore_Record.cs b/B3DealerClient/BO/FreshInStore/FreshInStore_Record.cs
new file mode 100644
index 0000000..1e6629a
--- /dev/null
+++ b/B3DealerClient/BO/FreshInStore/FreshInStore_Record.cs
@@ -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; }
+ }
+}
diff --git a/B3DealerClient/Dialogs/BaseInfoDialog.xaml.cs b/B3DealerClient/Dialogs/BaseInfoDialog.xaml.cs
index d27ca2e..d16ccb8 100644
--- a/B3DealerClient/Dialogs/BaseInfoDialog.xaml.cs
+++ b/B3DealerClient/Dialogs/BaseInfoDialog.xaml.cs
@@ -40,6 +40,9 @@ namespace B3DealerClient.Dialogs
case "Store":
this.Title = "仓库";
break;
+ case "DriverGoodsLine":
+ this.Title="送货线路";
+ break;
default:
break;
}
diff --git a/B3DealerClient/Utils/ValueConverter.cs b/B3DealerClient/Utils/ValueConverter.cs
index 58c7ba8..1e3543b 100644
--- a/B3DealerClient/Utils/ValueConverter.cs
+++ b/B3DealerClient/Utils/ValueConverter.cs
@@ -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();
}
diff --git a/B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreWindow.xaml b/B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreWindow.xaml
index 89fe9aa..3810bca 100644
--- a/B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreWindow.xaml
+++ b/B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreWindow.xaml
@@ -129,7 +129,6 @@
-->
-
@@ -173,7 +172,6 @@
-->
-
@@ -211,7 +209,6 @@
-->
-
@@ -253,7 +250,7 @@
-
+
diff --git a/B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreWindow.xaml.cs b/B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreWindow.xaml.cs
index bc10ebb..c4dcc6f 100644
--- a/B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreWindow.xaml.cs
+++ b/B3DealerClient/Windows/CarcassInStoreWindow_/CarcassInStoreWindow.xaml.cs
@@ -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)
diff --git a/B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutConfig.cs b/B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutConfig.cs
new file mode 100644
index 0000000..4207758
--- /dev/null
+++ b/B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutConfig.cs
@@ -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; }
+ }
+}
diff --git a/B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutContext.cs b/B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutContext.cs
new file mode 100644
index 0000000..9c20082
--- /dev/null
+++ b/B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutContext.cs
@@ -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 mDmoList = null;
+ public List DmoList { get { return mDmoList; } set { mDmoList = value; RaisePropertyChanged("DmoList"); } }
+
+ private readonly ObservableCollection mDetails = new ObservableCollection();
+ public ObservableCollection 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 mCustomerList = null;
+ public List 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; } }
+ }
+}
diff --git a/B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutWindow.xaml b/B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutWindow.xaml
index 95686d7..e7cf85a 100644
--- a/B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutWindow.xaml
+++ b/B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutWindow.xaml
@@ -1,9 +1,13 @@
+ 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">
+
+
+
@@ -29,55 +38,43 @@
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -86,10 +83,11 @@
+
-
-
+
+
@@ -98,7 +96,7 @@
-
+
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
@@ -206,22 +204,22 @@
-
+
-
+
-
+
-
+
@@ -229,6 +227,7 @@
+
@@ -237,7 +236,7 @@
-
+
@@ -250,7 +249,11 @@
-
+
@@ -260,10 +263,10 @@
-
-
-
+
+
+
-
+
diff --git a/B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutWindow.xaml.cs b/B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutWindow.xaml.cs
index d66bf12..8769843 100644
--- a/B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutWindow.xaml.cs
+++ b/B3DealerClient/Windows/CarcassSaleOutWindow_/CarcassSaleOutWindow.xaml.cs
@@ -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_
///
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();
+ 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("配货完成");
}
}
}
diff --git a/B3DealerClient/Windows/CarcassSaleOutWindow_/RecordViewDialog.xaml b/B3DealerClient/Windows/CarcassSaleOutWindow_/RecordViewDialog.xaml
new file mode 100644
index 0000000..6ee7f8b
--- /dev/null
+++ b/B3DealerClient/Windows/CarcassSaleOutWindow_/RecordViewDialog.xaml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/B3DealerClient/Windows/CarcassSaleOutWindow_/RecordViewDialog.xaml.cs b/B3DealerClient/Windows/CarcassSaleOutWindow_/RecordViewDialog.xaml.cs
new file mode 100644
index 0000000..a1bef52
--- /dev/null
+++ b/B3DealerClient/Windows/CarcassSaleOutWindow_/RecordViewDialog.xaml.cs
@@ -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_
+{
+ ///
+ /// RecordViewDialog.xaml 的交互逻辑
+ ///
+ 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);
+ }
+ }
+}
diff --git a/B3DealerClient/Windows/CarcassSaleOutWindow_/SelfValueConvert.cs b/B3DealerClient/Windows/CarcassSaleOutWindow_/SelfValueConvert.cs
new file mode 100644
index 0000000..f6eebf2
--- /dev/null
+++ b/B3DealerClient/Windows/CarcassSaleOutWindow_/SelfValueConvert.cs
@@ -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();
+ }
+ }
+}
diff --git a/B3DealerClient/Windows/FreshInStoreWindow_/FreshInStoreConfig.cs b/B3DealerClient/Windows/FreshInStoreWindow_/FreshInStoreConfig.cs
new file mode 100644
index 0000000..86fa6da
--- /dev/null
+++ b/B3DealerClient/Windows/FreshInStoreWindow_/FreshInStoreConfig.cs
@@ -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; }
+ }
+}
diff --git a/B3DealerClient/Windows/FreshInStoreWindow_/FreshInStoreContext.cs b/B3DealerClient/Windows/FreshInStoreWindow_/FreshInStoreContext.cs
new file mode 100644
index 0000000..628047e
--- /dev/null
+++ b/B3DealerClient/Windows/FreshInStoreWindow_/FreshInStoreContext.cs
@@ -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 dmoList = new List();
+
+ public List DmoList
+ {
+ get { return dmoList; }
+ set
+ {
+ dmoList = value;
+ this.RaisePropertyChanged("DmoList");
+ }
+ }
+
+ public bool CanSave { get { return Pics > 0 && mDetail != null; } }
+ }
+}
diff --git a/B3DealerClient/Windows/FreshInStoreWindow_/FreshInStoreWindow.xaml b/B3DealerClient/Windows/FreshInStoreWindow_/FreshInStoreWindow.xaml
index 78d552e..14a6b65 100644
--- a/B3DealerClient/Windows/FreshInStoreWindow_/FreshInStoreWindow.xaml
+++ b/B3DealerClient/Windows/FreshInStoreWindow_/FreshInStoreWindow.xaml
@@ -1,15 +1,21 @@
+ xmlns:local="clr-namespace:B3DealerClient.Control"
+ xmlns:util="clr-namespace:B3DealerClient.Utils"
+ Title="鲜品收货" Height="700" Width="1200" FontSize="17" WindowState="Maximized">
+
+
+
+
@@ -50,28 +62,33 @@
-
+
-
+
-
+
-
+
-
-
+
+
+
+
+
-
+
-
-
-
-
+
+
+
+
@@ -106,24 +122,24 @@
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
-
+
-
-
+
+
-
+
-
-
+
+
diff --git a/B3DealerClient/Windows/FreshInStoreWindow_/FreshInStoreWindow.xaml.cs b/B3DealerClient/Windows/FreshInStoreWindow_/FreshInStoreWindow.xaml.cs
index 510c3b9..e2c2d46 100644
--- a/B3DealerClient/Windows/FreshInStoreWindow_/FreshInStoreWindow.xaml.cs
+++ b/B3DealerClient/Windows/FreshInStoreWindow_/FreshInStoreWindow.xaml.cs
@@ -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_
///
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();
+ 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;
}
}
}
diff --git a/B3DealerClient/Windows/Test.xaml b/B3DealerClient/Windows/Test.xaml
new file mode 100644
index 0000000..de6aaeb
--- /dev/null
+++ b/B3DealerClient/Windows/Test.xaml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/B3DealerClient/Windows/Test.xaml.cs b/B3DealerClient/Windows/Test.xaml.cs
new file mode 100644
index 0000000..e2d61e1
--- /dev/null
+++ b/B3DealerClient/Windows/Test.xaml.cs
@@ -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
+{
+ ///
+ /// Test.xaml 的交互逻辑
+ ///
+ public partial class Test : Window
+ {
+ List Items;
+ public Test()
+ {
+ InitializeComponent();
+ Items = new List();
+ 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());
+ }
+ }
+}