|
|
|
@ -12,21 +12,29 @@ import com.glxp.api.constant.Constant;
|
|
|
|
|
import com.glxp.api.controller.BaseController;
|
|
|
|
|
import com.glxp.api.entity.auth.AuthAdmin;
|
|
|
|
|
import com.glxp.api.entity.auth.InvWarehouseEntity;
|
|
|
|
|
import com.glxp.api.entity.basic.UdiProductEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.PurReceiveDetailEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.PurReceiveEntity;
|
|
|
|
|
import com.glxp.api.entity.purchase.PurApplyDetailEntity;
|
|
|
|
|
import com.glxp.api.entity.purchase.PurOrderDetailEntity;
|
|
|
|
|
import com.glxp.api.entity.purchase.PurPlanDetailEntity;
|
|
|
|
|
import com.glxp.api.req.inout.AddReceiveDetailRequest;
|
|
|
|
|
import com.glxp.api.req.inout.FilterReceiveDetailRequest;
|
|
|
|
|
import com.glxp.api.req.inout.FilterReceiveRequest;
|
|
|
|
|
import com.glxp.api.req.inout.UpdateReceiveDetailRequest;
|
|
|
|
|
import com.glxp.api.req.purchase.*;
|
|
|
|
|
import com.glxp.api.res.PageSimpleResponse;
|
|
|
|
|
import com.glxp.api.res.inout.ReceiveDetailResponse;
|
|
|
|
|
import com.glxp.api.res.inout.ReceiveResponse;
|
|
|
|
|
import com.glxp.api.service.auth.CustomerService;
|
|
|
|
|
import com.glxp.api.service.auth.InvWarehouseService;
|
|
|
|
|
import com.glxp.api.service.basic.UdiProductService;
|
|
|
|
|
import com.glxp.api.service.inout.ReceiveService;
|
|
|
|
|
import com.glxp.api.service.inout.ReceivedetailService;
|
|
|
|
|
import com.glxp.api.service.purchase.PurApplyDetailService;
|
|
|
|
|
import com.glxp.api.util.GennerOrderUtils;
|
|
|
|
|
import com.glxp.api.util.OrderNoTypeBean;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
@ -34,8 +42,10 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
|
public class PurOrderReceiveController extends BaseController {
|
|
|
|
@ -49,6 +59,10 @@ public class PurOrderReceiveController extends BaseController {
|
|
|
|
|
CustomerService customerService;
|
|
|
|
|
@Resource
|
|
|
|
|
GennerOrderUtils gennerOrderUtils;
|
|
|
|
|
@Resource
|
|
|
|
|
PurApplyDetailService purApplyDetailService;
|
|
|
|
|
@Resource
|
|
|
|
|
UdiProductService udiProductService;
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/udiwms/thrsys/order/insertWeb")
|
|
|
|
@ -215,4 +229,64 @@ public class PurOrderReceiveController extends BaseController {
|
|
|
|
|
return ResultVOUtils.success("成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加申购单到采购单里面
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/receive/order/addOrderDetailAndApply")
|
|
|
|
|
public BaseResponse addOrderDetailAndApply(@RequestBody purReceiveRequest purReceiveRequest) {
|
|
|
|
|
|
|
|
|
|
if (purReceiveRequest.getOrderId() == null || purReceiveRequest.getId() == null) {
|
|
|
|
|
return ResultVOUtils.error(999,"参数错误!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//查询领用单详情
|
|
|
|
|
List<PurReceiveDetailEntity> purPlanDetailEntityList=receivedetailService.selectByOrderId(purReceiveRequest.getOrderId());
|
|
|
|
|
//使用stream拷贝list
|
|
|
|
|
List<PurApplyDetailEntity> purOrderDetailEntityList = purPlanDetailEntityList.stream()
|
|
|
|
|
.map(e-> {
|
|
|
|
|
PurApplyDetailEntity d = new PurApplyDetailEntity();
|
|
|
|
|
d.setProductId(e.getRelIdFk().intValue());
|
|
|
|
|
UdiProductEntity udiProductEntity=udiProductService.findByNameCode(e.getNameCode());
|
|
|
|
|
d.setProductName(udiProductEntity.getCpmctymc());
|
|
|
|
|
d.setCount(e.getCount());
|
|
|
|
|
d.setSupId(e.getSupId());
|
|
|
|
|
d.setZczbhhzbapzbh(udiProductEntity.getZczbhhzbapzbh());
|
|
|
|
|
return d;
|
|
|
|
|
})
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
for (PurApplyDetailEntity obj:purOrderDetailEntityList){
|
|
|
|
|
obj.setOrderIdFk(purReceiveRequest.getId()+"");
|
|
|
|
|
}
|
|
|
|
|
//获取详情表信息
|
|
|
|
|
List<PurApplyDetailEntity> purOrderDetailEntities=purApplyDetailService.findByOrderId(purReceiveRequest.getId());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Long> ids=new ArrayList<>();
|
|
|
|
|
for (PurApplyDetailEntity obj:purOrderDetailEntities){
|
|
|
|
|
for (PurApplyDetailEntity obj1:purOrderDetailEntityList){
|
|
|
|
|
if(obj.getProductId().equals(obj1.getProductId())){
|
|
|
|
|
//获取存在在详情表和申购单里面一样的产品
|
|
|
|
|
ids.add(obj.getId().longValue());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//删除存在的产品
|
|
|
|
|
if(ids.size()>0){
|
|
|
|
|
purApplyDetailService.deleteByIds(ids);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
boolean falg= purApplyDetailService.insertPurApplyDetailEntity(purOrderDetailEntityList);
|
|
|
|
|
if(falg){
|
|
|
|
|
//查询申购单
|
|
|
|
|
return ResultVOUtils.success(purReceiveRequest.getId());
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
return ResultVOUtils.success("添加失败");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|