|
@@ -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());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|