Browse Source

生产总订单推单优化

zthwr 1 year ago
parent
commit
dbf29ec641

+ 34 - 40
mmpac/mmpac/src/client/u8c/ui/mmpac/action/GenOtheroutinAction.java

@@ -44,10 +44,16 @@ public class GenOtheroutinAction extends AbstractAction{
 			OrderIssueVO[] issueArrays = getIssueVOs(oldchildvos);
 			List<OrderIssueVO> execList = new ArrayList<>();
 			for(OrderIssueVO issuevo : issueArrays) {
-				Object bdef3 = issuevo.getBdef3();//是否委外
-				if(bdef3 != null && bdef3.equals("Y") ) {
+//				Object bdef3 = issuevo.getBdef3();//是否委外
+//				if(bdef3 != null && bdef3.equals("Y") ) {
+//					execList.add(issuevo);
+//				}
+				
+				Object bdef5 = issuevo.getBdef5();//是否委外
+				if(bdef5 != null && bdef5.equals("Y") ) {
 					execList.add(issuevo);
 				}
+				
 			}
 			delICVos(oldchildvos);
 			if(execList.size() != 0) {
@@ -129,26 +135,20 @@ public class GenOtheroutinAction extends AbstractAction{
 				outvo.setUnitid(issuevo.getUnitid());
 				outvo.setTs(PubEnv.getServerTime());
 				outvo.setBdef1(issuevo.getPk_order_issue());
+				outvo.setBdef11(issuevo.getBdef11());//楼号楼层
+				outvo.setBdef12(issuevo.getBdef12());//樘数(数量)
+				outvo.setBdef13(issuevo.getBdef13());//框统计
+				outvo.setBdef14(issuevo.getBdef14());//扇统计
+				outvo.setBdef15(issuevo.getBdef15());//半成品分类
+				outvo.setBdef16(issuevo.getBdef16());//面积
+				outvo.setBdef17(issuevo.getBdef17());//切割长度
+				outvo.setBdef18(issuevo.getBdef18());//切割角度左下
+				outvo.setBdef19(issuevo.getBdef19());//切割角度右上
+				outvo.setBdef20(issuevo.getBdef20());//系列
+				outvo.setBdef2(issuevo.getBdef2());//备注
+				outvo.setBdef3(issuevo.getBdef3());//玻璃编号
 				ivo.insertVO(outvo);
-//				outvo.setBdef2(null);
-//				outvo.setBdef3(issuevo.getBdef3());
-//				outvo.setBdef4(issuevo.getBdef4());
-//				outvo.setBdef5(issuevo.getBdef5());
-//				outvo.setBdef6(issuevo.getBdef6());
-//				outvo.setBdef7(issuevo.getBdef7());
-//				outvo.setBdef8(issuevo.getBdef8());
-//				outvo.setBdef9(issuevo.getBdef9());
-//				outvo.setBdef10(issuevo.getBdef10());
-//				outvo.setBdef11(issuevo.getBdef11());
-//				outvo.setBdef12(issuevo.getBdef12());
-//				outvo.setBdef13(issuevo.getBdef13());
-//				outvo.setBdef14(issuevo.getBdef14());
-//				outvo.setBdef15(issuevo.getBdef15());
-//				outvo.setBdef16(issuevo.getBdef16());
-//				outvo.setBdef17(issuevo.getBdef17());
-//				outvo.setBdef18(issuevo.getBdef18());
-//				outvo.setBdef19(issuevo.getBdef19());
-//				outvo.setBdef20(issuevo.getBdef20());
+				
 				OrderOtherinVO invo = new OrderOtherinVO();
 				invo.setPk_order(issuevo.getPk_order());
 				invo.setPrjtypecode(issuevo.getPrjtypecode());
@@ -183,26 +183,20 @@ public class GenOtheroutinAction extends AbstractAction{
 				invo.setUnitid(issuevo.getUnitid());
 				invo.setTs(PubEnv.getServerTime());
 				invo.setBdef1(issuevo.getPk_order_issue());
+				invo.setBdef11(issuevo.getBdef11());//楼号楼层
+				invo.setBdef12(issuevo.getBdef12());//樘数(数量)
+				invo.setBdef13(issuevo.getBdef13());//框统计
+				invo.setBdef14(issuevo.getBdef14());//扇统计
+				invo.setBdef15(issuevo.getBdef15());//半成品分类
+				invo.setBdef16(issuevo.getBdef16());//面积
+				invo.setBdef17(issuevo.getBdef17());//切割长度
+				invo.setBdef18(issuevo.getBdef18());//切割角度左下
+				invo.setBdef19(issuevo.getBdef19());//切割角度右上
+				invo.setBdef20(issuevo.getBdef20());//系列
+				invo.setBdef2(issuevo.getBdef2());//备注
+				invo.setBdef3(issuevo.getBdef3());//玻璃编号
 				ivo.insertVO(invo);
-//				invo.setBdef2(null);
-//				invo.setBdef3(issuevo.getBdef3());
-//				invo.setBdef4(issuevo.getBdef4());
-//				invo.setBdef5(issuevo.getBdef5());
-//				invo.setBdef6(issuevo.getBdef6());
-//				invo.setBdef7(issuevo.getBdef7());
-//				invo.setBdef8(issuevo.getBdef8());
-//				invo.setBdef9(issuevo.getBdef9());
-//				invo.setBdef10(issuevo.getBdef10());
-//				invo.setBdef11(issuevo.getBdef11());
-//				invo.setBdef12(issuevo.getBdef12());
-//				invo.setBdef13(issuevo.getBdef13());
-//				invo.setBdef14(issuevo.getBdef14());
-//				invo.setBdef15(issuevo.getBdef15());
-//				invo.setBdef16(issuevo.getBdef16());
-//				invo.setBdef17(issuevo.getBdef17());
-//				invo.setBdef18(issuevo.getBdef18());
-//				invo.setBdef19(issuevo.getBdef19());
-//				invo.setBdef20(issuevo.getBdef20());
+
 			}
 		} catch (BusinessException e) {
 			// TODO Auto-generated catch block

+ 105 - 22
mmpac/mmpac/src/client/u8c/ui/mmpac/action/PushOtherInAction.java

@@ -5,7 +5,9 @@ import java.util.List;
 
 import nc.bs.framework.common.NCLocator;
 import nc.hr.utils.PubEnv;
+import nc.itf.uap.IUAPQueryBS;
 import nc.itf.uap.IVOPersistence;
+import nc.jdbc.framework.processor.ColumnProcessor;
 import nc.ui.hr.frame.FrameUI;
 import nc.ui.hr.frame.action.AbstractAction;
 import nc.ui.hr.frame.impl.MainBillMgrPanel;
@@ -31,13 +33,13 @@ import u8c.vo.OrderOtherinVO;
 import u8c.vo.OrderOtheroutVO;
 
 public class PushOtherInAction extends AbstractAction{
-	OrderTestUI frameUI = null;
-	IOtherInMaintainAPI iotherin = NCLocator.getInstance().lookup(IOtherInMaintainAPI.class);
-	IVOPersistence ivo = NCLocator.getInstance().lookup(IVOPersistence.class);
-
+	private  OrderTestUI frameUI = null;
+	private  IOtherInMaintainAPI iotherin = NCLocator.getInstance().lookup(IOtherInMaintainAPI.class);
+	private  IVOPersistence ivo = NCLocator.getInstance().lookup(IVOPersistence.class);
+	private  IUAPQueryBS iuap = NCLocator.getInstance().lookup(IUAPQueryBS.class);
 	public PushOtherInAction(FrameUI frameUI1) {
 		super(frameUI1);
-		this.frameUI = (OrderTestUI) frameUI;
+		this.frameUI = (OrderTestUI) frameUI1;
 	}
 
 	@Override
@@ -51,9 +53,14 @@ public class PushOtherInAction extends AbstractAction{
 			if(billstatus != 1) {
 				throw new ValidationException("非审批态单据不允许生成其他入库单");
 			}
+			
+			
 			String pk_corp = headvo.getPk_corp();
 			String pk_order = headvo.getPk_order();
+			String prjcode = headvo.getProjectid();//项目主键
 			OrderOtherinVO[] invos = getInVOs(s);
+			//业务类型
+			String billtype=headvo.getBusitype();
 			if(invos.length != 0) {
 				GeneralBillVO[] aggvos = new GeneralBillVO[1];
 				GeneralBillVO aggvo = new GeneralBillVO();
@@ -62,7 +69,12 @@ public class PushOtherInAction extends AbstractAction{
 				icheadvo.setPk_calbody(GetBaseDAOUtil.getcalpk(pk_corp));
 				icheadvo.setDbilldate(PubEnv.getServerDate());
 				icheadvo.setCoperatorid(PubEnv.getPk_user());
-				icheadvo.setCwarehouseid("1001V5100000000003A1");//仓库必填
+				//仓库ID
+				if("工装".equals(billtype)) {
+					icheadvo.setCwarehouseid("1001V51000000000039Z");//仓库必填
+				}else if("家装".equals(billtype)) {
+					icheadvo.setCwarehouseid("1001V5100000000003A0");//仓库必填
+				}
 				icheadvo.setBoutretflag(UFBoolean.FALSE);//是否退回 
 				icheadvo.setBsalecooppur(UFBoolean.FALSE); // 销售出是否已协同生成采购入 
 				icheadvo.setVnote("来源生产总订单");//备注
@@ -71,10 +83,25 @@ public class PushOtherInAction extends AbstractAction{
 				icheadvo.setFbillflag(2);
 				icheadvo.setFreplenishflag(UFBoolean.FALSE);
 				icheadvo.setCoperatoridnow(PubEnv.getPk_user());
+				//项目编码 pk_defdoc9
+				icheadvo.setAttributeValue("pk_defdoc9", prjcode);
+				//项目名称pk_defdoc10
+				icheadvo.setAttributeValue("pk_defdoc10", prjcode);
+				//加工单号pk_defdoc2
+				icheadvo.setAttributeValue("pk_defdoc2", headvo.getDef2());
+				
 				aggvo.setParentVO(icheadvo);
 				GeneralBillItemVO[] itemvos = new GeneralBillItemVO[invos.length];
+//				List<GeneralBillItemVO> lisbillvos=new ArrayList<GeneralBillItemVO>();
 				for(int i = 0;i < invos.length;i++) {
 					OrderOtherinVO invo = invos[i];
+					//校验已执行数量等于主数量不让再执行生单操作
+					UFDouble exenumvo=invo.getExecnum()==null?UFDouble.ZERO_DBL: new UFDouble (invo.getExecnum());//已执行数量
+					if(new UFDouble (invo.getNum()).sub(exenumvo).compareTo(UFDouble.ZERO_DBL)<=0) {
+						MessageDialog.showErrorDlg(frameUI, "失败", "已经生成其他入库单,不允许重复生成!");
+						return;
+					}
+					
 					GeneralBillItemVO itemvo = new GeneralBillItemVO();
 					String cmaterialcode = invo.getCmaterialcode();
 					String pk_invbasdoc = "";//存货pk
@@ -85,16 +112,19 @@ public class PushOtherInAction extends AbstractAction{
 						InvbasdocVO invbasvo  = GetBaseDAOUtil.getInvVO(cmaterialcode);
 						pk_invbasdoc = invbasvo.getPrimaryKey();
 					}
-					String prjcode = invo.getPrjcode();
-					String cprojectid = "";
-					if(prjcode.startsWith("1001")) {
-						cprojectid = prjcode;
-					}
-					else {
-						cprojectid = GetBaseDAOUtil.getprojectid(prjcode);
-					}
+					
+//					String prjcode = invo.getPrjcode();
+//					String cprojectid = "";
+//					if(prjcode.startsWith("1001")) {
+//						cprojectid = prjcode;
+//					}
+//					else {
+//						 cprojectid =getprojectid(prjcode);
+//					}
+					String cprojectid=prjcode;
 					InvmandocVO invmanvo = GetBaseDAOUtil.getInvmanVO(pk_invbasdoc);
 					String pk_invmandoc = invmanvo.getPrimaryKey();
+					itemvo.setCprojectid(cprojectid);
 					itemvo.setBbarcodeclose(UFBoolean.FALSE);
 					itemvo.setAttributeValue("bonroadflag", "N");
 					itemvo.setBreturnprofit(UFBoolean.FALSE);
@@ -106,7 +136,12 @@ public class PushOtherInAction extends AbstractAction{
 					itemvo.setBtransasset(UFBoolean.FALSE);
 					itemvo.setBzgflag(UFBoolean.FALSE);
 					itemvo.setCbodybilltypecode("4A");
-					itemvo.setCbodywarehouseid("1001V5100000000003A1");
+					//itemvo.setCbodywarehouseid("1001V5100000000003A1");
+					if("工装".equals(billtype)) {
+						itemvo.setCbodywarehouseid("1001V51000000000039Z");//仓库必填
+					}else if("家装".equals(billtype)) {
+						itemvo.setCbodywarehouseid("1001V5100000000003A0");//仓库必填
+					}
 					itemvo.setCfirstbillhid(pk_order);
 					itemvo.setCfirstbillbid(invo.getPrimaryKey());
 					itemvo.setCfirsttype("55A2");
@@ -138,15 +173,40 @@ public class PushOtherInAction extends AbstractAction{
 					itemvo.setVfree3(invo.getAlloy());
 					itemvo.setVfree4(invo.getStandard());
 					itemvo.setVsourcebillcode(headvo.getVbillno());
+					itemvo.setAttributeValue("pk_defdoc1", invo.getBdef11());//楼号楼层
+					itemvo.setAttributeValue("pk_defdoc2", invo.getBdef12());//樘数(数量)
+					itemvo.setAttributeValue("pk_defdoc3", invo.getBdef13());//框统计
+					itemvo.setAttributeValue("pk_defdoc4", invo.getBdef14());//扇统计
+					itemvo.setAttributeValue("pk_defdoc5", invo.getBdef15());//半成品分类
+					itemvo.setAttributeValue("pk_defdoc6", invo.getBdef16());//面积
+					itemvo.setAttributeValue("pk_defdoc7", invo.getBdef17());//切割长度
+					itemvo.setAttributeValue("pk_defdoc8", invo.getBdef18());//切割角度左下
+					itemvo.setAttributeValue("pk_defdoc9", invo.getBdef19());//切割角度右上
+					itemvo.setAttributeValue("pk_defdoc10", invo.getBdef2());//备注
+					itemvo.setAttributeValue("pk_defdoc11", invo.getWidth());//宽度
+					itemvo.setAttributeValue("pk_defdoc12", invo.getHeight());//高度
+					itemvo.setAttributeValue("pk_defdoc13", invo.getBdef20());//系列
+					itemvo.setAttributeValue("pk_defdoc14", invo.getBdef3());//玻璃编号
 					itemvos[i] = itemvo;
+//					lisbillvos.add(itemvo);
 				}
-				aggvo.setChildrenVO(itemvos);
-				aggvos[0] = aggvo;
-				GeneralBillVO[] res = iotherin.insertOtherIns(aggvos);
-				GeneralBillVO resvo = res[0];
-				//入库修改颜色,生单后,回写颜色到领料的入库颜色字段
-				UpdateIssue(invos);
-				MessageDialog.showHintDlg(frameUI, "成功", "其他入库单"+resvo.getVBillCode()+"新增成功");
+				
+//				if(null!=lisbillvos && lisbillvos.size()>0) {
+					aggvo.setChildrenVO(itemvos);
+					aggvos[0] = aggvo;
+					GeneralBillVO[] res = iotherin.insertOtherIns(aggvos);
+					GeneralBillVO resvo = res[0];
+					//入库修改颜色,生单后,回写颜色到领料的入库颜色字段
+					UpdateIssue(invos);
+					//回写已执行数量
+					UpdateExecnum(invos);
+					
+					MessageDialog.showHintDlg(frameUI, "成功", "其他入库单"+resvo.getVBillCode()+"新增成功");
+//				}else {
+//					
+//					MessageDialog.showErrorDlg(frameUI, "失败", "已经生成其他入库单,不允许重复生成!");
+//				}
+				
 			}
 			else {
 				MessageDialog.showHintDlg(frameUI, "提示", "该生产订单没有其他入库数据,不能生成其他入库单");
@@ -154,7 +214,19 @@ public class PushOtherInAction extends AbstractAction{
 			}
 		}
 	}
+	
+	
 
+	private void UpdateExecnum(OrderOtherinVO[] invos) throws Exception {
+		for(OrderOtherinVO invo : invos) {
+			invo.setExecnum(invo.getNum());
+			invo.setExecnastnum(invo.getNastnum());
+		}
+			ivo.updateVOArray(invos);
+			this.frameUI.getBillCardPanel().getBillModel().setBodyDataVO(invos);
+	}
+	
+	
 	private void UpdateIssue(OrderOtherinVO[] invos) throws Exception {
 		List<OrderIssueVO> issuevos = new ArrayList<>();
 		for(OrderOtherinVO invo : invos) {
@@ -172,6 +244,7 @@ public class PushOtherInAction extends AbstractAction{
 			ivo.updateVOList(issuevos);
 		}
 	}
+	
 
 	//获取其他入库数据
 	private OrderOtherinVO[] getInVOs(HRAggVO aggvo) {
@@ -189,4 +262,14 @@ public class PushOtherInAction extends AbstractAction{
 		}
 		return inArrays;
 	}
+	
+	 public  String getprojectid(String prjcode) throws Exception {
+	        String sql = "select * from  bd_jobmngfil where pk_jobbasfil "
+	        		+ " =(select pk_jobbasfil from bd_jobbasfil where jobcode ='"+prjcode+"' and isnull(dr,0) = 0) and isnull(dr,0) = 0 ";
+	        String pk_jobbasfil = (String) iuap.executeQuery(sql, new ColumnProcessor());
+	        if (pk_jobbasfil == null) {
+	            return "";
+	        }
+	        return pk_jobbasfil;
+	    }
 }

+ 76 - 13
mmpac/mmpac/src/client/u8c/ui/mmpac/action/PushOtherOutAction.java

@@ -32,11 +32,11 @@ import u8c.vo.OrderOtheroutVO;
 
 public class PushOtherOutAction extends AbstractAction{
 	OrderTestUI frameUI = null;
-	IOtherOutMaintainAPI iotherout = NCLocator.getInstance().lookup(IOtherOutMaintainAPI.class);
-
+	private  IOtherOutMaintainAPI iotherout = NCLocator.getInstance().lookup(IOtherOutMaintainAPI.class);
+	private  IVOPersistence ivo = NCLocator.getInstance().lookup(IVOPersistence.class);
 	public PushOtherOutAction(FrameUI frameUI1) {
 		super(frameUI1);
-		this.frameUI = (OrderTestUI) frameUI;
+		this.frameUI = (OrderTestUI) frameUI1;
 	}
 
 	@Override
@@ -52,6 +52,9 @@ public class PushOtherOutAction extends AbstractAction{
 			}
 			String pk_corp = headvo.getPk_corp();
 			String pk_order = headvo.getPk_order();
+			String prjcode = headvo.getProjectid();//项目主键
+			//业务类型
+			String billtype=headvo.getBusitype();
 			OrderOtheroutVO[] outvos = getOutVOs(s);
 			if(outvos.length != 0) {
 				GeneralBillVO[] aggvos = new GeneralBillVO[1];
@@ -61,7 +64,14 @@ public class PushOtherOutAction extends AbstractAction{
 				icheadvo.setPk_calbody(GetBaseDAOUtil.getcalpk(pk_corp));
 				icheadvo.setDbilldate(PubEnv.getServerDate());
 				icheadvo.setCoperatorid(PubEnv.getPk_user());
-				icheadvo.setCwarehouseid("1001V5100000000003A1");//仓库必填
+	//			icheadvo.setCwarehouseid("1001V5100000000003A1");//仓库必填
+				//仓库ID
+				if("工装".equals(billtype)) {
+					icheadvo.setCwarehouseid("1001V51000000000039Z");//仓库必填
+				}else if("家装".equals(billtype)) {
+					icheadvo.setCwarehouseid("1001V5100000000003A0");//仓库必填
+				}
+				
 				icheadvo.setBoutretflag(UFBoolean.FALSE);//是否退回 
 				icheadvo.setBsalecooppur(UFBoolean.FALSE); // 销售出是否已协同生成采购入 
 				icheadvo.setVnote("来源生产总订单");//备注
@@ -70,10 +80,25 @@ public class PushOtherOutAction extends AbstractAction{
 				icheadvo.setFbillflag(2);
 				icheadvo.setFreplenishflag(UFBoolean.FALSE);
 				icheadvo.setCoperatoridnow(PubEnv.getPk_user());
+				
+				//项目编码 pk_defdoc9
+				icheadvo.setAttributeValue("pk_defdoc9", prjcode);
+				//项目名称pk_defdoc10
+				icheadvo.setAttributeValue("pk_defdoc10", prjcode);
+				//加工单号pk_defdoc2
+				icheadvo.setAttributeValue("pk_defdoc2", headvo.getDef2());
+				
 				aggvo.setParentVO(icheadvo);
 				GeneralBillItemVO[] itemvos = new GeneralBillItemVO[outvos.length];
 				for(int i = 0;i < outvos.length;i++) {
 					OrderOtheroutVO outvo = outvos[i];
+					//校验已执行数量等于主数量不让再执行生单操作
+					UFDouble exenumvo=outvo.getExecnum()==null?UFDouble.ZERO_DBL: new UFDouble (outvo.getExecnum());//已执行数量
+					if(new UFDouble (outvo.getNum()).sub(exenumvo).compareTo(UFDouble.ZERO_DBL)<=0) {
+						MessageDialog.showErrorDlg(frameUI, "失败", "已经生成其他入库单,不允许重复生成!");
+						return;
+					}
+					
 					GeneralBillItemVO itemvo = new GeneralBillItemVO();
 					String cmaterialcode = outvo.getCmaterialcode();
 					String pk_invbasdoc = "";//存货pk
@@ -84,16 +109,20 @@ public class PushOtherOutAction extends AbstractAction{
 						InvbasdocVO invbasvo  = GetBaseDAOUtil.getInvVO(cmaterialcode);
 						pk_invbasdoc = invbasvo.getPrimaryKey();
 					}
-					String prjcode = outvo.getPrjcode();
-					String cprojectid = "";
-					if(prjcode.startsWith("1001")) {
-						cprojectid = prjcode;
-					}
-					else {
-						cprojectid = GetBaseDAOUtil.getprojectid(prjcode);
-					}
+//					String prjcode = outvo.getPrjcode();
+//					String cprojectid = "";
+//					if(prjcode.startsWith("1001")) {
+//						cprojectid = prjcode;
+//					}
+//					else {
+//						cprojectid = GetBaseDAOUtil.getprojectid(prjcode);
+//					}
+					
+					String cprojectid=prjcode;
+					
 					InvmandocVO invmanvo = GetBaseDAOUtil.getInvmanVO(pk_invbasdoc);
 					String pk_invmandoc = invmanvo.getPrimaryKey();
+					itemvo.setCprojectid(cprojectid);
 					itemvo.setBbarcodeclose(UFBoolean.FALSE);
 					itemvo.setAttributeValue("bonroadflag", "N");
 					itemvo.setBreturnprofit(UFBoolean.FALSE);
@@ -105,7 +134,13 @@ public class PushOtherOutAction extends AbstractAction{
 					itemvo.setBtransasset(UFBoolean.FALSE);
 					itemvo.setBzgflag(UFBoolean.FALSE);
 					itemvo.setCbodybilltypecode("4I");
-					itemvo.setCbodywarehouseid("1001V5100000000003A1");
+	//				itemvo.setCbodywarehouseid("1001V5100000000003A1");
+					//仓库ID
+					if("工装".equals(billtype)) {
+						itemvo.setCbodywarehouseid("1001V51000000000039Z");//仓库必填
+					}else if("家装".equals(billtype)) {
+						itemvo.setCbodywarehouseid("1001V5100000000003A0");//仓库必填
+					}
 					itemvo.setCfirstbillhid(pk_order);
 					itemvo.setCfirstbillbid(outvo.getPrimaryKey());
 					itemvo.setCfirsttype("55A2");
@@ -136,12 +171,29 @@ public class PushOtherOutAction extends AbstractAction{
 					itemvo.setVfree3(outvo.getAlloy());
 					itemvo.setVfree4(outvo.getStandard());
 					itemvo.setVsourcebillcode(headvo.getVbillno());
+					itemvo.setAttributeValue("pk_defdoc1", outvo.getBdef11());//楼号楼层
+					itemvo.setAttributeValue("pk_defdoc2", outvo.getBdef12());//樘数(数量)
+					itemvo.setAttributeValue("pk_defdoc3", outvo.getBdef13());//框统计
+					itemvo.setAttributeValue("pk_defdoc4", outvo.getBdef14());//扇统计
+					itemvo.setAttributeValue("pk_defdoc5", outvo.getBdef15());//半成品分类
+					itemvo.setAttributeValue("pk_defdoc6", outvo.getBdef16());//面积
+					itemvo.setAttributeValue("pk_defdoc7", outvo.getBdef17());//切割长度
+					itemvo.setAttributeValue("pk_defdoc8", outvo.getBdef18());//切割角度左下
+					itemvo.setAttributeValue("pk_defdoc9", outvo.getBdef19());//切割角度右上
+					itemvo.setAttributeValue("pk_defdoc10", outvo.getBdef2());//备注
+					itemvo.setAttributeValue("pk_defdoc11", outvo.getWidth());//宽度
+					itemvo.setAttributeValue("pk_defdoc12", outvo.getHeight());//高度
+					itemvo.setAttributeValue("pk_defdoc13", outvo.getBdef20());//系列
+					itemvo.setAttributeValue("pk_defdoc14", outvo.getBdef3());//玻璃编号
 					itemvos[i] = itemvo;
 				}
 				aggvo.setChildrenVO(itemvos);
 				aggvos[0] = aggvo;
 				GeneralBillVO[] res = iotherout.insertOtherOuts(aggvos);
 				GeneralBillVO resvo = res[0];
+				//回写已执行数量
+				UpdateExecnum(outvos);
+				
 				MessageDialog.showHintDlg(frameUI, "成功", "其他出库单"+resvo.getVBillCode()+"新增成功");
 			}
 			else {
@@ -151,6 +203,17 @@ public class PushOtherOutAction extends AbstractAction{
 		}
 	}
 	
+	
+	private void UpdateExecnum(OrderOtheroutVO[] outvos) throws Exception {
+		for(OrderOtheroutVO outvo : outvos) {
+			outvo.setExecnum(outvo.getNum());
+			outvo.setExecnastnum(outvo.getNastnum());
+		}
+			ivo.updateVOArray(outvos);
+			
+			this.frameUI.getBillCardPanel().getBillModel().setBodyDataVO(outvos);
+	}
+	
 
 	//获取其他出库数据
 	private OrderOtheroutVO[] getOutVOs(HRAggVO aggvo) {

+ 94 - 13
mmpac/mmpac/src/client/u8c/ui/mmpac/action/ToMaterialOutDialog.java

@@ -23,6 +23,7 @@ import nc.bs.framework.common.NCLocator;
 import nc.hr.utils.PubEnv;
 import nc.itf.uap.IUAPQueryBS;
 import nc.jdbc.framework.processor.BeanListProcessor;
+import nc.jdbc.framework.processor.ColumnProcessor;
 import nc.ui.pub.ButtonObject;
 import nc.ui.pub.ClientEnvironment;
 import nc.ui.pub.beans.MessageDialog;
@@ -51,7 +52,6 @@ import nc.vo.querytemplate.TemplateInfo;
 import u8c.bs.servlet.service.GetBaseDAOUtil;
 import u8c.itf.mmpac.mmpac.IOrderTotalInfo;
 import u8c.pubitf.ic.out.IMaterialOutMaintainAPI;
-import u8c.ui.mmpac.datamodel.OrderDataModel;
 import u8c.vo.OrderIssueVO;
 import u8c.vo.OrderMainVO;
 
@@ -113,10 +113,39 @@ public class ToMaterialOutDialog extends UIDialog implements ActionListener,Bill
 
 	//根据传入的aggvo获取issuevo数组
 	private OrderIssueVO[] getIssueVOs(HRAggVO aggvo) {
-		CircularlyAccessibleValueObject[] vos = aggvo.getAllChildrenVO();
+		//查询最新的数据
+		OrderMainVO headvo=(OrderMainVO) aggvo.getParentVO();
+		String pk_order=headvo.getPk_order();//主表主键
+		IUAPQueryBS iuap=NCLocator.getInstance().lookup(IUAPQueryBS.class);
+		String sql="select * from mmpac_order_issue where pk_order='"+pk_order+"' and isnull(dr,0)=0  ";
+		List<OrderIssueVO> orderissuvos=null;
+		try {
+			orderissuvos=(List<OrderIssueVO>) iuap.executeQuery(sql, new BeanListProcessor(OrderIssueVO.class));
+		} catch (BusinessException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		
+		
+//		CircularlyAccessibleValueObject[] vos = aggvo.getAllChildrenVO();
+//		List<OrderIssueVO> issuevos = new ArrayList<OrderIssueVO>();
+//		for(CircularlyAccessibleValueObject vo : vos) {
+//			if(vo instanceof OrderIssueVO) {
+//				//本次执行数量不填就默认
+//				//执行完的表体在生单界面不展示
+//				OrderIssueVO issuevo = (OrderIssueVO) vo;
+//				UFDouble num = issuevo.getNum() == null ? UFDouble.ZERO_DBL : issuevo.getNum();
+//				UFDouble execnum = issuevo.getExecnum() == null ? UFDouble.ZERO_DBL : issuevo.getExecnum();
+//				if(num.sub(execnum).compareTo(UFDouble.ZERO_DBL)==0){
+//					continue;
+//				}
+//				issuevo.setBdef5(num.sub(execnum).setScale(2, UFDouble.ROUND_HALF_UP).toString());
+//				issuevos.add(issuevo);
+//			}
+//		}
 		List<OrderIssueVO> issuevos = new ArrayList<OrderIssueVO>();
-		for(CircularlyAccessibleValueObject vo : vos) {
-			if(vo instanceof OrderIssueVO) {
+		if(null!=orderissuvos && orderissuvos.size()>0) {
+			for(OrderIssueVO vo:orderissuvos) {
 				//本次执行数量不填就默认
 				//执行完的表体在生单界面不展示
 				OrderIssueVO issuevo = (OrderIssueVO) vo;
@@ -125,15 +154,29 @@ public class ToMaterialOutDialog extends UIDialog implements ActionListener,Bill
 				if(num.sub(execnum).compareTo(UFDouble.ZERO_DBL)==0){
 					continue;
 				}
-				issuevo.setBdef2(num.sub(execnum).setScale(2, UFDouble.ROUND_HALF_UP).toString());
+				issuevo.setBdef5(num.sub(execnum).setScale(2, UFDouble.ROUND_HALF_UP).toString());
 				issuevos.add(issuevo);
 			}
+			
+		}else {
+			CircularlyAccessibleValueObject[] vos = aggvo.getAllChildrenVO();
+			for(CircularlyAccessibleValueObject vo : vos) {
+				if(vo instanceof OrderIssueVO) {
+					//本次执行数量不填就默认
+					//执行完的表体在生单界面不展示
+					OrderIssueVO issuevo = (OrderIssueVO) vo;
+					UFDouble num = issuevo.getNum() == null ? UFDouble.ZERO_DBL : issuevo.getNum();
+					UFDouble execnum = issuevo.getExecnum() == null ? UFDouble.ZERO_DBL : issuevo.getExecnum();
+					if(num.sub(execnum).compareTo(UFDouble.ZERO_DBL)==0){
+						continue;
+					}
+					issuevo.setBdef5(num.sub(execnum).setScale(2, UFDouble.ROUND_HALF_UP).toString());
+					issuevos.add(issuevo);
+				}
+			}
 		}
-//		Object[] objArrays = issuevos.toArray();
-//		OrderIssueVO[] issueArrays = new OrderIssueVO[objArrays.length];
-//		for(int i = 0;i < objArrays.length;i++) {
-//			issueArrays[i] = (OrderIssueVO) objArrays[i];
-//		}
+		
+		
 		OrderIssueVO[] issueArrays =issuevos.toArray(new OrderIssueVO[0]);
 		
 		return issueArrays;
@@ -219,7 +262,7 @@ public class ToMaterialOutDialog extends UIDialog implements ActionListener,Bill
 			int jfRowCount = getJlcardPanel().getRowCount();
 			if (jfRowCount > 0) {
 				for (int row = 0; row < jfRowCount; row++) {
-					getJlcardPanel().getBillModel().setValueAt(flag, row, "bdef20");
+					getJlcardPanel().getBillModel().setValueAt(flag, row, "bdef4");
 				}
 				
 			}
@@ -387,7 +430,7 @@ public class ToMaterialOutDialog extends UIDialog implements ActionListener,Bill
 				int k = 0;
 				for(int j = 0; j < vectors.size(); j++) {
 					Vector<Object> vector = (Vector<Object>)vectors.get(j);
-					//自定义项20 为勾选按钮 :勾选为Y 没有勾选是null
+					//自定义项4 为勾选按钮 :勾选为Y 没有勾选是null
 					if(null!=vector.get(0) &&  "Y".equals(vector.get(0).toString())){
 						GeneralBillItemVO itemvo = new GeneralBillItemVO();
 						String cmaterialcode = vector.get(7).toString();
@@ -417,7 +460,12 @@ public class ToMaterialOutDialog extends UIDialog implements ActionListener,Bill
 						itemvo.setBtransasset(UFBoolean.FALSE);
 						itemvo.setBzgflag(UFBoolean.FALSE);
 						itemvo.setCbodybilltypecode("4D");
-						itemvo.setCbodywarehouseid("1001V5100000000003GB");
+					//	itemvo.setCbodywarehouseid("1001V5100000000003GB");
+						if("工装".equals(billtype)) {
+							itemvo.setCbodywarehouseid("1001V51000000000039Z");//仓库必填
+						}else if("家装".equals(billtype)) {
+							itemvo.setCbodywarehouseid("1001V5100000000003A0");//仓库必填
+						}
 						itemvo.setCfirstbillhid(pk_order);
 						itemvo.setCfirstbillbid(vector.get(51).toString());
 						itemvo.setCfirsttype("55A2");
@@ -448,12 +496,30 @@ public class ToMaterialOutDialog extends UIDialog implements ActionListener,Bill
 						itemvo.setAttributeValue("processcost", new UFDouble(vector.get(24)==null?"0":vector.get(24).toString()));
 						itemvo.setPk_calbody(GetBaseDAOUtil.getcalpk(pk_corp));
 						itemvo.setVbatchcode(vector.get(6)==null?"":vector.get(6).toString());
+						Object fzdw=vector.get(27);
+						String castunitid=getpk(fzdw==null?"":fzdw.toString());
+						itemvo.setCastunitid(castunitid);//辅计量单位ID 
+						itemvo.setCastunitname(fzdw==null?"":fzdw.toString());//辅计量单位名称
 						itemvo.setVfirstbillcode(headvo.getVbillno());
 						itemvo.setVfree1(vector.get(11)==null?null:vector.get(11).toString());
 						itemvo.setVfree2(vector.get(13)==null?null:vector.get(13).toString());
 						itemvo.setVfree3(vector.get(12)==null?null:vector.get(12).toString());
 						itemvo.setVfree4(vector.get(14)==null?null:vector.get(14).toString());
 						itemvo.setVsourcebillcode(headvo.getVbillno());
+						itemvo.setAttributeValue("pk_defdoc1", vector.get(33)==null?null:vector.get(33).toString());//楼号楼层
+						itemvo.setAttributeValue("pk_defdoc2", vector.get(34)==null?null:vector.get(34).toString());//樘数(数量)
+						itemvo.setAttributeValue("pk_defdoc3", vector.get(35)==null?null:vector.get(35).toString());//框统计
+						itemvo.setAttributeValue("pk_defdoc4", vector.get(36)==null?null:vector.get(36).toString());//扇统计
+						itemvo.setAttributeValue("pk_defdoc5", vector.get(37)==null?null:vector.get(37).toString());//半成品分类
+						itemvo.setAttributeValue("pk_defdoc6", vector.get(38)==null?null:vector.get(38).toString());//面积
+						itemvo.setAttributeValue("pk_defdoc7", vector.get(39)==null?null:vector.get(39).toString());//切割长度
+						itemvo.setAttributeValue("pk_defdoc8", vector.get(40)==null?null:vector.get(40).toString());//切割角度左下
+						itemvo.setAttributeValue("pk_defdoc9", vector.get(41)==null?null:vector.get(41).toString());//切割角度右上
+						itemvo.setAttributeValue("pk_defdoc10",vector.get(42)==null?null:vector.get(42).toString());//备注
+						itemvo.setAttributeValue("pk_defdoc11",vector.get(18)==null?null:vector.get(18).toString());//宽度
+						itemvo.setAttributeValue("pk_defdoc12",vector.get(19)==null?null:vector.get(19).toString());//高度
+						itemvo.setAttributeValue("pk_defdoc13",vector.get(43)==null?null:vector.get(43).toString());//系列
+						itemvo.setAttributeValue("pk_defdoc14",vector.get(44)==null?null:vector.get(44).toString());//玻璃编号
 						//回写数量
 						UFDouble updatenum =  new UFDouble(vector.get(29)==null?"0":vector.get(29).toString()).add(new UFDouble(vector.get(1)==null?"0":vector.get(1).toString()));
 						updatemap.put(vector.get(51).toString(), updatenum);
@@ -542,7 +608,22 @@ public class ToMaterialOutDialog extends UIDialog implements ActionListener,Bill
 			}
 			
 		 }
+		
 	 }
+	
+	
+	//计量单位 
+	private String getpk(String shortname) throws BusinessException {
+	  String sql="select pk_measdoc from bd_measdoc where measname='"+shortname+"'  ";
+	  IUAPQueryBS iuap=(IUAPQueryBS) NCLocator.getInstance().lookup(IUAPQueryBS.class.getName());
+	  
+	  String pk_measdoc = (String) iuap.executeQuery(sql, new ColumnProcessor());
+      if (pk_measdoc == null) {
+          return "";
+      }
+      return pk_measdoc;
+		
+	}
 
 }
 

+ 326 - 38
mmpac/mmpac/src/client/u8c/ui/mmpac/action/ToSaleOutDialog.java

@@ -1,8 +1,11 @@
 package u8c.ui.mmpac.action;
 
+import java.awt.BorderLayout;
+import java.awt.Color;
 import java.awt.Component;
 import java.awt.Container;
 import java.awt.Dimension;
+import java.awt.FlowLayout;
 import java.awt.Toolkit;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
@@ -12,12 +15,16 @@ import java.util.List;
 import java.util.Map;
 import java.util.Vector;
 
+import javax.swing.BorderFactory;
 import javax.swing.JSplitPane;
+import javax.swing.border.BevelBorder;
 
 import nc.bs.framework.common.NCLocator;
 import nc.hr.utils.PubEnv;
+import nc.itf.uap.IUAPQueryBS;
 import nc.itf.uap.pf.IPFBusiAction;
 import nc.itf.uap.pf.IplatFormEntry;
+import nc.jdbc.framework.processor.BeanListProcessor;
 import nc.ui.pub.ClientEnvironment;
 import nc.ui.pub.beans.MessageDialog;
 import nc.ui.pub.beans.UIButton;
@@ -27,12 +34,14 @@ import nc.ui.pub.beans.UISplitPane;
 import nc.ui.pub.bill.BillCardPanel;
 import nc.ui.pub.bill.BillEditEvent;
 import nc.ui.pub.bill.BillEditListener;
+import nc.ui.querytemplate.QueryConditionDLG;
 import nc.vo.bd.invdoc.InvbasdocVO;
 import nc.vo.bd.invdoc.InvmandocVO;
 import nc.vo.hr.tools.pub.HRAggVO;
 import nc.vo.ic.pub.bill.GeneralBillHeaderVO;
 import nc.vo.ic.pub.bill.GeneralBillItemVO;
 import nc.vo.ic.pub.bill.GeneralBillVO;
+import nc.vo.pub.BusinessException;
 import nc.vo.pub.CircularlyAccessibleValueObject;
 import nc.vo.pub.VOStatus;
 import nc.vo.pub.lang.UFBoolean;
@@ -40,6 +49,8 @@ import nc.vo.pub.lang.UFDate;
 import nc.vo.pub.lang.UFDouble;
 import nc.vo.pub.pf.PfUtilWorkFlowVO;
 import nc.vo.pub.workflownote.WorkflownoteVO;
+import nc.vo.pubapp.pattern.pub.SqlBuilder;
+import nc.vo.querytemplate.TemplateInfo;
 import u8c.bs.servlet.service.GetBaseDAOUtil;
 import u8c.itf.mmpac.mmpac.IOrderTotalInfo;
 import u8c.pubitf.ic.out.ISaleOutMaintainAPI;
@@ -51,13 +62,20 @@ import u8c.vo.OrderMainVO;
 public class ToSaleOutDialog extends UIDialog implements ActionListener,BillEditListener{
 
 	private static final long serialVersionUID = -2605551888165671266L;
-	private UISplitPane mainpanel = null;//主面板
+	private int focus=1;
+	private UIPanel ivjUIPanel0 = null;
+	private UIPanel ivjUIPanel2 = null;
+	private UISplitPane mainpanel = null;
 	private BillCardPanel jlcardPanel = null;//卡面面板
 	private UIPanel jlbtnpanel = null;//存放按钮的panel
 	private UIButton saveCardBtn = null ; //保存
 	private UIButton cancelBtn = null ; //取消
+	private UIButton selectallBtn= null ; //全选按钮
+	private UIButton cancelallBtn= null ; //全消按钮
+	private UIButton queryBtn= null ;//查询按钮 
 	private ClientEnvironment ce = ClientEnvironment.getInstance();
 	private HRAggVO aggvo;
+	private OrderInVO[] inArrays = null;
 	ISaleOutMaintainAPI isaleout = NCLocator.getInstance().lookup(ISaleOutMaintainAPI.class);
 	IOrderTotalInfo iorder = NCLocator.getInstance().lookup(IOrderTotalInfo.class);
 	IplatFormEntry iIplatFormEntry = NCLocator.getInstance().lookup(IplatFormEntry.class);
@@ -68,28 +86,89 @@ public class ToSaleOutDialog extends UIDialog implements ActionListener,BillEdit
 		initialize(aggvo);
 	}
 
+//	private void initialize(HRAggVO aggvo) {
+//		Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
+//		setName("saleoutdlg");
+//		setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
+//		setTitle("生产总订单入库-销售出库");
+//		setSize(1000,360);
+//		this.setResizable(true);
+//		setLocation((dimension.width-550)/2, (dimension.height-300)/2);
+//		setContentPane(getMainPanel());
+//		addListenerEvent();
+//		this.aggvo = aggvo;
+//		//展示数据
+//		OrderInVO[] inArrays = getInVOs(aggvo);
+//		getJlcardPanel().getBillModel().setBodyDataVO(inArrays);
+//	}
+	
 	private void initialize(HRAggVO aggvo) {
 		Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
 		setName("saleoutdlg");
 		setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
 		setTitle("生产总订单入库-销售出库");
-		setSize(1000,360);
+//		setSize(1000,360);
+		setSize(dimension.width-100,dimension.height-200);
 		this.setResizable(true);
-		setLocation((dimension.width-550)/2, (dimension.height-300)/2);
-		setContentPane(getMainPanel());
+		add(getUIPanel0(), BorderLayout.NORTH);
+		add(getUIPanel2(), BorderLayout.CENTER);
+//		setLocation((dimension.width-550)/2, (dimension.height-300)/2);
+		setLocation(100/2, 200/2);
+//		setContentPane(getMainPanel());
 		addListenerEvent();
 		this.aggvo = aggvo;
 		//展示数据
 		OrderInVO[] inArrays = getInVOs(aggvo);
 		getJlcardPanel().getBillModel().setBodyDataVO(inArrays);
 	}
+	
+	
+	
+	
 
 	//按钮监听
 	private void addListenerEvent() {
 		getSaveCardBtn().addActionListener(this);
 		getCancelBtn().addActionListener(this);
+		getQueryBtn().addActionListener(this);
+		getSelectallBtn().addActionListener(this);
+		getCancelallBtn().addActionListener(this);
 		getJlcardPanel().addEditListener(this);
+		
 	}
+	
+	private UIPanel getUIPanel2() {
+		if (ivjUIPanel2 == null) {
+			ivjUIPanel2 = new UIPanel();
+			ivjUIPanel2.setLayout(new BorderLayout());
+			ivjUIPanel2.setPreferredSize(new Dimension(0, 500));
+			// ivjUIPanel2.add(getTablePanel(), BorderLayout.CENTER);
+			ivjUIPanel2.add(getMainPanel(), BorderLayout.CENTER);// ZTH
+		}
+		return this.ivjUIPanel2;
+	}
+	
+	
+	private UIPanel getUIPanel0() {
+		if (ivjUIPanel0 == null) {
+			try {
+				ivjUIPanel0 = new UIPanel();
+				ivjUIPanel0.setLayout(new FlowLayout(FlowLayout.LEFT));
+				ivjUIPanel0.add(getQueryBtn());
+				ivjUIPanel0.add(getSelectallBtn());
+				ivjUIPanel0.add(getCancelallBtn());
+			} catch (Throwable ivjExc) {
+				handleException(ivjExc);
+			}
+		}
+		return this.ivjUIPanel0;
+	}
+	
+	
+   private void handleException(Throwable e) {
+		
+	}
+	
 
 	private UISplitPane getMainPanel() {
 		if(mainpanel==null){
@@ -97,7 +176,7 @@ public class ToSaleOutDialog extends UIDialog implements ActionListener,BillEdit
 			mainpanel.setOrientation(JSplitPane.VERTICAL_SPLIT);
 			mainpanel.setTopComponent(getJlcardPanel());
 			mainpanel.setBottomComponent(getJlbtnpanel());
-			mainpanel.setDividerLocation(280);//分割位置
+			mainpanel.setDividerLocation(750);//分割位置
 			mainpanel.setOneTouchExpandable(true);
 			mainpanel.setDividerSize(8);
 		}
@@ -134,13 +213,55 @@ public class ToSaleOutDialog extends UIDialog implements ActionListener,BillEdit
 		}
 		return saveCardBtn;
 	}
+	
+	
+	private UIButton getQueryBtn() {
+		if (queryBtn == null) {
+			queryBtn = new UIButton();
+			queryBtn.setName("queryBtn");
+			queryBtn.setText("  筛选  ");
+			Color clrBack = new Color(0XC4C4C4);
+			queryBtn.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED,
+					Color.white,clrBack, new Color(0X5F5F5F), clrBack));
+		
+			
+		}
+		return this.queryBtn;
+	}
+
+	
+	private UIButton getSelectallBtn() {
+		if (selectallBtn == null) {
+			selectallBtn = new UIButton();
+			selectallBtn.setName("selectallBtn");
+			selectallBtn.setText("  全选  ");
+			Color clrBack = new Color(0XC4C4C4);
+			selectallBtn.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED,
+					Color.white,clrBack, new Color(0X5F5F5F), clrBack));
+		}
+		return this.selectallBtn;
+	}
+
+	private UIButton getCancelallBtn() {
+		if (cancelallBtn == null) {
+			cancelallBtn = new UIButton();
+			cancelallBtn.setName("cancelallBtn");
+			cancelallBtn.setText("  全消  ");
+			Color clrBack = new Color(0XC4C4C4);
+			cancelallBtn.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED,
+					Color.white,clrBack, new Color(0X5F5F5F), clrBack));
+		}
+		return this.cancelallBtn;
+	}
+	
 
 	private BillCardPanel getJlcardPanel() {
 		if(jlcardPanel==null){
 			jlcardPanel=new BillCardPanel();
 			jlcardPanel.setName("jlcardPanel");
 			//根据单据模板编码加载模板
-			jlcardPanel.loadTemplet("A224C",null,ce.getUser().getPrimaryKey(),ce.getCorporation().getPrimaryKey());
+//			jlcardPanel.loadTemplet("A224C",null,ce.getUser().getPrimaryKey(),ce.getCorporation().getPrimaryKey());
+			jlcardPanel.loadTemplet("QS412",null,ce.getUser().getPrimaryKey(),ce.getCorporation().getPrimaryKey());
 		}
 		
 		return jlcardPanel;
@@ -149,26 +270,80 @@ public class ToSaleOutDialog extends UIDialog implements ActionListener,BillEdit
 	//根据传入的aggvo获取invo数组
 	private OrderInVO[] getInVOs(HRAggVO aggvo) {
 		CircularlyAccessibleValueObject[] vos = aggvo.getAllChildrenVO();
-		List<OrderInVO> invos = new ArrayList();
-		for(CircularlyAccessibleValueObject vo : vos) {
+		//查询最新的数据
+		OrderMainVO headvo=(OrderMainVO) aggvo.getParentVO();
+		String pk_order=headvo.getPk_order();//主表主键
+		IUAPQueryBS iuap=NCLocator.getInstance().lookup(IUAPQueryBS.class);
+		String sql="select * from mmpac_order_in where pk_order='"+pk_order+"' and isnull(dr,0)=0  ";
+		List<OrderInVO> orderinvos=null;
+		try {
+			orderinvos=(List<OrderInVO>) iuap.executeQuery(sql, new BeanListProcessor(OrderInVO.class));
+		} catch (BusinessException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		
+		List<OrderInVO> invos = new ArrayList<OrderInVO>();
+//		for(CircularlyAccessibleValueObject vo : vos) {
+//			if(vo instanceof OrderInVO) {
+//				//本次执行数量不填就默认
+//				//执行完的表体在生单界面不展示
+//				OrderInVO invo = (OrderInVO) vo;
+//				UFDouble num = invo.getNum() == null ? new UFDouble(0) : invo.getNum();
+//				UFDouble execnum = invo.getExecnum() == null ? new UFDouble(0) : invo.getExecnum();
+////				if(num.equals(execnum) && num.equals(new UFDouble(0))) {
+////					continue;
+////				}
+//				if(num.sub(execnum).compareTo(UFDouble.ZERO_DBL)==0) {
+//					continue;
+//				}
+//				invo.setBdef5(num.sub(execnum).toString());
+//				invos.add(invo);
+//			}
+//		}
+//		OrderInVO[] inArrays = new OrderInVO[invos.size()];
+//		for(int i = 0;i < invos.size();i++) {
+//			inArrays[i] = invos.get(i);
+//		}
+		
+		List<OrderInVO> issuevos = new ArrayList<OrderInVO>();
+		if(null!=orderinvos && orderinvos.size()>0) {
+			for(OrderInVO invo:orderinvos) {
+				UFDouble num = invo.getNum() == null ? new UFDouble(0) : invo.getNum();
+				UFDouble execnum = invo.getExecnum() == null ? new UFDouble(0) : invo.getExecnum();
+				if(num.sub(execnum).compareTo(UFDouble.ZERO_DBL)==0) {
+					continue;
+				}
+				invo.setBdef5(num.sub(execnum).toString());
+				invos.add(invo);
+			}
+			
+		}else {
+			
+			for(CircularlyAccessibleValueObject vo : vos) {
 			if(vo instanceof OrderInVO) {
 				//本次执行数量不填就默认
 				//执行完的表体在生单界面不展示
 				OrderInVO invo = (OrderInVO) vo;
 				UFDouble num = invo.getNum() == null ? new UFDouble(0) : invo.getNum();
 				UFDouble execnum = invo.getExecnum() == null ? new UFDouble(0) : invo.getExecnum();
-				if(num.equals(execnum) && num.equals(new UFDouble(0))) {
+//				if(num.equals(execnum) && num.equals(new UFDouble(0))) {
+//					continue;
+//				}
+				if(num.sub(execnum).compareTo(UFDouble.ZERO_DBL)==0) {
 					continue;
 				}
-				invo.setBdef2(num.sub(execnum).toString());
+				invo.setBdef5(num.sub(execnum).toString());
 				invos.add(invo);
 			}
 		}
-		OrderInVO[] inArrays = new OrderInVO[invos.size()];
-		for(int i = 0;i < invos.size();i++) {
-			inArrays[i] = invos.get(i);
-		}
-		return inArrays;
+		
+	}
+		
+		OrderInVO [] issueArrays =invos.toArray(new OrderInVO[0]);
+		
+		
+		return issueArrays;
 	}
 
 	@Override
@@ -182,6 +357,25 @@ public class ToSaleOutDialog extends UIDialog implements ActionListener,BillEdit
 		// TODO Auto-generated method stub
 		
 	}
+	
+	
+	/**
+	 * 全选与反选,flag为true时,全选操作,flag为false时,进行反选操作
+	 */
+	private void onselectall(boolean flag) {
+		switch (focus) {
+		case 1:
+			int jfRowCount = getJlcardPanel().getRowCount();
+			if (jfRowCount > 0) {
+				for (int row = 0; row < jfRowCount; row++) {
+					getJlcardPanel().getBillModel().setValueAt(flag, row, "bdef4");
+				}
+				
+			}
+			break;
+
+		}
+	}
 
 	@Override
 	public void actionPerformed(ActionEvent e) {
@@ -219,8 +413,11 @@ public class ToSaleOutDialog extends UIDialog implements ActionListener,BillEdit
 					return;
 				}
 				OrderMainVO headvo = (OrderMainVO) this.aggvo.getParentVO();
+				//业务类型
+				String billtype=headvo.getBusitype();
 				String pk_corp = headvo.getPk_corp();
 				String pk_order = headvo.getPk_order();
+				String prjcode = headvo.getProjectid();//项目主键
 				GeneralBillVO[] aggvos = new GeneralBillVO[1];
 				GeneralBillVO aggvo = new GeneralBillVO();
 				GeneralBillHeaderVO icheadvo = new GeneralBillHeaderVO();
@@ -228,7 +425,12 @@ public class ToSaleOutDialog extends UIDialog implements ActionListener,BillEdit
 				icheadvo.setPk_calbody(GetBaseDAOUtil.getcalpk(pk_corp));
 				icheadvo.setDbilldate(PubEnv.getServerDate());
 				icheadvo.setCoperatorid(PubEnv.getPk_user());
-				icheadvo.setCwarehouseid("1001V5100000000003A1");//仓库必填
+				//仓库ID
+				if("工装".equals(billtype)) {
+					icheadvo.setCwarehouseid("1001V51000000000039Z");//仓库必填
+				}else if("家装".equals(billtype)) {
+					icheadvo.setCwarehouseid("1001V5100000000003A0");//仓库必填
+				}
 				icheadvo.setBoutretflag(UFBoolean.FALSE);//是否退回 
 				icheadvo.setBsalecooppur(UFBoolean.FALSE); // 销售出是否已协同生成采购入 
 				icheadvo.setVnote("来源生产总订单");//备注
@@ -241,6 +443,7 @@ public class ToSaleOutDialog extends UIDialog implements ActionListener,BillEdit
 				icheadvo.setPk_cubasdocC("0001V510000000000674");//客户基本档案
 				icheadvo.setFbillflag(2);
 				icheadvo.setCoperatoridnow(PubEnv.getPk_user());//设置当前操作人
+				icheadvo.setAttributeValue("pk_defdoc1", vectors.get(0).get(2)==null?"":vectors.get(0).get(2).toString());//开票类型
 				aggvo.setParentVO(icheadvo);
 				GeneralBillItemVO[] itemvos = new GeneralBillItemVO[execsize];
 				Map<String, UFDouble> updatemap = new HashMap<>();
@@ -248,7 +451,7 @@ public class ToSaleOutDialog extends UIDialog implements ActionListener,BillEdit
 				int k = 0;
 				for(int j = 0; j < vectors.size(); j++) {
 					Vector<Object> vector = (Vector<Object>)vectors.get(j);
-					//自定义项20为勾选按钮 :勾选为Y 没有勾选是null
+					//自定义项4为勾选按钮 :勾选为Y 没有勾选是null
 					if(null!=vector.get(0) &&  "Y".equals(vector.get(0).toString())){
 						GeneralBillItemVO itemvo = new GeneralBillItemVO();
 						String cmaterialcode = vector.get(8).toString();
@@ -260,14 +463,15 @@ public class ToSaleOutDialog extends UIDialog implements ActionListener,BillEdit
 							InvbasdocVO invbasvo  = GetBaseDAOUtil.getInvVO(cmaterialcode);
 							pk_invbasdoc = invbasvo.getPrimaryKey();
 						}
-						String prjcode = vector.get(3).toString();
-						String cprojectid = "";
-						if(prjcode.startsWith("1001")) {
-							cprojectid = prjcode;
-						}
-						else {
-							cprojectid = GetBaseDAOUtil.getprojectid(prjcode);
-						}
+//						String prjcode = vector.get(3).toString();
+//						String cprojectid = "";
+//						if(prjcode.startsWith("1001")) {
+//							cprojectid = prjcode;
+//						}
+//						else {
+//							cprojectid = GetBaseDAOUtil.getprojectid(prjcode);
+//						}
+						String cprojectid=prjcode;
 						InvmandocVO invmanvo = GetBaseDAOUtil.getInvmanVO(pk_invbasdoc);
 						String pk_invmandoc = invmanvo.getPrimaryKey();
 						itemvo.setBbarcodeclose(UFBoolean.FALSE);
@@ -278,9 +482,14 @@ public class ToSaleOutDialog extends UIDialog implements ActionListener,BillEdit
 						itemvo.setBtransasset(UFBoolean.FALSE);
 						itemvo.setBzgflag(UFBoolean.FALSE);
 						itemvo.setCbodybilltypecode("4C");
-						itemvo.setCbodywarehouseid("1001V5100000000003A1");
+				//		itemvo.setCbodywarehouseid("1001V5100000000003A1");
+						if("工装".equals(billtype)) {
+							itemvo.setCbodywarehouseid("1001V51000000000039Z");//仓库必填
+						}else if("家装".equals(billtype)) {
+							itemvo.setCbodywarehouseid("1001V5100000000003A0");//仓库必填
+						}
 						itemvo.setCfirstbillhid(pk_order);
-						itemvo.setCfirstbillbid(vector.get(51).toString());
+						itemvo.setCfirstbillbid(vector.get(34).toString());
 //						itemvo.setCfirsttype("55A2");
 						itemvo.setCinvbasid(pk_invbasdoc);
 						itemvo.setCinventoryid(pk_invmandoc);
@@ -290,7 +499,7 @@ public class ToSaleOutDialog extends UIDialog implements ActionListener,BillEdit
 						itemvo.setCreceieveid("0001V510000000000AJH");//收货单位
 						itemvo.setCrowno(Integer.toString((k+1)*10));
 						itemvo.setCsourcebillhid(pk_order);
-						itemvo.setCsourcebillbid(vector.get(51).toString());
+						itemvo.setCsourcebillbid(vector.get(34).toString());
 //						itemvo.setCsourcetype("55A2");
 						itemvo.setVsourcerowno("10");
 						itemvo.setDbizdate(PubEnv.getServerDate());
@@ -301,15 +510,15 @@ public class ToSaleOutDialog extends UIDialog implements ActionListener,BillEdit
 						itemvo.setIsok(UFBoolean.FALSE);
 						itemvo.setNbarcodenum(new UFDouble(0));
 						itemvo.setNoutnum(new UFDouble(vector.get(1)==null?"0":vector.get(1).toString()));
-						itemvo.setNquotentprice(new UFDouble(vector.get(27)==null?"0":vector.get(27).toString()));//原币无税单价
-						itemvo.setNquotentmny(itemvo.getNoutnum().multiply(itemvo.getNquotentprice()));//原币无税金额
-						itemvo.setAttributeValue("nquoteprice", new UFDouble(vector.get(23)==null?"0":vector.get(23).toString()));//报价含税单价
-						itemvo.setAttributeValue("nquotemny", itemvo.getNoutnum().multiply(new UFDouble(vector.get(23)==null?"0":vector.get(23).toString())));//报价含税金额
-						itemvo.setNsaleprice(new UFDouble(vector.get(27)==null?"0":vector.get(27).toString()));//销售价格
-						itemvo.setNsalemny(itemvo.getNoutnum().multiply(new UFDouble(vector.get(27)==null?"0":vector.get(27).toString())));//销售金额
+//						itemvo.setNquotentprice(new UFDouble(vector.get(27)==null?"0":vector.get(27).toString()));//原币无税单价
+//						itemvo.setNquotentmny(itemvo.getNoutnum().multiply(itemvo.getNquotentprice()));//原币无税金额
+//						itemvo.setAttributeValue("nquoteprice", new UFDouble(vector.get(23)==null?"0":vector.get(23).toString()));//报价含税单价
+//						itemvo.setAttributeValue("nquotemny", itemvo.getNoutnum().multiply(new UFDouble(vector.get(23)==null?"0":vector.get(23).toString())));//报价含税金额
+//						itemvo.setNsaleprice(new UFDouble(vector.get(27)==null?"0":vector.get(27).toString()));//销售价格
+//						itemvo.setNsalemny(itemvo.getNoutnum().multiply(new UFDouble(vector.get(27)==null?"0":vector.get(27).toString())));//销售金额
 						itemvo.setNshouldoutnum(new UFDouble(vector.get(1)==null?"0":vector.get(1).toString()));
-						itemvo.setNtaxprice(new UFDouble(vector.get(23)==null?"0":vector.get(23).toString()));
-						itemvo.setNtaxmny(itemvo.getNoutnum().multiply(new UFDouble(vector.get(23)==null?"0":vector.get(23).toString())));
+//						itemvo.setNtaxprice(new UFDouble(vector.get(23)==null?"0":vector.get(23).toString()));
+//						itemvo.setNtaxmny(itemvo.getNoutnum().multiply(new UFDouble(vector.get(23)==null?"0":vector.get(23).toString())));
 						
 						itemvo.setPk_bodycalbody(GetBaseDAOUtil.getcalpk(pk_corp));
 						itemvo.setPk_calbody(GetBaseDAOUtil.getcalpk(pk_corp));
@@ -327,9 +536,23 @@ public class ToSaleOutDialog extends UIDialog implements ActionListener,BillEdit
 //						itemvo.setHsl(new UFDouble(1));//换算率
 //						itemvo.setCastunitid(GetBaseDAOUtil.getMeasid(vector.get(21).toString()));//辅计量单位
 						itemvo.setVsourcebillcode(headvo.getVbillno());
+						itemvo.setAttributeValue("pk_defdoc1", vector.get(37)==null?null:vector.get(37).toString());//楼号楼层
+						itemvo.setAttributeValue("pk_defdoc2", vector.get(38)==null?null:vector.get(38).toString());//樘数(数量)
+						itemvo.setAttributeValue("pk_defdoc3", vector.get(39)==null?null:vector.get(39).toString());//框统计
+						itemvo.setAttributeValue("pk_defdoc4", vector.get(40)==null?null:vector.get(40).toString());//扇统计
+						itemvo.setAttributeValue("pk_defdoc5", vector.get(41)==null?null:vector.get(41).toString());//半成品分类
+						itemvo.setAttributeValue("pk_defdoc6", vector.get(42)==null?null:vector.get(42).toString());//面积
+						itemvo.setAttributeValue("pk_defdoc7", vector.get(43)==null?null:vector.get(43).toString());//切割长度
+						itemvo.setAttributeValue("pk_defdoc8", vector.get(44)==null?null:vector.get(44).toString());//切割角度左下
+						itemvo.setAttributeValue("pk_defdoc9", vector.get(45)==null?null:vector.get(45).toString());//切割角度右上
+						itemvo.setAttributeValue("pk_defdoc10",vector.get(46)==null?null:vector.get(46).toString());//备注
+						itemvo.setAttributeValue("pk_defdoc11",vector.get(19)==null?null:vector.get(19).toString());//宽度
+						itemvo.setAttributeValue("pk_defdoc12",vector.get(20)==null?null:vector.get(20).toString());//高度
+						itemvo.setAttributeValue("pk_defdoc13",vector.get(47)==null?null:vector.get(47).toString());//系列
+						itemvo.setAttributeValue("pk_defdoc14",vector.get(48)==null?null:vector.get(48).toString());//玻璃编号
 						//回写数量
 						UFDouble updatenum =  new UFDouble(vector.get(30)==null?"0":vector.get(30).toString()).add(new UFDouble(vector.get(1)==null?"0":vector.get(1).toString()));
-						updatemap.put(vector.get(51).toString(), updatenum);
+						updatemap.put(vector.get(34).toString(), updatenum);
 						itemvos[k]=itemvo;
 						k = k + 1;
 					}
@@ -341,7 +564,8 @@ public class ToSaleOutDialog extends UIDialog implements ActionListener,BillEdit
 				GeneralBillVO resvo = res[0];
 				Boolean updateres = iorder.UpdateInExecNum(updatemap);
 				
-				MessageDialog.showHintDlg(mainpanel, "成功", "销售出库单"+resvo.getVBillCode()+"新增成功");
+			//	MessageDialog.showHintDlg(mainpanel, "成功", "销售出库单"+resvo.getVBillCode()+"新增成功");
+				this.closeCancel();
 			}  catch (Exception e1) {
 				MessageDialog.showErrorDlg(mainpanel, "错误", e1.getMessage());
 				return;
@@ -353,6 +577,70 @@ public class ToSaleOutDialog extends UIDialog implements ActionListener,BillEdit
 			this.closeCancel();
 		}
 		
+		
+
+		// 全选
+		if (e.getSource() == getSelectallBtn()) {
+			onselectall(true);
+		}
+
+		// 全消
+		if (e.getSource() == getCancelallBtn()) {
+			onselectall(false);
+		}
+		
+		
+		// 筛选
+		if (e.getSource() == getQueryBtn()) {
+			TemplateInfo ti = new TemplateInfo();
+			ti.setTemplateId(null);
+			ti.setPk_Org(ce.getCorporation().getPrimaryKey());
+			ti.setUserid(ce.getUser().getPrimaryKey());
+			ti.setCurrentCorpPk(ce.getCorporation().getPrimaryKey());
+			// 功能节点默人模板分配后查询SELECT * from pub_systemplate order by ts desc
+			ti.setFunNode("40H204");
+			ti.setNodekey("qt");
+			QueryConditionDLG d = new QueryConditionDLG(this, ti, "销售出库明细");
+			Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
+			d.setSize(dimension.width - 1000, dimension.height - 650);
+			d.setLocation(500, 300);
+			if (d.showModal() != UIDialog.ID_OK) {
+				return;
+			}
+
+			String dlgsql = d.getWhereSQL();
+			if (!(null != dlgsql && !"".equals(dlgsql))) {
+				getJlcardPanel().getBillModel().setBodyDataVO(inArrays);
+				return;
+			}
+			String quresql = "select * from mmpac_order_in where  " + dlgsql + " and ";
+			IUAPQueryBS iuap = (IUAPQueryBS) NCLocator.getInstance().lookup(IUAPQueryBS.class.getName());
+
+			try {
+				List<String> pks = new ArrayList<String>();
+				if (null != inArrays && inArrays.length > 0) {
+					for (OrderInVO vo : inArrays) {
+						String pk_order_in = vo.getPk_order_in();
+						pks.add(pk_order_in);
+					}
+					SqlBuilder sqlbuild = new SqlBuilder();
+					sqlbuild.append(quresql);
+					sqlbuild.append("pk_order_issue", pks.toArray(new String[0]));
+					List<OrderInVO> lisorderinvos = (List<OrderInVO>) iuap.executeQuery(sqlbuild.toString(),
+							new BeanListProcessor(OrderInVO.class));
+					OrderInVO[] invos = lisorderinvos.toArray(new OrderInVO[0]);
+					getJlcardPanel().getBillModel().setBodyDataVO(invos);
+
+				} else {
+					getJlcardPanel().getBillModel().setBodyDataVO(null);
+				}
+
+			} catch (BusinessException e1) {
+				// TODO Auto-generated catch block
+				e1.printStackTrace();
+			}
+
+		}
 	
 	}