diff --git a/B3ClientService.Web/B3ClientService.Web.csproj b/B3ClientService.Web/B3ClientService.Web.csproj index e799ff0..99422f3 100644 --- a/B3ClientService.Web/B3ClientService.Web.csproj +++ b/B3ClientService.Web/B3ClientService.Web.csproj @@ -39,6 +39,10 @@ False ..\..\..\..\BwpB3Project\tsref\Debug\B3Frameworks.Web.dll + + False + ..\..\..\tsref\Debug\B3System.dll + False ..\..\..\..\BwpB3Project\tsref\Debug\Forks.EnterpriseServices.dll diff --git a/B3ClientService.Web/PluginClass.cs b/B3ClientService.Web/PluginClass.cs index 8b3abfd..a7d5c82 100644 --- a/B3ClientService.Web/PluginClass.cs +++ b/B3ClientService.Web/PluginClass.cs @@ -1,4 +1,5 @@ -using BWP.Web.Utils; +using BWP.B3System; +using BWP.Web.Utils; using System; using System.Collections.Generic; using System.Linq; @@ -13,6 +14,7 @@ namespace BWP.B3ClientService public void OnInit() { B3ClientServiceChoiceBoxDataProvider.Register(); + SubSystem.RegisterSubSystem(new SubSystem("B3ClientService", "MES系统")); } } } diff --git a/B3ClientService/B3ClientService.csproj b/B3ClientService/B3ClientService.csproj index c5ec622..a3fb7eb 100644 --- a/B3ClientService/B3ClientService.csproj +++ b/B3ClientService/B3ClientService.csproj @@ -149,6 +149,7 @@ + diff --git a/B3ClientService/BO/Bill/CarcassFullInfo.cs b/B3ClientService/BO/Bill/CarcassFullInfo.cs index f415ef5..60abb75 100644 --- a/B3ClientService/BO/Bill/CarcassFullInfo.cs +++ b/B3ClientService/BO/Bill/CarcassFullInfo.cs @@ -81,6 +81,9 @@ namespace BWP.B3ClientService.BO [LogicName("领用人员")] public long? PickWorker_ID { get; set; } + [LogicName("领用工作单元")] + public long? PickWorkUnit_ID { get; set; } + [LogicName("领用时间")] public DateTime? PickTime { get; set; } diff --git a/B3ClientService/OfflinRpc/CarcassInStoreRpc.cs b/B3ClientService/OfflinRpc/CarcassInStoreRpc.cs index 458fc0b..c56a611 100644 --- a/B3ClientService/OfflinRpc/CarcassInStoreRpc.cs +++ b/B3ClientService/OfflinRpc/CarcassInStoreRpc.cs @@ -212,8 +212,6 @@ namespace BWP.B3ClientService.Rpcs class CarcassInStoreObj { - public long ID { get; set; } - public int RowVersion { get; set; } public string BarCode { get; set; } public long? InStoreWorker_ID { get; set; } public long? WorkUnit_ID { get; set; } diff --git a/B3ClientService/OfflinRpc/CarcassTakeOutRpc.cs b/B3ClientService/OfflinRpc/CarcassTakeOutRpc.cs new file mode 100644 index 0000000..1a3c8c6 --- /dev/null +++ b/B3ClientService/OfflinRpc/CarcassTakeOutRpc.cs @@ -0,0 +1,99 @@ +using BWP.B3ClientService.BO; +using BWP.B3ClientService.NamedValueTemplate; +using Forks.EnterpriseServices.DomainObjects2; +using Forks.EnterpriseServices.DomainObjects2.DQuery; +using Forks.EnterpriseServices.JsonRpc; +using Forks.EnterpriseServices.SqlDoms; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using TSingSoft.WebPluginFramework; + +namespace BWP.B3ClientService.OfflinRpc +{ + [Rpc] + public static class CarcassTakeOutRpc + { + [Rpc(RpcFlags.SkipAuth)] + public static int UploadCarcassInfo(string json) + { + var list = JsonConvert.DeserializeObject>(json); + using (var session = Dmo.NewSession()) + { + foreach (var item in list) + { + var id = GetID(item.BarCode, session); + if (id.HasValue) + Update(id.Value, item, session); + else + Insert(item, session); + } + session.Commit(); + } + return 1; + } + + static long? GetID(string code, IDmoSession session) + { + var query = new DQueryDom(new JoinAlias(typeof(CarcassFullInfo))); + query.Columns.Add(DQSelectColumn.Field("ID")); + query.Where.Conditions.Add(DQCondition.EQ("BarCode", code)); + return query.EExecuteScalar(session); + } + + static void Update(long id, CarcassTakeOutObj obj, IDmoSession session) + { + var update = new DQUpdateDom(typeof(CarcassFullInfo)); + update.Columns.Add(new DQUpdateColumn("PickWorker_ID", obj.TakeOutWorker_ID)); + update.Columns.Add(new DQUpdateColumn("PickWorkUnit_ID", obj.WorkUnit_ID)); + update.Columns.Add(new DQUpdateColumn("PickGroupID", obj.GroupID)); + update.Columns.Add(new DQUpdateColumn("PickWeight", obj.Weight)); + update.Columns.Add(new DQUpdateColumn("PickTime", obj.Time)); + update.Columns.Add(new DQUpdateColumn("PickType", 领用类型.分割领用)); + update.Where.Conditions.Add(DQCondition.EQ("ID", id)); + session.ExecuteNonQuery(update); + } + + static void Insert(CarcassTakeOutObj obj, IDmoSession session) + { + var entity = new CarcassFullInfo(); + entity.BarCode = obj.BarCode; + entity.PickWorker_ID = obj.TakeOutWorker_ID; + entity.PickWorkUnit_ID = obj.WorkUnit_ID; + entity.PickWeight = obj.Weight; + entity.PickGroupID = obj.GroupID; + entity.PickTime = obj.Time; + entity.PickType = 领用类型.分割领用; + session.Insert(entity); + } + + [Rpc(RpcFlags.SkipAuth)] + public static string GetBeforeInfo(List codeList) + { + var main = new JoinAlias(typeof(CarcassFullInfo)); + var goods = new JoinAlias(typeof(Goods)); + var query = new DQueryDom(main); + query.From.AddJoin(JoinType.Left, new DQDmoSource(goods), DQCondition.EQ(main, "InStoreGoods_ID", goods, "ID")); + query.Columns.Add(DQSelectColumn.Field("BarCode")); + query.Columns.Add(DQSelectColumn.Field("InStoreWeight")); + query.Columns.Add(DQSelectColumn.Field("InStoreGoods_ID")); + query.Columns.Add(DQSelectColumn.Field("Name", goods)); + query.Where.Conditions.Add(DQCondition.And(DQCondition.IsNotNull(DQExpression.Field("InStoreWeight")), DQCondition.InList(DQExpression.Field("BarCode"), codeList.Select(x => DQExpression.Value(x)).ToArray()))); + var result = query.EExecuteList(); + var back = result.Select(x => new ExtensionObj { StringExt1 = x.Item1, DecimalExt1 = x.Item2, LongExt1 = x.Item3, StringExt2 = x.Item4 }); + return JsonConvert.SerializeObject(back); + } + } + + class CarcassTakeOutObj + { + public string BarCode { get; set; } + public long? TakeOutWorker_ID { get; set; } + public long? WorkUnit_ID { get; set; } + public decimal? Weight { get; set; } + public DateTime? Time { get; set; } + public long? GroupID { get; set; } + } +} diff --git a/B3ClientService/OfflinRpc/ExtensionObj.cs b/B3ClientService/OfflinRpc/ExtensionObj.cs index bf8c59e..9342e9f 100644 --- a/B3ClientService/OfflinRpc/ExtensionObj.cs +++ b/B3ClientService/OfflinRpc/ExtensionObj.cs @@ -14,5 +14,7 @@ namespace BWP.B3ClientService.BO public decimal? DecimalExt1 { get; set; } public string StringExt1 { get; set; } + + public string StringExt2 { get; set; } } } diff --git a/WebFolder/config/ioc/B3ClientServiceMenu.txt b/WebFolder/config/ioc/B3ClientServiceMenu.txt new file mode 100644 index 0000000..832f266 --- /dev/null +++ b/WebFolder/config/ioc/B3ClientServiceMenu.txt @@ -0,0 +1 @@ +DisplayName=MES系统菜单 \ No newline at end of file diff --git a/WebFolder/config/plugins/B3ClientService.plugin b/WebFolder/config/plugins/B3ClientService.plugin index 45e2f50..35c27d7 100644 --- a/WebFolder/config/plugins/B3ClientService.plugin +++ b/WebFolder/config/plugins/B3ClientService.plugin @@ -8,6 +8,7 @@ +