物料绑定(客户端)
This commit is contained in:
@ -58,6 +58,12 @@ namespace WCS.DAL.DbModels
|
||||
[SugarColumn(ColumnName = "modify_time", IsNullable = false, ColumnDescription = "更新时间")]
|
||||
public DateTime ModifyTime { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 当前位置的状态
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "location_status", IsNullable = false, DefaultValue = "0", ColumnDescription = "当前位置的状态")]
|
||||
public LocationStatusEnum LocationStatus { get; set; } = LocationStatusEnum.空闲;
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
@ -88,4 +94,16 @@ namespace WCS.DAL.DbModels
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public bool IsSelected { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 货架运输状态
|
||||
/// </summary>
|
||||
public enum LocationStatusEnum
|
||||
{
|
||||
空闲 = 0,//位置上既没有货架 也没有送货架过来的任务
|
||||
待占用 = 1,//位置上无货架 但是有送货架过来的任务
|
||||
占用 = 2,//位置上有货架
|
||||
待空闲 = 3,//位置上有货架 但是此货架已有送走的任务
|
||||
}
|
||||
}
|
||||
|
@ -90,6 +90,18 @@ namespace WCS.BLL.DbModels
|
||||
#endregion
|
||||
|
||||
#region 单据属性
|
||||
/// <summary>
|
||||
/// 单据类型Id
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "order_type_id", IsNullable = true, ColumnDescription = "单据类型Id")]
|
||||
public int OrderTypeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单据类型名称
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "order_Type_name", Length = 64, IsNullable = true, ColumnDescription = "单据类型名称")]
|
||||
public string OrderTypeName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单据编号
|
||||
/// </summary>
|
||||
|
34
WCS.BLL/Services/IService/IBatchBindMatDetailService.cs
Normal file
34
WCS.BLL/Services/IService/IBatchBindMatDetailService.cs
Normal file
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询货架存量列表
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public Task<PageQueryResponse<MatDetailCurrentInfoModel>> GetMatDetailCurrentInfosByStationCode(GetMatDetailCurrentInfosByStationCodeRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// 更新货架存量
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public Task<ResponseCommon<object>> updateMatDetailCurrentInfo(AddLocaionInfoRequest<MatDetailCurrentInfo> request);
|
||||
|
||||
/// <summary>
|
||||
/// 删除货架存量数据
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public Task<ResponseCommon<object>> deleteMatDetailCurrentInfo(DeleteInfosRequest request);
|
||||
}
|
||||
}
|
188
WCS.BLL/Services/Service/BatchBindMatDetailService.cs
Normal file
188
WCS.BLL/Services/Service/BatchBindMatDetailService.cs
Normal file
@ -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<PageQueryResponse<MatDetailCurrentInfoModel>> GetMatDetailCurrentInfosByStationCode(GetMatDetailCurrentInfosByStationCodeRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
var recordsQueryable = DbHelp.db.Queryable<MatDetailCurrentInfo>()
|
||||
.LeftJoin<ShelfInfo>((mci, si) => mci.ShlefId == si.Id)
|
||||
.LeftJoin<LocationInfo>((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<MatDetailCurrentInfoModel>()
|
||||
{
|
||||
Code = 200,
|
||||
Message = $"success",
|
||||
Data = new PageQueryResponseData<MatDetailCurrentInfoModel>()
|
||||
{
|
||||
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<MatDetailCurrentInfoModel>()
|
||||
{
|
||||
Code = 300,
|
||||
Message = $"操作失败:{ex.Message}",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ResponseCommon<object>> updateMatDetailCurrentInfo(AddLocaionInfoRequest<MatDetailCurrentInfo> request)
|
||||
{
|
||||
try
|
||||
{
|
||||
var matDetailCurrentInfo = await DbHelp.db.Queryable<MatDetailCurrentInfo>() //.Where(t => t.MatDetailCurrentCode == request.MatDetailCurrentInfo.MatDetailCurrentCode)
|
||||
.Where(t => t.Id == request.LocationInfo.Id)
|
||||
.FirstAsync();
|
||||
if (matDetailCurrentInfo == null)
|
||||
{
|
||||
return new ResponseCommon<Object>
|
||||
{
|
||||
Code = 205,
|
||||
Message = $"更新位置信息失败:此条数据不存在,请确认!",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
|
||||
matDetailCurrentInfo.MatQty = request.LocationInfo.MatQty;
|
||||
matDetailCurrentInfo.ModifyUser = request.UserName;
|
||||
matDetailCurrentInfo.ModifyTime = DateTime.Now;
|
||||
|
||||
var rowNum = await DbHelp.db.Updateable(matDetailCurrentInfo).ExecuteCommandAsync();
|
||||
if (rowNum == 0)
|
||||
{
|
||||
return new ResponseCommon<Object>
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"更新货架存量信息失败:请重试!",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ResponseCommon<Object>
|
||||
{
|
||||
Code = 200,
|
||||
Message = $"更新货架存量信息成功!",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var response = new ResponseCommon<Object>
|
||||
{
|
||||
Code = 300,
|
||||
Message = $"操作失败:{ex.Message}",
|
||||
Data = null
|
||||
};
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ResponseCommon<object>> deleteMatDetailCurrentInfo(DeleteInfosRequest request)
|
||||
{
|
||||
//先查询出具体的Id
|
||||
var MatDetailCurrentInfos = await DbHelp.db.Queryable<MatDetailCurrentInfo>()
|
||||
.Where(t => request.needDeleteIds.Contains(t.Id))
|
||||
.ToListAsync();
|
||||
//执行删除
|
||||
try
|
||||
{
|
||||
var deleteRows = await DbHelp.db.Deleteable(MatDetailCurrentInfos).ExecuteCommandAsync();
|
||||
return new ResponseCommon<Object>
|
||||
{
|
||||
Code = 200,
|
||||
Message = $"已删除{deleteRows}条数据!",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var response = new ResponseCommon<Object>
|
||||
{
|
||||
Code = 300,
|
||||
Message = $"操作失败:{ex.Message}",
|
||||
Data = null
|
||||
};
|
||||
return response;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WCS.Model.ApiModel.BatchBindMatDetail
|
||||
{
|
||||
public class GetMatDetailCurrentInfosByStationCodeRequest : PageQueryRequestBase
|
||||
{
|
||||
public int? OrderTypeId { get; set; }
|
||||
public string OrderNumber { get; set; }
|
||||
public string ShelfCode { get; set; }
|
||||
public string StationCode { get; set; }
|
||||
}
|
||||
}
|
@ -37,8 +37,17 @@ namespace WCS.Model.ApiModel.MatDetailCurrentInfo
|
||||
public int MatQty { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 批量绑定相关
|
||||
//当前位置编码
|
||||
public string? StationCode { get; set; } = string.Empty;
|
||||
|
||||
public int? OrderTypeId { get; set; }
|
||||
|
||||
public string OrderTypeName { get; set; } = string.Empty;
|
||||
|
||||
public string OrderNumber { get; set; } = string.Empty;
|
||||
#endregion
|
||||
|
||||
public string? ModifyUser { get; set; } = string.Empty;
|
||||
|
||||
public DateTime? ModifyTime { get; set; } = DateTime.Now;
|
||||
|
@ -5,6 +5,7 @@ using WCS.DAL.Db;
|
||||
using WCS.DAL.DbModels;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel;
|
||||
using WCS.Model.ApiModel.BatchBindMatDetail;
|
||||
using WCS.Model.ApiModel.Home;
|
||||
using WCS.Model.ApiModel.PDAMatBind;
|
||||
using WCS.Model.ApiModel.User;
|
||||
@ -19,11 +20,11 @@ namespace WCS.WebApi.Controllers
|
||||
[Route("[controller]")]
|
||||
public class BatchBindMatDetailController : ControllerBase
|
||||
{
|
||||
public IWarningService _warningService { get; set; }
|
||||
public IBatchBindMatDetailService _batchBindMatDetailService { get; set; }
|
||||
|
||||
public BatchBindMatDetailController(IWarningService warningService)
|
||||
public BatchBindMatDetailController(IBatchBindMatDetailService batchBindMatDetailService)
|
||||
{
|
||||
_warningService = warningService;
|
||||
_batchBindMatDetailService = batchBindMatDetailService;
|
||||
}
|
||||
|
||||
[Route("getOrderTypes")]
|
||||
@ -62,206 +63,37 @@ namespace WCS.WebApi.Controllers
|
||||
}
|
||||
|
||||
|
||||
[Route("getShelfInfoByLocationCode1")]
|
||||
[HttpPost(Name = "getShelfInfoByLocationCode1")]
|
||||
public async Task<ResponseBase> getShelfInfoByLocationCode(GetShelfInfoByLocationCodeRequest request)
|
||||
[Route("getMatDetailCurrentInfosByStationCode")]
|
||||
[HttpPost(Name = "getMatDetailCurrentInfosByStationCode")]
|
||||
public async Task<ResponseBase> GetMatDetailCurrentInfosByStationCode(GetMatDetailCurrentInfosByStationCodeRequest request)
|
||||
{
|
||||
//判断参数
|
||||
if (string.IsNullOrEmpty(request.LocationCode))
|
||||
if (string.IsNullOrEmpty(request.StationCode))
|
||||
{
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 201,
|
||||
Message = "工位编码为空!",
|
||||
Message = "工位编码为空,请联系相关人员进行配置!",
|
||||
Data = null,
|
||||
};
|
||||
}
|
||||
|
||||
//获取是否存在当前工位
|
||||
var location = await DbHelp.db.Queryable<LocationInfo>()
|
||||
.Where(t => t.LocationCode == request.LocationCode)
|
||||
.Where(t => t.IsEnable == true)
|
||||
.FirstAsync();
|
||||
if (location == null)
|
||||
//判断工位是否存在
|
||||
var isExsistLocation = await DbHelp.db.Queryable<LocationInfo>()
|
||||
.Where(t => t.LocationCode == request.StationCode)
|
||||
.AnyAsync();
|
||||
//不存在工位
|
||||
if (!isExsistLocation)
|
||||
{
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"工位[{request.LocationCode}]不存在或已被禁用!\r\n请联系系统管理人员维护工位信息!",
|
||||
Message = $"工位[{request.StationCode}]不存在,暂时无法使用此功能!",
|
||||
Data = null,
|
||||
};
|
||||
}
|
||||
|
||||
//获取当前工位的货架
|
||||
var shelf = await DbHelp.db.Queryable<ShelfInfo>()
|
||||
.Where(t => t.CurrentLocationId == location.Id && t.TransStatus == TransStatusEnum.静止
|
||||
|| t.DestinationLocationId == location.Id && t.TransStatus == TransStatusEnum.运输中)//解决产线人员 呼叫后货架未到的时候绑定的问题
|
||||
.Where(t => t.IsEnable)
|
||||
.FirstAsync();
|
||||
|
||||
return new ResponseBase<GetShelfInfoByLocationReturnData>()
|
||||
{
|
||||
Code = 200,
|
||||
Message = $"success",
|
||||
Data = new GetShelfInfoByLocationReturnData()
|
||||
{
|
||||
LocationId = location.Id,
|
||||
LocationCode = request.LocationCode,
|
||||
ShelfId = shelf?.Id,
|
||||
ShelfCode = shelf?.ShelfCode,
|
||||
},
|
||||
};
|
||||
|
||||
return await _batchBindMatDetailService.GetMatDetailCurrentInfosByStationCode(request);
|
||||
}
|
||||
|
||||
//[Route("bindMatDetail")]
|
||||
//[HttpPost(Name = "bindMatDetail")]
|
||||
//public async Task<ResponseCommon> bindMatDetail(BindMatDetailRequest request)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// #region 参数校验
|
||||
// //判断参数
|
||||
// if (request.LocationId == 0 || string.IsNullOrEmpty(request.LocationCode))
|
||||
// {
|
||||
// return new ResponseCommon()
|
||||
// {
|
||||
// Code = 201,
|
||||
// Message = "工位或工位编码为空!",
|
||||
// Data = null,
|
||||
// };
|
||||
// }
|
||||
|
||||
// if (request.ShelfId == 0 || string.IsNullOrEmpty(request.ShelfCode))
|
||||
// {
|
||||
|
||||
// return new ResponseCommon()
|
||||
// {
|
||||
// Code = 201,
|
||||
// Message = "货架或货架编码为空!",
|
||||
// Data = null,
|
||||
// };
|
||||
// }
|
||||
|
||||
// if (request.MatBaseInfoId == 0 || string.IsNullOrEmpty(request.MatCode))
|
||||
// {
|
||||
// return new ResponseCommon()
|
||||
// {
|
||||
// Code = 201,
|
||||
// Message = "未选择物料!",
|
||||
// Data = null,
|
||||
// };
|
||||
// }
|
||||
|
||||
// if (request.Qty <= 0)
|
||||
// {
|
||||
// return new ResponseCommon()
|
||||
// {
|
||||
// Code = 201,
|
||||
// Message = "数量应大于等于1!",
|
||||
// Data = null,
|
||||
// };
|
||||
// }
|
||||
// #endregion
|
||||
|
||||
// #region 数据校验
|
||||
// //判断参数
|
||||
// if (string.IsNullOrEmpty(request.LocationCode))
|
||||
// {
|
||||
// return new ResponseCommon()
|
||||
// {
|
||||
// Code = 201,
|
||||
// Message = "工位编码为空!",
|
||||
// Data = null,
|
||||
// };
|
||||
// }
|
||||
|
||||
// //获取是否存在当前工位
|
||||
// var location = await DbHelp.db.Queryable<LocationInfo>()
|
||||
// .Where(t => t.Id == request.LocationId)
|
||||
// .Where(t => t.IsEnable == true)
|
||||
// .FirstAsync();
|
||||
// if (location == null)
|
||||
// {
|
||||
// return new ResponseCommon()
|
||||
// {
|
||||
// Code = 201,
|
||||
// Message = $"工位[{request.LocationCode}]不存在或已被禁用!\r\n请联系系统管理人员维护工位信息!",
|
||||
// Data = null,
|
||||
// };
|
||||
// }
|
||||
|
||||
// //获取当前工位的货架
|
||||
// var shelf = await DbHelp.db.Queryable<ShelfInfo>()
|
||||
// .Where(t => t.Id == request.ShelfId)
|
||||
// .Where(t => t.CurrentLocationId == location.Id && t.TransStatus == TransStatusEnum.静止
|
||||
// || t.DestinationLocationId == location.Id && t.TransStatus == TransStatusEnum.运输中)//解决产线人员 呼叫后货架未到的时候绑定的问题
|
||||
// .Where(t => t.IsEnable == true)
|
||||
// .FirstAsync();
|
||||
// if (shelf == null)
|
||||
// {
|
||||
// return new ResponseCommon()
|
||||
// {
|
||||
// Code = 205,
|
||||
// Message = $"货架[{request.ShelfCode}],已不在工位上!\r\n请进行【货架呼叫】!",
|
||||
// Data = null,
|
||||
// };
|
||||
// }
|
||||
|
||||
// //获取物料基础信息
|
||||
// var matBaseInfo = await DbHelp.db.Queryable<MatBaseInfo>()
|
||||
// .Where(t => t.Id == request.MatBaseInfoId)
|
||||
// .Where(t => t.IsEnable == true)
|
||||
// .FirstAsync();
|
||||
// if (matBaseInfo == null)
|
||||
// {
|
||||
// return new ResponseCommon()
|
||||
// {
|
||||
// Code = 201,
|
||||
// Message = $"不存在物料[{request.MatCode}]或已被禁用!",
|
||||
// Data = null,
|
||||
// };
|
||||
// }
|
||||
// #endregion
|
||||
|
||||
// //校验合格 进行保存
|
||||
// var matDetailCurrentInfo = new MatDetailCurrentInfo()
|
||||
// {
|
||||
// ShlefId = shelf.Id,
|
||||
// ShelfCode = shelf.ShelfCode,
|
||||
// ShelfType = shelf.ShelfTypeName,
|
||||
// //ShelfArea = shelf.ShelfArea,
|
||||
|
||||
// MatCode = matBaseInfo.MatCode,
|
||||
// MatName = matBaseInfo.MatName,
|
||||
// MatSupplier = matBaseInfo.MatSupplier,
|
||||
// MatCustomer = matBaseInfo.MatCustomer,
|
||||
// MatSpec = matBaseInfo.MatSpec,
|
||||
// MatUnit = matBaseInfo.MatUnit,
|
||||
// MatQty = request.Qty,
|
||||
|
||||
// ModifyUser = request.UserName,
|
||||
// };
|
||||
// DbHelp.db.Insertable(matDetailCurrentInfo).ExecuteCommand();
|
||||
|
||||
// return new ResponseCommon()
|
||||
// {
|
||||
// Code = 200,
|
||||
// Message = "success",
|
||||
// Data = null,
|
||||
// };
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// return new ResponseCommon()
|
||||
// {
|
||||
// Code = 201,
|
||||
// Message = ex.Message,
|
||||
// Data = null,
|
||||
// };
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -83,6 +83,7 @@ namespace WebApi
|
||||
builder.Services.AddScoped<IUploadService, UploadService>();
|
||||
builder.Services.AddScoped<ILocationInfoService, LocationInfoService>();
|
||||
builder.Services.AddScoped<IMatDetailCurrentInfoService,MatDetailCurrentInfoService>();
|
||||
builder.Services.AddScoped<IBatchBindMatDetailService, BatchBindMatDetailService>();
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>롢<EFBFBD><EBA1A2><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ģʽ
|
||||
builder.Services.AddSingleton<IGenerateService, GenerateService>();
|
||||
|
330
货架标准上位机/ViewModels/BatchBindMatDetailViewModel.cs
Normal file
330
货架标准上位机/ViewModels/BatchBindMatDetailViewModel.cs
Normal file
@ -0,0 +1,330 @@
|
||||
using HandyControl.Controls;
|
||||
using MiniExcelLibs;
|
||||
using Ping9719.WpfEx.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using 智慧物流软件系统.Views.Controls;
|
||||
using 智慧物流软件系统.Api;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel.Home;
|
||||
using WCS.Model.ApiModel.StoreInfo;
|
||||
using WCS.BLL.DbModels;
|
||||
using WCS.Model.ApiModel.MatBaseInfo;
|
||||
using WCS.Model.ApiModel.User;
|
||||
using WCS.Model.ApiModel;
|
||||
using Newtonsoft.Json.Bson;
|
||||
using WCS.Model.ApiModel.LocationInfo;
|
||||
using WCS.Model.ApiModel.MatDetailCurrentInfo;
|
||||
using WCS.Model.ApiModel.BatchBindMatDetail;
|
||||
|
||||
namespace 智慧物流软件系统.ViewModel
|
||||
{
|
||||
public class BatchBindMatDetailViewModel : BindableBase
|
||||
{
|
||||
public BatchBindMatDetailViewModel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#region Property
|
||||
private List<MatDetailCurrentInfoModel> dataGridItemSource;
|
||||
public List<MatDetailCurrentInfoModel> DataGridItemSource
|
||||
{
|
||||
get { return dataGridItemSource; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref dataGridItemSource, value);
|
||||
}
|
||||
}
|
||||
|
||||
private MatDetailCurrentInfoModel selectedataGridItem;
|
||||
public MatDetailCurrentInfoModel SelectedataGridItem
|
||||
{
|
||||
get { return selectedataGridItem; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref selectedataGridItem, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 单据编号
|
||||
/// </summary>
|
||||
private string orderNumber;
|
||||
public string OrderNumber
|
||||
{
|
||||
get { return orderNumber; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref orderNumber, value);
|
||||
}
|
||||
}
|
||||
|
||||
#region 货架
|
||||
/// <summary>
|
||||
/// 货架编号
|
||||
/// </summary>
|
||||
private string shelfCode;
|
||||
public string ShelfCode
|
||||
{
|
||||
get { return shelfCode; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref shelfCode, value);
|
||||
}
|
||||
}
|
||||
|
||||
private List<OrderTypeModel> orderTypeItems;
|
||||
public List<OrderTypeModel> OrderTypeItems
|
||||
{
|
||||
get { return orderTypeItems; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref orderTypeItems, value);
|
||||
}
|
||||
}
|
||||
|
||||
private OrderTypeModel? selectedOrderTypeItem;
|
||||
public OrderTypeModel? SelectedOrderTypeItem
|
||||
{
|
||||
get { return selectedOrderTypeItem; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref selectedOrderTypeItem, value);
|
||||
}
|
||||
}
|
||||
public void InitOrderTypeItems()
|
||||
{
|
||||
//调用接口更新!
|
||||
Task.Run(() =>
|
||||
{
|
||||
OrderTypeItems = new List<OrderTypeModel>();
|
||||
OrderTypeItems.Add(new OrderTypeModel { Id = null, OrderTypeName = "全部" });
|
||||
|
||||
var body = new RequestBase()
|
||||
{
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
};
|
||||
|
||||
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<OrderTypeModel>>(LocalFile.Config.ApiIpHost + "batchBindMatDetail/getOrderTypes", body, "POST");
|
||||
if (Result != null && Result.Data != null && Result.Data.Lists.Count() > 0)
|
||||
{
|
||||
OrderTypeItems.AddRange(Result.Data.Lists);
|
||||
}
|
||||
|
||||
SelectedOrderTypeItem = OrderTypeItems.FirstOrDefault();
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Command
|
||||
public ICommand BtnResetCommand { get => new DelegateCommand(BtnReset); }
|
||||
public void BtnReset()
|
||||
{
|
||||
if (OrderTypeItems != null)
|
||||
{
|
||||
SelectedOrderTypeItem = OrderTypeItems.FirstOrDefault();
|
||||
}
|
||||
OrderNumber = string.Empty;
|
||||
ShelfCode = string.Empty;
|
||||
}
|
||||
|
||||
public ICommand BtnSearchCommand { get => new DelegateCommand(BtnSearchReset); }
|
||||
public void BtnSearchReset()
|
||||
{
|
||||
BtnSearch(true);
|
||||
}
|
||||
|
||||
public void BtnSearch(bool IsPageReset = true)
|
||||
{
|
||||
if (CurrentPage == 0 || IsPageReset)
|
||||
{
|
||||
CurrentPage = 1;
|
||||
return;
|
||||
}
|
||||
#region 调用接口获取数据
|
||||
var dia = Dialog.Show(new TextDialog());
|
||||
try
|
||||
{
|
||||
var body = new GetMatDetailCurrentInfosByStationCodeRequest()
|
||||
{
|
||||
OrderTypeId = SelectedOrderTypeItem?.Id,
|
||||
OrderNumber = OrderNumber,
|
||||
ShelfCode = ShelfCode,
|
||||
StationCode = LocalFile.Config.LocationCode,
|
||||
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
PageNumber = CurrentPage,
|
||||
PageSize = PageSize,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<MatDetailCurrentInfoModel>>(LocalFile.Config.ApiIpHost + "batchBindMatDetail/getMatDetailCurrentInfosByStationCode", body, "POST");
|
||||
if (Result != null && Result.Data != null && Result.Data.Lists != null)
|
||||
{
|
||||
DataGridItemSource = Result.Data.Lists;
|
||||
MaxPage = Result.Data.MaxPage;
|
||||
TotalCount = Result.Data.TotalCount;
|
||||
}
|
||||
else if(Result != null && !string.IsNullOrEmpty(Result.Message))
|
||||
{
|
||||
Growl.Warning(Result.Message);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Growl.Error("加载数据失败:" + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
dia.Close();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
public ICommand BtnEditCommand { get => new DelegateCommand(BtnEdit); }
|
||||
public void BtnEdit()
|
||||
{
|
||||
//查询勾选的第一个数据
|
||||
var info = DataGridItemSource?.Where(t => t.IsSelected == true).FirstOrDefault();
|
||||
if (info == null)
|
||||
{
|
||||
Growl.Warning("请选择需要修改的数据!");
|
||||
}
|
||||
else
|
||||
{
|
||||
var updateView = new MatDetailCurrentInfoUpdateView("修改货架存量", info);
|
||||
updateView.ShowDialog();
|
||||
if (updateView.DialogResult == true)
|
||||
{
|
||||
CurrentPage = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand BtnDeleteCommand { get => new DelegateCommand(BtnDelete); }
|
||||
public void BtnDelete()
|
||||
{
|
||||
Growl.Ask($"是否删除所有勾选的数据?", isConfirmed =>
|
||||
{
|
||||
if (isConfirmed)
|
||||
{
|
||||
//查询勾选的第一个数据
|
||||
var needDeleteIds = DataGridItemSource?.Where(t => t.IsSelected == true)
|
||||
.Select(t => t.Id)
|
||||
.ToList();
|
||||
|
||||
if (needDeleteIds == null)
|
||||
{
|
||||
Growl.Warning("请选择需要修改的数据!");
|
||||
}
|
||||
else
|
||||
{
|
||||
var body = new DeleteInfosRequest()
|
||||
{
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
needDeleteIds = needDeleteIds,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseBase<UserModel>>(LocalFile.Config.ApiIpHost + "matDetailCurrenInfo/deleteMatDetailCurrentInfo", body, "POST");
|
||||
if (Result != null && Result.Code == 200)
|
||||
{
|
||||
BtnSearch();
|
||||
Growl.Success("删除成功!" + Result?.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Error($"{Result?.Message?.ToString()}");
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region PageOperation 分页操作
|
||||
private int currentPage;
|
||||
public int CurrentPage
|
||||
{
|
||||
get { return currentPage; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref currentPage, value);
|
||||
BtnSearch(false);
|
||||
}
|
||||
}
|
||||
|
||||
private int maxPage;
|
||||
public int MaxPage
|
||||
{
|
||||
get { return maxPage; }
|
||||
set { SetProperty(ref maxPage, value); }
|
||||
}
|
||||
|
||||
//总数量
|
||||
private int totalCount;
|
||||
public int TotalCount
|
||||
{
|
||||
get { return totalCount; }
|
||||
set { SetProperty(ref totalCount, value); }
|
||||
}
|
||||
|
||||
private int pageSize = 10;
|
||||
public int PageSize
|
||||
{
|
||||
get => pageSize;
|
||||
set
|
||||
{
|
||||
SetProperty(ref pageSize, value);
|
||||
BtnSearch(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); }
|
||||
public void BtnFirstPage()
|
||||
{
|
||||
CurrentPage = 1;
|
||||
}
|
||||
|
||||
public ICommand BtnPrePageCommand { get => new DelegateCommand(BtnPrePage); }
|
||||
public void BtnPrePage()
|
||||
{
|
||||
if (CurrentPage > 1)
|
||||
{
|
||||
CurrentPage--;
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand BtnNextPageCommand { get => new DelegateCommand(BtnNextPage); }
|
||||
public void BtnNextPage()
|
||||
{
|
||||
if (CurrentPage < MaxPage)
|
||||
{
|
||||
CurrentPage++;
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand BtnLastPageCommand { get => new DelegateCommand(BtnLastPage); }
|
||||
public void BtnLastPage()
|
||||
{
|
||||
if (CurrentPage != MaxPage)
|
||||
{
|
||||
CurrentPage = MaxPage;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -39,9 +39,9 @@
|
||||
FontSize="18"></TextBlock>
|
||||
<ComboBox Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
DisplayMemberPath="ShelfTypeName"
|
||||
ItemsSource="{Binding ShelfTypeItems}"
|
||||
SelectedItem="{Binding SelectedShelfTypeItem}"
|
||||
DisplayMemberPath="OrderTypeName"
|
||||
ItemsSource="{Binding OrderTypeItems}"
|
||||
SelectedItem="{Binding SelectedOrderTypeItem}"
|
||||
Height="30"
|
||||
FontSize="18"
|
||||
IsEditable="False" />
|
||||
@ -51,32 +51,20 @@
|
||||
Text="单据编号:" FontSize="18" ></TextBlock>
|
||||
<TextBox Grid.Column="3"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Stretch"
|
||||
FontSize="18" MinWidth="90" Text="{Binding ShelfCode}"></TextBox>
|
||||
FontSize="18" MinWidth="90" Text="{Binding OrderNumber}"></TextBox>
|
||||
<TextBlock Grid.Column="4"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"
|
||||
Text="货架编号:"
|
||||
FontSize="18"></TextBlock>
|
||||
<ComboBox Grid.Row="0"
|
||||
Grid.Column="5"
|
||||
DisplayMemberPath="LocationAreaName"
|
||||
ItemsSource="{Binding LocationAreaItems}"
|
||||
SelectedItem="{Binding SelectedLocationAreaItems}"
|
||||
Height="30"
|
||||
FontSize="18"
|
||||
IsEditable="False" />
|
||||
|
||||
<!--<TextBlock Grid.Column="6"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"
|
||||
Text="位置编号:"
|
||||
FontSize="18"></TextBlock>
|
||||
<TextBox Grid.Column="7"
|
||||
<TextBox Grid.Column="5"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Stretch"
|
||||
FontSize="18"
|
||||
MinWidth="90"
|
||||
Text="{Binding LocationCode}"></TextBox>-->
|
||||
Text="{Binding ShelfCode}"></TextBox>
|
||||
|
||||
|
||||
<Button Style="{StaticResource ButtonSuccess}" hc:BorderElement.CornerRadius="15"
|
||||
Grid.Column="9" MinHeight="40" FontSize="18" Content=" 搜索" FontFamily="{StaticResource IconFont}"
|
||||
Command="{Binding BtnSearchCommand}">
|
||||
@ -151,16 +139,21 @@
|
||||
</DataGridTemplateColumn.HeaderTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
|
||||
<DataGridTextColumn Header="货架类型" MaxWidth="150" Binding="{Binding ShelfType}"></DataGridTextColumn>
|
||||
<DataGridTextColumn Header="货架编码" Binding="{Binding ShelfCode}"></DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Header="位置区域" MaxWidth="150" Binding="{Binding LocationArea}"></DataGridTextColumn>
|
||||
<DataGridTextColumn Header="位置编号" Binding="{Binding LocationCode}"></DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Header="单据类型" MaxWidth="150" Binding="{Binding OrderTypeName}"></DataGridTextColumn>
|
||||
<DataGridTextColumn Header="单据编号"
|
||||
MaxWidth="150"
|
||||
Binding="{Binding OrderNumber}"></DataGridTextColumn>
|
||||
|
||||
|
||||
<DataGridTextColumn Header="物料编码" Binding="{Binding MatCode}"></DataGridTextColumn>
|
||||
<DataGridTextColumn Header="物料名称" Binding="{Binding MatName}"></DataGridTextColumn>
|
||||
<DataGridTextColumn Header="物料规格" Binding="{Binding MatSpec}"></DataGridTextColumn>
|
||||
<DataGridTextColumn Header="物料规格"
|
||||
Binding="{Binding MatSpec}"
|
||||
MaxWidth="150"></DataGridTextColumn>
|
||||
<DataGridTextColumn Header="数量" Binding="{Binding MatQty}"></DataGridTextColumn>
|
||||
<DataGridTextColumn Header="货架编码"
|
||||
Binding="{Binding ShelfCode}"></DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn IsReadOnly="True" Header="更新人" Binding="{Binding ModifyUser}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="更新时间" Binding="{Binding ModifyTime ,StringFormat='yyyy-MM-dd HH:mm:ss'}"></DataGridTextColumn>
|
||||
</DataGrid.Columns>
|
||||
|
@ -18,13 +18,12 @@ namespace 智慧物流软件系统
|
||||
{
|
||||
public partial class BatchBindMatDetailView : UserControlBase
|
||||
{
|
||||
public MatDetailCurrentInfoViewModel viewModel { get; set; } = new MatDetailCurrentInfoViewModel();
|
||||
public BatchBindMatDetailViewModel viewModel { get; set; } = new BatchBindMatDetailViewModel();
|
||||
public BatchBindMatDetailView()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = viewModel;
|
||||
viewModel.InitLocationAreaItems();
|
||||
viewModel.InitShelfTypeItems();
|
||||
viewModel.InitOrderTypeItems();
|
||||
}
|
||||
|
||||
private void LoadedVisible(object sender, EventArgs e)
|
||||
|
Reference in New Issue
Block a user