Browse Source

生产总订单panel

zthwr 9 months ago
parent
commit
2ea4c18428

+ 170 - 1
mmpac/mmpac/src/client/u8c/ui/mmpac/panel/OrderMainPanel.java

@@ -1,18 +1,32 @@
 package u8c.ui.mmpac.panel;
 package u8c.ui.mmpac.panel;
 
 
+import java.awt.Color;
+import java.util.HashMap;
+import java.util.List;
+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.ui.hr.frame.FrameUI;
 import nc.ui.hr.frame.FrameUI;
 import nc.ui.hr.frame.impl.MainBillMgrPanel;
 import nc.ui.hr.frame.impl.MainBillMgrPanel;
 import nc.ui.hr.frame.state.StateRegister;
 import nc.ui.hr.frame.state.StateRegister;
+import nc.ui.pub.beans.MessageDialog;
+import nc.ui.pub.bill.BillCardPanel;
 import nc.ui.pub.bill.BillEditEvent;
 import nc.ui.pub.bill.BillEditEvent;
 import nc.ui.pub.bill.BillItemEvent;
 import nc.ui.pub.bill.BillItemEvent;
 import nc.ui.pub.bill.IBillItem;
 import nc.ui.pub.bill.IBillItem;
 import nc.vo.hr.tools.pub.HRConstEnum;
 import nc.vo.hr.tools.pub.HRConstEnum;
+import nc.vo.pub.BusinessException;
+import u8c.itf.mmpac.mmpac.IOrderTotalInfo;
 import u8c.ui.mmpac.datamodel.OrderDataModel;
 import u8c.ui.mmpac.datamodel.OrderDataModel;
