Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
J
jump_hm_warehouse
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Members
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
毛勇泽
jump_hm_warehouse
Commits
e53a54a5
Commit
e53a54a5
authored
Jan 24, 2024
by
huangqy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
物资出库
parent
daaa7962
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
662 行增加
和
3 行删除
+662
-3
AddWzin.ets
entry/src/main/ets/pages/metailmange/WzOutPage/WzOutDetail/AddWzin.ets
+244
-0
PzInfo.ets
entry/src/main/ets/pages/metailmange/WzOutPage/WzOutDetail/PzInfo.ets
+112
-0
WzInfo.ets
entry/src/main/ets/pages/metailmange/WzOutPage/WzOutDetail/WzInfo.ets
+139
-0
WzOutDetail.ets
entry/src/main/ets/pages/metailmange/WzOutPage/WzOutDetail/WzOutDetail.ets
+165
-0
WzOutPage.ets
entry/src/main/ets/pages/metailmange/WzOutPage/WzOutPage.ets
+2
-2
main_pages.json
entry/src/main/resources/base/profile/main_pages.json
+0
-1
没有找到文件。
entry/src/main/ets/pages/metailmange/WzOutPage/WzOutDetail/AddWzin.ets
0 → 100644
View file @
e53a54a5
import { zmlx_dict } from '@ohos/common/src/main/ets/utils/dict'
import gldwModel from '../../../../model/GldwModel'
import hwModel from '../../../../model/HwModel'
import kfModel from '../../../../model/KfModel'
import { renderPzlx, renderSzlx, WzClass } from '../../Common/Wzcrk.data'
import promptAction from '@ohos.promptAction'
@Observed
class Options {
value: string
id: string | number
constructor(value, id) {
this.value = value
this.id = id
}
}
@Observed
class Form {
title: string
key: string
enabled: boolean
required: boolean
type: 'input' | 'select'
options?: Options[]
constructor(data: {
title: string
key: string
enabled: boolean
type: 'input' | 'select',
required: boolean,
options?: Options[]
}) {
this.title = data.title
this.key = data.key
this.enabled = data.enabled
this.type = data.type
this.required = data.required || false
this.options = data.options
}
}
@Component
// 物资信息
export struct AddWzin {
@ObjectLink wzcrk: WzClass
@State form: Form[] = []
arr = [{ title: "凭证类型", key: 'pzlx', enabled: false, type: 'input' },
{ title: "凭证号", key: 'pzh', enabled: false, type: 'input' },
{ title: "收支类型", key: 'pzszlx', enabled: false, type: 'input' },
{
title: "库房",
key: 'kfguid',
enabled: true,
type: 'select',
options: [],
required: true
},
{
title: "货位号",
key: 'hwh',
enabled: true,
type: 'select',
options: [],
required: true
},
{
title: "发物管理单位",
key: 'fwgldwdm',
enabled: false,
type: 'select',
options: [],
required: true
},
{
title: "收物管理单位",
key: 'swgldwdm',
enabled: false,
type: 'select',
options: [],
required: true
},
{
title: "账目类型",
key: 'zmlx',
enabled: false,
type: 'select',
options: [],
required: true
},
{ title: "运单号", key: 'ydh', enabled: true, type: 'input' },
{ title: "备注", key: 'dec', enabled: true, type: 'input' }
]
// 表单验证
validate(): boolean {
this.arr.filter(v => v.required).forEach(v => {
if (!this.wzcrk[v.key]) {
promptAction.showToast({
message: `请${v.type == 'input' ? '输入' : '选择'}${v.title}`,
bottom: 300
})
return false
}
})
return true
}
handleText(key: string): string {
switch (key) {
case 'pzlx':
return renderPzlx(this.wzcrk.pzlx)
case 'pzszlx':
return renderSzlx(this.wzcrk.pzszlx)
default:
return String(this.wzcrk[key])
}
}
aboutToAppear() {
this.getData()
}
async getData() {
// 获取库房列表
const kfList = await kfModel.query({})
// 获取货架列表
const hwList = await hwModel.query()
// 获取单位列表
const dwList = await gldwModel.queryByData({})
this.arr.forEach((i: any) => {
this.form.push(new Form(i))
})
kfList.forEach(i => {
this.form[this.form.findIndex(v => v.key == 'kfguid')]
.options
.push(new Options(i.kfmc, i.guid))
})
hwList.forEach(i => {
this.form[this.form.findIndex(v => v.key == 'hwh')]
.options
.push(new Options(i.hwh, i.hwh))
})
zmlx_dict.forEach(i => {
this.form[this.form.findIndex(v => v.key == 'zmlx')]
.options
.push(new Options(i.text, i.value))
})
dwList.forEach(i => {
this.form[this.form.findIndex(v => v.key == 'swgldwdm')]
.options
.push(new Options(i.dwfh, i.dwdm))
})
dwList.forEach(i => {
this.form[this.form.findIndex(v => v.key == 'fwgldwdm')]
.options
.push(new Options(i.dwfh, i.dwdm))
})
}
build() {
Column() {
Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) {
Divider()
.vertical(true)
.height(14)
.strokeWidth(3)
.color('#19ac88')
.opacity(0.6)
.margin({ left: 8, right: 8 })
Text("凭证信息")
.fontSize(16)
}.height('8%')
List() {
ForEach(this.form, (item) => {
ListItem() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) {
Row(){
if (item.required) {
Text('*').fontColor('red').margin({ right: 5 })
}
Text(item.title)
.fontSize(14)
.height(40)
.fontColor($r("app.color.item_color_black"))
}.width("35%")
if (item.type == 'select') {
Select(item.options)
.value(`请选择${item.title}`)
.width(230)
.borderWidth(1)
.borderRadius(5)
.flexGrow(1)
.borderColor($r("app.color.rank_secondary_border"))
.onSelect((index: number, value?: string) => {
this.wzcrk[item.key] = item.options[index].id
})
}
if (item.type == 'input') {
TextInput({ text: this.handleText(item.key) })
.enterKeyType(EnterKeyType.Search)
.borderColor("#454545")
.borderRadius(5)
.height(40)
.padding(10)
.flexGrow(1)
.borderColor('#bcc5d7')
.borderWidth(1)
.backgroundColor(item.enabled ? '#fff' : "app.color.disabledColor")
.enabled(item.enabled)
.onChange((value: string) => {
if (item.enabled) {
this.wzcrk[item.key] = value
}
})
}
}
}
}.padding(15)
})
}.margin({ bottom: 40 })
}.backgroundColor('#fff')
}
}
\ No newline at end of file
entry/src/main/ets/pages/metailmange/WzOutPage/WzOutDetail/PzInfo.ets
0 → 100644
View file @
e53a54a5
import gldwModel from '../../../../model/GldwModel'
import kfModel from '../../../../model/KfModel'
import { renderPzlx, renderSzlx, renderZmlx, WzClass } from '../../Common/Wzcrk.data'
@Component
// 物资信息
export struct PzInfo {
@State kfmc: string = ''
@State fwgldw: string = ''
@State swgldw: string = ''
@ObjectLink wzcrk: WzClass
arr = [{ title: "凭证类型", key: 'pzlx', enabled: false },
{ title: "凭证号", key: 'pzh', enabled: false },
{ title: "库房", key: 'kfguid', enabled: false },
{ title: "收支类型", key: 'pzszlx', enabled: false },
{ title: "运单号", key: 'ydh', enabled: true },
{ title: "发物管理单位", key: 'fwgldwdm', enabled: false },
{ title: "收物管理单位", key: 'swgldwdm', enabled: false },
{ title: "账目类型", key: 'zmlx', enabled: false },
{ title: "备注", key: 'dec', enabled: true }
]
aboutToAppear(){
this.getData()
}
async getData() {
const res = await kfModel.query({guid: this.wzcrk.kfguid})
this.kfmc = res[0].kfmc ?? ''
const res1 = await gldwModel.queryByData({dwdm:this.wzcrk.fwgldwdm})
this.fwgldw = res1[0].dwfh ?? ''
const res2 = await gldwModel.queryByData({dwdm:this.wzcrk.swgldwdm})
this.swgldw = res2[0].dwfh ?? ''
}
handleText(key: string): string {
switch (key) {
case 'pzlx':
return renderPzlx(this.wzcrk.pzlx)
case 'pzszlx':
return renderSzlx(this.wzcrk.pzszlx)
case 'zmlx':
return renderZmlx(this.wzcrk.zmlx)
case 'kfguid':
return this.kfmc
case 'fwgldwdm':
return this.fwgldw
case 'swgldwdm':
return this.swgldw
default:
return String(this.wzcrk[key])
}
}
build(){
Column(){
Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) {
Divider()
.vertical(true)
.height(14)
.strokeWidth(3)
.color('#19ac88')
.opacity(0.6)
.margin({ left: 8, right: 8 })
Text("凭证信息")
.fontSize(16)
}.height('8%')
List(){
ForEach(this.arr,(item) => {
ListItem(){
Column(){
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) {
Text(item.title)
.fontSize(14)
.width("30%")
.height(40)
.fontColor($r("app.color.item_color_black"))
TextInput({ text: this.handleText(item.key),placeholder: `请输入${item.title}` })
.enterKeyType(EnterKeyType.Search)
.borderColor("#454545")
.borderRadius(5)
.width("70%")
.height(40)
.padding(10)
.borderColor('#bcc5d7')
.borderWidth(1)
.backgroundColor(item.enabled ? '#fff' : "app.color.disabledColor")
.enabled(item.enabled)
.onChange((value: string) => {
if(item.enabled) {
this.wzcrk[item.key] = value
}
})
}
}
}.padding(15)
})
}.margin({bottom:40})
}.backgroundColor('#fff')
}
}
\ No newline at end of file
entry/src/main/ets/pages/metailmange/WzOutPage/WzOutDetail/WzInfo.ets
0 → 100644
View file @
e53a54a5
import router from '@ohos.router';
import { Logger } from '@ohos/common';
import { Wzcrkmx } from '@ohos/common/src/main/ets/entity/Wzcrkmx';
import gldwModel from '../../../../model/GldwModel';
import kfModel from '../../../../model/KfModel';
import { WzClass, WzmxClass } from '../../Common/Wzcrk.data';
import { WzList } from './WzList';
@Extend(Button) function CommonButtonStyle() {
.borderWidth(2)
.borderColor('#0fa983')
.backgroundColor('#97c6a6')
.fontColor('#fff')
.borderRadius(5)
.type(ButtonType.Normal)
.stateEffect(true)
}
@Component
// 物资信息
export struct WzInfo {
private searchcontroller: SearchController = new SearchController()
@State kfmc: string = ''
@State sfdw: string = ''
@State wzmx: WzmxClass[] = []
@ObjectLink wzcrk: WzClass
getDetail: (wzpm?:string) => void
aboutToAppear(){
this.getData()
}
async getData() {
const res = await kfModel.query({guid: this.wzcrk.kfguid})
this.kfmc = res[0].kfmc ?? ''
const res1 = await gldwModel.queryByData({dwdm:this.wzcrk.sfdw})
this.sfdw = res1[0].dwfh ?? ''
}
build() {
Column() {
Flex({ direction: FlexDirection.Column }) {
Column() {
Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) {
Row() {
Divider()
.vertical(true)
.height(14)
.strokeWidth(3)
.color('#19ac88')
.opacity(0.6)
.margin({ left: 8, right: 8 })
Text("单位/库房信息")
.fontWeight(FontWeight.Medium)
.fontSize(14)
.fontColor($r("app.color.item_color_black"))
}
.width("35%")
Text(this.sfdw + this.kfmc)
.fontWeight(FontWeight.Medium)
.fontSize(21)
.fontColor($r("app.color.title_background"))
.width("60%")
.textAlign(TextAlign.Start)
.padding({ bottom: 20, top: 20 })
}.width("100%")
}.padding({ bottom: 20, top: 20 })
.borderRadius(5)
.width("100%")
.backgroundColor("#fff")
Flex({ direction: FlexDirection.Column }) {
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
Row() {
Divider()
.vertical(true)
.height(14)
.strokeWidth(3)
.color('#19ac88')
.opacity(0.6)
.margin({ left: 8, right: 8 })
Text("物资列表")
.fontWeight(FontWeight.Medium)
.fontSize(14)
.fontColor($r("app.color.item_color_black"))
}
}.padding({ left: 2, right: 10 })
.width("100%")
Row() {
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
Search({ placeholder: '请输入品名名称', controller: this.searchcontroller })
.height(40)
.backgroundColor('#F5F5F5')
.placeholderColor(Color.Grey)
.textAlign(TextAlign.Center)
.placeholderFont({ size: 14, weight: 400 })
.textFont({ size: 14, weight: 400 })
.width('75%')
.onSubmit((value: string) => {
this.getDetail(value)
})
.onChange((value: string) => {
})
.margin({ left: 10 })
.borderRadius(5)
Button("查看状态").CommonButtonStyle().width("25%").margin({ left: 5, right: 5 }).onClick(() => {
router.pushUrl({ url: 'pages/metailmange/WzStatus', params: {
wzmx: this.wzmx
} })
})
}.width("100%")
}.padding({ top: 10, bottom: 10 }).width("100%")
Column() {
List() {
ForEach(this.wzmx, (item) => {
ListItem() {
WzList({ wzmx: item })
}
})
}
}.flexGrow(1)
}
.padding({ bottom: 20, top: 20 })
.borderRadius(15)
.margin({ top: 20 })
.width("100%")
.backgroundColor("#fff")
}
.width("100%")
.height("100%")
}
}
}
\ No newline at end of file
entry/src/main/ets/pages/metailmange/WzOutPage/WzOutDetail/WzOutDetail.ets
0 → 100644
View file @
e53a54a5
import { TitleBar } from '../../../../view/title/TitleBar'
import router from '@ohos.router';
import { Logger } from '@ohos/common/src/main/ets/utils/Logger';
import { Wzcrk } from '@ohos/common/src/main/ets/entity/Wzcrk';
import { WzInfo } from './WzInfo'
import { PzInfo } from './PzInfo'
import wzcrkmxModel from '../../../../model/WzcrkmxModel';
import { WzClass, WzmxClass } from '../../Common/Wzcrk.data';
import promptAction from '@ohos.promptAction';
import wzcrkModel from '../../../../model/WzcrkModel';
import { SQLiteContext, Wzcrkmx, WzcrkmxDao } from '@ohos/common';
import {AddWzin} from './AddWzin'
import { uuid } from '@ohos/common/src/main/ets/utils/util';
@Extend(Button) function CommonButtonStyle() {
.borderWidth(2)
.borderColor('#0fa983')
.backgroundColor('#97c6a6')
.fontColor('#fff')
.borderRadius(5)
.type(ButtonType.Normal)
.stateEffect(true)
}
interface params {
wzcrk: Wzcrk,
isUpdate: boolean
}
/*出库详情*/
@Entry
@Component
struct WzOutDetail {
@State fontColor: string = '#0FA983'
@State selectedFontColor: string = '#fff'
@State currentIndex: number = 0
@State isUpdate: boolean = false
@State wzcrk: WzClass = null // 物资出入库单据信息
@State wzmx: WzmxClass[] = [] // 物资出入库明细
private controller: TabsController = new TabsController()
wzcrkmxDao: WzcrkmxDao = SQLiteContext.with(WzcrkmxDao)
onPageShow() {
const params = router.getParams() as params
this.isUpdate = params.isUpdate
this.wzcrk = new WzClass(params.wzcrk)
Logger.info('接收到出入库信息>>', JSON.stringify(params.wzcrk))
this.getDetail()
}
// 获取凭证信息
async getDetail(wzpm?) {
this.wzmx = []
const res = await wzcrkmxModel.query(this.wzcrk.guid, wzpm)
res.forEach(i => {
// @ts-ignore
this.wzmx.push(new WzmxClass(i))
})
Logger.info('接收到出入库物资明细信息>>', JSON.stringify(res))
}
@Builder TabBuilder(index: number, name: string) {
Column() {
Text(name)
.fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor)
.fontSize(21)
.lineHeight(36)
}
.width('100%')
.height(45)
.border({ width: 2, color: 'rgb(15, 169, 131)' })
.borderRadius(3)
.backgroundColor(this.currentIndex === index ? this.fontColor : '#00000000')
}
build() {
Column() {
Flex({ direction: FlexDirection.Column }) {
TitleBar({ title: "凭证详情" })
Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
TabContent() {
Column() {
if(this.isUpdate) {
PzInfo({ wzcrk: this.wzcrk })
} else {
AddWzin({ wzcrk: this.wzcrk })
}
}.width("100%")
}.tabBar(this.TabBuilder(0, '凭证信息'))
TabContent() {
Column() {
WzInfo({ wzmx: this.wzmx, wzcrk: this.wzcrk, getDetail: this.getDetail })
}.width("100%")
}.tabBar(this.TabBuilder(1, '物资信息'))
}
.margin({ left: 15, right: 15, top: 15 })
.onChange((index: number) => {
this.currentIndex = index
})
Row() {
Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) {
Button("射频扫码").CommonButtonStyle().width("50%").onClick(() => {
router.pushUrl({ url: 'pages/metailmange/UHFScanPage', params: { wzcrkItem: this.wzcrk } })
})
Button("保存").CommonButtonStyle().width("50%")
.onClick(async () => {
try {
Logger.info('保存的出库明细数据>>', JSON.stringify(this.wzmx))
if(this.isUpdate) {
const crksl = this.wzmx.map(v => Number(v.crksl)).reduce((a, b) => a + b, 0)
await wzcrkModel.updateWcztByData(this.wzcrk.guid, {
dec: this.wzcrk.dec,
ydh: this.wzcrk.ydh,
crksl
})
for (let index = 0; index < this.wzmx.length; index++) {
const element = this.wzmx[index];
try {
let val1 = await wzcrkmxModel.updateWcztmxByData(element.guid, {crksl:element.crksl})
} catch (e) {
Logger.error(this, '保存失败了>>' + JSON.stringify(e))
}
}
}
else {
this.wzcrk.guid = uuid()
this.wzcrk.gznd = new Date().getFullYear() + ''
this.wzcrk.sjlx = '新建'
await wzcrkModel.setOne(this.wzcrk)
Logger.info('添加的出库数据>>', JSON.stringify(this.wzcrk))
}
promptAction.showToast({
message: '保存出库数据成功',
bottom: 300
})
setTimeout(() => {
router.back({ url: 'pages/metailmange/WzOutPage/WzOutPage' })
}, 300)
} catch (e) {
promptAction.showToast({
message: '保存出库数据失败',
bottom: 200
})
}
})
}
}.margin({ left: 10, right: 10 }).height(80)
}.width("100%")
}.linearGradient({
direction: GradientDirection.Right, // 渐变方向
repeating: true, // 渐变颜色是否重复
colors: [[0x36a3c0, 0.0], [0x97c6a6, 1], [0xc7d799, 0.0]] // 数组末尾元素占比小于1时满足重复着色效果
})
}
}
\ No newline at end of file
entry/src/main/ets/pages/metailmange/WzOutPage/WzOutPage.ets
View file @
e53a54a5
...
@@ -378,10 +378,10 @@ export struct WzOutPage {
...
@@ -378,10 +378,10 @@ export struct WzOutPage {
ListItem() {
ListItem() {
WzList({ item, checkedList: $checkedList }).width('100%').backgroundColor('#fff')
WzList({ item, checkedList: $checkedList }).width('100%').backgroundColor('#fff')
}.onClick(() => {
}.onClick(() => {
router.pushUrl({ url: 'pages/metailmange/Wz
InPage/WzinDetail/Wzin
Detail', params: {
router.pushUrl({ url: 'pages/metailmange/Wz
OutPage/WzOutDetail/WzOut
Detail', params: {
wzcrk: item,
wzcrk: item,
isUpdate:true
isUpdate:true
}}
,
)
}})
})
})
})
})
}.padding(18)
}.padding(18)
...
...
entry/src/main/resources/base/profile/main_pages.json
View file @
e53a54a5
...
@@ -13,7 +13,6 @@
...
@@ -13,7 +13,6 @@
"pages/metailmange/WzInvPage"
,
"pages/metailmange/WzInvPage"
,
"pages/metailmange/WzInvPage/WzInvPage"
,
"pages/metailmange/WzInvPage/WzInvPage"
,
"pages/metailmange/WzInvPage/WzInvDetail/WzInvDetail"
,
"pages/metailmange/WzInvPage/WzInvDetail/WzInvDetail"
,
"pages/metailmange/WzInPage/WzInPage"
,
"pages/metailmange/WzInPage/WzinDetail/WzinDetail"
,
"pages/metailmange/WzInPage/WzinDetail/WzinDetail"
,
"pages/metailmange/WzPositionPage"
,
"pages/metailmange/WzPositionPage"
,
"pages/metailmange/WzReversePage"
,
"pages/metailmange/WzReversePage"
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论