Commit 75d4e02c by 毛勇泽

出库与入库顺序互换

parent b3354329
...@@ -24,6 +24,7 @@ export {KfInfo} from './src/main/ets/entity/KfInfo' ...@@ -24,6 +24,7 @@ export {KfInfo} from './src/main/ets/entity/KfInfo'
export {QyInfo} from './src/main/ets/entity/QyInfo' export {QyInfo} from './src/main/ets/entity/QyInfo'
export {Gldw} from './src/main/ets/entity/Gldw'; export {Gldw} from './src/main/ets/entity/Gldw';
export {HjInfo} from './src/main/ets/entity/HjInfo'; export {HjInfo} from './src/main/ets/entity/HjInfo';
export {WzPositionClass} from './src/main/ets/entity/WzPositionClass';
export {WzdmDao} from './src/main/ets/db/dao/WzdmDao'; export {WzdmDao} from './src/main/ets/db/dao/WzdmDao';
export {WzhxdmDao} from './src/main/ets/db/dao/WzhxdmDao'; export {WzhxdmDao} from './src/main/ets/db/dao/WzhxdmDao';
export {Wzdm} from './src/main/ets/entity/Wzdm'; export {Wzdm} from './src/main/ets/entity/Wzdm';
...@@ -34,3 +35,5 @@ export {Wzcrkmx} from './src/main/ets/entity/Wzcrkmx'; ...@@ -34,3 +35,5 @@ export {Wzcrkmx} from './src/main/ets/entity/Wzcrkmx';
export {DsRfid} from './src/main/ets/entity/DsRfid'; export {DsRfid} from './src/main/ets/entity/DsRfid';
export {DsRfidDao} from './src/main/ets/db/dao/DsRfidDao'; export {DsRfidDao} from './src/main/ets/db/dao/DsRfidDao';
export {pzlx_dict,szlx_dict,new_zmlx_dict} from './src/main/ets/utils/dict'; export {pzlx_dict,szlx_dict,new_zmlx_dict} from './src/main/ets/utils/dict';
export {SearchData} from './src/main/ets/bean/dto/SearchData';
export {WzPositionInfo} from './src/main/ets/bean/dto/WzPositionInfo';
\ No newline at end of file
export interface SearchData{
pmdmcode?:string;
wzpm?: string;
gldwguid?: string;
kfguid?: string;
zmlx?: string
}
\ No newline at end of file
export class WzPositionInfo{
wzpm?:string
pmdmcode?:string
hxmc?:string
pmdmSix?:string
SY?:number
YL?:number
ZS?:number
total?:number
}
\ No newline at end of file
import relationalStore from '@ohos.data.relationalStore'; import relationalStore from '@ohos.data.relationalStore';
import { HwInfo } from '../../entity/HwInfo'; import { HwInfo } from '../../entity/HwInfo';
import { WzPositionClass } from '../../entity/WzPositionClass';
import { Logger } from '../../utils/Logger';
import BaseTable, { ValueType } from '../BaseTable'; import BaseTable, { ValueType } from '../BaseTable';
import { Table } from '../decorator/Decorators'; import { Table } from '../decorator/Decorators';
import { NativeSql } from '../sql/NativeSql'; import { NativeSql } from '../sql/NativeSql';
import {WzPositionInfo} from '../../bean/dto/WzPositionInfo'
/** /**
...@@ -59,4 +62,163 @@ export class HwInfoDao extends BaseTable<HwInfo> { ...@@ -59,4 +62,163 @@ 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 selectPositionList(searchData?: any): Promise<WzPositionClass[]> {
try {
Logger.info(this,"查询参数",JSON.stringify(searchData))
let val_sql = NativeSql.getWzcshPageSql(searchData) ;
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.toWzPosition(rs))
} while (rs.goToNextRow())
}
console.log('查询SQL结果=' + JSON.stringify(items))
return items;
}catch (err){
console.log("查询报错==》"+JSON.stringify(err))
}
}
async getLsqPageSql(searchData?: any): Promise<WzPositionInfo[]> {
try {
Logger.info(this,"查询参数",JSON.stringify(searchData))
let val_sql = NativeSql.getLsqPageSql(searchData) ;
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.toWzPositionInfo(rs))
} while (rs.goToNextRow())
}
console.log('查询SQL结果=' + JSON.stringify(items))
return items;
}catch (err){
console.log("查询报错==》"+JSON.stringify(err))
}
}
async getLsqPageSqlNum(searchData?: any): Promise<WzPositionInfo[]> {
try {
Logger.info(this,"查询参数",JSON.stringify(searchData))
let val_sql = NativeSql.getLsqPageSqlNum(searchData) ;
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.toWzTotalInfo(rs))
} while (rs.goToNextRow())
}
console.log('查询SQL结果=' + JSON.stringify(items))
return items;
}catch (err){
console.log("查询报错==》"+JSON.stringify(err))
}
}
async getLsqPageSqlTotal(searchData?: any): Promise<WzPositionInfo[]> {
try {
Logger.info(this,"查询参数",JSON.stringify(searchData))
let val_sql = NativeSql.getLsqPageSqlTotal(searchData) ;
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.toWzPmTotalInfo(rs))
} while (rs.goToNextRow())
}
console.log('查询SQL结果=' + JSON.stringify(items))
return items;
}catch (err){
console.log("查询报错==》"+JSON.stringify(err))
}
}
async getHXpageSql(searchData?: any): Promise<WzPositionInfo[]> {
try {
Logger.info(this,"查询参数",JSON.stringify(searchData))
let val_sql = NativeSql.getHXpageSql(searchData) ;
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))
}
}
/**
* 转换
*/
toWzPosition(cursor: relationalStore.ResultSet): WzPositionClass {
let info: WzPositionClass = {
guid: cursor.getString(cursor.getColumnIndex('guid')),
hxmc: cursor.getString(cursor.getColumnIndex('hxmc')),
pmdmcode: cursor.getString(cursor.getColumnIndex('pmdmcode')),
wzpm: cursor.getString(cursor.getColumnIndex('wzpm')),
hwh: cursor.getString(cursor.getColumnIndex('hwh')),
hwsl: cursor.getLong(cursor.getColumnIndex('hwsl'))
};
return info;
}
/**
* 转换
*/
toWzPositionInfo(cursor: relationalStore.ResultSet): WzPositionInfo {
let info: WzPositionInfo = {
wzpm: cursor.getString(cursor.getColumnIndex('wzpm')),
pmdmSix: cursor.getString(cursor.getColumnIndex('pmdmSix')),
SY: cursor.getLong(cursor.getColumnIndex('SY')),
YL: cursor.getLong(cursor.getColumnIndex('YL')),
ZS: cursor.getLong(cursor.getColumnIndex('ZS'))
};
return info;
}
/**
* 转换
*/
toWzTotalInfo(cursor: relationalStore.ResultSet): WzPositionInfo {
let info: WzPositionInfo = {
SY: cursor.getLong(cursor.getColumnIndex('SY')),
YL: cursor.getLong(cursor.getColumnIndex('YL')),
ZS: cursor.getLong(cursor.getColumnIndex('ZS'))
};
return info;
}
/**
* 转换
*/
toWzPmTotalInfo(cursor: relationalStore.ResultSet): WzPositionInfo {
let info: WzPositionInfo = {
total: cursor.getLong(cursor.getColumnIndex('total'))
};
return info;
}
/**
* 转换
*/
toWzHXPositionInfo(cursor: relationalStore.ResultSet): WzPositionInfo {
let info: WzPositionInfo = {
hxmc: cursor.getString(cursor.getColumnIndex('hxmc')),
pmdmcode: cursor.getString(cursor.getColumnIndex('pmdmcode')),
SY: cursor.getLong(cursor.getColumnIndex('SY')),
YL: cursor.getLong(cursor.getColumnIndex('YL'))
};
return info;
}
} }
\ No newline at end of file
...@@ -444,4 +444,68 @@ export class NativeSql { ...@@ -444,4 +444,68 @@ export class NativeSql {
LEFT JOIN TAB_XTWH_JCSJ_WZDM wzdm ON wzdm.HXDM = mx.PMDMCODE `; LEFT JOIN TAB_XTWH_JCSJ_WZDM wzdm ON wzdm.HXDM = mx.PMDMCODE `;
return sql_val; return sql_val;
} }
/*落位物资统计*/
static getWzcshPageSqlTotal(params?: any): string {
var sql =
`select count (pmdmcode) as total from tab_bzgl_knzy_app_hwb hw left join tab_xtwh_jcsj_bzhx hx on hw.pmdmcode = hx.pmdmten where`
var ord =
` hw.pmdmcode is not null and hw.pmdmcode != '' and hw.hwh !='LS-1-1-1' and hw.gldwguid = ${params.gldwguid} and hw.kfguid = ${params.kfguid} and hw.zmlx = ${params.zmlx}`
var wzpmStr =
` hx.wzpm like ${params.wzpm} and`
if (params.wzpm) {
return sql + wzpmStr + ord
} else {
return sql + ord
}
}
/*物资落位*/
static getWzcshPageSql(params?: any): string {
const common =
`select * from ( select hx.pmdmsix, hx.wzpm, hx.hxmc, hw.hwsl, hw.hwh, hw.guid ,hw.pmdmcode from tab_bzgl_knzy_app_hwb hw left join tab_xtwh_jcsj_bzhx hx on hw.pmdmcode = hx.pmdmten where hw.pmdmcode is not null and hw.pmdmcode != '' and hx.pmdmsix is not null and hw.hwh !='LS-1-1-1' and hw.gldwguid = ${params.gldwguid} and hw.kfguid = ${params.kfguid} and hw.zmlx = ${params.zmlx}`
const wzpm = ` and ( hx.wzpm like ${params.wzpm} )`
const paging = ` order by hw.pmdmcode )`;
if (params.wzpm) {
return common + wzpm + paging
} else {
return common + paging
}
}
/*获取落位物资品种总数*/
static getLsqPageSqlTotal(params?: any): string {
const sql1 =
`SELECT count(pmdmsix) as total from (SELECT hx.pmdmsix, hx.wzpm,sum(hw.hwsl) hwsl,(case when hwh ='LS-1-1-1' then 'LS' else 'LW' end ) LX FROM tab_bzgl_knzy_app_hwb hw INNER JOIN TAB_BZGL_KNZY_APP_HJB hj ON hj.guid = hw.hjguid INNER JOIN TAB_BZGL_KNZY_APP_QYB qy ON qy.guid = hj.qyguid LEFT JOIN tab_xtwh_jcsj_bzhx hx ON hw.pmdmcode = hx.pmdmten WHERE hw.pmdmcode IS NOT NULL AND hw.hwsl IS NOT NULL AND hw.gldwguid = ${params.gldwguid} AND hw.kfguid = ${params.kfguid} AND hw.zmlx = ${params.zmlx}`
const sql2 = ` AND (hx.wzpm like ${params.wzpm})`
const sql3 =
` GROUP BY hx.pmdmsix, hx.wzpm) `
if (params.wzpm) {
return sql1 + sql2 + sql3
} else {
return sql1 + sql3
}
}
/*获取落位物资总数*/
static getLsqPageSqlNum(params?: any): string {
const sql1 =
`SELECT sum(case when lx ='LS' then hjsl else 0 end) SY , sum(case when lx ='LW' then hjsl else 0 end) YL, sum(hjsl) ZS from ( SELECT sum(hw.hwsl) AS hjsl,(case when hwh ='LS-1-1-1' then 'LS' else 'LW' end ) LX FROM tab_bzgl_knzy_app_hwb hw INNER JOIN TAB_BZGL_KNZY_APP_HJB hj ON hj.guid = hw.hjguid INNER JOIN TAB_BZGL_KNZY_APP_QYB qy ON qy.guid = hj.qyguid WHERE ifnull(hw.pmdmcode, '') != '' AND hw.gldwguid = ${params.gldwguid} AND hw.kfguid = ${params.kfguid} AND hw.zmlx = ${params.zmlx} group by (case when hwh ='LS-1-1-1' then 'LS' else 'LW' end ))`
return sql1
}
/**
**临时区物资查询
*/
static getLsqPageSql(params?: any):string{
const sql1 =
`SELECT * FROM (SELECT pmdmsix ,wzpm ,sum(case when lx ='LS' then hwsl else 0 end) SY ,sum(case when lx ='LW' then hwsl else 0 end) YL,sum(hwsl) ZS from (SELECT hx.pmdmsix, hx.wzpm,sum(hw.hwsl) hwsl,(case when hwh ='LS-1-1-1' then 'LS' else 'LW' end ) LX FROM tab_bzgl_knzy_app_hwb hw INNER JOIN TAB_BZGL_KNZY_APP_HJB hj ON hj.guid = hw.hjguid INNER JOIN TAB_BZGL_KNZY_APP_QYB qy ON qy.guid = hj.qyguid LEFT JOIN tab_xtwh_jcsj_bzhx hx ON hw.pmdmcode = hx.pmdmten WHERE hw.pmdmcode IS NOT NULL AND hw.hwsl IS NOT NULL AND hw.gldwguid = ${params.gldwguid} AND hw.kfguid = ${params.kfguid} AND hw.zmlx = ${params.zmlx}`
const sql2 = ` AND (hx.wzpm like ${params.wzpm})`
const sql3 =
` GROUP BY hx.pmdmsix, hx.wzpm, (case when hwh ='LS-1-1-1' then 'LS' else 'LW' end )) group by pmdmsix ,wzpm order by pmdmsix )`
if (params.wzpm) {
return sql1 + sql2 + sql3
} else {
return sql1 + sql3
}
}
static getHXpageSql(params?: any):string{
const sql=`select hw.pmdmcode, hx.hxmc, sum (case when hw.hwh='LS-1-1-1' then ifnull (hw.hwsl,0) +0 else 0 end) SY,sum (case when hw.hwh != 'LS-1-1-1' then ifnull (hw.hwsl, 0) +0 else 0 end) YL from tab_bzgl_knzy_app_hwb hw inner join TAB_BZGL_KNZY_APP_HJB hj on hj.guid = hw.hjguid inner join TAB_BZGL_KNZY_APP_QYB gy on gy.guid = hj.qyguid left join TAB_XTWH_JCSJ_BZHX hx on hw.pmdmcode = hx.pmdmten where substr (hw.pmdmcode, 1, 6) = ${params.pmdmcode} and hw.kfguid = ${params.kfguid} and hw.gldwguid= ${params.gldwguid} and zmlx = ${params.zmlx} group by hw.pmdmcode, hx.hxmc`
return sql
}
} }
\ No newline at end of file
@Observed
export class WzPositionClass {
guid?: string
hwh?:string
wzpm?:string
pmdmcode?:string
hxmc?:string
hwsl?:number
// pmdmSix:string
// SY:number
// YL:number
// ZS:number
}
\ No newline at end of file
import { HwInfo, SQLiteContext, HwInfoDao } from '@ohos/common' import { HwInfo, SQLiteContext, HwInfoDao ,WzPositionClass,WzPositionInfo} from '@ohos/common'
// 货位管理 // 货位管理
class HwModel { class HwModel {
...@@ -23,6 +23,31 @@ class HwModel { ...@@ -23,6 +23,31 @@ class HwModel {
let res = await SQLiteContext.with(HwInfoDao).getselectHwList(kfguid) let res = await SQLiteContext.with(HwInfoDao).getselectHwList(kfguid)
return res; return res;
} }
// 查询落位物资
async selectPositionList(searchData?: any): Promise<WzPositionClass[]> {
let res = await SQLiteContext.with(HwInfoDao).selectPositionList(searchData)
return res;
}
// 查询落位物资
async getLsqPageSql(searchData?: any): Promise<WzPositionClass[]> {
let res = await SQLiteContext.with(HwInfoDao).getLsqPageSql(searchData)
return res;
}
// 查询落位物资
async getLsqPageSqlNum(searchData?: any): Promise<WzPositionInfo[]> {
let res = await SQLiteContext.with(HwInfoDao).getLsqPageSqlNum(searchData)
return res;
}
// 查询落位物资
async getLsqPageSqlTotal(searchData?: any): Promise<WzPositionInfo[]> {
let res = await SQLiteContext.with(HwInfoDao).getLsqPageSqlTotal(searchData)
return res;
}
// 查询落位物资
async getHXpageSql(searchData?: any): Promise<WzPositionInfo[]> {
let res = await SQLiteContext.with(HwInfoDao).getHXpageSql(searchData)
return res;
}
// 清空表 // 清空表
async clear() { async clear() {
await SQLiteContext.with(HwInfoDao).clearTable() await SQLiteContext.with(HwInfoDao).clearTable()
......
import { TitleBar } from '../../../../view/title/TitleBar'
import router from '@ohos.router'
import { Logger, KfInfo, Gldw, WzPositionClass,SearchData,WzPositionInfo} from '@ohos/common';
import hwModel from "../../../../model/HwModel"
@Entry
@Component
struct WzHxPositionTotalPage{
@State searchData: SearchData = {}
@State dataSource:WzPositionInfo[]=[]
onPageShow(){
this.searchData=router.getParams()["searchData"]
this.getHxPageList()
}
async getHxPageList(){
this.dataSource=await hwModel.getHXpageSql(this.searchData)
}
build() {
Column() {
TitleBar({ title: "物资状态" })
Flex({ direction: FlexDirection.Column }) {
Row() {
List({ space: 2 }) {
ForEach(this.dataSource, (item: WzPositionInfo) => {
ListItem() {
Row() {
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center }) {
Text('号型名称: ' + item.hxmc).fontSize(14).fontColor('#3b4144')
Text('品名代码: ' + item.pmdmcode).fontSize(14).fontColor('#3b4144')
}
.width('70%')
Blank()
.layoutWeight(1)
Flex({
direction: FlexDirection.Column,
justifyContent: FlexAlign.Center,
alignItems: ItemAlign.Start
}) {
Text('应落数: ' + String(item.SY)).fontSize(14).fontColor('#3b4144')
Text('落位数: ' + String(item.YL)).fontSize(14).fontColor('#3b4144')
}
.width('40%')
}
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
.padding({ left: 12, right: 18 })
}
.height(90)
.onClick(() => {
})
})
}
.width('100%')
.backgroundColor('#fff')
.divider({ strokeWidth: 1, color: 'rgb(242,242,242)' }) // 每行之间的分界线
}.margin({ bottom: 50 })
}.padding({ bottom: 20, left: 20, right: 20 })
}
.height('100%')
.linearGradient({
direction: GradientDirection.RightBottom,
repeating: true,
colors: [['#36a3c0', 0.0], ['#97c6a6', 1.0], ['#c7d799', 2.0]]
})
}
}
\ No newline at end of file
import { WzPositionClass} from '@ohos/common';
@Component
export struct WzPositionList {
@ObjectLink wzposition: WzPositionClass
build() {
Column() {
Flex({ justifyContent: FlexAlign.SpaceBetween}) {
Column() {
Row() {
Text('货位号:')
Text(this.wzposition.hwh)
}.alignSelf(ItemAlign.Start).padding({ top: 5, bottom: 5 })
Row() {
Text('品名:')
Text( this.wzposition.wzpm)
}.alignSelf(ItemAlign.Start).padding({ top: 5, bottom: 5 })
Row() {
Text('代码:')
Text( this.wzposition.pmdmcode)
}.alignSelf(ItemAlign.Start).padding({ top: 5, bottom: 5 })
}.width("50%").margin({ left: 15 })
Column() {
Row() {
Text('号型:')
Text(this.wzposition.hxmc)
}.alignSelf(ItemAlign.End).padding({ top: 5, bottom: 5 })
Row() {
Text('数量:')
Text(String(this.wzposition.hwsl)).fontSize(19).fontColor($r("app.color.title_background"))
}.alignSelf(ItemAlign.End).padding({ top: 5, bottom: 5 })
Row() {
Image($r('app.media.trash')).width(35)
}.alignSelf(ItemAlign.End)
}.width("50%").margin({ right: 10 })
}.width("100%").margin({ top: 10 }).border({ width: { bottom: '1lpx' }, color: "#717171" })
}.width('100%')
}
}
\ No newline at end of file
import { TitleBar } from '../../../../view/title/TitleBar'
import router from '@ohos.router'
import { Logger, KfInfo, Gldw, WzPositionClass,SearchData,WzPositionInfo} from '@ohos/common';
import hwModel from "../../../../model/HwModel"
@Entry
@Component
struct WzPositionTotalPage{
@State resTotal:any=[]
@State total:number=0
@State pmTotal:number=0 /*品名总数*/
@State syTotal:number=0 /*应落总数*/
@State ylTotal:number=0 /*已落总数*/
@State dataSource:WzPositionClass[]=[]
private searchcontroller: SearchController = new SearchController()
@State searchData: SearchData = {}
onPageShow(){
this.searchData=router.getParams()["searchData"]
this.getLsqPageSql()
}
async getLsqPageSql(){
if (this.searchData.gldwguid && this.searchData.kfguid && this.searchData.zmlx) {
this.dataSource = await hwModel.getLsqPageSql(this.searchData)
const res=await hwModel.getLsqPageSqlNum(this.searchData)
if(res!=undefined&&res.length>0){
this.syTotal=res[0].SY
this.ylTotal=res[0].YL
}
const totalres=await hwModel.getLsqPageSqlTotal(this.searchData)
if(totalres!=undefined&&totalres.length>0){
this.pmTotal=totalres[0].total
}
}
}
build() {
Column() {
TitleBar({ title: "物资状态" })
Flex({ direction: FlexDirection.Column }) {
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('100%')
.onSubmit((value: string) => {
})
.onChange((value: string) => {
this.searchData.wzpm = '%' + value + '%'
// this.getWzcrkList()
})
.borderRadius(5)
}
}.width("100%")
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
Column() {
Text('品名数:' + String(this.pmTotal) + '个').fontSize(19).fontColor($r("app.color.title_background"))
}
Column() {
Text('应落:' + String(this.syTotal) + '个').fontSize(20).fontColor($r("app.color.title_background"))
Text('已落:' + String(this.ylTotal) + '个').fontSize(20).fontColor($r("app.color.title_background")).padding({top:10})
}
}
.width('100%')
.backgroundColor('#fff')
.borderRadius(5)
.margin({ bottom: 10})
.padding({ left: 10, right: 10 ,top:5,bottom:5})
Row() {
List({ space: 2 }) {
ForEach(this.dataSource, (item: WzPositionInfo) => {
ListItem() {
Row() {
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center }) {
Text('名称: ' + item.wzpm).fontSize(14).fontColor('#3b4144')
Text('代码: ' + item.pmdmSix).fontSize(14).fontColor('#3b4144')
}
.width('70%')
Blank()
.layoutWeight(1)
Flex({
direction: FlexDirection.Column,
justifyContent: FlexAlign.Center,
alignItems: ItemAlign.Start
}) {
Text('应落: ' + String(item.SY)).fontSize(14).fontColor('#3b4144')
Text('已落: ' + String(item.YL)).fontSize(14).fontColor('#3b4144')
}
.width('40%')
}
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
.padding({ left: 12, right: 18 })
}
.height(90)
.onClick(() => {
this.searchData.pmdmcode="'"+item.pmdmSix+"'"
router.pushUrl({ url: 'pages/metailmange/WzPositionPage/WzPositionDetailPage/WzHxPositionTotalPage', params: {
searchData: this.searchData
} })
})
})
}
.width('100%')
.backgroundColor('#fff')
.divider({ strokeWidth: 1, color: 'rgb(242,242,242)' }) // 每行之间的分界线
}.margin({ bottom: 50 })
}.padding({ bottom: 20, left: 20, right: 20 })
}
.height('100%')
.linearGradient({
direction: GradientDirection.RightBottom,
repeating: true,
colors: [['#36a3c0', 0.0], ['#97c6a6', 1.0], ['#c7d799', 2.0]]
})
}
}
\ No newline at end of file
import { TitleBar } from '../../../view/title/TitleBar'
import router from '@ohos.router';
import { Logger, KfInfo, Gldw, WzPositionClass,SearchData } from '@ohos/common';
import { WzPositionList } from '../../metailmange/WzPositionPage/WzPositionDetailPage/WzPositionList';
import promptAction from '@ohos.promptAction';
import { dateUtils } from '@ohos/common/src/main/ets/utils/util';
import ViewdrdcModel from '../../../model/ViewdrdcModel';
import { importData } from '../Common/Wzcrk.api';
import { ExportOrderDialog } from '../../../view/ExportOrderDialog/ExportOrderDialog';
import { zmlx_dict } from '@ohos/common/src/main/ets/utils/dict'
import gldwModel from '../../../model/GldwModel'
import kfModel from '../../../model/KfModel'
import hwModel from "../../../model/HwModel"
@Extend(Button) function bottomBtnSty() {
.borderWidth(1)
.padding({ top: 1, bottom: 1, right: 7, left: 7 })
.borderColor('#0fa983')
.backgroundColor('#fff')
.fontColor('#0fa983')
.borderRadius(7)
.type(ButtonType.Normal)
.stateEffect(true)
}
@Entry
@Component
struct WzPositionPage {
@State fontColor: string = '#182431'
@State selectedFontColor: string = '#fff'
@State currentIndex: number = 0
@State dataSource: WzPositionClass[] = []
@State checkedList: Array<string> = []
@State radioChecked: boolean = true
@State searchData: SearchData = {
wzpm: '',
gldwguid: '',
kfguid: '',
zmlx: ''
}
@State gldwselectValue: Array<SelectOption> = []
@State kfselectValue: Array<SelectOption> = []
@State zmlxselectValue: Array<SelectOption> = []
private kfList: KfInfo[] = []
private dwList: Gldw[] = []
private searchcontroller: SearchController = new SearchController()
@Builder bottomButtons() {
Row() {
Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) {
Button("落位统计")
.bottomBtnSty()
.onClick(() => {
if (this.searchData.gldwguid && this.searchData.kfguid && this.searchData.zmlx) {
router.pushUrl({ url: 'pages/metailmange/WzPositionPage/WzPositionDetailPage/WzPositionTotalPage', params: {
searchData: this.searchData
} })
}else {
promptAction.showToast({
message: '请选择管理单位、库房、账目类型',
bottom: 200
})
}
})
.fontColor("#0fa983")
.fontSize("14vp")
Button("扫描落位")
.bottomBtnSty().fontColor("#0fa983").fontSize("14vp")
Button("导出结果数据包")
.bottomBtnSty()
.onClick(async () => {
}).fontColor("#0fa983").fontSize("14vp")
}
}.height(50)
}
@Builder exportContainer() {
Column() {
Text('请选择导出单据模式')
}.height(40)
}
exportDialogController: CustomDialogController = new CustomDialogController({
builder: ExportOrderDialog({
cancel: this.onExportCancel,
confirm: this.onExportSubmit,
checkedList: $checkedList,
dataSource: $dataSource,
container: this.exportContainer
}),
autoCancel: true,
alignment: DialogAlignment.Bottom,
customStyle: true
})
onExportCancel() {
}
onExportSubmit() {
this.checkedList.forEach(async element => {
let res = await ViewdrdcModel.queryExport({ guid: element, wczt: '已完成', pzlx: '17' })
const jhguidArr = res.map((item) => item.guid)
if (jhguidArr && jhguidArr.length > 0) {
const date = dateUtils.formatDateTime(new Date(), 'before')
const newArr = [...new Set(jhguidArr)]
const exportData = newArr.map((item) => {
let newObj = {}
let ItemData = []
res.forEach((Item) => {
if (item == Item.guid) {
ItemData.push({
jhmxguid: Item.jhmxguid,
hwh: Item.hwh,
pmdmcode: Item.pmdmcode,
wzdm: Item.wzdm,
pzsl: Item.pzsl || 0,
sjsl: Item.crksl || 0
})
}
})
const [filterData] = res.filter((fItem) => fItem
.guid == item)
if (filterData) {
newObj = {
cbdwdm: filterData.ckdwguid,
ckkfdm: filterData.kfdm,
...filterData,
crksl: ItemData.map(i => i.sjsl).reduce((a, b) => {
return a + b
}, 0),
scjid: "863576927543400,863576927543400",
cjmc: "普华",
imei: "863576927543400,863576927543400",
model: "ax6737_65_n",
vendor: "alps",
dcsj: date,
pzmx: ItemData
}
}
return newObj
})
const exportForm = {
pzzbJson: exportData,
crklx: '11111CRKLX2',
gznd: '2023',
jsdwguid: 1,
}
await importData(exportForm)
}
})
promptAction.showDialog({
title: '提示',
message: '出库作业单据已同步至业务系统,请以保管员身份登录业务系统,在菜单“作业项目——物资出库”里刷新查看。',
buttons: [{
text: '已知晓',
color: '#0fa983',
}],
})
}
@Builder renderEmpty() {
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
Column() {
Image($r("app.media.empty")).width("42%")
Text("暂无数据").fontSize(22).fontColor("#fff").margin({ top: 5 })
}
}.height('70%')
}
@Builder selectPopupView() {
Row() {
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
Select(this.gldwselectValue)
.value('管理单位')
.selected(0)
.borderWidth(1)
.borderRadius(6)
.height(42)
.borderColor("#454545")
.onSelect(async (index: number, value?: string) => {
this.searchData.gldwguid = this.dwList[index].guid
this.getPositionPage()
})
.width(100)
.margin({
right: 5
})
Select(this.kfselectValue)
.value('库房')
.selected(0)
.borderWidth(1)
.borderRadius(6)
.height(42)
.borderColor("#454545")
.onSelect(async (index: number, value?: string) => {
this.searchData.kfguid = this.kfList[index].guid
this.getPositionPage()
})
.width(100)
.margin({
right: 5
})
Select(this.zmlxselectValue)
.value('账目类型')
.selected(0)
.borderWidth(1)
.borderRadius(6)
.height(42)
.borderColor("#454545")
.onSelect(async (index: number, value?: string) => {
this.searchData.zmlx = "'"+zmlx_dict[index].value+"'"
this.getPositionPage()
})
.width(100)
.margin({
right: 5
})
}
}
.padding({ top: 15, bottom: 15, left: 5, right: 5 })
.backgroundColor("#fff")
.margin({ top: 10, left: 15, right: 15 })
}
async getScreenList() {
// 获取库房列表
this.kfList = await kfModel.query({})
// 获取单位列表
this.dwList = await gldwModel.queryByData({})
this.dwList.forEach(i => {
this.gldwselectValue.push({ value: i.dwfh })
})
this.kfList.forEach(i => {
this.kfselectValue.push({ value: i.kfmc })
})
zmlx_dict.forEach(i => {
this.zmlxselectValue.push({ value: i.text })
})
}
async getPositionPage() {
Logger.info("开始查询===》",JSON.stringify(this.searchData))
if (this.searchData.gldwguid && this.searchData.kfguid && this.searchData.zmlx) {
this.dataSource = await hwModel.selectPositionList(this.searchData)
}
}
aboutToAppear() {
this.getScreenList()
}
build() {
Column() {
Flex({ direction: FlexDirection.Column }) {
TitleBar({ title: "物资落位" })
this.selectPopupView()
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('100%')
.onSubmit((value: string) => {
})
.onChange((value: string) => {
this.searchData.wzpm = '%' + value + '%'
// this.getWzcrkList()
})
.borderRadius(5)
}
}.width("100%")
.padding('15vp')
// 列表
Column() {
if (this.dataSource.length == 0) {
this.renderEmpty()
} else {
List({ space: 2 }) {
ForEach(this.dataSource, (item) => {
ListItem() {
WzPositionList({ wzposition: item }).width('100%').backgroundColor('#fff')
}.onClick(() => {
router.pushUrl({ url: 'pages/metailmange/WzOutPage/WzOutDetail/WzOutDetail', params: {
wzcrk: item,
isUpdate: true
} })
})
})
}.padding(18)
}
}.flexGrow(1).alignSelf(ItemAlign.Center)
Row() {
// 底部按钮
this.bottomButtons();
}.backgroundColor("#97c6a6").width("100%").height(80)
}
}.linearGradient({
direction: GradientDirection.Right, // 渐变方向
repeating: true, // 渐变颜色是否重复
colors: [[0x36a3c0, 0.0], [0x97c6a6, 1], [0xc7d799, 0.0]] // 数组末尾元素占比小于1时满足重复着色效果
})
}
}
\ No newline at end of file
...@@ -12,12 +12,14 @@ ...@@ -12,12 +12,14 @@
"pages/metailmange/WzConversionPage", "pages/metailmange/WzConversionPage",
"pages/metailmange/WzConversionPage/WzConversionPage", "pages/metailmange/WzConversionPage/WzConversionPage",
"pages/metailmange/WzConversionPage/WzConversionDetailPage/WzConversionDetailPage", "pages/metailmange/WzConversionPage/WzConversionDetailPage/WzConversionDetailPage",
"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/WzinDetail/WzinDetail", "pages/metailmange/WzInPage/WzinDetail/WzinDetail",
"pages/metailmange/WzPositionPage", "pages/metailmange/WzPositionPage",
"pages/metailmange/WzPositionPage/WzPositionPage",
"pages/metailmange/WzPositionPage/WzPositionDetailPage/WzPositionTotalPage",
"pages/metailmange/WzPositionPage/WzPositionDetailPage/WzHxPositionTotalPage",
"pages/metailmange/WzReversePage", "pages/metailmange/WzReversePage",
"pages/metailmange/WzReversePage/WzReverseDetailPage/WzReverseDetailPage", "pages/metailmange/WzReversePage/WzReverseDetailPage/WzReverseDetailPage",
"pages/metailmange/WzReversePage/WzReversePage", "pages/metailmange/WzReversePage/WzReversePage",
......
...@@ -111,7 +111,7 @@ export struct MaterialManagement { ...@@ -111,7 +111,7 @@ export struct MaterialManagement {
break; break;
case "position": case "position":
router.pushUrl({ router.pushUrl({
url: "pages/metailmange/WzPositionPage", url: "pages/metailmange/WzPositionPage/WzPositionPage",
}) })
break; break;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论