NC65拉单

1.查找节点对应的xml文件

1.1其中xml文件中的model和edit要和文件中的引用保持一致

1.2<bean id="addFrom4CAction" class="nc.ui.ic.m4a.action.SalesOutOfStockAction">

      其中bean中id自己填写,class的类是你自己写的要执行的类,但是继承拉单的自制按钮的父类

1.3<property name="editorModel" ref="icBizEditorModel" />

      <property name="model" ref="icBizModel" />

      <property name="transferViewProcessor" ref="transferViewProcessor" />

这些都是你代码中要用到的值,记得写get/set方法,如果父类有,就不需要添加。name的值和SalesOutOfStockAction类中的名字一致,ref的值要和xml文件的内容一致

1.4xml的java类要重新生成一次

选中xml右击  -》Springxml to java,如果执行没有效果,将property的内容全部删除再生成java类,然后自己手动添加property的内容,内容信息参照xml的java类其他一样地方

2.SalesOutOfStockAction类代码:

package nc.ui.ic.m4a.action;

import java.awt.event.ActionEvent;

import nc.ui.ic.general.action.GeneralAddAction;

import nc.ui.querytemplate.QueryConditionDLG;

import nc.ui.trade.business.HYPubBO_Client;

import nc.vo.uif2.LoginContext;

import java.awt.Container;

import nc.vo.ic.m4a.entity.GeneralInBodyVO;

import nc.vo.ic.m4a.entity.GeneralInHeadVO;

import nc.vo.ic.m4a.entity.GeneralInVO;

import nc.vo.ic.m4c.entity.SaleOutBodyVO;

import nc.vo.ic.m4c.entity.SaleOutHeadVO;

import nc.vo.ic.m4c.entity.SaleOutVO;

import nc.vo.querytemplate.TemplateInfo;

import nc.ui.pub.beans.UIDialog;

import nc.ui.pubapp.billref.dest.TransferViewProcessor;

import nc.ui.am.util.AMOrgUtils;

