fix:修改冲销
This commit is contained in:
parent
1d8aaf6e16
commit
d195633ab6
@ -97,6 +97,8 @@ public class MaterialUndoController {
|
|||||||
materialUndoServiceImpl.orderUndo(undoId, userId,commitDate);
|
materialUndoServiceImpl.orderUndo(undoId, userId,commitDate);
|
||||||
} else if (inv_TYPE.contains("ZLF")) { // 销售发货出库
|
} else if (inv_TYPE.contains("ZLF")) { // 销售发货出库
|
||||||
materialUndoServiceImpl.orderUndo(undoId, userId,commitDate);
|
materialUndoServiceImpl.orderUndo(undoId, userId,commitDate);
|
||||||
|
} else if (inv_TYPE.contains("无来源转库")) { // 无来源转库
|
||||||
|
materialUndoServiceImpl.wlyZkUndo(undoId, userId,preErpLocation,preLocationName);
|
||||||
} else {
|
} else {
|
||||||
return AjaxResult.me().setSuccess(false).setMessage("单据类型不支持冲销");
|
return AjaxResult.me().setSuccess(false).setMessage("单据类型不支持冲销");
|
||||||
}
|
}
|
||||||
|
@ -3364,7 +3364,7 @@ public class InvoiceServiceImpl implements InvoiceService {
|
|||||||
pakHashMap.put("shipRequestName", "");
|
pakHashMap.put("shipRequestName", "");
|
||||||
pakHashMap.put("shipRequestDetailName", "");
|
pakHashMap.put("shipRequestDetailName", "");
|
||||||
|
|
||||||
EventInfo eventInfo = new EventInfoUtil().makeEventInfo("备货出库拆分条码", eventUser, "拆分条码");
|
EventInfo eventInfo = new EventInfoUtil().makeEventInfo("拆分条码", eventUser, "备货出库拆分条码");
|
||||||
setEventInfo.setUserColumns(pakHashMap);
|
setEventInfo.setUserColumns(pakHashMap);
|
||||||
MaterialPackingServiceProxy.getMaterialPackingService().setEvent(new MaterialPackingKey( "SDK", MATERIALPACKINGNAME), eventInfo, setEventInfo);
|
MaterialPackingServiceProxy.getMaterialPackingService().setEvent(new MaterialPackingKey( "SDK", MATERIALPACKINGNAME), eventInfo, setEventInfo);
|
||||||
|
|
||||||
@ -3385,6 +3385,7 @@ public class InvoiceServiceImpl implements InvoiceService {
|
|||||||
" t.MATERIALSPECNAME,m.MATERIALPACKINGNAME,\r\n" +
|
" t.MATERIALSPECNAME,m.MATERIALPACKINGNAME,\r\n" +
|
||||||
" t.ERPFACTORY,\r\n" +
|
" t.ERPFACTORY,\r\n" +
|
||||||
" t.ERPLOCATION,\r\n" +
|
" t.ERPLOCATION,\r\n" +
|
||||||
|
" t.LOCATIONNAME,\r\n" +
|
||||||
" m2.SHIPREQUESTDETAILTYPE,\r\n" +
|
" m2.SHIPREQUESTDETAILTYPE,\r\n" +
|
||||||
" t.UNIT,\r\n" +
|
" t.UNIT,\r\n" +
|
||||||
" m1.COSTCENTER,\r\n" +
|
" m1.COSTCENTER,\r\n" +
|
||||||
@ -3448,6 +3449,22 @@ public class InvoiceServiceImpl implements InvoiceService {
|
|||||||
SUBList.add(materialPackingName);
|
SUBList.add(materialPackingName);
|
||||||
MaterialPackingKey materialPackingKey = new MaterialPackingKey("SDK",materialPackingName);
|
MaterialPackingKey materialPackingKey = new MaterialPackingKey("SDK",materialPackingName);
|
||||||
arrayList.add(materialPackingKey);
|
arrayList.add(materialPackingKey);
|
||||||
|
|
||||||
|
// 更新MATERIALPACKING表前仓库货位为现在货位和仓库数据,保存现仓库货位
|
||||||
|
Map<String, Object> row = ZKqueryForList.get(z);
|
||||||
|
String erpLocation = row.get("ERPLOCATION") == null ? "" : row.get("ERPLOCATION").toString();
|
||||||
|
String locationName = row.get("LOCATIONNAME") == null ? "" : row.get("LOCATIONNAME").toString();
|
||||||
|
String updSql = "UPDATE MATERIALPACKING SET PREERPLOCATION = :PREERPLOCATION, PRELOCATIONNAME = :PRELOCATIONNAME WHERE MATERIALPACKINGNAME = :MATERIALPACKINGNAME";
|
||||||
|
Map<String, Object> updHashMap = new HashMap<>();
|
||||||
|
updHashMap.put("PREERPLOCATION", erpLocation);
|
||||||
|
updHashMap.put("PRELOCATIONNAME", locationName);
|
||||||
|
updHashMap.put("MATERIALPACKINGNAME", materialPackingName);
|
||||||
|
try {
|
||||||
|
IDMFrameServiceProxy.getSqlTemplate().update(updSql, updHashMap);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 日志记录并抛出自定义异常,便于调试和事务回滚
|
||||||
|
throw new CustomException("更新仓库货位信息失败: " + materialPackingName, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
billCode = UnSourcedChangeLocation(arrayList,ERPRECEIVEFACTORY,
|
billCode = UnSourcedChangeLocation(arrayList,ERPRECEIVEFACTORY,
|
||||||
ERPRECEIVELOCATION, "", eventUser, commitDate );
|
ERPRECEIVELOCATION, "", eventUser, commitDate );
|
||||||
@ -3477,10 +3494,11 @@ public class InvoiceServiceImpl implements InvoiceService {
|
|||||||
}else {
|
}else {
|
||||||
throw new GlobalException("发送到mes失败!");
|
throw new GlobalException("发送到mes失败!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
makeEventInfo.setEventName("备货出库无来源转库");
|
||||||
WlySaveUnDoInfo( billCode,commitDate);
|
makeEventInfo.setEventComment("备货出库无来源转库");
|
||||||
|
// WlySaveUnDoInfo( billCode,commitDate);
|
||||||
|
untils.SaveUnDoInfo_ForSap(materialPackingKeyList, billCode, makeEventInfo);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -372,6 +372,87 @@ public class MaterialUndoServiceImpl implements IMaterialUndoService {
|
|||||||
// 更新凭证冲销状态
|
// 更新凭证冲销状态
|
||||||
MaterialReversalDao.updateReversalUnDoId(undoId);
|
MaterialReversalDao.updateReversalUnDoId(undoId);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 无来源转库
|
||||||
|
* @param undoId
|
||||||
|
* @param user
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
public void wlyZkUndo (String undoId, String user,String preErpLocation,String preLocationName) throws Exception {
|
||||||
|
|
||||||
|
String billCode = toSAPService.cancelShipInter(undoId, user);
|
||||||
|
if (billCode == null) {
|
||||||
|
throw new GlobalException("报送ERP失败,请联系IT处理!");
|
||||||
|
}
|
||||||
|
|
||||||
|
EventInfo makeEventInfo = new EventInfoUtil().makeEventInfo("冲销无来源转库", user, "冲销无来源转库");
|
||||||
|
String condition="WHERE UNDOID =? ";
|
||||||
|
String[] bindSet={undoId};
|
||||||
|
//根据物料凭证找到所有的待冲销数据,更新库存状态为创建
|
||||||
|
List<MaterialPacking> list = MaterialPackingServiceProxy.getMaterialPackingService().select(condition, bindSet);
|
||||||
|
SetEventInfo setEventInfo = new SetEventInfo();
|
||||||
|
|
||||||
|
|
||||||
|
for (MaterialPacking materialPacking : list) {
|
||||||
|
Map<String, Object> hashMap = new HashMap<String, Object> ();
|
||||||
|
hashMap.put("erpLocation", preErpLocation);
|
||||||
|
hashMap.put("locationName", preLocationName);
|
||||||
|
// hashMap.put("preErpLocation", materialPacking.getErpLocation());
|
||||||
|
// hashMap.put("preLocationName", materialPacking.getLocationName());
|
||||||
|
setEventInfo.setUserColumns(hashMap);
|
||||||
|
MaterialPackingKey key = materialPacking.getKey();
|
||||||
|
MaterialPackingServiceProxy.getMaterialPackingService().setEvent(key, makeEventInfo, setEventInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (MaterialPacking materialPackingSplit : list) {
|
||||||
|
|
||||||
|
String MATERIALPACKINGNAME1 = materialPackingSplit.getMaterialPackingName().toString();
|
||||||
|
String CHARGE = materialPackingSplit.getCharge();
|
||||||
|
|
||||||
|
Map<String, Object> hashMapsplit = new HashMap<String, Object> ();
|
||||||
|
hashMapsplit.put("MATERIALPACKINGNAME", MATERIALPACKINGNAME1);
|
||||||
|
// 如果是拆分批次
|
||||||
|
if ("Y".equals(materialPackingSplit.getSplit())) {
|
||||||
|
|
||||||
|
// 如果不是辅材出库,则合并批次数量并删除拆分的批次和sub
|
||||||
|
if(!CHARGE.isEmpty()) {
|
||||||
|
// 拆分的批次数量
|
||||||
|
Double spitMaterialQuantity = materialPackingSplit.getMaterialQuantity();
|
||||||
|
// 查出非拆分的原批次
|
||||||
|
String NsplitCondition="WHERE charge =? AND split IS NULL";
|
||||||
|
String[] NspliBindSet={CHARGE};
|
||||||
|
//
|
||||||
|
List<MaterialPacking> noSplitList = MaterialPackingServiceProxy.getMaterialPackingService().select(NsplitCondition, NspliBindSet);
|
||||||
|
String NoSMaterialPackingName = noSplitList.get(0).getMaterialPackingName();
|
||||||
|
|
||||||
|
// 存在原批次
|
||||||
|
if(!NoSMaterialPackingName.isEmpty()) {
|
||||||
|
MaterialPackingKey noSKey = noSplitList.get(0).getKey();
|
||||||
|
// 原批次数量
|
||||||
|
Double NoPMaterialQuantity = noSplitList.get(0).getMaterialQuantity();
|
||||||
|
Map<String, Object> hashMapNosplit = new HashMap<String, Object> ();
|
||||||
|
|
||||||
|
//累加数量
|
||||||
|
hashMapNosplit.put("materialQuantity", NoPMaterialQuantity + spitMaterialQuantity);
|
||||||
|
setEventInfo.setUserColumns(hashMapNosplit);
|
||||||
|
MaterialPackingServiceProxy.getMaterialPackingService().setEvent(noSKey, makeEventInfo, setEventInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
String delSplitSql = "DELETE FROM MATERIALPACKING WHERE MATERIALPACKINGNAME = :MATERIALPACKINGNAME";
|
||||||
|
// 删除拆分出的批次
|
||||||
|
IDMFrameServiceProxy.getSqlTemplate().update(delSplitSql, hashMapsplit);
|
||||||
|
}
|
||||||
|
//如果是辅材、更新为在库,删除sub,不是辅材 删除sub
|
||||||
|
String delSubSql = "DELETE FROM MATERIALPACKINGSUB WHERE MATERIALPACKINGNAME = :MATERIALPACKINGNAME";
|
||||||
|
IDMFrameServiceProxy.getSqlTemplate().update(delSubSql, hashMapsplit);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新凭证冲销状态
|
||||||
|
MaterialReversalDao.updateReversalUnDoId(undoId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 质检结果
|
* 质检结果
|
||||||
|
Loading…
x
Reference in New Issue
Block a user