Commit 6d27777a by 毛勇泽

射频扫码

parent 25f48c26
...@@ -67,4 +67,12 @@ export class BzhxDao extends BaseTable<Bzhx> { ...@@ -67,4 +67,12 @@ export class BzhxDao extends BaseTable<Bzhx> {
wp.orderByAsc('GUID').offsetAs(offset).limitAs(20); wp.orderByAsc('GUID').offsetAs(offset).limitAs(20);
return this.query(wp, this.getTableColumns()) return this.query(wp, this.getTableColumns())
} }
async selectWZInfo(lsm?:string):Promise<Bzhx[]>{
let wp = this.getPredicates();
if (lsm) {
wp.equalTo('LSM', lsm);
}
wp.orderByAsc('LSM');
return this.query(wp, this.getTableColumns())
}
} }
\ No newline at end of file
...@@ -53,4 +53,30 @@ export class DsRfidDao extends BaseTable<DsRfid> { ...@@ -53,4 +53,30 @@ export class DsRfidDao extends BaseTable<DsRfid> {
)`; )`;
return count_sql; return count_sql;
} }
/*查询上架---sjType:0(待上架),1(已上架)*/
async getselectSJList(wzcrkguid: string,sjType:number): Promise<DsRfid[]> {
let wp = this.getPredicates();
if (wzcrkguid) {
wp.equalTo('WZCRKGUID', wzcrkguid);
}
if(sjType==0){
wp.equalTo("HWH","暂无")
}else {
wp.notEqualTo("HWH","暂无")
}
wp.orderByAsc('HWH');
return this.query(wp, this.getTableColumns())
}
/**
* 更新上架状态
*/
async updateSJStatus(guid: string, hwh?: string): Promise<number> {
const valueBucket = {
"HWH": hwh
};
let wp = this.getPredicates()
wp.equalTo('guid', guid)
return this.updateData(valueBucket, wp)
}
} }
\ No newline at end of file
...@@ -60,5 +60,12 @@ export class HwInfoDao extends BaseTable<HwInfo> { ...@@ -60,5 +60,12 @@ export class HwInfoDao extends BaseTable<HwInfo> {
wp.orderByAsc('HWH'); wp.orderByAsc('HWH');
return this.query(wp, this.getTableColumns()) return this.query(wp, this.getTableColumns())
} }
async getselectHwList(kfguid: string): Promise<HwInfo[]> {
let wp = this.getPredicates();
if (kfguid) {
wp.equalTo('KFGUID', kfguid);
}
wp.orderByAsc('HWH');
return this.query(wp, this.getTableColumns())
}
} }
\ No newline at end of file
...@@ -62,7 +62,7 @@ export class WzhxdmDao extends BaseTable<Wzhxdm> { ...@@ -62,7 +62,7 @@ export class WzhxdmDao extends BaseTable<Wzhxdm> {
async selectHXList(sql?: string): Promise<Wzhxdm[]> { async selectHXList(sql?: string): Promise<Wzhxdm[]> {
let db = await this.futureDb; let db = await this.futureDb;
let rs = await db.querySql('', []); let rs = await db.querySql(sql, this.getTableColumns());
let items: Wzhxdm[]; let items: Wzhxdm[];
if (rs.goToFirstRow()) { if (rs.goToFirstRow()) {
do { do {
......
...@@ -238,7 +238,7 @@ async function analysisQrCode(bqData:string, isData:boolean = false) { ...@@ -238,7 +238,7 @@ async function analysisQrCode(bqData:string, isData:boolean = false) {
// "' or lsm = '" + hx_map["wzdm"] + "') " + " and ( pmdmten in (" + hx_map["pmdm_hxmc"] + // "' or lsm = '" + hx_map["wzdm"] + "') " + " and ( pmdmten in (" + hx_map["pmdm_hxmc"] +
// ") or hxmc in (" + hx_map["pmdm_hxmc"] + ") or lsm in (" + hx_map["pmdm_hxmc"] + ")) "; // ") or hxmc in (" + hx_map["pmdm_hxmc"] + ") or lsm in (" + hx_map["pmdm_hxmc"] + ")) ";
let sql = "select wzdm,hxdm,hxmc,lsm,wzpm from tab_xtwh_jcsj_wzhxdm where "+ let sql = "select wzdm,hxdm,hxmc,lsm,wzpm from TAB_XTWH_JCSJ_WZHXDM where "+
" lsm = '" + hx_map["wzdm"] + "' " + " lsm = '" + hx_map["wzdm"] + "' " +
" or lsm in (" + hx_map["pmdm_hxmc"] + ")"+ " or lsm in (" + hx_map["pmdm_hxmc"] + ")"+
" or pmdmten = '" + hx_map["wzdm"] + "' " + " or pmdmten = '" + hx_map["wzdm"] + "' " +
...@@ -255,8 +255,12 @@ async function analysisQrCode(bqData:string, isData:boolean = false) { ...@@ -255,8 +255,12 @@ async function analysisQrCode(bqData:string, isData:boolean = false) {
// const allList = await selectInformationType("GY_M_PMV3", allsql) // const allList = await selectInformationType("GY_M_PMV3", allsql)
// const allList1 = await createOrFindSQL("GY_M_PMV3", allsql1)\ // const allList1 = await createOrFindSQL("GY_M_PMV3", allsql1)\
bzhxModal.queryLsm(str) bzhxModal.queryLsm(str)
console.log('sql', sql) console.log('sql查询语句'+ sql)
let wzdmList = await bzhxModal.queryHXlist(sql) let wzdmList = await bzhxModal.queryHXlist(sql)
console.log('sql查询结果'+JSON.stringify(wzdmList))
if(!wzdmList){
wzdmList=[]
}
for (let j = 0; j < wzdmList.length; j++) { for (let j = 0; j < wzdmList.length; j++) {
let wzdm = wzdmList[j]; let wzdm = wzdmList[j];
Object.keys(hx_map).forEach((item) => { Object.keys(hx_map).forEach((item) => {
......
...@@ -26,8 +26,8 @@ class BzhxModel { ...@@ -26,8 +26,8 @@ class BzhxModel {
let res = await SQLiteContext.with(BzhxDao).getBzhxList(offset, pmdmsix, pmdmten) let res = await SQLiteContext.with(BzhxDao).getBzhxList(offset, pmdmsix, pmdmten)
return res; return res;
} }
async queryLsm(lsm?: string):Promise<Wzdm[]> { async queryLsm(lsm?: string):Promise<Bzhx[]> {
let res = await SQLiteContext.with(WzdmDao).selectWZDM(lsm); let res = await SQLiteContext.with(BzhxDao).selectWZInfo(lsm);
Logger.info("查询LSM结果"+JSON.stringify(res)) Logger.info("查询LSM结果"+JSON.stringify(res))
return res; return res;
} }
......
...@@ -6,6 +6,20 @@ class DsRfidModel { ...@@ -6,6 +6,20 @@ class DsRfidModel {
data.guid=uuid() data.guid=uuid()
await SQLiteContext.with(DsRfidDao).insert(data) await SQLiteContext.with(DsRfidDao).insert(data)
} }
// 查询待上架
async queryDSJ(wzcrkguid? : string,sjType?:number): Promise<DsRfid[]> {
let res = await SQLiteContext.with(DsRfidDao).getselectSJList(wzcrkguid,sjType)
return res;
}
// 查询已上架
async queryYSJ(wzcrkguid? : string,sjType?:number): Promise<DsRfid[]> {
let res = await SQLiteContext.with(DsRfidDao).getselectSJList(wzcrkguid,sjType)
return res;
}
async updateSJStatus(guid: string, hwh: string):Promise<number> {
let res = await SQLiteContext.with(DsRfidDao).updateSJStatus(guid, hwh)
return res;
}
} }
const dsRfidModel = new DsRfidModel() const dsRfidModel = new DsRfidModel()
......
...@@ -12,6 +12,11 @@ class HwModel { ...@@ -12,6 +12,11 @@ class HwModel {
let res = await SQLiteContext.with(HwInfoDao).getHwList(no) let res = await SQLiteContext.with(HwInfoDao).getHwList(no)
return res; return res;
} }
// 查询库房下货位
async queryHw(kfguid? : string): Promise<HwInfo[]> {
let res = await SQLiteContext.with(HwInfoDao).getselectHwList(kfguid)
return res;
}
// 清空表 // 清空表
async clear() { async clear() {
await SQLiteContext.with(HwInfoDao).clearTable() await SQLiteContext.with(HwInfoDao).clearTable()
......
import { TitleBar } from '../../view/title/TitleBar' import { TitleBar } from '../../view/title/TitleBar'
import promptAction from '@ohos.promptAction' import promptAction from '@ohos.promptAction'
import hwModel from "../../model/HwModel"
import { HwInfo, SQLiteContext, HwInfoDao,Logger} from '@ohos/common'
import dsRfidModel from '../../model/DsRfidModel';
import router from '@ohos.router'
@Extend(Button) function CommonButtonStyle() { @Extend(Button) function CommonButtonStyle() {
.borderWidth(2) .borderWidth(2)
...@@ -10,20 +14,54 @@ import promptAction from '@ohos.promptAction' ...@@ -10,20 +14,54 @@ import promptAction from '@ohos.promptAction'
.type(ButtonType.Normal) .type(ButtonType.Normal)
.stateEffect(true) .stateEffect(true)
} }
@Entry @Entry
@Component @Component
struct GoodsSelectHwPage{ struct GoodsSelectHwPage{
@State model: boolean = true @State model: boolean = true
@State hwInfoList:HwInfo[]=[]
@State selectValue:Array<SelectOption>=[]
@State checkedList: Array<string> = []
@State hwh:string=""
aboutToAppear(){
this.checkedList= router.getParams() as string[];
this.getHwList()
}
async getHwList(){
this.hwInfoList=await hwModel.queryHw("")
this.selectValue=this.hwInfoList.map(item =>{
return {value:item.hwh}
})
}
/*手动保存*/
onSubmit() {
try {
Logger.info("选择上架数据===》"+JSON.stringify(this.checkedList))
this.checkedList.forEach(async (element) => {
let num = await dsRfidModel.updateSJStatus(element, this.hwh)
if (num) {// 如果更新成功就减少
promptAction.showToast({
message: "保存成功"
})
}else{
promptAction.showToast({
message: "保存失败"
})
}
})
} catch (e) {
} finally {
router.back()
this.checkedList = []
}
}
build(){ build(){
Column() { Column() {
Flex({ direction: FlexDirection.Column }) { Flex({ direction: FlexDirection.Column }) {
TitleBar({ title: "货位"}) TitleBar({ title: "货位"})
Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) { Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) {
Column() { Column() {
Select([{ value: "LS-1-1-2" }, { value: "LS-1-1-3" }, { value: "LS-1-1-4" }]) Select(this.selectValue)
.value('请选择') .value('请选择')
.borderWidth(1) .borderWidth(1)
.borderRadius(6) .borderRadius(6)
...@@ -34,7 +72,7 @@ struct GoodsSelectHwPage{ ...@@ -34,7 +72,7 @@ struct GoodsSelectHwPage{
.borderColor("#e5e5e5") .borderColor("#e5e5e5")
.width(220) .width(220)
.onSelect((index: number, value?: string) => { .onSelect((index: number, value?: string) => {
this.hwh=value
}) })
}.visibility(this.model?Visibility.Visible:Visibility.Hidden).width('70%').margin({ right: 10 }) }.visibility(this.model?Visibility.Visible:Visibility.Hidden).width('70%').margin({ right: 10 })
...@@ -52,7 +90,7 @@ struct GoodsSelectHwPage{ ...@@ -52,7 +90,7 @@ struct GoodsSelectHwPage{
if (this.model) { if (this.model) {
} else { } else {
Flex({ justifyContent: FlexAlign.Center , alignItems: ItemAlign.Center }) { Flex({ justifyContent: FlexAlign.Center , alignItems: ItemAlign.Center}) {
Text('请扫描货位码').fontColor('#fff').fontSize(20) Text('请扫描货位码').fontColor('#fff').fontSize(20)
} }
.width('100%') .width('100%')
...@@ -72,14 +110,10 @@ struct GoodsSelectHwPage{ ...@@ -72,14 +110,10 @@ struct GoodsSelectHwPage{
.fontColor('#0fa983') .fontColor('#0fa983')
.backgroundColor('#fff') .backgroundColor('#fff')
.onClick(() => { .onClick(() => {
promptAction.showToast({ this.onSubmit()
message: "保存"
})
}) })
} }
.height(70) .height(70)
}.width("100%") }.width("100%")
}.linearGradient({ }.linearGradient({
direction: GradientDirection.Right, // 渐变方向 direction: GradientDirection.Right, // 渐变方向
......
...@@ -24,7 +24,7 @@ interface params { ...@@ -24,7 +24,7 @@ interface params {
/*入库详情*/ /*入库详情*/
@Entry @Entry
@Component @Component
struct PzInOutDetailPage{ 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
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论