Commit 86f4306a by 陈桂东

数据同步

parent 3485b15d
......@@ -12,8 +12,8 @@ export class BzhxDao extends BaseTable<Bzhx> {
toBean(cursor: relationalStore.ResultSet): Bzhx {
let info: Bzhx = {
guid: cursor.getString(cursor.getColumnIndex('guid')),
pmdmten: cursor.getString(cursor.getColumnIndex('pmdmten')),
pmdmsix: cursor.getString(cursor.getColumnIndex('pmdmsix')),
pmdmTen: cursor.getString(cursor.getColumnIndex('pmdmten')),
pmdmSix: cursor.getString(cursor.getColumnIndex('pmdmsix')),
wzpm: cursor.getString(cursor.getColumnIndex('wzpm')),
hxmc: cursor.getString(cursor.getColumnIndex('hxmc')),
xh: cursor.getLong(cursor.getColumnIndex('xh')),
......@@ -26,15 +26,15 @@ export class BzhxDao extends BaseTable<Bzhx> {
}
getEntityId(item: Bzhx): ValueType {
return item.pmdmten;
return item.pmdmTen;
}
getColumnId(): string {
return "pmdmten";
return "pmdmTen";
}
getTableColumns(): string[] {
return ['guid', 'pmdmten', 'pmdmsix', 'wzpm', 'hxmc', 'xh', 'pmguid', 'hxguid', 'hwzt', 'pmguid_old'];
return ['guid', 'pmdmTen', 'pmdmSix', 'wzpm', 'hxmc', 'xh', 'pmguid', 'hxguid', 'hwzt', 'pmguid_old'];
}
getCreateTableSql(): string {
......
......@@ -53,7 +53,7 @@ export class GldwDao extends BaseTable<Gldw> {
getGldwList(dwmc: string): Promise<Gldw[]> {
let wp = this.getPredicates();
if (dwmc) {
wp.like('DWFH', dwmc)
wp.like('DWFH', `%${dwmc}%`)
}
wp.orderByAsc('DWDM');
return this.query(wp, this.getTableColumns());
......
......@@ -51,7 +51,7 @@ export class KfInfoDao extends BaseTable<KfInfo> {
async getKf(kfmc: string): Promise<KfInfo[]> {
let wp = this.getPredicates();
if (kfmc) {
wp.like('KFMC', kfmc);
wp.like('KFMC', `%${kfmc}%`);
}
wp.orderByAsc("KFDM");
return this.query(wp, this.getTableColumns());
......
......@@ -7,11 +7,11 @@ export interface Bzhx {
/**
* 10位品名代码(存放10位品名代码或6位无号配号加“0000”)
*/
pmdmten: string,
pmdmTen: string,
/**
* 6位品名代码
*/
pmdmsix: string,
pmdmSix: string,
/**
* 物资品名
*/
......
......@@ -4,11 +4,11 @@
export interface Gldw {
guid?: string,
/**
* 单位代码
* 单位名称
*/
dwfh?: string,
/**
* 单位名称
* 单位代码
*/
dwdm?: string,
/**
......
import { BzhxDao, SQLiteContext,Bzhx } from '@ohos/common'
import { uuid } from '@ohos/common/src/main/ets/utils/util'
// 被装号型
class BzhxModal {
// 添加被装号型
async set(data: Bzhx[]) {
await SQLiteContext.with(BzhxDao).batchInsert(data)
const copyData = data.map(v => {
return {
...v,
pmdmSix: v.pmdmTen.slice(0,6),
guid:uuid(),
pmguid:"",
hxguid:"",
pmguid_old:""
}
})
await SQLiteContext.with(BzhxDao).batchInsert(copyData)
}
// 查询被装号型
......
......@@ -2,6 +2,7 @@ import { Gldw, SQLiteContext,GldwDao } from '@ohos/common'
// 管理单位
class GldwModal {
// 添加管理单位
async set(data: Gldw[]) {
await SQLiteContext.with(GldwDao).batchInsert(data)
......
......@@ -29,7 +29,7 @@ import promptAction from '@ohos.promptAction'
@Entry
@Component
export struct DataSynchronism {
export struct Pmhx {
@State content: string = ''
@State showProgress: boolean = false
@State dwguid: string = '' // 单位代码
......@@ -80,7 +80,7 @@ export struct DataSynchronism {
const allData = JSON.parse(res).bzhxList as Bzhx[]
// 添加品名
// await bzhxModal.set(allData)
await bzhxModal.set(allData)
// 获取基础信息
const baseRes = await getBaseList({ dwguid: this.dwguid })
......@@ -93,13 +93,13 @@ export struct DataSynchronism {
// await qyModel.set(qyList)
// 货架添加
await hjModel.set(hjList)
// await hjModel.set(hjList)
// 货位添加
// await hwModel.set(hwList)
// 添加管理单位
// await gldwModel.set(ddwAndJw)
await gldwModel.set(ddwAndJw)
......
import { Shelf } from './ShelfList'
import { TitleBar } from '../../../view/title/TitleBar'
import HjModel from '../../../model/HjModel'
import { Logger } from '@ohos/common'
import { HjInfo } from '@ohos/common'
@Entry
@Component
export struct GoodShelf {
@State searchValue: string = ''
controller: SearchController = new SearchController()
@State dataSource: HjInfo[] = []
aboutToAppear(){
this.getShelfList()
}
// 获取货架数据
async getShelfList(no?: string) {
const res = await HjModel.query(no)
this.dataSource = res
Logger.info(this, "货架数据>>" + JSON.stringify(res));
}
build() {
Column() {
Flex({ direction: FlexDirection.Column }) {
TitleBar({ title: "货架查看" })
Row() {
Search({ value: this.searchValue, placeholder: '请输入货架名称', controller: this.controller })
.height(40)
.backgroundColor('#F5F5F5')
.placeholderColor(Color.Grey)
.placeholderFont({ size: 14, weight: 400 })
.textFont({ size: 14, weight: 400 })
.onSubmit((value) => this.getShelfList(value))
.borderRadius(5)
}.width('100%')
Column() {
Shelf({ dataSource: $dataSource })
}.margin({top:20}).borderRadius(2)
}
}.linearGradient({
direction: GradientDirection.RightBottom,
repeating: true,
colors: [['#36a3c0', 0.0], ['#97c6a6', 1.0], ['#c7d799', 2.0]]
}).padding({bottom:40,left:20,right:20})
}
}
\ No newline at end of file
import { HjInfo } from '@ohos/common'
@Component
export struct Shelf {
@Link dataSource: HjInfo[]
@Styles commonPadding() {
.padding({top:4, bottom:4})
.alignSelf(ItemAlign.Start)
}
@Builder renderList() {
Column() {
List(){
ForEach(this.dataSource, (item, index) => {
ListItem(){
Row() {
Column() {
Row(){
Text("区域:").commonPadding()
Text(item.kfdm).commonPadding()
}.margin({left:20})
Row(){
Text("库房名称:").commonPadding()
Text(item.kfmc).commonPadding()
}
}.width('40%')
Column() {
Row(){
Text("库房类型:").commonPadding()
Text(item.kflx).commonPadding()
}
Row(){
Text("优先级:").commonPadding()
Text(item.yxj + '').commonPadding()
}
}.width('40%')
Row() {
Radio({ value: 'Radio1', group: 'radioGroup' })
.height(18)
.width(18)
.onChange((isChecked: boolean) => {
console.log('Radio1 status is ' + isChecked)
})
}.width('10%')
}.commonPadding()
}
})
}.divider({strokeWidth:1,color:'505050'})
}.width('100%').height('100%').backgroundColor('#fff')
}
@Builder renderEmpty() {
Flex({justifyContent:FlexAlign.Center,alignItems:ItemAlign.Center}) {
Column() {
Image($r("app.media.empty")).width("42%")
Text("暂无数据").fontSize(22).fontColor("#fff").margin({top: 5})
}
}.height('70%')
}
build() {
if(this.dataSource.length == 0) {
this.renderEmpty()
} else {
this.renderList()
}
}
}
\ No newline at end of file
import { BasicTable } from '../../view/BasicTable/BasicTable'
import { TitleBar } from '../../view/title/TitleBar'
import bzhxModal from '../../../model/BzhxModel'
import { BasicTable } from '../../../view/BasicTable/BasicTable'
import { TitleBar } from '../../../view/title/TitleBar'
import { Bzhx, Logger } from '@ohos/common'
import {pmhxList} from './pmhxList'
@Entry
@Component
export struct Pmhx {
@State searchValue: string = ''
@State dataSource: Bzhx[] = []
controller: SearchController = new SearchController()
aboutToAppear(){
// this.getUnitList()
}
async getUnitList(pmdmsix?: string) {
const res = await bzhxModal.query(pmdmsix)
this.dataSource = res
Logger.info(this, "号型数据>>" + JSON.stringify(res));
}
build() {
Column() {
Flex({ direction: FlexDirection.Column }) {
......@@ -21,29 +33,27 @@ export struct Pmhx {
}
}
.width('100%').backgroundColor('#fff').height(52).borderRadius(5).padding({ left: 10, right: 10 })
}.padding({ top: 20, right: 20, left: 20 })
}
Row() {
Search({ value: this.searchValue, placeholder: '请输入六位品名代码', controller: this.controller })
Search({ placeholder: '请输入六位品名代码', controller: this.controller })
.height(40)
.backgroundColor('#F5F5F5')
.placeholderColor(Color.Grey)
.placeholderFont({ size: 14, weight: 400 })
.textFont({ size: 14, weight: 400 })
.onChange((value: string) => {
this.searchValue = value
})
.margin(20)
.onSubmit((value: string) => this.getUnitList(value))
.borderRadius(5)
.margin({top:15})
}
Column() {
BasicTable({ dataSource: [], emptyTitle: '暂无品名号型数据' })
}
pmhxList({dataSource: $dataSource})
}.flexGrow(1)
}
}.linearGradient({
direction: GradientDirection.RightBottom,
repeating: true,
colors: [['#36a3c0', 0.0], ['#97c6a6', 1.0], ['#c7d799', 2.0]]
})
}).padding({bottom:40,left:20,right:20})
}
}
\ No newline at end of file
import { Bzhx } from '@ohos/common'
@Component
export struct pmhxList {
@Link dataSource: Bzhx[]
@Styles commonPadding() {
.padding({top:4, bottom:4})
.alignSelf(ItemAlign.Start)
}
@Builder renderList() {
Column() {
List(){
ForEach(this.dataSource, (item, index) => {
ListItem(){
Row() {
Column() {
Row(){
Text("物资品名:").commonPadding()
Text(item.wzpm).commonPadding()
}.margin({left:20})
Row(){
Text("号型名称:").commonPadding()
Text(item.hxmc).commonPadding()
}
}.width('60%')
Column() {
Row(){
Text("型号:").commonPadding()
Text(item.xh + '').commonPadding()
}
Row(){
Text(item.pmdmSix).commonPadding()
}
}.width('30%')
}.commonPadding()
}
})
}.divider({strokeWidth:1,color:'505050'})
}.width('100%').height('100%').backgroundColor('#fff')
}
@Builder renderEmpty() {
Flex({justifyContent:FlexAlign.Center,alignItems:ItemAlign.Center}) {
Column() {
Image($r("app.media.empty")).width("42%")
Text("暂无数据").fontSize(22).fontColor("#fff").margin({top: 5})
}
}.height('70%')
}
build() {
if(this.dataSource.length == 0) {
this.renderEmpty()
} else {
this.renderList()
}
}
}
\ No newline at end of file
import { TitleBar } from '../../view/title/TitleBar'
import { Logger } from '@ohos/common'
import gldwModal from '../../../model/GldwModel'
import { TitleBar } from '../../../view/title/TitleBar'
import { Gldw } from '@ohos/common'
import {UnitList} from'./UnitList'
@Entry
@Component
export struct Unit {
@State searchValue: string = ''
@State dataSource: Gldw[] = []
controller: SearchController = new SearchController()
aboutToAppear(){
this.getUnitList()
}
async getUnitList(dwmc?: string) {
const res = await gldwModal.query(dwmc)
this.dataSource = res
Logger.info(this, "单位数据>>" + JSON.stringify(res));
}
build() {
Column() {
Flex({ direction: FlexDirection.Column }) {
TitleBar({ title: "单位查看" })
Row() {
Search({ value: this.searchValue, placeholder: '请输入管理单位名称', controller: this.controller })
Search({ placeholder: '请输入单位名称', controller: this.controller })
.height(40)
.backgroundColor('#F5F5F5')
.placeholderColor(Color.Grey)
.placeholderFont({ size: 14, weight: 400 })
.textFont({ size: 14, weight: 400 })
.onChange((value: string) => {
this.searchValue = value
})
.margin(20)
.onSubmit((value) => this.getUnitList(value))
.borderRadius(5)
}
}.width('100%')
Column() {
UnitList({ dataSource: $dataSource })
}.margin({top:20}).borderRadius(2)
}
}.linearGradient({
direction: GradientDirection.RightBottom,
repeating: true,
colors: [['#36a3c0', 0.0], ['#97c6a6', 1.0], ['#c7d799', 2.0]]
})
}).padding({bottom:40,left:20,right:20})
}
}
\ No newline at end of file
import { Gldw } from '@ohos/common'
@Component
export struct UnitList {
@Link dataSource: Gldw[]
@Styles commonPadding() {
.padding({top:4, bottom:4})
.alignSelf(ItemAlign.Start)
}
@Builder renderList() {
Column() {
Scroll() {
List(){
ForEach(this.dataSource, (item, index) => {
ListItem(){
Row() {
Column() {
Row(){
Text("单位代码:").commonPadding()
Text(item.dwdm).commonPadding()
}.margin({left:10})
}.width('45%')
Column() {
Row(){
Text("单位名称:").commonPadding()
Text(item.dwfh).commonPadding()
}
}.width('45%')
}.commonPadding()
}
})
}.divider({strokeWidth:1,color:'505050'})
}.onScrollEdge(() => {
console.log("hhhhhhhhhhhhhhhhhhhhh")
})
}.width('100%').height('100%').backgroundColor('#fff')
}
@Builder renderEmpty() {
Flex({justifyContent:FlexAlign.Center,alignItems:ItemAlign.Center}) {
Column() {
Image($r("app.media.empty")).width("42%")
Text("暂无数据").fontSize(22).fontColor("#fff").margin({top: 5})
}
}.height('70%')
}
build() {
if(this.dataSource.length == 0) {
this.renderEmpty()
} else {
this.renderList()
}
}
}
\ No newline at end of file
import { KfInfo } from '@ohos/common/src/main/ets/entity/KfInfo'
@Entry
@Component
export struct Demo {
data: KfInfo[]
arr = [1,2,3,4,5]
export struct HouseList {
@Link dataSource: KfInfo[]
@Styles commonPadding() {
.padding({top:4, bottom:4})
.alignSelf(ItemAlign.Start)
}
build() {
@Builder renderList() {
Column() {
List(){
ForEach(this.dataSource, (item, index) => {
ListItem(){
Row() {
Column() {
Row(){
Text("库房代码:").commonPadding()
Text(item.kfdm).commonPadding()
}.margin({left:20})
Row(){
Text("库房名称:").commonPadding()
Text(item.kfmc).commonPadding()
}
}.width('40%')
Column() {
Row(){
Text("库房类型:").commonPadding()
Text(item.kflx).commonPadding()
}
Row(){
Text("优先级:").commonPadding()
Text(item.yxj + '').commonPadding()
}
}.width('40%')
Row() {
Radio({ value: 'Radio1', group: 'radioGroup' })
.height(18)
.width(18)
.onChange((isChecked: boolean) => {
console.log('Radio1 status is ' + isChecked)
})
}.width('10%')
}.commonPadding()
}
})
}.divider({strokeWidth:1,color:'505050'})
}.width('100%').height('100%').backgroundColor('#fff')
}
@Builder renderEmpty() {
Flex({justifyContent:FlexAlign.Center,alignItems:ItemAlign.Center}) {
Column() {
List(){
ForEach(this.arr, (item, index) => {
ListItem(){
Row() {
Column() {
Row(){
Text("库房代码:").commonPadding()
Text("2").commonPadding()
}
Row(){
Text("库房名称:").commonPadding()
Text("2").commonPadding()
}
}.width('40%')
Column() {
Row(){
Text("库房类型:").commonPadding()
Text("2").commonPadding()
}
Row(){
Text("优先级:").commonPadding()
Text("2").commonPadding()
}
}.width('40%')
Row() {
Radio({ value: 'Radio1', group: 'radioGroup' })
.height(18)
.width(18)
.onChange((isChecked: boolean) => {
console.log('Radio1 status is ' + isChecked)
})
}.width('10%')
}.commonPadding()
}
})
}.divider({strokeWidth:1,color:$r("app.color.home_grid_fontColor")})
}.width('100%').height('100%')
Image($r("app.media.empty")).width("42%")
Text("暂无数据").fontSize(22).fontColor("#fff").margin({top: 5})
}
}.height('70%')
}
build() {
if(this.dataSource.length == 0) {
this.renderEmpty()
} else {
this.renderList()
}
}
......
import { BasicTable } from '../../../view/BasicTable/BasicTable'
import { HouseList } from './HouseList'
import { TitleBar } from '../../../view/title/TitleBar'
import kfModel from '../../../model/KfModel'
import { Logger } from '@ohos/common'
import { KfInfo } from '@ohos/common'
@Entry
@Component
export struct Warehouse {
@State searchValue: string = ''
controller: SearchController = new SearchController()
@State dataSource: KfInfo[] = []
aboutToAppear(){
this.getWarehouseList()
}
// 获取库房数据
async getWarehouseList() {
const res = await kfModel.query()
async getWarehouseList(kfmc?: string ) {
const res = await kfModel.query(kfmc)
this.dataSource = res
Logger.info(this, "库房数据>" + JSON.stringify(res));
}
......@@ -30,21 +32,18 @@ export struct Warehouse {
.placeholderColor(Color.Grey)
.placeholderFont({ size: 14, weight: 400 })
.textFont({ size: 14, weight: 400 })
.onChange((value: string) => {
this.searchValue = value
})
.margin(20)
.onSubmit((value) => this.getWarehouseList(value))
.borderRadius(5)
}
}.width('100%')
Column() {
BasicTable({ dataSource: [], emptyTitle: '暂无库房数据' })
}
HouseList({ dataSource: $dataSource })
}.margin({top:20}).borderRadius(2)
}
}.linearGradient({
direction: GradientDirection.RightBottom,
repeating: true,
colors: [['#36a3c0', 0.0], ['#97c6a6', 1.0], ['#c7d799', 2.0]]
})
}).padding({bottom:40,left:20,right:20})
}
}
\ No newline at end of file
......@@ -14,10 +14,10 @@
"pages/metailmange/AddConversionPage",
"pages/metailmange/AddTemporaryInPage",
"pages/metailmange/AddTemporaryOutPage",
"pages/sub_systemMaintenance/Unit",
"pages/sub_systemMaintenance/Unit/Unit",
"pages/sub_systemMaintenance/Warehouse/Warehouse",
"pages/sub_systemMaintenance/GoodsShelf",
"pages/sub_systemMaintenance/Pmhx",
"pages/sub_systemMaintenance/GoodsShelf/GoodsShelf",
"pages/sub_systemMaintenance/Pmhx/Pmhx",
"pages/sub_systemMaintenance/Setting",
"pages/sub_systemMaintenance/General",
"pages/sub_systemMaintenance/Maintenance",
......
......@@ -21,7 +21,7 @@ export const uniInitList: UniListItem[] = [
showExtraIcon: true,
showArrow: true,
//extraIcon: '',
url: 'pages/sub_systemMaintenance/Unit'
url: 'pages/sub_systemMaintenance/Unit/Unit'
},
{
title: '库房查看',
......@@ -35,14 +35,14 @@ export const uniInitList: UniListItem[] = [
showExtraIcon: true,
showArrow: true,
//extraIcon: '',
url: 'pages/sub_systemMaintenance/GoodsShelf'
url: 'pages/sub_systemMaintenance/GoodsShelf/GoodsShelf'
},
{
title: '品名号型查看',
showExtraIcon: true,
showArrow: true,
//extraIcon: '',
url: 'pages/sub_systemMaintenance/Pmhx'
url: 'pages/sub_systemMaintenance/Pmhx/Pmhx'
},
{
title: '系统设置',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论