|
@@ -2,12 +2,14 @@ package u8c.ui.mmpac.action;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
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.jdbc.framework.processor.MapProcessor;
|
|
|
import nc.ui.hr.frame.FrameUI;
|
|
|
import nc.ui.hr.frame.action.AbstractAction;
|
|
|
import nc.ui.hr.frame.impl.MainBillMgrPanel;
|
|
@@ -37,6 +39,7 @@ public class PushOtherOutAction extends AbstractAction{
|
|
|
OrderTestUI frameUI = null;
|
|
|
private IOtherOutMaintainAPI iotherout = NCLocator.getInstance().lookup(IOtherOutMaintainAPI.class);
|
|
|
private IVOPersistence ivo = NCLocator.getInstance().lookup(IVOPersistence.class);
|
|
|
+ private IUAPQueryBS iuap=(IUAPQueryBS) NCLocator.getInstance().lookup(IUAPQueryBS.class.getName());
|
|
|
public PushOtherOutAction(FrameUI frameUI1) {
|
|
|
super(frameUI1);
|
|
|
this.frameUI = (OrderTestUI) frameUI1;
|
|
@@ -88,12 +91,27 @@ public class PushOtherOutAction extends AbstractAction{
|
|
|
//收发类别
|
|
|
icheadvo.setCdispatcherid(getpkrdcl("07"));
|
|
|
|
|
|
- //项目编码 pk_defdoc9
|
|
|
- icheadvo.setAttributeValue("pk_defdoc9", prjcode);
|
|
|
+// //项目编码 pk_defdoc9
|
|
|
+// icheadvo.setAttributeValue("pk_defdoc9", prjcode);
|
|
|
+// //项目名称pk_defdoc10
|
|
|
+// icheadvo.setAttributeValue("pk_defdoc10", prjcode);
|
|
|
+// //加工单号pk_defdoc1
|
|
|
+// icheadvo.setAttributeValue("pk_defdoc2", headvo.getDef1());
|
|
|
+
|
|
|
+
|
|
|
+ Map<String,String> mapcodename=getprojectmap(prjcode);
|
|
|
+ //项目名称
|
|
|
+ icheadvo.setAttributeValue("vuserdef10", mapcodename.get("jobname"));
|
|
|
//项目名称pk_defdoc10
|
|
|
- icheadvo.setAttributeValue("pk_defdoc10", prjcode);
|
|
|
- //加工单号pk_defdoc1
|
|
|
- icheadvo.setAttributeValue("pk_defdoc2", headvo.getDef1());
|
|
|
+ icheadvo.setAttributeValue("pk_defdoc10", prjcode);
|
|
|
+ //加工单号
|
|
|
+ icheadvo.setAttributeValue("vuserdef1", headvo.getDef1());
|
|
|
+ //业务类型
|
|
|
+ icheadvo.setAttributeValue("vuserdef7", billtype.trim());
|
|
|
+
|
|
|
+ icheadvo.setAttributeValue("pk_defdoc7",getpkdefdoc(billtype.trim()));
|
|
|
+
|
|
|
+
|
|
|
aggvo.setParentVO(icheadvo);
|
|
|
GeneralBillItemVO[] itemvos = new GeneralBillItemVO[outvos.length];
|
|
|
for(int i = 0;i < outvos.length;i++) {
|
|
@@ -163,9 +181,44 @@ public class PushOtherOutAction extends AbstractAction{
|
|
|
itemvo.setIsok(UFBoolean.FALSE);
|
|
|
|
|
|
itemvo.setNbarcodenum(new UFDouble(0));//条码数量
|
|
|
- itemvo.setNoutnum(outvo.getNum());//实出数量
|
|
|
- itemvo.setNshouldoutnum(outvo.getNum());//应出数量
|
|
|
- itemvo.setHsl(new UFDouble(outvo.getBdef6()));//换算率
|
|
|
+
|
|
|
+ String vbatcode=outvo.getVbatchcode()==null?"":outvo.getVbatchcode();
|
|
|
+ itemvo.setVfirstbillcode(headvo.getVbillno());
|
|
|
+ itemvo.setVfree1(outvo.getColor());//颜色
|
|
|
+ itemvo.setVfree2(outvo.getAlloy());//合金
|
|
|
+ itemvo.setVfree3(outvo.getSizing());//定尺
|
|
|
+ itemvo.setVfree4(outvo.getStandard());//标准
|
|
|
+ String bdef6=outvo.getBdef6();
|
|
|
+
|
|
|
+ //MA开头的型材没有主数量
|
|
|
+ if(cmaterialcode.startsWith("MA")) {
|
|
|
+ InvbasdocVO invbasvo = GetBaseDAOUtil.getInvVO(cmaterialcode);
|
|
|
+ String pk_invbasdoc2 = invbasvo.getPrimaryKey();
|
|
|
+ Object objbdef6 =getHandNum("1001", billtype, pk_invbasdoc2, vbatcode,
|
|
|
+ outvo.getColor(), outvo.getSizing(), outvo.getAlloy(), outvo.getStandard());//现存量换算率
|
|
|
+ if(null==objbdef6 || "".equals(objbdef6.toString())) {
|
|
|
+ MessageDialog.showErrorDlg(frameUI, "错误", "MA开头的现存量未查询到!无法计算换算率!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ UFDouble mahsl=new UFDouble(objbdef6.toString());
|
|
|
+ itemvo.setHsl(mahsl);//换算率
|
|
|
+ UFDouble nshnum=outvo.getNastnum().multiply(mahsl).setScale(2, UFDouble.ROUND_HALF_UP);
|
|
|
+ itemvo.setNshouldinnum(nshnum);//应入数量
|
|
|
+ itemvo.setNinnum(nshnum);//实入数量
|
|
|
+
|
|
|
+ }else {
|
|
|
+ if(null==bdef6 || "".equals(bdef6)) {
|
|
|
+ MessageDialog.showErrorDlg(frameUI, "错误", "请检查换算率不能为空!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ itemvo.setNshouldinnum(outvo.getNum());//应入数量
|
|
|
+ itemvo.setNinnum(outvo.getNum());//实入数量
|
|
|
+ itemvo.setHsl(new UFDouble(outvo.getBdef6()));//换算率
|
|
|
+ }
|
|
|
+
|
|
|
+// itemvo.setNoutnum(outvo.getNum());//实出数量
|
|
|
+// itemvo.setNshouldoutnum(outvo.getNum());//应出数量
|
|
|
+// itemvo.setHsl(new UFDouble(outvo.getBdef6()));//换算率
|
|
|
itemvo.setNoutassistnum(outvo.getNastnum());//实出辅数量
|
|
|
itemvo.setNshouldoutassistnum(outvo.getNastnum());//应出辅数量
|
|
|
|
|
@@ -174,27 +227,47 @@ public class PushOtherOutAction extends AbstractAction{
|
|
|
itemvo.setCastunitname(castunitid==null?"":castunitid.toString());//辅计量单位名称
|
|
|
|
|
|
itemvo.setPk_calbody(icheadvo.getPk_calbody());
|
|
|
- itemvo.setVbatchcode(outvo.getVbatchcode()==null?"":outvo.getVbatchcode());
|
|
|
- itemvo.setVfirstbillcode(headvo.getVbillno());
|
|
|
- itemvo.setVfree1(outvo.getColor());//颜色
|
|
|
- itemvo.setVfree2(outvo.getAlloy());//合金
|
|
|
- itemvo.setVfree3(outvo.getSizing());//定尺
|
|
|
- itemvo.setVfree4(outvo.getStandard());//标准
|
|
|
+ itemvo.setVbatchcode(vbatcode);//批次号
|
|
|
+
|
|
|
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());//玻璃编号
|
|
|
+
|
|
|
+// 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());//玻璃编号
|
|
|
+
|
|
|
+ itemvo.setAttributeValue("vuserdef1", outvo.getBdef11());//楼号楼层
|
|
|
+ itemvo.setAttributeValue("vuserdef2", outvo.getBdef12());//樘数(数量)
|
|
|
+ itemvo.setAttributeValue("vuserdef3", outvo.getBdef13());//框统计
|
|
|
+ itemvo.setAttributeValue("vuserdef4", outvo.getBdef14());//扇统计
|
|
|
+ itemvo.setAttributeValue("vuserdef5", outvo.getBdef15());//半成品分类
|
|
|
+ itemvo.setAttributeValue("vuserdef6", outvo.getBdef16());//面积
|
|
|
+ itemvo.setAttributeValue("vuserdef7", outvo.getBdef17());//切割长度
|
|
|
+ itemvo.setAttributeValue("vuserdef8", outvo.getBdef18());//切割角度左下
|
|
|
+ itemvo.setAttributeValue("vuserdef9", outvo.getBdef19());//切割角度右上
|
|
|
+ itemvo.setAttributeValue("vuserdef10",outvo.getBdef2());//备注
|
|
|
+ itemvo.setAttributeValue("vuserdef11",outvo.getWidth());//宽度
|
|
|
+ itemvo.setAttributeValue("vuserdef12",outvo.getHeight());//高度
|
|
|
+ itemvo.setAttributeValue("vuserdef13",outvo.getBdef20());//系列
|
|
|
+ itemvo.setAttributeValue("vuserdef14",outvo.getBdef3());//玻璃编号
|
|
|
+// itemvo.setAttributeValue("vuserdef15",vector.get()==null?null:vector.get().toString());//开票类型
|
|
|
+ itemvo.setAttributeValue("vuserdef17",outvo.getConf());//窗号
|
|
|
+ itemvo.setAttributeValue("vuserdef18",outvo.getWeight());//米重
|
|
|
+ itemvo.setAttributeValue("vuserdef19",outvo.getRound());//装饰面周长
|
|
|
+ itemvo.setAttributeValue("vuserdef20",outvo.getPrjtypecode());//专用区
|
|
|
+ itemvo.setAttributeValue("pk_defdoc20",getzyqpk("专用区",outvo.getPrjtypecode()));//专用区
|
|
|
+
|
|
|
+
|
|
|
itemvos[i] = itemvo;
|
|
|
}
|
|
|
aggvo.setChildrenVO(itemvos);
|
|
@@ -245,7 +318,6 @@ public class PushOtherOutAction extends AbstractAction{
|
|
|
//收发类别
|
|
|
private String getpkrdcl(String rdcode ) throws BusinessException {
|
|
|
String sql="select pk_rdcl from bd_rdcl where rdcode='"+rdcode+"' ";
|
|
|
- IUAPQueryBS iuap=(IUAPQueryBS) NCLocator.getInstance().lookup(IUAPQueryBS.class.getName());
|
|
|
|
|
|
String pk_rdcl = (String) iuap.executeQuery(sql, new ColumnProcessor());
|
|
|
if (pk_rdcl == null) {
|
|
@@ -258,7 +330,6 @@ public class PushOtherOutAction extends AbstractAction{
|
|
|
//计量单位
|
|
|
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) {
|
|
@@ -267,4 +338,97 @@ public class PushOtherOutAction extends AbstractAction{
|
|
|
return pk_measdoc;
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ //项目管理档案-编码和名称
|
|
|
+ public Map<String,String> getprojectmap(String pk_jobmngfil ) throws Exception {
|
|
|
+ String sql = "select jobcode,jobname from bd_jobbasfil where "
|
|
|
+ + "pk_jobbasfil = (select pk_jobbasfil from bd_jobmngfil where pk_jobmngfil ='"+pk_jobmngfil+"' and dr = 0) "
|
|
|
+ + "and dr=0";
|
|
|
+ Map<String,String> map = (Map<String, String>) iuap.executeQuery(sql, new MapProcessor());
|
|
|
+ if (map == null || map.size()==0) {
|
|
|
+ throw new Exception("项目管理档案"+pk_jobmngfil+"未查到,请检查");
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ //业务类型自定义档案查询
|
|
|
+ private String getpkdefdoc(String docname ) throws Exception {
|
|
|
+ String sql="select pk_defdoc from bd_defdoc where pk_defdoclist = "
|
|
|
+ + "(select pk_defdoclist from bd_defdef where defname = '业务类型' and dr=0 ) and dr=0 "
|
|
|
+ + "and docname='"+docname+"'";
|
|
|
+
|
|
|
+ Object pkdefdoc = iuap.executeQuery(sql, new ColumnProcessor());
|
|
|
+ if(pkdefdoc == null || "".equals(pkdefdoc)) {
|
|
|
+ throw new Exception("业务类型【"+docname+"】未查到,请检查");
|
|
|
+ }
|
|
|
+
|
|
|
+ return pkdefdoc.toString();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private String getzyqpk(String doclistname,String docname) throws BusinessException {
|
|
|
+
|
|
|
+ if(null==docname || "".equals(docname)) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+ //取到自定义档案列表主键
|
|
|
+ String sql = "select pk_defdoclist from bd_defdoclist where doclistname = '"+doclistname+"'";
|
|
|
+ Object pk_defdoclist = iuap.executeQuery(sql, new ColumnProcessor());
|
|
|
+ if(pk_defdoclist == null) {
|
|
|
+ throw new BusinessException("以下档案在U8cloud系统中根据公司或者账簿信息找不到,请检查!详细信息:1、档案类型:自定义档案列表,档案名称:"+doclistname);
|
|
|
+ }
|
|
|
+ String sql1 = "select pk_defdoc from bd_defdoc where pk_defdoclist = '"+pk_defdoclist.toString()+"' and docname ='"+docname+"'";
|
|
|
+ String pk_defdoc = (String) iuap.executeQuery(sql1, new ColumnProcessor());
|
|
|
+
|
|
|
+ return pk_defdoc;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询现存量物料换算率
|
|
|
+ * @param pk_corp
|
|
|
+ * @param storcode
|
|
|
+ * @param cinvbasid
|
|
|
+ * @param vbatchcode
|
|
|
+ * @param color 颜色
|
|
|
+ * @param sizing 定尺
|
|
|
+ * @param alloy 合金
|
|
|
+ * @param standard 标准
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ public Object getHandNum(String pk_corp,String storcode,String cinvbasid,String vbatchcode, String color ,String sizing,String alloy,String standard)throws Exception {
|
|
|
+ StringBuffer sql = new StringBuffer();
|
|
|
+ sql.append("SELECT ");
|
|
|
+ sql.append(" nonhandnum/nonhandastnum as hsl");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" ic_onhandnum");
|
|
|
+ sql.append(" WHERE");
|
|
|
+ sql.append(" pk_corp = '"+pk_corp+"'");
|
|
|
+ sql.append(" AND cwarehouseid = ( SELECT pk_stordoc FROM bd_stordoc WHERE storcode = '"+storcode+"' and sealflag = 'N' and dr = 0)");
|
|
|
+ sql.append(" AND cinvbasid = '"+cinvbasid+"' ");
|
|
|
+ if(vbatchcode != null && !"".equals(vbatchcode)) {
|
|
|
+ sql.append(" AND vlot = '"+vbatchcode+"' ");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(color != null && !"".equals(color)) {
|
|
|
+ sql.append(" AND vfree1='"+color+"' ");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(alloy != null && !"".equals(alloy)) {
|
|
|
+ sql.append(" AND vfree2='"+alloy+"' ");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(sizing != null && !"".equals(sizing)) {
|
|
|
+ sql.append(" AND vfree3='"+sizing+"' ");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(standard != null && !"".equals(standard)) {
|
|
|
+ sql.append(" AND vfree4='"+standard+"' ");
|
|
|
+ }
|
|
|
+
|
|
|
+ return iuap.executeQuery(sql.toString(), new ColumnProcessor());
|
|
|
+ }
|
|
|
+
|
|
|
}
|