+import u8c.vo.OrderInVO;
 
 
 public class OrderMainPanel extends MainBillMgrPanel{
 public class OrderMainPanel extends MainBillMgrPanel{
 
 
 	public int selectedRow = -1;
 	public int selectedRow = -1;
-	
+	public IUAPQueryBS iuap=NCLocator.getInstance().lookup(IUAPQueryBS.class);
 	public OrderMainPanel(FrameUI frameUI, String strBillType2, String strBusiType2) {
 	public OrderMainPanel(FrameUI frameUI, String strBillType2, String strBusiType2) {
 		super(frameUI, strBillType2, strBusiType2);
 		super(frameUI, strBillType2, strBusiType2);
 		initComboBox();
 		initComboBox();
@@ -41,18 +55,173 @@ public class OrderMainPanel extends MainBillMgrPanel{
 	
 	
 	@Override
 	@Override
 	public void afterEdit(BillEditEvent evt) { 
 	public void afterEdit(BillEditEvent evt) { 
+	  //表体、表头编辑后事件	
+//	  String field=evt.getKey();
+//	  String value=(String) evt.getValue();
+//	  String oldvalue=(String) evt.getOldValue();
+//	  value=oldvalue;
+//	  
+//	  //获取panle
+//	  BillCardPanel bcp=getBillCardPanel();
+//	  if(OrderInVO.COLOR.equals(field)) {
+//		//  bcp.setBodyValueAt(oldvalue, selectedRow, OrderInVO.COLOR, "mmpac_order_otherin");
+//		  
+//	  }
+
+		String field=evt.getKey();
+//		if("cmaterialcode".equals(field)) {
+//			
+//			try {
+//				Map<String,String> map = getInvbasdoc(evt.getValue().toString());
+//				BillCardPanel bcp=this.getBillCardPanel();
+////				getBillCardPanel().getHeadItem("vdef3").setEnabled(false);//表头不可编辑
+//				//颜色
+//				String free1 = map.get("free1");
+//				if(null==free1) {
+//					bcp.getBillModel().setCellEditable(evt.getRow(),"color", false);//不可编辑
+//			//		bcp.getBodyItem("color").setNull(false);//不用必输
+//				}else {
+//			//		bcp.getBodyItem("color").setNull(true);//必输项
+////					Color clrBack = new Color(209, 214, 251);
+////					bcp.getBodyPanel().setCellBackGround(0, "color", clrBack);
+//					bcp.getBillModel("mmpac_order_in").setBackground(Color.yellow,
+//							evt.getRow(),
+//                            bcp.getBillModel("mmpac_order_in").getItemIndex("color"));
+//				}
+//				//定尺
+//				String free3 = map.get("free3");
+//				if(null==free3) {
+//					bcp.getBillModel().setCellEditable(evt.getRow(),"sizing", false);//不可编辑
+//				//	bcp.getBodyItem("sizing").setNull(false);//不用必输
+//				}else {
+//				//	bcp.getBodyItem("sizing").setNull(true);//必输项
+//				}
+//				//合金
+//				String free2 = map.get("free2");
+//				if(null==free2) {
+//					bcp.getBillModel().setCellEditable(evt.getRow(),"alloy", false);//不可编辑
+//				//	bcp.getBodyItem("alloy").setNull(false);//不用必输
+//				}else {
+//				//	bcp.getBodyItem("alloy").setNull(true);//必输项
+//				}
+//				//标准
+//				String free4 = map.get("free4");
+//				if(null==free4) {
+//					bcp.getBillModel().setCellEditable(evt.getRow(),"standard", false);//不可编辑
+//				//	bcp.getBodyItem("standard").setNull(false);//不用必输
+//				}else {
+//				//	bcp.getBodyItem("standard").setNull(true);//必输项
+//				}
+//			
+//				
+//				
+//			} catch (BusinessException e) {
+//				// TODO Auto-generated catch block
+//				e.printStackTrace();
+//			}
+//			
+//		}
+		
+		Map<String,String> map=new HashMap<String,String>();
+		if("color".equals(field)) {
+		//	MessageDialog.showHintDlg(null, "提示", "Ok");
+			//保存数据到数据库
+			String tablecode= evt.getTableCode();
+			if("mmpac_order_otherin".equals(tablecode)) {
+				String value=(String) evt.getValue();
+				String pk=(String) getBillCardPanel().getBodyValueAt(evt.getRow(), "pk_order_otherin");//PK
+				map.put(pk, value);
+			}
+			
+		}
+		
+		
+		if("bdef5".equals(field)) {
+		    //是否委外标识
+			String tablecode= evt.getTableCode();
+			if("mmpac_order_issue".equals(tablecode)) {
+				//查询Bdef1 对应的出入库是否生成下游单据,生成了就不允许改成否
+				String pk=(String) getBillCardPanel().getBodyValueAt(evt.getRow(), "pk_order_issue");//PK
+				//查询出入库数据看已执行数量是否为空,不为空就不能取消标识
+				try {
+					Object objenumin=getTablevalue("execnum", "mmpac_order_otherin", "bdef1='" + pk + "' ");
+					Object objenumout=getTablevalue("execnum", "mmpac_order_otherout", "bdef1='" + pk + "' ");
+					
+					if(null!=objenumin  ||  null!=objenumout ) {
+						 MessageDialog.showErrorDlg(null, "提示", "已经生成下游单据不能取消!");
+						 this.getBillCardPanel().setBodyValueAt("Y", evt.getRow(),"bdef5" );
+						 return;
+					}
+					
+					
+				} catch (BusinessException e) {
+					
+					MessageDialog.showErrorDlg(null, "错误", e.getMessage());
+				}
+				
+				
+				
+			 }
+		  }
+		
+		
+		try {
+			if(null!=map &&  map.size()>0) {
+				StringBuffer sbf=new StringBuffer();
+				for (Map.Entry<String,String> entry : map.entrySet()) {
+					sbf.append("update mmpac_order_otherin set color='"+entry.getValue()+"' where  pk_order_otherin='"+entry.getKey()+"'; ");
+				}
+				IOrderTotalInfo iorderinfo=NCLocator.getInstance().lookup(IOrderTotalInfo.class);
+				iorderinfo.updateExecnum(sbf.toString());
+			}
+			
+		} catch (BusinessException e) {
+			// TODO Auto-generated catch block
+			MessageDialog.showErrorDlg(null, "错误", e.getMessage());
+		}
+		
 		super.afterEdit(evt);
 		super.afterEdit(evt);
 	}
 	}
 	
 	
 	@Override
 	@Override
 	protected boolean beforeEdit(BillItemEvent evt) { 
 	protected boolean beforeEdit(BillItemEvent evt) { 
+		//表头编辑前
 		return super.beforeEdit(evt);
 		return super.beforeEdit(evt);
 	}
 	}
 
 
 	@Override
 	@Override
 	public boolean beforeEdit(BillEditEvent evt) { 
 	public boolean beforeEdit(BillEditEvent evt) { 
+		//表体编辑前
+//	   evt.getSource();
+//	   OrderDataModel dataModel = (OrderDataModel) getParentUI().getDataModel();
+//	   String field=evt.getKey();
+//	   String value=(String) evt.getValue();
+//	   String oldvalue=(String) evt.getOldValue();
+//	   value=oldvalue;
+//		 //获取panle
+//		BillCardPanel bcp=getBillCardPanel();
+//		if(OrderInVO.COLOR.equals(field)) {
+//		   bcp.setBodyValueAt(oldvalue, selectedRow, OrderInVO.COLOR, "mmpac_order_otherin");
+//		}
+		
 		return super.beforeEdit(evt);
 		return super.beforeEdit(evt);
 	}
 	}
 	
 	
 	
 	
+	
+	  
+    //查询物料的自由项
+	 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());
+    }
+
+	 //查询表数据
+	 public Object getTablevalue(String value,String table,String where)throws BusinessException {
+    	String sql = "select "+value+"  from "+table+" where  "+where+" ";
+    	return  iuap.executeQuery(sql.toString(), new ColumnProcessor());
+    }
+
+	
+	
 }
 }

+ 22 - 5
mmpac/mmpac/src/client/u8c/ui/mmpac/panel/OrderTestUI.java

@@ -12,6 +12,7 @@ import nc.ui.hr.frame.bill.manage.ManageDataModel;
 import nc.ui.hr.frame.button.AbstractBtnReg;
 import nc.ui.hr.frame.button.AbstractBtnReg;
 import nc.ui.hr.frame.button.BtnStateReg;
 import nc.ui.hr.frame.button.BtnStateReg;
 import nc.ui.pub.bill.BillCardPanel;
 import nc.ui.pub.bill.BillCardPanel;
+import u8c.ui.mmpac.action.CardRefreshAction;
 import u8c.ui.mmpac.action.GenOtheroutinAction;
 import u8c.ui.mmpac.action.GenOtheroutinAction;
 import u8c.ui.mmpac.action.OrderAddAction;
 import u8c.ui.mmpac.action.OrderAddAction;
 import u8c.ui.mmpac.action.OrderApproveAction;
 import u8c.ui.mmpac.action.OrderApproveAction;
@@ -23,12 +24,14 @@ import u8c.ui.mmpac.action.OrderQueryAction;
 import u8c.ui.mmpac.action.OrderReturnFromCardToListAction;
 import u8c.ui.mmpac.action.OrderReturnFromCardToListAction;
 import u8c.ui.mmpac.action.OrderSaveAction;
 import u8c.ui.mmpac.action.OrderSaveAction;
 import u8c.ui.mmpac.action.OrderUnApproveAction;
 import u8c.ui.mmpac.action.OrderUnApproveAction;
+import u8c.ui.mmpac.action.OutSourcingAction;
 import u8c.ui.mmpac.action.PrintBarcodeAction;
 import u8c.ui.mmpac.action.PrintBarcodeAction;
 import u8c.ui.mmpac.action.PushMaterialAction;
 import u8c.ui.mmpac.action.PushMaterialAction;
 import u8c.ui.mmpac.action.PushOtherInAction;
 import u8c.ui.mmpac.action.PushOtherInAction;
 import u8c.ui.mmpac.action.PushOtherOutAction;
 import u8c.ui.mmpac.action.PushOtherOutAction;
 import u8c.ui.mmpac.action.PushProductAction;
 import u8c.ui.mmpac.action.PushProductAction;
 import u8c.ui.mmpac.action.PushSaleOutAction;
 import u8c.ui.mmpac.action.PushSaleOutAction;
+import u8c.ui.mmpac.action.UpdateColorAction;
 import u8c.ui.mmpac.datamodel.OrderDataModel;
 import u8c.ui.mmpac.datamodel.OrderDataModel;
 import u8c.ui.mytest.button.MyBtnStateReg;
 import u8c.ui.mytest.button.MyBtnStateReg;
 
 
@@ -60,20 +63,28 @@ public class OrderTestUI extends FrameUI{
 //		getBtnManager().addButtonByID(AbstractBtnReg.SYSBTN_EXPORT);
 //		getBtnManager().addButtonByID(AbstractBtnReg.SYSBTN_EXPORT);
 //		getBtnManager().addButtonByID(AbstractBtnReg.USERBTN_PUSHMATERIAL);
 //		getBtnManager().addButtonByID(AbstractBtnReg.USERBTN_PUSHMATERIAL);
 //		getBtnManager().addButtonByID(AbstractBtnReg.USERBTN_PUSHPRODUCT);
 //		getBtnManager().addButtonByID(AbstractBtnReg.USERBTN_PUSHPRODUCT);
-		getBtnManager().addButtonByID(AbstractBtnReg.USERBTN_GENOUTIN);//生成出入库页签
+//		getBtnManager().addButtonByID(AbstractBtnReg.USERBTN_GENOUTIN);//生成出入库页签
+		getBtnManager().addButtonByID(AbstractBtnReg.USERBTN_PRINTBARCODE); //打印条形码
 		getBtnManager().addButtonByID(AbstractBtnReg.USERBTN_boExportImport); //导出/导入
 		getBtnManager().addButtonByID(AbstractBtnReg.USERBTN_boExportImport); //导出/导入
 		getBtnManager().addButtonByID(AbstractBtnReg.USERBTN_ADDPRAYBILL); //生单
 		getBtnManager().addButtonByID(AbstractBtnReg.USERBTN_ADDPRAYBILL); //生单
-		getBtnManager().addButtonByID(AbstractBtnReg.USERBTN_PRINTBARCODE); //打印条形码
+		getBtnManager().addButtonByID(AbstractBtnReg.USERBTN_WEIWAI); //委外
+//		getBtnManager().addButtonByID(AbstractBtnReg.USERBTN_gcolor); //修改入库颜色 
+//		getBtnManager().addButtonByID(AbstractBtnReg.USERBTN_isweiwai); // 委外材料明细
+		
 		getBtnManager().addChildButtonsByIDs(AbstractBtnReg.USERBTN_ADDPRAYBILL , 
 		getBtnManager().addChildButtonsByIDs(AbstractBtnReg.USERBTN_ADDPRAYBILL , 
 				new int []{AbstractBtnReg.USERBTN_PUSHMATERIAL,AbstractBtnReg.USERBTN_PUSHPRODUCT,
 				new int []{AbstractBtnReg.USERBTN_PUSHMATERIAL,AbstractBtnReg.USERBTN_PUSHPRODUCT,
 				AbstractBtnReg.USERBTN_PUSHOTHEROUT,AbstractBtnReg.USERBTN_PUSHOTHERIN,AbstractBtnReg.USERBTN_PUSHSALEOUT});
 				AbstractBtnReg.USERBTN_PUSHOTHEROUT,AbstractBtnReg.USERBTN_PUSHOTHERIN,AbstractBtnReg.USERBTN_PUSHSALEOUT});
 		
 		
 		getBtnManager().addChildButtonsByIDs(AbstractBtnReg.USERBTN_boExportImport , 
 		getBtnManager().addChildButtonsByIDs(AbstractBtnReg.USERBTN_boExportImport , 
 				new int []{AbstractBtnReg.SYSBTN_EXPORT,AbstractBtnReg.SYSBTN_IMPORT});
 				new int []{AbstractBtnReg.SYSBTN_EXPORT,AbstractBtnReg.SYSBTN_IMPORT});
-
 		
 		
 		
 		
+		getBtnManager().addChildButtonsByIDs(AbstractBtnReg.USERBTN_WEIWAI , 
+				new int []{AbstractBtnReg.USERBTN_isweiwai,AbstractBtnReg.USERBTN_GENOUTIN,AbstractBtnReg.USERBTN_gcolor,AbstractBtnReg.USERBTN_Refresh});
+
 		
 		
+		
+		getBtnManager().regCmd(AbstractBtnReg.USERBTN_PRINTBARCODE, new PrintBarcodeAction(this));
 		getBtnManager().regCmd(AbstractBtnReg.SYSBTN_ADD, new OrderAddAction(this));
 		getBtnManager().regCmd(AbstractBtnReg.SYSBTN_ADD, new OrderAddAction(this));
 		getBtnManager().regCmd(AbstractBtnReg.SYSBTN_EDIT, new OrderEditAction(this));
 		getBtnManager().regCmd(AbstractBtnReg.SYSBTN_EDIT, new OrderEditAction(this));
 		getBtnManager().regCmd(AbstractBtnReg.SYSBTN_DELETE, new OrderDeleteAction(this));
 		getBtnManager().regCmd(AbstractBtnReg.SYSBTN_DELETE, new OrderDeleteAction(this));
@@ -95,8 +106,9 @@ public class OrderTestUI extends FrameUI{
 		getBtnManager().regCmd(AbstractBtnReg.USERBTN_PUSHOTHEROUT, new PushOtherOutAction(this));
 		getBtnManager().regCmd(AbstractBtnReg.USERBTN_PUSHOTHEROUT, new PushOtherOutAction(this));
 		getBtnManager().regCmd(AbstractBtnReg.USERBTN_PUSHOTHERIN, new PushOtherInAction(this));
 		getBtnManager().regCmd(AbstractBtnReg.USERBTN_PUSHOTHERIN, new PushOtherInAction(this));
 		getBtnManager().regCmd(AbstractBtnReg.USERBTN_PUSHSALEOUT, new PushSaleOutAction(this));
 		getBtnManager().regCmd(AbstractBtnReg.USERBTN_PUSHSALEOUT, new PushSaleOutAction(this));
-		getBtnManager().regCmd(AbstractBtnReg.USERBTN_PRINTBARCODE, new PrintBarcodeAction(this));
-		
+		getBtnManager().regCmd(AbstractBtnReg.USERBTN_isweiwai, new OutSourcingAction(this));//委外材料明细
+		getBtnManager().regCmd(AbstractBtnReg.USERBTN_gcolor, new UpdateColorAction(this));
+		getBtnManager().regCmd(AbstractBtnReg.USERBTN_Refresh, new CardRefreshAction(this));
 		getBtnManager().adjustButtonOrder(new int[] {
 		getBtnManager().adjustButtonOrder(new int[] {
 				AbstractBtnReg.SYSBTN_ADD,
 				AbstractBtnReg.SYSBTN_ADD,
 				AbstractBtnReg.SYSBTN_EDIT,
 				AbstractBtnReg.SYSBTN_EDIT,
@@ -121,7 +133,12 @@ public class OrderTestUI extends FrameUI{
 				AbstractBtnReg.USERBTN_PUSHOTHEROUT,
 				AbstractBtnReg.USERBTN_PUSHOTHEROUT,
 				AbstractBtnReg.USERBTN_PUSHOTHERIN,
 				AbstractBtnReg.USERBTN_PUSHOTHERIN,
 				AbstractBtnReg.USERBTN_PUSHSALEOUT,
 				AbstractBtnReg.USERBTN_PUSHSALEOUT,
+				AbstractBtnReg.USERBTN_WEIWAI,
+				AbstractBtnReg.USERBTN_gcolor,
+				AbstractBtnReg.USERBTN_isweiwai,
+				AbstractBtnReg.USERBTN_Refresh,
 				AbstractBtnReg.USERBTN_PRINTBARCODE
 				AbstractBtnReg.USERBTN_PRINTBARCODE
+				
 				}
 				}
 				);
 				);
 	}
 	}