Browse Source

发料记录修改扫描物料校验

wms3.0_pda
lijuncheng 10 months ago
parent
commit
daa186e85f
  1. 49
      common/directory.js
  2. 1
      common/record.js
  3. 8
      mycomponents/scan/winComScan.vue
  4. 103
      mycomponents/scan/winScanItem.vue
  5. 2
      pages/index/index.vue
  6. 52
      pages/issue/coms/comIssueRequestPopup.vue
  7. 7
      pages/issue/record/issueRecord.vue

49
common/directory.js

@ -1,5 +1,6 @@
let jobStatusList = [];
let itemStatusList = [];
let itemTypeList =[];
let locationTypeList = [];
let uomList = [];
let inventoryStatusList = [];
@ -39,6 +40,7 @@ export function getBusinessTypeDesc(type) {
export function clearCacheData() {
jobStatusList = [];
itemStatusList = [];
itemTypeList =[];
locationTypeList = [];
uomList = [];
inventoryStatusList = [];
@ -143,16 +145,57 @@ export function getJobStateStyle(value) {
}
}
//获取库位描述
export function getListLocationTypeDesc(lst) {
//获取库位描述(多个库位)
export function getListLocationTypeDesc(list) {
let desc = '';
lst.forEach(res => {
list.forEach(res => {
desc += getLocationTypeInfo(res).label + ","
})
desc = desc.slice(0, -1);
return desc;
}
//获取物品状态(多个状态)
export function getListItemStateDesc(list) {
let desc = '';
list.forEach(res => {
desc += getItemStateInfo(res).label + ","
})
desc = desc.slice(0, -1);
return desc;
}
//获取物品类型(多个)
export function getListItemTypeDesc(list) {
let desc = '';
list.forEach(res => {
desc += getItemTypeInfo(res).label + ","
})
desc = desc.slice(0, -1);
return desc;
}
//获取物品类型
export function getItemTypeInfo(value) {
var resultInfo = "";
if (itemTypeList.length == 0) {
itemTypeList = getDirectoryInfo("item_type")
}
if (itemTypeList.length > 0) {
for (let item of itemTypeList) {
if (item.value == value) {
resultInfo = item
break;
}
}
}
return resultInfo
}
//获取物品状态
export function getItemStateInfo(value) {
var resultInfo = "";

1
common/record.js

@ -67,6 +67,7 @@ export function getBusinessType(typeCode, callback) {
result.businessType = res.data.list[0];
result.fromlocationTypeList = getDirectoryItemArray(res.data.list[0].outLocationTypes)
result.tolocationTypeList = getDirectoryItemArray(res.data.list[0].inLocationTypes)
result.itemCodeTypeList = getDirectoryItemArray(res.data.list[0].itemTypes)
result.fromInventoryStatuses = res.data.list[0].outInventoryStatuses;
result.toInventoryStatuses = res.data.list[0].inInventoryStatuses;
callback(result)

8
mycomponents/scan/winComScan.vue

@ -141,13 +141,19 @@
// })
let that = this;
let index = that.scanMsg.indexOf('\n');
if (index > 0) {
if (index >= 0) {
// that.scanMsg = 'HPQ;V1.0;ICE115F11161AG;PP20230427000027;B20230427002;Q50';
setTimeout(() => {
that.losefocus();
let content = uni.$u.trim(that.scanMsg)
if (content == "") {
that.getfocus();
this.$refs.comMessage.showErrorMessage("扫描内容为空,请重新扫描", res => {
if (res) {
that.scanMsg=""
that.getfocus();
}
})
return;
}

103
mycomponents/scan/winScanItem.vue

@ -13,29 +13,42 @@
</view>
<view class="">
<view class="">
<win-com-scan ref="scan" @getResult="getScanResult"
:placeholder='title'
:clearResult="false"
headerType="HMQ,HPQ">
<win-com-scan ref="scan" @getResult="getScanResult" :placeholder='title' :clearResult="false"
headerType="HMQ,HPQ">
</win-com-scan>
</view>
</view>
</view>
</uni-popup>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
import {
getBasicItemByCode
} from '@/api/request2.js';
import {
getLocationTypeName,
getListLocationTypeDesc,
checkDirectoryItemExist,
getListItemTypeDesc,
getItemTypeInfo
} from '@/common/directory.js';
import winComScan from '@/mycomponents/scan/winComScan.vue'
import comMessage from '@/mycomponents/common/comMessage.vue'
export default {
name: 'winScanItem',
components: {
winComScan
winComScan,
comMessage
},
emits: ["getScanCode",'getScanResult'],
emits: ["getScanCode", 'getScanResult'],
props: {
title: {
type: String,
@ -44,7 +57,11 @@
isShowRecord: {
type: Boolean,
default: true
}
},
itemCodeTypeList: {
type: Array,
default: []
},
},
data() {
return {
@ -80,22 +97,76 @@
this.$refs.scan.clearScanValue();
},
getScanResult(result) {
this.result = result;
if (result.label.barType == "QRCode") {
this.code = result.label.itemCode;
} else if (result.label.barType == "BarCode") {
this.code = result.label.code;
uni.showLoading({
title: '扫描中...',
mask: true
});
var scanResult = result;
if (scanResult.label.barType == "QRCode") {
this.code = scanResult.label.itemCode;
} else if (scanResult.label.barType == "BarCode") {
this.code = scanResult.label.code;
}
this.callBack();
if (this.code == undefined) {
uni.hideLoading();
this.showErrorMessage("扫描物料[" + this.code + "]为空,请输入正确的物料")
return
}
getBasicItemByCode(this.code).then(res => {
uni.hideLoading();
if (res.data != null && res.data.list.length > 0) {
var result =res.data.list[0];
var status =result.status;
var type = result.type;
var itemCode = result.code
var itemName =result.name
var uom = result.uom
var std = result.uom
result.package = scanResult.package
if(status=="ENABLE"){
if(checkDirectoryItemExist(this.itemCodeTypeList,type)){
this.result =result;
this.callBack()
}else {
var hint = getListItemTypeDesc(this.itemCodeTypeList);
this.showErrorMessage("扫描物料[" + this.code + "]是[" +
getItemTypeInfo(type).label + "],需要的物料类型是[" + hint + "]")
}
}else {
this.showErrorMessage('物料【' + this.code + '】不可用');
}
} else {
this.showErrorMessage('未查找到物料【' + this.code + '】');
}
}).catch(error => {
uni.hideLoading();
this.showErrorMessage(error)
})
},
callBack() {
this.closeScanPopup();
this.$refs.scan.clear();
this.$emit("getScanCode", this.code);
// this.$emit("getScanCode", this.code);
this.$emit("getScanResult", this.code, this.result);
},
change(e) {
this.isShow = e.show
}
},
showErrorMessage(message) {
this.losefocus();
this.$refs.comMessage.showErrorMessage(message, res => {
this.code = '';
this.getfocus();
})
},
getfocus() {
this.$refs.scan.getfocus();
},
losefocus() {
this.$refs.scan.losefocus();
},
}
}
</script>

2
pages/index/index.vue

@ -317,7 +317,7 @@
},
getDictory() {
var params = {
types: ["job_status", "location_type", "item_status", "uom",
types: ["job_status", "location_type", "item_status","item_type","uom",
"inventory_status", "container_type", "pack_unit", "unplanned_receipt_reason",
"unplanned_issue_reason", "scrap_reason", "inspect_failed_reason",
"request_status", "inspect_type", "next_action", "sample_method", "transfer_mode",

52
pages/issue/coms/comIssueRequestPopup.vue

@ -62,7 +62,7 @@
</view>
</view>
</uni-popup>
<win-scan-item ref="scanPopup" title='物料代码' @getScanResult='getItemScanResult'>
<win-scan-item ref="scanPopup" title='物料代码' @getScanResult='getItemScanResult' :itemCodeTypeList="itemCodeTypeList" >
</win-scan-item>
<comMessage ref="comMessage"></comMessage>
</view>
@ -97,7 +97,6 @@
},
data() {
return {
// itemCode: 'CE115F11161AG',
workshopCode: "", //
workShopName: "",
productionLineCode: "", //线
@ -112,7 +111,6 @@
itemCodeFocus: false,
requestInfo: null,
itemCodeList: [],
isCheckItemCode: false,
counQty: undefined,
editPosition: true,
numberFocus: false,
@ -131,6 +129,10 @@
type: String,
default: '需求信息'
},
itemCodeTypeList: {
type: Array,
default: []
},
},
methods: {
checkNum(e) {
@ -162,7 +164,6 @@
this.isModifiedPosition = false
} else {
this.itemCode = "";
this.isCheckItemCode = false;
this.show = false
this.uom = ""
this.qty = 0;
@ -177,7 +178,6 @@
initData(){
this.positionList = [];
this.itemCode = "请扫描物料信息";
this.isCheckItemCode = false;
this.rawLocationCode =""
this.positionInfo ="请选择位置"
this.workshopCode= "" //
@ -211,10 +211,6 @@
itemCodeLoseFocus() {
this.itemCodeFocus = false;
},
selectedItem(item) {
this.itemCode = item.itemCode;
this.checkItemCode();
},
confirm() {
if (this.positionInfo == "请选择位置" ) {
@ -222,7 +218,7 @@
return
}
if (this.itemCode == "" || !this.isCheckItemCode) {
if (this.itemCode == "请扫描物料信息") {
this.showErrorMessage("请输入物料", "itemCode")
return
}
@ -243,28 +239,6 @@
this.callback('add');
},
checkItemCode(itemCode) {
//
getBasicItemByCode(itemCode).then(res => {
uni.hideLoading();
this.$refs.scanPopup.closeScanPopup();
if (res.data != null && res.data.list.length > 0) {
this.itemCode = res.data.list[0].code;
this.itemName = res.data.list[0].name
this.isCheckItemCode = true;
this.numberFocus = true
this.uom = res.data.list[0].uom
} else {
this.showErrorMessage('未查找到物料【' + itemCode + '】', "itemCode");
}
}).catch(error => {
uni.hideLoading();
this.showErrorMessage(error, "itemCode");
})
},
callback(action) {
let item = {
positionInfo: this.positionInfo,
@ -295,8 +269,7 @@
}
})
if (type == "itemCode") {
this.itemCode = ""
this.isCheckItemCode = false;
this.itemCode = "请扫描物料信息"
}
})
},
@ -343,13 +316,12 @@
},
getItemScanResult(code, scanResult) {
if (code == "") {
this.showErrorMessage('物料号不能为空')
return;
}
this.itemCode = "";
this.checkItemCode(code)
this.itemCode = code;
this.itemName = scanResult.name
this.uom =scanResult.uom
this.stdPackInfo = scanResult.package;
this.numberFocus = true
}
}
}

7
pages/issue/record/issueRecord.vue

@ -39,7 +39,7 @@
</view>
</view>
<com-issue-request-popup ref="comIssueRequestPopup" @confirm='requestConfirm'></com-issue-request-popup>
<com-issue-request-popup ref="comIssueRequestPopup" @confirm='requestConfirm' :itemCodeTypeList="itemCodeTypeList"></com-issue-request-popup>
<win-scan-button v-if='detailSource.length>0' @goScan='openScanDetailPopup'></win-scan-button>
<com-scan-issue-pack ref="comScanIssuePack" @closeScan='closeScan' @updateData='updateData'>
</com-scan-issue-pack>
@ -113,7 +113,8 @@
toInventoryStatuses: "",
requestList: [],
dataContent: {},
managementList: []
managementList: [],
itemCodeTypeList: []
}
},
mounted() {
@ -129,7 +130,7 @@
getBusinessType(typeCode, res => {
if (res.success) {
this.businessType = res.businessType;
this.fromlocationTypeList = res.fromlocationTypeList;
this.itemCodeTypeList = res.itemCodeTypeList;
this.tolocationTypeList = res.tolocationTypeList;
this.fromInventoryStatuses = res.fromInventoryStatuses
this.toInventoryStatuses = res.toInventoryStatuses

Loading…
Cancel
Save