解决自动拣货报空指针问题-张鑫0505

This commit is contained in:
zhangxinah@yonyou.com 2025-05-05 14:31:15 +08:00
parent 1d67948b6b
commit c58d29bee8
2 changed files with 928 additions and 974 deletions

View File

@ -78,32 +78,30 @@ public class PickAutoServiceImpl implements IPickAutoService {
private BusiCalculator calc = BusiCalculator.getBusiCalculatorAtBS(); private BusiCalculator calc = BusiCalculator.getBusiCalculatorAtBS();
@Override @Override
public Object autoPick(ICBillVO billvo, Map<String,Object> userObject) { public Object autoPick(ICBillVO billvo, Map<String, Object> userObject) {
List<ICBillBodyVO> delbodys = this.processDelBody(new ICBillVO[]{billvo}); List<ICBillBodyVO> delbodys = this.processDelBody(new ICBillVO[] { billvo });
//拣货前先清除行备注防止错误提示 // 拣货前先清除行备注防止错误提示
this.clearBodyNote(billvo); this.clearBodyNote(billvo);
ICBillVO retBillvo = (ICBillVO) billvo.clone(); ICBillVO retBillvo = (ICBillVO) billvo.clone();
// ICBillBodyVO[] bodyvos = retBillvo.getBodys(); // ICBillBodyVO[] bodyvos = retBillvo.getBodys();
this.preprocess(retBillvo); this.preprocess(retBillvo);
OnhandResService resserver = NCLocator.getInstance().lookup( OnhandResService resserver = NCLocator.getInstance().lookup(OnhandResService.class);
OnhandResService.class);
try { try {
// 预留处理 // 预留处理
ICBillVO[] retvos = NCLocator.getInstance().lookup(ReserveInOut.class) ICBillVO[] retvos = NCLocator.getInstance().lookup(ReserveInOut.class)
.reserveOutAutoPick(new ICBillVO[] {retBillvo}, false); .reserveOutAutoPick(new ICBillVO[] { retBillvo }, false);
retBillvo = retvos[0]; retBillvo = retvos[0];
ICBillBodyVO[] bodyvos = retvos[0].getBodys(); ICBillBodyVO[] bodyvos = retvos[0].getBodys();
//支持预留拣货 modify by yangls7 // 支持预留拣货 modify by yangls7
// ICBillPickResults results = resserver.reservePickAuto(billvo); // ICBillPickResults results = resserver.reservePickAuto(billvo);
ICBillPickResults results = resserver.pickAuto(retBillvo); ICBillPickResults results = resserver.pickAuto(retBillvo);
if (results == null) { if (results == null) {
this.setBodyNoteOnhandErro(retBillvo.getBodys(), results); this.setBodyNoteOnhandErro(retBillvo.getBodys(), results);
return retBillvo; return retBillvo;
} }
if(results.isResPick()) { if (results.isResPick()) {
fireNumEditEvent(retBillvo, ICPubMetaNameConst.NNUM, retBillvo.getBody(0).getNnum(), -1, userObject); fireNumEditEvent(retBillvo, ICPubMetaNameConst.NNUM, retBillvo.getBody(0).getNnum(), -1, userObject);
return retBillvo; return retBillvo;
} }
@ -123,9 +121,11 @@ public class PickAutoServiceImpl implements IPickAutoService {
if (bodys == null || bodys.length <= 0) { if (bodys == null || bodys.length <= 0) {
// 如果此行没有拣货数据将此行直接放入新表体中 // 如果此行没有拣货数据将此行直接放入新表体中
newBodyVOs.add(bodyvos[i]); newBodyVOs.add(bodyvos[i]);
//zhengxinm 次行没有拣货数据 可能在预留时已经拣货 可能拣货成功但是表体备注有问题 这里检查下 如果没问题清空表体备注 2020-11-04 // zhengxinm 次行没有拣货数据 可能在预留时已经拣货 可能拣货成功但是表体备注有问题 这里检查下 如果没问题清空表体备注 2020-11-04
if ((bodyvos[i].getNassistnum() != null ? bodyvos[i].getNassistnum() : new UFDouble(0)).doubleValue() if ((bodyvos[i].getNassistnum() != null ? bodyvos[i].getNassistnum() : new UFDouble(0))
==(bodyvos[i].getNshouldassistnum() != null ? bodyvos[i].getNshouldassistnum() : new UFDouble(0)).doubleValue()) { .doubleValue() == (bodyvos[i].getNshouldassistnum() != null
? bodyvos[i].getNshouldassistnum()
: new UFDouble(0)).doubleValue()) {
bodyvos[i].setVnotebody(null); bodyvos[i].setVnotebody(null);
} }
continue; continue;
@ -134,7 +134,7 @@ public class PickAutoServiceImpl implements IPickAutoService {
bodyvos[i].setCrowno(null); bodyvos[i].setCrowno(null);
// this.getEditorModel().getCardPanelWrapper().copyLine(); // this.getEditorModel().getCardPanelWrapper().copyLine();
List<ICBillBodyVO> rowBodyVOs = new ArrayList<ICBillBodyVO>(); List<ICBillBodyVO> rowBodyVOs = new ArrayList<ICBillBodyVO>();
for (int k = 0; k < bodys.length; k++) {//不知道这块之前为啥反向遍历 导致行号逆序 改过来了 zhengxinm 2021-03-10 for (int k = 0; k < bodys.length; k++) {// 不知道这块之前为啥反向遍历 导致行号逆序 改过来了 zhengxinm 2021-03-10
if (k == 0) { if (k == 0) {
this.setOnhandDataToBody(bodys[k], bodyvos[i]); this.setOnhandDataToBody(bodys[k], bodyvos[i]);
if (bodyvos[i].getStatus() != VOStatus.NEW) { if (bodyvos[i].getStatus() != VOStatus.NEW) {
@ -144,14 +144,14 @@ public class PickAutoServiceImpl implements IPickAutoService {
} else { } else {
ICBillBodyVO tempBodyvo = (ICBillBodyVO) bodyvos[i].clone(); ICBillBodyVO tempBodyvo = (ICBillBodyVO) bodyvos[i].clone();
this.processForNewVO(tempBodyvo); this.processForNewVO(tempBodyvo);
//78--2025年4月9日19点11分--sdlizheng--实发传输到应发最后一行做合计处理--start // 78--2025年4月9日19点11分--sdlizheng--实发传输到应发最后一行做合计处理--start
if(k==bodys.length-1){ if (k == bodys.length - 1) {
this.setOnhandDataToBody_End(bodys[k], tempBodyvo,rowBodyVOs); this.setOnhandDataToBody_End(bodys[k], tempBodyvo, rowBodyVOs);
}else{ } else {
this.setOnhandDataToBody(bodys[k], tempBodyvo); this.setOnhandDataToBody(bodys[k], tempBodyvo);
} }
rowBodyVOs.add(tempBodyvo); rowBodyVOs.add(tempBodyvo);
//78--2025年4月9日19点11分--sdlizheng--实发传输到应发最后一行做合计处理--start // 78--2025年4月9日19点11分--sdlizheng--实发传输到应发最后一行做合计处理--start
} }
} }
@ -159,25 +159,22 @@ public class PickAutoServiceImpl implements IPickAutoService {
} }
// 查询出来的对应入库单交易类型为编码需要转换成主键再走模板翻译 // 查询出来的对应入库单交易类型为编码需要转换成主键再走模板翻译
this.translateCcorres(newBodyVOs); this.translateCcorres(newBodyVOs);
retBillvo.setChildren(bodyvos[0].getClass(), retBillvo.setChildren(bodyvos[0].getClass(), CollectionUtils.listToArray(newBodyVOs));
CollectionUtils.listToArray(newBodyVOs));
this.setbodyNote(retBillvo, results); this.setbodyNote(retBillvo, results);
// 同步表体批次辅助字段 // 同步表体批次辅助字段
new BatchSynchronizer(new ICBatchFields()).fillBatchVOtoBill(retBillvo new BatchSynchronizer(new ICBatchFields()).fillBatchVOtoBill(retBillvo.getBodys());
.getBodys()); // 处理供应商 客户vid字段
//处理供应商 客户vid字段
fireCvendoridEvent(retBillvo.getBodys()); fireCvendoridEvent(retBillvo.getBodys());
// 同步表体序列号辅助字段 // 同步表体序列号辅助字段
new SnCodeSynchronizer(new ICSnFields()).fillBatchVOtoBill(retBillvo new SnCodeSynchronizer(new ICSnFields()).fillBatchVOtoBill(retBillvo.getBodys());
.getBodys());
fireNumEditEvent(retBillvo, ICPubMetaNameConst.NNUM, newBodyVOs.get(0).getNnum(), -1, userObject); fireNumEditEvent(retBillvo, ICPubMetaNameConst.NNUM, newBodyVOs.get(0).getNnum(), -1, userObject);
} catch (BusinessException e) { } catch (BusinessException e) {
ExceptionUtils.wrappBusinessException(e.getMessage()); ExceptionUtils.wrappBusinessException(e.getMessage());
} }
CircularlyAccessibleValueObject[] allChildrenVO = retBillvo.getAllChildrenVO(); CircularlyAccessibleValueObject[] allChildrenVO = retBillvo.getAllChildrenVO();
CollectionUtils.addArrayToList(delbodys, (ICBillBodyVO[])allChildrenVO); CollectionUtils.addArrayToList(delbodys, (ICBillBodyVO[]) allChildrenVO);
retBillvo.setChildrenVO(CollectionUtils.listToArray(delbodys)); retBillvo.setChildrenVO(CollectionUtils.listToArray(delbodys));
return retBillvo; return retBillvo;
} }
@ -196,40 +193,38 @@ public class PickAutoServiceImpl implements IPickAutoService {
this.resetBodyLocationID(bodyvo, origin); this.resetBodyLocationID(bodyvo, origin);
this.processCcorrespondInfo(bodyvo, origin); this.processCcorrespondInfo(bodyvo, origin);
this.processNumInfo_End(bodyvo, origin,newBodyVOs); this.processNumInfo_End(bodyvo, origin, newBodyVOs);
this.setSNInfoToBody(bodyvo, origin); this.setSNInfoToBody(bodyvo, origin);
} }
private void processNumInfo_End(ICBillBodyVO bodyvo, ICBillBodyVO origin, List<ICBillBodyVO> newBodyVOs) { private void processNumInfo_End(ICBillBodyVO bodyvo, ICBillBodyVO origin, List<ICBillBodyVO> newBodyVOs) {
origin.setAttributeValue(ICPubMetaNameConst.NNUM, bodyvo.getNnum()); origin.setAttributeValue(ICPubMetaNameConst.NNUM, bodyvo.getNnum());
origin.setAttributeValue(ICPubMetaNameConst.NASSISTNUM, bodyvo.getNassistnum()); origin.setAttributeValue(ICPubMetaNameConst.NASSISTNUM, bodyvo.getNassistnum());
origin.setAttributeValue(ICPubMetaNameConst.NGROSSNUM, origin.setAttributeValue(ICPubMetaNameConst.NGROSSNUM, bodyvo.getNgrossnum());
bodyvo.getNgrossnum()); // 计算前几行的应发数量合
//计算前几行的应发数量合 UFDouble sumShouldNum = UFDouble.ZERO_DBL;
UFDouble sumShouldNum=UFDouble.ZERO_DBL; UFDouble sumShouldAssistNum = UFDouble.ZERO_DBL;
UFDouble sumShouldAssistNum=UFDouble.ZERO_DBL; for (ICBillBodyVO bodyVO : newBodyVOs) {
for(ICBillBodyVO bodyVO:newBodyVOs){
UFDouble nShouldnum = bodyVO.getNshouldnum(); UFDouble nShouldnum = bodyVO.getNshouldnum();
UFDouble nShouldAssistNum = bodyVO.getNshouldassistnum(); UFDouble nShouldAssistNum = bodyVO.getNshouldassistnum();
sumShouldNum= MathTool.add(sumShouldNum,nShouldnum); sumShouldNum = MathTool.add(sumShouldNum, nShouldnum);
sumShouldAssistNum= MathTool.add(sumShouldAssistNum,nShouldAssistNum); sumShouldAssistNum = MathTool.add(sumShouldAssistNum, nShouldAssistNum);
} }
//78--2025年4月9日19点11分--sdlizheng--实发传输到应发最后一行做合计处理--start // 78--2025年4月9日19点11分--sdlizheng--实发传输到应发最后一行做合计处理--start
origin.setAttributeValue(ICPubMetaNameConst.NSHOULDNUM, MathTool.sub(bodyvo.getNshouldnum(),sumShouldNum) ); origin.setAttributeValue(ICPubMetaNameConst.NSHOULDNUM, MathTool.sub(bodyvo.getNshouldnum(), sumShouldNum));
origin.setAttributeValue(ICPubMetaNameConst.NSHOULDASSISTNUM, MathTool.sub(bodyvo.getNshouldassistnum(),sumShouldAssistNum)); origin.setAttributeValue(ICPubMetaNameConst.NSHOULDASSISTNUM,
//78--2025年4月9日19点11分--sdlizheng--实发传输到应发最后一行做合计处理--start MathTool.sub(bodyvo.getNshouldassistnum(), sumShouldAssistNum));
// 78--2025年4月9日19点11分--sdlizheng--实发传输到应发最后一行做合计处理--start
UFDouble shouldnum = origin.getNshouldnum(); UFDouble shouldnum = origin.getNshouldnum();
UFDouble shouldastnum = origin.getNshouldassistnum(); UFDouble shouldastnum = origin.getNshouldassistnum();
UFDouble num = origin.getNnum(); UFDouble num = origin.getNnum();
if (NCBaseTypeUtils.isNullOrZero(shouldnum) if (NCBaseTypeUtils.isNullOrZero(shouldnum) && NCBaseTypeUtils.isNullOrZero(shouldastnum)
&& NCBaseTypeUtils.isNullOrZero(shouldastnum)
&& NCBaseTypeUtils.isNullOrZero(num)) { && NCBaseTypeUtils.isNullOrZero(num)) {
return; return;
} }
InvCalBodyVO calbodyvo = invInfoMap.get(origin.getCmaterialvid()) InvCalBodyVO calbodyvo = invInfoMap.get(origin.getCmaterialvid()).getInvcalbodyvo();
.getInvcalbodyvo();
// 清空辅数量避免辅数量是拣货前数量影响联动计算 // 清空辅数量避免辅数量是拣货前数量影响联动计算
origin.setAttributeValue(ICPubMetaNameConst.NASSISTNUM, null); origin.setAttributeValue(ICPubMetaNameConst.NASSISTNUM, null);
@ -237,19 +232,17 @@ public class PickAutoServiceImpl implements IPickAutoService {
if (ValueCheckUtil.isTrue(calbodyvo.getSerialmanaflag())) { if (ValueCheckUtil.isTrue(calbodyvo.getSerialmanaflag())) {
origin.setAttributeValue(ICPubMetaNameConst.NNUM, bodyvo.getNnum()); origin.setAttributeValue(ICPubMetaNameConst.NNUM, bodyvo.getNnum());
// this.caculateAfterNumEdit(bodyvo); // this.caculateAfterNumEdit(bodyvo);
origin.setAttributeValue(ICPubMetaNameConst.NASSISTNUM, origin.setAttributeValue(ICPubMetaNameConst.NASSISTNUM, bodyvo.getNassistnum());
bodyvo.getNassistnum()); boolean isNullServialcode = StringUtil.isSEmptyOrNullForAll(
boolean isNullServialcode = StringUtil.isSEmptyOrNullForAll(VOEntityUtil VOEntityUtil.getVOsValuesNotDel(bodyvo.getLocationVOs(), ICLocationVO.VSERIALCODE, String.class));
.getVOsValuesNotDel(bodyvo.getLocationVOs(),
ICLocationVO.VSERIALCODE, String.class));
if (bodyvo.getLocationVOs() != null && isNullServialcode) { if (bodyvo.getLocationVOs() != null && isNullServialcode) {
this.processLocAstNum(bodyvo); this.processLocAstNum(bodyvo);
} }
// origin.setLocationVOs(bodyvo.getLocationVOs()); // origin.setLocationVOs(bodyvo.getLocationVOs());
ICLocationVO[] lvos = origin.getLocationVOs(); ICLocationVO[] lvos = origin.getLocationVOs();
ICLocationVO[] lvos2 = bodyvo.getLocationVOs(); ICLocationVO[] lvos2 = bodyvo.getLocationVOs();
if(lvos2 != null) { if (lvos2 != null) {
//这里获取的pks可能是[null,null,...] 这样的 增加过滤 // 这里获取的pks可能是[null,null,...] 这样的 增加过滤
String[] lpks = VOEntityUtil.getVOsValuesNotDel(lvos == null ? new ICLocationVO[] {} : lvos, String[] lpks = VOEntityUtil.getVOsValuesNotDel(lvos == null ? new ICLocationVO[] {} : lvos,
ICLocationVO.PK_SERIALCODE, String.class); ICLocationVO.PK_SERIALCODE, String.class);
List<String> lpkList = new ArrayList<String>(); List<String> lpkList = new ArrayList<String>();
@ -261,14 +254,14 @@ public class PickAutoServiceImpl implements IPickAutoService {
} }
} }
//这里获取的pks可能是[null,null,...] 这样的 增加过滤 // 这里获取的pks可能是[null,null,...] 这样的 增加过滤
if(lpkList.size() > 0) { if (lpkList.size() > 0) {
int needNum = shouldnum.intValue(); int needNum = shouldnum.intValue();
for (ICLocationVO lvo : lvos2) { for (ICLocationVO lvo : lvos2) {
if(!lpkList.contains(lvo.getPk_serialcode()) && lvos.length < needNum) { if (!lpkList.contains(lvo.getPk_serialcode()) && lvos.length < needNum) {
lvos = CollectionUtils.combineArrs(lvos, new ICLocationVO[] {lvo}); lvos = CollectionUtils.combineArrs(lvos, new ICLocationVO[] { lvo });
// needNum--; // needNum--;
} }
} }
@ -283,15 +276,13 @@ public class PickAutoServiceImpl implements IPickAutoService {
// this.caculateAfterNumEdit(bodyvo); // this.caculateAfterNumEdit(bodyvo);
// 对于辅计量记结存的物料计算辅数量之后会导致界面展示和结存数据不一致所以用结存数据设置 // 对于辅计量记结存的物料计算辅数量之后会导致界面展示和结存数据不一致所以用结存数据设置
if (!ValueCheckUtil.isNullORZeroLength(this.isasunitstore)) { if (!ValueCheckUtil.isNullORZeroLength(this.isasunitstore)) {
if (ValueCheckUtil.isTrue(this.isasunitstore.get((String) origin if (ValueCheckUtil
.getAttributeValue(ICPubMetaNameConst.CMATERIALVID) .isTrue(this.isasunitstore.get((String) origin.getAttributeValue(ICPubMetaNameConst.CMATERIALVID)
+ (String) origin.getAttributeValue(ICPubMetaNameConst.CASTUNITID)))) { + (String) origin.getAttributeValue(ICPubMetaNameConst.CASTUNITID)))) {
origin.setAttributeValue(ICPubMetaNameConst.NASSISTNUM, origin.setAttributeValue(ICPubMetaNameConst.NASSISTNUM, bodyvo.getNassistnum());
bodyvo.getNassistnum());
} else { } else {
bodyvo.setNassistnum(calc.calculateAstNum(bodyvo.getNnum(), bodyvo.setNassistnum(calc.calculateAstNum(bodyvo.getNnum(),
(String) origin.getAttributeValue(ICPubMetaNameConst.VCHANGERATE), (String) origin.getAttributeValue(ICPubMetaNameConst.VCHANGERATE), bodyvo.getCasscustid()));
bodyvo.getCasscustid()));
} }
} }
@ -303,36 +294,36 @@ public class PickAutoServiceImpl implements IPickAutoService {
/** /**
* 查询出来的对应入库单交易类型为编码需要转换成主键再走模板翻译 * 查询出来的对应入库单交易类型为编码需要转换成主键再走模板翻译
*
* @param newBodyVOs * @param newBodyVOs
*/ */
private void translateCcorres(List<ICBillBodyVO> newBodyVOs) { private void translateCcorres(List<ICBillBodyVO> newBodyVOs) {
Set<String> codeSet = new HashSet<String>(); Set<String> codeSet = new HashSet<String>();
if(newBodyVOs != null && newBodyVOs.size() > 0) { if (newBodyVOs != null && newBodyVOs.size() > 0) {
for(ICBillBodyVO bodyVO : newBodyVOs) { for (ICBillBodyVO bodyVO : newBodyVOs) {
codeSet.add(bodyVO.getCcorrespondtranstype()); codeSet.add(bodyVO.getCcorrespondtranstype());
} }
} }
Map<String, String> idMap = new HashMap<String, String>(); Map<String, String> idMap = new HashMap<String, String>();
if(codeSet.size() > 0) { if (codeSet.size() > 0) {
String pk_group = InvocationInfoProxy.getInstance().getGroupId(); String pk_group = InvocationInfoProxy.getInstance().getGroupId();
SqlBuilder sql = new SqlBuilder(); SqlBuilder sql = new SqlBuilder();
sql.append(" select pk_billtypecode, pk_billtypeid from bd_billtype where "); sql.append(" select pk_billtypecode, pk_billtypeid from bd_billtype where ");
sql.append(" pk_group ", pk_group); sql.append(" pk_group ", pk_group);
sql.append(" and "); sql.append(" and ");
sql.append( " pk_billtypecode ", codeSet.toArray(new String[codeSet.size()])); sql.append(" pk_billtypecode ", codeSet.toArray(new String[codeSet.size()]));
IRowSet query = new DataAccessUtils().query(sql.toString()); IRowSet query = new DataAccessUtils().query(sql.toString());
while (query.next()) { while (query.next()) {
idMap.put(query.getString(0), query.getString(1)); idMap.put(query.getString(0), query.getString(1));
} }
} }
if(MapUtils.isNotEmpty(idMap)) { if (MapUtils.isNotEmpty(idMap)) {
for(ICBillBodyVO bodyVO : newBodyVOs) { for (ICBillBodyVO bodyVO : newBodyVOs) {
bodyVO.setCcorrespondtranstype(idMap.get(bodyVO.getCcorrespondtranstype())); bodyVO.setCcorrespondtranstype(idMap.get(bodyVO.getCcorrespondtranstype()));
} }
} }
} }
private void fireCvendoridEvent(ICBillBodyVO[] bodys) { private void fireCvendoridEvent(ICBillBodyVO[] bodys) {
if (bodys == null || bodys.length == 0) { if (bodys == null || bodys.length == 0) {
return; return;
@ -364,26 +355,27 @@ public class PickAutoServiceImpl implements IPickAutoService {
// 获取所有表体的供应商oid 拣货后台逻辑未变只带出物料辅助属性的客户 供应商oid 补充vid // 获取所有表体的供应商oid 拣货后台逻辑未变只带出物料辅助属性的客户 供应商oid 补充vid
HashMap<String, String> cvendoridMap = new HashMap<String, String>(); HashMap<String, String> cvendoridMap = new HashMap<String, String>();
HashMap<String, String> casscustidMap = new HashMap<String, String>(); HashMap<String, String> casscustidMap = new HashMap<String, String>();
HashMap<String, UFDate> cvendoridAndDate= new HashMap<String, UFDate>(); HashMap<String, UFDate> cvendoridAndDate = new HashMap<String, UFDate>();
HashMap<String, UFDate> casscustidAndDate= new HashMap<String, UFDate>(); HashMap<String, UFDate> casscustidAndDate = new HashMap<String, UFDate>();
HashMap<String, String> ctplcustomeridMap = new HashMap<String, String>(); HashMap<String, String> ctplcustomeridMap = new HashMap<String, String>();
HashMap<String, String> cvmivenderidMap = new HashMap<String, String>(); HashMap<String, String> cvmivenderidMap = new HashMap<String, String>();
HashMap<String, UFDate> ctplcustomeridAndDate = new HashMap<String, UFDate>(); HashMap<String, UFDate> ctplcustomeridAndDate = new HashMap<String, UFDate>();
HashMap<String, UFDate> cvmivenderidAndDate = new HashMap<String, UFDate>(); HashMap<String, UFDate> cvmivenderidAndDate = new HashMap<String, UFDate>();
UFDate busidate = AppContext.getInstance().getBusiDate(); UFDate busidate = AppContext.getInstance().getBusiDate();
if (cvendoridset != null && cvendoridset.size() > 0) { if (cvendoridset != null && cvendoridset.size() > 0) {
for(String cvendorid : cvendoridset) { for (String cvendorid : cvendoridset) {
cvendoridAndDate.put(cvendorid,busidate); cvendoridAndDate.put(cvendorid, busidate);
} }
//根据供应商oid和业务日期查询vid // 根据供应商oid和业务日期查询vid
cvendoridMap = (HashMap<String, String>) SupplierPubService.querySupplierVidsByOidAndDate(cvendoridAndDate); cvendoridMap = (HashMap<String, String>) SupplierPubService.querySupplierVidsByOidAndDate(cvendoridAndDate);
} }
if (casscustidset != null && casscustidset.size() > 0) { if (casscustidset != null && casscustidset.size() > 0) {
for(String casscustid : casscustidset) { for (String casscustid : casscustidset) {
casscustidAndDate.put(casscustid,busidate); casscustidAndDate.put(casscustid, busidate);
} }
//根据客户oid和业务日期查询vid // 根据客户oid和业务日期查询vid
casscustidMap = (HashMap<String, String>) CustomerPubService.queryCustomerVidsByOidsAndDate(casscustidAndDate); casscustidMap = (HashMap<String, String>) CustomerPubService
.queryCustomerVidsByOidsAndDate(casscustidAndDate);
} }
if (ctplcustomeridset != null && ctplcustomeridset.size() > 0) { if (ctplcustomeridset != null && ctplcustomeridset.size() > 0) {
for (String ctplcustomerid : ctplcustomeridset) { for (String ctplcustomerid : ctplcustomeridset) {
@ -401,7 +393,7 @@ public class PickAutoServiceImpl implements IPickAutoService {
cvmivenderidMap = (HashMap<String, String>) SupplierPubService cvmivenderidMap = (HashMap<String, String>) SupplierPubService
.querySupplierVidsByOidAndDate(cvmivenderidAndDate); .querySupplierVidsByOidAndDate(cvmivenderidAndDate);
} }
//根据客户 供应商oid对vid赋值 // 根据客户 供应商oid对vid赋值
for (ICBillBodyVO body : bodys) { for (ICBillBodyVO body : bodys) {
if (body.getCvendorid() != null) { if (body.getCvendorid() != null) {
body.setCvendorvid(cvendoridMap.get(body.getCvendorid())); body.setCvendorvid(cvendoridMap.get(body.getCvendorid()));
@ -441,9 +433,9 @@ public class PickAutoServiceImpl implements IPickAutoService {
* @param newnum * @param newnum
* @param oldnum * @param oldnum
*/ */
private void fireNumEditEvent(ICBillVO billvo, String numField, private void fireNumEditEvent(ICBillVO billvo, String numField, UFDouble num, int index,
UFDouble num, int index, Map<String,Object> userObject) { Map<String, Object> userObject) {
//获取拣货后的billvo的实发数量存放到数量编辑后事件之后的新vo里 // 获取拣货后的billvo的实发数量存放到数量编辑后事件之后的新vo里
Map<String, UFDouble> nassistnumMap = new HashMap<>(); Map<String, UFDouble> nassistnumMap = new HashMap<>();
Map<String, UFDouble> nnumMap = new HashMap<>(); Map<String, UFDouble> nnumMap = new HashMap<>();
CircularlyAccessibleValueObject[] bodys = billvo.getAllChildrenVO(); CircularlyAccessibleValueObject[] bodys = billvo.getAllChildrenVO();
@ -452,7 +444,7 @@ public class PickAutoServiceImpl implements IPickAutoService {
UFDouble nassistnum = (UFDouble) body.getAttributeValue(MetaNameConst.NASSISTNUM); UFDouble nassistnum = (UFDouble) body.getAttributeValue(MetaNameConst.NASSISTNUM);
UFDouble nnum = (UFDouble) body.getAttributeValue(MetaNameConst.NNUM); UFDouble nnum = (UFDouble) body.getAttributeValue(MetaNameConst.NNUM);
String crowno = (String) body.getAttributeValue(MetaNameConst.CROWNO); String crowno = (String) body.getAttributeValue(MetaNameConst.CROWNO);
if(crowno == null) { if (crowno == null) {
i = i + 10; i = i + 10;
crowno = i + ""; crowno = i + "";
body.setAttributeValue(MetaNameConst.CROWNO, crowno); body.setAttributeValue(MetaNameConst.CROWNO, crowno);
@ -461,18 +453,18 @@ public class PickAutoServiceImpl implements IPickAutoService {
nnumMap.put(crowno, nnum); nnumMap.put(crowno, nnum);
} }
BillCardBodyChangedRow changedRow = new BillCardBodyChangedRow(num, BillCardBodyChangedRow changedRow = new BillCardBodyChangedRow(num, null, null);
null, null); BillCardBodyEditEvent event = new BillCardBodyEditEvent(numField, index,
BillCardBodyEditEvent event = new BillCardBodyEditEvent(numField, new BillCardBodyChangedRow[] { changedRow }, null);
index, new BillCardBodyChangedRow[] { changedRow }, null);
new NumEventRule().afterEdit(billvo, event, userObject); new NumEventRule().afterEdit(billvo, event, userObject);
CircularlyAccessibleValueObject[] newBodys = billvo.getAllChildrenVO(); CircularlyAccessibleValueObject[] newBodys = billvo.getAllChildrenVO();
for (CircularlyAccessibleValueObject body : newBodys) { for (CircularlyAccessibleValueObject body : newBodys) {
if(nassistnumMap.get(body.getAttributeValue(MetaNameConst.CROWNO)) != null) { if (nassistnumMap.get(body.getAttributeValue(MetaNameConst.CROWNO)) != null) {
body.setAttributeValue(MetaNameConst.NASSISTNUM, nassistnumMap.get(body.getAttributeValue(MetaNameConst.CROWNO))); body.setAttributeValue(MetaNameConst.NASSISTNUM,
nassistnumMap.get(body.getAttributeValue(MetaNameConst.CROWNO)));
} }
if(nnumMap.get(body.getAttributeValue(MetaNameConst.CROWNO)) != null) { if (nnumMap.get(body.getAttributeValue(MetaNameConst.CROWNO)) != null) {
body.setAttributeValue(MetaNameConst.NNUM, nnumMap.get(body.getAttributeValue(MetaNameConst.CROWNO))); body.setAttributeValue(MetaNameConst.NNUM, nnumMap.get(body.getAttributeValue(MetaNameConst.CROWNO)));
} }
} }
@ -494,11 +486,10 @@ public class PickAutoServiceImpl implements IPickAutoService {
String errMsg = OnhandRes.getOnhandErro(); String errMsg = OnhandRes.getOnhandErro();
Set<String> origRowNo = new HashSet<String>(); Set<String> origRowNo = new HashSet<String>();
int realIndex = 0; int realIndex = 0;
int pickIndex = 1;//拣货下标 int pickIndex = 1;// 拣货下标
for (int i = 0, loop = uiBodys.length; i < loop; i++) { for (int i = 0, loop = uiBodys.length; i < loop; i++) {
if(uiBodys[i].getNshouldassistnum() == null && uiBodys[i].getNshouldnum() == null) { if (uiBodys[i].getNshouldassistnum() == null && uiBodys[i].getNshouldnum() == null) {
continue; continue;
} }
@ -511,29 +502,28 @@ public class PickAutoServiceImpl implements IPickAutoService {
UFDouble nshouldnum = uibody.getNshouldnum(); UFDouble nshouldnum = uibody.getNshouldnum();
String crowno = uibody.getCrowno(); String crowno = uibody.getCrowno();
for (ICBillBodyVO body : bodys) { for (ICBillBodyVO body : bodys) {
//防止多次计算添加货位判断同一行表体拣货拆分行后表体行和拣货行货位相同--sdlizheng start // 防止多次计算添加货位判断同一行表体拣货拆分行后表体行和拣货行货位相同--sdlizheng start
if(body.getClocationid().equals(uibody.getClocationid())){ if (body.getClocationid() == null || body.getClocationid().equals(uibody.getClocationid())) {
UFDouble nnum = body.getNnum(); UFDouble nnum = body.getNnum();
nshouldnum = nshouldnum.sub(nnum); nshouldnum = nshouldnum.sub(nnum);
} }
//防止多次计算添加货位判断同一行表体拣货拆分行后表体行和拣货行货位相同--sdlizheng start // 防止多次计算添加货位判断同一行表体拣货拆分行后表体行和拣货行货位相同--sdlizheng start
} }
if (nshouldnum!=null && UFDouble.ZERO_DBL.compareTo(nshouldnum) < 0) { if (nshouldnum != null && UFDouble.ZERO_DBL.compareTo(nshouldnum) < 0) {
origRowNo.add(crowno); origRowNo.add(crowno);
} }
//sdlizheng --因为拣货拆行获取pickbodys时的下标row需要循环完此次已拣货的行数之后加1--start // sdlizheng --因为拣货拆行获取pickbodys时的下标row需要循环完此次已拣货的行数之后加1--start
if(pickIndex==bodys.length){ if (pickIndex == bodys.length) {
realIndex++; realIndex++;
pickIndex=1; pickIndex = 1;
}else { } else {
pickIndex++; pickIndex++;
} }
//sdlizheng --因为拣货拆行获取pickbodys时的下标row需要循环完此次已拣货的行数之后加1--end // sdlizheng --因为拣货拆行获取pickbodys时的下标row需要循环完此次已拣货的行数之后加1--end
} }
for (int i = 0; i < uiBodys.length; i++) { for (int i = 0; i < uiBodys.length; i++) {
String rowno = (String) uiBodys[i] String rowno = (String) uiBodys[i].getAttributeValue(ICPubMetaNameConst.CROWNO);
.getAttributeValue(ICPubMetaNameConst.CROWNO);
if (origRowNo.contains(rowno)) { if (origRowNo.contains(rowno)) {
uiBodys[i].setAttributeValue(ICPubMetaNameConst.VNOTEBODY, errMsg); uiBodys[i].setAttributeValue(ICPubMetaNameConst.VNOTEBODY, errMsg);
} }
@ -552,16 +542,15 @@ public class PickAutoServiceImpl implements IPickAutoService {
tempBodyvo.setAttributeValue("rowid", null); tempBodyvo.setAttributeValue("rowid", null);
tempBodyvo.setStatus(VOStatus.NEW); tempBodyvo.setStatus(VOStatus.NEW);
//清除扩展表数据 // 清除扩展表数据
clearExtendTableData(tempBodyvo); clearExtendTableData(tempBodyvo);
} }
private void clearExtendTableData(ICBillBodyVO tempBodyvo) { private void clearExtendTableData(ICBillBodyVO tempBodyvo) {
String[] extendTableField = new String[] { "naccumvminum", String[] extendTableField = new String[] { "naccumvminum", "ncorrespondgrsnum", "ncorrespondastnum",
"ncorrespondgrsnum", "ncorrespondastnum", "ncorrespondnum", "ncorrespondnum", "naccumoutsignnum", "naccumoutbacknum", "nrushnum", "nsignnum", "ntotaltrannum",
"naccumoutsignnum", "naccumoutbacknum", "nrushnum", "nsignnum", "btranendflag", "naccumwastnum", "csumid" };
"ntotaltrannum", "btranendflag", "naccumwastnum", "csumid" }; for (String field : extendTableField) {
for(String field : extendTableField) {
tempBodyvo.setAttributeValue(field, null); tempBodyvo.setAttributeValue(field, null);
} }
} }
@ -589,18 +578,17 @@ public class PickAutoServiceImpl implements IPickAutoService {
if (!SysInitGroupQuery.isSNEnabled()) { if (!SysInitGroupQuery.isSNEnabled()) {
return; return;
} }
UFDouble nassistnum = (UFDouble) origin UFDouble nassistnum = (UFDouble) origin.getAttributeValue(ICPubMetaNameConst.NASSISTNUM);
.getAttributeValue(ICPubMetaNameConst.NASSISTNUM);
// 只有表体数量为1时才设置表体值 // 只有表体数量为1时才设置表体值
if (!NCBaseTypeUtils.isEquals(nassistnum, UFDouble.ONE_DBL)) { if (!NCBaseTypeUtils.isEquals(nassistnum, UFDouble.ONE_DBL)) {
return; return;
} }
ICLocationVO[] lvoes = origin.getLocationVOs(); ICLocationVO[] lvoes = origin.getLocationVOs();
//因为捡完第一次货删了实发数量重新拣货之后孙表虽然不是一个但没被删除的只有一个 // 因为捡完第一次货删了实发数量重新拣货之后孙表虽然不是一个但没被删除的只有一个
if(lvoes != null && lvoes.length > 0) { if (lvoes != null && lvoes.length > 0) {
List<ICLocationVO> lvoLists = new ArrayList<>(); List<ICLocationVO> lvoLists = new ArrayList<>();
for(ICLocationVO lvo : lvoes) { for (ICLocationVO lvo : lvoes) {
if(VOStatus.DELETED != lvo.getStatus()) { if (VOStatus.DELETED != lvo.getStatus()) {
lvoLists.add(lvo); lvoLists.add(lvo);
} }
} }
@ -613,34 +601,29 @@ public class PickAutoServiceImpl implements IPickAutoService {
&& StringUtil.isNullStringOrNull(lvo.getPk_serialcode())) { && StringUtil.isNullStringOrNull(lvo.getPk_serialcode())) {
return; return;
} }
origin.setAttributeValue(ICPubMetaNameConst.VSERIALCODE, origin.setAttributeValue(ICPubMetaNameConst.VSERIALCODE, lvos[0].getVserialcode());
lvos[0].getVserialcode()); origin.setAttributeValue(ICPubMetaNameConst.PK_SERIALCODE, lvos[0].getPk_serialcode());
origin.setAttributeValue(ICPubMetaNameConst.PK_SERIALCODE,
lvos[0].getPk_serialcode());
} }
} }
private void processNumInfo(ICBillBodyVO bodyvo, ICBillBodyVO origin) { private void processNumInfo(ICBillBodyVO bodyvo, ICBillBodyVO origin) {
origin.setAttributeValue(ICPubMetaNameConst.NNUM, bodyvo.getNnum()); origin.setAttributeValue(ICPubMetaNameConst.NNUM, bodyvo.getNnum());
origin.setAttributeValue(ICPubMetaNameConst.NASSISTNUM, bodyvo.getNassistnum()); origin.setAttributeValue(ICPubMetaNameConst.NASSISTNUM, bodyvo.getNassistnum());
origin.setAttributeValue(ICPubMetaNameConst.NGROSSNUM, origin.setAttributeValue(ICPubMetaNameConst.NGROSSNUM, bodyvo.getNgrossnum());
bodyvo.getNgrossnum()); // 78--2025年4月9日19点11分--sdlizheng--实发传输到应发最后一行做合计处理--start
//78--2025年4月9日19点11分--sdlizheng--实发传输到应发最后一行做合计处理--start
origin.setAttributeValue(ICPubMetaNameConst.NSHOULDNUM, bodyvo.getNnum()); origin.setAttributeValue(ICPubMetaNameConst.NSHOULDNUM, bodyvo.getNnum());
origin.setAttributeValue(ICPubMetaNameConst.NSHOULDASSISTNUM, bodyvo.getNassistnum()); origin.setAttributeValue(ICPubMetaNameConst.NSHOULDASSISTNUM, bodyvo.getNassistnum());
//78--2025年4月9日19点11分--sdlizheng--实发传输到应发最后一行做合计处理--start // 78--2025年4月9日19点11分--sdlizheng--实发传输到应发最后一行做合计处理--start
UFDouble shouldnum = origin.getNshouldnum(); UFDouble shouldnum = origin.getNshouldnum();
UFDouble shouldastnum = origin.getNshouldassistnum(); UFDouble shouldastnum = origin.getNshouldassistnum();
UFDouble num = origin.getNnum(); UFDouble num = origin.getNnum();
if (NCBaseTypeUtils.isNullOrZero(shouldnum) if (NCBaseTypeUtils.isNullOrZero(shouldnum) && NCBaseTypeUtils.isNullOrZero(shouldastnum)
&& NCBaseTypeUtils.isNullOrZero(shouldastnum)
&& NCBaseTypeUtils.isNullOrZero(num)) { && NCBaseTypeUtils.isNullOrZero(num)) {
return; return;
} }
InvCalBodyVO calbodyvo = invInfoMap.get(origin.getCmaterialvid()) InvCalBodyVO calbodyvo = invInfoMap.get(origin.getCmaterialvid()).getInvcalbodyvo();
.getInvcalbodyvo();
// 清空辅数量避免辅数量是拣货前数量影响联动计算 // 清空辅数量避免辅数量是拣货前数量影响联动计算
origin.setAttributeValue(ICPubMetaNameConst.NASSISTNUM, null); origin.setAttributeValue(ICPubMetaNameConst.NASSISTNUM, null);
@ -648,19 +631,17 @@ public class PickAutoServiceImpl implements IPickAutoService {
if (ValueCheckUtil.isTrue(calbodyvo.getSerialmanaflag())) { if (ValueCheckUtil.isTrue(calbodyvo.getSerialmanaflag())) {
origin.setAttributeValue(ICPubMetaNameConst.NNUM, bodyvo.getNnum()); origin.setAttributeValue(ICPubMetaNameConst.NNUM, bodyvo.getNnum());
// this.caculateAfterNumEdit(bodyvo); // this.caculateAfterNumEdit(bodyvo);
origin.setAttributeValue(ICPubMetaNameConst.NASSISTNUM, origin.setAttributeValue(ICPubMetaNameConst.NASSISTNUM, bodyvo.getNassistnum());
bodyvo.getNassistnum()); boolean isNullServialcode = StringUtil.isSEmptyOrNullForAll(
boolean isNullServialcode = StringUtil.isSEmptyOrNullForAll(VOEntityUtil VOEntityUtil.getVOsValuesNotDel(bodyvo.getLocationVOs(), ICLocationVO.VSERIALCODE, String.class));
.getVOsValuesNotDel(bodyvo.getLocationVOs(),
ICLocationVO.VSERIALCODE, String.class));
if (bodyvo.getLocationVOs() != null && isNullServialcode) { if (bodyvo.getLocationVOs() != null && isNullServialcode) {
this.processLocAstNum(bodyvo); this.processLocAstNum(bodyvo);
} }
// origin.setLocationVOs(bodyvo.getLocationVOs()); // origin.setLocationVOs(bodyvo.getLocationVOs());
ICLocationVO[] lvos = origin.getLocationVOs(); ICLocationVO[] lvos = origin.getLocationVOs();
ICLocationVO[] lvos2 = bodyvo.getLocationVOs(); ICLocationVO[] lvos2 = bodyvo.getLocationVOs();
if(lvos2 != null) { if (lvos2 != null) {
//这里获取的pks可能是[null,null,...] 这样的 增加过滤 // 这里获取的pks可能是[null,null,...] 这样的 增加过滤
String[] lpks = VOEntityUtil.getVOsValuesNotDel(lvos == null ? new ICLocationVO[] {} : lvos, String[] lpks = VOEntityUtil.getVOsValuesNotDel(lvos == null ? new ICLocationVO[] {} : lvos,
ICLocationVO.PK_SERIALCODE, String.class); ICLocationVO.PK_SERIALCODE, String.class);
List<String> lpkList = new ArrayList<String>(); List<String> lpkList = new ArrayList<String>();
@ -672,14 +653,14 @@ public class PickAutoServiceImpl implements IPickAutoService {
} }
} }
//这里获取的pks可能是[null,null,...] 这样的 增加过滤 // 这里获取的pks可能是[null,null,...] 这样的 增加过滤
if(lpkList.size() > 0) { if (lpkList.size() > 0) {
int needNum = shouldnum.intValue(); int needNum = shouldnum.intValue();
for (ICLocationVO lvo : lvos2) { for (ICLocationVO lvo : lvos2) {
if(!lpkList.contains(lvo.getPk_serialcode()) && lvos.length < needNum) { if (!lpkList.contains(lvo.getPk_serialcode()) && lvos.length < needNum) {
lvos = CollectionUtils.combineArrs(lvos, new ICLocationVO[] {lvo}); lvos = CollectionUtils.combineArrs(lvos, new ICLocationVO[] { lvo });
// needNum--; // needNum--;
} }
} }
@ -694,15 +675,13 @@ public class PickAutoServiceImpl implements IPickAutoService {
// this.caculateAfterNumEdit(bodyvo); // this.caculateAfterNumEdit(bodyvo);
// 对于辅计量记结存的物料计算辅数量之后会导致界面展示和结存数据不一致所以用结存数据设置 // 对于辅计量记结存的物料计算辅数量之后会导致界面展示和结存数据不一致所以用结存数据设置
if (!ValueCheckUtil.isNullORZeroLength(this.isasunitstore)) { if (!ValueCheckUtil.isNullORZeroLength(this.isasunitstore)) {
if (ValueCheckUtil.isTrue(this.isasunitstore.get((String) origin if (ValueCheckUtil
.getAttributeValue(ICPubMetaNameConst.CMATERIALVID) .isTrue(this.isasunitstore.get((String) origin.getAttributeValue(ICPubMetaNameConst.CMATERIALVID)
+ (String) origin.getAttributeValue(ICPubMetaNameConst.CASTUNITID)))) { + (String) origin.getAttributeValue(ICPubMetaNameConst.CASTUNITID)))) {
origin.setAttributeValue(ICPubMetaNameConst.NASSISTNUM, origin.setAttributeValue(ICPubMetaNameConst.NASSISTNUM, bodyvo.getNassistnum());
bodyvo.getNassistnum());
} else { } else {
bodyvo.setNassistnum(calc.calculateAstNum(bodyvo.getNnum(), bodyvo.setNassistnum(calc.calculateAstNum(bodyvo.getNnum(),
(String) origin.getAttributeValue(ICPubMetaNameConst.VCHANGERATE), (String) origin.getAttributeValue(ICPubMetaNameConst.VCHANGERATE), bodyvo.getCasscustid()));
bodyvo.getCasscustid()));
} }
} }
@ -712,8 +691,6 @@ public class PickAutoServiceImpl implements IPickAutoService {
} }
} }
/** /**
* 处理货位信息的辅数量进行重新计算并处理尾差解决存量不足时货位单品信息数量错误的问题 * 处理货位信息的辅数量进行重新计算并处理尾差解决存量不足时货位单品信息数量错误的问题
* *
@ -731,8 +708,7 @@ public class PickAutoServiceImpl implements IPickAutoService {
UFDouble nassistnum = UFDouble.ZERO_DBL; UFDouble nassistnum = UFDouble.ZERO_DBL;
for (int i = 0; i < locs.length - 1; i++) { for (int i = 0; i < locs.length - 1; i++) {
// 此处无论是否单品管理都需要处理辅数量否则有货位信息时更新存量会有问题 // 此处无论是否单品管理都需要处理辅数量否则有货位信息时更新存量会有问题
nassistnum = calc.calculateAstNum(locs[i].getNnum(), nassistnum = calc.calculateAstNum(locs[i].getNnum(), body.getVchangerate(), body.getCastunitid());
body.getVchangerate(), body.getCastunitid());
locs[i].setNassistnum(nassistnum); locs[i].setNassistnum(nassistnum);
nsum = NCBaseTypeUtils.add(nsum, nassistnum); nsum = NCBaseTypeUtils.add(nsum, nassistnum);
@ -745,14 +721,11 @@ public class PickAutoServiceImpl implements IPickAutoService {
} }
private void processCcorrespondInfo(ICBillBodyVO bodyvo, ICBillBodyVO origin) { private void processCcorrespondInfo(ICBillBodyVO bodyvo, ICBillBodyVO origin) {
String[] corresponds = new String[] { MetaNameConst.CCORRESPONDTYPE, String[] corresponds = new String[] { MetaNameConst.CCORRESPONDTYPE, MetaNameConst.CCORRESPONDTRANSTYPE,
MetaNameConst.CCORRESPONDTRANSTYPE, MetaNameConst.CCORRESPONDCODE, MetaNameConst.CCORRESPONDCODE, MetaNameConst.CCORRESPONDHID, MetaNameConst.CCORRESPONDBID,
MetaNameConst.CCORRESPONDHID, MetaNameConst.CCORRESPONDBID, MetaNameConst.CCORRESPONDROWNO, ICPubMetaNameConst.CROWNO, ICPubMetaNameConst.NCOSTMNY,
MetaNameConst.CCORRESPONDROWNO, ICPubMetaNameConst.CROWNO, ICPubMetaNameConst.NPLANNEDMNY, MetaNameConst.DBIZDATE, ICPubMetaNameConst.VNOTEBODY };
ICPubMetaNameConst.NCOSTMNY, ICPubMetaNameConst.NPLANNEDMNY, String cmateiralvid = (String) origin.getAttributeValue(ICPubMetaNameConst.CMATERIALVID);
MetaNameConst.DBIZDATE, ICPubMetaNameConst.VNOTEBODY };
String cmateiralvid = (String) origin
.getAttributeValue(ICPubMetaNameConst.CMATERIALVID);
InvCalBodyVO invvo = this.invInfoMap.get(cmateiralvid).getInvcalbodyvo(); InvCalBodyVO invvo = this.invInfoMap.get(cmateiralvid).getInvcalbodyvo();
// 对于非出入库跟踪物料不处理对应入库单信息否则会把原始信息清掉出库参照入库单拉单 // 对于非出入库跟踪物料不处理对应入库单信息否则会把原始信息清掉出库参照入库单拉单
if (invvo == null || !ValueCheckUtil.isTrue(invvo.getOuttrackin())) { if (invvo == null || !ValueCheckUtil.isTrue(invvo.getOuttrackin())) {
@ -767,8 +740,7 @@ public class PickAutoServiceImpl implements IPickAutoService {
* 重新设置表体货位ID如果单品信息分布在多个货位清空表体否则设置单品货位信息到表体 * 重新设置表体货位ID如果单品信息分布在多个货位清空表体否则设置单品货位信息到表体
* *
* @param bodyvo拣货结果 * @param bodyvo拣货结果
* @param row * @param row 当前行
* 当前行
*/ */
private void resetBodyLocationID(ICBillBodyVO bodyvo, ICBillBodyVO origin) { private void resetBodyLocationID(ICBillBodyVO bodyvo, ICBillBodyVO origin) {
ICLocationVO[] locs = bodyvo.getLocationVOs(); ICLocationVO[] locs = bodyvo.getLocationVOs();
@ -777,8 +749,7 @@ public class PickAutoServiceImpl implements IPickAutoService {
return; return;
} }
List<String> locids = VOEntityUtil.getVOsValueListNotDel(locs, List<String> locids = VOEntityUtil.getVOsValueListNotDel(locs, ICLocationVO.CLOCATIONID);
ICLocationVO.CLOCATIONID);
if (ValueCheckUtil.isNullORZeroLength(locids)) { if (ValueCheckUtil.isNullORZeroLength(locids)) {
return; return;
} }
@ -804,33 +775,26 @@ public class PickAutoServiceImpl implements IPickAutoService {
continue; continue;
} }
// 拣出的货非换算率记结存场合不包含换算率信息 // 拣出的货非换算率记结存场合不包含换算率信息
if (field.equals(OnhandDimVO.VCHANGERATE) if (field.equals(OnhandDimVO.VCHANGERATE) && StringUtil.isSEmptyOrNull(bodyvo.getVchangerate())) {
&& StringUtil.isSEmptyOrNull(bodyvo.getVchangerate())) {
continue; continue;
} }
// 固定辅助属性(库存状态项目供应商生产厂商客户) // 固定辅助属性(库存状态项目供应商生产厂商客户)
if (field.equals(OnhandDimVO.CSTATEID) if (field.equals(OnhandDimVO.CSTATEID) && StringUtil.isSEmptyOrNull(bodyvo.getCstateid())) {
&& StringUtil.isSEmptyOrNull(bodyvo.getCstateid())) {
continue; continue;
} }
if (field.equals(OnhandDimVO.CPROJECTID) if (field.equals(OnhandDimVO.CPROJECTID) && StringUtil.isSEmptyOrNull(bodyvo.getCprojectid())) {
&& StringUtil.isSEmptyOrNull(bodyvo.getCprojectid())) {
continue; continue;
} }
if (field.equals(OnhandDimVO.CVENDORID) if (field.equals(OnhandDimVO.CVENDORID) && StringUtil.isSEmptyOrNull(bodyvo.getCvendorid())) {
&& StringUtil.isSEmptyOrNull(bodyvo.getCvendorid())) {
continue; continue;
} }
if (field.equals(OnhandDimVO.CPRODUCTORID) if (field.equals(OnhandDimVO.CPRODUCTORID) && StringUtil.isSEmptyOrNull(bodyvo.getCproductorid())) {
&& StringUtil.isSEmptyOrNull(bodyvo.getCproductorid())) {
continue; continue;
} }
if (field.equals(OnhandDimVO.CASSCUSTID) if (field.equals(OnhandDimVO.CASSCUSTID) && StringUtil.isSEmptyOrNull(bodyvo.getCasscustid())) {
&& StringUtil.isSEmptyOrNull(bodyvo.getCasscustid())) {
continue; continue;
} }
if (field.equals(OnhandDimVO.CFFILEID) if (field.equals(OnhandDimVO.CFFILEID) && StringUtil.isSEmptyOrNull(bodyvo.getCffileid())) {
&& StringUtil.isSEmptyOrNull(bodyvo.getCffileid())) {
continue; continue;
} }
origin.setAttributeValue(field, bodyvo.getAttributeValue(field)); origin.setAttributeValue(field, bodyvo.getAttributeValue(field));
@ -873,11 +837,12 @@ public class PickAutoServiceImpl implements IPickAutoService {
// } // }
IMarAssistantPubService assistantPubService = NCLocator.getInstance().lookup(IMarAssistantPubService.class); IMarAssistantPubService assistantPubService = NCLocator.getInstance().lookup(IMarAssistantPubService.class);
try { try {
UserdefitemVO[] userdefitemVOs = assistantPubService.queryMarAssistantDefine(AppContext.getInstance().getPkGroup()); UserdefitemVO[] userdefitemVOs = assistantPubService
.queryMarAssistantDefine(AppContext.getInstance().getPkGroup());
boolean isUseDef = false; boolean isUseDef = false;
if(userdefitemVOs!=null) { if (userdefitemVOs != null) {
for (UserdefitemVO vo : userdefitemVOs) { for (UserdefitemVO vo : userdefitemVOs) {
if(vo.getClassid().equals("BS000010000100001032")) { if (vo.getClassid().equals("BS000010000100001032")) {
isUseDef = true; isUseDef = true;
} }
} }
@ -889,8 +854,7 @@ public class PickAutoServiceImpl implements IPickAutoService {
ExceptionUtils.wrappException(e); ExceptionUtils.wrappException(e);
} }
// 统一处理变动换算率格式否则与结存的换算率格式不匹配 // 统一处理变动换算率格式否则与结存的换算率格式不匹配
new ICBillValueSetter().procChangeRateFormat(new ICBillVO[] { billvo }, new ICBillValueSetter().procChangeRateFormat(new ICBillVO[] { billvo }, new ICBSContext().getInvInfo());
new ICBSContext().getInvInfo());
} }
/** /**
@ -905,7 +869,7 @@ public class PickAutoServiceImpl implements IPickAutoService {
for (int k = 1; k <= 10; k++) { for (int k = 1; k <= 10; k++) {
String index = "vfree" + k; String index = "vfree" + k;
Object vfree = bodyvo.getAttributeValue(index); Object vfree = bodyvo.getAttributeValue(index);
if ((vfree != null&&vfree.equals("N")) ) { if ((vfree != null && vfree.equals("N"))) {
bodyvo.setAttributeValue(index, null); bodyvo.setAttributeValue(index, null);
} }
} }
@ -916,7 +880,7 @@ public class PickAutoServiceImpl implements IPickAutoService {
String index = "vfree" + k; String index = "vfree" + k;
Object vfree = bodyvo.getAttributeValue(index); Object vfree = bodyvo.getAttributeValue(index);
if ((vfree != null && vfree.equals("N"))) { if ((vfree != null && vfree.equals("N"))) {
if(list==null || !list.contains(index)) { if (list == null || !list.contains(index)) {
bodyvo.setAttributeValue(index, null); bodyvo.setAttributeValue(index, null);
} }
} }
@ -925,7 +889,7 @@ public class PickAutoServiceImpl implements IPickAutoService {
} }
} }
public MapList<String, String> check(String materialField,ISuperVO[] valueObjects) { public MapList<String, String> check(String materialField, ISuperVO[] valueObjects) {
MapList<String, String> materialMapList = new MapList<String, String>(); MapList<String, String> materialMapList = new MapList<String, String>();
Map<String, MaterialVO> materialMap = this.getMaterialMap(materialField, valueObjects); Map<String, MaterialVO> materialMap = this.getMaterialMap(materialField, valueObjects);
if (materialMap == null || materialMap.size() == 0) { if (materialMap == null || materialMap.size() == 0) {
@ -939,17 +903,18 @@ public class PickAutoServiceImpl implements IPickAutoService {
Object pk_material = value.getAttributeValue(materialField); Object pk_material = value.getAttributeValue(materialField);
String pk_marasstframe = materialMap.get(pk_material).getPk_marasstframe(); String pk_marasstframe = materialMap.get(pk_material).getPk_marasstframe();
List<Integer> list = marFrameMap.get(pk_marasstframe); List<Integer> list = marFrameMap.get(pk_marasstframe);
if(list==null) { if (list == null) {
continue; continue;
} }
for(Integer listvlaue:list) { for (Integer listvlaue : list) {
if (pk_marasstframe != null) { if (pk_marasstframe != null) {
materialMapList.put(pk_material.toString(), "vfree"+(listvlaue-5)); materialMapList.put(pk_material.toString(), "vfree" + (listvlaue - 5));
} }
} }
} }
return materialMapList; return materialMapList;
} }
private Map<String, List<Integer>> getMarFrameMap(Map<String, MaterialVO> materialMap) { private Map<String, List<Integer>> getMarFrameMap(Map<String, MaterialVO> materialMap) {
Map<String, List<Integer>> marFrameMap = null; Map<String, List<Integer>> marFrameMap = null;
try { try {
@ -960,14 +925,14 @@ public class PickAutoServiceImpl implements IPickAutoService {
marFramePkSet.add(pk_marasstframe); marFramePkSet.add(pk_marasstframe);
} }
} }
marFrameMap = marFrameMap = MarAssistantCheckUtils
MarAssistantCheckUtils.queryMarAsstFrameIncludeDefPropIndex(marFramePkSet .queryMarAsstFrameIncludeDefPropIndex(marFramePkSet.toArray(new String[0]));
.toArray(new String[0]));
} catch (BusinessException e) { } catch (BusinessException e) {
ExceptionUtils.wrappException(e); ExceptionUtils.wrappException(e);
} }
return marFrameMap; return marFrameMap;
} }
private Map<String, MaterialVO> getMaterialMap(String materialField, ISuperVO[] valueObjects) { private Map<String, MaterialVO> getMaterialMap(String materialField, ISuperVO[] valueObjects) {
Map<String, MaterialVO> materialMap = null; Map<String, MaterialVO> materialMap = null;
try { try {
@ -977,38 +942,31 @@ public class PickAutoServiceImpl implements IPickAutoService {
marPkSet.add(pk_material); marPkSet.add(pk_material);
} }
IMaterialPubService_C marService = IMaterialPubService_C marService = NCLocator.getInstance().lookup(IMaterialPubService_C.class);
NCLocator.getInstance().lookup(IMaterialPubService_C.class); materialMap = marService.queryMaterialBaseInfoByPks(marPkSet.toArray(new String[0]),
materialMap = new String[] { MaterialVO.PK_MARASSTFRAME, MaterialVO.NAME, MaterialVO.NAME2, MaterialVO.NAME3,
marService.queryMaterialBaseInfoByPks(marPkSet.toArray(new String[0]), new String[] { MaterialVO.NAME4, MaterialVO.NAME5, MaterialVO.NAME6 });
MaterialVO.PK_MARASSTFRAME, MaterialVO.NAME, MaterialVO.NAME2, MaterialVO.NAME3,
MaterialVO.NAME4, MaterialVO.NAME5, MaterialVO.NAME6});
} catch (BusinessException e) { } catch (BusinessException e) {
ExceptionUtils.wrappException(e); ExceptionUtils.wrappException(e);
} }
return materialMap; return materialMap;
} }
/** /**
* 没有拣到存量的行设置表体备注现存量不足 * 没有拣到存量的行设置表体备注现存量不足
* *
* @param uiBodys * @param uiBodys
* @param results * @param results
*/ */
private void setBodyNoteOnhandErro(ICBillBodyVO[] uiBodys, private void setBodyNoteOnhandErro(ICBillBodyVO[] uiBodys, ICBillPickResults results) {
ICBillPickResults results) {
String errMsg = OnhandRes.getOnhandErro(); String errMsg = OnhandRes.getOnhandErro();
if (results == null) { if (results == null) {
for (int i = 0, loop = uiBodys.length; i < loop; i++) { for (int i = 0, loop = uiBodys.length; i < loop; i++) {
if (null == uiBodys[i] if (null == uiBodys[i].getAttributeValue(ICPubMetaNameConst.CMATERIALVID)) {
.getAttributeValue(ICPubMetaNameConst.CMATERIALVID)) {
continue; continue;
} }
if (!NCBaseTypeUtils.isNullOrZero((UFDouble) uiBodys[i] if (!NCBaseTypeUtils.isNullOrZero((UFDouble) uiBodys[i].getAttributeValue(ICPubMetaNameConst.NNUM))) {
.getAttributeValue(ICPubMetaNameConst.NNUM))) {
continue; continue;
} }
uiBodys[i].setAttributeValue(ICPubMetaNameConst.VNOTEBODY, errMsg); uiBodys[i].setAttributeValue(ICPubMetaNameConst.VNOTEBODY, errMsg);
@ -1026,8 +984,7 @@ public class PickAutoServiceImpl implements IPickAutoService {
if (null == uiBodys[i].getAttributeValue(ICPubMetaNameConst.CMATERIALVID)) { if (null == uiBodys[i].getAttributeValue(ICPubMetaNameConst.CMATERIALVID)) {
continue; continue;
} }
if (!NCBaseTypeUtils.isNullOrZero((UFDouble) uiBodys[i] if (!NCBaseTypeUtils.isNullOrZero((UFDouble) uiBodys[i].getAttributeValue(ICPubMetaNameConst.NNUM))) {
.getAttributeValue(ICPubMetaNameConst.NNUM))) {
continue; continue;
} }
uiBodys[i].setAttributeValue(ICPubMetaNameConst.VNOTEBODY, errMsg); uiBodys[i].setAttributeValue(ICPubMetaNameConst.VNOTEBODY, errMsg);
@ -1036,13 +993,11 @@ public class PickAutoServiceImpl implements IPickAutoService {
} }
private void loadInvCalBodyInfo(ICBillVO billvo) { private void loadInvCalBodyInfo(ICBillVO billvo) {
String pk_org = (String) billvo.getHead().getAttributeValue( String pk_org = (String) billvo.getHead().getAttributeValue(ICPubMetaNameConst.PK_ORG);
ICPubMetaNameConst.PK_ORG);
ICBillBodyVO[] uiBodys = billvo.getBodys(); ICBillBodyVO[] uiBodys = billvo.getBodys();
Set<String> invpks = new HashSet<String>(); Set<String> invpks = new HashSet<String>();
for (int i = 0; i < uiBodys.length; i++) { for (int i = 0; i < uiBodys.length; i++) {
String cmaterialvid = (String) uiBodys[i] String cmaterialvid = (String) uiBodys[i].getAttributeValue(ICPubMetaNameConst.CMATERIALVID);
.getAttributeValue(ICPubMetaNameConst.CMATERIALVID);
if (StringUtil.isSEmptyOrNull(cmaterialvid)) { if (StringUtil.isSEmptyOrNull(cmaterialvid)) {
continue; continue;
} }
@ -1052,8 +1007,8 @@ public class PickAutoServiceImpl implements IPickAutoService {
if (invpks.size() == 0) { if (invpks.size() == 0) {
return; return;
} }
InvBasAndCalInfo[] invInfos = new ICBSContext().getInvInfo() InvBasAndCalInfo[] invInfos = new ICBSContext().getInvInfo().getInvBasAndCalInfo(pk_org,
.getInvBasAndCalInfo(pk_org, invpks.toArray(new String[0])); invpks.toArray(new String[0]));
if (invInfos == null || invInfos.length == 0) { if (invInfos == null || invInfos.length == 0) {
return; return;
} }
@ -1062,8 +1017,7 @@ public class PickAutoServiceImpl implements IPickAutoService {
this.invInfoMap = this.setInvBasInfosToMap(invInfos); this.invInfoMap = this.setInvBasInfosToMap(invInfos);
} }
private Map<String, InvBasAndCalInfo> setInvBasInfosToMap( private Map<String, InvBasAndCalInfo> setInvBasInfosToMap(InvBasAndCalInfo[] invInfos) {
InvBasAndCalInfo[] invInfos) {
Map<String, InvBasAndCalInfo> infoMap = new HashMap<String, InvBasAndCalInfo>(); Map<String, InvBasAndCalInfo> infoMap = new HashMap<String, InvBasAndCalInfo>();
for (InvBasAndCalInfo info : invInfos) { for (InvBasAndCalInfo info : invInfos) {
// BUG:如果没有分配到库存组织就跳过否则会报错 // BUG:如果没有分配到库存组织就跳过否则会报错
@ -1088,13 +1042,11 @@ public class PickAutoServiceImpl implements IPickAutoService {
List<String> invpks = new ArrayList<String>(); List<String> invpks = new ArrayList<String>();
List<String> measpks = new ArrayList<String>(); List<String> measpks = new ArrayList<String>();
for (int i = 0; i < bodyvos.length; i++) { for (int i = 0; i < bodyvos.length; i++) {
String invpk = (String) bodyvos[i] String invpk = (String) bodyvos[i].getAttributeValue(ICPubMetaNameConst.CMATERIALVID);
.getAttributeValue(ICPubMetaNameConst.CMATERIALVID);
if (StringUtil.isSEmptyOrNull(invpk)) { if (StringUtil.isSEmptyOrNull(invpk)) {
continue; continue;
} }
String measpk = (String) bodyvos[i] String measpk = (String) bodyvos[i].getAttributeValue(ICPubMetaNameConst.CASTUNITID);
.getAttributeValue(ICPubMetaNameConst.CASTUNITID);
; ;
if (StringUtil.isSEmptyOrNull(measpk)) { if (StringUtil.isSEmptyOrNull(measpk)) {
continue; continue;
@ -1107,8 +1059,7 @@ public class PickAutoServiceImpl implements IPickAutoService {
} }
} }
InvMeasVO[] invmeasvos = new ICBSContext().getInvInfo().getInvMeasVO( InvMeasVO[] invmeasvos = new ICBSContext().getInvInfo().getInvMeasVO(invpks.toArray(new String[invpks.size()]),
invpks.toArray(new String[invpks.size()]),
measpks.toArray(new String[measpks.size()])); measpks.toArray(new String[measpks.size()]));
Map<String, UFBoolean> bastunitstore = new HashMap<String, UFBoolean>(); Map<String, UFBoolean> bastunitstore = new HashMap<String, UFBoolean>();
if (invmeasvos != null) { if (invmeasvos != null) {
@ -1127,6 +1078,7 @@ public class PickAutoServiceImpl implements IPickAutoService {
/** /**
* 同步序列号档案上信息到孙表 * 同步序列号档案上信息到孙表
*
* @param billvo * @param billvo
* @param results * @param results
* *

View File

@ -177,6 +177,8 @@ public class ICAPILocationVOUtils {
} }
lvo.setClocationid(rackvo.getPk_rack()); lvo.setClocationid(rackvo.getPk_rack());
bodyvo.setClocationid(rackvo.getPk_rack());
} }
// ÉèÖÃÐòÁкÅÖ÷¼ü // ÉèÖÃÐòÁкÅÖ÷¼ü
String vserialcode = lvo.getVserialcode(); String vserialcode = lvo.getVserialcode();