新增 vue vue-element 组件,用户开发操作复杂页面
新增散料,修改盘料入库逻辑
This commit is contained in:
1 parent
eeafb20012
commit
630e33a27a
726 files changed
+281372
-151
No files matched your search
@@ -14,7 +14,7 @@ using System.Collections.Generic;
|
||||
namespace HHWMS.Web.Controllers
|
||||
{
|
||||
[Area("receipt")]
|
||||
[ActionDescription("入库单操作")]
|
||||
[ActionDescription("盘料操作")]
|
||||
public partial class ReceiptInController : BaseController
|
||||
{
|
||||
private readonly IUnitWork _unitwork;
|
||||
@@ -26,20 +26,9 @@ namespace HHWMS.Web.Controllers
|
||||
[ActionDescription("Sys.Search")]
|
||||
public ActionResult Index()
|
||||
{
|
||||
var vm = Wtm.CreateVM<ReceiptInListVM>();
|
||||
return PartialView(vm);
|
||||
return PartialView("Index");
|
||||
}
|
||||
|
||||
/* [ActionDescription("Sys.Search")]
|
||||
[HttpPost]
|
||||
public string Search(ReceiptDetailListVM vm)
|
||||
{
|
||||
vm.Searcher.Page = vm.FC.GetValue<int>("Page");
|
||||
vm.Searcher.Limit = vm.FC.GetValue<int>("Limit");
|
||||
vm.Searcher.ReceiptHeaderId = vm.FC.GetValue<int>("Code");
|
||||
return vm.GetJson(false);
|
||||
}*/
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult<dynamic> SelectReceiptCode()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
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;
|
||||
|
||||
namespace HHWMS.Web.Controllers
|
||||
{
|
||||
[Area("receipt")]
|
||||
[ActionDescription("散料操作")]
|
||||
public partial 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
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using HHWMS.Web.Models;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
using Z.EntityFramework.Plus;
|
||||
|
||||
namespace HHWMS.Web
|
||||
{
|
||||
public partial class ReceiptInVM : BaseCRUDVM<ReceiptHeader>
|
||||
{
|
||||
public ReceiptDetailListVM2 Details = new ReceiptDetailListVM2();
|
||||
public ReceiptInVM()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void InitVM()
|
||||
{
|
||||
Details.CopyContext(this);
|
||||
Details.Searcher.ReceiptHeaderId = Entity.ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using HHWMS.Web.Models;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
using WalkingTec.Mvvm.Core.Extensions;
|
||||
|
||||
namespace HHWMS.Web
|
||||
{
|
||||
public partial class ReceiptInListVM : BasePagedListVM<ReceiptDetail_View, ReceiptInSearcher>
|
||||
{
|
||||
public ReceiptDetailListVM2 Details { get; set; } = new ReceiptDetailListVM2();
|
||||
public List<ComboSelectListItem> Codes { get; set; }
|
||||
protected override void InitVM()
|
||||
{
|
||||
Details.CopyContext(this);
|
||||
Codes = DC.Set<ReceiptHeader>().Select(x => new ComboSelectListItem
|
||||
{
|
||||
Text = x.Code,
|
||||
Value = x.ID
|
||||
}).ToList();
|
||||
}
|
||||
protected override List<GridAction> InitGridAction()
|
||||
{
|
||||
return new List<GridAction>();
|
||||
/*{
|
||||
this.MakeStandardAction("ReceiptHeader", GridActionStandardTypesEnum.Create, Localizer["Sys.Create"],"receipt", dialogWidth: 800),
|
||||
this.MakeStandardAction("ReceiptHeader", GridActionStandardTypesEnum.Edit, Localizer["Sys.Edit"], "receipt", dialogWidth: 800),
|
||||
this.MakeStandardAction("ReceiptHeader", GridActionStandardTypesEnum.Delete, Localizer["Sys.Delete"], "receipt", dialogWidth: 800),
|
||||
this.MakeStandardAction("ReceiptHeader", GridActionStandardTypesEnum.Details, Localizer["Sys.Details"], "receipt", dialogWidth: 800),
|
||||
this.MakeStandardAction("ReceiptHeader", GridActionStandardTypesEnum.BatchEdit, Localizer["Sys.BatchEdit"], "receipt", dialogWidth: 800),
|
||||
this.MakeStandardAction("ReceiptHeader", GridActionStandardTypesEnum.BatchDelete, Localizer["Sys.BatchDelete"], "receipt", dialogWidth: 800),
|
||||
this.MakeStandardAction("ReceiptHeader", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "receipt", dialogWidth: 800),
|
||||
this.MakeStandardAction("ReceiptHeader", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "receipt"),
|
||||
};*/
|
||||
}
|
||||
|
||||
protected override IEnumerable<IGridColumn<ReceiptDetail_View>> InitGridHeader()
|
||||
{
|
||||
return new List<GridColumn<ReceiptDetail_View>>{
|
||||
this.MakeGridHeader(x => x.MaterialCode)
|
||||
};
|
||||
}
|
||||
|
||||
public override IOrderedQueryable<ReceiptDetail_View> GetSearchQuery()
|
||||
{
|
||||
var query = DC.Set<ReceiptDetail>()
|
||||
.Where(x => x.ReceiptHeaderId.Equals(Searcher.ReceiptHeaderId))
|
||||
.Select(x => new ReceiptDetail_View
|
||||
{
|
||||
ID = x.ID,
|
||||
MaterialCode = x.MaterialCode
|
||||
})
|
||||
.OrderBy(x => x.ID);
|
||||
return query;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using HHWMS.Web.Models;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
|
||||
namespace HHWMS.Web
|
||||
{
|
||||
public partial class ReceiptInSearcher : BaseSearcher
|
||||
{
|
||||
[Display(Name = "Inventory.ReceiptCode")]
|
||||
public int ReceiptHeaderId { get; set; }
|
||||
|
||||
[Display(Name = "Inventory.SourceCode")]
|
||||
public String SourceCode { get; set; }
|
||||
|
||||
[Display(Name = "Inventory.ReceiptCode")]
|
||||
public String Code { get; set; }
|
||||
|
||||
[Display(Name = "Inventory.BoxCode")]
|
||||
public String BoxCode { get; set; }
|
||||
|
||||
[Display(Name = "Inventory.Size")]
|
||||
public String Size { get; set; }
|
||||
|
||||
[Display(Name = "Inventory.UniqueCode")]
|
||||
public String UniqueCode { get; set; }
|
||||
|
||||
[Display(Name = "Inventory.BillType")]
|
||||
public String BillType { get; set; }
|
||||
|
||||
[Display(Name = "Receipt.FirstStatus")]
|
||||
public ReceiptStatusEnum? FirstStatus { get; set; }
|
||||
|
||||
[Display(Name = "Receipt.LastStatus")]
|
||||
public ReceiptStatusEnum? LastStatus { get; set; }
|
||||
|
||||
protected override void InitVM()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
<el-row id="app" :gutter="20">
|
||||
<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">
|
||||
@@change="changeselect" @@clear="clearReceipt">
|
||||
<el-option v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
<script>
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
el: '#plapp',
|
||||
data() {
|
||||
var validatePass = (rule, value, callback) => {
|
||||
if (value === '') {
|
||||
@@ -83,7 +83,7 @@
|
||||
callback(new Error('请输入正确周转箱编码'));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return {
|
||||
form: {
|
||||
code: '',
|
||||
@@ -96,7 +96,7 @@
|
||||
value: '',
|
||||
tableData: [],
|
||||
bindingData: [],
|
||||
dataIndex:[],
|
||||
dataIndex: [],
|
||||
rules: {
|
||||
boxCode: [
|
||||
{ validator: validatePass, trigger: 'blur' }
|
||||
@@ -104,12 +104,12 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted: function() {
|
||||
mounted: function () {
|
||||
// 获取所有单据编码
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data:{},
|
||||
data: {},
|
||||
url: "/receipt/ReceiptIn/SelectReceiptCode",
|
||||
success: function (json) {
|
||||
app.options = json.Data;
|
||||
@@ -125,9 +125,7 @@
|
||||
},
|
||||
onSubmit() {
|
||||
var _this = this;
|
||||
console.log('submit!');
|
||||
console.log(this.form);
|
||||
|
||||
|
||||
// 提交已绑定数据
|
||||
$.ajax({
|
||||
type: "post",
|
||||
@@ -141,7 +139,7 @@
|
||||
});
|
||||
_this.resetForm('form');
|
||||
}
|
||||
else{
|
||||
else {
|
||||
_this.$message({
|
||||
message: '绑定失败!',
|
||||
type: 'warning'
|
||||
@@ -161,6 +159,9 @@
|
||||
this.form.boxSize = [];
|
||||
this.bindingData = [];
|
||||
},
|
||||
clearReceipt() {
|
||||
this.tableData = [];
|
||||
},
|
||||
// 选择单据后,查询明细
|
||||
changeselect(data) {
|
||||
var _this = this;
|
||||
@@ -194,7 +195,7 @@
|
||||
}
|
||||
},
|
||||
// 扫描周转箱
|
||||
scanBox(data){
|
||||
scanBox(data) {
|
||||
this.form.size = '';
|
||||
this.form.boxSize = [];
|
||||
if (data == "M00000001" || data == "M00000002") {
|
||||
@@ -213,6 +214,10 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 重新扫描箱号后,待绑定列表清空
|
||||
this.bindingData = [];
|
||||
this.changeselect(this.value);
|
||||
|
||||
this.$refs.uniqueCode.focus();
|
||||
},
|
||||
// 选择尺寸后
|
||||
@@ -242,7 +247,7 @@
|
||||
})
|
||||
if (isExit == -1) {
|
||||
this.$message({
|
||||
message: '唯一码'+ data + '不正确!',
|
||||
message: '唯一码' + data + '不正确!',
|
||||
type: 'warning'
|
||||
});
|
||||
this.form.uniqueCode = '';
|
||||
@@ -259,7 +264,7 @@
|
||||
receiptCode: this.form.code,
|
||||
boxCode: this.form.boxCode,
|
||||
index: this.dataIndex.shift(),
|
||||
uniqueCode : data,
|
||||
uniqueCode: data,
|
||||
size: this.form.size
|
||||
})
|
||||
this.form.uniqueCode = '';
|
||||
@@ -272,6 +277,6 @@
|
||||
this.dataIndex.unshift(rows[index].index);
|
||||
rows.splice(index, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,280 @@
|
||||
<el-row id="slapp" :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"></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" 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-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<script>
|
||||
var app = new Vue({
|
||||
el: '#slapp',
|
||||
data() {
|
||||
var validatePass = (rule, value, callback) => {
|
||||
if (value === '') {
|
||||
callback(new Error('请输入周转箱编码'));
|
||||
}
|
||||
else if (value == 'M00000001' || value == 'M00000002' || value == 'E00000001' || value == 'E00000002') {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error('请输入正确周转箱编码'));
|
||||
}
|
||||
};
|
||||
|
||||
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;
|
||||
console.log('submit!');
|
||||
console.log(this.form);
|
||||
|
||||
// 提交已绑定数据
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: { data: _this.bindingData },
|
||||
url: "/receipt/ReceiptIn/BindingData",
|
||||
success: function (json) {
|
||||
if (json.Success) {
|
||||
_this.$message({
|
||||
message: '绑定成功!'
|
||||
});
|
||||
_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);
|
||||
}
|
||||
});
|
||||
})
|
||||
console.log(json.Data);
|
||||
},
|
||||
error: function (json) {
|
||||
_this.$message({
|
||||
message: '加载单据明细失败!',
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
// 扫描周转箱
|
||||
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];
|
||||
}
|
||||
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 {
|
||||
this.$message({
|
||||
message: '输入周转箱编码不正确!',
|
||||
type: 'warning'
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.$refs.uniqueCode.focus();
|
||||
},
|
||||
// 选择尺寸后
|
||||
changeSize() {
|
||||
this.$refs.uniqueCode.focus();
|
||||
},
|
||||
// 扫描唯一码
|
||||
scanUniqueCode(data) {
|
||||
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 = '';
|
||||
},
|
||||
// 删除已绑定行
|
||||
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);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
Reference in new issue
Block a user