yaoyu 1 год назад
Родитель
Сommit
9784a09f8c

+ 28 - 2
mmpac/mmpac/src/private/u8c/bs/mmpac/bp/SpecialDataRule.java

@@ -11,6 +11,7 @@ import nc.jdbc.framework.processor.MapProcessor;
 import nc.vo.bd.def.DefdocVO;
 import nc.vo.pub.BusinessException;
 import nc.vo.pub.CircularlyAccessibleValueObject;
+import nc.vo.pub.lang.UFDouble;
 import u8c.pubitf.rule.IRule;
 import u8c.vo.ExAggOrderMainVO;
 import u8c.vo.OrderInVO;
@@ -49,10 +50,32 @@ public class SpecialDataRule implements IRule<ExAggOrderMainVO>{
 				orderInVO.setSpec(invbasdocMap.get("invspec"));
 				//型号
 				orderInVO.setModel(invbasdocMap.get("invtype"));
+				//米重
+				orderInVO.setWeight(invbasdocMap.get("def1"));
+				//装饰面周长
+				orderInVO.setRound(invbasdocMap.get("def2"));
+				//窗号
+				orderInVO.setConf(invbasdocMap.get("def3"));
 				//计量单位
 				orderInVO.setUnitid(invbasdocMap.get("measname"));
-				//辅单位
-				orderInVO.setCastunitid(invbasdocMap.get("measnames"));
+				if(invbasdocMap.get("measnames") != null) {
+					//辅单位
+					orderInVO.setCastunitid(invbasdocMap.get("measnames"));
+					//主数量
+					UFDouble number = orderInVO.getNum();
+					//辅数量
+					UFDouble nastnum = orderInVO.getNastnum();
+					if(nastnum == null) {
+						throw new BusinessException("存货:"+orderInVO.getCmaterialcode()+"有辅计量单位,辅数量不能为空");
+					}
+					//换算率
+					UFDouble result = new UFDouble(number.div(nastnum).toString(),2);
+					orderInVO.setBdef6(result.toString());
+				}else {
+					if(orderInVO.getNastnum() != null) {
+						throw new BusinessException("存货:"+orderInVO.getCmaterialcode()+"没有辅计量单位,辅数量不能输入");
+					}
+				}
 				disposeDefdoc("YS(颜色)", orderInVO.getColor());
 				disposeDefdoc("DC(定尺)", orderInVO.getSizing());
 			}
@@ -81,6 +104,9 @@ public class SpecialDataRule implements IRule<ExAggOrderMainVO>{
     	sql.append(" bd_invbasdoc.invname as invname,");
     	sql.append(" bd_invbasdoc.invspec as invspec,");
     	sql.append(" bd_invbasdoc.invtype as invtype,");
+    	sql.append(" bd_invbasdoc.def1 as def1,");
+    	sql.append(" bd_invbasdoc.def2 as def2,");
+    	sql.append(" bd_invbasdoc.def3 as def3,");
     	sql.append(" bd_measdoc.measname as measname,");
     	sql.append(" bd_measdocs.measname as measnames");
     	sql.append(" FROM");

+ 58 - 0
mmpac/mmpac/src/private/u8c/bs/mmpac/bp/ValidateRule.java

@@ -1,8 +1,11 @@
 package u8c.bs.mmpac.bp;
 
+import java.util.Map;
+
 import nc.bs.framework.common.NCLocator;
 import nc.itf.uap.IUAPQueryBS;
 import nc.jdbc.framework.processor.ColumnProcessor;
+import nc.jdbc.framework.processor.MapProcessor;
 import nc.vo.pub.BusinessException;
 import u8c.pubitf.rule.IRule;
 import u8c.vo.ExAggOrderMainVO;
@@ -22,9 +25,56 @@ public class ValidateRule implements IRule<ExAggOrderMainVO>{
 		for(int i = 0; i < vos.length; i++) {
 			OrderInVO[] orderInVOs = (OrderInVO[]) vos[i].getChildrenVO();
 			for (int j = 0; j < orderInVOs.length; j++) {
+				Map<String,String> map = getInvbasdoc(orderInVOs[j].getCmaterialcode());
+				//颜色
+				String free1 = map.get("free1");
+				if (free1 == null) {
+				    if (orderInVOs[j].getColor() != null) {
+				        throw new BusinessException("存货档案:"+orderInVOs[j].getCmaterialcode()+"没有启用颜色,颜色不允许输入");
+				    }
+				} else {
+				    if (orderInVOs[j].getColor() == null) {
+				        throw new BusinessException("存货档案:"+orderInVOs[j].getCmaterialcode()+"启用了颜色,颜色不允许为空");
+				    }
+				}
+				//定尺
+				String free3 = map.get("free3");
+				if (free3 == null) {
+				    if (orderInVOs[j].getSizing() != null) {
+				        throw new BusinessException("存货档案:"+orderInVOs[j].getCmaterialcode()+"没有启用定尺,定尺不允许输入");
+				    }
+				} else {
+				    if (orderInVOs[j].getSizing() == null) {
+				        throw new BusinessException("存货档案:"+orderInVOs[j].getCmaterialcode()+"启用了定尺,定尺不允许为空");
+				    }
+				}
+				//合金
+				String free2 = map.get("free2");
+				if (free2 == null) {
+				    if (orderInVOs[j].getAlloy() != null) {
+				        throw new BusinessException("存货档案:"+orderInVOs[j].getCmaterialcode()+"没有启用合金,合金不允许输入");
+				    }
+				} else {
+				    if (orderInVOs[j].getAlloy() == null) {
+				        throw new BusinessException("存货档案:"+orderInVOs[j].getCmaterialcode()+"启用了合金,合金不允许为空");
+				    }
+				}
+				//标准
+				String free4 = map.get("free4");
+				if (free4 == null) {
+				    if (orderInVOs[j].getStandard() != null) {
+				        throw new BusinessException("存货档案:"+orderInVOs[j].getCmaterialcode()+"没有启用标准,标准不允许输入");
+				    }
+				} else {
+				    if (orderInVOs[j].getStandard() == null) {
+				        throw new BusinessException("存货档案:"+orderInVOs[j].getCmaterialcode()+"启用了标准,标准不允许为空");
+				    }
+				}
+				
 				getDefdoc("HJ(合金)",orderInVOs[j].getAlloy());
 				getDefdoc("BZ(标准)",orderInVOs[j].getStandard());
 				getMeasdoc(orderInVOs[j].getCastunitid());
+				
 			}
 		}
 	}
@@ -51,4 +101,12 @@ public class ValidateRule implements IRule<ExAggOrderMainVO>{
         	throw new BusinessException("以下档案在U8cloud系统中根据公司或者账簿信息找不到,请检查!详细信息:1、档案类型 计量档案,档案名称:"+shortname+"");
         }
     }
