销售订单审核修改物料销售表
This commit is contained in:
		
							parent
							
								
									1cc6ae357d
								
							
						
					
					
						commit
						fd7c6b1f67
					
				|  | @ -0,0 +1,116 @@ | |||
| package nc.ui.so.m30.billui.action; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| 
 | ||||
| import nc.bs.framework.common.NCLocator; | ||||
| import nc.itf.bd.material.sale.IMaterialSaleService; | ||||
| import nc.itf.pubapp.pub.exception.IResumeException; | ||||
| import nc.md.persist.framework.IMDPersistenceQueryService; | ||||
| import nc.ui.pubapp.uif2app.AppUiState; | ||||
| import nc.ui.pubapp.uif2app.actions.pflow.ApproveScriptAction; | ||||
| import nc.ui.scmpub.util.ResumeExceptionUIProcessUtils; | ||||
| import nc.vo.bd.material.MaterialVO; | ||||
| import nc.vo.bd.material.sale.MaterialSaleVO; | ||||
| import nc.vo.pub.BusinessException; | ||||
| import nc.vo.pub.lang.UFDouble; | ||||
| import nc.vo.so.m30.entity.SaleOrderBVO; | ||||
| import nc.vo.so.m30.entity.SaleOrderVO; | ||||
| import nc.vo.so.pub.enumeration.BillStatus; | ||||
| import nccloud.framework.service.ServiceLocator; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| public class SaleOrderApproveAction | ||||
|   extends ApproveScriptAction | ||||
| { | ||||
|   protected boolean isActionEnable() { | ||||
|     Object[] seldatas = this.model.getSelectedOperaDatas(); | ||||
|      | ||||
|     if (this.model.getAppUiState() == AppUiState.NOT_EDIT && null != seldatas && seldatas.length > 1) | ||||
|     { | ||||
|       return true;  | ||||
|     } | ||||
|     Object selectedData = this.model.getSelectedData(); | ||||
|     Integer status = null; | ||||
|     if (null != selectedData && selectedData instanceof SaleOrderVO) { | ||||
|       SaleOrderVO selorder = (SaleOrderVO)selectedData; | ||||
|       status = selorder.getParentVO().getFstatusflag(); | ||||
|       String actionName = getFlowContext().getActionName(); | ||||
|       //销售订单审核通过之后同步修改物料销售表 | ||||
|       if(status == 2 && "APPROVE".equals(actionName) && this.enabled) { | ||||
|     	  updateMaterialBySaleOrder(selorder); | ||||
|       } | ||||
|        | ||||
|     }  | ||||
|     return (this.model | ||||
|       .getAppUiState() == AppUiState.NOT_EDIT && selectedData != null && (BillStatus.FREE | ||||
|        | ||||
|       .equalsValue(status) || BillStatus.AUDITING | ||||
|       .equalsValue(status))); | ||||
|   } | ||||
|      | ||||
|     /** | ||||
| 	     * 业务逻辑:销售订单子表的   cmaterialvid(物料编码)  和 pk_org(销售组织)   | ||||
| 	     * 去同步 这个物料销售表中相同销售组织(pk_org) 和物料编码(code)的 参考售价 | ||||
| 	*/ | ||||
|     protected void updateMaterialBySaleOrder(SaleOrderVO selorder) { | ||||
|     	//根据销售订单子表的物料编码和销售组织查询物料主表 | ||||
| 	  	SaleOrderBVO[] saleOrderitems =  selorder.getChildrenVO(); | ||||
| 			 //循环销售订单子表 | ||||
| 			 for(int i = 0; i < saleOrderitems.length; i++) { | ||||
| 				SaleOrderBVO item = saleOrderitems[i]; | ||||
| 				//取销售订单子表的物料编码和销售组织 | ||||
| 				String cmaterialvid = item.getCmaterialvid(); //物料主键 | ||||
| 				String pk_org = item.getPk_org(); //销售组织 | ||||
| 				UFDouble nqtorigprice = item.getNqtorigprice(); //无税单价 | ||||
| 				String whereSql = "nvl(bd_material.dr,0) = 0 and  bd_material.code = '" + cmaterialvid + "' and bd_material.pk_org = '" + pk_org + "'"; | ||||
| //				IMDPersistenceQueryService aggvoQueryService = ServiceLocator.find(IMDPersistenceQueryService.class); | ||||
| 				IMDPersistenceQueryService aggvoQueryService = NCLocator.getInstance().lookup(IMDPersistenceQueryService.class);	 | ||||
| 				// 条件查询得到物料MaterialSaleVO | ||||
| 				try { | ||||
| 					whereSql = "nvl(bd_materialsale.dr,0) = 0 and bd_materialsale.pk_material = '" + cmaterialvid + "' and bd_materialsale.pk_org = '" + pk_org + "'"; | ||||
| 					@SuppressWarnings("unchecked") | ||||
| 					ArrayList<MaterialSaleVO> materialSaleVOs = (ArrayList<MaterialSaleVO>)aggvoQueryService.queryBillOfVOByCond(MaterialSaleVO.class, whereSql, true, false); | ||||
| 					if(materialSaleVOs.size() <= 0) { | ||||
| 						continue; | ||||
| 					} | ||||
| 					for(MaterialSaleVO materialSaleVO : materialSaleVOs) { | ||||
| 						materialSaleVO.setResaleprice(nqtorigprice); | ||||
| 						//实体更新物料销售表 | ||||
| //							IMaterialSaleService iMaterialSaleService = ServiceLocator.find(IMaterialSaleService.class); | ||||
| 						IMaterialSaleService iMaterialSaleService = NCLocator.getInstance().lookup(IMaterialSaleService.class); | ||||
| 						iMaterialSaleService.updateMaterialSaleVO(materialSaleVO); | ||||
| 					} | ||||
| 				}catch(BusinessException e) { | ||||
| 					// TODO Auto-generated catch block | ||||
| 					e.printStackTrace(); | ||||
| 				} | ||||
| 			 } | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|    | ||||
|   protected boolean isResume(IResumeException resumeInfo) {  | ||||
| 	  return ResumeExceptionUIProcessUtils.isResume(resumeInfo, getFlowContext()); } | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| /* Location:              E:\project\taikai\ncchome\modules\so\client\li\\uiso_salesorder.jar!/nc/ui/so/m30/billui/action/SaleOrderApproveAction.class | ||||
|  * Java compiler version: 8 (52.0) | ||||
|  * JD-Core Version:       1.0.7 | ||||
|  */ | ||||
		Loading…
	
		Reference in New Issue