Commit 915c4216 by huangqy

临时单据保存

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