|
|
|
@ -1,12 +1,17 @@
|
|
|
|
|
package com.foreverwin.mesnac.dispatch.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.foreverwin.mesnac.common.constant.Constants;
|
|
|
|
|
import com.foreverwin.mesnac.common.enums.HandleEnum;
|
|
|
|
|
import com.foreverwin.mesnac.common.model.PrintLog;
|
|
|
|
|
import com.foreverwin.mesnac.common.service.PrintLogService;
|
|
|
|
|
import com.foreverwin.mesnac.common.util.ExceptionUtil;
|
|
|
|
|
import com.foreverwin.mesnac.common.util.NumberUtil;
|
|
|
|
|
import com.foreverwin.mesnac.common.util.StringUtil;
|
|
|
|
|
import com.foreverwin.mesnac.dispatch.model.SurplusInventory;
|
|
|
|
|
import com.foreverwin.mesnac.dispatch.service.SurplusInventoryService;
|
|
|
|
|
import com.foreverwin.mesnac.meapi.model.Inventory;
|
|
|
|
|
import com.foreverwin.mesnac.meapi.model.InventoryAssyData;
|
|
|
|
|
import com.foreverwin.mesnac.meapi.service.InventoryAssyDataService;
|
|
|
|
|
import com.foreverwin.mesnac.meapi.service.InventoryService;
|
|
|
|
|
import com.foreverwin.modular.core.exception.BusinessException;
|
|
|
|
@ -51,7 +56,10 @@ public class SurplusReturnServiceImpl extends ServiceImpl<SurplusReturnMapper, S
|
|
|
|
|
private SurplusReturnMapper surplusReturnMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private SurplusInventoryService surplusInventoryService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private PrintLogService printLogService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private InventoryAssyDataService inventoryAssyDataService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getInventoryData(String site, String inventory) {
|
|
|
|
@ -181,5 +189,35 @@ public class SurplusReturnServiceImpl extends ServiceImpl<SurplusReturnMapper, S
|
|
|
|
|
surplusItemReturn.setModifyUser(user);
|
|
|
|
|
surplusItemReturn.setModifiedDateTime(dateTime);
|
|
|
|
|
surplusReturnMapper.insert(surplusItemReturn);
|
|
|
|
|
|
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
// 记录余料信息,提供打印
|
|
|
|
|
// {"ITEM":"500100010001","INVENTORY":"500100010001*20210721","ITEM_DESC":"测试物料","SUPPLIER":"BA002"}
|
|
|
|
|
PrintLog printLog = new PrintLog();
|
|
|
|
|
printLog.setHandle(UUID.randomUUID().toString());
|
|
|
|
|
printLog.setSfc(site);
|
|
|
|
|
printLog.setCategory(Constants.PRINT_TYPE_EXM);
|
|
|
|
|
printLog.setPrintTemplate(Constants.PRINT_TYPE_EXM);
|
|
|
|
|
//打印模板参数
|
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
|
|
jsonObject.put("ITEM", inventoryModel.getItemBo().split(",")[1]); // 物料编号
|
|
|
|
|
jsonObject.put("ITEM_DESC", inventoryModel.getDescription()); // 物料描述
|
|
|
|
|
InventoryAssyData inventoryAssyData = new InventoryAssyData();
|
|
|
|
|
inventoryAssyData.setInventoryBo(inventoryBo);
|
|
|
|
|
inventoryAssyData.setDataField("VENDOR_NAME");
|
|
|
|
|
List<InventoryAssyData> inventoryAssyDataList = inventoryAssyDataService.selectList(inventoryAssyData);
|
|
|
|
|
if (inventoryAssyDataList.size() == 1){
|
|
|
|
|
jsonObject.put("SUPPLIER", inventoryAssyDataList.get(0).getDataAttr()); // 供应商
|
|
|
|
|
}else {
|
|
|
|
|
throw BusinessException.build("未正确找到当前批次的供应商!");
|
|
|
|
|
}
|
|
|
|
|
jsonObject.put("INVENTORY", surplusInventory); // 批次号
|
|
|
|
|
printLog.setPrintParam(jsonObject.toString());
|
|
|
|
|
printLog.setInventory(surplusInventory);
|
|
|
|
|
printLog.setItemBo(inventoryModel.getItemBo());
|
|
|
|
|
//printLog.setIsPrint("false");
|
|
|
|
|
printLog.setCreateUser(user);
|
|
|
|
|
printLog.setCreatedDateTime(dateTime);
|
|
|
|
|
printLogService.save(printLog);
|
|
|
|
|
}
|
|
|
|
|
}
|