Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
J
jump_hm_warehouse
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Members
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
毛勇泽
jump_hm_warehouse
Commits
71593ac9
Commit
71593ac9
authored
Jan 27, 2024
by
huangqy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
所有的临时单据
parent
743822e7
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
1506 行增加
和
23 行删除
+1506
-23
WzcrkmxDao.ets
common/src/main/ets/db/dao/WzcrkmxDao.ets
+1
-1
WzInfo.ets
entry/src/main/ets/pages/metailmange/Common/WzInfo.ets
+11
-8
WzInsertInfo.ets
entry/src/main/ets/pages/metailmange/Common/WzInsertInfo.ets
+1260
-0
Wzcrk.data.ets
entry/src/main/ets/pages/metailmange/Common/Wzcrk.data.ets
+6
-0
WzInPage.ets
entry/src/main/ets/pages/metailmange/WzInPage/WzInPage.ets
+2
-2
AddWzin.ets
entry/src/main/ets/pages/metailmange/WzInPage/WzinDetail/AddWzin.ets
+12
-11
WzinsertDetail.ets
entry/src/main/ets/pages/metailmange/WzInPage/WzinDetail/WzinsertDetail.ets
+212
-0
main_pages.json
entry/src/main/resources/base/profile/main_pages.json
+2
-1
没有找到文件。
common/src/main/ets/db/dao/WzcrkmxDao.ets
View file @
71593ac9
...
...
@@ -373,7 +373,7 @@ export class WzcrkmxDao extends BaseTable<Wzcrkmx> {
try {
let val_sql = NativeSql.insertWzSql(params)
let db = await this.futureDb;
let rs = await db.
query
Sql(val_sql);
let rs = await db.
execute
Sql(val_sql);
return rs;
} catch (e) {
throw new Error('[插入异常]|' + e)
...
...
entry/src/main/ets/pages/metailmange/Common/WzInfo.ets
View file @
71593ac9
...
...
@@ -3,7 +3,7 @@ import { Logger } from '@ohos/common';
import gldwModel from '../../../model/GldwModel';
import kfModel from '../../../model/KfModel';
import { DividerTitle } from '../../../view/DividerTitle/DividerTitle';
import { historicalInformationClass, PzFormClass, ScanWzClass, WzClass
, WzmxClass
} from './Wzcrk.data';
import { historicalInformationClass, PzFormClass, ScanWzClass, WzClass } from './Wzcrk.data';
import { WzList } from '../WzInPage/WzinDetail/WzList';
import { WzScanInfoDialog } from './Dialog/WzScanInfoDialog';
import { analysisQrCode } from '../../../identify/analysis/analysis_QR_code'
...
...
@@ -11,8 +11,6 @@ import emitter from '@ohos.events.emitter';
import Prompt from '@system.prompt';
import wzcrkmxModel from '../../../model/WzcrkmxModel';
import { dateUtils, uuid } from '@ohos/common/src/main/ets/utils/util';
import { PzMxDto } from '@ohos/common/src/main/ets/bean/dto/RecommendHwDto.ts';
import wzcrkModel from '../../../model/WzcrkModel';
@Extend(Button) function CommonButtonStyle() {
...
...
@@ -167,9 +165,9 @@ export struct WzInfo {
this.isAutomation = false
const res = await analysisQrCode(value, false)
if (res.data && res.data.length > 0) {
if (this.scanInfoDialog != undefined) {
this.scanInfoDialog.open()
}
//
if (this.scanInfoDialog != undefined) {
//
this.scanInfoDialog.open()
//
}
console.log("解析货位", JSON.stringify(res.data))
//1. 获取默认货位
this.handleGetDefaultHwh(res)
...
...
@@ -292,7 +290,6 @@ export struct WzInfo {
console.log('pzData', JSON.stringify(pzData))
if (pzData.length == 0) {
Prompt.showToast({
// title: this.pageType + '导入的凭证中无扫描品种,不容许添加!',
message: '本单据中无此扫描品种,不允许添加!'
})
return
...
...
@@ -336,7 +333,7 @@ export struct WzInfo {
wzcrkguid: this.pzxqGuild,
pmdmcode: ITEM.pmdmcode
}
const pzData = await
await
wzcrkmxModel.getPzMxItem(params, false)
const pzData = await wzcrkmxModel.getPzMxItem(params, false)
console.log('pzDatapzData', pzData)
if (pzData.length == 0) {
Prompt.showToast({
...
...
@@ -521,18 +518,23 @@ export struct WzInfo {
currentModel: this.currentModel,
...filterInsrtData
}
console.log("11.调试======", JSON.stringify(insertParams))
await wzcrkmxModel.insertWz(insertParams)
// createOrFindSQL("GY_M_PMV3", insertWz(insertParams))
ITEM.mxguid = insertParams.guid
}
// this.pageInit(ITEM, 'update')
Logger.info(this, "调试======")
if (res.data && res.data.length > 1) {
Logger.info(this, "调试======1")
this.pageInit(ITEM, 'update')
} else {
if (this.pageType == '倒库' || this.pageType == '调号' || this.pageType == '换位') {
this.pageInit(ITEM, 'update')
} else {
Logger.info(this, "调试======2")
this.setDkScan(ITEM, res.data)
}
}
...
...
@@ -944,6 +946,7 @@ export struct WzInfo {
// console.log('新增物资明细结束', dateUtils.formatDate(new Date()))
// this.insertWzMxFun(params)
this.historicalInformation.unshift(params)
console.log("==========================", JSON.stringify(this.historicalInformation))
// this.historicalInformation.forEach((item) => {
// if (item.pmdmcode == params.pmdmcode) {
// console.log('筛选ITEM', item)
...
...
entry/src/main/ets/pages/metailmange/Common/WzInsertInfo.ets
0 → 100644
View file @
71593ac9
import router from '@ohos.router';
import { Logger } from '@ohos/common';
import gldwModel from '../../../model/GldwModel';
import kfModel from '../../../model/KfModel';
import { DividerTitle } from '../../../view/DividerTitle/DividerTitle';
import { historicalInformationClass, PzFormClass, ScanWzClass, WzClass, WzmxClass } from './Wzcrk.data';
import { WzList } from '../WzInPage/WzinDetail/WzList';
import { WzScanInfoDialog } from './Dialog/WzScanInfoDialog';
import { analysisQrCode } from '../../../identify/analysis/analysis_QR_code'
import emitter from '@ohos.events.emitter';
import Prompt from '@system.prompt';
import wzcrkmxModel from '../../../model/WzcrkmxModel';
import { dateUtils, uuid } from '@ohos/common/src/main/ets/utils/util';
import { PzMxDto } from '@ohos/common/src/main/ets/bean/dto/RecommendHwDto.ts';
import wzcrkModel from '../../../model/WzcrkModel';
@Extend(Button) function CommonButtonStyle() {
.borderWidth(2)
.borderColor('#0fa983')
.backgroundColor('#97c6a6')
.fontColor('#fff')
.borderRadius(5)
.type(ButtonType.Normal)
.stateEffect(true)
}
@Component
// 物资新增
export struct WzInsertInfo {
@State currentHwh: string = '' // 当前货位
@State pageType: string = "" //当前凭证的类型
@State currentModel: boolean = false //倒出:true/倒入:false
@State currentWZInfo: ScanWzClass[] = [] //当前扫描物资信息
@State defaultArr: Array<any> = []
@State dataType: boolean = false // 导入是true, 其他false 根据单据状态控制提交按钮显示隐藏
@State isHaveButton: boolean = false // 完成状态, 未完成是true, 其他false
@State isAutomation: boolean = true //控制扫描提示显示隐藏
@State pzxqGuild: string = '' //当前凭证guid
@State historicalInformation: historicalInformationClass[] = [] //物资数据
@State currentPmdmcode: string = '' //当前扫描pmdm10位
@State defaultHwh: string = this.convertionDefaultHwh()
@State hjsl: number | string = this.convertionHjsl()
@State currentDw: string = ''
@State kfmc: string = ''
@ObjectLink wzcrk: PzFormClass
getDetail: (wzpm?: string) => void
scanInfoDialog: CustomDialogController = new CustomDialogController({
builder: WzScanInfoDialog({
container: this.container,
defaultHwh: $defaultHwh,
pageType: $pageType,
currentHwh: $currentHwh,
currentWZInfo: $currentWZInfo
}),
autoCancel: false,
alignment: DialogAlignment.Top,
customStyle: true
})
private searchcontroller: SearchController = new SearchController()
/***
* @description: 物资合计数量
* @param {*}
* @return {*}
* @author: 王弘钢
*/
convertionHjsl() {
var newData = this.historicalInformation
newData.forEach((item, index) => {
if (this.pageType == '调号') {
if (item.currentModel) {
// 调出
item.pzsl = item.srsl
item.crksl = 0 - Number(item.srsl)
} else {
// 调入
item.pzsl = 0 - Number(item.srsl)
item.crksl = item.srsl
}
} else if (this.pageType == '换位') {
if (item.currentModel) {
// 调入
item.pzsl = 0 - Number(item.srsl)
item.crksl = item.srsl
} else {
// 调出
item.pzsl = item.srsl
item.crksl = 0 - Number(item.srsl)
}
} else {
item.pzsl = item.srsl
item.crksl = item.srsl
}
item.hwsl = item.srsl
})
const fArr = newData.map((item) => Number(item.pzsl))
const sArr = newData.map((item) => Number(item.crksl))
var res1 = 0
var res2 = 0
if (fArr.length == 0) {
res1 = 0
} else {
res1 = fArr.reduce((x, y) => x + y);
}
if (sArr.length == 0) {
res2 = 0
} else {
res2 = sArr.reduce((x, y) => x + y);
}
if (this.pageType == '调号' || this.pageType == '换位') {
return res1 || 0
} else {
return res1 || 0 + '/' + res2 || 0
}
// const srslList = this.historicalInformation.map(item => {
// if (item.srsl) {
// if (item.currentModel) {
// return item.srsl
// }
// } else {
// return 0
// }
// })
// var srslHj = 0
// if (srslList && srslList.length > 0) {
// srslHj = srslList.reduce(function(prev, cur, index, array) {
// return Number(prev) + Number(cur);
// })
// } else {
// srslHj = 0
// }
// return srslHj
}
@Builder container() {
Column() {
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Text("当前扫描货位号:").fontSize(16).lineHeight(18)
Text(this.currentHwh || "请扫描货位").fontSize(20).fontColor("#0fa983").fontWeight(700)
}.padding(15)
if (this.pageType == "倒库") {
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Text("当前倒库模式:").fontSize(16).lineHeight(18)
Text(this.currentModel ? "倒出" : "倒入").fontSize(20).fontColor("#0fa983").fontWeight(700)
}.padding(15)
}
if (this.pageType == "调号") {
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Text("当前调号模式:").fontSize(16).lineHeight(18)
Text(this.currentModel ? "调出" : "调入").fontSize(20).fontColor("#0fa983").fontWeight(700)
}.padding(15)
}
if (this.pageType == "换位") {
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Text("当前换位模式:").fontSize(16).lineHeight(18)
Text(this.currentModel ? "换出" : "换入").fontSize(20).fontColor("#0fa983").fontWeight(700)
}.padding(15)
}
Flex({ justifyContent: FlexAlign.Start }) {
Text("当前扫描物资信息: ").fontSize(16).lineHeight(18)
if (this.currentWZInfo.length == 0) {
Text("请扫描物资信息").fontSize(14)
}
}.padding(15)
if (this.currentWZInfo.length > 0) {
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
Text("品名代码").width("25%").textAlign(TextAlign.Start)
Text("物资品名").width("25%").textAlign(TextAlign.Center)
Text("号型名称").width("25%").textAlign(TextAlign.Center)
Text("数量").width("25%").textAlign(TextAlign.Center)
}.padding(15)
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
ForEach(this.currentWZInfo, item => {
Text(item.pmdmsix).width("25%").textAlign(TextAlign.Start).fontSize(14)
Text(item.wzpm).width("25%").textAlign(TextAlign.Center).fontSize(14)
Text(item.hxmc).width("25%").textAlign(TextAlign.Center).fontSize(14)
Text(item.crksl + '')
.width("25%")
.textAlign(TextAlign.Center)
.fontSize(20)
.fontColor("#0fa983")
.fontWeight(700)
})
}.padding(15)
}
}
}
convertionDefaultHwh(): string {
if (this.defaultArr && this.defaultArr.length > 1) {
return this.defaultArr[0].HWH + ',' + this.defaultArr[1].HWH + '...' || '暂无'
} else if (this.defaultArr && this.defaultArr.length == 1) {
return this.defaultArr[0].HWH || '暂无'
} else {
return '暂无'
}
}
// 页面初始化
aboutToAppear() {
this.pzxqGuild = this.wzcrk.guid
this.getData()
this.scanCodeListen();
}
// 在自定义组件即将析构销毁时将dialogController置空
aboutToDisappear() {
this.scanInfoDialog = undefined // 将dialogController置空
Logger.info('Aaaaa>>', JSON.stringify(this.historicalInformation))
}
scanCodeListen() {
var innerEvent = { eventId: 3 }
emitter.on(innerEvent, (eventQRData) => {
if (innerEvent.eventId == 3) {
let result = eventQRData.data.qrcode
console.log("接收到上级传入数据", "收到扫码信息:" + result)
this.handleanalysisQrCode(result)
}
})
}
async getData() {
// 获取收物单位
const res1 = await gldwModel.queryByData({ dwdm: this.wzcrk.sfdw })
this.currentDw = res1[0].dwfh ?? ''
// 获取库房名称
// @ts-ignore
const res = await kfModel.query({ guid: this.wzcrk.kfguid })
this.kfmc = res[0].kfmc ?? ''
}
/***
* @description: 扫码验证
* @param {*}
* @return {*}
* @author: 王弘钢
*/
handleanalysisQrCode(data) {
console.log(">>>>>>>>扫码验证", JSON.stringify(this.wzcrk.kfdm))
if (this.wzcrk && this.wzcrk.kfdm) {
this.isAutomation = false
this.handleTransmitInformation(data)
} else {
Prompt.showToast({
message: '请选择库房'
})
return
}
}
/***
* @description: 扫描解析
* @param {*}
* @return {*}
* @author: 王弘钢
*/
async handleTransmitInformation(value) {
try {
const res = await analysisQrCode(value, false)
Logger.info(this, JSON.stringify(res))
if (res.data && res.data.length == 0) {
//1. 获取默认货位
this.handleGetDefaultHwh(res)
// 2.检验基础数据
Prompt.showToast({
message: '请检查基础数据是否完善'
})
return
}
// 3.检验是否扫描货位
if (!this.wzcrk.hwh && !res.data[0].hwh) {
Prompt.showToast({
message: '请优先扫描货位'
})
return
}
// 4.首次设置货位
if (!this.wzcrk.hwh && res.data[0].hwh) {
// if (this.pageType == '倒库') {
const hwParams = {
kfdm: this.wzcrk.kfdm,
hwh: res.data[0].hwh,
hjguid: res.data[0].hjguid
}
// console.log('this.currentModel', this.currentModel, this.pzFrom)
if (this.pageType == '倒库') {
if (this.currentModel) {
hwParams.kfdm = this.wzcrk.kfdm
} else {
hwParams.kfdm = this.wzcrk.rkkfdm
}
} else {
hwParams.kfdm = this.wzcrk.kfdm
}
const testHwForKf = await wzcrkmxModel.testHwWz(hwParams)
if (testHwForKf.length == 0) {
Prompt.showToast({
message: '当前库房不存在' + res.data[0].hwh + '货位'
})
return
}
this.wzcrk.hwh = res.data[0].hwh
// @ts-ignore
this.wzcrk.hjguid = res.data[0].hjguid
this.currentHwh = res.data[0].hwh
Prompt.showToast({
message: '当前货位:' + res.data[0].hwh
})
return
}
if (this.wzcrk.hwh) {
// 5.二次设置货位
if (this.wzcrk.hwh && res.data[0].hjguid) {
this.wzcrk.hwh = res.data[0].hwh
// @ts-ignore
this.wzcrk.hjguid = res.data[0].hjguid
this.currentHwh = res.data[0].hwh
Prompt.showToast({
message: '切换货位:' + this.wzcrk.hwh,
})
// uni.showModal({
// title: '提示',
// content: '当前扫描了其他货架,是否确认切换!',
// success: function(RES) {
// if (RES.confirm) {
// that.pzFrom.hwh = res.data[0].hwh
// that.pzFrom.hjguid = res.data[0].hjguid
// that.currentHwh = res.data[0].hwh
// uni.showToast({
// title: '当前货位:' + that.pzFrom.hwh,
// icon: 'none'
// })
// } else if (RES.cancel) {
// uni.showToast({
// title: '保留原先货位',
// icon: 'none'
// })
// }
// }
// });
return
}
// 6.处理物资数据
if (res.data && res.data.length > 0) {
// this.currentWZInfo = res.data
res.data.forEach((ITEM) => {
if (this.historicalInformation && this.historicalInformation.length > 0) {
// currentModel
if (this.pageType == '调号') {
const [thCommonData] = this.historicalInformation.filter(item => item
.pmdmcode == ITEM.pmdmcode)
if (thCommonData) {
const [isHave] = this.historicalInformation.filter(item => item
.pmdmcode == ITEM.pmdmcode && item.currentModel == this
.currentModel)
if (!isHave) {
var model = thCommonData.currentModel ? '调出' : '调入'
Prompt.showToast({
message: '当前物资调号模式为' + model + '无法修改'
})
return
}
}
}
if (this.pageType == '换位') {
const [thCommonData] = this.historicalInformation.filter(item => item
.pmdmcode == ITEM.pmdmcode && item.currentModel != this
.currentModel && item.hwh == this.currentHwh)
console.log('thCommonData', thCommonData)
if (thCommonData) {
console.log('不符合')
var model = thCommonData.currentModel ? '换出' : '换入'
Prompt.showToast({
message: '当前物资换位模式为' + model + '无法修改'
})
return
}
}
// if(this.pageType == '换位'){
// const [thCommonData] = this.historicalInformation.filter(item => item
// .pmdmcode == ITEM.pmdmcode)
// }
const [data] = this.historicalInformation.filter((item, index) => item
.pmdmcode == ITEM.pmdmcode && item.hwh == this.wzcrk.hwh && item
.currentModel == this.currentModel)
console.log('data', data)
if (data) {
this.historicalInformation.forEach((item, index) => {
if (item.pmdmcode == data.pmdmcode && item.hwh == this
.wzcrk.hwh) {
let num = ITEM.srsl || 1
// @ts-ignore
let hjsl = Number(item.srsl) + Number(num)
// that.handleCkHwWzTest({
// ...item,
// srsl: hjsl,
// hwsl: hjsl
// }, (RES) => {
// if (RES) {
// @ts-ignore
item.srsl = hjsl
// @ts-ignore
item.hwsl = hjsl
this.setWZInfo(res.data)
// }
// })
}
})
} else {
const params = {
...ITEM,
hwh: this.wzcrk.hwh,
// @ts-ignore
hjguid: this.wzcrk.hjguid,
hwsl: ITEM.srsl,
currentModel: this.currentModel,
guid: uuid()
}
// this.handleCkHwWzTest(params, (RES) => {
// if (RES) {
this.historicalInformation.push(params)
this.setWZInfo(res.data)
// }
// })
}
} else {
const params = {
...ITEM,
hwh: this.wzcrk.hwh,
// @ts-ignore
hjguid: this.wzcrk.hjguid,
hwsl: ITEM.srsl,
currentModel: this.currentModel,
guid: uuid()
}
// this.handleCkHwWzTest(params, (RES) => {
// if (RES) {
this.historicalInformation.push(params)
this.setWZInfo(res.data)
// }
// })
}
})
}
} else {
Prompt.showToast({
message: '请先扫描货位'
})
}
} catch (e) {
//TODO handle the exception
// Prompt.showToast({
// message: '解析失败'
// })
}
}
setWZInfo(data) {
console.log('this.historicalInformation', this.historicalInformation)
const newData = data.map((item) => {
const [filterData] = this.historicalInformation.filter((fLe) => fLe.pmdmcode == item
.pmdmcode && fLe.hwh == this.currentHwh)
return filterData
})
this.currentWZInfo = newData
}
async pageInit(ITEM, tip, callback?) {
try {
// 不同号型新增
// 查询同号型数据
const params = {
guid: this.pzxqGuild,
pmdm: ITEM.pmdmcode.slice(0, 6)
}
const res = await wzcrkmxModel.getCommonHxPzMx(params)
// 设置
if (tip == 'insert') {
Prompt.showToast({
message: '切换号型:' + ITEM.pmdmcode + '数据'
})
}
this.currentPmdmcode = ITEM.pmdmcode
// @ts-ignore
this.historicalInformation = res
this.setDefaultActive()
callback && callback()
} catch (e) {
}
}
/***
* @description: 数据设置默认状态
*/
setDefaultActive() {
if (this.pageType == '倒库' || this.pageType == '调号' || this.pageType == '换位') {
// 倒库默认添加倒库模式
this.historicalInformation.forEach((item) => {
if (item.pzsl > 0) {
item.currentModel = true
} else {
item.currentModel = false
}
})
}
}
/***
* @description: 单据明细新增/修改
*/
async handleSetInsertOrUpdate(res, ITEM) {
const [filterInsrtData] = res.data.filter(item => item.pmdmcode == ITEM.pmdmcode && item
.hxmc == ITEM.hxmc)
var testPmdmCodeSql = []
if (this.pageType == '倒库' || this.pageType == '调号' || this.pageType == '换位') {
testPmdmCodeSql = this.historicalInformation.filter((item) => item.pmdmcode ==
filterInsrtData.pmdmcode && (item.hwh == '' || item.hwh == this.wzcrk.hwh) && item
.currentModel == this.currentModel)
} else {
testPmdmCodeSql = this.historicalInformation.filter((item) => item.pmdmcode ==
filterInsrtData.pmdmcode && (item.hwh == '' || item.hwh == this.wzcrk.hwh))
}
console.log('testPmdmCodeSql', JSON.stringify(testPmdmCodeSql), this.currentModel)
if (testPmdmCodeSql && testPmdmCodeSql.length > 0) {
var update_crksl = 0
if (this.pageType == '倒库' || this.pageType == '调号' || this.pageType == '换位') {
if (this.currentModel) {
update_crksl = Number(testPmdmCodeSql[0].crksl) +
Number(filterInsrtData.srsl)
} else {
update_crksl = Number(testPmdmCodeSql[0].crksl) -
Number(filterInsrtData.srsl)
}
} else {
if (testPmdmCodeSql[0].crksl) {
update_crksl = Number(testPmdmCodeSql[0].crksl) +
Number(filterInsrtData.srsl)
} else {
update_crksl = filterInsrtData.srsl
}
}
const updateParams = {
mxguid: testPmdmCodeSql[0].mxguid,
hwh: testPmdmCodeSql[0].hwh || this.wzcrk.hwh,
crksl: update_crksl
}
console.log("updateParams", JSON.stringify(updateParams))
let s = await wzcrkmxModel.updateWzmx(updateParams)
console.log("updateParams执行成功或者失败:" + JSON.stringify(this.historicalInformation))
} else {
var insert_crksl = 0
if (this.pageType == '倒库' || this.pageType == '调号' || this.pageType == '换位') {
if (this.currentModel) {
insert_crksl = 0 + Number(filterInsrtData.srsl)
} else {
insert_crksl = 0 - Number(filterInsrtData.srsl)
}
} else {
insert_crksl = filterInsrtData.srsl
}
const insertParams = {
guid: uuid(),
pzsl: insert_crksl,
crksl: insert_crksl,
hwh: this.wzcrk.hwh,
wzcrkguid: this.pzxqGuild,
currentModel: this.currentModel,
...filterInsrtData
}
console.log("11.调试======", JSON.stringify(insertParams))
await wzcrkmxModel.insertWz(insertParams)
// createOrFindSQL("GY_M_PMV3", insertWz(insertParams))
ITEM.mxguid = insertParams.guid
}
// this.pageInit(ITEM, 'update')
Logger.info(this, "调试======")
if (res.data && res.data.length > 1) {
Logger.info(this, "调试======1")
this.pageInit(ITEM, 'update')
} else {
if (this.pageType == '倒库' || this.pageType == '调号' || this.pageType == '换位') {
this.pageInit(ITEM, 'update')
} else {
Logger.info(this, "调试======2")
this.setDkScan(ITEM, res.data)
}
}
}
/***
* @description: 修改物资数据
*/
setDkScan(ITEM, ScanData) {
// console.log('修改配置信息=============================================')
try {
if (this.historicalInformation && this.historicalInformation.length > 0) {
const [data] = this.historicalInformation.filter((item, index) =>
item.pmdmcode == ITEM.pmdmcode)
// console.log('判断有没有这条数据,没有新增=============================================')
// console.log(data)
// 判断有没有这条数据,没有新增
if (data) {
// 倒库单判断如果当前为倒出模式判断有没有这个pmdmcode/currentModel为1的
// 有覆盖/无新增(新增向缓存添加,向新增列表添加)
// 如果有这条数据,判断当前数据有没有货位号
if (data.hwh) {
// 如果有货位号,判断货位号和当前扫描货位号是否一致
if (data.hwh == this.wzcrk.hwh) {
if (this.pageType == '倒库') {
// 先检测是否存在,如果存在覆盖,如果没有新增
const newCurrentModel = this.currentModel
const [newIsDk] = this.historicalInformation.filter((item) =>
item.pmdmcode == data
.pmdmcode && item.currentModel == newCurrentModel)
if (newIsDk) {
// 如果一致,则覆盖这条数据货位并合计
this.historicalInformation.forEach(async (item,
index) => {
if (item.hwh == this.wzcrk.hwh && item
.pmdmcode == ITEM.pmdmcode && item
.currentModel ==
newCurrentModel) {
// item.currentModel = this.currentModel
let num = ITEM.srsl || 1
let hjsl = 0
if (this.pageType == '倒库') {
if (item.currentModel) {
hjsl = Number(item.crksl) +
Number(
num)
} else {
hjsl = Number(item.crksl) -
Number(
num)
}
} else {
hjsl = Number(item.crksl) + Number(
num)
}
item.crksl = hjsl
}
})
} else {
const params = {
guid: uuid(),
pzsl: ITEM.srsl,
crksl: ITEM.srsl,
hwh: this.wzcrk.hwh,
wzcrkguid: this.pzxqGuild,
currentModel: this.currentModel,
...ITEM
}
if (params.currentModel) {
params.pzsl = 0 + Number(ITEM.srsl)
params.crksl = 0 + Number(ITEM.srsl)
} else {
params.pzsl = 0 - Number(ITEM.srsl)
params.crksl = 0 - Number(ITEM.srsl)
}
// @ts-ignore
this.insertWzMxFun(params)
// this.historicalInformation.unshift(params)
// this.bufferFun(params)
// createOrFindSQL("GY_M_PMV3", insertWz(params))
// uni.showToast({
// title: '新增单据号型:' + ITEM.hxmc + '模式:' + this.currentModel ? '倒出' :
// '倒入',
// icon: 'none'
// })
}
} else {
// 如果一致,则覆盖这条数据货位并合计
this.historicalInformation.forEach(async (item,
index) => {
if (item.hwh == this.wzcrk.hwh && item
.pmdmcode == ITEM.pmdmcode) {
// item.currentModel = this.currentModel
let num = ITEM.srsl || 1
let hjsl = 0
if (this.pageType == '倒库') {
if (item.currentModel) {
hjsl = Number(item.crksl) +
Number(
num)
} else {
hjsl = Number(item.crksl) -
Number(
num)
}
} else {
hjsl = Number(item.crksl) + Number(num)
}
item.crksl = hjsl
// this.bufferFun(item)
}
})
}
} else {
if (this.pageType == '倒库') {
// 先检测是否存在,如果存在覆盖,如果没有新增
const newCurrentModel = this.currentModel
const [newIsDk] = this.historicalInformation.filter((item) =>
item.pmdmcode == data
.pmdmcode && item.currentModel == newCurrentModel)
if (newIsDk) {
// 如果不一致,则新增数据
const [newHwData] = this.historicalInformation.filter((
item) => item.hwh ==
this
.wzcrk
.hwh && item.pmdmcode == ITEM.pmdmcode)
if (newHwData) {
this.historicalInformation.forEach(async (item,
index) => {
if (item.hwh == this.wzcrk.hwh && item
.pmdmcode == ITEM
.pmdmcode && item.currentModel ==
newCurrentModel) {
let num = ITEM.srsl || 1
let hjsl = 0
if (this.pageType == '倒库') {
if (item.currentModel) {
hjsl = Number(item.crksl) +
Number(
num)
} else {
hjsl = Number(item.crksl) -
Number(
num)
}
} else {
hjsl = Number(item.crksl) +
Number(num)
}
item.crksl = hjsl
// this.bufferFun(item)
}
})
} else {
if (this.pageType == '倒库') {
Prompt.showToast({
message: '此单据号型:' + ITEM.hxmc + '不存在'
})
return
} else {
this.insertWzmxFun(ITEM)
}
}
} else {
const params = {
guid: uuid(),
pzsl: ITEM.srsl,
crksl: ITEM.srsl,
hwh: this.wzcrk.hwh,
wzcrkguid: this.pzxqGuild,
currentModel: this.currentModel,
...ITEM
}
if (params.currentModel) {
params.pzsl = 0 + Number(ITEM.srsl)
params.crksl = 0 + Number(ITEM.srsl)
} else {
params.pzsl = 0 - Number(ITEM.srsl)
params.crksl = 0 - Number(ITEM.srsl)
}
// @ts-ignore
this.insertWzMxFun(params)
// this.historicalInformation.unshift(params)
// this.bufferFun(params)
// createOrFindSQL("GY_M_PMV3", insertWz(params))
// uni.showToast({
// title: '新增单据号型:' + ITEM.hxmc + '模式:' + this.currentModel ? '倒出' :
// '倒入',
// icon: 'none'
// })
}
} else {
// 如果不一致,则新增数据
const [newHwData] = this.historicalInformation.filter((item) =>
item.hwh == this
.wzcrk
.hwh && item.pmdmcode == ITEM.pmdmcode)
if (newHwData) {
this.historicalInformation.forEach(async (item,
index) => {
if (item.hwh == this.wzcrk.hwh &&
item
.pmdmcode == ITEM.pmdmcode) {
let num = ITEM.srsl || 1
let hjsl = 0
if (this.pageType == '倒库') {
if (item.currentModel) {
hjsl = Number(item.crksl) +
Number(
num)
} else {
hjsl = Number(item.crksl) -
Number(
num)
}
} else {
hjsl = Number(item.crksl) + Number(
num)
}
item.crksl = hjsl
// this.bufferFun(item)
}
})
} else {
if (this.pageType == '倒库') {
Prompt.showToast({
message: '此单据号型:' + ITEM.hxmc + '不存在'
})
return
} else {
console.log(
'==========================不存在4==============='
)
this.insertWzmxFun(ITEM)
}
}
}
}
} else {
console.log('========================= 无货位 ======================')
if (this.pageType == '倒库') {
// 先检测是否存在,如果存在覆盖,如果没有新增
const newCurrentModel = this.currentModel
const [newIsDk] = this.historicalInformation.filter((item) => item
.pmdmcode == data
.pmdmcode && item.currentModel == newCurrentModel)
console.log('没有货位====================')
//console.log(newIsDk)
if (newIsDk) {
// console.log('==========================存在===============1')
// 如果没有货位号,则覆盖这条数据货位并合计
this.historicalInformation.forEach(async (item, index) => {
if (item.pmdmcode == data.pmdmcode && item
.currentModel ==
newCurrentModel) {
if (!item.hwh) {
item.hwh = this.wzcrk.hwh
// @ts-ignore
item.hjguid = this.wzcrk.hjguid
}
let num = ITEM.srsl || 1
let hjsl = 0
if (this.pageType == '倒库') {
if (item.currentModel) {
hjsl = Number(item.crksl) +
Number(
num)
} else {
hjsl = Number(item.crksl) -
Number(
num)
}
} else {
hjsl = Number(item.crksl) + Number(num)
}
item.crksl = hjsl
// this.bufferFun(item)
}
})
} else {
console.log('==========================不存在5===============2')
const params = {
guid: uuid(),
pzsl: ITEM.srsl,
crksl: ITEM.srsl,
hwh: this.wzcrk.hwh,
wzcrkguid: this.pzxqGuild,
currentModel: this.currentModel,
...ITEM
}
if (params.currentModel) {
params.pzsl = 0 + Number(ITEM.srsl)
params.crksl = 0 + Number(ITEM.srsl)
} else {
params.pzsl = 0 - Number(ITEM.srsl)
params.crksl = 0 - Number(ITEM.srsl)
}
console.log('===========params5', params)
// @ts-ignore
this.insertWzMxFun(params)
// this.historicalInformation.unshift(params)
// this.bufferFun(params)
// createOrFindSQL("GY_M_PMV3", insertWz(params))
// uni.showToast({
// title: '新增单据号型:' + ITEM.hxmc + '模式:' + this.currentModel ? '倒出' : '倒入',
// icon: 'none'
// })
}
} else {
// 如果没有货位号,则覆盖这条数据货位并合计
this.calcWzmxFun(data, ITEM)
}
}
} else {
// 倒库单 判断有没有这条数据,没有提示
if (this.pageType == '倒库') {
Prompt.showToast({
message: '此单据号型:' + ITEM.hxmc + '不存在'
})
return
} else {
console.log('==========================不存在6===============')
this.insertWzmxFun(ITEM)
}
}
} else {
// console.log('========================= 列表无数据新增 ======================')
if (this.pageType == '倒库') {
Prompt.showToast({
message: '此单据号型:' + ITEM.hxmc + '不存在'
})
return
} else {
console.log('==========================不存在7===============')
this.insertWzmxFun(ITEM)
}
}
const newData = ScanData.map((item) => {
const [filterData] = this.historicalInformation.filter((fLe) => fLe.pmdmcode ==
item.pmdmcode && fLe.hwh == this.currentHwh)
return filterData
}) as ScanWzClass []
console.log('this.newData', JSON.stringify(newData))
this.currentWZInfo = []
newData.forEach(i => {
this.currentWZInfo.push(new ScanWzClass(i))
})
console.log('this.currentWZInfo', JSON.stringify(this.currentWZInfo))
Logger.info(this, '手动修改结束', dateUtils.formatDate(new Date()))
} catch (e) {
//TODO handle the exception
Prompt.showToast({
message: '修改物资失败'
})
}
}
/***
* @description: 新增物资明细
* @param {*}
* @return {*}
* @author: 王弘钢
*/
insertWzmxFun(ITEM) {
try {
var insert_crksl = 0
if (this.pageType == '倒库') {
if (this.currentModel) {
insert_crksl = 0 + Number(ITEM.srsl)
} else {
insert_crksl = 0 - Number(ITEM.srsl)
}
} else {
insert_crksl = ITEM.srsl
}
const params = {
guid: uuid(),
pzsl: insert_crksl,
crksl: insert_crksl,
hwh: this.wzcrk.hwh,
wzcrkguid: this.pzxqGuild,
currentModel: this.currentModel,
...ITEM
}
// console.log('新增单据号型', params)
// console.log('开始新增物资明细', dateUtils.formatDate(new Date()))
// createOrFindSQL("GY_M_PMV3", insertWz(params))
// console.log('新增物资明细结束', dateUtils.formatDate(new Date()))
// this.insertWzMxFun(params)
this.historicalInformation.unshift(params)
console.log("==========================", JSON.stringify(this.historicalInformation))
// this.historicalInformation.forEach((item) => {
// if (item.pmdmcode == params.pmdmcode) {
// console.log('筛选ITEM', item)
// if (item.children && item.children.length > 0) {
// const [filterPmData] = item.children.filter((ELEMENT) => ELEMENT.pmdmcode == params
// .pmdmcode && ELEMENT.hwh == params.hwh)
// if (filterPmData) {
// item.children.forEach(newItem => {
// if (newItem.pmdmcode == params.pmdmcode && ELEMENT.hwh == params
// .hwh) {
// newItem.crksl = Number(newItem.crksl) + Number(insert_crksl)
// newItem.pzsl = Number(newItem.pzsl) + Number(insert_crksl)
// console.log('筛选ITEM.===', item.children)
// }
// })
// // item.children.(params)
// } else {
// item.children.push(params)
// console.log('筛选ITEM.push', item.children)
// }
// } else {
// item.children = []
// item.children.push(params)
// console.log('筛选ITEM.push', item.children)
// }
// }
// })
// createOrFindSQL("GY_M_PMV3", insertWz(params))
// uni.showToast({
// title: '新增单据号型:' + ITEM.hxmc,
// icon: 'none'
// })
} catch (e) {
//TODO handle the exception
Prompt.showToast({
message: '物资新增失败'
})
}
}
/***
* @description: 计算合计数
* @param {*}
* @return {*}
* @author: 王弘钢
*/
calcWzmxFun(data, ITEM) {
try {
this.historicalInformation.forEach(async (item, index) => {
if (item.pmdmcode == data.pmdmcode) {
if (!item.hwh) {
item.hwh = this.wzcrk.hwh
// @ts-ignore
item.hjguid = this.wzcrk.hjguid
}
let num = ITEM.srsl || 1
let hjsl = 0
if (this.pageType == '倒库') {
if (item.currentModel) {
hjsl = Number(item.crksl) + Number(num)
} else {
hjsl = Number(item.crksl) - Number(num)
}
} else {
hjsl = Number(item.crksl) + Number(num)
}
item.crksl = hjsl
// this.bufferFun(item)
}
})
} catch (e) {
//TODO handle the exception
Prompt.showToast({
message: '物资合计失败'
})
}
}
handleGetDefaultHwh(res) {
try {
var defaultArr = []
res.data.forEach(async (item, index) => {
const defaultParams = {
kfdm: this.wzcrk.kfdm,
pmguid: item?.pmdm
}
Logger.info(this, '默认货位defaultParams-------', JSON.stringify(item), JSON.stringify(defaultParams))
// 获取推荐货位
const defaultData = await wzcrkmxModel.queryRecommendHw(defaultParams)
Logger.info(this, '默认货位defaultData-------', JSON.stringify(defaultData))
defaultArr = defaultArr.concat(defaultData)
const last = res.data.length - 1
if (index == last) {
Logger.info(this, '默认货位defaultArr-------', JSON.stringify(defaultArr))
this.defaultArr = defaultArr
}
})
} catch (e) {
Prompt.showToast({
message: '获取默认货位失败'
})
}
}
build() {
Column() {
Flex({ direction: FlexDirection.Column }) {
Column() {
if (this.pageType == "倒库") {
Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) {
DividerTitle({ title: "当前单位出库房:" })
Text(this.currentDw + this.kfmc)
.fontWeight(FontWeight.Medium)
.fontSize(21)
.fontColor($r("app.color.title_background"))
.width("60%")
.textAlign(TextAlign.Start)
.padding({ bottom: 20, top: 20 })
}.width("100%")
Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) {
DividerTitle({ title: "当前单位入库房:" })
Text(this.currentDw + this.kfmc)
.fontWeight(FontWeight.Medium)
.fontSize(21)
.fontColor($r("app.color.title_background"))
.width("60%")
.textAlign(TextAlign.Start)
.padding({ bottom: 20, top: 20 })
}.width("100%")
} else {
Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) {
DividerTitle({ title: "单位/库房信息" })
Text(this.currentDw + this.kfmc)
.fontWeight(FontWeight.Medium)
.fontSize(21)
.fontColor($r("app.color.title_background"))
.width("60%")
.textAlign(TextAlign.Start)
.padding({ bottom: 20, top: 20 })
}.width("100%")
}
if (this.isHaveButton && (this.pageType == '倒库' || this.pageType == '调号' || this.pageType == '换位')) {
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
DividerTitle({ title: this.pageType + "模式" })
Row() {
if (this.pageType == "倒库") {
Text("倒入").margin({ left: 10, right: 10 })
}
if (this.pageType == "调号") {
Text("调入").margin({ left: 10, right: 10 })
}
if (this.pageType == "换位") {
Text("换出").margin({ left: 10, right: 10 })
}
Toggle({ type: ToggleType.Switch, isOn: true })
.selectedColor('#007DFF')
.switchPointColor('#FFFFFF')
.onChange((isOn: boolean) => {
console.info('Component status:' + isOn)
})
if (this.pageType == "倒库") {
Text("倒出").margin({ left: 10, right: 10 })
}
if (this.pageType == "调号") {
Text("调出").margin({ left: 10, right: 10 })
}
if (this.pageType == "换位") {
Text("换入").margin({ left: 10, right: 10 })
}
}
}.padding({ left: 8, right: 8 })
}
}.padding({ bottom: 20, top: 20 })
.borderRadius(5)
.width("100%")
.backgroundColor("#fff")
Flex({ direction: FlexDirection.Column }) {
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
DividerTitle({ title: "物资列表" })
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
Text("品种个数:")
Text(this.historicalInformation.length + '' || '0').fontColor("#0fa983").fontSize(20).fontWeight(700)
Text("合计数量:")
Text(this.hjsl + '').fontColor("#0fa983").fontSize(20).fontWeight(700)
}
}.padding({ left: 2, right: 10 })
.width("100%")
Row() {
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
Search({ placeholder: '请输入品名名称', controller: this.searchcontroller })
.height(40)
.backgroundColor('#F5F5F5')
.placeholderColor(Color.Grey)
.textAlign(TextAlign.Center)
.placeholderFont({ size: 14, weight: 400 })
.textFont({ size: 14, weight: 400 })
.width('75%')
.onSubmit((value: string) => {
this.getDetail(value)
})
.onChange((value: string) => {
})
.margin({ left: 10 })
.borderRadius(5)
Button("查看状态").CommonButtonStyle().width("25%").margin({ left: 5, right: 5 }).onClick(() => {
router.pushUrl({ url: 'pages/metailmange/WzStatus', params: {
wzmx: this.historicalInformation
} })
})
}.width("100%")
}.padding({ top: 10, bottom: 10 }).width("100%")
Column() {
List() {
ForEach(this.historicalInformation, (item) => {
ListItem() {
WzList({ wzmx: item })
}
})
}
}.flexGrow(1)
}
.padding({ bottom: 20, top: 20 })
.borderRadius(15)
.margin({ top: 20 })
.width("100%")
.backgroundColor("#fff")
}
.width("100%")
.height("100%")
}
}
}
\ No newline at end of file
entry/src/main/ets/pages/metailmange/Common/Wzcrk.data.ets
View file @
71593ac9
...
...
@@ -262,6 +262,8 @@ export class historicalInformationClass {
mxguid: string
pzmxguid: string
currentModel?: boolean
srsl?: number
hwsl?: number
constructor(data: {
...
...
@@ -275,6 +277,8 @@ export class historicalInformationClass {
mxguid: string
pzmxguid: string
currentModel?: boolean
srsl?: number
hwsl?: number
}) {
this.wzpm = data.wzpm
this.pmdmsix = data.pmdmsix
...
...
@@ -286,6 +290,8 @@ export class historicalInformationClass {
this.mxguid = data.mxguid
this.pzmxguid = data.pzmxguid
this.currentModel = data.currentModel || false
this.srsl = data.srsl
this.hwsl = data.hwsl
}
}
...
...
entry/src/main/ets/pages/metailmange/WzInPage/WzInPage.ets
View file @
71593ac9
...
...
@@ -251,8 +251,8 @@ export struct WzInPage {
// 获取凭证号
const pzh = await getDefaultPzh('14')
router.pushUrl({
url: "pages/metailmange/WzInPage/WzinDetail/WzinDetail",
params: {
isUpdate: false
, wzcrk: { pzlx: '14', pzszlx: "DR", pzh,crklx: '2', wczt:"未完成" } }
url: "pages/metailmange/WzInPage/WzinDetail/Wzin
sert
Detail",
params: {
currentSjlx: '临时收物'
, wzcrk: { pzlx: '14', pzszlx: "DR", pzh,crklx: '2', wczt:"未完成" } }
})
})
.fontColor("#0fa983")
...
...
entry/src/main/ets/pages/metailmange/WzInPage/WzinDetail/AddWzin.ets
View file @
71593ac9
...
...
@@ -52,20 +52,20 @@ export struct AddWzin {
{ title: "收支类型", key: 'pzszlx', enabled: false, type: 'input' },
{
title: "库房",
key: 'kfguid',
enabled: true,
type: 'select',
options: [],
required: true
},
{
title: "货位号",
key: 'hwh',
key: 'kfdm',
enabled: true,
type: 'select',
options: [],
required: true
},
// {
// title: "货位号",
// key: 'hwh',
// enabled: true,
// type: 'select',
// options: [],
// required: true
// },
{
title: "发物管理单位",
key: 'fwgldwdm',
...
...
@@ -141,9 +141,9 @@ export struct AddWzin {
})
kfList.forEach(i => {
this.form[this.form.findIndex(v => v.key == 'kf
guid
')]
this.form[this.form.findIndex(v => v.key == 'kf
dm
')]
.options
.push(new Options(i.kfmc, i.
guid
))
.push(new Options(i.kfmc, i.
kfdm
))
})
hwList.forEach(i => {
...
...
@@ -212,6 +212,7 @@ export struct AddWzin {
.borderColor($r("app.color.rank_secondary_border"))
.onSelect((index: number, value?: string) => {
this.wzcrk[item.key] = item.options[index].id
console.log('>>>>>>>>>选择了+', JSON.stringify(this.wzcrk))
})
}
...
...
entry/src/main/ets/pages/metailmange/WzInPage/WzinDetail/WzinsertDetail.ets
0 → 100644
View file @
71593ac9
import { TitleBar } from '../../../../view/title/TitleBar'
import router from '@ohos.router';
import { Logger } from '@ohos/common/src/main/ets/utils/Logger';
import { Wzcrk } from '@ohos/common/src/main/ets/entity/Wzcrk';
import { WzInfo } from '../../Common/WzInfo'
import { PzInfo } from './PzInfo'
import wzcrkmxModel from '../../../../model/WzcrkmxModel';
import { historicalInformationClass, PzFormClass, WzClass, WzmxClass } from '../../Common/Wzcrk.data';
import promptAction from '@ohos.promptAction';
import wzcrkModel from '../../../../model/WzcrkModel';
import { AddWzin } from './AddWzin'
import { uuid } from '@ohos/common/src/main/ets/utils/util';
import IdentifyService from '../../../../identify/IdentifySerivce'
import emitter from '@ohos.events.emitter';
import { WzcrkDetailDto } from '@ohos/common/src/main/ets/bean/dto/WzcrkMxRefWzDto';
import { WzInsertInfo } from '../../Common/WzInsertInfo';
@Extend(Button) function CommonButtonStyle() {
.borderWidth(2)
.borderColor('#0fa983')
.backgroundColor('#97c6a6')
.fontColor('#fff')
.borderRadius(5)
.type(ButtonType.Normal)
.stateEffect(true)
}
interface params {
wzcrk: Wzcrk,
currentSjlx: string
}
@Entry
@Component
struct WzinsertDetail {
@State fontColor: string = '#0FA983'
@State selectedFontColor: string = '#fff'
@State currentIndex: number = 0
@State currentSjlx: string = '临时收物'
@State wzcrk: WzClass = null // 物资出入库单据信息
@State historicalInformation: historicalInformationClass[] = [] // 物资出入库明细
@State pzForm: PzFormClass = null // 物资出入库表单详情
private controller: TabsController = new TabsController()
onPageShow() {
const params = router.getParams() as params
this.currentSjlx = params.currentSjlx
this.wzcrk = new WzClass(params.wzcrk)
// if (this.isUpdate) {
// this.getWzFormDetail()
// }
// this.getWzmxList()
this.scanCodeListen()
IdentifyService.openScanPort()
}
// 获取物资表单详情
async getWzFormDetail() {
Logger.info('获取物资表单详情>>', JSON.stringify(this.wzcrk.guid))
const res = await wzcrkModel.queryByCrkDetailGuid(this.wzcrk.guid)
this.pzForm = new PzFormClass(res[0])
}
// 获取物资列表详情信息
async getWzmxList(wzpm?) {
const pzmxRes = await wzcrkModel.getPzMx({ guid: this.wzcrk.guid })
pzmxRes.forEach((element) => {
this.historicalInformation.push(new historicalInformationClass(element))
})
Logger.info('接收到出入库物资明细信息>>', JSON.stringify(pzmxRes))
}
@Builder TabBuilder(index: number, name: string) {
Column() {
Text(name)
.fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor)
.fontSize(21)
.lineHeight(36)
}
.width('100%')
.height(45)
.border({ width: 2, color: 'rgb(15, 169, 131)' })
.borderRadius(3)
.backgroundColor(this.currentIndex === index ? this.fontColor : '#00000000')
}
build() {
Column() {
Flex({ direction: FlexDirection.Column }) {
TitleBar({ title: "物资新增" })
Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
TabContent() {
Column() {
AddWzin({ wzcrk: this.wzcrk })
}.width("100%")
}.tabBar(this.TabBuilder(0, '凭证信息'))
TabContent() {
Column() {
// pzxqGuild必传 是wzcrk的guid, 我里面已经接了
// pageType必传 入库 出库 盘库 调号 倒库 换位
// dataType必传 导入是true, 其他为false
// isHaveButton 必传 完成状态 未完成是true, 其他为false
WzInsertInfo({
wzcrk: this.wzcrk as PzFormClass,
getDetail: this.getWzmxList,
pageType: "入库",
historicalInformation: this.historicalInformation,
isHaveButton: this.wzcrk.wczt == '未完成' ? true : false
})
}.width("100%")
}.tabBar(this.TabBuilder(1, '物资信息'))
}
.margin({ left: 15, right: 15, top: 15 })
.onChange((index: number) => {
this.currentIndex = index
})
Row() {
Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) {
Button("射频扫码").CommonButtonStyle().width("50%").onClick(() => {
router.pushUrl({ url: 'pages/metailmange/UHFScanPage', params: { wzcrkItem: this.wzcrk } })
})
Button("保存").CommonButtonStyle().width("50%")
.onClick(async () => {
try {
Logger.info('保存的入库明细数据>>', JSON.stringify(this.historicalInformation))
// if (this.isUpdate) {
// const crksl = this.historicalInformation.map(v => Number(v.crksl)).reduce((a, b) => a + b, 0)
// await wzcrkModel.updateWcztByData(this.wzcrk.guid, {
// dec: this.wzcrk.dec,
// ydh: this.wzcrk.ydh,
// crksl
// })
//
// for (let index = 0; index < this.historicalInformation.length; index++) {
// const element = this.historicalInformation[index];
// try {
// let val1 = await wzcrkmxModel.updateWcztmxByData(element.mxguid, { crksl: element.crksl })
// } catch (e) {
// Logger.error(this, '保存失败了>>' + JSON.stringify(e))
// }
// }
// }
// else {
this.wzcrk.guid = uuid()
this.wzcrk.gznd = new Date().getFullYear() + ''
this.wzcrk.sjlx = '新建'
await wzcrkModel.setOne(this.wzcrk)
Logger.info('添加的入库数据>>', JSON.stringify(this.wzcrk))
// }
promptAction.showToast({
message: '保存入库数据成功',
bottom: 300
})
setTimeout(() => {
router.back({ url: 'pages/metailmange/WzInPage/WzInPage' })
}, 300)
} catch (e) {
promptAction.showToast({
message: '保存入库数据失败',
bottom: 200
})
}
})
}
}.margin({ left: 10, right: 10 }).height(80)
}.width("100%")
}.onKeyEvent((e: globalThis.KeyEvent) => {
console.error('keycode====》:' + e.keyCode)
if ((e.keyCode == 2096 || e.keyCode == 2093)) {
if (e.type == 1) {
if (this.currentIndex == 0) {
this.currentIndex = 1
}
IdentifyService.openScan()
}
}
console.error('keycode====》:' + e.keyCode)
}).linearGradient({
direction: GradientDirection.Right, // 渐变方向
repeating: true, // 渐变颜色是否重复
colors: [[0x36a3c0, 0.0], [0x97c6a6, 1], [0xc7d799, 0.0]] // 数组末尾元素占比小于1时满足重复着色效果
})
}
scanCodeListen() {
var innerEvent = { eventId: 2 }
emitter.on(innerEvent, (eventData) => {
if (innerEvent.eventId == 2) {
let result = eventData.data.scancode
console.log("扫码校验", "收到扫码信息:" + result)
let innerEvent = {
eventId: 3,
};
var eventQRData = {
data: {
'qrcode': result
},
priority: emitter.EventPriority.IMMEDIATE
}
emitter.emit(innerEvent, eventQRData)
}
})
}
}
\ No newline at end of file
entry/src/main/resources/base/profile/main_pages.json
View file @
71593ac9
...
...
@@ -53,6 +53,7 @@
"pages/metailmange/GoodsSelectHwPage"
,
"pages/metailmange/GoodsSelectRfidTools"
,
"pages/metailmange/WzOutPage/WzOutDetail/WzOutDetail"
,
"pages/package/ReceivePack"
"pages/package/ReceivePack"
,
"pages/metailmange/WzInPage/WzinDetail/WzinsertDetail"
]
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论