Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
a4188a4d26
|
@ -0,0 +1,135 @@
|
|||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package nccloud.impl.imag.service.bp;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import nc.bs.framework.common.InvocationInfoProxy;
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
import nc.bs.pf.pub.PfDataCache;
|
||||
import nc.imag.common.util.ImagePubUtil;
|
||||
import nc.imag.common.util.ImageServiceCommonUtil;
|
||||
import nc.imag.imag.exception.BillInfoCheckBusinessException;
|
||||
import nc.imag.imag.exception.ImagConfigBusinessException;
|
||||
import nc.imag.imag.exception.ImagStateCheckBusinessException;
|
||||
import nc.imag.itf.service.IImageService;
|
||||
import nc.imag.pub.util.ImageServiceUtil;
|
||||
import nc.imag.util.ws.ImageFactoryConfigUtil;
|
||||
import nc.imag.util.ws.ImageFlowUtil;
|
||||
import nc.imag.util.ws.ImageLookupExternalInstance;
|
||||
import nc.vo.image.log.ImageLogBusiTypeEnum;
|
||||
import nc.vo.image.log.ImageLogRequest;
|
||||
import nc.vo.image.log.ImageLogUtil;
|
||||
import nc.vo.ml.NCLangRes4VoTransl;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nccloud.itf.imag.service.bp.ISSCImageCheckBP;
|
||||
import nccloud.itf.imag.service.bp.ISSCImageExtendBP;
|
||||
|
||||
public class SSCImageCheckBPImpl implements ISSCImageCheckBP {
|
||||
public SSCImageCheckBPImpl() {
|
||||
}
|
||||
|
||||
public void commitCheckWithImage(String billType, String billID, String pk_org) throws BusinessException {
|
||||
int scanType = ImageServiceCommonUtil.getImageScanType(pk_org, billType);
|
||||
if (scanType != 0 && scanType != -2) {
|
||||
if (billID != null && !billID.equals("")) {
|
||||
String factoryCode = ImageFactoryConfigUtil.getFactoryCode((String)null);
|
||||
if (factoryCode == null) {
|
||||
factoryCode = ImageServiceCommonUtil.getImageFactoryCode(pk_org);
|
||||
}
|
||||
|
||||
boolean scanInflow = ImageServiceCommonUtil.getIfScanInFlow(pk_org, billType);
|
||||
boolean ifinflow = ImageFlowUtil.billIsInFlow(billID);
|
||||
boolean ifimageact = ImageFlowUtil.isWFOnImageActivity(billID);
|
||||
int imagestate = ((IImageService)NCLocator.getInstance().lookup(IImageService.class)).getImageState(billID);
|
||||
ISSCImageExtendBP realExtendBP = new SSCImageExtendBPImpl();
|
||||
switch (scanType) {
|
||||
case -2:
|
||||
return;
|
||||
case -1:
|
||||
case 0:
|
||||
if (imagestate != 1 && imagestate != 5 && imagestate <= 6 && (!ifinflow || ImageFlowUtil.ifMakeBillActive(billID))) {
|
||||
Map<String, List<String>> imageNum = null;
|
||||
|
||||
try {
|
||||
imageNum = realExtendBP.downloadImages(Arrays.asList(billID));
|
||||
} catch (Exception var14) {
|
||||
if (var14.getMessage() != null && "调用影像服务异常提示:null".equals(var14.getMessage())) {
|
||||
throw new ImagStateCheckBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("1054004002_0", "01054004002-0035"));
|
||||
}
|
||||
|
||||
throw new ImagStateCheckBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("1054003_0", "01054003-0073" + var14.getMessage()));
|
||||
}
|
||||
|
||||
if (imageNum != null && imageNum.size() > 0) {
|
||||
throw new ImagStateCheckBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("1054003_0", "01054003-0071"));
|
||||
}
|
||||
|
||||
String userid = InvocationInfoProxy.getInstance().getUserId();
|
||||
ImageLogRequest request = new ImageLogRequest(billID, userid, (Object)null);
|
||||
ImageLogUtil.insertMainLog(ImageLogBusiTypeEnum.DELETE_UNSCANIMAGETASK_MAKEBILL, request, (Object)null);
|
||||
ImageServiceUtil.deleteImageOnSync(new String[]{billID}, userid, NCLangRes4VoTransl.getNCLangRes().getStrByID("1054003002_0", "01054003002-0026"));
|
||||
}
|
||||
|
||||
return;
|
||||
case 1:
|
||||
if (!ImageServiceCommonUtil.ifImageHasScaned(billID, pk_org)) {
|
||||
String billtypeName = PfDataCache.getBillTypeInfo(billType).getBilltypenameOfCurrLang();
|
||||
throw new ImagStateCheckBusinessException(billtypeName + NCLangRes4VoTransl.getNCLangRes().getStrByID("1054003_0", "01054003-0065"));
|
||||
} else {
|
||||
Map<String, List<String>> imageNumMap = realExtendBP.downloadImages(Arrays.asList(billID));
|
||||
if (imageNumMap != null && imageNumMap.size() != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw new ImagStateCheckBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("1054003_0", "01054003-0072"));
|
||||
}
|
||||
case 2:
|
||||
if (scanInflow) {
|
||||
if (!ifimageact) {
|
||||
return;
|
||||
} else if (!ImageServiceCommonUtil.ifImageHasScaned(billID, pk_org)) {
|
||||
throw new ImagStateCheckBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("1054003_0", "01054003-0066"));
|
||||
}
|
||||
} else if (ifinflow) {
|
||||
return;
|
||||
} else if (!ImageServiceCommonUtil.ifImageHasScaned(billID, pk_org)) {
|
||||
String billtypeName = PfDataCache.getBillTypeInfo(billType).getBilltypenameOfCurrLang();
|
||||
throw new ImagStateCheckBusinessException(billtypeName + NCLangRes4VoTransl.getNCLangRes().getStrByID("1054003_0", "01054003-0065"));
|
||||
}
|
||||
default:
|
||||
(new ImageLookupExternalInstance()).CusCommitCheckWithImage(billType, billID, pk_org, ifinflow, ifimageact, imagestate, scanType, factoryCode);
|
||||
}
|
||||
} else {
|
||||
throw new BillInfoCheckBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("1054003_0", "01054003-0018"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getImageShowPermission(String billType, String billId) throws BusinessException {
|
||||
return ImagePubUtil.getImageShowPermission2(billType, billId);
|
||||
}
|
||||
|
||||
public int getImageShowPermission(Object billvo, String billType, String billId, String pk_org) throws BusinessException {
|
||||
return ImagePubUtil.getImageShowPermission2(billvo, billType, billId, pk_org);
|
||||
}
|
||||
|
||||
public void imageShowCheck(String billType, String billID) throws BusinessException {
|
||||
ImagePubUtil.checkImageIsUsedAndBillIDEmpty(billID, InvocationInfoProxy.getInstance().getGroupId());
|
||||
}
|
||||
|
||||
public void checkCusImageScanck(Object billvo, String billtypeCode, String transtypeCode, String billID, String pk_org, String userid, Object other) throws BusinessException {
|
||||
if (billID != null && ImageServiceCommonUtil.ifImageHasScaned(billID, pk_org)) {
|
||||
throw new ImagStateCheckBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("1054003_0", "01054003-0056"));
|
||||
} else {
|
||||
int scanType = ImageServiceCommonUtil.getImageScanType(pk_org, transtypeCode);
|
||||
if (scanType == 0) {
|
||||
throw new ImagConfigBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("1054003_0", "01054003-0022"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -47,7 +47,7 @@ public class saveBeforeCheckRule implements IRule<PMOAggVO> {
|
|||
return;
|
||||
}
|
||||
|
||||
Map<String, Object> valMap = getVbdef6(itemvo.getVsrcbid());
|
||||
Map<String, Object> valMap = getVbdef6(itemvo.getVsrcbid(),itemvo.getCmoid());
|
||||
if (valMap == null || valMap.isEmpty()) {
|
||||
throw new BusinessException("无法关联到销售订单,无法保存!");
|
||||
}
|
||||
|
@ -91,11 +91,11 @@ public class saveBeforeCheckRule implements IRule<PMOAggVO> {
|
|||
}
|
||||
}
|
||||
|
||||
private Map<String, Object> getVbdef6(String vsrcbidStr) throws BusinessException {
|
||||
private Map<String, Object> getVbdef6(String vsrcbidStr,String cmoid) throws BusinessException {
|
||||
IUAPQueryBS queryBS = NCLocator.getInstance().lookup(IUAPQueryBS.class);
|
||||
String sql = " SELECT bt.pk_billtypecode,s.creationtime,b.vbdef12,d.nastnum FROM so_saleorder_b b\n"
|
||||
+ "INNER JOIN so_saleorder s ON s.csaleorderid = b.csaleorderid\n"
|
||||
+ "left join (select mm_mo.Vsrcbid,sum(nastnum) as nastnum \n" + "from mm_mo\n" + "where mm_mo.dr=0\n"
|
||||
+ "left join (select mm_mo.Vsrcbid,sum(nastnum) as nastnum \n" + "from mm_mo\n" + "where mm_mo.dr=0\n"+" and cmoid !='"+cmoid+ "' "
|
||||
+ "group by mm_mo.Vsrcbid) d on b.csaleorderbid=d.Vsrcbid\n"
|
||||
+ "INNER JOIN bd_billtype bt on bt.pk_billtypeid=s.ctrantypeid\n" + "where b.csaleorderbid='"
|
||||
+ vsrcbidStr + "' ";
|
||||
|
|
|
@ -5,11 +5,13 @@
|
|||
|
||||
package nc.bs.mmpub.rule;
|
||||
|
||||
import nc.bs.mmpsc.pscsettle.bp.SettleToAPBP;
|
||||
import nc.impl.pubapp.pattern.data.vo.tool.VOConcurrentTool;
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
import nc.impl.pubapp.pattern.rule.IRule;
|
||||
import nc.itf.mmpsc.pscsettle.ISettleBusiness;
|
||||
import nc.util.mmf.framework.base.MMArrayUtil;
|
||||
import nc.vo.mmpsc.pscsettle.entity.AggSettleVO;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nccloud.api.so.m30.IAPISaleOrderMaitain;
|
||||
|
||||
public class MMVOToAPRule implements IRule<AggSettleVO> {
|
||||
|
||||
|
@ -20,13 +22,13 @@ public class MMVOToAPRule implements IRule<AggSettleVO> {
|
|||
|
||||
public void process(AggSettleVO[] vos) {
|
||||
if (!MMArrayUtil.isEmpty(vos)) {
|
||||
(new VOConcurrentTool()).checkTSWithDB(vos[0].getItemVO());
|
||||
SettleToAPBP bp = new SettleToAPBP();
|
||||
AggSettleVO[] retBills = bp.toAP(vos);
|
||||
if (retBills.length>0){
|
||||
System.out.println(1);
|
||||
}
|
||||
ISettleBusiness settleBusiness= (ISettleBusiness) NCLocator.getInstance().lookup(ISettleBusiness.class);
|
||||
|
||||
try {
|
||||
settleBusiness.toAP(vos);
|
||||
} catch (BusinessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ public class AfterApprovingSynchronizeRuleRZ implements IRule<OrderVO> {
|
|||
// 推送到睿智系统
|
||||
pushToRZMOM(newOrderVOS.toArray(new OrderVO[0]));
|
||||
} catch (Exception e) {
|
||||
log.error("同步采购订单到睿智系统失败: " + e.getMessage());
|
||||
log.error("同步采购订单到锐制系统失败: " + e.getMessage());
|
||||
ExceptionUtils.wrappException(e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ public class OrderApproveAction {
|
|||
processer.addAfterRule(new OrderRewritePMStartDateRule(true));
|
||||
processer.addAfterRule(new OrderApprovePMSupplyRule());
|
||||
|
||||
// 采购订单审批后 同步到锐制MES系统
|
||||
// 采购订单审批后同步到锐制MES系统
|
||||
processer.addAfterRule(new AfterApprovingSynchronizeRuleRZ());
|
||||
}
|
||||
|
||||
|
|
|
@ -10,10 +10,6 @@ import nc.impl.pubapp.pattern.rule.IRule;
|
|||
import nc.jdbc.framework.processor.ColumnProcessor;
|
||||
import nc.pubitf.para.SysInitQuery;
|
||||
import nc.vo.bd.defdoc.DefdocVO;
|
||||
import nc.vo.bd.material.MaterialVO;
|
||||
import nc.vo.bd.psn.PsndocVO;
|
||||
import nc.vo.bd.stordoc.StordocVO;
|
||||
import nc.vo.bd.supplier.SupplierVO;
|
||||
import nc.vo.cmp.util.StringUtils;
|
||||
import nc.vo.org.OrgVO;
|
||||
import nc.vo.pub.BusinessException;
|
||||
|
|
|
@ -45,7 +45,7 @@ public class SCOrderApproveAction {
|
|||
prcr.addAfterRule(new ApproveSupplyRule());
|
||||
prcr.addAfterRule(new SCOrderApprovePMSupplyRule());
|
||||
|
||||
//2025年5月18日15点12分-- 互感器委外订单审批推送RZ系统
|
||||
//2025年5月18日15点12分-- 互感器委外订单审批推送锐制系统
|
||||
prcr.addAfterRule(new AfterApproceRuleSyncRZWMSProcess());
|
||||
}
|
||||
|
||||
|
|
|
@ -117,13 +117,13 @@ public class ApplicationSplitMergeMakeInvoiceAction implements ICommonAction {
|
|||
|
||||
for(IVApplicationAggVO appVo : appVos) {
|
||||
IVApplicationBodyVO[] bodyVos = appVo.getBodyVOs();
|
||||
if (appVo.getParentVO().getKpfs() != null && appVo.getParentVO().getKpfs() != IVAplocationKPFS.ZLKP.toIntValue() && bodyVos[0].getPk_ivappdetail().length() > 20) {
|
||||
Map<String, String> failMap = new HashMap();
|
||||
failMap.put("billNo", appVo.getParentVO().getBillno());
|
||||
failMap.put("msg", NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0", "01058sal-0106"));
|
||||
failMapList.add(failMap);
|
||||
++failNum;
|
||||
} else {
|
||||
// if (appVo.getParentVO().getKpfs() != null && appVo.getParentVO().getKpfs() != IVAplocationKPFS.ZLKP.toIntValue() && bodyVos[0].getPk_ivappdetail().length() > 20) {
|
||||
// Map<String, String> failMap = new HashMap();
|
||||
// failMap.put("billNo", appVo.getParentVO().getBillno());
|
||||
// failMap.put("msg", NCLangRes4VoTransl.getNCLangRes().getStrByID("1058sal_0", "01058sal-0106"));
|
||||
// failMapList.add(failMap);
|
||||
// ++failNum;
|
||||
// } else {
|
||||
if (bodyVos[0].getPk_ivappdetail().length() > 20) {
|
||||
for(IVApplicationBodyVO bodyVo : bodyVos) {
|
||||
String detailpk = bodyVo.getPk_ivappdetail();
|
||||
|
@ -140,7 +140,7 @@ public class ApplicationSplitMergeMakeInvoiceAction implements ICommonAction {
|
|||
|
||||
newAppVos.add(appVo);
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
if (appIds.size() == 0) {
|
||||
return (IVApplicationAggVO[])newAppVos.toArray(new IVApplicationAggVO[0]);
|
||||
|
|
|
@ -282,7 +282,7 @@ public abstract class CommonProcessor {
|
|||
//ÐéÄâÖ÷¼ü
|
||||
headVo.setPk_ivapplication(new SequenceGenerator().generate());
|
||||
//ĬÈÏÖ±Áª
|
||||
headVo.setKpfs(IVAplocationKPFS.ZLKP.toIntValue());
|
||||
// headVo.setKpfs(IVAplocationKPFS.ZLKP.toIntValue());
|
||||
}
|
||||
|
||||
return appVos;
|
||||
|
|
|
@ -1,40 +1,100 @@
|
|||
## 物料编码
|
||||
~~~sql
|
||||
CREATE OR REPLACE FORCE EDITIONABLE VIEW "TKNCC"."V_UAPBD_QUERYSYNC_MATERIAL" ("PK_MATERIAL", "CODE", "NAME", "MATERIALSPEC", "PK_MEASDOC", "CHKFREEFLAG", "ENABLESTATE", "PK_STORDOC", "MATERSTATE", "PK_ORG", "ORG_CODE", "TS") AS
|
||||
SELECT DISTINCT
|
||||
m.PK_MATERIAL,
|
||||
m.CODE,
|
||||
m.NAME,
|
||||
m.MATERIALSPEC,
|
||||
m.PK_MEASDOC,
|
||||
mk.chkfreeflag,
|
||||
m.ENABLESTATE,
|
||||
mk.pk_stordoc,
|
||||
md.materstate,
|
||||
m.PK_ORG,
|
||||
oo.code AS org_code,
|
||||
GREATEST(m.TS, mk.TS, md.TS, oo.TS) AS TS
|
||||
-- TKNCC.V_UAPBD_QUERYSYNC_MATERIAL source
|
||||
create view V_UAPBD_QUERYSYNC_MATERIAL as
|
||||
SELECT
|
||||
t."PK_MATERIAL",t."CODE",t."NAME",t."MATERIALSPEC",t."ENABLESTATE",t."DW_CODE",t."DW_NAME",t."PK_MEASDOC",t."CHKFREEFLAG",t."STOCKORG_CODE",t."PK_STORDOC",t."STOCKCODE",t."STOCKNAME",t."PK_ORG",t."REAL_ORG_CODE",t."MTS",t."MKTS",
|
||||
'C022' AS org_code,
|
||||
t1.materstate,
|
||||
t.PK_MARBASCLASS,
|
||||
CASE
|
||||
WHEN t.mTS IS NULL
|
||||
AND t.mkTS IS NULL
|
||||
AND t1.mdTS IS NULL THEN to_char(TO_DATE(sysdate, 'YYYY-MM-DD HH24:MI:SS'))
|
||||
ELSE GREATEST(
|
||||
COALESCE(t.mTS, '2000-01-01 00:00:00'),
|
||||
COALESCE(t.mkTS, '2000-01-01 00:00:00'),
|
||||
COALESCE(t1.mdTS, '2000-01-01 00:00:00'))
|
||||
END AS ts
|
||||
FROM
|
||||
bd_material m
|
||||
LEFT JOIN bd_materialstock mk ON m.PK_MATERIAL = mk.pk_material
|
||||
LEFT JOIN bd_materialprod md ON m.PK_MATERIAL = md.pk_material
|
||||
LEFT JOIN org_orgs oo ON m.pk_org = oo.pk_org
|
||||
WHERE
|
||||
m.dr = 0;
|
||||
(
|
||||
SELECT
|
||||
m.PK_MATERIAL,
|
||||
m.CODE,
|
||||
m.NAME,
|
||||
m.MATERIALSPEC,
|
||||
m.PK_MARBASCLASS,
|
||||
m.ENABLESTATE,
|
||||
mc.code AS dw_code,
|
||||
mc.name AS dw_name,
|
||||
mc.pk_measdoc AS pk_measdoc,
|
||||
mk.chkfreeflag,
|
||||
os.code AS stockorg_code,
|
||||
bdstoc.pk_stordoc,
|
||||
bdstoc.code AS stockcode,
|
||||
bdstoc.name AS stockname,
|
||||
oo.PK_ORG,
|
||||
oo.code AS real_org_code,
|
||||
m.ts AS mts,
|
||||
mk.ts AS mkts
|
||||
FROM
|
||||
bd_material m
|
||||
INNER JOIN bd_materialstock mk ON
|
||||
m.PK_MATERIAL = mk.pk_material
|
||||
INNER JOIN org_stockorg os ON
|
||||
mk.pk_org = os.pk_stockorg
|
||||
AND os.code = 'C022'
|
||||
LEFT JOIN bd_stordoc bdstoc ON
|
||||
mk.pk_stordoc = bdstoc.pk_stordoc
|
||||
LEFT JOIN bd_measdoc mc ON
|
||||
m.pk_measdoc = mc.pk_measdoc
|
||||
LEFT JOIN org_orgs oo ON
|
||||
m.pk_org = oo.pk_org
|
||||
WHERE
|
||||
m.dr = 0
|
||||
-- AND (oo.code = '30401'
|
||||
-- OR m.CODE LIKE '1%'
|
||||
-- OR m.CODE LIKE '2%'
|
||||
-- OR m.CODE LIKE '4%')
|
||||
ORDER BY
|
||||
m.pk_material DESC
|
||||
)t
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
md.pk_material,
|
||||
md.materstate,
|
||||
orgf.code AS orgf_code,
|
||||
md.ts AS mdts
|
||||
FROM
|
||||
bd_materialprod md
|
||||
INNER JOIN org_factory orgf ON
|
||||
md.pk_org = orgf.pk_factory
|
||||
AND orgf.code = 'C022'
|
||||
)t1 ON
|
||||
t.PK_MATERIAL = t1.PK_MATERIAL
|
||||
|
||||
|
||||
~~~
|
||||
|
||||
## 物料分类
|
||||
~~~sql
|
||||
CREATE VIEW V_UAPBD_QUERYSYNC_MATERIALCLASS AS
|
||||
create view V_UAPBD_QUERYSYNC_MATCLASS as
|
||||
SELECT
|
||||
m.code,
|
||||
m.name,
|
||||
m.pk_marbasclass ,
|
||||
p.name AS parent_name,
|
||||
p.code AS parent_code,
|
||||
oo.CODE AS org_code,
|
||||
p.pk_marbasclass pk_parent,
|
||||
GREATEST(p.TS, m.TS) AS TS
|
||||
oo.CODE AS real_org_code,
|
||||
m.enablestate,
|
||||
CASE
|
||||
WHEN p.TS IS NULL
|
||||
AND m.TS IS NULL THEN to_char(TO_DATE(sysdate, 'YYYY-MM-DD HH24:MI:SS'))
|
||||
ELSE GREATEST(
|
||||
COALESCE(p.TS, '2000-01-01 00:00:00'),
|
||||
COALESCE(m.TS, '2000-01-01 00:00:00'))
|
||||
END AS ts
|
||||
FROM
|
||||
bd_marbasclass m
|
||||
LEFT JOIN bd_marbasclass p ON m.pk_parent = p.pk_marbasclass
|
||||
|
@ -45,7 +105,7 @@ WHERE
|
|||
|
||||
## 人员
|
||||
~~~sql
|
||||
CREATE VIEW V_UAPBD_QUERYSYNC_PSNDOC AS
|
||||
create view V_UAPBD_QUERYSYNC_PSNDOC as
|
||||
SELECT
|
||||
p.pk_psndoc,
|
||||
p.CODE,
|
||||
|
@ -54,87 +114,114 @@ SELECT
|
|||
dept.name AS dept_name,
|
||||
p.ENABLESTATE,
|
||||
org.code as org_code,
|
||||
p.TS AS TS
|
||||
CASE
|
||||
WHEN p.TS IS NULL
|
||||
AND j.TS IS NULL THEN to_char(TO_DATE(sysdate, 'YYYY-MM-DD HH24:MI:SS'))
|
||||
ELSE GREATEST(
|
||||
COALESCE(p.TS, '2000-01-01 00:00:00'),
|
||||
COALESCE(j.TS, '2000-01-01 00:00:00'))
|
||||
END AS ts
|
||||
FROM
|
||||
bd_psndoc p
|
||||
LEFT JOIN bd_psnjob j ON p.pk_psndoc = j.pk_psndoc
|
||||
LEFT JOIN bd_psnjob j ON p.pk_psndoc = j.pk_psndoc AND (j.enddutydate IS NULL OR TO_DATE(j.enddutydate, 'YYYY-MM-DD HH24:MI:SS') > SYSDATE)
|
||||
AND j.ismainjob = 'Y'
|
||||
AND j.dr = 0
|
||||
LEFT JOIN org_orgs org ON p.pk_org = org.pk_org
|
||||
LEFT JOIN org_dept dept ON j.pk_dept = dept.pk_dept
|
||||
WHERE
|
||||
p.dr = 0;
|
||||
p.dr = 0
|
||||
~~~
|
||||
|
||||
## 客户
|
||||
~~~sql
|
||||
CREATE VIEW V_UAPBD_QUERYSYNC_CUSTOMER AS
|
||||
SELECT
|
||||
c.pk_customer,
|
||||
c.name,
|
||||
c.code,
|
||||
c.enablestate,
|
||||
c.shortname,
|
||||
oo.code AS org_code,
|
||||
oo.name AS org_name,
|
||||
og.code AS group_code,
|
||||
og.name AS group_name,
|
||||
GREATEST(c.ts, oo.TS, og.TS) AS TS
|
||||
FROM
|
||||
bd_customer c
|
||||
LEFT JOIN org_orgs oo ON c.pk_org = oo.pk_org
|
||||
LEFT JOIN org_group og ON c.pk_group = og.pk_group
|
||||
WHERE
|
||||
c.dr = 0;
|
||||
create view V_UAPBD_QUERYSYNC_CUSTOMER as
|
||||
SELECT t.PK_CUSTOMER,
|
||||
t.NAME,
|
||||
t.CODE,
|
||||
t.ENABLESTATE,
|
||||
t.SHORTNAME,
|
||||
t.REAL_ORG_CODE,
|
||||
t.ORG_NAME,
|
||||
t.GROUP_CODE,
|
||||
t.GROUP_NAME,
|
||||
NVL(t.TS, SYSDATE) AS ts,
|
||||
t.RN,
|
||||
CEIL(t.rn / 10000) AS org_code
|
||||
FROM (SELECT c.pk_customer,
|
||||
c.name,
|
||||
c.code,
|
||||
c.enablestate,
|
||||
c.shortname,
|
||||
oo.code AS real_org_code,
|
||||
oo.name AS org_name,
|
||||
og.code AS group_code,
|
||||
og.name AS group_name,
|
||||
c.ts AS TS,
|
||||
ROW_NUMBER() OVER (ORDER BY c.pk_customer) AS rn
|
||||
FROM bd_customer c
|
||||
LEFT JOIN org_orgs oo ON c.pk_org = oo.pk_org
|
||||
LEFT JOIN org_group og ON c.pk_group = og.pk_group
|
||||
WHERE c.dr = 0) t
|
||||
~~~
|
||||
|
||||
## 供应商
|
||||
~~~sql
|
||||
CREATE VIEW V_UAPBD_QUERYSYNC_SUPPLIER AS
|
||||
create view V_UAPBD_QUERYSYNC_SUPPLIER as
|
||||
SELECT
|
||||
s.CODE,
|
||||
s.PK_SUPPLIER,
|
||||
s.NAME,
|
||||
s.ENABLESTATE,
|
||||
s.shortname,
|
||||
oo.code AS org_code,
|
||||
oo.name AS org_name,
|
||||
og.code AS group_code,
|
||||
og.name AS group_name,
|
||||
s.ts AS TS
|
||||
FROM
|
||||
bd_supplier s
|
||||
LEFT JOIN org_orgs oo ON s.pk_org = oo.pk_org
|
||||
LEFT JOIN org_group og ON s.pk_group = og.pk_group
|
||||
WHERE
|
||||
s.dr = 0;
|
||||
t."CODE",t."PK_SUPPLIER",t."NAME",t."ENABLESTATE",t."SHORTNAME",t."REAL_ORG_CODE",t."ORG_NAME",t."GROUP_CODE",t."GROUP_NAME",t."TS",t."RN",
|
||||
CEIL(t.rn / 10000) AS org_code
|
||||
FROM (
|
||||
SELECT
|
||||
s.CODE,
|
||||
s.PK_SUPPLIER,
|
||||
s.NAME,
|
||||
s.ENABLESTATE,
|
||||
s.shortname,
|
||||
oo.code AS real_org_code,
|
||||
oo.name AS org_name,
|
||||
og.code AS group_code,
|
||||
og.name AS group_name,
|
||||
s.ts AS TS,
|
||||
ROW_NUMBER() OVER (ORDER BY s.PK_SUPPLIER) AS rn
|
||||
FROM
|
||||
bd_supplier s
|
||||
LEFT JOIN org_orgs oo ON s.pk_org = oo.pk_org
|
||||
LEFT JOIN org_group og ON s.pk_group = og.pk_group
|
||||
WHERE
|
||||
s.dr = 0
|
||||
) t
|
||||
~~~
|
||||
|
||||
## 部门
|
||||
~~~sql
|
||||
CREATE VIEW V_UAPBD_QUERYSYNC_DEPT AS
|
||||
create view V_UAPBD_QUERYSYNC_DEPT as
|
||||
SELECT
|
||||
d.CODE,
|
||||
d.NAME,
|
||||
d.ENABLESTATE,
|
||||
|
||||
d.PK_DEPT,
|
||||
oo.code AS org_code,
|
||||
oo.name AS org_name,
|
||||
og.code AS group_code,
|
||||
og.name AS group_name,
|
||||
d.ts AS TS
|
||||
CASE
|
||||
WHEN d.TS IS NULL
|
||||
AND d.MODIFIEDTIME IS NULL THEN to_char(TO_DATE(sysdate, 'YYYY-MM-DD HH24:MI:SS'))
|
||||
ELSE GREATEST(
|
||||
COALESCE(d.TS, '2000-01-01 00:00:00'),
|
||||
COALESCE(d.MODIFIEDTIME, '2000-01-01 00:00:00'))
|
||||
END AS ts
|
||||
FROM
|
||||
org_dept d
|
||||
LEFT JOIN org_orgs oo ON d.pk_org = oo.pk_org
|
||||
LEFT JOIN org_group og ON d.pk_group = og.pk_group
|
||||
WHERE
|
||||
d.dr = 0;
|
||||
d.dr = 0
|
||||
~~~
|
||||
|
||||
## 仓库
|
||||
~~~sql
|
||||
CREATE VIEW V_UAPBD_QUERYSYNC_STORDOC AS
|
||||
create view V_UAPBD_QUERYSYNC_STORDOC as
|
||||
SELECT
|
||||
sd.CODE,
|
||||
sd.name,
|
||||
|
@ -145,11 +232,10 @@ SELECT
|
|||
og.code AS group_code,
|
||||
og.name AS group_name,
|
||||
sd.ts AS TS
|
||||
|
||||
FROM
|
||||
bd_stordoc sd
|
||||
LEFT JOIN org_stockorg so ON sd.pk_org = so.pk_stockorg
|
||||
LEFT JOIN org_group og ON sd.pk_group = og.pk_group
|
||||
WHERE
|
||||
sd.dr = 0;
|
||||
sd.dr = 0
|
||||
~~~
|
Loading…
Reference in New Issue