Browse Source

完善

master
yibo 7 years ago
parent
commit
7d5aa5a745
10 changed files with 113 additions and 14 deletions
  1. +20
    -0
      ButcherFactory.BO/Base/WorkerGoodsSetProfile.cs
  2. +36
    -0
      ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs
  3. +1
    -1
      ButcherFactory.BO/BaseInfo/Goods.cs
  4. +4
    -1
      ButcherFactory.BO/ButcherFactory.BO.csproj
  5. +15
    -0
      ButcherFactory.BO/Enums/ApplyClient.cs
  6. +0
    -0
      ButcherFactory.BO/Enums/DriveType.cs
  7. +32
    -10
      ButcherFactory.BO/Rpcs/BaseInfoSyncRpc.cs
  8. +1
    -1
      ButcherFactory.BO/Utils/LoginUtil.cs
  9. +1
    -1
      ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.cs
  10. +3
    -0
      ButcherFactory.Login/Login.cs

+ 20
- 0
ButcherFactory.BO/Base/WorkerGoodsSetProfile.cs View File

@ -0,0 +1,20 @@
using Forks.EnterpriseServices.DataDictionary;
using Forks.EnterpriseServices.DomainObjects2;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ButcherFactory.BO
{
[MapToTable("Butcher_WorkerGoodsSetProfile")]
[DBIndex("IDX_Butcher_WorkerGoodsSet_Clustered", "Worker_ID", false, 0)]
[DBIndexType("IDX_Butcher_WorkerGoodsSet_Clustered", IndexType.Clustered)]
public class WorkerGoodsSetProfile
{
public long Worker_ID { get; set; }
public long ClientGoodsSet_Detail_ID { get; set; }
}
}

+ 36
- 0
ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs View File

@ -0,0 +1,36 @@
using Forks.EnterpriseServices.DomainObjects2;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ButcherFactory.BO
{
[MapToTable("Butcher_ClientGoodsSet")]
public class ClientGoodsSet : BaseInfo
{
private List<ClientGoodsSet_Detail> mDetails = new List<ClientGoodsSet_Detail>();
[NonDmoProperty]
public List<ClientGoodsSet_Detail> Details { get { return mDetails; } }
[NonDmoProperty]
public bool Stopped { get; set; }
}
[MapToTable("Butcher_ClientGoodsSet_Detail")]
public class ClientGoodsSet_Detail
{
public long ClientGoodsSet_ID { get; set; }
public long ID { get; set; }
public long Goods_ID { get; set; }
public decimal? StandardWeight { get; set; }
public decimal? StandardWeightUp { get; set; }
public decimal? StandardWeightLow { get; set; }
}
}

+ 1
- 1
ButcherFactory.BO/BaseInfo/Goods.cs View File

