2025-01-08 15:43:26 +08:00
|
|
|
|
using WmsMobileServe.Annotation;
|
|
|
|
|
|
using WmsMobileServe.ApiClient.Mes;
|
|
|
|
|
|
using WmsMobileServe.ApiClient.Mes.Dto;
|
|
|
|
|
|
using WmsMobileServe.ApiServe.Mobile.Dto;
|
|
|
|
|
|
using WmsMobileServe.ApiServe.Mobile.Vo;
|
|
|
|
|
|
using WmsMobileServe.DataBase.Base.Dao;
|
|
|
|
|
|
using WmsMobileServe.DataBase.Base.Po;
|
|
|
|
|
|
using WmsMobileServe.Utils;
|
|
|
|
|
|
|
|
|
|
|
|
namespace WmsMobileServe.ApiServe.Mobile.Service;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Component]
|
2025-01-15 07:53:20 +08:00
|
|
|
|
public class StockInService(MesApiClient mesApiClient, TOnGoodsShelfDao onGoodsShelfDao, TMiStockDao miStockDao, CuxWmsPoLinesItfDao cuxWmsPoLinesItfDao)
|
2025-01-08 15:43:26 +08:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 空载具入库
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public MobileApiResponse EmptyVehicleIn(EmptyVehicleInReq request)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (string.IsNullOrEmpty(request.VehicleNo)) return MobileApiResponse.Fail("传入的载具号为空");
|
|
|
|
|
|
/* 检验载具是否有入库任务 */
|
|
|
|
|
|
var stackInRasks = onGoodsShelfDao.SelectWithVehicleNo(request.VehicleNo);
|
|
|
|
|
|
if(stackInRasks == default) return MobileApiResponse.Fail("数据服务异常,请稍后再试");
|
|
|
|
|
|
if(stackInRasks.Count > 0) return MobileApiResponse.Fail(string.Format("该载具号:{0} 存在入库任务,请核实后再试", request.VehicleNo));
|
|
|
|
|
|
/* 检验载具是否在库存中 */
|
|
|
|
|
|
var stocks = miStockDao.SelectWithVehicleNo(request.VehicleNo);
|
|
|
|
|
|
if (stocks == default) return MobileApiResponse.Fail("数据服务异常,请稍后再试");
|
|
|
|
|
|
if (stocks.Count > 0) return MobileApiResponse.Fail(string.Format("该载具号:{0} 仍在库中,请核实后再试", request.VehicleNo));
|
|
|
|
|
|
/* 构建空载具信息插入数据库 */
|
|
|
|
|
|
TOnGoodsShelf onGoodsShelf = new()
|
|
|
|
|
|
{
|
|
|
|
|
|
LotId = UUIDUtils.GetNewUUID2(),
|
|
|
|
|
|
GoodsId = "000000",
|
|
|
|
|
|
ProviderId = "景旺",
|
|
|
|
|
|
LocationId = "",
|
|
|
|
|
|
StoNum = 1,
|
|
|
|
|
|
AccNum = 1,
|
|
|
|
|
|
ShelfNum = 1,
|
|
|
|
|
|
StockNum = 0,
|
|
|
|
|
|
OnDate = DateTime.Now,
|
|
|
|
|
|
OnShelfUserId = "Mobile_Android",
|
2025-01-16 15:36:10 +08:00
|
|
|
|
StorageId = "",
|
|
|
|
|
|
StorageAreaId = "",
|
2025-01-08 15:43:26 +08:00
|
|
|
|
UpGoodsId = UUIDUtils.GetNewUUID2(),
|
|
|
|
|
|
GoodsTypeId = "0",
|
|
|
|
|
|
StorageMode = "空托入库",
|
|
|
|
|
|
ProdictionDate = DateTime.Now,
|
|
|
|
|
|
Ctl = request.VehicleNo,
|
2025-01-16 15:36:10 +08:00
|
|
|
|
BarCode = "",
|
2025-01-08 15:43:26 +08:00
|
|
|
|
CustomerId = "景旺",
|
|
|
|
|
|
GoodsName = "空载具",
|
|
|
|
|
|
Status = "0",
|
2025-01-16 15:36:10 +08:00
|
|
|
|
Unit = "",
|
2025-01-08 15:43:26 +08:00
|
|
|
|
TaskType = "1",
|
|
|
|
|
|
GoodsMeasureId = UUIDUtils.GetNewUUID2(),
|
|
|
|
|
|
PackingNum = 1,
|
|
|
|
|
|
DamageNum = 1,
|
|
|
|
|
|
Remark = ""
|
|
|
|
|
|
};
|
|
|
|
|
|
var insertResult = onGoodsShelfDao.Insert(onGoodsShelf);
|
|
|
|
|
|
if (insertResult > 0) return MobileApiResponse.Success(string.Format("空载具:{0} 产生入库任务成功", request.VehicleNo));
|
|
|
|
|
|
return MobileApiResponse.Fail(string.Format("空载具:{0} 产生入库任务失败,数据无法插入", request.VehicleNo));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取箱子号对应的信息
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="boxNo"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public MobileApiResponse<GetGoodsDetailResp> GetGoodsDetail(string? boxNo)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (string.IsNullOrEmpty(boxNo)) return MobileApiResponse<GetGoodsDetailResp>.Fail("无法识别的箱子号");
|
|
|
|
|
|
var response = mesApiClient.GetOutBoxInfo(boxNo);
|
|
|
|
|
|
if (!response.IsSend) return MobileApiResponse<GetGoodsDetailResp>.Fail(string.Format("请求MES货物物料信息失败,异常信息:{0}", response.Exception?.Message));
|
2025-01-15 07:53:20 +08:00
|
|
|
|
var responseData = response.ResponseMsg;
|
2025-01-08 15:43:26 +08:00
|
|
|
|
if (string.IsNullOrEmpty(responseData)) return MobileApiResponse<GetGoodsDetailResp>.Fail(string.Format("MES返回的信息无法识别,信息:{0}", responseData));
|
|
|
|
|
|
var responseDto = XmlUtils.Deserialize<GetOutBoxInfoResp>(responseData);
|
|
|
|
|
|
if (responseDto == null) return MobileApiResponse<GetGoodsDetailResp>.Fail(string.Format("MES返回的信息无法解析,信息:{0}", responseData));
|
2025-01-15 07:53:20 +08:00
|
|
|
|
var mesData = responseDto.Data ?? "";
|
|
|
|
|
|
//var mesData = "Succ:|2|2|1|0|PL0125367A|11120240400183-2|BAG|2345||3031|";
|
|
|
|
|
|
var dataDetail = mesData.Split(':');
|
2025-01-08 15:43:26 +08:00
|
|
|
|
if (dataDetail.Length < 2) return MobileApiResponse<GetGoodsDetailResp>.Fail(string.Format("MES返回的信息格式不正确,信息:{0}", responseData));
|
|
|
|
|
|
if (dataDetail[0] != "Succ") return MobileApiResponse<GetGoodsDetailResp>.Fail(string.Format("MES返回箱子错误,信息:{0}", responseData));
|
2025-01-15 07:53:20 +08:00
|
|
|
|
var goodsInfo = dataDetail[1];
|
|
|
|
|
|
var goodsDetails = goodsInfo.Split("|");
|
|
|
|
|
|
if (goodsDetails.Length < 13) return MobileApiResponse<GetGoodsDetailResp>.Fail(string.Format("MES返回的箱子信息参数数量不足,信息:{0}", goodsInfo));
|
|
|
|
|
|
//if(goodsDetails[0] != boxNo) return MobileApiResponse<GetGoodsDetailResp>.Fail(string.Format("MES返回的箱子号和扫描的箱子号不一致,返回的箱号:{0}", goodsDetails[0]));
|
|
|
|
|
|
var numPerBox = goodsDetails[1]; // 每包数量
|
|
|
|
|
|
var goodsNum = goodsDetails[2]; // 包装数量
|
|
|
|
|
|
var packetNum = goodsDetails[3]; // 包数量
|
|
|
|
|
|
var otherNum = goodsDetails[4]; // 零包数量
|
|
|
|
|
|
if(numPerBox.IsNotNumber() || goodsNum.IsNotNumber() || packetNum.IsNotNumber() || otherNum.IsNotNumber())
|
|
|
|
|
|
return MobileApiResponse<GetGoodsDetailResp>.Fail(string.Format("MES返回的箱子信息内的数量存在不是数字情况,信息:{0}", goodsInfo));
|
2025-01-08 15:43:26 +08:00
|
|
|
|
GetGoodsDetailResp mesGoodsDetail = new()
|
|
|
|
|
|
{
|
2025-01-15 07:53:20 +08:00
|
|
|
|
BoxNo = boxNo,
|
2025-01-08 15:43:26 +08:00
|
|
|
|
NumPerBox = numPerBox.ToDecimal(),
|
|
|
|
|
|
GoodsNum = goodsNum.ToDecimal(),
|
|
|
|
|
|
PacketNum = packetNum.ToDecimal(),
|
|
|
|
|
|
OtherNum = otherNum.ToDecimal(),
|
2025-01-15 07:53:20 +08:00
|
|
|
|
GoodsId = goodsDetails[5],
|
|
|
|
|
|
SaleOrderNo = goodsDetails[6],
|
|
|
|
|
|
PacketLevel = goodsDetails[7],
|
|
|
|
|
|
Cycle = goodsDetails[8],
|
|
|
|
|
|
CustomSaleOrderNo = goodsDetails[9],
|
|
|
|
|
|
MinorWarehouseId = goodsDetails[10],
|
|
|
|
|
|
GoodsDesc = goodsDetails[11],
|
|
|
|
|
|
CustomerId = goodsDetails[12]
|
2025-01-08 15:43:26 +08:00
|
|
|
|
};
|
|
|
|
|
|
return MobileApiResponse<GetGoodsDetailResp>.Success(data: mesGoodsDetail);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 根据订单行和物料号
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public MobileApiResponse<CuxWmsPoLinesItfView> GetCanUseGoods(GetCanUseGoodsRequest request)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (string.IsNullOrEmpty(request.OrderId) || string.IsNullOrEmpty(request.GoodsId) || !request.GoodsId.IsNumber())
|
|
|
|
|
|
return MobileApiResponse<CuxWmsPoLinesItfView>.Fail("传入的参数不正确");
|
|
|
|
|
|
var wareNoticeTabs = cuxWmsPoLinesItfDao.SelectCanUse(request.OrderId, Convert.ToInt64(request.GoodsId));
|
|
|
|
|
|
if(wareNoticeTabs == null) return MobileApiResponse<CuxWmsPoLinesItfView>.Fail("数据服务异常,请稍后再试");
|
|
|
|
|
|
if(wareNoticeTabs.Count < 1) return MobileApiResponse<CuxWmsPoLinesItfView>.Fail("该入库单行和物料无入库单数据");
|
|
|
|
|
|
foreach(var cus in wareNoticeTabs)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(cus.Quantity - cus.QuantityReceives > 0) return MobileApiResponse<CuxWmsPoLinesItfView>.Success("查询成功", cus);
|
|
|
|
|
|
}
|
|
|
|
|
|
return MobileApiResponse<CuxWmsPoLinesItfView>.Fail("无可入库的数量或数量不足,请检查采购单可入库数量");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-15 07:53:20 +08:00
|
|
|
|
|
2025-01-08 15:43:26 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 码盘入库
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public MobileApiResponse BindingVehicleIn(BindingVehicleInRequest request)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(string.IsNullOrEmpty(request.VehicleNo)) return MobileApiResponse.Fail("载具号为空");
|
|
|
|
|
|
var goods = request.Goods;
|
|
|
|
|
|
if (goods == null || goods.Count < 1) return MobileApiResponse.Fail("传入的数据为空");
|
|
|
|
|
|
List<TOnGoodsShelf> onGoodsShelfs = [];
|
|
|
|
|
|
foreach (var item in goods)
|
|
|
|
|
|
{
|
2025-01-15 07:53:20 +08:00
|
|
|
|
var vehicleNo = item.Batch;
|
|
|
|
|
|
if(string.IsNullOrEmpty(vehicleNo)) return MobileApiResponse.Fail("载具号不能为空");
|
|
|
|
|
|
/* 检验载具是否有入库任务 */
|
|
|
|
|
|
var stackInTasks = onGoodsShelfDao.SelectWithVehicleNo(vehicleNo);
|
|
|
|
|
|
if(stackInTasks == null) return MobileApiResponse.Fail("数据服务异常,请稍后再试");
|
|
|
|
|
|
if(stackInTasks.Count > 0) return MobileApiResponse.Fail(string.Format("该载具号:{0} 存在入库任务,请核实后再试", vehicleNo));
|
|
|
|
|
|
/* 检验载具是否在库存中 */
|
|
|
|
|
|
var stocks = miStockDao.SelectWithVehicleNo(vehicleNo);
|
|
|
|
|
|
if (stocks == null) return MobileApiResponse.Fail("数据服务异常,请稍后再试");
|
|
|
|
|
|
if (stocks.Count > 0) return MobileApiResponse.Fail(string.Format("该载具号:{0} 仍在库中,请核实后再试", vehicleNo));
|
|
|
|
|
|
|
2025-01-08 15:43:26 +08:00
|
|
|
|
if (string.IsNullOrEmpty(item.ProductData)) item.ProductData = "19970102";
|
2025-01-15 07:53:20 +08:00
|
|
|
|
/* 构建码盘载具信息插入数据库 */
|
2025-01-08 15:43:26 +08:00
|
|
|
|
TOnGoodsShelf onGoodsShelf = new()
|
|
|
|
|
|
{
|
|
|
|
|
|
LotId = UUIDUtils.GetNewUUID2(),
|
|
|
|
|
|
GoodsId = item.ItemId,
|
|
|
|
|
|
ProviderId = item.Segment1,
|
|
|
|
|
|
LocationId = "",
|
|
|
|
|
|
StoNum = 1,
|
|
|
|
|
|
AccNum = 1,
|
|
|
|
|
|
ShelfNum = Convert.ToInt32(item.Quantity),
|
|
|
|
|
|
StockNum = 0,
|
|
|
|
|
|
OnDate = DateTime.Now,
|
|
|
|
|
|
OnShelfUserId = "Mobile_Android",
|
2025-01-16 15:36:10 +08:00
|
|
|
|
StorageId = "",
|
2025-01-08 15:43:26 +08:00
|
|
|
|
StorageAreaId = item.Area,
|
|
|
|
|
|
UpGoodsId = UUIDUtils.GetNewUUID2(),
|
|
|
|
|
|
GoodsTypeId = item.GoodsTypeId,
|
|
|
|
|
|
StorageMode = "码盘入库",
|
|
|
|
|
|
ProdictionDate = new DateTime(Convert.ToInt32(item.ProductData.Substring(0, 4)), Convert.ToInt32(item.ProductData.Substring(4, 2)), Convert.ToInt32(item.ProductData.Substring(6, 2))),
|
|
|
|
|
|
Ctl = request.VehicleNo,
|
|
|
|
|
|
BarCode = item.SendOrderId,
|
|
|
|
|
|
CustomerId = item.PruBatch,
|
|
|
|
|
|
GoodsName = item.GoodsName,
|
|
|
|
|
|
WGH = item.Weight,
|
|
|
|
|
|
BAOZHIQI = "",
|
|
|
|
|
|
Status = "0",
|
|
|
|
|
|
PRODUCLOTID = item.LineLocationId,
|
|
|
|
|
|
Unit = item.Unit,
|
|
|
|
|
|
TaskType = request.InArea,
|
|
|
|
|
|
GoodsMeasureId = item.Batch,
|
|
|
|
|
|
PackingNum = 1,
|
|
|
|
|
|
DamageNum = 1,
|
2025-01-15 07:53:20 +08:00
|
|
|
|
Remark = ""
|
2025-01-08 15:43:26 +08:00
|
|
|
|
};
|
|
|
|
|
|
onGoodsShelfs.Add(onGoodsShelf);
|
|
|
|
|
|
}
|
|
|
|
|
|
//bool createTask = wareNoticeTabDao.UpdateStatusAndInsertInTask("1", onGoodsShelfs, request.VehicleNo);
|
|
|
|
|
|
var insertResult = onGoodsShelfDao.Insert([.. onGoodsShelfs]);
|
2025-01-15 07:53:20 +08:00
|
|
|
|
if (insertResult > 0) return MobileApiResponse.Success(string.Format("载具:{0} 产生入库任务成功", request.VehicleNo));
|
|
|
|
|
|
return MobileApiResponse.Fail(string.Format("载具:{0} 产生入库任务失败,数据无法插入", request.VehicleNo));
|
2025-01-08 15:43:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// MES 码盘入库
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public MobileApiResponse BindingVehicleInMes(BindingVehicleInReq request)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (string.IsNullOrEmpty(request.VehicleNo) || request.BindingGoodsDetails == null) return MobileApiResponse.Fail("传入的数据无法识别");
|
2025-01-15 07:53:20 +08:00
|
|
|
|
if (request.BindingGoodsDetails.Count < 1 && request.InArea == "1") return MobileApiResponse.Fail("传入的数据为空");
|
2025-01-08 15:43:26 +08:00
|
|
|
|
/* 检验载具是否有入库任务 */
|
2025-01-15 07:53:20 +08:00
|
|
|
|
var stackInTasks = onGoodsShelfDao.SelectWithVehicleNo(request.VehicleNo);
|
|
|
|
|
|
if (stackInTasks == null) return MobileApiResponse.Fail("数据服务异常,请稍后再试");
|
|
|
|
|
|
if (stackInTasks.Count > 0) return MobileApiResponse.Fail(string.Format("该载具号:{0} 存在入库任务,请核实后再试", request.VehicleNo));
|
2025-01-08 15:43:26 +08:00
|
|
|
|
/* 检验载具是否在库存中 */
|
|
|
|
|
|
var stocks = miStockDao.SelectWithVehicleNo(request.VehicleNo);
|
|
|
|
|
|
if (stocks == null) return MobileApiResponse.Fail("数据服务异常,请稍后再试");
|
|
|
|
|
|
if (stocks.Count > 0) return MobileApiResponse.Fail(string.Format("该载具号:{0} 仍在库中,请核实后再试", request.VehicleNo));
|
|
|
|
|
|
/* 构建入库任务 */
|
|
|
|
|
|
List<TOnGoodsShelf> onGoodsShelves = []; // 需要入库的任务
|
2025-01-15 07:53:20 +08:00
|
|
|
|
if (request.InArea == "1")
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var item in request.BindingGoodsDetails)
|
|
|
|
|
|
{
|
|
|
|
|
|
onGoodsShelves.Add(new()
|
|
|
|
|
|
{
|
|
|
|
|
|
LotId = UUIDUtils.GetNewUUID2(),
|
|
|
|
|
|
GoodsId = item.GoodsId,
|
|
|
|
|
|
ProviderId = item.SaleOrderNo,
|
|
|
|
|
|
LocationId = "",
|
|
|
|
|
|
StoNum = item.OtherNum.ToDecimal(),
|
|
|
|
|
|
AccNum = item.NumPerBox.ToDecimal(),
|
|
|
|
|
|
ShelfNum = item.GoodsNum.ToDecimal(),
|
|
|
|
|
|
StockNum = item.PacketNum.ToDecimal(),
|
|
|
|
|
|
OnDate = DateTime.Now,
|
|
|
|
|
|
OnShelfUserId = "Mobile_Android",
|
2025-01-16 15:36:10 +08:00
|
|
|
|
StorageId = "",
|
2025-01-15 07:53:20 +08:00
|
|
|
|
StorageAreaId = item.MinorWarehouseId,
|
|
|
|
|
|
UpGoodsId = UUIDUtils.GetNewUUID2(),
|
|
|
|
|
|
GoodsTypeId = item.PacketLevel,
|
|
|
|
|
|
StorageMode = "MES码盘入库",
|
|
|
|
|
|
ProdictionDate = DateTime.Now,
|
|
|
|
|
|
Ctl = request.VehicleNo,
|
|
|
|
|
|
BarCode = item.BoxNo,
|
|
|
|
|
|
CustomerId = item.CustomerId,
|
|
|
|
|
|
GoodsName = item.GoodsDesc,
|
|
|
|
|
|
Status = "0",
|
|
|
|
|
|
PRODUCLOTID = item.MinorWarehouseId,
|
2025-01-16 15:36:10 +08:00
|
|
|
|
Unit = "",
|
2025-01-15 07:53:20 +08:00
|
|
|
|
TaskType = request.InArea,
|
|
|
|
|
|
GoodsMeasureId = item.SaleOrderNo,
|
|
|
|
|
|
PackingNum = 1,
|
|
|
|
|
|
DamageNum = 1,
|
|
|
|
|
|
ScaleUnit = item.Cycle,
|
|
|
|
|
|
Remark = item.CustomSaleOrderNo
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
2025-01-08 15:43:26 +08:00
|
|
|
|
{
|
|
|
|
|
|
onGoodsShelves.Add(new()
|
|
|
|
|
|
{
|
|
|
|
|
|
LotId = UUIDUtils.GetNewUUID2(),
|
2025-01-15 07:53:20 +08:00
|
|
|
|
GoodsId = request.VehicleNo,
|
|
|
|
|
|
ProviderId = "0",
|
2025-01-08 15:43:26 +08:00
|
|
|
|
LocationId = "",
|
2025-01-15 07:53:20 +08:00
|
|
|
|
StoNum = 0,
|
|
|
|
|
|
AccNum = 0,
|
|
|
|
|
|
ShelfNum = 1,
|
|
|
|
|
|
StockNum = 0,
|
2025-01-08 15:43:26 +08:00
|
|
|
|
OnDate = DateTime.Now,
|
|
|
|
|
|
OnShelfUserId = "Mobile_Android",
|
2025-01-16 15:36:10 +08:00
|
|
|
|
StorageId = "",
|
|
|
|
|
|
StorageAreaId = "",
|
2025-01-08 15:43:26 +08:00
|
|
|
|
UpGoodsId = UUIDUtils.GetNewUUID2(),
|
2025-01-16 15:36:10 +08:00
|
|
|
|
GoodsTypeId = "",
|
2025-01-15 07:53:20 +08:00
|
|
|
|
StorageMode = "MES码盘包装线",
|
2025-01-08 15:43:26 +08:00
|
|
|
|
ProdictionDate = DateTime.Now,
|
|
|
|
|
|
Ctl = request.VehicleNo,
|
2025-01-16 15:36:10 +08:00
|
|
|
|
BarCode = "",
|
|
|
|
|
|
CustomerId = "",
|
2025-01-15 07:53:20 +08:00
|
|
|
|
GoodsName = "去包装线托盘",
|
2025-01-08 15:43:26 +08:00
|
|
|
|
Status = "0",
|
2025-01-16 15:36:10 +08:00
|
|
|
|
PRODUCLOTID = "",
|
|
|
|
|
|
Unit = "",
|
2025-01-15 07:53:20 +08:00
|
|
|
|
TaskType = request.InArea,
|
2025-01-16 15:36:10 +08:00
|
|
|
|
GoodsMeasureId = "",
|
2025-01-08 15:43:26 +08:00
|
|
|
|
PackingNum = 1,
|
|
|
|
|
|
DamageNum = 1,
|
2025-01-16 15:36:10 +08:00
|
|
|
|
ScaleUnit = "",
|
2025-01-08 15:43:26 +08:00
|
|
|
|
Remark = ""
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
var insertResult = onGoodsShelfDao.Insert([.. onGoodsShelves]);
|
|
|
|
|
|
if (insertResult > 0) return MobileApiResponse.Success(string.Format("载具:{0} 产生入库任务成功", request.VehicleNo));
|
|
|
|
|
|
return MobileApiResponse.Fail(string.Format("载具:{0} 产生入库任务失败,数据无法插入", request.VehicleNo));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取EBS待码盘信息
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public MobileApiResponse<List<CuxWmsPoLinesItf>> GetCuxData()
|
|
|
|
|
|
{
|
|
|
|
|
|
List<CuxWmsPoLinesItf>? cuxWmsPoLinesItfs = cuxWmsPoLinesItfDao.SelectWithStatus(0);
|
|
|
|
|
|
if (cuxWmsPoLinesItfs == default) return MobileApiResponse<List<CuxWmsPoLinesItf>>.Fail();
|
|
|
|
|
|
return MobileApiResponse<List<CuxWmsPoLinesItf>>.Success(data: cuxWmsPoLinesItfs);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Ebs 码盘入库
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public MobileApiResponse BindingVehicleInEbsOld(BindingVehicleInEbsOldReq request)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (string.IsNullOrEmpty(request.VehicleNo) || request.BindingGoodsDetails == null) return MobileApiResponse.Fail("传入的数据无法识别");
|
|
|
|
|
|
if (request.BindingGoodsDetails.Count < 1) return MobileApiResponse.Fail("传入的数据为空");
|
|
|
|
|
|
/* 检验载具是否有入库任务 */
|
|
|
|
|
|
var stackInRasks = onGoodsShelfDao.SelectWithVehicleNo(request.VehicleNo);
|
|
|
|
|
|
if (stackInRasks == null) return MobileApiResponse.Fail("数据服务异常,请稍后再试");
|
|
|
|
|
|
if (stackInRasks.Count > 0) return MobileApiResponse.Fail(string.Format("该载具号:{0} 存在入库任务,请核实后再试", request.VehicleNo));
|
|
|
|
|
|
/* 检验载具是否在库存中 */
|
|
|
|
|
|
var stocks = miStockDao.SelectWithVehicleNo(request.VehicleNo);
|
|
|
|
|
|
if (stocks == null) return MobileApiResponse.Fail("数据服务异常,请稍后再试");
|
|
|
|
|
|
if (stocks.Count > 0) return MobileApiResponse.Fail(string.Format("该载具号:{0} 仍在库中,请核实后再试", request.VehicleNo));
|
|
|
|
|
|
/* 构建入库任务 */
|
|
|
|
|
|
List<TOnGoodsShelf> onGoodsShelves = []; // 需要入库的任务
|
|
|
|
|
|
List<(string? PoHeaderId, string? PoLineId, string? LineLocationId)> orders = [];
|
|
|
|
|
|
foreach (var item in request.BindingGoodsDetails)
|
|
|
|
|
|
{
|
|
|
|
|
|
onGoodsShelves.Add(new()
|
|
|
|
|
|
{
|
|
|
|
|
|
LotId = UUIDUtils.GetNewUUID2(),
|
|
|
|
|
|
GoodsId = item.GoodsId,
|
|
|
|
|
|
ProviderId = item.SaleOrderNo,
|
|
|
|
|
|
LocationId = "",
|
|
|
|
|
|
StoNum = item.OtherNum,
|
|
|
|
|
|
AccNum = item.NumPerBox,
|
|
|
|
|
|
ShelfNum = item.GoodsNum,
|
|
|
|
|
|
StockNum = item.PacketNum,
|
|
|
|
|
|
OnDate = DateTime.Now,
|
|
|
|
|
|
OnShelfUserId = "Mobile_Android",
|
2025-01-16 15:36:10 +08:00
|
|
|
|
StorageId = "",
|
2025-01-08 15:43:26 +08:00
|
|
|
|
StorageAreaId = item.MinorWarehouseId,
|
|
|
|
|
|
UpGoodsId = UUIDUtils.GetNewUUID2(),
|
|
|
|
|
|
GoodsTypeId = item.PacketLevel,
|
|
|
|
|
|
StorageMode = "EBS码盘入库",
|
|
|
|
|
|
ProdictionDate = DateTime.Now,
|
|
|
|
|
|
Ctl = request.VehicleNo,
|
|
|
|
|
|
BarCode = item.BoxNo,
|
|
|
|
|
|
CustomerId = item.CustomSaleOrderNo,
|
|
|
|
|
|
GoodsName = item.GoodsDesc,
|
|
|
|
|
|
Status = "0",
|
2025-01-16 15:36:10 +08:00
|
|
|
|
Unit = "",
|
2025-01-08 15:43:26 +08:00
|
|
|
|
TaskType = request.TaskType.ToString(),
|
|
|
|
|
|
GoodsMeasureId = item.SaleOrderNo,
|
|
|
|
|
|
PackingNum = 1,
|
|
|
|
|
|
DamageNum = 1,
|
|
|
|
|
|
ScaleUnit = item.Cycle,
|
|
|
|
|
|
Remark = ""
|
|
|
|
|
|
});
|
|
|
|
|
|
orders.Add((item.PoHeaderId, item.PoLineId, item.LineLocationId));
|
|
|
|
|
|
}
|
|
|
|
|
|
// 插入数据,更新状态
|
|
|
|
|
|
var insertResult = onGoodsShelfDao.InsertWithCux(onGoodsShelves, orders);
|
|
|
|
|
|
if (insertResult) return MobileApiResponse.Success(string.Format("载具:{0} 产生入库任务成功", request.VehicleNo));
|
|
|
|
|
|
return MobileApiResponse.Fail(string.Format("载具:{0} 产生入库任务失败,数据无法插入", request.VehicleNo));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Ebs 码盘入库
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public MobileApiResponse BindingVehicleInEbs(BindingVehicleInEbsReq request)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (string.IsNullOrEmpty(request.VehicleNo) || request.BindingGoodsDetails == default) return MobileApiResponse.Fail("传入的数据无法识别");
|
|
|
|
|
|
if (request.BindingGoodsDetails.Count < 1) return MobileApiResponse.Fail("传入的数据为空");
|
|
|
|
|
|
/* 检验载具是否有入库任务 */
|
|
|
|
|
|
var stackInRasks = onGoodsShelfDao.SelectWithVehicleNo(request.VehicleNo);
|
|
|
|
|
|
if (stackInRasks == default) return MobileApiResponse.Fail("数据服务异常,请稍后再试");
|
|
|
|
|
|
if (stackInRasks.Count > 0) return MobileApiResponse.Fail(string.Format("该载具号:{0} 存在入库任务,请核实后再试", request.VehicleNo));
|
|
|
|
|
|
/* 检验载具是否在库存中 */
|
|
|
|
|
|
var stocks = miStockDao.SelectWithVehicleNo(request.VehicleNo);
|
|
|
|
|
|
if (stocks == default) return MobileApiResponse.Fail("数据服务异常,请稍后再试");
|
|
|
|
|
|
if (stocks.Count > 0) return MobileApiResponse.Fail(string.Format("该载具号:{0} 仍在库中,请核实后再试", request.VehicleNo));
|
|
|
|
|
|
/* 检查入库单中是否有该任务 */
|
|
|
|
|
|
//foreach (var item in request.BindingGoodsDetails)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// List<CuxWmsPoLinesItf> cuxWmsPos = cuxWmsPoLinesItfDao.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// /* 构建入库任务 */
|
|
|
|
|
|
// List<TOnGoodsShelf> onGoodsShelves = []; // 需要入库的任务
|
|
|
|
|
|
//List<(string? PoHeaderId, string? PoLineId, string? LineLocationId)> orders = [];
|
|
|
|
|
|
//foreach (var item in request.BindingGoodsDetails)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// onGoodsShelves.Add(new()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// LotId = UUIDUtils.GetNewUUID2(),
|
|
|
|
|
|
// GoodsId = item.GoodsId,
|
|
|
|
|
|
// ProviderId = item.SaleOrderNo,
|
|
|
|
|
|
// LocationId = "",
|
|
|
|
|
|
// StoNum = item.OtherNum,
|
|
|
|
|
|
// AccNum = item.NumPerBox,
|
|
|
|
|
|
// ShelfNum = item.GoodsNum,
|
|
|
|
|
|
// StockNum = item.PacketNum,
|
|
|
|
|
|
// OnDate = DateTime.Now,
|
|
|
|
|
|
// OnShelfUserId = "Mobile_Android",
|
|
|
|
|
|
// StorageId = "-",
|
|
|
|
|
|
// StorageAreaId = item.MinorWarehouseId,
|
|
|
|
|
|
// UpGoodsId = UUIDUtils.GetNewUUID2(),
|
|
|
|
|
|
// GoodsTypeId = item.PacketLevel,
|
|
|
|
|
|
// StorageMode = "EBS码盘入库",
|
|
|
|
|
|
// ProdictionDate = DateTime.Now,
|
|
|
|
|
|
// Ctl = request.VehicleNo,
|
|
|
|
|
|
// BarCode = item.BoxNo,
|
|
|
|
|
|
// CustomerId = item.CustomSaleOrderNo,
|
|
|
|
|
|
// GoodsName = item.GoodsDesc,
|
|
|
|
|
|
// Status = "0",
|
|
|
|
|
|
// Unit = "-",
|
|
|
|
|
|
// TaskType = request.TaskType.ToString(),
|
|
|
|
|
|
// GoodsMeasureId = item.SaleOrderNo,
|
|
|
|
|
|
// PackingNum = 1,
|
|
|
|
|
|
// DamageNum = 1,
|
|
|
|
|
|
// ScaleUnit = item.Cycle,
|
|
|
|
|
|
// Remark = ""
|
|
|
|
|
|
// });
|
|
|
|
|
|
// orders.Add((item.PoHeaderId, item.PoLineId, item.LineLocationId));
|
|
|
|
|
|
//}
|
|
|
|
|
|
// 插入数据,更新状态
|
|
|
|
|
|
//var insertResult = onGoodsShelfDao.InsertWithCux(onGoodsShelves, orders);
|
|
|
|
|
|
//if (insertResult) return MobileApiResponse.Success(string.Format("载具:{0} 产生入库任务成功", request.VehicleNo));
|
|
|
|
|
|
return MobileApiResponse.Fail(string.Format("载具:{0} 产生入库任务失败,数据无法插入", request.VehicleNo));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|