StandardInterface/MES.Service/service/ZZCXDManager.cs
@@ -12,8 +12,20 @@
    {
        public bool SaveList(List<ERPZZCXD> list)
        {
            var result = list.Select(Save).ToList();
            return result.All(b => b);
            /*var result = list.Select(Save).ToList();
            return result.All(b => b);*/
            foreach (var item in list)
            {
                try
                {
                    Save(item);
                }
                catch (Exception ex)
                {
                    throw new Exception($"单据 {item.Main.bill_no} 出错: {ex.Message}", ex);
                }
            }
            return true;
        }
        public bool Save(ERPZZCXD data)
@@ -126,7 +138,7 @@
                            Memo = subDto.memo
                        };
                        var existingSub = Db.Queryable<ZZCXB>().Where(s => s.Eid == subEntity.Eid).Single();
                        var existingSub = Db.Queryable<ZZCXB>().Where(s => s.Erpid == subEntity.Erpid).Single();
                        if (existingSub != null) subEntity.Id = existingSub.Id;
                        item.SubItems ??= new List<ZZCXB>();
@@ -152,9 +164,13 @@
            if (head.Id != null)
                base.DeleteById(head.Id);
            // 删除孙表
            db.Deleteable<ZZCXB>().Where(d => d.YdId == head.Erpid).ExecuteCommand();
            // 删除子表(使用 yd_id 作为关联)
            db.Deleteable<ZZCXA>().Where(d => d.YdId == head.Erpid).ExecuteCommand();
            db.Deleteable<ZZCXB>().Where(d => d.Erpid == head.Erpid).ExecuteCommand();
            // 删除主表
            db.Deleteable<ZZCX>().Where(d => d.Erpid == head.Erpid).ExecuteCommand();
            var insertedHead = db.Insertable(head)
                .IgnoreColumns(true)
                .ExecuteReturnIdentity();