@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace ButcherFactory.BO namespace ButcherFactory.BO
{ {
[MapToTable("Butcher_Goods")] [MapToTable("Butcher_Goods")]
public class Goods:BaseInfo
public class Goods : BaseInfo
{ {
public string MainUnit { get; set; } public string MainUnit { get; set; }


+ 4
- 1
ButcherFactory.BO/ButcherFactory.BO.csproj View File

@ -56,13 +56,16 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="BaseInfo\ClientGoodsSet.cs" />
<Compile Include="Base\BaseInfo.cs" /> <Compile Include="Base\BaseInfo.cs" />
<Compile Include="BaseInfo\ProductBatch.cs" /> <Compile Include="BaseInfo\ProductBatch.cs" />
<Compile Include="Base\DriveType.cs" />
<Compile Include="Enums\ApplyClient.cs" />
<Compile Include="Enums\DriveType.cs" />
<Compile Include="Base\SyncBill.cs" /> <Compile Include="Base\SyncBill.cs" />
<Compile Include="BaseInfo\Goods.cs" /> <Compile Include="BaseInfo\Goods.cs" />
<Compile Include="BaseInfo\WorkUnit.cs" /> <Compile Include="BaseInfo\WorkUnit.cs" />
<Compile Include="BaseInfo\Worker.cs" /> <Compile Include="BaseInfo\Worker.cs" />
<Compile Include="Base\WorkerGoodsSetProfile.cs" />
<Compile Include="Bill\CarcassInStore.cs" /> <Compile Include="Bill\CarcassInStore.cs" />
<Compile Include="LocalBL\BaseInfoBL.cs" /> <Compile Include="LocalBL\BaseInfoBL.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />


+ 15
- 0
ButcherFactory.BO/Enums/ApplyClient.cs View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ButcherFactory.BO
{
public enum ApplyClient
{
= 0,
= 1,
= 2,
}
}

ButcherFactory.BO/Base/DriveType.cs → ButcherFactory.BO/Enums/DriveType.cs View File


+ 32
- 10
ButcherFactory.BO/Rpcs/BaseInfoSyncRpc.cs View File

@ -1,5 +1,6 @@
using ButcherFactory.BO.Utils; using ButcherFactory.BO.Utils;
using Forks.EnterpriseServices.DomainObjects2; using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.JsonRpc.Client; using Forks.JsonRpc.Client;
using Newtonsoft.Json; using Newtonsoft.Json;
using System; using System;
@ -38,17 +39,38 @@ namespace ButcherFactory.BO.Rpcs
} }
} }
public static void SyncGoodsByTag(string tag)
public static void SyncGoodsByTag(ApplyClient applyClient)
{ {
//var json = RpcFacade.Call<string>(baseInfoRpcPath + "SyncGoods");
//var list = JsonConvert.DeserializeObject<List<Goods>>(json);
//using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
//{
// TruncateTable(typeof(Goods), session);
// foreach (var item in list)
// session.Insert(item);
// session.Commit();
//}
var json = RpcFacade.Call<string>(baseInfoRpcPath + "SyncClientGoodsSetByClient", (short)applyClient);
var list = JsonConvert.DeserializeObject<List<ClientGoodsSet>>(json);
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
{
foreach (var item in list)
{
DeleteOld(item.ID, session);
if (!item.Stopped)
Insert(item, session);
}
session.Commit();
}
}
static void DeleteOld(long id, IDmoSession session)
{
var detail = new DQDeleteDom(typeof(ClientGoodsSet_Detail));
detail.Where.Conditions.Add(DQCondition.EQ("ClientGoodsSet_ID", id));
session.ExecuteNonQuery(detail);
var main = new DQDeleteDom(typeof(ClientGoodsSet));
main.Where.Conditions.Add(DQCondition.EQ("ID", id));
session.ExecuteNonQuery(main);
}
static void Insert(ClientGoodsSet entity, IDmoSession session)
{
session.Insert(entity);
foreach (var detail in entity.Details)
session.Insert(detail);
} }
} }
} }

+ 1
- 1
ButcherFactory.BO/Utils/LoginUtil.cs View File

@ -86,7 +86,7 @@ namespace ButcherFactory.BO.Utils
const string loginMethod = "/MainSystem/B3ClientService/Rpcs/LoginRpc/Login"; const string loginMethod = "/MainSystem/B3ClientService/Rpcs/LoginRpc/Login";
var r = RpcFacade.Call<long>(loginMethod, name, pwd); var r = RpcFacade.Call<long>(loginMethod, name, pwd);
if (r == 0) if (r == 0)
throw new Exception("工号输入错误");
throw new Exception("用户名密码错误");
else if (r == -1) else if (r == -1)
throw new Exception("账号被停用"); throw new Exception("账号被停用");
AppContext.Worker.ID = r; AppContext.Worker.ID = r;


+ 1
- 1
ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.cs View File

@ -32,7 +32,7 @@ namespace ButcherFactory.CarcassInStore_
{ {
if (netStateWatch1.NetState) if (netStateWatch1.NetState)
{ {
BaseInfoSyncRpc.SyncGoodsByTag("");
BaseInfoSyncRpc.SyncGoodsByTag(ApplyClient.);
BaseInfoSyncRpc.SyncBaseInfo<WorkUnit>(); BaseInfoSyncRpc.SyncBaseInfo<WorkUnit>();
BaseInfoSyncRpc.SyncBaseInfo<ProductBatch>(); BaseInfoSyncRpc.SyncBaseInfo<ProductBatch>();
} }


+ 3
- 0
ButcherFactory.Login/Login.cs View File

@ -17,6 +17,9 @@ namespace ButcherFactory.Login
public Login() public Login()
{ {
InitializeComponent(); InitializeComponent();
#if DEBUG
pwdBox.Text = "123";
#endif
try try
{ {
userNameBox.Text = AppContext.Worker.Name; userNameBox.Text = AppContext.Worker.Name;


Loading…
Cancel
Save