|
@ -1,10 +1,12 @@ |
|
|
package com.yxt.supervise.customer.biz.purchaserequisition; |
|
|
package com.yxt.supervise.customer.biz.purchaserequisition; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
|
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
import com.yxt.supervise.customer.api.gdwholesalegd.GdWholesaleGd; |
|
|
import com.yxt.supervise.customer.api.gdwholesalegd.GdWholesaleGd; |
|
|
import com.yxt.supervise.customer.api.gdwholesalegd.GdWholesaleGdExcelVo; |
|
|
import com.yxt.supervise.customer.api.gdwholesalegd.GdWholesaleGdExcelVo; |
|
@ -17,9 +19,19 @@ import com.yxt.supervise.customer.api.restrictedbrand.RestrictedBrand; |
|
|
import com.yxt.supervise.customer.api.restrictedbrand.RestrictedBrandQuery; |
|
|
import com.yxt.supervise.customer.api.restrictedbrand.RestrictedBrandQuery; |
|
|
import com.yxt.supervise.customer.api.restrictedbrand.RestrictedBrandVo; |
|
|
import com.yxt.supervise.customer.api.restrictedbrand.RestrictedBrandVo; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
|
import org.apache.poi.hssf.usermodel.HSSFCell; |
|
|
|
|
|
import org.apache.poi.hssf.usermodel.HSSFCellStyle; |
|
|
|
|
|
import org.apache.poi.hssf.usermodel.HSSFRow; |
|
|
|
|
|
import org.apache.poi.hssf.usermodel.HSSFSheet; |
|
|
|
|
|
import org.apache.poi.ss.usermodel.CellType; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
|
import java.text.ParseException; |
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
|
import java.util.Date; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @author wangpengfei |
|
|
* @author wangpengfei |
|
@ -77,4 +89,514 @@ public class PurchaseRequisitionService extends MybatisBaseService<PurchaseRequi |
|
|
List<PurchaseRequisitionExcelVo> pagging = baseMapper.exportExcel(qw); |
|
|
List<PurchaseRequisitionExcelVo> pagging = baseMapper.exportExcel(qw); |
|
|
return pagging; |
|
|
return pagging; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void supplierAnalysis() throws ParseException { |
|
|
|
|
|
ztspglhzb(); |
|
|
|
|
|
gysddmxb(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 在途商品管理汇总表 |
|
|
|
|
|
* |
|
|
|
|
|
* @throws ParseException |
|
|
|
|
|
*/ |
|
|
|
|
|
public void ztspglhzb() throws ParseException { |
|
|
|
|
|
// Date date = new Date();
|
|
|
|
|
|
// SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMdd");
|
|
|
|
|
|
// baseMapper.deleteAll();
|
|
|
|
|
|
// List<Map<String, Object>> list = baseMapper.ztspglhzb();//--在途商品管理汇总表
|
|
|
|
|
|
// for (Map<String, Object> m : list) {
|
|
|
|
|
|
// String billTotalPrice = m.get("billTotalPrice") != null ? m.get("billTotalPrice").toString() : "0";//订单总额
|
|
|
|
|
|
// String prodValue = m.get("prodValue") != null ? m.get("prodValue").toString() : "0";//实际到货价值
|
|
|
|
|
|
// String arrivalDate = m.get("arrivalDate") != null ? m.get("arrivalDate").toString() : "0";//全部到货日期
|
|
|
|
|
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
|
|
|
|
|
|
// m.put("date", sdf.format(date));
|
|
|
|
|
|
// m.put("no", sdf1.format(date).toString() + "01");//编号
|
|
|
|
|
|
// BigDecimal bigDecimal = new BigDecimal(billTotalPrice); //总金额
|
|
|
|
|
|
// BigDecimal bigDecimal1 = new BigDecimal(prodValue);//到货金额
|
|
|
|
|
|
// BigDecimal subtract = bigDecimal.subtract(bigDecimal1);//有未到货的货值
|
|
|
|
|
|
// Date parse = sdf.parse(arrivalDate);
|
|
|
|
|
|
// long nowMillisecond = date.getTime();
|
|
|
|
|
|
// long arrivalMillisecond = parse.getTime();//到货日期
|
|
|
|
|
|
// if (nowMillisecond > arrivalMillisecond && subtract.compareTo(new BigDecimal("0")) == 1) {//是否延期 大于到货日期 并且在途货值大于0 为延期
|
|
|
|
|
|
// m.put("sfyq", "是");
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// m.put("sfyq", "否");
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (subtract.compareTo(new BigDecimal("0")) == 1) {
|
|
|
|
|
|
// m.put("wdhjz", subtract.toString());
|
|
|
|
|
|
// m.put("cchjz", "0");
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// m.put("wdhjz", "0");
|
|
|
|
|
|
// BigDecimal subtract2 = bigDecimal1.subtract(bigDecimal);
|
|
|
|
|
|
// m.put("cchjz", subtract2.toString());
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// log.info("ztspglhzb:{}", JSONObject.toJSONString(list));
|
|
|
|
|
|
// baseMapper.insertZtspglhzb(list);
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 供应商订单明细表 |
|
|
|
|
|
*/ |
|
|
|
|
|
public void gysddmxb() { |
|
|
|
|
|
// Date date = new Date();
|
|
|
|
|
|
// SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMdd");
|
|
|
|
|
|
// List<Map<String, String>> list2 = baseMapper.gysddmxb();//--供应商订单明细表
|
|
|
|
|
|
// for (Map<String, String> m : list2) {
|
|
|
|
|
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
|
|
|
|
|
|
// String format = sdf.format(date);
|
|
|
|
|
|
// m.put("date", format.toString());
|
|
|
|
|
|
// String no = sdf1.format(date).toString() + "01";//编号
|
|
|
|
|
|
// m.put("no", no);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// log.info("gysddmxb:{}", JSONObject.toJSONString(list2));
|
|
|
|
|
|
// baseMapper.deleteGysddmxb();
|
|
|
|
|
|
// baseMapper.insertGysddmxb(list2);
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
// public ResultBean<String> readBrandPeriodSorXls1(InputStream is) {
|
|
|
|
|
|
// /* int ii=uddatePrice();
|
|
|
|
|
|
// if(ii==1){
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }*/
|
|
|
|
|
|
// HSSFWorkbook hssfWorkbook = null;
|
|
|
|
|
|
// try {
|
|
|
|
|
|
// hssfWorkbook = new HSSFWorkbook(is);
|
|
|
|
|
|
// } catch (IOException e) {
|
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// List<String> lisss=new ArrayList<>();
|
|
|
|
|
|
// List<String> lisss2=new ArrayList<>();
|
|
|
|
|
|
// HSSFSheet hssfSheet = hssfWorkbook.getSheetAt(0);
|
|
|
|
|
|
// PurchaseRequisition pr=new PurchaseRequisition();
|
|
|
|
|
|
// List<PurchaseRequisitionPro> prps=new ArrayList<>();
|
|
|
|
|
|
// pr.setPurchasingOrgCode("1");
|
|
|
|
|
|
// pr.setPurchasingOrgName("36524集团");
|
|
|
|
|
|
// pr.setPurchasingDeptCode("9001");
|
|
|
|
|
|
// pr.setPurchasingDeptName("365生活通");
|
|
|
|
|
|
// // 循环行Row
|
|
|
|
|
|
// for (int rowNum = 0; rowNum <=hssfSheet.getLastRowNum(); rowNum++) {
|
|
|
|
|
|
// HSSFRow hssfRow = hssfSheet.getRow(rowNum);
|
|
|
|
|
|
// int i = 0;
|
|
|
|
|
|
// try{
|
|
|
|
|
|
// //设置单号 填单人 填单时间
|
|
|
|
|
|
// /*if(rowNum==0){
|
|
|
|
|
|
// for ( ; i < hssfRow.getLastCellNum(); i++) {
|
|
|
|
|
|
// setRow0(pr, hssfRow, i);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }*/
|
|
|
|
|
|
// //设置单号 填单人 填单时间
|
|
|
|
|
|
// if(rowNum==1){
|
|
|
|
|
|
// for ( ; i < hssfRow.getLastCellNum(); i++) {
|
|
|
|
|
|
// setRow1(pr, hssfRow, i);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// //设置供货单位 仓位 到货日期
|
|
|
|
|
|
// if(rowNum==2){
|
|
|
|
|
|
// for ( ; i < hssfRow.getLastCellNum(); i++) {
|
|
|
|
|
|
// setRow2(pr, hssfRow, i);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// //设置采购员 入库单位 单据到效期
|
|
|
|
|
|
// if(rowNum==3){
|
|
|
|
|
|
// for ( ; i < hssfRow.getLastCellNum(); i++) {
|
|
|
|
|
|
// setRow3(pr, hssfRow, i);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// //设置采购员 入库单位 单据到效期
|
|
|
|
|
|
// if(rowNum==4){
|
|
|
|
|
|
// for ( ; i < hssfRow.getLastCellNum(); i++) {
|
|
|
|
|
|
// setRow4(pr, hssfRow, i);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if(rowNum>6){
|
|
|
|
|
|
// ProductInformation p=new ProductInformation();
|
|
|
|
|
|
// PurchaseRequisitionPro prp = new PurchaseRequisitionPro();
|
|
|
|
|
|
// prp.setMainSid(pr.getSid());
|
|
|
|
|
|
// String hsje="";//含税金额
|
|
|
|
|
|
// for ( ; i < hssfRow.getLastCellNum(); i++) {
|
|
|
|
|
|
// HSSFCell brandIdHSSFCell = hssfRow.getCell(i);
|
|
|
|
|
|
// if(brandIdHSSFCell!=null){
|
|
|
|
|
|
// if (i == 1) {//商品代码
|
|
|
|
|
|
// brandIdHSSFCell.setCellType(CellType.STRING);
|
|
|
|
|
|
// String code = brandIdHSSFCell.getStringCellValue();
|
|
|
|
|
|
// ProductInformationVo productInformation=productInformationService.selectByCode(code);
|
|
|
|
|
|
// if(productInformation==null){
|
|
|
|
|
|
// p.setCode(code);
|
|
|
|
|
|
// }else{
|
|
|
|
|
|
// prp.setCategory(productInformation.getCategory());
|
|
|
|
|
|
// prp.setCategoryKey(productInformation.getCategoryKey());
|
|
|
|
|
|
// prp.setBrand(productInformation.getBrand());
|
|
|
|
|
|
// prp.setBrandCode(productInformation.getBrandSid());
|
|
|
|
|
|
// }
|
|
|
|
|
|
// prp.setProCode(code);
|
|
|
|
|
|
// prp.setContent("code");//规格型号
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (i == 2) {//名称
|
|
|
|
|
|
// brandIdHSSFCell.setCellType(CellType.STRING);
|
|
|
|
|
|
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
|
|
|
|
|
|
// String name = brandIdHSSFCell.getStringCellValue();
|
|
|
|
|
|
// prp.setProName(name);
|
|
|
|
|
|
// p.setName(name);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (i == 3) {//数量
|
|
|
|
|
|
// brandIdHSSFCell.setCellType(CellType.STRING);
|
|
|
|
|
|
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
|
|
|
|
|
|
// String value = brandIdHSSFCell.getStringCellValue();
|
|
|
|
|
|
// prp.setNumber(value);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (i == 10) {//第二代码
|
|
|
|
|
|
// brandIdHSSFCell.setCellType(CellType.STRING);
|
|
|
|
|
|
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
|
|
|
|
|
|
// String value = brandIdHSSFCell.getStringCellValue();
|
|
|
|
|
|
// prp.setSecondCode(value);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (i == 53) {//包装数量
|
|
|
|
|
|
// brandIdHSSFCell.setCellType(CellType.STRING);
|
|
|
|
|
|
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
|
|
|
|
|
|
// String value = brandIdHSSFCell.getStringCellValue();
|
|
|
|
|
|
// prp.setPackageNumber(value);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (i == 53) {//包内数量 对应采购订单的规格
|
|
|
|
|
|
// brandIdHSSFCell.setCellType(CellType.STRING);
|
|
|
|
|
|
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
|
|
|
|
|
|
// String value= brandIdHSSFCell.getStringCellValue();
|
|
|
|
|
|
// prp.setPackageNumber(value);
|
|
|
|
|
|
// prp.setPackageInsideNumber(value);
|
|
|
|
|
|
// BigDecimal v3 = new BigDecimal(value);//包内数量 规格
|
|
|
|
|
|
// String packagePrice = prp.getPackagePrice();//包装价格
|
|
|
|
|
|
// BigDecimal v4 = new BigDecimal(packagePrice);
|
|
|
|
|
|
// BigDecimal divide = v4.divide(v3, 2,BigDecimal.ROUND_HALF_UP);//单价
|
|
|
|
|
|
// String number = prp.getNumber();//数量
|
|
|
|
|
|
// BigDecimal v5 = new BigDecimal(number);
|
|
|
|
|
|
// BigDecimal v6 = divide .multiply( v5);//订货总金额
|
|
|
|
|
|
// String packageInsideNumber = prp.getPackageInsideNumber();
|
|
|
|
|
|
// BigDecimal v = new BigDecimal(packagePrice).divide(new BigDecimal(packageInsideNumber),2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
// prp.setUnitPrice(v.toString());
|
|
|
|
|
|
// BigDecimal bigDecimal = new BigDecimal(hsje);
|
|
|
|
|
|
// BigDecimal v10 = bigDecimal.divide(new BigDecimal(value),2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
// prp.setUnitPriceTax(v10.toString());
|
|
|
|
|
|
// prp.setTotalPrice(v6.toString());
|
|
|
|
|
|
// ProductInformationVo productInformationVo = productInformationService.selectByCode(prp.getProCode());
|
|
|
|
|
|
// productInformationVo.setNewestPurchasePrice(divide.toString());
|
|
|
|
|
|
// BigDecimal v122 = new BigDecimal(packagePrice).divide(new BigDecimal(prp.getPackageNumber()),2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
// productInformationVo.setLatestPurchasePrice(v122.toString());
|
|
|
|
|
|
// ProductInformation pif=new ProductInformation();
|
|
|
|
|
|
// BeanUtil.copyProperties(productInformationVo,pif);
|
|
|
|
|
|
// productInformationService.updateById(pif);
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// if(StringUtils.isNotBlank(p.getCode())){
|
|
|
|
|
|
// p.setBrandSid("supervise");
|
|
|
|
|
|
// p.setBrand("监管");
|
|
|
|
|
|
// String categoryKey = prp.getCategoryKey();
|
|
|
|
|
|
// DictCommonDetailsVo category = dictCommonService.fetchByKeyAndType(categoryKey, "category");
|
|
|
|
|
|
// if(category==null){
|
|
|
|
|
|
// category=new DictCommonDetailsVo();
|
|
|
|
|
|
// category.setDictKey(categoryKey);
|
|
|
|
|
|
// category.setDictValue(prp.getCategory());
|
|
|
|
|
|
// category.setDictType("category");
|
|
|
|
|
|
// DictCommon dictCommon = new DictCommon();
|
|
|
|
|
|
// BeanUtil.copyProperties(category,dictCommon);
|
|
|
|
|
|
// dictCommonService.insert(dictCommon);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// p.setCategoryKey(category.getDictKey());
|
|
|
|
|
|
// p.setCategory(category.getDictValue());
|
|
|
|
|
|
// productInformationService.insert(p);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (i == 4) {//包装规格
|
|
|
|
|
|
// brandIdHSSFCell.setCellType(CellType.STRING);
|
|
|
|
|
|
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
|
|
|
|
|
|
// String value= brandIdHSSFCell.getStringCellValue();
|
|
|
|
|
|
// prp.setPackageSpec(value);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (i == 11) {//单位
|
|
|
|
|
|
// brandIdHSSFCell.setCellType(CellType.STRING);
|
|
|
|
|
|
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
|
|
|
|
|
|
// String value= brandIdHSSFCell.getStringCellValue();
|
|
|
|
|
|
// prp.setUnit(value);
|
|
|
|
|
|
// p.setUnit(value);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (i == 34) {//包装价格(元)
|
|
|
|
|
|
// brandIdHSSFCell.setCellType(CellType.STRING);
|
|
|
|
|
|
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
|
|
|
|
|
|
// String value= brandIdHSSFCell.getStringCellValue();
|
|
|
|
|
|
// prp.setPackagePrice(value);
|
|
|
|
|
|
// // prp.setPackageInsideNumber(i1+"");
|
|
|
|
|
|
//
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (i == 37) {//包合计(元)
|
|
|
|
|
|
// brandIdHSSFCell.setCellType(CellType.STRING);
|
|
|
|
|
|
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
|
|
|
|
|
|
// String value= brandIdHSSFCell.getStringCellValue();
|
|
|
|
|
|
// prp.setPackageTotalPrice(value);
|
|
|
|
|
|
// //latestPurchasePrice
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// if (i == 54) {//零售金额
|
|
|
|
|
|
// brandIdHSSFCell.setCellType(CellType.STRING);
|
|
|
|
|
|
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
|
|
|
|
|
|
// String value= brandIdHSSFCell.getStringCellValue();
|
|
|
|
|
|
// prp.setRetailAmount(value);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (i == 51) {//品类
|
|
|
|
|
|
// brandIdHSSFCell.setCellType(CellType.STRING);
|
|
|
|
|
|
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
|
|
|
|
|
|
// String value= brandIdHSSFCell.getStringCellValue();
|
|
|
|
|
|
// String[] split = value.split("\\[");
|
|
|
|
|
|
// String v = split[0];//类别value
|
|
|
|
|
|
// String key=split[1].replace("]","");//key
|
|
|
|
|
|
// prp.setCategory(v);
|
|
|
|
|
|
// prp.setCategoryKey(key);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (i == 12) {//配货价格
|
|
|
|
|
|
// brandIdHSSFCell.setCellType(CellType.STRING);
|
|
|
|
|
|
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
|
|
|
|
|
|
// String value= brandIdHSSFCell.getStringCellValue();
|
|
|
|
|
|
// prp.setRetailAmount(value);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// if (i == 7) {//含税单价(元)
|
|
|
|
|
|
// brandIdHSSFCell.setCellType(CellType.STRING);
|
|
|
|
|
|
// if(StringUtils.isBlank(prp.getProCode())){
|
|
|
|
|
|
// continue;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
|
|
|
|
|
|
// hsje= brandIdHSSFCell.getStringCellValue();
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }else{
|
|
|
|
|
|
// System.err.println("rowNum="+rowNum+",i="+i+",value=null");
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if(StringUtils.isNotBlank(prp.getProCode())){
|
|
|
|
|
|
// prps.add(prp);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }catch(Exception e){
|
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
|
// System.err.println("i="+i+",value=null");
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// lisss.add(rowNum+"");
|
|
|
|
|
|
//
|
|
|
|
|
|
// }
|
|
|
|
|
|
// log.info("productInformation:{}", JSONObject.toJSONString(pr));
|
|
|
|
|
|
// ResultBean<String> objectResultBean=ResultBean.fireFail();
|
|
|
|
|
|
// SupplierInfoVo supplierInfoVo = supplierInfoService.selectByCodeForIndex(pr.getSupplierCode());
|
|
|
|
|
|
// if(supplierInfoVo==null){
|
|
|
|
|
|
// return objectResultBean.setMsg("供应商不存在!");
|
|
|
|
|
|
// }
|
|
|
|
|
|
// // List<Map<String,String>> suplierZtyz=baseMapper.suplierZtyz(pr.getSupplierCode()); 临时注释掉 2023-01-16
|
|
|
|
|
|
// List<Map<String,String>> suplierZtyz=baseMapper.suplierZtyz2(pr.getSupplierCode());
|
|
|
|
|
|
// if(suplierZtyz.size()>0){
|
|
|
|
|
|
// return objectResultBean.setMsg("供应商有在途商品!");
|
|
|
|
|
|
// }
|
|
|
|
|
|
// purchaseRequisitionService.insert(pr);
|
|
|
|
|
|
// for (PurchaseRequisitionPro p: prps){
|
|
|
|
|
|
// purchaseRequisitionProService.insert(p);
|
|
|
|
|
|
// /* String proCode = p.getProCode();*/
|
|
|
|
|
|
// /*int row=purchaseRequisitionProService.selectProdCodeTable(proCode);
|
|
|
|
|
|
// if(row==0){
|
|
|
|
|
|
// purchaseRequisitionProService.insertProdCodeTable(proCode);
|
|
|
|
|
|
// }*/
|
|
|
|
|
|
// }
|
|
|
|
|
|
// GdRescategoryProdService.resetCache();
|
|
|
|
|
|
// log.info("x:{}",JSON.toJSONString(lisss));
|
|
|
|
|
|
// String x1 = JSON.toJSONString(lisss2);
|
|
|
|
|
|
// log.info("x1:{}",JSON.toJSONString(lisss2));
|
|
|
|
|
|
// return objectResultBean.success().setData(pr.getCode());
|
|
|
|
|
|
// //return message;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// private void setRow0(PurchaseRequisition pr, HSSFRow hssfRow, int i) {
|
|
|
|
|
|
// HSSFCell brandIdHSSFCell = hssfRow.getCell(i);
|
|
|
|
|
|
// if(brandIdHSSFCell!=null){
|
|
|
|
|
|
// if (i == 1) {//单号
|
|
|
|
|
|
// brandIdHSSFCell.setCellType(CellType.STRING);
|
|
|
|
|
|
// String code = brandIdHSSFCell.getStringCellValue();
|
|
|
|
|
|
// if(com.yxt.common.base.utils.StringUtils.isNotBlank(code)){
|
|
|
|
|
|
// PurchaseRequisition purchaseRequisition = purchaseRequisitionService.selectByCode(code);
|
|
|
|
|
|
// if(purchaseRequisition!=null){
|
|
|
|
|
|
// String newCode = purchaseRequisition.getNewCode();
|
|
|
|
|
|
// String[] split = newCode.split(",");
|
|
|
|
|
|
// split[split.length]=code;
|
|
|
|
|
|
// String str="";
|
|
|
|
|
|
// for(String s:split){
|
|
|
|
|
|
// str=str+","+s;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// String substring = str.substring(1, str.length());
|
|
|
|
|
|
// purchaseRequisition.setNewCode(substring);
|
|
|
|
|
|
// purchaseRequisitionService.updateById(purchaseRequisition);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// pr.setOldCode(code);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// private void setRow1(PurchaseRequisition pr, HSSFRow hssfRow, int i) {
|
|
|
|
|
|
// HSSFCell brandIdHSSFCell = hssfRow.getCell(i);
|
|
|
|
|
|
// if(brandIdHSSFCell!=null){
|
|
|
|
|
|
// if (i == 1) {//单号
|
|
|
|
|
|
// brandIdHSSFCell.setCellType(CellType.STRING);
|
|
|
|
|
|
// String code = brandIdHSSFCell.getStringCellValue();
|
|
|
|
|
|
// PurchaseRequisition purchaseRequisition = baseMapper.selectByCode(code);
|
|
|
|
|
|
// Map<String,Object> map=new HashMap<>();
|
|
|
|
|
|
// map.put("code",code);
|
|
|
|
|
|
// baseMapper.deleteByMap(map);
|
|
|
|
|
|
// purchaseRequisition=new PurchaseRequisition();
|
|
|
|
|
|
// Map<String,Object> map1=new HashMap<>();
|
|
|
|
|
|
// if(purchaseRequisition!=null){
|
|
|
|
|
|
// map1.put("mainSid",purchaseRequisition.getSid());
|
|
|
|
|
|
// purchaseRequisitionProService.deleteByMap(map1);
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// //ProductInformationVo productInformationVo = baseMapper.selectByCode(code);
|
|
|
|
|
|
// pr.setCode(code);
|
|
|
|
|
|
//
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (i == 3) {//填单人
|
|
|
|
|
|
// brandIdHSSFCell.setCellType(CellType.STRING);
|
|
|
|
|
|
// String value = brandIdHSSFCell.getStringCellValue();
|
|
|
|
|
|
// //ProductInformationVo productInformationVo = baseMapper.selectByCode(code);
|
|
|
|
|
|
// String[] split = value.split("\\[");
|
|
|
|
|
|
// String v = split[0];//类别value
|
|
|
|
|
|
// String key=split[1].replace("]","");//key
|
|
|
|
|
|
// pr.setBuyerName(v);
|
|
|
|
|
|
// pr.setBuyerCode(key);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (i == 5) {//填单时间
|
|
|
|
|
|
// brandIdHSSFCell.setCellType(CellType.STRING);
|
|
|
|
|
|
// String value = brandIdHSSFCell.getStringCellValue();
|
|
|
|
|
|
// //ProductInformationVo productInformationVo = baseMapper.selectByCode(code);
|
|
|
|
|
|
// pr.setPurchaseDate(value);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// private void setRow2(PurchaseRequisition pr, HSSFRow hssfRow, int i) {
|
|
|
|
|
|
// HSSFCell brandIdHSSFCell = hssfRow.getCell(i);
|
|
|
|
|
|
// if(brandIdHSSFCell!=null){
|
|
|
|
|
|
// if (i == 1) {//供货单位 供应商
|
|
|
|
|
|
// brandIdHSSFCell.setCellType(CellType.STRING);
|
|
|
|
|
|
// String value = brandIdHSSFCell.getStringCellValue();
|
|
|
|
|
|
// String[] split = value.split("\\[");
|
|
|
|
|
|
// String v = split[0];//类别value
|
|
|
|
|
|
// String key=split[1].replace("]","");//key
|
|
|
|
|
|
// SupplierInfoVo supplierInfoVo = supplierInfoService.selectByCodeForIndex(key);
|
|
|
|
|
|
// pr.setSupplierCode(supplierInfoVo.getCodeUnified());
|
|
|
|
|
|
// pr.setSupplierName(v);
|
|
|
|
|
|
//
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (i == 3) {//仓位
|
|
|
|
|
|
// brandIdHSSFCell.setCellType(CellType.STRING);
|
|
|
|
|
|
// String value = brandIdHSSFCell.getStringCellValue();
|
|
|
|
|
|
// String[] split = value.split("\\[");
|
|
|
|
|
|
// String v ="供应链仓";// split[0];//类别value
|
|
|
|
|
|
// String key="112";//split[1].replace("]","");//key
|
|
|
|
|
|
// WarehousePositionVo warehousePositionVo = warehousePositionService.selectByCode(key);
|
|
|
|
|
|
// if(warehousePositionVo==null){
|
|
|
|
|
|
// WarehousePosition warehousePosition=new WarehousePosition();
|
|
|
|
|
|
// warehousePosition.setName(v);
|
|
|
|
|
|
// warehousePosition.setCode(key);
|
|
|
|
|
|
// warehousePositionService.insert(warehousePosition);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// pr.setWarehousePosition(v);
|
|
|
|
|
|
// pr.setWarehousePositionCode(key);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (i == 5) {//到货日期
|
|
|
|
|
|
// brandIdHSSFCell.setCellType(CellType.STRING);
|
|
|
|
|
|
// String value = brandIdHSSFCell.getStringCellValue();
|
|
|
|
|
|
// //ProductInformationVo productInformationVo = baseMapper.selectByCode(code);
|
|
|
|
|
|
// pr.setArrivalDate(value);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
private void setRow3(PurchaseRequisition pr, HSSFRow hssfRow, int i) { |
|
|
|
|
|
HSSFCell brandIdHSSFCell = hssfRow.getCell(i); |
|
|
|
|
|
if (brandIdHSSFCell != null) { |
|
|
|
|
|
if (i == 1) {//采购员
|
|
|
|
|
|
brandIdHSSFCell.setCellType(CellType.STRING); |
|
|
|
|
|
String value = brandIdHSSFCell.getStringCellValue(); |
|
|
|
|
|
//ProductInformationVo productInformationVo = baseMapper.selectByCode(code);
|
|
|
|
|
|
String[] split = value.split("\\["); |
|
|
|
|
|
String v = split[0];//类别value
|
|
|
|
|
|
String key = split[1].replace("]", "");//key
|
|
|
|
|
|
pr.setBuyerName(v); |
|
|
|
|
|
pr.setBuyerCode(key); |
|
|
|
|
|
pr.setLogisticsCompanyCode(key); |
|
|
|
|
|
pr.setLogisticsCompanyName(v); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (i == 5) {//单据到效期
|
|
|
|
|
|
brandIdHSSFCell.setCellType(CellType.STRING); |
|
|
|
|
|
String value = brandIdHSSFCell.getStringCellValue(); |
|
|
|
|
|
//ProductInformationVo productInformationVo = baseMapper.selectByCode(code);
|
|
|
|
|
|
pr.setExpiryDate(value); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void setRow4(PurchaseRequisition pr, HSSFRow hssfRow, int i) { |
|
|
|
|
|
HSSFCell brandIdHSSFCell = hssfRow.getCell(i); |
|
|
|
|
|
if (brandIdHSSFCell != null) { |
|
|
|
|
|
if (i == 5) {//完成状态
|
|
|
|
|
|
brandIdHSSFCell.setCellType(CellType.STRING); |
|
|
|
|
|
String value = brandIdHSSFCell.getStringCellValue(); |
|
|
|
|
|
//ProductInformationVo productInformationVo = baseMapper.selectByCode(code);
|
|
|
|
|
|
pr.setCompletionStatus(value); |
|
|
|
|
|
pr.setCompletionStatusKey("0");//0未完成
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void createRow3(HSSFSheet sheet, int rownum, String[] col1, HSSFCellStyle style) { |
|
|
|
|
|
//声明列对象
|
|
|
|
|
|
HSSFCell cell = null; |
|
|
|
|
|
//创建标题
|
|
|
|
|
|
HSSFRow row2 = sheet.createRow(rownum); |
|
|
|
|
|
for (int i = 0; i < col1.length; i++) { |
|
|
|
|
|
cell = row2.createCell(i); |
|
|
|
|
|
cell.setCellValue(col1[i]); |
|
|
|
|
|
cell.setCellStyle(style); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ResultBean<String> checkCodeByFileName(String filename) { |
|
|
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
|
|
if (StringUtils.isBlank(filename)) |
|
|
|
|
|
return rb.setMsg("文件名不可为空"); |
|
|
|
|
|
if (filename.length() < 15) |
|
|
|
|
|
return rb.setMsg("文件名格式错误"); |
|
|
|
|
|
String code = filename.substring(0, 14); |
|
|
|
|
|
PurchaseRequisition purchaseRequisition = fetchByCode(code); |
|
|
|
|
|
if (purchaseRequisition == null) |
|
|
|
|
|
return rb.success().setData("nothas"); |
|
|
|
|
|
return rb.success().setData("hased"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public PurchaseRequisition fetchByCode(String code) { |
|
|
|
|
|
QueryWrapper<PurchaseRequisition> qw = new QueryWrapper<>(); |
|
|
|
|
|
qw.eq("code", code); |
|
|
|
|
|
List<PurchaseRequisition> list = baseMapper.selectList(qw); |
|
|
|
|
|
if (list == null || list.isEmpty()) |
|
|
|
|
|
return null; |
|
|
|
|
|
return list.get(0); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|