yaoyu vor 2 Jahren
Ursprung
Commit
fade8e870d

BIN
pu/META-INF/hutool-all-5.3.0.jar


BIN
pu/META-INF/hutool-all-5.8.11.jar


+ 16 - 10
pu/META-INF/ocritf.upm

@@ -1,10 +1,16 @@
-<?xml version="1.0" encoding="gbk"?>
-<module name="th">
-	<public>
-		    <!-- ½Ó¿Ú -->
-		    <component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
-	      <interface>nc.itf.th.IThOcrService</interface>
-	      <implementation>nc.impl.th.ThOcrServiceImpl</implementation>
-	    </component>
-	</public>
-</module>
+<?xml version="1.0" encoding="gbk"?>
+<module name="th">
+	<public>
+		    <!-- ½Ó¿Ú -->
+		    <component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
+	      <interface>nc.itf.th.IThOcrService</interface>
+	      <implementation>nc.impl.th.ThOcrServiceImpl</implementation>
+	    </component>
+	</public>
+	
+		<public>
+		   <component name="ApproveOrder" accessProtected="false"  remote="true" singleton="true" tx="NONE" supportAlias="true">
+	      <implementation>nc.impl.th.ThOrderServiceImpl</implementation>
+	    </component>
+	</public>
+</module>

+ 12 - 6
pu/pu/src/client/nc/pub/filesystem/newui/ThOCRAction.java

