opt:客户功能wql改成mybatis plus
This commit is contained in:
@@ -4,6 +4,7 @@ import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.nl.b_lms.pda.service.PrintTableTwoService;
|
||||
import org.nl.b_lms.pdm.info.dao.PdmBiContainerinfo;
|
||||
@@ -15,6 +16,8 @@ import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
import org.nl.wms.basedata.master.customer.service.dao.Customerbase;
|
||||
import org.nl.wms.basedata.master.customer.service.dao.mapper.CustomerbaseMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -36,6 +39,9 @@ public class PrintTableTwoServiceImpl implements PrintTableTwoService {
|
||||
@Autowired
|
||||
private IPdmBiOrderbominfoService iPdmBiOrderbominfoService;
|
||||
|
||||
@Autowired
|
||||
private CustomerbaseMapper customerbaseMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject withinTable(JSONObject whereJson) {
|
||||
@@ -101,14 +107,18 @@ public class PrintTableTwoServiceImpl implements PrintTableTwoService {
|
||||
// 抬头
|
||||
String BTW = "%BTW% /AF=" + LocationOfBTW + "/R=3 /PRN=" + "\"" + jsonPrint.getString("print_floder") + "\"" + " /D /P /C=1";
|
||||
// 标签类型: 查询客户信息中配置的打印模版,根据模版找到字典配置的参数
|
||||
JSONObject jsonCust = WQLObject.getWQLObject("md_cs_customerbase")
|
||||
.query("cust_code = '" + subDao.getCustomer_name() + "' AND is_delete = '0' AND is_used = '1'")
|
||||
.uniqueResult(0);
|
||||
LambdaQueryWrapper<Customerbase> lam = new LambdaQueryWrapper<Customerbase>();
|
||||
lam.eq(Customerbase::getCust_code,subDao.getCustomer_name());
|
||||
lam.eq(Customerbase::getIs_delete,"0");
|
||||
lam.eq(Customerbase::getIs_used,"1");
|
||||
Customerbase jsonCust = customerbaseMapper.selectOne(lam);
|
||||
|
||||
|
||||
if (ObjectUtil.isEmpty(jsonCust)) {
|
||||
throw new BadRequestException("客户【"+subDao.getCustomer_description()+"】不存在或未启用!");
|
||||
}
|
||||
JSONObject jsonDict = WQLObject.getWQLObject("sys_dict")
|
||||
.query("code = 'two_print_temple' AND value = '" + jsonCust.getString("bz_print_within") + "'")
|
||||
.query("code = 'two_print_temple' AND value = '" + jsonCust.getBz_print_within() + "'")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonDict)) {
|
||||
throw new BadRequestException("客户【"+subDao.getCustomer_description()+"】未找到对应的打印模版,请检查是否在客户信息中配置!");
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
package org.nl.wms.basedata.master.rest;
|
||||
package org.nl.wms.basedata.master.customer.controller;
|
||||
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.wms.basedata.master.service.CustomerbaseService;
|
||||
import org.nl.wms.basedata.master.service.dto.CustomerbaseDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.nl.wms.basedata.master.customer.service.CustomerbaseService;
|
||||
import org.nl.wms.basedata.master.customer.service.dao.Customerbase;
|
||||
import org.nl.wms.basedata.master.customer.service.dto.CustomerbaseQuery;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ldjun
|
||||
@@ -20,7 +21,6 @@ import java.util.Map;
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
|
||||
@RequestMapping("/api/customerbase")
|
||||
@Slf4j
|
||||
public class CustomerbaseController {
|
||||
@@ -29,33 +29,25 @@ public class CustomerbaseController {
|
||||
|
||||
@GetMapping
|
||||
@Log("查询客户基础表")
|
||||
|
||||
//@PreAuthorize("@el.check('customerbase:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(customerbaseService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
public ResponseEntity<Object> query(CustomerbaseQuery whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(customerbaseService.queryAll(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增客户基础表")
|
||||
|
||||
//@PreAuthorize("@el.check('customerbase:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody CustomerbaseDto dto) {
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody Customerbase dto) {
|
||||
customerbaseService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改客户基础表")
|
||||
|
||||
//@PreAuthorize("@el.check('customerbase:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody CustomerbaseDto dto) {
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody Customerbase dto) {
|
||||
customerbaseService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除客户基础表")
|
||||
|
||||
//@PreAuthorize("@el.check('customerbase:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
customerbaseService.deleteAll(ids);
|
||||
@@ -0,0 +1,46 @@
|
||||
package org.nl.wms.basedata.master.customer.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.basedata.master.customer.service.dao.Customerbase;
|
||||
import org.nl.wms.basedata.master.customer.service.dto.CustomerbaseQuery;
|
||||
|
||||
|
||||
/**
|
||||
* @author ldjun
|
||||
* @description 服务接口
|
||||
* @date 2021-12-06
|
||||
**/
|
||||
public interface CustomerbaseService extends IService<Customerbase> {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
IPage<Customerbase> queryAll(CustomerbaseQuery whereJson, PageQuery page);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void create(Customerbase dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void update(Customerbase dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package org.nl.wms.basedata.master.customer.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author: zds
|
||||
* @date: 2024-09-27
|
||||
* @description:
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("md_cs_customerbase")
|
||||
public class Customerbase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "cust_id", type = IdType.NONE)
|
||||
private String cust_id;
|
||||
//客户编码
|
||||
private String cust_code;
|
||||
//客户名称
|
||||
private String cust_name;
|
||||
//客户简称
|
||||
private String cust_simple_name;
|
||||
//公司电话
|
||||
private String corp_tele_no;
|
||||
//公司地址
|
||||
private String corp_address;
|
||||
//业务员
|
||||
private String sales_owner;
|
||||
//创建人
|
||||
private String create_id;
|
||||
//创建人姓名
|
||||
private String create_name;
|
||||
//创建时间
|
||||
private String create_time;
|
||||
//修改人
|
||||
private String update_id;
|
||||
//修改人姓名
|
||||
private String update_name;
|
||||
//修改时间
|
||||
private String update_time;
|
||||
//是否启用
|
||||
private String is_used;
|
||||
//是否删除
|
||||
private String is_delete;
|
||||
//备注
|
||||
private String remark;
|
||||
//子卷打印模板号
|
||||
private String zj_print_no;
|
||||
//包装打印模板号
|
||||
private String bz_print_no;
|
||||
//送货单打印模板号
|
||||
private String shd_print_no;
|
||||
//送货单明细数
|
||||
private Integer shd_dtl_num;
|
||||
//是否自动贴标
|
||||
private String is_auto_table;
|
||||
//内标打印模版
|
||||
private String bz_print_within;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package org.nl.wms.basedata.master.customer.service.dao;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author: zds
|
||||
* @date: 2024-09-27
|
||||
* @description:
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("md_cs_customerbaseproc")
|
||||
public class CustomerbaseProc implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.NONE)
|
||||
private String id;
|
||||
//客户code
|
||||
private String customer_name;
|
||||
//客户名称
|
||||
private String description;
|
||||
//客户简称
|
||||
private String company;
|
||||
//国家
|
||||
private String country;
|
||||
//省份/州
|
||||
private String state;
|
||||
//城市
|
||||
private String city;
|
||||
//客户地址/街道
|
||||
private String address_line1;
|
||||
//邮编
|
||||
private String zip_code;
|
||||
//手机号
|
||||
private String phone_number;
|
||||
//传真
|
||||
private String fax_number;
|
||||
//邮箱
|
||||
private String web_site;
|
||||
//备注
|
||||
private String notes;
|
||||
//业务员
|
||||
private String sales_owner;
|
||||
//新增时间
|
||||
private String create_time;
|
||||
|
||||
public void copyFrom(JSONObject source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package org.nl.wms.basedata.master.customer.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.wms.basedata.master.customer.service.dao.Customerbase;
|
||||
|
||||
/**
|
||||
* @author: zds
|
||||
* @date: 2024-09-27
|
||||
* @description:
|
||||
*/
|
||||
public interface CustomerbaseMapper extends BaseMapper<Customerbase> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.basedata.master.customer.service.dao.mapper.CustomerbaseMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.nl.wms.basedata.master.customer.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.wms.basedata.master.customer.service.dao.Customerbase;
|
||||
import org.nl.wms.basedata.master.customer.service.dao.CustomerbaseProc;
|
||||
|
||||
/**
|
||||
* @author: zds
|
||||
* @date: 2024-09-27
|
||||
* @description:
|
||||
*/
|
||||
public interface CustomerbaseProcMapper extends BaseMapper<CustomerbaseProc> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.basedata.master.customer.service.dao.mapper.CustomerbaseProcMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.nl.wms.basedata.master.customer.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author: zds
|
||||
* @date: 2024-09-27
|
||||
* @description:
|
||||
*/
|
||||
@Data
|
||||
public class CustomerbaseQuery implements Serializable {
|
||||
//编码或名称
|
||||
private String search;
|
||||
//是否启用
|
||||
private String is_used;
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package org.nl.wms.basedata.master.customer.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.wms.basedata.master.customer.service.CustomerbaseService;
|
||||
import org.nl.wms.basedata.master.customer.service.dao.Customerbase;
|
||||
import org.nl.wms.basedata.master.customer.service.dao.mapper.CustomerbaseMapper;
|
||||
import org.nl.wms.basedata.master.customer.service.dto.CustomerbaseQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
/**
|
||||
* @author ldjun
|
||||
* @description 服务实现
|
||||
* @date 2021-12-06
|
||||
**/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class CustomerbaseServiceImpl extends ServiceImpl<CustomerbaseMapper, Customerbase> implements CustomerbaseService {
|
||||
|
||||
@Autowired
|
||||
private CustomerbaseMapper customerbaseMapper;
|
||||
|
||||
@Override
|
||||
public IPage<Customerbase> queryAll(CustomerbaseQuery whereJson, PageQuery page) {
|
||||
IPage<Customerbase> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
LambdaQueryWrapper<Customerbase> lam = new LambdaQueryWrapper<Customerbase>();
|
||||
|
||||
lam.eq(ObjectUtil.isNotEmpty(whereJson.getIs_used()), Customerbase::getIs_used, whereJson.getIs_used())
|
||||
.and(ObjectUtil.isNotEmpty(whereJson.getSearch()),blam -> blam.like(Customerbase::getCust_name, whereJson.getSearch()).or()
|
||||
.like(Customerbase::getCust_code, whereJson.getSearch()))
|
||||
.orderByDesc(Customerbase::getCust_code);
|
||||
customerbaseMapper.selectPage(pages, lam);
|
||||
return pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(Customerbase dto) {
|
||||
LambdaQueryWrapper<Customerbase> lam = new LambdaQueryWrapper<Customerbase>();
|
||||
lam.eq(Customerbase::getCust_code,dto.getCust_code());
|
||||
lam.eq(Customerbase::getIs_delete,"0");
|
||||
Customerbase customer = customerbaseMapper.selectOne(lam);
|
||||
if (ObjectUtil.isNotEmpty(customer)) {
|
||||
throw new BadRequestException("已存在相同的客户编号!");
|
||||
}
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setCust_id(IdUtil.getSnowflake(1, 1).nextId()+"");
|
||||
dto.setCreate_id(currentUserId);
|
||||
dto.setCreate_name(nickName);
|
||||
dto.setCreate_time(now);
|
||||
customerbaseMapper.insert(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(Customerbase dto) {
|
||||
LambdaQueryWrapper<Customerbase> lam = new LambdaQueryWrapper<Customerbase>();
|
||||
lam.eq(Customerbase::getCust_code,dto.getCust_code());
|
||||
lam.eq(Customerbase::getIs_delete,"0");
|
||||
lam.ne(Customerbase::getCust_id,dto.getCust_id());
|
||||
Customerbase customer = customerbaseMapper.selectOne(lam);
|
||||
if (ObjectUtil.isNotEmpty(customer)) {
|
||||
throw new BadRequestException("已存在相同的客户编号!");
|
||||
}
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_id(currentUserId);
|
||||
dto.setUpdate_name(nickName);
|
||||
customerbaseMapper.updateById(dto);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
//设置更新条件
|
||||
LambdaUpdateWrapper<Customerbase> lam = new LambdaUpdateWrapper<Customerbase>();
|
||||
lam.in(Customerbase::getCust_id,ids);
|
||||
|
||||
lam.set(Customerbase::getIs_delete, "1");
|
||||
lam.set(Customerbase::getUpdate_id, currentUserId);
|
||||
lam.set(Customerbase::getUpdate_name, nickName);
|
||||
lam.set(Customerbase::getUpdate_time, now);
|
||||
customerbaseMapper.update(null,lam);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.nl.wms.basedata.master.faultdevice.controller;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.TableDataInfo;
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
package org.nl.wms.basedata.master.faultdevice.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.basedata.master.faultdevice.service.dao.FaultDevice;
|
||||
import org.nl.wms.basedata.master.faultdevice.service.dto.FaultQuery;
|
||||
import org.nl.wms.basedata.master.service.dto.CustomerbaseDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
package org.nl.wms.basedata.master.service;
|
||||
|
||||
import org.nl.wms.basedata.master.service.dto.CustomerbaseDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ldjun
|
||||
* @description 服务接口
|
||||
* @date 2021-12-06
|
||||
**/
|
||||
public interface CustomerbaseService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @param whereJson 条件参数
|
||||
* @return List<CustomerbaseDto>
|
||||
*/
|
||||
List<CustomerbaseDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param cust_id ID
|
||||
* @return Customerbase
|
||||
*/
|
||||
CustomerbaseDto findById(Long cust_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
*
|
||||
* @param code code
|
||||
* @return Customerbase
|
||||
*/
|
||||
CustomerbaseDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void create(CustomerbaseDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void update(CustomerbaseDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
}
|
||||
@@ -1,212 +0,0 @@
|
||||
package org.nl.wms.basedata.master.service.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author ldjun
|
||||
* @description /
|
||||
* @date 2021-12-06
|
||||
**/
|
||||
@Data
|
||||
public class CustomerbaseDto implements Serializable {
|
||||
/** 客户标识 */
|
||||
/**
|
||||
* 防止精度丢失
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long cust_id;
|
||||
|
||||
/**
|
||||
* 客户编码
|
||||
*/
|
||||
private String cust_code;
|
||||
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
private String cust_name;
|
||||
|
||||
/**
|
||||
* 业务员
|
||||
*/
|
||||
private String sales_owner;
|
||||
|
||||
/**
|
||||
* 客户简称
|
||||
*/
|
||||
private String cust_simple_name;
|
||||
|
||||
/**
|
||||
* 国家
|
||||
*/
|
||||
private String country;
|
||||
|
||||
/**
|
||||
* 省份
|
||||
*/
|
||||
private String state;
|
||||
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 传真
|
||||
*/
|
||||
private String faxnumber;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String webSite;
|
||||
|
||||
/**
|
||||
* 法人代表
|
||||
*/
|
||||
private String jurid_name;
|
||||
|
||||
/**
|
||||
* 税务登记号
|
||||
*/
|
||||
private String tax_no;
|
||||
|
||||
/**
|
||||
* 工商注册号
|
||||
*/
|
||||
private String register_no;
|
||||
|
||||
/**
|
||||
* 经营许可证号
|
||||
*/
|
||||
private String manage_lice_no;
|
||||
|
||||
/**
|
||||
* 营业执照
|
||||
*/
|
||||
private String busi_char_name;
|
||||
|
||||
/**
|
||||
* 行政区划
|
||||
*/
|
||||
private Long area_id;
|
||||
|
||||
/**
|
||||
* 邮政编码
|
||||
*/
|
||||
private String zip_code;
|
||||
|
||||
/**
|
||||
* 公司电话
|
||||
*/
|
||||
private String corp_tele_no;
|
||||
|
||||
/**
|
||||
* 公司地址
|
||||
*/
|
||||
private String corp_address;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String create_id;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String update_optid;
|
||||
|
||||
/**
|
||||
* 修改人姓名
|
||||
*/
|
||||
private String update_optname;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
/**
|
||||
* 启用时间
|
||||
*/
|
||||
private String is_used_time;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private String is_used;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
|
||||
/**
|
||||
* 外部标识
|
||||
*/
|
||||
private String ext_id;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 分类标识
|
||||
*/
|
||||
private Long class_id;
|
||||
|
||||
/**
|
||||
* 分类编码
|
||||
*/
|
||||
private String class_code;
|
||||
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
private String class_name;
|
||||
|
||||
/**
|
||||
* 子卷打印模板号
|
||||
*/
|
||||
private String zj_print_no;
|
||||
|
||||
/**
|
||||
* 包装打印模板号
|
||||
*/
|
||||
private String bz_print_no;
|
||||
|
||||
/**
|
||||
* 送货单打印模板号
|
||||
*/
|
||||
private String shd_print_no;
|
||||
|
||||
/**
|
||||
* 送货单明细数
|
||||
*/
|
||||
private String shd_dtl_num;
|
||||
|
||||
/**
|
||||
* 是否自动贴标
|
||||
*/
|
||||
private String is_auto_table;
|
||||
|
||||
/**
|
||||
* 内标打印模版
|
||||
*/
|
||||
private String bz_print_within;
|
||||
}
|
||||
@@ -1,155 +0,0 @@
|
||||
package org.nl.wms.basedata.master.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.core.bean.ResultBean;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.wms.basedata.master.service.ClassstandardService;
|
||||
import org.nl.wms.basedata.master.service.CustomerbaseService;
|
||||
import org.nl.wms.basedata.master.service.dto.CustomerbaseDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ldjun
|
||||
* @description 服务实现
|
||||
* @date 2021-12-06
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class CustomerbaseServiceImpl implements CustomerbaseService {
|
||||
@Autowired
|
||||
private ClassstandardService classstandardService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
String where = "";
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_customerbase");
|
||||
String search = (String) whereJson.get("search");
|
||||
if (!StrUtil.isEmpty(search)) {
|
||||
where = "AND (cust_code like '%" + search + "%' OR cust_name like '%" + search + "%')";
|
||||
}
|
||||
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "is_delete = '0'" + where, "update_time desc");
|
||||
final JSONObject json = rb.pageResult();
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CustomerbaseDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_customerbase");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
List<CustomerbaseDto> list = arr.toJavaList(CustomerbaseDto.class);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomerbaseDto findById(Long cust_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_customerbase");
|
||||
JSONObject json = wo.query("cust_id =" + cust_id + "").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(json)) {
|
||||
return null;
|
||||
}
|
||||
final CustomerbaseDto obj = json.toJavaObject(CustomerbaseDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomerbaseDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_customerbase");
|
||||
JSONObject json = wo.query("cust_code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(json)) {
|
||||
return null;
|
||||
}
|
||||
final CustomerbaseDto obj = json.toJavaObject(CustomerbaseDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(CustomerbaseDto dto) {
|
||||
String cust_code = dto.getCust_code();
|
||||
CustomerbaseDto customerbaseDto = this.findByCode(cust_code);
|
||||
if (customerbaseDto != null && "0".equals(customerbaseDto.getIs_delete())) {
|
||||
throw new BadRequestException("存在相同的客户编号");
|
||||
}
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setCust_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||
dto.setCreate_id(currentUserId);
|
||||
dto.setCreate_name(nickName);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_customerbase");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(CustomerbaseDto dto) {
|
||||
CustomerbaseDto entity = this.findById(dto.getCust_id());
|
||||
if (entity == null) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
}
|
||||
|
||||
String cust_code = dto.getCust_code();
|
||||
CustomerbaseDto customerbaseDto = this.findByCode(cust_code);
|
||||
if (customerbaseDto != null && !customerbaseDto.getCust_id().equals(dto.getCust_id()) && "0".equals(customerbaseDto.getIs_delete())) {
|
||||
throw new BadRequestException("存在相同的客户编号");
|
||||
}
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_customerbase");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_customerbase");
|
||||
for (Long cust_id : ids) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("cust_id", String.valueOf(cust_id));
|
||||
param.put("is_delete", "1");
|
||||
param.put("update_optid", currentUserId);
|
||||
param.put("update_optname", nickName);
|
||||
param.put("update_time", now);
|
||||
wo.update(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,6 +44,8 @@ import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
import org.nl.wms.basedata.master.customer.service.dao.Customerbase;
|
||||
import org.nl.wms.basedata.master.customer.service.dao.mapper.CustomerbaseMapper;
|
||||
import org.nl.wms.ext.acs.service.AcsToWmsService;
|
||||
import org.nl.wms.pda.mps.eum.RegionTypeEnum;
|
||||
import org.nl.wms.pda.mps.service.CasingService;
|
||||
@@ -96,6 +98,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
|
||||
private final ISysNoticeService noticeService;
|
||||
|
||||
@Autowired
|
||||
private CustomerbaseMapper customerbaseMapper;
|
||||
|
||||
/**
|
||||
* 入库处理类服务
|
||||
*/
|
||||
@@ -788,12 +793,15 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
* 判断此客户是否是自动贴标
|
||||
*/
|
||||
// 查询客户
|
||||
JSONObject jsonCust = WQLObject.getWQLObject("md_cs_customerbase").query("cust_code = '" + sub_jo.getString("customer_name") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonCust)) {
|
||||
LambdaQueryWrapper<Customerbase> lam = new LambdaQueryWrapper<Customerbase>();
|
||||
lam.eq(Customerbase::getCust_code,sub_jo.getString("customer_name"));
|
||||
lam.eq(Customerbase::getIs_delete,"0");
|
||||
Customerbase customer = customerbaseMapper.selectOne(lam);
|
||||
if (ObjectUtil.isEmpty(customer)) {
|
||||
throw new BadRequestException("客户不存在请检查!");
|
||||
}
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("is_auto_table", jsonCust.getString("is_auto_table"));
|
||||
data.put("is_auto_table", customer.getIs_auto_table());
|
||||
|
||||
//判断系统参数是否贴标
|
||||
String is_labeling = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("is_labeling").getValue();
|
||||
@@ -808,7 +816,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
}
|
||||
|
||||
// 判断是否贴标
|
||||
if (!StrUtil.equals(jsonCust.getString("is_auto_table"), "1")) {
|
||||
if (!StrUtil.equals(customer.getIs_auto_table(), "1")) {
|
||||
result.put("data", data);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -6,12 +6,17 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.basedata.master.customer.service.dao.Customerbase;
|
||||
import org.nl.wms.basedata.master.customer.service.dao.CustomerbaseProc;
|
||||
import org.nl.wms.basedata.master.customer.service.dao.mapper.CustomerbaseMapper;
|
||||
import org.nl.wms.basedata.master.customer.service.dao.mapper.CustomerbaseProcMapper;
|
||||
import org.nl.wms.ext.crm.service.CrmToLmsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -20,69 +25,59 @@ import java.util.HashMap;
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class CrmToLmsServiceImpl implements CrmToLmsService {
|
||||
|
||||
@Autowired
|
||||
private CustomerbaseMapper customerbaseMapper;
|
||||
|
||||
@Autowired
|
||||
private CustomerbaseProcMapper customerbaseProcMapper;
|
||||
@Override
|
||||
public JSONObject getCustomerInfo(JSONObject row) {
|
||||
|
||||
String customer_name = row.getString("CustomerName");
|
||||
String description = row.getString("Description");
|
||||
String company = row.getString("Company");
|
||||
String country = row.getString("Country");
|
||||
String state = row.getString("State");
|
||||
String city = row.getString("City");
|
||||
String address_line1 = row.getString("AddressLine1");
|
||||
String zip_code = row.getString("ZipCode");
|
||||
String phone_number = row.getString("PhoneNumber");
|
||||
String fax_number = row.getString("FaxNumber");
|
||||
String web_site = row.getString("WebSite");
|
||||
String notes = row.getString("Notes");
|
||||
String sales_owner = row.getString("SalesOwner");
|
||||
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
jo.put("customer_name", customer_name);
|
||||
jo.put("description", description);
|
||||
jo.put("company", company);
|
||||
jo.put("country", country);
|
||||
jo.put("state", state);
|
||||
jo.put("city", city);
|
||||
jo.put("address_line1", address_line1);
|
||||
jo.put("zip_code", zip_code);
|
||||
jo.put("phone_number", phone_number);
|
||||
jo.put("fax_number", fax_number);
|
||||
jo.put("web_site", web_site);
|
||||
jo.put("notes", notes);
|
||||
jo.put("sales_owner", sales_owner);
|
||||
WQLObject.getWQLObject("MD_CS_CustomerBaseProc").insert(jo);
|
||||
log.info(jo.toString());
|
||||
|
||||
//插入客户表
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
JSONObject customer_jo = WQLObject.getWQLObject("md_cs_customerbase").query("cust_code = '" + customer_name + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(customer_jo)) {
|
||||
customer_jo = new JSONObject();
|
||||
customer_jo.put("cust_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
customer_jo.put("cust_code", customer_name);
|
||||
customer_jo.put("cust_name", description);
|
||||
customer_jo.put("cust_simple_name", company);
|
||||
customer_jo.put("sales_owner", sales_owner);
|
||||
customer_jo.put("create_id", currentUserId);
|
||||
customer_jo.put("create_name", nickName);
|
||||
customer_jo.put("create_time", now);
|
||||
customer_jo.put("update_optid", currentUserId);
|
||||
customer_jo.put("update_optname", nickName);
|
||||
customer_jo.put("update_time", now);
|
||||
WQLObject.getWQLObject("md_cs_customerbase").insert(customer_jo);
|
||||
CustomerbaseProc customerbaseProc = new CustomerbaseProc();
|
||||
customerbaseProc.copyFrom(row);
|
||||
JSONObject jo = new JSONObject();
|
||||
customerbaseProc.setId(IdUtil.getSnowflake(1, 1).nextId()+"");
|
||||
customerbaseProc.setCreate_time(now);
|
||||
customerbaseProcMapper.insert(customerbaseProc);
|
||||
log.info(customerbaseProc.toString());
|
||||
|
||||
|
||||
LambdaQueryWrapper<Customerbase> lam = new LambdaQueryWrapper<Customerbase>();
|
||||
lam.eq(Customerbase::getCust_code,customer_name);
|
||||
lam.eq(Customerbase::getIs_delete,"0");
|
||||
Customerbase customer = customerbaseMapper.selectOne(lam);
|
||||
|
||||
if (ObjectUtil.isEmpty(customer)) {
|
||||
customer = new Customerbase();
|
||||
customer.setCust_id(IdUtil.getSnowflake(1, 1).nextId()+"");
|
||||
customer.setCust_code(customer_name);
|
||||
customer.setCust_name(description);
|
||||
customer.setCust_simple_name(company);
|
||||
customer.setSales_owner(sales_owner);
|
||||
customer.setCreate_id(currentUserId);
|
||||
customer.setCreate_name(nickName);
|
||||
customer.setCreate_time(now);
|
||||
customerbaseMapper.insert(customer);
|
||||
} else {
|
||||
customer_jo.put("cust_name", description);
|
||||
customer_jo.put("cust_simple_name", company);
|
||||
customer_jo.put("sales_owner", sales_owner);
|
||||
customer_jo.put("update_optid", currentUserId);
|
||||
customer_jo.put("update_optname", nickName);
|
||||
customer_jo.put("update_time", now);
|
||||
WQLObject.getWQLObject("md_cs_customerbase").update(customer_jo);
|
||||
customer.setCust_name(description);
|
||||
customer.setCust_simple_name(company);
|
||||
customer.setSales_owner(sales_owner);
|
||||
customer.setUpdate_id(currentUserId);
|
||||
customer.setUpdate_name(nickName);
|
||||
customer.setUpdate_time(now);
|
||||
customerbaseMapper.updateById(customer);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import org.nl.b_lms.pdm.info.dao.PdmBiContainerinfo;
|
||||
import org.nl.b_lms.pdm.info.dao.PdmBiOrderbominfo;
|
||||
import org.nl.b_lms.pdm.info.service.IPdmBiContainerinfoService;
|
||||
import org.nl.b_lms.pdm.info.service.IPdmBiOrderbominfoService;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.service.IpdmBiSubpackagerelationService;
|
||||
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
|
||||
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
|
||||
@@ -44,12 +43,13 @@ import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
import org.nl.wms.basedata.master.customer.service.dao.Customerbase;
|
||||
import org.nl.wms.basedata.master.customer.service.dao.mapper.CustomerbaseMapper;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.ext.mes.service.MesToLmsService;
|
||||
import org.nl.wms.pda.mps.service.InService;
|
||||
import org.nl.wms.pda.mps.service.OutService;
|
||||
import org.nl.wms.pda.mps.service.impl.BakingServiceImpl;
|
||||
import org.nl.wms.pdm.bi.service.dto.SubpackagerelationDto;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.tasks.CoolCutTask;
|
||||
import org.nl.wms.st.inbill.service.CheckOutBillService;
|
||||
@@ -96,10 +96,10 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
private IbstIvtPackageinfoivtService packageinfoivtService;
|
||||
|
||||
@Autowired
|
||||
private IpdmBiSubpackagerelationService subpackagerelationService;
|
||||
private SlitterService slitterService;
|
||||
|
||||
@Autowired
|
||||
private SlitterService slitterService;
|
||||
private CustomerbaseMapper customerbaseMapper;
|
||||
|
||||
|
||||
/**
|
||||
@@ -1502,11 +1502,15 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
change_jo.put("demand_date", DemandDate);
|
||||
change_jo.put("customer_name", CustomerName);
|
||||
//查询对应的客户
|
||||
JSONObject customer_jo = WQLObject.getWQLObject("md_cs_customerbase").query("cust_code = '" + CustomerName + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(customer_jo)) {
|
||||
LambdaQueryWrapper<Customerbase> lam = new LambdaQueryWrapper<Customerbase>();
|
||||
lam.eq(Customerbase::getCust_code,CustomerName);
|
||||
lam.eq(Customerbase::getIs_delete,"0");
|
||||
Customerbase customer = customerbaseMapper.selectOne(lam);
|
||||
|
||||
if (ObjectUtil.isEmpty(customer)) {
|
||||
throw new BadRequestException("客户不存在:" + CustomerName);
|
||||
}
|
||||
change_jo.put("customer_description", customer_jo.getString("cust_name"));
|
||||
change_jo.put("customer_description", customer.getCust_name());
|
||||
change_jo.put("isRePrintPackageBoxLabel", isRePrintPackageBoxLabel);
|
||||
change_jo.put("isUnPackBox", isUnPackBox);
|
||||
change_jo.put("UpdatedDateOfProduction", UpdatedDateOfProduction);
|
||||
|
||||
@@ -5,12 +5,16 @@ import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.basedata.master.customer.service.dao.Customerbase;
|
||||
import org.nl.wms.basedata.master.customer.service.dao.mapper.CustomerbaseMapper;
|
||||
import org.nl.wms.pda.st.service.PrintService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.*;
|
||||
@@ -26,6 +30,9 @@ import java.util.HashMap;
|
||||
@Slf4j
|
||||
public class PrintServiceImpl implements PrintService {
|
||||
|
||||
@Autowired
|
||||
private CustomerbaseMapper customerbaseMapper;
|
||||
|
||||
@Override
|
||||
public JSONObject customerInfo(JSONObject whereJson) {
|
||||
String box_no = whereJson.getString("box_no");
|
||||
@@ -40,7 +47,6 @@ public class PrintServiceImpl implements PrintService {
|
||||
public JSONObject customerPrint(JSONObject whereJson) {
|
||||
JSONObject jo = new JSONObject();
|
||||
WQLObject printTab = WQLObject.getWQLObject("pdm_bi_printinfo");
|
||||
WQLObject custTab = WQLObject.getWQLObject("md_cs_customerbase");
|
||||
WQLObject subTab = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
|
||||
|
||||
String box_no = whereJson.getString("box_no");
|
||||
@@ -97,15 +103,19 @@ public class PrintServiceImpl implements PrintService {
|
||||
String storage_conditions = "";
|
||||
|
||||
// 根据客户条件选择对应模板
|
||||
JSONObject jsonCust = custTab.query("cust_code = '" + box_jo.getString("customer_name") + "' and is_delete = '0' and is_used = '1'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonCust)) {
|
||||
LambdaQueryWrapper<Customerbase> lam = new LambdaQueryWrapper<Customerbase>();
|
||||
lam.eq(Customerbase::getCust_code,box_jo.getString("customer_name"));
|
||||
lam.eq(Customerbase::getIs_delete,"0");
|
||||
lam.eq(Customerbase::getIs_used,"1");
|
||||
Customerbase customer = customerbaseMapper.selectOne(lam);
|
||||
if (ObjectUtil.isEmpty(customer)) {
|
||||
throw new BadRequestException("客户不存在或未启用");
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(jsonCust.getString("bz_print_no"))) {
|
||||
String bz_print_no = customer.getBz_print_no();
|
||||
if (ObjectUtil.isEmpty(bz_print_no)) {
|
||||
throw new BadRequestException("请先设置客户打印模板");
|
||||
}
|
||||
String bz_print_no = jsonCust.getString("bz_print_no");
|
||||
|
||||
double weight = 0;
|
||||
JSONArray rows = WQL.getWO("PDA_ST_01").addParam("flag", "5").addParam("box_no", box_no).process().getResultJSONArray(0);
|
||||
@@ -181,7 +191,6 @@ public class PrintServiceImpl implements PrintService {
|
||||
public JSONObject customerPrint2(JSONObject whereJson) {
|
||||
JSONObject jo = new JSONObject();
|
||||
WQLObject printTab = WQLObject.getWQLObject("pdm_bi_printinfo");
|
||||
WQLObject custTab = WQLObject.getWQLObject("md_cs_customerbase");
|
||||
WQLObject subTab = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
|
||||
|
||||
String box_no = whereJson.getString("box_no");
|
||||
@@ -243,15 +252,19 @@ public class PrintServiceImpl implements PrintService {
|
||||
String storage_conditions = "";
|
||||
|
||||
// 根据客户条件选择对应模板
|
||||
JSONObject jsonCust = custTab.query("cust_code = '" + box_jo.getString("customer_name") + "' and is_delete = '0' and is_used = '1'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonCust)) {
|
||||
LambdaQueryWrapper<Customerbase> lam = new LambdaQueryWrapper<Customerbase>();
|
||||
lam.eq(Customerbase::getCust_code,box_jo.getString("customer_name"));
|
||||
lam.eq(Customerbase::getIs_delete,"0");
|
||||
lam.eq(Customerbase::getIs_used,"1");
|
||||
Customerbase customer = customerbaseMapper.selectOne(lam);
|
||||
if (ObjectUtil.isEmpty(customer)) {
|
||||
throw new BadRequestException("客户不存在或未启用");
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(jsonCust.getString("bz_print_no"))) {
|
||||
String bz_print_no = customer.getBz_print_no();
|
||||
if (ObjectUtil.isEmpty(bz_print_no)) {
|
||||
throw new BadRequestException("请先设置客户打印模板");
|
||||
}
|
||||
String bz_print_no = jsonCust.getString("bz_print_no");
|
||||
|
||||
|
||||
double weight = 0;
|
||||
JSONArray rows = WQL.getWO("PDA_ST_01").addParam("flag", "5").addParam("box_no", box_no).process().getResultJSONArray(0);
|
||||
|
||||
@@ -7,6 +7,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
@@ -15,11 +16,14 @@ import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.wms.basedata.master.customer.service.dao.Customerbase;
|
||||
import org.nl.wms.basedata.master.customer.service.dao.mapper.CustomerbaseMapper;
|
||||
import org.nl.wms.basedata.st.service.impl.UserStorServiceImpl;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.nl.wms.st.inbill.service.StorPublicService;
|
||||
import org.nl.wms.st.instor.service.ChangeService;
|
||||
import org.nl.wms.st.instor.task.HandMoveStorAcsTask;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -37,6 +41,9 @@ import java.util.Map;
|
||||
public class ChangeServiceImpl implements ChangeService {
|
||||
private final StorPublicService storPublicService;
|
||||
|
||||
@Autowired
|
||||
private CustomerbaseMapper customerbaseMapper;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> pageQuery(Map whereJson, Pageable page) {
|
||||
HashMap<String, String> map = new HashMap<>(whereJson);
|
||||
@@ -194,11 +201,14 @@ public class ChangeServiceImpl implements ChangeService {
|
||||
change_jo.put("demand_date", DemandDate);
|
||||
change_jo.put("customer_name", CustomerName);
|
||||
//查询对应的客户
|
||||
JSONObject customer_jo = WQLObject.getWQLObject("md_cs_customerbase").query("cust_code = '" + CustomerName + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(customer_jo)) {
|
||||
LambdaQueryWrapper<Customerbase> lam = new LambdaQueryWrapper<Customerbase>();
|
||||
lam.eq(Customerbase::getCust_code,CustomerName);
|
||||
lam.eq(Customerbase::getIs_delete,"0");
|
||||
Customerbase customer = customerbaseMapper.selectOne(lam);
|
||||
if (ObjectUtil.isEmpty(customer)) {
|
||||
throw new BadRequestException("未查询到对应客户编码为:" + CustomerName);
|
||||
}
|
||||
change_jo.put("customer_description", customer_jo.getString("cust_name"));
|
||||
change_jo.put("customer_description", customer.getCust_name());
|
||||
change_jo.put("isRePrintPackageBoxLabel", isRePrintPackageBoxLabel);
|
||||
change_jo.put("isUnPackBox", isUnPackBox);
|
||||
change_jo.put("UpdatedDateOfProduction", UpdatedDateOfProduction);
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.alibaba.excel.write.metadata.WriteSheet;
|
||||
import com.alibaba.excel.write.metadata.fill.FillWrapper;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
@@ -25,6 +26,8 @@ import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
import org.nl.wms.basedata.master.customer.service.dao.Customerbase;
|
||||
import org.nl.wms.basedata.master.customer.service.dao.mapper.CustomerbaseMapper;
|
||||
import org.nl.wms.basedata.st.service.impl.UserStorServiceImpl;
|
||||
import org.nl.wms.pda.mps.eum.RegionTypeEnum;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
@@ -39,6 +42,7 @@ import org.nl.wms.st.outbill.util.ThreadManage;
|
||||
import org.nl.wms.st.returns.service.InAndOutReturnService;
|
||||
import org.nl.wms.st.returns.service.impl.InAndOutRetrunServiceImpl;
|
||||
import org.nl.wms.util.TranUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -67,6 +71,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
private final OutTask outTask;
|
||||
private final HandMoveStorAcsTask moveStorAcsTask;
|
||||
private final InAndOutReturnService inAndOutReturnService;
|
||||
@Autowired
|
||||
private CustomerbaseMapper customerbaseMapper;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> pageQuery(Map whereJson, Pageable page, String[] stor_id, String[] bill_status, String[] bill_type) {
|
||||
@@ -5979,7 +5985,6 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void downloadExcel(HttpServletResponse response, Map whereJson) throws IOException {
|
||||
|
||||
WQLObject custTab = WQLObject.getWQLObject("MD_CS_CustomerBase"); // 客户基本信息表
|
||||
WQLObject mstTab = WQLObject.getWQLObject("ST_IVT_IOStorInv"); // 出入库主表
|
||||
WQLObject dtlTab = WQLObject.getWQLObject("st_ivt_iostorinvdtl"); // 出入库明细表
|
||||
WQLObject disTab = WQLObject.getWQLObject("st_ivt_iostorinvdis"); // 出入库分配明细
|
||||
@@ -5991,7 +5996,11 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
JSONObject jsonMst = mstTab.query("iostorinv_id = '" + MapUtil.getStr(whereJson, "iostorinv_id") + "'").uniqueResult(0);
|
||||
String cust_code = jsonMst.getString("cust_code");
|
||||
|
||||
JSONObject jsonCust = custTab.query("cust_code = '" + cust_code + "'").uniqueResult(0);
|
||||
//查询客户信息
|
||||
LambdaQueryWrapper<Customerbase> lam = new LambdaQueryWrapper<Customerbase>();
|
||||
lam.eq(Customerbase::getCust_code,cust_code);
|
||||
lam.eq(Customerbase::getIs_delete,"0");
|
||||
Customerbase jsonCust = customerbaseMapper.selectOne(lam);
|
||||
String bill_type = jsonMst.getString("bill_type");
|
||||
|
||||
int j = Integer.parseInt((String) whereJson.get("j"));
|
||||
@@ -6057,9 +6066,9 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
code_template = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("PRINT_TEMPLE").getValue();
|
||||
|
||||
} else {
|
||||
shd_dtl_num = jsonCust.getIntValue("shd_dtl_num");
|
||||
shd_dtl_num = jsonCust.getShd_dtl_num();
|
||||
//1.根据出入库主表中 收货单位 查询客户表中的模板路径
|
||||
code_template = jsonCust.getString("shd_print_no");
|
||||
code_template = jsonCust.getShd_print_no();
|
||||
}
|
||||
|
||||
JSONObject jsonDtl = dtlTab.query("iostorinv_id = '" + jsonMst.getString("iostorinv_id") + "'").uniqueResult(0);
|
||||
|
||||
Reference in New Issue
Block a user