Commit 2bf6e7cf by 毛勇泽

包裹扫描

parent 1d92a8e7
...@@ -162,6 +162,51 @@ export class HwInfoDao extends BaseTable<HwInfo> { ...@@ -162,6 +162,51 @@ export class HwInfoDao extends BaseTable<HwInfo> {
console.log("查询报错==》"+JSON.stringify(err)) console.log("查询报错==》"+JSON.stringify(err))
} }
} }
/*删除sql*/
async deleHwRecordSql(guid?: string) {
try {
let val_sql = NativeSql.deleHwRecordSql(guid)
Logger.info('删除>>sql', val_sql)
let db = await this.futureDb;
let rs = await db.executeSql(val_sql);
return rs;
} catch (e) {
throw new Error('[插入异常]|' + e)
}
}
/*加临时区物资*/
async addLsqWzSql(params?:any) {
try {
let val_sql = NativeSql.addLsqWzSql(params)
Logger.info('加临时区物资>>sql', val_sql)
let db = await this.futureDb;
let rs = await db.executeSql(val_sql);
return rs;
} catch (e) {
throw new Error('[插入异常]|' + e)
}
}
/*判断临时区有没有这个品种*/
async testLsqWzSql(params?:any): Promise<WzPositionInfo[]> {
try {
Logger.info(this,"查询参数",JSON.stringify(params))
let val_sql = NativeSql.testLsqWzSql(params) ;
console.log('查询SQL语句=' + val_sql)
let db = await this.futureDb;
let rs = await db.querySql(val_sql);
console.log('查询SQL语句开始2')
let items = []
if (rs.goToFirstRow()) {
do {
items.push(this.toWzHXPositionInfo(rs))
} while (rs.goToNextRow())
}
console.log('查询SQL结果=' + JSON.stringify(items))
return items;
}catch (err){
console.log("查询报错==》"+JSON.stringify(err))
}
}
/** /**
* 转换 * 转换
*/ */
......
...@@ -721,6 +721,23 @@ WHERE ...@@ -721,6 +721,23 @@ WHERE
`update TAB_BZGL_KNZY_APP_BGGL set BGZT = '待上架', JSSJ =' ${time}' , XS = ${params.xs}, PC = ${params.pc} where ddh in ('${params.ddh}')` `update TAB_BZGL_KNZY_APP_BGGL set BGZT = '待上架', JSSJ =' ${time}' , XS = ${params.xs}, PC = ${params.pc} where ddh in ('${params.ddh}')`
return sql return sql
} }
// 删除sql
static deleHwRecordSql(guid?:string):string {
const sql = `delete from tab_bzgl_knzy_app_hwb where guid = '${guid}'`
return sql
}
// 判断临时区有没有这个品种
static testLsqWzSql(params?:any):string{
const sql =
`select * from tab_bzgl_knzy_app_hwb where pmdmcode = ${params.pmdmcode} and gldwguid = '${params.gldwguid}' and kfguid = '${params.kfguid}' and zmlx = '${params.zmlx}' and hwh = 'LS-1-1-1'`
return sql
}
// 加临时区物资
static addLsqWzSql(params?:any):string {
const sql =
`update tab_bzgl_knzy_app_hwb set hwsl = hwsl + ${params.hwsl} where pmdmcode = ${params.pmdmcode} and gldwguid = '${params.gldwguid}' and kfguid = '${params.kfguid}' and zmlx = '${params.zmlx}' and hwh = 'LS-1-1-1'`
return sql
}
} }
...@@ -48,6 +48,21 @@ class HwModel { ...@@ -48,6 +48,21 @@ class HwModel {
let res = await SQLiteContext.with(HwInfoDao).getHXpageSql(searchData) let res = await SQLiteContext.with(HwInfoDao).getHXpageSql(searchData)
return res; return res;
} }
// 删除sql
async deleHwRecordSql(guid?: string) {
let res = await SQLiteContext.with(HwInfoDao).deleHwRecordSql(guid)
return res;
}
// 判断临时区有没有这个品种
async testLsqWzSql(params?: any) : Promise<WzPositionInfo[]>{
let res = await SQLiteContext.with(HwInfoDao).testLsqWzSql(params)
return res;
}
// 加临时区物资
async addLsqWzSql(params?: any) {
let res = await SQLiteContext.with(HwInfoDao).addLsqWzSql(params)
return res;
}
// 清空表 // 清空表
async clear() { async clear() {
await SQLiteContext.with(HwInfoDao).clearTable() await SQLiteContext.with(HwInfoDao).clearTable()
......
...@@ -3,6 +3,7 @@ import { WzPositionClass} from '@ohos/common'; ...@@ -3,6 +3,7 @@ import { WzPositionClass} from '@ohos/common';
@Component @Component
export struct WzPositionList { export struct WzPositionList {
@ObjectLink wzposition: WzPositionClass @ObjectLink wzposition: WzPositionClass
handleDelete:(wzposition: WzPositionClass)=>void
build() { build() {
Column() { Column() {
Flex({ justifyContent: FlexAlign.SpaceBetween}) { Flex({ justifyContent: FlexAlign.SpaceBetween}) {
...@@ -30,7 +31,9 @@ export struct WzPositionList { ...@@ -30,7 +31,9 @@ export struct WzPositionList {
Text(String(this.wzposition.hwsl)).fontSize(19).fontColor($r("app.color.title_background")) Text(String(this.wzposition.hwsl)).fontSize(19).fontColor($r("app.color.title_background"))
}.alignSelf(ItemAlign.End).padding({ top: 5, bottom: 5 }) }.alignSelf(ItemAlign.End).padding({ top: 5, bottom: 5 })
Row() { Row() {
Image($r('app.media.trash')).width(35) Image($r('app.media.trash')).width(35).onClick(()=>{
this.handleDelete(this.wzposition)
})
}.alignSelf(ItemAlign.End) }.alignSelf(ItemAlign.End)
}.width("50%").margin({ right: 10 }) }.width("50%").margin({ right: 10 })
}.width("100%").margin({ top: 10 }).border({ width: { bottom: '1lpx' }, color: "#717171" }) }.width("100%").margin({ top: 10 }).border({ width: { bottom: '1lpx' }, color: "#717171" })
......
...@@ -121,6 +121,87 @@ struct WzPositionPage { ...@@ -121,6 +121,87 @@ struct WzPositionPage {
onExportSubmit() { onExportSubmit() {
Logger.info(this,"导出数据"+JSON.stringify(this.exportData)) Logger.info(this,"导出数据"+JSON.stringify(this.exportData))
} }
/***
* @description: 合并导出
*/
async handleMergeExport() {
try {
const params = {
pzzbJson: this.exportData,
// crklx: '11111CRKLX2',
bestrow: false,
gznd: '2023',
// kfdm: this.option.kfdmOption[this.currentActive].value,
gldwguid: this.searchData.gldwguid,
kfguid: this.searchData.kfguid,
zmlx: this.searchData.zmlx,
dwguid: this.searchData.gldwguid
// jsdwguid: this.currentDwData[0].DWDM
}
console.log('params', params)
// const res = await transferApi.intiRepertoryUp(params)
// this.handleInform(this.currentPath, 'network')
} catch (e) {
Prompt.showToast({
message:'合并导出失败'
})
}
}
/***
* @description: 覆盖导出
*/
async handleOverlayDerivation() {
try {
const params = {
pzzbJson: this.exportData,
// crklx: '11111CRKLX2',
bestrow: false,
gznd: '2023',
// kfdm: this.option.kfdmOption[this.currentActive].value,
gldwguid: this.searchData.gldwguid,
kfguid: this.searchData.kfguid,
zmlx: this.searchData.zmlx,
dwguid: this.searchData.gldwguid
// jsdwguid: this.currentDwData[0].DWDM
}
console.log('params', params)
// const res = await transferApi.intiRepertoryUp(params)
// this.handleInform(this.currentPath, 'network')
} catch (e) {
Prompt.showToast({
message:'覆盖导出失败'
})
}
}
/***
* @description: 号型删除
*/
async handleDelete(row) {
try {
const params = {
...this.searchData,
pmdmcode:row.pmdmcode,
hwsl:row.hwsl
}
console.log('params', params)
await hwModel.deleHwRecordSql(row.guid)
const res = await hwModel.testLsqWzSql(params)
if (res && res.length > 0) {
await hwModel.addLsqWzSql(params)
}
Prompt.showToast({
message:'删除成功'
})
setTimeout(async () => {
await this.getPositionPage()
}, 800);
} catch (e) {
//TODO handle the exception
Prompt.showToast({
message:'删除失败'
})
}
}
@Builder renderEmpty() { @Builder renderEmpty() {
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
...@@ -250,7 +331,7 @@ struct WzPositionPage { ...@@ -250,7 +331,7 @@ struct WzPositionPage {
List({ space: 2 }) { List({ space: 2 }) {
ForEach(this.dataSource, (item) => { ForEach(this.dataSource, (item) => {
ListItem() { ListItem() {
WzPositionList({ wzposition: item }).width('100%').backgroundColor('#fff') WzPositionList({ wzposition: item,handleDelete:this.handleDelete}).width('100%').backgroundColor('#fff')
} }
}) })
}.padding(18) }.padding(18)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论