public class SalesOutOfStockAction extends GeneralAddAction {

private TransferViewProcessor transferViewProcessor;

public TransferViewProcessor getTransferViewProcessor() {

return transferViewProcessor;

}

public void setTransferViewProcessor(TransferViewProcessor transferViewProcessor) {

this.transferViewProcessor = transferViewProcessor;

}

public SalesOutOfStockAction() {

super();

super.setBtnName("销售出库单");

super.setCode("SalesOutOfStock");

}

@Override

public void doAction(ActionEvent e) throws Exception {

//super.doAction(e);

LoginContext context = this.getEditorModel().getContext().getLoginContext();

String pk_org =  AMOrgUtils.getDefaultOrgId(context);

String pk_group  = context.getPk_group();

// 调用查询模板

Container container = context.getEntranceUI();

TemplateInfo ti = new TemplateInfo();

String id = (String) HYPubBO_Client.findColValue("pub_query_templet",

"id", " node_code='40080802' ");

ti.setTemplateId(id);

ti.setPk_Org(context.getPk_group());

ti.setUserid(context.getPk_loginUser());

ti.setCurrentCorpPk(context.getPk_group());

ti.setFunNode("40080802");

ti.setNodekey("");

QueryConditionDLG qcDLG = new QueryConditionDLG(container, ti);

qcDLG.setVisibleNormalPanel(false);

if (qcDLG.showModal() == UIDialog.ID_OK) {

// 打开拉单界面

SourceRefDialog dialog = new SourceRefDialog(

container, qcDLG.getWhereSQL(), pk_org);

if (dialog.showModal() == UIDialog.ID_OK) {

// 返回数据

SaleOutVO  billVO = dialog.getAggSaleOutVO();

SaleOutHeadVO saleHead = (SaleOutHeadVO) billVO.getParentVO();

SaleOutBodyVO[] saleBody = (SaleOutBodyVO[]) billVO.getChildrenVO();

GeneralInVO aggGeneralInVO =new GeneralInVO();

GeneralInHeadVO headVO = new GeneralInHeadVO();

GeneralInBodyVO[] bodyVOs = new GeneralInBodyVO[saleBody.length];

//设置表体头字段

if(saleHead != null){

//库存组织

headVO.setPk_org(saleHead.getPk_org());

headVO.setPk_org_v(saleHead.getPk_org_v());

//集团

headVO.setPk_group(saleHead.getPk_group());

//仓库

headVO.setCwarehouseid(saleHead.getCwarehouseid());

//入库类型

String billType = (String) HYPubBO_Client.findColValue("bd_billtype",

"pk_billtypeid", "billtypename='其它入库'");

//headVO.setCtrantypeid(billType);

//headVO.setCtrantypeid(saleHead.getCtrantypeid());

//库管员

headVO.setCwhsmanagerid(saleHead.getCwhsmanagerid());

//部门

headVO.setCdptid(saleHead.getCdptid());

headVO.setCdptvid(saleHead.getCdptvid());

//备注

headVO.setVnote(saleHead.getVnote());

}

//设置表体字段

if(saleBody != null && saleBody.length > 0){

for(int i=0;i<saleBody.length;i++){

GeneralInBodyVO bodyVO = new GeneralInBodyVO();

//行号

bodyVO.setCrowno(saleBody[i].getCrowno());

//物料

bodyVO.setCmaterialoid(saleBody[i].getCmaterialoid());

bodyVO.setCmaterialvid(saleBody[i].getCmaterialvid());

//主单位

bodyVO.setCunitid(saleBody[i].getCunitid());

//单位

bodyVO.setCastunitid(saleBody[i].getCastunitid());

//质检批次

//bodyVO.setVbatchcode(saleBody[i].getVbatchcode());

//实收数量

bodyVO.setNassistnum(saleBody[i].getNassistnum());

//实收主数量

bodyVO.setNnum(saleBody[i].getNnum());

//入库日期

bodyVO.setDbizdate(saleBody[i].getDbizdate());

//库存状态

bodyVO.setCstateid(saleBody[i].getCstateid());

//行备注

bodyVO.setVnotebody(saleBody[i].getVnotebody());

//生产日期

bodyVO.setDproducedate(saleBody[i].getDproducedate());

//失效日期

bodyVO.setDvalidate(saleBody[i].getDvalidate());

//换算率

bodyVO.setVchangerate(saleBody[i].getVchangerate());

bodyVOs[i] = bodyVO;

}

}

aggGeneralInVO.setParentVO(headVO);

aggGeneralInVO.setChildrenVO(bodyVOs);

//调用父类方法跳转卡片画面

super.doAction(e);

//设置卡片画面内容

this.transferViewProcessor.getBillForm().setValue(aggGeneralInVO);

//显示卡片画面

this.transferViewProcessor.getBillForm().showMeUp();

}

}

}

}

3.查询中转界面SourceRefDialog类:

package nc.ui.ic.m4a.action;

import java.awt.BorderLayout;

import java.awt.Container;

import java.awt.Dimension;

import java.awt.FlowLayout;

import java.awt.Font;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.util.List;

import javax.swing.JPanel;

import nc.bs.framework.common.NCLocator;

import nc.itf.uap.IUAPQueryBS;

import nc.jdbc.framework.processor.BeanListProcessor;

import nc.ui.pub.beans.MessageDialog;

import nc.ui.pub.beans.UIButton;

import nc.ui.pub.beans.UIDialog;

import nc.ui.pub.bill.BillEditEvent;

import nc.ui.pub.bill.BillEditListener;

import nc.ui.pub.bill.BillListPanel;

import nc.ui.trade.business.HYPubBO_Client;

import nc.vo.ic.m4c.entity.SaleOutBodyVO;

import nc.vo.ic.m4c.entity.SaleOutHeadVO;

import nc.vo.ic.m4c.entity.SaleOutVO;

