卷料退库

明细拆分loading
This commit is contained in:
zgf committed 2024-02-05 12:04:42 +08:00
1 parent 43146db587
commit 8f8b558b46
4 files changed
+335 -237

No files matched your search

+311 -234
View File
@@ -1,57 +1,65 @@
<div id="print4">
<el-form ref="form" :inline="true" :model="form" size="mini" label-width="100px">
<el-row>
<el-switch v-model="tk"
active-text="退库"
inactive-text="新入库">
</el-switch>
<el-divider></el-divider>
<el-row v-show="!tk">
<el-form-item label="仓库">
<el-select v-model="form.ck" :popper-append-to-body="false" placeholder="仓库">
<el-option v-for="item in ckList"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-button type="primary" size="small" @@click="createjh">生成卷号</el-button>
<el-col :span="24">
<el-form-item label="仓库">
<el-select v-model="form.ck" :popper-append-to-body="false" placeholder="仓库">
<el-option v-for="item in ckList"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-button type="primary" size="small" @@click="createjh">生成卷号</el-button>
<el-col :span="24">
<el-form-item label="厂家">
<el-input v-model="form.cj" placeholder="厂家" @@keyup.enter.native="splitCJ()">
</el-input>
</el-form-item>
@* <el-form-item label="卷号">
<el-input v-model="form.jh" @@keyup.enter.native="splitJH()"
placeholder="卷号">
<el-form-item label="厂家">
<el-input v-model="form.cj" placeholder="厂家" @@keyup.enter.native="splitCJ()">
</el-input>
</el-form-item> *@
<el-form-item label="规格">
<el-input v-model="form.lot" @@keyup.enter.native="splitLot()"
placeholder="规格">
</el-input>
</el-form-item>
<el-form-item label="重量">
<el-input v-model="form.qty" @@keyup.enter.native="splitQty()"
placeholder="重量">
</el-input>
</el-form-item>
<el-col :span="24">
<el-form-item label="米数">
<el-input v-model="form.len" @@keyup.enter.native="splitLen()"
placeholder="米数">
</el-input>
</el-form-item>
<el-form-item label="铁损">
<el-input v-model="form.sn" @@keyup.enter.native="splitSn()"
placeholder="铁损">
</el-input>
</el-form-item>
<el-form-item label="片厚">
<el-input v-model="form.ph" @@keyup.enter.native="splitPh()"
placeholder="片厚">
</el-input>
</el-form-item>
</el-col>
</el-form-item>
<el-form-item label="规格">
<el-input v-model="form.lot" @@keyup.enter.native="splitLot()"
placeholder="规格">
</el-input>
</el-form-item>
<el-form-item label="重量">
<el-input v-model="form.qty" @@keyup.enter.native="splitQty()"
placeholder="重量">
</el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="米数">
<el-input v-model="form.len" @@keyup.enter.native="splitLen()"
placeholder="米数">
</el-input>
</el-form-item>
<el-form-item label="铁损">
<el-input v-model="form.sn" @@keyup.enter.native="splitSn()"
placeholder="铁损">
</el-input>
</el-form-item>
<el-form-item label="片厚">
<el-input v-model="form.ph" @@keyup.enter.native="splitPh()"
placeholder="片厚">
</el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-row v-show="tk">
<el-form-item label="卷号">
<el-input v-model="form.jh" @@keyup.enter.native="scanJH()"
placeholder="卷号">
</el-input>
</el-form-item>
</el-row>
</el-form>
<el-col :span="4">
<el-button type="primary" @@click="create">创建入库单</el-button>
</el-col>
@@ -59,8 +67,6 @@
<el-button type="success" @@click="print">打印</el-button>
</el-col>
<el-table :data="tableData"
max-height="600" stripe border
style="width: 100%"
@@ -78,7 +84,11 @@
<el-input size="small" v-model="scope.row.Lot"></el-input>
</template>
</el-table-column>
<el-table-column label="重量" width="150" align="center" prop="Qty"></el-table-column>
<el-table-column label="重量" width="150" align="center" prop="Qty">
<template slot-scope="scope">
<el-input size="small" v-model="scope.row.Qty"></el-input>
</template>
</el-table-column>
<el-table-column label="米数" width="150" align="center" prop="Len">
<template slot-scope="scope">
<el-input size="small" v-model="scope.row.Len"></el-input>
@@ -112,7 +122,7 @@
sn: '',
ph: ''
},
tk:false,
ckList: [
{
value: '1',
@@ -179,200 +189,267 @@
message: '取消输入'
});
});
},
// 拆解卷号
splitJH() {
var _this = this;
},
// 拆解卷号
splitJH() {
var _this = this;
if (this.form.jh != "") {
if (this.form.jh != "") {
var list = this.form.jh.trim().split(/\s+/);
var num = list.length;
if (num > 0) {
if (this.tableData.length > 0) {
this.tableData = [];
}
while (num > 0) {
if (list[list.length - num] != "") {
this.tableData.push(JSON.parse(JSON.stringify({
"Ware": this.ckList.filter(function (item) {
return item.value == _this.form.ck;
})[0].label,
"CJ": this.form.cj,
"JH": list[list.length - num],
"Qty": "",
"Len": "",
"Lot": "",
"Sn": "",
"PH": "",
"RQ": new Date().toLocaleDateString()
})));
}
num--;
}
}
}
},
// 拆解重量
splitQty() {
var _this = this;
if (this.form.qty != "") {
var list = this.form.qty.trim().split(/\s+/);
if (list.length == this.tableData.length) {
var nn = list.length - 1;
while (nn >= 0) {
_this.tableData[nn].Qty = list[nn];
nn--;
var num = list.length;
if (num > 0) {
if (this.tableData.length > 0) {
this.tableData = [];
}
while (num > 0) {
if (list[list.length - num] != "") {
this.tableData.push(JSON.parse(JSON.stringify({
"Ware": this.ckList.filter(function (item) {
return item.value == _this.form.ck;
})[0].label,
"CJ": this.form.cj,
"JH": list[list.length - num],
"Qty": "",
"Len": "",
"Lot": "",
"Sn": "",
"PH": "",
"RQ": new Date().toLocaleDateString()
})));
}
num--;
}
}
} else {
layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" });
}
}
},
// 拆解米数
splitLen() {
var _this = this;
_this.tableData.forEach(function (item) {
item.Len = _this.form.len;
})
// if (this.form.len != "") {
// var list = this.form.len.trim().split(/\s+/);
// if (list.length == this.tableData.length) {
// var nn = list.length - 1;
// while (nn >= 0) {
// _this.tableData[nn].Len = list[nn];
// nn--;
// }
// } else {
// layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" });
// }
// }
},
// 拆解规格
splitLot() {
var _this = this;
if (this.form.lot != "") {
var list = this.form.lot.trim().split(/\s+/);
if (list.length == this.tableData.length) {
var nn = list.length - 1;
while (nn >= 0) {
_this.tableData[nn].Lot = list[nn];
nn--;
},
// 拆解重量
splitQty() {
var _this = this;
if (this.form.qty != "") {
var list = this.form.qty.trim().split(/\s+/);
if (list.length == this.tableData.length) {
var nn = list.length - 1;
while (nn >= 0) {
_this.tableData[nn].Qty = list[nn];
nn--;
}
} else {
layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" });
}
} else {
layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" });
}
}
},
// 拆解铁损
splitSn() {
var _this = this;
_this.tableData.forEach(function (item) {
item.Sn = _this.form.sn;
})
// if (this.form.sn != "") {
// var list = this.form.sn.trim().split(/\s+/);
// if (list.length == this.tableData.length) {
// var nn = list.length - 1;
// while (nn >= 0) {
// _this.tableData[nn].Sn = list[nn];
// nn--;
// }
// } else {
// layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" });
// }
// }
},
// 拆解片厚
splitPh() {
var _this = this;
_this.tableData.forEach(function (item) {
item.PH = _this.form.ph;
})
// if (this.form.ph != "") {
// var list = this.form.ph.trim().split(/\s+/);
// if (list.length == this.tableData.length) {
// var nn = list.length - 1;
// while (nn >= 0) {
// _this.tableData[nn].PH = list[nn];
// nn--;
// }
// } else {
// layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" });
// }
// }
},
splitCJ() {
var _this = this;
_this.tableData.forEach(function (item) {
item.CJ = _this.form.cj;
});
},
create() {
var _this = this;
if (_this.tableData.length == 0) {
_this.$message({
message: "当前无数据!!",
type: "warning",
duration: "500",
},
// 拆解米数
splitLen() {
var _this = this;
_this.tableData.forEach(function (item) {
item.Len = _this.form.len;
})
// if (this.form.len != "") {
// var list = this.form.len.trim().split(/\s+/);
// if (list.length == this.tableData.length) {
// var nn = list.length - 1;
// while (nn >= 0) {
// _this.tableData[nn].Len = list[nn];
// nn--;
// }
// } else {
// layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" });
// }
// }
},
// 拆解规格
splitLot() {
var _this = this;
if (this.form.lot != "") {
var list = this.form.lot.trim().split(/\s+/);
if (list.length == this.tableData.length) {
var nn = list.length - 1;
while (nn >= 0) {
_this.tableData[nn].Lot = list[nn];
nn--;
}
} else {
layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" });
}
}
},
// 拆解铁损
splitSn() {
var _this = this;
_this.tableData.forEach(function (item) {
item.Sn = _this.form.sn;
})
// if (this.form.sn != "") {
// var list = this.form.sn.trim().split(/\s+/);
// if (list.length == this.tableData.length) {
// var nn = list.length - 1;
// while (nn >= 0) {
// _this.tableData[nn].Sn = list[nn];
// nn--;
// }
// } else {
// layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" });
// }
// }
},
// 拆解片厚
splitPh() {
var _this = this;
_this.tableData.forEach(function (item) {
item.PH = _this.form.ph;
})
// if (this.form.ph != "") {
// var list = this.form.ph.trim().split(/\s+/);
// if (list.length == this.tableData.length) {
// var nn = list.length - 1;
// while (nn >= 0) {
// _this.tableData[nn].PH = list[nn];
// nn--;
// }
// } else {
// layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" });
// }
// }
},
splitCJ() {
var _this = this;
_this.tableData.forEach(function (item) {
item.CJ = _this.form.cj;
});
return;
}
},
create() {
var _this = this;
if (_this.tableData.length == 0) {
_this.$message({
message: "当前无数据!!",
type: "warning",
duration: "500",
});
return;
}
// 调用后台方法,判断是否在物料表内
$.ajax({
type: "post",
dataType: "json",
data: { data: _this.tableData },
url: "/xwms/ReceiptHeader2/CreateDetail4",
success: function (json) {
if (json.Code != 200) {
// 调用后台方法,判断是否在物料表内
$.ajax({
type: "post",
dataType: "json",
data: { data: _this.tableData },
url: "/xwms/ReceiptHeader2/CreateDetail4",
success: function (json) {
if (json.Code != 200) {
_this.$message({
message: "创建失败!" + json.Msg,
type: "warning",
duration: "10000",
});
return;
} else {
_this.$message({
message: "创建成功!"
});
}
},
error: function (json) {
_this.$message({
message: "创建失败!" + json.Msg,
type: "warning",
message: "创建失败!",
type: "error",
duration: "10000",
});
return;
} else {
_this.$message({
message: "创建成功!"
});
}
},
error: function (json) {
_this.$message({
message: "创建失败!",
type: "error",
duration: "10000",
});
},
});
},
print() {
var _this = this;
_this.printData = [];
_this.tableData.forEach(function (item) {
_this.printData.push({
ck: item.Ware,
cj: item.CJ,
lot: item.Lot,
rq: item.RQ,
qty: item.Qty,
len: item.Len,
jh: item.JH,
sn: item.Sn,
qrcode: item.JH,
PH: item.PH
},
});
});
},
scanJH() {
var _this = this;
if (_this.form.jh == "") {
_this.$message({
message: "当前无数据!!",
type: "warning",
duration: "500",
});
return;
}
hiprint.init();
var hiprintTemplate = new hiprint.PrintTemplate({
template: this.template
})
hiprintTemplate.print(this.printData);
},
}
});
// 调用后台方法,判断是否在物料表内
$.ajax({
type: "post",
dataType: "json",
data: { data: _this.form.jh },
url: "/xwms/ReceiptHeader2/ScanJh",
success: function (json) {
if (json.Code != 200) {
_this.$message({
message: "扫码失败!" + json.Msg,
type: "warning",
duration: "10000",
});
return;
} else {
_this.form.jh = "";
// UniqueCode = item.JH,
// MaterialSpec = item.Lot,
// MaterialType = item.Sn,
// Qty = item.Qty,
// Batch = item.PH,
// CreateTime = DateTime.Now,
let isExit = 0;
_this.tableData.forEach(function (item) {
if (item.JH == json.Data.UniqueCode) {
_this.$message({
message: "扫码失败!重复扫码",
type: "warning",
duration: "10000",
});
isExit = 1;
}
});
if (isExit == 0) {
_this.tableData.push({
"Ware": "立库",
"CJ":json.Data.SourceCode,
"Len":json.Data.Lot,
"JH": json.Data.UniqueCode,
"Lot": json.Data.MaterialSpec,
"Sn": json.Data.MaterialType,
"Qty": json.Data.Qty,
"PH": json.Data.Batch,
"RQ": json.Data.CreateTime.substring(0, 10)
})
}
}
},
error: function (json) {
_this.$message({
message: "扫码失败!",
type: "error",
duration: "10000",
});
},
});
},
print() {
var _this = this;
_this.printData = [];
_this.tableData.forEach(function (item) {
_this.printData.push({
ck: item.Ware,
cj: item.CJ,
lot: item.Lot,
rq: item.RQ,
qty: item.Qty,
len: item.Len,
jh: item.JH,
sn: item.Sn,
qrcode: item.JH,
PH: item.PH
});
});
hiprint.init();
var hiprintTemplate = new hiprint.PrintTemplate({
template: this.template
})
hiprintTemplate.print(this.printData);
},
}
});
</script>
@@ -322,6 +322,7 @@ namespace HHWMS.Web.Controllers
detail.SourceLine = receipt.SourceLine;
detail.MaterialCode = receipt.MaterialCode;
detail.MaterialName = receipt.MaterialName;
detail.Coefficient = receipt.Coefficient;
detail.Lot = receipt.Lot;
detail.SupplierCode = receipt.SupplierCode;
detail.SupplierName = receipt.SupplierName;
@@ -419,6 +419,8 @@ namespace HHWMS.Web.Controllers
MaterialType = item.Sn,
Qty = item.Qty,
Batch = item.PH,
Lot = item.Len,
SourceCode = item.CJ,
CreateTime = DateTime.Now,
});
}
@@ -456,6 +458,18 @@ namespace HHWMS.Web.Controllers
}
return JsonMore(str);
}
[Public]
[HttpPost]
[ActionDescription("Sys.ScanJh")]
public ActionResult ScanJh(string data) {
var material = _unitwork.FindSingle<Material>(x => x.UniqueCode == data);
if(material == null)
{
return JsonMore(null,500,$"卷号{data}未找到!");
}
return JsonMore(material);
}
}
public class receipt4
@@ -465,9 +479,10 @@ namespace HHWMS.Web.Controllers
/// </summary>
public string JH { get; set; }
public decimal Qty { get; set; }
public decimal Len { get; set; }
public string Len { get; set; }
public string Lot { get; set; }
public string Sn { get; set;}
public string CJ { get; set; }
/// <summary>
/// 片厚
/// </summary>
@@ -14,7 +14,7 @@
<el-button type="primary" @@click="print">打印</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" @@click="chaiBill">拆分</el-button>
<el-button type="primary" @@click="chaiBill" :disabled="disabledChaiButton">拆分</el-button>
</el-form-item>
</el-form>
@@ -50,7 +50,8 @@
qty:'',
loading: false,
tableData: [],
sumQty:0
sumQty:0,
disabledChaiButton:false
};
},
mounted: function () {
@@ -112,6 +113,7 @@
},
chaiBill() {
var _this = this;
var loadIndex = layer.load(0);
$.ajax({
type: "post",
dataType: "json",
@@ -120,13 +122,16 @@
},
url: "/xwms/ReceiptDetail2/ChaiDetail",
success: function (json) {
layer.close(loadIndex);
if (json.Code == 200) {
layer.msg("拆分数据成功");
_this.disabledChaiButton = true;
} else {
layer.alert(json.Msg, { icon: 5, shadeClose: true, title: "错误信息" });
}
},
error: function (json) {
layer.close(loadIndex);
layer.alert("失败", { icon: 5, shadeClose: true, title: "错误信息" });
}
});