Commit 915c4216 by huangqy

临时单据保存

parent 71593ac9
......@@ -41,7 +41,7 @@ export struct WzInsertInfo {
@State currentPmdmcode: string = '' //当前扫描pmdm10位
@State defaultHwh: string = this.convertionDefaultHwh()
@State hjsl: number | string = this.convertionHjsl()
@State hjsl: string = this.convertionHjsl()
@State currentDw: string = ''
@State kfmc: string = ''
@ObjectLink wzcrk: PzFormClass
......@@ -67,8 +67,9 @@ export struct WzInsertInfo {
* @return {*}
* @author: 王弘钢
*/
convertionHjsl() {
convertionHjsl(): string {
var newData = this.historicalInformation
newData.forEach((item, index) => {
if (this.pageType == '调号') {
if (item.currentModel) {
......@@ -112,9 +113,11 @@ export struct WzInsertInfo {
res2 = sArr.reduce((x, y) => x + y);
}
if (this.pageType == '调号' || this.pageType == '换位') {
return res1 || 0
return (res1 || 0).toString()
} else {
return res1 || 0 + '/' + res2 || 0
console.log(".......---计算的数量1---", JSON.stringify(this.historicalInformation))
console.log(".......---计算的数量2---", (res1 || 0 + '/' + res2 || 0))
return (res1 || 0 + '/' + res2 || 0).toString()
}
// const srslList = this.historicalInformation.map(item => {
// if (item.srsl) {
......@@ -354,6 +357,18 @@ export struct WzInsertInfo {
}
// 6.处理物资数据
if (res.data && res.data.length > 0) {
let isNumber = false
res.data.forEach(element => {
if (/^\d+$/.test(element.srsl)) { // 判断扫描的物资的srsl一定是数字才会通过校验不是就报错
isNumber = true
}
});
if (!isNumber) {
Prompt.showToast({
message: '当前扫描的物资信息不完整',
})
return
}
// this.currentWZInfo = res.data
res.data.forEach((ITEM) => {
if (this.historicalInformation && this.historicalInformation.length > 0) {
......@@ -398,7 +413,7 @@ export struct WzInsertInfo {
const [data] = this.historicalInformation.filter((item, index) => item
.pmdmcode == ITEM.pmdmcode && item.hwh == this.wzcrk.hwh && item
.currentModel == this.currentModel)
console.log('data', data)
console.log('-------data-----', data)
if (data) {
this.historicalInformation.forEach((item, index) => {
if (item.pmdmcode == data.pmdmcode && item.hwh == this
......@@ -428,12 +443,14 @@ export struct WzInsertInfo {
// @ts-ignore
hjguid: this.wzcrk.hjguid,
hwsl: ITEM.srsl,
crksl: ITEM.srsl,
currentModel: this.currentModel,
guid: uuid()
}
// this.handleCkHwWzTest(params, (RES) => {
// if (RES) {
this.historicalInformation.push(params)
console.log("------------1.0historicalInformation--------" + JSON.stringify(params));
this.setWZInfo(res.data)
// }
// })
......@@ -445,11 +462,13 @@ export struct WzInsertInfo {
// @ts-ignore
hjguid: this.wzcrk.hjguid,
hwsl: ITEM.srsl,
crksl: ITEM.srsl,
currentModel: this.currentModel,
guid: uuid()
}
// this.handleCkHwWzTest(params, (RES) => {
// if (RES) {
console.log("------------2.0historicalInformation--------" + JSON.stringify(params));
this.historicalInformation.push(params)
this.setWZInfo(res.data)
// }
......@@ -1206,7 +1225,7 @@ export struct WzInsertInfo {
Text("品种个数:")
Text(this.historicalInformation.length + '' || '0').fontColor("#0fa983").fontSize(20).fontWeight(700)
Text("合计数量:")
Text(this.hjsl + '').fontColor("#0fa983").fontSize(20).fontWeight(700)
Text(this.hjsl).fontColor("#0fa983").fontSize(20).fontWeight(700)
}
}.padding({ left: 2, right: 10 })
.width("100%")
......
......@@ -131,7 +131,7 @@ export struct AddWzin {
const kfList = await kfModel.query({})
// 获取货架列表
const hwList = await hwModel.query()
// const hwList = await hwModel.query()
// 获取单位列表
const dwList = await gldwModel.queryByData({})
......@@ -140,17 +140,18 @@ export struct AddWzin {
this.form.push(new Form(i))
})
kfList.forEach(i => {
this.form[this.form.findIndex(v => v.key == 'kfdm')]
.options
.push(new Options(i.kfmc, i.kfdm))
})
hwList.forEach(i => {
this.form[this.form.findIndex(v => v.key == 'hwh')]
.options
.push(new Options(i.hwh, i.hwh))
})
// hwList.forEach(i => {
// this.form[this.form.findIndex(v => v.key == 'hwh')]
// .options
// .push(new Options(i.hwh, i.hwh))
// })
zmlx_dict.forEach(i => {
......
......@@ -22,7 +22,7 @@ export struct WzList {
Column() {
Row() {
Text("总数: ")
Text(this.wzmx.pzsl + '')
Text(this.wzmx.pzsl ? this.wzmx.pzsl + '' : this.wzmx.crksl + '')
}.alignSelf(ItemAlign.End).padding({ top: 5, bottom: 5 })
Row() {
......
......@@ -127,7 +127,7 @@ struct WzinsertDetail {
Button("保存").CommonButtonStyle().width("50%")
.onClick(async () => {
try {
Logger.info('保存的入库明细数据>>', JSON.stringify(this.historicalInformation))
Logger.info('保存的入库明细数据>>', JSON.stringify(this.historicalInformation))
// if (this.isUpdate) {
// const crksl = this.historicalInformation.map(v => Number(v.crksl)).reduce((a, b) => a + b, 0)
......@@ -153,14 +153,15 @@ struct WzinsertDetail {
this.wzcrk.sjlx = '新建'
await wzcrkModel.setOne(this.wzcrk)
Logger.info('添加的入库数据>>', JSON.stringify(this.wzcrk))
await wzcrkmxModel.set(this.historicalInformation)
// }
promptAction.showToast({
message: '保存入库数据成功',
bottom: 300
})
setTimeout(() => {
router.back({ url: 'pages/metailmange/WzInPage/WzInPage' })
}, 300)
// setTimeout(() => {
// router.back({ url: 'pages/metailmange/WzInPage/WzInPage' })
// }, 300)
} catch (e) {
promptAction.showToast({
message: '保存入库数据失败',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论