|
@@ -39,7 +39,7 @@
|
|
|
<el-button
|
|
|
class="sureBtn"
|
|
|
type="primary"
|
|
|
- :disabled="outStatus || addStatus"
|
|
|
+ :disabled="outStatus || addStatus || Machinery"
|
|
|
@click="sureToOut"
|
|
|
>出库
|
|
|
</el-button>
|
|
@@ -47,10 +47,14 @@
|
|
|
<el-col :span="8">
|
|
|
<div class="type-title">盒内原有物料</div>
|
|
|
<el-scrollbar class="outing-container">
|
|
|
+ <div style="height: 300px" v-if="Machinery">
|
|
|
+ <MachineryLoading />
|
|
|
+ </div>
|
|
|
<div v-if="!outStatus">
|
|
|
<div class="addbox" v-if="addSuccessStatus">
|
|
|
扫码的盒子编码:{{ addBoxInfo.code }}
|
|
|
</div>
|
|
|
+
|
|
|
<ScanCodeInput
|
|
|
v-if="addStatus && addSuccessStatus == false"
|
|
|
v-model="addBoxSearch"
|
|
@@ -63,6 +67,8 @@
|
|
|
class="sureBtn"
|
|
|
:type="addStatus ? 'info' : 'primary'"
|
|
|
@click="changeAddStatus"
|
|
|
+ :disabled="Machinery"
|
|
|
+ style="margin-bottom: 20px"
|
|
|
>{{ addStatus ? "取消" : "入库新载具" }}
|
|
|
</el-button>
|
|
|
</div>
|
|
@@ -75,12 +81,18 @@
|
|
|
<div class="material-title">
|
|
|
{{ material.materialName }} | {{ material.materialNo }}
|
|
|
</div>
|
|
|
- <div
|
|
|
- @click="deleteIndexOld(index)"
|
|
|
+ <!-- <div
|
|
|
+ @click=""
|
|
|
class="material-title deleteSty"
|
|
|
>
|
|
|
删除
|
|
|
- </div>
|
|
|
+ </div> -->
|
|
|
+ <i-ep-delete
|
|
|
+ class="delete-btn"
|
|
|
+ color="#ff4d4f"
|
|
|
+ size="20px"
|
|
|
+ @click="deleteIndexOld(index)"
|
|
|
+ />
|
|
|
</div>
|
|
|
<div class="material-info">
|
|
|
<div>批次号/序列号</div>
|
|
@@ -98,7 +110,11 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-scrollbar>
|
|
|
- <el-button class="sureBtn" type="info" @click="backToStorage"
|
|
|
+ <el-button
|
|
|
+ class="sureBtn"
|
|
|
+ type="info"
|
|
|
+ @click="backToStorage"
|
|
|
+ :disabled="Machinery || !boxStatus"
|
|
|
>入库
|
|
|
</el-button>
|
|
|
</el-col>
|
|
@@ -127,17 +143,27 @@
|
|
|
<span class="unit">{{ item.unitDictLabel }}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div
|
|
|
+ <!-- <div
|
|
|
@click="deleteIndexScanAdd(index)"
|
|
|
class="list-box-delete deleteSty"
|
|
|
>
|
|
|
删除
|
|
|
- </div>
|
|
|
+ </div> -->
|
|
|
+ <i-ep-delete
|
|
|
+ class="delete-btn"
|
|
|
+ color="#ff4d4f"
|
|
|
+ size="20px"
|
|
|
+ @click="deleteIndexScanAdd(index)"
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-scrollbar>
|
|
|
- <el-button class="sureBtn" type="primary" @click="sureToAdd"
|
|
|
+ <el-button
|
|
|
+ class="sureBtn"
|
|
|
+ type="primary"
|
|
|
+ @click="sureToAdd"
|
|
|
+ :disabled="Machinery || materialList.length < 1 || !boxStatus"
|
|
|
>确认添加
|
|
|
</el-button>
|
|
|
</el-col>
|
|
@@ -158,6 +184,10 @@ import {
|
|
|
toOutBox,
|
|
|
inBoxAPI,
|
|
|
} from "@/api/storage/in";
|
|
|
+import { getStorageOrderInfo } from "@/api/storage/out";
|
|
|
+import { useCommonStoreHook } from "@/store";
|
|
|
+
|
|
|
+const commonS = useCommonStoreHook();
|
|
|
|
|
|
const boxSearch = ref("");
|
|
|
const deleteIndexOld = (index: any) => {
|
|
@@ -169,16 +199,25 @@ const deleteIndexScanAdd = (index: any) => {
|
|
|
materialList.value.splice(index, 1);
|
|
|
ElMessage.success("操作成功!");
|
|
|
};
|
|
|
-
|
|
|
+//硬件操作期间的状态:false 表示未有操作 true表示硬件在操作中
|
|
|
+const Machinery = ref(false);
|
|
|
//盒内原有物料data
|
|
|
const boxesList = ref<any[]>([]);
|
|
|
+//新加载具的开起状态
|
|
|
const addStatus = ref(false);
|
|
|
+//新加载具的成功状态
|
|
|
const addSuccessStatus = ref(false);
|
|
|
+//新加载具的内容
|
|
|
const addBoxInfo = ref();
|
|
|
-//选中的item
|
|
|
+//库中选中的item
|
|
|
const currentBox = ref<any>({});
|
|
|
+//绑定当前盒子的状态
|
|
|
+const boxStatus = ref(false);
|
|
|
const currentBoxIndex = ref(-1);
|
|
|
+//库中选中的状态
|
|
|
const outStatus = ref(false);
|
|
|
+//新扫时候的input值
|
|
|
+const addBoxSearch = ref("");
|
|
|
const resetData = () => {
|
|
|
addSuccessStatus.value = false;
|
|
|
addBoxInfo.value = null;
|
|
@@ -192,6 +231,7 @@ const resetData = () => {
|
|
|
boxSearch.value = "";
|
|
|
addStatus.value = false;
|
|
|
outStatus.value = false;
|
|
|
+ boxStatus.value = false;
|
|
|
};
|
|
|
const changeAddStatus = () => {
|
|
|
if (addStatus.value == true) {
|
|
@@ -200,7 +240,7 @@ const changeAddStatus = () => {
|
|
|
addStatus.value = !addStatus.value;
|
|
|
}
|
|
|
};
|
|
|
-const addBoxSearch = ref("");
|
|
|
+
|
|
|
//扫盒子
|
|
|
const addenterBox = () => {
|
|
|
addBoxSearch.value = addBoxSearch.value.trim();
|
|
@@ -211,6 +251,7 @@ const addenterBox = () => {
|
|
|
outingBox.value.vehicleId = addBoxInfo.value.id;
|
|
|
outingBox.value.houseNo = "1";
|
|
|
ElMessage.success("扫码成功!");
|
|
|
+ boxStatus.value = true;
|
|
|
});
|
|
|
};
|
|
|
//出库
|
|
@@ -220,6 +261,7 @@ const enterBox = () => {
|
|
|
boxSearch.value ? { vehicleCode: boxSearch.value } : {}
|
|
|
).then((res) => {
|
|
|
boxesList.value = res.data;
|
|
|
+ commonS.orderInId = res.data.orderId;
|
|
|
});
|
|
|
};
|
|
|
const clickBox = (box: any, index: number) => {
|
|
@@ -228,38 +270,90 @@ const clickBox = (box: any, index: number) => {
|
|
|
};
|
|
|
//出库操作
|
|
|
const sureToOut = async () => {
|
|
|
- await toOutBox({
|
|
|
+ let res = await toOutBox({
|
|
|
vehicleNo: currentBox.value.vehicleNo,
|
|
|
houseNo: currentBox.value.houseNo,
|
|
|
});
|
|
|
- ElMessage.success("出库成功");
|
|
|
+ ElMessage.success("出库成功,等待料箱到达捡料位置");
|
|
|
+
|
|
|
+ commonS.orderInId = res.data.orderId;
|
|
|
+ commonS.changeBoxType = 1;
|
|
|
+ Machinery.value = true;
|
|
|
+ checkHasOuting();
|
|
|
outStatus.value = true;
|
|
|
- outingBox.value = currentBox.value;
|
|
|
- if (outingBox.value.list.length > 0) {
|
|
|
- outingMaterials.value = outingBox.value.list;
|
|
|
- outingRawBoxList = JSON.parse(JSON.stringify(outingBox.value.list));
|
|
|
- } else {
|
|
|
- outingRawBoxList = [];
|
|
|
- outingMaterials.value = [];
|
|
|
+};
|
|
|
+//定时器任务
|
|
|
+let outInterval: number = -1;
|
|
|
+const checkHasOuting = () => {
|
|
|
+ // 点击出库之后,需要在其他地方(机器)确实已经到达检料位置,才能进行捡料
|
|
|
+ // 接口需要传入出库outBox接口返回的orderId转为id传上去, 如果有这个orderId就开始轮询
|
|
|
+ // 如果没有数据则停止轮询。数据返回的state是1处理中2启用3处理异常4已完成, 当为3或者4的时候停止轮询,并且在派发后清空oderid。
|
|
|
+ if (commonS.orderInId != -1) {
|
|
|
+ outInterval = setInterval(() => {
|
|
|
+ getStorageOrderInfo({ id: commonS.orderInId })
|
|
|
+ .then((res: any) => {
|
|
|
+ if (res.data) {
|
|
|
+ if (res.data.state === 3 || res.data.state === 4) {
|
|
|
+ clearInterval(outInterval);
|
|
|
+ commonS.orderInId = -1;
|
|
|
+ if (commonS.changeBoxType === 1) {
|
|
|
+ outingBox.value = currentBox.value;
|
|
|
+ if (outingBox.value.list.length > 0) {
|
|
|
+ outingMaterials.value = outingBox.value.list;
|
|
|
+ outingRawBoxList = JSON.parse(
|
|
|
+ JSON.stringify(outingBox.value.list)
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ outingRawBoxList = [];
|
|
|
+ outingMaterials.value = [];
|
|
|
+ }
|
|
|
+ getStorageBoxesList({}).then((res: any) => {
|
|
|
+ boxesList.value = res.data;
|
|
|
+ });
|
|
|
+ currentBoxIndex.value = -1;
|
|
|
+ ElMessage.success("料箱已到达");
|
|
|
+ Machinery.value = false;
|
|
|
+ boxStatus.value = true;
|
|
|
+ } else {
|
|
|
+ resetData();
|
|
|
+ getStorageBoxesList({}).then((res) => {
|
|
|
+ boxesList.value = res.data;
|
|
|
+ });
|
|
|
+ ElMessage.success("料箱入库成功");
|
|
|
+ Machinery.value = false;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ outStatus.value = false;
|
|
|
+ ElMessage.error(res.msg);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ clearInterval(outInterval);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ clearInterval(outInterval);
|
|
|
+ commonS.orderInId = -1;
|
|
|
+ Machinery.value = false;
|
|
|
+ });
|
|
|
+ }, 5000);
|
|
|
}
|
|
|
};
|
|
|
-
|
|
|
let outingRawBoxList: any[] = []; //确认添加的时候会对比捡料位和扫描的数量,多次点击会导致捡料位的数字一直改变,所以用一个变量来保存原始的捡料位数据
|
|
|
const outingBox = ref<any>({});
|
|
|
const outingMaterials = ref<any[]>([]);
|
|
|
const backToStorage = async () => {
|
|
|
- await backToStorageAPI({
|
|
|
+ const { data } = await backToStorageAPI({
|
|
|
vehicleCode: outingBox.value.vehicleNo,
|
|
|
houseNo: outingBox.value.houseNo,
|
|
|
detailsList: outingMaterials.value,
|
|
|
});
|
|
|
outingBox.value = {};
|
|
|
outingMaterials.value = [];
|
|
|
- ElMessage.success("返库成功");
|
|
|
- resetData();
|
|
|
- getStorageBoxesList({}).then((res) => {
|
|
|
- boxesList.value = res.data;
|
|
|
- });
|
|
|
+ ElMessage.success("返库操作成功,等待料箱到达");
|
|
|
+ commonS.changeBoxType = 2;
|
|
|
+ commonS.orderInId = data.orderId;
|
|
|
+ Machinery.value = true;
|
|
|
+ checkHasOuting();
|
|
|
};
|
|
|
|
|
|
// 物料
|
|
@@ -326,6 +420,7 @@ onMounted(() => {
|
|
|
getStorageBoxesList({}).then((res) => {
|
|
|
boxesList.value = res.data;
|
|
|
});
|
|
|
+ checkHasOuting();
|
|
|
});
|
|
|
</script>
|
|
|
|