修改WCS任务反馈逻辑,添加盘料入库扫描料箱号占用站台逻辑,修改盘料库启动入库逻辑,将启动入库功能迁移到盘料操作界面中,修改盘料出库料塔取料逻辑,创建出库单据分解定时器,任务下发定时器添加盘料出库任务逻辑

This commit is contained in:
霍尔 committed 2023-09-13 10:39:23 +08:00
1 parent 79d4512266
commit 1fa11ab235
11 files changed
+536 -136

No files matched your search

@@ -53,6 +53,41 @@ namespace HHWMS.Web.Controllers
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.ContainerCode.Equals(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>
@@ -73,11 +108,7 @@ namespace HHWMS.Web.Controllers
//var receipt = _unitWork.FindSingle<ReceiptDetail>(x => x.UniqueCode == item.UniqueCode);
if (receipt != null)
{
if (receipt.Status == ReceiptStatusEnum.收完) continue;
receipt.CompletedQty += item.BindQty;
}
if (receipt.CompletedQty == receipt.Qty)
{
receipt.CompletedQty = receipt.Qty;
receipt.Status = ReceiptStatusEnum.收完;
if (!header.ReceiptDetails.Any(x => x.Status < ReceiptStatusEnum.收完))
{
@@ -85,14 +116,15 @@ namespace HHWMS.Web.Controllers
_unitWork.Update(header);
}
}
_unitWork.Update(receipt);
// 新建库存
var inventory = new Inventory
{
ZoneCode = ZoneCodeEnum.盘料库,
UniqueCode = item.UniqueCode,
Flag = item.Index,
Flag = item.Size,
Qty = receipt.Qty,
Lot = item.Size.ToString(),
Lot = item.Index.ToString(),
ContainerCode = item.BoxCode,
TaskStatus = InventoryTaskStatus.任务中
};
@@ -35,36 +35,36 @@ public class ReceiptInOperationController : BaseController
/// </summary>
/// <returns></returns>
[HttpPost]
public ActionResult InOperation(List<InData> data)
public ActionResult InOperation(string boxCode)
{
// 创建盘料入库任务
foreach(var inData in data)
// 查找已绑定库存,没有,跳过
var invList = _unitWork.Find<Inventory>(x => x.ContainerCode.Equals(boxCode))
.ToList();
if (invList.Count == 0)
{
// 查找已绑定库存,没有,跳过
var invList = _unitWork.Find<Inventory>(x => x.ContainerCode.Equals(inData.BoxName))
.ToList();
if (invList.Count == 0) continue;
var task = new TaskHeader
{
TaskNo = _unitWork.GetSerialNumber("pin", 4),
TaskType = TaskTypeEnum.盘料入库,
Status = TaskStatusEnum.待下发,
FromLocation = inData.Station == "1" ? "L01": "L02",
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, 500, $"站台{boxCode}没有绑定数据,请正确操作!");
}
var task = new TaskHeader
{
TaskNo = _unitWork.GetSerialNumber("pin", 4),
TaskType = TaskTypeEnum.盘料入库,
Status = TaskStatusEnum.待下发,
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);
}
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
using HHWMS.Web.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
@@ -63,11 +64,15 @@ public class ReceiptSLInController : BaseController
ContainerCode = box.ContainerCode,
FromLocation = box.Code,
ToLocation = toLocation,
Status = TaskStatusEnum.新建,
Status = TaskStatusEnum.待下发,
CreateTime = DateTime.Now,
CreateBy = Wtm.LoginUserInfo.ITCode
};
_unitWork.Add(task);
//更新起点仓位状态
box.Status = LocationStatus.任务锁;
_unitWork.Update(box);
return JsonMore(null);
}
@@ -175,7 +180,8 @@ public class ReceiptSLInController : BaseController
public ActionResult BoxBack(string boxCode, bool isFull)
{
// 判断任务重复
if(!_unitWork.IsExit<TaskHeader>(x => x.ZoneCode.Equals(ZoneCodeEnum.散料库) && x.ContainerCode.Equals(boxCode))){
if (_unitWork.IsExit<TaskHeader>(x => x.ZoneCode.Equals(ZoneCodeEnum.散料库) && x.ContainerCode.Equals(boxCode)))
{
return JsonMore(null, 500, $"库内已存在{boxCode}的任务,请勿重复操作!");
};
// 判断箱号是否合理
@@ -188,10 +194,8 @@ public class ReceiptSLInController : BaseController
}
else
{
// 查找目标库位
var toLocation = _unitWork.FindSingle<Location>(x => x.Status.Equals(LocationStatus.空仓位)
&& x.Type.Equals(LocationTypeEnum.散料库位)
&& x.Row.Equals(box.Row));
// 查找目标库位,托盘回原库位
var toLocation = _unitWork.FindSingle<Location>(x => x.Code.Equals(boxCode));
if (toLocation != null)
{
@@ -204,7 +208,7 @@ public class ReceiptSLInController : BaseController
ContainerCode = boxCode,
FromLocation = box.Code,
ToLocation = toLocation.Code,
Status = TaskStatusEnum.新建,
Status = TaskStatusEnum.待下发,
CreateBy = Wtm.LoginUserInfo.ITCode,
CreateTime = DateTime.Now
};
@@ -63,6 +63,7 @@
<el-form-item style="float:right">
<el-button type="primary" @@click="onSubmit">绑定</el-button>
<el-button @@click="resetForm('form')">重置</el-button>
<el-button type="primary" @@click="inOperation">启动入库</el-button>
</el-form-item>
</el-form>
</el-card>
@@ -75,12 +76,12 @@
data() {
var validatePass = (rule, value, callback) => {
if (value === '') {
callback(new Error('请输入周转箱编码'));
callback(new Error('请输入工位编码'));
}
else if (value == 'M00000001' || value == 'M00000002' || value == 'E00000001' || value == 'E00000002') {
else if (value == 'L01' || value == 'L02') {
callback();
} else {
callback(new Error('请输入正确周转箱编码'));
callback(new Error('请输入正确工位编码'));
}
};
@@ -123,6 +124,7 @@
sizeFormatter(row) {
return row.size + 'mm';
},
//绑定单据
onSubmit() {
var _this = this;
@@ -154,6 +156,35 @@
}
});
},
// 启动入库
inOperation() {
var _this = this;
console.log(_this);
$.ajax({
type: "post",
dataType: "json",
data: { data: this.form.boxCode },
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: "10000",
});
}
},
error: function (json) {
alert("加载失败");
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.form.boxSize = [];
@@ -196,29 +227,55 @@
},
// 扫描周转箱
scanBox(data) {
this.form.size = '';
this.form.boxSize = [];
if (data == "M00000001" || data == "M00000002") {
this.form.boxSize = [{ label: "8mm", value: "8" }]
this.form.size = this.form.boxSize[0].value;
this.dataIndex = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
var _this = this;
_this.form.size = '';
_this.form.boxSize = [];
if (data == "L02") {
_this.form.boxSize = [{ label: "8mm", value: "8" }]
_this.form.size = _this.form.boxSize[0].value;
_this.dataIndex = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
}
else if (data == "E00000001" || data == "E00000002") {
this.form.boxSize = [{ label: "10mm", value: "10" }, { label: "16mm", value: "16" }, { label: "24mm", value: "24" }];
this.dataIndex = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20];
else if (data == "L01") {
_this.form.boxSize = [{ label: "10mm", value: "10" }, { label: "16mm", value: "16" }, { label: "24mm", value: "24" }];
_this.dataIndex = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20];
}
else {
this.$message({
_this.$message({
message: '输入周转箱编码不正确!',
type: 'warning'
});
return;
}
$.ajax({
type: "post",
dataType: "json",
data: { boxCode: data },
url: "/receipt/ReceiptIn/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",
});
},
});
// 重新扫描箱号后,待绑定列表清空
this.bindingData = [];
this.changeselect(this.value);
_this.bindingData = [];
_this.changeselect(_this.value);
this.$refs.uniqueCode.focus();
_this.$refs.uniqueCode.focus();
},
// 选择尺寸后
changeSize() {
@@ -8,13 +8,7 @@
<el-table-column prop="boxName" label="周转箱" align="center">
</el-table-column>
<el-table-column label="工位" align="center" prop="station">
<template slot-scope="scope">
<el-select v-model="scope.row.station" size="medium" style="width:100%">
<el-option v-for="item in station" :key="item.label" :label="item.label" :value="item.value">
</el-option>
</el-select>
</template>
<el-table-column label="工位" align="center" prop="label">
</el-table-column>
</el-table>
<div style="margin-top: 20px">
@@ -28,26 +22,17 @@
el: "#opapp",
data() {
return {
station: [
{
label: 'left',
value: 1,
},
{
label: 'right',
value: 3,
},
],
// 表格数据
tableData: [
{
boxName: 'M00000001',
station: '',
boxName: 'L01',
label: '左侧',
station: '3',
},
{
boxName: 'E00000001',
station: '',
boxName: 'L02',
label: '右侧',
station: '1',
},
],
selectData: []
@@ -70,6 +55,7 @@
},
methods: {
handleSelectionChange(val) {
console.log(22);
val.forEach(row => {
if (row.station == '') {
this.$refs.multipleTable.toggleRowSelection(row);
@@ -97,19 +83,22 @@
},
// 启动入库
inOperation() {
console.log(this.tableData)
var _this = this;
if (_this.selectData = []) {
this.$message({
message: "必须一行!",
type: "warning",
duration: "5000",
});
return;
for (var i = 0; i < _this.tableData.length; i++) {
if (_this.tableData[i].station == null || _this.tableData[i].station == "") {
this.$message({
message: "必须全部选择!",
type: "warning",
duration: "5000",
});
return;
}
}
$.ajax({
type: "post",
dataType: "json",
data: { data: _this.selectData },
data: { data: _this.tableData },
url: "/receipt/ReceiptInOperation/InOperation",
success: function (json) {
if (json.Code == 200) {