Commit d6734c02 by 陈桂东

数据导入

parent cf3a707d
......@@ -194,6 +194,16 @@ export class WzmxClass {
*/
pzmxguid: string
hxmc:string
xh:string
wzpm:string
pmdmSix:string
wczt:string
constructor(data: {
guid?: string,
gznd: string,
......@@ -202,7 +212,12 @@ export class WzmxClass {
crksl: number,
wzcrkguid: string,
hwh: string,
pzmxguid: string
pzmxguid: string,
hxmc:string,
xh:string,
wzpm:string,
pmdmSix:string,
wczt:string
}) {
this.guid = data.guid;
this.gznd = data.gznd;
......@@ -212,6 +227,11 @@ export class WzmxClass {
this.wzcrkguid = data.wzcrkguid;
this.hwh = data.hwh;
this.pzmxguid = data.pzmxguid;
this.hxmc = data.hxmc;
this.xh = data.xh;
this.wzpm = data.wzpm;
this.pmdmSix = data.pmdmSix;
this.wczt = data.wczt;
}
}
......
import { WzmxClass } from '../Wzin.data'
@CustomDialog
@Component
export struct LeftDialog {
controller: CustomDialogController
cancel: () => void
confirm: () => void
private item: WzmxClass
build() {
Column() {
List({ space: 2 }) {
ListItem() {
Row() {
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center }) {
Text('号型:' + this.item.xh).fontSize(12).fontColor('#3b4144')
Text('凭证数量:' + this.item.pzsl).fontSize(12).fontColor('#3b4144').margin({ top: 30 })
}
.width('70%')
Blank()
.layoutWeight(1)
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Start }) {
if(this.item.wczt == '未完成' && this.item.crksl < this.item.pzsl) {
Text('未完成').fontSize(14).fontColor('red')
} else {
Text('完成').fontSize(14).fontColor( 'green')
}
Text('入库数量: ' + this.item.crksl).fontSize(12).fontColor('#3b4144').margin({ top: 30 })
}
.width('40%')
}
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
.padding({ left: 12, right: 18 })
}.height(90)
}.margin({ top: 100 })
}.width('100%')
.width('60%')
.height('100%')
.backgroundColor('#fff')
}
}
\ No newline at end of file
......@@ -5,7 +5,7 @@ import { renderPzlx, renderSzlx, renderZmlx } from '../Wzin.data'
export struct PzInfo {
arr = [{ title: "凭证类型", key: 'pzlx', enabled: false },
{ title: "凭证号", key: 'pzh', enabled: false },
{ title: "库房", key: '', enabled: true },
{ title: "库房", key: '', enabled: false },
{ title: "收支类型", key: 'pzszlx', enabled: false },
{ title: "运单号", key: 'ydh', enabled: true },
{ title: "发物管理单位", key: 'fwgldwdm', enabled: false },
......@@ -50,7 +50,7 @@ export struct PzInfo {
.width("70%")
.height(40)
.padding(10)
.backgroundColor($r("app.color.disabledColor"))
.backgroundColor(item.enabled ? '#fff' : "app.color.disabledColor")
.enabled(item.enabled)
}.padding("10vp")
})
......
import router from '@ohos.router';
import { Logger } from '@ohos/common';
import { Wzcrkmx } from '@ohos/common/src/main/ets/entity/Wzcrkmx';
import { WzmxClass } from '../Wzin.data';
import { WzList } from './WzList';
......@@ -17,7 +18,7 @@ import { WzList } from './WzList';
// 物资信息
export struct WzInfo {
private searchcontroller: SearchController = new SearchController()
private wzmx: WzmxClass[]
@State private wzmx: WzmxClass[] = []
build() {
Column() {
......@@ -87,18 +88,18 @@ export struct WzInfo {
.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
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})
List() {
ForEach(this.wzmx, (item) => {
ListItem() {
WzList({ wzmx: item })
}
})
}
......
import { Logger } from '@ohos/common/src/main/ets/utils/Logger'
import { WzmxClass } from '../Wzin.data'
@Component
export struct WzList {
@ObjectLink wzmx: WzmxClass
build() {
Column() {
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Column() {
Text("冬季防寒靴100000").padding({ top: 5, bottom: 5 })
Text(this.wzmx.wzpm).padding({ top: 5, bottom: 5 })
Row() {
Text("号型: ")
Text("1003")
Text("号型: " + this.wzmx.hxmc)
}.alignSelf(ItemAlign.Start).padding({ top: 5, bottom: 5 })
Row() {
Text("货位号: ")
Text(this.wzmx.hwh == '' ? '暂无货位号': this.wzmx.hwh)
Text("货位号: " + this.wzmx.hwh == '' ? '暂无货位号': this.wzmx.hwh)
}.alignSelf(ItemAlign.Start).padding({ top: 5, bottom: 5 })
}.margin({ left: 15 })
......@@ -34,6 +34,9 @@ export struct WzList {
this.wzmx.crksl = this.wzmx.crksl + 1
})
.onDec(() => {
if( this.wzmx.crksl == 0) {
return
}
this.wzmx.crksl = this.wzmx.crksl - 1
})
}.alignSelf(ItemAlign.End)
......
......@@ -45,12 +45,23 @@ struct PzInOutDetailPage{
const res = await wzcrkmxModel.query(this.wzcrk.guid)
for (let index = 0; index < res.length; index++) {
const element = res[index];
const res1 = bzhxModel.query(0, '', element.pmdmcode)
const res1 = await bzhxModel.query(0, '', element.pmdmcode)
Logger.info('查询到对应品名代码》》',JSON.stringify(res1))
// @ts-ignore
element.xh = res1[0].xh
// @ts-ignore
element.hxmc = res1[0].hxmc
// @ts-ignore
element.pmdmSix = res1[0].pmdmSix
// @ts-ignore
element.wzpm = res1[0].wzpm
// @ts-ignore
element.wczt = this.wzcrk.wczt
// @ts-ignore
this.wzmx.push(new WzmxClass(element))
}
Logger.info('接收到出入库物资明细信息>>', JSON.stringify(res))
Logger.info('接收到出入库物资明细信息>>', JSON.stringify(this.wzmx))
}
......
import { LeftDialog } from '../../view/LeftDialog/LeftDialog'
import { LeftDialog } from '../metailmange/WzInPage/WzinDetail/LeftDialog'
import { TitleBar } from '../../view/title/TitleBar'
import router from '@ohos.router'
import { WzmxClass } from './WzInPage/Wzin.data'
......@@ -13,9 +13,11 @@ import { WzmxClass } from './WzInPage/Wzin.data'
.height(30)
.stateEffect(true)
}
interface params {
wzmx: WzmxClass[]
}
@Entry
@Component
export struct WzStatus {
......@@ -23,62 +25,25 @@ export struct WzStatus {
@State private unFinishNum: number = 5
@State private numberPercentage: string = "0/500个"
@State show: boolean = false
@State private dataSource: WzmxClass[] = [
// {mc: '冬季防寒靴100000',dm: 100000, pzsl: 0, rksl: 100, status: '未完成', hx: '180100002'},
// {mc: '冬季防寒靴100000',dm: 100000, pzsl: 0, rksl: 100, status: '未完成', hx: '180100002'},
// {mc: '冬季防寒靴100000',dm: 100000, pzsl: 0, rksl: 100, status: '未完成', hx: '180100002'},
// {mc: '冬季防寒靴100000',dm: 100000, pzsl: 0, rksl: 100, status: '未完成', hx: '180100002'},
// {mc: '冬季防寒靴100000',dm: 100000, pzsl: 0, rksl: 100, status: '未完成', hx: '180100002'},
// {mc: '冬季防寒靴100000',dm: 100000, pzsl: 0, rksl: 100, status: '未完成', hx: '180100002'},
// {mc: '冬季防寒靴100000',dm: 100000, pzsl: 0, rksl: 100, status: '未完成', hx: '180100002'},
// {mc: '冬季防寒靴100000',dm: 100000, pzsl: 0, rksl: 100, status: '未完成', hx: '180100002'},
// {mc: '冬季防寒靴100000',dm: 100000, pzsl: 0, rksl: 100, status: '未完成', hx: '180100002'},
// {mc: '冬季防寒靴100000',dm: 100000, pzsl: 0, rksl: 100, status: '未完成', hx: '180100002'},
// {mc: '冬季防寒靴100000',dm: 100000, pzsl: 0, rksl: 100, status: '未完成', hx: '180100002'},
// {mc: '冬季防寒靴100000',dm: 100000, pzsl: 0, rksl: 100, status: '未完成', hx: '180100002'},
// {mc: '冬季防寒靴100000',dm: 100000, pzsl: 0, rksl: 100, status: '未完成', hx: '180100002'},
]
aboutToAppear(){
@State currentItem: WzmxClass = null
@State private dataSource: WzmxClass[] = []
aboutToAppear() {
const params = router.getParams() as params
this.dataSource = params.wzmx
}
@Builder DetailBuilder() {
Column() {
List({ space: 2 }) {
ListItem() {
Row() {
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center }) {
Text('号型:180100002').fontSize(12).fontColor('#3b4144')
Text('凭证数量:0').fontSize(12).fontColor('#3b4144')
}
.width('70%')
Blank()
.layoutWeight(1)
const pzsl = this.dataSource.map(v => Number(v.pzsl)).reduce((a, b) => a + b, 0)
const crksl = this.dataSource.map(v => Number(v.crksl)).reduce((a, b) => a + b, 0)
this.numberPercentage = crksl + '/' + pzsl
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Start }) {
Text('未完成').fontSize(12).fontColor('#3b4144')
Text('入库数量:100').fontSize(12).fontColor('#3b4144')
}
.width('40%')
}
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
.padding({ left: 12, right: 18 })
}.height(90)
}.margin({top: 100})
}.width('100%')
}
dialogController: CustomDialogController = new CustomDialogController({
builder: LeftDialog({
cancel: this.onCancel,
confirm: this.onSubmit,
container: this.DetailBuilder,
item:this.currentItem
}),
alignment: DialogAlignment.CenterEnd,
customStyle: true,
......@@ -96,8 +61,6 @@ export struct WzStatus {
console.info('Click the callback in the blank area')
}
build() {
Column() {
TitleBar({ title: "物资状态" })
......@@ -106,8 +69,9 @@ export struct WzStatus {
Column() {
Text('完成:' + this.finishNum + '个' + ' 未完成:' + this.unFinishNum + '个').fontSize(13)
}
Column() {
Text('数量:'+ this.numberPercentage).fontSize(13)
Text('数量:' + this.numberPercentage).fontSize(13)
}
}
.width('100%')
......@@ -123,8 +87,8 @@ export struct WzStatus {
ListItem() {
Row() {
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center }) {
Text('名称: ' ).fontSize(14).fontColor('#3b4144')
Text('代码: ').fontSize(14).fontColor('#3b4144')
Text('名称: ' + item.wzpm).fontSize(14).fontColor('#3b4144')
Text('代码: ' + item.pmdmSix).fontSize(14).fontColor('#3b4144')
Button('号型信息').CommonButtonStyle()
}
.width('70%')
......@@ -132,10 +96,21 @@ export struct WzStatus {
Blank()
.layoutWeight(1)
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Start }) {
Flex({
direction: FlexDirection.Column,
justifyContent: FlexAlign.Center,
alignItems: ItemAlign.Start
}) {
Text('凭证数量: ' + item.pzsl).fontSize(14).fontColor('#3b4144')
Text('入库数量: ' + item.crksl).fontSize(14).fontColor('#3b4144')
// Text(item.status).fontSize(14).fontColor( item.status == '未完成' ? 'red': 'green')
if(item.wczt == '未完成' && item.crksl < item.pzsl) {
Text('未完成').fontSize(14).fontColor('red')
} else {
Text('完成').fontSize(14).fontColor( 'green')
}
}
.width('40%')
......@@ -145,10 +120,10 @@ export struct WzStatus {
.padding({ left: 12, right: 18 })
}
.height(90)
.onClick((item) => {
.onClick(() => {
this.currentItem = item
if (this.dialogController != undefined) {
this.dialogController.open()
this.DetailBuilder()
}
})
})
......@@ -158,8 +133,6 @@ export struct WzStatus {
.divider({ strokeWidth: 1, color: 'rgb(242,242,242)' }) // 每行之间的分界线
}.margin({ bottom: 50 })
}.padding({ bottom: 20, left: 20, right: 20 })
}
.height('100%')
......@@ -169,5 +142,4 @@ export struct WzStatus {
colors: [['#36a3c0', 0.0], ['#97c6a6', 1.0], ['#c7d799', 2.0]]
})
}
}
\ No newline at end of file
......@@ -17,6 +17,8 @@ import wzcrkModel from '../../../model/WzcrkModel'
import { Bggl } from '@ohos/common/src/main/ets/entity/Bggl'
import bgglModel from '../../../model/BgglModel'
import wzdmModel from '../../../model/WzdmModel'
import drModel from '../../../model/DrModel'
import { DrInfo } from '@ohos/common/src/main/ets/entity/DrInfo'
@Extend(Button) function CommonButtonStyle() {
.borderWidth(2)
......@@ -38,6 +40,7 @@ export struct Pmhx {
@State content: string = ''
@State showProgress: boolean = false
@State dwguid: string = '' // 单位代码
@State drData: DrInfo[] = [] // 导入数据
dialogController: CustomDialogController = new CustomDialogController({
builder: TipDialog({
......@@ -74,6 +77,17 @@ export struct Pmhx {
console.log("onSubmit")
}
aboutToAppear(){
this.getDrData()
}
// 获取导入数据
async getDrData() {
const res = await drModel.query()
this.drData = res
Logger.info('基础信息数据(内部网络导入)>>', JSON.stringify(res))
}
async handleClick(item) {
switch (item.title) {
......@@ -97,10 +111,10 @@ export struct Pmhx {
await kfModel.set(ckkfList)
// 区域添加
// await qyModel.set(qyList)
await qyModel.set(qyList)
// 货架添加
// await hjModel.set(hjList)
await hjModel.set(hjList)
// 货位添加
await hwModel.set(hwList)
......@@ -108,6 +122,11 @@ export struct Pmhx {
// 添加管理单位
await gldwModel.set(ddwAndJw)
await drModel.set('基础信息数据(内部网络导入)')
this.getDrData()
promptAction.showToast({
message: '同步数据成功'
})
......@@ -129,15 +148,18 @@ export struct Pmhx {
// 在这里执行对每个元素的操作
return {
...row,
sjlx:"导入",
wczt:"未完成",
sjlx: "导入",
wczt: "未完成",
};
});
wzcrkModel.set(mappedRows)
await wzcrkModel.set(mappedRows)
await drModel.set('单据信息数据(内部网络导入)')
this.getDrData()
promptAction.showToast({
message: '同步数据成功'
})
}catch (error) {
} catch (error) {
promptAction.showToast({
message: '同步数据失败'
})
......@@ -153,10 +175,12 @@ export struct Pmhx {
// 获取临时区库存数据
const lsqData = JSON.parse(res)
await hwModel.set(lsqData)
await drModel.set('临时区库存数据(内部网络导入)')
this.getDrData()
promptAction.showToast({
message: '同步数据成功'
})
}catch (error) {
} catch (error) {
promptAction.showToast({
message: '同步数据失败'
})
......@@ -173,10 +197,12 @@ export struct Pmhx {
// 获取包裹数据
const bgData = JSON.parse(res) as Bggl[]
await bgglModel.set(bgData)
await drModel.set('订单导入(内部网络导入)')
this.getDrData()
promptAction.showToast({
message: '同步数据成功'
})
}catch (error) {
} catch (error) {
promptAction.showToast({
message: '同步数据失败'
})
......@@ -233,6 +259,16 @@ export struct Pmhx {
Text("当前数据导入版本:").fontSize(12).fontColor("#0fa983")
Text("暂无").fontSize(12).fontColor("#0fa983")
}
List(){
ForEach(this.drData,(item: DrInfo) => {
ListItem(){
Column(){
Text(item.filename).fontSize(11)
Text(item.time).fontSize(10).fontSize('#858383')
}
}
})
}
}.border({ width: 1, color: 0x0fa983, radius: 2, style: BorderStyle.Dotted })
.height("92%").width('92%').margin({ top: 12 })
}
......
......@@ -48,7 +48,7 @@ export struct Unit {
.placeholderColor(Color.Grey)
.placeholderFont({ size: 14, weight: 400 })
.textFont({ size: 14, weight: 400 })
.onSubmit((value) => {
.onChange((value) => {
this.clearData()
this.dwmc = value
this.getUnitList()
......
......@@ -32,7 +32,7 @@ export struct Warehouse {
.placeholderColor(Color.Grey)
.placeholderFont({ size: 14, weight: 400 })
.textFont({ size: 14, weight: 400 })
.onSubmit((value) => this.getWarehouseList(value))
.onChange((value) => this.getWarehouseList(value))
.borderRadius(5)
}.width('100%')
Column() {
......
......@@ -8,9 +8,7 @@ export struct LeftDialog {
build() {
Column() {
this.container()
}
.width('60%')
.height('100%')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论