卷料退库

明细拆分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"> <div id="print4">
<el-form ref="form" :inline="true" :model="form" size="mini" label-width="100px"> <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-col :span="24">
<el-form-item label="仓库"> <el-form-item label="厂家">
<el-select v-model="form.ck" :popper-append-to-body="false" placeholder="仓库"> <el-input v-model="form.cj" placeholder="厂家" @@keyup.enter.native="splitCJ()">
<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-input> </el-input>
</el-form-item> *@ </el-form-item>
<el-form-item label="规格">
<el-input v-model="form.lot" @@keyup.enter.native="splitLot()" <el-form-item label="规格">
placeholder="规格"> <el-input v-model="form.lot" @@keyup.enter.native="splitLot()"
</el-input> placeholder="规格">
</el-form-item> </el-input>
<el-form-item label="重量"> </el-form-item>
<el-input v-model="form.qty" @@keyup.enter.native="splitQty()" <el-form-item label="重量">
placeholder="重量"> <el-input v-model="form.qty" @@keyup.enter.native="splitQty()"
</el-input> placeholder="重量">
</el-form-item> </el-input>
<el-col :span="24"> </el-form-item>
<el-form-item label="米数"> </el-col>
<el-input v-model="form.len" @@keyup.enter.native="splitLen()" <el-col :span="24">
placeholder="米数"> <el-form-item label="米数">
</el-input> <el-input v-model="form.len" @@keyup.enter.native="splitLen()"
</el-form-item> placeholder="米数">
<el-form-item label="铁损"> </el-input>
<el-input v-model="form.sn" @@keyup.enter.native="splitSn()" </el-form-item>
placeholder="铁损"> <el-form-item label="铁损">
</el-input> <el-input v-model="form.sn" @@keyup.enter.native="splitSn()"
</el-form-item> placeholder="铁损">
<el-form-item label="片厚"> </el-input>
<el-input v-model="form.ph" @@keyup.enter.native="splitPh()" </el-form-item>
placeholder="片厚"> <el-form-item label="片厚">
</el-input> <el-input v-model="form.ph" @@keyup.enter.native="splitPh()"
</el-form-item> placeholder="片厚">
</el-col> </el-input>
</el-form-item>
</el-col>
</el-row> </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-col :span="4">
<el-button type="primary" @@click="create">创建入库单</el-button> <el-button type="primary" @@click="create">创建入库单</el-button>
</el-col> </el-col>
@@ -59,8 +67,6 @@
<el-button type="success" @@click="print">打印</el-button> <el-button type="success" @@click="print">打印</el-button>
</el-col> </el-col>
<el-table :data="tableData" <el-table :data="tableData"
max-height="600" stripe border max-height="600" stripe border
style="width: 100%" style="width: 100%"
@@ -78,7 +84,11 @@
<el-input size="small" v-model="scope.row.Lot"></el-input> <el-input size="small" v-model="scope.row.Lot"></el-input>
</template> </template>
</el-table-column> </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"> <el-table-column label="米数" width="150" align="center" prop="Len">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input size="small" v-model="scope.row.Len"></el-input> <el-input size="small" v-model="scope.row.Len"></el-input>
@@ -112,7 +122,7 @@
sn: '', sn: '',
ph: '' ph: ''
}, },
tk:false,
ckList: [ ckList: [
{ {
value: '1', value: '1',
@@ -179,200 +189,267 @@
message: '取消输入' message: '取消输入'
}); });
}); });
}, },
// 拆解卷号 // 拆解卷号
splitJH() { splitJH() {
var _this = this; var _this = this;
if (this.form.jh != "") { if (this.form.jh != "") {
var list = this.form.jh.trim().split(/\s+/); var list = this.form.jh.trim().split(/\s+/);
var num = list.length; var num = list.length;
if (num > 0) { if (num > 0) {
if (this.tableData.length > 0) { if (this.tableData.length > 0) {
this.tableData = []; this.tableData = [];
} }
while (num > 0) { while (num > 0) {
if (list[list.length - num] != "") { if (list[list.length - num] != "") {
this.tableData.push(JSON.parse(JSON.stringify({ this.tableData.push(JSON.parse(JSON.stringify({
"Ware": this.ckList.filter(function (item) { "Ware": this.ckList.filter(function (item) {
return item.value == _this.form.ck; return item.value == _this.form.ck;
})[0].label, })[0].label,
"CJ": this.form.cj, "CJ": this.form.cj,
"JH": list[list.length - num], "JH": list[list.length - num],
"Qty": "", "Qty": "",
"Len": "", "Len": "",
"Lot": "", "Lot": "",
"Sn": "", "Sn": "",
"PH": "", "PH": "",
"RQ": new Date().toLocaleDateString() "RQ": new Date().toLocaleDateString()
}))); })));
} }
num--; 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--;
} }
} else {
layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" });
} }
} },
}, // 拆解重量
// 拆解米数 splitQty() {
splitLen() { var _this = this;
var _this = this; if (this.form.qty != "") {
_this.tableData.forEach(function (item) { var list = this.form.qty.trim().split(/\s+/);
item.Len = _this.form.len; if (list.length == this.tableData.length) {
}) var nn = list.length - 1;
// if (this.form.len != "") { while (nn >= 0) {
// var list = this.form.len.trim().split(/\s+/); _this.tableData[nn].Qty = list[nn];
// if (list.length == this.tableData.length) { nn--;
// var nn = list.length - 1; }
// while (nn >= 0) { } else {
// _this.tableData[nn].Len = list[nn]; layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" });
// 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: "错误信息" });
} }
} },
}, // 拆解米数
// 拆解铁损 splitLen() {
splitSn() { var _this = this;
var _this = this; _this.tableData.forEach(function (item) {
_this.tableData.forEach(function (item) { item.Len = _this.form.len;
item.Sn = _this.form.sn; })
}) // if (this.form.len != "") {
// if (this.form.sn != "") { // var list = this.form.len.trim().split(/\s+/);
// var list = this.form.sn.trim().split(/\s+/); // if (list.length == this.tableData.length) {
// if (list.length == this.tableData.length) { // var nn = list.length - 1;
// var nn = list.length - 1; // while (nn >= 0) {
// while (nn >= 0) { // _this.tableData[nn].Len = list[nn];
// _this.tableData[nn].Sn = list[nn]; // nn--;
// nn--; // }
// } // } else {
// } else { // layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" });
// layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" }); // }
// } // }
// } },
}, // 拆解规格
// 拆解片厚 splitLot() {
splitPh() { var _this = this;
var _this = this; if (this.form.lot != "") {
_this.tableData.forEach(function (item) { var list = this.form.lot.trim().split(/\s+/);
item.PH = _this.form.ph; if (list.length == this.tableData.length) {
}) var nn = list.length - 1;
// if (this.form.ph != "") { while (nn >= 0) {
// var list = this.form.ph.trim().split(/\s+/); _this.tableData[nn].Lot = list[nn];
// if (list.length == this.tableData.length) { nn--;
// var nn = list.length - 1; }
// while (nn >= 0) { } else {
// _this.tableData[nn].PH = list[nn]; layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" });
// nn--; }
// } }
// } else { },
// layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" }); // 拆解铁损
// } splitSn() {
// } var _this = this;
}, _this.tableData.forEach(function (item) {
splitCJ() { item.Sn = _this.form.sn;
var _this = this; })
_this.tableData.forEach(function (item) { // if (this.form.sn != "") {
item.CJ = _this.form.cj; // var list = this.form.sn.trim().split(/\s+/);
}); // if (list.length == this.tableData.length) {
}, // var nn = list.length - 1;
create() { // while (nn >= 0) {
var _this = this; // _this.tableData[nn].Sn = list[nn];
if (_this.tableData.length == 0) { // nn--;
_this.$message({ // }
message: "当前无数据!!", // } else {
type: "warning", // layer.alert("数量与表行不一致!!", { icon: 5, shadeClose: true, title: "错误信息" });
duration: "500", // }
// }
},
// 拆解片厚
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({ $.ajax({
type: "post", type: "post",
dataType: "json", dataType: "json",
data: { data: _this.tableData }, data: { data: _this.tableData },
url: "/xwms/ReceiptHeader2/CreateDetail4", url: "/xwms/ReceiptHeader2/CreateDetail4",
success: function (json) { success: function (json) {
if (json.Code != 200) { if (json.Code != 200) {
_this.$message({
message: "创建失败!" + json.Msg,
type: "warning",
duration: "10000",
});
return;
} else {
_this.$message({
message: "创建成功!"
});
}
},
error: function (json) {
_this.$message({ _this.$message({
message: "创建失败!" + json.Msg, message: "创建失败!",
type: "warning", type: "error",
duration: "10000", 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({ $.ajax({
template: this.template type: "post",
}) dataType: "json",
hiprintTemplate.print(this.printData); 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> </script>
@@ -322,6 +322,7 @@ namespace HHWMS.Web.Controllers
detail.SourceLine = receipt.SourceLine; detail.SourceLine = receipt.SourceLine;
detail.MaterialCode = receipt.MaterialCode; detail.MaterialCode = receipt.MaterialCode;
detail.MaterialName = receipt.MaterialName; detail.MaterialName = receipt.MaterialName;
detail.Coefficient = receipt.Coefficient;
detail.Lot = receipt.Lot; detail.Lot = receipt.Lot;
detail.SupplierCode = receipt.SupplierCode; detail.SupplierCode = receipt.SupplierCode;
detail.SupplierName = receipt.SupplierName; detail.SupplierName = receipt.SupplierName;
@@ -419,6 +419,8 @@ namespace HHWMS.Web.Controllers
MaterialType = item.Sn, MaterialType = item.Sn,
Qty = item.Qty, Qty = item.Qty,
Batch = item.PH, Batch = item.PH,
Lot = item.Len,
SourceCode = item.CJ,
CreateTime = DateTime.Now, CreateTime = DateTime.Now,
}); });
} }
@@ -456,6 +458,18 @@ namespace HHWMS.Web.Controllers
} }
return JsonMore(str); 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 public class receipt4
@@ -465,9 +479,10 @@ namespace HHWMS.Web.Controllers
/// </summary> /// </summary>
public string JH { get; set; } public string JH { get; set; }
public decimal Qty { get; set; } public decimal Qty { get; set; }
public decimal Len { get; set; } public string Len { get; set; }
public string Lot { get; set; } public string Lot { get; set; }
public string Sn { get; set;} public string Sn { get; set;}
public string CJ { get; set; }
/// <summary> /// <summary>
/// 片厚 /// 片厚
/// </summary> /// </summary>
@@ -14,7 +14,7 @@
<el-button type="primary" @@click="print">打印</el-button> <el-button type="primary" @@click="print">打印</el-button>
</el-form-item> </el-form-item>
<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-item>
</el-form> </el-form>
@@ -50,7 +50,8 @@
qty:'', qty:'',
loading: false, loading: false,
tableData: [], tableData: [],
sumQty:0 sumQty:0,
disabledChaiButton:false
}; };
}, },
mounted: function () { mounted: function () {
@@ -112,6 +113,7 @@
}, },
chaiBill() { chaiBill() {
var _this = this; var _this = this;
var loadIndex = layer.load(0);
$.ajax({ $.ajax({
type: "post", type: "post",
dataType: "json", dataType: "json",
@@ -120,13 +122,16 @@
}, },
url: "/xwms/ReceiptDetail2/ChaiDetail", url: "/xwms/ReceiptDetail2/ChaiDetail",
success: function (json) { success: function (json) {
layer.close(loadIndex);
if (json.Code == 200) { if (json.Code == 200) {
layer.msg("拆分数据成功"); layer.msg("拆分数据成功");
_this.disabledChaiButton = true;
} else { } else {
layer.alert(json.Msg, { icon: 5, shadeClose: true, title: "错误信息" }); layer.alert(json.Msg, { icon: 5, shadeClose: true, title: "错误信息" });
} }
}, },
error: function (json) { error: function (json) {
layer.close(loadIndex);
layer.alert("失败", { icon: 5, shadeClose: true, title: "错误信息" }); layer.alert("失败", { icon: 5, shadeClose: true, title: "错误信息" });
} }
}); });