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 个修改的文件
包含
356 行增加
和
239 行删除
+356
-239
BaseTable.ets
common/src/main/ets/db/BaseTable.ets
+5
-0
WzcrkmxDao.ets
common/src/main/ets/db/dao/WzcrkmxDao.ets
+34
-10
NativeSql.ets
common/src/main/ets/db/sql/NativeSql.ets
+0
-0
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
+45
-36
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
+167
-31
PzInfo.ets
entry/src/main/ets/pages/metailmange/WzInPage/WzinDetail/PzInfo.ets
+10
-1
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
+52
-14
Pick.ets
entry/src/main/ets/pages/package/Pick.ets
+30
-7
没有找到文件。
common/src/main/ets/db/BaseTable.ets
View file @
fef13132
...
@@ -188,6 +188,7 @@ export default abstract class BaseTable<T> implements ITable {
...
@@ -188,6 +188,7 @@ export default abstract class BaseTable<T> implements ITable {
* @param predicates 默认不填,根据主键更新,否则依据[predicates]更新
* @param predicates 默认不填,根据主键更新,否则依据[predicates]更新
*/
*/
async update(item: T, predicates?: rdb.RdbPredicates): Promise<number> {
async update(item: T, predicates?: rdb.RdbPredicates): Promise<number> {
try{
let bucket = {};
let bucket = {};
Logger.info(this, '更新数据,item=' + JSON.stringify(item));
Logger.info(this, '更新数据,item=' + JSON.stringify(item));
this.toUpdateBucket(bucket, item);
this.toUpdateBucket(bucket, item);
...
@@ -198,6 +199,10 @@ export default abstract class BaseTable<T> implements ITable {
...
@@ -198,6 +199,10 @@ export default abstract class BaseTable<T> implements ITable {
predicates = this.getPredicates().equalTo(this.getColumnId(), this.getEntityId(item));
predicates = this.getPredicates().equalTo(this.getColumnId(), this.getEntityId(item));
}
}
return db.update(bucket, predicates);
return db.update(bucket, predicates);
}catch (e){
throw new Error('[数据更新失败]|异常信息>>' + e)
}
}
}
async updateData(bucket: ValuesBucket, predicates?: rdb.RdbPredicates): Promise<number> {
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';
...
@@ -14,14 +14,14 @@ import { WzcrkMxRefWzDto } from '../../bean/dto/WzcrkMxRefWzDto';
export class WzcrkmxDao extends BaseTable<Wzcrkmx> {
export class WzcrkmxDao extends BaseTable<Wzcrkmx> {
toBean(cursor: relationalStore.ResultSet): Wzcrkmx {
toBean(cursor: relationalStore.ResultSet): Wzcrkmx {
let info: Wzcrkmx = {
let info: Wzcrkmx = {
guid: cursor.getString(cursor.getColumnIndex('
guid
')),
guid: cursor.getString(cursor.getColumnIndex('
GUID
')),
gznd: cursor.getString(cursor.getColumnIndex('
gznd
')),
gznd: cursor.getString(cursor.getColumnIndex('
GZND
')),
pmdmcode: cursor.getString(cursor.getColumnIndex('
pmdmcode
')),
pmdmcode: cursor.getString(cursor.getColumnIndex('
PMDMCODE
')),
pzsl: cursor.getLong(cursor.getColumnIndex('
pzsl
')),
pzsl: cursor.getLong(cursor.getColumnIndex('
PZSL
')),
crksl: cursor.getLong(cursor.getColumnIndex('
crksl
')),
crksl: cursor.getLong(cursor.getColumnIndex('
CRKSL
')),
wzcrkguid: cursor.getString(cursor.getColumnIndex('
wzcrkguid
')),
wzcrkguid: cursor.getString(cursor.getColumnIndex('
WZCRKGUID
')),
hwh: cursor.getString(cursor.getColumnIndex('
hwh
')),
hwh: cursor.getString(cursor.getColumnIndex('
HWH
')),
pzmxguid: cursor.getString(cursor.getColumnIndex('
pzmxguid
'))
pzmxguid: cursor.getString(cursor.getColumnIndex('
PZMXGUID
'))
};
};
return info;
return info;
}
}
...
@@ -31,7 +31,7 @@ export class WzcrkmxDao extends BaseTable<Wzcrkmx> {
...
@@ -31,7 +31,7 @@ export class WzcrkmxDao extends BaseTable<Wzcrkmx> {
}
}
getColumnId(): string {
getColumnId(): string {
return "
guid
";
return "
GUID
";
}
}
getTableColumns(): string[] {
getTableColumns(): string[] {
...
@@ -138,16 +138,40 @@ export class WzcrkmxDao extends BaseTable<Wzcrkmx> {
...
@@ -138,16 +138,40 @@ export class WzcrkmxDao extends BaseTable<Wzcrkmx> {
return this.updateData(valueBucket, wp)
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> {
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 = {
const valueBucket = {
// "wczt": wczt
};
};
for (const [key, value] of Object.entries(data)) {
for (const [key, value] of Object.entries(data)) {
if(value) {
valueBucket[key] = value
valueBucket[key] = value
}
}
}
let wp = this.getPredicates()
let wp = this.getPredicates()
wp.equalTo('guid', guid)
wp.equalTo('guid', guid)
return this.updateData(valueBucket, wp)
return this.updateData(valueBucket, wp)
...
...
common/src/main/ets/db/sql/NativeSql.ets
View file @
fef13132
common/src/main/ets/entity/Wzcrkmx.ts
View file @
fef13132
...
@@ -28,8 +28,4 @@ export interface Wzcrkmx {
...
@@ -28,8 +28,4 @@ export interface Wzcrkmx {
* 凭证明细的guid
* 凭证明细的guid
*/
*/
pzmxguid
:
string
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 {
...
@@ -43,6 +43,11 @@ class WzcrkModel {
// await SQLiteContext.with(WzcrkDao).batchInsert(data)
// await SQLiteContext.with(WzcrkDao).batchInsert(data)
}
}
// 添加一个
async setOne(data: Wzcrk) {
await SQLiteContext.with(WzcrkDao).insert(data)
}
// 查询
// 查询
async query(data: Partial<Wzcrk>): Promise<Wzcrk[]> {
async query(data: Partial<Wzcrk>): Promise<Wzcrk[]> {
let res = await SQLiteContext.with(WzcrkDao).getWzcrk(data)
let res = await SQLiteContext.with(WzcrkDao).getWzcrk(data)
...
...
entry/src/main/ets/model/WzcrkmxModel.ets
View file @
fef13132
...
@@ -27,10 +27,11 @@ class WzcrkmxModel {
...
@@ -27,10 +27,11 @@ class WzcrkmxModel {
return res;
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)
let res = await SQLiteContext.with(WzcrkmxDao).updateWcztmxByData(guid, data)
return res;
return res;
}
}
// 清空表
// 清空表
async clear() {
async clear() {
await SQLiteContext.with(WzcrkmxDao).clearTable()
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
@Observed
export class WzClass {
export class WzClass {
guid?: string
guid?: string
...
@@ -126,31 +129,31 @@ export class WzClass {
...
@@ -126,31 +129,31 @@ export class WzClass {
pzsl?: number;
pzsl?: number;
crksl?: number;
crksl?: number;
}) {
}) {
this.guid = data.guid;
this.guid = data.guid
|| ''
;
this.gznd = data.gznd;
this.gznd = data.gznd
|| ''
;
this.crkrq = data.crkrq;
this.crkrq = data.crkrq
|| ''
;
this.ckdwguid = data.ckdwguid;
this.ckdwguid = data.ckdwguid
|| ''
;
this.czr = data.czr;
this.czr = data.czr
|| ''
;
this.qrzt = data.qrzt;
this.qrzt = data.qrzt
|| ''
;
this.crklx = data.crklx;
this.crklx = data.crklx
|| ''
;
this.pzzbguid = data.pzzbguid;
this.pzzbguid = data.pzzbguid
|| ''
;
this.pzlx = data.pzlx;
this.pzlx = data.pzlx
|| ''
;
this.pzh = data.pzh;
this.pzh = data.pzh
|| 0
;
this.sjlx = data.sjlx;
this.sjlx = data.sjlx
|| ''
;
this.pzszlx = data.pzszlx;
this.pzszlx = data.pzszlx
|| ''
;
this.sfdw = data.sfdw;
this.sfdw = data.sfdw
|| ''
;
this.wczt = data.wczt;
this.wczt = data.wczt
|| ''
;
this.kfdm = data.kfdm;
this.kfdm = data.kfdm
|| ''
;
this.rkkfdm = data.rkkfdm;
this.rkkfdm = data.rkkfdm
|| ''
;
this.pzsl = data.pzsl;
this.pzsl = data.pzsl
|| 0
;
this.crksl = data.crksl;
this.crksl = data.crksl
|| 0
;
this.ydh = data.ydh;
this.ydh = data.ydh
|| ''
;
this.fwgldwdm = data.fwgldwdm;
this.fwgldwdm = data.fwgldwdm
|| ''
;
this.swgldwdm = data.swgldwdm;
this.swgldwdm = data.swgldwdm
|| ''
;
this.kfguid = data.kfguid;
this.kfguid = data.kfguid
|| ''
;
this.zmlx = data.zmlx;
this.zmlx = data.zmlx
|| ''
;
this.bdguid = data.bdguid;
this.bdguid = data.bdguid
|| ''
;
this.dec = data.dec;
this.dec = data.dec
|| ''
;
}
}
}
}
...
@@ -190,23 +193,23 @@ export class WzmxClass {
...
@@ -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: {
constructor(data: {
guid?: string,
guid?: string,
...
@@ -217,11 +220,11 @@ export class WzmxClass {
...
@@ -217,11 +220,11 @@ export class WzmxClass {
wzcrkguid: string,
wzcrkguid: string,
hwh: string,
hwh: string,
pzmxguid: string,
pzmxguid: string,
hxmc:string,
hxmc:
string,
xh:string,
xh:
string,
wzpm:string,
wzpm:
string,
pmdmSix:string,
pmdmSix:
string,
wczt:string
wczt:
string
}) {
}) {
this.guid = data.guid;
this.guid = data.guid;
// this.gznd = data.gznd;
// this.gznd = data.gznd;
...
@@ -257,3 +260,8 @@ export function renderZmlx(zmlx) {
...
@@ -257,3 +260,8 @@ export function renderZmlx(zmlx) {
const res = new_zmlx_dict.find(v => v.value == zmlx)
const res = new_zmlx_dict.find(v => v.value == zmlx)
return res ? res.text : ''
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';
...
@@ -3,7 +3,7 @@ import router from '@ohos.router';
import { WzList } from '../Common/WzcrkList';
import { WzList } from '../Common/WzcrkList';
import wzcrkModel from '../../../model/WzcrkModel';
import wzcrkModel from '../../../model/WzcrkModel';
import { Logger } from '@ohos/common/src/main/ets/utils/Logger';
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 promptAction from '@ohos.promptAction';
import { SetStatusDialog } from '../../../view/SetStatusDialog/SetStatusDialog';
import { SetStatusDialog } from '../../../view/SetStatusDialog/SetStatusDialog';
import { ExportOrderDialog } from '../../../view/ExportOrderDialog/ExportOrderDialog';
import { ExportOrderDialog } from '../../../view/ExportOrderDialog/ExportOrderDialog';
...
@@ -247,9 +247,12 @@ export struct WzInPage {
...
@@ -247,9 +247,12 @@ export struct WzInPage {
Button("临时收物")
Button("临时收物")
.visibility(this.currentIndex === 1 ? Visibility.Visible : Visibility.None)
.visibility(this.currentIndex === 1 ? Visibility.Visible : Visibility.None)
.bottomBtnSty()
.bottomBtnSty()
.onClick(() => {
.onClick(async () => {
// 获取凭证号
const pzh = await getDefaultPzh('14')
router.pushUrl({
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")
.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 gldwModel from '../../../../model/GldwModel'
import hwModel from '../../../../model/HwModel'
import kfModel from '../../../../model/KfModel'
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
@Component
// 物资信息
// 物资信息
export struct PzInfo {
export struct AddWzin {
// @State kfmc: string = ''
@ObjectLink wzcrk: WzClass
// @State fwgldw: string = ''
@State form: Form[] = []
// @State swgldw: string = ''
arr = [{ title: "凭证类型", key: 'pzlx', enabled: false, type: 'input' },
arr = [{ title: "凭证类型", key: 'pzlx', enabled: false, type: 'input' },
{ title: "凭证号", key: 'pzh', enabled: false, type: 'input' },
{ title: "凭证号", key: 'pzh', enabled: false, type: 'input' },
{ title: "收支类型", key: 'pzszlx', 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: 'ydh', enabled: true, type: 'input' },
{ title: "发物管理单位", key: 'fwgldwdm', enabled: false, type: 'select' },
{
{ title: "收物管理单位", key: 'swgldwdm', enabled: false, type: 'select' },
title: "发物管理单位",
{ title: "账目类型", key: 'zmlx', enabled: false, type: 'select'},
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' }
{ 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() {
aboutToAppear() {
this.getData()
this.getData()
}
}
async 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 {
const hwList = await hwModel.query()
value:v.kfmc,
id:v.guid
// 获取单位列表
}
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))
})
})
//
// const res1 = await gldwModel.queryByData({ dwdm: this.wzcrk.fwgldwdm })
zmlx_dict.forEach(i => {
// this.fwgldw = res1[0].dwfh ?? ''
this.form[this.form.findIndex(v => v.key == 'zmlx')]
//
.options
// const res2 = await gldwModel.queryByData({ dwdm: this.wzcrk.swgldwdm })
.push(new Options(i.text, i.value))
// this.swgldw = res2[0].dwfh ?? ''
})
dwList.forEach(i => {
this.form[this.form.findIndex(v => v.key == 'swgldwdm')]
.options
.push(new Options(i.dwfh, i.dwdm))
})
dwList.forEach(i => {
this.form[this.form.findIndex(v => v.key == 'fwgldwdm')]
.options
.push(new Options(i.dwfh, i.dwdm))
})
}
}
build() {
build() {
...
@@ -59,28 +186,33 @@ export struct PzInfo {
...
@@ -59,28 +186,33 @@ export struct PzInfo {
.fontSize(16)
.fontSize(16)
}.height('8%')
}.height('8%')
ForEach(this.arr, (item) => {
List() {
ForEach(this.form, (item) => {
ListItem() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) {
if (item.required) {
Text('*').fontColor('red').margin({ right: 5 })
}
Text(item.title)
Text(item.title)
.fontSize(14)
.fontSize(14)
.width("30%")
.width("30%")
.height(40)
.height(40)
.fontColor($r("app.color.item_color_black"))
.fontColor($r("app.color.item_color_black"))
if (item.type == 'select') {
if (item.type == 'select') {
Select([]
)
Select(item.options
)
.value(`请选择${item.title}`)
.value(`请选择${item.title}`)
.width(230)
.width(230)
.borderWidth(1)
.borderWidth(1)
.borderRadius(5)
.borderRadius(5)
.borderColor($r("app.color.rank_secondary_border"))
.borderColor($r("app.color.rank_secondary_border"))
.onSelect((index: number, value?: string) => {
.onSelect((index: number, value?: string) => {
console.log("选择库房", value)
this.wzcrk[item.key] = item.options[index].id
})
})
}
}
if (item.type == 'input') {
if (item.type == 'input') {
TextInput({ text: "1111"
})
TextInput({ text: this.handleText(item.key)
})
.enterKeyType(EnterKeyType.Search)
.enterKeyType(EnterKeyType.Search)
.borderColor("#454545")
.borderColor("#454545")
.borderRadius(5)
.borderRadius(5)
...
@@ -93,12 +225,15 @@ export struct PzInfo {
...
@@ -93,12 +225,15 @@ export struct PzInfo {
.enabled(item.enabled)
.enabled(item.enabled)
.onChange((value: string) => {
.onChange((value: string) => {
if (item.enabled) {
if (item.enabled) {
//
this.wzcrk[item.key] = value
this.wzcrk[item.key] = value
}
}
})
})
}
}
}.padding("10vp")
}
}
}.padding(15)
})
})
}.margin({ bottom: 40 })
}.backgroundColor('#fff')
}.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 {
...
@@ -16,6 +16,7 @@ export struct PzInfo {
{ title: "运单号", key: 'ydh', enabled: true },
{ title: "运单号", key: 'ydh', enabled: true },
{ title: "发物管理单位", key: 'fwgldwdm', enabled: false },
{ title: "发物管理单位", key: 'fwgldwdm', enabled: false },
{ title: "收物管理单位", key: 'swgldwdm', enabled: false },
{ title: "收物管理单位", key: 'swgldwdm', enabled: false },
{ title: "账目类型", key: 'zmlx', enabled: false },
{ title: "备注", key: 'dec', enabled: true }
{ title: "备注", key: 'dec', enabled: true }
]
]
...
@@ -73,7 +74,10 @@ export struct PzInfo {
...
@@ -73,7 +74,10 @@ export struct PzInfo {
Text("凭证信息")
Text("凭证信息")
.fontSize(16)
.fontSize(16)
}.height('8%')
}.height('8%')
List(){
ForEach(this.arr,(item) => {
ForEach(this.arr,(item) => {
ListItem(){
Column(){
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) {
Text(item.title)
Text(item.title)
.fontSize(14)
.fontSize(14)
...
@@ -96,8 +100,12 @@ export struct PzInfo {
...
@@ -96,8 +100,12 @@ export struct PzInfo {
this.wzcrk[item.key] = value
this.wzcrk[item.key] = value
}
}
})
})
}.padding("10vp")
}
}
}.padding(15)
})
})
}.margin({bottom:40})
}.backgroundColor('#fff')
}.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';
...
@@ -9,6 +9,9 @@ import { WzClass, WzmxClass } from '../../Common/Wzcrk.data';
import bzhxModel from '../../../../model/BzhxModel';
import bzhxModel from '../../../../model/BzhxModel';
import promptAction from '@ohos.promptAction';
import promptAction from '@ohos.promptAction';
import wzcrkModel from '../../../../model/WzcrkModel';
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() {
@Extend(Button) function CommonButtonStyle() {
.borderWidth(2)
.borderWidth(2)
...
@@ -21,7 +24,8 @@ import wzcrkModel from '../../../../model/WzcrkModel';
...
@@ -21,7 +24,8 @@ import wzcrkModel from '../../../../model/WzcrkModel';
}
}
interface params {
interface params {
wzcrk: Wzcrk
wzcrk: Wzcrk,
isUpdate: boolean
}
}
/*入库详情*/
/*入库详情*/
@Entry
@Entry
...
@@ -30,13 +34,16 @@ struct WzinDetail {
...
@@ -30,13 +34,16 @@ struct WzinDetail {
@State fontColor: string = '#0FA983'
@State fontColor: string = '#0FA983'
@State selectedFontColor: string = '#fff'
@State selectedFontColor: string = '#fff'
@State currentIndex: number = 0
@State currentIndex: number = 0
@State isUpdate: boolean = false
@State wzcrk: WzClass = null // 物资出入库单据信息
@State wzcrk: WzClass = null // 物资出入库单据信息
@State wzmx: WzmxClass[] = [] // 物资出入库明细
@State wzmx: WzmxClass[] = [] // 物资出入库明细
private controller: TabsController = new TabsController()
private controller: TabsController = new TabsController()
wzcrkmxDao: WzcrkmxDao = SQLiteContext.with(WzcrkmxDao)
onPageShow() {
onPageShow() {
const params = router.getParams() as params
const params = router.getParams() as params
this.isUpdate = params.isUpdate
this.wzcrk = new WzClass(params.wzcrk)
this.wzcrk = new WzClass(params.wzcrk)
Logger.info('接收到出入库信息>>', JSON.stringify(params.wzcrk))
Logger.info('接收到出入库信息>>', JSON.stringify(params.wzcrk))
this.getDetail()
this.getDetail()
...
@@ -74,14 +81,19 @@ struct WzinDetail {
...
@@ -74,14 +81,19 @@ struct WzinDetail {
Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
TabContent() {
TabContent() {
Column() {
Column() {
if(this.isUpdate) {
PzInfo({ wzcrk: this.wzcrk })
PzInfo({ wzcrk: this.wzcrk })
// PzInfo()
} else {
AddWzin({ wzcrk: this.wzcrk })
}
}.width("100%")
}.width("100%")
}.tabBar(this.TabBuilder(0, '凭证信息'))
}.tabBar(this.TabBuilder(0, '凭证信息'))
TabContent() {
TabContent() {
Column() {
Column() {
WzInfo({ wzmx: this.wzmx, wzcrk: this.wzcrk,
getDetail:
this.getDetail })
WzInfo({ wzmx: this.wzmx, wzcrk: this.wzcrk,
getDetail:
this.getDetail })
}.width("100%")
}.width("100%")
}.tabBar(this.TabBuilder(1, '物资信息'))
}.tabBar(this.TabBuilder(1, '物资信息'))
}
}
...
@@ -94,32 +106,58 @@ struct WzinDetail {
...
@@ -94,32 +106,58 @@ struct WzinDetail {
Row() {
Row() {
Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) {
Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) {
Button("射频扫码").CommonButtonStyle().width("50%").onClick(() => {
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%")
Button("保存").CommonButtonStyle().width("50%")
.onClick(async () => {
.onClick(async () => {
try {
try {
Logger.info('保存的入库数据>>', JSON.stringify(this.wzcrk))
Logger.info('保存的入库明细数据>>', JSON.stringify(this.wzmx))
Logger.info('保存的入库明细数据>>', JSON.stringify(this.wzmx))
for (let index = 0; index < this.wzmx.length; index++) {
if(this.isUpdate) {
const element = this.wzmx[index];
await wzcrkModel.updateWcztByData(this.wzcrk.guid, {
await wzcrkmxModel.updateWcztmxByData(element.guid, { crksl: element.crksl })
dec: this.wzcrk.dec,
ydh: this.wzcrk.ydh,
})
}
}
const crksl = this.wzmx.map(v => Number(v.crksl)).reduce((a, b) => a + b, 0)
else {
this.wzcrk.guid = uuid()
await wzcrkModel.updateWcztByData(this.wzcrk.guid, { dec: this.wzcrk.dec, ydh: this.wzcrk.ydh,crksl })
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({
promptAction.showToast({
message: '保存入库数据成功',
message: '保存入库数据成功',
bottom:
2
00
bottom:
3
00
})
})
setTimeout(() => {
setTimeout(() => {
router.replaceUrl({ url: 'pages/metailmange/WzInPage/WzInPage' })
router.replaceUrl({ url: 'pages/metailmange/WzInPage/WzInPage' })
},
5
00)
},
3
00)
} catch (e) {
} catch (e) {
promptAction.showToast({
promptAction.showToast({
message: '保存入库数据失败',
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 { BasicTable } from '../../view/BasicTable/BasicTable'
import { TitleBar } from '../../view/title/TitleBar'
import { TitleBar } from '../../view/title/TitleBar'
...
@@ -16,6 +16,7 @@ import { TitleBar } from '../../view/title/TitleBar'
...
@@ -16,6 +16,7 @@ import { TitleBar } from '../../view/title/TitleBar'
@Component
@Component
export struct Pick {
export struct Pick {
controller: SearchController = new SearchController()
controller: SearchController = new SearchController()
wzcrkmxDao: WzcrkmxDao = SQLiteContext.with(WzcrkmxDao)
build() {
build() {
Column() {
Column() {
...
@@ -43,14 +44,36 @@ export struct Pick {
...
@@ -43,14 +44,36 @@ export struct Pick {
Row() {
Row() {
Flex({ justifyContent: FlexAlign.SpaceAround }) {
Flex({ justifyContent: FlexAlign.SpaceAround }) {
Button("打印面单").CommonButtonStyle().onClick(() => {
Button("打印面单").CommonButtonStyle().onClick(async () => {
Logger.info(this,'输出数据:666666666666');
let val = await this.wzcrkmxDao.batchInsert([{
SQLiteContext.with(ViewdrdcDao).queryAll().then(res=>{
guid: '123',
Logger.info(this,'输出数据:' + JSON.stringify(res));
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')
}.height(80).backgroundColor('#97c6a6')
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论