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
fef13132
Commit
fef13132
authored
Jan 23, 2024
by
陈桂东
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交代码
parent
870a637b
隐藏空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
425 行增加
和
308 行删除
+425
-308
BaseTable.ets
common/src/main/ets/db/BaseTable.ets
+14
-9
WzcrkmxDao.ets
common/src/main/ets/db/dao/WzcrkmxDao.ets
+35
-11
NativeSql.ets
common/src/main/ets/db/sql/NativeSql.ets
+1
-1
Wzcrkmx.ts
common/src/main/ets/entity/Wzcrkmx.ts
+0
-5
WzcrkModel.ets
entry/src/main/ets/model/WzcrkModel.ets
+5
-0
WzcrkmxModel.ets
entry/src/main/ets/model/WzcrkmxModel.ets
+2
-1
Wzcrk.data.ets
entry/src/main/ets/pages/metailmange/Common/Wzcrk.data.ets
+46
-37
WzInPage.ets
entry/src/main/ets/pages/metailmange/WzInPage/WzInPage.ets
+6
-3
AddWzin.ets
entry/src/main/ets/pages/metailmange/WzInPage/WzinDetail/AddWzin.ets
+199
-63
PzInfo.ets
entry/src/main/ets/pages/metailmange/WzInPage/WzinDetail/PzInfo.ets
+33
-24
PzInfo2.ets
entry/src/main/ets/pages/metailmange/WzInPage/WzinDetail/PzInfo2.ets
+0
-131
WzinDetail.ets
entry/src/main/ets/pages/metailmange/WzInPage/WzinDetail/WzinDetail.ets
+53
-15
Pick.ets
entry/src/main/ets/pages/package/Pick.ets
+31
-8
没有找到文件。
common/src/main/ets/db/BaseTable.ets
View file @
fef13132
...
...
@@ -188,16 +188,21 @@ export default abstract class BaseTable<T> implements ITable {
* @param predicates 默认不填,根据主键更新,否则依据[predicates]更新
*/
async update(item: T, predicates?: rdb.RdbPredicates): Promise<number> {
let bucket = {};
Logger.info(this, '更新数据,item=' + JSON.stringify(item));
this.toUpdateBucket(bucket, item);
Logger.info(this, '更新数据,bucket=' + JSON.stringify(bucket));
bucket[this.getColumnId()] = undefined;
let db = await this.futureDb;
if (!predicates) {
predicates = this.getPredicates().equalTo(this.getColumnId(), this.getEntityId(item));
try{
let bucket = {};
Logger.info(this, '更新数据,item=' + JSON.stringify(item));
this.toUpdateBucket(bucket, item);
Logger.info(this, '更新数据,bucket=' + JSON.stringify(bucket));
bucket[this.getColumnId()] = undefined;
let db = await this.futureDb;
if (!predicates) {
predicates = this.getPredicates().equalTo(this.getColumnId(), this.getEntityId(item));
}
return db.update(bucket, predicates);
}catch (e){
throw new Error('[数据更新失败]|异常信息>>' + e)
}
return db.update(bucket, predicates);
}
async updateData(bucket: ValuesBucket, predicates?: rdb.RdbPredicates): Promise<number> {
...
...
common/src/main/ets/db/dao/WzcrkmxDao.ets
View file @
fef13132
...
...
@@ -14,14 +14,14 @@ import { WzcrkMxRefWzDto } from '../../bean/dto/WzcrkMxRefWzDto';
export class WzcrkmxDao extends BaseTable<Wzcrkmx> {
toBean(cursor: relationalStore.ResultSet): Wzcrkmx {
let info: Wzcrkmx = {
guid: cursor.getString(cursor.getColumnIndex('
guid
')),
gznd: cursor.getString(cursor.getColumnIndex('
gznd
')),
pmdmcode: cursor.getString(cursor.getColumnIndex('
pmdmcode
')),
pzsl: cursor.getLong(cursor.getColumnIndex('
pzsl
')),
crksl: cursor.getLong(cursor.getColumnIndex('
crksl
')),
wzcrkguid: cursor.getString(cursor.getColumnIndex('
wzcrkguid
')),
hwh: cursor.getString(cursor.getColumnIndex('
hwh
')),
pzmxguid: cursor.getString(cursor.getColumnIndex('
pzmxguid
'))
guid: cursor.getString(cursor.getColumnIndex('
GUID
')),
gznd: cursor.getString(cursor.getColumnIndex('
GZND
')),
pmdmcode: cursor.getString(cursor.getColumnIndex('
PMDMCODE
')),
pzsl: cursor.getLong(cursor.getColumnIndex('
PZSL
')),
crksl: cursor.getLong(cursor.getColumnIndex('
CRKSL
')),
wzcrkguid: cursor.getString(cursor.getColumnIndex('
WZCRKGUID
')),
hwh: cursor.getString(cursor.getColumnIndex('
HWH
')),
pzmxguid: cursor.getString(cursor.getColumnIndex('
PZMXGUID
'))
};
return info;
}
...
...
@@ -31,7 +31,7 @@ export class WzcrkmxDao extends BaseTable<Wzcrkmx> {
}
getColumnId(): string {
return "
guid
";
return "
GUID
";
}
getTableColumns(): string[] {
...
...
@@ -138,16 +138,40 @@ export class WzcrkmxDao extends BaseTable<Wzcrkmx> {
return this.updateData(valueBucket, wp)
}
/**
* 更新出入库明细
*/
async updateCrkMx1(item: Wzcrkmx): Promise<number> {
Logger.info(this, '更新数据' + JSON.stringify(item))
return this.update(item)
}
/**
* 更新单据状态
*/
async updateWcztmxByData(guid: string, data: Partial<Wzcrkmx>): Promise<number> {
// const valueBucket = {};
// for (const [key, value] of Object.entries(data)) {
// valueBucket[key] = value
// }
// valueBucket[this.getColumnId()] = undefined;
// Logger.error(this, '更新的BUCKET' + JSON.stringify(valueBucket));
// let wp = this.getPredicates()
// wp.equalTo('guid', data.guid);
// return this.updateData(valueBucket, wp);
//return db.update(valueBucket,wp);
// return this.update(data as Wzcrkmx)
const valueBucket = {
// "wczt": wczt
};
for (const [key, value] of Object.entries(data)) {
valueBucket[key] = value
if(value) {
valueBucket[key] = value
}
}
let wp = this.getPredicates()
wp.equalTo('guid', guid)
return this.updateData(valueBucket, wp)
...
...
common/src/main/ets/db/sql/NativeSql.ets
View file @
fef13132
...
...
@@ -6,7 +6,7 @@ export class NativeSql {
*/
static getSqlByCrkmx(wzcrkguid: string, wzpm?: string): string {
let sql_val = `SELECT
s2.guid, s2.xh, s2.hxmc,
s2.pmdmsix,s2.pmdmten, s2.wzpm, s1.pzmxguid,
s2.guid, s2.xh, s2.hxmc, s2.pmdmsix,s2.pmdmten, s2.wzpm, s1.pzmxguid,
s1.wzcrkguid,s1.pzsl,s1.hwh,s1.crksl FROM TAB_BZGL_KNZY_APP_WZCRKMX s1
LEFT JOIN TAB_XTWH_JCSJ_BZHX s2 on s1.PMDMCODE = s2.PMDMTEN where s1.WZCRKGUID='${wzcrkguid}'`;
if (wzpm) {
...
...
common/src/main/ets/entity/Wzcrkmx.ts
View file @
fef13132
...
...
@@ -28,8 +28,4 @@ export interface Wzcrkmx {
* 凭证明细的guid
*/
pzmxguid
:
string
/**
* 临时码
*/
wzdm
?:
string
}
\ No newline at end of file
entry/src/main/ets/model/WzcrkModel.ets
View file @
fef13132
...
...
@@ -43,6 +43,11 @@ class WzcrkModel {
// await SQLiteContext.with(WzcrkDao).batchInsert(data)
}
// 添加一个
async setOne(data: Wzcrk) {
await SQLiteContext.with(WzcrkDao).insert(data)
}
// 查询
async query(data: Partial<Wzcrk>): Promise<Wzcrk[]> {
let res = await SQLiteContext.with(WzcrkDao).getWzcrk(data)
...
...
entry/src/main/ets/model/WzcrkmxModel.ets
View file @
fef13132
...
...
@@ -27,10 +27,11 @@ class WzcrkmxModel {
return res;
}
// 更新单据信息
async updateWcztmxByData(guid:
string,
data: Partial<Wzcrkmx>):Promise<number> {
async updateWcztmxByData(guid:
string,
data: Partial<Wzcrkmx>):Promise<number> {
let res = await SQLiteContext.with(WzcrkmxDao).updateWcztmxByData(guid, data)
return res;
}
// 清空表
async clear() {
await SQLiteContext.with(WzcrkmxDao).clearTable()
...
...
entry/src/main/ets/pages/metailmange/Common/Wzcrk.data.ets
View file @
fef13132
import { pzlx_dict, szlx_dict,new_zmlx_dict, Logger } from '@ohos/common'
import { pzlx_dict, szlx_dict, new_zmlx_dict, Logger } from '@ohos/common'
import wzcrkModel from '../../../model/WzcrkModel'
@Observed
export class WzClass {
guid?: string
...
...
@@ -126,31 +129,31 @@ export class WzClass {
pzsl?: number;
crksl?: number;
}) {
this.guid = data.guid;
this.gznd = data.gznd;
this.crkrq = data.crkrq;
this.ckdwguid = data.ckdwguid;
this.czr = data.czr;
this.qrzt = data.qrzt;
this.crklx = data.crklx;
this.pzzbguid = data.pzzbguid;
this.pzlx = data.pzlx;
this.pzh = data.pzh;
this.sjlx = data.sjlx;
this.pzszlx = data.pzszlx;
this.sfdw = data.sfdw;
this.wczt = data.wczt;
this.kfdm = data.kfdm;
this.rkkfdm = data.rkkfdm;
this.pzsl = data.pzsl;
this.crksl = data.crksl;
this.ydh = data.ydh;
this.fwgldwdm = data.fwgldwdm;
this.swgldwdm = data.swgldwdm;
this.kfguid = data.kfguid;
this.zmlx = data.zmlx;
this.bdguid = data.bdguid;
this.dec = data.dec;
this.guid = data.guid
|| ''
;
this.gznd = data.gznd
|| ''
;
this.crkrq = data.crkrq
|| ''
;
this.ckdwguid = data.ckdwguid
|| ''
;
this.czr = data.czr
|| ''
;
this.qrzt = data.qrzt
|| ''
;
this.crklx = data.crklx
|| ''
;
this.pzzbguid = data.pzzbguid
|| ''
;
this.pzlx = data.pzlx
|| ''
;
this.pzh = data.pzh
|| 0
;
this.sjlx = data.sjlx
|| ''
;
this.pzszlx = data.pzszlx
|| ''
;
this.sfdw = data.sfdw
|| ''
;
this.wczt = data.wczt
|| ''
;
this.kfdm = data.kfdm
|| ''
;
this.rkkfdm = data.rkkfdm
|| ''
;
this.pzsl = data.pzsl
|| 0
;
this.crksl = data.crksl
|| 0
;
this.ydh = data.ydh
|| ''
;
this.fwgldwdm = data.fwgldwdm
|| ''
;
this.swgldwdm = data.swgldwdm
|| ''
;
this.kfguid = data.kfguid
|| ''
;
this.zmlx = data.zmlx
|| ''
;
this.bdguid = data.bdguid
|| ''
;
this.dec = data.dec
|| ''
;
}
}
...
...
@@ -190,23 +193,23 @@ export class WzmxClass {
/**
* 号型名称
*/
hxmc:string
hxmc:
string
/**
* 型号
*/
xh:string
xh:
string
/**
* 物资品名
*/
wzpm:string
wzpm:
string
/**
* 六位品名代码
*/
pmdmSix:string
pmdmSix:
string
/**
* 完成状态
*/
wczt:string
wczt:
string
constructor(data: {
guid?: string,
...
...
@@ -217,11 +220,11 @@ export class WzmxClass {
wzcrkguid: string,
hwh: string,
pzmxguid: string,
hxmc:string,
xh:string,
wzpm:string,
pmdmSix:string,
wczt:string
hxmc:
string,
xh:
string,
wzpm:
string,
pmdmSix:
string,
wczt:
string
}) {
this.guid = data.guid;
// this.gznd = data.gznd;
...
...
@@ -252,8 +255,13 @@ export function renderSzlx(szlx) {
return res ? res.text : ''
}
// 账目类型
export function
renderZmlx(zmlx) {
export function renderZmlx(zmlx) {
Logger.info('szlx>>', zmlx)
const res = new_zmlx_dict.find(v => v.value == zmlx)
return res ? res.text : ''
}
export async function getDefaultPzh(pzlx: string) {
const res = await wzcrkModel.query({ sjlx: '新建', pzlx })
return res.length + 1
}
\ No newline at end of file
entry/src/main/ets/pages/metailmange/WzInPage/WzInPage.ets
View file @
fef13132
...
...
@@ -3,7 +3,7 @@ import router from '@ohos.router';
import { WzList } from '../Common/WzcrkList';
import wzcrkModel from '../../../model/WzcrkModel';
import { Logger } from '@ohos/common/src/main/ets/utils/Logger';
import { WzClass } from '../Common/Wzcrk.data'
import { WzClass
, getDefaultPzh
} from '../Common/Wzcrk.data'
import promptAction from '@ohos.promptAction';
import { SetStatusDialog } from '../../../view/SetStatusDialog/SetStatusDialog';
import { ExportOrderDialog } from '../../../view/ExportOrderDialog/ExportOrderDialog';
...
...
@@ -247,9 +247,12 @@ export struct WzInPage {
Button("临时收物")
.visibility(this.currentIndex === 1 ? Visibility.Visible : Visibility.None)
.bottomBtnSty()
.onClick(() => {
.onClick(async () => {
// 获取凭证号
const pzh = await getDefaultPzh('14')
router.pushUrl({
url: "pages/metailmange/AddTemporaryInPage",
url: "pages/metailmange/WzInPage/WzinDetail/WzinDetail",
params: { isUpdate: false, wzcrk: { pzlx: '14', pzszlx: "DR", pzh,crklx: '2', wczt:"未完成" } }
})
})
.fontColor("#0fa983")
...
...
entry/src/main/ets/pages/metailmange/WzInPage/WzinDetail/AddWzin.ets
View file @
fef13132
import { zmlx_dict } from '@ohos/common/src/main/ets/utils/dict'
import gldwModel from '../../../../model/GldwModel'
import hwModel from '../../../../model/HwModel'
import kfModel from '../../../../model/KfModel'
import { renderPzlx, renderSzlx, renderZmlx, WzinClass } from '../../Common/Wzcrk.data'
import { renderPzlx, renderSzlx, WzClass } from '../../Common/Wzcrk.data'
import promptAction from '@ohos.promptAction'
@Observed
class Options {
value: string
id: string | number
constructor(value, id) {
this.value = value
this.id = id
}
}
@Observed
class Form {
title: string
key: string
enabled: boolean
required: boolean
type: 'input' | 'select'
options?: Options[]
constructor(data: {
title: string
key: string
enabled: boolean
type: 'input' | 'select',
required: boolean,
options?: Options[]
}) {
this.title = data.title
this.key = data.key
this.enabled = data.enabled
this.type = data.type
this.required = data.required || false
this.options = data.options
}
}
@Entry
@Component
// 物资信息
export struct PzInfo {
// @State kfmc: string = ''
// @State fwgldw: string = ''
// @State swgldw: string = ''
export struct AddWzin {
@ObjectLink wzcrk: WzClass
@State form: Form[] = []
arr = [{ title: "凭证类型", key: 'pzlx', enabled: false, type: 'input' },
{ title: "凭证号", key: 'pzh', enabled: false, type: 'input' },
{ title: "收支类型", key: 'pzszlx', enabled: false, type: 'input' },
{ title: "库房", key: 'kfguid', enabled: true, type: 'select', options:[] },
{ title: "货位号", key: 'hwh', enabled: true, type: 'select' },
{
title: "库房",
key: 'kfguid',
enabled: true,
type: 'select',
options: [],
required: true
},
{
title: "货位号",
key: 'hwh',
enabled: true,
type: 'select',
options: [],
required: true
},
{ title: "运单号", key: 'ydh', enabled: true, type: 'input' },
{ title: "发物管理单位", key: 'fwgldwdm', enabled: false, type: 'select' },
{ title: "收物管理单位", key: 'swgldwdm', enabled: false, type: 'select' },
{ title: "账目类型", key: 'zmlx', enabled: false, type: 'select'},
{
title: "发物管理单位",
key: 'fwgldwdm',
enabled: false,
type: 'select',
options: [],
required: true
},
{
title: "收物管理单位",
key: 'swgldwdm',
enabled: false,
type: 'select',
options: [],
required: true
},
{
title: "账目类型",
key: 'zmlx',
enabled: false,
type: 'select',
options: [],
required: true
},
{ title: "备注", key: 'dec', enabled: true, type: 'input' }
]
// 表单验证
validate(): boolean {
this.arr.filter(v => v.required).forEach(v => {
if (!this.wzcrk[v.key]) {
promptAction.showToast({
message: `请${v.type == 'input' ? '输入' : '选择'}${v.title}`,
bottom: 300
})
return false
}
})
return true
}
handleText(key: string): string {
switch (key) {
case 'pzlx':
return renderPzlx(this.wzcrk.pzlx)
case 'pzszlx':
return renderSzlx(this.wzcrk.pzszlx)
default:
return String(this.wzcrk[key])
}
}
aboutToAppear() {
this.getData()
}
async getData() {
// 获取库房列表
const kfList = await kfModel.query({
})
const kfList = await kfModel.query({})
this.arr[this.arr.findIndex(v => v.key == 'kfguid')].options = kfList.map(v => {
return {
value:v.kfmc,
id:v.guid
}
// 获取货架列表
const hwList = await hwModel.query()
// 获取单位列表
const dwList = await gldwModel.queryByData({})
this.arr.forEach((i: any) => {
this.form.push(new Form(i))
})
kfList.forEach(i => {
this.form[this.form.findIndex(v => v.key == 'kfguid')]
.options
.push(new Options(i.kfmc, i.guid))
})
hwList.forEach(i => {
this.form[this.form.findIndex(v => v.key == 'hwh')]
.options
.push(new Options(i.hwh, i.hwh))
})
zmlx_dict.forEach(i => {
this.form[this.form.findIndex(v => v.key == 'zmlx')]
.options
.push(new Options(i.text, i.value))
})
dwList.forEach(i => {
this.form[this.form.findIndex(v => v.key == 'swgldwdm')]
.options
.push(new Options(i.dwfh, i.dwdm))
})
//
// const res1 = await gldwModel.queryByData({ dwdm: this.wzcrk.fwgldwdm })
// this.fwgldw = res1[0].dwfh ?? ''
//
// const res2 = await gldwModel.queryByData({ dwdm: this.wzcrk.swgldwdm })
// this.swgldw = res2[0].dwfh ?? ''
dwList.forEach(i => {
this.form[this.form.findIndex(v => v.key == 'fwgldwdm')]
.options
.push(new Options(i.dwfh, i.dwdm))
})
}
build() {
...
...
@@ -59,46 +186,54 @@ export struct PzInfo {
.fontSize(16)
}.height('8%')
ForEach(this.arr, (item) => {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) {
Text(item.title)
.fontSize(14)
.width("30%")
.height(40)
.fontColor($r("app.color.item_color_black"))
if (item.type == 'select') {
Select([])
.value(`请选择${item.title}`)
.width(230)
.borderWidth(1)
.borderRadius(5)
.borderColor($r("app.color.rank_secondary_border"))
.onSelect((index: number, value?: string) => {
console.log("选择库房", value)
})
}
if (item.type == 'input') {
TextInput({ text: "1111" })
.enterKeyType(EnterKeyType.Search)
.borderColor("#454545")
.borderRadius(5)
.width("70%")
.height(40)
.padding(10)
.borderColor('#bcc5d7')
.borderWidth(1)
.backgroundColor(item.enabled ? '#fff' : "app.color.disabledColor")
.enabled(item.enabled)
.onChange((value: string) => {
if (item.enabled) {
// this.wzcrk[item.key] = value
List() {
ForEach(this.form, (item) => {
ListItem() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) {
if (item.required) {
Text('*').fontColor('red').margin({ right: 5 })
}
Text(item.title)
.fontSize(14)
.width("30%")
.height(40)
.fontColor($r("app.color.item_color_black"))
if (item.type == 'select') {
Select(item.options)
.value(`请选择${item.title}`)
.width(230)
.borderWidth(1)
.borderRadius(5)
.borderColor($r("app.color.rank_secondary_border"))
.onSelect((index: number, value?: string) => {
this.wzcrk[item.key] = item.options[index].id
})
}
if (item.type == 'input') {
TextInput({ text: this.handleText(item.key) })
.enterKeyType(EnterKeyType.Search)
.borderColor("#454545")
.borderRadius(5)
.width("70%")
.height(40)
.padding(10)
.borderColor('#bcc5d7')
.borderWidth(1)
.backgroundColor(item.enabled ? '#fff' : "app.color.disabledColor")
.enabled(item.enabled)
.onChange((value: string) => {
if (item.enabled) {
this.wzcrk[item.key] = value
}
})
}
})
}
}.padding("10vp")
})
}
}
}.padding(15)
})
}.margin({ bottom: 40 })
}.backgroundColor('#fff')
}
}
\ No newline at end of file
entry/src/main/ets/pages/metailmange/WzInPage/WzinDetail/PzInfo.ets
View file @
fef13132
...
...
@@ -16,6 +16,7 @@ export struct PzInfo {
{ title: "运单号", key: 'ydh', enabled: true },
{ title: "发物管理单位", key: 'fwgldwdm', enabled: false },
{ title: "收物管理单位", key: 'swgldwdm', enabled: false },
{ title: "账目类型", key: 'zmlx', enabled: false },
{ title: "备注", key: 'dec', enabled: true }
]
...
...
@@ -73,31 +74,38 @@ export struct PzInfo {
Text("凭证信息")
.fontSize(16)
}.height('8%')
ForEach(this.arr,(item) => {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) {
Text(item.title)
.fontSize(14)
.width("30%")
.height(40)
.fontColor($r("app.color.item_color_black"))
TextInput({ text: this.handleText(item.key) })
.enterKeyType(EnterKeyType.Search)
.borderColor("#454545")
.borderRadius(5)
.width("70%")
.height(40)
.padding(10)
.borderColor('#bcc5d7')
.borderWidth(1)
.backgroundColor(item.enabled ? '#fff' : "app.color.disabledColor")
.enabled(item.enabled)
.onChange((value: string) => {
if(item.enabled) {
this.wzcrk[item.key] = value
List(){
ForEach(this.arr,(item) => {
ListItem(){
Column(){
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) {
Text(item.title)
.fontSize(14)
.width("30%")
.height(40)
.fontColor($r("app.color.item_color_black"))
TextInput({ text: this.handleText(item.key) })
.enterKeyType(EnterKeyType.Search)
.borderColor("#454545")
.borderRadius(5)
.width("70%")
.height(40)
.padding(10)
.borderColor('#bcc5d7')
.borderWidth(1)
.backgroundColor(item.enabled ? '#fff' : "app.color.disabledColor")
.enabled(item.enabled)
.onChange((value: string) => {
if(item.enabled) {
this.wzcrk[item.key] = value
}
})
}
})
}.padding("10vp")
})
}
}.padding(15)
})
}.margin({bottom:40})
}.backgroundColor('#fff')
}
}
\ No newline at end of file
entry/src/main/ets/pages/metailmange/WzInPage/WzinDetail/PzInfo2.ets
deleted
100644 → 0
View file @
870a637b
import { Logger } from '@ohos/common/src/main/ets/utils/Logger'
import gldwModel from '../../../../model/GldwModel'
import kfModel from '../../../../model/KfModel'
import { renderPzlx, renderSzlx, renderZmlx, WzinClass } from '../../Common/Wzcrk.data'
// @Observed
class Options {
value:'string'
id: string | number
}
// @Observed
class Form {
title: string
key: string
enabled:boolean
type: 'input' | 'select'
options?: Options[]
}
@Entry
@Component
// 物资信息
export struct PzInfo {
// @State kfmc: string = ''
// @State fwgldw: string = ''
// @State swgldw: string = ''
@State Form: form[] = []
arr = [{ title: "凭证类型", key: 'pzlx', enabled: false, type: 'input' },
{ title: "凭证号", key: 'pzh', enabled: false, type: 'input' },
{ title: "收支类型", key: 'pzszlx', enabled: false, type: 'input' },
{ title: "库房", key: 'kfguid', enabled: true, type: 'select' },
{ title: "货位号", key: 'hwh', enabled: true, type: 'select'},
{ title: "运单号", key: 'ydh', enabled: true, type: 'input' },
{ title: "发物管理单位", key: 'fwgldwdm', enabled: false, type: 'select' },
{ title: "收物管理单位", key: 'swgldwdm', enabled: false, type: 'select' },
{ title: "账目类型", key: 'zmlx', enabled: false, type: 'select'},
{ title: "备注", key: 'dec', enabled: true, type: 'input' }
]
aboutToAppear() {
this.getData()
}
async getData() {
// 获取库房列表
const kfList = await kfModel.query({})
Logger.info('库房列表>>', JSON.stringify(kfList))
this.arr.forEach(i => {
this.form
})
// this.arr[this.arr.findIndex(v => v.key == 'kfguid')].options = kfList.map(v => {
// return {
// value:v.kfmc,
// id:v.guid
// }
// })
Logger.info('库房列表>>111', JSON.stringify( this.arr[this.arr.findIndex(v => v.key == 'kfguid')].options))
//
// const res1 = await gldwModel.queryByData({ dwdm: this.wzcrk.fwgldwdm })
// this.fwgldw = res1[0].dwfh ?? ''
//
// const res2 = await gldwModel.queryByData({ dwdm: this.wzcrk.swgldwdm })
// this.swgldw = res2[0].dwfh ?? ''
}
build() {
Column() {
Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) {
Divider()
.vertical(true)
.height(14)
.strokeWidth(3)
.color('#19ac88')
.opacity(0.6)
.margin({ left: 8, right: 8 })
Text("凭证信息")
.fontSize(16)
}.height('8%')
ForEach(this.arr, (item) => {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) {
Text(item.title)
.fontSize(14)
.width("30%")
.height(40)
.fontColor($r("app.color.item_color_black"))
if (item.type == 'select') {
Select(item.options)
.value(`请选择${item.title}`)
.width(230)
.borderWidth(1)
.borderRadius(5)
.borderColor($r("app.color.rank_secondary_border"))
.onSelect((index: number, value?: string) => {
console.log("选择库房", value)
})
}
if (item.type == 'input') {
TextInput({ text: "1111" })
.enterKeyType(EnterKeyType.Search)
.borderColor("#454545")
.borderRadius(5)
.width("70%")
.height(40)
.padding(10)
.borderColor('#bcc5d7')
.borderWidth(1)
.backgroundColor(item.enabled ? '#fff' : "app.color.disabledColor")
.enabled(item.enabled)
.onChange((value: string) => {
if (item.enabled) {
// this.wzcrk[item.key] = value
}
})
}
}.padding("10vp")
})
}.backgroundColor('#fff')
}
}
\ No newline at end of file
entry/src/main/ets/pages/metailmange/WzInPage/WzinDetail/WzinDetail.ets
View file @
fef13132
...
...
@@ -9,6 +9,9 @@ import { WzClass, WzmxClass } from '../../Common/Wzcrk.data';
import bzhxModel from '../../../../model/BzhxModel';
import promptAction from '@ohos.promptAction';
import wzcrkModel from '../../../../model/WzcrkModel';
import { SQLiteContext, Wzcrkmx, WzcrkmxDao } from '@ohos/common';
import {AddWzin} from './AddWzin'
import { uuid } from '@ohos/common/src/main/ets/utils/util';
@Extend(Button) function CommonButtonStyle() {
.borderWidth(2)
...
...
@@ -21,7 +24,8 @@ import wzcrkModel from '../../../../model/WzcrkModel';
}
interface params {
wzcrk: Wzcrk
wzcrk: Wzcrk,
isUpdate: boolean
}
/*入库详情*/
@Entry
...
...
@@ -30,13 +34,16 @@ struct WzinDetail {
@State fontColor: string = '#0FA983'
@State selectedFontColor: string = '#fff'
@State currentIndex: number = 0
@State isUpdate: boolean = false
@State wzcrk: WzClass = null // 物资出入库单据信息
@State wzmx: WzmxClass[] = [] // 物资出入库明细
private controller: TabsController = new TabsController()
wzcrkmxDao: WzcrkmxDao = SQLiteContext.with(WzcrkmxDao)
onPageShow() {
const params = router.getParams() as params
this.isUpdate = params.isUpdate
this.wzcrk = new WzClass(params.wzcrk)
Logger.info('接收到出入库信息>>', JSON.stringify(params.wzcrk))
this.getDetail()
...
...
@@ -74,14 +81,19 @@ struct WzinDetail {
Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
TabContent() {
Column() {
PzInfo({ wzcrk: this.wzcrk })
// PzInfo()
if(this.isUpdate) {
PzInfo({ wzcrk: this.wzcrk })
} else {
AddWzin({ wzcrk: this.wzcrk })
}
}.width("100%")
}.tabBar(this.TabBuilder(0, '凭证信息'))
TabContent() {
Column() {
WzInfo({ wzmx: this.wzmx, wzcrk: this.wzcrk,
getDetail:
this.getDetail })
WzInfo({ wzmx: this.wzmx, wzcrk: this.wzcrk,
getDetail:
this.getDetail })
}.width("100%")
}.tabBar(this.TabBuilder(1, '物资信息'))
}
...
...
@@ -94,32 +106,58 @@ struct WzinDetail {
Row() {
Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) {
Button("射频扫码").CommonButtonStyle().width("50%").onClick(() => {
router.pushUrl({
url:'pages/metailmange/UHFScanPage',params:{wzcrkItem:this.wzcrk}
})
router.pushUrl({
url: 'pages/metailmange/UHFScanPage', params: { wzcrkItem: this.wzcrk }
})
})
Button("保存").CommonButtonStyle().width("50%")
.onClick(async () => {
try {
Logger.info('保存的入库数据>>', JSON.stringify(this.wzcrk))
Logger.info('保存的入库明细数据>>', JSON.stringify(this.wzmx))
for (let index = 0; index < this.wzmx.length; index++) {
const element = this.wzmx[index];
await wzcrkmxModel.updateWcztmxByData(element.guid, { crksl: element.crksl })
if(this.isUpdate) {
await wzcrkModel.updateWcztByData(this.wzcrk.guid, {
dec: this.wzcrk.dec,
ydh: this.wzcrk.ydh,
})
}
const crksl = this.wzmx.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 })
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))
}
// for (let index = 0; index < this.wzmx.length; index++) {
// const element = this.wzmx[index];
// try {
// Logger.error(this, '更新数据参数' + JSON.stringify({
// 'guid': element.guid,
// 'crksl': element.crksl
// }))
// let val1 = await this.wzcrkmxDao.update({ 'guid': element.guid, 'crksl': element.crksl } as Wzcrkmx)
// Logger.error(this, '更新查询的入库数据>>' + JSON.stringify(val1));
// } catch (e) {
// Logger.error(this, '保存失败了>>' + JSON.stringify(e))
// }
// }
//
// const crksl = this.wzmx.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
// })
//
promptAction.showToast({
message: '保存入库数据成功',
bottom:
2
00
bottom:
3
00
})
setTimeout(() => {
router.replaceUrl({ url: 'pages/metailmange/WzInPage/WzInPage' })
},
5
00)
},
3
00)
} catch (e) {
promptAction.showToast({
message: '保存入库数据失败',
...
...
entry/src/main/ets/pages/package/Pick.ets
View file @
fef13132
import { SQLiteContext,
ViewdrdcDao,Logger
} from '@ohos/common'
import { SQLiteContext,
Logger, WzcrkmxDao, Wzcrkmx
} from '@ohos/common'
import { BasicTable } from '../../view/BasicTable/BasicTable'
import { TitleBar } from '../../view/title/TitleBar'
...
...
@@ -16,6 +16,7 @@ import { TitleBar } from '../../view/title/TitleBar'
@Component
export struct Pick {
controller: SearchController = new SearchController()
wzcrkmxDao: WzcrkmxDao = SQLiteContext.with(WzcrkmxDao)
build() {
Column() {
...
...
@@ -43,14 +44,36 @@ export struct Pick {
Row() {
Flex({ justifyContent: FlexAlign.SpaceAround }) {
Button("打印面单").CommonButtonStyle().onClick(() => {
Logger.info(this,'输出数据:666666666666');
SQLiteContext.with(ViewdrdcDao).queryAll().then(res=>{
Logger.info(this,'输出数据:' + JSON.stringify(res));
})
Button("打印面单").CommonButtonStyle().onClick(async () => {
let val = await this.wzcrkmxDao.batchInsert([{
guid: '123',
gznd: '2023',
pmdmcode: '10001',
pzsl: 100,
crksl: 0,
wzcrkguid: '1000',
hwh: '1-1-1-2',
pzmxguid: '1000'
}, {
guid: '124',
gznd: '2023',
pmdmcode: '10001',
pzsl: 880,
crksl: 0,
wzcrkguid: '1000',
hwh: '1-1-2-2',
pzmxguid: '1000'
}]);
Logger.info(this, '输出数据:' + val);
})
Button("扫码取件").CommonButtonStyle().onClick(async () => {
let val = await this.wzcrkmxDao.update({ guid: '124', crksl: 888 } as Wzcrkmx);
Logger.info(this, '输出更新数据:' + val);
})
Button("手动取件").CommonButtonStyle().onClick(async () => {
let val = await this.wzcrkmxDao.queryAll();
Logger.info(this, '输出查询数据:' + JSON.stringify(val));
})
Button("扫码取件").CommonButtonStyle()
Button("手动取件").CommonButtonStyle()
}
}.height(80).backgroundColor('#97c6a6')
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论