提交 41a5efaa 编写于 作者: misaka's avatar misaka

update

上级 fd39ecc2
......@@ -9,6 +9,7 @@ import cn.ibizlab.businesscentral.core.odoo_purchase.domain.Purchase_order;
import cn.ibizlab.businesscentral.core.odoo_purchase.domain.Purchase_requisition_line;
import cn.ibizlab.businesscentral.core.odoo_purchase.domain.Purchase_requisition_type;
import cn.ibizlab.businesscentral.core.odoo_purchase.service.impl.Purchase_requisitionServiceImpl;
import cn.ibizlab.businesscentral.util.dict.StaticDict;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import cn.ibizlab.businesscentral.core.odoo_purchase.domain.Purchase_requisition;
......@@ -69,7 +70,7 @@ public class Purchase_requisitionExService extends Purchase_requisitionServiceIm
}
log.warn("purchase_order");
et.setState("cancel");
et.setState(StaticDict.PURCHASE_REQUISITION__STATE.CANCEL.getValue());
this.update(et);
return super.action_cancel(et);
}
......@@ -85,7 +86,8 @@ public class Purchase_requisitionExService extends Purchase_requisitionServiceIm
public Purchase_requisition action_done(Purchase_requisition et) {
List<Purchase_order> orders = purchaseOrderService.selectByRequisitionId(et.getId());
for (Purchase_order order:orders ) {
if(StringUtils.compare(order.getState(),"draft")==0||StringUtils.compare(order.getState(),"sent")==0||StringUtils.compare(order.getState(),"to approve")==0){
if(StringUtils.compare(order.getState(),StaticDict.PURCHASE_ORDER__STATE.DRAFT.getValue())==0||StringUtils.compare(order.getState(), StaticDict.PURCHASE_ORDER__STATE.SENT.getValue()
)==0||StringUtils.compare(order.getState(),StaticDict.PURCHASE_ORDER__STATE.TO_APPROVE.getValue())==0){
throw new RuntimeException("关闭采购申请单前,你必须取消或批准每个RFQ采购订单。") ;
}
}
......@@ -100,7 +102,7 @@ public class Purchase_requisitionExService extends Purchase_requisitionServiceIm
}
log.warn("移除 line 关联 supplierinfo");
et.setState("done");
et.setState(StaticDict.PURCHASE_REQUISITION__STATE.DONE.getValue());
this.update(et);
return super.action_done(et);
}
......@@ -115,7 +117,7 @@ public class Purchase_requisitionExService extends Purchase_requisitionServiceIm
@Transactional
public Purchase_requisition action_draft(Purchase_requisition et) {
et.setName("New");
et.setState("draft");
et.setState(StaticDict.PURCHASE_REQUISITION__STATE.DRAFT.getValue());
this.update(et);
return super.action_draft(et);
}
......@@ -134,7 +136,7 @@ public class Purchase_requisitionExService extends Purchase_requisitionServiceIm
if (lines.size() == 0) {
throw new RuntimeException(String.format("没有明细行,无法确认此申请单 '%s'", et.getName()));
}
if (StringUtils.compare(et.getQuantityCopy(), "none") == 0 && et.getVendorId() != null) {
if (StringUtils.compare(et.getQuantityCopy(), StaticDict.PURCHASE_REQUISITION_TYPE__QUANTITY_COPY.NONE.getValue()) == 0 && et.getVendorId() != null) {
for (Purchase_requisition_line line : lines) {
if (line.getPriceUnit() <= 0) {
throw new RuntimeException("你无法确认没有单价的单一供应商采购申请单。");
......@@ -147,7 +149,7 @@ public class Purchase_requisitionExService extends Purchase_requisitionServiceIm
// 向product_supplierinfo表中添加供应商价格记录,在action_done行为时将这些记录删除
Purchase_requisition purchaseRequisition = this.baseMapper.selectById(line.getRequisitionId());
Purchase_requisition_type requisitionType = purchaseRequisitionTypeService.get(purchaseRequisition.getTypeId());
if(StringUtils.compare(requisitionType.getQuantityCopy(), "none") == 0 && purchaseRequisition.getVendorId() != null){
if(StringUtils.compare(requisitionType.getQuantityCopy(), StaticDict.PURCHASE_REQUISITION_TYPE__QUANTITY_COPY.NONE.getValue()) == 0 && purchaseRequisition.getVendorId() != null){
Product_supplierinfo supplierinfo = new Product_supplierinfo();
supplierinfo.setName(purchaseRequisition.getVendorId());
supplierinfo.setProductId(line.getProductId());
......@@ -163,13 +165,13 @@ public class Purchase_requisitionExService extends Purchase_requisitionServiceIm
}
log.warn("关联 create_supplier_info");
}
et.setState("ongoing");
et.setState(StaticDict.PURCHASE_REQUISITION__STATE.ONGOING.getValue());
} else {
et.setState("in_progress");
et.setState(StaticDict.PURCHASE_REQUISITION__STATE.IN_PROGRESS.getValue());
}
if (StringUtils.compare(et.getName(), "New") == 0) {
Ir_sequence sequence = new Ir_sequence();
if (StringUtils.compare(et.getQuantityCopy(), "none") != 0) {
if (StringUtils.compare(et.getQuantityCopy(), StaticDict.PURCHASE_REQUISITION_TYPE__QUANTITY_COPY.NONE.getValue()) != 0) {
sequence.setCode("purchase.requisition.purchase.tender");
} else {
sequence.setCode("purchase.requisition.blanket.order");
......@@ -198,7 +200,8 @@ public class Purchase_requisitionExService extends Purchase_requisitionServiceIm
@Override
public boolean remove(Long key) {
Purchase_requisition et = this.get(key);
if(StringUtils.compare(et.getState(),"draft")!=0||StringUtils.compare(et.getState(),"cancel")!=0){
if(StringUtils.compare(et.getState(),StaticDict.PURCHASE_REQUISITION__STATE.DRAFT.getValue())!=0||StringUtils.compare(et.getState(),StaticDict.PURCHASE_REQUISITION__STATE.CANCEL.getValue())!=0){
throw new RuntimeException("你只能删除草稿申请单。");
}
purchaseRequisitionLineService.removeByRequisitionId(key);
......@@ -217,7 +220,7 @@ public class Purchase_requisitionExService extends Purchase_requisitionServiceIm
et = this.get(et.getId());
//采购订单
if (StringUtils.compare(et.getState(), "draft") == 0) {
if (StringUtils.compare(et.getState(), StaticDict.PURCHASE_REQUISITION__STATE.DRAFT.getValue()) == 0) {
et.setOrderCount(0);
} else {
Purchase_order order = new Purchase_order();
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册