添加报警窗口
出库流程调试、优化
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Runtime;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
@ -10,9 +11,12 @@ using WCS.BLL.DbModels;
|
||||
using WCS.BLL.HardWare;
|
||||
using WCS.BLL.Manager;
|
||||
using WCS.BLL.Services.IService;
|
||||
using WCS.BLL.Tool;
|
||||
using WCS.BLL.Tool.Api.ApiModel;
|
||||
using WCS.DAL.Db;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel.MatBaseInfo;
|
||||
using static Dm.net.buffer.ByteArrayBuffer;
|
||||
|
||||
namespace WCS.BLL.Services.Service
|
||||
{
|
||||
@ -63,7 +67,7 @@ namespace WCS.BLL.Services.Service
|
||||
//已找到模组对应货架
|
||||
shelf.GoInInstore(request.IpAdress);
|
||||
|
||||
if (shelf.CurentMode == Mode.入库模式)
|
||||
if (shelf.CurrentMode == Mode.入库模式)
|
||||
//成功进入入库模式
|
||||
return new ShelfGoInInstoreResponse()
|
||||
{
|
||||
@ -129,12 +133,12 @@ namespace WCS.BLL.Services.Service
|
||||
};
|
||||
}
|
||||
//判断当前是否是入库模式
|
||||
if (shelf.CurentMode != Mode.入库模式)
|
||||
if (shelf.CurrentMode != Mode.入库模式)
|
||||
{
|
||||
return new ResponseCommon<MatInfo>()
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"操作失败:货架[{request.ShelfCode}]不在入库模式!\r\n当前为{shelf.CurentMode}",
|
||||
Message = $"操作失败:货架[{request.ShelfCode}]不在入库模式!\r\n当前为{shelf.CurrentMode}",
|
||||
};
|
||||
}
|
||||
//判断物料是否已入库
|
||||
@ -149,9 +153,92 @@ namespace WCS.BLL.Services.Service
|
||||
}
|
||||
#region 获取物料数据 //调用接口或者直接查询数据库
|
||||
//TODO做成配置 调用接口
|
||||
if (1 != 1)
|
||||
if (1 == 1)
|
||||
{
|
||||
#region 调用Mes接口获取物料信息
|
||||
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 = "111222",
|
||||
materialName = "电阻",
|
||||
materialQty = 1000,
|
||||
}
|
||||
}
|
||||
};
|
||||
//查询到物料信息
|
||||
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,
|
||||
|
||||
InstoreUser = request.UserName
|
||||
};
|
||||
|
||||
var matInfo = new MatInfo()
|
||||
{
|
||||
MatSn = data.materialBar,
|
||||
MatCode = data.materialCode,
|
||||
MatName = data.materialName,
|
||||
MatBatch = data.batchNo,
|
||||
MatQty = (int)data.materialQty,
|
||||
MatSpec = data.materialSpec,
|
||||
MatSupplier = "",
|
||||
MatCustomer = "",
|
||||
};
|
||||
|
||||
return new ResponseCommon<MatInfo>()
|
||||
{
|
||||
Code = 200,
|
||||
Data = matInfo,
|
||||
Message = "success"
|
||||
};
|
||||
}
|
||||
else if (Result != null && Result.Code == 200 && Result.Data == null)
|
||||
{
|
||||
//Mes系统中未获取到物料信息
|
||||
return new ResponseCommon<MatInfo>()
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"操作失败:调用Mes接口未获取到物料信息!",
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ResponseCommon<MatInfo>()
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"操作失败:调用Mes接口失败!",
|
||||
};
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return new ResponseCommon<MatInfo>()
|
||||
{
|
||||
Code = 300,
|
||||
Message = $"操作失败:调用Mes接口发生异常{e.Message}",
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
//查询数据库
|
||||
else
|
||||
@ -207,12 +294,12 @@ namespace WCS.BLL.Services.Service
|
||||
}
|
||||
|
||||
//判断当前是否是入库模式
|
||||
if (shelf.CurentMode != Mode.入库模式)
|
||||
if (shelf.CurrentMode != Mode.入库模式)
|
||||
{
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"货架[{request.ShelfCode}]已退出入库模式!\r\n当前为{shelf.CurentMode}",
|
||||
Message = $"货架[{request.ShelfCode}]已退出入库模式!\r\n当前为{shelf.CurrentMode}",
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user