+    
+    
+    public Map<String,String> getInvbasdoc(String cmaterialcode)throws BusinessException {
+    	String sql = "select free1,free2,free3,free4 from bd_invbasdoc where invcode  = '"+cmaterialcode+"' and dr = 0";
+    	return (Map<String, String>) iuap.executeQuery(sql.toString(), new MapProcessor());
+    }
+    
+    
 }

+ 3 - 4
mmpac/mmpac/src/private/u8c/impl/mmpac/mmpac/OrderTotalInfoImpl.java

@@ -7,6 +7,7 @@ import java.util.List;
 import java.util.Map;
 
 import nc.bs.framework.common.NCLocator;
+import nc.ui.pub.beans.MessageDialog;
 import nc.vo.hr.tools.pub.HRAggVO;
 import nc.vo.ic.pub.bill.GeneralBillVO;
 import nc.vo.pub.BusinessException;
@@ -61,8 +62,7 @@ public class OrderTotalInfoImpl implements IOrderTotalInfo {
 			}
 			return true;
 		} catch (Exception e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
+			MessageDialog.showErrorDlg(null, "错误1", e.getMessage());
 		}
 		
 		return false;
@@ -88,8 +88,7 @@ public class OrderTotalInfoImpl implements IOrderTotalInfo {
 			}
 			return true;
 		} catch (Exception e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
+			MessageDialog.showErrorDlg(null, "错误2", e.getMessage());
 		}
 		
 		return false;

+ 26 - 2
xc/cg/src/private/u8c/bs/mytest/bp/SpecialDataRule.java

@@ -10,6 +10,7 @@ import nc.jdbc.framework.processor.MapProcessor;
 import nc.vo.bd.def.DefdocVO;
 import nc.vo.pub.BusinessException;
 import nc.vo.pub.CircularlyAccessibleValueObject;
+import nc.vo.pub.lang.UFDouble;
 import u8c.pubitf.rule.IRule;
 import u8c.vo.AggDemandVO;
 import u8c.vo.DemandBVO;
@@ -43,10 +44,30 @@ public class SpecialDataRule implements IRule<AggDemandVO> {
 				demandBVO.setSpec(invbasdocMap.get("invspec"));
 				//型号
 				demandBVO.setModel(invbasdocMap.get("invtype"));
+				//米重
+				demandBVO.setWeight(invbasdocMap.get("def1"));
+				//装饰面周长
+				demandBVO.setRound(invbasdocMap.get("def2"));
 				//计量单位
 				demandBVO.setUnitid(invbasdocMap.get("measname"));
-				//辅计量单位
-				demandBVO.setCastunitid(invbasdocMap.get("measnames"));
+				if(invbasdocMap.get("measnames") != null) {
+					//辅单位
+					demandBVO.setCastunitid(invbasdocMap.get("measnames"));
+					//主数量
+					UFDouble number = demandBVO.getNum();
+					//辅数量
+					UFDouble nastnum = new UFDouble(demandBVO.getNastnum());
+					if(demandBVO.getNastnum() == null) {
+						throw new BusinessException("存货:"+demandBVO.getCmaterialcode()+"有辅计量单位,辅数量不能为空");
+					}
+					//换算率
+					UFDouble result = new UFDouble(number.div(nastnum).toString(),2);
+					demandBVO.setVdef13(result.toString());
+				}else {
+					if(demandBVO.getNastnum() != null) {
+						throw new BusinessException("存货:"+demandBVO.getCmaterialcode()+"没有辅计量单位,辅数量不能输入");
+					}
+				}
 				disposeDefdoc("YS(颜色)", demandBVO.getColor());
 				disposeDefdoc("DC(定尺)", demandBVO.getSizing());
 			}
