1.增加单灯出库查询物料接口
2.修改入库查询物料接口 3.货架出库单据计算物料重复问题修复 4.出库单据、盘点单据生成单据号修改为按 202406100001这种格式
This commit is contained in:
@ -122,25 +122,6 @@ namespace WCS.BLL.Services.Service
|
||||
|
||||
public async Task<ResponseBase> queryByMatSn(QueryByMatSnRequest request)
|
||||
{
|
||||
//获取货架
|
||||
var shelf = ShelfManager.Shelves.Where(t => t.ShelfCode == request.ShelfCode).FirstOrDefault();
|
||||
if (shelf == null)//货架不存在
|
||||
{
|
||||
return new ResponseCommon<MatInfo>()
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"操作失败:货架[{request.ShelfCode}]不存在!",
|
||||
};
|
||||
}
|
||||
//判断当前是否是入库模式
|
||||
if (shelf.CurrentMode != Mode.入库模式)
|
||||
{
|
||||
return new ResponseCommon<MatInfo>()
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"操作失败:货架[{request.ShelfCode}]不在入库模式!\r\n当前为{shelf.CurrentMode}",
|
||||
};
|
||||
}
|
||||
//判断物料是否已入库
|
||||
var inventory = await DbHelp.db.Queryable<InventoryDetail>().Where(t => t.MatSN == request.MatSn).FirstAsync();
|
||||
if (inventory != null)
|
||||
@ -148,50 +129,65 @@ namespace WCS.BLL.Services.Service
|
||||
return new ResponseCommon<MatInfo>()
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"操作失败:物料{inventory.MatSN}已入库,库位为{inventory.StoreCode}",
|
||||
Message = $"操作失败:物料{inventory.MatSN}已入库!库位为{inventory.StoreCode}",
|
||||
};
|
||||
}
|
||||
|
||||
IShelfBase shelf = null;
|
||||
if (!request.IsSingleLightIn)
|
||||
{
|
||||
//获取货架
|
||||
shelf = ShelfManager.Shelves.Where(t => t.ShelfCode == request.ShelfCode).FirstOrDefault();
|
||||
if (shelf == null)//货架不存在
|
||||
{
|
||||
return new ResponseCommon<MatInfo>()
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"操作失败:货架[{request.ShelfCode}]不存在!",
|
||||
};
|
||||
}
|
||||
//判断当前是否是入库模式
|
||||
if (shelf.CurrentMode != Mode.入库模式)
|
||||
{
|
||||
return new ResponseCommon<MatInfo>()
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"操作失败:货架[{request.ShelfCode}]不在入库模式!\r\n当前为{shelf.CurrentMode}",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#region 获取物料数据 //调用接口或者直接查询数据库
|
||||
//TODO做成配置 调用接口
|
||||
if (1 != 1)
|
||||
if (LocalFile.Config.IsAccessWMS)
|
||||
{
|
||||
#region 调用Mes接口获取物料信息
|
||||
#region 调用WMS接口获取物料信息
|
||||
try
|
||||
{
|
||||
var body = new
|
||||
{
|
||||
materialBar = request.MatSn
|
||||
};
|
||||
//var Result = ApiHelp.GetDataFromHttp<ResponseCommon<List<queryByBarResponse>>>("http://192.168.2.23:9213/integrate/instock/queryBybar", body, "POST");
|
||||
var Result = new ResponseCommon<List<queryByBarResponse>>()
|
||||
{
|
||||
Code = 200,
|
||||
Data = new List<queryByBarResponse>() {new queryByBarResponse()
|
||||
{
|
||||
materialBar = request.MatSn,
|
||||
materialCode = "100200300",
|
||||
materialName = "电阻",
|
||||
materialQty = 1000,
|
||||
}
|
||||
}
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseCommon<List<queryByBarResponse>>>("http://192.168.2.23:9213/integrate/instock/queryBybar", body, "POST");
|
||||
|
||||
//查询到物料信息
|
||||
if (Result != null && Result.Code == 200 && Result.Data != null && Result.Data.Count > 0)
|
||||
{
|
||||
var data = Result.Data.First();
|
||||
shelf.InStoreData = new MatInfoResponse()
|
||||
{
|
||||
materialBar = data.materialBar,
|
||||
materialCode = data.materialCode,
|
||||
materialName = data.materialName,
|
||||
materialQty = data.materialQty,
|
||||
materialSpec = data.materialSpec,
|
||||
batchNo = data.batchNo,
|
||||
supplier = "",
|
||||
customer = data.materialBar,
|
||||
if (!request.IsSingleLightIn && shelf != null)
|
||||
shelf.InStoreData = new MatInfoResponse()
|
||||
{
|
||||
materialBar = data.materialBar,
|
||||
materialCode = data.materialCode,
|
||||
materialName = data.materialName,
|
||||
materialQty = data.materialQty,
|
||||
materialSpec = data.materialSpec,
|
||||
batchNo = data.batchNo,
|
||||
supplier = "",
|
||||
customer = data.materialBar,
|
||||
|
||||
InstoreUser = request.UserName
|
||||
};
|
||||
InstoreUser = request.UserName
|
||||
};
|
||||
|
||||
var matInfo = new MatInfo()
|
||||
{
|
||||
@ -240,26 +236,27 @@ namespace WCS.BLL.Services.Service
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
//查询数据库
|
||||
//查询数据库是否存在这个物料
|
||||
else
|
||||
{
|
||||
var matInfo = await DbHelp.db.Queryable<MatInfo>().Where(t => t.MatSn == request.MatSn).FirstAsync();
|
||||
if (matInfo != null)
|
||||
{
|
||||
//TODO 改成wcs的实体
|
||||
shelf.InStoreData = new MatInfoResponse()
|
||||
{
|
||||
materialBar = matInfo.MatSn,
|
||||
materialCode = matInfo.MatCode,
|
||||
materialName = matInfo.MatName,
|
||||
materialQty = matInfo.MatQty,
|
||||
materialSpec = matInfo.MatSpec,
|
||||
batchNo = matInfo.MatBatch,
|
||||
supplier = matInfo.MatSupplier,
|
||||
customer = matInfo.MatCustomer,
|
||||
if (!request.IsSingleLightIn && shelf != null)
|
||||
shelf.InStoreData = new MatInfoResponse()
|
||||
{
|
||||
materialBar = matInfo.MatSn,
|
||||
materialCode = matInfo.MatCode,
|
||||
materialName = matInfo.MatName,
|
||||
materialQty = matInfo.MatQty,
|
||||
materialSpec = matInfo.MatSpec,
|
||||
batchNo = matInfo.MatBatch,
|
||||
supplier = matInfo.MatSupplier,
|
||||
customer = matInfo.MatCustomer,
|
||||
|
||||
InstoreUser = request.UserName
|
||||
};
|
||||
InstoreUser = request.UserName
|
||||
};
|
||||
|
||||
return new ResponseCommon<MatInfo>()
|
||||
{
|
||||
@ -276,10 +273,47 @@ namespace WCS.BLL.Services.Service
|
||||
Message = $"不存在物料{request.MatSn}"
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 单灯出库时查询物料信息 这里返回库存的数据
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ResponseBase> queryByMatSnOut(QueryByMatSnRequest request)
|
||||
{
|
||||
//判断物料是否已入库
|
||||
var inventory = await DbHelp.db.Queryable<InventoryDetail>().Where(t => t.MatSN == request.MatSn).FirstAsync();
|
||||
if (inventory == null)
|
||||
{
|
||||
return new ResponseCommon<MatInfo>()
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"操作失败:物料不在库存内,无法进行出库!",
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ResponseCommon<MatInfo>()
|
||||
{
|
||||
Code = 200,
|
||||
Message = $"Success",
|
||||
Data = new MatInfo()
|
||||
{
|
||||
MatSn = inventory.MatSN,
|
||||
MatCode = inventory.MatCode,
|
||||
MatName = inventory.MatName,
|
||||
MatBatch = inventory.MatBatch,
|
||||
MatQty = inventory.MatQty,
|
||||
MatSpec = inventory.MatSpec,
|
||||
MatSupplier = inventory.MatSupplier,
|
||||
MatCustomer = inventory.MatCustomer,
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ResponseBase> queryInstoreStatus(QueryByMatSnRequest request)
|
||||
{
|
||||
//获取货架
|
||||
|
Reference in New Issue
Block a user