bug相关修改,业务单据修改

master
anthonywj 2 years ago
parent a89aba0977
commit b2779284f0

@ -203,6 +203,8 @@ public class Constant {
*/
public static final String ORDER_STATUS_CHECK_SUCCESS = "checkSuccess";
public static final String ORDER_STATUS_WAIT_AUDITED = "waitAudited";
/**
* -
*/

@ -276,4 +276,10 @@ public class ConstantStatus {
public static final int INVIN_USE = 3;
public static final String BUS_ORDER_HCLY = "HCLY";
public static final String BUS_ORDER_CPSG = "CPSG";
public static final String BUS_ORDER_CGJH = "CGJH";
public static final String BUS_ORDER_CGDD = "CGDD";
}

@ -26,7 +26,9 @@ import com.glxp.api.service.basic.EntrustReceService;
import com.glxp.api.service.basic.IBasicBussinessTypeService;
import com.glxp.api.service.inout.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.scheduling.annotation.Async;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
@ -63,11 +65,21 @@ public class IoOrderController extends BaseController {
* @param filterOrderRequest
* @return
*/
@AuthRuleAnnotation("")
@GetMapping("/udiwms/inout/order/filter")
public BaseResponse filterOrder(FilterOrderRequest filterOrderRequest) {
if (StrUtil.isNotBlank(filterOrderRequest.getStatusType())) {
orderService.setFilterStatus(filterOrderRequest);
}
if (StrUtil.isNotBlank(filterOrderRequest.getVueType())) {
orderService.setActions(filterOrderRequest);
}
String customerId = getCustomerId();
if (!customerId.equals("110")) {
filterOrderRequest.setFromCorp(customerId);
}
List<IoOrderResponse> list = orderService.filterList(filterOrderRequest);
PageInfo<IoOrderResponse> pageInfo = new PageInfo<>(list);
return ResultVOUtils.page(pageInfo);
@ -75,8 +87,8 @@ public class IoOrderController extends BaseController {
@GetMapping("/udiwms/inout/order/filterInvoice")
public BaseResponse filterInvoice(FilterOrderRequest filterOrderRequest) {
filterOrderRequest.setDealStatuses(Arrays.asList(2,3));
filterOrderRequest.setStatuses(Arrays.asList(7,5,8));
filterOrderRequest.setDealStatuses(Arrays.asList(2, 3));
filterOrderRequest.setStatuses(Arrays.asList(7, 5, 10));
String customerId = getCustomerId();
if (!customerId.equals("110")) {
filterOrderRequest.setFromCorp(customerId);
@ -87,9 +99,6 @@ public class IoOrderController extends BaseController {
}
//新增业务-立即提交
@AuthRuleAnnotation("")
@PostMapping("warehouse/inout/submitBiz")
@ -133,7 +142,7 @@ public class IoOrderController extends BaseController {
List<IoOrderDetailCodeEntity> orderDetailCodeEntities = orderDetailCodeService.findByOrderId(addOrderRequest.getBillNo());
if (CollUtil.isEmpty(orderDetailCodeEntities)) {
return ResultVOUtils.error(500, "单据未扫码或扫码异常,请检查后重新提交!");
return ResultVOUtils.error(500, "单据未扫码或扫码校验无法通过,提交失败,请检查后重新提交!");
}
IoOrderEntity orderEntity = orderService.findByBillNo(addOrderRequest.getBillNo());
ioAddInoutService.dealProcess(orderEntity);
@ -185,7 +194,7 @@ public class IoOrderController extends BaseController {
List<IoOrderDetailCodeEntity> orderDetailCodeEntities = orderDetailCodeService.findByOrderId(addOrderRequest.getBillNo());
if (CollUtil.isEmpty(orderDetailCodeEntities)) {
return ResultVOUtils.error(500, "单据还未扫码或UDI码存在异常无法提交!");
return ResultVOUtils.error(500, "单据还未扫码或和扫码校验存在异常无法提交!");
}
if (checkInoutService.checkManual(addOrderRequest.getBillNo())) {
@ -194,11 +203,11 @@ public class IoOrderController extends BaseController {
if (StrUtil.isNotEmpty(errMsg)) {
return ResultVOUtils.error(500, "单据未校验完成,请检查后重新提交!");
return ResultVOUtils.error(500, "单据校验提交失败,请检查后重新提交!");
}
errMsg = checkInoutService.codeOrderCheck(orderDetailCodeEntities, orderDetailBizEntities);
if (StrUtil.isNotEmpty(errMsg)) {
return ResultVOUtils.error(500, "单据未校验完成,请检查后重新提交!");
return ResultVOUtils.error(500, "单据校验提交失败,请检查后重新提交!");
}
saveOrderWeb(addOrderRequest);
IoOrderEntity orderEntity = orderService.findByBillNo(addOrderRequest.getBillNo());
@ -207,7 +216,7 @@ public class IoOrderController extends BaseController {
orderService.update(orderEntity);
checkInoutService.check(addOrderRequest.getBillNo());
} else {
return ResultVOUtils.error(500, "单据未校验完成,请先录入业务单据!");
return ResultVOUtils.error(500, "单据校验提交失败,请先录入业务单据!");
}
} else {
IoOrderEntity orderEntity = orderService.findByBillNo(addOrderRequest.getBillNo());

@ -104,7 +104,9 @@ public class IoOrderDetailBizController extends BaseController {
@PostMapping("/udiwms/inout/order/addBizProduct")
public BaseResponse addBizProduct(@RequestBody AddBizProductReqeust addBizProductReqeust) {
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("vail_product_cert");
boolean isVailCert = systemParamConfigEntity.getParamValue().equals("1") ? true : false;
boolean isVailCert = false;
if (systemParamConfigEntity != null)
isVailCert = systemParamConfigEntity.getParamValue().equals("1") ? true : false;
AuthAdmin authAdmin = getUser();
if (addBizProductReqeust.getRelId() == null && CollUtil.isEmpty(addBizProductReqeust.getDatas()))
return ResultVOUtils.error(500, "未选择产品信息");

@ -0,0 +1,455 @@
package com.glxp.api.controller.purchase;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.glxp.api.constant.Constant;
import com.glxp.api.constant.ConstantStatus;
import com.glxp.api.constant.ConstantType;
import com.glxp.api.entity.basic.BasicBusTypeChangeEntity;
import com.glxp.api.entity.basic.BasicProductsEntity;
import com.glxp.api.entity.basic.UdiProductEntity;
import com.glxp.api.entity.inout.IoOrderDetailBizEntity;
import com.glxp.api.entity.inout.IoOrderEntity;
import com.glxp.api.entity.inout.PurReceiveDetailEntity;
import com.glxp.api.entity.inout.PurReceiveEntity;
import com.glxp.api.entity.purchase.*;
import com.glxp.api.service.basic.IBasicBusTypeChangeService;
import com.glxp.api.service.basic.UdiProductService;
import com.glxp.api.service.inout.IoOrderDetailBizService;
import com.glxp.api.service.inout.IoOrderService;
import com.glxp.api.service.inout.ReceiveService;
import com.glxp.api.service.inout.ReceivedetailService;
import com.glxp.api.service.purchase.*;
import com.glxp.api.util.CustomUtil;
import com.glxp.api.util.DateUtil;
import com.glxp.api.util.GennerOrderUtils;
import com.glxp.api.util.OrderNoTypeBean;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
public class IoPurChangeService {
@Resource
IBasicBusTypeChangeService basicBusTypeChangeService;
@Resource
ReceiveService receiveService;
@Resource
ReceivedetailService receivedetailService;
@Resource
PurApplyService purApplyService;
@Resource
PurApplyDetailService purApplyDetailService;
@Resource
PurPlanService purPlanService;
@Resource
PurPlanDetailService purPlanDetailService;
@Resource
PurOrderService purOrderService;
@Resource
PurOrderDetailService purOrderDetailService;
@Resource
GennerOrderUtils gennerOrderUtils;
@Resource
UdiProductService udiProductService;
@Resource
IoOrderService ioOrderService;
@Resource
IoOrderDetailBizService ioOrderDetailBizService;
//领用单流转
public void purReceiveChange(PurReceiveEntity purReceiveEntity) {
purReceiveEntity = receiveService.selectById(purReceiveEntity.getId());
List<PurReceiveDetailEntity> purReceiveDetailEntityList = receivedetailService.selectByOrderId(purReceiveEntity.getBillNo());
BasicBusTypeChangeEntity basicBusTypeChangeEntity = basicBusTypeChangeService.selectByOriginAction(ConstantStatus.BUS_ORDER_HCLY);
PurApplyEntity purApplyEntity = new PurApplyEntity();
if (basicBusTypeChangeEntity != null && StrUtil.isNotEmpty(basicBusTypeChangeEntity.getTargetBusAction()) && basicBusTypeChangeEntity.isEnable() == true) {
purApplyEntity.setBillNo(gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.SG_ORDER, "yyyyMMdd")));
purApplyEntity.setBillDate(purReceiveEntity.getBillDate());
purApplyEntity.setStatus(basicBusTypeChangeEntity.getBusAuditStatus());
purApplyEntity.setRemark(purReceiveEntity.getRemark());
purApplyEntity.setInvCode(purReceiveEntity.getTargetInvCode());
purApplyEntity.setDeptCode(purReceiveEntity.getTargetDeptCode());
purApplyEntity.setTargetInvCode(purReceiveEntity.getInvCode());
purApplyEntity.setTargetDeptCode(purReceiveEntity.getDeptCode());
purApplyEntity.setCreateUser(purReceiveEntity.getAuditUser());
purApplyEntity.setCreateTime(DateUtil.timeProcess(purReceiveEntity.getCreateTime(), basicBusTypeChangeEntity.getBusBeforeTime()));
purApplyEntity.setUpdateUser(purReceiveEntity.getAuditUser());
purApplyEntity.setUpdateTime(DateUtil.timeProcess(purReceiveEntity.getCreateTime(), basicBusTypeChangeEntity.getBusBeforeTime()));
if (purApplyEntity.getStatus() == 3) {
purApplyEntity.setAuditUser("");
purApplyEntity.setAuditTime(new Date());
}
//插入申购主表
purApplyService.insert(purApplyEntity);
//用stream流复制list
List<PurApplyDetailEntity> purApplyDetailEntityList = purReceiveDetailEntityList.stream().map(e -> {
PurApplyDetailEntity d = new PurApplyDetailEntity();
d.setOrderIdFk(purApplyEntity.getId() + "");
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());
purApplyDetailService.insertPurApplyDetailEntity(purApplyDetailEntityList);
}
}
//申购单流转
public void purApplyChange(PurApplyEntity purApplyEntity) {
BasicBusTypeChangeEntity basicBusTypeChangeEntity = new BasicBusTypeChangeEntity();
//查询申购详情
List<PurApplyDetailEntity> purApplyDetailEntityList = purApplyDetailService.findByOrderId(purApplyEntity.getId() + "");
//---------------------------------判断申购为已审核就生成计划单-------------------------------------------//
PurPlanEntity purPlanEntity = new PurPlanEntity();
List<PurPlanDetailEntity> purPlanDetailEntityList = new ArrayList<>();
if (purApplyEntity.getStatus() == 3) {
basicBusTypeChangeEntity = basicBusTypeChangeService.selectByOriginAction("CPSG");
if (basicBusTypeChangeEntity != null && StrUtil.isNotEmpty(basicBusTypeChangeEntity.getTargetBusAction()) && basicBusTypeChangeEntity.isEnable() == true) {
purPlanEntity.setBillNo(gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.JH_ORDER, "yyyyMMdd")));
purPlanEntity.setBillDate(purApplyEntity.getBillDate());
purPlanEntity.setStatus(basicBusTypeChangeEntity.getBusAuditStatus());
purPlanEntity.setRemark(purApplyEntity.getRemark());
purPlanEntity.setEmergency(purApplyEntity.getEmergency());
purPlanEntity.setArrivalTime(purApplyEntity.getArrivalTime());
purPlanEntity.setInvCode(purApplyEntity.getInvCode());
purPlanEntity.setDeptCode(purApplyEntity.getDeptCode());
purPlanEntity.setCreateUser(purApplyEntity.getAuditUser());
purPlanEntity.setCreateTime(DateUtil.timeProcess(purApplyEntity.getCreateTime(), basicBusTypeChangeEntity.getBusBeforeTime()));
purPlanEntity.setUpdateUser(purApplyEntity.getAuditUser());
purPlanEntity.setUpdateTime(DateUtil.timeProcess(purApplyEntity.getCreateTime(), basicBusTypeChangeEntity.getBusBeforeTime()));
if (purPlanEntity.getStatus() == 3) {
purPlanEntity.setAuditUser("");
purPlanEntity.setAuditTime(new Date());
}
//插入计划主表
purPlanService.insert(purPlanEntity);
//用stream流复制list
purPlanDetailEntityList = purApplyDetailEntityList.stream().map(e -> {
PurPlanDetailEntity d = new PurPlanDetailEntity();
d.setOrderIdFk(purPlanEntity.getId() + "");
d.setProductId(e.getProductId());
d.setProductName(e.getProductName());
d.setCount(e.getCount());
d.setSupId(e.getSupId());
d.setZczbhhzbapzbh(e.getZczbhhzbapzbh());
return d;
}).collect(Collectors.toList());
purPlanDetailService.insertPurPlanDetailEntity(purPlanDetailEntityList);
//更新申购表信息插入计划单号
PurApplyEntity purApplyEntity1 = new PurApplyEntity();
purApplyEntity1.setId(purApplyEntity.getId());
purApplyEntity1.setPlanBillNo(purPlanEntity.getBillNo());
purApplyEntity1.setGeneratePlan(true);
purApplyService.update(purApplyEntity1);
}
}
}
//采购计划流转
public void purPlanChange(PurPlanEntity purPlanEntity) {
BasicBusTypeChangeEntity basicBusTypeChangeEntity = new BasicBusTypeChangeEntity();
//查询计划详情
List<PurPlanDetailEntity> purPlanDetailEntityList = purPlanDetailService.findByOrderId(purPlanEntity.getId() + "");
//---------------------------------判断计划为已审核就生成计划单-------------------------------------------//\
PurOrderEntity purOrderEntity = new PurOrderEntity();
if (purPlanEntity.getStatus() == 3) {
basicBusTypeChangeEntity = basicBusTypeChangeService.selectByOriginAction("CGJH");
if (basicBusTypeChangeEntity != null && StrUtil.isNotEmpty(basicBusTypeChangeEntity.getTargetBusAction()) && basicBusTypeChangeEntity.isEnable() == true) {
purOrderEntity.setBillNo(gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.CG_ORDER, "yyyyMMdd")));
purOrderEntity.setBillDate(purPlanEntity.getBillDate());
purOrderEntity.setStatus(basicBusTypeChangeEntity.getBusAuditStatus());
purOrderEntity.setRemark(purPlanEntity.getRemark());
purOrderEntity.setEmergency(purPlanEntity.getEmergency());
purOrderEntity.setArrivalTime(purPlanEntity.getArrivalTime());
purOrderEntity.setInvCode(purPlanEntity.getInvCode());
purOrderEntity.setDeptCode(purPlanEntity.getDeptCode());
purOrderEntity.setCreateUser(purPlanEntity.getAuditUser());
purOrderEntity.setCreateTime(DateUtil.timeProcess(purPlanEntity.getCreateTime(), basicBusTypeChangeEntity.getBusBeforeTime()));
purOrderEntity.setUpdateUser(purPlanEntity.getAuditUser());
purOrderEntity.setUpdateTime(DateUtil.timeProcess(purPlanEntity.getCreateTime(), basicBusTypeChangeEntity.getBusBeforeTime()));
if (purOrderEntity.getStatus() == 3) {
purOrderEntity.setAuditUser("");
purOrderEntity.setAuditTime(new Date());
}
//插入订单主表
purOrderService.insert(purOrderEntity);
//用stream流复制list
List<PurOrderDetailEntity> purOrderDetailEntityList = purPlanDetailEntityList.stream().map(e -> {
PurOrderDetailEntity d = new PurOrderDetailEntity();
d.setOrderIdFk(purOrderEntity.getId() + "");
d.setProductId(e.getProductId());
d.setProductName(e.getProductName());
d.setCount(e.getCount());
d.setSupId(e.getSupId());
d.setZczbhhzbapzbh(e.getZczbhhzbapzbh());
return d;
}).collect(Collectors.toList());
purOrderDetailService.insertPurOrderDetailEntity(purOrderDetailEntityList);
// 更新计划表信息插入订单单号
PurPlanEntity purPlanEntity1 = new PurPlanEntity();
purPlanEntity1.setId(purPlanEntity.getId());
purPlanEntity1.setStockOrderNo(purOrderEntity.getBillNo());
// purPlanEntity.sets(true);
purPlanService.update(purPlanEntity1);
}
}
}
//采购订单流转
public void purOrderChange(PurOrderEntity purOrderEntity) {
//最后一层,无法流转业务单
}
//领用单生成扫码单据
public void purReceiveGen(PurReceiveEntity purReceiveEntity) {
BasicBusTypeChangeEntity basicBusTypeChangeEntity = basicBusTypeChangeService.selectByOriginAction(ConstantStatus.BUS_ORDER_HCLY);
purReceiveEntity = receiveService.selectById(purReceiveEntity.getId());
List<PurReceiveDetailEntity> purReceiveDetailEntityList = receivedetailService.selectByOrderId(purReceiveEntity.getBillNo());
Map<String, List<PurReceiveDetailEntity>> map = purReceiveDetailEntityList.stream().collect(Collectors.groupingBy(PurReceiveDetailEntity::getSupId));
String billNo = "";
if (basicBusTypeChangeEntity != null && StrUtil.isNotEmpty(basicBusTypeChangeEntity.getTargetAction()) && basicBusTypeChangeEntity.isEnable() == true) {
for (Map.Entry<String, List<PurReceiveDetailEntity>> m : map.entrySet()) {
//生产单据表信息
IoOrderEntity ioOrderEntity = new IoOrderEntity();
ioOrderEntity.setBillNo(gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER, "yyyyMMdd")));
ioOrderEntity.setCorpOrderId(CustomUtil.getDate());
ioOrderEntity.setMainAction(ConstantType.TYPE_PUT);
ioOrderEntity.setAction(basicBusTypeChangeEntity.getTargetAction());
ioOrderEntity.setFromCorp(m.getKey());
ioOrderEntity.setFromType(ConstantStatus.FROM_PLAN);
ioOrderEntity.setStatus(1);
ioOrderEntity.setDealStatus(1);
ioOrderEntity.setOrderType(1);
ioOrderEntity.setCreateTime(new Date());
ioOrderEntity.setCreateUser(purReceiveEntity.getCreateUser());
ioOrderEntity.setUpdateTime(new Date());
ioOrderEntity.setUpdateUser(purReceiveEntity.getCreateUser());
ioOrderEntity.setCustomerId("110");
ioOrderEntity.setDeptCode(purReceiveEntity.getInvCode());
ioOrderEntity.setInvCode(purReceiveEntity.getDeptCode());
ioOrderService.insertOrder(ioOrderEntity);
billNo += ioOrderEntity.getBillNo() + ",";
//插入业务单表
for (PurReceiveDetailEntity obj : m.getValue()) {
BasicProductsEntity basicProductsEntity = purPlanDetailService.selectIoOrderDetailBiz(obj.getId());
IoOrderDetailBizEntity ioOrderDetailBizEntity = new IoOrderDetailBizEntity();
ioOrderDetailBizEntity.setOrderIdFk(ioOrderEntity.getBillNo());
ioOrderDetailBizEntity.setBindRlFk(obj.getRelIdFk());
ioOrderDetailBizEntity.setCount(obj.getCount());
ioOrderDetailBizEntity.setUuidFk(basicProductsEntity.getUuid());
ioOrderDetailBizEntity.setNameCode(basicProductsEntity.getNameCode());
ioOrderDetailBizEntity.setCoName(basicProductsEntity.getCpmctymc());
ioOrderDetailBizEntity.setCertCode(basicProductsEntity.getZczbhhzbapzbh());
ioOrderDetailBizEntity.setYlqxzcrbarmc(basicProductsEntity.getYlqxzcrbarmc());
ioOrderDetailBizEntity.setManufacturer(basicProductsEntity.getManufactory());
ioOrderDetailBizEntity.setMeasname(basicProductsEntity.getMeasname());
ioOrderDetailBizEntity.setSpec(basicProductsEntity.getGgxh());
if (basicProductsEntity.getPrice() != null) {
ioOrderDetailBizEntity.setPrice(BigDecimal.valueOf(basicProductsEntity.getPrice()));
}
ioOrderDetailBizEntity.setSupId(obj.getSupId());
ioOrderDetailBizService.insert(ioOrderDetailBizEntity);
}
}
// purReceiveEntity.se(billNo.substring(0, billNo.length() - 1));
// receiveService.update(purPlanEntity1);
}
}
//申购单生成扫码单据
public void purApplyGen(PurApplyEntity purApplyEntity) {
BasicBusTypeChangeEntity basicBusTypeChangeEntity = basicBusTypeChangeService.selectByOriginAction(ConstantStatus.BUS_ORDER_HCLY);
List<PurApplyDetailEntity> purApplyDetailEntityList = purApplyDetailService.findByOrderId(purApplyEntity.getId() + "");
Map<String, List<PurApplyDetailEntity>> map = purApplyDetailEntityList.stream().collect(Collectors.groupingBy(PurApplyDetailEntity::getSupId));
String billNo = "";
if (basicBusTypeChangeEntity != null && StrUtil.isNotEmpty(basicBusTypeChangeEntity.getTargetAction()) && basicBusTypeChangeEntity.isEnable() == true) {
for (Map.Entry<String, List<PurApplyDetailEntity>> m : map.entrySet()) {
//生产单据表信息
IoOrderEntity ioOrderEntity = new IoOrderEntity();
ioOrderEntity.setBillNo(gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER, "yyyyMMdd")));
ioOrderEntity.setCorpOrderId(CustomUtil.getDate());
ioOrderEntity.setMainAction(ConstantType.TYPE_PUT);
ioOrderEntity.setAction(basicBusTypeChangeEntity.getTargetAction());
ioOrderEntity.setFromCorp(m.getKey());
ioOrderEntity.setFromType(ConstantStatus.FROM_PLAN);
ioOrderEntity.setStatus(1);
ioOrderEntity.setDealStatus(1);
ioOrderEntity.setOrderType(1);
ioOrderEntity.setCreateTime(new Date());
ioOrderEntity.setCreateUser(purApplyEntity.getCreateUser());
ioOrderEntity.setUpdateTime(new Date());
ioOrderEntity.setUpdateUser(purApplyEntity.getCreateUser());
ioOrderEntity.setCustomerId("110");
ioOrderEntity.setDeptCode(purApplyEntity.getInvCode());
ioOrderEntity.setInvCode(purApplyEntity.getDeptCode());
ioOrderService.insertOrder(ioOrderEntity);
billNo += ioOrderEntity.getBillNo() + ",";
//插入业务单表
for (PurApplyDetailEntity obj : m.getValue()) {
BasicProductsEntity basicProductsEntity = purPlanDetailService.selectIoOrderDetailBiz(obj.getId());
IoOrderDetailBizEntity ioOrderDetailBizEntity = new IoOrderDetailBizEntity();
ioOrderDetailBizEntity.setOrderIdFk(ioOrderEntity.getBillNo());
ioOrderDetailBizEntity.setBindRlFk(Long.valueOf(obj.getProductId()));
ioOrderDetailBizEntity.setCount(obj.getCount());
ioOrderDetailBizEntity.setUuidFk(basicProductsEntity.getUuid());
ioOrderDetailBizEntity.setNameCode(basicProductsEntity.getNameCode());
ioOrderDetailBizEntity.setCoName(basicProductsEntity.getCpmctymc());
ioOrderDetailBizEntity.setCertCode(basicProductsEntity.getZczbhhzbapzbh());
ioOrderDetailBizEntity.setYlqxzcrbarmc(basicProductsEntity.getYlqxzcrbarmc());
ioOrderDetailBizEntity.setManufacturer(basicProductsEntity.getManufactory());
ioOrderDetailBizEntity.setMeasname(basicProductsEntity.getMeasname());
ioOrderDetailBizEntity.setSpec(basicProductsEntity.getGgxh());
if (basicProductsEntity.getPrice() != null) {
ioOrderDetailBizEntity.setPrice(BigDecimal.valueOf(basicProductsEntity.getPrice()));
}
ioOrderDetailBizEntity.setSupId(obj.getSupId());
ioOrderDetailBizService.insert(ioOrderDetailBizEntity);
}
}
// PurPlanEntity purPlanEntity1 = new PurPlanEntity();
// purPlanEntity1.setId(purPlanEntity.getId());
// purPlanEntity1.setStockOrderNo(billNo.substring(0, billNo.length() - 1));
// purPlanService.update(purPlanEntity1);
}
}
//采购计划生成扫码单据
public void purPlanGen(PurPlanEntity purPlanEntity) {
BasicBusTypeChangeEntity basicBusTypeChangeEntity = new BasicBusTypeChangeEntity();
List<PurPlanDetailEntity> purPlanDetailEntities = purPlanDetailService.findByOrderId(purPlanEntity.getId() + "");
//对计划单里面的供应商进行分组
Map<String, List<PurPlanDetailEntity>> map = purPlanDetailEntities.stream().collect(Collectors.groupingBy(PurPlanDetailEntity::getSupId));
String billNo = "";
if (basicBusTypeChangeEntity != null && StrUtil.isNotEmpty(basicBusTypeChangeEntity.getTargetAction()) && basicBusTypeChangeEntity.isEnable() == true) {
for (Map.Entry<String, List<PurPlanDetailEntity>> m : map.entrySet()) {
//生产单据表信息
IoOrderEntity ioOrderEntity = new IoOrderEntity();
ioOrderEntity.setBillNo(gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER, "yyyyMMdd")));
ioOrderEntity.setCorpOrderId(CustomUtil.getDate());
ioOrderEntity.setMainAction(ConstantType.TYPE_PUT);
ioOrderEntity.setAction(basicBusTypeChangeEntity.getTargetAction());
ioOrderEntity.setFromCorp(m.getKey());
ioOrderEntity.setFromType(ConstantStatus.FROM_PLAN);
ioOrderEntity.setStatus(1);
ioOrderEntity.setDealStatus(1);
ioOrderEntity.setOrderType(1);
ioOrderEntity.setCreateTime(new Date());
ioOrderEntity.setCreateUser(purPlanEntity.getCreateUser());
ioOrderEntity.setUpdateTime(new Date());
ioOrderEntity.setUpdateUser(purPlanEntity.getCreateUser());
ioOrderEntity.setCustomerId("110");
ioOrderEntity.setDeptCode(purPlanEntity.getInvCode());
ioOrderEntity.setInvCode(purPlanEntity.getDeptCode());
ioOrderService.insertOrder(ioOrderEntity);
billNo += ioOrderEntity.getBillNo() + ",";
//插入业务单表
for (PurPlanDetailEntity obj : m.getValue()) {
BasicProductsEntity basicProductsEntity = purPlanDetailService.selectIoOrderDetailBiz(obj.getId());
IoOrderDetailBizEntity ioOrderDetailBizEntity = new IoOrderDetailBizEntity();
ioOrderDetailBizEntity.setOrderIdFk(ioOrderEntity.getBillNo());
ioOrderDetailBizEntity.setBindRlFk(Long.valueOf(obj.getProductId()));
ioOrderDetailBizEntity.setCount(obj.getCount());
ioOrderDetailBizEntity.setUuidFk(basicProductsEntity.getUuid());
ioOrderDetailBizEntity.setNameCode(basicProductsEntity.getNameCode());
ioOrderDetailBizEntity.setCoName(basicProductsEntity.getCpmctymc());
ioOrderDetailBizEntity.setCertCode(basicProductsEntity.getZczbhhzbapzbh());
ioOrderDetailBizEntity.setYlqxzcrbarmc(basicProductsEntity.getYlqxzcrbarmc());
ioOrderDetailBizEntity.setManufacturer(basicProductsEntity.getManufactory());
ioOrderDetailBizEntity.setMeasname(basicProductsEntity.getMeasname());
ioOrderDetailBizEntity.setSpec(basicProductsEntity.getGgxh());
if (basicProductsEntity.getPrice() != null) {
ioOrderDetailBizEntity.setPrice(BigDecimal.valueOf(basicProductsEntity.getPrice()));
}
ioOrderDetailBizEntity.setSupId(obj.getSupId());
ioOrderDetailBizService.insert(ioOrderDetailBizEntity);
}
}
purPlanEntity.setId(purPlanEntity.getId());
purPlanEntity.setStockOrderNo(billNo.substring(0, billNo.length() - 1));
purPlanService.update(purPlanEntity);
}
}
//采购订单生成扫码单据
public void purOrderGen(PurOrderEntity purOrderEntity) {
List<PurOrderDetailEntity> purOrderDetailEntities = purOrderDetailService.findByOrderId(purOrderEntity.getId() + "");
//对计划单里面的供应商进行分组
Map<String, List<PurOrderDetailEntity>> map = purOrderDetailEntities.stream().collect(Collectors.groupingBy(PurOrderDetailEntity::getSupId));
BasicBusTypeChangeEntity basicBusTypeChangeEntity = basicBusTypeChangeService.selectByOriginAction(ConstantStatus.BUS_ORDER_CGDD);
String billNo = "";
if (purOrderEntity.getStatus() == ConstantStatus.APPLY_AUDIT_ED) {
for (Map.Entry<String, List<PurOrderDetailEntity>> m : map.entrySet()) {
//生产单据表信息
IoOrderEntity ioOrderEntity = new IoOrderEntity();
ioOrderEntity.setBillNo(gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER, "yyyyMMdd")));
ioOrderEntity.setCorpOrderId(CustomUtil.getDate());
ioOrderEntity.setMainAction(ConstantType.TYPE_PUT);
ioOrderEntity.setAction(basicBusTypeChangeEntity.getTargetAction());
ioOrderEntity.setFromCorp(m.getKey());
ioOrderEntity.setFromType(ConstantStatus.FROM_Order);
ioOrderEntity.setStatus(1);
ioOrderEntity.setDealStatus(1);
ioOrderEntity.setOrderType(1);
ioOrderEntity.setCreateTime(new Date());
// ioOrderEntity.setCreateUser(postPurOrderRequest.getPurOrderEntity().getAuditUser());
ioOrderEntity.setUpdateTime(new Date());
// ioOrderEntity.setUpdateUser(postPurOrderRequest.getPurOrderEntity().getAuditUser());
ioOrderEntity.setCustomerId("110");
ioOrderEntity.setDeptCode(purOrderEntity.getDeptCode());
ioOrderEntity.setInvCode(purOrderEntity.getInvCode());
ioOrderService.insertOrder(ioOrderEntity);
billNo += ioOrderEntity.getBillNo() + ",";
//插入业务单表
for (PurOrderDetailEntity obj : m.getValue()) {
BasicProductsEntity basicProductsEntity = purOrderDetailService.selectIoOrderDetailBiz(obj.getId());
IoOrderDetailBizEntity ioOrderDetailBizEntity = new IoOrderDetailBizEntity();
ioOrderDetailBizEntity.setOrderIdFk(ioOrderEntity.getBillNo());
ioOrderDetailBizEntity.setBindRlFk(Long.valueOf(obj.getProductId()));
ioOrderDetailBizEntity.setCount(obj.getCount());
ioOrderDetailBizEntity.setUuidFk(basicProductsEntity.getUuid());
ioOrderDetailBizEntity.setNameCode(basicProductsEntity.getNameCode());
ioOrderDetailBizEntity.setCoName(basicProductsEntity.getCpmctymc());
ioOrderDetailBizEntity.setCertCode(basicProductsEntity.getZczbhhzbapzbh());
ioOrderDetailBizEntity.setYlqxzcrbarmc(basicProductsEntity.getYlqxzcrbarmc());
ioOrderDetailBizEntity.setManufacturer(basicProductsEntity.getManufactory());
ioOrderDetailBizEntity.setMeasname(basicProductsEntity.getMeasname());
ioOrderDetailBizEntity.setSpec(basicProductsEntity.getGgxh());
if (basicProductsEntity.getPrice() != null) {
ioOrderDetailBizEntity.setPrice(BigDecimal.valueOf(basicProductsEntity.getPrice()));
}
ioOrderDetailBizEntity.setSupId(obj.getSupId());
ioOrderDetailBizService.insert(ioOrderDetailBizEntity);
}
}
purOrderEntity.setStockOrderNo(billNo.substring(0, billNo.length() - 1));
purOrderService.update(purOrderEntity);
}
}
}

