Commit 5b4940dd by 毛勇泽

Merge remote-tracking branch 'origin/master'

parents fa0b57c8 c8b9d353
...@@ -49,4 +49,16 @@ export interface CommonHxPzMxDto { ...@@ -49,4 +49,16 @@ export interface CommonHxPzMxDto {
hwh: string, hwh: string,
mxguid: string, mxguid: string,
pzmxguid: string pzmxguid: string
}
export interface PzMxDto {
wzpm: string,
pmdmsix: string,
pmdmcode: string,
hxmc: string,
pzsl: number,
crksl: number,
hwh: string,
mxguid: string,
pzmxguid: string
} }
\ No newline at end of file
import relationalStore from '@ohos.data.relationalStore'; import relationalStore from '@ohos.data.relationalStore';
import { PzMxDto } from '../../bean/dto/RecommendHwDto.ts';
import { WzcrkDetailDto } from '../../bean/dto/WzcrkMxRefWzDto'; import { WzcrkDetailDto } from '../../bean/dto/WzcrkMxRefWzDto';
import { Wzcrk } from '../../entity/Wzcrk'; import { Wzcrk } from '../../entity/Wzcrk';
import { Wzcrkmx } from '../../entity/Wzcrkmx'; import { Wzcrkmx } from '../../entity/Wzcrkmx';
...@@ -202,4 +203,39 @@ export class WzcrkDao extends BaseTable<Wzcrk> { ...@@ -202,4 +203,39 @@ export class WzcrkDao extends BaseTable<Wzcrk> {
} }
return items; return items;
} }
async getPzMx(params): Promise<PzMxDto[]> {
try {
let val_sql = NativeSql.getPzMxSql(params);
Logger.info(this, '---getPzMx---' + val_sql)
let db = await this.futureDb;
let rs = await db.querySql(val_sql);
let items = []
if (rs.goToFirstRow()) {
do {
items.push(this.toPzMx(rs))
} while (rs.goToNextRow())
}
Logger.info(this, 'queryAll items22=' + JSON.stringify(items))
return items;
} catch (e) {
throw new Error('[查询异常]|' + e)
}
}
toPzMx(cursor: relationalStore.ResultSet): PzMxDto {
let info: PzMxDto = {
wzpm: cursor.getString(cursor.getColumnIndex('wzpm')),
pmdmsix: cursor.getString(cursor.getColumnIndex('pmdmsix')),
pmdmcode: cursor.getString(cursor.getColumnIndex('pmdmcode')),
hxmc: cursor.getString(cursor.getColumnIndex('hxmc')),
pzsl: cursor.getLong(cursor.getColumnIndex('pzsl')),
crksl: cursor.getLong(cursor.getColumnIndex('crksl')),
hwh: cursor.getString(cursor.getColumnIndex('hwh')),
mxguid: cursor.getString(cursor.getColumnIndex('mxguid')),
pzmxguid: cursor.getString(cursor.getColumnIndex('pzmxguid'))
};
return info;
}
} }
\ No newline at end of file
...@@ -5,7 +5,7 @@ import { Table } from '../decorator/Decorators'; ...@@ -5,7 +5,7 @@ import { Table } from '../decorator/Decorators';
import { Logger } from '../../utils/Logger'; import { Logger } from '../../utils/Logger';
import { NativeSql } from '../sql/NativeSql'; import { NativeSql } from '../sql/NativeSql';
import { WzcrkDetailDto, WzcrkMxRefWzDto } from '../../bean/dto/WzcrkMxRefWzDto'; import { WzcrkDetailDto, WzcrkMxRefWzDto } from '../../bean/dto/WzcrkMxRefWzDto';
import { CommonHxPzMxDto, PzMxItemDto, RecommendHwDto, TestHwWzDto } from '../../bean/dto/RecommendHwDto.ts'; import { CommonHxPzMxDto, PzMxDto, PzMxItemDto, RecommendHwDto, TestHwWzDto } from '../../bean/dto/RecommendHwDto.ts';
/** /**
......
...@@ -106,6 +106,11 @@ WHERE ...@@ -106,6 +106,11 @@ WHERE
`insert into tab_bzgl_knzy_app_hwb (guid, hwh, pmdmcode, hwsl, hjguid, hwzt) values ('${params.guid}', '${params.hwh}', '${params.pmdmcode}', '${params.hwsl}', '${params.hjguid}','11111111SF1')` `insert into tab_bzgl_knzy_app_hwb (guid, hwh, pmdmcode, hwsl, hjguid, hwzt) values ('${params.guid}', '${params.hwh}', '${params.pmdmcode}', '${params.hwsl}', '${params.hjguid}','11111111SF1')`
return sql return sql
} }
// -- -- - 物资列表详情
static getPzMxSql(params): string {
const sql = `select * from (select hx.wzpm wzpm, hx.pmdmsix pmdmsix,hx.pmdmten pmdmcode, hx.hxmc hxmc, mx.pzsl pzsl, mx.crksl crksl, mx.hwh hwh, mx.guid mxguid ,mx.pzmxguid from tab_bzgl_knzy_app_wzcrk crk left join tab_bzgl_knzy_app_wzcrkmx mx on crk.GUID = mx.wzcrkguid left join tab_xtwh_jcsj_bzhx hx on mx.pmdmcode = hx.pmdmten where crk.guid = '${params.guid}' order by hx.PMDMSIX, hx.XH)`
return sql
}
/** /**
* 包裹管理表 * 包裹管理表
......
...@@ -83,6 +83,13 @@ class WzcrkModel { ...@@ -83,6 +83,13 @@ class WzcrkModel {
return res; return res;
} }
// 物资列表详情
async getPzMx(params) {
let res = await SQLiteContext.with(WzcrkDao).getPzMx(params)
Logger.info(this, JSON.stringify(res))
return res
}
// 清空表 // 清空表
async clear() { async clear() {
......
...@@ -3,7 +3,7 @@ import { Logger } from '@ohos/common'; ...@@ -3,7 +3,7 @@ import { Logger } from '@ohos/common';
import gldwModel from '../../../model/GldwModel'; import gldwModel from '../../../model/GldwModel';
import kfModel from '../../../model/KfModel'; import kfModel from '../../../model/KfModel';
import { DividerTitle } from '../../../view/DividerTitle/DividerTitle'; import { DividerTitle } from '../../../view/DividerTitle/DividerTitle';
import { PzFormClass, ScanWzClass, WzClass, WzmxClass } from './Wzcrk.data'; import { historicalInformationClass, PzFormClass, ScanWzClass, WzClass, WzmxClass } from './Wzcrk.data';
import { WzList } from '../WzInPage/WzinDetail/WzList'; import { WzList } from '../WzInPage/WzinDetail/WzList';
import { WzScanInfoDialog } from './Dialog/WzScanInfoDialog'; import { WzScanInfoDialog } from './Dialog/WzScanInfoDialog';
import { analysisQrCode } from '../../../identify/analysis/analysis_QR_code' import { analysisQrCode } from '../../../identify/analysis/analysis_QR_code'
...@@ -11,6 +11,8 @@ import emitter from '@ohos.events.emitter'; ...@@ -11,6 +11,8 @@ import emitter from '@ohos.events.emitter';
import Prompt from '@system.prompt'; import Prompt from '@system.prompt';
import wzcrkmxModel from '../../../model/WzcrkmxModel'; import wzcrkmxModel from '../../../model/WzcrkmxModel';
import { dateUtils, uuid } from '@ohos/common/src/main/ets/utils/util'; import { dateUtils, uuid } from '@ohos/common/src/main/ets/utils/util';
import { PzMxDto } from '@ohos/common/src/main/ets/bean/dto/RecommendHwDto.ts';
import wzcrkModel from '../../../model/WzcrkModel';
@Extend(Button) function CommonButtonStyle() { @Extend(Button) function CommonButtonStyle() {
...@@ -35,14 +37,13 @@ export struct WzInfo { ...@@ -35,14 +37,13 @@ export struct WzInfo {
@State isHaveButton: boolean = false // 完成状态, 未完成是true, 其他false @State isHaveButton: boolean = false // 完成状态, 未完成是true, 其他false
@State isAutomation: boolean = true //控制扫描提示显示隐藏 @State isAutomation: boolean = true //控制扫描提示显示隐藏
@State pzxqGuild: string = '' //当前凭证guid @State pzxqGuild: string = '' //当前凭证guid
@State historicalInformation: Array<any> = [] //物资数据 @State historicalInformation: historicalInformationClass[] = [] //物资数据
@State currentPmdmcode: string = '' //当前扫描pmdm10位 @State currentPmdmcode: string = '' //当前扫描pmdm10位
@State defaultHwh: string = this.convertionDefaultHwh() @State defaultHwh: string = this.convertionDefaultHwh()
@Link pzForm: PzFormClass @Link pzForm: PzFormClass
@State currentDw: string = '' @State currentDw: string = ''
@State kfmc: string = '' @State kfmc: string = ''
@State wzmx: WzmxClass[] = []
@ObjectLink wzcrk: WzClass @ObjectLink wzcrk: WzClass
getDetail: (wzpm?: string) => void getDetail: (wzpm?: string) => void
scanInfoDialog: CustomDialogController = new CustomDialogController({ scanInfoDialog: CustomDialogController = new CustomDialogController({
...@@ -59,11 +60,6 @@ export struct WzInfo { ...@@ -59,11 +60,6 @@ export struct WzInfo {
}) })
private searchcontroller: SearchController = new SearchController() private searchcontroller: SearchController = new SearchController()
// 在自定义组件即将析构销毁时将dialogController置空
aboutToDisappear() {
this.scanInfoDialog = undefined // 将dialogController置空
}
@Builder container() { @Builder container() {
Column() { Column() {
Flex({ justifyContent: FlexAlign.SpaceBetween }) { Flex({ justifyContent: FlexAlign.SpaceBetween }) {
...@@ -138,6 +134,12 @@ export struct WzInfo { ...@@ -138,6 +134,12 @@ export struct WzInfo {
this.scanCodeListen(); this.scanCodeListen();
} }
// 在自定义组件即将析构销毁时将dialogController置空
aboutToDisappear() {
this.scanInfoDialog = undefined // 将dialogController置空
Logger.info('Aaaaa>>', JSON.stringify(this.historicalInformation))
}
scanCodeListen() { scanCodeListen() {
var innerEvent = { eventId: 3 } var innerEvent = { eventId: 3 }
emitter.on(innerEvent, (eventQRData) => { emitter.on(innerEvent, (eventQRData) => {
...@@ -150,7 +152,6 @@ export struct WzInfo { ...@@ -150,7 +152,6 @@ export struct WzInfo {
} }
async getData() { async getData() {
Logger.info(">>>>>>>>>>>>>>>PAGETYPE:", this.pageType)
// 获取收物单位 // 获取收物单位
const res1 = await gldwModel.queryByData({ dwdm: this.wzcrk.sfdw }) const res1 = await gldwModel.queryByData({ dwdm: this.wzcrk.sfdw })
this.currentDw = res1[0].dwfh ?? '' this.currentDw = res1[0].dwfh ?? ''
...@@ -264,6 +265,19 @@ export struct WzInfo { ...@@ -264,6 +265,19 @@ export struct WzInfo {
} }
// 扫描物资 // 扫描物资
if (res.data && res.data.length > 0) { if (res.data && res.data.length > 0) {
console.log(">>>>>>>>扫描物资>>>>>>>" + JSON.stringify(res.data))
let isNumber = false
res.data.forEach(element => {
if (/^\d+$/.test(element.srsl)) { // 判断扫描的物资的srsl一定是数字才会通过校验不是就报错
isNumber = true
}
});
if (!isNumber) {
Prompt.showToast({
message: '当前扫描的物资信息不完整',
})
return
}
res.data.forEach(async (ITEM) => { res.data.forEach(async (ITEM) => {
if (this.dataType) { if (this.dataType) {
// 单据导入 // 单据导入
...@@ -275,7 +289,7 @@ export struct WzInfo { ...@@ -275,7 +289,7 @@ export struct WzInfo {
pmdmcode: ITEM.pmdmcode.slice(0, 6) pmdmcode: ITEM.pmdmcode.slice(0, 6)
} }
const pzData = await wzcrkmxModel.getPzMxItem(params, true) const pzData = await wzcrkmxModel.getPzMxItem(params, true)
console.log('pzData', pzData) console.log('pzData', JSON.stringify(pzData))
if (pzData.length == 0) { if (pzData.length == 0) {
Prompt.showToast({ Prompt.showToast({
// title: this.pageType + '导入的凭证中无扫描品种,不容许添加!', // title: this.pageType + '导入的凭证中无扫描品种,不容许添加!',
...@@ -369,6 +383,7 @@ export struct WzInfo { ...@@ -369,6 +383,7 @@ export struct WzInfo {
// 2.换出和换入的品种号型必须一样 // 2.换出和换入的品种号型必须一样
} }
console.log('---historicalInformation---', JSON.stringify(this.historicalInformation))
const [data] = this.historicalInformation.filter((item, index) => item const [data] = this.historicalInformation.filter((item, index) => item
.pmdmcode == ITEM.pmdmcode && item.hwh == this.pzForm.hwh) .pmdmcode == ITEM.pmdmcode && item.hwh == this.pzForm.hwh)
console.log('---过滤后的data---', JSON.stringify(data)) console.log('---过滤后的data---', JSON.stringify(data))
...@@ -397,7 +412,6 @@ export struct WzInfo { ...@@ -397,7 +412,6 @@ export struct WzInfo {
}) })
} }
}) })
console.log('this.historicalInformation', this.historicalInformation)
} }
} }
} }
...@@ -418,6 +432,7 @@ export struct WzInfo { ...@@ -418,6 +432,7 @@ export struct WzInfo {
}) })
} }
this.currentPmdmcode = ITEM.pmdmcode this.currentPmdmcode = ITEM.pmdmcode
// @ts-ignore
this.historicalInformation = res this.historicalInformation = res
this.setDefaultActive() this.setDefaultActive()
callback && callback() callback && callback()
...@@ -459,7 +474,7 @@ export struct WzInfo { ...@@ -459,7 +474,7 @@ export struct WzInfo {
testPmdmCodeSql = this.historicalInformation.filter((item) => item.pmdmcode == testPmdmCodeSql = this.historicalInformation.filter((item) => item.pmdmcode ==
filterInsrtData.pmdmcode && (item.hwh == '' || item.hwh == this.pzForm.hwh)) filterInsrtData.pmdmcode && (item.hwh == '' || item.hwh == this.pzForm.hwh))
} }
console.log('testPmdmCodeSql', testPmdmCodeSql, this.currentModel) console.log('testPmdmCodeSql', JSON.stringify(testPmdmCodeSql), this.currentModel)
if (testPmdmCodeSql && testPmdmCodeSql.length > 0) { if (testPmdmCodeSql && testPmdmCodeSql.length > 0) {
var update_crksl = 0 var update_crksl = 0
if (this.pageType == '倒库' || this.pageType == '调号' || this.pageType == '换位') { if (this.pageType == '倒库' || this.pageType == '调号' || this.pageType == '换位') {
...@@ -485,7 +500,7 @@ export struct WzInfo { ...@@ -485,7 +500,7 @@ export struct WzInfo {
} }
console.log("updateParams", JSON.stringify(updateParams)) console.log("updateParams", JSON.stringify(updateParams))
let s = await wzcrkmxModel.updateWzmx(updateParams) let s = await wzcrkmxModel.updateWzmx(updateParams)
console.log("updateParams执行成功或者失败:" + s) console.log("updateParams执行成功或者失败:" + JSON.stringify(this.historicalInformation))
} else { } else {
var insert_crksl = 0 var insert_crksl = 0
if (this.pageType == '倒库' || this.pageType == '调号' || this.pageType == '换位') { if (this.pageType == '倒库' || this.pageType == '调号' || this.pageType == '换位') {
...@@ -776,7 +791,7 @@ export struct WzInfo { ...@@ -776,7 +791,7 @@ export struct WzInfo {
.pmdmcode == data .pmdmcode == data
.pmdmcode && item.currentModel == newCurrentModel) .pmdmcode && item.currentModel == newCurrentModel)
console.log('没有货位====================') console.log('没有货位====================')
console.log(newIsDk) //console.log(newIsDk)
if (newIsDk) { if (newIsDk) {
// console.log('==========================存在===============1') // console.log('==========================存在===============1')
// 如果没有货位号,则覆盖这条数据货位并合计 // 如果没有货位号,则覆盖这条数据货位并合计
......
...@@ -248,6 +248,51 @@ export class WzmxClass { ...@@ -248,6 +248,51 @@ export class WzmxClass {
} }
} }
// 物资明细
@Observed
export class historicalInformationClass {
wzpm: string
pmdmsix: string
pmdmcode: string
hxmc: string
pzsl: number
crksl: number
hwh: string
mxguid: string
pzmxguid: string
currentModel?: boolean
constructor(data: {
wzpm: string
pmdmsix: string
pmdmcode: string
hxmc: string
pzsl: number
crksl: number
hwh: string
mxguid: string
pzmxguid: string
currentModel?: boolean
}) {
this.wzpm = data.wzpm
this.pmdmsix = data.pmdmsix
this.pmdmcode = data.pmdmcode
this.hxmc = data.hxmc
this.pzsl = data.pzsl
this.crksl = data.crksl
this.hwh = data.hwh
this.mxguid = data.mxguid
this.pzmxguid = data.pzmxguid
this.currentModel = data.currentModel || false
}
}
// 物资表单详情 // 物资表单详情
@Observed @Observed
......
import { WzmxClass } from '../../Common/Wzcrk.data' import { historicalInformationClass, WzmxClass } from '../../Common/Wzcrk.data'
@Component @Component
export struct WzList { export struct WzList {
@ObjectLink wzmx: WzmxClass @ObjectLink wzmx: historicalInformationClass
build() { build() {
Column() { Column() {
......
...@@ -5,7 +5,7 @@ import { Wzcrk } from '@ohos/common/src/main/ets/entity/Wzcrk'; ...@@ -5,7 +5,7 @@ import { Wzcrk } from '@ohos/common/src/main/ets/entity/Wzcrk';
import { WzInfo } from '../../Common/WzInfo' import { WzInfo } from '../../Common/WzInfo'
import { PzInfo } from './PzInfo' import { PzInfo } from './PzInfo'
import wzcrkmxModel from '../../../../model/WzcrkmxModel'; import wzcrkmxModel from '../../../../model/WzcrkmxModel';
import { PzFormClass, WzClass, WzmxClass } from '../../Common/Wzcrk.data'; import { historicalInformationClass, PzFormClass, WzClass, WzmxClass } from '../../Common/Wzcrk.data';
import promptAction from '@ohos.promptAction'; import promptAction from '@ohos.promptAction';
import wzcrkModel from '../../../../model/WzcrkModel'; import wzcrkModel from '../../../../model/WzcrkModel';
import { AddWzin } from './AddWzin' import { AddWzin } from './AddWzin'
...@@ -37,7 +37,7 @@ struct WzinDetail { ...@@ -37,7 +37,7 @@ struct WzinDetail {
@State currentIndex: number = 0 @State currentIndex: number = 0
@State isUpdate: boolean = false @State isUpdate: boolean = false
@State wzcrk: WzClass = null // 物资出入库单据信息 @State wzcrk: WzClass = null // 物资出入库单据信息
@State wzmx: WzmxClass[] = [] // 物资出入库明细 @State historicalInformation: historicalInformationClass[] = [] // 物资出入库明细
@State pzForm: PzFormClass = null // 物资出入库表单详情 @State pzForm: PzFormClass = null // 物资出入库表单详情
private controller: TabsController = new TabsController() private controller: TabsController = new TabsController()
...@@ -62,13 +62,11 @@ struct WzinDetail { ...@@ -62,13 +62,11 @@ struct WzinDetail {
// 获取物资列表详情信息 // 获取物资列表详情信息
async getWzmxList(wzpm?) { async getWzmxList(wzpm?) {
this.wzmx = [] const pzmxRes = await wzcrkModel.getPzMx({ guid: this.wzcrk.guid })
const res = await wzcrkmxModel.query(this.wzcrk.guid, wzpm) pzmxRes.forEach((element) => {
res.forEach(i => { this.historicalInformation.push(new historicalInformationClass(element))
// @ts-ignore
this.wzmx.push(new WzmxClass(i))
}) })
Logger.info('接收到出入库物资明细信息>>', JSON.stringify(res)) Logger.info('接收到出入库物资明细信息>>', JSON.stringify(pzmxRes))
} }
@Builder TabBuilder(index: number, name: string) { @Builder TabBuilder(index: number, name: string) {
...@@ -108,8 +106,15 @@ struct WzinDetail { ...@@ -108,8 +106,15 @@ struct WzinDetail {
// pageType必传 入库 出库 盘库 调号 倒库 换位 // pageType必传 入库 出库 盘库 调号 倒库 换位
// dataType必传 导入是true, 其他为false // dataType必传 导入是true, 其他为false
// isHaveButton 必传 完成状态 未完成是true, 其他为false // isHaveButton 必传 完成状态 未完成是true, 其他为false
WzInfo({ historicalInformation: this.wzmx, wzcrk: this.wzcrk, getDetail: this.getWzmxList, WzInfo({
pageType: "入库", pzForm: this.pzForm, dataType: this.isUpdate ? true : false, isHaveButton: this.wzcrk.wczt == '未完成' ? true : false}) wzcrk: this.wzcrk,
getDetail: this.getWzmxList,
pageType: "入库",
pzForm: this.pzForm,
historicalInformation: this.historicalInformation,
dataType: this.isUpdate ? true : false,
isHaveButton: this.wzcrk.wczt == '未完成' ? true : false
})
}.width("100%") }.width("100%")
}.tabBar(this.TabBuilder(1, '物资信息')) }.tabBar(this.TabBuilder(1, '物资信息'))
} }
...@@ -128,20 +133,20 @@ struct WzinDetail { ...@@ -128,20 +133,20 @@ struct WzinDetail {
Button("保存").CommonButtonStyle().width("50%") Button("保存").CommonButtonStyle().width("50%")
.onClick(async () => { .onClick(async () => {
try { try {
Logger.info('保存的入库明细数据>>', JSON.stringify(this.wzmx)) Logger.info('保存的入库明细数据>>', JSON.stringify(this.historicalInformation))
if (this.isUpdate) { if (this.isUpdate) {
const crksl = this.wzmx.map(v => Number(v.crksl)).reduce((a, b) => a + b, 0) const crksl = this.historicalInformation.map(v => Number(v.crksl)).reduce((a, b) => a + b, 0)
await wzcrkModel.updateWcztByData(this.wzcrk.guid, { await wzcrkModel.updateWcztByData(this.wzcrk.guid, {
dec: this.wzcrk.dec, dec: this.wzcrk.dec,
ydh: this.wzcrk.ydh, ydh: this.wzcrk.ydh,
crksl crksl
}) })
for (let index = 0; index < this.wzmx.length; index++) { for (let index = 0; index < this.historicalInformation.length; index++) {
const element = this.wzmx[index]; const element = this.historicalInformation[index];
try { try {
let val1 = await wzcrkmxModel.updateWcztmxByData(element.guid, { crksl: element.crksl }) let val1 = await wzcrkmxModel.updateWcztmxByData(element.mxguid, { crksl: element.crksl })
} catch (e) { } catch (e) {
Logger.error(this, '保存失败了>>' + JSON.stringify(e)) Logger.error(this, '保存失败了>>' + JSON.stringify(e))
} }
......
...@@ -85,7 +85,7 @@ struct WzInvDetail{ ...@@ -85,7 +85,7 @@ struct WzInvDetail{
TabContent() { TabContent() {
Column() { Column() {
WzInfo({ historicalInformation: this.wzmx, wzcrk: this.wzcrk, getDetail: this.getDetail }) WzInfo({ wzcrk: this.wzcrk, getDetail: this.getDetail })
}.width("100%") }.width("100%")
}.tabBar(this.TabBuilder(1, '物资信息')) }.tabBar(this.TabBuilder(1, '物资信息'))
} }
......
...@@ -92,7 +92,7 @@ struct WzOutDetail { ...@@ -92,7 +92,7 @@ struct WzOutDetail {
TabContent() { TabContent() {
Column() { Column() {
WzInfo({ historicalInformation: this.wzmx, wzcrk: this.wzcrk, getDetail: this.getDetail, pageType: "出库" }) WzInfo({ wzcrk: this.wzcrk, getDetail: this.getDetail, pageType: "出库" })
}.width("100%") }.width("100%")
}.tabBar(this.TabBuilder(1, '物资信息')) }.tabBar(this.TabBuilder(1, '物资信息'))
} }
......
...@@ -97,7 +97,9 @@ export struct Pack { ...@@ -97,7 +97,9 @@ export struct Pack {
this.ddh = value this.ddh = value
this.getPackList() this.getPackList()
}) })
Button("接收").CommonButtonStyle() Button("接收").CommonButtonStyle().onClick(() => {
router.pushUrl({ url: 'pages/package/ReceivePack' })
})
Button("上架").CommonButtonStyle() Button("上架").CommonButtonStyle()
} }
......
import { TitleBar } from '../../view/title/TitleBar'
@Entry
@Component
export struct ReceivePack {
build() {
Column() {
TitleBar({ title: "新增包裹" })
Column() {
Text("请扫描包裹").fontColor('#fff').fontSize(26).margin({ top: 300 })
}
.alignItems(HorizontalAlign.Center)
.flexGrow(1)
.width('88%')
.borderWidth(3)
.border({ style: BorderStyle.Dotted })
.borderColor('#fff')
}.height('100%')
.width('100%')
.linearGradient({
direction: GradientDirection.Right, // 渐变方向
repeating: true, // 渐变颜色是否重复
colors: [[0x36a3c0, 0.0], [0x97c6a6, 1], [0xc7d799, 0.0]] // 数组末尾元素占比小于1时满足重复着色效果
}).padding({ bottom: 20 })
}
}
\ No newline at end of file
...@@ -4,12 +4,24 @@ import kfModel from '../../../model/KfModel' ...@@ -4,12 +4,24 @@ import kfModel from '../../../model/KfModel'
@Component @Component
export struct HouseList { export struct HouseList {
@Link dataSource: KfInfo[] @Link dataSource: KfInfo[]
@Link searchValue: string
@Styles commonPadding() { @Styles commonPadding() {
.padding({ top: 4, bottom: 4 }) .padding({ top: 4, bottom: 4 })
.alignSelf(ItemAlign.Start) .alignSelf(ItemAlign.Start)
} }
async handleChange(record) {
await kfModel.update(record.guid)
this.getWarehouseList()
}
// 获取库房数据
async getWarehouseList() {
const res = await kfModel.query({ kfmc: this.searchValue })
this.dataSource = res
}
@Builder renderList() { @Builder renderList() {
Column() { Column() {
List() { List() {
...@@ -38,7 +50,7 @@ export struct HouseList { ...@@ -38,7 +50,7 @@ export struct HouseList {
Text("优先级:").commonPadding() Text("优先级:").commonPadding()
Text(item.yxj + '').commonPadding() Text(item.yxj + '').commonPadding()
} }
}.width('40%') }.width('35%')
Column() { Column() {
Radio({ value: item.guid, group: 'radioGroup' }) Radio({ value: item.guid, group: 'radioGroup' })
...@@ -47,13 +59,13 @@ export struct HouseList { ...@@ -47,13 +59,13 @@ export struct HouseList {
.width(18) .width(18)
.onChange((isChecked: boolean) => { .onChange((isChecked: boolean) => {
if (isChecked) { if (isChecked) {
kfModel.update(item.guid) this.handleChange(item)
} }
}) })
if (item.isdefault == '1') { if (item.isdefault == '1') {
Text('默认库房').fontColor('#3672cf') Text('默认库房').fontColor('#3672cf').fontSize(12)
} }
}.width('10%') }.width('20%')
}.commonPadding() }.commonPadding()
} }
}) })
......
import { HouseList } from './HouseList' import { HouseList } from './HouseList'
import { TitleBar } from '../../../view/title/TitleBar' import { TitleBar } from '../../../view/title/TitleBar'
import kfModel from '../../../model/KfModel' import kfModel from '../../../model/KfModel'
import { Logger } from '@ohos/common' import { KfInfo, Logger } from '@ohos/common'
import { KfInfo } from '@ohos/common'
@Entry @Entry
@Component @Component
export struct Warehouse { export struct Warehouse {
...@@ -10,13 +10,13 @@ export struct Warehouse { ...@@ -10,13 +10,13 @@ export struct Warehouse {
controller: SearchController = new SearchController() controller: SearchController = new SearchController()
@State dataSource: KfInfo[] = [] @State dataSource: KfInfo[] = []
aboutToAppear(){ aboutToAppear() {
this.getWarehouseList() this.getWarehouseList()
} }
// 获取库房数据 // 获取库房数据
async getWarehouseList(kfmc?: string ) { async getWarehouseList(kfmc?: string) {
const res = await kfModel.query({kfmc}) const res = await kfModel.query({ kfmc })
this.dataSource = res this.dataSource = res
Logger.info(this, "库房数据>" + JSON.stringify(res)); Logger.info(this, "库房数据>" + JSON.stringify(res));
} }
...@@ -32,18 +32,21 @@ export struct Warehouse { ...@@ -32,18 +32,21 @@ export struct Warehouse {
.placeholderColor(Color.Grey) .placeholderColor(Color.Grey)
.placeholderFont({ size: 14, weight: 400 }) .placeholderFont({ size: 14, weight: 400 })
.textFont({ size: 14, weight: 400 }) .textFont({ size: 14, weight: 400 })
.onChange((value) => this.getWarehouseList(value)) .onChange((value) => {
this.searchValue = value
this.getWarehouseList(value)
})
.borderRadius(5) .borderRadius(5)
}.width('100%') }.width('100%')
Column() { Column() {
HouseList({ dataSource: $dataSource }) HouseList({ dataSource: $dataSource,searchValue:$searchValue })
}.margin({top:20}).borderRadius(2) }.margin({ top: 20 }).borderRadius(2)
} }
}.linearGradient({ }.linearGradient({
direction: GradientDirection.RightBottom, direction: GradientDirection.RightBottom,
repeating: true, repeating: true,
colors: [['#36a3c0', 0.0], ['#97c6a6', 1.0], ['#c7d799', 2.0]] colors: [['#36a3c0', 0.0], ['#97c6a6', 1.0], ['#c7d799', 2.0]]
}).padding({bottom:40,left:20,right:20}) }).padding({ bottom: 40, left: 20, right: 20 })
} }
} }
\ No newline at end of file
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
"identify/demo_page/ScanDemo", "identify/demo_page/ScanDemo",
"pages/metailmange/GoodsSelectHwPage", "pages/metailmange/GoodsSelectHwPage",
"pages/metailmange/GoodsSelectRfidTools", "pages/metailmange/GoodsSelectRfidTools",
"pages/metailmange/WzOutPage/WzOutDetail/WzOutDetail" "pages/metailmange/WzOutPage/WzOutDetail/WzOutDetail",
"pages/package/ReceivePack"
] ]
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论