Commit 0fdb8f62 by 毛勇泽

Merge remote-tracking branch 'origin/master'

parents a406ccaa fef13132
......@@ -31,9 +31,9 @@ export default abstract class BaseTable<T> implements ITable {
name: this.dbName,
securityLevel: rdb.SecurityLevel.S4
})
Logger.info(this,"开始执行====")
Logger.info(this, "开始执行====")
await this.init(db);
Logger.info(this,"结束执行====")
Logger.info(this, "结束执行====")
return db;
}
......@@ -80,6 +80,9 @@ export default abstract class BaseTable<T> implements ITable {
}
/**
* 更新数据的bucket
*/
toBuckets(bucket: ValuesBucket, item: T): ValuesBucket {
this.getTableColumns().forEach((col) => {
bucket[col] = item[col]
......@@ -163,6 +166,10 @@ export default abstract class BaseTable<T> implements ITable {
return db.delete(predicates);
}
/**
* 根据主键批量删除
* @param items 主键集合
*/
async deleteItems(...items: T[]): Promise<number[]> {
if (!items) {
return [];
......@@ -175,7 +182,13 @@ export default abstract class BaseTable<T> implements ITable {
return results;
}
/**
* 更新对象
* @param item 要更新的对象
* @param predicates 默认不填,根据主键更新,否则依据[predicates]更新
*/
async update(item: T, predicates?: rdb.RdbPredicates): Promise<number> {
try{
let bucket = {};
Logger.info(this, '更新数据,item=' + JSON.stringify(item));
this.toUpdateBucket(bucket, item);
......@@ -186,6 +199,10 @@ export default abstract class BaseTable<T> implements ITable {
predicates = this.getPredicates().equalTo(this.getColumnId(), this.getEntityId(item));
}
return db.update(bucket, predicates);
}catch (e){
throw new Error('[数据更新失败]|异常信息>>' + e)
}
}
async updateData(bucket: ValuesBucket, predicates?: rdb.RdbPredicates): Promise<number> {
......@@ -224,7 +241,6 @@ export default abstract class BaseTable<T> implements ITable {
}
/**
* 创建表的SQL语句
*/
......
......@@ -124,19 +124,19 @@ export class WzcrkDao extends BaseTable<Wzcrk> {
async getWzcrk(data: Partial<Wzcrk>): Promise<Wzcrk[]> {
let wp = this.getPredicates();
// if (pzh) {
// wp.equalTo('PZH', pzh)
// }
// if (wczt) {
// wp.equalTo('WCZT', wczt)
// }
// wp.equalTo('CRKLX', crklx)
// wp.orderByAsc('PZH');
for (const [key, value] of Object.entries(data)) {
if (value) {
wp.equalTo(key, value)
if (data.pzh) {
wp.like('PZH', '%' + data.pzh + '%')
}
if (data.wczt) {
wp.equalTo('WCZT', data.wczt)
}
if (data.pzlx) {
wp.equalTo('PZLX', data.pzlx)
}
if (data.sjlx) {
wp.equalTo('SJLX', data.sjlx)
}
wp.orderByAsc('PZH');
return this.query(wp, this.getTableColumns());
}
......
......@@ -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)) {
if(value) {
valueBucket[key] = value
}
}
let wp = this.getPredicates()
wp.equalTo('guid', guid)
return this.updateData(valueBucket, wp)
......
......@@ -28,8 +28,4 @@ export interface Wzcrkmx {
* 凭证明细的guid
*/
pzmxguid: string
/**
* 临时码
*/
wzdm?: string
}
\ No newline at end of file
......@@ -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)
......
......@@ -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()
......
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 WzinClass {
export class WzClass {
guid?: string
/**
* 工作年度
......@@ -126,31 +129,31 @@ export class WzinClass {
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;
......@@ -257,3 +260,8 @@ export function renderZmlx(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
import { WzinClass,renderPzlx } from './Wzin.data'
import { WzClass,renderPzlx } from './Wzcrk.data'
@Component
export struct WzInList {
@ObjectLink item: WzinClass
export struct WzList {
@ObjectLink item: WzClass
@Link checkedList: Array<string>
build() {
......
import { TitleBar } from '../../../view/title/TitleBar'
import router from '@ohos.router';
import { WzInList } from './WzInList';
import { WzList } from '../Common/WzcrkList';
import wzcrkModel from '../../../model/WzcrkModel';
import { Logger } from '@ohos/common/src/main/ets/utils/Logger';
import { WzinClass } from './Wzin.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';
import ViewdrdcModel from '../../../model/ViewdrdcModel';
import { ViewdrdcDao } from '@ohos/common/src/main/ets/db/dao/ViewdrdcDao';
import defHttp from '@ohos/common/src/main/ets/utils/HttpUtil';
import { importData } from './wzIn.api';
import { importData } from '../Common/Wzcrk.api';
import { dateUtils } from '@ohos/common/src/main/ets/utils/util';
@Extend(Button) function bottomBtnSty() {
.borderWidth(1)
......@@ -34,7 +33,7 @@ export struct WzInPage {
@State fontColor: string = '#182431'
@State selectedFontColor: string = '#fff'
@State currentIndex: number = 0
@State dataSource: WzinClass[] = []
@State dataSource: WzClass[] = []
@State checkedList: Array<string> = []
@State radioChecked: boolean = true
@State searchData: SearchData = {
......@@ -69,11 +68,11 @@ export struct WzInPage {
async getWzcrkList(qzh?: number, wczt?: string) {
Logger.info('出入库传入参数>>:', JSON.stringify(this.searchData))
this.dataSource = []
const res = await wzcrkModel.query({ crklx: "2", pzh: Number(this.searchData.pzh) , wczt: this.searchData.wczt, sjlx: this.currentIndex === 0 ? "导入" : "临时收物" })
const res = await wzcrkModel.query({ pzlx: "14", pzh: Number(this.searchData.pzh), wczt: this.searchData.wczt, sjlx: this.currentIndex === 0 ? "导入" : "临时收物" })
Logger.info('出入库数据>>:', JSON.stringify(res))
Logger.info('出入库数据长度>>:', JSON.stringify(res.length))
res.forEach(element => {
this.dataSource.push(new WzinClass(element))
this.dataSource.push(new WzClass(element))
});
Logger.info('数量是' + JSON.stringify(this.dataSource))
}
......@@ -84,7 +83,7 @@ export struct WzInPage {
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Text('完成').margin({ left: 20 })
Radio({ value: 'Radio1', group: 'radioGroup' })
.checked(this.radioChecked)
.checked(true)
.onChange((isChecked: boolean) => {
this.radioChecked = isChecked
}).margin({ right: 20 })
......@@ -95,7 +94,7 @@ export struct WzInPage {
Row() {
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Text('未完成').margin({ left: 20 })
Radio({ value: 'Radio1', group: 'radioGroup' })
Radio({ value: 'Radio2', group: 'radioGroup' })
.onChange((isChecked: boolean) => {
}).margin({ right: 20 })
}
......@@ -132,9 +131,8 @@ export struct WzInPage {
onSubmit() {
try{
this.checkedList.forEach(async (element)=>{
let num = await wzcrkModel.updateWzcrkWczt(element, this.radioChecked ? '已完成' : '未完成')
if(num){
Logger.info("删除的数据是:" + JSON.stringify(this.dataSource))
let num = await wzcrkModel.updateWzcrkWczt(element, (this.radioChecked == undefined || this.radioChecked ? '已完成' : '未完成'))
if(num) {
this.dataSource.splice(this.dataSource.findIndex(i => i.guid == element), 1)
}
})
......@@ -166,10 +164,9 @@ export struct WzInPage {
this.checkedList.forEach(async element => {
let res = await ViewdrdcModel.queryExport({guid: element, wczt: '已完成', pzlx: '14'})
const jhguidArr = res.map((item) => item.guid)
Logger.info('导出数据0:', JSON.stringify(jhguidArr))
if (jhguidArr && jhguidArr.length > 0) {
const date = dateUtils.formatDateTime(new Date(), 'before')
const newArr = [...new Set(jhguidArr)]
Logger.info('导出数据1:', JSON.stringify(newArr))
const exportData = newArr.map((item) => {
let newObj = {}
let ItemData = []
......@@ -185,38 +182,43 @@ export struct WzInPage {
})
}
})
Logger.info('导出数据2:', JSON.stringify(ItemData))
const [filterData] = res.filter((fItem) => fItem
.guid == item)
Logger.info('>>>>>>>kkkll:' + JSON.stringify(filterData))
if (filterData) {
newObj = {
cbdwdm: filterData.ckdwguid,
ckkfdm: filterData.kfdm,
...filterData,
crksl: ItemData.map(i => i.sjsl).reduce((a, b) => {
return a + b
},0),
scjid: "863576927543400,863576927543400",
cjmc: "普华",
imei: "863576927543400,863576927543400",
model: "ax6737_65_n",
vendor: "alps",
dcsj: "2024年01月20日",
dcsj: date,
pzmx: ItemData
}
}
return newObj
})
Logger.info('导出数据3:', JSON.stringify(exportData))
const kkkk = {
const exportForm = {
pzzbJson: exportData,
crklx: '11111CRKLX2',
gznd: '2023',
jsdwguid: 1,
}
await importData(kkkk)
await importData(exportForm)
}
})
promptAction.showToast({
message: '导出'
promptAction.showDialog({
title: '提示',
message: '入库作业单据已同步至业务系统,请以保管员身份登录业务系统,在菜单“作业项目--物资入库”里刷新查看。',
buttons: [{
text: '已知晓',
color: '#0fa983',
}],
})
}
......@@ -245,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")
......@@ -391,7 +396,7 @@ export struct WzInPage {
List({ space: 2 }) {
ForEach(this.dataSource, (item) => {
ListItem() {
WzInList({ item, checkedList: $checkedList }).width('100%').backgroundColor('#fff')
WzList({ item, checkedList: $checkedList }).width('100%').backgroundColor('#fff')
}.onClick(() => {
router.pushUrl({ url: 'pages/metailmange/WzInPage/WzinDetail/WzinDetail', params: {
wzcrk: item
......
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 '../Wzin.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))
})
//
// 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 ?? ''
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))
})
dwList.forEach(i => {
this.form[this.form.findIndex(v => v.key == 'fwgldwdm')]
.options
.push(new Options(i.dwfh, i.dwdm))
})
}
build() {
......@@ -59,28 +186,33 @@ export struct PzInfo {
.fontSize(16)
}.height('8%')
ForEach(this.arr, (item) => {
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([])
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)
this.wzcrk[item.key] = item.options[index].id
})
}
if (item.type == 'input') {
TextInput({ text: "1111" })
TextInput({ text: this.handleText(item.key) })
.enterKeyType(EnterKeyType.Search)
.borderColor("#454545")
.borderRadius(5)
......@@ -93,12 +225,15 @@ export struct PzInfo {
.enabled(item.enabled)
.onChange((value: string) => {
if (item.enabled) {
// this.wzcrk[item.key] = value
this.wzcrk[item.key] = value
}
})
}
}.padding("10vp")
}
}
}.padding(15)
})
}.margin({ bottom: 40 })
}.backgroundColor('#fff')
}
}
\ No newline at end of file
import { WzmxClass } from '../Wzin.data'
import { WzmxClass } from '../../Common/Wzcrk.data'
@CustomDialog
@Component
export struct LeftDialog {
......
import gldwModel from '../../../../model/GldwModel'
import kfModel from '../../../../model/KfModel'
import { renderPzlx, renderSzlx, renderZmlx, WzinClass } from '../Wzin.data'
import { renderPzlx, renderSzlx, renderZmlx, WzClass } from '../../Common/Wzcrk.data'
@Component
// 物资信息
export struct PzInfo {
@State kfmc: string = ''
@State fwgldw: string = ''
@State swgldw: string = ''
@ObjectLink wzcrk: WzinClass
@ObjectLink wzcrk: WzClass
arr = [{ title: "凭证类型", key: 'pzlx', enabled: false },
{ title: "凭证号", key: 'pzh', enabled: false },
......@@ -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,7 +74,10 @@ export struct PzInfo {
Text("凭证信息")
.fontSize(16)
}.height('8%')
List(){
ForEach(this.arr,(item) => {
ListItem(){
Column(){
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) {
Text(item.title)
.fontSize(14)
......@@ -96,8 +100,12 @@ export struct PzInfo {
this.wzcrk[item.key] = value
}
})
}.padding("10vp")
}
}
}.padding(15)
})
}.margin({bottom:40})
}.backgroundColor('#fff')
}
}
\ No newline at end of file
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 '../Wzin.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
......@@ -3,7 +3,7 @@ import { Logger } from '@ohos/common';
import { Wzcrkmx } from '@ohos/common/src/main/ets/entity/Wzcrkmx';
import gldwModel from '../../../../model/GldwModel';
import kfModel from '../../../../model/KfModel';
import { WzinClass, WzmxClass } from '../Wzin.data';
import { WzClass, WzmxClass } from '../../Common/Wzcrk.data';
import { WzList } from './WzList';
@Extend(Button) function CommonButtonStyle() {
......@@ -23,7 +23,7 @@ export struct WzInfo {
@State kfmc: string = ''
@State sfdw: string = ''
@State private wzmx: WzmxClass[] = []
@ObjectLink wzcrk: WzinClass
@ObjectLink wzcrk: WzClass
getDetail: (wzpm?:string) => void
aboutToAppear(){
......
import { Logger } from '@ohos/common/src/main/ets/utils/Logger'
import { WzmxClass } from '../Wzin.data'
import { WzmxClass } from '../../Common/Wzcrk.data'
@Component
export struct WzList {
......
......@@ -5,10 +5,13 @@ import { Wzcrk } from '@ohos/common/src/main/ets/entity/Wzcrk';
import { WzInfo } from './WzInfo'
import { PzInfo } from './PzInfo'
import wzcrkmxModel from '../../../../model/WzcrkmxModel';
import { WzinClass, WzmxClass } from '../Wzin.data';
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,14 +34,17 @@ struct WzinDetail {
@State fontColor: string = '#0FA983'
@State selectedFontColor: string = '#fff'
@State currentIndex: number = 0
@State wzcrk: WzinClass = null // 物资出入库单据信息
@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.wzcrk = new WzinClass(params.wzcrk)
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() {
if(this.isUpdate) {
PzInfo({ wzcrk: this.wzcrk })
// PzInfo()
} 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: 200
bottom: 300
})
setTimeout(() => {
router.replaceUrl({ url: 'pages/metailmange/WzInPage/WzInPage' })
}, 500)
}, 300)
} catch (e) {
promptAction.showToast({
message: '保存入库数据失败',
......
import { TitleBar } from '../../view/title/TitleBar'
import { Demo } from '../../view/demo/demo';
import router from '@ohos.router';
@Extend(Button) function bottomBtnSty() {
.borderWidth(1)
.padding({top:1,bottom:1,right:7,left:7})
.borderColor('#0fa983')
.backgroundColor('#fff')
.fontColor('#0fa983')
.borderRadius(7)
.type(ButtonType.Normal)
.stateEffect(true)
}
@Entry
@Component
export struct WzOutPage {
@State fontColor: string = '#182431'
@State selectedFontColor: string = '#fff'
@State currentIndex: number = 0
private controller: TabsController = new TabsController()
private searchcontroller: SearchController = new SearchController()
itemClick() {
router.pushUrl({url:'pages/order_detail/PzInOutDetailPage'})
}
@Builder TabBuilder(index: number, name: string) {
Column() {
Text(name)
.fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor)
.fontSize(16)
.lineHeight(22)
.margin({ top: 17, bottom: 7 })
Divider()
.strokeWidth(2)
.color('#fff')
.width(50)
.opacity(this.currentIndex === index ? 1 : 0)
}.width('100%')
}
@Builder bottomButtons() {
Row() {
Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) {
Button("临时发物")
.visibility(this.currentIndex === 1 ? Visibility.Visible:Visibility.None)
.bottomBtnSty()
.onClick( () => {
router.pushUrl({
url: "pages/metailmange/AddTemporaryOutPage",
})
})
.fontColor("#0fa983")
.fontSize("14vp")
Button("设置状态")
.bottomBtnSty()
.onClick(() => {
})
.fontColor("#0fa983")
.fontSize("14vp")
Button("单据匹配")
.visibility(this.currentIndex === 1 ? Visibility.Visible : Visibility.None)
.bottomBtnSty()
.onClick(() => {
router.pushUrl({
url: "pages/metailmange/AddTemporaryInPage",
})
})
.fontColor("#0fa983")
.fontSize("14vp")
Button("导出数据包")
.visibility(this.currentIndex === 0 ? Visibility.Visible : Visibility.None)
.bottomBtnSty()
.onClick(() => {
}).fontColor("#0fa983") .fontSize("14vp")
Button("全选")
.bottomBtnSty().fontColor("#0fa983") .fontSize("14vp")
Button("清空选择")
.bottomBtnSty()
.onClick(() =>{
}).fontColor("#0fa983") .fontSize("14vp")
}
}.height(80)
}
build(){
Column() {
Flex({direction:FlexDirection.Column}){
TitleBar({ title:"物资出库" })
Row(){
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }){
Search({ placeholder: '请输入凭证号',controller: this.searchcontroller })
.height(40)
.backgroundColor('#F5F5F5')
.placeholderColor(Color.Grey)
.borderRadius(5)
.textAlign(TextAlign.Center)
.placeholderFont({ size: 14, weight: 400 })
.textFont({ size: 14, weight: 400 })
.width('100%')
.onSubmit((value: string) => {
})
.onChange((value: string) => {
})
}.height(40)
}.width("100%")
.padding('15vp')
Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
TabContent() {
// Column().width('100%').height('100%').backgroundColor('#00CB87')
}.tabBar(this.TabBuilder(0, '导入'))
TabContent() {
// Column().width('100%').height('100%').backgroundColor('#007DFF')
}.tabBar(this.TabBuilder(1, '临时发物'))
}
.height(80)
.margin({top:-15})
.onChange((index: number) => {
this.currentIndex = index
})
// 列表
Column() {
Demo({itemClick: this.itemClick}).width('90%')
}.flexGrow(1).backgroundColor('#fff').alignSelf(ItemAlign.Center)
Row(){
// 底部按钮
this.bottomButtons();
}.backgroundColor("#97c6a6").width("100%").height(80)
}
}.linearGradient({
direction: GradientDirection.Right, // 渐变方向
repeating: true, // 渐变颜色是否重复
colors: [[0x36a3c0, 0.0], [0x97c6a6, 1], [0xc7d799, 0.0]] // 数组末尾元素占比小于1时满足重复着色效果
})
}
}
\ No newline at end of file
import { LeftDialog } from '../metailmange/WzInPage/WzinDetail/LeftDialog'
import { TitleBar } from '../../view/title/TitleBar'
import router from '@ohos.router'
import { WzmxClass } from './WzInPage/Wzin.data'
import { WzmxClass } from './Common/Wzcrk.data'
@Extend(Button) function CommonButtonStyle() {
.borderWidth(2)
......
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')
}
......
import { UniListItem } from '@ohos/system/src/main/ets/model/UniInitList';
import { WzinClass } from '../../pages/metailmange/WzInPage/Wzin.data';
import { WzClass } from '../../pages/metailmange/Common/Wzcrk.data';
@Extend(Button) function CommonButtonStyle() {
.borderWidth(2)
.borderColor('#0fa983')
......@@ -32,7 +32,7 @@ interface FormData {
@CustomDialog
@Component
export struct ExportOrderDialog {
@Link dataSource: WzinClass[]
@Link dataSource: WzClass[]
@Link checkedList: Array<string>
controller: CustomDialogController
cancel: () => void
......
import { UniListItem } from '@ohos/system/src/main/ets/model/UniInitList';
import { WzinClass } from '../../pages/metailmange/WzInPage/Wzin.data';
import { WzClass } from '../../pages/metailmange/Common/Wzcrk.data';
@Extend(Button) function CommonButtonStyle() {
.borderWidth(2)
.borderColor('#0fa983')
......@@ -32,7 +32,7 @@ interface FormData {
@CustomDialog
@Component
export struct SetStatusDialog {
@Link dataSource: WzinClass[]
@Link dataSource: WzClass[]
@Link checkedList: Array<string>
controller: CustomDialogController
cancel: () => void
......
......@@ -5,7 +5,7 @@
"pages/package/Pick",
"pages/package/Pack",
"pages/metailmange/WzInPage/WzInPage",
"pages/metailmange/WzOutPage",
"pages/metailmange/WzOutPage/WzOutPage",
"pages/metailmange/WzExchangePage",
"pages/metailmange/WzConversionPage",
"pages/metailmange/WzInvPage",
......
......@@ -86,7 +86,7 @@ export struct MaterialManagement {
break;
case "out":
router.pushUrl({
url: "pages/metailmange/WzOutPage",
url: "pages/metailmange/WzOutPage/WzOutPage",
})
break;
case "exchange":
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论