|
|
@@ -67,6 +67,7 @@
|
|
|
size="medium"
|
|
|
style="width: 100%"
|
|
|
clearable
|
|
|
+ :value="formData.extInfo.assetType"
|
|
|
:options="codeList"
|
|
|
:props="{
|
|
|
value: 'id',
|
|
|
@@ -98,6 +99,16 @@
|
|
|
></el-option>
|
|
|
</el-select> </el-form-item
|
|
|
></el-col>
|
|
|
+ <el-col v-if="formData.bizType == 12" :span="8">
|
|
|
+ <el-form-item label="关联出库单" prop="documentSource">
|
|
|
+ <el-input
|
|
|
+ placeholder="请输入"
|
|
|
+ v-model="stockOutOrders"
|
|
|
+ @click.native="handleStockOutOrder()"
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item
|
|
|
v-if="formData.bizType == 12"
|
|
|
@@ -362,7 +373,9 @@
|
|
|
|
|
|
<div class="material">
|
|
|
<header-title title="产品信息">
|
|
|
- <el-button type="primary" @click="addStock">添加</el-button>
|
|
|
+ <el-button v-if="!isOutsourcing" type="primary" @click="addStock"
|
|
|
+ >添加</el-button
|
|
|
+ >
|
|
|
</header-title>
|
|
|
|
|
|
<div class="mt10 form-table">
|
|
|
@@ -488,6 +501,7 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
+ v-if="clientEnvironmentId != 2"
|
|
|
label="批次号"
|
|
|
prop="batchNo"
|
|
|
width="70"
|
|
|
@@ -865,7 +879,7 @@
|
|
|
>批量保存</el-button
|
|
|
>
|
|
|
<el-table
|
|
|
- v-if="showMaterialTable"
|
|
|
+ v-if="isWrapTable"
|
|
|
ref="materialCodeReqListTable"
|
|
|
:data="materialCodeReqList"
|
|
|
tooltip-effect="dark"
|
|
|
@@ -904,6 +918,7 @@
|
|
|
width="100"
|
|
|
></el-table-column>
|
|
|
<el-table-column
|
|
|
+ v-if="clientEnvironmentId != 2"
|
|
|
label="批次号"
|
|
|
prop="batchNo"
|
|
|
width="70"
|
|
|
@@ -1062,13 +1077,20 @@
|
|
|
<el-table-column
|
|
|
v-if="!isSplit"
|
|
|
label="操作"
|
|
|
- width="80"
|
|
|
+ width="120"
|
|
|
fixed="right"
|
|
|
>
|
|
|
- <template slot-scope="{ row }">
|
|
|
+ <template slot-scope="{ row, $index }">
|
|
|
<el-button type="text" @click="packCout(row)">
|
|
|
{{ !row.isPack ? '保存' : '编辑' }}
|
|
|
</el-button>
|
|
|
+ <el-button
|
|
|
+ v-if="isOutsourcing"
|
|
|
+ type="text"
|
|
|
+ @click="wrapDelete(row, $index)"
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
@@ -1087,6 +1109,7 @@
|
|
|
>批量保存</el-button
|
|
|
>
|
|
|
<el-table
|
|
|
+ v-if="isMaterialTable"
|
|
|
ref="resultArrayTable"
|
|
|
:data="resultArray"
|
|
|
tooltip-effect="dark"
|
|
|
@@ -1117,6 +1140,7 @@
|
|
|
width="100"
|
|
|
></el-table-column>
|
|
|
<el-table-column
|
|
|
+ v-if="clientEnvironmentId != 2"
|
|
|
label="批次号"
|
|
|
prop="batchNo"
|
|
|
width="80"
|
|
|
@@ -1211,11 +1235,18 @@
|
|
|
<span>{{ qualityStatus[row.status] }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="操作" width="80" fixed="right">
|
|
|
- <template slot-scope="{ row }">
|
|
|
+ <el-table-column label="操作" width="120" fixed="right">
|
|
|
+ <template slot-scope="{ row, $index }">
|
|
|
<el-button type="text" @click="materialBtn(row)">
|
|
|
{{ !row.isPack ? '保存' : '编辑' }}
|
|
|
</el-button>
|
|
|
+ <el-button
|
|
|
+ v-if="isOutsourcing"
|
|
|
+ type="text"
|
|
|
+ @click="materialDelete(row, $index)"
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
@@ -1264,7 +1295,8 @@
|
|
|
>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
-
|
|
|
+ <!-- 出库单 -->
|
|
|
+ <stockOutOrder ref="stockOutOrderRef" @success="stockOutOrderSuccess" />
|
|
|
<!-- 销售订单 -->
|
|
|
<picker ref="pickerRef" @success="pickerSuccess" />
|
|
|
<!-- 委外订单 -->
|
|
|
@@ -1278,6 +1310,7 @@
|
|
|
<script>
|
|
|
import { add, bignumber } from 'mathjs';
|
|
|
import picker from './components/picker.vue';
|
|
|
+ import stockOutOrder from './components/stockOutOrder.vue';
|
|
|
import outsourcedOrders from './components/outsourcedOrders.vue';
|
|
|
import outin from '@/api/warehouseManagement/outin';
|
|
|
import {
|
|
|
@@ -1315,11 +1348,15 @@
|
|
|
upload,
|
|
|
ReturnSelect,
|
|
|
picker,
|
|
|
- outsourcedOrders
|
|
|
+ outsourcedOrders,
|
|
|
+ stockOutOrder
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- showMaterialTable: true, // 缓存包装明细列表
|
|
|
+ isWrapTable: true, // 包装表格显隐
|
|
|
+ isMaterialTable: true, // 物料表格显隐
|
|
|
+ isOutsourcing: false, // 是否委外
|
|
|
+ stockOutOrders: '',
|
|
|
isSplit: false, // 是否拆分到物料明细
|
|
|
qualityStatus: {
|
|
|
0: '未检',
|
|
|
@@ -1407,6 +1444,9 @@
|
|
|
},
|
|
|
tableHeader() {
|
|
|
return tableHeader(this.selectEquiType);
|
|
|
+ },
|
|
|
+ clientEnvironmentId() {
|
|
|
+ return this.$store.state.user.info.clientEnvironmentId;
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
@@ -1736,9 +1776,12 @@
|
|
|
} else {
|
|
|
row.isPack = false;
|
|
|
}
|
|
|
- // setTimeout(() => {
|
|
|
-
|
|
|
- // }, 100);
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.isWrapTable = false;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.isWrapTable = true;
|
|
|
+ });
|
|
|
+ });
|
|
|
},
|
|
|
// 批量修改包装明细
|
|
|
bulkEditingWrap() {
|
|
|
@@ -1888,6 +1931,14 @@
|
|
|
} else {
|
|
|
row.isPack = false;
|
|
|
}
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.isWrapTable = false;
|
|
|
+ this.isMaterialTable = false;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.isWrapTable = true;
|
|
|
+ this.isMaterialTable = true;
|
|
|
+ });
|
|
|
+ });
|
|
|
},
|
|
|
packNum(row, value) {
|
|
|
const total = {
|
|
|
@@ -1923,6 +1974,273 @@
|
|
|
outsourcedOrdersSuccess(row) {
|
|
|
this.outsourcedOrdersRow = row;
|
|
|
this.formData.extInfo.documentSource = row.code;
|
|
|
+ this.$forceUpdate();
|
|
|
+ },
|
|
|
+ // 包装删除
|
|
|
+ wrapDelete(row, index) {
|
|
|
+ // 删除包装
|
|
|
+ this.materialCodeReqList.splice(index, 1);
|
|
|
+ let outIndex = 0;
|
|
|
+ let arr = this.warehousingMaterialList.filter((item, index) => {
|
|
|
+ if (item.assetCode == row.assetCode && item.batchNo == row.batchNo) {
|
|
|
+ outIndex = index;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 修改产品
|
|
|
+ if (arr[0].minPackingCount * arr[0].outInNum === row.minPackingCount) {
|
|
|
+ this.warehousingMaterialList.splice(outIndex, 1);
|
|
|
+ } else {
|
|
|
+ this.$set(
|
|
|
+ this.warehousingMaterialList[outIndex],
|
|
|
+ 'outInNum',
|
|
|
+ this.warehousingMaterialList[outIndex].outInNum - 1
|
|
|
+ );
|
|
|
+ }
|
|
|
+ // 删除物料
|
|
|
+ if (this.resultArray.length > 0) {
|
|
|
+ let indexs = [];
|
|
|
+ let arr = this.resultArray.filter((item, index) => {
|
|
|
+ if (
|
|
|
+ item.assetCode == row.assetCode &&
|
|
|
+ item.batchNo == row.batchNo
|
|
|
+ ) {
|
|
|
+ indexs.push(index);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ console.log(indexs);
|
|
|
+ console.log(arr);
|
|
|
+ this.resultArray = this.resultArray.filter((item, index) => {
|
|
|
+ return !indexs.includes(index);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 物料删除
|
|
|
+ materialDelete(row, index) {
|
|
|
+ console.log('row---------------');
|
|
|
+ console.log(index);
|
|
|
+ console.log(row);
|
|
|
+ let isBoolen = false;
|
|
|
+ // 删除物料
|
|
|
+ this.resultArray.splice(index, 1);
|
|
|
+ // 过滤物料对应包装
|
|
|
+ let wrapOutIndex = 0;
|
|
|
+ let wrapArr = this.materialCodeReqList.filter((item, index) => {
|
|
|
+ if (
|
|
|
+ item.assetCode == row.assetCode &&
|
|
|
+ item.batchNo == row.batchNo &&
|
|
|
+ item.onlyCode == row.onlyCode
|
|
|
+ ) {
|
|
|
+ wrapOutIndex = index;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ console.log('wrapArr------------------');
|
|
|
+ console.log(wrapArr);
|
|
|
+ // 包装和物料数量一致(相同删除列/不同-1)
|
|
|
+ if (wrapArr[0].minPackingCount === row.minPackingCount) {
|
|
|
+ isBoolen = true;
|
|
|
+ // 修改产品
|
|
|
+ let materialOutIndex = 0;
|
|
|
+ let materialArr = this.warehousingMaterialList.filter(
|
|
|
+ (item, index) => {
|
|
|
+ console.log(wrapOutIndex);
|
|
|
+ console.log(this.materialCodeReqList);
|
|
|
+ console.log(item.assetCode);
|
|
|
+ console.log(this.materialCodeReqList[wrapOutIndex]);
|
|
|
+ console.log(this.materialCodeReqList[wrapOutIndex].assetCode);
|
|
|
+ console.log('----------------');
|
|
|
+ if (
|
|
|
+ item.assetCode ==
|
|
|
+ this.materialCodeReqList[wrapOutIndex].assetCode &&
|
|
|
+ item.batchNo == this.materialCodeReqList[wrapOutIndex].batchNo
|
|
|
+ ) {
|
|
|
+ materialOutIndex = index;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
+ // 产品和包装数量一致(相同删除列/不同-1)———— 产品
|
|
|
+ if (
|
|
|
+ materialArr[0].minPackingCount * materialArr[0].outInNum ===
|
|
|
+ this.materialCodeReqList[wrapOutIndex].minPackingCount
|
|
|
+ ) {
|
|
|
+ this.warehousingMaterialList.splice(materialOutIndex, 1);
|
|
|
+ } else {
|
|
|
+ this.$set(
|
|
|
+ this.warehousingMaterialList[materialOutIndex],
|
|
|
+ 'outInNum',
|
|
|
+ this.warehousingMaterialList[materialOutIndex].outInNum - 1
|
|
|
+ );
|
|
|
+ }
|
|
|
+ this.materialCodeReqList.splice(wrapOutIndex, 1);
|
|
|
+ } else {
|
|
|
+ // 包装数量-1
|
|
|
+ this.$set(
|
|
|
+ this.materialCodeReqList[wrapOutIndex],
|
|
|
+ 'minPackingCount',
|
|
|
+ this.materialCodeReqList[wrapOutIndex].minPackingCount - 1
|
|
|
+ );
|
|
|
+ }
|
|
|
+ if (!isBoolen) {
|
|
|
+ // 修改产品
|
|
|
+ let materialOutIndex = 0;
|
|
|
+ // 找到包装对应产品
|
|
|
+ let materialArr = this.warehousingMaterialList.filter(
|
|
|
+ (item, index) => {
|
|
|
+ console.log(wrapOutIndex);
|
|
|
+ console.log(this.materialCodeReqList);
|
|
|
+ console.log(item.assetCode);
|
|
|
+ console.log(this.materialCodeReqList[wrapOutIndex]);
|
|
|
+ console.log(this.materialCodeReqList[wrapOutIndex].assetCode);
|
|
|
+ console.log('----------------');
|
|
|
+ if (
|
|
|
+ item.assetCode ==
|
|
|
+ this.materialCodeReqList[wrapOutIndex].assetCode &&
|
|
|
+ item.batchNo == this.materialCodeReqList[wrapOutIndex].batchNo
|
|
|
+ ) {
|
|
|
+ materialOutIndex = index;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
+ // 产品和包装数量一致(相同删除列/不同-1)———— 产品
|
|
|
+ if (
|
|
|
+ materialArr[0].minPackingCount * materialArr[0].outInNum ===
|
|
|
+ this.materialCodeReqList[wrapOutIndex].minPackingCount
|
|
|
+ ) {
|
|
|
+ this.warehousingMaterialList.splice(materialOutIndex, 1);
|
|
|
+ } else {
|
|
|
+ this.$set(
|
|
|
+ this.warehousingMaterialList[materialOutIndex],
|
|
|
+ 'outInNum',
|
|
|
+ this.warehousingMaterialList[materialOutIndex].outInNum - 1
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async stockOutOrderSuccess(row) {
|
|
|
+ console.log('--------------------------');
|
|
|
+ console.log(row);
|
|
|
+ this.stockOutOrders = row.bizNo;
|
|
|
+ this.formData.bizType = '2';
|
|
|
+ this.formData.extInfo = row.extInfo;
|
|
|
+ this.selectEquiType = row.categoryLevelTopId;
|
|
|
+ this.formData.sourceBizNo = row.receiveNo;
|
|
|
+ this.formData.fromId = row.id;
|
|
|
+ this.formData.clientName = row.partaName;
|
|
|
+ this.formData.clientCode = row.partaId;
|
|
|
+ // const data = await oneId(row.id);
|
|
|
+ // if (this.warehousingMaterialList.length == 0) {
|
|
|
+ // let list = data.productList.map((item) => {
|
|
|
+ // return {
|
|
|
+ // ...item,
|
|
|
+ // assetName: item.productName,
|
|
|
+ // assetCode: item.productCode,
|
|
|
+ // categoryId: item.productCategoryId,
|
|
|
+ // minPackUnit: item.packingUnit
|
|
|
+ // };
|
|
|
+ // });
|
|
|
+ // await this.onSelectTableData(await this.serachMainCode(list));
|
|
|
+ // }
|
|
|
+ // // 委外发货入库(出库再入库)
|
|
|
+ // if (row.outsourceSendCode) {
|
|
|
+ this.isOutsourcing = true;
|
|
|
+ this.formData.bizType = '12';
|
|
|
+ this.title = '委外入库(非采购)';
|
|
|
+ console.log('-------this.formData----');
|
|
|
+ console.log(this.formData);
|
|
|
+ outin.getById(row.id).then(async (res) => {
|
|
|
+ console.log('-------res--------res-------');
|
|
|
+ console.log(res);
|
|
|
+ if (res.outInDetailVOList && res.outInDetailVOList.length > 0) {
|
|
|
+ const batchNo = await getCode('lot_number_code');
|
|
|
+ this.warehousingMaterialList = [];
|
|
|
+ this.resultArray = [];
|
|
|
+ let arr = res.outInDetailVOList.map(async (goodsiItem) => {
|
|
|
+ return new Promise(async (outResolve) => {
|
|
|
+ goodsiItem.isSave = true;
|
|
|
+ goodsiItem.houseList = [];
|
|
|
+ goodsiItem.batchNo = batchNo;
|
|
|
+ goodsiItem.assetName = goodsiItem.name;
|
|
|
+ goodsiItem.assetCode = goodsiItem.categoryCode;
|
|
|
+ goodsiItem.outInNum =
|
|
|
+ goodsiItem.packingCount < 1 ? 1 : goodsiItem.packingCount;
|
|
|
+ goodsiItem.minPackingCount = goodsiItem.minPackingCount;
|
|
|
+ goodsiItem.minPackUnit = goodsiItem.packingUnit;
|
|
|
+ this.warehousingMaterialList.push(goodsiItem);
|
|
|
+ let res = await outin.getAssetNum({
|
|
|
+ assetCode: goodsiItem.assetCode,
|
|
|
+ batchNum: goodsiItem.batchNo,
|
|
|
+ num: goodsiItem.outInNum < 1 ? 1 : goodsiItem.outInNum
|
|
|
+ });
|
|
|
+ let arr = goodsiItem.outInDetailRecordVOList.map(
|
|
|
+ (wrapItem, index) => {
|
|
|
+ return new Promise(async (resolve) => {
|
|
|
+ wrapItem.onlyCode = res.shift().onlyCode;
|
|
|
+ wrapItem.packingCount =
|
|
|
+ wrapItem.packingCount < 1 ? 1 : wrapItem.packingCount;
|
|
|
+ wrapItem.isPack = true;
|
|
|
+ wrapItem.minPackingCount = wrapItem.totalCount;
|
|
|
+ wrapItem.assetName = goodsiItem.name;
|
|
|
+ wrapItem.assetCode = goodsiItem.categoryCode;
|
|
|
+ wrapItem.batchNo = batchNo;
|
|
|
+ wrapItem.result =
|
|
|
+ wrapItem.result === null ? '' : String(wrapItem.result);
|
|
|
+ // wrapItem.count =
|
|
|
+ // wrapItem.outInDetailRecordMaterialDetailVOList.length; // 增加包装计量数量
|
|
|
+ // 增加内部重量(解决重量未保存同时参与计算问题)
|
|
|
+ wrapItem.initWeight = wrapItem.weight;
|
|
|
+ if (
|
|
|
+ wrapItem.outInDetailRecordMaterialDetailVOList?.length >
|
|
|
+ 0
|
|
|
+ ) {
|
|
|
+ wrapItem.outInDetailRecordMaterialDetailVOList.forEach(
|
|
|
+ (materialItem, index) => {
|
|
|
+ materialItem.id = '';
|
|
|
+ materialItem.onlyCode = wrapItem.onlyCode;
|
|
|
+ materialItem.no =
|
|
|
+ materialItem.onlyCode +
|
|
|
+ index.toString().padStart(4, '0');
|
|
|
+ materialItem.result =
|
|
|
+ materialItem.result === null
|
|
|
+ ? ''
|
|
|
+ : String(materialItem.result);
|
|
|
+ materialItem.batchNo = batchNo;
|
|
|
+ materialItem.minPackingCount = 1;
|
|
|
+ materialItem.isPack = true;
|
|
|
+ // 增加内部重量(解决重量未保存同时参与计算问题)
|
|
|
+ materialItem.initWeight = materialItem.weight;
|
|
|
+ this.resultArray.push(materialItem);
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+ resolve(wrapItem);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ );
|
|
|
+ Promise.all(arr).then((data) => {
|
|
|
+ console.log(goodsiItem);
|
|
|
+ goodsiItem.warehouseLedgerDetails = data;
|
|
|
+ outResolve(goodsiItem);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
+ Promise.all(arr).then((data) => {
|
|
|
+ console.log(this.warehousingMaterialList);
|
|
|
+ console.log(this.resultArray);
|
|
|
+ this.warehousingMaterialList = data;
|
|
|
+ if (this.resultArray.length > 0) {
|
|
|
+ this.isSplit = true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // } else {
|
|
|
+ // this.formData.bizType = '2';
|
|
|
+ // this.title = '采购入库';
|
|
|
+ // }
|
|
|
},
|
|
|
async pickerSuccess(row) {
|
|
|
this.pickerRow = row;
|
|
|
@@ -1986,6 +2304,10 @@
|
|
|
this.formData.extInfo.supplierId = '';
|
|
|
this.$forceUpdate();
|
|
|
},
|
|
|
+
|
|
|
+ handleStockOutOrder() {
|
|
|
+ this.$refs.stockOutOrderRef.open();
|
|
|
+ },
|
|
|
handleOutsourcedOrders() {
|
|
|
this.$refs.outsourcedOrdersRef.open();
|
|
|
},
|
|
|
@@ -2538,6 +2860,19 @@
|
|
|
},
|
|
|
|
|
|
handleSave() {
|
|
|
+ if (this.isOutsourcing) {
|
|
|
+ if (!this.formData.extInfo.documentSource) {
|
|
|
+ this.$message.error('请选择委外申请单!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ let boolen = this.warehousingMaterialList.every(
|
|
|
+ (item) => item.houseList.length > 0
|
|
|
+ );
|
|
|
+ if (!boolen) {
|
|
|
+ this.$message.error('请选择产品仓库!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
this.$refs.formName.validate(async (valid) => {
|
|
|
if (valid) {
|
|
|
if (!this.warehousingMaterialList?.length) {
|
|
|
@@ -2564,7 +2899,7 @@
|
|
|
manualBatchNo: item.manualBatchNo,
|
|
|
batchNo: item.batchNo,
|
|
|
categoryId:
|
|
|
- this.formData.bizType == 2
|
|
|
+ this.formData.bizType == 2 || this.formData.bizType == 12
|
|
|
? item.categoryId
|
|
|
? item.categoryId
|
|
|
: item.id
|