盘料站台入库
This commit is contained in:
1 parent
49078aaf0e
commit
79d4512266
3 files changed
+58
-369
No files matched your search
@@ -56,7 +56,7 @@ namespace HHWMS.Web
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public IActionResult ReturnStatus(TaskResponse response)
|
public IActionResult Test(TaskResponse response)
|
||||||
{
|
{
|
||||||
var taskno = response.TaskId.Split("-")[0];
|
var taskno = response.TaskId.Split("-")[0];
|
||||||
//wcs 任务反馈
|
//wcs 任务反馈
|
||||||
@@ -265,7 +265,7 @@ namespace HHWMS.Web
|
|||||||
/// <param name="response"></param>
|
/// <param name="response"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public IActionResult Test(TaskResponse response)
|
public IActionResult Test1(TaskResponse response)
|
||||||
{
|
{
|
||||||
var taskno = response.TaskId.Split("-")[0];
|
var taskno = response.TaskId.Split("-")[0];
|
||||||
//wcs 任务反馈
|
//wcs 任务反馈
|
||||||
|
|||||||
@@ -31,174 +31,46 @@ public class ReceiptInOperationController : BaseController
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取已绑定物料的周转箱信息
|
/// 启动入库
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult BindBox()
|
public ActionResult InOperation(List<InData> data)
|
||||||
{
|
{
|
||||||
var boxInfo = _unitWork.Find<TaskHeader>(x => x.Status.Equals(TaskStatusEnum.新建)
|
// 创建盘料入库任务
|
||||||
&& x.TaskType.Equals(TaskTypeEnum.盘料入库)).ToList();
|
foreach(var inData in data)
|
||||||
if(boxInfo.Count > 0)
|
|
||||||
{
|
{
|
||||||
return JsonMore(boxInfo.Select(x => x.ContainerCode).ToList());
|
// 查找已绑定库存,没有,跳过
|
||||||
}
|
var invList = _unitWork.Find<Inventory>(x => x.ContainerCode.Equals(inData.BoxName))
|
||||||
return JsonMore(null);
|
.ToList();
|
||||||
}
|
if (invList.Count == 0) continue;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 扫描散料箱
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="boxCode"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost]
|
|
||||||
public ActionResult ScanBox(string boxCode)
|
|
||||||
{
|
|
||||||
// 判断任务重复
|
|
||||||
if (_unitWork.IsExit<TaskHeader>(x => x.ZoneCode.Equals(ZoneCodeEnum.散料库) && x.ContainerCode.Equals(boxCode)))
|
|
||||||
{
|
|
||||||
return JsonMore(null, 500, $"库内已存在{boxCode}的任务,请勿重复操作!");
|
|
||||||
};
|
|
||||||
// 判断箱号是否合理
|
|
||||||
var box = _unitWork.FindSingle<Location>(x => x.ContainerCode.Equals(boxCode));
|
|
||||||
if (box != null)
|
|
||||||
{
|
|
||||||
if (box.Type != LocationTypeEnum.散料库站台)
|
|
||||||
{
|
|
||||||
return JsonMore(null, 500, $"{boxCode}不在站台,无法入库!");
|
|
||||||
}
|
|
||||||
return JsonMore(null);
|
|
||||||
}
|
|
||||||
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 inventory = new Inventory
|
|
||||||
{
|
|
||||||
ZoneCode = ZoneCodeEnum.散料库,
|
|
||||||
UniqueCode = item.UniqueCode,
|
|
||||||
Qty = item.BindQty,
|
|
||||||
Lot = item.Size.ToString(),
|
|
||||||
ContainerCode = item.BoxCode,
|
|
||||||
TaskStatus = InventoryTaskStatus.任务中
|
|
||||||
};
|
|
||||||
_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))){
|
|
||||||
return JsonMore(null, 500, $"库内已存在{boxCode}的任务,请勿重复操作!");
|
|
||||||
};
|
|
||||||
// 判断箱号是否合理
|
|
||||||
var box = _unitWork.FindSingle<Location>(x => x.ContainerCode.Equals(boxCode));
|
|
||||||
if (box != null)
|
|
||||||
{
|
|
||||||
if(box.Type != LocationTypeEnum.散料库站台)
|
|
||||||
{
|
|
||||||
return JsonMore(null, 500, $"{boxCode}不在站台,无法入库!");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// 查找目标库位
|
|
||||||
var toLocation = _unitWork.FindSingle<Location>(x => x.Status.Equals(LocationStatus.空仓位)
|
|
||||||
&& x.Type.Equals(LocationTypeEnum.散料库位)
|
|
||||||
&& x.Row.Equals(box.Row));
|
|
||||||
|
|
||||||
if (toLocation != null)
|
|
||||||
{
|
|
||||||
// 创建任务
|
|
||||||
var task = new TaskHeader
|
var task = new TaskHeader
|
||||||
{
|
{
|
||||||
ZoneCode = ZoneCodeEnum.散料库,
|
TaskNo = _unitWork.GetSerialNumber("pin", 4),
|
||||||
TaskNo = _unitWork.GetSerialNumber("CIn"),
|
TaskType = TaskTypeEnum.盘料入库,
|
||||||
TaskType = TaskTypeEnum.散料盒入库,
|
Status = TaskStatusEnum.待下发,
|
||||||
ContainerCode = boxCode,
|
FromLocation = inData.Station == "1" ? "L01": "L02",
|
||||||
FromLocation = box.Code,
|
TaskDetails = new List<TaskDetail>(),
|
||||||
ToLocation = toLocation.Code,
|
};
|
||||||
|
foreach(var item in invList)
|
||||||
|
{
|
||||||
|
var detail = new TaskDetail
|
||||||
|
{
|
||||||
|
UniqueCode = item.UniqueCode,
|
||||||
|
FromLocation = item.Lot,
|
||||||
Status = TaskStatusEnum.新建,
|
Status = TaskStatusEnum.新建,
|
||||||
CreateBy = Wtm.LoginUserInfo.ITCode,
|
|
||||||
CreateTime = DateTime.Now
|
CreateTime = DateTime.Now
|
||||||
};
|
};
|
||||||
|
task.TaskDetails.Add(detail);
|
||||||
|
}
|
||||||
_unitWork.Add(task);
|
_unitWork.Add(task);
|
||||||
|
}
|
||||||
|
return JsonMore(null);
|
||||||
|
}
|
||||||
|
|
||||||
toLocation.Status = LocationStatus.任务锁;
|
public class InData
|
||||||
toLocation.Length = isFull ? 1 : 0; // 是否满盘
|
|
||||||
_unitWork.Update(toLocation);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
return JsonMore(null, 500, $"库内无可用仓位,无法入库!");
|
public string BoxName { get; set; }
|
||||||
}
|
public string Station { get; set; }
|
||||||
}
|
|
||||||
return JsonMore(data: null);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return JsonMore(null, 500, $"{boxCode}不正确!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -81,232 +81,49 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.selectData = val;
|
this.selectData = val;
|
||||||
|
let names = this.selectData.map(item => item["station"]);
|
||||||
|
let nameSet = new Set(names);
|
||||||
|
|
||||||
|
if (nameSet.size != names.length) {
|
||||||
|
this.$message({
|
||||||
|
message: "站台不能重复!",
|
||||||
|
type: "warning",
|
||||||
|
duration: "5000",
|
||||||
|
});
|
||||||
|
this.$refs.multipleTable.clearSelection();
|
||||||
|
this.selectData = [];
|
||||||
|
}
|
||||||
console.log(this.selectData);
|
console.log(this.selectData);
|
||||||
},
|
},
|
||||||
// 呼叫料箱
|
// 启动入库
|
||||||
callBox() {
|
inOperation() {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
if (_this.selectData = []) {
|
||||||
|
this.$message({
|
||||||
|
message: "必须一行!",
|
||||||
|
type: "warning",
|
||||||
|
duration: "5000",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "post",
|
type: "post",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: {},
|
data: { data: _this.selectData },
|
||||||
url: "/receipt/ReceiptSLIn/CallBox",
|
url: "/receipt/ReceiptInOperation/InOperation",
|
||||||
success: function (json) {
|
success: function (json) {
|
||||||
if (json.Code == 200) {
|
if (json.Code == 200) {
|
||||||
_this.$message({
|
_this.$message({
|
||||||
message: "呼叫成功!",
|
message: "启动成功!",
|
||||||
});
|
type: "success",
|
||||||
// _this.resetForm('form');
|
|
||||||
} else {
|
|
||||||
_this.$message({
|
|
||||||
message: "呼叫失败!" + json.Msg,
|
|
||||||
type: "warning",
|
|
||||||
duration: "10000",
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function (json) {
|
error: function (json) {
|
||||||
_this.$message({
|
alert("加载失败");
|
||||||
message: "呼叫失败!",
|
}
|
||||||
type: "error",
|
|
||||||
duration: "10000",
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// 扫描散料箱
|
|
||||||
scanBox(data) {
|
|
||||||
var _this = this;
|
|
||||||
$.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 {
|
|
||||||
_this.$refs.uniqueCode.focus();
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
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 = [];
|
|
||||||
} 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.boxSize = [];
|
|
||||||
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,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function (json) {
|
|
||||||
_this.$message({
|
|
||||||
message: "扫描失败!",
|
|
||||||
type: "error",
|
|
||||||
duration: "10000",
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
this.form.uniqueCode = "";
|
|
||||||
},
|
|
||||||
// 删除已绑定行
|
|
||||||
deleteRow(index, rows) {
|
|
||||||
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.code == "") {
|
|
||||||
_this.$message({
|
|
||||||
message: "箱号为空,不能创建回库任务!",
|
|
||||||
type: "error",
|
|
||||||
duration: "1000",
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$.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');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function (json) {
|
|
||||||
_this.$message({
|
|
||||||
message: "回库任务创建失败!",
|
|
||||||
type: "error",
|
|
||||||
duration: "10000",
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
Reference in new issue
Block a user