|
|
|
@ -5,9 +5,11 @@ import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.glxp.api.annotation.AuthRuleAnnotation;
|
|
|
|
|
import com.glxp.api.annotation.Log;
|
|
|
|
|
import com.glxp.api.common.enums.ResultEnum;
|
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
|
import com.glxp.api.constant.BusinessType;
|
|
|
|
|
import com.glxp.api.constant.Constant;
|
|
|
|
|
import com.glxp.api.constant.ConstantStatus;
|
|
|
|
|
import com.glxp.api.controller.BaseController;
|
|
|
|
@ -16,6 +18,8 @@ import com.glxp.api.entity.auth.AuthAdmin;
|
|
|
|
|
import com.glxp.api.entity.auth.InvWarehouseEntity;
|
|
|
|
|
import com.glxp.api.entity.basic.*;
|
|
|
|
|
import com.glxp.api.entity.inout.*;
|
|
|
|
|
import com.glxp.api.entity.purchase.PurOrderDetailEntity;
|
|
|
|
|
import com.glxp.api.entity.purchase.PurOrderEntity;
|
|
|
|
|
import com.glxp.api.entity.purchase.SupProductEntity;
|
|
|
|
|
import com.glxp.api.entity.system.SystemParamConfigEntity;
|
|
|
|
|
import com.glxp.api.entity.thrsys.ThrOrderDetailEntity;
|
|
|
|
@ -31,6 +35,9 @@ import com.glxp.api.res.inout.IoOrderInvoiceResponse;
|
|
|
|
|
import com.glxp.api.service.auth.InvWarehouseService;
|
|
|
|
|
import com.glxp.api.service.basic.*;
|
|
|
|
|
import com.glxp.api.service.inout.*;
|
|
|
|
|
import com.glxp.api.service.purchase.PurOrderDetailService;
|
|
|
|
|
import com.glxp.api.service.purchase.PurOrderService;
|
|
|
|
|
import com.glxp.api.service.purchase.SupCertService;
|
|
|
|
|
import com.glxp.api.service.purchase.SupProductService;
|
|
|
|
|
import com.glxp.api.service.system.SystemParamConfigService;
|
|
|
|
|
import com.glxp.api.service.thrsys.ThrOrderDetailService;
|
|
|
|
@ -98,15 +105,16 @@ public class IoOrderDetailBizController extends BaseController {
|
|
|
|
|
SupProductService supProductService;
|
|
|
|
|
@Resource
|
|
|
|
|
SystemParamConfigService systemParamConfigService;
|
|
|
|
|
@Resource
|
|
|
|
|
SupCertService supCertService;
|
|
|
|
|
|
|
|
|
|
//录入业务单据详情
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/udiwms/inout/order/addBizProduct")
|
|
|
|
|
@Log(title = "单据管理", businessType = BusinessType.INSERT)
|
|
|
|
|
public BaseResponse addBizProduct(@RequestBody AddBizProductReqeust addBizProductReqeust) {
|
|
|
|
|
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("vail_product_cert");
|
|
|
|
|
boolean isVailCert = false;
|
|
|
|
|
if (systemParamConfigEntity != null)
|
|
|
|
|
isVailCert = systemParamConfigEntity.getParamValue().equals("1") ? true : false;
|
|
|
|
|
boolean isVailCert = systemParamConfigEntity.getParamValue().equals("1") ? true : false;
|
|
|
|
|
AuthAdmin authAdmin = getUser();
|
|
|
|
|
if (addBizProductReqeust.getRelId() == null && CollUtil.isEmpty(addBizProductReqeust.getDatas()))
|
|
|
|
|
return ResultVOUtils.error(500, "未选择产品信息");
|
|
|
|
@ -188,6 +196,7 @@ public class IoOrderDetailBizController extends BaseController {
|
|
|
|
|
//修改业务单据详情
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/udiwms/inout/order/updateBizProduct")
|
|
|
|
|
@Log(title = "单据管理", businessType = BusinessType.UPDATE)
|
|
|
|
|
public BaseResponse updateBizProduct(@RequestBody IoOrderDetailBizEntity orderDetailBizEntity) {
|
|
|
|
|
boolean isExit = orderDetailBizService.isExit(orderDetailBizEntity.getBindRlFk(), orderDetailBizEntity.getBatchNo(), orderDetailBizEntity.getId(), orderDetailBizEntity.getOrderIdFk());
|
|
|
|
|
if (isExit) {
|
|
|
|
@ -207,6 +216,7 @@ public class IoOrderDetailBizController extends BaseController {
|
|
|
|
|
//选入第三方单据至业务单据
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/udiwms/inout/order/addThrOrder")
|
|
|
|
|
@Log(title = "单据管理", businessType = BusinessType.INSERT)
|
|
|
|
|
public BaseResponse addThrOrder(@RequestBody ThrOrderEntity thrOrderRequest) {
|
|
|
|
|
|
|
|
|
|
ThrOrderEntity thrOrderEntity = thrOrderService.findById(thrOrderRequest.getId());
|
|
|
|
@ -332,6 +342,7 @@ public class IoOrderDetailBizController extends BaseController {
|
|
|
|
|
//选入领用单据至业务单据
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/udiwms/inout/order/addReceiveOrder")
|
|
|
|
|
@Log(title = "单据管理", businessType = BusinessType.INSERT)
|
|
|
|
|
public BaseResponse addReceiveOrder(@RequestBody PurReceiveEntity purReceiveEntity,
|
|
|
|
|
BindingResult bindingResult) {
|
|
|
|
|
|
|
|
|
@ -392,8 +403,74 @@ public class IoOrderDetailBizController extends BaseController {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
PurOrderService purOrderService;
|
|
|
|
|
@Resource
|
|
|
|
|
PurOrderDetailService purOrderDetailService;
|
|
|
|
|
|
|
|
|
|
//选入领用单据至业务单据
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/udiwms/inout/order/addPurOrder")
|
|
|
|
|
@Log(title = "单据管理", businessType = BusinessType.INSERT)
|
|
|
|
|
public BaseResponse addPurOrder(@RequestBody PurOrderEntity purOrderEntity,
|
|
|
|
|
BindingResult bindingResult) {
|
|
|
|
|
|
|
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
|
|
|
}
|
|
|
|
|
purOrderEntity = purOrderService.selectById(purOrderEntity.getId());
|
|
|
|
|
List<PurOrderDetailEntity> purOrderDetailEntities = purOrderDetailService.findByOrderId(purOrderEntity.getId() + "");
|
|
|
|
|
BasicBusTypeChangeEntity basicBusTypeChangeEntity = basicBusTypeChangeService.selectByOriginAction(purOrderEntity.getBillType());
|
|
|
|
|
BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(basicBusTypeChangeEntity.getTargetAction());
|
|
|
|
|
|
|
|
|
|
AuthAdmin authAdmin = getUser();
|
|
|
|
|
//创建单据
|
|
|
|
|
IoOrderEntity orderEntity = new IoOrderEntity();
|
|
|
|
|
String orderNo = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER + StrUtil.trimToEmpty(bussinessTypeEntity.getPrefix()), "yyyyMMdd"));
|
|
|
|
|
orderEntity.setBillNo(orderNo);
|
|
|
|
|
orderEntity.setCreateUser(authAdmin.getId() + "");
|
|
|
|
|
orderEntity.setCreateTime(new Date());
|
|
|
|
|
orderEntity.setUpdateUser(authAdmin.getId() + "");
|
|
|
|
|
orderEntity.setUpdateTime(new Date());
|
|
|
|
|
orderEntity.setCustomerId(authAdmin.getCustomerId() + "");
|
|
|
|
|
orderEntity.setCorpOrderId(purOrderEntity.getBillNo());
|
|
|
|
|
orderEntity.setAction(bussinessTypeEntity.getAction());
|
|
|
|
|
orderEntity.setMainAction(bussinessTypeEntity.getMainAction());
|
|
|
|
|
orderEntity.setDeptCode(purOrderEntity.getDeptCode());
|
|
|
|
|
orderEntity.setInvCode(purOrderEntity.getInvCode());
|
|
|
|
|
orderEntity.setFromReceiveBillNo(purOrderEntity.getBillNo());
|
|
|
|
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE);
|
|
|
|
|
orderEntity.setDealStatus(ConstantStatus.ORDER_DEAL_DRAFT);
|
|
|
|
|
orderEntity.setFromType(ConstantStatus.FROM_RECEIVE);
|
|
|
|
|
orderEntity.setOrderType(ConstantStatus.ORDER_TYPE_BIZ);
|
|
|
|
|
orderEntity.setBusType(bussinessTypeEntity.getBusType());
|
|
|
|
|
orderService.insertOrder(orderEntity);
|
|
|
|
|
for (PurOrderDetailEntity purReceiveDetailEntity : purOrderDetailEntities) {
|
|
|
|
|
IoOrderDetailBizEntity ioOrderDetailBizEntity = new IoOrderDetailBizEntity();
|
|
|
|
|
UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectGroupById(purReceiveDetailEntity.getProductId().longValue());
|
|
|
|
|
ioOrderDetailBizEntity.setOrderIdFk(orderEntity.getBillNo());
|
|
|
|
|
ioOrderDetailBizEntity.setBindRlFk(udiRelevanceResponse.getId());
|
|
|
|
|
ioOrderDetailBizEntity.setUuidFk(udiRelevanceResponse.getUuid());
|
|
|
|
|
ioOrderDetailBizEntity.setNameCode(udiRelevanceResponse.getNameCode());
|
|
|
|
|
ioOrderDetailBizEntity.setCoName(udiRelevanceResponse.getCpmctymc());
|
|
|
|
|
ioOrderDetailBizEntity.setCertCode(udiRelevanceResponse.getZczbhhzbapzbh());
|
|
|
|
|
ioOrderDetailBizEntity.setYlqxzcrbarmc(udiRelevanceResponse.getYlqxzcrbarmc());
|
|
|
|
|
ioOrderDetailBizEntity.setManufacturer(udiRelevanceResponse.getManufactory());
|
|
|
|
|
ioOrderDetailBizEntity.setMeasname(udiRelevanceResponse.getMeasname());
|
|
|
|
|
ioOrderDetailBizEntity.setSpec(udiRelevanceResponse.getGgxh());
|
|
|
|
|
ioOrderDetailBizEntity.setPrice(udiRelevanceResponse.getPrice());
|
|
|
|
|
ioOrderDetailBizEntity.setSupId(purReceiveDetailEntity.getSupId());
|
|
|
|
|
ioOrderDetailBizEntity.setCount(purReceiveDetailEntity.getCount());
|
|
|
|
|
orderDetailBizService.insert(ioOrderDetailBizEntity);
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.success("选入成功!");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/udiwms/inout/order/delBizProduct")
|
|
|
|
|
@Log(title = "单据管理", businessType = BusinessType.DELETE)
|
|
|
|
|
public BaseResponse delBizProduct(@RequestBody DeleteRequest deleteRequest) {
|
|
|
|
|
return orderDetailBizService.deleteById(Integer.parseInt(deleteRequest.getId())) > 0 ? ResultVOUtils.success("删除成功!") : ResultVOUtils.error(500, "删除失败");
|
|
|
|
|
}
|
|
|
|
@ -424,6 +501,7 @@ public class IoOrderDetailBizController extends BaseController {
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/udiwms/inout/biz/updateBind")
|
|
|
|
|
@Log(title = "单据管理", businessType = BusinessType.UPDATE)
|
|
|
|
|
public BaseResponse updateBindSup(@RequestBody BizBindUpdateRequest bizBindUpdateRequest) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -447,6 +525,7 @@ public class IoOrderDetailBizController extends BaseController {
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/udiwms/inout/biz/deleteById")
|
|
|
|
|
@Log(title = "发票管理", businessType = BusinessType.DELETE)
|
|
|
|
|
public BaseResponse deleteById(Integer id) {
|
|
|
|
|
|
|
|
|
|
return ResultVOUtils.success(ioOrderInvoiceService.deleteByInvId(id));
|
|
|
|
@ -461,6 +540,7 @@ public class IoOrderDetailBizController extends BaseController {
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
@PostMapping("/udiwms/inout/biz/updateById")
|
|
|
|
|
@Log(title = "发票管理", businessType = BusinessType.UPDATE)
|
|
|
|
|
public BaseResponse deleteById(@RequestBody IoOrderInvoiceRequest ioOrderInvoiceRequest) {
|
|
|
|
|
|
|
|
|
|
return ResultVOUtils.success(ioOrderInvoiceService.updateByInvId(ioOrderInvoiceRequest));
|
|
|
|
@ -469,20 +549,17 @@ public class IoOrderDetailBizController extends BaseController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/udiwms/inout/biz/insertInvoice")
|
|
|
|
|
public BaseResponse insertInvoice(@RequestBody List<IoOrderDetailResultEntity> list) {
|
|
|
|
|
if (CollUtil.isEmpty(list)) {
|
|
|
|
|
return ResultVOUtils.error(500, "请选入产品!");
|
|
|
|
|
}
|
|
|
|
|
for (IoOrderDetailResultEntity ioOrderDetailResultEntity : list) {
|
|
|
|
|
IoOrderInvoiceEntity ioOrderInvoiceEntity = new IoOrderInvoiceEntity();
|
|
|
|
|
ioOrderInvoiceEntity.setOrderIdFk(ioOrderDetailResultEntity.getOrderIdFk());
|
|
|
|
|
ioOrderInvoiceEntity.setBindRlFk(ioOrderDetailResultEntity.getBindRlFk() + "");
|
|
|
|
|
ioOrderInvoiceEntity.setBatchNo(ioOrderDetailResultEntity.getBatchNo());
|
|
|
|
|
ioOrderInvoiceEntity.setProductDate(ioOrderDetailResultEntity.getProductDate());
|
|
|
|
|
ioOrderInvoiceEntity.setExpireDate(ioOrderDetailResultEntity.getExpireDate());
|
|
|
|
|
boolean b = ioOrderInvoiceService.insertInvoice(ioOrderInvoiceEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Log(title = "发票管理", businessType = BusinessType.INSERT)
|
|
|
|
|
public BaseResponse insertInvoice(@RequestBody IoOrderDetailBizEntity ioOrderDetailBizEntity) {
|
|
|
|
|
|
|
|
|
|
IoOrderInvoiceEntity ioOrderInvoiceEntity = new IoOrderInvoiceEntity();
|
|
|
|
|
ioOrderInvoiceEntity.setOrderIdFk(ioOrderDetailBizEntity.getOrderIdFk());
|
|
|
|
|
ioOrderInvoiceEntity.setBindRlFk(ioOrderDetailBizEntity.getBindRlFk() + "");
|
|
|
|
|
ioOrderInvoiceEntity.setBatchNo(ioOrderDetailBizEntity.getBatchNo());
|
|
|
|
|
ioOrderInvoiceEntity.setProductDate(ioOrderDetailBizEntity.getProductDate());
|
|
|
|
|
ioOrderInvoiceEntity.setExpireDate(ioOrderDetailBizEntity.getExpireDate());
|
|
|
|
|
ioOrderInvoiceEntity.setBizIdFk(ioOrderDetailBizEntity.getId());
|
|
|
|
|
boolean b = ioOrderInvoiceService.insertInvoice(ioOrderInvoiceEntity);
|
|
|
|
|
|
|
|
|
|
return ResultVOUtils.success("成功");
|
|
|
|
|
|
|
|
|
|