优化入库单|Excel创建方法的命名
This commit is contained in:
parent
82e3d665df
commit
fa1fd09170
|
|
@ -17,7 +17,7 @@ spring:
|
|||
# password: Tony123
|
||||
url: jdbc:mysql://localhost:3306/leader_wms?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true
|
||||
username: root
|
||||
password: 123456
|
||||
password: root
|
||||
# # 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ server:
|
|||
|
||||
logging:
|
||||
level:
|
||||
com.zbf: debug
|
||||
com.zbf: info
|
||||
org.springframework: warn
|
||||
org.quartz: warn
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
package com.zbf.common.enums.custom;
|
||||
|
||||
/**
|
||||
* 入库通知单明细启停状态
|
||||
*/
|
||||
public enum InboundNoticeTabStatus
|
||||
{
|
||||
ENABLED("0", "启用"),
|
||||
DISABLED("1", "停用");
|
||||
|
||||
private final String code;
|
||||
private final String description;
|
||||
|
||||
InboundNoticeTabStatus(String code, String description)
|
||||
{
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
}
|
||||
|
|
@ -36,7 +36,6 @@ import org.springframework.stereotype.Component;
|
|||
import shade.com.alibaba.fastjson2.JSONArray;
|
||||
import shade.com.alibaba.fastjson2.JSONObject;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
|
@ -93,7 +92,7 @@ public class D_Service {
|
|||
* @param*/
|
||||
|
||||
|
||||
@PostConstruct
|
||||
// @PostConstruct
|
||||
public void initToken() {
|
||||
try {
|
||||
oauth2Client = createOauth2Client();
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
package com.zbf.system.domain;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.zbf.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.zbf.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 入库通知单明细更新参数
|
||||
|
|
@ -22,68 +22,110 @@ import java.util.Map;
|
|||
public class TRkWareNoticeTabUpdate extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 通知单主键ID */
|
||||
/**
|
||||
* 通知单主键ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/** 通知单ID */
|
||||
/**
|
||||
* 通知单ID
|
||||
*/
|
||||
private String noticeId;
|
||||
|
||||
/**来源单号 */
|
||||
/**
|
||||
* 来源单号
|
||||
*/
|
||||
private String deliveryId;
|
||||
|
||||
/** 仓库ID */
|
||||
/**
|
||||
* 仓库ID
|
||||
*/
|
||||
private String storageId;
|
||||
/** 仓库ID */
|
||||
/**
|
||||
* 仓库ID
|
||||
*/
|
||||
private String storageShortName;
|
||||
|
||||
/** 库位 */
|
||||
/**
|
||||
* 库位
|
||||
*/
|
||||
private String storageLocation;
|
||||
|
||||
/** 库区 */
|
||||
/**
|
||||
* 库区
|
||||
*/
|
||||
private String storageAreaId;
|
||||
|
||||
/** 入库类型 */
|
||||
/**
|
||||
* 入库类型
|
||||
*/
|
||||
private String storageMode;
|
||||
|
||||
/** 用户账号 */
|
||||
/**
|
||||
* 用户账号
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
private Map<String, String> extras = new HashMap<>();
|
||||
|
||||
/** 手持用字段 */
|
||||
/**
|
||||
* 手持用字段
|
||||
*/
|
||||
private String recordPerson;
|
||||
|
||||
/** 托盘号 */
|
||||
/**
|
||||
* 托盘号
|
||||
*/
|
||||
private String ctlNo;
|
||||
|
||||
/** 部门ID */
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
private Long deptId;
|
||||
|
||||
/**物料编码 */
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
private String goodsId;
|
||||
|
||||
/**物料名称 */
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
private String goodsName;
|
||||
|
||||
/**打印条码数量 */
|
||||
/**
|
||||
* 打印条码数量
|
||||
*/
|
||||
private int printNum;
|
||||
|
||||
/**收货数量 */
|
||||
/**
|
||||
* 收货数量
|
||||
*/
|
||||
private int receiveNum;
|
||||
|
||||
/**子需求编号 */
|
||||
/**
|
||||
* 子需求编号
|
||||
*/
|
||||
private String salesOrderNumber;
|
||||
|
||||
/**虚拟收货 */
|
||||
/**
|
||||
* 虚拟收货
|
||||
*/
|
||||
private String fictitious;
|
||||
|
||||
/**规格型号 */
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
private String specification;
|
||||
|
||||
/** 通知单明细 */
|
||||
/**
|
||||
* 通知单明细
|
||||
*/
|
||||
private List<TRkWareNoticeTab> trkWareNoticeTabList;
|
||||
|
||||
/** 入库任务明细 */
|
||||
/**
|
||||
* 入库任务明细
|
||||
*/
|
||||
private List<TOngoodsshelf> tOngoodsshelfList;
|
||||
|
||||
private String rkMxId;
|
||||
|
|
|
|||
|
|
@ -12,9 +12,11 @@ import com.zbf.common.enums.custom.InboundLevelType;
|
|||
import com.zbf.common.enums.custom.InboundNoticeReceivingStatus;
|
||||
import com.zbf.common.enums.custom.InboundNoticeTabInStatus;
|
||||
import com.zbf.common.enums.custom.InboundNoticeTabReceivingStatus;
|
||||
import com.zbf.common.enums.custom.InboundNoticeTabStatus;
|
||||
import com.zbf.common.enums.custom.InboundOngoodsshelfInStatus;
|
||||
import com.zbf.common.enums.custom.InboundResourceLockStatus;
|
||||
import com.zbf.common.enums.custom.InboundResourceOccupancyStatus;
|
||||
import com.zbf.common.enums.custom.InboundStorageMode;
|
||||
import com.zbf.common.enums.custom.InboundTaskStatus;
|
||||
import com.zbf.common.enums.custom.InboundTaskType;
|
||||
import com.zbf.common.exception.ServiceException;
|
||||
|
|
@ -1710,8 +1712,9 @@ public class TRkWareNoticeServiceImpl extends ServiceImpl<TRkWareNoticeMapper, T
|
|||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
// 入库流程
|
||||
public String importData(List<TRkWareNoticeTab> importedNoticeTabs, boolean isUpdateSupport, String operName) {
|
||||
if (StringUtils.isNull(importedNoticeTabs) || importedNoticeTabs.size() == 0) {
|
||||
if (StringUtils.isNull(importedNoticeTabs) || importedNoticeTabs.isEmpty()) {
|
||||
throw new ServiceException("导入入库通知单数据不能为空!");
|
||||
}
|
||||
int successCount = 0;
|
||||
|
|
@ -1721,18 +1724,12 @@ public class TRkWareNoticeServiceImpl extends ServiceImpl<TRkWareNoticeMapper, T
|
|||
TRkWareNoticeTab firstImportedNoticeTab = importedNoticeTabs.get(0);
|
||||
TRkWareNotice importedNotice = new TRkWareNotice();
|
||||
|
||||
//来源单号生成
|
||||
Random random = new Random();
|
||||
|
||||
// 生成一个1000到9999之间的随机数
|
||||
// int randomFourDigit = 1000 + random.nextInt(9000);
|
||||
|
||||
importedNotice.setDeliveryId(firstImportedNoticeTab.getDeliveryId());
|
||||
List<TRkWareNotice> duplicateNotices = tRkWareNoticeMapper.selectTRkWareNoticeList(importedNotice);
|
||||
if (duplicateNotices.size() == 0) {
|
||||
if (duplicateNotices.isEmpty()) {
|
||||
setTrkNotice(importedNotice, firstImportedNoticeTab, operName);
|
||||
importedNotice.setReceivingStatus("0");
|
||||
importedNotice.setStorageMode("1");
|
||||
importedNotice.setReceivingStatus(InboundNoticeReceivingStatus.CREATED.getCode());
|
||||
importedNotice.setStorageMode(InboundStorageMode.STANDARD.getCode());
|
||||
tRkWareNoticeMapper.insertTRkWareNotice(importedNotice);
|
||||
|
||||
} else if (isUpdateSupport) {
|
||||
|
|
@ -1752,20 +1749,19 @@ public class TRkWareNoticeServiceImpl extends ServiceImpl<TRkWareNoticeMapper, T
|
|||
TRkWareNoticeTab importedNoticeTab = importedNoticeTabs.get(importIndex);
|
||||
validateImportedNoticeTab(importIndex, importedNoticeTab);
|
||||
// 验证是否存在该明细
|
||||
// importedNoticeTab.setDeliveryId(importedNoticeTab.getDeliveryId());
|
||||
TRkWareNoticeTab noticeTabQuery = new TRkWareNoticeTab();
|
||||
noticeTabQuery.setSalesOrderNumber(importedNoticeTab.getSalesOrderNumber());
|
||||
noticeTabQuery.setGoodsId(importedNoticeTab.getGoodsId());
|
||||
noticeTabQuery.setReceivingStatus("0");
|
||||
noticeTabQuery.setInStatus("0");
|
||||
importedNoticeTab.setDataSource("二级库");
|
||||
noticeTabQuery.setDataSource("二级库");
|
||||
noticeTabQuery.setReceivingStatus(InboundNoticeTabReceivingStatus.PENDING.getCode());
|
||||
noticeTabQuery.setInStatus(InboundNoticeTabInStatus.INITIAL.getCode());
|
||||
noticeTabQuery.setDataSource(InboundLevelType.LEVEL_TWO.getDescription());
|
||||
|
||||
importedNoticeTab.setLevelType("2");
|
||||
importedNoticeTab.setLevelType(InboundLevelType.LEVEL_TWO.getCode());
|
||||
importedNoticeTab.setDataSource(InboundLevelType.LEVEL_TWO.getDescription());
|
||||
|
||||
List<TRkWareNoticeTab> duplicateNoticeTabs = tRkWareNoticeTabMapper.selectTRkWareNoticeTabList(noticeTabQuery);
|
||||
|
||||
if (duplicateNoticeTabs.size() == 0) {
|
||||
if (duplicateNoticeTabs.isEmpty()) {
|
||||
initializeNoticeTabForInsert(importedNoticeTab, importedNotice.getId(), operName);
|
||||
importedNoticeTab.setDeliveryId(firstImportedNoticeTab.getDeliveryId());
|
||||
importedNoticeTab.setSourceNum(firstImportedNoticeTab.getDeliveryId());
|
||||
|
|
@ -1814,8 +1810,9 @@ public class TRkWareNoticeServiceImpl extends ServiceImpl<TRkWareNoticeMapper, T
|
|||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
// 入库流程
|
||||
public String importExcelData(List<TRkWareNoticeTabExcel> importedExcelNoticeTabs, boolean isUpdateSupport, String operName) {
|
||||
if (StringUtils.isNull(importedExcelNoticeTabs) || importedExcelNoticeTabs.size() == 0) {
|
||||
if (StringUtils.isNull(importedExcelNoticeTabs) || importedExcelNoticeTabs.isEmpty()) {
|
||||
throw new ServiceException("导入入库通知单数据不能为空!");
|
||||
}
|
||||
int successCount = 0;
|
||||
|
|
@ -1825,54 +1822,44 @@ public class TRkWareNoticeServiceImpl extends ServiceImpl<TRkWareNoticeMapper, T
|
|||
TRkWareNoticeTabExcel firstImportedNoticeTab = importedExcelNoticeTabs.get(0);
|
||||
TRkWareNotice importedNotice = new TRkWareNotice();
|
||||
|
||||
//来源单号生成
|
||||
Random random = new Random();
|
||||
|
||||
// 生成一个1000到9999之间的随机数
|
||||
// int randomFourDigit = 1000 + random.nextInt(9000);
|
||||
//一级库发货单号唯一
|
||||
importedNotice.setDeliveryId(firstImportedNoticeTab.getPurchaseId());
|
||||
List<TRkWareNotice> duplicateNotices = tRkWareNoticeMapper.selectTRkWareNoticeList(importedNotice);
|
||||
if (duplicateNotices.size() == 0) {
|
||||
if (duplicateNotices.isEmpty()) {
|
||||
setExcelTrkNotice(importedNotice, firstImportedNoticeTab, operName);
|
||||
importedNotice.setReceivingStatus("0");
|
||||
importedNotice.setStorageMode("1");
|
||||
importedNotice.setReceivingStatus(InboundNoticeReceivingStatus.CREATED.getCode());
|
||||
importedNotice.setStorageMode(InboundStorageMode.STANDARD.getCode());
|
||||
tRkWareNoticeMapper.insertTRkWareNotice(importedNotice);
|
||||
|
||||
// TRkWareNotice notice2 = new TRkWareNotice();
|
||||
// notice2.setId(tRkWareNotice.getId());
|
||||
// notice2.setCreateBy(operName);
|
||||
// tRkWareNoticeMapper.updateTRkWareNotice(notice2);
|
||||
|
||||
} else if (isUpdateSupport) {
|
||||
List<String> noticeIdsToDelete = duplicateNotices.stream().map(TRkWareNotice::getId).collect(Collectors.toList());
|
||||
tRkWareNoticeMapper.deleteTRkWareNoticeByIds(noticeIdsToDelete.toArray(new String[noticeIdsToDelete.size()]));
|
||||
setExcelTrkNotice(importedNotice, firstImportedNoticeTab, operName);
|
||||
importedNotice.setReceivingStatus("0");
|
||||
importedNotice.setStorageMode("1");
|
||||
importedNotice.setReceivingStatus(InboundNoticeReceivingStatus.CREATED.getCode());
|
||||
importedNotice.setStorageMode(InboundStorageMode.STANDARD.getCode());
|
||||
tRkWareNoticeMapper.insertTRkWareNotice(importedNotice);
|
||||
|
||||
} else {
|
||||
throw new ServiceException("来源单号 " + firstImportedNoticeTab.getDeliveryId() + " 重复导入异常!");
|
||||
}
|
||||
|
||||
for (int importIndex = 0; importIndex < importedExcelNoticeTabs.size(); importIndex++) {
|
||||
for (TRkWareNoticeTabExcel importedExcelNoticeTab : importedExcelNoticeTabs) {
|
||||
try {
|
||||
|
||||
//校验必输字段
|
||||
TRkWareNoticeTabExcel importedExcelNoticeTab = importedExcelNoticeTabs.get(importIndex);
|
||||
// 校验必输字段
|
||||
// validateImportedNoticeTab(importIndex, importedExcelNoticeTab);
|
||||
// 验证是否存在该明细
|
||||
importedExcelNoticeTab.setDeliveryId(importedExcelNoticeTab.getPurchaseId());
|
||||
|
||||
TRkWareNoticeTab noticeTabQuery = new TRkWareNoticeTab();
|
||||
noticeTabQuery.setSalesOrderNumber(importedExcelNoticeTab.getSalesOrderNumber());
|
||||
noticeTabQuery.setGoodsId(importedExcelNoticeTab.getGoodsId());
|
||||
noticeTabQuery.setReceivingStatus("0");
|
||||
noticeTabQuery.setInStatus("0");
|
||||
noticeTabQuery.setDataSource("一级库");
|
||||
noticeTabQuery.setReceivingStatus(InboundNoticeTabReceivingStatus.PENDING.getCode());
|
||||
noticeTabQuery.setInStatus(InboundNoticeTabInStatus.INITIAL.getCode());
|
||||
noticeTabQuery.setDataSource(InboundLevelType.LEVEL_ONE.getDescription());
|
||||
|
||||
importedExcelNoticeTab.setDataSource("一级库");
|
||||
importedExcelNoticeTab.setLevelType("1");
|
||||
importedExcelNoticeTab.setDataSource(InboundLevelType.LEVEL_ONE.getDescription());
|
||||
importedExcelNoticeTab.setLevelType(InboundLevelType.LEVEL_ONE.getCode());
|
||||
importedExcelNoticeTab.setDeliveryId(importedExcelNoticeTab.getPurchaseId());
|
||||
|
||||
SimpleDateFormat originalFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US);
|
||||
SimpleDateFormat targetFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
|
@ -1887,27 +1874,19 @@ public class TRkWareNoticeServiceImpl extends ServiceImpl<TRkWareNoticeMapper, T
|
|||
importedExcelNoticeTab.setPlanDate(formattedPlanDate);
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
|
||||
// e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
TRkWareNoticeTab noticeTabToInsert = new TRkWareNoticeTab();
|
||||
BeanUtils.copyProperties(importedExcelNoticeTab, noticeTabToInsert);
|
||||
List<TRkWareNoticeTab> duplicateNoticeTabs = tRkWareNoticeTabMapper.selectTRkWareNoticeTabList(noticeTabQuery);
|
||||
noticeTabToInsert.setDeliveryId(firstImportedNoticeTab.getDeliveryId());
|
||||
noticeTabToInsert.setSourceNum(firstImportedNoticeTab.getDeliveryId());
|
||||
if (duplicateNoticeTabs.size() == 0) {
|
||||
List<TRkWareNoticeTab> duplicateNoticeTabs = tRkWareNoticeTabMapper.selectTRkWareNoticeTabList(noticeTabQuery);
|
||||
if (duplicateNoticeTabs.isEmpty()) {
|
||||
logger.info("createBy:{}", noticeTabToInsert.getCreateBy());
|
||||
initializeNoticeTabForInsert(noticeTabToInsert, importedNotice.getId(), operName);
|
||||
noticeTabToInsert.setReceivingNum(importedExcelNoticeTab.getArraMount());
|
||||
logger.info("createBy:{}", noticeTabToInsert.getCreateBy());
|
||||
tRkWareNoticeTabMapper.insertTRkWareNoticeTab(noticeTabToInsert);
|
||||
// TRkWareNoticeTab noticeTabToUpdate = new TRkWareNoticeTab();
|
||||
// noticeTabToUpdate.setId(noticeTabToInsert.getId());
|
||||
// noticeTabToUpdate.setCreateBy(operName);
|
||||
// tRkWareNoticeTabMapper.updateTRkWareNoticeTab(noticeTabToUpdate);
|
||||
// logger.info("createBy:{}", noticeTabToInsert.getCreateBy());
|
||||
successCount++;
|
||||
successMessage.append("<br/>" + successCount + "、物料编号 " + importedExcelNoticeTab.getGoodsId() + " 导入成功");
|
||||
} else if (isUpdateSupport) {
|
||||
|
|
@ -1943,8 +1922,8 @@ public class TRkWareNoticeServiceImpl extends ServiceImpl<TRkWareNoticeMapper, T
|
|||
noticeTabToInsert.setId(OrderCodeFactory.getOrderCode("", ""));
|
||||
noticeTabToInsert.setNoticeId(noticeId);
|
||||
noticeTabToInsert.setCreateBy(operName);
|
||||
noticeTabToInsert.setInStatus("0");
|
||||
noticeTabToInsert.setStatus("0");
|
||||
noticeTabToInsert.setInStatus(InboundNoticeTabInStatus.INITIAL.getCode());
|
||||
noticeTabToInsert.setStatus(InboundNoticeTabStatus.ENABLED.getCode());
|
||||
noticeTabToInsert.setCreateTime(DateUtils.getNowDate());
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user