Commit c6b98d6d by huangqy

出库列表的功能实现

parent 69e75a13
......@@ -124,19 +124,19 @@ export class WzcrkDao extends BaseTable<Wzcrk> {
async getWzcrk(data: Partial<Wzcrk>): Promise<Wzcrk[]> {
let wp = this.getPredicates();
// if (pzh) {
// wp.equalTo('PZH', pzh)
// }
// if (wczt) {
// wp.equalTo('WCZT', wczt)
// }
// wp.equalTo('CRKLX', crklx)
// wp.orderByAsc('PZH');
for (const [key, value] of Object.entries(data)) {
if (value) {
wp.equalTo(key, value)
}
if (data.pzh) {
wp.like('PZH', '%' + data.pzh + '%')
}
if (data.wczt) {
wp.equalTo('WCZT', data.wczt)
}
if (data.pzlx) {
wp.equalTo('PZLX', data.pzlx)
}
if (data.sjlx) {
wp.equalTo('SJLX', data.sjlx)
}
wp.orderByAsc('PZH');
return this.query(wp, this.getTableColumns());
}
......
......@@ -132,8 +132,7 @@ export struct WzInPage {
try{
this.checkedList.forEach(async (element)=>{
let num = await wzcrkModel.updateWzcrkWczt(element, (this.radioChecked == undefined || this.radioChecked ? '已完成' : '未完成'))
if(num){
Logger.info("删除的数据是:" + JSON.stringify(this.dataSource))
if(num) {
this.dataSource.splice(this.dataSource.findIndex(i => i.guid == element), 1)
}
})
......
......@@ -4,6 +4,12 @@ import wzcrkModel from '../../../model/WzcrkModel';
import { Logger } from '@ohos/common';
import { WzClass } from '../Common/Wzcrk.data';
import { WzList } from '../Common/WzcrkList';
import promptAction from '@ohos.promptAction';
import { SetStatusDialog } from '../../../view/SetStatusDialog/SetStatusDialog';
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';
@Extend(Button) function bottomBtnSty() {
.borderWidth(1)
......@@ -35,6 +41,8 @@ export struct WzOutPage {
}
private controller: TabsController = new TabsController()
private searchcontroller: SearchController = new SearchController()
@State defaultSelectValue: Array<SelectOption> = [{ value: "未完成" }, { value: "已完成" }]
@State selectValue: Array<SelectOption> = [{ value: "未完成" }, { value: "已完成" }, { value: "完成已绑定" }]
itemClick() {
router.pushUrl({url:'pages/order_detail/PzInOutDetailPage'})
......@@ -46,7 +54,8 @@ export struct WzOutPage {
async getWzcrkList(qzh?: number, wczt?: string) {
this.dataSource = []
const res = await wzcrkModel.query({ pzlx: "17",
const res = await wzcrkModel.query({
pzlx: "17",
pzh: Number(this.searchData.pzh),
wczt: this.searchData.wczt,
sjlx: this.currentIndex === 0 ? "导入" : "临时发物" })
......@@ -56,6 +65,151 @@ export struct WzOutPage {
Logger.info('数量是' + JSON.stringify(this.dataSource))
}
@Builder container() {
Column() {
Row() {
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Text('完成').margin({ left: 20 })
Radio({ value: 'Radio1', group: 'radioGroup' })
.checked(true)
.onChange((isChecked: boolean) => {
this.radioChecked = isChecked
}).margin({ right: 20 })
}
}.padding({ top: 10, bottom: 10 })
Divider().strokeWidth(1).color('rgb(242,242,242)')
Row() {
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Text('未完成').margin({ left: 20 })
Radio({ value: 'Radio2', group: 'radioGroup' })
.onChange((isChecked: boolean) => {
}).margin({ right: 20 })
}
}.padding({ top: 10, bottom: 10 })
Divider().strokeWidth(1).color('rgb(242,242,242)')
}
}
@Builder exportContainer() {
Column() {
Text('请选择导出单据模式')
}.height(40)
}
dialogController: CustomDialogController = new CustomDialogController({
builder: SetStatusDialog({
cancel: this.onCancel,
confirm: this.onSubmit,
checkedList: $checkedList,
dataSource: $dataSource,
container: this.container
}),
autoCancel: true,
alignment: DialogAlignment.Bottom,
customStyle: true
})
onCancel() {
console.info('------取消------')
}
onSubmit() {
try{
this.checkedList.forEach(async (element)=>{
let num = await wzcrkModel.updateWzcrkWczt(element, (this.radioChecked == undefined || this.radioChecked ? '已完成' : '未完成'))
if(num) {
this.dataSource.splice(this.dataSource.findIndex(i => i.guid == element), 1)
}
})
}catch(e){
}finally{
this.checkedList = []
}
}
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: '14'})
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 TabBuilder(index: number, name: string) {
Column() {
Text(name)
......@@ -83,12 +237,12 @@ export struct WzOutPage {
@Builder bottomButtons() {
Row() {
Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) {
Button("临时物")
.visibility(this.currentIndex === 1 ? Visibility.Visible:Visibility.None)
Button("临时物")
.visibility(this.currentIndex === 1 ? Visibility.Visible : Visibility.None)
.bottomBtnSty()
.onClick( () => {
.onClick(() => {
router.pushUrl({
url: "pages/metailmange/AddTemporaryOutPage",
url: "pages/metailmange/AddTemporaryInPage",
})
})
.fontColor("#0fa983")
......@@ -96,6 +250,15 @@ export struct WzOutPage {
Button("设置状态")
.bottomBtnSty()
.onClick(() => {
if (this.checkedList.length == 0) {
promptAction.showToast({
message: '请至少选择一条单据'
})
} else {
// if (this.dialogController != undefined) {
// this.dialogController.open()
// }
}
})
.fontColor("#0fa983")
.fontSize("14vp")
......@@ -113,37 +276,78 @@ export struct WzOutPage {
.visibility(this.currentIndex === 0 ? Visibility.Visible : Visibility.None)
.bottomBtnSty()
.onClick(() => {
}).fontColor("#0fa983") .fontSize("14vp")
if (this.checkedList.length == 0) {
promptAction.showToast({
message: '请至少选择一条单据'
})
} else if (this.dataSource.filter(i => i.wczt == '未完成').length > 0) {
promptAction.showToast({
message: '请选择已完成的单据'
})
} else {
// if (this.exportDialogController != undefined) {
// this.exportDialogController.open()
// }
}
}).fontColor("#0fa983").fontSize("14vp")
.fontColor("#0fa983")
.fontSize("14vp")
Button("全选")
.bottomBtnSty().fontColor("#0fa983") .fontSize("14vp")
.bottomBtnSty().fontColor("#0fa983").fontSize("14vp")
.onClick(() => {
this.checkedList = this.dataSource.map((item) => item.guid)
})
Button("清空选择")
.bottomBtnSty()
.onClick(() =>{
}).fontColor("#0fa983") .fontSize("14vp")
.onClick(() => {
this.checkedList = []
}).fontColor("#0fa983").fontSize("14vp")
}
}.height(80)
}
build(){
Column() {
Flex({direction:FlexDirection.Column}){
TitleBar({ title:"物资出库" })
Row(){
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }){
Search({ placeholder: '请输入凭证号',controller: this.searchcontroller })
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
Search({ placeholder: '请输入凭证号', controller: this.searchcontroller })
.height(40)
.backgroundColor('#F5F5F5')
.placeholderColor(Color.Grey)
.borderRadius(5)
.textAlign(TextAlign.Center)
.placeholderFont({ size: 14, weight: 400 })
.textFont({ size: 14, weight: 400 })
.width('100%')
.width('60%')
.onSubmit((value: string) => {
})
.onChange((value: string) => {
this.searchData.pzh = value
this.getWzcrkList()
})
}.height(40)
.borderRadius(5)
Select(this.currentIndex === 1 ? this.selectValue : this.defaultSelectValue)
.value('未完成')
.selected(0)
.borderWidth(1)
.borderRadius(6)
.height(42)
.margin({ left: 10 })
.borderColor("#454545")
.onSelect(async (index: number, value?: string) => {
if (value == this.searchData.wczt) {
} else {
this.searchData.wczt = value
this.getWzcrkList()
}
})
.width(120)
.padding({
right: 15
})
}
}.width("100%")
.padding('15vp')
Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
......@@ -160,7 +364,8 @@ export struct WzOutPage {
.onChange((index: number) => {
this.currentIndex = index
})
// 列表
// 列表
Column() {
......
......@@ -86,7 +86,7 @@ export struct MaterialManagement {
break;
case "out":
router.pushUrl({
url: "pages/metailmange/WzOutPage",
url: "pages/metailmange/WzOutPage/WzOutPage",
})
break;
case "exchange":
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论