| | |
| | | using SqlSugar; |
| | | |
| | | namespace MES.Service.service.BasicData; |
| | | |
| | | /// <summary> |
| | | /// 仓库信息 |
| | | /// </summary> |
| | | public class MesDepotsManager : Repository<MesDepots> |
| | | { |
| | | // Save 方法用于保存单个仓库记录,根据类型执行不同的操作 |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 同步物料信息new_0/4 |
| | | /// 同步仓库信息new_0/4 |
| | | /// </summary> |
| | | /// <param name="db"></param> |
| | | /// <param name="entity"></param> |
| | |
| | | Depottype = depots.FStockProperty, |
| | | IsNg = depots.FForbidStatus, |
| | | Zuid = depots.FGroup, |
| | | FSubsidiary = depots.FUseOrgId, |
| | | Fumbrella = depots.FCreateOrgId, |
| | | //FSubsidiary = depots.FUseOrgId, |
| | | //Fumbrella = depots.FCreateOrgId, |
| | | // 如果存在,使用现有的CreateDate,后续将删除后重新插入 |
| | | // 如果不存在,设为当前时间 |
| | | CreateDate = existingCustomer?.CreateDate ?? DateTime.Now, |
| | |
| | | factory_name = depots.factory_name, |
| | | Remark4 = depots.remark4, |
| | | Remark5 = depots.remark5, |
| | | FSubsidiary = string.IsNullOrEmpty(depots.FUseOrgId) ? "1" : depots.FUseOrgId, |
| | | Fumbrella = string.IsNullOrEmpty(depots.FCreateOrgId) ? "1" : depots.FCreateOrgId, |
| | | }; |
| | | // ERP: 0=未禁用, 1=禁用 |
| | | // MES: A=未禁用, B=禁用 |
| | |
| | | } |
| | | |
| | | // 批量更新仓库状态的方法 |
| | | private bool UpdateDepotStatusBatch(SqlSugarScope db, |
| | | List<MesDepots> depotList, string status) |
| | | private bool UpdateDepotStatusBatch(SqlSugarScope db,List<MesDepots> depotList, string status) |
| | | { |
| | | var ids = depotList.Select(it => it.DepotId).ToArray(); |
| | | var result = db.Updateable<MesDepots>() |
| | |
| | | } |
| | | |
| | | // 批量插入仓库的方法 |
| | | private bool InsertDepotBatch(SqlSugarScope db, |
| | | List<MesDepots> depotList) |
| | | private bool InsertDepotBatch(SqlSugarScope db,List<MesDepots> depotList) |
| | | { |
| | | var insertRange = db.Insertable(depotList).ExecuteCommand(); |
| | | if (insertRange > 0) |
| | |
| | | } |
| | | |
| | | // 批量插入或更新仓库的方法 |
| | | private bool InsertOrUpdateBatch(SqlSugarScope db, |
| | | List<MesDepots> depotList) |
| | | private bool InsertOrUpdateBatch(SqlSugarScope db,List<MesDepots> depotList) |
| | | { |
| | | return depotList.All(entity => InsertOrUpdate(db, entity)); |
| | | } |