Ver Fonte

物料主辅计量单位换算率

pancy há 1 ano atrás
pai
commit
2fbd870d0d

+ 50 - 0
ic/ic/src/private/nc/bs/bd/pfxx/plugin/MaterialPfxxPlugin.java

@@ -13,7 +13,9 @@ import nc.itf.bd.material.assign.IMaterialAssignService;
 import nc.itf.bd.material.baseinfo.IMaterialBaseInfoService;
 import nc.itf.uap.IUAPQueryBS;
 import nc.jdbc.framework.SQLParameter;
+import nc.jdbc.framework.processor.ArrayProcessor;
 import nc.jdbc.framework.processor.BeanListProcessor;
+import nc.jdbc.framework.processor.ColumnProcessor;
 import nc.vo.bd.errorlog.ErrLogReturnValue;
 import nc.vo.bd.errorlog.ErrorMsgVO;
 import nc.vo.bd.material.MaterialConvertVO;
@@ -26,6 +28,7 @@ import nc.vo.pfxx.auxiliary.AggxsysregisterVO;
 import nc.vo.pfxx.util.PfxxPluginUtils;
 import nc.vo.pub.BusinessException;
 import nc.vo.pub.VOStatus;
+import nc.vo.pub.lang.UFDouble;
 
 import org.apache.commons.lang.StringUtils;
 
@@ -50,7 +53,28 @@ public class MaterialPfxxPlugin extends nc.bs.pfxx.plugin.AbstractPfxxPlugin {
     try {
       MaterialVO materialVO = (MaterialVO) vo;
       String vbillcode = materialVO.getCode();
+      String bianma = vbillcode.substring(0, 15);
+      String qrybianma = "select thickness_yl,color_yl  from ypff_encoderfile where inventorycode = '"+bianma+"' and nvl(dr,0) = 0";
+	  String thickness = (String) iUAPQueryBS.executeQuery(qrybianma, new ColumnProcessor("thickness_yl"));
+	  String color = (String) iUAPQueryBS.executeQuery(qrybianma, new ColumnProcessor("color_yl"));
+	  //获取厚度毫米
+	  String stname= "select  name From bd_defdoc  where  pk_defdoc=? and  nvl(dr,0)=0 ";
+	  Object[] otname = (Object[]) getVo(stname,thickness);
+      UFDouble ttname =new UFDouble(otname[0].toString()).div(1000);
+      //获取密度吨/立方
+      String sds= "select  memo  From bd_defdoc  where  pk_defdoc=? and  nvl(dr,0)=0 ";
+	  Object[] ods = (Object[]) getVo(sds,color);
+	  UFDouble tds =new UFDouble(ods[0].toString());
+	  String t=(ttname.multiply(tds)).toString();
+	  
+      
+      //设置主辅单位换算率
       String memo = materialVO.getMemo();
+      MaterialConvertVO[] vos = materialVO.getMaterialconvert();
+      for(MaterialConvertVO convvo : vos){
+    	  convvo.setMeasrate("1.00000000/"+t);
+      }
+    	  
       List<CostRegionVO> costRegionVO=getCostRegion(iUAPQueryBS, memo);
       pk =
           PfxxPluginUtils.queryBillPKBeforeSaveOrUpdate(
@@ -60,6 +84,7 @@ public class MaterialPfxxPlugin extends nc.bs.pfxx.plugin.AbstractPfxxPlugin {
         PfxxPluginUtils.addDocIDVsPKContrast(swapContext.getBilltype(),
             swapContext.getDocID(), materialVO.getPrimaryKey());
         materialVO.setCode(vbillcode);
+        materialVO.setMemo("");
         this.getService().updateMaterial(materialVO);
         orgAssign(materialVO, memo, costRegionVO);
         return materialVO.getPrimaryKey();
@@ -72,6 +97,31 @@ public class MaterialPfxxPlugin extends nc.bs.pfxx.plugin.AbstractPfxxPlugin {
     }
     return pk;
   }
+  
+  public Object getVo(String sql, String pk) {
+		Object ob = null;
+		if (pk == null || pk.equals(null)) {
+			try {
+				ob = (Object) iUAPQueryBS.executeQuery(sql,
+						new ArrayProcessor());
+			} catch (BusinessException e) {
+				// TODO 自动生成的 catch 块
+				e.printStackTrace();
+			}
+			return ob;
+		}
+		// 获取组织VO
+		SQLParameter param = new SQLParameter(); // 构造参数对象
+		param.addParam(pk); // 添加参数
+		try {
+			ob = (Object) iUAPQueryBS.executeQuery(sql, param,
+					new ArrayProcessor());
+		} catch (BusinessException e) {
+			// TODO 自动生成的 catch 块
+			e.printStackTrace();
+		}
+		return ob;
+	}
 
   /**
    *