StandardPda/MES.Service/Dto/webApi/ErpCustomer.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
StandardPda/MES.Service/Dto/webApi/ErpDetail.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
StandardPda/MES.Service/Dto/webApi/ErpSupplier.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
StandardPda/MES.Service/service/BasicData/MesCustomerManager.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
StandardPda/MES.Service/service/BasicData/MesRohInManager.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
StandardPda/MES.Service/service/BasicData/MesSupplierManager.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
StandardPda/MES.Service/service/BasicData/SalesReturnNoticeManager.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
StandardPda/MES.Service/Dto/webApi/ErpCustomer.cs
@@ -14,11 +14,4 @@ public string? FForbidStatus { get; set; } public List<ErpDetail>? ErpDetails { get; set; } } public class ErpDetail { public string? FUseOrgId { get; set; } } StandardPda/MES.Service/Dto/webApi/ErpDetail.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,6 @@ namespace MES.Service.Dto.webApi; public class ErpDetail { public string? FUseOrgId { get; set; } } StandardPda/MES.Service/Dto/webApi/ErpSupplier.cs
@@ -26,7 +26,7 @@ // public string? FCreateOrgId { get; set; } //ç¨åç¹æ®ç¹ public string[]? FUseOrgId { get; set; } public List<ErpDetail>? FUseOrgId { get; set; } //public string? FDescription { get; set; } // public string? fremarks { get; set; } public string? PrivateDescSeg { get; set; } StandardPda/MES.Service/service/BasicData/MesCustomerManager.cs
@@ -134,8 +134,6 @@ //var id = db.Insertable(insertObj).ExecuteReturnIdentity(); //æ ¹æ®åºåè·åæ°çMES_ID List<MesCustomer> customers = new List<MesCustomer>(); foreach (ErpDetail erpDetail in customer.ErpDetails) @@ -181,9 +179,6 @@ customers.Add(mesCustomer); } //customers = customer.ErpDetails.Select(ErpDetails => new MesCustomer //{ StandardPda/MES.Service/service/BasicData/MesRohInManager.cs
@@ -32,50 +32,6 @@ }) > 0; } // æå ¥æ°æ®çæ¹æ³ private bool InsertData(SqlSugarScope db, MesRohIn mesRohIn, List<MesRohInData> mesRohInDatas, string FBILLTYPE) { switch (FBILLTYPE) { case "A": { var decimals = mesRohInDatas.Select(s => s.Id).ToArray(); if (mesRohIn.Id != null) base.DeleteById(mesRohIn.Id); if (decimals.Length > 0) db.Deleteable<MesRohInData>().In(decimals).ExecuteCommand(); var insert = base.Insert(mesRohIn); var insertRange = rohInDataManager.InsertRange(mesRohInDatas); if (insert && insertRange) return true; throw new NotImplementedException("æå ¥å¤±è´¥"); } case "B": { var decimals = mesRohInDatas.Select(s => s.Id).ToArray(); if (base.DeleteById(mesRohIn.Id) && db .Deleteable<MesRohInData>().In(decimals) .ExecuteCommand() > 0) { var insert = base.Insert(mesRohIn); var insertRange = rohInDataManager.InsertRange(mesRohInDatas); if (insert && insertRange) return true; throw new NotImplementedException("æå ¥å¤±è´¥"); } break; } } throw new NotImplementedException("éè´è®¢åç±»åé误"); } // æ´æ°æ°æ®çæ¹æ³ private bool UpdateData(SqlSugarScope db, MesRohIn mesRohIn, List<MesRohInData> mesRohInDatas) StandardPda/MES.Service/service/BasicData/MesSupplierManager.cs
@@ -16,15 +16,15 @@ switch (unit.Type) { case "0": if (UpdateSupplierStatus(db, entity.Id, "A")) if (UpdateSupplierStatus(db, entity, "A")) return 1; break; case "1": if (UpdateSupplierStatus(db, entity.Id, "B")) if (UpdateSupplierStatus(db, entity, "B")) return 1; break; case "3": if (DeleteSupplier(entity.Id)) if (DeleteSupplier(entity)) return 1; break; case "2": @@ -43,50 +43,19 @@ public bool SaveList(List<ErpSupplier> suppliers) { var list = suppliers.Select(GetMesSupplier).ToList(); var groupBy = list.GroupBy(s => s.Type) .ToDictionary(g => g.Key, g => g.ToList()); return UseTransaction(db => { foreach (var supplierGroup in groupBy) switch (supplierGroup.Key) { case "0": if (!UpdateSupplierStatusBatch(db, supplierGroup.Value, "A")) throw new NotImplementedException("å¯ç¨å¤±è´¥"); break; case "1": if (!UpdateSupplierStatusBatch(db, supplierGroup.Value, "B")) throw new NotImplementedException("ç¦ç¨å¤±è´¥"); break; case "3": if (!DeleteSupplierBatch(db, supplierGroup.Value)) throw new NotImplementedException("å é¤å¤±è´¥"); break; case "2": case "4": if (!InsertOrUpdateBatch(db, supplierGroup.Value)) throw new NotImplementedException("åæ¥å¤±è´¥"); break; default: throw new ArgumentNullException( $"type没æ{supplierGroup.Key}è¿ä¸ªç±»åçåæ°"); var result = suppliers.Select(Save).ToList(); return result.All(b => b); } return 1; }) > 0; } private bool UpdateSupplierStatus(SqlSugarScope db, decimal supplierId, private bool UpdateSupplierStatus(SqlSugarScope db, List<MesSupplier> supplierId, string status) { var ids = supplierId.Select(it => it.Id).ToArray(); var result = db.Updateable<MesSupplier>() .SetColumns(s => s.Fforbidstatus == status) .Where(s => s.Id == supplierId).ExecuteCommand(); .Where(s => ids.Contains(s.Id)).ExecuteCommand(); if (result > 0) return true; @@ -94,27 +63,54 @@ throw new NotImplementedException(status == "A" ? "å¯ç¨å¤±è´¥" : "ç¦ç¨å¤±è´¥"); } private bool InsertSupplier(SqlSugarScope db, MesSupplier entity) private bool DeleteSupplier(List<MesSupplier> supplierId) { var insert = db.Insertable(entity).ExecuteCommand(); if (insert > 0) return true; var ids = supplierId.Select(it => it.Id).ToArray(); throw new NotImplementedException("æå ¥å¤±è´¥"); } var executeCommand = Db.Deleteable<MesSupplier>() .Where(s => ids.Contains(s.Id)).ExecuteCommand(); private bool DeleteSupplier(decimal supplierId) { if (base.DeleteById(supplierId)) return true; if (executeCommand > 0) return true; throw new NotImplementedException("å é¤å¤±è´¥"); } private MesSupplier GetMesSupplier(ErpSupplier supplier) private List<MesSupplier> GetMesSupplier(ErpSupplier supplier) { return new MesSupplier List<MesSupplier> list = new List<MesSupplier>(); foreach (var se in supplier.FUseOrgId) { Id = Convert.ToDecimal(supplier.Id), var exists = Db.Queryable<MesLinkU9>().Any(u => u.U9Id == supplier.Id && u.OrgId == se.FUseOrgId && u.TableType == "MES_SUPPLIER"); decimal mesId = 0; if (exists) { //è·åmesid mesId = Convert.ToDecimal(Db.Queryable<MesLinkU9>() .Where(u => u.U9Id == supplier.Id && u.OrgId == se.FUseOrgId && u.TableType == "MES_SUPPLIER") .Select(u => u.MesId) // éæ© MesId åæ®µ .First()); } else { var entity = new MesLinkU9 { CreateDate = DateTime.Now, MesId = mesId.ToString(), U9Id = supplier.Id, OrgId = se.FUseOrgId, TableType = "MES_SUPPLIER" }; mesId = Db.Insertable(entity).ExecuteReturnIdentity(); } var mesSupplier = new MesSupplier { Id = mesId, SuppNo = supplier.FNumber, SuppSname = supplier.FShortName, SuppName = supplier.FName, @@ -136,47 +132,17 @@ Fforbidstatus = supplier.FForbidStatus, CreateDate = DateTime.Now, //CreateOrg= Convert.ToDecimal(supplier.FCreateOrgId), //UseOrg = supplier.FUseOrgId, UseOrg = se.FUseOrgId, //Remark=supplier.fremarks, PrivateDescSeg = supplier.PrivateDescSeg, Company = "1000", Factory = "1000" }; list.Add(mesSupplier); } private bool UpdateSupplierStatusBatch(SqlSugarScope db, List<MesSupplier> supplierList, string status) { var ids = supplierList.Select(it => it.Id).ToArray(); var result = db.Updateable<MesSupplier>() .SetColumns(s => s.Fforbidstatus == status) .Where(s => ids.Contains(s.Id)).ExecuteCommand(); if (result > 0) return true; throw new NotImplementedException(status == "A" ? "å¯ç¨å¤±è´¥" : "ç¦ç¨å¤±è´¥"); } private bool InsertSupplierBatch(SqlSugarScope db, List<MesSupplier> supplierList) { var insertRange = db.Insertable(supplierList).ExecuteCommand(); if (insertRange > 0) return true; throw new NotImplementedException("æå ¥å¤±è´¥"); } private bool DeleteSupplierBatch(SqlSugarScope db, List<MesSupplier> supplierList) { var ids = supplierList.Select(it => it.Id).ToArray(); var deleteByIds = db.Deleteable<MesSupplier>().In(ids).ExecuteCommand(); if (deleteByIds > 0) return true; throw new NotImplementedException("å é¤å¤±è´¥"); return list; } /// <summary> @@ -208,24 +174,20 @@ // return false; //} ///æ°ä»£ç private bool InsertOrUpdate(SqlSugarScope db, MesSupplier entity) private bool InsertOrUpdate(SqlSugarScope db, List<MesSupplier> entity) { db.Deleteable<MesSupplier>() .Where(s => s.Id == entity.Id) var ids = entity.Select(it => it.Id).ToArray(); var executeCommand = db.Deleteable<MesSupplier>() .Where(s => ids.Contains(s.Id)) .ExecuteCommand(); if (executeCommand > 0) { var insert = db.Insertable(entity).ExecuteCommand(); return insert > 0; } private bool InsertOrUpdateBatch(SqlSugarScope db, List<MesSupplier> supplierList) { foreach (var entity in supplierList) if (!InsertOrUpdate(db, entity)) return false; return true; throw new Exception("æä½å¤±è´¥"); } } StandardPda/MES.Service/service/BasicData/SalesReturnNoticeManager.cs
@@ -10,69 +10,4 @@ //è¿éé¢åç代ç ä¸ä¼ç»è¦ç,妿è¦éæ°çæè¯·å é¤ SalesReturnNoticeManager.cs #region æå¦æ¹æ³ /// <summary> /// ä»å¨æ¹æ³æ»¡è¶³ä¸äºå¤æä¸å¡éæ±ï¼ä¸å¡ä»£ç 请å¨è¿éé¢å®ä¹æ¹æ³ /// </summary> public void Study() { /*********æ¥è¯¢*********/ var data1 = base.GetById(1); //æ ¹æ®IDæ¥è¯¢ var data2 = base.GetList(); //æ¥è¯¢ææ var data3 = base.GetList(it => 1 == 1); //æ ¹æ®æ¡ä»¶æ¥è¯¢ //var data4 = base.GetSingle(it => 1 == 1);//æ ¹æ®æ¡ä»¶æ¥è¯¢ä¸æ¡,å¦æè¶ è¿ä¸æ¡ä¼æ¥é var p = new PageModel { PageIndex = 1, PageSize = 2 }; // å页æ¥è¯¢ var data5 = base.GetPageList(it => 1 == 1, p); Console.Write(p.TotalCount); //è¿åæ»æ° var data6 = base.GetPageList(it => 1 == 1, p, it => SqlFunc.GetRandom()); // å页æ¥è¯¢å æåº Console.Write(p.TotalCount); //è¿åæ»æ° var conModels = new List<IConditionalModel>(); //ç»è£ æ¡ä»¶æ¥è¯¢ä½ä¸ºæ¡ä»¶å®ç° å页æ¥è¯¢å æåº conModels.Add(new ConditionalModel { FieldName = typeof(SalesReturnNotice).GetProperties()[0].Name, ConditionalType = ConditionalType.Equal, FieldValue = "1" }); //id=1 var data7 = base.GetPageList(conModels, p, it => SqlFunc.GetRandom()); AsQueryable().Where(x => 1 == 1) .ToList(); //æ¯æäºè½¬æ¢æqueryable,æä»¬å¯ä»¥ç¨queryableå®ç°å¤æåè½ /*********æå ¥*********/ var insertData = new SalesReturnNotice(); //æµè¯åæ° var insertArray = new[] { insertData }; base.Insert(insertData); //æå ¥ base.InsertRange(insertArray); //æ¹éæå ¥ var id = base.InsertReturnIdentity(insertData); //æå ¥è¿åèªå¢å AsInsertable(insertData).ExecuteCommand(); //æä»¬å¯ä»¥è½¬æ Insertableå®ç°å¤ææå ¥ /*********æ´æ°*********/ var updateData = new SalesReturnNotice(); //æµè¯åæ° var updateArray = new[] { updateData }; //æµè¯åæ° base.Update(updateData); //æ ¹æ®å®ä½æ´æ° base.UpdateRange(updateArray); //æ¹éæ´æ° //base.Update(it => new SalesReturnNotice() { ClassName = "a", CreateTime = DateTime.Now }, it => it.id==1);// åªæ´æ°ClassNameååCreateTimeåï¼å ¶å®å䏿´æ°ï¼æ¡ä»¶id=1 AsUpdateable(updateData).ExecuteCommand(); //转æUpdateableå¯ä»¥å®ç°å¤æçæå ¥ /*********å é¤*********/ var deldata = new SalesReturnNotice(); //æµè¯åæ° base.Delete(deldata); //æ ¹æ®å®ä½å é¤ base.DeleteById(1); //æ ¹æ®ä¸»é®å é¤ base.DeleteById(new[] { 1, 2 }); //æ ¹æ®ä¸»é®æ°ç»å é¤ base.Delete(it => 1 == 2); //æ ¹æ®æ¡ä»¶å é¤ AsDeleteable().Where(it => 1 == 2) .ExecuteCommand(); //转æDeleteableå®ç°å¤æçæä½ } #endregion }