|
@@ -69,6 +69,7 @@
|
|
|
<!-- 这里放置操作按钮 -->
|
|
|
<div class="button-group">
|
|
|
<el-button type="primary" @click="edit(scope.row)" icon="el-icon-edit" circle>编辑</el-button>
|
|
|
+ <el-button type="primary" @click="toDo(scope.row)" icon="el-icon-check" circle>执行</el-button>
|
|
|
<el-button type="danger" @click="orderDelete(scope.row)" icon="el-icon-delete" circle>删除</el-button>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -81,6 +82,60 @@
|
|
|
layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange"
|
|
|
@current-change="handleCurrentChange"/>
|
|
|
</div>
|
|
|
+
|
|
|
+
|
|
|
+ <el-dialog
|
|
|
+ title="新增入库单"
|
|
|
+ :visible.sync="dialogVisible"
|
|
|
+ :before-close="handleClose">
|
|
|
+ <el-form ref="form" :model="order" :rules="rules" label-position="right" label-width="80px" size="medium">
|
|
|
+ <!-- 刀具规格 -->
|
|
|
+ <el-form-item label="订单名称" prop="orderName" >
|
|
|
+ <el-input v-model.trim="order.orderName" maxlength="255" :disabled="isViewMode"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="订单编码" prop="orderCode">
|
|
|
+ <el-input v-model.trim="order.orderCode" maxlength="255" :disabled="isViewMode"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="入库类型">
|
|
|
+ <el-select v-model="order.detailType" placeholder="请选择" :disabled="isViewMode">
|
|
|
+ <el-option
|
|
|
+ v-for="item in detailTypeOptions"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="物料编码">
|
|
|
+ <el-input type="text" v-model="inputCode" placeholder="输入物料编码" @change="addNewRow()" style="width: 300px" :disabled="isViewMode"></el-input>
|
|
|
+ <!--<el-button type="primary" @click="addNewRow()">新增</el-button>-->
|
|
|
+ </el-form-item>
|
|
|
+ <el-table ref="singleTable" :data="detailList" v-loading="loading" :border=true
|
|
|
+ tooltip-effect="dark"
|
|
|
+ highlight-current-row max-height="500" style="width: 100%;"
|
|
|
+ :default-sort="{prop: 'createDate', order: 'descending'}"
|
|
|
+ @selection-change="handleSelectionChange" :disabled="isViewMode">
|
|
|
+ <el-table-column prop="materialCode" label="物料编码" :show-overflow-tooltip="true"></el-table-column>
|
|
|
+ <el-table-column prop="materialName" label="物料名称" :show-overflow-tooltip="true"></el-table-column>
|
|
|
+ <el-table-column prop="planAmount" label="计划出库数量" :show-overflow-tooltip="true">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input v-model="scope.row.planAmount" type="number" :disabled="isViewMode"></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作">
|
|
|
+ <template #default="scope">
|
|
|
+ <!-- 这里放置操作按钮 -->
|
|
|
+ <el-button type="danger" @click="handleDelete(scope.row)" :disabled="isViewMode">删除</el-button>
|
|
|
+ <!-- 可以添加更多的操作按钮 -->
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="dialogVisible = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="submit()" :disabled="isViewMode">确 定</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -93,6 +148,7 @@
|
|
|
data: function () {
|
|
|
return {
|
|
|
migrationResultList: [],
|
|
|
+ detailList: [],
|
|
|
name: '',
|
|
|
createDate: '',
|
|
|
currentPage: 1,
|
|
@@ -103,11 +159,22 @@
|
|
|
formInline: {
|
|
|
inOutCode: ''
|
|
|
},
|
|
|
+ rules: {
|
|
|
+ orderName: [
|
|
|
+ { required: true, message: '必填', trigger: 'blur' },
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ dialogVisible:false,
|
|
|
+ isViewMode:false,
|
|
|
+ orderId:'',
|
|
|
+ inputCode:'',
|
|
|
+ order: this.initOrder(),
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
console.log("初始化")
|
|
|
this.queryClick();
|
|
|
+ this.getDic();
|
|
|
},
|
|
|
methods: {
|
|
|
handleSizeChange(pageSize, total) {
|
|
@@ -122,6 +189,25 @@
|
|
|
clear() {
|
|
|
this.ylCard = '';
|
|
|
this.master = '';
|
|
|
+ }, getDic() {
|
|
|
+ axios.post('/Dic/list', {
|
|
|
+ 'dicCode': 'detailType'
|
|
|
+ })
|
|
|
+ .then(response => {
|
|
|
+ console.log(response)
|
|
|
+ this.detailTypeOptions = response.data;
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ // 处理错误
|
|
|
+ });
|
|
|
+
|
|
|
+ },
|
|
|
+ initOrder(){
|
|
|
+ return{
|
|
|
+ orderName:'',
|
|
|
+ orderCode:'',
|
|
|
+ detailType:''
|
|
|
+ }
|
|
|
},
|
|
|
queryClick() {
|
|
|
this.loading = true;
|
|
@@ -189,10 +275,126 @@
|
|
|
}
|
|
|
|
|
|
|
|
|
+ },handleScan(){
|
|
|
+ console.log(this.inputCode)
|
|
|
+ axios.get('/order/verifyCode/'+this.inputCode, {
|
|
|
+ })
|
|
|
+ .then(response => {
|
|
|
+ const verify=response.data.data;
|
|
|
+ if(verify === null){
|
|
|
+ this.$message.error('无法识别'+this.inputCode);
|
|
|
+ this.inputCode='';
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if(verify === 0){
|
|
|
+ const needFlag=this.detailListTask.some(vo=>{
|
|
|
+ if(vo.materialCode === this.inputCode){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ })
|
|
|
+ if(!needFlag){
|
|
|
+ this.$message.error('需求明细无法识别'+this.inputCode);
|
|
|
+ this.inputCode='';
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ const flag =this.detailListPallet.some(vo=>{
|
|
|
+ if(vo.materialCode === this.inputCode){
|
|
|
+ const flag1=this.detailListOut.some(item =>{
|
|
|
+ if(item.materialCode === this.inputCode){
|
|
|
+ item.amount=parseInt(item.amount)+1;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+
|
|
|
+ })
|
|
|
+ if(!flag1){
|
|
|
+ const newRow = {
|
|
|
+ "materialCode":this.inputCode,
|
|
|
+ "materialName":vo.materialName,
|
|
|
+ "amount":1
|
|
|
+ }
|
|
|
+ this.detailListOut.push(newRow);
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ })
|
|
|
+
|
|
|
+ if(!flag){
|
|
|
+ this.$message.error('托盘明细中无法识别'+this.inputCode);
|
|
|
+ }
|
|
|
+ }else if(verify === 1){
|
|
|
+ console.log(this.detailListTask)
|
|
|
+ const allMaterials = this.detailListTask.reduce((accumulator, currentObject) => {
|
|
|
+ return accumulator.concat(currentObject.inventoryManagementList);
|
|
|
+ }, []);
|
|
|
+ let locationCode1='';
|
|
|
+ const hasMatchingCode = allMaterials.some(task => {
|
|
|
+ if (task.palletCode === this.inputCode) {
|
|
|
+ locationCode1 = task.storageLocationCode;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ });
|
|
|
+ if(!hasMatchingCode){
|
|
|
+ this.$message.error("库存明细中无法识别到 " + this.inputCode);
|
|
|
+ this.inputCode='';
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ axios.get('/wInventoryManagement/'+locationCode1, {
|
|
|
+ })
|
|
|
+ .then(response => {
|
|
|
+ console.log(response)
|
|
|
+ if(response.data.success){
|
|
|
+ const res=response.data.data;
|
|
|
+ this.detailListPallet=res;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ // 处理错误
|
|
|
+ });
|
|
|
+ this.palletCode=this.inputCode;
|
|
|
+ }
|
|
|
+ this.inputCode='';
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ // 处理错误
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
},add(){
|
|
|
- window.location.href = "add.html";
|
|
|
+ this.dialogVisible=true;
|
|
|
+ this.isViewMode=false;
|
|
|
+ this.clearForm();
|
|
|
},edit(row){
|
|
|
- window.location.href = "edit.html?id="+row.id;
|
|
|
+ this.dialogVisible=true;
|
|
|
+ axios.get('/order/getOrderById/'+row.id, {
|
|
|
+ })
|
|
|
+ .then(response => {
|
|
|
+ console.log(response)
|
|
|
+ if(response.data.success){
|
|
|
+ const res=response.data.data;
|
|
|
+ this.orderId=res.id;
|
|
|
+ this.order.orderName=res.orderName;
|
|
|
+ this.order.orderCode=res.orderCode;
|
|
|
+ this.order.detailType=res.detailType.toString();
|
|
|
+
|
|
|
+ this.detailList=res.detailList;
|
|
|
+ /*res.detailList.forEach(item=>{
|
|
|
+ this.addOutPalletCode(item.materialCode)
|
|
|
+ })*/
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ // 处理错误
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
},orderDelete(row){
|
|
|
axios.get('/order/delete/'+row.id, {
|
|
|
})
|
|
@@ -208,6 +410,106 @@
|
|
|
.catch(error => {
|
|
|
// 处理错误
|
|
|
});
|
|
|
+ },handleClose(done) {
|
|
|
+ this.clearForm();
|
|
|
+ done();
|
|
|
+ /* this.$confirm('确认关闭?')
|
|
|
+ .then(_ => {
|
|
|
+
|
|
|
+
|
|
|
+ })
|
|
|
+ .catch(_ => {});*/
|
|
|
+ },clearForm(){
|
|
|
+ this.orderId='';
|
|
|
+ this.order.orderName='';
|
|
|
+ this.order.orderCode='';
|
|
|
+ this.order.detailType='';
|
|
|
+ this.inputCode='';
|
|
|
+ this.detailList=[];
|
|
|
+ },handleSelectionChange(selection) {
|
|
|
+ this.selection = selection
|
|
|
+ },addNewRow() {
|
|
|
+ // Define your new row object
|
|
|
+ /*if(this.entryPoint === ''){
|
|
|
+ this.$message.error('请选择当前入库口');
|
|
|
+ return
|
|
|
+ }*/
|
|
|
+
|
|
|
+ console.log(this.inputCode)
|
|
|
+ const code= this.inputCode
|
|
|
+ //判断输入的是托盘编码 料箱编码 物料编码
|
|
|
+ axios.get('/wMaterial/'+code, {
|
|
|
+ })
|
|
|
+ .then(response => {
|
|
|
+ console.log(response)
|
|
|
+ const verify=response.data.data;
|
|
|
+ if(verify === null){
|
|
|
+ this.$message.error('无法识别'+code);
|
|
|
+ this.inputCode='';
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.verifCode(code,verify);
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ // 处理错误
|
|
|
+ });
|
|
|
+ },verifCode(code,verify){
|
|
|
+ //0 物料编码 1 托盘编码 2 料盒编码
|
|
|
+ const newRow = {
|
|
|
+ materialCode: code,
|
|
|
+ materialName: verify.materialName,
|
|
|
+ planAmount: 1,
|
|
|
+ };
|
|
|
+ this.inputCode='';
|
|
|
+ if(this.detailList.length === 0){
|
|
|
+ // Push the new row to migrationResultList
|
|
|
+ this.detailList.push(newRow);
|
|
|
+ this.addOutPalletCode(code);
|
|
|
+ }else{
|
|
|
+ let flag = true;
|
|
|
+ this.detailList.forEach(item => {
|
|
|
+ if (item.materialCode === code) {
|
|
|
+ item.planAmount=parseInt(item.planAmount)+1;
|
|
|
+ flag=false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if(flag){
|
|
|
+ this.detailList.push(newRow);
|
|
|
+ this.addOutPalletCode(code);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ },submit(){
|
|
|
+ axios.post('/order/addOut', {
|
|
|
+ "orderType":2,
|
|
|
+ "id":this.orderId,
|
|
|
+ "inOutType":2,
|
|
|
+ "orderName":this.order.orderName,
|
|
|
+ "orderCode":this.order.orderCode,
|
|
|
+ "detailType":this.order.detailType,
|
|
|
+ "status":0,
|
|
|
+ "operation":this.orderId === ''?"add":"edit",
|
|
|
+ "detailList":this.detailList
|
|
|
+ }).then(response => {
|
|
|
+ if(response.data.success){
|
|
|
+ this.$message({
|
|
|
+ message: this.orderId === ''?'保存成功':'修改成功',
|
|
|
+ type: "success"
|
|
|
+ })
|
|
|
+ this.dialogVisible=false;
|
|
|
+ this.queryClick();
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ // 处理错误
|
|
|
+ });
|
|
|
+
|
|
|
+ },toDo(row){
|
|
|
+ window.location.href = "edit.html?id="+row.id;
|
|
|
}
|
|
|
}
|
|
|
|