diff --git a/WCS.BLL/DbModels/STZL/LocationInfo.cs b/WCS.BLL/DbModels/STZL/LocationInfo.cs
index 00596da..38dad89 100644
--- a/WCS.BLL/DbModels/STZL/LocationInfo.cs
+++ b/WCS.BLL/DbModels/STZL/LocationInfo.cs
@@ -58,6 +58,12 @@ namespace WCS.DAL.DbModels
[SugarColumn(ColumnName = "modify_time", IsNullable = false, ColumnDescription = "更新时间")]
public DateTime ModifyTime { get; set; } = DateTime.Now;
+ ///
+ /// 当前位置的状态
+ ///
+ [SugarColumn(ColumnName = "location_status", IsNullable = false, DefaultValue = "0", ColumnDescription = "当前位置的状态")]
+ public LocationStatusEnum LocationStatus { get; set; } = LocationStatusEnum.空闲;
+
///
/// 是否启用
///
@@ -88,4 +94,16 @@ namespace WCS.DAL.DbModels
[SugarColumn(IsIgnore = true)]
public bool IsSelected { get; set; }
}
+
+
+ ///
+ /// 货架运输状态
+ ///
+ public enum LocationStatusEnum
+ {
+ 空闲 = 0,//位置上既没有货架 也没有送货架过来的任务
+ 待占用 = 1,//位置上无货架 但是有送货架过来的任务
+ 占用 = 2,//位置上有货架
+ 待空闲 = 3,//位置上有货架 但是此货架已有送走的任务
+ }
}
diff --git a/WCS.BLL/DbModels/STZL/MatDetailCurrentInfo.cs b/WCS.BLL/DbModels/STZL/MatDetailCurrentInfo.cs
index bcff7d9..452ca3a 100644
--- a/WCS.BLL/DbModels/STZL/MatDetailCurrentInfo.cs
+++ b/WCS.BLL/DbModels/STZL/MatDetailCurrentInfo.cs
@@ -90,6 +90,18 @@ namespace WCS.BLL.DbModels
#endregion
#region 单据属性
+ ///
+ /// 单据类型Id
+ ///
+ [SugarColumn(ColumnName = "order_type_id", IsNullable = true, ColumnDescription = "单据类型Id")]
+ public int OrderTypeId { get; set; }
+
+ ///
+ /// 单据类型名称
+ ///
+ [SugarColumn(ColumnName = "order_Type_name", Length = 64, IsNullable = true, ColumnDescription = "单据类型名称")]
+ public string OrderTypeName { get; set; }
+
///
/// 单据编号
///
diff --git a/WCS.BLL/Services/IService/IBatchBindMatDetailService.cs b/WCS.BLL/Services/IService/IBatchBindMatDetailService.cs
new file mode 100644
index 0000000..9361f42
--- /dev/null
+++ b/WCS.BLL/Services/IService/IBatchBindMatDetailService.cs
@@ -0,0 +1,34 @@
+using WCS.Model;
+using WCS.DAL.DbModels;
+using WCS.Model.ApiModel.StoreInfo;
+using WCS.BLL.DbModels;
+using WCS.Model.ApiModel.MatBaseInfo;
+using WCS.Model.ApiModel.MatDetailCurrentInfo;
+using WCS.Model.ApiModel.BatchBindMatDetail;
+
+namespace WCS.BLL.Services.IService
+{
+ public interface IBatchBindMatDetailService
+ {
+ ///
+ /// 查询货架存量列表
+ ///
+ ///
+ ///
+ public Task> GetMatDetailCurrentInfosByStationCode(GetMatDetailCurrentInfosByStationCodeRequest request);
+
+ ///
+ /// 更新货架存量
+ ///
+ ///
+ ///
+ public Task> updateMatDetailCurrentInfo(AddLocaionInfoRequest request);
+
+ ///
+ /// 删除货架存量数据
+ ///
+ ///
+ ///
+ public Task> deleteMatDetailCurrentInfo(DeleteInfosRequest request);
+ }
+}
diff --git a/WCS.BLL/Services/Service/BatchBindMatDetailService.cs b/WCS.BLL/Services/Service/BatchBindMatDetailService.cs
new file mode 100644
index 0000000..943d0b9
--- /dev/null
+++ b/WCS.BLL/Services/Service/BatchBindMatDetailService.cs
@@ -0,0 +1,188 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using TouchSocket.Core;
+using WCS.BLL.Config;
+using WCS.BLL.DbModels;
+using WCS.BLL.HardWare;
+using WCS.BLL.Manager;
+using WCS.BLL.Services.IService;
+using WCS.DAL;
+using WCS.DAL.Db;
+using WCS.DAL.DbModels;
+using WCS.Model;
+using WCS.Model.ApiModel;
+using WCS.Model.ApiModel.BatchBindMatDetail;
+using WCS.Model.ApiModel.InOutRecord;
+using WCS.Model.ApiModel.MatBaseInfo;
+using WCS.Model.ApiModel.MatDetailCurrentInfo;
+using WCS.Model.ApiModel.StoreInfo;
+using WCS.Model.ApiModel.User;
+
+namespace WCS.BLL.Services.Service
+{
+ public class BatchBindMatDetailService : IBatchBindMatDetailService
+ {
+
+ public async Task> GetMatDetailCurrentInfosByStationCode(GetMatDetailCurrentInfosByStationCodeRequest request)
+ {
+ try
+ {
+ var recordsQueryable = DbHelp.db.Queryable()
+ .LeftJoin((mci, si) => mci.ShlefId == si.Id)
+ .LeftJoin((mci, si, li) => (si.TransStatus == TransStatusEnum.静止 && si.CurrentLocationId == li.Id)
+ || (si.TransStatus == TransStatusEnum.运输中 && si.DestinationLocationId == li.Id))
+ .WhereIF(request.OrderTypeId != null && request.OrderTypeId != 0, (mci, si, li) => mci.OrderTypeId == request.OrderTypeId)
+ .WhereIF(!string.IsNullOrEmpty(request.ShelfCode), (mci, si, li) => si.ShelfCode.Contains(request.ShelfCode))
+ //.WhereIF(!string.IsNullOrEmpty(request.StationCode), (mci, si, li) => mci.StationCode.Contains(request.StationCode))
+ .Select((mci, si, li) => new MatDetailCurrentInfoModel()
+ {
+ Id = mci.Id,
+ ShlefId = mci.ShlefId,
+ ShelfCode = mci.ShelfCode,
+ ShelfType = mci.ShelfType,
+
+ LocationArea = li.LocationArea,
+ LocationCode = li.LocationCode,
+
+ MatCode = mci.MatCode,
+ MatName = mci.MatName,
+ MatSpec = mci.MatSpec,
+ MatUnit = mci.MatUnit,
+ MatCustomer = mci.MatCustomer,
+ MatQty = mci.MatQty,
+ MatSupplier = mci.MatSupplier,
+
+ OrderTypeId = mci.OrderTypeId,
+ OrderTypeName = mci.OrderTypeName,
+ OrderNumber = mci.OrderNumber,
+
+ StationCode = mci.StationCode,
+ ModifyUser = mci.ModifyUser,
+ ModifyTime = mci.ModifyTime
+ });
+
+ //分页
+ var totalCount = await recordsQueryable.CountAsync();
+ var records = await recordsQueryable
+ .OrderByDescending(mci => mci.Id)
+ .Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize)
+ .ToListAsync();
+ //生成序号
+ for (int i = 0; i < records.Count; i++)
+ {
+ records[i].RowNumber = (request.PageNumber - 1) * request.PageSize + i + 1;
+ }
+ return new PageQueryResponse()
+ {
+ Code = 200,
+ Message = $"success",
+ Data = new PageQueryResponseData()
+ {
+ TotalCount = totalCount,
+ MaxPage = request.PageSize == 0 ? 0 : (int)Math.Ceiling((decimal)totalCount / request.PageSize),
+ Count = records.Count,
+ Lists = records.ToList()
+ }
+ };
+ }
+ catch (Exception ex)
+ {
+ return new PageQueryResponse()
+ {
+ Code = 300,
+ Message = $"操作失败:{ex.Message}",
+ };
+ }
+ }
+
+ public async Task> updateMatDetailCurrentInfo(AddLocaionInfoRequest request)
+ {
+ try
+ {
+ var matDetailCurrentInfo = await DbHelp.db.Queryable() //.Where(t => t.MatDetailCurrentCode == request.MatDetailCurrentInfo.MatDetailCurrentCode)
+ .Where(t => t.Id == request.LocationInfo.Id)
+ .FirstAsync();
+ if (matDetailCurrentInfo == null)
+ {
+ return new ResponseCommon