Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
1c26c4e2ab
|
@ -32,129 +32,123 @@ import nc.vo.mmpac.pickm.entity.PickmItemVO;
|
|||
|
||||
public class PloProdDeptRule implements IRule<AggregatedPoVO> {
|
||||
|
||||
@Override
|
||||
public void process(AggregatedPoVO[] vos) {
|
||||
if (null == vos) {
|
||||
return;
|
||||
}
|
||||
Map<String, List<String>> map = new HashMap<String, List<String>>();
|
||||
ArrayList<String> vsrcbidList = new ArrayList<>();
|
||||
for (AggregatedPoVO agg : vos) {
|
||||
PoVO plo = agg.getParentVO();
|
||||
String vid = plo.getCmaterialvid();
|
||||
String stockorgid = plo.getCstockorgid();
|
||||
String stockorgvid = plo.getCstockorgvid();
|
||||
String prodDeptid = plo.getCproddeptid();
|
||||
String prodDeptvid = plo.getCproddeptvid();
|
||||
Integer posource = plo.getFposource();
|
||||
if (PoSourceEnum.COMPUT == posource && MMValueCheck.isEmpty(prodDeptid)
|
||||
&& MMValueCheck.isEmpty(prodDeptvid) && MMValueCheck.isNotEmpty(stockorgid)
|
||||
&& MMValueCheck.isNotEmpty(stockorgvid)) {
|
||||
List<String> vids = map.get(stockorgid);
|
||||
if (null == vids) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
list.add(vid);
|
||||
map.put(stockorgid, list);
|
||||
}
|
||||
else {
|
||||
vids.add(vid);
|
||||
}
|
||||
}
|
||||
String vsrcbid = plo.getVsrcbid();//来源单据表体主键
|
||||
int fdemandbill = plo.getFdemandbill();//需求来源
|
||||
if (PoSourceEnum.COMPUT == posource && fdemandbill == 1) {
|
||||
vsrcbidList.add(vsrcbid);
|
||||
}
|
||||
}
|
||||
if (vsrcbidList != null && vsrcbidList.size() > 0) {
|
||||
String[] vsrcbids = vsrcbidList.toArray(new String[vsrcbidList.size()]);
|
||||
Map<String, AggPickmVO> pickmVOMap;
|
||||
try {
|
||||
pickmVOMap = NCLocator.getInstance().lookup(IPickmPubQueryService.class)
|
||||
.queryPickm4Issue(vsrcbids);
|
||||
} catch (BusinessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
pickmVOMap.getClass();
|
||||
for (AggregatedPoVO agg : vos) {
|
||||
PoVO plo = agg.getParentVO();
|
||||
String vsrcbid = plo.getVsrcbid();//来源单据表体主键
|
||||
AggPickmVO aggPickmVOData = pickmVOMap.get(vsrcbid);
|
||||
if (aggPickmVOData != null) {
|
||||
PickmItemVO[] children = (PickmItemVO[]) aggPickmVOData.getChildren(PickmItemVO.class);
|
||||
String vbdef5 = "";//合同编号
|
||||
String vbdef6 = "";//合同销售订单号
|
||||
String vbdef7 = "";//标前项目号
|
||||
for (PickmItemVO pickmItemVO : children) {
|
||||
if (pickmItemVO.getCpickm_bid().equals(vsrcbid)) {
|
||||
vbdef5 = pickmItemVO.getVbdef5();//合同编号
|
||||
vbdef6 = pickmItemVO.getVbdef6();//合同销售订单号
|
||||
vbdef7 = pickmItemVO.getVbdef7();//标前项目号
|
||||
}
|
||||
}
|
||||
plo.setVdef2(vbdef5);//合同编号
|
||||
plo.setVdef3(vbdef6);//合同销售订单号
|
||||
plo.setVdef4(vbdef7);//标前项目号
|
||||
}
|
||||
}
|
||||
}
|
||||
Set<String> stockorgids = map.keySet();
|
||||
Iterator<String> i = stockorgids.iterator();
|
||||
while (i.hasNext()) {
|
||||
String key = i.next();
|
||||
List<String> vids = map.get(key);
|
||||
Map<String, MaterialProdVO> results =
|
||||
MaterialPubService.queryMaterialProduceInfoByPks(vids.toArray(new String[0]), key, new String[] {
|
||||
MaterialProdVO.PK_PRODEPTDOC
|
||||
});
|
||||
for (AggregatedPoVO agg : vos) {
|
||||
PoVO plo = agg.getParentVO();
|
||||
String vid = plo.getCmaterialvid();
|
||||
String stockorgid = plo.getCstockorgid();
|
||||
String stockorgvid = plo.getCstockorgvid();
|
||||
Integer posource = plo.getFposource();
|
||||
if (PoSourceEnum.COMPUT == posource && MMValueCheck.isNotEmpty(stockorgid)
|
||||
&& MMValueCheck.isNotEmpty(stockorgvid)) {
|
||||
if (null != results) {
|
||||
MaterialProdVO prodvo = results.get(vid);
|
||||
if (null != prodvo) {
|
||||
plo.setCproddeptid(prodvo.getPk_prodeptdoc());// 生产部门ID
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 根据生产部门ID查询设置VID
|
||||
List<String> proddeptids = new ArrayList<String>();
|
||||
for (AggregatedPoVO agg : vos) {
|
||||
PoVO plo = agg.getParentVO();
|
||||
String prodDeptid = plo.getCproddeptid();
|
||||
Integer posource = plo.getFposource();
|
||||
if (PoSourceEnum.COMPUT == posource && MMValueCheck.isNotEmpty(prodDeptid)) {
|
||||
proddeptids.add(prodDeptid);
|
||||
}
|
||||
}
|
||||
IDeptPubService deptPubService = this.getDeptPubService();
|
||||
try {
|
||||
HashMap<String, String> results = deptPubService.getLastVIDSByDeptIDS(proddeptids.toArray(new String[0]));
|
||||
if (null != results) {
|
||||
for (AggregatedPoVO agg : vos) {
|
||||
PoVO plo = agg.getParentVO();
|
||||
String prodDeptid = plo.getCproddeptid();
|
||||
Integer posource = plo.getFposource();
|
||||
if (PoSourceEnum.COMPUT == posource && MMValueCheck.isNotEmpty(prodDeptid)) {
|
||||
plo.setCproddeptvid(results.get(prodDeptid));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (BusinessException e) {
|
||||
ExceptionUtils.wrappException(e);
|
||||
}
|
||||
@Override
|
||||
public void process(AggregatedPoVO[] vos) {
|
||||
if (null == vos) {
|
||||
return;
|
||||
}
|
||||
Map<String, List<String>> map = new HashMap<String, List<String>>();
|
||||
ArrayList<String> vsrcbidList = new ArrayList<>();
|
||||
for (AggregatedPoVO agg : vos) {
|
||||
PoVO plo = agg.getParentVO();
|
||||
String vid = plo.getCmaterialvid();
|
||||
String stockorgid = plo.getCstockorgid();
|
||||
String stockorgvid = plo.getCstockorgvid();
|
||||
String prodDeptid = plo.getCproddeptid();
|
||||
String prodDeptvid = plo.getCproddeptvid();
|
||||
Integer posource = plo.getFposource();
|
||||
if (PoSourceEnum.COMPUT == posource && MMValueCheck.isEmpty(prodDeptid) && MMValueCheck.isEmpty(prodDeptvid)
|
||||
&& MMValueCheck.isNotEmpty(stockorgid) && MMValueCheck.isNotEmpty(stockorgvid)) {
|
||||
List<String> vids = map.get(stockorgid);
|
||||
if (null == vids) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
list.add(vid);
|
||||
map.put(stockorgid, list);
|
||||
} else {
|
||||
vids.add(vid);
|
||||
}
|
||||
}
|
||||
String vsrcbid = plo.getVsrcbid();// 来源单据表体主键
|
||||
// 需求来源为备料计划的才回写
|
||||
if (PoSourceEnum.COMPUT == posource && plo.getFdemandbill() != null && plo.getFdemandbill() == 1) {
|
||||
vsrcbidList.add(vsrcbid);
|
||||
}
|
||||
}
|
||||
if (vsrcbidList != null && vsrcbidList.size() > 0) {
|
||||
String[] vsrcbids = vsrcbidList.toArray(new String[vsrcbidList.size()]);
|
||||
Map<String, AggPickmVO> pickmVOMap;
|
||||
try {
|
||||
pickmVOMap = NCLocator.getInstance().lookup(IPickmPubQueryService.class).queryPickm4Issue(vsrcbids);
|
||||
} catch (BusinessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
pickmVOMap.getClass();
|
||||
for (AggregatedPoVO agg : vos) {
|
||||
PoVO plo = agg.getParentVO();
|
||||
String vsrcbid = plo.getVsrcbid();// 来源单据表体主键
|
||||
AggPickmVO aggPickmVOData = pickmVOMap.get(vsrcbid);
|
||||
if (aggPickmVOData != null) {
|
||||
PickmItemVO[] children = (PickmItemVO[]) aggPickmVOData.getChildren(PickmItemVO.class);
|
||||
String vbdef5 = "";// 合同编号
|
||||
String vbdef6 = "";// 合同销售订单号
|
||||
String vbdef7 = "";// 标前项目号
|
||||
for (PickmItemVO pickmItemVO : children) {
|
||||
if (pickmItemVO.getCpickm_bid().equals(vsrcbid)) {
|
||||
vbdef5 = pickmItemVO.getVbdef5();// 合同编号
|
||||
vbdef6 = pickmItemVO.getVbdef6();// 合同销售订单号
|
||||
vbdef7 = pickmItemVO.getVbdef7();// 标前项目号
|
||||
}
|
||||
}
|
||||
plo.setVdef2(vbdef5);// 合同编号
|
||||
plo.setVdef3(vbdef6);// 合同销售订单号
|
||||
plo.setVdef4(vbdef7);// 标前项目号
|
||||
}
|
||||
}
|
||||
}
|
||||
Set<String> stockorgids = map.keySet();
|
||||
Iterator<String> i = stockorgids.iterator();
|
||||
while (i.hasNext()) {
|
||||
String key = i.next();
|
||||
List<String> vids = map.get(key);
|
||||
Map<String, MaterialProdVO> results = MaterialPubService.queryMaterialProduceInfoByPks(
|
||||
vids.toArray(new String[0]), key, new String[] { MaterialProdVO.PK_PRODEPTDOC });
|
||||
for (AggregatedPoVO agg : vos) {
|
||||
PoVO plo = agg.getParentVO();
|
||||
String vid = plo.getCmaterialvid();
|
||||
String stockorgid = plo.getCstockorgid();
|
||||
String stockorgvid = plo.getCstockorgvid();
|
||||
Integer posource = plo.getFposource();
|
||||
if (PoSourceEnum.COMPUT == posource && MMValueCheck.isNotEmpty(stockorgid)
|
||||
&& MMValueCheck.isNotEmpty(stockorgvid)) {
|
||||
if (null != results) {
|
||||
MaterialProdVO prodvo = results.get(vid);
|
||||
if (null != prodvo) {
|
||||
plo.setCproddeptid(prodvo.getPk_prodeptdoc());// 生产部门ID
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 根据生产部门ID查询设置VID
|
||||
List<String> proddeptids = new ArrayList<String>();
|
||||
for (AggregatedPoVO agg : vos) {
|
||||
PoVO plo = agg.getParentVO();
|
||||
String prodDeptid = plo.getCproddeptid();
|
||||
Integer posource = plo.getFposource();
|
||||
if (PoSourceEnum.COMPUT == posource && MMValueCheck.isNotEmpty(prodDeptid)) {
|
||||
proddeptids.add(prodDeptid);
|
||||
}
|
||||
}
|
||||
IDeptPubService deptPubService = this.getDeptPubService();
|
||||
try {
|
||||
HashMap<String, String> results = deptPubService.getLastVIDSByDeptIDS(proddeptids.toArray(new String[0]));
|
||||
if (null != results) {
|
||||
for (AggregatedPoVO agg : vos) {
|
||||
PoVO plo = agg.getParentVO();
|
||||
String prodDeptid = plo.getCproddeptid();
|
||||
Integer posource = plo.getFposource();
|
||||
if (PoSourceEnum.COMPUT == posource && MMValueCheck.isNotEmpty(prodDeptid)) {
|
||||
plo.setCproddeptvid(results.get(prodDeptid));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (BusinessException e) {
|
||||
ExceptionUtils.wrappException(e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private IDeptPubService getDeptPubService() {
|
||||
return NCLocator.getInstance().lookup(IDeptPubService.class);
|
||||
}
|
||||
private IDeptPubService getDeptPubService() {
|
||||
return NCLocator.getInstance().lookup(IDeptPubService.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,89 @@
|
|||
package nc.bs.sscivm.ivsale.util;
|
||||
|
||||
import nc.vo.sscivm.ivmpub.InvoiceTypeEnum;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 发票类型和特殊票种映射工具类
|
||||
* @author wangyl7
|
||||
*
|
||||
*/
|
||||
public class InvoiceTypeToTspzUtil {
|
||||
private final static Map<Integer,String> invoiceMap = new HashMap<Integer,String>();
|
||||
private final static Map<Integer,String> tspzMap = new HashMap<Integer,String>();
|
||||
static {
|
||||
invoiceMap.put(InvoiceTypeEnum.INVOICETYPE_ZYFP_JDC.toIntValue(), "4");
|
||||
invoiceMap.put(InvoiceTypeEnum.INVOICETYPE_DZPTFP_KCL.toIntValue(), "1");
|
||||
invoiceMap.put(InvoiceTypeEnum.INVOICETYPE_DZZYFP_KCL.toIntValue(), "2");
|
||||
invoiceMap.put(InvoiceTypeEnum.INVOICETYPE_PTFP_KCL.toIntValue(), "3");
|
||||
invoiceMap.put(InvoiceTypeEnum.INVOICETYPE_ZYFP_KCL.toIntValue(), "4");
|
||||
invoiceMap.put(InvoiceTypeEnum.INVOICETYPE_ESCTYFP.toIntValue(), "15");//二手车统一销售与机打重复
|
||||
invoiceMap.put(InvoiceTypeEnum.INVOICETYPE_DZPTFP_NCP.toIntValue(), "1");
|
||||
invoiceMap.put(InvoiceTypeEnum.INVOICETYPE_PTFP_NCP.toIntValue(), "3");
|
||||
|
||||
tspzMap.put(InvoiceTypeEnum.INVOICETYPE_ZYFP_JDC.toIntValue(), "12");
|
||||
tspzMap.put(InvoiceTypeEnum.INVOICETYPE_DZPTFP_KCL.toIntValue(), "16");
|
||||
tspzMap.put(InvoiceTypeEnum.INVOICETYPE_DZZYFP_KCL.toIntValue(), "16");
|
||||
tspzMap.put(InvoiceTypeEnum.INVOICETYPE_PTFP_KCL.toIntValue(), "16");
|
||||
tspzMap.put(InvoiceTypeEnum.INVOICETYPE_ZYFP_KCL.toIntValue(), "16");
|
||||
tspzMap.put(InvoiceTypeEnum.INVOICETYPE_DZPTFP_NCP.toIntValue(), "9");
|
||||
tspzMap.put(InvoiceTypeEnum.INVOICETYPE_PTFP_NCP.toIntValue(), "9");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取真实的发票类型
|
||||
* @param fplx 发票类型
|
||||
* @return 真实的发票类型
|
||||
*/
|
||||
public static String getRealInvoicetype(Integer fplx){
|
||||
if (invoiceMap.containsKey(fplx)){
|
||||
return invoiceMap.get(fplx);
|
||||
}
|
||||
return String.valueOf(fplx);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取特殊票种
|
||||
* @param fplx 发票类型
|
||||
* @return 特殊票种
|
||||
*/
|
||||
public static String getTspz(Integer fplx){
|
||||
if (tspzMap.containsKey(fplx)){
|
||||
return tspzMap.get(fplx);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更具发票类型和特殊票种转发票类型
|
||||
* @param fplx
|
||||
* @param tspz
|
||||
* @return
|
||||
*/
|
||||
public static String getInvoicetypeByFplxAndTspz(String fplx, String tspz){
|
||||
//非特殊票种
|
||||
if (tspz == null || tspz.startsWith("E")){
|
||||
return fplx;
|
||||
}
|
||||
//全电发票不拼接
|
||||
if ("31".equals(fplx) || "32".equals(fplx) ||"33".equals(fplx) || "34".equals(fplx)){
|
||||
return fplx;
|
||||
}
|
||||
//增值税专用发票(机动车)
|
||||
if ("412".equals(fplx + tspz)){
|
||||
return InvoiceTypeEnum.INVOICETYPE_ZYFP_JDC.toStringValue();
|
||||
}
|
||||
//农产品收购
|
||||
if ("9".equals(tspz)) {
|
||||
return fplx + "0" + tspz;
|
||||
}
|
||||
//数电纸质发票(机动车销售统一发票
|
||||
if ("36".equals(fplx)){
|
||||
return fplx;
|
||||
}
|
||||
//其他特殊票种发票
|
||||
return fplx + tspz;
|
||||
}
|
||||
}
|
|
@ -88,6 +88,8 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
|
|||
|
||||
private static Map<String, Object> tsMap = new HashMap();
|
||||
|
||||
private String orgCodeFlag =null;
|
||||
|
||||
private static Map<String, Object> voMap = new HashMap();
|
||||
|
||||
private static Map<String, Set<String>> idsMap = new HashMap();
|
||||
|
@ -112,7 +114,11 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
|
|||
list.add(agg);
|
||||
}
|
||||
AggBomVO[] aggVOs = (AggBomVO[]) list.toArray(new AggBomVO[list.size()]);
|
||||
|
||||
if(aggVOs[0].getParentVO().getAttributeValue("pk_org")==null||aggVOs[0].getParentVO().getAttributeValue("pk_org")==""){
|
||||
ExceptionUtils.wrappBusinessException("请求参数pk_org为空,请检查!!!!");
|
||||
}else{
|
||||
this.orgCodeFlag=aggVOs[0].getParentVO().getAttributeValue("pk_org").toString();
|
||||
}
|
||||
BillFieldsCodeToPkUtil.doTranslateVOFields(aggVOs);
|
||||
IUifService iUifService = NCLocator.getInstance().lookup(IUifService.class);
|
||||
for (AggBomVO aggtwo : aggVOs) {
|
||||
|
@ -170,7 +176,7 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
|
|||
result = service.insertBom((AggBomVO[]) addAggvoList.toArray(new AggBomVO[0]));
|
||||
} else if (!commitAggvoList.isEmpty() && addAggvoList.isEmpty()) {
|
||||
List<AggBomVO> newAggVOList = new ArrayList<>();
|
||||
if ("gaoning".equals(userCode)) {
|
||||
if ("gaoning".equals(userCode)|| "C029".equals(orgCodeFlag)) {
|
||||
for (AggBomVO aggvo : commitAggvoList) {
|
||||
result = service.insertCommitBomWithParam(new AggBomVO[] { aggvo }, true, true);
|
||||
newAggVOList.add(result[0]);
|
||||
|
@ -720,7 +726,7 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
|
|||
if (VersionTypeEnum.AVAILABLE.equalsValue(head.getHfversiontype())
|
||||
&& !head.getCbomid().equals(headvo.getCbomid())) {
|
||||
// sdlizheng --添加独立判断--plm三方越过此校验
|
||||
if ("gaoning".equals(userCode) || "dlkgsrm".equals(userCode)) {
|
||||
if ("gaoning".equals(userCode) || "dlkgsrm".equals(userCode)|| "C029".equals(this.orgCodeFlag)) {
|
||||
// AggBomVO afterVO = service.canceldefault(aggBomVO);
|
||||
} else {
|
||||
return UFBoolean.TRUE;
|
||||
|
@ -774,14 +780,14 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
|
|||
agg.getParent().setAttributeValue("fbillstatus", Integer.valueOf(-1));
|
||||
agg.getParent().setAttributeValue("hfbomsource", Integer.valueOf(1));
|
||||
agg.getParent().setAttributeValue("hfbomcategory", Integer.valueOf(1));
|
||||
if ("gaoning".equals(userCode) || "dlkgsrm".equals(userCode)) {
|
||||
if ("gaoning".equals(userCode) || "dlkgsrm".equals(userCode)|| "C029".equals(this.orgCodeFlag)) {
|
||||
// sdlizheng
|
||||
// 1、对于之前不存在的BOM,新增时:如果是传自由态,不默认且无效,走标准逻辑,如果传的是审批态默认且有效。2025年4月11日16点28分 start
|
||||
if (fbillstatus != null && "1".equals(fbillstatus.toString())) {
|
||||
agg.getParent().setAttributeValue("hfversiontype", Integer.valueOf(1));
|
||||
agg.getParent().setAttributeValue("hbdefault", UFBoolean.TRUE);
|
||||
}else if(fbillstatus != null && "-1".equals(fbillstatus.toString())){
|
||||
if("gaoning".equals(userCode)){
|
||||
if("gaoning".equals(userCode)|| "C029".equals(this.orgCodeFlag)){
|
||||
agg.getParent().setAttributeValue("hfversiontype", Integer.valueOf(1));
|
||||
agg.getParent().setAttributeValue("hbdefault", UFBoolean.TRUE);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue