no message

main
FOAM 2025-08-21 15:51:29 +08:00
parent d33f950ffe
commit bca515060e
33 changed files with 467 additions and 159 deletions

View File

@ -46,6 +46,18 @@ public class BomAccount extends BaseEntity implements Serializable {
@JoinColumn(name = "`big_item_id`")
@ApiModelProperty(value = "完成品品番")
private BigItem bigItem;
@Column(name = "`big_item_code`")
@ApiModelProperty(value = "机型代码")
private String bigItemCode;
@Column(name = "`big_item_name`")
@ApiModelProperty(value = "机型名称")
private String bigItemName;
@Column(name = "`ky_qz`")
@ApiModelProperty(value = "组顺/组顺/刻印号前2位")
private String kyQz;
@OneToOne
@JoinColumn(name = "`item_id`")
@ApiModelProperty(value = "部品品番")

View File

@ -40,8 +40,8 @@ public interface BomAccountRepository extends JpaRepository<BomAccount, Long>, J
BomAccount findByOnly(Long big_item_id,Long item_id,Long r_area_id,Long z_point_id);
@Query(value = "SELECT * FROM base_bom_account ba WHERE ba.big_item_id=?1 and ba.item_id=?2 and ba.ns=?3 and ba.z_point_id=?4", nativeQuery = true)
BomAccount findByQnique(Long big_item_id,Long item_id,String ns,Long z_point_id);
@Query(value = "SELECT * FROM base_bom_account ba WHERE ba.big_item_id=?1 and ba.item_id=?2 and ba.ns=?3 and ba.z_point_id=?4 and ba.bonded=?5" , nativeQuery = true)
BomAccount findByQnique(Long big_item_id,Long item_id,String ns,Long z_point_id,String bonded);
/**
* true bigitem
@ -74,7 +74,7 @@ public interface BomAccountRepository extends JpaRepository<BomAccount, Long>, J
//获得所有BOM标签
//SUBSTRING(bi.master_name, 1, CEIL(CHAR_LENGTH(bi.master_name)/2))
@Query(value = "select it.code, ba.ns,it.name pm,point.code hw,ba.xz,ba.srs,ba.bonded,ba.supplier," +
@Query(value = "select max(ba.id) id ,it.code, ba.ns,it.name pm,point.code hw,ba.xz,ba.srs,ba.bonded,ba.supplier," +
// "GROUP_CONCAT(SUBSTRING(bi.master_name, 1, CEIL(CHAR_LENGTH(bi.master_name)/2))) jxs ,GROUP_CONCAT(ba.singles) tyls " +
"GROUP_CONCAT(bi.master_name) jxs ,GROUP_CONCAT(ba.singles) tyls " +
"from base_bom_account ba \n" +

View File

@ -17,6 +17,7 @@ package com.youchain.basicdata.repository;
import com.youchain.basicdata.domain.BigItem;
import com.youchain.basicdata.domain.Point;
import com.youchain.businessdata.returnJson.PointZyPrint;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
@ -44,4 +45,10 @@ public interface PointRepository extends JpaRepository<Point, Long>, JpaSpecific
@Query("from Point i where i.code in (:codes) and i.enabled=true ")
List<Point> queryByPointCodes(List<String> codes);
@Query(value = "select p.code,area.`name` areaName from base_point p \n" +
"left join base_area area on area.id=p.area_id " +
" where (area.name=:areaName or :areaName is null)", nativeQuery = true)
List<PointZyPrint> queryPrintAll(String areaName);
}

View File

@ -130,7 +130,7 @@ public class BomAccountController {
public ResponseEntity<Object> bomPrintBiaoQianList(@PathVariable("dxw") String dxw){
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
String json=(String)redisUtils.get(SecurityUtils.getCurrentUsername()+dxw);
log.info(SecurityUtils.getCurrentUsername()+dxw+"-----"+json);
//log.info(SecurityUtils.getCurrentUsername()+dxw+"-----"+json);
List<BomPrint_BiaoQian2> list= JSONUtil.toList(json, BomPrint_BiaoQian2.class);
List<BomPrint_BiaoQian> list2=new ArrayList<>();
for(BomPrint_BiaoQian2 l:list){
@ -142,21 +142,16 @@ public class BomAccountController {
hw=hw.substring(0,3)+"-"+hw.substring(3,hw.length());
bq.setHw(hw);
bq.setPm(l.getPm());
bq.setEwm(l.getCode()+";"+l.getNs()+";"+l.getBonded()+";"+l.getHw());
bq.setEwm(l.getId()+"]"+l.getCode()+"]"+l.getNs()+"]"+l.getBonded()+"]"+l.getHw());
bq.setBonded(l.getBonded());
bq.setSrs(l.getSrs());
bq.setXz(l.getXz());
bq.setSupplier(l.getSupplier());
if(dxw.equals("_BiaoQian_D")){
bq.setId(l.getId());
bq.setJxs(l.getJxs() == null ? null :
Arrays.stream(l.getJxs().split(","))
.map(s -> s.length() > 10 ? s.substring(0, 10) : s)
.toArray(String[]::new));
}else {
bq.setJxs(l.getJxs() == null ? null : l.getJxs().split(","));
}
bq.setTyls(l.getTyls()==null?null:l.getTyls().split(","));
list2.add(bq);
}
@ -205,16 +200,17 @@ public class BomAccountController {
// }
// 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);
}
// 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);
}
@ -233,15 +229,15 @@ public class BomAccountController {
// }
// 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);
}
// 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);
bomAccountLogService.copyBomAccount(resources.getId(),"update");
return new ResponseEntity<>(HttpStatus.NO_CONTENT);

View File

@ -15,6 +15,7 @@
*/
package com.youchain.basicdata.rest;
import cn.hutool.json.JSONUtil;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import com.alibaba.fastjson.JSON;
@ -25,10 +26,13 @@ import com.youchain.basicdata.domain.Area;
import com.youchain.basicdata.domain.Item;
import com.youchain.basicdata.domain.Point;
import com.youchain.basicdata.repository.ItemRepository;
import com.youchain.basicdata.repository.PointRepository;
import com.youchain.basicdata.service.AreaService;
import com.youchain.basicdata.service.PointService;
import com.youchain.basicdata.service.dto.BomAccountQueryCriteria;
import com.youchain.basicdata.service.dto.PointDto;
import com.youchain.basicdata.service.dto.PointQueryCriteria;
import com.youchain.businessdata.returnJson.*;
import com.youchain.businessdata.service.InventoryService;
import com.youchain.businessdata.service.dto.InventoryDto;
import com.youchain.businessdata.service.dto.InventoryQueryCriteria;
@ -36,10 +40,9 @@ import com.youchain.config.FileProperties;
import com.youchain.exception.BadRequestException;
import com.youchain.exception.handler.ApiError;
import com.youchain.modules.system.domain.Dept;
import com.youchain.utils.BaseStatus;
import com.youchain.utils.FileUtil;
import com.youchain.utils.UserUtils;
import com.youchain.utils.*;
import lombok.extern.slf4j.Slf4j;
import net.dreamlu.mica.core.utils.JsonUtil;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
@ -52,10 +55,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
@ -74,12 +74,13 @@ import static org.springframework.http.HttpStatus.BAD_REQUEST;
public class PointController {
private final PointService pointService;
private final InventoryService inventoryService;
private final AreaService areaService;
private final FileProperties properties;
private final ItemRepository itemRepository;
private final InventoryService inventoryService;
private final PointRepository pointRepository;
@Log("导出数据")
@ApiOperation("导出数据")
@ -255,4 +256,34 @@ public class PointController {
pointService.queryPoint(pointCode);
return new ResponseEntity<>(HttpStatus.OK);
}
@GetMapping("/queryPointPrintList")
@Log("查询自由货位标签")
@ApiOperation("查询自由货位标签")
@AnonymousAccess
public ResponseEntity<Object> queryPointPrintList(PointQueryCriteria criteria){
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
redisUtils.del(SecurityUtils.getCurrentUsername()+"_BiaoQian_ZY");
List<PointZyPrint> list=pointRepository.queryPrintAll(criteria.getAreaName());
redisUtils.set(SecurityUtils.getCurrentUsername()+"_BiaoQian_ZY", JsonUtil.toJson(list));
return new ResponseEntity<>(list,HttpStatus.OK);
}
@GetMapping("/pointPrintBiaoQianList/{type}")
@Log("获取Point中库位标签")
@ApiOperation("获取Point中库位标签")
@AnonymousAccess
public ResponseEntity<Object> pointPrintBiaoQianList(@PathVariable("type") String type){
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
String json=(String)redisUtils.get(SecurityUtils.getCurrentUsername()+type);
log.info(SecurityUtils.getCurrentUsername()+type+"-----"+json);
List<PointPrint_BiaoQian_Zy> list= JSONUtil.toList(json, PointPrint_BiaoQian_Zy.class);
List<PointPrint_BiaoQian_Zy> list2=new ArrayList<>();
for(PointPrint_BiaoQian_Zy zy:list){
zy.setEwm(zy.getCode());
zy.setCode(zy.getCode().substring(0,3)+"-"+zy.getCode().substring(3));
list2.add(zy);
}
return new ResponseEntity<>( list2,HttpStatus.OK);
}
}

View File

@ -23,6 +23,8 @@ import com.youchain.basicdata.service.dto.ItemDto;
import com.youchain.basicdata.service.dto.PointDto;
import com.youchain.basicdata.service.dto.PointQueryCriteria;
import com.youchain.basicdata.service.dto.PointSmallDto;
import com.youchain.businessdata.returnJson.BomPrint;
import com.youchain.businessdata.returnJson.PointZyPrint;
import org.springframework.data.domain.Pageable;
import java.util.Map;
import java.util.List;
@ -128,6 +130,7 @@ public interface PointService {
List<Point> getPoint(String type,String areaCode);
/**
*
* @param code

View File

@ -40,6 +40,12 @@ public class BomAccountDto implements Serializable {
/** 部品品番 */
private ItemDto item;
/** 机型代码 */
private String bigItemCode;
/** 机型名称 */
private String bigItemName;
/** 刻印前缀 */
private String kyqz;
/** 加工内容 */
private String contents;

View File

@ -53,8 +53,6 @@ public class ImportBomAccountServiceImpl implements ImportBomAccountService {
List<BomEntity> dataList =new ArrayList<>();
for (Map<Integer, Object> map: list ) {
BomEntity bomAccountImport=new BomEntity();
bomAccountImport.setPf(map.get(0) != null ? map.get(0).toString() : "");
bomAccountImport.setNs(map.get(1) != null ? map.get(1).toString() : "");
@ -69,8 +67,7 @@ public class ImportBomAccountServiceImpl implements ImportBomAccountService {
bomAccountImport.setTckw(map.get(10) != null ? map.get(10).toString() : "");
bomAccountImport.setDxw(map.get(11) != null ? map.get(11).toString() : "");
bomAccountImport.setSb(map.get(12) != null ? map.get(12).toString() : "");
if(bomAccountImport.getZcfq().equals("制造库位")) {
for (int ccc=0;ccc<50;ccc++){
BomEntity bomAccountImport_new=new BomEntity();
int index=ccc*4+12;
@ -94,14 +91,29 @@ public class ImportBomAccountServiceImpl implements ImportBomAccountService {
bomAccountImport_new.setTckw(bomAccountImport.getTckw());
bomAccountImport_new.setDxw(bomAccountImport.getDxw());
bomAccountImport_new.setSb(bomAccountImport.getSb());
if(bomAccountImport_new.getTyl().length()>0){
if (bomAccountImport_new.getTyl().length() > 0) {
dataList.add(bomAccountImport_new);
}
}
}else{
bomAccountImport.setJxdm(BaseStatus.DEFAULT_CG_BIG);
bomAccountImport.setJx(BaseStatus.DEFAULT_CG_BIG);
bomAccountImport.setTyl("0");
dataList.add(bomAccountImport);
}
}
log.error(JSONUtil.toJsonStr(dataList));
Map<String, BomEntity> existBomAccountMap =new HashMap<>();
for(BomEntity ba:dataList){
String key=ba.pf+"]"+ba.jxdm+"]"+ba.ns+"]"+ ba.hw+"]"+ba.sb;
if(existBomAccountMap.containsKey(key)){
log.info(JSONUtil.toJsonStr(ba));
}
existBomAccountMap.put(key,ba);
}
dataList = new ArrayList<>(existBomAccountMap.values());
// List<BomAccountImport> dataList = FastExcelUtil.readExcelData(file, BomAccountImport.class, 0, 1);
//批量导入
@ -118,6 +130,8 @@ public class ImportBomAccountServiceImpl implements ImportBomAccountService {
// log.info("处理批量导入,数据条数: {}", dataList.size());
Map<String,ItemEntity> itemEntitys=new HashMap<>();
Map<String,BigItemEntity> biEntitys=new HashMap<>();
for (BomEntity data : bomEntitys) {
ItemEntity it=new ItemEntity();
it.setAc(data.getAc());
@ -127,15 +141,20 @@ public class ImportBomAccountServiceImpl implements ImportBomAccountService {
it.setSrs(data.getSrs()+"");
itemEntitys.put(data.getPf(),it);
BigItemEntity be=new BigItemEntity();
be.setCode(data.getJxdm());
be.setName(data.jx);
biEntitys.put(data.getJxdm(),be);
}
//验证品番
Map<String, Item> existItemMap = validateItem(itemEntitys);
//获取文件中所有的完成品
List<String> bigItemNames = bomEntitys.stream().map(BomEntity::getJx).collect(Collectors.toList());
bigItemNames = bigItemNames.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
// List<String> bigItemNames = bomEntitys.stream().map(BomEntity::getJx).collect(Collectors.toList());
// bigItemNames = bigItemNames.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
// //验证完成品品番
// Map<String, BigItem> existBigItemMap = validateBigItem(bigItemNames);
//验证完成品品番
Map<String, BigItem> existBigItemMap = validateBigItem(bigItemNames);
Map<String, BigItem> existBigItemMap = validateBigItem(biEntitys);
//获取文件中所有的库位
List<String> hwCodes = bomEntitys.stream().map(BomEntity::getHw).collect(Collectors.toList());
hwCodes = hwCodes.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
@ -144,21 +163,28 @@ public class ImportBomAccountServiceImpl implements ImportBomAccountService {
List<BomAccount> createBomList = new ArrayList<>();//批量新增BomAccount
List<BomAccount> updateBomList = new ArrayList<>();//批量修改BomAccount
// Area outArea=areaRepository.getByCode(BaseStatus.DEFAULT_AREA);
log.info("开始校验");
int i=0;
List<BomAccount> bomAccounts=bomAccountRepository.findAll();
Map<String, BomAccount> existBomAccountMap =new HashMap<>();
for(BomAccount ba:bomAccounts){
existBomAccountMap.put(ba.getBigItem().getId()+"]"+ba.getItem().getId()+"]"+ba.getNs()+"]"+ ba.getZPoint().getId()+"]"+ba.getBonded(),ba);
}
for (BomEntity entity : bomEntitys) {
// log.info("开始校验"+i+++"行");
//品番
Item item = existItemMap.get(entity.getPf());
//货位
Point point=existPointMap.get(entity.getHw());
//完成品品番
BigItem bigItem=existBigItemMap.get(entity.getJx());
BomAccount existBom = bomAccountRepository.findByQnique(bigItem.getId(), item.getId(),entity.ns, point.getId());
if(existBom==null){
existBom=new BomAccount();
BigItem bigItem=existBigItemMap.get(entity.getJxdm());
BomAccount existBom =existBomAccountMap.get(bigItem.getId()+"]"+item.getId()+"]"+entity.ns+"]"+ point.getId()+"]"+entity.sb);
if(existBom!=null){
BomAccount ba=this.BaEntity(existBom,entity,bigItem,item,point,Integer.parseInt(entity.tyl),null);
ba.setId(existBom.getId());
updateBomList.add(ba);
}else {
existBom=new BomAccount();
BomAccount ba = this.BaEntity(existBom, entity, bigItem,item, point, Integer.parseInt(entity.tyl),null);
createBomList.add(ba);
}
@ -169,6 +195,8 @@ public class ImportBomAccountServiceImpl implements ImportBomAccountService {
bomAccountService.update(bomAccount);
bomAccountLogService.copyBomAccount(bomAccount.getId(), "import_update");
}*/
}
log.info("校验完成,开始批量保存拉。。。。新增"+createBomList.size()+"修改"+updateBomList.size());
if(CollectionUtils.isNotEmpty(createBomList)){
bomAccountRepository.saveAll(createBomList);
}
@ -176,7 +204,6 @@ public class ImportBomAccountServiceImpl implements ImportBomAccountService {
bomAccountRepository.saveAll(updateBomList);
}
}
}
//验证品番
private Map<String,Item> validateItem(Map<String,ItemEntity> entitys) {
@ -212,6 +239,43 @@ public class ImportBomAccountServiceImpl implements ImportBomAccountService {
return totalMap;
}
//验证完成品番
private Map<String,BigItem> validateBigItem(Map<String,BigItemEntity> entitys) {
List<String> allCodes = entitys.values().stream()
.map(BigItemEntity::getCode)
.collect(Collectors.toList());
Map<String, BigItem> existMap = bigItemService.queryByBigItemCodesToMap(allCodes);
Map<String, BigItem> createMap = new HashMap<>();
List<String> existCodes = new ArrayList<>(existMap.keySet());
// 获取两个集合的非交集说明品番不存在或失效,直接提示
List<String> difference = SmartStringUtil.getDifference(allCodes, existCodes);
List<BigItem> createEntitys=new ArrayList<>();
for(String code:difference){
BigItemEntity bi=entitys.get(code);
BigItem entity=new BigItem();
entity.setCode(code);
entity.setName(bi.getName());
entity.setDeptId(UserUtils.getDept().getId());
entity.setModels("无");
entity.setMasterName(bi.getName());
entity.setEnabled(true);
entity.setDeptId(UserUtils.getDept().getId());
createEntitys.add(entity);
}
if(CollectionUtils.isNotEmpty(createEntitys)){
List<BigItem> createEntityList= bigItemRepository.saveAll(createEntitys);
for (BigItem it:createEntityList){
createMap.put(it.getCode(),it);
}
}
Map<String, BigItem> totalMap = new HashMap<>();
if (existMap != null) {
totalMap.putAll(existMap);
}
totalMap.putAll(createMap);
return totalMap;
}
//验证完成品品番
private Map<String,BigItem> validateBigItem(List<String> allCodes) {
log.info(allCodes.toString());
@ -305,6 +369,7 @@ public class ImportBomAccountServiceImpl implements ImportBomAccountService {
@Data
public class BigItemEntity{
private String code;
private String name;
}
@Data
@ -351,6 +416,9 @@ public class ImportBomAccountServiceImpl implements ImportBomAccountService {
ba.setDept(UserUtils.getDept());
ba.setZcfq(data.getZcfq());
ba.setTckw(data.getTckw());
ba.setBigItemName(data.getJx());
ba.setBigItemCode(data.getJxdm());
ba.setKyQz(data.getKyh());
return ba;
}

View File

@ -64,6 +64,10 @@ public class PickDetail extends BaseEntity implements Serializable {
@ApiModelProperty(value = "行号")
private Long lineNo;
@Column(name = "`type`")
@ApiModelProperty(value = "指示类型")
private String type;
@Column(name = "`po`")
@ApiModelProperty(value = "po订单号")
private String po;

View File

@ -48,6 +48,10 @@ public class XppRecord extends BaseEntity implements Serializable {
@ApiModelProperty(value = "ID")
private Long id;
@Column(name = "`type`")
@ApiModelProperty(value = "采集类型")
private String type;
@Column(name = "`ewm`")
@ApiModelProperty(value = "二维码")
private String ewm;

View File

@ -263,8 +263,16 @@ public class AsnDetailController {
RRkXpp map = xppRecordService.xppAnalysis(s.getEwm());
return new ResponseEntity<>(map, HttpStatus.OK);
}
if (seq==2) {
if (seq==2||seq==3) {//库存上架
String pointCode = s.getPointCode();
String bomItemCode=null;
String bonded=null;
if(seq==3){
String[] str=pointCode.split("]");
pointCode=str[4];
bomItemCode=str[1];
bonded=str[3];
}
if (pointCode == null||pointCode.equals("")) {
return new ResponseEntity<>( "库位不能为空", BAD_REQUEST);
}
@ -274,10 +282,13 @@ public class AsnDetailController {
}
Area area=point.getArea();
for(String ewm:s.getEwms()){
XppRecord xppRecord = xppRecordService.saveXppRecord(ewm);
if(seq==2) {//收货上架
XppRecord xppRecord = xppRecordService.saveXppRecord(ewm, point.getArea(), "1001");
AsnDetail asnDetail = xppRecordService.addAsnDetail(xppRecord);
asnDetailService.putawayInv(asnDetail.getId(),area.getId(),point.getId(),xppRecord.getNrs(),xppRecord.getEwm());
asnDetailService.putawayInv(asnDetail.getId(), area.getId(), point.getId(), xppRecord.getNrs(), xppRecord.getEwm());
}else if(seq==3){//制造投料
xppRecordService.xppPutaway(ewm,bonded,bomItemCode,point);
}
}
}
return new ResponseEntity<>("操作成功", HttpStatus.OK);
@ -289,11 +300,21 @@ public class AsnDetailController {
@AnonymousAccess
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<Object> collectPutAway(@RequestBody HashMap rk) {
XppRecord xppRecord = xppRecordService.saveXppRecord(rk.get("ewm").toString());
Long pointId=Long.parseLong(rk.get("pointId").toString());
AsnDetail asnDetail = xppRecordService.addAsnDetail(xppRecord);
String type=rk.get("type").toString();
Point point=pointService.findEntityById(pointId);
String ewm=rk.get("ewm").toString();
if(type.equals("1001")){//收货上架
XppRecord xppRecord = xppRecordService.saveXppRecord(rk.get("ewm").toString(),point.getArea(),type);
AsnDetail asnDetail = xppRecordService.addAsnDetail(xppRecord);
asnDetailService.putawayInv(asnDetail.getId(),point.getArea().getId(),pointId,xppRecord.getNrs(),xppRecord.getEwm());
}else if(type.equals("2001")){//制造上架
//查找线边库存是否存在,插入
Long bomId=Long.parseLong(rk.get("bomId").toString());
BomAccount bom=bomAccountRepository.getById(bomId);
String bomItemCode=bom.getItem().getCode();
xppRecordService.xppPutaway(ewm,bom.getBonded(),bomItemCode,point);
}
return new ResponseEntity<>("操作成功", HttpStatus.OK);
}

View File

@ -110,13 +110,22 @@ public class PickDetailController {
return new ResponseEntity<>(pickDetailService.queryAll(criteria, pageable), HttpStatus.OK);
}
@GetMapping(value = "/queryPickDetailZzjl")
@Log("查询pickDetail")
@ApiOperation("查询pickDetail")
@AnonymousAccess
public ResponseEntity<Object> queryPickDetailZzjl(PickDetailQueryCriteria criteria, Pageable pageable) {
criteria.setType("ZCZS");
return new ResponseEntity<>(pickDetailService.queryAll(criteria, pageable), HttpStatus.OK);
}
@GetMapping(value = "/queryPickDetailZsc")
@Log("查询指示残")
@ApiOperation("查询指示残")
@Log("查询制造叫料数据")
@ApiOperation("查询制造叫料数据")
@AnonymousAccess
public ResponseEntity<Object> queryPickDetailZsc(PickDetailQueryCriteria criteria, Pageable pageable) {
criteria.setPageType("ZSC");
return new ResponseEntity<>(pickDetailService.queryPickDetailAll(criteria, pageable), HttpStatus.OK);
criteria.setType(BaseStatus.ZZJL);
return new ResponseEntity<>(pickDetailService.queryAll(criteria, pageable), HttpStatus.OK);
}
@GetMapping(value = "/queryPickDetailAll")
@ -190,13 +199,13 @@ public class PickDetailController {
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/cxjl")
@Log("产线叫料")
@ApiOperation("产线叫料")
@PostMapping("/zzjl")
@Log("制造叫料")
@ApiOperation("制造叫料")
@PreAuthorize("@el.check('super:man')")
@AnonymousAccess
@DuplicateSubmission(5)
public ResponseEntity<Object> cxjl(@RequestBody CxjlDto cxjldto) throws Exception {
public ResponseEntity<Object> zzjl(@RequestBody CxjlDto cxjldto) throws Exception {
pickDetailService.cxjlCreate(cxjldto);
return new ResponseEntity<>(HttpStatus.OK);
}
@ -206,15 +215,13 @@ public class PickDetailController {
@ApiOperation("拣货分配审核")
@AnonymousAccess
public synchronized ResponseEntity<Object> allocatePickDetail(@RequestBody Long[] ids) throws Exception {
List<Long> picktickIds = Arrays.asList(ids);
Collections.sort(picktickIds);//升序排序
if (picktickIds.size() > 0) {
List<Long> pickDetailIds = Arrays.asList(ids);
Collections.sort(pickDetailIds);//升序排序
if (pickDetailIds.size() > 0) {
try {
for (Long picktickId : picktickIds) {
List<PickDetail> pickDetailList = pickDetailService.queryPickDetailList(picktickId);
for (PickDetail pd : pickDetailList) {
pickDetailService.allocate(pd.getId(), pd.getOrderQty() - pd.getAllocatedQty(),pd.getPo());
}
for (Long pickDetailId : pickDetailIds) {
PickDetail pickDetail=pickDetailRepository.getById(pickDetailId);
pickDetailService.allocate(pickDetail.getId(), pickDetail.getOrderQty() - pickDetail.getAllocatedQty(),pickDetail.getPo(),BaseStatus.ZZJL);
}
} catch (Exception e) {
return new ResponseEntity(ApiResult.fail(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
@ -262,14 +269,14 @@ public class PickDetailController {
throw new BadRequestException(sbIt.getCode()+"找不到对应的Bom工位清单"+sbQty);
}
BomAccount bomAccount=bomList.get(0);
PickDetail newD= pickDetailService.createPickDetail(pt,sbIt,oldD.getPo(),sbQty,oldD.getSupplier());
PickDetail newD= pickDetailService.createPickDetail(pt,sbIt,oldD.getPo(),sbQty,oldD.getSupplier(),BaseStatus.ZCCK);
newD.setRemark("设变");
newD.setSourceId(oldD.getId());
newD.setBomId(bomAccount.getId());
newD.setAc(bomAccount.getAc());
newD.setSupplier(bomAccount.getSupplier());
newD.setPoint(bomAccount.getZPoint());
pickDetailService.allocate(newD.getId(), newD.getOrderQty() - newD.getAllocatedQty(),oldD.getPo());
pickDetailService.allocate(newD.getId(), newD.getOrderQty() - newD.getAllocatedQty(),oldD.getPo(),BaseStatus.ZCCK);
oldD.setOrderQty(oldD.getOrderQty()-sbQty);
oldD.setSourceId(newD.getId());
pickDetailService.update(oldD);
@ -398,7 +405,7 @@ public class PickDetailController {
for (Object[] obj : objs) {
PickDetail oldDetail = pickDetailRepository.getById(Long.parseLong(obj[0].toString()));
double orderQty = oldDetail.getOrderQty() - oldDetail.getAllocatedQty() - oldDetail.getBcQty();
PickDetail pickDetail = pickDetailService.createPickDetail(pickTicket, oldDetail.getItem(), null, orderQty, oldDetail.getSupplier());
PickDetail pickDetail = pickDetailService.createPickDetail(pickTicket, oldDetail.getItem(), null, orderQty, oldDetail.getSupplier(),BaseStatus.ZCCK);
pickDetail.setPoint(oldDetail.getPoint());
pickDetail.setPo(oldDetail.getPo());
pickDetail.setPropC3(oldDetail.getPropC3());
@ -410,7 +417,7 @@ public class PickDetailController {
pickDetail.setArea(oldDetail.getArea());
pickDetail.setShArea(oldDetail.getShArea());
pickDetailService.update(pickDetail);
pickDetailService.allocate(pickDetail.getId(), pickDetail.getOrderQty(),pickDetail.getPo());
pickDetailService.allocate(pickDetail.getId(), pickDetail.getOrderQty(),pickDetail.getPo(),BaseStatus.ZCCK);
double bcQty = pickDetail.getAllocatedQty();
//将出单数写入到订单数
pickDetail.setOrderQty(bcQty);

View File

@ -219,10 +219,10 @@ public class PickTicketController {
double orderQty=0;
//生成出库明细
for (Inventory inv:invs){
PickDetail detail=pickDetailService.createPickDetail(pickTicket,inv.getItemKey().getItem(), stockCode,inv.getQuantity(),null);
PickDetail detail=pickDetailService.createPickDetail(pickTicket,inv.getItemKey().getItem(), stockCode,inv.getQuantity(),null,BaseStatus.ZCCK);
orderQty+=detail.getOrderQty();
//分配
pickDetailService.allocate(detail.getId(), detail.getOrderQty(),stockCode);
pickDetailService.allocate(detail.getId(), detail.getOrderQty(),stockCode,BaseStatus.ZCCK);
}
pickTicket.setOrderQuantity(orderQty);
pickTicketService.update(pickTicket);

View File

@ -105,6 +105,7 @@ public class PlanPickDetailController {
return new ResponseEntity<>(planPickDetailService.queryAll(criteria, pageable), HttpStatus.OK);
}
@GetMapping("/getAllCode")
@Log("获取全部单号做下拉")
@ApiOperation("获取全部单号做下拉")

View File

@ -112,6 +112,16 @@ public class XppRecordController {
@ApiOperation("查询xppRecord")
@AnonymousAccess
public ResponseEntity<Object> queryXppRecord(XppRecordQueryCriteria criteria, Pageable pageable) {
criteria.setType("1001");
return new ResponseEntity<>(xppRecordService.queryAll(criteria, pageable), HttpStatus.OK);
}
@GetMapping(value = "/queryXppRecordZztl")
@Log("查询xppRecord")
@ApiOperation("查询xppRecord")
@AnonymousAccess
public ResponseEntity<Object> queryXppRecordZztl(XppRecordQueryCriteria criteria, Pageable pageable) {
criteria.setType("2001");
return new ResponseEntity<>(xppRecordService.queryAll(criteria, pageable), HttpStatus.OK);
}
@ -190,7 +200,7 @@ public class XppRecordController {
inventoryLogService.storeInventoryLog(BizStatus.RETENTION_OUT, BizStatus.REDUCE, "现品票留样", area, xppRecord.getItemKey(), null, null, null, null,
0d, xppRecord.getNrs() + 0d, null, xppRecord.getEwm(), BizStatus.RETENTION_OUT, xppRecord.getId(), null, "现品票留样");
PickDetail detail = pickDetailService.createPickDetail(pt, xppRecord.getItem(), xppRecord.getDdbh(), xppRecord.getNrs() + 0d, xppRecord.getRelaSupplier());
PickDetail detail = pickDetailService.createPickDetail(pt, xppRecord.getItem(), xppRecord.getDdbh(), xppRecord.getNrs() + 0d, xppRecord.getRelaSupplier(),BaseStatus.LYCK);
detail.setRemark(xppRecord.getEwm());
pickDetailService.update(detail);
pt.setOrderQuantity(pt.getOrderQuantity() + detail.getOrderQty());
@ -581,7 +591,7 @@ public class XppRecordController {
inventoryLogService.storeInventoryLog(BizStatus.RETENTION_OUT, BizStatus.REDUCE, "现品票留样", area, xppRecord.getItemKey(), null, null, null, null,
0d, xppRecord.getNrs() + 0d, null, xppRecord.getEwm(), BizStatus.RETENTION_OUT, xppRecord.getId(), null, "现品票留样");
}
PickDetail detail = pickDetailService.createPickDetail(pt, xppRecord.getItem(), xppRecord.getDdbh(), xppRecord.getNrs() + 0d, xppRecord.getRelaSupplier());
PickDetail detail = pickDetailService.createPickDetail(pt, xppRecord.getItem(), xppRecord.getDdbh(), xppRecord.getNrs() + 0d, xppRecord.getRelaSupplier(),BaseStatus.LYCK);
detail.setRemark(xppRecord.getEwm());
pickDetailService.update(detail);
pt.setOrderQuantity(pt.getOrderQuantity() + detail.getOrderQty());

View File

@ -13,6 +13,7 @@ import javax.persistence.Entity;
* @date: 2020-04-01 15:01
*/
public interface BomPrint {
Long getId();
String getNs();
String getCode();
String getXz();

View File

@ -10,8 +10,8 @@ import lombok.Data;
public class BomPrint_BiaoQian {
private Long id;
private String ns;
private String code;
//"箱种"

View File

@ -9,7 +9,7 @@ import lombok.Data;
@Data
public class BomPrint_BiaoQian2 {
private Long id;
private String ns;
private String code;

View File

@ -0,0 +1,16 @@
package com.youchain.businessdata.returnJson;
import lombok.Data;
/**
* @description:
* @date: 2020-04-01 15:01
*/
@Data
public class PointPrint_BiaoQian_Zy {
private String areaName;
private String code;
//"二维码"
private String ewm;
}

View File

@ -0,0 +1,11 @@
package com.youchain.businessdata.returnJson;
/**
* @description:
* @date: 2020-04-01 15:01
*/
public interface PointZyPrint {
String getCode();
String getAreaName();
String getEwm();
}

View File

@ -101,7 +101,7 @@ public interface InventoryService {
void downloadZz(List<InventoryDto> all, HttpServletResponse response) throws Exception, Exception;
List<Inventory> queryInventoryAllocate(long itemId,long areaId,Long zzkwId,String stockCode);
List<Inventory> queryInventoryAllocate(long itemId,long areaId,Long zzkwId,String stockCode,String propC2,String type);
/**
* 线

View File

@ -107,7 +107,7 @@ public interface PickDetailService {
/**
*
*/
void allocate(long id,double quantity,String stockCode);
void allocate(long id,double quantity,String stockCode,String type);
/**
*
@ -136,7 +136,7 @@ public interface PickDetailService {
* @param supplier
* @return
*/
PickDetail createPickDetail(PickTicket pt, Item item, String po, double qty,String supplier);
PickDetail createPickDetail(PickTicket pt, Item item, String po, double qty,String supplier,String type);
/**
*

View File

@ -122,7 +122,7 @@ public interface XppRecordService {
* @param ewm
* @return
*/
XppRecord saveXppRecord(String ewm);
XppRecord saveXppRecord(String ewm,Area area,String type);
/**
*
@ -134,4 +134,13 @@ public interface XppRecordService {
*/
void xppShipOut(Long id, Area area, Point srcPoint, Point zzkw, String type,String billCode,String des);
/**
*
* @param ewm
* @param bonded
* @param bomItemCode
* @param point
*/
void xppPutaway(String ewm,String bonded,String bomItemCode,Point point);
}

View File

@ -47,6 +47,11 @@ public class PickDetailDto implements Serializable {
*/
private Long pickId;
/**
* ID
*/
private String type;
/**
*
*/

View File

@ -74,5 +74,8 @@ public class PickDetailQueryCriteria{
/** 页面类型 ZSC指示残 ALL明细 */
@Query(type = Query.Type.EQUAL)
private String pageType;
/**ZCZS 正常指示,ZZJL 制造叫料*/
@Query(type = Query.Type.EQUAL)
private String type;
}

View File

@ -49,6 +49,11 @@ public class XppRecordDto implements Serializable {
*
*/
private String ewm;
/**
*
*/
private String type;
/**
*
*/

View File

@ -62,4 +62,7 @@ public class XppRecordQueryCriteria{
@Query(type = Query.Type.EQUAL)
private String prop_c1;
@Query(type = Query.Type.EQUAL)
private String type;
}

View File

@ -149,22 +149,28 @@ public class InventoryServiceImpl implements InventoryService {
}
@Override
public List<Inventory> queryInventoryAllocate(long itemId, long areaId,Long zzkwId,String stockCode) {
public List<Inventory> queryInventoryAllocate(long itemId, long areaId,Long zzkwId,String stockCode,String propC2,String type) {
String hql = " from Inventory inv where 1=1 " +
" and inv.itemKey.item.id=" + itemId + " " +
" and inv.area.id=" + areaId + " " +
" and inv.quantity-inv.queuedQty>0 and inv.quantity>0 and inv.point.code !='BH_ZC'";
if(zzkwId!=null){
hql+=" and inv.area.id=" + areaId + " ";
hql+=" and inv.zzkw.id="+zzkwId;
hql+="and inv.point.type in ('"+BaseStatus.HCKW+"','"+BaseStatus.ZZKW+"')";
}else{
hql+="and inv.point.type='"+BaseStatus.CH+"' ";
}
if(stockCode!=null){
hql+=" and inv.stockCode='"+stockCode+"'";
}else{
hql+=" and inv.stockCode is null";
if(type.equals(BaseStatus.ZCCK)) {
if (stockCode != null) {
hql += " and inv.stockCode='" + stockCode + "'";
} else {
hql += " and inv.stockCode is null";
}
}
if(propC2!=null){
hql+=" and inv.itemKey.propC2='"+propC2+"'";
}
hql+= " order by inv.itemKey.propC1 asc ";
Query query = entityManager.createQuery(hql);
List<Inventory> inventoryList = query.getResultList();
@ -209,9 +215,9 @@ public class InventoryServiceImpl implements InventoryService {
throw new BadRequestException(HttpStatus.NOT_FOUND, area.getCode()+"接收库区必须为线边仓");
}
// if(area.getPoint()==null){
if(area.getPointId()==null){
throw new BadRequestException(HttpStatus.NOT_FOUND, "接收库区线边库位必填");
}
// if(area.getPointId()==null){
// throw new BadRequestException(HttpStatus.NOT_FOUND, "接收库区线边库位必填");
// }
}
if(type.equals(BizStatus.SL_ALL)){
//取库区默认

View File

@ -60,6 +60,7 @@ import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.*;
import java.io.IOException;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import javax.servlet.http.HttpServletResponse;
@ -79,6 +80,7 @@ public class PickDetailServiceImpl implements PickDetailService {
private final PickDetailMapper pickDetailMapper;
private final InventoryRepository inventoryRepository;
private final TaskRepository taskRepository;
private final BomAccountRepository bomAccountRepository;
private final ItemService itemService;
private final TaskService taskService;
private final AreaService areaService;
@ -178,6 +180,7 @@ public class PickDetailServiceImpl implements PickDetailService {
Area sharea=areaRepository.getById(cxjldto.getRk_id());
Item it=itemRepository.getById(cxjldto.getItem_id());
Point zzkw= pointRepository.getById(cxjldto.getZzkw_id());
BomAccount bomAccount=bomAccountRepository.getById(cxjldto.getBom_account_id());
pd.setArea(area);
pd.setShArea(sharea);
pd.setItem(it);
@ -185,30 +188,44 @@ public class PickDetailServiceImpl implements PickDetailService {
pd.setStatus(BizStatus.OPEN);
pd.setOrderQty(cxjldto.getOrder_qty());
pd.setRemark(cxjldto.getRemark());
pd.setSourceName("CXJL");
pd.setType(BaseStatus.ZZJL);
pd.setPropC2(bomAccount.getBonded());
pd.setBomId(bomAccount.getId());
this.create(pd);
return pd;
}
@Override
@Transactional(rollbackFor = Exception.class)
public synchronized void allocate(long id, double quantity,String stockCode){
public synchronized void allocate(long id, double quantity,String stockCode,String type){
PickDetailDto pickDetailDto = findById(id);
PickDetail pd = toEntity(pickDetailDto);//Dto转实体
PickTicket pickTicket = pd.getPickTicket();
ItemDto itemDto = pickDetailDto.getItem();
Item item = itemService.toEntity(itemDto);
String billCode=null;
Long areaId=0L;
if (pd.getOrderQty() > pd.getAllocatedQty()) {
Long zzkwId=null;
if(pickTicket!=null){
if(pd.getPoint()!=null&&pickTicket.getArea().getBexb()){
zzkwId=pd.getPoint().getId();
}
List<Inventory> invs = inventoryService.queryInventoryAllocate(item.getId(), pickTicket.getArea().getId(),zzkwId,stockCode);
areaId= pickTicket.getArea().getId();
billCode=pickTicket.getCode();
}
List<Inventory> invs = inventoryService.queryInventoryAllocate(item.getId(),areaId,zzkwId,stockCode,pd.getPropC2(),type);
if (invs.size() > 0) {
double allocateQty = 0;
double unQty = quantity;//未分配数量
double srs=item.getExtendD3();
Map<String,String> map=new HashMap<>();
for (Inventory inv : invs) {
if(inv.getStockCode()!=null){
//回写推荐托盘即可
map.put(inv.getId()+"",inv.getStockCode()+"]"+inv.getItemKey().getPropC1()+"]"+inv.getPoint().getCode()+"]"+inv.getQuantity());
continue;
}
Point startPoint = inv.getPoint();//原库位
String areaCode=BaseStatus.DEFAULT_AREA;
Point endPoint = pointService.getPoint(null, null, BaseStatus.BHZC, areaCode);//目标库位
@ -222,8 +239,9 @@ public class PickDetailServiceImpl implements PickDetailService {
if (allocateQty <= 0) {
continue;
}
if(type.equals(BaseStatus.ZCCK)) {
//本次拣货数小于收容数则按照收容数进行分配,只有正常备货单才走该逻辑
if(pickTicket.getCode().indexOf("BH")>=0||pickTicket.getCode().indexOf("BC")>=0) {
if (pickTicket.getCode().indexOf("BH") >= 0 || pickTicket.getCode().indexOf("BC") >= 0) {
if (unQty < srs) {
if (allocateQty >= srs) {
unQty = srs;
@ -232,6 +250,7 @@ public class PickDetailServiceImpl implements PickDetailService {
}
}
}
}
if (unQty < allocateQty) {
allocateQty = unQty;
}
@ -240,20 +259,32 @@ public class PickDetailServiceImpl implements PickDetailService {
unQty -= allocateQty;
pd.setAllocatedQty(pd.getAllocatedQty() + allocateQty);
pickDetailRepository.save(pd);
if(type.equals(BaseStatus.ZCCK)) {
pickTicket.setAllocatedQuantity(pickTicket.getAllocatedQuantity() + allocateQty);
if (pickTicket.getAllocatedQuantity()>0) {
pickTicket.setStatus(BizStatus.ALLOCATE);
}
//备货表上出单日期(审核写)
pickTicket.setOutOrderDate(new Timestamp(new Date().getTime()));
pickTicketRepository.save(pickTicket);
Task task = taskService.storeTask(null,pd,pickTicket.getArea(),inv.getItemKey(),startPoint,endPoint,allocateQty,inv.getStockCode());
} else if (type.equals(BaseStatus.ZZJL)) {
pd.setStatus(BizStatus.ALLOCATE);
}
this.update(pd);
Task task = taskService.storeTask(null,pd,inv.getArea(),inv.getItemKey(),startPoint,endPoint,allocateQty,inv.getStockCode());
//修改占用数,写入日志
inventoryLogService.storeInventoryLog(BizStatus.CHANGE_ZYS, BizStatus.ADD, pickTicket.getCode(), inv.getArea(), inv.getItemKey(), inv.getPoint(),
inventoryLogService.storeInventoryLog(BizStatus.CHANGE_ZYS, BizStatus.ADD, billCode, inv.getArea(), inv.getItemKey(), inv.getPoint(),
inv.getPoint(), inv.getZzkw(), (inv.getQueuedQty()-allocateQty), allocateQty, null, BizStatus.PICK,
pd.getId(), inv.getId(), task.getId()+"备货占用");
}
if(map!=null){
pd.setRemark(map.values().stream()
.collect(Collectors.joining("\n")));
log.info(pd.getRemark()+"===="+pd.getType());
this.update(pd);
}
}
} else {
throw new BadRequestException(HttpStatus.NOT_FOUND,"已分配,请勿重复操作!");
@ -328,7 +359,7 @@ public class PickDetailServiceImpl implements PickDetailService {
}
@Override
public PickDetail createPickDetail(PickTicket pt,Item item, String po,double qty,String supplier) {
public PickDetail createPickDetail(PickTicket pt,Item item, String po,double qty,String supplier,String type) {
PickDetail d = new PickDetail();
d.setItem(item);
d.setLineNo(1l);
@ -338,6 +369,7 @@ public class PickDetailServiceImpl implements PickDetailService {
d.setPo(po);
d.setPickTicket(pt);
d.setSupplier(supplier);
d.setType(BaseStatus.ZCCK);
pickDetailRepository.save(d);
return d;
}

View File

@ -192,7 +192,7 @@ public class PickInstructionServiceImpl implements PickInstructionService {
}
}
PickDetail pickDetailDto = pickDetailRepository.save(pickDetail);
pickDetailService.allocate(pickDetailDto.getId(), pickDetailDto.getOrderQty(),null);
pickDetailService.allocate(pickDetailDto.getId(), pickDetailDto.getOrderQty(),null,BaseStatus.ZCCK);
bcAllocatedQty = pickDetail.getAllocatedQty();
//回写
pickInstruction.setAllocatedQty(pickInstruction.getAllocatedQty()+bcAllocatedQty);

View File

@ -29,6 +29,7 @@ import com.youchain.businessdata.repository.AsnDetailRepository;
import com.youchain.businessdata.returnJson.RRkXpp;
import com.youchain.businessdata.service.InventoryLogService;
import com.youchain.businessdata.service.InventoryService;
import com.youchain.businessdata.service.ItemKeyService;
import com.youchain.businessdata.service.dto.*;
import com.youchain.exception.BadRequestException;
import com.youchain.modules.system.domain.Job;
@ -56,6 +57,8 @@ import javax.persistence.EntityManager;
import javax.persistence.Query;
import javax.servlet.http.HttpServletResponse;
import static org.springframework.http.HttpStatus.BAD_REQUEST;
/**
* @author baobinglin
* @website https://eladmin.vip
@ -74,6 +77,7 @@ public class XppRecordServiceImpl implements XppRecordService {
private final AreaRepository areaRepository;
private final JobRepository jobRepository;
private final ItemKeyService itemKeyService;
private final InventoryLogService inventoryLogService;
private final InventoryService inventoryService;
@ -330,6 +334,9 @@ public class XppRecordServiceImpl implements XppRecordService {
if (criteria.getDdbh()!=null &&!criteria.getDdbh().equals("") ) {
sql += " and xpp.ddbh like '%" + criteria.getDdbh() + "%'";
}
if (criteria.getType()!=null &&!criteria.getType().equals("") ) {
sql += " and xpp.type = '" + criteria.getType() + "'";
}
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 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)+"'";
@ -435,7 +442,7 @@ public class XppRecordServiceImpl implements XppRecordService {
return xpp;
}
public XppRecord saveXppRecord(String ewm){
public XppRecord saveXppRecord(String ewm,Area area,String type){
XppRecord xppRecord = xppRecordRepository.findByCode(ewm);
if (xppRecord != null) {
throw new BadRequestException("二维码已采集");
@ -446,7 +453,7 @@ public class XppRecordServiceImpl implements XppRecordService {
throw new BadRequestException("部品品番不存在");
}
xppRecord = new XppRecord();
Area area=areaRepository.getByCode(BaseStatus.DEFAULT_AREA);
// Area area=areaRepository.getByCode(BaseStatus.DEFAULT_AREA);
// Long user_id=SecurityUtils.getCurrentUserId();
// List<Job> jobs=jobRepository.jobAreaCodes(user_id);
// if(jobs.size()>0){
@ -463,6 +470,7 @@ public class XppRecordServiceImpl implements XppRecordService {
// throw new BadRequestException(pf+"找不到BOM对应的出库库区");
// }
xppRecord.setItem(item);
xppRecord.setType(type);
xppRecord.setItemCode(xpp.getItemCode());
xppRecord.setAreaCode(xpp.getPq());
xppRecord.setAc(xpp.getAc());
@ -523,7 +531,26 @@ public class XppRecordServiceImpl implements XppRecordService {
inventoryLogService.storeInventoryLog(type, BizStatus.REDUCE, billCode, area, ik, srcPoint, srcPoint, null, null, srcQty, xppRecord.getNrs()+0d,null,xppRecord.getEwm(),
BizStatus.ASN, xppRecord.getId(), inventory.getId(), des);
}
public void xppPutaway(String ewm,String bonded,String bomItemCode,Point point) {
String xppItemCode = ewm.substring(3, 13);
if(!xppItemCode.equals(bomItemCode)){
throw new BadRequestException("现品票品番"+xppItemCode+"和库位品番"+bomItemCode+"不一致");
//return new ResponseEntity<>( "现品票品番"+xppItemCode+"和库位品番"+bomItemCode+"不一致", BAD_REQUEST);
}
XppRecord xppRecord = this.saveXppRecord(ewm,point.getArea(),"2001");
ItemKey itemKey = itemKeyService.getItemKey(xppRecord.getItem(), null,bonded);
Inventory inventory = inventoryService.getInventory(itemKey, point.getArea(), point, point, point.getDept(), BizStatus.ZZKW_TL,null);
double srcQty = inventory.getQuantity();
inventory.setQuantity(inventory.getQuantity() + xppRecord.getNrs());
inventoryService.update(inventory);
InventoryLog inventoryLog = inventoryLogService.storeInventoryLog(BizStatus.ZZKW_TL, BizStatus.ADD, xppRecord.getDdbh(), point.getArea(), itemKey, inventory.getPoint(), inventory.getPoint(), null, null, srcQty, xppRecord.getNrs()+0d, null, xppRecord.getEwm(),
BizStatus.ZZKW_TL, xppRecord.getId(), inventory.getId(), "制造投料");
inventoryLog.setZzkw(point);
inventoryLogService.update(inventoryLog);
xppRecord.setInvPoint(point);
xppRecord.setStatus(BizStatus.ZZKW_TL);
this.update(xppRecord);
}
}

View File

@ -111,5 +111,20 @@ public interface BaseStatus {
*/
public static String BS = "保税";
/**
* -
*/
public static String ZCCK = "ZCCK";
/**
* -
*/
public static String LYCK = "LYCK";
/**
* -
*/
public static String ZZJL = "ZZJL";
}

View File

@ -70,6 +70,11 @@ public class BizStatus {
*/
public static String SL_ALL = "SL_ALL";
/**
* ;
*/
public static String ZZ_TL = "ZZ_TL";
/**
* -
*/