力阔现场出入库流程
agv任务下发 修改部分实体类错误和页面字段等 layout 添加条码库 添加容器逻辑修改
This commit is contained in:
1 parent
345b5a3d5b
commit
b4632cfc33
29 files changed
+618
-849
No files matched your search
@@ -1,3 +1,5 @@
|
||||
using System;
|
||||
using HHWMS.Web.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
using WalkingTec.Mvvm.Mvc;
|
||||
@@ -5,14 +7,14 @@ using WalkingTec.Mvvm.Mvc;
|
||||
namespace HHWMS.Web.Controllers
|
||||
{
|
||||
[Area("receipt")]
|
||||
[ActionDescription("盘料操作")]
|
||||
[ActionDescription("入库操作")]
|
||||
public partial class ReceiptInController : BaseController
|
||||
{
|
||||
private readonly IUnitWork _unitWork;
|
||||
|
||||
public ReceiptInController(IUnitWork unitwork)
|
||||
public ReceiptInController(IUnitWork unitWork)
|
||||
{
|
||||
_unitWork = unitwork;
|
||||
_unitWork = unitWork;
|
||||
}
|
||||
|
||||
#region Index
|
||||
@@ -24,5 +26,77 @@ namespace HHWMS.Web.Controllers
|
||||
}
|
||||
|
||||
#endregion Index
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult TaskIn(string containerCode)
|
||||
{
|
||||
// 判断containerCode是否为空
|
||||
if (string.IsNullOrEmpty(containerCode))
|
||||
{
|
||||
return JsonMore(null, 500, "容器编码为空!请检查后重新提交!");
|
||||
}
|
||||
// 查询container表code为containercode的值
|
||||
var container = _unitWork.FindSingle<Container>(u => u.Code == containerCode);
|
||||
if (container == null)
|
||||
{
|
||||
return JsonMore(null, 500, $"库内没有编码为 {containerCode} 的容器!");
|
||||
}
|
||||
|
||||
container.IsLock = ContainerLockEnum.任务锁;
|
||||
container.UpdateTime = DateTime.Now;
|
||||
container.UpdateBy = Wtm.LoginUserInfo?.ITCode??"WMS";
|
||||
_unitWork.Update(container);
|
||||
|
||||
//查询location表的一个空库位 更新仓位状态为锁定
|
||||
var location = _unitWork.FindSingle<Location>(u => u.Status == LocationStatus.空仓位);
|
||||
// 判断location是否为空
|
||||
if (location == null)
|
||||
{
|
||||
return JsonMore(null, 500, "库内没有空闲仓位!");
|
||||
}
|
||||
location.Status = LocationStatus.任务锁;
|
||||
location.UpdateTime = DateTime.Now;
|
||||
location.UpdateBy = Wtm.LoginUserInfo?.ITCode??"WMS";
|
||||
_unitWork.Update(location);
|
||||
|
||||
//创建容器编码为containercode的任务
|
||||
var task = new TaskHeader
|
||||
{
|
||||
ZoneCode = ZoneCodeEnum.立库,
|
||||
TaskNo = _unitWork.GetSerialNumber("In"),
|
||||
TaskType = TaskTypeEnum.立库入库,
|
||||
ContainerCode = containerCode,
|
||||
FromLocation = "",
|
||||
ToLocation = location.Code,
|
||||
Status = TaskStatusEnum.待下发,
|
||||
CreateBy = Wtm.LoginUserInfo?.ITCode??"WMS",
|
||||
CreateTime = DateTime.Now
|
||||
};
|
||||
_unitWork.Add(task);
|
||||
|
||||
// 下发任务到wcs
|
||||
var postData = new
|
||||
{
|
||||
TaskNo = task.TaskNo,
|
||||
PalletNo = task.ContainerCode,
|
||||
FromLocation = task.FromLocation,
|
||||
ToLocation = task.ToLocation
|
||||
};
|
||||
var res1 = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, postData);
|
||||
var res = res1.Result.Data;
|
||||
if (res.Success)
|
||||
{
|
||||
task.Status = TaskStatusEnum.已下发;
|
||||
}
|
||||
else
|
||||
{
|
||||
task.ErrorMsg = res.Msg;
|
||||
}
|
||||
task.UpdateTime = DateTime.Now;
|
||||
task.UpdateBy = "WMS";
|
||||
_unitWork.Update(task);
|
||||
|
||||
return JsonMore(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,342 +1,56 @@
|
||||
<el-row id="plapp" :gutter="20">
|
||||
<el-col :span="6">
|
||||
<el-card class="box-card" :span="8">
|
||||
<el-select v-model="value" clearable filterable placeholder="请选择单据" size="big" style="width:100%"
|
||||
@@change="changeselect" @@clear="clearReceipt">
|
||||
<el-option v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
||||
<el-table :data="tableData" height="700" border
|
||||
style="width: 100%">
|
||||
<el-table-column prop="name"
|
||||
label="唯一码"
|
||||
align="center">
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="18">
|
||||
<el-card class="box-card" :span="16">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="单据名称">
|
||||
<el-input v-model="form.code" readonly></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="周转箱编码" prop="boxCode">
|
||||
<el-input v-model="form.boxCode" @@change="scanBox" ref="boxCode"></el-input>
|
||||
</el-form-item>
|
||||
<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 form.boxSize"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="唯一码" prop="uniqueCode">
|
||||
<el-input v-model="form.uniqueCode" @@change="scanUniqueCode" ref="uniqueCode"></el-input>
|
||||
</el-form-item>
|
||||
<el-table :data="bindingData"
|
||||
ref="tableData"
|
||||
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="receiptCode" v-if="false"></el-table-column>
|
||||
<el-table-column label="周转箱" align="center" prop="boxCode"></el-table-column>
|
||||
<el-table-column label="索引" align="center" prop="index"></el-table-column>
|
||||
<el-table-column label="唯一码" align="center" prop="uniqueCode"></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="primary" @@click="inOperation">启动入库</el-button> *@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<div id="receiptin">
|
||||
<a-space direction="vertical" fill>
|
||||
<a-input :style="{width:'320px'}" placeholder="扫描箱号" v-model="ContainerCode" allow-clear/>
|
||||
<a-button @@click="handleClick"
|
||||
:loading="loading1"
|
||||
type="primary">
|
||||
入库
|
||||
</a-button>
|
||||
</a-space>
|
||||
</div>
|
||||
<script>
|
||||
var app = new Vue({
|
||||
el: '#plapp',
|
||||
data() {
|
||||
var validatePass = (rule, value, callback) => {
|
||||
if (value === '') {
|
||||
callback(new Error('请输入工位编码'));
|
||||
}
|
||||
else if (value == 'L01' || value == 'L02') {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error('请输入正确工位编码'));
|
||||
}
|
||||
};
|
||||
const { createApp, reactive, ref } = Vue
|
||||
|
||||
return {
|
||||
form: {
|
||||
code: '',
|
||||
boxCode: '',
|
||||
boxSize: [],
|
||||
size: '',
|
||||
uniqueCode: ''
|
||||
},
|
||||
options: [],
|
||||
value: '',
|
||||
tableData: [],
|
||||
bindingData: [],
|
||||
dataIndex: [],
|
||||
rules: {
|
||||
boxCode: [
|
||||
{ validator: validatePass, trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
// 获取所有单据编码
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {},
|
||||
url: "/receipt/ReceiptIn/SelectReceiptCode",
|
||||
success: function (json) {
|
||||
app.options = json.Data;
|
||||
},
|
||||
error: function (json) {
|
||||
alert("加载失败");
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
sizeFormatter(row) {
|
||||
return row.size + 'mm';
|
||||
},
|
||||
//绑定单据
|
||||
onSubmit() {
|
||||
var _this = this;
|
||||
|
||||
// 提交已绑定数据
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: { data: _this.bindingData },
|
||||
url: "/receipt/ReceiptIn/BindingData",
|
||||
success: function (json) {
|
||||
if (json.Code == 200) {
|
||||
_this.$message({
|
||||
message: '入库成功!',
|
||||
type: 'success'
|
||||
});
|
||||
_this.resetForm('form');
|
||||
}
|
||||
else {
|
||||
_this.$message({
|
||||
message: '入库失败!',
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function (json) {
|
||||
_this.$message({
|
||||
message: '入库失败!',
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
resetForm(formName) {
|
||||
this.$refs[formName].resetFields();
|
||||
this.form.boxSize = [];
|
||||
this.bindingData = [];
|
||||
},
|
||||
clearReceipt() {
|
||||
this.tableData = [];
|
||||
},
|
||||
// 选择单据后,查询明细
|
||||
changeselect(data) {
|
||||
var _this = this;
|
||||
_this.form.code = data;
|
||||
// 调用后台方法,查询单据明细数据
|
||||
if (data != "") {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: { Code: data },
|
||||
url: "/receipt/ReceiptIn/SelectReceipt",
|
||||
success: function (json) {
|
||||
_this.tableData = json.Data;
|
||||
// 对比待绑定列表,删除在其表内的明细
|
||||
_this.bindingData.forEach(function (item) {
|
||||
_this.tableData.forEach(function (value, index, arr) {
|
||||
if (value.name == item.uniqueCode) {
|
||||
arr.splice(index, 1);
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
error: function (json) {
|
||||
_this.$message({
|
||||
message: '加载单据明细失败!',
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
// 扫描周转箱
|
||||
scanBox(Box) {
|
||||
var _this = this;
|
||||
_this.form.size = '';
|
||||
_this.form.boxSize = [];
|
||||
|
||||
if (this.form.code == '') {
|
||||
this.$message({
|
||||
message: '请先选择单据!',
|
||||
type: 'warning'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: { boxCode: Box },
|
||||
url: "/receipt/ReceiptIn/ScanBox",
|
||||
success: function (json) {
|
||||
if (json.Code != 200) {
|
||||
_this.$message({
|
||||
message: "扫描失败!" + json.Msg,
|
||||
type: "warning",
|
||||
duration: "10000",
|
||||
});
|
||||
_this.form.boxCode = "";
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
_this.$message({
|
||||
message: "扫描成功!",
|
||||
type: "success",
|
||||
duration: "10000",
|
||||
});
|
||||
_this.$refs.uniqueCode.focus();
|
||||
|
||||
if (Box == "L02") {
|
||||
_this.form.boxSize = [{ label: "24mm", value: "24" }, { label: "16mm", value: "16" }, { label: "10mm", value: "10" }]
|
||||
_this.dataIndex = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
|
||||
}
|
||||
else if (Box == "L01") {
|
||||
_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, 17, 18, 19, 20];
|
||||
}
|
||||
else {
|
||||
_this.$message({
|
||||
message: '输入周转箱编码不正确!',
|
||||
type: 'warning'
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (json) {
|
||||
_this.$message({
|
||||
message: "扫描失败!",
|
||||
type: "error",
|
||||
duration: "10000",
|
||||
});
|
||||
return;
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
// 重新扫描箱号后,待绑定列表清空
|
||||
_this.bindingData = [];
|
||||
_this.changeselect(_this.value);
|
||||
|
||||
// _this.$refs.uniqueCode.focus();
|
||||
},
|
||||
// 选择尺寸后
|
||||
changeSize() {
|
||||
this.$refs.uniqueCode.focus();
|
||||
},
|
||||
// 扫描唯一码
|
||||
scanUniqueCode(data) {
|
||||
if (this.form.code == '') {
|
||||
this.$message({
|
||||
message: '请先选择单据!',
|
||||
type: 'warning'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (this.dataIndex.length == 0) {
|
||||
this.$message({
|
||||
message: '该周转箱已放满!',
|
||||
type: 'warning'
|
||||
});
|
||||
this.form.uniqueCode = '';
|
||||
return;
|
||||
}
|
||||
if (this.form.boxCode == '' || this.form.size == '') {
|
||||
this.$message({
|
||||
message: '请先输入周转箱编码并选择料盘尺寸!',
|
||||
type: 'warning'
|
||||
});
|
||||
this.form.uniqueCode = '';
|
||||
return;
|
||||
}
|
||||
var isExit = this.tableData.findIndex(function (value, index, arr) {
|
||||
return value.name == data;
|
||||
})
|
||||
if (isExit == -1) {
|
||||
this.$message({
|
||||
message: '唯一码' + data + '不正确!',
|
||||
type: 'warning'
|
||||
});
|
||||
this.form.uniqueCode = '';
|
||||
return;
|
||||
}
|
||||
// 1.明细减少
|
||||
this.tableData.forEach(function (item, index, arr) {
|
||||
if (item.name == data) {
|
||||
arr.splice(index, 1);
|
||||
}
|
||||
});
|
||||
// 2.已扫描增加
|
||||
this.bindingData.push({
|
||||
receiptCode: this.form.code,
|
||||
boxCode: this.form.boxCode,
|
||||
index: this.dataIndex.shift(),
|
||||
uniqueCode: data,
|
||||
size: this.form.size
|
||||
})
|
||||
this.form.uniqueCode = '';
|
||||
this.$nextTick(() => {
|
||||
this.$refs.tableData.bodyWrapper.scrollTop = this.$refs.tableData.bodyWrapper.scrollHeight
|
||||
})
|
||||
},
|
||||
// 删除已绑定行
|
||||
deleteRow(index, rows) {
|
||||
if (this.form.code == rows[index].receiptCode) {
|
||||
this.tableData.push({ name: rows[index].uniqueCode });
|
||||
}
|
||||
this.dataIndex.unshift(rows[index].index);
|
||||
rows.splice(index, 1);
|
||||
}
|
||||
const app = createApp({
|
||||
data() {
|
||||
return {
|
||||
ContainerCode: '',
|
||||
loading1:false,
|
||||
data: reactive([])
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleClick() {
|
||||
var _this = this;
|
||||
if (_this.ContainerCode == ""){
|
||||
_this.$message.error("请扫描箱号!");
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
_this.loading1 = !_this.loading1
|
||||
|
||||
let postData = new URLSearchParams();
|
||||
postData.append('containerCode', _this.ContainerCode);
|
||||
|
||||
axios.post("/receipt/ReceiptIn/TaskIn", postData)
|
||||
.then(function (json) {
|
||||
_this.loading1 = !_this.loading1;
|
||||
if (json.data.Code == 200){
|
||||
_this.ContainerCode = '';
|
||||
_this.$message.success("入库任务创建成功!");
|
||||
}
|
||||
else{
|
||||
_this.$message.error(json.data.Msg);
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
_this.$message.error(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
app.use(ArcoVue)
|
||||
.use(ArcoVueIcon)
|
||||
.mount('#receiptin');
|
||||
|
||||
</script>
|
||||
Reference in new issue
Block a user