@ -251,24 +251,24 @@ public class PurOrderReceiveController extends BaseController {
purReceiveEntity.setUpdateTime(new Date());
receiveService.updateOrder(purReceiveEntity);
if(purReceiveEntity.getStatus()==3){
generateDocument(purReceiveEntity);
}
if (purReceiveEntity.getStatus() == 3) {
generateDocument(purReceiveEntity);
}
return ResultVOUtils.success("成功");
}
//根据单据生成新单据
public Boolean generateDocument(PurReceiveEntity purReceiveEntity){
public Boolean generateDocument(PurReceiveEntity purReceiveEntity) {
//查询耗材表
purReceiveEntity=receiveService.selectById(purReceiveEntity.getId());
purReceiveEntity = receiveService.selectById(purReceiveEntity.getId());
//查询耗材详情
List<PurReceiveDetailEntity> purReceiveDetailEntityList=receivedetailService.selectByOrderId(purReceiveEntity.getBillNo());
PurApplyEntity purApplyEntity=new PurApplyEntity();
List<PurReceiveDetailEntity> purReceiveDetailEntityList = receivedetailService.selectByOrderId(purReceiveEntity.getBillNo());
PurApplyEntity purApplyEntity = new PurApplyEntity();
//查询耗材要生成的业务单
BasicBusTypeChangeEntity basicBusTypeChangeEntity=new BasicBusTypeChangeEntity();
basicBusTypeChangeEntity=basicBusTypeChangeService.selectByOriginAction("HCLY");
if(basicBusTypeChangeEntity!=null && StrUtil.isNotEmpty(basicBusTypeChangeEntity.getTargetBusAction()) && basicBusTypeChangeEntity.isEnable()==true){
BasicBusTypeChangeEntity basicBusTypeChangeEntity = new BasicBusTypeChangeEntity();
basicBusTypeChangeEntity = basicBusTypeChangeService.selectByOriginAction("HCLY");
if (basicBusTypeChangeEntity != null && StrUtil.isNotEmpty(basicBusTypeChangeEntity.getTargetBusAction()) && basicBusTypeChangeEntity.isEnable() == true) {
purApplyEntity.setBillNo(gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.SG_ORDER, "yyyyMMdd")));
purApplyEntity.setBillDate(purReceiveEntity.getBillDate());
purApplyEntity.setStatus(basicBusTypeChangeEntity.getBusAuditStatus());
@ -278,36 +278,36 @@ public class PurOrderReceiveController extends BaseController {
purApplyEntity.setTargetInvCode(purReceiveEntity.getInvCode());
purApplyEntity.setTargetDeptCode(purReceiveEntity.getDeptCode());
purApplyEntity.setCreateUser(purReceiveEntity.getAuditUser());
purApplyEntity.setCreateTime(timeProcess(purReceiveEntity.getCreateTime(),basicBusTypeChangeEntity.getBusBeforeTime()));
purApplyEntity.setCreateTime(timeProcess(purReceiveEntity.getCreateTime(), basicBusTypeChangeEntity.getBusBeforeTime()));
purApplyEntity.setUpdateUser(purReceiveEntity.getAuditUser());
purApplyEntity.setUpdateTime(timeProcess(purReceiveEntity.getCreateTime(),basicBusTypeChangeEntity.getBusBeforeTime()));
if(purApplyEntity.getStatus()==3){
purApplyEntity.setUpdateTime(timeProcess(purReceiveEntity.getCreateTime(), basicBusTypeChangeEntity.getBusBeforeTime()));
if (purApplyEntity.getStatus() == 3) {
purApplyEntity.setAuditUser("");
purApplyEntity.setAuditTime(new Date());
}
//插入申购主表
purApplyService.insert(purApplyEntity);
purApplyService.insert(purApplyEntity);
//用stream流复制list
List<PurApplyDetailEntity> purApplyDetailEntityList = purReceiveDetailEntityList.stream().map(e -> {
PurApplyDetailEntity d = new PurApplyDetailEntity();
d.setOrderIdFk(purApplyEntity.getId()+"");
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;
})
PurApplyDetailEntity d = new PurApplyDetailEntity();
d.setOrderIdFk(purApplyEntity.getId() + "");
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());
purApplyDetailService.insertPurApplyDetailEntity(purApplyDetailEntityList);
//---------------------------------判断申购为已审核就生成计划单-------------------------------------------//
PurPlanEntity purPlanEntity=new PurPlanEntity();
List<PurPlanDetailEntity> purPlanDetailEntityList=new ArrayList<>();
if(purApplyEntity.getStatus()==3){
basicBusTypeChangeEntity=basicBusTypeChangeService.selectByOriginAction("CPSG");
if(basicBusTypeChangeEntity!=null && StrUtil.isNotEmpty(basicBusTypeChangeEntity.getTargetBusAction()) && basicBusTypeChangeEntity.isEnable()==true){
PurPlanEntity purPlanEntity = new PurPlanEntity();
List<PurPlanDetailEntity> purPlanDetailEntityList = new ArrayList<>();
if (purApplyEntity.getStatus() == 3) {
basicBusTypeChangeEntity = basicBusTypeChangeService.selectByOriginAction("CPSG");
if (basicBusTypeChangeEntity != null && StrUtil.isNotEmpty(basicBusTypeChangeEntity.getTargetBusAction()) && basicBusTypeChangeEntity.isEnable() == true) {
purPlanEntity.setBillNo(gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.JH_ORDER, "yyyyMMdd")));
purPlanEntity.setBillDate(purReceiveEntity.getBillDate());
purPlanEntity.setStatus(basicBusTypeChangeEntity.getBusAuditStatus());
@ -315,10 +315,10 @@ public class PurOrderReceiveController extends BaseController {
purPlanEntity.setInvCode(purReceiveEntity.getInvCode());
purPlanEntity.setDeptCode(purReceiveEntity.getDeptCode());
purPlanEntity.setCreateUser(purReceiveEntity.getAuditUser());
purPlanEntity.setCreateTime(timeProcess(purReceiveEntity.getCreateTime(),basicBusTypeChangeEntity.getBusBeforeTime()));
purPlanEntity.setCreateTime(timeProcess(purReceiveEntity.getCreateTime(), basicBusTypeChangeEntity.getBusBeforeTime()));
purPlanEntity.setUpdateUser(purReceiveEntity.getAuditUser());
purPlanEntity.setUpdateTime(timeProcess(purReceiveEntity.getCreateTime(),basicBusTypeChangeEntity.getBusBeforeTime()));
if(purPlanEntity.getStatus()==3){
purPlanEntity.setUpdateTime(timeProcess(purReceiveEntity.getCreateTime(), basicBusTypeChangeEntity.getBusBeforeTime()));
if (purPlanEntity.getStatus() == 3) {
purPlanEntity.setAuditUser("");
purPlanEntity.setAuditTime(new Date());
}
@ -327,9 +327,9 @@ public class PurOrderReceiveController extends BaseController {
//用stream流复制list
purPlanDetailEntityList = purReceiveDetailEntityList.stream().map(e -> {
PurPlanDetailEntity d = new PurPlanDetailEntity();
d.setOrderIdFk(purPlanEntity.getId()+"");
d.setOrderIdFk(purPlanEntity.getId() + "");
d.setProductId(e.getRelIdFk().intValue());
UdiProductEntity udiProductEntity=udiProductService.findByNameCode(e.getNameCode());
UdiProductEntity udiProductEntity = udiProductService.findByNameCode(e.getNameCode());
d.setProductName(udiProductEntity.getCpmctymc());
d.setCount(e.getCount());
d.setSupId(e.getSupId());
@ -338,16 +338,16 @@ public class PurOrderReceiveController extends BaseController {
}).collect(Collectors.toList());
purPlanDetailService.insertPurPlanDetailEntity(purPlanDetailEntityList);
//更新申购表信息插入计划单号
PurApplyEntity purApplyEntity1=new PurApplyEntity();
PurApplyEntity purApplyEntity1 = new PurApplyEntity();
purApplyEntity1.setId(purApplyEntity.getId());
purApplyEntity1.setPlanBillNo(purPlanEntity.getBillNo());
purApplyEntity1.setGeneratePlan(true);
purApplyService.update(purApplyEntity1);
//---------------------------------判断计划为已审核就生成计划单-------------------------------------------//\
PurOrderEntity purOrderEntity=new PurOrderEntity();
if(purPlanEntity.getStatus()==3){
basicBusTypeChangeEntity=basicBusTypeChangeService.selectByOriginAction("CGJH");
if(basicBusTypeChangeEntity!=null && StrUtil.isNotEmpty(basicBusTypeChangeEntity.getTargetBusAction()) && basicBusTypeChangeEntity.isEnable()==true){
PurOrderEntity purOrderEntity = new PurOrderEntity();
if (purPlanEntity.getStatus() == 3) {
basicBusTypeChangeEntity = basicBusTypeChangeService.selectByOriginAction("CGJH");
if (basicBusTypeChangeEntity != null && StrUtil.isNotEmpty(basicBusTypeChangeEntity.getTargetBusAction()) && basicBusTypeChangeEntity.isEnable() == true) {
purOrderEntity.setBillNo(gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.CG_ORDER, "yyyyMMdd")));
purOrderEntity.setBillDate(purReceiveEntity.getBillDate());
purOrderEntity.setStatus(basicBusTypeChangeEntity.getBusAuditStatus());
@ -355,10 +355,10 @@ public class PurOrderReceiveController extends BaseController {
purOrderEntity.setInvCode(purReceiveEntity.getInvCode());
purOrderEntity.setDeptCode(purReceiveEntity.getDeptCode());
purOrderEntity.setCreateUser(purReceiveEntity.getAuditUser());
purOrderEntity.setCreateTime(timeProcess(purReceiveEntity.getCreateTime(),basicBusTypeChangeEntity.getBusBeforeTime()));
purOrderEntity.setCreateTime(timeProcess(purReceiveEntity.getCreateTime(), basicBusTypeChangeEntity.getBusBeforeTime()));
purOrderEntity.setUpdateUser(purReceiveEntity.getAuditUser());
purOrderEntity.setUpdateTime(timeProcess(purReceiveEntity.getCreateTime(),basicBusTypeChangeEntity.getBusBeforeTime()));
if(purOrderEntity.getStatus()==3){
purOrderEntity.setUpdateTime(timeProcess(purReceiveEntity.getCreateTime(), basicBusTypeChangeEntity.getBusBeforeTime()));
if (purOrderEntity.getStatus() == 3) {
purOrderEntity.setAuditUser("");
purOrderEntity.setAuditTime(new Date());
}
@ -367,9 +367,9 @@ public class PurOrderReceiveController extends BaseController {
//用stream流复制list
List<PurOrderDetailEntity> purOrderDetailEntityList = purReceiveDetailEntityList.stream().map(e -> {
PurOrderDetailEntity d = new PurOrderDetailEntity();
d.setOrderIdFk(purOrderEntity.getId()+"");
d.setOrderIdFk(purOrderEntity.getId() + "");
d.setProductId(e.getRelIdFk().intValue());
UdiProductEntity udiProductEntity=udiProductService.findByNameCode(e.getNameCode());
UdiProductEntity udiProductEntity = udiProductService.findByNameCode(e.getNameCode());
d.setProductName(udiProductEntity.getCpmctymc());
d.setCount(e.getCount());
d.setSupId(e.getSupId());
@ -377,8 +377,8 @@ public class PurOrderReceiveController extends BaseController {
return d;
}).collect(Collectors.toList());
purOrderDetailService.insertPurOrderDetailEntity(purOrderDetailEntityList);
// 更新计划表信息插入订单单号
PurPlanEntity purPlanEntity1=new PurPlanEntity();
// 更新计划表信息插入订单单号
PurPlanEntity purPlanEntity1 = new PurPlanEntity();
purPlanEntity1.setId(purPlanEntity.getId());
purPlanEntity1.setStockOrderNo(purOrderEntity.getBillNo());
// purPlanEntity.sets(true);
@ -386,15 +386,15 @@ public class PurOrderReceiveController extends BaseController {
}
//---------------------------------判断计划为已审核就生成采购入库单-------------------------------------------//\
//查询申购单详情
List<PurPlanDetailEntity> purPlanDetailEntities=purPlanDetailService.findByOrderId(purPlanEntity.getId()+"");
List<PurPlanDetailEntity> purPlanDetailEntities = purPlanDetailService.findByOrderId(purPlanEntity.getId() + "");
//对计划单里面的供应商进行分组
Map<String, List<PurPlanDetailEntity>> map = purPlanDetailEntities.stream().collect(Collectors.groupingBy(PurPlanDetailEntity::getSupId));
String billNo="";
if(basicBusTypeChangeEntity!=null && StrUtil.isNotEmpty(basicBusTypeChangeEntity.getTargetAction()) && basicBusTypeChangeEntity.isEnable()==true){
for (Map.Entry<String, List<PurPlanDetailEntity>> m:map.entrySet()) {
String billNo = "";
if (basicBusTypeChangeEntity != null && StrUtil.isNotEmpty(basicBusTypeChangeEntity.getTargetAction()) && basicBusTypeChangeEntity.isEnable() == true) {
for (Map.Entry<String, List<PurPlanDetailEntity>> m : map.entrySet()) {
//生产单据表信息
IoOrderEntity ioOrderEntity=new IoOrderEntity();
ioOrderEntity.setBillNo(gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER ,"yyyyMMdd")));
IoOrderEntity ioOrderEntity = new IoOrderEntity();
ioOrderEntity.setBillNo(gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER, "yyyyMMdd")));
ioOrderEntity.setCorpOrderId(CustomUtil.getDate());
ioOrderEntity.setMainAction(ConstantType.TYPE_PUT);
ioOrderEntity.setAction(basicBusTypeChangeEntity.getTargetAction());
@ -411,9 +411,9 @@ public class PurOrderReceiveController extends BaseController {
ioOrderEntity.setDeptCode(purReceiveEntity.getInvCode());
ioOrderEntity.setInvCode(purReceiveEntity.getDeptCode());
ioOrderService.insertOrder(ioOrderEntity);
billNo+=ioOrderEntity.getBillNo()+",";
billNo += ioOrderEntity.getBillNo() + ",";
//插入业务单表
for (PurPlanDetailEntity obj:m.getValue()) {
for (PurPlanDetailEntity obj : m.getValue()) {
BasicProductsEntity basicProductsEntity = purPlanDetailService.selectIoOrderDetailBiz(obj.getId());
IoOrderDetailBizEntity ioOrderDetailBizEntity = new IoOrderDetailBizEntity();
ioOrderDetailBizEntity.setOrderIdFk(ioOrderEntity.getBillNo());
@ -434,9 +434,9 @@ public class PurOrderReceiveController extends BaseController {
ioOrderDetailBizService.insert(ioOrderDetailBizEntity);
}
}
PurPlanEntity purPlanEntity1=new PurPlanEntity();
PurPlanEntity purPlanEntity1 = new PurPlanEntity();
purPlanEntity1.setId(purPlanEntity.getId());
purPlanEntity1.setStockOrderNo(billNo.substring(0,billNo.length()-1));
purPlanEntity1.setStockOrderNo(billNo.substring(0, billNo.length() - 1));
purPlanService.update(purPlanEntity1);
}
@ -450,7 +450,6 @@ public class PurOrderReceiveController extends BaseController {
}
/**
*
*/
@ -458,17 +457,17 @@ public class PurOrderReceiveController extends BaseController {
public BaseResponse addOrderDetailAndApply(@RequestBody purReceiveRequest purReceiveRequest) {
if (purReceiveRequest.getOrderId() == null || purReceiveRequest.getId() == null) {
return ResultVOUtils.error(999,"参数错误!");
return ResultVOUtils.error(999, "参数错误!");
}
//查询领用单详情
List<PurReceiveDetailEntity> purPlanDetailEntityList=receivedetailService.selectByOrderId(purReceiveRequest.getOrderId());
List<PurReceiveDetailEntity> purPlanDetailEntityList = receivedetailService.selectByOrderId(purReceiveRequest.getOrderId());
//使用stream拷贝list
List<PurApplyDetailEntity> purOrderDetailEntityList = purPlanDetailEntityList.stream()
.map(e-> {
.map(e -> {
PurApplyDetailEntity d = new PurApplyDetailEntity();
d.setProductId(e.getRelIdFk().intValue());
UdiProductEntity udiProductEntity=udiProductService.findByNameCode(e.getNameCode());
UdiProductEntity udiProductEntity = udiProductService.findByNameCode(e.getNameCode());
d.setProductName(udiProductEntity.getCpmctymc());
d.setCount(e.getCount());
d.setSupId(e.getSupId());
@ -477,17 +476,17 @@ public class PurOrderReceiveController extends BaseController {
})
.collect(Collectors.toList());
for (PurApplyDetailEntity obj:purOrderDetailEntityList){
obj.setOrderIdFk(purReceiveRequest.getId()+"");
for (PurApplyDetailEntity obj : purOrderDetailEntityList) {
obj.setOrderIdFk(purReceiveRequest.getId() + "");
}
//获取详情表信息
List<PurApplyDetailEntity> purOrderDetailEntities=purApplyDetailService.findByOrderId(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())){
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;
@ -495,25 +494,25 @@ public class PurOrderReceiveController extends BaseController {
}
}
//删除存在的产品
if(ids.size()>0){
if (ids.size() > 0) {
purApplyDetailService.deleteByIds(ids);
}
boolean falg= purApplyDetailService.insertPurApplyDetailEntity(purOrderDetailEntityList);
if(falg){
boolean falg = purApplyDetailService.insertPurApplyDetailEntity(purOrderDetailEntityList);
if (falg) {
//查询申购单
return ResultVOUtils.success(purReceiveRequest.getId());
}else{
} else {
return ResultVOUtils.success("添加失败");
}
}
public Date timeProcess(Date date,Integer timeCount) {
public Date timeProcess(Date date, Integer timeCount) {
Calendar rightNow = Calendar.getInstance();
rightNow.setTime(date);
rightNow.add(Calendar.HOUR,timeCount);
rightNow.add(Calendar.HOUR, timeCount);
Date dt1 = rightNow.getTime();
return dt1;
}

@ -53,7 +53,8 @@ public class IdcServiceImpl implements IdcService {
private String apiKey;
@Value("${API_SECRET}")
private String apiSecret;
// "sup_company/updateTime//配送供应商资质信息",
// "sup_company/updateTime//配送供应商资质信息",
/*自助平台->UDI*/
private final String[] SPMS_TO_UDI_TABLES = {
"basic_udirel/updateTime//耗材字典", "basic_products///耗材字典信息详情", "company_product_relevance/updateTime//供应商关联信息",
@ -62,19 +63,25 @@ public class IdcServiceImpl implements IdcService {
"thr_inv_products/updateTime//第三方库存", "thr_inv_warehouse///第三方仓库",
"thr_order/updateTime//第三方单据", "thr_order_detail/updateTime//第三方单据详情",
"thr_products/updateTime//第三方产品信息", "sup_cert/updateTime/filePath/资质证书信息",
"sup_cert_set/updateTime//供应商资质证书设置", "sup_company/updateTime//配送供应商资质信息",
"sup_cert_set/updateTime//供应商资质证书设置",
"sup_manufacturer/updateTime//生产企业资质信息", "sup_product/updateTime//产品资质信息"};
/*UDI->自助平台*/
private final String[] UDI_TO_SPMS_TABLES = {
"basic_udirel/updateTime//耗材字典", "basic_products///耗材字典信息详情", "company_product_relevance/updateTime//供应商关联信息",
"basic_corp/updateTime//往来单位", "thr_bustype_origin/updateTime//第三方单据类型",
"thr_corp/updateTime//第三方往来单位", "thr_dept/updateTime//第三方部门",
"thr_inv_products/updateTime//第三方库存", "thr_inv_warehouse///第三方仓库",
"thr_order/updateTime//第三方单据", "thr_order_detail/updateTime//第三方单据详情",
"thr_products/updateTime//第三方产品信息", "sup_cert/updateTime/filePath/资质证书信息",
"sup_cert_set/updateTime//供应商资质证书设置", "sup_company/updateTime//配送供应商资质信息",
"sup_manufacturer/updateTime//生产企业资质信息", "sup_product/updateTime//产品资质信息",
"productinfo/updateTime//国家库UDI数据,udicompany/updateTime//国际库医疗器械注册人信息"};
};
/**
* "basic_udirel/updateTime//耗材字典", "basic_products///耗材字典信息详情", "company_product_relevance/updateTime//供应商关联信息",
* "basic_corp/updateTime//往来单位", "thr_bustype_origin/updateTime//第三方单据类型",
* "thr_corp/updateTime//第三方往来单位", "thr_dept/updateTime//第三方部门",
* "thr_inv_products/updateTime//第三方库存", "thr_inv_warehouse///第三方仓库",
* "thr_order/updateTime//第三方单据", "thr_order_detail/updateTime//第三方单据详情",
* "thr_products/updateTime//第三方产品信息", "sup_cert/updateTime/filePath/资质证书信息",
* "sup_cert_set/updateTime//供应商资质证书设置",
* "sup_manufacturer/updateTime//生产企业资质信息", "sup_product/updateTime//产品资质信息",
* "productinfo/updateTime//国家库UDI数据,udicompany/updateTime//国际库医疗器械注册人信息"};
*/
private int orderNum = 0;
@ -141,8 +148,8 @@ public class IdcServiceImpl implements IdcService {
/*为顶级或末级,以及下游或上游连通,可执行*/
Boolean isLastLevel = isLastLevel(direction);
Boolean isRelay = isRelay(direction);
System.out.print("-----数据传输任务开始----" + direction + "\n");
System.out.print("-----是否顶级或末级服务:" + isLastLevel + ",是否转发数据:" + isRelay + "----\n");
logger.info("-----数据传输任务开始----" + direction + "\n");
logger.info("-----是否顶级或末级服务:" + isLastLevel + ",是否转发数据:" + isRelay + "----\n");
if (isLastLevel && isRelay) {
for (String t : tNames) {
uploadData(t);
@ -158,7 +165,8 @@ public class IdcServiceImpl implements IdcService {
Map<String, Object> map = new HashMap<String, Object>();
String sqlWhere = "not exists (select fkId from idc_record where fkId=" + tn[0] + ".id)";
if (!StringUtils.isEmpty(tn[1])) {
sqlWhere += " and ifnull(" + tn[1] + ",now())>=cast('" + lastUpdateTime + "' as datetime)";
sqlWhere += " and " + tn[1] + ">=cast('" + lastUpdateTime + "' as datetime)";
// sqlWhere += " and ifnull(" + tn[1] + ",now())>=cast('" + lastUpdateTime + "' as datetime)";
} else {
map.put("isEnd", "1");
}

@ -34,7 +34,7 @@ public class AsyncIdcTask implements SchedulingConfigurer {
scheduledRequest.setCronName("syncIdc");
logger.info("syncIdc----------------");
ScheduledEntity scheduledEntity = scheduledDao.findScheduled(scheduledRequest);
String cron = scheduledEntity != null ? scheduledEntity.getCron() : "5 * * * * ?";
String cron = scheduledEntity != null ? scheduledEntity.getCron() : "0 */5 * * * ?";
if (cron.isEmpty()) {
logger.error("cron is null");

@ -63,12 +63,11 @@ public class IoChangeInoutService {
List<IoCodeEntity> codeEnttities = codeService.findByOrderId(orderEntity.getBillNo());
if (basicBusTypePreEntity != null) {
buildInOrder(basicBusTypePreEntity, codeEnttities, orderEntity);
}else {
} else {
//结束,不生成库存,
}
}
@ -237,15 +236,18 @@ public class IoChangeInoutService {
codeTempService.insertBatch(codeTempEntities);
//根据单据设置状态 1:草稿
if (bussinessChangeTypeEntity.getAuditStatus() == 1) {
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE);
orderService.update(orderEntity);
} else if (bussinessChangeTypeEntity.getAuditStatus() == 2 || bussinessChangeTypeEntity.getAuditStatus() == 3) {
addInoutService.dealProcess(outOrder);
if (!ioCheckInoutService.checkManual(outOrder.getBillNo())) {
ioCheckInoutService.check(outOrder.getBillNo());
if (bussinessChangeTypeEntity.getAuditStatus() != null) {
if (bussinessChangeTypeEntity.getAuditStatus() == 1) {
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE);
orderService.update(orderEntity);
} else if (bussinessChangeTypeEntity.getAuditStatus() == 2 || bussinessChangeTypeEntity.getAuditStatus() == 3) {
addInoutService.dealProcess(outOrder);
if (!ioCheckInoutService.checkManual(outOrder.getBillNo())) {
ioCheckInoutService.check(outOrder.getBillNo());
}
}
}
}
}

@ -524,6 +524,10 @@ public class IoOrderServiceImpl implements IoOrderService {
filterOrderRequest.setStatuses(Arrays.asList(5, 8));
filterOrderRequest.setDealStatuses(Arrays.asList(2));
break;
case Constant.ORDER_STATUS_WAIT_AUDITED:
filterOrderRequest.setStatuses(Arrays.asList(10));
filterOrderRequest.setDealStatuses(Arrays.asList(3, 4));
break;
case Constant.ORDER_STATUS_AUDITED:
filterOrderRequest.setStatuses(Arrays.asList(7));
filterOrderRequest.setDealStatuses(Arrays.asList(3, 4));

@ -683,4 +683,11 @@ public class DateUtil extends DateUtils {
return yearStart.toString("yyyy-MM-dd").equals(formatDate(date, "yyyy-MM-dd"));
}
}
public static Date timeProcess(Date date, Integer timeCount) {
Calendar rightNow = Calendar.getInstance();
rightNow.setTime(date);
rightNow.add(Calendar.HOUR, timeCount);
Date dt1 = rightNow.getTime();
return dt1;
}
}

Loading…
Cancel
Save