| @ -0,0 +1,37 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Data; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using BWP.B3Frameworks.BO; | |||
| using Forks.EnterpriseServices.DataForm; | |||
| using Forks.EnterpriseServices.DomainObjects2; | |||
| namespace BWP.B3ClientService.BO | |||
| { | |||
| [Serializable] | |||
| [DFClass] | |||
| public class MaterialRequisitionRecord : Base | |||
| { | |||
| public long? B3_ID { get; set; } | |||
| public DateTime? SyncToB3DateTime { get; set; } | |||
| private DateTime mCreateTime = DateTime.Now; | |||
| [DbColumn(DbType = SqlDbType.DateTime)] | |||
| public DateTime CreateTime { get { return mCreateTime; } set { mCreateTime = value; } } | |||
| public string BarCode { get; set; }//条码 | |||
| public long Goods_ID { get; set; } | |||
| public string Goods_Name { get; set; } | |||
| public string Goods_Spec { get; set; } | |||
| public decimal Weight { get; set; }//净重 | |||
| public string CardBarCode { get; set; }//放产品的车的条码 | |||
| public string BiaoShi { get; set; }//用来记录那个工作台或者哪台触摸屏做的 | |||
| public string CreateUserName { get; set; } | |||
| } | |||
| } | |||
| @ -0,0 +1,27 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using BWP.B3ClientService.BO; | |||
| using Forks.EnterpriseServices.DataForm; | |||
| namespace BWP.B3ClientService.Rpcs.BillRpc | |||
| { | |||
| [Serializable, DFClass] | |||
| public class MaterialRequisitionRecordDto : ClientSyncBaseDto | |||
| { | |||
| public string BarCode { get; set; }//条码 | |||
| public long Goods_ID { get; set; } | |||
| public string Goods_Name { get; set; } | |||
| public string Goods_Spec { get; set; } | |||
| public decimal Weight { get; set; }//净重 | |||
| public string CardBarCode { get; set; }//放产品的车的条码 | |||
| public string BiaoShi { get; set; }//用来记录那个工作台或者哪台触摸屏做的 | |||
| public string CreateUserName { get; set; } | |||
| } | |||
| } | |||
| @ -0,0 +1,67 @@ | |||
| using System; | |||
| using BWP.B3ClientService.BO; | |||
| using BWP.B3Frameworks.Utils; | |||
| using Forks.EnterpriseServices.DomainObjects2; | |||
| using Forks.EnterpriseServices.DomainObjects2.DQuery; | |||
| using Forks.EnterpriseServices.JsonRpc; | |||
| using Newtonsoft.Json; | |||
| namespace BWP.B3ClientService.Rpcs.BillRpc | |||
| { | |||
| [Rpc] | |||
| public static class MaterialRequisitionRecordRpc | |||
| { | |||
| private static readonly object _insertObj = new object(); | |||
| [Rpc] | |||
| public static long Insert(string json) | |||
| { | |||
| lock (_insertObj) | |||
| { | |||
| var record = JsonConvert.DeserializeObject<MaterialRequisitionRecord>(json); | |||
| record.CreateTime = DateTime.Now; | |||
| using (var session = Dmo.NewSession()) | |||
| { | |||
| session.Insert(record); | |||
| session.Commit(); | |||
| } | |||
| return record.ID; | |||
| } | |||
| } | |||
| private static readonly object _updateObj = new object(); | |||
| [Rpc] | |||
| public static int Update(string json) | |||
| { | |||
| lock (_updateObj) | |||
| { | |||
| var clientRecord = JsonConvert.DeserializeObject<MaterialRequisitionRecordDto>(json); | |||
| using (var session = Dmo.NewSession()) | |||
| { | |||
| var record = session.Load(new DmoIdentity(typeof(MaterialRequisitionRecord), clientRecord.Service_ID ?? 0)); | |||
| if (record == null) | |||
| { | |||
| return 0; | |||
| } | |||
| DmoUtil.CopyDmoFields(clientRecord, record, "ID", "B3_ID"); | |||
| session.Update(record); | |||
| session.Commit(); | |||
| } | |||
| return 1; | |||
| } | |||
| } | |||
| [Rpc] | |||
| public static int Delete(long id) | |||
| { | |||
| var delDom = new DQDeleteDom(typeof(MaterialRequisitionRecord)); | |||
| delDom.Where.Conditions.Add(DQCondition.EQ("ID", id)); | |||
| using (var session = Dmo.NewSession()) | |||
| { | |||
| session.ExecuteNonQuery(delDom); | |||
| session.Commit(); | |||
| } | |||
| return 1; | |||
| } | |||
| } | |||
| } | |||