1.增加刷新库位显示库存接口
2.增加任务物料唯一码的保存
This commit is contained in:
@ -93,6 +93,12 @@ namespace WCS.BLL.DbModels
|
|||||||
[SugarColumn(ColumnName = "mat_batch", Length = 150, IsNullable = true, ColumnDescription = "物料批次")]
|
[SugarColumn(ColumnName = "mat_batch", Length = 150, IsNullable = true, ColumnDescription = "物料批次")]
|
||||||
public string MatBatch { get; set; }
|
public string MatBatch { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料SN 物料唯一码
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "mat_sn", Length = 150, IsNullable = true, ColumnDescription = "物料SN物料唯一码")]
|
||||||
|
public string MatSN { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 物料数量
|
/// 物料数量
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -92,6 +92,12 @@ namespace WCS.BLL.DbModels
|
|||||||
[SugarColumn(ColumnName = "mat_batch", Length = 150, IsNullable = true, ColumnDescription = "物料批次")]
|
[SugarColumn(ColumnName = "mat_batch", Length = 150, IsNullable = true, ColumnDescription = "物料批次")]
|
||||||
public string MatBatch { get; set; }
|
public string MatBatch { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料SN 物料唯一码
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "mat_sn", Length = 150, IsNullable = true, ColumnDescription = "物料SN物料唯一码")]
|
||||||
|
public string MatSN { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 物料数量
|
/// 物料数量
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -92,6 +92,12 @@ namespace WCS.BLL.DbModels
|
|||||||
[SugarColumn(ColumnName = "mat_batch", Length = 150, IsNullable = true, ColumnDescription = "物料批次")]
|
[SugarColumn(ColumnName = "mat_batch", Length = 150, IsNullable = true, ColumnDescription = "物料批次")]
|
||||||
public string MatBatch { get; set; }
|
public string MatBatch { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料SN 物料唯一码
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "mat_sn", Length = 150, IsNullable = true, ColumnDescription = "物料SN物料唯一码")]
|
||||||
|
public string MatSN { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 物料数量
|
/// 物料数量
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -16,5 +16,7 @@ namespace WCS.BLL.Services.IService
|
|||||||
public interface IMXL4Service
|
public interface IMXL4Service
|
||||||
{
|
{
|
||||||
public Task<ResponseCommon<object>> sysOrderMXL4(SysOrderMXL4Request request);
|
public Task<ResponseCommon<object>> sysOrderMXL4(SysOrderMXL4Request request);
|
||||||
|
|
||||||
|
public Task<ResponseCommon> refreshInventoryRequest(RefreshInventoryRequest request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,5 +122,45 @@ namespace WCS.BLL.Services.Service
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<ResponseCommon> refreshInventoryRequest(RefreshInventoryRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//第一步:校验库位在数据库中是否都存在
|
||||||
|
var storeCodeList = request.StoreCodes.Distinct()
|
||||||
|
.ToList();
|
||||||
|
var stores = DbHelp.db.Queryable<StoreInfo>()
|
||||||
|
.LeftJoin<ShelfTypeInfo>((si, sti) => si.ShelfTypeId == sti.Id)
|
||||||
|
.Where((si, sti) => sti.ShelfTypeName == "液晶货架")
|
||||||
|
.Where((si, sti) => storeCodeList.Contains(si.StoreCode))
|
||||||
|
.Select((st, sti) => st)
|
||||||
|
.ToList();
|
||||||
|
if (stores.Count < storeCodeList.Count)
|
||||||
|
{
|
||||||
|
var storeCodesInDB = stores.Select(t => t.StoreCode).ToList();
|
||||||
|
storeCodeList.RemoveAll(t => storeCodesInDB.Contains(t));
|
||||||
|
return new ResponseCommon
|
||||||
|
{
|
||||||
|
Code = 200,
|
||||||
|
Message = $"操作失败:库位【{string.Join(",", storeCodeList)}】不存在!",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
//向WMS系统获取对应库位最新的库存信息、更新至电子标签
|
||||||
|
return new ResponseCommon
|
||||||
|
{
|
||||||
|
Code = 200,
|
||||||
|
Message = "success"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return new ResponseCommon
|
||||||
|
{
|
||||||
|
Code = 200,
|
||||||
|
Message = "操作失败:" + ex.Message,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
15
WCS.Model/ApiModel/MXL4/RefreshInventoryRequest.cs
Normal file
15
WCS.Model/ApiModel/MXL4/RefreshInventoryRequest.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using WCS.BLL.DbModels.Task;
|
||||||
|
|
||||||
|
namespace WCS.Model.ApiModel.MXL4
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 刷新库位库存显示信息请求实体
|
||||||
|
/// </summary>
|
||||||
|
public class RefreshInventoryRequest : RequestBase
|
||||||
|
{
|
||||||
|
public List<string> StoreCodes { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -45,5 +45,36 @@ namespace WCS.WebApi.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 刷新库存信息 当上游系统入库后可以调用此接口对硬件显示的库存信息进行刷新
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[Route("refreshInventory")]
|
||||||
|
[HttpPost(Name = "refreshInventory")]
|
||||||
|
public async Task<ResponseCommon> refreshInventory(RefreshInventoryRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//校验传入的参数
|
||||||
|
if (request.StoreCodes == null || request.StoreCodes.Count == 0)
|
||||||
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 201,
|
||||||
|
Message = "操作失败:缺少需要刷新的库位!",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return await _mxl4Service.refreshInventoryRequest(request);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return new ResponseCommon()
|
||||||
|
{
|
||||||
|
Code = 300,
|
||||||
|
Message = "操作失败:" + ex.Message,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user