|
@@ -77,7 +77,7 @@ public class InStoreFormServiceImpl extends BaseServiceImpl<InStoreFormMapper, I
|
|
|
|
|
|
@Override
|
|
|
public StoreWorkBenchVO getCurrentlyList(String userId) {
|
|
|
- StoreWorkBenchVO storeWorkBenchVO=new StoreWorkBenchVO();
|
|
|
+ StoreWorkBenchVO storeWorkBenchVO = new StoreWorkBenchVO();
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
|
|
|
List<LocalDateTime> currentWeekStartAndEndList = DateUtils.currentWeek();
|
|
@@ -85,7 +85,7 @@ public class InStoreFormServiceImpl extends BaseServiceImpl<InStoreFormMapper, I
|
|
|
LocalDateTime searchEndTime = now.withHour(23).withMinute(59).withSecond(59);
|
|
|
// 总数
|
|
|
InStoreFormDTO queryDTO = new InStoreFormDTO();
|
|
|
- OutStoreFormDTO queryDTO2=new OutStoreFormDTO();
|
|
|
+ OutStoreFormDTO queryDTO2 = new OutStoreFormDTO();
|
|
|
queryDTO2.setSearchStartTime(searchStartTime);
|
|
|
queryDTO2.setStatus(InStoreStatusEnum.EXECUTING.getValue());
|
|
|
queryDTO.setStatus(OutStoreStatusEnum.EXECUTING.getValue());
|
|
@@ -95,25 +95,25 @@ public class InStoreFormServiceImpl extends BaseServiceImpl<InStoreFormMapper, I
|
|
|
queryDTO.setUserId(userId);
|
|
|
queryDTO2.setUserId(userId);
|
|
|
List<InStoreDetailVO> list = inStoreDetailMapper.getCurrentlyList(queryDTO) == null ? new ArrayList<>() : inStoreDetailMapper.getCurrentlyList(queryDTO);
|
|
|
- List<OutStoreDetailVO> list2=outStoreDetailMapper.getCurrentlyList(queryDTO2) == null ? new ArrayList<>() : outStoreDetailMapper.getCurrentlyList(queryDTO2);
|
|
|
+ List<OutStoreDetailVO> list2 = outStoreDetailMapper.getCurrentlyList(queryDTO2) == null ? new ArrayList<>() : outStoreDetailMapper.getCurrentlyList(queryDTO2);
|
|
|
List<InStoreDetailVO> result = new ArrayList<>();
|
|
|
- List<OutStoreDetailVO> result2=new ArrayList<>();
|
|
|
- for(LocalDateTime tempDate: currentWeekStartAndEndList){
|
|
|
+ List<OutStoreDetailVO> result2 = new ArrayList<>();
|
|
|
+ for (LocalDateTime tempDate : currentWeekStartAndEndList) {
|
|
|
InStoreDetailVO vo = new InStoreDetailVO();
|
|
|
- OutStoreDetailVO vo1=new OutStoreDetailVO();
|
|
|
+ OutStoreDetailVO vo1 = new OutStoreDetailVO();
|
|
|
int tempTotalNum = 0;
|
|
|
vo.setWeekDayName(tempDate.getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.CHINA));
|
|
|
vo1.setWeekDayName(tempDate.getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.CHINA));
|
|
|
- for(InStoreDetailVO useVO: list){
|
|
|
- if(useVO.getCreatedTime().toLocalDate().isEqual(tempDate.toLocalDate())){
|
|
|
- tempTotalNum+=1;
|
|
|
+ for (InStoreDetailVO useVO : list) {
|
|
|
+ if (useVO.getCreatedTime().toLocalDate().isEqual(tempDate.toLocalDate())) {
|
|
|
+ tempTotalNum += 1;
|
|
|
}
|
|
|
}
|
|
|
vo.setNum(new BigDecimal(tempTotalNum));
|
|
|
- int tempTotalNum2=0;
|
|
|
- for(OutStoreDetailVO useVO: list2){
|
|
|
- if(useVO.getCreatedTime().toLocalDate().isEqual(tempDate.toLocalDate())){
|
|
|
- tempTotalNum2+=1;
|
|
|
+ int tempTotalNum2 = 0;
|
|
|
+ for (OutStoreDetailVO useVO : list2) {
|
|
|
+ if (useVO.getCreatedTime().toLocalDate().isEqual(tempDate.toLocalDate())) {
|
|
|
+ tempTotalNum2 += 1;
|
|
|
}
|
|
|
}
|
|
|
vo1.setNum(new BigDecimal(tempTotalNum2));
|
|
@@ -127,39 +127,39 @@ public class InStoreFormServiceImpl extends BaseServiceImpl<InStoreFormMapper, I
|
|
|
|
|
|
@Override
|
|
|
public StoreWorkBenchVO getStoreWorkBenchVO(String userId) {
|
|
|
- StoreDTO query=new StoreDTO();
|
|
|
+ StoreDTO query = new StoreDTO();
|
|
|
query.setUserId(userId);
|
|
|
- Integer count=storeMapper.getStoreNums(query);
|
|
|
+ Integer count = storeMapper.getStoreNums(query);
|
|
|
|
|
|
- SpareStoreDTO spareStoreDTO=new SpareStoreDTO();
|
|
|
+ SpareStoreDTO spareStoreDTO = new SpareStoreDTO();
|
|
|
spareStoreDTO.setUserId(userId);
|
|
|
- List<SpareStoreVO> spareStoreVOS=spareStoreMapper.selectList(spareStoreDTO);
|
|
|
- Double totalPrice=0.0;
|
|
|
- for(SpareStoreVO vo:spareStoreVOS){
|
|
|
- totalPrice+=(vo.getNum().intValue())*(vo.getPrice().doubleValue());
|
|
|
+ List<SpareStoreVO> spareStoreVOS = spareStoreMapper.selectList(spareStoreDTO);
|
|
|
+ Double totalPrice = 0.0;
|
|
|
+ for (SpareStoreVO vo : spareStoreVOS) {
|
|
|
+ totalPrice += (vo.getNum().intValue()) * (vo.getPrice().doubleValue());
|
|
|
}
|
|
|
- DecimalFormat df=new DecimalFormat("0.00");
|
|
|
- Double s=new Double(df.format(totalPrice));
|
|
|
- InStoreFormDTO queryDTO=new InStoreFormDTO();
|
|
|
+ DecimalFormat df = new DecimalFormat("0.00");
|
|
|
+ Double s = new Double(df.format(totalPrice));
|
|
|
+ InStoreFormDTO queryDTO = new InStoreFormDTO();
|
|
|
queryDTO.setUserId(userId);
|
|
|
- OutStoreFormDTO queryDTO2=new OutStoreFormDTO();
|
|
|
+ OutStoreFormDTO queryDTO2 = new OutStoreFormDTO();
|
|
|
queryDTO2.setUserId(userId);
|
|
|
- List<OutStoreFormVO> outStoreFormVOS=outStoreFormMapper.selectOutStoreList(queryDTO2);
|
|
|
- List<InStoreFormVO> inStoreFormVOS=inStoreFormMapper.getInStoreDetailVOs(queryDTO);
|
|
|
- StoreWorkBenchVO storeWorkBenchVO=new StoreWorkBenchVO();
|
|
|
- BigDecimal num=new BigDecimal(0);
|
|
|
- BigDecimal purchaseNum=new BigDecimal(0);
|
|
|
- BigDecimal xzNum=new BigDecimal(0);
|
|
|
- BigDecimal dbNum=new BigDecimal(0);
|
|
|
- BigDecimal otherNum=new BigDecimal(0);
|
|
|
- BigDecimal num1=new BigDecimal(0);
|
|
|
- BigDecimal lyNum=new BigDecimal(0);
|
|
|
- BigDecimal dbNum2=new BigDecimal(0);
|
|
|
- BigDecimal bfNum=new BigDecimal(0);
|
|
|
- BigDecimal otherNum2=new BigDecimal(0);
|
|
|
- BigDecimal pdNum=new BigDecimal(0);
|
|
|
- for(OutStoreFormVO vo:outStoreFormVOS){
|
|
|
- if(vo!=null) {
|
|
|
+ List<OutStoreFormVO> outStoreFormVOS = outStoreFormMapper.selectOutStoreList(queryDTO2);
|
|
|
+ List<InStoreFormVO> inStoreFormVOS = inStoreFormMapper.getInStoreDetailVOs(queryDTO);
|
|
|
+ StoreWorkBenchVO storeWorkBenchVO = new StoreWorkBenchVO();
|
|
|
+ BigDecimal num = new BigDecimal(0);
|
|
|
+ BigDecimal purchaseNum = new BigDecimal(0);
|
|
|
+ BigDecimal xzNum = new BigDecimal(0);
|
|
|
+ BigDecimal dbNum = new BigDecimal(0);
|
|
|
+ BigDecimal otherNum = new BigDecimal(0);
|
|
|
+ BigDecimal num1 = new BigDecimal(0);
|
|
|
+ BigDecimal lyNum = new BigDecimal(0);
|
|
|
+ BigDecimal dbNum2 = new BigDecimal(0);
|
|
|
+ BigDecimal bfNum = new BigDecimal(0);
|
|
|
+ BigDecimal otherNum2 = new BigDecimal(0);
|
|
|
+ BigDecimal pdNum = new BigDecimal(0);
|
|
|
+ for (OutStoreFormVO vo : outStoreFormVOS) {
|
|
|
+ if (vo != null) {
|
|
|
//领用出库
|
|
|
if ((OutStoreTypeEnum.CHUKU_LINGYONG.getValue()).equals(vo.getType())) {
|
|
|
lyNum = new BigDecimal(lyNum.intValue() + vo.getOutStoreNum().intValue());
|
|
@@ -176,31 +176,32 @@ public class InStoreFormServiceImpl extends BaseServiceImpl<InStoreFormMapper, I
|
|
|
otherNum2 = new BigDecimal(otherNum2.intValue() + vo.getOutStoreNum().intValue());
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
- num1=new BigDecimal(lyNum.intValue()+dbNum2.intValue()+bfNum.intValue()+otherNum2.intValue());
|
|
|
- for(InStoreFormVO vo:inStoreFormVOS) {
|
|
|
+ num1 = new BigDecimal(lyNum.intValue() + dbNum2.intValue() + bfNum.intValue() + otherNum2.intValue());
|
|
|
+ for (InStoreFormVO vo : inStoreFormVOS) {
|
|
|
if (vo != null) {
|
|
|
System.out.println(vo.getType());
|
|
|
- //采购入库
|
|
|
- if (InStoreTypeEnum.CAIGOU_RUKU.getValue().equals(vo.getType())) {
|
|
|
- purchaseNum = new BigDecimal(lyNum.intValue() + vo.getInStoreNum().intValue());
|
|
|
- }
|
|
|
- //闲置入库
|
|
|
- if ((InStoreTypeEnum.XIANZHI_RUKU.getValue().equals(vo.getType()))) {
|
|
|
- xzNum = new BigDecimal(xzNum.intValue() + vo.getInStoreNum().intValue());
|
|
|
- }
|
|
|
- //调拨入库
|
|
|
- if ((InStoreTypeEnum.DIAOBO_RUKU.getValue()).equals(vo.getType())) {
|
|
|
- dbNum = new BigDecimal(bfNum.intValue() + vo.getInStoreNum().intValue());
|
|
|
- }
|
|
|
- if ((InStoreTypeEnum.FAYUN_RUKU.getValue()).equals(vo.getType()) || (InStoreTypeEnum.STORE_CHECK.getValue()).equals(vo.getType())) {
|
|
|
- otherNum = new BigDecimal(otherNum.intValue() + vo.getInStoreNum().intValue());
|
|
|
+ //采购入库
|
|
|
+ if (InStoreTypeEnum.CAIGOU_RUKU.getValue().equals(vo.getType())) {
|
|
|
+ purchaseNum = new BigDecimal(lyNum.intValue() + vo.getInStoreNum().intValue());
|
|
|
+ }
|
|
|
+ //闲置入库
|
|
|
+ if ((InStoreTypeEnum.XIANZHI_RUKU.getValue().equals(vo.getType()))) {
|
|
|
+ xzNum = new BigDecimal(xzNum.intValue() + vo.getInStoreNum().intValue());
|
|
|
+ }
|
|
|
+ //调拨入库
|
|
|
+ if ((InStoreTypeEnum.DIAOBO_RUKU.getValue()).equals(vo.getType())) {
|
|
|
+ dbNum = new BigDecimal(bfNum.intValue() + vo.getInStoreNum().intValue());
|
|
|
+ }
|
|
|
+ if ((InStoreTypeEnum.FAYUN_RUKU.getValue()).equals(vo.getType()) || (InStoreTypeEnum.STORE_CHECK.getValue()).equals(vo.getType())) {
|
|
|
+ otherNum = new BigDecimal(otherNum.intValue() + vo.getInStoreNum().intValue());
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
}
|
|
|
- num=new BigDecimal(purchaseNum.intValue()+xzNum.intValue()+dbNum.intValue()+otherNum.intValue());
|
|
|
+ num = new BigDecimal(purchaseNum.intValue() + xzNum.intValue() + dbNum.intValue() + otherNum.intValue());
|
|
|
|
|
|
storeWorkBenchVO.setInTotalNum(num);
|
|
|
storeWorkBenchVO.setPurchaseApplyNum(purchaseNum);
|
|
@@ -317,6 +318,7 @@ public class InStoreFormServiceImpl extends BaseServiceImpl<InStoreFormMapper, I
|
|
|
|
|
|
/**
|
|
|
* 入库,只记录不更新
|
|
|
+ *
|
|
|
* @param model
|
|
|
* @return
|
|
|
*/
|
|
@@ -324,9 +326,9 @@ public class InStoreFormServiceImpl extends BaseServiceImpl<InStoreFormMapper, I
|
|
|
public InStoreForm saveModelByDTO(InStoreFormDTO model) {
|
|
|
Store store = storeService.getModelById(model.getStoreId());
|
|
|
if (store == null) {
|
|
|
- throw new BusinessException("仓库不存在, storeId:" + model.getStoreId() );
|
|
|
+ throw new BusinessException("仓库不存在, storeId:" + model.getStoreId());
|
|
|
}
|
|
|
- if (store.getLevel().equals(StoreLevelEnum.ZONGCANG)){
|
|
|
+ if (store.getLevel().equals(StoreLevelEnum.ZONGCANG)) {
|
|
|
throw new BusinessException("请选择库位");
|
|
|
}
|
|
|
UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
@@ -408,7 +410,7 @@ public class InStoreFormServiceImpl extends BaseServiceImpl<InStoreFormMapper, I
|
|
|
public void updateModelByDTO(InStoreFormDTO model) {
|
|
|
Store store = storeService.getModelById(model.getStoreId());
|
|
|
if (store == null) {
|
|
|
- throw new BusinessException("仓库不存在, storeId:" + model.getStoreId() );
|
|
|
+ throw new BusinessException("仓库不存在, storeId:" + model.getStoreId());
|
|
|
}
|
|
|
if (store.getLevel().equals(StoreLevelEnum.ZONGCANG)) {
|
|
|
throw new BusinessException("请选择库位");
|
|
@@ -551,8 +553,8 @@ public class InStoreFormServiceImpl extends BaseServiceImpl<InStoreFormMapper, I
|
|
|
UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
|
InStoreForm model = this.getModelById(id);
|
|
|
// 采购单入库的路由至新流程
|
|
|
- if(InStoreTypeEnum.CAIGOU_RUKU.getValue() == model.getType()){
|
|
|
- handlePurchaseInForm(model,userInfo);
|
|
|
+ if (InStoreTypeEnum.CAIGOU_RUKU.getValue() == model.getType()) {
|
|
|
+ handlePurchaseInForm(model, userInfo);
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -614,20 +616,21 @@ public class InStoreFormServiceImpl extends BaseServiceImpl<InStoreFormMapper, I
|
|
|
|
|
|
/**
|
|
|
* 处理采购入库单的入库操作
|
|
|
+ *
|
|
|
* @param form
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- void handlePurchaseInForm(InStoreForm form,UserInfo userInfo){
|
|
|
+ void handlePurchaseInForm(InStoreForm form, UserInfo userInfo) {
|
|
|
PurchaseStoreForm storeForm = new PurchaseStoreForm();
|
|
|
storeForm.setId(form.getPurchaseId());
|
|
|
storeForm.setUpdateUserName(userInfo.getUsername());
|
|
|
storeForm.setUpdateUserId(userInfo.getUserId());
|
|
|
storeForm.setUpdateTime(LocalDateTime.now());
|
|
|
- try{
|
|
|
+ try {
|
|
|
String storeId = form.getStoreId();
|
|
|
// 找到入库备件明细
|
|
|
Weekend<PurchaseStoreFormDetail> detailWeekend = new Weekend<>(PurchaseStoreFormDetail.class);
|
|
|
- detailWeekend.weekendCriteria().andEqualTo(PurchaseStoreFormDetail::getPurchaseStoreFormId, form.getPurchaseId()).andEqualTo(PurchaseStoreFormDetail::getDeleteFlag,PurchaseStoreFormDetailDelFlagEnum.NORMAL.getValue());
|
|
|
+ detailWeekend.weekendCriteria().andEqualTo(PurchaseStoreFormDetail::getPurchaseStoreFormId, form.getPurchaseId()).andEqualTo(PurchaseStoreFormDetail::getDeleteFlag, PurchaseStoreFormDetailDelFlagEnum.NORMAL.getValue());
|
|
|
List<PurchaseStoreFormDetail> detailList = purchaseStoreFormDetailMapper.selectByExample(detailWeekend);
|
|
|
// 更新库存
|
|
|
for (PurchaseStoreFormDetail detail : detailList) {
|
|
@@ -672,10 +675,10 @@ public class InStoreFormServiceImpl extends BaseServiceImpl<InStoreFormMapper, I
|
|
|
mapper.updateByPrimaryKeySelective(updForm);
|
|
|
// 修正采购入库单状态
|
|
|
storeForm.setStatus(PurchaseStoreFormStatusEnum.COMPLETED.getValue());
|
|
|
- }catch (Exception e){
|
|
|
- log.error("采购入库失败----------------"+e.getCause().getMessage());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("采购入库失败----------------" + e.getCause().getMessage());
|
|
|
storeForm.setStatus(PurchaseStoreFormStatusEnum.STORE_FAIL.getValue());
|
|
|
- }finally {
|
|
|
+ } finally {
|
|
|
purchaseStoreFormMapper.updateByPrimaryKeySelective(storeForm);
|
|
|
}
|
|
|
}
|
|
@@ -853,7 +856,7 @@ public class InStoreFormServiceImpl extends BaseServiceImpl<InStoreFormMapper, I
|
|
|
spareStore.setUpdateTime(LocalDateTime.now());
|
|
|
spareStore.setUpdateUserId(userInfo.getUserId());
|
|
|
spareStore.setUpdateUserName(userInfo.getRealName());
|
|
|
- spareStore.setPrice(getNewPrice(spareStore,detail));
|
|
|
+ spareStore.setPrice(getNewPrice(spareStore, detail));
|
|
|
spareStoreMapper.updateByPrimaryKeySelective(spareStore);
|
|
|
}
|
|
|
}
|