Commit 611238fa by 陈桂东

提交代码

parent e7a58017
export interface newBgglDto {
guid: string;
ddh: string;
xs: number;
pc: number;
fwdw: string;
kfdm: string;
bgzt: string;
slr: string;
sldwdm: string;
sjh: number;
jssj: string;
cksj: string;
sfdc: string;
sfdf: string;
hwh: string;
qjm: string;
dfje: number;
kfmc: string;
}
\ No newline at end of file
import relationalStore from '@ohos.data.relationalStore'; import relationalStore from '@ohos.data.relationalStore';
import { newBgglDto } from '../../bean/dto/BgglDto';
import { Bggl } from '../../entity/Bggl'; import { Bggl } from '../../entity/Bggl';
import { Logger } from '../../utils/Logger';
import BaseTable, { ValueType } from '../BaseTable'; import BaseTable, { ValueType } from '../BaseTable';
import { Table } from '../decorator/Decorators'; import { Table } from '../decorator/Decorators';
import { NativeSql } from '../sql/NativeSql'; import { NativeSql } from '../sql/NativeSql';
...@@ -62,4 +64,52 @@ export class BgglDao extends BaseTable<Bggl> { ...@@ -62,4 +64,52 @@ export class BgglDao extends BaseTable<Bggl> {
} }
return this.query(wp, this.getTableColumns()); return this.query(wp, this.getTableColumns());
} }
/**
* 获取最新上架信息
*/
async getNewData(params: Partial<Bggl>): Promise<newBgglDto[]> {
try {
let val_sql = NativeSql.getNewBgglSql(params);
Logger.info('最新上架>>sql', val_sql)
let db = await this.futureDb;
let rs = await db.querySql(val_sql);
let items = []
if (rs.goToFirstRow()) {
do {
items.push(this.toWzcrkRefWz(rs))
} while (rs.goToNextRow())
}
Logger.info(this, '最新上架>>' + JSON.stringify(items))
return items;
} catch (e) {
throw new Error('[查询异常]|' + e)
}
}
toWzcrkRefWz(cursor: relationalStore.ResultSet): newBgglDto {
let info: newBgglDto = {
guid: cursor.getString(cursor.getColumnIndex('guid')),
ddh: cursor.getString(cursor.getColumnIndex('ddh')),
xs: cursor.getLong(cursor.getColumnIndex('xs')),
pc: cursor.getLong(cursor.getColumnIndex('pc')),
fwdw: cursor.getString(cursor.getColumnIndex('fwdw')),
bgzt: cursor.getString(cursor.getColumnIndex('bgzt')),
slr: cursor.getString(cursor.getColumnIndex('slr')),
sldwdm: cursor.getString(cursor.getColumnIndex('sldwdm')),
sjh: cursor.getLong(cursor.getColumnIndex('sjh')),
jssj: cursor.getString(cursor.getColumnIndex('jssj')),
cksj: cursor.getString(cursor.getColumnIndex('cksj')),
sfdc: cursor.getString(cursor.getColumnIndex('sfdc')),
sfdf: cursor.getString(cursor.getColumnIndex('sfdf')),
kfdm: cursor.getString(cursor.getColumnIndex('kfdm')),
kfmc: cursor.getString(cursor.getColumnIndex('kfmc')),
qjm: cursor.getString(cursor.getColumnIndex('qjm')),
dfje: cursor.getLong(cursor.getColumnIndex('dfje')),
hwh: cursor.getString(cursor.getColumnIndex('hwh')),
};
return info;
}
} }
\ No newline at end of file
import { uuid } from '../../utils/util'; import { uuid } from '../../utils/util';
export class NativeSql { export class NativeSql {
/** /**
* 构建出入库明细查询语句 * 构建出入库明细查询语句
...@@ -569,9 +570,9 @@ WHERE ...@@ -569,9 +570,9 @@ WHERE
return sql1 return sql1
} }
/** /**
**临时区物资查询 **临时区物资查询
*/ */
static getLsqPageSql(params?: any):string{ static getLsqPageSql(params?: any): string {
const sql1 = const sql1 =
`SELECT * FROM (SELECT pmdmsix ,wzpm ,sum(case when lx ='LS' then hwsl else 0 end) SY ,sum(case when lx ='LW' then hwsl else 0 end) YL,sum(hwsl) ZS from (SELECT hx.pmdmsix, hx.wzpm,sum(hw.hwsl) hwsl,(case when hwh ='LS-1-1-1' then 'LS' else 'LW' end ) LX FROM tab_bzgl_knzy_app_hwb hw INNER JOIN TAB_BZGL_KNZY_APP_HJB hj ON hj.guid = hw.hjguid INNER JOIN TAB_BZGL_KNZY_APP_QYB qy ON qy.guid = hj.qyguid LEFT JOIN tab_xtwh_jcsj_bzhx hx ON hw.pmdmcode = hx.pmdmten WHERE hw.pmdmcode IS NOT NULL AND hw.hwsl IS NOT NULL AND hw.gldwguid = ${params.gldwguid} AND hw.kfguid = ${params.kfguid} AND hw.zmlx = ${params.zmlx}` `SELECT * FROM (SELECT pmdmsix ,wzpm ,sum(case when lx ='LS' then hwsl else 0 end) SY ,sum(case when lx ='LW' then hwsl else 0 end) YL,sum(hwsl) ZS from (SELECT hx.pmdmsix, hx.wzpm,sum(hw.hwsl) hwsl,(case when hwh ='LS-1-1-1' then 'LS' else 'LW' end ) LX FROM tab_bzgl_knzy_app_hwb hw INNER JOIN TAB_BZGL_KNZY_APP_HJB hj ON hj.guid = hw.hjguid INNER JOIN TAB_BZGL_KNZY_APP_QYB qy ON qy.guid = hj.qyguid LEFT JOIN tab_xtwh_jcsj_bzhx hx ON hw.pmdmcode = hx.pmdmten WHERE hw.pmdmcode IS NOT NULL AND hw.hwsl IS NOT NULL AND hw.gldwguid = ${params.gldwguid} AND hw.kfguid = ${params.kfguid} AND hw.zmlx = ${params.zmlx}`
const sql2 = ` AND (hx.wzpm like ${params.wzpm})` const sql2 = ` AND (hx.wzpm like ${params.wzpm})`
...@@ -583,23 +584,24 @@ WHERE ...@@ -583,23 +584,24 @@ WHERE
return sql1 + sql3 return sql1 + sql3
} }
} }
static getHXpageSql(params?: any):string{
const sql=`select hw.pmdmcode, hx.hxmc, sum (case when hw.hwh='LS-1-1-1' then ifnull (hw.hwsl,0) +0 else 0 end) SY,sum (case when hw.hwh != 'LS-1-1-1' then ifnull (hw.hwsl, 0) +0 else 0 end) YL from tab_bzgl_knzy_app_hwb hw inner join TAB_BZGL_KNZY_APP_HJB hj on hj.guid = hw.hjguid inner join TAB_BZGL_KNZY_APP_QYB gy on gy.guid = hj.qyguid left join TAB_XTWH_JCSJ_BZHX hx on hw.pmdmcode = hx.pmdmten where substr (hw.pmdmcode, 1, 6) = ${params.pmdmcode} and hw.kfguid = ${params.kfguid} and hw.gldwguid= ${params.gldwguid} and zmlx = ${params.zmlx} group by hw.pmdmcode, hx.hxmc` static getHXpageSql(params?: any): string {
return sql const sql = `select hw.pmdmcode, hx.hxmc, sum (case when hw.hwh='LS-1-1-1' then ifnull (hw.hwsl,0) +0 else 0 end) SY,sum (case when hw.hwh != 'LS-1-1-1' then ifnull (hw.hwsl, 0) +0 else 0 end) YL from tab_bzgl_knzy_app_hwb hw inner join TAB_BZGL_KNZY_APP_HJB hj on hj.guid = hw.hjguid inner join TAB_BZGL_KNZY_APP_QYB gy on gy.guid = hj.qyguid left join TAB_XTWH_JCSJ_BZHX hx on hw.pmdmcode = hx.pmdmten where substr (hw.pmdmcode, 1, 6) = ${params.pmdmcode} and hw.kfguid = ${params.kfguid} and hw.gldwguid= ${params.gldwguid} and zmlx = ${params.zmlx} group by hw.pmdmcode, hx.hxmc`
return sql
} }
/*验证扫描:验证扫描完的数据有没有*/ /*验证扫描:验证扫描完的数据有没有*/
static testInsertSql(params?: any):string{ static testInsertSql(params?: any): string {
const sql= `select * from (select hw.*,qy.kfdm kfdm from tab_bzgl_knzy_app_hwb hw left join tab_bzgl_knzy_app_hjb hj on hj.guid = hw.hjguid left join tab_bzgl_knzy_app_qyb qy on qy.guid = hj.qyguid ) where kfguid = '${params.kfguid}' and hwh = ${params.hwh} and (pmdmcode = ${(params.pmdmcode)} or pmdmcode ='' or pmdmcode is null )` const sql = `select * from (select hw.*,qy.kfdm kfdm from tab_bzgl_knzy_app_hwb hw left join tab_bzgl_knzy_app_hjb hj on hj.guid = hw.hjguid left join tab_bzgl_knzy_app_qyb qy on qy.guid = hj.qyguid ) where kfguid = '${params.kfguid}' and hwh = ${params.hwh} and (pmdmcode = ${(params.pmdmcode)} or pmdmcode ='' or pmdmcode is null )`
return sql return sql
} }
/*验证扫描完更新*/ /*验证扫描完更新*/
static updateWzcshSql(params?: any):string{ static updateWzcshSql(params?: any): string {
const sql=`update tab_bzgl_knzy_app_hwb set hwsl = ifnull(hwsl,0) + ${params.srsl}, pmdmcode = ${params.pmdmcode} where guid = ${params.guid}` const sql = `update tab_bzgl_knzy_app_hwb set hwsl = ifnull(hwsl,0) + ${params.srsl}, pmdmcode = ${params.pmdmcode} where guid = ${params.guid}`
return sql return sql
} }
/*验证扫描完新增*/ /*验证扫描完新增*/
static insertWzcshSql(params?: any):string{ static insertWzcshSql(params?: any): string {
const sql=`insert into tab_bzgl_knzy_app_hwb (guid, hwh, pmdmcode, hwsl, hjguid,hwzt,gldwguid,kfguid,zmlx) values ('${params.guid}','${params.hwh}',${params.pmdmcode},${params.srsl},'${params.hjguid}','11111111SF1','${params.gldwguid}','${params.kfguid}',${params.zmlx})` const sql = `insert into tab_bzgl_knzy_app_hwb (guid, hwh, pmdmcode, hwsl, hjguid,hwzt,gldwguid,kfguid,zmlx) values ('${params.guid}','${params.hwh}',${params.pmdmcode},${params.srsl},'${params.hjguid}','11111111SF1','${params.gldwguid}','${params.kfguid}',${params.zmlx})`
return sql return sql
} }
/*物资落位导出*/ /*物资落位导出*/
...@@ -607,4 +609,19 @@ WHERE ...@@ -607,4 +609,19 @@ WHERE
const sql=`select hw.* from tab_bzgl_knzy_app_hwb hw inner join TAB_BZGL_KNZY_APP_HJB hj on hj.guid =hw.hjguid inner join TAB_BZGL_KNZY_APP_QYB qy on qy.guid = hj.qyguid where hw.pmdmcode is not null and hw.pmdmcode !='' and hw.hwh not like 'LS%' and hw.kfguid = '${params.kfguid}' and hw.gldwguid = '${params.gldwguid}' and hw.zmlx = ${params.zmlx}` const sql=`select hw.* from tab_bzgl_knzy_app_hwb hw inner join TAB_BZGL_KNZY_APP_HJB hj on hj.guid =hw.hjguid inner join TAB_BZGL_KNZY_APP_QYB qy on qy.guid = hj.qyguid where hw.pmdmcode is not null and hw.pmdmcode !='' and hw.hwh not like 'LS%' and hw.kfguid = '${params.kfguid}' and hw.gldwguid = '${params.gldwguid}' and hw.zmlx = ${params.zmlx}`
return sql return sql
} }
}
\ No newline at end of file /**
* 获取最新上架信息
*/
static getNewBgglSql(params: Partial<Bggl>): string {
var sql = `select bg.*,kf.kfmc from TAB_BZGL_KNZY_APP_BGGL bg left join TAB_BZGL_KNZY_APP_DWKF kf on kf.kfdm = bg.kfdm where bg.BGZT = '${params.bgzt}' `
var sqlHz = ' order by bg.JSSJ desc'
if (params.ddh) {
return `${sql} and (bg.DDH like ${params.ddh} ${sqlHz}`;
} else {
return sql + sqlHz
}
}
}
import { BgglDao, SQLiteContext, Bggl } from '@ohos/common' import { Bggl, BgglDao, SQLiteContext } from '@ohos/common'
import { newBgglDto } from '@ohos/common/src/main/ets/bean/dto/BgglDto';
import { uuid } from '@ohos/common/src/main/ets/utils/util' import { uuid } from '@ohos/common/src/main/ets/utils/util'
// 包裹管理 // 包裹管理
...@@ -34,7 +35,7 @@ class BgglModel { ...@@ -34,7 +35,7 @@ class BgglModel {
ddh: item.ddh || '', ddh: item.ddh || '',
xs: item.xs || 1, xs: item.xs || 1,
fwdw: item.fwdw || '', fwdw: item.fwdw || '',
bgzt: '待入库', bgzt: '未领取',
// @ts-ignore // @ts-ignore
slr: item.ryxm || '', slr: item.ryxm || '',
sjh: item.sjh || '', sjh: item.sjh || '',
...@@ -46,16 +47,22 @@ class BgglModel { ...@@ -46,16 +47,22 @@ class BgglModel {
sfdf: item.sfdf, sfdf: item.sfdf,
dfje: 0 dfje: 0
} }
}) }) as Bggl[]
await SQLiteContext.with(BgglDao).batchInsert(data) await SQLiteContext.with(BgglDao).batchInsert(copyData)
} }
// 查询包裹 // 查询包裹
async query(data: Partial<Bggl>):Promise<Bggl[]> { async query(data: Partial<Bggl>): Promise<Bggl[]> {
let res = await SQLiteContext.with(BgglDao).getDdh(data); let res = await SQLiteContext.with(BgglDao).getDdh(data);
return res; return res;
} }
// 查询最新上架信息
async queryNewDara(data: Partial<Bggl>): Promise<newBgglDto[]> {
let res = await SQLiteContext.with(BgglDao).getNewData(data);
return res;
}
// 清空表 // 清空表
async clear() { async clear() {
await SQLiteContext.with(BgglDao).clearTable() await SQLiteContext.with(BgglDao).clearTable()
......
...@@ -3,7 +3,7 @@ import { PageConstants } from '../constants/PageConstants'; ...@@ -3,7 +3,7 @@ import { PageConstants } from '../constants/PageConstants';
import { buttonInfo, ButtonInfoModel } from '../viewmodel/MainPageData'; import { buttonInfo, ButtonInfoModel } from '../viewmodel/MainPageData';
import { DirectConnect } from '@ohos/direct'; import { DirectConnect } from '@ohos/direct';
import { MaterialManagement } from '@ohos/material'; import { MaterialManagement } from '@ohos/material';
import { PageManagement } from '@ohos/pagemanagement'; import { PageManagement } from './PageManagement/PageManagement';
import { SystemMaintenance } from '@ohos/system'; import { SystemMaintenance } from '@ohos/system';
import { BreakpointConstants, BreakpointSystem, Logger, StyleConstants } from '@ohos/common'; import { BreakpointConstants, BreakpointSystem, Logger, StyleConstants } from '@ohos/common';
......
@Entry
@Component
export struct PageManagement {
build() {
Column() {
Row() {
Text('订单').width('30%').padding({ top: 8, bottom: 8 })
Text('姓名').width('30%').padding({ top: 8, bottom: 8 })
Text('手机号').width('30%').padding({ top: 8, bottom: 8 })
}.margin({ left: 30 })
List() {
ForEach([1, 2, 3], item => {
ListItem() {
Row() {
Text('111111111').width('30%')
Text('111111111').width('30%')
Text('111111111').width('30%')
}.margin({ left: 30 })
}
})
}
}
}
}
\ No newline at end of file
import router from '@ohos.router' import router from '@ohos.router'
import { BgglDao, Logger, SQLiteContext, StatusBarManager } from '@ohos/common'; import { BgglDao, Logger, SQLiteContext, StatusBarManager } from '@ohos/common';
import bgglModel from '../../model/BgglModel';
@Extend(Text) function numberStyle() { @Extend(Text) function numberStyle() {
.fontSize(20) .fontSize(20)
...@@ -24,6 +25,7 @@ export struct PageManagement { ...@@ -24,6 +25,7 @@ export struct PageManagement {
this.getDsj() this.getDsj()
this.getYlq() this.getYlq()
this.getWlq() this.getWlq()
this.getPackList()
} }
} }
...@@ -41,8 +43,10 @@ export struct PageManagement { ...@@ -41,8 +43,10 @@ export struct PageManagement {
}.width('100%') }.width('100%')
} }
// 获取包裹列表 // 最新上架数据
async getPackList(ddh?: string) { async getPackList(ddh?: string) {
const res = await bgglModel.queryNewDara({ bgzt: "未领取" })
Logger.info('最新上架数据>>', JSON.stringify(res))
} }
async getTotal() { async getTotal() {
...@@ -53,21 +57,21 @@ export struct PageManagement { ...@@ -53,21 +57,21 @@ export struct PageManagement {
async getDsj() { async getDsj() {
let wp = SQLiteContext.with(BgglDao).getPredicates() let wp = SQLiteContext.with(BgglDao).getPredicates()
wp.equalTo('WCZT', '待上架') wp.equalTo('BGZT', '待上架')
const res = await SQLiteContext.with(BgglDao).query(wp) const res = await SQLiteContext.with(BgglDao).query(wp)
this.dsj = res.length this.dsj = res.length
} }
async getWlq() { async getWlq() {
let wp = SQLiteContext.with(BgglDao).getPredicates() let wp = SQLiteContext.with(BgglDao).getPredicates()
wp.equalTo('WCZT', '未领取') wp.equalTo('BGZT', '未领取')
const res = await SQLiteContext.with(BgglDao).query(wp) const res = await SQLiteContext.with(BgglDao).query(wp)
this.wlq = res.length this.wlq = res.length
} }
async getYlq() { async getYlq() {
let wp = SQLiteContext.with(BgglDao).getPredicates() let wp = SQLiteContext.with(BgglDao).getPredicates()
wp.equalTo('WCZT', '已领取') wp.equalTo('BGZT', '已领取')
const res = await SQLiteContext.with(BgglDao).query(wp) const res = await SQLiteContext.with(BgglDao).query(wp)
this.ylq = res.length this.ylq = res.length
} }
......
export { PageManagement } from './src/main/ets/pages/PageManagement' export { PageManagement } from '../../entry/src/main/ets/pages/PageManagement/PageManagement'
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论