@@ -151,18 +151,21 @@ public class ThOCRAction extends AbstractNCAction{
 //				String name = filewjlis.get(i);
 				String name =newvo.getName();
 				String memo = info.getString("number");//发票号
-				String code = info.getString("number");//发票代码
+				String code = info.getString("fid");
 				String fid = info.getString("fid");
+				String codenumber = info.getString("code"); //发票代码
 				//特殊发票发票号和发票代码不存在
-				if(code == null || "".equals(code)) {
-					memo = "特殊发票"+fid;
-					code = fid;
+				if(codenumber == null || "".equals(codenumber)) {
+					codenumber = "0";
+				}
+				if(memo == null || "".equals(memo)) {
+					memo = "0";
 				}
 				if(!"0".equals(ret)) {
 					String message = infos.getJSONObject(j).getString("message");
 					MessageDialog.showErrorDlg(parentpanel, NCLangRes.getInstance().getStrByID("pc", "FileManageUI-000000")/*错误*/
 							,"ocr返回数据校验:\n"+"发票:"+name+":"+message);
-					//return;
+					return;
 				}
 				String ext = info.getString("ext");
 				JSONObject extobj = JSONObject.parseObject(ext);
@@ -173,7 +176,8 @@ public class ThOCRAction extends AbstractNCAction{
 				String date = pro.getString("date");//发票日期
 				String type = pro.getString("type");//发票类型
 				String cname = pro.getString("cname");//发票类型名称
-				String kind = pro.getString("kind");//开票内容
+				//String kind = pro.getString("kind");//开票内容
+				String kind = extobj.getString("content");
 				JSONObject price = comm_info.getJSONObject("price");
 				//发票识别之后进行发票查验
 				//是否需要查验 0不需要 1需要
@@ -235,6 +239,7 @@ public class ThOCRAction extends AbstractNCAction{
 					defvo.setAttributeValue("enablestate", 2);
 					defvo.setAttributeValue("innercode", "0");
 					defvo.setAttributeValue("shortname4", kind);
+					defvo.setAttributeValue("modifier", codenumber);
 					
 					try {
 						idefservice.updateDefdocs(pk_group,updatevos);
@@ -272,6 +277,7 @@ public class ThOCRAction extends AbstractNCAction{
 					defvo.setAttributeValue("shortname6", trate);
 					defvo.setAttributeValue("innercode", "0");
 					defvo.setAttributeValue("shortname4", kind);
+					defvo.setAttributeValue("modifier", codenumber);
 					vos[0] = defvo;
 					try {
 				//		idefservice.insertDefdocs(pk_org, vos);

+ 1 - 0
pu/pu/src/client/nc/ui/pu/m25/action/processor/CopyActionProcessor.java

@@ -115,6 +115,7 @@ public class CopyActionProcessor implements ICopyActionProcessor<InvoiceVO> {
 				vo.setVbdef16(null);
 				vo.setVbdef17(null);
 				vo.setVbdef20(null);
+				vo.setVbdef12(null);
 				
 			}
 

+ 234 - 173
pu/pu/src/client/nc/ui/pu/m25/editor/card/afteredit/body/Material.java

@@ -1,173 +1,234 @@
-package nc.ui.pu.m25.editor.card.afteredit.body;
-
-import nc.itf.scmpub.reference.uap.bd.vat.BuySellFlagEnum;
-import nc.itf.scmpub.reference.uap.bd.vat.VATInfoQueryVO;
-import nc.itf.scmpub.reference.uap.bd.vat.VATInfoVO;
-import nc.ui.pu.m25.editor.utils.RelationCalculate;
-import nc.ui.pu.m25.editor.utils.TaxRateAndTypeUtil;
-import nc.ui.pu.m25.rule.InvoiceQueryPriceHandler;
-import nc.ui.pu.pub.editor.CardEditorHelper;
-import nc.ui.pu.pub.editor.card.listener.ICardBodyAfterEditEventListener;
-import nc.ui.pub.bill.BillCardPanel;
-import nc.ui.pubapp.uif2app.event.card.CardBodyAfterEditEvent;
-import nc.ui.pubapp.uif2app.view.util.RefMoreSelectedUtils;
-import nc.vo.pu.m25.entity.InvoiceHeaderVO;
-import nc.vo.pu.m25.entity.InvoiceItemVO;
-import nc.vo.pu.pub.enumeration.PricePriority;
-import nc.vo.pu.pub.rule.vat.BillItemVatTaxInfoSetter;
-import nc.vo.pu.pub.rule.vat.TaxValue;
-import nc.vo.pu.pub.util.ObjectUtil;
-import nc.vo.pu.pub.util.PUSysParamUtil;
-import nc.vo.pub.lang.UFBoolean;
-import nc.vo.pub.lang.UFDate;
-import nc.vo.pubapp.AppContext;
-import nc.vo.pubapp.pattern.data.ValueUtils;
-import nc.vo.pubapp.scale.ScaleUtils;
-
-import org.apache.commons.lang.ArrayUtils;
-import org.apache.commons.lang.StringUtils;
-
-/**
- * <p>
- * <b>本类主要完成以下功能:</b>
- * <ul>
- * <li>表体物料编辑后处理
- * </ul>
- * <p>
- * <p>
- * 
- * @version 6.0
- * @since 6.0
- * @author tianft
- * @time 2010-3-26 上午10:38:21
- */
-public class Material implements ICardBodyAfterEditEventListener {
-
-  @Override
-  public void afterEdit(CardBodyAfterEditEvent event) {
-
-    RefMoreSelectedUtils utils =
-        new RefMoreSelectedUtils(event.getBillCardPanel());
-    event.getBillCardPanel().getBillModel().setNeedCalculate(false);
-    // 处理多选情况
-    int[] rows =
-        utils.refMoreSelected(event.getRow(), InvoiceItemVO.PK_MATERIAL, true);
-    // 清空物料
-    if (rows.length == 1 && ObjectUtil.isEmptyWithTrim(event.getValue())) {
-      event.getBillCardPanel().getBillModel().setNeedCalculate(true);
-      return;
-
-    }
-    // 物料编辑时(已经有物料的情况下,单位可能被该动过)
-    this.calculateByNum(event.getBillCardPanel(), rows);
-
-    // ---------远程调用合并-------------------------------------
-    // 多选处理,询计划价,税率
-    TaxRateAndTypeUtil util =
-        new TaxRateAndTypeUtil(event.getBillCardPanel(), rows);
-    util.prepare();
-    // 询价远程调用合并
-    InvoiceQueryPriceHandler price =
-        new InvoiceQueryPriceHandler(event.getBillCardPanel(), rows);
-    price.prepareQueryPrice();
-    // VAT信息设置规则的远程调用
-    TaxValue taxvaluerule =
-        this.getVatValueRule(event.getBillCardPanel(), rows);
-    taxvaluerule.prepare();
-
-    // ---------远程调用合并执行真正的处理---------------------
-    // VAT信息设置
-    this.setVatVule(taxvaluerule, event.getBillCardPanel(), rows);
-    // 计划价
-    util.setPlanPrice();
-    // 触发询价,劳务折扣类物料不参与询价!!
-    price.handleQueryPrice();
-    event.getBillCardPanel().getBillModel().setNeedCalculate(true);
-  }
-
-  /**
-   * 编辑物料时重新设置单位,并用主数量联动
-   * 
-   * @param event
-   * @param rows
-   */
-  private void calculateByNum(BillCardPanel panel, int[] rows) {
-    if (ArrayUtils.isEmpty(rows)) {
-      return;
-    }
-    ScaleUtils scale = new ScaleUtils(AppContext.getInstance().getPkGroup());
-    for (int row : rows) {
-      panel.setBodyValueAt(scale.adjustHslScale("1.00/1.00"), row,
-          InvoiceItemVO.VCHANGERATE);
-    }
-    RelationCalculate calc = new RelationCalculate();
-    calc.calculate(panel, rows, InvoiceItemVO.NNUM);
-  }
-
-  private TaxValue getVatValueRule(BillCardPanel bcp, int[] rows) {
-    CardEditorHelper invoice = new CardEditorHelper(bcp);
-    String sendcountry =
-        invoice.getHeadStringValue(InvoiceHeaderVO.CSENDCOUNTRYID);
-    String rececountry =
-        invoice.getHeadStringValue(InvoiceHeaderVO.CRECECOUNTRYID);
-    String taxcountry =
-        invoice.getHeadStringValue(InvoiceHeaderVO.CTAXCOUNTRYID);
-    UFDate billdate = invoice.getHeadUFDateValue(InvoiceHeaderVO.DBILLDATE);
-    Integer fbsflag =
-        (Integer) invoice.getHeadValue(InvoiceHeaderVO.FBUYSELLFLAG);
-    String pk_supplier =
-        invoice.getHeadStringValue(InvoiceHeaderVO.PK_SUPPLIER);
-    UFBoolean triatrade =
-        ValueUtils.getUFBoolean(invoice
-            .getHeadValue(InvoiceHeaderVO.BTRIATRADEFLAG));
-    String pk_org = invoice.getHeadStringValue(InvoiceHeaderVO.PK_ORG);
-    VATInfoQueryVO[] vatqvos = new VATInfoQueryVO[rows.length];
-    for (int i = 0; i < rows.length; i++) {
-      if (StringUtils.isBlank(sendcountry) || StringUtils.isBlank(rececountry)
-          || StringUtils.isBlank(taxcountry)
-          || StringUtils.isBlank(pk_supplier) || null == billdate
-          || null == fbsflag) {
-        continue;
-      }
-      String pk_material =
-          invoice.getBodyStringValue(rows[i], InvoiceItemVO.PK_MATERIAL);
-      vatqvos[i] =
-          new VATInfoQueryVO(taxcountry, BuySellFlagEnum.valueOf(fbsflag),
-              triatrade, sendcountry, rececountry, pk_supplier, pk_material,
-              billdate, pk_org);
-    }
-    TaxValue tv = new TaxValue(vatqvos);
-    tv.prepare();
-    return tv;
-  }
-
-  private void setVatVule(TaxValue tv, BillCardPanel bcp, int[] rows) {
-    CardEditorHelper invoice = new CardEditorHelper(bcp);
-    // VATValueSetProvider puorgbuysellGetter = new
-    // VATValueSetProvider(invoice);
-    // puorgbuysellGetter.setFbuysellflagPos(PosEnum.head);
-    BillItemVatTaxInfoSetter setter = new BillItemVatTaxInfoSetter(invoice);
-    RelationCalculate calc = new RelationCalculate();
-    tv.process();
-    VATInfoVO[] vatinfos = tv.getVatinfos();
-    String pk_purchaseorg =
-        invoice.getHeadStringValue(InvoiceHeaderVO.PK_PURCHASEORG);
-    PricePriority pricePriority =
-        PUSysParamUtil.getPO28For25(pk_purchaseorg) ? PricePriority.TAXPRICE_PRIOR_TO_PRICE
-            : PricePriority.PRICE_PRIOR_TO_TAXPRICE;
-    for (int i = 0; i < rows.length; i++) {
-      VATInfoVO vatvo = vatinfos[i];
-      if (null == vatvo) {
-        continue;
-      }
-      String chgkey = setter.setVatTax(vatvo, rows[i], pricePriority);
-      if (null == chgkey) {
-        continue;
-      }
-      calc.calculate(invoice.getEditor(), new int[] {
-        rows[i]
-      }, chgkey);
-    }
-  }
-
-}
+package nc.ui.pu.m25.editor.card.afteredit.body;
+
+import nc.bs.framework.common.NCLocator;
+import nc.itf.scmpub.reference.uap.bd.vat.BuySellFlagEnum;
+import nc.itf.scmpub.reference.uap.bd.vat.VATInfoQueryVO;
+import nc.itf.scmpub.reference.uap.bd.vat.VATInfoVO;
+import nc.itf.uap.IUAPQueryBS;
+import nc.jdbc.framework.processor.BeanProcessor;
+import nc.jdbc.framework.processor.ColumnProcessor;
+import nc.ui.pu.m25.editor.utils.RelationCalculate;
+import nc.ui.pu.m25.editor.utils.TaxRateAndTypeUtil;
+import nc.ui.pu.m25.rule.InvoiceQueryPriceHandler;
+import nc.ui.pu.pub.editor.CardEditorHelper;
+import nc.ui.pu.pub.editor.card.listener.ICardBodyAfterEditEventListener;
+import nc.ui.pub.bill.BillCardPanel;
+import nc.ui.pubapp.uif2app.event.card.CardBodyAfterEditEvent;
+import nc.ui.pubapp.uif2app.view.util.RefMoreSelectedUtils;
+import nc.vo.bd.defdoc.DefdocVO;
+import nc.vo.pu.m25.entity.InvoiceHeaderVO;
+import nc.vo.pu.m25.entity.InvoiceItemVO;
+import nc.vo.pu.pub.enumeration.PricePriority;
+import nc.vo.pu.pub.rule.vat.BillItemVatTaxInfoSetter;
+import nc.vo.pu.pub.rule.vat.TaxValue;
+import nc.vo.pu.pub.util.ObjectUtil;
+import nc.vo.pu.pub.util.PUSysParamUtil;
+import nc.vo.pub.lang.UFBoolean;
+import nc.vo.pub.lang.UFDate;
+import nc.vo.pub.lang.UFDouble;
+import nc.vo.pubapp.AppContext;
+import nc.vo.pubapp.pattern.data.ValueUtils;
+import nc.vo.pubapp.pattern.exception.ExceptionUtils;
+import nc.vo.pubapp.scale.ScaleUtils;
+
+import java.util.Map;
+
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.StringUtils;
+
+/**
+ * <p>
+ * <b>本类主要完成以下功能:</b>
+ * <ul>
+ * <li>表体物料编辑后处理
+ * </ul>
+ * <p>
+ * <p>
+ * 
+ * @version 6.0
+ * @since 6.0
+ * @author tianft
+ * @time 2010-3-26 上午10:38:21
+ */
+public class Material implements ICardBodyAfterEditEventListener {
+	
+public IUAPQueryBS iuap=(IUAPQueryBS) NCLocator.getInstance().lookup(IUAPQueryBS.class.getName());
+
+  @Override
+  public void afterEdit(CardBodyAfterEditEvent event) {
+
+    RefMoreSelectedUtils utils =
+        new RefMoreSelectedUtils(event.getBillCardPanel());
+    event.getBillCardPanel().getBillModel().setNeedCalculate(false);
+    // 处理多选情况
+    int[] rows =
+        utils.refMoreSelected(event.getRow(), InvoiceItemVO.PK_MATERIAL, true);
+    // 清空物料
+    if (rows.length == 1 && ObjectUtil.isEmptyWithTrim(event.getValue())) {
+      event.getBillCardPanel().getBillModel().setNeedCalculate(true);
+      return;
+
+    }
+    // 物料编辑时(已经有物料的情况下,单位可能被该动过)
+    this.calculateByNum(event.getBillCardPanel(), rows);
+
+    // ---------远程调用合并-------------------------------------
+    // 多选处理,询计划价,税率
+    TaxRateAndTypeUtil util =
+        new TaxRateAndTypeUtil(event.getBillCardPanel(), rows);
+    util.prepare();
+    // 询价远程调用合并
+    InvoiceQueryPriceHandler price =
+        new InvoiceQueryPriceHandler(event.getBillCardPanel(), rows);
+    price.prepareQueryPrice();
+    // VAT信息设置规则的远程调用
+    TaxValue taxvaluerule =
+        this.getVatValueRule(event.getBillCardPanel(), rows);
+    taxvaluerule.prepare();
+
+    // ---------远程调用合并执行真正的处理---------------------
+    // VAT信息设置
+    this.setVatVule(taxvaluerule, event.getBillCardPanel(), rows);
+    // 计划价
+    util.setPlanPrice();
+    // 触发询价,劳务折扣类物料不参与询价!!
+    price.handleQueryPrice();
+    
+   
+    
+    try {
+    	String vbdef20 = (String) event.getBillCardPanel().getBodyValueAt(event.getRow(), "vbdef20");
+	    if(vbdef20 != null) {
+	    	String sql = "select * from bd_defdoc where dr=0 and pk_defdoc = '"+vbdef20+"'";
+	    	DefdocVO defdocvo = (DefdocVO) iuap.executeQuery(sql, new BeanProcessor(DefdocVO.class));
+	    	String qryshuilv = "select pk_taxcode from bd_taxrate where nvl(dr,0) = 0 and pk_taxcode not in (select pk_taxcode from bd_taxcode where code = '0') and taxrate = '"+defdocvo.getShortname6()+"'";
+	    	Object shuilvpk = iuap.executeQuery(qryshuilv, new ColumnProcessor());
+	    	if(shuilvpk == null){
+				ExceptionUtils.wrappBusinessException("税率没有对应税码,请检查!");
+			}
+	    	
+	    	UFDouble SumAmount = UFDouble.ZERO_DBL;//不含税
+			UFDouble SumTotal = UFDouble.ZERO_DBL;//价税合计
+			UFDouble SumTax =UFDouble.ZERO_DBL;//税额
+			Object shortname = defdocvo.getShortname();
+			if(shortname != null && shortname.toString() != ""){
+				SumAmount = SumAmount.add(new UFDouble(shortname.toString()));
+			}
+			Object shortname2 = defdocvo.getShortname2();
+			if(shortname2 != null && shortname2.toString() != ""){
+				SumTotal = SumTotal.add(new UFDouble(shortname2.toString()));
+			}
+			Object shortname3 = defdocvo.getShortname3();
+			if(shortname3 != null && shortname3.toString() != ""){
+				SumTax = SumTax.add(new UFDouble(shortname3.toString()));
+			}
+			
+	    	event.getBillCardPanel().setBodyValueAt(defdocvo.getShortname6(), event.getRow(), "ntaxrate");//税率
+	    	event.getBillCardPanel().setBodyValueAt(shuilvpk, event.getRow(), "ctaxcodeid");//税码
+	    	event.getBillCardPanel().setBodyValueAt(SumAmount, event.getRow(), "nastorigprice");//无税单价
+	    	event.getBillCardPanel().setBodyValueAt(SumAmount, event.getRow(), "nastprice");//本币无税单价
+	    	event.getBillCardPanel().setBodyValueAt(SumAmount, event.getRow(), "nprice");//主本币无税单价
+	    	event.getBillCardPanel().setBodyValueAt(SumAmount, event.getRow(), "norigmny");//无税金额
+	    	event.getBillCardPanel().setBodyValueAt(SumAmount, event.getRow(), "nmny");//本币无税金额
+			event.getBillCardPanel().setBodyValueAt(SumAmount, event.getRow(), "ncalcostmny");//计成本金额
+			event.getBillCardPanel().setBodyValueAt(SumTotal, event.getRow(), "nastorigtaxprice");//含税单价
+			event.getBillCardPanel().setBodyValueAt(SumTotal, event.getRow(), "nasttaxprice");//本币含税单价
+			event.getBillCardPanel().setBodyValueAt(SumTotal, event.getRow(), "ntaxprice");//主本币含税单价
+			event.getBillCardPanel().setBodyValueAt(SumTotal, event.getRow(), "norigtaxmny");//价税合计
+			event.getBillCardPanel().setBodyValueAt(SumTotal, event.getRow(), "ntaxmny");//本币价税合计
+			event.getBillCardPanel().setBodyValueAt(SumTax, event.getRow(), "ntax");//税额
+			
+	    }
+	} catch (Exception e) {
+		ExceptionUtils.wrappBusinessException(e.getMessage());
+	}
+    event.getBillCardPanel().getBillModel().setNeedCalculate(true);
+   
+  }
+
+  /**
+   * 编辑物料时重新设置单位,并用主数量联动
+   * 
+   * @param event
+   * @param rows
+   */
+  private void calculateByNum(BillCardPanel panel, int[] rows) {
+    if (ArrayUtils.isEmpty(rows)) {
+      return;
+    }
+    ScaleUtils scale = new ScaleUtils(AppContext.getInstance().getPkGroup());
+    for (int row : rows) {
+      panel.setBodyValueAt(scale.adjustHslScale("1.00/1.00"), row,
+          InvoiceItemVO.VCHANGERATE);
+    }
+    RelationCalculate calc = new RelationCalculate();
+    calc.calculate(panel, rows, InvoiceItemVO.NNUM);
+  }
+
+  private TaxValue getVatValueRule(BillCardPanel bcp, int[] rows) {
+    CardEditorHelper invoice = new CardEditorHelper(bcp);
+    String sendcountry =
+        invoice.getHeadStringValue(InvoiceHeaderVO.CSENDCOUNTRYID);
+    String rececountry =
+        invoice.getHeadStringValue(InvoiceHeaderVO.CRECECOUNTRYID);
+    String taxcountry =
+        invoice.getHeadStringValue(InvoiceHeaderVO.CTAXCOUNTRYID);
+    UFDate billdate = invoice.getHeadUFDateValue(InvoiceHeaderVO.DBILLDATE);
+    Integer fbsflag =
+        (Integer) invoice.getHeadValue(InvoiceHeaderVO.FBUYSELLFLAG);
+    String pk_supplier =
+        invoice.getHeadStringValue(InvoiceHeaderVO.PK_SUPPLIER);
+    UFBoolean triatrade =
+        ValueUtils.getUFBoolean(invoice
+            .getHeadValue(InvoiceHeaderVO.BTRIATRADEFLAG));
+    String pk_org = invoice.getHeadStringValue(InvoiceHeaderVO.PK_ORG);
+    VATInfoQueryVO[] vatqvos = new VATInfoQueryVO[rows.length];
+    for (int i = 0; i < rows.length; i++) {
+      if (StringUtils.isBlank(sendcountry) || StringUtils.isBlank(rececountry)
+          || StringUtils.isBlank(taxcountry)
+          || StringUtils.isBlank(pk_supplier) || null == billdate
+          || null == fbsflag) {
+        continue;
+      }
+      String pk_material =
+          invoice.getBodyStringValue(rows[i], InvoiceItemVO.PK_MATERIAL);
+      vatqvos[i] =
+          new VATInfoQueryVO(taxcountry, BuySellFlagEnum.valueOf(fbsflag),
+              triatrade, sendcountry, rececountry, pk_supplier, pk_material,
+              billdate, pk_org);
+    }
+    TaxValue tv = new TaxValue(vatqvos);
+    tv.prepare();
+    return tv;
+  }
+
+  private void setVatVule(TaxValue tv, BillCardPanel bcp, int[] rows) {
+    CardEditorHelper invoice = new CardEditorHelper(bcp);
+    // VATValueSetProvider puorgbuysellGetter = new
+    // VATValueSetProvider(invoice);
+    // puorgbuysellGetter.setFbuysellflagPos(PosEnum.head);
+    BillItemVatTaxInfoSetter setter = new BillItemVatTaxInfoSetter(invoice);
+    RelationCalculate calc = new RelationCalculate();
+    tv.process();
+    VATInfoVO[] vatinfos = tv.getVatinfos();
+    String pk_purchaseorg =
+        invoice.getHeadStringValue(InvoiceHeaderVO.PK_PURCHASEORG);
+    PricePriority pricePriority =
+        PUSysParamUtil.getPO28For25(pk_purchaseorg) ? PricePriority.TAXPRICE_PRIOR_TO_PRICE
+            : PricePriority.PRICE_PRIOR_TO_TAXPRICE;
+    for (int i = 0; i < rows.length; i++) {
+      VATInfoVO vatvo = vatinfos[i];
+      if (null == vatvo) {
+        continue;
+      }
+      String chgkey = setter.setVatTax(vatvo, rows[i], pricePriority);
+      if (null == chgkey) {
+        continue;
+      }
+      calc.calculate(invoice.getEditor(), new int[] {
+        rows[i]
+      }, chgkey);
+    }
+  }
+
+}

+ 3 - 1
pu/pu/src/client/nc/ui/pu/m25/editor/card/afteredit/body/OcrRefaft.java

@@ -49,6 +49,7 @@ public class OcrRefaft implements ICardBodyAfterEditEventListener{
 			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "ncalcostmny");//计成本金额
 			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "vbdef13");//开票内容
 			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "vbdef14");//是否一致
+			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "vbdef12");//显示名称
 			return;
 		}else {
 			for (int i = 0; i < pks.length; i++) {
@@ -118,6 +119,7 @@ public class OcrRefaft implements ICardBodyAfterEditEventListener{
 					arg0.getBillCardPanel().setBodyValueAt(defdocvo.getShortname5(), arg0.getRow(), "vbdef17");//发票分类
 					arg0.getBillCardPanel().setBodyValueAt(defdocvo.getShortname6(), arg0.getRow(), "ntaxrate");//税率
 					arg0.getBillCardPanel().setBodyValueAt(shuilvpk, arg0.getRow(), "ctaxcodeid");//税码
+					arg0.getBillCardPanel().setBodyValueAt(defdocvo.getCode(), arg0.getRow(), "vbdef16");//发票fid
 					Object shortname = defdocvo.getShortname();
 					if(shortname != null && shortname.toString() != ""){
 						SumAmount = SumAmount.add(new UFDouble(shortname.toString()));
@@ -184,7 +186,7 @@ public class OcrRefaft implements ICardBodyAfterEditEventListener{
 			}
 			arg0.getBillCardPanel().setBodyValueAt(str, arg0.getRow(), "vbdef13");//开票内容
 			arg0.getBillCardPanel().setBodyValueAt(sbf.toString().substring(0, sbf.toString().length()-1), arg0.getRow(), "vbdef20");//主键
-			arg0.getBillCardPanel().setBodyValueAt(refEnumxz, arg0.getRow(), "vbdef16");//显示名称
+			arg0.getBillCardPanel().setBodyValueAt(refEnumxz, arg0.getRow(), "vbdef12");//显示名称
 		} catch (Exception e) {
 			// TODO 自动生成的 catch 块
 			ExceptionUtils.wrappBusinessException(e.getMessage());

+ 235 - 0
pu/pu/src/client/nc/ui/pu/m25/editor/card/afteredit/header/Supplier.java

@@ -0,0 +1,235 @@
+package nc.ui.pu.m25.editor.card.afteredit.header;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import nc.bs.framework.common.NCLocator;
+import nc.itf.pu.pub.IPURemoteCallCombinator;
+import nc.itf.scmpub.reference.uap.bd.supplier.SupplierPubService;
+import nc.itf.uap.IUAPQueryBS;
+import nc.jdbc.framework.processor.BeanProcessor;
+import nc.jdbc.framework.processor.ColumnProcessor;
+import nc.ui.pu.m25.editor.utils.CurrencyUtil;
+import nc.ui.pu.m25.editor.utils.ExchangeRateUtil;
+import nc.ui.pu.m25.rule.InvoiceQueryPriceHandler;
+import nc.ui.pu.m25.rule.InvoiceTaxEditHandler;
+import nc.ui.pu.pub.editor.CardEditorHelper;
+import nc.ui.pu.pub.editor.card.handler.SupplierValueHandler;
+import nc.ui.pu.pub.editor.card.listener.ICardHeadTailAfterEditEventListener;
+import nc.ui.pu.pub.util.SupplierFreeCustInfoUtil;
+import nc.ui.pubapp.uif2app.event.card.CardHeadTailAfterEditEvent;
+import nc.vo.bd.defdoc.DefdocVO;
+import nc.vo.jcom.lang.StringUtil;
+import nc.vo.pu.m25.entity.InvoiceHeaderVO;
+import nc.vo.pu.m25.pub.InvoiceVOUtil;
+import nc.vo.pu.m25.rule.maintain.InvoiceSupplierVatCodeFillRule;
+import nc.vo.pu.m25.rule.maintain.InvoiceVatTaxFillRule;
+import nc.vo.pub.lang.UFDouble;
+import nc.vo.pubapp.pattern.data.ValueUtils;
+import nc.vo.pubapp.pattern.exception.ExceptionUtils;
+
+import org.apache.commons.lang.StringUtils;
+
+/**
+ * <b>本类主要完成以下功能:供应商 </b>
+ * <ul>
+ * <li>表头供应商编辑后处理
+ * </ul>
+ * <p>
+ * </p>
+ * 
+ * @author xiebo
+ * @version 6.0
+ * @see
+ * @since
+ * @time 2010-2-25 上午10:25:16
+ */
+public class Supplier implements ICardHeadTailAfterEditEventListener {
+  /** 一些处理的合并调用工具 */
+  private List<IPURemoteCallCombinator> rccRuleLst =
+      new ArrayList<IPURemoteCallCombinator>();
+  public IUAPQueryBS iuap=(IUAPQueryBS) NCLocator.getInstance().lookup(IUAPQueryBS.class.getName());
+  @Override
+  public void afterEdit(CardHeadTailAfterEditEvent event) {
+    String newValue = ValueUtils.getString(event.getValue());
+    // 1.清空供应商时
+    if (StringUtil.isEmptyWithTrim(newValue)) {
+      // 币种
+      // event.getBillCardPanel().setHeadItem(InvoiceHeaderVO.CORIGCURRENCYID,
+      // null);
+      // 收付款协议
+      event.getBillCardPanel().setHeadItem(InvoiceHeaderVO.PK_PAYTERM, null);
+      event.getBillCardPanel().setHeadItem(InvoiceHeaderVO.PK_BANKACCBAS, null);
+      event.getBillCardPanel().setHeadItem(InvoiceHeaderVO.VBANKACCOUNT, null);
+      return;
+    }
+    // ====== 供应商不空 ================
+    // 1. 取供应商币种并设到表头币种上(询价) √
+    // 2. 改变表头汇率,触发表体重新计算 √
+    // 3. 电话(公式实现)√
+    // 4. 银行账户 (公式实现)√
+    // 5. 付款协议、付款单位, √
+    // 6. 带部门及业务员? √
+    // 7. 散户处理 √
+    // 8.VAT信息设置√
+    // 9.询价√
+
+    // 设置发货国
+    this.setSendcountry(event);
+    SupplierValueHandler handler =
+        new SupplierValueHandler(event.getBillCardPanel());
+    // 设置付款单位,付款协议,采购部门,采购员等
+    handler.handleHeadDefaultValue();
+    CardEditorHelper util = new CardEditorHelper(event.getBillCardPanel());
+    String oldExchangeRate =
+        util.getHeadStringValue(InvoiceHeaderVO.NEXCHANGERATE);
+    // 设置表头币种
+    CurrencyUtil.setOrigcurrency(util);
+    // 设置表头汇率
+    ExchangeRateUtil.setExchangerate(util);
+    // 汇率变化后处理
+    ExchangeRateUtil.calculateBodyRows(util, oldExchangeRate);
+
+    // 注册-触发询价,针对表体所有行(远程调用合并)
+    InvoiceQueryPriceHandler price =
+        new InvoiceQueryPriceHandler(event.getBillCardPanel());
+    price.prepareQueryPrice();
+
+    // 注册-VAT取税规则合并调用
+    this.register_vattaxrule(util);
+
+    // 注册-设置散户的可编辑性及银行账号合并调用
+    SupplierFreeCustInfoUtil scutil = new SupplierFreeCustInfoUtil();
+    scutil.registerCombineRemoteCall(util);
+
+    // 设置散户的可编辑性及银行账号
+    scutil.setFreeCustBankAcc(util);
+    // 执行远程调用的合并规则
+    this.doRmtCombCallRule();
+    // 执行询价
+    price.handleQueryPrice();
+    
+    //比较表体销售方公司
+    try {
+    	int count=event.getBillCardPanel().getRowCount();
+        for(int i=0;i<count;i++){
+        	String headSupplier = (String) event.getBillCardPanel().getHeadItem("pk_supplier").getValueObject();//供应商
+        	String vbdef15 = (String) event.getBillCardPanel().getBodyValueAt(i, "vbdef15"); 
+    		if(vbdef15 == null && headSupplier == null) {
+    			//一致
+    			event.getBillCardPanel().setBodyValueAt("一致", i, "vbdef14");
+    		}else if(vbdef15 == null || headSupplier == null) {
+    			//不一致
+    			event.getBillCardPanel().setBodyValueAt("不一致", i, "vbdef14");
+    		}else {
+    			String sql = "select name from bd_supplier where pk_supplier ='"+headSupplier+"'";
+    			String name = (String) iuap.executeQuery(sql, new ColumnProcessor());
+    			if(vbdef15.equals(name)) {
+    				//一致
+    				event.getBillCardPanel().setBodyValueAt("一致", i, "vbdef14");
+    			}else {
+    				//不一致
+    				event.getBillCardPanel().setBodyValueAt("不一致", i, "vbdef14");
+    			}
+    		}
+    		
+    		
+    		String vbdef20 = (String) event.getBillCardPanel().getBodyValueAt(i, "vbdef20");
+    	    if(vbdef20 != null) {
+    	    	String sql = "select * from bd_defdoc where dr=0 and pk_defdoc = '"+vbdef20+"'";
+    	    	DefdocVO defdocvo = (DefdocVO) iuap.executeQuery(sql, new BeanProcessor(DefdocVO.class));
+    	    	String qryshuilv = "select pk_taxcode from bd_taxrate where nvl(dr,0) = 0 and pk_taxcode not in (select pk_taxcode from bd_taxcode where code = '0') and taxrate = '"+defdocvo.getShortname6()+"'";
+    	    	Object shuilvpk = iuap.executeQuery(qryshuilv, new ColumnProcessor());
+    	    	if(shuilvpk == null){
+    				ExceptionUtils.wrappBusinessException("税率没有对应税码,请检查!");
+    			}
+    	    	
+    	    	UFDouble SumAmount = UFDouble.ZERO_DBL;//不含税
+    			UFDouble SumTotal = UFDouble.ZERO_DBL;//价税合计
+    			UFDouble SumTax =UFDouble.ZERO_DBL;//税额
+    			Object shortname = defdocvo.getShortname();
+    			if(shortname != null && shortname.toString() != ""){
+    				SumAmount = SumAmount.add(new UFDouble(shortname.toString()));
+    			}
+    			Object shortname2 = defdocvo.getShortname2();
+    			if(shortname2 != null && shortname2.toString() != ""){
+    				SumTotal = SumTotal.add(new UFDouble(shortname2.toString()));
+    			}
+    			Object shortname3 = defdocvo.getShortname3();
+    			if(shortname3 != null && shortname3.toString() != ""){
+    				SumTax = SumTax.add(new UFDouble(shortname3.toString()));
+    			}
+    			
+    	    	event.getBillCardPanel().setBodyValueAt(defdocvo.getShortname6(), i, "ntaxrate");//税率
+    	    	event.getBillCardPanel().setBodyValueAt(shuilvpk, i, "ctaxcodeid");//税码
+    	    	event.getBillCardPanel().setBodyValueAt(SumAmount, i, "nastorigprice");//无税单价
+    	    	event.getBillCardPanel().setBodyValueAt(SumAmount, i, "nastprice");//本币无税单价
+    	    	event.getBillCardPanel().setBodyValueAt(SumAmount, i, "nprice");//主本币无税单价
+    	    	event.getBillCardPanel().setBodyValueAt(SumAmount, i, "norigmny");//无税金额
+    	    	event.getBillCardPanel().setBodyValueAt(SumAmount, i, "nmny");//本币无税金额
+    			event.getBillCardPanel().setBodyValueAt(SumAmount, i, "ncalcostmny");//计成本金额
+    			event.getBillCardPanel().setBodyValueAt(SumTotal, i, "nastorigtaxprice");//含税单价
+    			event.getBillCardPanel().setBodyValueAt(SumTotal, i, "nasttaxprice");//本币含税单价
+    			event.getBillCardPanel().setBodyValueAt(SumTotal, i, "ntaxprice");//主本币含税单价
+    			event.getBillCardPanel().setBodyValueAt(SumTotal, i, "norigtaxmny");//价税合计
+    			event.getBillCardPanel().setBodyValueAt(SumTotal, i, "ntaxmny");//本币价税合计
+    			event.getBillCardPanel().setBodyValueAt(SumTax, i, "ntax");//税额
+    			
+    	    }
+        }
+	} catch (Exception e) {
+		ExceptionUtils.wrappBusinessException(e.getMessage());
+	}
+    
+  }
+
+  private void doRmtCombCallRule() {
+    try {
+      for (IPURemoteCallCombinator rccrule : this.rccRuleLst) {
+        rccrule.process();
+      }
+    }
+    catch (Exception e) {
+      ExceptionUtils.wrappException(e);
+    }
+    finally {
+      // 处理完成后必须清空
+      this.rccRuleLst.clear();
+    }
+  }
+
+  private void register_vattaxrule(CardEditorHelper invoice) {
+    // 清空供应商VAT注册码
+    invoice.setHeadValue(InvoiceHeaderVO.VVENDORVATCODE, null);
+
+    IPURemoteCallCombinator vattaxrule =
+        new InvoiceTaxEditHandler(invoice.getEditor(), null,
+            new InvoiceSupplierVatCodeFillRule(new CardEditorHelper[] {
+              invoice
+            }), new InvoiceVatTaxFillRule(new CardEditorHelper[] {
+              invoice
+            }));
+    vattaxrule.prepare();
+    this.rccRuleLst.add(vattaxrule);
+  }
+
+  private boolean setSendcountry(CardHeadTailAfterEditEvent event) {
+    CardEditorHelper invoice = new CardEditorHelper(event.getBillCardPanel());
+    String pk_supplier = (String) event.getValue();
+    // 非自制的发票不能修改国家
+    if (StringUtils.isBlank(pk_supplier) || !InvoiceVOUtil.isSelfMade(invoice)) {
+      return false;
+    }
+    // 有缓存,这里不会有远程调用
+    String pk_country = SupplierPubService.queryCountryBySupplier(new String[] {
+      pk_supplier
+    }).get(pk_supplier);
+    String old_country =
+        invoice.getHeadStringValue(InvoiceHeaderVO.CSENDCOUNTRYID);
+    if (StringUtils.isBlank(pk_country) || pk_country.equals(old_country)) {
+      return false;
+    }
+    invoice.setHeadValue(InvoiceHeaderVO.CSENDCOUNTRYID, pk_country);
+    return true;
+  }
+}

+ 32 - 21
pu/pu/src/client/nc/ui/pubapp/uif2app/actions/MultiSelectDialog.java

@@ -50,6 +50,7 @@ import nc.vo.bd.defdoc.DefdocVO;
 import nc.vo.pub.BusinessException;
 import nc.vo.pub.filesystem.FileTypeConst;
 import nc.vo.pub.filesystem.NCFileVO;
+import nc.vo.pub.lang.UFDouble;
 import nc.vo.pubapp.pattern.pub.SqlBuilder;
 public class MultiSelectDialog extends UIDialog {
 
@@ -151,15 +152,19 @@ public class MultiSelectDialog extends UIDialog {
 				for(int j = 0;j < infos.size();j++){
 					JSONObject info = infos.getJSONObject(j);
 					String memo = info.getString("number");//发票号
-					String code = info.getString("number");//发票代码
+					String code = info.getString("fid");
 					String fid = info.getString("fid");
-					
+					String codenumber = info.getString("code"); //发票代码
 					//特殊发票发票号和发票代码不存在
-					if(code == null || "".equals(code)) {
-						memo = "特殊发票"+fid;
-						code = fid;
+					if(codenumber == null || "".equals(codenumber)) {
+						codenumber = "0";
+					}
+					if(memo == null || "".equals(memo)) {
+						memo = "0";
 					}
 					
+					
+					
 					String ext = info.getString("ext");
 					JSONObject extobj = JSONObject.parseObject(ext);
 					String trate = extobj.getString("trate");//税率
@@ -200,7 +205,14 @@ public class MultiSelectDialog extends UIDialog {
 					JSONObject payer = comm_info.getJSONObject("payer");
 					String name3 = payer.getString("tcode");//销售方纳税人识别号
 					String name4 = payer.getString("company");//购买方公司名称
-					String norigtaxmny = QryNorigtaxmny(code);//发票已使用金额
+					Map<Object,Object> mappo =  QryNorigtaxmny(code);
+					UFDouble norigtaxmny =  new UFDouble(mappo.get("norigtaxmny") == null ? 0.00 : Double.valueOf(mappo.get("norigtaxmny").toString()),2);//已使用价税合计
+					UFDouble norigmny = new UFDouble(mappo.get("norigmny") == null ? 0.00 : Double.valueOf(mappo.get("norigmny").toString()),2);//已使用无税金额
+					UFDouble ntax = new UFDouble(mappo.get("norigtaxmny") == null ? 0.00 : Double.valueOf(mappo.get("ntax").toString()),2);//已使用税额
+					
+					UFDouble norigtaxmnys = new UFDouble(total ==  null ? 0.00 : Double.parseDouble(total),2);//发票价税合计
+					UFDouble norigmnys = new UFDouble(amount ==  null ? 0.00 : Double.parseDouble(amount),2);//发票无税金额
+					UFDouble ntaxs = new UFDouble(dtax ==  null ? 0.00 : Double.parseDouble(dtax),2);//发票税额
 					DefdocVO defvo = new DefdocVO();
 					long l = System.currentTimeMillis();
 					//发票可以重复获取,避免自定义档案保存保存,加上时间戳保证唯一
@@ -230,14 +242,15 @@ public class MultiSelectDialog extends UIDialog {
 					defvo.setAttributeValue("innercode", "1");//0本地上传 1发票云获取
 					//mapfurl.put(code, furl);
 					defvo.setAttributeValue("shortname4", kind);
+					defvo.setAttributeValue("modifier", codenumber);
 					listDefdocVO.add(defvo);
 					Boolean blen = QryOCRNumber(code, "1")  == null ? false : true;
 					String url = "https://dl.mypiaojia.com/api/noauth/?id="+furl;
 					String link = "<html><a href="+url+">"+name+"</a></html>";
-					Object[] obj = {blen,cname,amount,norigtaxmny,dtax,trate,total,code,memo,link,mnecode,name2,name3,name4,kind,date};
+					Object[] obj = {blen,cname,norigtaxmnys.sub(norigtaxmny),norigmnys.sub(norigmny),ntaxs.sub(ntax),total,amount,trate,dtax,codenumber,memo,link,mnecode,name2,name3,name4,kind,date,code};
 					dataList.add(obj);
 				}
-				String[] columnNames = {"选择","发票类型", "发票金额","已使用金额","税额","税率","价税合计","发票代码","发票号","发票名称","购买方纳税人识别号","购买方公司名称","销售方纳税人识别号","销售方公司名称","开票内容","发票时间"};
+				String[] columnNames = {"选择","发票类型" ,"可用含税金额","可用无税金额","可用税额","票面含税金额","票面无税金额","票面税率","票面税额","发票代码","发票号","发票名称","购买方纳税人识别号","购买方公司名称","销售方纳税人识别号","销售方公司名称","开票内容","发票时间","fid"};
 				Object[][] dataArray = new Object[dataList.size()][columnNames.length];
 				for (int i = 0; i < dataList.size(); i++) {
 		            Object[] rowData = dataList.get(i);
@@ -264,7 +277,7 @@ public class MultiSelectDialog extends UIDialog {
 			            int column = table.columnAtPoint(e.getPoint());
 			            
 			            // 如果点击的是链接列
-			            if (column == 9) {
+			            if (column == 11) {
 			                String htmlLink = ((String) table.getValueAt(row, column)).replaceAll(".*<a href=(.*?)>.*", "$1");
 			                // 使用Desktop类打开默认浏览器
 			                try {
@@ -346,7 +359,7 @@ public class MultiSelectDialog extends UIDialog {
 			List<Object[]> list  = getSelectedData();
 			for (int i = 0; i < list.size(); i++) {
 				//选中的code
-				String code = list.get(i)[7].toString();
+				String code = list.get(i)[18].toString();
 				for (int j = 0; j < listDefdocVO.size(); j++) {
 					//获取的code
 					String codes = listDefdocVO.get(j).getCode();
@@ -412,16 +425,14 @@ public class MultiSelectDialog extends UIDialog {
 		
 		List<String> memoarry = QryDefMemo(lisvdef20);
 		String number = "";//发票号
-		//String pjnames="";//发票名称
 		for (int i = 0; i < unlist.size(); i++) {
 			//如果发票参照没有选择数据,可直接删除
 			if(memoarry.size() == 0) {
-				String code = unlist.get(i)[7].toString();
+				String code = unlist.get(i)[18].toString();
 				number += code.substring(0, code.indexOf("—")) +",";
-				//pjnames+= unlist.get(i)[9].toString() +",";
 			}
 			//未选中的发票名称
-			String name = unlist.get(i)[9].toString().replaceAll("<[^>]*>", "");
+			String name = unlist.get(i)[11].toString().replaceAll("<[^>]*>", "");
 			for (int j = 0; j < memoarry.size(); j++) {
 				//参照已选中的发票
 				String names = memoarry.get(j);
@@ -430,14 +441,13 @@ public class MultiSelectDialog extends UIDialog {
 				}
 				//如果发票参照选择了数据,匹配后没有相同项,可删除
 				if((j+1) == memoarry.size()) {
-					String code = unlist.get(i)[7].toString();
+					String code = unlist.get(i)[18].toString();
 					number += code.substring(0, code.indexOf("—")) +",";
 				}
 			}
 		}
 		if(!"".equals(number)) {
 			DeleteDOC(number);
-			//DeleteFile(pjnames);//删除附件
 		}
 		
 	}
@@ -569,15 +579,17 @@ public class MultiSelectDialog extends UIDialog {
 		
 	}
 	/**
-	 * 查询该发票已使用价税合计
+	 * 查询该发票已使用价税合计,无税金额,税额
 	 * @param code 发票号
 	 * @return
 	 * @throws Exception
 	 */
-	private String QryNorigtaxmny(String code) throws Exception {
+	private Map<Object,Object> QryNorigtaxmny(String code) throws Exception {
 		StringBuffer sql = new StringBuffer();
 		sql.append("SELECT");
-		sql.append(" SUM( po_invoice_b.norigtaxmny ) as norigtaxmny");
+		sql.append(" SUM( po_invoice_b.norigtaxmny ) as norigtaxmny,");
+		sql.append(" SUM( po_invoice_b.norigmny ) as norigmny,");
+		sql.append(" SUM( po_invoice_b.ntax ) as ntax");
 		sql.append(" FROM");
 		sql.append(" po_invoice po_invoice");
 		sql.append(" LEFT JOIN po_invoice_b po_invoice_b ON po_invoice.pk_invoice = po_invoice_b.pk_invoice ");
@@ -585,8 +597,7 @@ public class MultiSelectDialog extends UIDialog {
 		sql.append(" po_invoice.fbillstatus <> '0' ");
 		sql.append(" AND po_invoice.fbillstatus <> '1' ");
 		sql.append(" AND po_invoice_b.vbdef20 IN ( SELECT pk_defdoc FROM bd_defdoc WHERE code LIKE '"+code+"%' )");
-		Object norigtaxmny = (Object) iuap.executeQuery(sql.toString(), new ColumnProcessor());
-		return  (String) (norigtaxmny == null ? "0.00" : norigtaxmny.toString());
+		return (Map<Object, Object>) iuap.executeQuery(sql.toString(), new MapProcessor());
 	}
 }
 

+ 5 - 1
pu/pu/src/private/nc/bs/ic/base/InvoiceAfterCheckEvent.java

@@ -127,7 +127,11 @@ public class InvoiceAfterCheckEvent implements IBusinessListener{
 								}
 							}
 						}
-						for (Map<Object, Object> map : listMap) { 
+						for (Map<Object, Object> map : listMap) {//
+							//自增没有来源不比较
+							if(invoiceItemVO.getCsourcebid() == null) {
+								continue;
+							}
 							//来源可能是采购订单,采购入库单
 							if (invoiceItemVO.getCsourcebid().equals(map.get("pk_order_b")) || invoiceItemVO.getCsourcebid().equals(map.get("cgeneralbid"))) { 
 								UFDouble norigtaxmny1 = invoiceItemVO.getNorigtaxmny();

+ 125 - 0
pu/pu/src/private/nc/bs/ic/base/OrderAfterSubmitEvent.java

@@ -0,0 +1,125 @@
+package nc.bs.ic.base;
+
+import com.alibaba.fastjson.JSONArray;
+
+import nc.impl.pubapp.pattern.rule.IRule;
+import nc.vo.pu.m21.entity.OrderVO;
+import net.sf.json.JSONObject;
+
+/**
+ * 采购订单提交后传OA
+ * @author Yaoyu
+ * 2023/07/17
+ */
+public class OrderAfterSubmitEvent implements IRule<OrderVO>{
+
+	@Override
+	public void process(OrderVO[] vos) {
+		for (int i = 0; i < vos.length; i++) {
+			//表头
+			JSONObject mainData = new JSONObject();
+			//
+			mainData.put("fieldName", null);
+			mainData.put("fieldValue", null);
+			//采购组织
+			JSONObject cgzz = new JSONObject();
+			cgzz.put("fieldName", null);
+			cgzz.put("fieldValue", null);
+			//订单编号
+			JSONObject ddbh = new JSONObject();
+			ddbh.put("fieldName", null);
+			ddbh.put("fieldValue", null);
+			//订单日期
+			JSONObject ddrq = new JSONObject();
+			ddrq.put("fieldName", null);
+			ddrq.put("fieldValue", null);
+			//订单类型
+			JSONObject ddlx = new JSONObject();
+			ddlx.put("fieldName", null);
+			ddlx.put("fieldValue", null);
+			//供应商
+			JSONObject gys = new JSONObject();
+			gys.put("fieldName", null);
+			gys.put("fieldValue", null);
+			//计划员
+			JSONObject jhy = new JSONObject();
+			jhy.put("fieldName", null);
+			jhy.put("fieldValue", null);
+			//计划部门
+			JSONObject jhbm = new JSONObject();
+			jhbm.put("fieldName", null);
+			jhbm.put("fieldValue", null);
+			//采购员
+			JSONObject cgy = new JSONObject();
+			cgy.put("fieldName", null);
+			cgy.put("fieldValue", null);
+			//采购部门
+			JSONObject cgbm = new JSONObject();
+			cgbm.put("fieldName", null);
+			cgbm.put("fieldValue", null);
+			//是否需要招投标
+			JSONObject sfxyztb = new JSONObject();
+			sfxyztb.put("fieldName", null);
+			sfxyztb.put("fieldValue", null);
+			//有无框架协议
+			JSONObject ywkjxy = new JSONObject();
+			ywkjxy.put("fieldName", null);
+			ywkjxy.put("fieldValue", null);
+			//预算名称
+			JSONObject ysmc = new JSONObject();
+			ysmc.put("fieldName", null);
+			ysmc.put("fieldValue", null);
+			//预算编号
+			JSONObject ysbh = new JSONObject();
+			ysbh.put("fieldName", null);
+			ysbh.put("fieldValue", null);
+			//预算所在部门
+			JSONObject ysszbm = new JSONObject();
+			ysszbm.put("fieldName", null);
+			ysszbm.put("fieldValue", null);
+			//是否有附件
+			JSONObject sfyfj = new JSONObject();
+			sfyfj.put("fieldName", null);
+			sfyfj.put("fieldValue", null);
+			//总数量
+			JSONObject zsl = new JSONObject();
+			zsl.put("fieldName", null);
+			zsl.put("fieldValue", null);
+			//价税合计
+			JSONObject jshj = new JSONObject();
+			jshj.put("fieldName", null);
+			jshj.put("fieldValue", null);
+			//备注
+			JSONObject bz = new JSONObject();
+			bz.put("fieldName", null);
+			bz.put("fieldValue", null);
+			//判断前端后无合同
+			JSONObject pdqdywht = new JSONObject();
+			pdqdywht.put("fieldName", null);
+			pdqdywht.put("fieldValue", null);
+			//判断合同是否框架协议
+			JSONObject pdhtsfkjxy = new JSONObject();
+			pdhtsfkjxy.put("fieldName", null);
+			pdhtsfkjxy.put("fieldValue", null);
+			//一个合同关联订单累计金额
+			JSONObject pdtyghtglddljje = new JSONObject();
+			pdtyghtglddljje.put("fieldName", null);
+			pdtyghtglddljje.put("fieldValue", null);
+			//判断是否月结
+			JSONObject pdsfyj = new JSONObject();
+			pdsfyj.put("fieldName", null);
+			pdsfyj.put("fieldValue", null);
+			JSONObject fieldValue = new JSONObject();
+		    fieldValue.put("filePath", "https://autoaccount.thape.com.cn/uploads/20220908/0a44e9b50b8b6143771eb6eb238ea82a.png");
+		    fieldValue.put("fileName", "test.png");
+		    // 创建包含fieldName和fieldValue的JSONArray
+		    JSONArray jsonArray = new JSONArray();
+		    jsonArray.add(fieldValue);
+		    //附件
+		    JSONObject fj = new JSONObject();
+		    // 将fieldName和fieldValue放入最终的JSONObject
+		    fj.put("fieldName", null);
+		    fj.put("fieldValue", jsonArray);
+		}
+	}
+}

+ 19 - 0
pu/pu/src/private/nc/bs/ic/base/OrderAfterUnSubmitEvent.java

@@ -0,0 +1,19 @@
+package nc.bs.ic.base;
+
+import nc.impl.pubapp.pattern.rule.IRule;
+import nc.vo.pu.m21.entity.OrderVO;
+
+/**
+ * ²É¹º¶©µ¥ÊÕ»ØÉ¾³ýOAµ¥¾Ý
+ * @author Yaoyu	
+ *2023/07/17
+ */
+public class OrderAfterUnSubmitEvent implements IRule<OrderVO>{
+
+	@Override
+	public void process(OrderVO[] vos) {
+		// TODO Auto-generated method stub
+		
+	}
+
+}

+ 38 - 0
pu/pu/src/private/nc/impl/pu/m21/action/OrderSendApproveAction.java

@@ -0,0 +1,38 @@
+package nc.impl.pu.m21.action;
+
+import nc.bs.ic.base.OrderAfterSubmitEvent;
+import nc.bs.pu.m21.plugin.OrderPluginPoint;
+import nc.bs.pub.compiler.AbstractCompiler2;
+import nc.bs.scmpub.pf.PfParameterUtil;
+import nc.impl.pu.m21.action.rule.approve.SendAppoveVOValidateRule;
+import nc.impl.pu.m21.action.rule.approve.SendApproveAfterRule;
+import nc.impl.pu.m21.action.rule.approve.SendApproveBeforeEventRule;
+import nc.impl.pu.m21.action.rule.approve.SendApproveFlowCheckRule;
+import nc.impl.pu.m21.action.rule.approve.SendApproveStatusChangeRule;
+import nc.impl.pubapp.pattern.data.bill.BillUpdate;
+import nc.impl.pubapp.pattern.rule.processer.AroundProcesser;
+import nc.vo.pu.m21.entity.OrderVO;
+
+public class OrderSendApproveAction {
+	public OrderVO[] sendApprove(OrderVO[] vos, AbstractCompiler2 script) {
+		PfParameterUtil<OrderVO> util = new PfParameterUtil(script.getPfParameterVO(), vos);
+		OrderVO[] originBills = (OrderVO[]) util.getOrginBills();
+		OrderVO[] clientBills = (OrderVO[]) util.getClientFullInfoBill();
+		AroundProcesser<OrderVO> processor = new AroundProcesser(OrderPluginPoint.SEND_APPROVE);
+		this.addRule(processor);
+		processor.before(clientBills);
+		OrderVO[] returnVos = (OrderVO[]) (new BillUpdate()).update(clientBills, originBills);
+		processor.after(returnVos);
+		return returnVos;
+	}
+
+	private void addRule(AroundProcesser<OrderVO> processer) {
+		processer.addBeforeFinalRule(new SendApproveFlowCheckRule());
+		processer.addBeforeFinalRule(new SendAppoveVOValidateRule());
+		processer.addBeforeFinalRule(new SendApproveStatusChangeRule());
+		processer.addBeforeRule(new SendApproveBeforeEventRule());
+		processer.addAfterRule(new SendApproveAfterRule());
+		processer.addAfterRule(new OrderAfterSubmitEvent());
+		
+	}
+}

+ 47 - 0
pu/pu/src/private/nc/impl/pu/m21/action/OrderUnSendApproveAction.java

@@ -0,0 +1,47 @@
+package nc.impl.pu.m21.action;
+
+import nc.bs.ic.base.OrderAfterUnSubmitEvent;
+import nc.bs.pu.m21.plugin.OrderPluginPoint;
+import nc.bs.pub.compiler.AbstractCompiler2;
+import nc.bs.scmpub.pf.PfParameterUtil;
+import nc.impl.pu.m21.action.rule.approve.UnSendAppoveVOValidateRule;
+import nc.impl.pu.m21.action.rule.approve.UnSendApproveAfterEventRule;
+import nc.impl.pu.m21.action.rule.approve.UnSendApproveBeforeEventRule;
+import nc.impl.pubapp.pattern.data.bill.BillUpdate;
+import nc.impl.pubapp.pattern.rule.processer.AroundProcesser;
+import nc.vo.pu.m21.entity.OrderVO;
+import nc.vo.pubapp.pattern.exception.ExceptionUtils;
+
+public class OrderUnSendApproveAction {
+	public OrderVO[] unSendApprove(OrderVO[] vos, AbstractCompiler2 script) {
+		PfParameterUtil<OrderVO> util = new PfParameterUtil(script == null ? null : script.getPfParameterVO(), vos);
+		OrderVO[] originBills = (OrderVO[]) util.getOrginBills();
+		OrderVO[] clientBills = (OrderVO[]) util.getClientFullInfoBill();
+		AroundProcesser<OrderVO> processer = new AroundProcesser(OrderPluginPoint.UNSAVE);
+		this.addBeforeRule(processer);
+		this.addAfterRule(processer);
+		processer.before(clientBills);
+		if (null != script) {
+			try {
+				script.procRecallFlow(script.getPfParameterVO());
+			} catch (Exception var9) {
+				ExceptionUtils.wrappException(var9);
+			}
+		}
+
+		BillUpdate<OrderVO> update = new BillUpdate();
+		OrderVO[] returnVos = (OrderVO[]) update.update(clientBills, originBills);
+		processer.after(returnVos);
+		return returnVos;
+	}
+
+	private void addBeforeRule(AroundProcesser<OrderVO> processer) {
+		processer.addBeforeFinalRule(new UnSendAppoveVOValidateRule());
+		processer.addBeforeRule(new UnSendApproveBeforeEventRule());
+	}
+
+	private void addAfterRule(AroundProcesser<OrderVO> processer) {
+		processer.addAfterRule(new UnSendApproveAfterEventRule());
+		processer.addAfterRule(new OrderAfterUnSubmitEvent());
+	}
+}

+ 162 - 0
pu/pu/src/private/nc/impl/th/OrderSendOA.java

@@ -0,0 +1,162 @@
+package nc.impl.th;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jeecg.common.util.DataUtill;
+
+import com.alibaba.fastjson.JSONObject;
+
+import cn.hutool.core.util.CharsetUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.crypto.asymmetric.KeyType;
+import cn.hutool.crypto.asymmetric.RSA;
+import cn.hutool.http.HttpRequest;
+import cn.hutool.json.JSONUtil;
+import nc.bs.dao.BaseDAO;
+/**
+ * Token认证测试
+ *
+ *  认证过程主要采用RSA非对称加密算法
+ *
+ * @author tzf 2020/6/9
+ */
+public class OrderSendOA {
+    /**
+     * 模拟缓存服务
+     */
+    private static  Map<String,String> SYSTEM_CACHE = new HashMap <String,String>();
+    
+    private static String address = "http://bx.thape.com.cn:8080";
+    private static String api = "/api/system/appmanage/route";
+    
+    static BaseDAO basedao = new BaseDAO();
+    /**
+     * ecology系统发放的授权许可证(appid)
+     */
+    private static final String APPID = "SHTH-NC-20230720";
+
+    /**
+     * 第一步:
+     *
+     * 调用ecology注册接口,根据appid进行注册,将返回服务端公钥和Secret信息
+     */
+    public static Map<String,Object> testRegist(String address){
+        //获取当前系统RSA加密的公钥
+        RSA rsa = new RSA();
+        String publicKey = rsa.getPublicKeyBase64();
+        String privateKey = rsa.getPrivateKeyBase64();
+        // 客户端RSA私钥
+        SYSTEM_CACHE.put("LOCAL_PRIVATE_KEY",privateKey);
+        // 客户端RSA公钥
+        SYSTEM_CACHE.put("LOCAL_PUBLIC_KEY",publicKey);
+        //调用ECOLOGY系统接口进行注册
+//        String data = HttpRequest.post(address + "/api/ec/dev/auth/regist")
+//                .header("appid",APPID)
+//                .header("cpk",publicKey)
+//                .timeout(2000)
+//                .execute().body();
+        String data = "{\"msg\":\"ok\",\"code\":0,\"msgShowType\":\"none\",\"secrit\":\"9f8dcd63-86b0-4be8-86d0-feeb2919ed9c\",\"secret\":\"9f8dcd63-86b0-4be8-86d0-feeb2919ed9c\",\"status\":true,\"spk\":\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmx1HfTtkjYDzYrIb95v382KyzJlNpkVHZ3W/OjxMm9pvlaJlrEY6rF9Q8ASeK4RBlHkPyq5SsfQBPjHMHmjKU0j1I+VSOL7qpipDvBfmxAZVGH+VehJeP3DvV94Z8n1nfBoQrMEsSfu4obvFQ6LkCxV9Ev6bKPdV1yJb89uOJYoxdDb/E/SuP8KK6HqsIv9M98TDofaZRaY3G/iKnHQUGKqoXNc4YwI6AxKXBl90mOCViydHvjcxbj4qJGWP0tQ97xRH9gEGk/v5Ezf68u4Z25K2eFu377y4VfJRzAuGwgpTCp6JZxnL1oJ3Hft/5mKfzGKkcbrzSLeMvsKKuo2tmwIDAQAB\"}";
+        // 打印ECOLOGY响应信息
+        System.out.println("testRegist():"+data);
+        Map<String,Object> datas = JSONUtil.parseObj(data);
+        //ECOLOGY返回的系统公钥
+        SYSTEM_CACHE.put("SERVER_PUBLIC_KEY",StrUtil.nullToEmpty((String)datas.get("spk")));
+        //ECOLOGY返回的系统密钥
+        SYSTEM_CACHE.put("SERVER_SECRET",StrUtil.nullToEmpty((String)datas.get("secrit")));
+        //将数据存入数据库
+        return datas;
+    }
+    /**
+     * 第二步:
+     *
+     * 通过第一步中注册系统返回信息进行获取token信息
+     * @throws Exception 
+     */
+    public static Map<String,Object> testGetoken(String address) throws Exception{
+        String secret = null;
+        String spk = null;
+    	String str = DataUtill.queryRegist();
+    	//如果为1,说明还未进行注册,调用注册接口进行注册认证与数据更新
+    	if("1".equals(str)) {
+    		 testRegist(address);
+             // 重新获取最新ECOLOGY系统公钥和Secret信息
+             secret = SYSTEM_CACHE.get("SERVER_SECRET");
+             spk = SYSTEM_CACHE.get("SERVER_PUBLIC_KEY");
+             //将数据信息存入
+             JSONObject defaultvalue = new JSONObject();
+             defaultvalue.put("SERVER_SECRET", SYSTEM_CACHE.get("SERVER_SECRET"));
+             defaultvalue.put("SERVER_PUBLIC_KEY", SYSTEM_CACHE.get("SERVER_PUBLIC_KEY"));
+    	}else {
+    		JSONObject defaultvalue = JSONObject.parseObject(str);
+    		secret = defaultvalue.getString("");
+            spk = defaultvalue.getString("SERVER_PUBLIC_KEY");
+            Update(defaultvalue.toString());
+    	}
+        // 公钥加密,所以RSA对象私钥为null
+        RSA rsa = new RSA(null,spk);
+        //对秘钥进行加密传输,防止篡改数据
+        String encryptSecret = rsa.encryptBase64(secret,CharsetUtil.CHARSET_UTF_8,KeyType.PublicKey);
+        //调用ECOLOGY系统接口进行注册
+        String data = HttpRequest.post(address+ "/api/ec/dev/auth/applytoken")
+                .header("appid",APPID)
+                .header("secret",encryptSecret)
+                .header("time","3600")
+                .execute().body();
+        System.out.println("testGetoken():"+data);
+        Map<String,Object> datas = JSONUtil.parseObj(data);
+        //ECOLOGY返回的token
+        // TODO 为Token缓存设置过期时间
+        SYSTEM_CACHE.put("SERVER_TOKEN",StrUtil.nullToEmpty((String)datas.get("token")));
+        return datas;
+    }
+    /**
+     * 第三步:
+     *
+     * 调用ecology系统的rest接口,请求头部带上token和用户标识认证信息
+     *
+     * @param address ecology系统地址
+     * @param api rest api 接口地址(该测试代码仅支持GET请求)
+     * @param jsonParams 请求参数json串
+     *
+     * 注意:ECOLOGY系统所有POST接口调用请求头请设置 "Content-Type","application/x-www-form-urlencoded; charset=utf-8"
+     * @throws Exception 
+     */
+    public static String testRestful(String jsonParams) throws Exception{
+        //ECOLOGY返回的token
+        String token= SYSTEM_CACHE.get("SERVER_TOKEN");
+        if (StrUtil.isEmpty(token)){
+            token = (String) testGetoken(address).get("token");
+        }
+        String spk = SYSTEM_CACHE.get("SERVER_PUBLIC_KEY");
+        //封装请求头参数
+        RSA rsa = new RSA(null,spk);
+        //对用户信息进行加密传输,暂仅支持传输OA用户ID
+        String encryptUserid = rsa.encryptBase64("1",CharsetUtil.CHARSET_UTF_8,KeyType.PublicKey);
+        //调用ECOLOGY系统接口,注意此处的disableCookie,可翻阅hutool的文档查看
+//        HttpRequest request = HttpRequest.get(address + api);
+//        request.disableCookie();
+//        String data = HttpRequest
+//                .get(address + api)
+//                .header("appid",APPID)
+//                .header("token",token)
+//                .header("userid",encryptUserid)
+//                .body(jsonParams)
+//                .execute().body();
+//        System.out.println("testRestful():"+data);
+        return null;
+    }
+    /**
+     * 
+     * @param data
+     * @throws Exception 
+     */
+    public static void Update(String data) throws Exception {
+    	String sql = "update pub_sysinittemp set defaultvalue = '"+data+"' where initcode ='OAZCRZ'";
+    	basedao.executeUpdate(sql.toString());
+    }
+    
+    
+    public static void main(String[] args) throws Exception {
+        testRestful("1");
+    }
+}

+ 0 - 1
pu/pu/src/private/nc/impl/th/ThOcrServiceImpl.java

@@ -839,7 +839,6 @@ public class ThOcrServiceImpl implements IThOcrService{
 							arrinfos.add(bodyJson2);
 						}
 						bodyJson1.put("infos", arrinfos);
-						System.out.println();
 						NcLog.info("·¢Æ±Ëø¶¨Ð޸ķµ»Øjson:"+UpdateInvoiceOCR(bodyJson1.toString()));
 					}
 			}

+ 141 - 0
pu/pu/src/private/nc/impl/th/ThOrderServiceImpl.java

@@ -0,0 +1,141 @@
+package nc.impl.th;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import nc.bs.framework.adaptor.IHttpServletAdaptor;
+import nc.bs.framework.common.InvocationInfoProxy;
+import nc.bs.framework.common.NCLocator;
+import nc.bs.framework.server.ISecurityTokenCallback;
+import nc.bs.servlet.service.BaseServlet;
+import nc.itf.uap.IUAPQueryBS;
+import nc.itf.uap.pf.IplatFormEntry;
+import nc.jdbc.framework.processor.ColumnProcessor;
+import nc.log.NcLog;
+import nc.md.persist.framework.IMDPersistenceQueryService;
+import nc.pub.util.DataSourceUtil;
+import nc.vo.pu.m21.entity.OrderVO;
+import nc.vo.pub.BusinessException;
+import net.sf.json.JSONObject;
+
+
+/**
+ * 采购订单审批
+ * @author Yaoyu
+ *2023/07/14
+ */
+public class ThOrderServiceImpl extends BaseServlet implements IHttpServletAdaptor{
+	private IUAPQueryBS iuap = (IUAPQueryBS) NCLocator.getInstance().lookup(IUAPQueryBS.class.getName());
+	private IMDPersistenceQueryService service = NCLocator.getInstance().lookup(IMDPersistenceQueryService.class);
+	private String vbillcode = null;
+	@Override
+	public void doAction(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+		try {
+			String data = buildJson(req, resp, this.getClass().getName());
+			NcLog.info("采购订单审批开始,JSON:"+data);
+			JSONObject json = JSONObject.fromObject(data);
+			vbillcode = json.getString("vbillcode");
+			checkJson(json);
+			// 登录NC
+			NCLocator.getInstance().lookup(ISecurityTokenCallback.class).token("NCSystem".getBytes(),"pfxx".getBytes());
+			//根据单据号查询pk后根据pk或者AggVO
+			OrderVO orderVO = (OrderVO) service.queryBillOfNCObjectByPKWithDR(OrderVO.class, QuyOrderPK(vbillcode,json.getString("pk_org")), true).getContainmentObject();
+			//用户id
+			String pk_user = QuyUserPk(json.getString("approver"));
+			setInstance(json.getString("taudittime"),pk_user,orderVO.getParent().getAttributeValue("pk_group").toString());
+			//调用审批动作脚本
+			IplatFormEntry ipf = NCLocator.getInstance().lookup(IplatFormEntry.class);
+			ipf.processAction("APPROVE", "21", null, orderVO, null, null);
+			resp.getWriter().write(formatRSJsonData("成功","",vbillcode).toString());
+		} catch (Exception e) {
+			e.printStackTrace();
+			StringWriter stringWriter = new StringWriter();
+			e.printStackTrace(new PrintWriter(stringWriter));
+			//获取详细信息
+			String msg=stringWriter.getBuffer().toString();
+			NcLog.info("采购订单同步失败:"+msg);
+			resp.getWriter().write(formatRSJsonData("失败",e.getMessage() == null ? "" : e.getMessage(),vbillcode).toString());
+		}
+	}
+	
+	
+	/**
+	 * 非空判断
+	 * @param json
+	 * @throws Exception
+	 */
+	private void checkJson(JSONObject json) throws Exception {
+		
+		StringBuffer mags = new StringBuffer();
+		String groupCode = "groupCode";//集团编码
+		String pk_org = "pk_org";//组织编码
+		String vbillcode = "vbillcode";//采购订单号
+		String approver = "approver";//审批人
+		String taudittime = "taudittime";//审批时间
+ 
+		String[] HeadKey = {groupCode,pk_org,vbillcode,approver,taudittime};
+		
+		for (String as : HeadKey) {
+
+			if (json.getString(as).isEmpty()) {
+				mags.append("'" + as + "'");
+			}
+		}
+		
+		if (mags.length()!=0) {
+			throw new Exception("以下字段不可为空:"+mags);
+		}
+	}
+	
+	/**
+	 * 设置线程
+	 * @throws BusinessException
+	 */
+	private void setInstance(String taudittime,String user_pk,String pk_group) throws Exception {
+		DataSourceUtil.setDataSource();
+		// 线程设置用户主键
+		InvocationInfoProxy.getInstance().setUserId(user_pk);
+		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		Date date = format.parse(taudittime);
+		long timestamp = date.getTime();
+		// 线程设置业务日期
+		InvocationInfoProxy.getInstance().setBizDateTime(timestamp);
+		// 线程设置集团主键
+		InvocationInfoProxy.getInstance().setGroupId(pk_group);
+	}
+	
+	/**
+	 * 根据单据号查询单据主键
+	 * @param vbillcode
+	 * @return 单据主键
+	 * @throws Exception
+	 */
+	private String QuyOrderPK(String vbillcode,String pk_org) throws Exception {
+		String sql = "select pk_order from po_order where pk_org = (select pk_purchaseorg  from org_purchaseorg where code = '"+pk_org+"') and vbillcode = '"+vbillcode+"' and nvl(dr,0) = 0";
+		String pk_order =  (String) iuap.executeQuery(sql,new ColumnProcessor());
+		if(pk_order == null) {
+			throw new Exception("采购订单单据号:"+vbillcode+"不存在,请检查");
+		}
+		return pk_order;
+	}
+	
+	private String QuyUserPk(String approver) throws Exception {
+		String sql = "select cuserid  from sm_user where user_code='"+approver+"' and enablestate = 2 and nvl(dr,0) = 0";
+		String pk_user= (String) iuap.executeQuery(sql,new ColumnProcessor());
+		if(pk_user == null) {
+			throw new Exception("用户"+approver+"不存在,请检查!");
+		}
+		return pk_user;
+	}
+	
+	
+	
+
+}

+ 19 - 0
pu/pu/src/private/org/jeecg/common/util/DataUtill.java

@@ -0,0 +1,19 @@
+package org.jeecg.common.util;
+
+import nc.bs.framework.common.NCLocator;
+import nc.itf.uap.IUAPQueryBS;
+import nc.jdbc.framework.processor.ColumnProcessor;
+
+public class DataUtill {
+
+	private static IUAPQueryBS iUAPQueryBS = (IUAPQueryBS) NCLocator.getInstance().lookup(IUAPQueryBS.class.getName());
+	
+	public static String queryRegist() throws Exception {
+		String sql = "select defaultvalue from pub_sysinittemp where initcode ='OAZCRZ'";
+		String defaultvalue = (String) iUAPQueryBS.executeQuery(sql, new ColumnProcessor());
+		if(defaultvalue == null) {
+			throw new Exception("参数模板设置未配置初始信息!");
+		}
+		return defaultvalue;
+	}
+}

+ 1 - 1
pu/pu/src/public/nc/ui/bd/ref/model/StorDocReportRefModel.java

@@ -33,7 +33,7 @@ public class StorDocReportRefModel extends AbstractRefModel{
 	public void reset() {
         this.setFieldCode(new String[] {
         		DefdocVO.SHORTNAME5,DefdocVO.SHORTNAME,"shortname3",DefdocVO.SHORTNAME6,"shortname2",
-        		DefdocVO.CODE, DefdocVO.NAME, DefdocVO.MEMO, DefdocVO.MNECODE,DefdocVO.NAME2,DefdocVO.NAME3,DefdocVO.NAME4,
+        		"modifier", DefdocVO.NAME, DefdocVO.MEMO, DefdocVO.MNECODE,DefdocVO.NAME2,DefdocVO.NAME3,DefdocVO.NAME4,
         		DefdocVO.PID,
         		DefdocVO.SHORTNAME4
             });