功能调整
parent
e2d7da9938
commit
4f992bf739
|
|
@ -16,6 +16,8 @@
|
||||||
|
|
||||||
package com.youchain.utils;
|
package com.youchain.utils;
|
||||||
|
|
||||||
|
import com.youchain.exception.BadRequestException;
|
||||||
|
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
|
@ -23,6 +25,7 @@ import java.time.*;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author: liaojinlong
|
* @author: liaojinlong
|
||||||
|
|
@ -133,6 +136,27 @@ public class DateUtil {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static Date md_date(String dateString) {
|
||||||
|
try {
|
||||||
|
// 设置中国地区Locale
|
||||||
|
Locale chinaLocale = Locale.SIMPLIFIED_CHINESE;
|
||||||
|
// 获取当前年份
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
int currentYear = calendar.get(Calendar.YEAR);
|
||||||
|
// 构建完整的日期字符串
|
||||||
|
dateString = currentYear+"年" + dateString;
|
||||||
|
// 创建日期格式化对象
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日", chinaLocale);
|
||||||
|
// 解析日期字符串为Date对象
|
||||||
|
return dateFormat.parse(dateString);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
throw new BadRequestException(dateString+"日期格式错误");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日期格式化 yyyy-MM-dd
|
* 日期格式化 yyyy-MM-dd
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -134,8 +134,6 @@ public class BomAccount extends BaseEntity implements Serializable {
|
||||||
@Column(name = "`tckw`")
|
@Column(name = "`tckw`")
|
||||||
@ApiModelProperty(value = "台车库位,工程")
|
@ApiModelProperty(value = "台车库位,工程")
|
||||||
private String tckw;
|
private String tckw;
|
||||||
|
|
||||||
|
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "`z_point_id`")
|
@JoinColumn(name = "`z_point_id`")
|
||||||
@ApiModelProperty(value = "制造库位")
|
@ApiModelProperty(value = "制造库位")
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import lombok.Data;
|
||||||
public class ProductionPlanVo {
|
public class ProductionPlanVo {
|
||||||
private Long id;
|
private Long id;
|
||||||
private String machineNo;
|
private String machineNo;
|
||||||
|
private Long areaId;
|
||||||
private String workingStation;
|
private String workingStation;
|
||||||
private String name;
|
private String name;
|
||||||
private Integer number;
|
private Integer number;
|
||||||
|
|
|
||||||
|
|
@ -79,11 +79,21 @@ public interface ProductionPlanRepository extends JpaRepository<ProductionPlan,
|
||||||
String getIdNoWhyScGw( @Param("workingStation") String workingStation);
|
String getIdNoWhyScGw( @Param("workingStation") String workingStation);
|
||||||
|
|
||||||
|
|
||||||
@Query(value = "SELECT count(id) FROM base_production_plan p WHERE p.IDNO >= :IDNO and p.working_station =:workingStation and p.statue!='UN_CONSUME'", nativeQuery = true)
|
@Query(value = "SELECT count(id) FROM base_production_plan p WHERE p.IDNO >= :IDNO and p.machine_No=:machineNo and p.working_station =:workingStation and p.statue!='UN_CONSUME'", nativeQuery = true)
|
||||||
int existsGwHyIdno( @Param("IDNO") String IDNO,@Param("workingStation") String workingStation);
|
int existsGwHyIdno( @Param("IDNO") String IDNO,@Param("workingStation") String workingStation,@Param("machineNo")String machineNo);
|
||||||
@Query(value = "SELECT * FROM base_production_plan p WHERE p.idno >= :idno and p.working_station =:workingStation", nativeQuery = true)
|
@Query(value = "SELECT * FROM base_production_plan p WHERE p.idno >= :idno and p.machine_No=:machineNo and p.working_station =:workingStation", nativeQuery = true)
|
||||||
List<ProductionPlan> findByGwIdnoList(@Param("idno") String idno,@Param("workingStation") String workingStation);
|
List<ProductionPlan> findByGwIdnoList(@Param("idno") String idno,@Param("workingStation") String workingStation ,@Param("machineNo")String machineNo);
|
||||||
|
|
||||||
|
@Query(value = "SELECT * FROM base_production_plan p WHERE p.idno = :idno and p.machine_No=:machineNo and p.working_station =:workingStation", nativeQuery = true)
|
||||||
|
List<ProductionPlan> findByIDNO( @Param("idno") String idno,@Param("workingStation") String workingStation ,@Param("machineNo")String machineNo);
|
||||||
|
/**查找目前最大的序号*/
|
||||||
|
@Query(value = "SELECT max(order_no) FROM `base_production_plan` p where p.machine_No=:machineNo and p.working_station =:workingStation", nativeQuery = true)
|
||||||
|
Long getMaxOrderNo(@Param("workingStation") String workingStation ,@Param("machineNo")String machineNo);
|
||||||
|
|
||||||
|
@Query(value = "SELECT * FROM `base_production_plan` bpp where bpp.rk_area_id = :rk_area_id and bpp.statue='UN_CONSUME' AND bpp.`IDNO`<= :IDNO order by bpp.`IDNO` ASC", nativeQuery = true)
|
||||||
|
List<ProductionPlan> getIdNoAllData(@Param("rk_area_id") Long rk_area_id, @Param("IDNO")String IDNO);
|
||||||
|
|
||||||
|
@Query(value = "SELECT bpp.rk_area_id FROM `base_production_plan` bpp where bpp.`IDNO`<= :IDNO group by bpp.working_station", nativeQuery = true)
|
||||||
|
List<Long> getIdNoHyGw( @Param("IDNO")String IDNO);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -440,7 +440,7 @@ public class AutomaticPlanningController {
|
||||||
automaticPlanning.setStartNum(startNum);
|
automaticPlanning.setStartNum(startNum);
|
||||||
automaticPlanningService.update(automaticPlanning);
|
automaticPlanningService.update(automaticPlanning);
|
||||||
AutomaticPlanDetail detail=automaticPlanDetailService.storeAutomaticPlanDetail(automaticPlanning);
|
AutomaticPlanDetail detail=automaticPlanDetailService.storeAutomaticPlanDetail(automaticPlanning);
|
||||||
productionPlanService.scsxHaoyong(whyList,gw, "上线计划自动耗用:"+detail.getId());
|
productionPlanService.scsxHaoyong(whyList,detail.getShArea().getId(), "上线计划自动耗用:"+detail.getId());
|
||||||
}
|
}
|
||||||
return new ResponseEntity<>("操作成功",HttpStatus.OK);
|
return new ResponseEntity<>("操作成功",HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,13 +19,11 @@ import cn.hutool.json.JSONArray;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.youchain.annotation.AnonymousAccess;
|
import com.youchain.annotation.AnonymousAccess;
|
||||||
import com.youchain.annotation.Log;
|
import com.youchain.annotation.Log;
|
||||||
import com.youchain.basicdata.domain.BigItem;
|
import com.youchain.basicdata.domain.*;
|
||||||
import com.youchain.basicdata.domain.BomAccount;
|
|
||||||
import com.youchain.basicdata.domain.Item;
|
|
||||||
import com.youchain.basicdata.domain.Point;
|
|
||||||
import com.youchain.basicdata.repository.BomAccountRepository;
|
import com.youchain.basicdata.repository.BomAccountRepository;
|
||||||
import com.youchain.basicdata.repository.PointRepository;
|
import com.youchain.basicdata.repository.PointRepository;
|
||||||
import com.youchain.basicdata.repository.TableConfigRepository;
|
import com.youchain.basicdata.repository.TableConfigRepository;
|
||||||
|
import com.youchain.basicdata.service.AreaService;
|
||||||
import com.youchain.basicdata.service.BomAccountLogService;
|
import com.youchain.basicdata.service.BomAccountLogService;
|
||||||
import com.youchain.basicdata.service.BomAccountService;
|
import com.youchain.basicdata.service.BomAccountService;
|
||||||
import com.youchain.basicdata.service.PointService;
|
import com.youchain.basicdata.service.PointService;
|
||||||
|
|
@ -35,10 +33,7 @@ import com.youchain.basicdata.service.mapstruct.BomAccountMapper;
|
||||||
import com.youchain.businessdata.returnJson.BomPrint;
|
import com.youchain.businessdata.returnJson.BomPrint;
|
||||||
import com.youchain.businessdata.returnJson.BomPrint_BiaoQian;
|
import com.youchain.businessdata.returnJson.BomPrint_BiaoQian;
|
||||||
import com.youchain.businessdata.returnJson.BomPrint_BiaoQian2;
|
import com.youchain.businessdata.returnJson.BomPrint_BiaoQian2;
|
||||||
import com.youchain.utils.BaseStatus;
|
import com.youchain.utils.*;
|
||||||
import com.youchain.utils.RedisUtils;
|
|
||||||
import com.youchain.utils.SecurityUtils;
|
|
||||||
import com.youchain.utils.SpringContextHolder;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.dreamlu.mica.core.utils.JsonUtil;
|
import net.dreamlu.mica.core.utils.JsonUtil;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
@ -72,6 +67,7 @@ public class BomAccountController {
|
||||||
private final BomAccountMapper bomAccountMapper;
|
private final BomAccountMapper bomAccountMapper;
|
||||||
private final PointRepository pointRepository;
|
private final PointRepository pointRepository;
|
||||||
private final PointService pointService;
|
private final PointService pointService;
|
||||||
|
private final AreaService areaService;
|
||||||
private final BomAccountRepository bomAccountRepository;
|
private final BomAccountRepository bomAccountRepository;
|
||||||
|
|
||||||
@Log("导出数据")
|
@Log("导出数据")
|
||||||
|
|
@ -341,6 +337,15 @@ public class BomAccountController {
|
||||||
return new ResponseEntity<>(boms,HttpStatus.OK);
|
return new ResponseEntity<>(boms,HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = "/queryByAreaId/{areaId}")
|
||||||
|
@Log("根据库区查询bomAccount完成品品番")
|
||||||
|
@ApiOperation("根据库区查询bomAccount完成品品番")
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> queryByAreaId(@PathVariable("areaId") Long areaId){
|
||||||
|
List<BigItem> boms=bomAccountService.queryByAreaId(areaId);
|
||||||
|
return new ResponseEntity<>(boms,HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/queryBomAccountPoints")
|
@GetMapping(value = "/queryBomAccountPoints")
|
||||||
@Log("查询bomAccount品番库位")
|
@Log("查询bomAccount品番库位")
|
||||||
@ApiOperation("查询bomAccount品番库位")
|
@ApiOperation("查询bomAccount品番库位")
|
||||||
|
|
@ -355,28 +360,14 @@ public class BomAccountController {
|
||||||
@ApiOperation("新增bomAccount")
|
@ApiOperation("新增bomAccount")
|
||||||
@PreAuthorize("@el.check('super:man')")
|
@PreAuthorize("@el.check('super:man')")
|
||||||
public ResponseEntity<Object> createBomAccount(@Validated @RequestBody BomAccount resources){
|
public ResponseEntity<Object> createBomAccount(@Validated @RequestBody BomAccount resources){
|
||||||
// if(resources.getHPoint().getCode()==null){
|
Area area=areaService.findByCode(BaseStatus.DEFAULT_AREA);
|
||||||
// resources.setHPoint(null);
|
resources.setRArea(resources.getZPoint().getArea());
|
||||||
// }else{
|
resources.setCArea(area);
|
||||||
// Point point=pointRepository.findByCode(resources.getHPoint().getCode());
|
resources.setBigItemName(resources.getBigItem().getName());
|
||||||
// if (point == null) {
|
resources.setBigItemCode(resources.getBigItem().getCode());
|
||||||
// point = pointService.createPoint(resources.getHPoint().getCode(), "ZCKW", resources.getRArea(),null);
|
resources.setEnabled(true);
|
||||||
// }
|
resources.setBp_type("大");
|
||||||
// resources.setHPoint(point);
|
return new ResponseEntity<>(bomAccountService.create(resources),HttpStatus.CREATED);
|
||||||
// }
|
|
||||||
// if(resources.getZPoint().getCode()==null){
|
|
||||||
// resources.setZPoint(null);
|
|
||||||
// }else{
|
|
||||||
// Point point=pointRepository.findByCode(resources.getZPoint().getCode());
|
|
||||||
// if (point == null) {
|
|
||||||
// point = pointService.createPoint(resources.getZPoint().getCode(), BaseStatus.HCKW, resources.getRArea());
|
|
||||||
// }
|
|
||||||
// resources.setZPoint(point);
|
|
||||||
// }
|
|
||||||
BomAccountDto bomAccountDto=bomAccountService.create(resources);
|
|
||||||
// bomAccountDto.setRArea(bomAccountDto.getZPoint().getArea());
|
|
||||||
bomAccountLogService.copyBomAccount(bomAccountDto.getId(),"add");
|
|
||||||
return new ResponseEntity<>(bomAccountDto,HttpStatus.CREATED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
|
|
@ -384,26 +375,10 @@ public class BomAccountController {
|
||||||
@ApiOperation("修改bomAccount")
|
@ApiOperation("修改bomAccount")
|
||||||
@PreAuthorize("@el.check('super:man')")
|
@PreAuthorize("@el.check('super:man')")
|
||||||
public ResponseEntity<Object> updateBomAccount(@Validated @RequestBody BomAccount resources){
|
public ResponseEntity<Object> updateBomAccount(@Validated @RequestBody BomAccount resources){
|
||||||
// if(resources.getHPoint().getCode()==null){
|
resources.setBigItemName(resources.getBigItem().getName());
|
||||||
// resources.setHPoint(null);
|
resources.setBigItemCode(resources.getBigItem().getCode());
|
||||||
// }else{
|
resources.setRArea(resources.getZPoint().getArea());
|
||||||
// Point point=pointRepository.findByCode(resources.getHPoint().getCode());
|
|
||||||
// if (point == null) {
|
|
||||||
// point = pointService.createPoint(resources.getHPoint().getCode(), "ZCKW", resources.getRArea(),null);
|
|
||||||
// }
|
|
||||||
// resources.setHPoint(point);
|
|
||||||
// }
|
|
||||||
// if(resources.getZPoint().getCode()==null){
|
|
||||||
// resources.setZPoint(null);
|
|
||||||
// }else{
|
|
||||||
// Point point=pointRepository.findByCode(resources.getZPoint().getCode());
|
|
||||||
// if (point == null) {
|
|
||||||
// point = pointService.createPoint(resources.getZPoint().getCode(), BaseStatus.HCKW, resources.getRArea());
|
|
||||||
// }
|
|
||||||
// resources.setZPoint(point);
|
|
||||||
// }
|
|
||||||
bomAccountService.update(resources);
|
bomAccountService.update(resources);
|
||||||
bomAccountLogService.copyBomAccount(resources.getId(),"update");
|
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@ public class ImportDataController {
|
||||||
private final ImportBomAccountService importBomAccountService;
|
private final ImportBomAccountService importBomAccountService;
|
||||||
private final ImportPointService importPointService;
|
private final ImportPointService importPointService;
|
||||||
private final ImportItemService importItemService;
|
private final ImportItemService importItemService;
|
||||||
|
private final ImportProductionPlanService importProductionPlanService;
|
||||||
|
|
||||||
@Log("导入完成品品番")
|
@Log("导入完成品品番")
|
||||||
@ApiOperation("导入完成品品番")
|
@ApiOperation("导入完成品品番")
|
||||||
|
|
@ -240,6 +241,19 @@ public class ImportDataController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Log("导入ProductionPlan")
|
||||||
|
@ApiOperation("导入ProductionPlan")
|
||||||
|
@PostMapping(value = "/importProductionPlan")
|
||||||
|
@Transactional
|
||||||
|
@AnonymousAccess
|
||||||
|
public ResponseEntity<Object> importProductionPlan(@RequestParam("file") MultipartFile multipartFile) {
|
||||||
|
log.info("开始导入");
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
importProductionPlanService.importData(multipartFile);
|
||||||
|
log.info("导入结束,耗时:{}ms", (System.currentTimeMillis() - start));
|
||||||
|
return new ResponseEntity<>(ApiResult.success(OK.value(), "导入成功", null), OK);
|
||||||
|
}
|
||||||
|
|
||||||
@Log("导入Point")
|
@Log("导入Point")
|
||||||
@ApiOperation("导入Point")
|
@ApiOperation("导入Point")
|
||||||
@PostMapping(value = "/importPoint")
|
@PostMapping(value = "/importPoint")
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,7 @@ public class ProductionPlanController {
|
||||||
if(productionPlans == null || productionPlans.size() < productionPlanVo.getNumber()){
|
if(productionPlans == null || productionPlans.size() < productionPlanVo.getNumber()){
|
||||||
return new ResponseEntity(ApiResult.fail(400,"库存不够,无法批量耗用",""), HttpStatus.BAD_REQUEST);
|
return new ResponseEntity(ApiResult.fail(400,"库存不够,无法批量耗用",""), HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
productionPlanService.scsxHaoyong(productionPlans,productionPlanVo.getWorkingStation(),"生产顺序计划耗用");
|
productionPlanService.scsxHaoyong(productionPlans,productionPlanVo.getAreaId(),"生产顺序计划耗用");
|
||||||
return new ResponseEntity<>(ApiResult.success("耗用成功!",""), HttpStatus.OK);
|
return new ResponseEntity<>(ApiResult.success("耗用成功!",""), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,8 @@ public interface BomAccountService {
|
||||||
void download(List<BomAccountDto> all, HttpServletResponse response) throws Exception, Exception;
|
void download(List<BomAccountDto> all, HttpServletResponse response) throws Exception, Exception;
|
||||||
|
|
||||||
List<BigItem> queryBigItemByType(String stationType);
|
List<BigItem> queryBigItemByType(String stationType);
|
||||||
|
|
||||||
|
List<BigItem> queryByAreaId(Long areaId);
|
||||||
/**得到品番*/
|
/**得到品番*/
|
||||||
List queryItemByArea(Long areaId);
|
List queryItemByArea(Long areaId);
|
||||||
|
|
||||||
|
|
@ -112,6 +114,8 @@ public interface BomAccountService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<BomAccount> queryBomAccount(Long bigItemId,Long jsAreaId,String gw);
|
List<BomAccount> queryBomAccount(Long bigItemId,Long jsAreaId,String gw);
|
||||||
|
|
||||||
|
List<BomAccount> queryBomAccountKy(Long bigItemId,Long shAreaId,String kyh);
|
||||||
/***
|
/***
|
||||||
* 备货计划生成对应的备货操作明细数据
|
* 备货计划生成对应的备货操作明细数据
|
||||||
* @param code
|
* @param code
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,6 @@ public interface ProductionPlanService {
|
||||||
/**
|
/**
|
||||||
* 批量耗用
|
* 批量耗用
|
||||||
*/
|
*/
|
||||||
void scsxHaoyong(List<ProductionPlan> productionPlans,String gw,String des);
|
void scsxHaoyong(List<ProductionPlan> productionPlans,Long areaId,String des);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -15,6 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package com.youchain.basicdata.service.dto;
|
package com.youchain.basicdata.service.dto;
|
||||||
|
|
||||||
|
import com.youchain.basicdata.domain.Item;
|
||||||
|
import com.youchain.basicdata.domain.Point;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
|
||||||
|
|
@ -176,6 +176,18 @@ public class BomAccountServiceImpl implements BomAccountService {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BigItem> queryByAreaId(Long areaId) {
|
||||||
|
String hql = "select t.bigItem from BomAccount t where t.rArea.id = " + areaId+" group by t.bigItem";
|
||||||
|
Query query = entityManager.createQuery(hql);
|
||||||
|
List<BigItem> resultList = query.getResultList();
|
||||||
|
if (!resultList.isEmpty()){
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable(key = "'areaid:' + #p0")
|
@Cacheable(key = "'areaid:' + #p0")
|
||||||
|
|
@ -246,6 +258,19 @@ public class BomAccountServiceImpl implements BomAccountService {
|
||||||
return resultList;
|
return resultList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<BomAccount> queryBomAccountKy(Long bigItemId,Long shAreaId,String kyh) {
|
||||||
|
String hql = "from BomAccount t where t.bigItem.id="+bigItemId+" and t.item.enabled=true";
|
||||||
|
if(shAreaId!=null){
|
||||||
|
hql+=" and t.rArea.id = " + shAreaId;
|
||||||
|
}
|
||||||
|
if(kyh!=null&&!kyh.equals("")){
|
||||||
|
hql+=" and t.kyQz = '" + kyh+"'";
|
||||||
|
}
|
||||||
|
Query query = entityManager.createQuery(hql);
|
||||||
|
List<BomAccount> resultList = query.getResultList();
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public List<Object[]> queryBomAccountList(String code,Long outAreaId, Long shAreaId,String bp_type,String type) {
|
public List<Object[]> queryBomAccountList(String code,Long outAreaId, Long shAreaId,String bp_type,String type) {
|
||||||
String hql =null;
|
String hql =null;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
package com.youchain.basicdata.service.impl;
|
package com.youchain.basicdata.service.impl;
|
||||||
|
|
||||||
import com.youchain.basicdata.domain.Area;
|
import com.youchain.basicdata.domain.*;
|
||||||
import com.youchain.basicdata.domain.BigItem;
|
|
||||||
import com.youchain.basicdata.domain.Item;
|
|
||||||
import com.youchain.basicdata.domain.ProductionPlan;
|
|
||||||
import com.youchain.basicdata.repository.AreaRepository;
|
import com.youchain.basicdata.repository.AreaRepository;
|
||||||
import com.youchain.basicdata.repository.BigItemRepository;
|
import com.youchain.basicdata.repository.BigItemRepository;
|
||||||
import com.youchain.basicdata.repository.ItemRepository;
|
import com.youchain.basicdata.repository.ItemRepository;
|
||||||
|
|
@ -13,8 +10,10 @@ import com.youchain.businessdata.inputJson.imports.ItemImport;
|
||||||
import com.youchain.businessdata.inputJson.imports.ProductionPlanImport;
|
import com.youchain.businessdata.inputJson.imports.ProductionPlanImport;
|
||||||
import com.youchain.exception.BadRequestException;
|
import com.youchain.exception.BadRequestException;
|
||||||
import com.youchain.utils.*;
|
import com.youchain.utils.*;
|
||||||
|
import lombok.Data;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
@ -70,59 +69,60 @@ public class ImportProductionPlanServiceImpl implements ImportProductionPlanServ
|
||||||
// TODO: 实现批量导入逻辑
|
// TODO: 实现批量导入逻辑
|
||||||
log.info("处理批量导入,数据条数: {}", dataList.size());
|
log.info("处理批量导入,数据条数: {}", dataList.size());
|
||||||
//获取文件中所有的库位编码
|
//获取文件中所有的库位编码
|
||||||
List<String> bigitemcodes = dataList.stream().map(ProductionPlanImport::getBigItemCode).collect(Collectors.toList());
|
List<String> bigitemcodes = dataList.stream()
|
||||||
|
.map(item -> item.getBigItemCode().replace("-", ""))
|
||||||
|
.collect(Collectors.toList());
|
||||||
bigitemcodes = bigitemcodes.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
bigitemcodes = bigitemcodes.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||||
Map<String, BigItem> exitBigItemMap = bigItemService.queryByBigItemCodesToMap(bigitemcodes);
|
Map<String, BigItem> exitBigItemMap = validateBigItem(bigitemcodes); //校验机型是否存在
|
||||||
List<String> areaNames = dataList.stream().map(ProductionPlanImport::getZcdx).collect(Collectors.toList());
|
List<String> areaNames = dataList.stream().map(ProductionPlanImport::getZcdx).collect(Collectors.toList());
|
||||||
areaNames = areaNames.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
areaNames = areaNames.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||||
Map<String, Area> exitAreaMap = areaService.queryByAreaCodesToMap(areaNames);
|
Map<String, Area> exitAreaMap = validateArea(areaNames);//校验库区是否存在
|
||||||
//得到每个工位最小序号,查找最小序号IDNO是否有已消耗数据,有则异常,没有则删除导入新数据
|
//得到每个工位最小序号,查找最小序号IDNO是否有已消耗数据,有则异常,没有则删除导入新数据
|
||||||
HashMap<String,String> maps=new HashMap<>();
|
HashMap<String,String> maps=new HashMap<>();
|
||||||
|
Map<String, Long> map = new HashMap<String, Long>();////职场+工件,序号
|
||||||
for (ProductionPlanImport data : dataList) {
|
for (ProductionPlanImport data : dataList) {
|
||||||
String zcdx=data.getZcdx();
|
String zcdx=data.getZcdx();
|
||||||
String IDNO=data.getKyh();
|
String IDNO=data.getKyh();
|
||||||
String makeLine=data.getMakeLine();
|
// String makeLine=data.getMakeLine();
|
||||||
if(!maps.containsKey(zcdx+makeLine)){
|
String machineNo=data.getGj();
|
||||||
maps.put(zcdx+makeLine,IDNO);
|
if(!maps.containsKey(zcdx+machineNo)){
|
||||||
int hyCount = productionPlanRepository.existsGwHyIdno(IDNO,zcdx);
|
Long orderNo = productionPlanRepository.getMaxOrderNo(zcdx,machineNo);
|
||||||
if (hyCount > 0) {
|
if (orderNo==null) {
|
||||||
throw new BadRequestException( "大于" + IDNO + "存在已耗用数据");
|
map.put(zcdx+machineNo, 1L);
|
||||||
} else {
|
}else{
|
||||||
List<ProductionPlan> productionPlans = productionPlanRepository.findByGwIdnoList(IDNO ,zcdx);
|
map.put(zcdx+machineNo, orderNo+1);
|
||||||
productionPlanRepository.deleteAll(productionPlans);
|
|
||||||
}
|
}
|
||||||
|
maps.put(zcdx+machineNo,IDNO);
|
||||||
|
}
|
||||||
|
int hyCount = productionPlanRepository.existsGwHyIdno(IDNO,zcdx,machineNo);
|
||||||
|
if (hyCount > 0) {
|
||||||
|
throw new BadRequestException( "大于" + IDNO + "存在已耗用数据");
|
||||||
|
} else {
|
||||||
|
List<ProductionPlan> productionPlans = productionPlanRepository.findByGwIdnoList(IDNO ,zcdx,machineNo);
|
||||||
|
productionPlanRepository.deleteAll(productionPlans);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Map<String, Long> map = new HashMap<String, Long>();//制造线,序号
|
|
||||||
for (ProductionPlanImport data : dataList) {
|
for (ProductionPlanImport data : dataList) {
|
||||||
String zcdx=data.getZcdx();
|
String zcdx=data.getZcdx();
|
||||||
String IDNO=data.getKyh();
|
String machineNo=data.getGj();
|
||||||
String makeLine=data.getMakeLine();
|
|
||||||
Area area=exitAreaMap.get(zcdx);
|
Area area=exitAreaMap.get(zcdx);
|
||||||
Long orderNo =1L;
|
Long orderNo=map.get(zcdx+machineNo);
|
||||||
List<ProductionPlan> idnoList = productionPlanRepository.findByIDNO(IDNO);
|
map.put(zcdx+machineNo,orderNo+1);
|
||||||
if (!idnoList.isEmpty()) {
|
BigItem bigItem = exitBigItemMap.get(data.getBigItemCode().replace("-",""));
|
||||||
orderNo = idnoList.get(0).getOrderNo();
|
|
||||||
} else {
|
|
||||||
orderNo = productionPlanRepository.getMaxOrderNo();
|
|
||||||
if (orderNo==null) {
|
|
||||||
map.put(makeLine, 1L);
|
|
||||||
}else{
|
|
||||||
orderNo=orderNo+1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
BigItem bigItem = exitBigItemMap.get(data.getBigItemCode());
|
|
||||||
ProductionPlan productionPlan = new ProductionPlan();
|
ProductionPlan productionPlan = new ProductionPlan();
|
||||||
productionPlan.setBigItem(bigItem);
|
productionPlan.setBigItem(bigItem);
|
||||||
productionPlan.setType(bigItem.getOutboundType());
|
// productionPlan.setType(bigItem.getOutboundType());
|
||||||
productionPlan.setWorkingStation(zcdx);
|
productionPlan.setWorkingStation(zcdx);
|
||||||
productionPlan.setRkArea(area);
|
productionPlan.setRkArea(area);
|
||||||
productionPlan.setDept(UserUtils.getDept());
|
productionPlan.setDept(UserUtils.getDept());
|
||||||
productionPlan.setEnabled(true);
|
productionPlan.setEnabled(true);
|
||||||
productionPlan.setNo(Integer.valueOf(data.getXh()));
|
productionPlan.setNo(Integer.valueOf(data.getXh()));
|
||||||
productionPlan.setMakeLine(makeLine);
|
productionPlan.setMachineNo(data.getGj());
|
||||||
productionPlan.setDownlineDate( new Timestamp(DateUtil.ymd_date(data.getHjOut()).getTime()));
|
productionPlan.setMakeLine(data.getMakeLine());
|
||||||
productionPlan.setIdno(IDNO);
|
Date downDate=DateUtil.md_date(data.getHjOut());
|
||||||
|
productionPlan.setDownlineDate( new Timestamp(downDate.getTime()));
|
||||||
|
productionPlan.setIdno(data.getKyh());
|
||||||
productionPlan.setImportDate(new Timestamp (new Date ().getTime()));
|
productionPlan.setImportDate(new Timestamp (new Date ().getTime()));
|
||||||
productionPlan.setStatue(BizStatus.UN_CONSUME);
|
productionPlan.setStatue(BizStatus.UN_CONSUME);
|
||||||
productionPlan.setOrderNo(orderNo);
|
productionPlan.setOrderNo(orderNo);
|
||||||
|
|
@ -130,6 +130,35 @@ public class ImportProductionPlanServiceImpl implements ImportProductionPlanServ
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Map<String, BigItem> validateBigItem(List<String> codes) {
|
||||||
|
Map<String, BigItem> existMap = bigItemService.queryByBigItemCodesToMap(codes);
|
||||||
|
if (existMap.isEmpty()) {
|
||||||
|
throw new BadRequestException("机型代码不存在或已失效");
|
||||||
|
}
|
||||||
|
List<String> existCodes = new ArrayList(existMap.keySet());
|
||||||
|
// 获取两个集合的非交集说明品番不存在或失效,直接提示
|
||||||
|
List<String> difference = SmartStringUtil.getDifference(codes, existCodes);
|
||||||
|
if (CollectionUtils.isNotEmpty(difference)) {
|
||||||
|
throw new BadRequestException(difference + "机型不存在或已失效");
|
||||||
|
}
|
||||||
|
return existMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//验证库区
|
||||||
|
private Map<String, Area> validateArea(List<String> names) {
|
||||||
|
Map<String, Area> existMap = areaService.queryByAreaCodesToMap(names);
|
||||||
|
if (existMap.isEmpty()) {
|
||||||
|
throw new BadRequestException(names+"库区不存在或已失效");
|
||||||
|
}
|
||||||
|
List<String> existCodes = new ArrayList(existMap.keySet());
|
||||||
|
// 获取两个集合的非交集说明品番不存在或失效,直接提示
|
||||||
|
List<String> difference = SmartStringUtil.getDifference(names, existCodes);
|
||||||
|
if (CollectionUtils.isNotEmpty(difference)) {
|
||||||
|
throw new BadRequestException(difference + "库区不存在或已失效");
|
||||||
|
}
|
||||||
|
return existMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//验证模板是否使用正确
|
//验证模板是否使用正确
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
package com.youchain.basicdata.service.impl;
|
package com.youchain.basicdata.service.impl;
|
||||||
|
|
||||||
import com.youchain.basicdata.domain.*;
|
import com.youchain.basicdata.domain.*;
|
||||||
|
import com.youchain.basicdata.repository.AreaRepository;
|
||||||
import com.youchain.basicdata.repository.BigItemRepository;
|
import com.youchain.basicdata.repository.BigItemRepository;
|
||||||
import com.youchain.basicdata.repository.BillTypeRepository;
|
import com.youchain.basicdata.repository.BillTypeRepository;
|
||||||
import com.youchain.businessdata.domain.PlanPickDetail;
|
import com.youchain.businessdata.domain.PlanPickDetail;
|
||||||
|
|
@ -68,6 +69,7 @@ public class ProductionPlanServiceImpl implements ProductionPlanService {
|
||||||
private final EntityManager entityMapper;
|
private final EntityManager entityMapper;
|
||||||
private final SparepartsService sparepartsService;
|
private final SparepartsService sparepartsService;
|
||||||
private final BigItemRepository bigItemRepository;
|
private final BigItemRepository bigItemRepository;
|
||||||
|
private final AreaRepository areaRepository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> queryAll(ProductionPlanQueryCriteria criteria, Pageable pageable) {
|
public Map<String, Object> queryAll(ProductionPlanQueryCriteria criteria, Pageable pageable) {
|
||||||
|
|
@ -157,9 +159,8 @@ public class ProductionPlanServiceImpl implements ProductionPlanService {
|
||||||
@Override
|
@Override
|
||||||
public List<ProductionPlan> piLiangHaoYong(ProductionPlanVo productionPlanVo) {
|
public List<ProductionPlan> piLiangHaoYong(ProductionPlanVo productionPlanVo) {
|
||||||
Long id = productionPlanVo.getId();
|
Long id = productionPlanVo.getId();
|
||||||
String workingStation = productionPlanVo.getWorkingStation();
|
|
||||||
Integer number = productionPlanVo.getNumber();
|
Integer number = productionPlanVo.getNumber();
|
||||||
String hql = " from ProductionPlan t where t.id >="+id+"and t.workingStation = '"+workingStation+"' and t.statue='UN_CONSUME' order by t.id ASC";
|
String hql = " from ProductionPlan t where t.id >="+id+"and t.rkArea.id = "+productionPlanVo.getAreaId()+" and t.statue='UN_CONSUME' order by t.id ASC";
|
||||||
Query query = entityMapper.createQuery(hql);
|
Query query = entityMapper.createQuery(hql);
|
||||||
query.setMaxResults(number);
|
query.setMaxResults(number);
|
||||||
List<ProductionPlan> resultList = query.getResultList();
|
List<ProductionPlan> resultList = query.getResultList();
|
||||||
|
|
@ -190,27 +191,33 @@ public class ProductionPlanServiceImpl implements ProductionPlanService {
|
||||||
return map;
|
return map;
|
||||||
|
|
||||||
}
|
}
|
||||||
public void scsxHaoyong(List<ProductionPlan> productionPlans,String gw,String des){
|
public void scsxHaoyong(List<ProductionPlan> productionPlans,Long areaId,String des){
|
||||||
for (ProductionPlan productionPlan: productionPlans){
|
for (ProductionPlan productionPlan: productionPlans){
|
||||||
productionPlan.setStatue(BizStatus.CONSUME);
|
productionPlan.setStatue(BizStatus.CONSUME);
|
||||||
productionPlan.setTakeUpTime(new Timestamp(new Date().getTime()));
|
productionPlan.setTakeUpTime(new Timestamp(new Date().getTime()));
|
||||||
this.update(productionPlan);
|
this.update(productionPlan);
|
||||||
}
|
}
|
||||||
Map<Long,Integer> map = new HashMap<>();
|
Map<String,Integer> map = new HashMap<>();
|
||||||
for(ProductionPlan productionPlan : productionPlans){
|
for(ProductionPlan productionPlan : productionPlans){
|
||||||
Long id = productionPlan.getBigItem().getId();
|
Long id = productionPlan.getBigItem().getId();
|
||||||
if(map.containsKey(id)){
|
String kyqz=productionPlan.getIdno()==null?null:productionPlan.getIdno().substring(0,2);
|
||||||
map.put(id,map.get(id)+1);
|
String key=id+"]"+kyqz;
|
||||||
|
if(map.containsKey(key)){
|
||||||
|
map.put(key,map.get(key)+1);
|
||||||
}else {
|
}else {
|
||||||
map.put(id,1);
|
map.put(key,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(Long key : map.keySet()){
|
for(String key : map.keySet()){
|
||||||
Spareparts spareparts = new Spareparts();
|
Spareparts spareparts = new Spareparts();
|
||||||
spareparts.setStationType(gw);
|
Area area=areaRepository.getById(areaId);
|
||||||
|
spareparts.setStationType(area.getWorkingStation());
|
||||||
|
spareparts.setShArea(area);
|
||||||
spareparts.setStatus("UN_CONSUME");
|
spareparts.setStatus("UN_CONSUME");
|
||||||
spareparts.setDate(new Timestamp(new Date().getTime()));
|
spareparts.setDate(new Timestamp(new Date().getTime()));
|
||||||
BigItem bigItem = bigItemRepository.getById(key);
|
String[] str=key.split("]");
|
||||||
|
spareparts.setKyQz(str[1]);
|
||||||
|
BigItem bigItem = bigItemRepository.getById(Long.parseLong(str[0]));
|
||||||
// bigItem.setId(key);
|
// bigItem.setId(key);
|
||||||
spareparts.setBigItemId(bigItem);
|
spareparts.setBigItemId(bigItem);
|
||||||
spareparts.setOrderQuantity(map.get(key));
|
spareparts.setOrderQuantity(map.get(key));
|
||||||
|
|
|
||||||
|
|
@ -221,6 +221,23 @@ public class PickDetail extends BaseEntity implements Serializable {
|
||||||
@ApiModelProperty(value = "出库库区")
|
@ApiModelProperty(value = "出库库区")
|
||||||
private Area area;
|
private Area area;
|
||||||
|
|
||||||
|
@OneToOne
|
||||||
|
@JoinColumn(name = "`ck_point_id`")
|
||||||
|
@ApiModelProperty(value = "出库库位")
|
||||||
|
private Point ckPoint;
|
||||||
|
|
||||||
|
@Column(name = "`be_xpp`")
|
||||||
|
@ApiModelProperty(value = "现品票品番")
|
||||||
|
private Boolean beXpp;
|
||||||
|
|
||||||
|
@Column(name = "`be_xd`")
|
||||||
|
@ApiModelProperty(value = "箱单整出")
|
||||||
|
private Boolean beXd;
|
||||||
|
|
||||||
|
@Column(name = "`be_xd_pf`")
|
||||||
|
@ApiModelProperty(value = "箱单品番")
|
||||||
|
private Boolean beXdPf;
|
||||||
|
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "`sh_area_id`")
|
@JoinColumn(name = "`sh_area_id`")
|
||||||
@ApiModelProperty(value = "收货库区")
|
@ApiModelProperty(value = "收货库区")
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
package com.youchain.businessdata.domain;
|
package com.youchain.businessdata.domain;
|
||||||
|
|
||||||
import com.youchain.base.BaseEntity;
|
import com.youchain.base.BaseEntity;
|
||||||
|
import com.youchain.basicdata.domain.Area;
|
||||||
import com.youchain.basicdata.domain.BigItem;
|
import com.youchain.basicdata.domain.BigItem;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
|
@ -47,6 +48,15 @@ public class Spareparts extends BaseEntity implements Serializable {
|
||||||
@ApiModelProperty(value = "工位")
|
@ApiModelProperty(value = "工位")
|
||||||
private String stationType;
|
private String stationType;
|
||||||
|
|
||||||
|
@OneToOne
|
||||||
|
@JoinColumn(name = "`sh_area_id`")
|
||||||
|
@ApiModelProperty(value = "收货仓库")
|
||||||
|
private Area shArea;
|
||||||
|
|
||||||
|
@Column(name = "`ky_qz`")
|
||||||
|
@ApiModelProperty(value = "组顺/组顺/刻印号前2位")
|
||||||
|
private String kyQz;
|
||||||
|
|
||||||
@Column(name = "`date`")
|
@Column(name = "`date`")
|
||||||
@ApiModelProperty(value = "下线日期")
|
@ApiModelProperty(value = "下线日期")
|
||||||
private Timestamp date;
|
private Timestamp date;
|
||||||
|
|
|
||||||
|
|
@ -65,4 +65,9 @@ public interface InventoryRepository extends JpaRepository<Inventory, Long>, Jpa
|
||||||
"WHERE inv.quantity>0 and p.type='CH' and inv.stock_code=:stockCode" , nativeQuery = true)
|
"WHERE inv.quantity>0 and p.type='CH' and inv.stock_code=:stockCode" , nativeQuery = true)
|
||||||
List<Inventory> queryInvStockCode(String stockCode);
|
List<Inventory> queryInvStockCode(String stockCode);
|
||||||
|
|
||||||
|
@Query(value = "SELECT * from data_inventory inv \n" +
|
||||||
|
"left join base_point p on inv.point_id=p.id\n" +
|
||||||
|
"WHERE inv.quantity>0 and p.type='CH' and inv.stock_code=:stockCode and inv.itemKey.item.code=:itemCode" , nativeQuery = true)
|
||||||
|
List<Inventory> queryInvStockItemCode(String stockCode,String itemCode);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,10 @@ public interface XppRecordRepository extends JpaRepository<XppRecord, Long>, Jpa
|
||||||
@Query(value = "SELECT * FROM data_xpp_record xr WHERE xr.ewm=:ewm and xr.type=:type", nativeQuery = true)
|
@Query(value = "SELECT * FROM data_xpp_record xr WHERE xr.ewm=:ewm and xr.type=:type", nativeQuery = true)
|
||||||
XppRecord findByEwmType(String ewm,String type);
|
XppRecord findByEwmType(String ewm,String type);
|
||||||
|
|
||||||
|
@QueryHints(@QueryHint(name = "org.hibernate.cacheMode", value = "REFRESH"))
|
||||||
|
@Query(value = "SELECT * FROM data_xpp_record xr WHERE xr.ewm=:ewm and xr.type=:type ", nativeQuery = true)
|
||||||
|
List<XppRecord> findByEwmTypes(String ewm,String type);
|
||||||
|
|
||||||
@Query(value = "SELECT * FROM data_xpp_record xr WHERE xr.item_Key_id=?1 and xr.inv_Point_id=?2 and xr.status='PUTAWAY'", nativeQuery = true)
|
@Query(value = "SELECT * FROM data_xpp_record xr WHERE xr.item_Key_id=?1 and xr.inv_Point_id=?2 and xr.status='PUTAWAY'", nativeQuery = true)
|
||||||
List<XppRecord> queryXppItemKeyPoint(Long itemKeyId, Long invPointId);
|
List<XppRecord> queryXppItemKeyPoint(Long itemKeyId, Long invPointId);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,7 @@ public class PickDetailController {
|
||||||
private final PickTicketService pickTicketService;
|
private final PickTicketService pickTicketService;
|
||||||
private final InventoryService inventoryService;
|
private final InventoryService inventoryService;
|
||||||
private final InventoryLogService inventoryLogService;
|
private final InventoryLogService inventoryLogService;
|
||||||
|
private final XppRecordService xppRecordService;
|
||||||
private final BillTypeRepository billTypeRepository;
|
private final BillTypeRepository billTypeRepository;
|
||||||
private final InventoryRepository inventoryRepository;
|
private final InventoryRepository inventoryRepository;
|
||||||
private final TaskRepository taskRepository;
|
private final TaskRepository taskRepository;
|
||||||
|
|
@ -333,6 +334,10 @@ public class PickDetailController {
|
||||||
String view_type="01";
|
String view_type="01";
|
||||||
String view_des="无库存";
|
String view_des="无库存";
|
||||||
String view_name="箱单号";
|
String view_name="箱单号";
|
||||||
|
if(pickDetail.getBeXdPf()){
|
||||||
|
view_name="箱单号(品番)";
|
||||||
|
view_type="04";
|
||||||
|
}
|
||||||
ZzjlPickHead head=new ZzjlPickHead();
|
ZzjlPickHead head=new ZzjlPickHead();
|
||||||
List<ZzjlPickDetail> detail_list=new ArrayList<>();
|
List<ZzjlPickDetail> detail_list=new ArrayList<>();
|
||||||
if(tasks.size()>=0){
|
if(tasks.size()>=0){
|
||||||
|
|
@ -378,7 +383,7 @@ public class PickDetailController {
|
||||||
String stock_code=null;
|
String stock_code=null;
|
||||||
if(zzjlPick.getView_type().equals("02")){
|
if(zzjlPick.getView_type().equals("02")){
|
||||||
xppQRCode=zzjlPick.getScan_code();
|
xppQRCode=zzjlPick.getScan_code();
|
||||||
}else if(zzjlPick.getView_type().equals("03")){
|
}else if(zzjlPick.getView_type().equals("03")||zzjlPick.getView_type().equals("04")){
|
||||||
stock_code=zzjlPick.getScan_code();
|
stock_code=zzjlPick.getScan_code();
|
||||||
if(stock_code.indexOf("84")==0){
|
if(stock_code.indexOf("84")==0){
|
||||||
stock_code=stock_code.substring(2);
|
stock_code=stock_code.substring(2);
|
||||||
|
|
@ -386,15 +391,33 @@ public class PickDetailController {
|
||||||
}
|
}
|
||||||
PickDetail pickDetail=pickDetailRepository.getById(zzjlPick.getDetail_id());
|
PickDetail pickDetail=pickDetailRepository.getById(zzjlPick.getDetail_id());
|
||||||
if(stock_code!=null){
|
if(stock_code!=null){
|
||||||
List<Inventory> invs = inventoryRepository.queryInvStockCode(stock_code);
|
if(zzjlPick.getView_type().equals("03")){//箱单出库
|
||||||
for (Inventory inv : invs) {
|
List<Inventory> invs = inventoryRepository.queryInvStockCode(stock_code);
|
||||||
//生成Task,生成出库扣减库存
|
for (Inventory inv : invs) {
|
||||||
Task task = taskService.storeTask(null,pickDetail,inv.getArea(),inv.getItemKey(),inv.getPoint(),null,inv.getQuantity(),inv.getStockCode());
|
//生成Task,生成出库扣减库存
|
||||||
task.setBillCode(pickDetail.getItem().getCode()+"关联箱单出库"+pickDetail.getId());
|
Task task = taskService.storeTask(null,pickDetail,inv.getArea(),inv.getItemKey(),inv.getPoint(),null,inv.getQuantity(),inv.getStockCode());
|
||||||
task.setTaskType(BizStatus.XD_PICK);
|
task.setBillCode(pickDetail.getItem().getCode()+"关联箱单出库"+pickDetail.getId());
|
||||||
|
task.setTaskType(BizStatus.XD_PICK);
|
||||||
|
taskRepository.save(task);
|
||||||
|
pickTicketService.pickForTask(task.getId(), task.getSrcStockCode(), task.getPlanQty()-task.getMoveQty(), null, SecurityUtils.getCurrentUsername());
|
||||||
|
}
|
||||||
|
}else if(zzjlPick.getView_type().equals("04")){//箱单品番出库
|
||||||
|
//箱单内现品票
|
||||||
|
String xpp=zzjlPick.getXpp();
|
||||||
|
RRkXpp rRkXpp=xppRecordService.xppAnalysis(xpp,null);
|
||||||
|
//查询是否能找到对应的库存
|
||||||
|
List<Inventory> invs = inventoryRepository.queryInvStockItemCode(stock_code,rRkXpp.getItemCode());
|
||||||
|
Inventory inv=invs.get(0);
|
||||||
|
if(inv.getQuantity()<rRkXpp.getNrs()){
|
||||||
|
throw new BadRequestException( "库存数量不足纳入数");
|
||||||
|
}
|
||||||
|
Task task = taskService.storeTask(null,pickDetail,inv.getArea(),inv.getItemKey(),
|
||||||
|
inv.getPoint(),null,rRkXpp.getNrs(),inv.getStockCode());
|
||||||
|
task.setTaskType(BizStatus.XD_PF_PICK);
|
||||||
taskRepository.save(task);
|
taskRepository.save(task);
|
||||||
pickTicketService.pickForTask(task.getId(), task.getSrcStockCode(), task.getPlanQty()-task.getMoveQty(), null, SecurityUtils.getCurrentUsername());
|
pickTicketService.pickForTask(task.getId(), task.getSrcStockCode(), task.getPlanQty()-task.getMoveQty(), null, SecurityUtils.getCurrentUsername());
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (xppQRCode!=null) {//现品票拣货确认
|
} else if (xppQRCode!=null) {//现品票拣货确认
|
||||||
XppRecord xpp = xppRecordRepository.findByEwmType(xppQRCode, BillParmType.XPP_1001);
|
XppRecord xpp = xppRecordRepository.findByEwmType(xppQRCode, BillParmType.XPP_1001);
|
||||||
if (Objects.isNull(xpp)){
|
if (Objects.isNull(xpp)){
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,10 @@ public class SparepartsController {
|
||||||
@PreAuthorize("@el.check('super:man')")
|
@PreAuthorize("@el.check('super:man')")
|
||||||
public ResponseEntity<Object> createSpareparts(@Validated @RequestBody Spareparts resources){
|
public ResponseEntity<Object> createSpareparts(@Validated @RequestBody Spareparts resources){
|
||||||
resources.setStatus("UN_CONSUME");
|
resources.setStatus("UN_CONSUME");
|
||||||
|
if(resources.getShArea()==null){
|
||||||
|
throw new BadRequestException("库区不能为空");
|
||||||
|
}
|
||||||
|
resources.setStationType(resources.getShArea().getWorkingStation());
|
||||||
return new ResponseEntity<>(sparepartsService.create(resources),HttpStatus.CREATED);
|
return new ResponseEntity<>(sparepartsService.create(resources),HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -176,13 +180,13 @@ public class SparepartsController {
|
||||||
@Transactional
|
@Transactional
|
||||||
@PreAuthorize("@el.check('super:man')")
|
@PreAuthorize("@el.check('super:man')")
|
||||||
public ResponseEntity<Object> autoAddHy(@RequestBody String idno) {
|
public ResponseEntity<Object> autoAddHy(@RequestBody String idno) {
|
||||||
List<String> whyGwList = productionPlanRepository.getIdNoWhyGw(idno);
|
List<Long> whyGwList = productionPlanRepository.getIdNoHyGw(idno);
|
||||||
if(whyGwList.size()<=0){
|
if(whyGwList.size()<=0){
|
||||||
throw new BadRequestException("未找到需要耗用数据");
|
throw new BadRequestException("未找到需要耗用数据");
|
||||||
}
|
}
|
||||||
for (String gw:whyGwList){
|
for (Long areaId:whyGwList){
|
||||||
List<ProductionPlan> whyList = productionPlanRepository.getIdNoAllData(gw,idno);
|
List<ProductionPlan> whyList = productionPlanRepository.getIdNoAllData(areaId,idno);
|
||||||
productionPlanService.scsxHaoyong(whyList,gw,"截止IDNO自动耗用");
|
productionPlanService.scsxHaoyong(whyList,areaId,"截止IDNO自动耗用");
|
||||||
}
|
}
|
||||||
//自动创建
|
//自动创建
|
||||||
return new ResponseEntity<>("操作成功",HttpStatus.OK);
|
return new ResponseEntity<>("操作成功",HttpStatus.OK);
|
||||||
|
|
|
||||||
|
|
@ -294,7 +294,7 @@ public class XppRecordController {
|
||||||
if(tl.getSlQty()>0){
|
if(tl.getSlQty()>0){
|
||||||
//扣减线边库存
|
//扣减线边库存
|
||||||
PickDetail pickDetail=task.getPickDetail();
|
PickDetail pickDetail=task.getPickDetail();
|
||||||
List<Inventory> inventorys=inventoryService.getXbHyInv(pickDetail.getItem(),pickDetail.getShArea(),pickDetail.getShArea().getWorkingStation(),pickDetail.getPoint(),"退库接收");
|
List<Inventory> inventorys=inventoryService.getXbHyInv(pickDetail.getItem(),pickDetail.getShArea(),pickDetail.getPoint(),"退库接收");
|
||||||
if(inventorys.size()>0){
|
if(inventorys.size()>0){
|
||||||
Inventory inv= inventorys.get(0);
|
Inventory inv= inventorys.get(0);
|
||||||
double srcQty=inv.getQuantity();
|
double srcQty=inv.getQuantity();
|
||||||
|
|
@ -500,15 +500,17 @@ public class XppRecordController {
|
||||||
JSONObject jsonObject = JSONObject.parseObject(resources);
|
JSONObject jsonObject = JSONObject.parseObject(resources);
|
||||||
String ewm=jsonObject.getString("ewm");
|
String ewm=jsonObject.getString("ewm");
|
||||||
String type=jsonObject.getString("type");
|
String type=jsonObject.getString("type");
|
||||||
|
XppRecord xppRecord=null;
|
||||||
if(type.equals("7")){//现品票二维码解析
|
if(type.equals("7")){//现品票二维码解析
|
||||||
RRkXpp xpp = xppRecordService.xppAnalysis(ewm,null);
|
RRkXpp xpp = xppRecordService.xppAnalysis(ewm,null);
|
||||||
return new ResponseEntity<>(xpp, HttpStatus.OK);
|
return new ResponseEntity<>(xpp, HttpStatus.OK);
|
||||||
}else{
|
}else{
|
||||||
String gw="";
|
String gw="";
|
||||||
XppRecord xppRecord = xppRecordRepository.findByCode(ewm);
|
List<XppRecord> xppRecords = xppRecordRepository.findByEwmTypes(ewm,BillParmType.XPP_1001);
|
||||||
if (xppRecord==null){
|
if (xppRecords.size()<=0){
|
||||||
throw new BadRequestException("现品票未采集");
|
throw new BadRequestException("现品票未采集");
|
||||||
}else {
|
}else {
|
||||||
|
xppRecord=xppRecords.get(0);
|
||||||
if (type.equals("1")) {//留样出库
|
if (type.equals("1")) {//留样出库
|
||||||
if (!xppRecord.getStatus().equals(BizStatus.RECEIVED) && !xppRecord.getStatus().equals(BizStatus.PUTAWAY)) {
|
if (!xppRecord.getStatus().equals(BizStatus.RECEIVED) && !xppRecord.getStatus().equals(BizStatus.PUTAWAY)) {
|
||||||
throw new BadRequestException("现品票状态不正确");
|
throw new BadRequestException("现品票状态不正确");
|
||||||
|
|
@ -625,16 +627,16 @@ public class XppRecordController {
|
||||||
return new ResponseEntity<>(srcPoint + "库位不存在", BAD_REQUEST);
|
return new ResponseEntity<>(srcPoint + "库位不存在", BAD_REQUEST);
|
||||||
}
|
}
|
||||||
Area area=srcPoint.getArea();
|
Area area=srcPoint.getArea();
|
||||||
Point zzkw=pointService.getPoint(BaseStatus.ZZKW,null,null,null);
|
// Point zzkw=pointService.getPoint(BaseStatus.ZZKW,null,null,null);
|
||||||
if(zzkw==null){
|
// if(zzkw==null){
|
||||||
return new ResponseEntity<>(BaseStatus.ZZKW + "默认制造库位不存在", BAD_REQUEST);
|
// return new ResponseEntity<>(BaseStatus.ZZKW + "默认制造库位不存在", BAD_REQUEST);
|
||||||
}
|
// }
|
||||||
for(Long id:ids){
|
for(Long id:ids){
|
||||||
XppRecord xppRecord = xppRecordRepository.getById(id);
|
XppRecord xppRecord = xppRecordRepository.getById(id);
|
||||||
if(!srcPoint.getId().equals(xppRecord.getInvPoint().getId())){
|
if(!srcPoint.getId().equals(xppRecord.getInvPoint().getId())){
|
||||||
return new ResponseEntity<>(srcPoint + "库位和现品票对应不匹配"+xppRecord.getInvPoint().getCode(), BAD_REQUEST);
|
return new ResponseEntity<>(srcPoint + "库位和现品票对应不匹配"+xppRecord.getInvPoint().getCode(), BAD_REQUEST);
|
||||||
}
|
}
|
||||||
xppRecordService.xppShipOut(id,area,srcPoint,zzkw,BizStatus.SHIPPING,"现品票直接出库","现品票直接出库");
|
xppRecordService.xppShipOut(id,area,srcPoint,null,BizStatus.SHIPPING,"现品票直接出库","现品票直接出库");
|
||||||
}
|
}
|
||||||
return new ResponseEntity<>("操作成功", HttpStatus.OK);
|
return new ResponseEntity<>("操作成功", HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ public interface InventoryService {
|
||||||
* @param type
|
* @param type
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<Inventory> getXbHyInv(Item item, Area area, String gw,Point zzkw,String type);
|
List<Inventory> getXbHyInv(Item item, Area area,Point zzkw,String type);
|
||||||
List<Inventory> getInventoryXbTl(Item item, Area area, Point point,Point zzkw);
|
List<Inventory> getInventoryXbTl(Item item, Area area, Point point,Point zzkw);
|
||||||
List<Inventory> queryInventory(Stock stock);
|
List<Inventory> queryInventory(Stock stock);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,12 @@ public class AsnQueryCriteria{
|
||||||
@Query(type = Query.Type.INNER_LIKE)
|
@Query(type = Query.Type.INNER_LIKE)
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
|
@Query(type = Query.Type.INNER_LIKE)
|
||||||
|
private String cusCode;
|
||||||
|
|
||||||
|
@Query(type = Query.Type.INNER_LIKE)
|
||||||
|
private String relatedBill1;
|
||||||
|
|
||||||
/** 模糊 */
|
/** 模糊 */
|
||||||
// 左关联查询,left Join , joinName为关联实体名称 , propName为关联实体 字段
|
// 左关联查询,left Join , joinName为关联实体名称 , propName为关联实体 字段
|
||||||
@Query(joinName = "area", propName="code",type = Query.Type.EQUAL)
|
@Query(joinName = "area", propName="code",type = Query.Type.EQUAL)
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,8 @@ public class InventoryLogQueryCriteria{
|
||||||
@Query(joinName = "itemKey>", propName="propC1",type = Query.Type.INNER_LIKE)
|
@Query(joinName = "itemKey>", propName="propC1",type = Query.Type.INNER_LIKE)
|
||||||
private String propC1;
|
private String propC1;
|
||||||
|
|
||||||
|
@Query(joinName = "itemKey>", propName="propC2",type = Query.Type.EQUAL)
|
||||||
|
private String bonded;
|
||||||
|
|
||||||
/** 源点位号 */
|
/** 源点位号 */
|
||||||
@Query(type = Query.Type.EQUAL)
|
@Query(type = Query.Type.EQUAL)
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,9 @@ public class InventoryQueryCriteria{
|
||||||
@Query(joinName = "itemKey>", propName="propC1",type = Query.Type.INNER_LIKE)
|
@Query(joinName = "itemKey>", propName="propC1",type = Query.Type.INNER_LIKE)
|
||||||
private String propC1;
|
private String propC1;
|
||||||
|
|
||||||
|
@Query(joinName = "itemKey>", propName="propC2",type = Query.Type.EQUAL)
|
||||||
|
private String bonded;
|
||||||
|
|
||||||
@Query(joinName = "itemKey>item>", propName="code",type = Query.Type.IN)
|
@Query(joinName = "itemKey>item>", propName="code",type = Query.Type.IN)
|
||||||
private List<String> itemCode;
|
private List<String> itemCode;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -259,6 +259,13 @@ public class PickDetailDto implements Serializable {
|
||||||
/** 出库库区 */
|
/** 出库库区 */
|
||||||
private AreaDto area;
|
private AreaDto area;
|
||||||
|
|
||||||
|
/** 出库库位 */
|
||||||
|
private PointDto ckPoint;
|
||||||
|
|
||||||
|
private Boolean beXpp;
|
||||||
|
private Boolean beXd;
|
||||||
|
private Boolean beXdPf;
|
||||||
|
|
||||||
/** 收货库区 */
|
/** 收货库区 */
|
||||||
private AreaDto shArea;
|
private AreaDto shArea;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,12 @@
|
||||||
package com.youchain.businessdata.service.dto;
|
package com.youchain.businessdata.service.dto;
|
||||||
|
|
||||||
import com.youchain.basicdata.domain.BigItem;
|
import com.youchain.basicdata.domain.BigItem;
|
||||||
|
import com.youchain.basicdata.service.dto.AreaDto;
|
||||||
import com.youchain.basicdata.service.dto.BigItemDto;
|
import com.youchain.basicdata.service.dto.BigItemDto;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
@ -39,7 +43,12 @@ public class SparepartsDto implements Serializable {
|
||||||
private Timestamp date;
|
private Timestamp date;
|
||||||
|
|
||||||
/** 型式名 */
|
/** 型式名 */
|
||||||
private BigItem bigItemId;
|
private BigItemDto bigItemId;
|
||||||
|
|
||||||
|
/** 耗用库区 */
|
||||||
|
private AreaDto shArea;
|
||||||
|
/** 刻印前缀 */
|
||||||
|
private String kyQz;
|
||||||
|
|
||||||
/** 数量 */
|
/** 数量 */
|
||||||
private Integer orderQuantity;
|
private Integer orderQuantity;
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,9 @@ public class XppRecordQueryCriteria{
|
||||||
@Query(type = Query.Type.EQUAL)
|
@Query(type = Query.Type.EQUAL)
|
||||||
private String prop_c1;
|
private String prop_c1;
|
||||||
|
|
||||||
|
@Query(type = Query.Type.EQUAL)
|
||||||
|
private String bonded;
|
||||||
|
|
||||||
@Query(type = Query.Type.EQUAL)
|
@Query(type = Query.Type.EQUAL)
|
||||||
private String type;
|
private String type;
|
||||||
}
|
}
|
||||||
|
|
@ -36,6 +36,7 @@ public class CxjlDto implements Serializable {
|
||||||
private Long zzkw_id;
|
private Long zzkw_id;
|
||||||
private Long rk_id;
|
private Long rk_id;
|
||||||
private int order_qty;
|
private int order_qty;
|
||||||
|
private Boolean beXdPf;
|
||||||
private String remark;
|
private String remark;
|
||||||
private String ewm;
|
private String ewm;
|
||||||
private String type;
|
private String type;
|
||||||
|
|
|
||||||
|
|
@ -276,18 +276,17 @@ public class InventoryServiceImpl implements InventoryService {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Inventory> getXbHyInv(Item item, Area area, String gw, Point zzkw,String type) {
|
public List<Inventory> getXbHyInv(Item item, Area area, Point zzkw,String type) {
|
||||||
//生成Inventory
|
//生成Inventory
|
||||||
String hql = " from Inventory inv where 1=1 and inv.point.type not in ('"+BaseStatus.BHZC+"','"+BaseStatus.SHZC+"')";
|
String hql = " from Inventory inv where 1=1 and inv.point.type not in ('"+BaseStatus.BHZC+"','"+BaseStatus.SHZC+"')";
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
hql += " and inv.itemKey.item.id=" + item.getId() + " ";
|
hql += " and inv.itemKey.item.id=" + item.getId() + " ";
|
||||||
}
|
}
|
||||||
hql += " and inv.area.workingStation='" + gw + "'";
|
if(area!=null) {
|
||||||
if (zzkw != null) {
|
hql += " and inv.area.id=" + area.getId() ;
|
||||||
hql += " and inv.zzkw.id=" + zzkw.getId();
|
|
||||||
}
|
}
|
||||||
if(type.equals("耗用")){//目前只能从暂存库位耗用
|
if(type.equals("耗用")){//直接制造库位库存耗用
|
||||||
hql += " and inv.point.id=" + area.getPointId();
|
hql += " and inv.point.id=" + zzkw.getId();
|
||||||
}
|
}
|
||||||
hql+=" order by inv.itemKey.propC1 asc";
|
hql+=" order by inv.itemKey.propC1 asc";
|
||||||
Query query = entityManager.createQuery(hql);
|
Query query = entityManager.createQuery(hql);
|
||||||
|
|
|
||||||
|
|
@ -192,6 +192,7 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
pd.setType(BaseStatus.ZZJL);
|
pd.setType(BaseStatus.ZZJL);
|
||||||
pd.setPropC2(cxjldto.getBonded());
|
pd.setPropC2(cxjldto.getBonded());
|
||||||
pd.setBomId(cxjldto.getBom_account_id());
|
pd.setBomId(cxjldto.getBom_account_id());
|
||||||
|
pd.setBeXdPf(cxjldto.getBeXdPf());
|
||||||
this.create(pd);
|
this.create(pd);
|
||||||
return pd;
|
return pd;
|
||||||
}
|
}
|
||||||
|
|
@ -224,6 +225,7 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
//回写推荐托盘即可
|
//回写推荐托盘即可
|
||||||
pd.setStatus(BizStatus.ALLOCATE);
|
pd.setStatus(BizStatus.ALLOCATE);
|
||||||
pd.setArea(inv.getArea());
|
pd.setArea(inv.getArea());
|
||||||
|
pd.setCkPoint(inv.getPoint());
|
||||||
map.put(inv.getId()+"",inv.getStockCode()+"]"+inv.getItemKey().getPropC1()+"]"+inv.getPoint().getCode()+"]"+inv.getQuantity());
|
map.put(inv.getId()+"",inv.getStockCode()+"]"+inv.getItemKey().getPropC1()+"]"+inv.getPoint().getCode()+"]"+inv.getQuantity());
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -276,6 +278,7 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
pd.setStatus(BizStatus.ALLOCATE);
|
pd.setStatus(BizStatus.ALLOCATE);
|
||||||
}
|
}
|
||||||
pd.setArea(inv.getArea());
|
pd.setArea(inv.getArea());
|
||||||
|
pd.setCkPoint(inv.getPoint());
|
||||||
pickDetailRepository.save(pd);
|
pickDetailRepository.save(pd);
|
||||||
Task task = taskService.storeTask(null,pd,inv.getArea(),inv.getItemKey(),startPoint,endPoint,allocateQty,inv.getStockCode());
|
Task task = taskService.storeTask(null,pd,inv.getArea(),inv.getItemKey(),startPoint,endPoint,allocateQty,inv.getStockCode());
|
||||||
//修改占用数,写入日志
|
//修改占用数,写入日志
|
||||||
|
|
|
||||||
|
|
@ -140,19 +140,18 @@ public class SparepartsServiceImpl implements SparepartsService {
|
||||||
if(!s.getStatus().equals(BizStatus.UN_CONSUME)){
|
if(!s.getStatus().equals(BizStatus.UN_CONSUME)){
|
||||||
throw new BadRequestException("状态必须未未耗用");
|
throw new BadRequestException("状态必须未未耗用");
|
||||||
}
|
}
|
||||||
String gw=s.getStationType();
|
String kyQz=s.getKyQz();
|
||||||
List<BomAccount> bs = bomAccountService.queryBomAccount(s.getBigItemId().getId(), null,gw);
|
List<BomAccount> bs = bomAccountService.queryBomAccountKy(s.getBigItemId().getId(), s.getShArea().getId(),kyQz);
|
||||||
if (bs.size() <= 0) {
|
if (bs.size() <= 0) {
|
||||||
throw new BadRequestException(s.getBigItemId().getCode() + "未查到"+gw+"对应BOM工位清单");
|
throw new BadRequestException(s.getBigItemId().getCode() + "未查到"+kyQz+"对应BOM工位清单");
|
||||||
}
|
}
|
||||||
for(BomAccount ba:bs){
|
for(BomAccount ba:bs){
|
||||||
if(ba.getZPoint()==null){
|
if(ba.getZPoint()==null){
|
||||||
throw new BadRequestException(ba.getItem().getCode()+"维护制造库位");
|
throw new BadRequestException(ba.getItem().getCode()+"维护制造库位");
|
||||||
}
|
}
|
||||||
double qty=s.getOrderQuantity()*ba.getSingles();
|
double qty=s.getOrderQuantity()*ba.getSingles();
|
||||||
log.info(ba.getId()+"=="+ba.getItem().getId());
|
|
||||||
//扣除线边库存
|
//扣除线边库存
|
||||||
List<Inventory> inventorys=inventoryService.getXbHyInv(ba.getItem(),ba.getRArea(),gw,ba.getZPoint(),"耗用");
|
List<Inventory> inventorys=inventoryService.getXbHyInv(ba.getItem(),ba.getRArea(),ba.getZPoint(),"耗用");
|
||||||
if(inventorys.size()>0){
|
if(inventorys.size()>0){
|
||||||
int num=0;
|
int num=0;
|
||||||
for(Inventory inv:inventorys){
|
for(Inventory inv:inventorys){
|
||||||
|
|
@ -189,9 +188,9 @@ public class SparepartsServiceImpl implements SparepartsService {
|
||||||
ItemKey itemKey=itemKeyService.getItemKey(ba.getItem(),null,ba.getBonded());
|
ItemKey itemKey=itemKeyService.getItemKey(ba.getItem(),null,ba.getBonded());
|
||||||
Inventory inventory = new Inventory();
|
Inventory inventory = new Inventory();
|
||||||
inventory.setItemKey(itemKey);
|
inventory.setItemKey(itemKey);
|
||||||
inventory.setPoint(point);
|
inventory.setPoint(ba.getZPoint());
|
||||||
inventory.setPointCode(point.getCode());
|
inventory.setPointCode(ba.getZPoint().getCode());
|
||||||
inventory.setZzkw(ba.getZPoint());
|
// inventory.setZzkw(ba.getZPoint());
|
||||||
inventory.setDept(UserUtils.getDept());
|
inventory.setDept(UserUtils.getDept());
|
||||||
inventory.setArea(ba.getRArea());
|
inventory.setArea(ba.getRArea());
|
||||||
inventory.setQuantity(-qty);
|
inventory.setQuantity(-qty);
|
||||||
|
|
@ -199,7 +198,7 @@ public class SparepartsServiceImpl implements SparepartsService {
|
||||||
InventoryLog log=inventoryLogService.storeInventoryLog(BizStatus.XB_HY,BizStatus.REDUCE,ba.getBigItem().getCode(),ba.getRArea(),inventory.getItemKey(),
|
InventoryLog log=inventoryLogService.storeInventoryLog(BizStatus.XB_HY,BizStatus.REDUCE,ba.getBigItem().getCode(),ba.getRArea(),inventory.getItemKey(),
|
||||||
inventory.getPoint(),inventory.getPoint(),null,null,0d,qty,null,null,s.getBigItemId().getCode(),
|
inventory.getPoint(),inventory.getPoint(),null,null,0d,qty,null,null,s.getBigItemId().getCode(),
|
||||||
s.getId(),inventory.getId(),"零件耗用");
|
s.getId(),inventory.getId(),"零件耗用");
|
||||||
log.setZzkw(ba.getZPoint());
|
// log.setZzkw(ba.getZPoint());
|
||||||
inventoryLogService.update(log);
|
inventoryLogService.update(log);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -336,6 +336,9 @@ public class XppRecordServiceImpl implements XppRecordService {
|
||||||
if (criteria.getType()!=null &&!criteria.getType().equals("") ) {
|
if (criteria.getType()!=null &&!criteria.getType().equals("") ) {
|
||||||
sql += " and xpp.type = '" + criteria.getType() + "'";
|
sql += " and xpp.type = '" + criteria.getType() + "'";
|
||||||
}
|
}
|
||||||
|
if (criteria.getBonded()!=null &&!criteria.getBonded().equals("") ) {
|
||||||
|
sql += " and ik.prop_c2 = '" + criteria.getBonded() + "'";
|
||||||
|
}
|
||||||
if (criteria.getCreateTime()!=null &&criteria.getCreateTime().size()>0 ) {
|
if (criteria.getCreateTime()!=null &&criteria.getCreateTime().size()>0 ) {
|
||||||
sql += " and xpp.cj_date BETWEEN '"+criteria.getCreateTime().get(0)+"' and '"+criteria.getCreateTime().get(1)+"'";
|
sql += " and xpp.cj_date BETWEEN '"+criteria.getCreateTime().get(0)+"' and '"+criteria.getCreateTime().get(1)+"'";
|
||||||
//sql += " and date_format(xpp.cj_date,'%Y-%m-%d %H:%i:%s')>='"+criteria.getCreateTime().get(0)+"' and date_format(xpp.cj_date,'%Y-%m-%d %H:%i:%s')<='"+criteria.getCreateTime().get(1)+"'";
|
//sql += " and date_format(xpp.cj_date,'%Y-%m-%d %H:%i:%s')>='"+criteria.getCreateTime().get(0)+"' and date_format(xpp.cj_date,'%Y-%m-%d %H:%i:%s')<='"+criteria.getCreateTime().get(1)+"'";
|
||||||
|
|
@ -548,6 +551,7 @@ public class XppRecordServiceImpl implements XppRecordService {
|
||||||
BizStatus.ZZKW_TL, xppRecord.getId(), inventory.getId(), "制造投料");
|
BizStatus.ZZKW_TL, xppRecord.getId(), inventory.getId(), "制造投料");
|
||||||
inventoryLog.setZzkw(point);
|
inventoryLog.setZzkw(point);
|
||||||
inventoryLogService.update(inventoryLog);
|
inventoryLogService.update(inventoryLog);
|
||||||
|
xppRecord.setItemKey(itemKey);
|
||||||
xppRecord.setInvPoint(point);
|
xppRecord.setInvPoint(point);
|
||||||
xppRecord.setStatus(BizStatus.ZZKW_TL);
|
xppRecord.setStatus(BizStatus.ZZKW_TL);
|
||||||
this.update(xppRecord);
|
this.update(xppRecord);
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,11 @@ public class BizStatus {
|
||||||
*/
|
*/
|
||||||
public static String XD_PICK = "XD_PICK";
|
public static String XD_PICK = "XD_PICK";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 箱单关联出库任务
|
||||||
|
*/
|
||||||
|
public static String XD_PF_PICK = "XD_PF_PICK";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 盘点任务
|
* 盘点任务
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue