|  | @@ -3,7 +3,6 @@ package com.ruoyi.warehouseBusiness.service.impl;
 | 
	
		
			
				|  |  |  import cn.hutool.core.bean.BeanUtil;
 | 
	
		
			
				|  |  |  import cn.hutool.core.collection.CollectionUtil;
 | 
	
		
			
				|  |  |  import cn.hutool.core.util.ObjectUtil;
 | 
	
		
			
				|  |  | -import cn.hutool.json.JSONUtil;
 | 
	
		
			
				|  |  |  import com.alibaba.fastjson.JSON;
 | 
	
		
			
				|  |  |  import com.alibaba.fastjson.JSONArray;
 | 
	
		
			
				|  |  |  import com.alibaba.fastjson.JSONObject;
 | 
	
	
		
			
				|  | @@ -32,7 +31,6 @@ import com.ruoyi.common.utils.*;
 | 
	
		
			
				|  |  |  import com.ruoyi.common.utils.ip.AddressUtils;
 | 
	
		
			
				|  |  |  import com.ruoyi.common.utils.poi.DrawExcel;
 | 
	
		
			
				|  |  |  import com.ruoyi.common.utils.poi.ExcelUtils;
 | 
	
		
			
				|  |  | -import com.ruoyi.common.utils.sign.Md5Utils;
 | 
	
		
			
				|  |  |  import com.ruoyi.finance.domain.TFeeDo;
 | 
	
		
			
				|  |  |  import com.ruoyi.finance.mapper.TFeeDoMapper;
 | 
	
		
			
				|  |  |  import com.ruoyi.quotation.domain.TSeaprice;
 | 
	
	
		
			
				|  | @@ -725,6 +723,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |          TWhgenleg tWhgenleg = new TWhgenleg();
 | 
	
		
			
				|  |  |          if (WarehouseTypeEnum.SJRK.getType().equals(warehouseBills.getfBilltype())) {
 | 
	
		
			
				|  |  |              tWhgenleg.setfOriginalbilldate(warehousebillsitems.getfBsdate());
 | 
	
		
			
				|  |  | +            tWhgenleg.setfWarehouseInformation(warehousebillsitems.getfWarehouseInformation());
 | 
	
		
			
				|  |  |              if (StringUtils.isNotEmpty(warehouseBills.getfCustomno())) {
 | 
	
		
			
				|  |  |                  tWhgenleg.setfCustomno(warehouseBills.getfCustomno());
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -741,6 +740,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |          if (WarehouseTypeEnum.HQZY.getType().equals(warehouseBills.getfBilltype()) || WarehouseTypeEnum.CKDB.getType().equals(warehouseBills.getfBilltype()) ||
 | 
	
		
			
				|  |  |                  WarehouseTypeEnum.HWTG.getType().equals(warehouseBills.getfBilltype())) {
 | 
	
		
			
				|  |  |              tWhgenleg.setfOriginalbilldate(warehousebillsitems.getfOriginalbilldate());
 | 
	
		
			
				|  |  | +            tWhgenleg.setfWarehouseInformation(warehousebillsitems.getfWarehouseInformation());
 | 
	
		
			
				|  |  |              if (WarehouseTypeEnum.CKDB.getType().equals(warehouseBills.getfBilltype()) || WarehouseTypeEnum.HWTG.getType().equals(warehouseBills.getfBilltype())) {
 | 
	
		
			
				|  |  |                  tWhgenleg.setfCorpid(warehouseBills.getfCorpid());
 | 
	
		
			
				|  |  |              } else {
 | 
	
	
		
			
				|  | @@ -861,6 +861,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |          Long timestamp = DateUtils.getTimestamp(new Date());
 | 
	
		
			
				|  |  |          warehouseBills.setfDateChanged(timestamp.toString() + (int) (Math.random() * 900) + 100);
 | 
	
		
			
				|  |  |          TWarehousebillsitems itemInFo = tWarehousebillsitemsMapper.selectItemQtyByFPid(warehouseBills.getfId());
 | 
	
		
			
				|  |  | +        TWarehouse tWarehouse = tWarehouseMapper.selectTWarehouseById(warehouseBills.getfWarehouseid());
 | 
	
		
			
				|  |  |          warehouseBills.setfQty(itemInFo.getfQty());
 | 
	
		
			
				|  |  |          warehouseBills.setfNetweight(itemInFo.getfNetweight());
 | 
	
		
			
				|  |  |          warehouseBills.setfGrossweight(itemInFo.getfGrossweight());
 | 
	
	
		
			
				|  | @@ -949,6 +950,13 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |                      wbItem.setfBillingway(warehouseBills.getfBillingway());
 | 
	
		
			
				|  |  |                      wbItem.setfMblno(warehouseBills.getfMblno());// 入库更新库存前执行update更新明细的提单号等于主表的提单号
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | +                if (WarehouseTypeEnum.CKDB.getType().equals(billsType) || WarehouseTypeEnum.HWTG.getType().equals(billsType)) {
 | 
	
		
			
				|  |  | +                    TWarehouse tWarehouse1 = tWarehouseMapper.selectTWarehouseById(wbItem.getfTransferWarehouselocid());
 | 
	
		
			
				|  |  | +                    wbItem.setfWarehouseInformation(tWarehouse.getfName() + "/" + tWarehouse1.getfName());
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  | +                    TWarehouse tWarehouse1 = tWarehouseMapper.selectTWarehouseById(wbItem.getfWarehouselocid());
 | 
	
		
			
				|  |  | +                    wbItem.setfWarehouseInformation(tWarehouse.getfName() + "/" + tWarehouse1.getfName());
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |                  if (null != wbItem.getfId()) {
 | 
	
		
			
				|  |  |                      wbItem.setUpdateTime(wbItem.getfBsdate());
 | 
	
		
			
				|  |  |                      wbItem.setUpdateBy(loginUser.getUser().getUserName());
 | 
	
	
		
			
				|  | @@ -966,11 +974,11 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |                      wbItem.setfPid(fPid);
 | 
	
		
			
				|  |  |                      wbItem.setCreateBy(loginUser.getUser().getUserName());
 | 
	
		
			
				|  |  |                      wbItem.setCreateTime(new Date());
 | 
	
		
			
				|  |  | -                    tWarehousebillsitemsMapper.insertTWarehousebillsitems(wbItem);
 | 
	
		
			
				|  |  |                      if (!warehouseStatus) {
 | 
	
		
			
				|  |  |                          // 添加状态log
 | 
	
		
			
				|  |  |                          insertTWarehousebillsLog(wbItem, 10L);
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  | +                    tWarehousebillsitemsMapper.insertTWarehousebillsitems(wbItem);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  // 获取前端是否传递电子标签数据
 | 
	
	
		
			
				|  | @@ -1701,8 +1709,13 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |          JSONArray warehouseJSON = JSONArray.parseArray(tWarehousebillsitems);
 | 
	
		
			
				|  |  |          List<TWarehousebillsitems> warehousebillsitemsList = JSONObject.parseArray(warehouseJSON.toJSONString(), TWarehousebillsitems.class);
 | 
	
		
			
				|  |  |          int line = 0;
 | 
	
		
			
				|  |  | +        TWarehouse tWarehouseZ = tWarehouseMapper.selectTWarehouseById(warehouseBills.getfWarehouseid());
 | 
	
		
			
				|  |  |          for (TWarehousebillsitems wbItem : warehousebillsitemsList) {
 | 
	
		
			
				|  |  |              line++;
 | 
	
		
			
				|  |  | +            TWarehouse tWarehouse = tWarehouseMapper.selectTWarehouseById(wbItem.getfWarehouselocid());
 | 
	
		
			
				|  |  | +            if (tWarehouse != null) {
 | 
	
		
			
				|  |  | +                wbItem.setfWarehouseInformation(tWarehouseZ.getfName() + "/" + tWarehouse.getfName());
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |              if ("SJRK".equals(billsType) || "SJCK".equals(billsType) || WarehouseTypeEnum.CKDB.getType().equals(billsType) || WarehouseTypeEnum.HWTG.getType().equals(billsType)) {
 | 
	
		
			
				|  |  |                  // 除了入库其他模块不需要更新主表的 仓储费计费日期到明细表,其他模块 应从库存总账把仓储费计费日期 赋给明细表
 | 
	
		
			
				|  |  |                  if ("SJRK".equals(billsType)) {
 | 
	
	
		
			
				|  | @@ -4811,7 +4824,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |              } else if (WarehouseTypeEnum.CKDB.getType().equals(billsType) || WarehouseTypeEnum.HWTG.getType().equals(billsType)) { // 调拨查询
 | 
	
		
			
				|  |  |                  //校验计费日期是等于库存总帐计费日,如果不相等则报错
 | 
	
		
			
				|  |  |                  checkWhgenleg(wbItem, tWhgenle);
 | 
	
		
			
				|  |  | -                if (fCharg == 0) {
 | 
	
		
			
				|  |  | +                if (fCharg != 0) {
 | 
	
		
			
				|  |  |                      wbItem.setfChargedate(wbItem.getfBsdate());
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  if (!Objects.equals(wbItem.getfWarehouselocid(), wbItem.getfTransferWarehouselocid())) {
 | 
	
	
		
			
				|  | @@ -10422,9 +10435,9 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |          reqBody.put("storageName", a.getStorageName());
 | 
	
		
			
				|  |  |          reqBody.put("storageContractCode", a.getStorageContractCode());
 | 
	
		
			
				|  |  |          List<SkuItem> skuItemList = a.getSkuItemList();
 | 
	
		
			
				|  |  | -        if (skuItemList.size() > 0) {
 | 
	
		
			
				|  |  | +        if (!skuItemList.isEmpty()) {
 | 
	
		
			
				|  |  |              TWarehouseBills tWarehouseBills = warehouseBillsMapper.selectBYOriginalBillNo(skuItemList.get(0).getEnterCode());
 | 
	
		
			
				|  |  | -            if (tWarehouseBills != null){
 | 
	
		
			
				|  |  | +            if (tWarehouseBills != null) {
 | 
	
		
			
				|  |  |                  if (ObjectUtils.isNull(tWarehouseBills.getfBsdate())) {
 | 
	
		
			
				|  |  |                      throw new RuntimeException("入库日期不能为空");
 | 
	
		
			
				|  |  |                  }
 | 
	
	
		
			
				|  | @@ -10436,7 +10449,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  DateFormat df1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 | 
	
		
			
				|  |  |                  reqBody.put("storagePayTime", df1.format(tWarehouseBills.getfChargedate()));
 | 
	
		
			
				|  |  | -            }else{
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  |                  reqBody.put("storageContractStart", a.getStorageContractStart());// 改
 | 
	
		
			
				|  |  |                  reqBody.put("storagePayTime", a.getStoragePayTime());//改
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -10514,7 +10527,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |                  sysDictData.setDictValue(vo.getSpu());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  //是否保税
 | 
	
		
			
				|  |  | -                reqBody.put("whetherBonded", a.getWhetherBonded());
 | 
	
		
			
				|  |  | +                goodsMaps.put("taxType", a.getWhetherBonded());
 | 
	
		
			
				|  |  |                  goodsMaps.put("spuId", vo.getSpu());
 | 
	
		
			
				|  |  |                  goodsMaps.put("skuId", vo.getSku());
 | 
	
		
			
				|  |  |                  goodsMaps.put("skuName", goods.getfName());
 | 
	
	
		
			
				|  | @@ -10599,8 +10612,8 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |          // 公钥
 | 
	
		
			
				|  |  |          String appKey = "D0fJZ22Gn4BTE7qd";
 | 
	
		
			
				|  |  |          // 请求地址
 | 
	
		
			
				|  |  | -        String url = "https://sdpftz-console-test.pub.jdtiot.com/open/wms/receiptDistributeGoodsResult";
 | 
	
		
			
				|  |  | -//        String url = "https://sdpftz-console.ai-warehouse.com/open/wms/receiptDistributeGoodsResult";
 | 
	
		
			
				|  |  | +//        String url = "https://sdpftz-console-test.pub.jdtiot.com/open/wms/receiptDistributeGoodsResult";
 | 
	
		
			
				|  |  | +        String url = "https://sdpftz-console.ai-warehouse.com/open/wms/receiptDistributeGoodsResult";
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          String appSecret = "Qrgx3tn2tGqdIkvwIK0rcdckdYDG3caF";
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -10675,6 +10688,218 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |          return new AjaxResult(200, "保存成功");
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public AjaxResult importLibraryInformationV1(MultipartFile file, Long fWarehouseid, Long billId, LoginUser loginUser) {
 | 
	
		
			
				|  |  | +        List<TWarehousebillsitems> itemList = new ArrayList<>();
 | 
	
		
			
				|  |  | +        InputStream inputStream = null;
 | 
	
		
			
				|  |  | +        TWarehouse tWarehouseZ = tWarehouseMapper.selectTWarehouseById(fWarehouseid);
 | 
	
		
			
				|  |  | +        try {
 | 
	
		
			
				|  |  | +            inputStream = file.getInputStream();
 | 
	
		
			
				|  |  | +            String originalFilename = file.getOriginalFilename();
 | 
	
		
			
				|  |  | +            Workbook workbook = null;
 | 
	
		
			
				|  |  | +            if (originalFilename.endsWith("xls")) {
 | 
	
		
			
				|  |  | +                workbook = WorkbookFactory.create(inputStream);
 | 
	
		
			
				|  |  | +            } else if (originalFilename.endsWith("xlsx")) {
 | 
	
		
			
				|  |  | +                workbook = new XSSFWorkbook(inputStream);
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                return AjaxResult.error("文件后缀异常");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            Sheet sheet = workbook.getSheetAt(0);
 | 
	
		
			
				|  |  | +            int line = 0;
 | 
	
		
			
				|  |  | +            for (Row rows : sheet) {
 | 
	
		
			
				|  |  | +                line++;
 | 
	
		
			
				|  |  | +                if (rows.getRowNum() == 0) {
 | 
	
		
			
				|  |  | +                    continue;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                System.out.println("*****" + rows.getPhysicalNumberOfCells());
 | 
	
		
			
				|  |  | +                TWarehousebillsitems warehousebillsitems = new TWarehousebillsitems();
 | 
	
		
			
				|  |  | +                for (int a = 0; a <= rows.getPhysicalNumberOfCells(); a++) {
 | 
	
		
			
				|  |  | +                    System.out.println("============" + rows.getCell(a));
 | 
	
		
			
				|  |  | +                    if (StringUtils.isNull(rows.getCell(a))) {
 | 
	
		
			
				|  |  | +                        continue;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    Cell cell = rows.getCell(a);
 | 
	
		
			
				|  |  | +                    String value = filter(sheet.getRow(0), CellReference.convertNumToColString(cell.getColumnIndex()));
 | 
	
		
			
				|  |  | +                    switch (value) {
 | 
	
		
			
				|  |  | +                        case "货物名称":
 | 
	
		
			
				|  |  | +                            // 设置单元格类型
 | 
	
		
			
				|  |  | +                            cell.setCellType(CellType.STRING);
 | 
	
		
			
				|  |  | +                            if (StringUtils.isNotEmpty(cell.getStringCellValue())) {
 | 
	
		
			
				|  |  | +                                TGoods tGoods = tGoodsMapper.getGoodsByName(cell.getStringCellValue());
 | 
	
		
			
				|  |  | +                                if (ObjectUtils.isNotNull(tGoods)) {
 | 
	
		
			
				|  |  | +                                    warehousebillsitems.setfGoodsid(tGoods.getfId());
 | 
	
		
			
				|  |  | +                                }
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                            break;
 | 
	
		
			
				|  |  | +                        case "备案序号":
 | 
	
		
			
				|  |  | +                            // 设置单元格类型
 | 
	
		
			
				|  |  | +                            cell.setCellType(CellType.STRING);
 | 
	
		
			
				|  |  | +                            if (StringUtils.isNotEmpty(cell.getStringCellValue())) {
 | 
	
		
			
				|  |  | +                                warehousebillsitems.setfBusinessType(5L);
 | 
	
		
			
				|  |  | +                                warehousebillsitems.setfMarks(cell.getStringCellValue());
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                            break;
 | 
	
		
			
				|  |  | +                        case "件数":
 | 
	
		
			
				|  |  | +                            //设置单元格类型
 | 
	
		
			
				|  |  | +                            cell.setCellType(CellType.STRING);
 | 
	
		
			
				|  |  | +                            if (StringUtils.isNotEmpty(cell.getStringCellValue())) {
 | 
	
		
			
				|  |  | +                                warehousebillsitems.setfPlanqty(Long.valueOf(cell.getStringCellValue()));
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                            break;
 | 
	
		
			
				|  |  | +                        case "毛重":
 | 
	
		
			
				|  |  | +                            //设置单元格类型
 | 
	
		
			
				|  |  | +                            cell.setCellType(CellType.STRING);
 | 
	
		
			
				|  |  | +                            if (StringUtils.isNotEmpty(cell.getStringCellValue())) {
 | 
	
		
			
				|  |  | +                                warehousebillsitems.setfPlangrossweight(new BigDecimal(cell.getStringCellValue()).setScale(2, BigDecimal.ROUND_HALF_UP));
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                            break;
 | 
	
		
			
				|  |  | +                        case "净重":
 | 
	
		
			
				|  |  | +                            //设置单元格类型
 | 
	
		
			
				|  |  | +                            cell.setCellType(CellType.STRING);
 | 
	
		
			
				|  |  | +                            if (StringUtils.isNotEmpty(cell.getStringCellValue())) {
 | 
	
		
			
				|  |  | +                                warehousebillsitems.setfPlannetweight(new BigDecimal(cell.getStringCellValue()).setScale(2, BigDecimal.ROUND_HALF_UP));
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                            break;
 | 
	
		
			
				|  |  | +                        case "入库日期":
 | 
	
		
			
				|  |  | +                            //设置单元格类型
 | 
	
		
			
				|  |  | +                            cell.setCellType(CellType.STRING);
 | 
	
		
			
				|  |  | +                            if (StringUtils.isNotEmpty(cell.getStringCellValue())) {
 | 
	
		
			
				|  |  | +                                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
 | 
	
		
			
				|  |  | +                                Date date = sdf.parse(cell.getStringCellValue());
 | 
	
		
			
				|  |  | +                                warehousebillsitems.setfBsdate(date);
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                            break;
 | 
	
		
			
				|  |  | +                      /*  case "仓库":
 | 
	
		
			
				|  |  | +                            // 设置单元格类型
 | 
	
		
			
				|  |  | +                            cell.setCellType(CellType.STRING);
 | 
	
		
			
				|  |  | +                            if (StringUtils.isNotEmpty(cell.getStringCellValue())) {
 | 
	
		
			
				|  |  | +                                    warehousebillsitems.setfWarehouseInformation(cell.getStringCellValue());
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                            break;*/
 | 
	
		
			
				|  |  | +                        case "库位":
 | 
	
		
			
				|  |  | +                            // 设置单元格类型
 | 
	
		
			
				|  |  | +                            cell.setCellType(CellType.STRING);
 | 
	
		
			
				|  |  | +                            if (StringUtils.isNotEmpty(cell.getStringCellValue()) && ObjectUtils.isNotNull(fWarehouseid)) {
 | 
	
		
			
				|  |  | +                                TWarehouse tWarehouse = tWarehouseMapper.selectByPidANDName(cell.getStringCellValue(), fWarehouseid);
 | 
	
		
			
				|  |  | +                                if (ObjectUtils.isNotNull(tWarehouse)) {
 | 
	
		
			
				|  |  | +//                                    if (ObjectUtils.isNotNull(tWarehouse.getAncestors())) {
 | 
	
		
			
				|  |  | +//                                        String[] arrs = tWarehouse.getAncestors().split(",");
 | 
	
		
			
				|  |  | +//                                        String text = "";
 | 
	
		
			
				|  |  | +//                                        for (String arr : arrs) {
 | 
	
		
			
				|  |  | +//                                            tWarehouseMapper.selectTWarehouseById();
 | 
	
		
			
				|  |  | +//                                        }
 | 
	
		
			
				|  |  | +//                                    }
 | 
	
		
			
				|  |  | +                                    warehousebillsitems.setfWarehouselocid(tWarehouse.getfId());
 | 
	
		
			
				|  |  | +                                    warehousebillsitems.setfWarehouseInformation(tWarehouseZ.getfName() + "/" + tWarehouse.getfName());
 | 
	
		
			
				|  |  | +                                } else {
 | 
	
		
			
				|  |  | +                                    warehousebillsitems.setfWarehouselocid(null);
 | 
	
		
			
				|  |  | +                                    warehousebillsitems.setfWarehouseInformation(null);
 | 
	
		
			
				|  |  | +                                }
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                            break;
 | 
	
		
			
				|  |  | +                        case "规格":
 | 
	
		
			
				|  |  | +                            //设置单元格类型
 | 
	
		
			
				|  |  | +                            cell.setCellType(CellType.STRING);
 | 
	
		
			
				|  |  | +                            if (StringUtils.isNotEmpty(cell.getStringCellValue())) {
 | 
	
		
			
				|  |  | +                                warehousebillsitems.setfPackagespecs(cell.getStringCellValue());
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                            break;
 | 
	
		
			
				|  |  | +                        case "批次号":
 | 
	
		
			
				|  |  | +                            //设置单元格类型
 | 
	
		
			
				|  |  | +                            cell.setCellType(CellType.STRING);
 | 
	
		
			
				|  |  | +                            if (StringUtils.isNotEmpty(cell.getStringCellValue())) {
 | 
	
		
			
				|  |  | +                                warehousebillsitems.setfLocalcntrno(cell.getStringCellValue());
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                            break;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                if (warehousebillsitems.getfGoodsid() != null) {
 | 
	
		
			
				|  |  | +                    itemList.add(warehousebillsitems);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        } catch (IOException e) {
 | 
	
		
			
				|  |  | +            return AjaxResult.error("上传文件失败,请检查文件是否损坏");
 | 
	
		
			
				|  |  | +        } catch (ParseException e) {
 | 
	
		
			
				|  |  | +            throw new RuntimeException(e);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        StringBuilder errinfo = new StringBuilder();
 | 
	
		
			
				|  |  | +        int line = 1;
 | 
	
		
			
				|  |  | +        for (TWarehousebillsitems li : itemList) {
 | 
	
		
			
				|  |  | +            if (ObjectUtil.isEmpty(li.getfBusinessType())) {
 | 
	
		
			
				|  |  | +                errinfo.append("第").append(line).append("行备案序号为空,");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if (li.getfGoodsid() == null) {
 | 
	
		
			
				|  |  | +                errinfo.append("第").append(line).append("行货物名称为空,");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if (li.getfWarehouselocid() == null) {
 | 
	
		
			
				|  |  | +                errinfo.append("第").append(line).append("行库位为空,");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if (StringUtils.isNull(li.getfPlanqty())) {
 | 
	
		
			
				|  |  | +                errinfo.append("第").append(line).append("行预计件数为空,");
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                li.setfQty(li.getfPlanqty());
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if (StringUtils.isNull(li.getfPlangrossweight())) {
 | 
	
		
			
				|  |  | +                errinfo.append("第").append(line).append("行预计毛重为空,");
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                li.setfGrossweight(li.getfPlangrossweight());
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if (StringUtils.isNull(li.getfPlannetweight())) {
 | 
	
		
			
				|  |  | +                errinfo.append("第").append(line).append("行预计净重为空,");
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                li.setfNetweight(li.getfPlannetweight());
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            line++;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (StringUtils.isEmpty(errinfo.toString())) {
 | 
	
		
			
				|  |  | +            TWarehouseBills warehouseBills = warehouseBillsMapper.selectTWarehousebillsById(billId);
 | 
	
		
			
				|  |  | +            Date mixDate = new Date();
 | 
	
		
			
				|  |  | +            if (CollectionUtils.isNotEmpty(itemList)) {
 | 
	
		
			
				|  |  | +                Date minDate = itemList.get(0).getfBsdate();
 | 
	
		
			
				|  |  | +                for (int i = 0; i < itemList.size(); i++) {
 | 
	
		
			
				|  |  | +                    Date date = itemList.get(i).getfBsdate();
 | 
	
		
			
				|  |  | +                    if (minDate.after(date)) {
 | 
	
		
			
				|  |  | +                        minDate = date;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                mixDate = minDate;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            String billsType = "SJRK";
 | 
	
		
			
				|  |  | +            for (TWarehousebillsitems wbItem : itemList) {
 | 
	
		
			
				|  |  | +                // 仓储计费日期
 | 
	
		
			
				|  |  | +                wbItem.setfBilltype(billsType);
 | 
	
		
			
				|  |  | +                if (!this.getFchargedate(billId, wbItem.getfBsdate())) {
 | 
	
		
			
				|  |  | +                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
 | 
	
		
			
				|  |  | +                    return AjaxResult.error("入库日期不能小于最小仓储费计算日期");
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                if ("1".equals(warehouseBills.getfChargetype())) {
 | 
	
		
			
				|  |  | +                    wbItem.setfChargedate(wbItem.getfBsdate());
 | 
	
		
			
				|  |  | +                } else if ("0".equals(warehouseBills.getfChargetype())) {
 | 
	
		
			
				|  |  | +                    Date fchargedate = tWarehousebillsitemsMapper.getFchargedate(billId);
 | 
	
		
			
				|  |  | +                    if (fchargedate != null) {
 | 
	
		
			
				|  |  | +                        wbItem.setfChargedate(fchargedate);
 | 
	
		
			
				|  |  | +                    } else {
 | 
	
		
			
				|  |  | +                        wbItem.setfChargedate(mixDate);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                wbItem.setfBillingway(warehouseBills.getfBillingway());
 | 
	
		
			
				|  |  | +                wbItem.setfMblno(warehouseBills.getfMblno());// 入库更新库存前执行update更新明细的提单号等于主表的提单号
 | 
	
		
			
				|  |  | +                TWarehouse tWarehouse1 = tWarehouseMapper.selectTWarehouseById(wbItem.getfWarehouselocid());
 | 
	
		
			
				|  |  | +                wbItem.setfWarehouseInformation(tWarehouseZ.getfName() + "/" + tWarehouse1.getfName());
 | 
	
		
			
				|  |  | +                // 添加主表 业务单号
 | 
	
		
			
				|  |  | +                wbItem.setfBillno(warehouseBills.getfBillno());
 | 
	
		
			
				|  |  | +                wbItem.setfBillstatus(10L);
 | 
	
		
			
				|  |  | +                wbItem.setfPid(billId);
 | 
	
		
			
				|  |  | +                wbItem.setCreateBy(loginUser.getUser().getUserName());
 | 
	
		
			
				|  |  | +                wbItem.setCreateTime(new Date());
 | 
	
		
			
				|  |  | +                tWarehousebillsitemsMapper.insertTWarehousebillsitems(wbItem);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            return AjaxResult.success(itemList);
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            return AjaxResult.success(errinfo.toString(), itemList);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * RSA 签名
 | 
	
		
			
				|  |  |       *
 |