|
|
@ -64,11 +64,55 @@ namespace BWP.B3ClientService.Rpcs.BillRpc |
|
|
return serializer.Serialize(list); |
|
|
return serializer.Serialize(list); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static long DeleteDetail(GradeAndWeight_Detail entity) |
|
|
|
|
|
{ |
|
|
|
|
|
using (var session = Dmo.NewSession()) |
|
|
|
|
|
{ |
|
|
|
|
|
if(entity.ID>0) |
|
|
|
|
|
{ |
|
|
|
|
|
session.Delete(new DmoIdentity(typeof(GradeAndWeight_Detail), entity.ID)); |
|
|
|
|
|
if (entity.OrderDetail_ID.HasValue) |
|
|
|
|
|
{ |
|
|
|
|
|
SubAlready(session, entity.OrderDetail_ID.Value, entity.Technics); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
session.Commit(); |
|
|
|
|
|
return entity.ID; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void SubAlready(IDmoSession session, long orderDetailID, short technics) |
|
|
|
|
|
{ |
|
|
|
|
|
var entity = GetRelate(orderDetailID, technics); |
|
|
|
|
|
if (entity != null) |
|
|
|
|
|
{ |
|
|
|
|
|
entity.Already -= 1; |
|
|
|
|
|
session.Update(entity); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Rpc] |
|
|
[Rpc] |
|
|
public static long UpdateOrInsertDetail(string json) |
|
|
|
|
|
|
|
|
public static long UpdateOrInsertDetailOrDelete(string json) |
|
|
{ |
|
|
{ |
|
|
json = json.ESerializeDateTime(); |
|
|
json = json.ESerializeDateTime(); |
|
|
var entity = serializer.Deserialize<GradeAndWeight_Detail>(json); |
|
|
var entity = serializer.Deserialize<GradeAndWeight_Detail>(json); |
|
|
|
|
|
if (entity.IsDeleted) |
|
|
|
|
|
{ |
|
|
|
|
|
return DeleteDetail(entity); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
return UpdateOrInsertDetail(entity); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static long UpdateOrInsertDetail(GradeAndWeight_Detail entity) |
|
|
|
|
|
{ |
|
|
using (var session = Dmo.NewSession()) |
|
|
using (var session = Dmo.NewSession()) |
|
|
{ |
|
|
{ |
|
|
if (entity.ID == 0) |
|
|
if (entity.ID == 0) |
|
|
|