From bf853ab0d81fa04ca707b273413156f2cbbdbef5 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@63.com> Date: 星期四, 30 六月 2022 15:22:50 +0800 Subject: [PATCH] # --- static/js/object/StaTask.js | 89 ++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 84 insertions(+), 5 deletions(-) diff --git a/static/js/object/StaTask.js b/static/js/object/StaTask.js index a24aba1..31479ea 100644 --- a/static/js/object/StaTask.js +++ b/static/js/object/StaTask.js @@ -1,26 +1,105 @@ - - - +import {InitPallet, InitGoods} from './StoreGoods.js'; // 杈撻�佺嚎褰撳墠杩愯鐘舵�佸璞� function StaTask(staData, object) { let that = this; + that.object = object; + that.no = 0; + that.readyIn = false; that.run = false; + that.loaded = 0; + that.wrkNo = null; + + that.inlet = -1; + that.outlet = -1; + + that.position = null; let init = function () { that.no = staData.no; + that.inlet = staData.inlet; + that.outlet = staData.outlet; + + let item = getArrVal(conveyObjects.objects, "no", that.no+""); + if (!that.position && item) { + that.position = item.position; + } } init(); - that.modify = function (staData) { + if (that.run || that.no === 0) { + console.error(staData.no + "鍙疯緭閫佺嚎鏇存柊澶辫触"); + return; + } + + // 椤甸潰鍒囨崲瀵艰嚧璐х墿瑕嗙洊 + if (that.loaded === 1 && staData.loaded === 1 && staData.wrkNo > 0 && that.wrkNo > 0 && that.wrkNo !== staData.wrkNo) { + if (that.inlet === 1) { + // remove + console.log("sta_" + that.no + " remove锛�" + that.wrkNo + "-Pallet锛� " + that.wrkNo + "-Goods"); + that.object.removeObject(that.wrkNo + "-Pallet"); + that.object.removeObject(that.wrkNo + "-Goods"); + // add + console.log("sta_" + that.no + " add锛�" + staData.wrkNo + "-Pallet + Goods锛� [up]"); + InitPallet(that.object, [{wrkNo: staData.wrkNo}], {position: that.position}, 2); + InitGoods(that.object, [{wrkNo: staData.wrkNo}], {position: that.position}, 2); + } + + that.readyIn = false; + } + + if (that.loaded === 0 && staData.loaded === 1) { + that.readyIn = true; + } + if (that.readyIn && staData.wrkNo && staData.wrkNo !== '0') { + // 鏃犺揣 ===>> 鏈夎揣 + + // 1.鍏ュ簱绗竴绔� 銆愭柊澧炪�� + if (that.inlet === 1) { + console.log("sta_" + that.no + " add锛�" + staData.wrkNo + "-Pallet + Goods锛� [down]"); + InitPallet(that.object, [{wrkNo: staData.wrkNo}], {position: that.position}, 2); + InitGoods(that.object, [{wrkNo: staData.wrkNo}], {position: that.position}, 2); + + // 2.鏉ヨ嚜鍏朵粬绔欑偣鐨勮揣鐗� 銆愮Щ鍔ㄣ�� + } else { + + } + that.readyIn = false; + } + + if (that.loaded === 1 && staData.loaded === 0) { + // 鏈夎揣 ===>> 鏃犺揣 + + // 1.鍑哄簱鏈�鍚庝竴绔� 銆愮Щ闄ゃ�� + if (that.outlet === 1) { + let pallet = getArrVal(that.object.objects, "name", that.wrkNo + "-Pallet"); + if (pallet != null) { + that.object.removeObject(that.wrkNo + "-Pallet"); + } + let goods = getArrVal(that.object.objects, "name", that.wrkNo + "-Goods"); + if (goods != null) { + that.object.removeObject(that.wrkNo + "-Goods"); + } + } + that.readyIn = false; + } + + // 瀹炴椂鏇存柊 + that.loaded = staData.loaded; + that.wrkNo = staData.wrkNo; + // that.run = true; } that.change = function () { - console.log(1) + + + } } + +export {StaTask} -- Gitblit v1.9.1