@@ -74,6 +95,9 @@ public class SpecialDataRule implements IRule<AggDemandVO> {
     	sql.append(" bd_invbasdoc.invname as invname,");
     	sql.append(" bd_invbasdoc.invspec as invspec,");
     	sql.append(" bd_invbasdoc.invtype as invtype,");
+    	sql.append(" bd_invbasdoc.def1 as def1,");
+    	sql.append(" bd_invbasdoc.def2 as def2,");
+    	sql.append(" bd_invbasdoc.def3 as def3,");
     	sql.append(" bd_measdoc.measname as measname,");
     	sql.append(" bd_measdocs.measname as measnames");
     	sql.append(" from");

+ 53 - 0
xc/cg/src/private/u8c/bs/mytest/bp/ValidateRule.java

@@ -1,8 +1,11 @@
 package u8c.bs.mytest.bp;
 
+import java.util.Map;
+
 import nc.bs.framework.common.NCLocator;
 import nc.itf.uap.IUAPQueryBS;
 import nc.jdbc.framework.processor.ColumnProcessor;
+import nc.jdbc.framework.processor.MapProcessor;
 import nc.vo.pub.BusinessException;
 import u8c.pubitf.rule.IRule;
 import u8c.vo.AggDemandVO;
@@ -21,6 +24,51 @@ public class ValidateRule implements IRule<AggDemandVO> {
 			DemandVO demandVO = (DemandVO) vos[i].getParentVO();
 			DemandBVO[] demandBVOs = (DemandBVO[]) vos[i].getChildrenVO();
 			for (int j = 0; j < demandBVOs.length; j++) {
+				Map<String,String> map = getInvbasdoc(demandBVOs[j].getCmaterialcode());
+				//颜色
+				String free1 = map.get("free1");
+				if (free1 == null) {
+				    if (demandBVOs[j].getColor() != null) {
+				        throw new BusinessException("存货档案:"+demandBVOs[j].getCmaterialcode()+"没有启用颜色,颜色不允许输入");
+				    }
+				} else {
+				    if (demandBVOs[j].getColor() == null) {
+				        throw new BusinessException("存货档案:"+demandBVOs[j].getCmaterialcode()+"启用了颜色,颜色不允许为空");
+				    }
+				}
+				//定尺
+				String free3 = map.get("free3");
+				if (free3 == null) {
+				    if (demandBVOs[j].getSizing() != null) {
+				        throw new BusinessException("存货档案:"+demandBVOs[j].getCmaterialcode()+"没有启用定尺,定尺不允许输入");
+				    }
+				} else {
+				    if (demandBVOs[j].getSizing() == null) {
+				        throw new BusinessException("存货档案:"+demandBVOs[j].getCmaterialcode()+"启用了定尺,定尺不允许为空");
+				    }
+				}
+				//合金
+				String free2 = map.get("free2");
+				if (free2 == null) {
+				    if (demandBVOs[j].getAlloy() != null) {
+				        throw new BusinessException("存货档案:"+demandBVOs[j].getCmaterialcode()+"没有启用合金,合金不允许输入");
+				    }
+				} else {
+				    if (demandBVOs[j].getAlloy() == null) {
+				        throw new BusinessException("存货档案:"+demandBVOs[j].getCmaterialcode()+"启用了合金,合金不允许为空");
+				    }
+				}
+				//标准
+				String free4 = map.get("free4");
+				if (free4 == null) {
+				    if (demandBVOs[j].getStandard() != null) {
+				        throw new BusinessException("存货档案:"+demandBVOs[j].getCmaterialcode()+"没有启用标准,标准不允许输入");
+				    }
+				} else {
+				    if (demandBVOs[j].getStandard() == null) {
+				        throw new BusinessException("存货档案:"+demandBVOs[j].getCmaterialcode()+"启用了标准,标准不允许为空");
+				    }
+				}
 				getDefdoc("HJ(合金)",demandBVOs[j].getAlloy());
 				getDefdoc("BZ(标准)",demandBVOs[j].getStandard());
 				getMeasdoc(demandBVOs[j].getCastunitid());
@@ -53,5 +101,10 @@ public class ValidateRule implements IRule<AggDemandVO> {
         }
     }
     
+    public Map<String,String> getInvbasdoc(String cmaterialcode)throws BusinessException {
+    	String sql = "select free1,free2,free3,free4 from bd_invbasdoc where invcode  = '"+cmaterialcode+"' and dr = 0";
+    	return (Map<String, String>) iuap.executeQuery(sql.toString(), new MapProcessor());
+    }
+    
 
 }