base
This commit is contained in:
1 parent
d1781f7326
commit
aa33eadcb6
1066 files changed
+68
-335722
No files matched your search
@@ -1,16 +1,6 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
using WalkingTec.Mvvm.Mvc;
|
||||
using WalkingTec.Mvvm.Core.Extensions;
|
||||
using HHWMS.Web;
|
||||
using HHWMS.Web.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection.Emit;
|
||||
|
||||
namespace HHWMS.Web.Controllers
|
||||
{
|
||||
@@ -19,212 +9,20 @@ namespace HHWMS.Web.Controllers
|
||||
public partial class ReceiptInController : BaseController
|
||||
{
|
||||
private readonly IUnitWork _unitWork;
|
||||
|
||||
public ReceiptInController(IUnitWork unitwork)
|
||||
{
|
||||
_unitWork = unitwork;
|
||||
}
|
||||
#region Search
|
||||
|
||||
#region Index
|
||||
|
||||
[ActionDescription("Sys.Search")]
|
||||
public ActionResult Index()
|
||||
{
|
||||
return PartialView("Index");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult<dynamic> SelectReceiptCode()
|
||||
{
|
||||
var data = _unitWork.Find<ReceiptHeader>(x => x.FirstStatus < ReceiptStatusEnum.收完)
|
||||
.Select(x => new { label = x.Code, value = x.Code });
|
||||
return JsonMore(data);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult<dynamic> SelectReceipt(string Code)
|
||||
{
|
||||
var data = _unitWork.Find<ReceiptHeader>(x => x.Code == Code)
|
||||
.Include(x => x.ReceiptDetails.Where(a => a.Status < ReceiptStatusEnum.收完))
|
||||
.FirstOrDefault();
|
||||
if(data != null)
|
||||
{
|
||||
var result = data.ReceiptDetails.Select(x => new { name = x.UniqueCode });
|
||||
return JsonMore(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
return JsonMore(null);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 盘料入库扫描料箱号
|
||||
/// </summary>
|
||||
/// <param name="boxCode"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public ActionResult ScanBox(string boxCode)
|
||||
{
|
||||
// 判断任务重复
|
||||
if (_unitWork.IsExit<TaskHeader>(x => x.FromLocation == boxCode || x.ToLocation == boxCode))
|
||||
{
|
||||
return JsonMore(null, 500, $"库内已存在{boxCode}的任务,请勿重复操作!");
|
||||
}
|
||||
// 判断箱号是否合理
|
||||
var box = _unitWork.FindSingle<Location>(x => x.Code.Equals(boxCode));
|
||||
if (box != null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(box.ContainerCode))
|
||||
{
|
||||
box.ContainerCode = boxCode;
|
||||
_unitWork.Update(box);
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// return JsonMore(null, 500, $"{boxCode}已经被其他任务占用,无法入库!");
|
||||
//}
|
||||
return JsonMore(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
return JsonMore(null, 500, $"{boxCode}不正确!");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 入库盘料绑定并创建入库任务
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public ActionResult BindingData(List<Binding> data)
|
||||
{
|
||||
// 判断库内是否有充足库位执行入库 todo
|
||||
/*var emptyLoc = _unitWork.Find<Location>(x => x.Type == LocationTypeEnum.盘料库位)
|
||||
.ToList()
|
||||
.GroupBy(x => Convert.ToInt32(x.Length));
|
||||
var sizeEmptyNum = new List<dynamic>();
|
||||
foreach (var group in emptyLoc)
|
||||
{
|
||||
var num = group.Sum(x => (x.Length - x.Width));
|
||||
sizeEmptyNum.Add(new
|
||||
{
|
||||
size = group.Key,
|
||||
num = Convert.ToInt32(num)
|
||||
});
|
||||
}
|
||||
var sizeList = data.GroupBy(x => x.Size).ToList();
|
||||
foreach(var item in sizeList)
|
||||
{
|
||||
var size = 23;
|
||||
switch (item.Key)
|
||||
{
|
||||
case 8:
|
||||
size = 23;
|
||||
break;
|
||||
case 10:
|
||||
size = 19;
|
||||
break;
|
||||
case 16:
|
||||
size = 16;
|
||||
break;
|
||||
case 24:
|
||||
size = 13;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
var num = sizeEmptyNum.First(x => x.size == item.Key).num
|
||||
if(item.Count() > num)
|
||||
return JsonMore(null, 500, $"尺寸{item.Key}的盘料盒无法满足入库需求,剩余数量{num}");
|
||||
|
||||
}*/
|
||||
var receiptHeaderList = _unitWork.Find<ReceiptHeader>(x =>
|
||||
data.Select(x => x.ReceiptCode).ToList().Contains(x.Code))
|
||||
.Include(x => x.ReceiptDetails).ToList();
|
||||
// 查找明细,修改对应状态,并且 绑定物料周转箱
|
||||
foreach (Binding item in data)
|
||||
{
|
||||
// 更新入库单明细状态
|
||||
var header = receiptHeaderList.First(x => x.Code.Equals(item.ReceiptCode));
|
||||
var receipt = header.ReceiptDetails.First(x =>
|
||||
x.UniqueCode.Equals(item.UniqueCode)
|
||||
&& x.Status < ReceiptStatusEnum.收完);
|
||||
//var receipt = _unitWork.FindSingle<ReceiptDetail>(x => x.UniqueCode == item.UniqueCode);
|
||||
if (receipt != null)
|
||||
{
|
||||
receipt.CompletedQty = receipt.Qty;
|
||||
receipt.Status = ReceiptStatusEnum.收完;
|
||||
if (!header.ReceiptDetails.Any(x => x.Status < ReceiptStatusEnum.收完))
|
||||
{
|
||||
header.FirstStatus = ReceiptStatusEnum.收完;
|
||||
_unitWork.Update(header);
|
||||
}
|
||||
}
|
||||
_unitWork.Update(receipt);
|
||||
// 新建库存
|
||||
var inventory = new Inventory
|
||||
{
|
||||
ZoneCode = ZoneCodeEnum.盘料库,
|
||||
UniqueCode = item.UniqueCode,
|
||||
Flag = item.Size,
|
||||
MaterialCode = receipt.MaterialCode,
|
||||
MaterialType = receipt.MaterialType,
|
||||
MaterialName = receipt.MaterialName,
|
||||
MaterialSpec = receipt.MaterialSpec,
|
||||
Batch = receipt.Batch,
|
||||
MaterialUnit = receipt.MaterialUnit,
|
||||
SupplierCode = receipt.SupplierCode,
|
||||
Qty = receipt.Qty,
|
||||
Lot = item.Index.ToString(),
|
||||
ContainerCode = item.BoxCode,
|
||||
Status = "0",
|
||||
TaskStatus = InventoryTaskStatus.任务中
|
||||
};
|
||||
_unitWork.Add(inventory);
|
||||
}
|
||||
var boxcode = data.First().BoxCode;
|
||||
//创建入库任务
|
||||
var invList = _unitWork.Find<Inventory>(x => x.ContainerCode.Equals(boxcode))
|
||||
.ToList();
|
||||
if (invList.Count == 0)
|
||||
{
|
||||
return JsonMore(null, 500, $"站台{boxcode}没有绑定数据,请正确操作!");
|
||||
}
|
||||
var task = new TaskHeader
|
||||
{
|
||||
TaskNo = _unitWork.GetSerialNumber("pin", 4),
|
||||
TaskType = TaskTypeEnum.盘料入库,
|
||||
Status = TaskStatusEnum.待下发,
|
||||
ZoneCode = ZoneCodeEnum.盘料库,
|
||||
FromLocation = boxcode,
|
||||
TaskDetails = new List<TaskDetail>(),
|
||||
};
|
||||
foreach (var item in invList)
|
||||
{
|
||||
var detail = new TaskDetail
|
||||
{
|
||||
UniqueCode = item.UniqueCode,
|
||||
FromLocation = item.Lot,
|
||||
Status = TaskStatusEnum.新建,
|
||||
CreateTime = DateTime.Now
|
||||
};
|
||||
task.TaskDetails.Add(detail);
|
||||
}
|
||||
_unitWork.Add(task);
|
||||
return JsonMore(null);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
public class Binding
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string ReceiptCode { get; set; }
|
||||
public string UniqueCode { get; set; }
|
||||
public string BoxCode { get; set; }
|
||||
public int Index { get; set; }
|
||||
public int Size { get; set; }
|
||||
public int BindQty { get; set; }
|
||||
#endregion Index
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using HHWMS.Web.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
using WalkingTec.Mvvm.Mvc;
|
||||
|
||||
namespace HHWMS.Web.Controllers;
|
||||
|
||||
[Area("receipt")]
|
||||
[ActionDescription("盘料站台入库操作")]
|
||||
public class ReceiptInOperationController : BaseController
|
||||
{
|
||||
private readonly IUnitWork _unitWork;
|
||||
|
||||
public ReceiptInOperationController(IUnitWork unitWork)
|
||||
{
|
||||
_unitWork = unitWork;
|
||||
}
|
||||
|
||||
#region Index
|
||||
|
||||
[ActionDescription("Sys.Search")]
|
||||
public ActionResult Index()
|
||||
{
|
||||
return PartialView("Index");
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 启动入库
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public ActionResult InOperation(string boxCode)
|
||||
{
|
||||
// 创建盘料入库任务
|
||||
// 查找已绑定库存,没有,跳过
|
||||
var invList = _unitWork.Find<Inventory>(x => x.ContainerCode.Equals(boxCode))
|
||||
.ToList();
|
||||
if (invList.Count == 0)
|
||||
{
|
||||
return JsonMore(null, 500, $"站台{boxCode}没有绑定数据,请正确操作!");
|
||||
}
|
||||
var task = new TaskHeader
|
||||
{
|
||||
TaskNo = _unitWork.GetSerialNumber("pin", 4),
|
||||
TaskType = TaskTypeEnum.盘料入库,
|
||||
Status = TaskStatusEnum.待下发,
|
||||
ZoneCode = ZoneCodeEnum.盘料库,
|
||||
FromLocation = boxCode,
|
||||
TaskDetails = new List<TaskDetail>(),
|
||||
};
|
||||
foreach(var item in invList)
|
||||
{
|
||||
var detail = new TaskDetail
|
||||
{
|
||||
UniqueCode = item.UniqueCode,
|
||||
FromLocation = item.Lot,
|
||||
Status = TaskStatusEnum.新建,
|
||||
CreateTime = DateTime.Now
|
||||
};
|
||||
task.TaskDetails.Add(detail);
|
||||
}
|
||||
_unitWork.Add(task);
|
||||
return JsonMore(null);
|
||||
}
|
||||
|
||||
public class InData
|
||||
{
|
||||
public string BoxName { get; set; }
|
||||
public string Station { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,275 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection.Emit;
|
||||
using HHWMS.Web.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
using WalkingTec.Mvvm.Mvc;
|
||||
|
||||
namespace HHWMS.Web.Controllers;
|
||||
|
||||
[Area("receipt")]
|
||||
[ActionDescription("散料操作")]
|
||||
public class ReceiptSLInController : BaseController
|
||||
{
|
||||
private readonly IUnitWork _unitWork;
|
||||
|
||||
public ReceiptSLInController(IUnitWork unitWork)
|
||||
{
|
||||
_unitWork = unitWork;
|
||||
}
|
||||
|
||||
#region Search
|
||||
|
||||
[ActionDescription("Sys.Search")]
|
||||
public ActionResult Index()
|
||||
{
|
||||
return PartialView("Index");
|
||||
}
|
||||
#endregion
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult CallBox()
|
||||
{
|
||||
// 查询站台占用
|
||||
var stations = _unitWork.Find<Location>(x => (x.Code == StationCode.散料库左抽屉
|
||||
|| x.Code == StationCode.散料库右抽屉)
|
||||
&& x.Status == LocationStatus.空仓位
|
||||
).ToList();
|
||||
if (stations.Count == 0) return JsonMore(null, 500, "无可用站台!");
|
||||
|
||||
// 查找没任务的仓位,分两边查,那边站台能用 查哪边
|
||||
var box = _unitWork.Find<Location>(x => (x.ZoneCode == ZoneCodeEnum.散料库)
|
||||
&& x.Status != LocationStatus.任务锁
|
||||
&& x.Status != LocationStatus.满货
|
||||
&& x.Status != LocationStatus.空仓位
|
||||
&& x.IsStop == false
|
||||
&& x.Row == stations.First().Row)
|
||||
.OrderBy(x => x.Status)
|
||||
.ThenBy(x => x.Layer)
|
||||
.ThenByDescending(x => x.Line)
|
||||
.FirstOrDefault();
|
||||
if (box == null && stations.Count == 2)
|
||||
box = _unitWork.Find<Location>(x => (x.ZoneCode == ZoneCodeEnum.散料库)
|
||||
&& x.Status != LocationStatus.任务锁
|
||||
&& x.Status != LocationStatus.满货
|
||||
&& x.Status != LocationStatus.空仓位
|
||||
&& x.IsStop == false
|
||||
&& x.Row == stations.Last().Row)
|
||||
.OrderBy(x => x.Status)
|
||||
.ThenBy(x => x.Layer)
|
||||
.ThenByDescending(x => x.Line)
|
||||
.FirstOrDefault();
|
||||
|
||||
if (box == null) return JsonMore(null, 500, "库内没有可用散料箱!");
|
||||
|
||||
var toLocation = box.Row == 1 ? StationCode.散料库右抽屉 : StationCode.散料库左抽屉;
|
||||
// 创建任务
|
||||
var task = new TaskHeader
|
||||
{
|
||||
ZoneCode = ZoneCodeEnum.散料库,
|
||||
TaskNo = _unitWork.GetSerialNumber("SOut"),
|
||||
TaskType = TaskTypeEnum.散料盒出库,
|
||||
ContainerCode = box.ContainerCode,
|
||||
FromLocation = box.Code,
|
||||
ToLocation = toLocation,
|
||||
Status = TaskStatusEnum.待下发,
|
||||
CreateTime = DateTime.Now,
|
||||
CreateBy = Wtm.LoginUserInfo.ITCode
|
||||
};
|
||||
_unitWork.Add(task);
|
||||
|
||||
//更新起点仓位状态
|
||||
box.Status = LocationStatus.任务锁;
|
||||
_unitWork.Update(box);
|
||||
return JsonMore(null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 扫描散料箱
|
||||
/// </summary>
|
||||
/// <param name="boxCode"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public ActionResult ScanBox(string boxCode)
|
||||
{
|
||||
// 判断任务重复
|
||||
if (_unitWork.IsExit<TaskHeader>(x => x.ZoneCode.Equals(ZoneCodeEnum.散料库)
|
||||
&& (x.FromLocation.Equals(boxCode) || x.ToLocation.Equals(boxCode))
|
||||
&& x.Status < TaskStatusEnum.完成))
|
||||
{
|
||||
return JsonMore(null, 500, $"库内已存在{boxCode}的任务,请勿重复操作!");
|
||||
};
|
||||
// 判断箱号是否合理
|
||||
var box = _unitWork.FindSingle<Location>(x => x.Code.Equals(boxCode) && x.Type == LocationTypeEnum.散料库站台);
|
||||
|
||||
if (box != null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(box.ContainerCode))
|
||||
{
|
||||
return JsonMore(null, 500, $"{boxCode}站台没有料箱,无法入库!");
|
||||
}
|
||||
var data = _unitWork.Find<Inventory>(x => x.LocationCode == boxCode
|
||||
&& x.TaskStatus == InventoryTaskStatus.任务中).ToList();
|
||||
return JsonMore(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
return JsonMore(null, 500, $"{boxCode}不正确!");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 扫描唯一码,并验证,返回入库单明细
|
||||
/// </summary>
|
||||
/// <param name="uniqueCode"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public ActionResult ScanUniqueCode(string uniqueCode)
|
||||
{
|
||||
var receiptDetail = _unitWork.FindSingle<ReceiptDetail>(x => x.UniqueCode.Equals(uniqueCode));
|
||||
if (receiptDetail != null)
|
||||
{
|
||||
if (receiptDetail.Status == ReceiptStatusEnum.收完)
|
||||
{
|
||||
return JsonMore(null, 500, $"{uniqueCode}已全部收完,无需重新绑定!");
|
||||
}
|
||||
return JsonMore(receiptDetail);
|
||||
}
|
||||
return JsonMore(null, 500, $"{uniqueCode}不存在!");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绑定
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public ActionResult BindingData(List<Binding> data)
|
||||
{
|
||||
var receiptHeaderList = _unitWork.Find<ReceiptHeader>(x =>
|
||||
data.Select(x => x.ReceiptCode).ToList().Contains(x.ID.ToString()))
|
||||
.Include(x => x.ReceiptDetails).ToList();
|
||||
|
||||
// 查找明细,修改对应状态,并且 绑定物料周转箱
|
||||
foreach (Binding item in data.OrderBy(x => x.ReceiptCode))
|
||||
{
|
||||
// 更新入库单明细状态
|
||||
var header = receiptHeaderList.Find(x => x.ID.ToString().Equals(item.ReceiptCode));
|
||||
var receipt = header.ReceiptDetails.First(x => x.UniqueCode.Equals(item.UniqueCode));
|
||||
if (receipt != null)
|
||||
{
|
||||
if (receipt.Status == ReceiptStatusEnum.收完) continue;
|
||||
receipt.CompletedQty += item.BindQty;
|
||||
}
|
||||
if(receipt.CompletedQty == receipt.Qty)
|
||||
{
|
||||
receipt.Status = ReceiptStatusEnum.收完;
|
||||
if (!header.ReceiptDetails.Any(x => x.Status < ReceiptStatusEnum.收完))
|
||||
{
|
||||
header.FirstStatus = ReceiptStatusEnum.收完;
|
||||
}
|
||||
}
|
||||
var station = _unitWork.FindSingle<Location>(x => x.Code == item.BoxCode);
|
||||
// 新建库存
|
||||
var inventory = new Inventory
|
||||
{
|
||||
ZoneCode = ZoneCodeEnum.散料库,
|
||||
UniqueCode = item.UniqueCode,
|
||||
MaterialCode = receipt.MaterialCode,
|
||||
MaterialType = receipt.MaterialType,
|
||||
MaterialName = receipt.MaterialName,
|
||||
MaterialSpec = receipt.MaterialSpec,
|
||||
Batch = receipt.Batch,
|
||||
MaterialUnit = receipt.MaterialUnit,
|
||||
SupplierCode = receipt.SupplierCode,
|
||||
Qty = item.BindQty,
|
||||
LocationCode = item.BoxCode,
|
||||
ContainerCode = station.ContainerCode,
|
||||
ReceiptCode = item.ReceiptCode,
|
||||
Status = "0",
|
||||
TaskStatus = InventoryTaskStatus.任务中,
|
||||
Flag = item.Size,
|
||||
};
|
||||
_unitWork.Add(inventory);
|
||||
}
|
||||
_unitWork.BatchUpdate(receiptHeaderList.ToArray());
|
||||
return JsonMore(null);
|
||||
}
|
||||
/// <summary>
|
||||
/// 散料箱回库
|
||||
/// </summary>
|
||||
/// <param name="boxCode"></param>
|
||||
/// <param name="isFull"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public ActionResult BoxBack(string boxCode, bool isFull)
|
||||
{
|
||||
// 判断任务重复
|
||||
if (_unitWork.IsExit<TaskHeader>(x => x.ZoneCode.Equals(ZoneCodeEnum.散料库) && x.ContainerCode.Equals(boxCode) && x.Status < TaskStatusEnum.完成))
|
||||
{
|
||||
return JsonMore(null, 500, $"库内已存在{boxCode}的任务,请勿重复操作!");
|
||||
};
|
||||
// 判断箱号是否合理
|
||||
var station = _unitWork.FindSingle<Location>(x => x.Code.Equals(boxCode)
|
||||
&& x.Type == LocationTypeEnum.散料库站台);
|
||||
if (station == null)
|
||||
{
|
||||
return JsonMore(null, 500, $"站台{boxCode}不存在,无法入库!");
|
||||
}
|
||||
if (string.IsNullOrEmpty(station.ContainerCode))
|
||||
{
|
||||
return JsonMore(null, 500, $"{boxCode}站台没有料箱,无法入库!");
|
||||
}
|
||||
// 判断箱号是否合理
|
||||
var box = _unitWork.FindSingle<Location>(x => x.ContainerCode.Equals(station.ContainerCode)
|
||||
&& x.Type != LocationTypeEnum.散料库站台);
|
||||
|
||||
if (box != null)
|
||||
{
|
||||
//if(box.Type != LocationTypeEnum.散料库站台)
|
||||
//{
|
||||
// return JsonMore(null, 500, $"{boxCode}不在站台,无法入库!");
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// 查找目标库位,托盘回原库位
|
||||
var toLocation = _unitWork.FindSingle<Location>(x => x.Code.Equals(box.Code));
|
||||
|
||||
if (toLocation != null)
|
||||
{
|
||||
// 创建任务
|
||||
var task = new TaskHeader
|
||||
{
|
||||
ZoneCode = ZoneCodeEnum.散料库,
|
||||
TaskNo = _unitWork.GetSerialNumber("CIn"),
|
||||
TaskType = TaskTypeEnum.散料盒入库,
|
||||
ContainerCode = toLocation.Code,
|
||||
FromLocation = station.Code,
|
||||
ToLocation = toLocation.Code,
|
||||
Status = TaskStatusEnum.待下发,
|
||||
CreateBy = Wtm.LoginUserInfo.ITCode,
|
||||
CreateTime = DateTime.Now
|
||||
};
|
||||
_unitWork.Add(task);
|
||||
|
||||
toLocation.Status = LocationStatus.任务锁;
|
||||
toLocation.Length = isFull ? 1 : 0; // 是否满盘
|
||||
_unitWork.Update(toLocation);
|
||||
}
|
||||
else
|
||||
{
|
||||
return JsonMore(null, 500, $"库内无可用仓位,无法入库!");
|
||||
}
|
||||
//}
|
||||
return JsonMore(data: null);
|
||||
}
|
||||
else
|
||||
{
|
||||
return JsonMore(null, 500, $"{boxCode}不正确!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection.Emit;
|
||||
using HHWMS.Web.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
using WalkingTec.Mvvm.Mvc;
|
||||
|
||||
namespace HHWMS.Web.Controllers;
|
||||
|
||||
[Area("receipt")]
|
||||
[ActionDescription("货架入库")]
|
||||
public class ReceiptShelfInController : BaseController
|
||||
{
|
||||
private readonly IUnitWork _unitWork;
|
||||
|
||||
public ReceiptShelfInController(IUnitWork unitWork)
|
||||
{
|
||||
_unitWork = unitWork;
|
||||
}
|
||||
|
||||
#region Search
|
||||
|
||||
[ActionDescription("Sys.Search")]
|
||||
public ActionResult Index()
|
||||
{
|
||||
return PartialView("Index");
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 扫描唯一码,并验证,返回入库单明细
|
||||
/// </summary>
|
||||
/// <param name="uniqueCode"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public ActionResult ScanUniqueCode(string uniqueCode)
|
||||
{
|
||||
var receiptDetail = _unitWork.FindSingle<ReceiptDetail>(x => x.UniqueCode.Equals(uniqueCode));
|
||||
if (receiptDetail != null)
|
||||
{
|
||||
if (receiptDetail.Status == ReceiptStatusEnum.收完)
|
||||
{
|
||||
return JsonMore(null, 500, $"{uniqueCode}已全部收完,无需重新绑定!");
|
||||
}
|
||||
return JsonMore(receiptDetail);
|
||||
}
|
||||
return JsonMore(null, 500, $"{uniqueCode}不存在!");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绑定
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public ActionResult BindingData(List<Binding> data)
|
||||
{
|
||||
var receiptHeaderList = _unitWork.Find<ReceiptHeader>(x =>
|
||||
data.Select(x => x.ReceiptCode).ToList().Contains(x.ID.ToString()))
|
||||
.Include(x => x.ReceiptDetails).ToList();
|
||||
|
||||
var invList = new List<Inventory>();
|
||||
var listInvtran = new List<InventoryTransaction>();
|
||||
|
||||
// 查找明细,修改对应状态,并且 绑定物料周转箱
|
||||
foreach (Binding item in data.OrderBy(x => x.ReceiptCode))
|
||||
{
|
||||
// 更新入库单明细状态
|
||||
var header = receiptHeaderList.Find(x => x.ID.ToString().Equals(item.ReceiptCode));
|
||||
var receipt = header.ReceiptDetails.First(x => x.UniqueCode.Equals(item.UniqueCode));
|
||||
if (receipt != null)
|
||||
{
|
||||
receipt.Status = ReceiptStatusEnum.收完;
|
||||
if (!header.ReceiptDetails.Any(x => x.Status < ReceiptStatusEnum.收完))
|
||||
{
|
||||
header.FirstStatus = ReceiptStatusEnum.收完;
|
||||
}
|
||||
receipt.UpdateTime = DateTime.Now;
|
||||
}
|
||||
|
||||
// 新建库存
|
||||
invList.Add(new Inventory
|
||||
{
|
||||
ZoneCode = ZoneCodeEnum.货架库,
|
||||
LocationCode = item.BoxCode,
|
||||
UniqueCode = item.UniqueCode,
|
||||
MaterialCode = receipt.MaterialCode,
|
||||
MaterialType = receipt.MaterialType,
|
||||
MaterialName = receipt.MaterialName,
|
||||
MaterialSpec = receipt.MaterialSpec,
|
||||
Batch = receipt.Batch,
|
||||
MaterialUnit = receipt.MaterialUnit,
|
||||
SupplierCode = receipt.SupplierCode,
|
||||
Qty = receipt.Qty,
|
||||
Status = "0",
|
||||
TaskStatus = InventoryTaskStatus.无任务,
|
||||
CreateBy = Wtm.LoginUserInfo.ITCode,
|
||||
CreateTime = DateTime.Now
|
||||
}); ;
|
||||
|
||||
foreach (var inv in invList)
|
||||
{
|
||||
listInvtran.Add(new InventoryTransaction
|
||||
{
|
||||
BillType = "in",
|
||||
ZoneCode = inv.ZoneCode,
|
||||
Type = inv.UniqueCode,
|
||||
MaterialCode = inv.MaterialCode,
|
||||
MaterialName = inv.MaterialName,
|
||||
MaterialSpec = inv.MaterialSpec,
|
||||
MaterialUnit = inv.MaterialUnit,
|
||||
MaterialType = inv.MaterialType,
|
||||
Batch = inv.Batch,
|
||||
Lot = inv.Lot,
|
||||
CompanyCode = inv.CompanyCode,
|
||||
LocationCode = inv.LocationCode,
|
||||
SupplierCode = inv.SupplierCode,
|
||||
Qty = inv.Qty,
|
||||
CreateTime = DateTime.Now
|
||||
});
|
||||
}
|
||||
}
|
||||
_unitWork.BatchAdd(invList.ToArray());
|
||||
_unitWork.BatchAdd(listInvtran.ToArray());
|
||||
_unitWork.BatchUpdate(receiptHeaderList.ToArray());
|
||||
return JsonMore(null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
<el-row id="opapp">
|
||||
<el-card class="box-card" :span="16">
|
||||
<el-table :data="tableData" ref="multipleTable" border style="width: 100%" @@selection-change="handleSelectionChange">
|
||||
>
|
||||
<el-table-column type="selection"
|
||||
width="55">
|
||||
</el-table-column>
|
||||
<el-table-column prop="boxName" label="周转箱" align="center">
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="工位" align="center" prop="label">
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div style="margin-top: 20px">
|
||||
<el-button type="primary" @@click="inOperation()">启动入库</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-row>
|
||||
|
||||
<script>
|
||||
var app = new Vue({
|
||||
el: "#opapp",
|
||||
data() {
|
||||
return {
|
||||
// 表格数据
|
||||
tableData: [
|
||||
{
|
||||
boxName: 'L01',
|
||||
label: '左侧',
|
||||
station: '3',
|
||||
},
|
||||
{
|
||||
boxName: 'L02',
|
||||
label: '右侧',
|
||||
station: '1',
|
||||
},
|
||||
],
|
||||
selectData: []
|
||||
};
|
||||
},
|
||||
mounted: function () {
|
||||
// 获取所有单据编码
|
||||
// $.ajax({
|
||||
// type: "post",
|
||||
// dataType: "json",
|
||||
// data:{},
|
||||
// url: "/receipt/ReceiptIn/SelectReceiptCode",
|
||||
// success: function (json) {
|
||||
// app.options = json.Data;
|
||||
// },
|
||||
// error: function (json) {
|
||||
// alert("加载失败");
|
||||
// }
|
||||
// });
|
||||
},
|
||||
methods: {
|
||||
handleSelectionChange(val) {
|
||||
this.selectData = val;
|
||||
},
|
||||
// 启动入库
|
||||
inOperation() {
|
||||
var _this = this;
|
||||
if (_this.selectData.length < 1) {
|
||||
this.$message({
|
||||
message: "至少选择一个站台!",
|
||||
type: "warning",
|
||||
duration: "5000",
|
||||
});
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: { data: _this.selectData },
|
||||
url: "/receipt/ReceiptInOperation/InOperation",
|
||||
success: function (json) {
|
||||
if (json.Code == 200) {
|
||||
_this.$message({
|
||||
message: "启动成功!",
|
||||
type: "success",
|
||||
});
|
||||
}
|
||||
else {
|
||||
_this.$message({
|
||||
message: json.Msg,
|
||||
type: "warning",
|
||||
duration: "1000",
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function (json) {
|
||||
alert("加载失败");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -1,412 +0,0 @@
|
||||
<el-row id="slapp">
|
||||
<el-card class="box-card" :span="16">
|
||||
<el-form ref="form" :model="form" label-width="100px">
|
||||
<el-row>
|
||||
<el-col :span="16">
|
||||
<el-form-item label="散料盒编码" prop="code">
|
||||
<el-input v-model="form.code"
|
||||
placeholder="请扫描散料盒编码"
|
||||
@@change="scanBox">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item style="float: left">
|
||||
<el-button type="primary" @@click="callBox">呼叫料盒</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="尺寸" prop="size">
|
||||
<el-select v-model="form.size"
|
||||
placeholder="请选择料盘尺寸"
|
||||
style="width: 100%"
|
||||
@@change="changeSize"
|
||||
clearable>
|
||||
<el-option v-for="item in boxSize"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-col :span="16">
|
||||
<el-form-item label="唯一码" prop="uniqueCode">
|
||||
<el-input v-model="form.uniqueCode"
|
||||
@@change="scanUniqueCode"
|
||||
ref="uniqueCode">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="满盘">
|
||||
<el-switch v-model="form.isFull"></el-switch>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-table :data="bindingData"
|
||||
ref="tableData"
|
||||
stripe max-height="450" border style="width: 100%">
|
||||
<el-table-column fixed="left" label="操作" width="120" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button @@click.native.prevent="deleteRow(scope.$index, bindingData)"
|
||||
type="text"
|
||||
size="small">
|
||||
移除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="周转箱"
|
||||
align="center"
|
||||
prop="boxCode">
|
||||
</el-table-column>
|
||||
<el-table-column label="唯一码"
|
||||
align="center"
|
||||
prop="uniqueCode">
|
||||
</el-table-column>
|
||||
<el-table-column label="数量"
|
||||
align="center"
|
||||
prop="qty" v-if="false">
|
||||
</el-table-column>
|
||||
<el-table-column label="数量"
|
||||
align="center"
|
||||
prop="bindQty">
|
||||
<template slot-scope="scope">
|
||||
<el-input size="small" v-model="scope.row.bindQty" @@change="handleEdit(scope.$index, scope.row)"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="尺寸"
|
||||
align="center"
|
||||
prop="size"
|
||||
:formatter="sizeFormatter">
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-form-item style="float: right">
|
||||
<el-button type="primary" @@click="onSubmit">绑定</el-button>
|
||||
<el-button @@click="resetForm('form')">重置</el-button>
|
||||
<el-button type="success" @@click="back" :disabled="disabledbackbutton">回库</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</el-row>
|
||||
|
||||
<script>
|
||||
var app = new Vue({
|
||||
el: "#slapp",
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
code: "",
|
||||
size: "1",
|
||||
uniqueCode: "",
|
||||
isFull: false
|
||||
},
|
||||
disabledbackbutton: true,// true不可回库,false可回库
|
||||
boxSize: [
|
||||
{ label: "8mm", value: "8" },
|
||||
{ label: "10mm", value: "10" },
|
||||
{ label: "16mm", value: "16" },
|
||||
{ label: "24mm", value: "24" },
|
||||
{ label: "散料", value: "1" },
|
||||
],
|
||||
bindingData: [],
|
||||
qty: ''
|
||||
};
|
||||
},
|
||||
mounted: function () {
|
||||
// 获取所有单据编码
|
||||
// $.ajax({
|
||||
// type: "post",
|
||||
// dataType: "json",
|
||||
// data:{},
|
||||
// url: "/receipt/ReceiptIn/SelectReceiptCode",
|
||||
// success: function (json) {
|
||||
// app.options = json.Data;
|
||||
// },
|
||||
// error: function (json) {
|
||||
// alert("加载失败");
|
||||
// }
|
||||
// });
|
||||
},
|
||||
methods: {
|
||||
// 呼叫料箱
|
||||
callBox() {
|
||||
var _this = this;
|
||||
this.$confirm('确定要呼叫料盒出库?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {},
|
||||
url: "/receipt/ReceiptSLIn/CallBox",
|
||||
success: function (json) {
|
||||
if (json.Code == 200) {
|
||||
_this.$message({
|
||||
message: "呼叫成功!",
|
||||
});
|
||||
// _this.resetForm('form');
|
||||
} else {
|
||||
_this.$message({
|
||||
message: "呼叫失败!" + json.Msg,
|
||||
type: "warning",
|
||||
duration: "10000",
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function (json) {
|
||||
_this.$message({
|
||||
message: "呼叫失败!",
|
||||
type: "error",
|
||||
duration: "10000",
|
||||
});
|
||||
},
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消'
|
||||
});
|
||||
});
|
||||
|
||||
},
|
||||
// 扫描散料箱
|
||||
scanBox(data) {
|
||||
var _this = this;
|
||||
_this.bindingData = [];
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: { boxCode: _this.form.code },
|
||||
url: "/receipt/ReceiptSLIn/ScanBox",
|
||||
success: function (json) {
|
||||
if (json.Code != 200) {
|
||||
_this.$message({
|
||||
message: "扫描失败!" + json.Msg,
|
||||
type: "warning",
|
||||
duration: "10000",
|
||||
});
|
||||
}
|
||||
else {
|
||||
json.Data.forEach(function (item) {
|
||||
_this.bindingData.push({
|
||||
"receiptCode":item.ReceiptCode,
|
||||
"boxCode": item.ContainerCode,
|
||||
"uniqueCode": item.UniqueCode,
|
||||
"qty": item.Qty,
|
||||
"bindQty": item.Qty,
|
||||
"size": item.Flag,
|
||||
"band":1
|
||||
})
|
||||
});
|
||||
|
||||
_this.$refs.uniqueCode.focus();
|
||||
_this.disabledbackbutton = false;
|
||||
}
|
||||
},
|
||||
error: function (json) {
|
||||
_this.$message({
|
||||
message: "扫描失败!",
|
||||
type: "error",
|
||||
duration: "10000",
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
sizeFormatter(row) {
|
||||
var rr = this.boxSize.filter((item) => item.value == row.size)[0].label;
|
||||
return rr;
|
||||
},
|
||||
// 绑定
|
||||
onSubmit() {
|
||||
var _this = this;
|
||||
|
||||
// 提交已绑定数据
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: { data: _this.bindingData },
|
||||
url: "/receipt/ReceiptSLIn/BindingData",
|
||||
success: function (json) {
|
||||
if (json.Code == 200) {
|
||||
_this.$message({
|
||||
message: "绑定成功!",
|
||||
});
|
||||
// _this.bindingData = [];
|
||||
_this.bindingData.forEach(function (item) {
|
||||
item.band = 1;
|
||||
})
|
||||
_this.disabledbackbutton = false;
|
||||
} else {
|
||||
_this.$message({
|
||||
message: "绑定失败!",
|
||||
type: "warning",
|
||||
duration: "10000",
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function (json) {
|
||||
_this.$message({
|
||||
message: "绑定失败!",
|
||||
type: "error",
|
||||
duration: "10000",
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
// 重置
|
||||
resetForm(formName) {
|
||||
this.$refs[formName].resetFields();
|
||||
this.form.code = "";
|
||||
this.bindingData = [];
|
||||
},
|
||||
// 选择尺寸后
|
||||
changeSize() {
|
||||
this.$refs.uniqueCode.focus();
|
||||
},
|
||||
// 扫描唯一码
|
||||
scanUniqueCode(data) {
|
||||
var _this = this;
|
||||
// 1. 判断条件
|
||||
if (this.form.code == "" || this.form.size == "") {
|
||||
this.$message({
|
||||
message: "请先扫描料箱箱编码并选择物料尺寸!",
|
||||
type: "warning",
|
||||
});
|
||||
this.form.uniqueCode = "";
|
||||
return;
|
||||
}
|
||||
//2. 判断唯一码是否合理,调用后台,并返回唯一码对应的数量
|
||||
var isExit = this.bindingData.findIndex(function (value) {
|
||||
return value.uniqueCode == data;
|
||||
})
|
||||
if (isExit != -1) {
|
||||
this.$message({
|
||||
message: '唯一码' + data + '已绑定!',
|
||||
type: 'warning'
|
||||
});
|
||||
this.form.uniqueCode = '';
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: { uniqueCode: _this.form.uniqueCode },
|
||||
url: "/receipt/ReceiptSLIn/ScanUniqueCode",
|
||||
success: function (json) {
|
||||
if (json.Code != 200) {
|
||||
_this.$message({
|
||||
message: json.Msg,
|
||||
type: "warning",
|
||||
duration: "10000",
|
||||
});
|
||||
} else {
|
||||
// 3.已扫描增加
|
||||
_this.bindingData.push({
|
||||
receiptCode: json.Data.ReceiptHeaderId,
|
||||
boxCode: _this.form.code,
|
||||
uniqueCode: data,
|
||||
qty: json.Data.Qty - json.Data.CompletedQty,
|
||||
bindQty: json.Data.Qty - json.Data.CompletedQty,
|
||||
size: _this.form.size,
|
||||
});
|
||||
_this.disabledbackbutton = true;
|
||||
_this.$nextTick(() => {
|
||||
_this.$refs.tableData.bodyWrapper.scrollTop = _this.$refs.tableData.bodyWrapper.scrollHeight
|
||||
})
|
||||
}
|
||||
},
|
||||
error: function (json) {
|
||||
_this.$message({
|
||||
message: "扫描失败!",
|
||||
type: "error",
|
||||
duration: "10000",
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
this.form.uniqueCode = "";
|
||||
},
|
||||
// 删除已绑定行
|
||||
deleteRow(index, rows) {
|
||||
if (rows[index].band == 1) {
|
||||
this.$message({
|
||||
message: "已绑定物料不能移除!",
|
||||
type: "warning",
|
||||
duration: "1000",
|
||||
});
|
||||
return;
|
||||
}
|
||||
else {
|
||||
rows.splice(index, 1);
|
||||
}
|
||||
},
|
||||
handleEdit(index, row) {
|
||||
// console.log(index, row, this.bindingData);
|
||||
if (row.qty < row.bindQty) {
|
||||
this.$message({
|
||||
message: "数量不能大于剩余绑定数量!" + row.qty,
|
||||
type: "warning",
|
||||
duration: "1000",
|
||||
});
|
||||
this.bindingData[index].bindQty = row.qty;
|
||||
}
|
||||
else if (row.bindQty <= 0) {
|
||||
this.bindingData[index].bindQty = row.qty;
|
||||
}
|
||||
},
|
||||
// 回库
|
||||
back() {
|
||||
var _this = this;
|
||||
// 创建回库任务
|
||||
if (_this.form.code == "") {
|
||||
_this.$message({
|
||||
message: "箱号为空,不能创建回库任务!",
|
||||
type: "error",
|
||||
duration: "1000",
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.$confirm('确定执行回库动作?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: { boxCode: _this.form.code, isFull: _this.form.isFull },
|
||||
url: "/receipt/ReceiptSLIn/BoxBack",
|
||||
success: function (json) {
|
||||
if (json.Code != 200) {
|
||||
_this.$message({
|
||||
message: "回库任务创建失败!" + json.Msg,
|
||||
type: "warning",
|
||||
duration: "10000",
|
||||
});
|
||||
} else {
|
||||
_this.$message({
|
||||
message: "回库任务创建成功!"
|
||||
});
|
||||
_this.resetForm('form');
|
||||
_this.disabledbackbutton = true;
|
||||
}
|
||||
},
|
||||
error: function (json) {
|
||||
_this.$message({
|
||||
message: "回库任务创建失败!",
|
||||
type: "error",
|
||||
duration: "10000",
|
||||
});
|
||||
},
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消'
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
@@ -1,189 +0,0 @@
|
||||
<el-row id="shelfapp">
|
||||
<el-card class="box-card" :span="16">
|
||||
<el-form ref="form" :model="form" label-width="100px" @@submit.native.prevent>
|
||||
<el-row>
|
||||
<el-col :span="16">
|
||||
<el-form-item label="位置" prop="locationCode">
|
||||
<el-input v-model="form.locationCode"
|
||||
ref="locationCode">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="16">
|
||||
<el-form-item label="唯一码" prop="uniqueCode">
|
||||
<el-input v-model="form.uniqueCode"
|
||||
@@change="scanUniqueCode"
|
||||
ref="uniqueCode">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table :data="bindingData" stripe max-height="450" border style="width: 100%">
|
||||
<el-table-column fixed="left" label="操作" width="120" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button @@click.native.prevent="deleteRow(scope.$index, bindingData)"
|
||||
type="text"
|
||||
size="small">
|
||||
移除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="位置"
|
||||
align="center"
|
||||
prop="boxCode">
|
||||
</el-table-column>
|
||||
<el-table-column label="唯一码"
|
||||
align="center"
|
||||
prop="uniqueCode">
|
||||
</el-table-column>
|
||||
<el-table-column label="物料码"
|
||||
align="center"
|
||||
prop="materialCode">
|
||||
</el-table-column>
|
||||
<el-table-column label="名称"
|
||||
align="center"
|
||||
prop="materialName">
|
||||
</el-table-column>
|
||||
<el-table-column label="数量"
|
||||
align="center"
|
||||
prop="bindQty">
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-form-item style="float: right">
|
||||
<el-button type="primary" @@click="onSubmit">入库</el-button>
|
||||
<el-button @@click="resetForm('form')">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</el-row>
|
||||
|
||||
<script>
|
||||
var app = new Vue({
|
||||
el: "#shelfapp",
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
uniqueCode: "",
|
||||
locationCode: ""
|
||||
},
|
||||
bindingData: []
|
||||
};
|
||||
},
|
||||
mounted: function () {
|
||||
// 获取所有单据编码
|
||||
// $.ajax({
|
||||
// type: "post",
|
||||
// dataType: "json",
|
||||
// data:{},
|
||||
// url: "/receipt/ReceiptIn/SelectReceiptCode",
|
||||
// success: function (json) {
|
||||
// app.options = json.Data;
|
||||
// },
|
||||
// error: function (json) {
|
||||
// alert("加载失败");
|
||||
// }
|
||||
// });
|
||||
},
|
||||
methods: {
|
||||
|
||||
// 绑定
|
||||
onSubmit() {
|
||||
var _this = this;
|
||||
|
||||
// 提交已绑定数据
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: { data: _this.bindingData },
|
||||
url: "/receipt/ReceiptShelfIn/BindingData",
|
||||
success: function (json) {
|
||||
if (json.Code == 200) {
|
||||
_this.$message({
|
||||
message: "入库成功!",
|
||||
});
|
||||
_this.bindingData = [];
|
||||
} else {
|
||||
_this.$message({
|
||||
message: "入库失败!",
|
||||
type: "warning",
|
||||
duration: "10000",
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function (json) {
|
||||
_this.$message({
|
||||
message: "入库失败!",
|
||||
type: "error",
|
||||
duration: "10000",
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
// 重置
|
||||
resetForm(formName) {
|
||||
this.$refs[formName].resetFields();
|
||||
this.bindingData = [];
|
||||
},
|
||||
// 扫描唯一码
|
||||
scanUniqueCode(data) {
|
||||
var _this = this;
|
||||
|
||||
//1. 判断唯一码是否合理,调用后台,并返回唯一码对应的数量
|
||||
var isExit = this.bindingData.findIndex(function (value) {
|
||||
return value.uniqueCode == data;
|
||||
})
|
||||
if (isExit != -1) {
|
||||
this.$message({
|
||||
message: '唯一码' + data + '已绑定!',
|
||||
type: 'warning'
|
||||
});
|
||||
this.form.uniqueCode = '';
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: { uniqueCode: _this.form.uniqueCode },
|
||||
url: "/receipt/ReceiptShelfIn/ScanUniqueCode",
|
||||
success: function (json) {
|
||||
if (json.Code != 200) {
|
||||
_this.$message({
|
||||
message: json.Msg,
|
||||
type: "warning",
|
||||
duration: "10000",
|
||||
});
|
||||
} else {
|
||||
// 3.已扫描增加
|
||||
_this.bindingData.push({
|
||||
receiptCode: json.Data.ReceiptHeaderId,
|
||||
uniqueCode: json.Data.UniqueCode,
|
||||
materialCode: json.Data.MaterialCode,
|
||||
materialName: json.Data.MaterialName,
|
||||
batch: json.Data.Batch,
|
||||
bindQty: json.Data.Qty,
|
||||
boxCode: _this.form.locationCode
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function (json) {
|
||||
_this.$message({
|
||||
message: "扫描失败!",
|
||||
type: "error",
|
||||
duration: "10000",
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
this.form.uniqueCode = "";
|
||||
},
|
||||
// 删除已绑定行
|
||||
deleteRow(index, rows) {
|
||||
rows.splice(index, 1);
|
||||
},
|
||||
|
||||
},
|
||||
});
|
||||
</script>
|
||||
Reference in new issue
Block a user