|
@@ -1,6 +1,9 @@
|
|
|
package u8c.ui.mmpac.action;
|
|
|
|
|
|
+import java.awt.BorderLayout;
|
|
|
+import java.awt.Color;
|
|
|
import java.awt.Dimension;
|
|
|
+import java.awt.FlowLayout;
|
|
|
import java.awt.Toolkit;
|
|
|
import java.awt.event.ActionEvent;
|
|
|
import java.awt.event.ActionListener;
|
|
@@ -10,15 +13,21 @@ import java.util.Iterator;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Vector;
|
|
|
-
|
|
|
+import nc.vo.pubapp.pattern.pub.SqlBuilder;
|
|
|
+import javax.swing.BorderFactory;
|
|
|
import javax.swing.JSplitPane;
|
|
|
+import javax.swing.border.BevelBorder;
|
|
|
|
|
|
import nc.ui.pub.beans.UIPanel;
|
|
|
import nc.bs.framework.common.NCLocator;
|
|
|
import nc.hr.utils.PubEnv;
|
|
|
+import nc.itf.uap.IUAPQueryBS;
|
|
|
+import nc.jdbc.framework.processor.BeanListProcessor;
|
|
|
+import nc.ui.pub.ButtonObject;
|
|
|
import nc.ui.pub.ClientEnvironment;
|
|
|
import nc.ui.pub.beans.MessageDialog;
|
|
|
import nc.ui.pub.beans.UIButton;
|
|
|
+import nc.ui.pub.beans.UIDesktopPane;
|
|
|
import nc.ui.pub.beans.UIDialog;
|
|
|
import nc.ui.pub.beans.UISplitPane;
|
|
|
import nc.ui.pub.bill.BillCardPanel;
|
|
@@ -26,6 +35,7 @@ import nc.ui.pub.bill.BillData;
|
|
|
import nc.ui.pub.bill.BillEditEvent;
|
|
|
import nc.ui.pub.bill.BillEditListener;
|
|
|
import nc.ui.pub.bill.BillItem;
|
|
|
+import nc.ui.querytemplate.QueryConditionDLG;
|
|
|
import nc.vo.bd.invdoc.InvbasdocVO;
|
|
|
import nc.vo.bd.invdoc.InvmandocVO;
|
|
|
import nc.vo.hr.tools.pub.HRAggVO;
|
|
@@ -37,6 +47,7 @@ import nc.vo.pub.CircularlyAccessibleValueObject;
|
|
|
import nc.vo.pub.lang.UFBoolean;
|
|
|
import nc.vo.pub.lang.UFDate;
|
|
|
import nc.vo.pub.lang.UFDouble;
|
|
|
+import nc.vo.querytemplate.TemplateInfo;
|
|
|
import u8c.bs.servlet.service.GetBaseDAOUtil;
|
|
|
import u8c.itf.mmpac.mmpac.IOrderTotalInfo;
|
|
|
import u8c.pubitf.ic.out.IMaterialOutMaintainAPI;
|
|
@@ -51,12 +62,21 @@ public class ToMaterialOutDialog extends UIDialog implements ActionListener,Bill
|
|
|
* 弹框勾选推单生成下游单据-材料出
|
|
|
*/
|
|
|
private static final long serialVersionUID = -2605551888165671265L;
|
|
|
- private UISplitPane mainpanel = null;//主面板
|
|
|
+ /** 按钮组 **/
|
|
|
+ private UISplitPane mainpanel = null;
|
|
|
+ private int focus=1;
|
|
|
+ private UIPanel ivjUIPanel0 = null;
|
|
|
+ private UIPanel ivjUIPanel2 = null;
|
|
|
+ private BillCardPanel datepanel = null;
|
|
|
private BillCardPanel jlcardPanel = null;//卡面面板
|
|
|
private UIPanel jlbtnpanel = null;//存放按钮的panel
|
|
|
- private UIButton saveCardBtn = null ; //保存
|
|
|
- private UIButton cancelBtn = null ; //取消
|
|
|
+ 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 OrderIssueVO[] issueArrays = null;
|
|
|
private HRAggVO aggvo;
|
|
|
IMaterialOutMaintainAPI imaterapi=(IMaterialOutMaintainAPI) NCLocator.getInstance().lookup(IMaterialOutMaintainAPI.class.getName());
|
|
|
IOrderTotalInfo iorder = NCLocator.getInstance().lookup(IOrderTotalInfo.class);
|
|
@@ -72,44 +92,50 @@ public class ToMaterialOutDialog extends UIDialog implements ActionListener,Bill
|
|
|
Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
|
|
|
setName("clc");
|
|
|
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
|
|
- setTitle("生产总订单-领料");
|
|
|
- setSize(1000,360);
|
|
|
+ setTitle("生产总订单-材料明细");
|
|
|
+// 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-1000)/2, (dimension.height-360)/2);
|
|
|
+ setLocation(100/2, 200/2);
|
|
|
addListenerEvent();
|
|
|
this.aggvo = aggvo;
|
|
|
//展示数据
|
|
|
- OrderIssueVO[] issueArrays = getIssueVOs(aggvo);
|
|
|
+ this.issueArrays = getIssueVOs(aggvo);
|
|
|
getJlcardPanel().getBillModel().setBodyDataVO(issueArrays);
|
|
|
|
|
|
|
|
|
}
|
|
|
+
|
|
|
|
|
|
|
|
|
//根据传入的aggvo获取issuevo数组
|
|
|
private OrderIssueVO[] getIssueVOs(HRAggVO aggvo) {
|
|
|
CircularlyAccessibleValueObject[] vos = aggvo.getAllChildrenVO();
|
|
|
- List<OrderIssueVO> issuevos = new ArrayList();
|
|
|
+ List<OrderIssueVO> issuevos = new ArrayList<OrderIssueVO>();
|
|
|
for(CircularlyAccessibleValueObject vo : vos) {
|
|
|
if(vo instanceof OrderIssueVO) {
|
|
|
//本次执行数量不填就默认
|
|
|
//执行完的表体在生单界面不展示
|
|
|
OrderIssueVO issuevo = (OrderIssueVO) vo;
|
|
|
- UFDouble num = issuevo.getNum() == null ? new UFDouble(0) : issuevo.getNum();
|
|
|
- UFDouble execnum = issuevo.getExecnum() == null ? new UFDouble(0) : issuevo.getExecnum();
|
|
|
- if(num.equals(execnum) && num.equals(new UFDouble(0))) {
|
|
|
+ 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.setBdef2(num.sub(execnum).toString());
|
|
|
+ issuevo.setBdef2(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];
|
|
|
- }
|
|
|
+// 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;
|
|
|
}
|
|
|
|
|
@@ -117,16 +143,33 @@ public class ToMaterialOutDialog extends UIDialog implements ActionListener,Bill
|
|
|
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;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public UISplitPane getMainPanel(){
|
|
|
if(mainpanel==null){
|
|
|
mainpanel = new UISplitPane();
|
|
|
mainpanel.setOrientation(JSplitPane.VERTICAL_SPLIT);
|
|
|
mainpanel.setTopComponent(getJlcardPanel());
|
|
|
mainpanel.setBottomComponent(getJlbtnpanel());
|
|
|
- mainpanel.setDividerLocation(280);//分割位置
|
|
|
+ mainpanel.setDividerLocation(750);//分割位置
|
|
|
mainpanel.setOneTouchExpandable(true);
|
|
|
mainpanel.setDividerSize(8);
|
|
|
}
|
|
@@ -135,6 +178,26 @@ public class ToMaterialOutDialog extends UIDialog implements ActionListener,Bill
|
|
|
}
|
|
|
|
|
|
|
|
|
+ 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) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public UIPanel getJlbtnpanel() {
|
|
|
if(jlbtnpanel==null){
|
|
|
jlbtnpanel = new UIPanel();
|
|
@@ -145,6 +208,70 @@ public class ToMaterialOutDialog extends UIDialog implements ActionListener,Bill
|
|
|
return jlbtnpanel;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 全选与反选,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, "bdef20");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
public UIButton getSaveCardBtn() {
|
|
|
|
|
|
if(saveCardBtn == null){
|
|
@@ -234,6 +361,8 @@ public class ToMaterialOutDialog extends UIDialog implements ActionListener,Bill
|
|
|
String pk_corp = headvo.getPk_corp();
|
|
|
UFDate dbilldate = headvo.getDbilldate();
|
|
|
String pk_order = headvo.getPk_order();
|
|
|
+ //业务类型
|
|
|
+ String billtype=headvo.getBusitype();
|
|
|
GeneralBillVO[] aggvos = new GeneralBillVO[1];
|
|
|
GeneralBillVO aggvo = new GeneralBillVO();
|
|
|
GeneralBillHeaderVO icheadvo = new GeneralBillHeaderVO();
|
|
@@ -241,7 +370,12 @@ public class ToMaterialOutDialog extends UIDialog implements ActionListener,Bill
|
|
|
icheadvo.setPk_calbody(GetBaseDAOUtil.getcalpk(pk_corp));
|
|
|
icheadvo.setDbilldate(dbilldate);
|
|
|
icheadvo.setCoperatorid(PubEnv.getPk_user());
|
|
|
- icheadvo.setCwarehouseid("1001V5100000000003GB");//仓库必填
|
|
|
+ //仓库ID
|
|
|
+ if("工装".equals(billtype)) {
|
|
|
+ icheadvo.setCwarehouseid("1001V51000000000039Z");//仓库必填
|
|
|
+ }else if("家装".equals(billtype)) {
|
|
|
+ icheadvo.setCwarehouseid("1001V5100000000003A0");//仓库必填
|
|
|
+ }
|
|
|
icheadvo.setBoutretflag(UFBoolean.FALSE);//是否退回
|
|
|
icheadvo.setBsalecooppur(UFBoolean.FALSE); // 销售出是否已协同生成采购入
|
|
|
icheadvo.setVnote("来源生产总订单");//备注
|
|
@@ -332,8 +466,8 @@ public class ToMaterialOutDialog extends UIDialog implements ActionListener,Bill
|
|
|
GeneralBillVO[] res = imaterapi.insertMaterialOuts(aggvos);
|
|
|
GeneralBillVO resvo = res[0];
|
|
|
Boolean updateres = iorder.UpdateIssueExecNum(updatemap);
|
|
|
-
|
|
|
- MessageDialog.showHintDlg(mainpanel, "成功", "材料出库单"+resvo.getVBillCode()+"新增成功");
|
|
|
+ // MessageDialog.showHintDlg(mainpanel, "成功", "材料出库单"+resvo.getVBillCode()+"新增成功");
|
|
|
+ this.closeCancel();
|
|
|
} catch (Exception e1) {
|
|
|
MessageDialog.showErrorDlg(mainpanel, "错误", e1.getMessage());
|
|
|
return;
|
|
@@ -345,7 +479,70 @@ public class ToMaterialOutDialog extends UIDialog implements ActionListener,Bill
|
|
|
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(issueArrays);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ String quresql="select * from mmpac_order_issue where "+dlgsql+" and " ;
|
|
|
+ IUAPQueryBS iuap=(IUAPQueryBS) NCLocator.getInstance().lookup(IUAPQueryBS.class.getName());
|
|
|
+
|
|
|
+ try {
|
|
|
+ List<String> pks=new ArrayList<String>();
|
|
|
+ if(null!=issueArrays && issueArrays.length>0) {
|
|
|
+ for(OrderIssueVO vo:issueArrays) {
|
|
|
+ String pk_order_issue=vo.getPk_order_issue();
|
|
|
+ pks.add(pk_order_issue);
|
|
|
+ }
|
|
|
+ SqlBuilder sqlbuild=new SqlBuilder();
|
|
|
+ sqlbuild.append(quresql);
|
|
|
+ sqlbuild.append("pk_order_issue",pks.toArray(new String[0]));
|
|
|
+ List<OrderIssueVO> lisorderiussvos = (List<OrderIssueVO>) iuap.executeQuery(sqlbuild.toString(), new BeanListProcessor(OrderIssueVO.class));
|
|
|
+ OrderIssueVO[] issuevos = lisorderiussvos.toArray(new OrderIssueVO[0]);
|
|
|
+ getJlcardPanel().getBillModel().setBodyDataVO(issuevos);
|
|
|
+
|
|
|
+ }else {
|
|
|
+ getJlcardPanel().getBillModel().setBodyDataVO(null);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ } catch (BusinessException e1) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e1.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|