import nc.vo.pub.BusinessException;

public class SourceRefDialog extends UIDialog implements ActionListener {

private static final long serialVersionUID = 7444507682861271658L;

private JPanel contentPanel;

private JPanel southPanel;

private JPanel centerPanel;

private BillListPanel billListPanel;

private UIButton btn_ok;

private UIButton btn_cl;

private SaleOutVO aggSaleOutVO;

private String whereSql = null;

private String pk_org = null;

private String bill_templet = null;

private String  cgeneralhid = null;

SaleOutBodyVO[] bodyObj =null;

public SourceRefDialog(Container parent, String strWhere,

String pk_org) throws Exception {

super(parent);

this.whereSql = strWhere;

this.pk_org = pk_org;

initialize();

}

/**

* 初始化

* @throws Exception

*/

private void initialize() throws Exception {

setName("SourceRefDialog");

setDefaultCloseOperation(2);

setSize(1200, 600);

setTitle("销售出库单 ");

bill_templet = (String) HYPubBO_Client.findColValue("pub_billtemplet",

"pk_billtemplet", "bill_templetname='销售出库单'");

setContentPane(getContentPanel());

getBtnOk().addActionListener(this);

getBtnCl().addActionListener(this);

setDlgPosition();

queryData();

}

/**

* 居中显示

*/

private void setDlgPosition() {

int x = (int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth() - (double) getWidth()) / 2;

int y = (int) (Toolkit.getDefaultToolkit().getScreenSize().getHeight() - (double) getHeight()) / 2;

if (x < 0)

x = 0;

if (y < 0)

y = 0;

setLocation(x, y);

}

private BillListPanel getBillListPanel(){

if (billListPanel == null) {

billListPanel = new BillListPanel();

billListPanel.loadTemplet(bill_templet);

billListPanel.setMultiSelect(false);

//显示表体内容

billListPanel.addHeadEditListener(new QueryProgressEditListener());

}

return billListPanel;

}

/**

* 拉单加载上游单据页面数据

*/

@SuppressWarnings("unchecked")

private void queryData() {

try {

IUAPQueryBS query = NCLocator.getInstance().lookup(

IUAPQueryBS.class);

String sql = "select * from ic_saleout_h where nvl(dr,0)=0 and nvl(vdef20,'N')='Y'";

if (whereSql != null && !"".equals(whereSql)) {

sql += " and " + whereSql;

}

if(null!=pk_org&&!"".equals(pk_org)){

sql+=" and pk_org='"+pk_org+"'";

}

              // 表头

List<SaleOutHeadVO> saleOutHead = (List<SaleOutHeadVO>) query

.executeQuery(sql, new BeanListProcessor(

SaleOutHeadVO.class));

if (saleOutHead != null && saleOutHead.size() > 0) {

getBillListPanel().getHeadBillModel().setBodyDataVO(

saleOutHead.toArray(new SaleOutHeadVO[0]));

getBillListPanel().getHeadBillModel()

.loadLoadRelationItemValue();

}

} catch (Exception e) {

e.printStackTrace();

}

}

private class QueryProgressEditListener implements BillEditListener {

@Override

public void afterEdit(BillEditEvent e) {}

@SuppressWarnings("unchecked")

@Override

public void bodyRowChange(BillEditEvent e) {

// 选择的表头的主键

cgeneralhid  = (String) getBillListPanel()

.getHeadBillModel().getValueAt(e.getRow(), "cgeneralhid");

// 获取表体数据

IUAPQueryBS query = NCLocator.getInstance().lookup(

IUAPQueryBS.class);

String sql = "select * from ic_saleout_b where nvl(dr,0)=0 and cgeneralhid='"+cgeneralhid+"' ";

List<SaleOutBodyVO> saleOutBodyList =null;

try {

saleOutBodyList = (List<SaleOutBodyVO>) query

.executeQuery(sql, new BeanListProcessor(SaleOutBodyVO.class));

} catch (BusinessException e1) {

// TODO 自动生成的 catch 块

e1.printStackTrace();

}

bodyObj = saleOutBodyList.toArray(new SaleOutBodyVO[saleOutBodyList.size()]);

getBillListPanel().getBodyBillModel().setBodyDataVO(bodyObj);

getBillListPanel().getBodyBillModel().loadLoadRelationItemValue();

}

}

private JPanel getSouthPanel() {

if (southPanel == null) {

southPanel = new JPanel();

southPanel.setName("NorthPane");

southPanel.setLayout(new FlowLayout());

southPanel.add(getBtnOk());

southPanel.add(getBtnCl());

}

return southPanel;

}

private JPanel getCenterPanel() {

if (centerPanel == null) {

centerPanel = new JPanel();

centerPanel.setName("CenterPane");

centerPanel.setLayout(new BorderLayout());

centerPanel.add(getBillListPanel());

}

return centerPanel;

}

private JPanel getContentPanel() {

if (contentPanel == null) {

contentPanel = new JPanel();

contentPanel.setName("AdconfirmPane");

contentPanel.setLayout(new BorderLayout());

contentPanel.add(getCenterPanel(), BorderLayout.CENTER);

contentPanel.add(getSouthPanel(), BorderLayout.SOUTH);

}

return contentPanel;

}

private UIButton getBtnOk() {

if (btn_ok == null) {

btn_ok = new UIButton();

btn_ok.setName("BtnOk");

btn_ok.setText("确定");

btn_ok.setPreferredSize(new Dimension(80, 22));

btn_ok.setFont(new Font("dialog", 0, 12));

}

return btn_ok;

}

private UIButton getBtnCl() {

if (btn_cl == null) {

btn_cl = new UIButton();

btn_cl.setName("BtnCl");

btn_cl.setText("取消");

btn_cl.setPreferredSize(new Dimension(80, 22));

btn_cl.setFont(new Font("dialog", 0, 12));

}

return btn_cl;

}

/**

* 拉单返回数据

*

* @return AggPatentAccNoticeVO

*/

public SaleOutVO getAggSaleOutVO() {

return aggSaleOutVO;

}

/**

* 设置拉单返回数据

*

* @throws BusinessException

*/

@SuppressWarnings("unchecked")

public boolean setAggSaleOutVO() {

if (cgeneralhid == null || "".equals(cgeneralhid)) {

MessageDialog.showHintDlg(this, null, "请选择一条记录");

return false;

}

aggSaleOutVO = new SaleOutVO();

// 获取选中表头数据

IUAPQueryBS query = NCLocator.getInstance().lookup(

IUAPQueryBS.class);

String sql = "select * from ic_saleout_h where nvl(dr,0)=0 and cgeneralhid='"+cgeneralhid+"' ";

List<SaleOutHeadVO> saleOutHead = null;

try {

saleOutHead = (List<SaleOutHeadVO>) query.executeQuery(sql,

new BeanListProcessor(SaleOutHeadVO.class));

} catch (BusinessException e) {

// TODO 自动生成的 catch 块

e.printStackTrace();

}

aggSaleOutVO.setParentVO(saleOutHead.get(0));

aggSaleOutVO.setChildrenVO(bodyObj);

return true;

}

public void actionPerformed(ActionEvent e) {

if (e.getSource() == getBtnOk()) {

if (setAggSaleOutVO()) {

closeOK();

}

} else if (e.getSource() == getBtnCl()) {

closeCancel();

}

}

}

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 215,794评论 6 498
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 92,050评论 3 391
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 161,587评论 0 351
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 57,861评论 1 290
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 66,901评论 6 388
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 50,898评论 1 295
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,832评论 3 416
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 38,617评论 0 271
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,077评论 1 308
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,349评论 2 331
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,483评论 1 345
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,199评论 5 341
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,824评论 3 325
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,442评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,632评论 1 268
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 47,474评论 2 368
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,393评论 2 352

推荐阅读更多精彩内容