refactor: 优化采购订单相关功能及代码结构
重构采购订单模块,包括以下改进: 1. 移除PurchaseOrderItemVo中冗余字段 2. 在ContractCtx中添加调试日志 3. 修改InventoryTabSkinContracts和PurchaseOrderTabSkinBillVoucher中的equals比较逻辑 4. 调整PurchaseOrderVo的税率字段类型并添加锁定标志 5. 修正FXML文件中的控制器路径 6. 优化InventoryStringConverter的toString方法格式 7. 在PurchaseBillVoucherItemService中添加凭证查询条件 8. 改进ContractRepairTasker的进度更新逻辑 9. 修复AbstContractRepairTasker中的子合同同步问题 10. 优化PurchaseOrderTabSkinItems的表格列显示 11. 添加InventoryCatalogStringConverter及相关缓存支持 12. 完善PurchaseBillVoucherService的查询逻辑 13. 增强ContractService的库存查询功能 14. 改进PurchaseOrderItemService的合同项查询逻辑 15. 为InventoryService添加缓存支持 16. 优化ContractTabSkinPurchaseOrders的员工列显示 17. 改进ContractTabSkinItemsV2的数量显示逻辑 18. 重构PurchaseOrderViewModel的数据绑定逻辑
This commit is contained in:
@@ -92,7 +92,7 @@ public class InventoryTabSkinContracts
|
||||
@Override
|
||||
public ParamUtils.Builder getSpecification(InventoryVo parent) {
|
||||
ParamUtils.Builder params = getSpecification();
|
||||
params.equals("inventory", parent);
|
||||
params.equals("inventory", parent.getId());
|
||||
return params;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,32 +5,36 @@ import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.controller.contract.AbstContractTableTabSkin;
|
||||
import com.ecep.contract.controller.contract.ContractWindowController;
|
||||
import com.ecep.contract.controller.inventory.InventoryWindowController;
|
||||
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
||||
import com.ecep.contract.controller.table.cell.AsyncUpdateTableCell;
|
||||
import com.ecep.contract.controller.table.cell.EmployeeTableCell;
|
||||
import com.ecep.contract.controller.table.cell.InventoryTableCell;
|
||||
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
|
||||
import com.ecep.contract.service.ContractItemService;
|
||||
import com.ecep.contract.service.InventoryService;
|
||||
import com.ecep.contract.service.PurchaseOrderItemService;
|
||||
import com.ecep.contract.util.FxmlPath;
|
||||
import com.ecep.contract.util.ParamUtils;
|
||||
import com.ecep.contract.vm.ContractItemComposeViewModel;
|
||||
import com.ecep.contract.vm.ContractItemViewModel;
|
||||
import com.ecep.contract.vm.InventoryViewModel;
|
||||
import com.ecep.contract.vo.ContractItemVo;
|
||||
import com.ecep.contract.vo.InventoryVo;
|
||||
|
||||
import com.ecep.contract.vo.PurchaseOrderItemVo;
|
||||
import javafx.application.Platform;
|
||||
import javafx.scene.control.ContextMenu;
|
||||
import javafx.scene.control.MenuItem;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.control.cell.TextFieldTableCell;
|
||||
import javafx.util.Callback;
|
||||
import javafx.util.StringConverter;
|
||||
import javafx.util.converter.CurrencyStringConverter;
|
||||
import javafx.util.converter.NumberStringConverter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@FxmlPath("/ui/contract/contract-tab-item-v2.fxml")
|
||||
public class ContractTabSkinItemsV2
|
||||
@@ -128,7 +132,7 @@ public class ContractTabSkinItemsV2
|
||||
taxPriceColumn.setCellFactory(TextFieldTableCell.forTableColumn(currencyStringConverter));
|
||||
|
||||
quantityColumn.setCellValueFactory(param -> param.getValue().getQuantity());
|
||||
quantityColumn.setCellFactory(TextFieldTableCell.forTableColumn(new NumberStringConverter(getLocale())));
|
||||
quantityColumn.setCellFactory(QuantityTableCell.forTableColumn(new NumberStringConverter(getLocale())));
|
||||
|
||||
taxAmountColumn.setCellValueFactory(param -> param.getValue().getTaxAmount());
|
||||
taxAmountColumn.setCellFactory(TextFieldTableCell.forTableColumn(currencyStringConverter));
|
||||
@@ -185,4 +189,26 @@ public class ContractTabSkinItemsV2
|
||||
showInOwner(InventoryWindowController.class, InventoryViewModel.from(inventory));
|
||||
});
|
||||
}
|
||||
|
||||
public static class QuantityTableCell extends AsyncUpdateTableCell<ContractItemViewModel, Number, PurchaseOrderItemVo> {
|
||||
public static Callback<TableColumn<ContractItemViewModel, Number>, TableCell<ContractItemViewModel, Number>> forTableColumn(NumberStringConverter stringConverter) {
|
||||
;
|
||||
return param -> new QuantityTableCell(stringConverter);
|
||||
}
|
||||
|
||||
public QuantityTableCell(NumberStringConverter stringConverter) {
|
||||
setService(SpringApp.getBean(PurchaseOrderItemService.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setLoadingText() {
|
||||
setText("-/" + getItem());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void asyncLoadAndUpdate() {
|
||||
double sum = getService().findAll(ParamUtils.equal("contractItem", this.getTableRow().getItem().getId().get()), Pageable.unpaged()).stream().mapToDouble(PurchaseOrderItemVo::getQuantity).sum();
|
||||
Platform.runLater(() -> setText(sum + "/" + getItem()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.ecep.contract.controller.tab;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.ecep.contract.ContractPayWay;
|
||||
import com.ecep.contract.controller.table.cell.EmployeeTableCell;
|
||||
import com.ecep.contract.util.FxmlPath;
|
||||
import com.ecep.contract.controller.contract.AbstContractTableTabSkin;
|
||||
import com.ecep.contract.controller.contract.ContractWindowController;
|
||||
@@ -70,17 +71,16 @@ public class ContractTabSkinPurchaseOrders
|
||||
idColumn.setCellValueFactory(param -> param.getValue().getId());
|
||||
codeColumn.setCellValueFactory(param -> param.getValue().getCode());
|
||||
|
||||
EmployeeStringConverter converter = getEmployeeStringConverter();
|
||||
table_makerColumn.setCellValueFactory(param -> param.getValue().getMaker());
|
||||
table_makerColumn.setCellFactory(CompanyTableCell.forTableColumn(getCompanyService()));
|
||||
table_makerColumn.setCellFactory(EmployeeTableCell.forTableColumn(getEmployeeService()));
|
||||
table_makerDateColumn.setCellValueFactory(param -> param.getValue().getMakerDate());
|
||||
table_makerDateColumn.setCellFactory(param -> new LocalDateTimeTableCell<>());
|
||||
table_verifierColumn.setCellValueFactory(param -> param.getValue().getMaker());
|
||||
table_verifierColumn.setCellFactory(CompanyTableCell.forTableColumn(getCompanyService()));
|
||||
table_verifierColumn.setCellFactory(EmployeeTableCell.forTableColumn(getEmployeeService()));
|
||||
table_verifierDateColumn.setCellValueFactory(param -> param.getValue().getVerifierDate());
|
||||
table_verifierDateColumn.setCellFactory(param -> new LocalDateTimeTableCell<>());
|
||||
table_closerColumn.setCellValueFactory(param -> param.getValue().getMaker());
|
||||
table_closerColumn.setCellFactory(CompanyTableCell.forTableColumn(getCompanyService()));
|
||||
table_closerColumn.setCellFactory(EmployeeTableCell.forTableColumn(getEmployeeService()));
|
||||
table_closerDateColumn.setCellValueFactory(param -> param.getValue().getCloserDate());
|
||||
table_closerDateColumn.setCellFactory(param -> new LocalDateTimeTableCell<>());
|
||||
|
||||
|
||||
@@ -77,15 +77,14 @@ public class AsyncUpdateTableCell<V, K, T extends IdentityEntity> extends javafx
|
||||
setText(null);
|
||||
return;
|
||||
}
|
||||
// if (isInitialized(itemId)) {
|
||||
// setText(format(itemId));
|
||||
// return;
|
||||
// }
|
||||
|
||||
setText("# " + itemId);
|
||||
setLoadingText();
|
||||
syncFuture = submit(this::asyncLoadAndUpdate);
|
||||
}
|
||||
|
||||
protected void setLoadingText() {
|
||||
setText("# " + getItem());
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查实体是否已初始化
|
||||
*
|
||||
@@ -126,15 +125,8 @@ public class AsyncUpdateTableCell<V, K, T extends IdentityEntity> extends javafx
|
||||
if (getItem() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if (getService() instanceof QueryService<T, ?> queryService) {
|
||||
// queryService.findById(getItem().getId());
|
||||
// queryService.asyncFindById(getItem().getId()).thenAccept(this::_updateEntity);
|
||||
// return;
|
||||
// }
|
||||
T entity = initialize();
|
||||
_updateEntity(entity);
|
||||
|
||||
}
|
||||
|
||||
private void _updateEntity(T entity) {
|
||||
|
||||
@@ -14,7 +14,7 @@ import lombok.NoArgsConstructor;
|
||||
public class InventoryTableCell<V> extends AsyncUpdateTableCell<V, Integer, InventoryVo> {
|
||||
/**
|
||||
* 创建单元格工厂
|
||||
*
|
||||
*
|
||||
* @param inventoryService 库存服务
|
||||
* @return 单元格工厂
|
||||
*/
|
||||
@@ -22,12 +22,12 @@ public class InventoryTableCell<V> extends AsyncUpdateTableCell<V, Integer, Inve
|
||||
InventoryService inventoryService) {
|
||||
return param -> new InventoryTableCell<>(inventoryService);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建单元格工厂,支持自定义StringConverter
|
||||
*
|
||||
*
|
||||
* @param inventoryService 库存服务
|
||||
* @param converter 字符串转换器
|
||||
* @param converter 字符串转换器
|
||||
* @return 单元格工厂
|
||||
*/
|
||||
public static <V> Callback<javafx.scene.control.TableColumn<V, Integer>, javafx.scene.control.TableCell<V, Integer>> forTableColumn(
|
||||
@@ -57,7 +57,7 @@ public class InventoryTableCell<V> extends AsyncUpdateTableCell<V, Integer, Inve
|
||||
public String format(InventoryVo entity) {
|
||||
Integer catalogId = entity.getCatalogId();
|
||||
InventoryCatalogVo catalog = getInventoryCatalogService().findById(catalogId);
|
||||
return (catalog != null ? (catalog.getName() + " ") : "") + entity.getName();
|
||||
return (catalog != null ? (catalog.getName() + " ") : "") + entity.getName() + " " + entity.getSpecification();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -47,6 +47,9 @@ public class PurchaseOrderTabSkinBase
|
||||
initializeEmployeeField(controller.verifierField, viewModel.getVerifier());
|
||||
initializeEmployeeField(controller.closerField, viewModel.getCloser());
|
||||
|
||||
viewModel.getTaxRate();
|
||||
viewModel.getTaxRateLocked();
|
||||
|
||||
controller.makeDateField.textProperty().bind(viewModel.getMakerDate().map(MyDateTimeUtils::format));
|
||||
controller.verifierDateField.textProperty().bind(viewModel.getVerifierDate().map(MyDateTimeUtils::format));
|
||||
controller.modifierDateField.textProperty().bind(viewModel.getModifyDate().map(MyDateTimeUtils::format));
|
||||
@@ -59,7 +62,6 @@ public class PurchaseOrderTabSkinBase
|
||||
}
|
||||
|
||||
private void initializeEmployeeField(TextField textField, SimpleObjectProperty<Integer> property) {
|
||||
EmployeeStringConverter converter = getEmployeeStringConverter();
|
||||
UITools.autoCompletion(textField, property, controller.getEmployeeService());
|
||||
}
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ public class PurchaseOrderTabSkinBillVoucher
|
||||
|
||||
public Builder getSpecification(PurchaseOrderVo parent) {
|
||||
Builder params = getSpecification();
|
||||
params.equals("purchaseOrder", parent);
|
||||
params.equals("purchaseOrder", parent.getId());
|
||||
return params;
|
||||
}
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ public class PurchaseOrderTabSkinItems
|
||||
idColumn.setCellValueFactory(param -> param.getValue().getId());
|
||||
refIdColumn.setCellValueFactory(param -> param.getValue().getRefId());
|
||||
nameColumn.setCellValueFactory(param -> param.getValue().getInventory());
|
||||
nameColumn.setCellFactory(col -> new InventoryTableCell<>());
|
||||
nameColumn.setCellFactory(InventoryTableCell.forTableColumn(getInventoryService()));
|
||||
// unitColumn.setCellValueFactory(param -> param.getValue().getInventory());
|
||||
// unitColumn.setCellFactory(col -> new UnitTableCell());
|
||||
NumberCellFactory v1 = new NumberCellFactory("%,.1f", null);
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.ecep.contract.converter;
|
||||
|
||||
import com.ecep.contract.service.InventoryCatalogService;
|
||||
import com.ecep.contract.vo.InventoryCatalogVo;
|
||||
import javafx.util.StringConverter;
|
||||
|
||||
/**
|
||||
* 存货分类字符串转换器
|
||||
* 用于在UI组件中显示存货分类信息并支持从字符串还原存货分类对象
|
||||
*/
|
||||
public class InventoryCatalogStringConverter<T> extends StringConverter<InventoryCatalogVo> {
|
||||
|
||||
/** 存货分类服务,用于从字符串查找对应的存货分类对象 */
|
||||
private final InventoryCatalogService service;
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
*
|
||||
* @param service 存货分类服务实例
|
||||
*/
|
||||
public InventoryCatalogStringConverter(InventoryCatalogService service) {
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将存货分类对象转换为字符串表示
|
||||
*
|
||||
* @param object 存货分类对象
|
||||
* @return 存货分类的名称,如果对象为null则返回空字符串
|
||||
*/
|
||||
@Override
|
||||
public String toString(InventoryCatalogVo object) {
|
||||
return object == null ? "" : object.getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* 从字符串还原存货分类对象
|
||||
*
|
||||
* @param string 存货分类名称
|
||||
* @return 对应的存货分类对象,如果未找到则返回null
|
||||
*/
|
||||
@Override
|
||||
public InventoryCatalogVo fromString(String string) {
|
||||
return service.findByName(string);
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import javafx.util.StringConverter;
|
||||
* 用于在UI组件中显示存货信息并支持从字符串还原存货对象
|
||||
*/
|
||||
public class InventoryStringConverter extends StringConverter<InventoryVo> {
|
||||
|
||||
|
||||
/** 存货服务,用于从字符串查找对应的存货对象 */
|
||||
private final InventoryService service;
|
||||
|
||||
@@ -30,7 +30,7 @@ public class InventoryStringConverter extends StringConverter<InventoryVo> {
|
||||
*/
|
||||
@Override
|
||||
public String toString(InventoryVo object) {
|
||||
return object == null ? "" : (object.getName()+"-"+ object.getSpecification());
|
||||
return object == null ? "" : (object.getName() + "-" + object.getSpecification());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import com.ecep.contract.converter.InventoryCatalogStringConverter;
|
||||
import javafx.util.StringConverter;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.cache.annotation.Caching;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -9,7 +15,15 @@ import com.ecep.contract.vm.InventoryCatalogViewModel;
|
||||
import com.ecep.contract.vo.InventoryCatalogVo;
|
||||
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "inventory-catalog")
|
||||
public class InventoryCatalogService extends QueryService<InventoryCatalogVo, InventoryCatalogViewModel> {
|
||||
private StringConverter<InventoryCatalogVo> stringConverter = new InventoryCatalogStringConverter<>(this);
|
||||
|
||||
@Cacheable(key = "#p0")
|
||||
@Override
|
||||
public InventoryCatalogVo findById(Integer id) {
|
||||
return super.findById(id);
|
||||
}
|
||||
|
||||
public InventoryCatalogVo findByName(String name) {
|
||||
Page<InventoryCatalogVo> page = findAll(ParamUtils.builder().equals("name", name).build(), Pageable.ofSize(1));
|
||||
@@ -19,4 +33,24 @@ public class InventoryCatalogService extends QueryService<InventoryCatalogVo, In
|
||||
return page.getContent().getFirst();
|
||||
}
|
||||
|
||||
@Caching(evict = {
|
||||
@CacheEvict(key = "#p0.id")
|
||||
})
|
||||
@Override
|
||||
public InventoryCatalogVo save(InventoryCatalogVo entity) {
|
||||
return super.save(entity);
|
||||
}
|
||||
|
||||
@Caching(evict = {
|
||||
@CacheEvict(key = "#p0.id")
|
||||
})
|
||||
@Override
|
||||
public void delete(InventoryCatalogVo entity) {
|
||||
super.delete(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StringConverter<InventoryCatalogVo> getStringConverter() {
|
||||
return stringConverter;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,10 @@ import com.ecep.contract.converter.CustomerFileTypeStringConverter;
|
||||
import com.ecep.contract.converter.InventoryStringConverter;
|
||||
import com.ecep.contract.vo.CustomerFileTypeLocalVo;
|
||||
import javafx.util.StringConverter;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.cache.annotation.Caching;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -15,9 +19,11 @@ import com.ecep.contract.util.ParamUtils;
|
||||
import com.ecep.contract.vm.InventoryViewModel;
|
||||
import com.ecep.contract.vo.InventoryVo;
|
||||
|
||||
@CacheConfig(cacheNames = "inventory")
|
||||
@Service
|
||||
public class InventoryService extends QueryService<InventoryVo, InventoryViewModel> {
|
||||
private final StringConverter<InventoryVo> stringConverter = new InventoryStringConverter(this);
|
||||
|
||||
@Override
|
||||
public InventoryVo createNewEntity() {
|
||||
InventoryVo inventory = new InventoryVo();
|
||||
@@ -32,6 +38,12 @@ public class InventoryService extends QueryService<InventoryVo, InventoryViewMod
|
||||
throw new UnsupportedOperationException("Unimplemented method 'syncInventory'");
|
||||
}
|
||||
|
||||
@Cacheable(key = "#p0")
|
||||
@Override
|
||||
public InventoryVo findById(Integer id) {
|
||||
return super.findById(id);
|
||||
}
|
||||
|
||||
public InventoryVo findByCode(String code) {
|
||||
Page<InventoryVo> page = findAll(ParamUtils.builder().equals("code", code).build(), Pageable.ofSize(1));
|
||||
if (page.isEmpty()) {
|
||||
@@ -48,6 +60,22 @@ public class InventoryService extends QueryService<InventoryVo, InventoryViewMod
|
||||
return page.getContent().getFirst();
|
||||
}
|
||||
|
||||
@Caching(evict = {
|
||||
@CacheEvict(key = "#p0.id")
|
||||
})
|
||||
@Override
|
||||
public InventoryVo save(InventoryVo entity) {
|
||||
return super.save(entity);
|
||||
}
|
||||
|
||||
@Caching(evict = {
|
||||
@CacheEvict(key = "#p0.id")
|
||||
})
|
||||
@Override
|
||||
public void delete(InventoryVo entity) {
|
||||
super.delete(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StringConverter<InventoryVo> getStringConverter() {
|
||||
return stringConverter;
|
||||
|
||||
@@ -6,11 +6,7 @@ import java.util.Objects;
|
||||
|
||||
import com.ecep.contract.vo.PurchaseOrderVo;
|
||||
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.property.SimpleDoubleProperty;
|
||||
import javafx.beans.property.SimpleIntegerProperty;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.property.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@@ -20,13 +16,11 @@ public class PurchaseOrderViewModel extends IdentityViewModel<PurchaseOrderVo> {
|
||||
SimpleIntegerProperty refId = new SimpleIntegerProperty();
|
||||
SimpleObjectProperty<Integer> contractId = new SimpleObjectProperty<>();
|
||||
SimpleStringProperty code = new SimpleStringProperty();
|
||||
SimpleObjectProperty<LocalDate> orderDate = new SimpleObjectProperty<>();
|
||||
SimpleStringProperty vendorCode = new SimpleStringProperty();
|
||||
SimpleDoubleProperty totalAmount = new SimpleDoubleProperty();
|
||||
SimpleDoubleProperty taxAmount = new SimpleDoubleProperty();
|
||||
SimpleDoubleProperty taxRate = new SimpleDoubleProperty();
|
||||
SimpleIntegerProperty statusId = new SimpleIntegerProperty();
|
||||
SimpleStringProperty remark = new SimpleStringProperty();
|
||||
SimpleBooleanProperty active = new SimpleBooleanProperty();
|
||||
SimpleFloatProperty taxRate = new SimpleFloatProperty();
|
||||
SimpleBooleanProperty taxRateLocked = new SimpleBooleanProperty();
|
||||
// 保留原有的员工相关字段
|
||||
SimpleObjectProperty<Integer> employee = new SimpleObjectProperty<>();
|
||||
SimpleObjectProperty<Integer> maker = new SimpleObjectProperty<>();
|
||||
@@ -46,38 +40,23 @@ public class PurchaseOrderViewModel extends IdentityViewModel<PurchaseOrderVo> {
|
||||
getContractId().set(v.getContractId());
|
||||
}
|
||||
getCode().set(v.getCode());
|
||||
getVendorCode().set(v.getVendorCode());
|
||||
//
|
||||
getTotalAmount().set(v.getTotalAmount() != null ? v.getTotalAmount() : 0.0);
|
||||
getTaxAmount().set(v.getTaxAmount() != null ? v.getTaxAmount() : 0.0);
|
||||
getTaxRate().set(v.getTaxRate() != null ? v.getTaxRate() : 0.0);
|
||||
getTaxRate().set(v.getTaxRate());
|
||||
taxRateLocked.set(v.isTaxRateLocked());
|
||||
|
||||
// 保留原有的员工相关字段设置
|
||||
if (getEmployee() != null && getEmployee().get() != null) {
|
||||
getEmployee().set(getEmployee().get());
|
||||
}
|
||||
if (getMaker() != null && getMaker().get() != null) {
|
||||
getMaker().set(getMaker().get());
|
||||
}
|
||||
if (getVerifier() != null && getVerifier().get() != null) {
|
||||
getVerifier().set(getVerifier().get());
|
||||
}
|
||||
if (getCloser() != null && getCloser().get() != null) {
|
||||
getCloser().set(getCloser().get());
|
||||
}
|
||||
if (getMakerDate() != null && getMakerDate().get() != null) {
|
||||
getMakerDate().set(getMakerDate().get());
|
||||
}
|
||||
if (getModifyDate() != null && getModifyDate().get() != null) {
|
||||
getModifyDate().set(getModifyDate().get());
|
||||
}
|
||||
if (getVerifierDate() != null && getVerifierDate().get() != null) {
|
||||
getVerifierDate().set(getVerifierDate().get());
|
||||
}
|
||||
if (getCloserDate() != null && getCloserDate().get() != null) {
|
||||
getCloserDate().set(getCloserDate().get());
|
||||
}
|
||||
if (getDescription() != null && getDescription().get() != null) {
|
||||
getDescription().set(getDescription().get());
|
||||
}
|
||||
employee.set(v.getEmployeeId());
|
||||
maker.set(v.getEmployeeId());
|
||||
verifier.set(v.getVerifierId());
|
||||
closer.set(v.getCloserId());
|
||||
makerDate.set(v.getMakerDate());
|
||||
modifyDate.set(v.getModifyDate());
|
||||
verifierDate.set(v.getVerifierDate());
|
||||
closerDate.set(v.getCloserDate());
|
||||
description.set(v.getDescription());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -95,6 +74,10 @@ public class PurchaseOrderViewModel extends IdentityViewModel<PurchaseOrderVo> {
|
||||
v.setCode(code.get());
|
||||
modified = true;
|
||||
}
|
||||
if (!Objects.equals(vendorCode.get(), v.getVendorCode())) {
|
||||
v.setVendorCode(vendorCode.get());
|
||||
modified = true;
|
||||
}
|
||||
if (!Objects.equals(totalAmount.get(), v.getTotalAmount())) {
|
||||
v.setTotalAmount(totalAmount.get());
|
||||
modified = true;
|
||||
@@ -107,11 +90,48 @@ public class PurchaseOrderViewModel extends IdentityViewModel<PurchaseOrderVo> {
|
||||
v.setTaxRate(taxRate.get());
|
||||
modified = true;
|
||||
}
|
||||
if (!Objects.equals(taxRate.get(), v.getTaxRate())) {
|
||||
v.setTaxRate(taxRate.get());
|
||||
if (!Objects.equals(taxRateLocked.get(), v.isTaxRateLocked())) {
|
||||
v.setTaxRateLocked(taxRateLocked.get());
|
||||
modified = true;
|
||||
}
|
||||
|
||||
|
||||
if (!Objects.equals(getEmployee().get(), v.getEmployeeId())) {
|
||||
v.setEmployeeId(getEmployee().get());
|
||||
modified = true;
|
||||
}
|
||||
|
||||
if (!Objects.equals(getMaker().get(), v.getMakerId())) {
|
||||
v.setMakerId(getMaker().get());
|
||||
modified = true;
|
||||
}
|
||||
|
||||
if (!Objects.equals(getVerifier().get(), v.getVerifierId())) {
|
||||
v.setVerifierId(getVerifier().get());
|
||||
modified = true;
|
||||
}
|
||||
|
||||
if (!Objects.equals(getCloser().get(), v.getCloserId())) {
|
||||
v.setCloserId(getCloser().get());
|
||||
modified = true;
|
||||
}
|
||||
|
||||
|
||||
if (!Objects.equals(getMakerDate().get(), v.getMakerDate())) {
|
||||
v.setMakerDate(getMakerDate().get());
|
||||
modified = true;
|
||||
}
|
||||
|
||||
|
||||
if (!Objects.equals(getModifyDate().get(), v.getModifyDate())) {
|
||||
v.setModifyDate(getModifyDate().get());
|
||||
modified = true;
|
||||
}
|
||||
|
||||
if (!Objects.equals(getCloserDate().get(), v.getCloserDate())) {
|
||||
v.setCloserDate(getCloserDate().get());
|
||||
modified = true;
|
||||
}
|
||||
|
||||
if (!Objects.equals(description.get(), v.getDescription())) {
|
||||
v.setDescription(description.get());
|
||||
modified = true;
|
||||
|
||||
Reference in New Issue
Block a user