|  | @@ -967,9 +967,16 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |              warehouseBills.setfBillstatus(tWarehouseBills.getfBillstatus());
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          int i = tWarehouseBillsMapper.updateTWarehousebills(warehouseBills);
 | 
	
		
			
				|  |  | +        TWarehousebillsCntr tWarehousebillsCntr = tWarehousebillsCntrMapper.selectTWarehousebillsCntrByPId(warehouseBills.getfId());
 | 
	
		
			
				|  |  |          int cntritemsfPid = tWarehousebillsCntritemsMapper.deleteTWarehousebillsCntritemsfPid(warehouseBills.getfId());
 | 
	
		
			
				|  |  |          if (CollectionUtils.isNotEmpty(tWarehousebillsCntrs)) {
 | 
	
		
			
				|  |  |              for (TWarehousebillsCntritems warehousebillsCntritems : tWarehousebillsCntrs) {
 | 
	
		
			
				|  |  | +                AjaxResult ajaxResult = this.judgeBoxPile(warehousebillsCntritems, tWarehousebillsCntr.getfCntrid());
 | 
	
		
			
				|  |  | +                String code = ajaxResult.get("code").toString();
 | 
	
		
			
				|  |  | +                if ("500".equals(code)) {
 | 
	
		
			
				|  |  | +                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
 | 
	
		
			
				|  |  | +                    return AjaxResult.success("error",ajaxResult.get("msg").toString());
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |                  warehousebillsCntritems.setfPid(warehouseBills.getfId());
 | 
	
		
			
				|  |  |                  warehousebillsCntritems.setCreateTime(DateUtils.getNowDate());
 | 
	
		
			
				|  |  |                  warehousebillsCntritems.setCreateBy(SecurityUtils.getUsername());
 | 
	
	
		
			
				|  | @@ -1033,8 +1040,15 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |          warehouseBills.setfTimes(tWarehouseBills.getfTimes() + 1);
 | 
	
		
			
				|  |  |          tWarehouseBillsMapper.updateTWarehousebills(warehouseBills);
 | 
	
		
			
				|  |  |          tWarehousebillsCntritemsMapper.deleteTWarehousebillsCntritemsfPid(warehouseBills.getfId());
 | 
	
		
			
				|  |  | +        TWarehousebillsCntr tWarehousebillsCntr = tWarehousebillsCntrMapper.selectTWarehousebillsCntrByPId(warehouseBills.getfId());
 | 
	
		
			
				|  |  |          if (CollectionUtils.isNotEmpty(tWarehousebillsCntritemsList)) {
 | 
	
		
			
				|  |  |              for (TWarehousebillsCntritems warehousebillsCntritems : tWarehousebillsCntritemsList) {
 | 
	
		
			
				|  |  | +                AjaxResult ajaxResult = this.judgeBoxPile(warehousebillsCntritems, tWarehousebillsCntr.getfCntrid());
 | 
	
		
			
				|  |  | +                String code = ajaxResult.get("code").toString();
 | 
	
		
			
				|  |  | +                if ("500".equals(code)) {
 | 
	
		
			
				|  |  | +                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
 | 
	
		
			
				|  |  | +                    return AjaxResult.success("error",ajaxResult.get("msg").toString());
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |                  warehousebillsCntritems.setfPid(warehouseBills.getfId());
 | 
	
		
			
				|  |  |                  warehousebillsCntritems.setCreateTime(DateUtils.getNowDate());
 | 
	
		
			
				|  |  |                  warehousebillsCntritems.setCreateBy(SecurityUtils.getUsername());
 | 
	
	
		
			
				|  | @@ -1892,10 +1906,8 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |                              }
 | 
	
		
			
				|  |  |                              companyMsg.setfCntrno(cell.getStringCellValue());
 | 
	
		
			
				|  |  |                              //判断箱号是否存在
 | 
	
		
			
				|  |  | -                            TCntrno tCntrno = new TCntrno();
 | 
	
		
			
				|  |  | -                            tCntrno.setfNo(cell.getStringCellValue());
 | 
	
		
			
				|  |  | -                            List<TCntrno> cnTrNoList= tCntrnoMapper.selectTCntrnoList(tCntrno);
 | 
	
		
			
				|  |  | -                            if (CollectionUtils.isEmpty(cnTrNoList)){
 | 
	
		
			
				|  |  | +                            TCntrno tCntrno = tCntrnoMapper.selectTCnTrNoByfNo(cell.getStringCellValue());
 | 
	
		
			
				|  |  | +                            if (tCntrno == null){
 | 
	
		
			
				|  |  |                                  tCnTrNoList.add(cell.getStringCellValue());
 | 
	
		
			
				|  |  |                              }
 | 
	
		
			
				|  |  |                              break;
 | 
	
	
		
			
				|  | @@ -1955,9 +1967,15 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |                                  return AjaxResult.success("Excel箱信息数据第" + line + "行数据缺少箱型",500);*/
 | 
	
		
			
				|  |  |                                  break;
 | 
	
		
			
				|  |  |                              }
 | 
	
		
			
				|  |  | -                            if (tCntr.getfNo().equals(cell.getStringCellValue())){
 | 
	
		
			
				|  |  | -                                companyMsg.setCntrName(cell.getStringCellValue());
 | 
	
		
			
				|  |  | -                            }else {
 | 
	
		
			
				|  |  | +                            TCntrno cnTrNo = tCntrnoMapper.selectTCnTrNoByfNo(companyMsg.getfCntrno());
 | 
	
		
			
				|  |  | +                            if (cnTrNo != null && cnTrNo.getTypeidName().equals(cell.getStringCellValue())){
 | 
	
		
			
				|  |  | +                                if (tCntr.getfNo().equals(cell.getStringCellValue())){
 | 
	
		
			
				|  |  | +                                    companyMsg.setCntrName(cell.getStringCellValue());
 | 
	
		
			
				|  |  | +                                }else {
 | 
	
		
			
				|  |  | +                                    List.add(companyMsg.getfCntrno());
 | 
	
		
			
				|  |  | +                                    break;
 | 
	
		
			
				|  |  | +                                }
 | 
	
		
			
				|  |  | +                            }else if (cnTrNo != null && !cnTrNo.getTypeidName().equals(cell.getStringCellValue())){
 | 
	
		
			
				|  |  |                                  List.add(companyMsg.getfCntrno());
 | 
	
		
			
				|  |  |                                  break;
 | 
	
		
			
				|  |  |                              }
 | 
	
	
		
			
				|  | @@ -5038,6 +5056,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |                  tWarehousebillsCntrMapper.insertTWarehousebillsCntr(warehousebillsCntr);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        TWarehousebillsCntr warehousebillsCntr = tWarehousebillsCntrMapper.selectTWarehousebillsCntrByPId(warehouseBills.getfId());
 | 
	
		
			
				|  |  |          //修改箱信息
 | 
	
		
			
				|  |  |          if (StringUtils.isNotEmpty(tWarehousebillsCntritems) && !"[]".equals(tWarehousebillsCntritems)){
 | 
	
		
			
				|  |  |              JSONArray objects = JSONArray.parseArray(tWarehousebillsCntritems);
 | 
	
	
		
			
				|  | @@ -5056,6 +5075,13 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |                  }else {
 | 
	
		
			
				|  |  |                      warehousebillsCntritems.setUpdateBy(userName);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | +                //判断箱是否存在,判断箱型是否一致
 | 
	
		
			
				|  |  | +                AjaxResult ajaxResult = this.judgeBoxPile(warehousebillsCntritems, warehousebillsCntr.getfCntrid());
 | 
	
		
			
				|  |  | +                String code = ajaxResult.get("code").toString();
 | 
	
		
			
				|  |  | +                if ("500".equals(code)) {
 | 
	
		
			
				|  |  | +                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
 | 
	
		
			
				|  |  | +                    return AjaxResult.success("error",ajaxResult.get("msg").toString());
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |                  tWarehousebillsCntritemsMapper.insertTWarehousebillsCntritems(warehousebillsCntritems);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -5810,4 +5836,31 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 判断箱号是否存在 箱型是否一致
 | 
	
		
			
				|  |  | +     * @param tWarehousebillsCntritems 箱信息表
 | 
	
		
			
				|  |  | +     * @param fId 货物信息表箱类型ID
 | 
	
		
			
				|  |  | +     * @return
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    public AjaxResult judgeBoxPile(TWarehousebillsCntritems tWarehousebillsCntritems,Long fId){
 | 
	
		
			
				|  |  | +        //判断箱子是否存在
 | 
	
		
			
				|  |  | +        TCntrno tCntrno = tCntrnoMapper.selectTCnTrNoByfNo(tWarehousebillsCntritems.getfCntrno());
 | 
	
		
			
				|  |  | +        if (tCntrno == null){
 | 
	
		
			
				|  |  | +           return AjaxResult.error("箱号"+tWarehousebillsCntritems.getfCntrno()+"不存在");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        //判断箱型是否一致
 | 
	
		
			
				|  |  | +        //TCntr tCntr = tCntrMapper.selectTCntrById(fId);//查询货物信息对应的箱类型
 | 
	
		
			
				|  |  | +        TCntrno cnTrNo = tCntrnoMapper.selectTCnTrNoByfNo(tWarehousebillsCntritems.getfCntrno());//查询箱号对应的箱信息
 | 
	
		
			
				|  |  | +        TCntr tCntr = tCntrMapper.selectTCntrById(cnTrNo.getfTypeid());//查询箱类型
 | 
	
		
			
				|  |  | +        if (cnTrNo != null && cnTrNo.getfTypeid() == tWarehousebillsCntritems.getfCntrid()){
 | 
	
		
			
				|  |  | +            if (tWarehousebillsCntritems.getfCntrid() != fId){
 | 
	
		
			
				|  |  | +                TCntr cntr = tCntrMapper.selectTCntrById(fId);
 | 
	
		
			
				|  |  | +                return AjaxResult.error("箱号"+tWarehousebillsCntritems.getfCntrno()+"跟货物信息中箱类型不一致,箱类型应为:"+cntr.getfNo());
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }else if (cnTrNo != null && cnTrNo.getfTypeid() != tWarehousebillsCntritems.getfCntrid()){
 | 
	
		
			
				|  |  | +            return AjaxResult.error("箱号"+tWarehousebillsCntritems.getfCntrno()+"跟基础信息中箱类型不一致,箱类型应为:"+tCntr.getfNo());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return AjaxResult.success();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  }
 |