提交 def64d9e 编写于 作者: yujiaming's avatar yujiaming

自定义行为更新

上级 dc185a8c
...@@ -65,6 +65,7 @@ public class Purchase_orderExService extends Purchase_orderServiceImpl { ...@@ -65,6 +65,7 @@ public class Purchase_orderExService extends Purchase_orderServiceImpl {
public Purchase_order button_cancel(Purchase_order et) { public Purchase_order button_cancel(Purchase_order et) {
// 获取凭证录入的ID组 // 获取凭证录入的ID组
List<Account_move_purchase_order_rel> accountMovePurchaseOrderRels = accountMovePurchaseOrderRelService.selectByPurchaseOrderId(et.getId()); List<Account_move_purchase_order_rel> accountMovePurchaseOrderRels = accountMovePurchaseOrderRelService.selectByPurchaseOrderId(et.getId());
// 这里应该为Long型,
List<String> accountMoveIds = new ArrayList(); List<String> accountMoveIds = new ArrayList();
for(Account_move_purchase_order_rel accountMovePurchaseOrderRel : accountMovePurchaseOrderRels){ for(Account_move_purchase_order_rel accountMovePurchaseOrderRel : accountMovePurchaseOrderRels){
accountMoveIds.add(accountMovePurchaseOrderRel.getAccountMoveId().toString()); accountMoveIds.add(accountMovePurchaseOrderRel.getAccountMoveId().toString());
...@@ -72,7 +73,7 @@ public class Purchase_orderExService extends Purchase_orderServiceImpl { ...@@ -72,7 +73,7 @@ public class Purchase_orderExService extends Purchase_orderServiceImpl {
// 通过凭证录入的ID获取对应的凭证记录 // 通过凭证录入的ID获取对应的凭证记录
List<Account_move> accountMoves = accountMoveService.getAccountMoveByIds(accountMoveIds); List<Account_move> accountMoves = accountMoveService.getAccountMoveByIds(accountMoveIds);
for(Account_move accountMove : accountMoves){ for(Account_move accountMove : accountMoves){
if(StringUtils.compare(accountMove.getState(),"cancel")==0|| StringUtils.compare(accountMove.getState(),"draft")==0){ if(StringUtils.compare(accountMove.getState(),"cancel")!=0|| StringUtils.compare(accountMove.getState(),"draft")!=0){
throw new RuntimeException("无法取消此采购订单。 您必须先取消相关的供应商账单。") ; throw new RuntimeException("无法取消此采购订单。 您必须先取消相关的供应商账单。") ;
} }
} }
...@@ -120,13 +121,16 @@ public class Purchase_orderExService extends Purchase_orderServiceImpl { ...@@ -120,13 +121,16 @@ public class Purchase_orderExService extends Purchase_orderServiceImpl {
// 判断是否将当前的供应商加入产品供应商信息表product_supplierinfo中 // 判断是否将当前的供应商加入产品供应商信息表product_supplierinfo中
if(line.getProductId() != null && condition2 && supplierinfos.size() <= 10){ if(line.getProductId() != null && condition2 && supplierinfos.size() <= 10){
// 获取币种currency // 获取币种currency
Res_currency Currency = new Res_currency(); // 获取当前订单公司所使用的币种
if(partner.getPropertyPurchaseCurrencyId() !=null && et.getCurrencyId() != null){ Res_company company = resCompanyService.get(line.getCompanyId());
Currency = resCurrencyService.getById(partner.getPropertyPurchaseCurrencyId()); // 获取当前供应商所使用的币种
}else if(partner.getPropertyPurchaseCurrencyId() !=null && et.getCurrencyId() == null){ Res_company partnerCompany = resCompanyService.get(partner.getCompanyId());
Currency = resCurrencyService.getById(partner.getPropertyPurchaseCurrencyId()); Res_currency currency = new Res_currency();
}else if(partner.getPropertyPurchaseCurrencyId() ==null && et.getCurrencyId() != null){ // 供应商使用的币种存在时就使用供应商的币种,否则使用订单公司的币种
Currency = resCurrencyService.getById(partner.getPropertyPurchaseCurrencyId()); if(partnerCompany.getCurrencyId() != null){
currency = resCurrencyService.get(partnerCompany.getCurrencyId());
}else{
currency = resCurrencyService.get(company.getCurrencyId());
} }
// 将price转换成当前所用币种的price,还未处理,需要调用Res_currency中的_convert()方法 // 将price转换成当前所用币种的price,还未处理,需要调用Res_currency中的_convert()方法
Double price = line.getPriceUnit(); Double price = line.getPriceUnit();
...@@ -168,13 +172,14 @@ public class Purchase_orderExService extends Purchase_orderServiceImpl { ...@@ -168,13 +172,14 @@ public class Purchase_orderExService extends Purchase_orderServiceImpl {
supplierinfo.setSequence(sequence); supplierinfo.setSequence(sequence);
supplierinfo.setMinQty(0.0); supplierinfo.setMinQty(0.0);
supplierinfo.setPrice(price); supplierinfo.setPrice(price);
supplierinfo.setCurrencyId(Currency.getId()); supplierinfo.setCurrencyId(currency.getId());
supplierinfo.setDelay(0); supplierinfo.setDelay(0);
// 按条件查找供应商 // 按条件查找供应商
// 未处理,需要调用product.py中的_select_seller()方法' // 未处理,需要调用product.py中的_select_seller()方法'
// Product_supplierinfo seller = ; // Product_supplierinfo seller = ;
/** /**
* _select_seller()方法
Long partnerId = line.getPartnerId(); Long partnerId = line.getPartnerId();
Double quantity = line.getProductQty(); Double quantity = line.getProductQty();
Timestamp date = et.getDateOrder(); Timestamp date = et.getDateOrder();
...@@ -185,16 +190,13 @@ public class Purchase_orderExService extends Purchase_orderServiceImpl { ...@@ -185,16 +190,13 @@ public class Purchase_orderExService extends Purchase_orderServiceImpl {
// precision,decimal_precision.py中的precision_get()方法 // precision,decimal_precision.py中的precision_get()方法
Integer precision = 3; Integer precision = 3;
// sellers = self._prepare_sellers(params) product.py中的_prepare_sellers()方法 // sellers = self._prepare_sellers(params) product.py中的_prepare_sellers()方法
List<Product_supplierinfo> sellers = productSupplierinfoService.select(); List<Product_supplierinfo> sellers = productSupplierinfoService.select();
for(Product_supplierinfo seller : sellers){ for(Product_supplierinfo seller : sellers){
Double quantityUomSeller = quantity; Double quantityUomSeller = quantity;
if(quantityUomSeller != 0.0 && uomId != null && uomId != seller.getProductUom()){ if(quantityUomSeller != 0.0 && uomId != null && uomId != seller.getProductUom()){
//调用uom_uom.py中的_compute_quantity()方法 //调用uom_uom.py中的_compute_quantity()方法
Uom_uom uom1 = uomService.get(uomId); Uom_uom uom1 = uomService.get(uomId);
Uom_uom uom2 = uomService.get(seller.getProductUom()); Uom_uom uom2 = uomService.get(seller.getProductUom());
if(uom1.getCategoryId() != uom2.getCategoryId()){ if(uom1.getCategoryId() != uom2.getCategoryId()){
if(true){ if(true){
...@@ -220,7 +222,6 @@ public class Purchase_orderExService extends Purchase_orderServiceImpl { ...@@ -220,7 +222,6 @@ public class Purchase_orderExService extends Purchase_orderServiceImpl {
if(partnerId != null && seller.getName() != partnerId && seller.getName() != resPartner.getParentId()) if(partnerId != null && seller.getName() != partnerId && seller.getName() != resPartner.getParentId())
continue; continue;
// float_compare()方法,float_utils.py中的 // float_compare()方法,float_utils.py中的
if(seller.getProductId() != null && ) if(seller.getProductId() != null && )
continue; continue;
} }
...@@ -246,12 +247,12 @@ public class Purchase_orderExService extends Purchase_orderServiceImpl { ...@@ -246,12 +247,12 @@ public class Purchase_orderExService extends Purchase_orderServiceImpl {
if( condition1 || condition2 || condition3){ if( condition1 || condition2 || condition3){
// 调用button_approve() // 调用button_approve()
et = this.button_approve(et); et = this.button_approve(et);
log.warn("button_approve()"); // log.warn("button_approve()");
}else{ }else{
et.setState("to approve"); et.setState("to approve");
} }
} }
this.update(et);
return super.button_confirm(et); return super.button_confirm(et);
} }
/** /**
...@@ -289,12 +290,13 @@ public class Purchase_orderExService extends Purchase_orderServiceImpl { ...@@ -289,12 +290,13 @@ public class Purchase_orderExService extends Purchase_orderServiceImpl {
@Transactional @Transactional
public Purchase_order get_name(Purchase_order et) { public Purchase_order get_name(Purchase_order et) {
// 当订单的name是new时自动为其创建一个name // 当订单的name是new时自动为其创建一个name
if(StringUtils.compare(et.getName(), "new") == 0){ if(StringUtils.compare(et.getName(), "New") == 0){
if(et.getDateOrder() != null){ if(et.getDateOrder() != null){
// sequence_date // sequence_date
Ir_sequence sequence = new Ir_sequence(); Ir_sequence sequence = new Ir_sequence();
sequenceService.get_next_by_code(sequence); sequenceService.get_next_by_code(sequence);
et.setName(sequence.getNextChar()); et.setName(sequence.getNextChar());
this.update(et);
} }
} }
return super.get_name(et); return super.get_name(et);
...@@ -312,7 +314,7 @@ public class Purchase_orderExService extends Purchase_orderServiceImpl { ...@@ -312,7 +314,7 @@ public class Purchase_orderExService extends Purchase_orderServiceImpl {
Timestamp dateApprove = new Timestamp(System.currentTimeMillis()); Timestamp dateApprove = new Timestamp(System.currentTimeMillis());
et.setDateApprove(dateApprove); et.setDateApprove(dateApprove);
this.update(et); this.update(et);
// 查找order中公司的po_lock状态为lock的order,改变状态为done,有疑问 // 查找order中公司的po_lock状态为lock的order,改变状态为done
Res_company resCompany = resCompanyService.get(et.getCompanyId()); Res_company resCompany = resCompanyService.get(et.getCompanyId());
if(StringUtils.compare(resCompany.getPoLock(), "lock") == 0){ if(StringUtils.compare(resCompany.getPoLock(), "lock") == 0){
et.setState("done"); et.setState("done");
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册