优化序列号模块
This commit is contained in:
parent
89565ec769
commit
f1b119a6a9
@ -1255,4 +1255,13 @@ INSERT INTO `jsh_platform_config` (`platform_key`, `platform_key_info`, `platfor
|
||||
-- by jishenghua
|
||||
-- 给序列号表增加仓库id
|
||||
-- --------------------------------------------------------
|
||||
alter table jsh_serial_number add depot_id bigint(20) DEFAULT NULL COMMENT '仓库id' after material_Id;
|
||||
alter table jsh_serial_number add depot_id bigint(20) DEFAULT NULL COMMENT '仓库id' after material_Id;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
-- 时间 2021年10月4日
|
||||
-- by jishenghua
|
||||
-- 给序列号表增加入库单号和出库单号字段,另外去掉单据id字段
|
||||
-- --------------------------------------------------------
|
||||
alter table jsh_serial_number add in_bill_no varchar(50) DEFAULT NULL COMMENT '入库单号' after updater;
|
||||
alter table jsh_serial_number add out_bill_no varchar(50) DEFAULT NULL COMMENT '出库单号' after in_bill_no;
|
||||
alter table jsh_serial_number drop column depot_head_id;
|
||||
@ -36,29 +36,6 @@ public class SerialNumberController {
|
||||
|
||||
@Resource
|
||||
private SerialNumberService serialNumberService;
|
||||
/**
|
||||
* create by: cjl
|
||||
* description:
|
||||
* 检查序列号是否存在
|
||||
* create time: 2019/1/22 11:02
|
||||
* @Param: id
|
||||
* @Param: materialName
|
||||
* @Param: serialNumber
|
||||
* @Param: request
|
||||
* @return java.lang.Object
|
||||
*/
|
||||
@PostMapping("/serialNumber/checkIsExist")
|
||||
@ResponseBody
|
||||
public Object checkIsExist(@RequestParam("id") Long id, @RequestParam("materialName") String materialName,
|
||||
@RequestParam("serialNumber") String serialNumber, HttpServletRequest request) throws Exception{
|
||||
JSONObject result = ExceptionConstants.standardSuccess();
|
||||
if(StringUtil.isEmpty(serialNumber)){
|
||||
throw new BusinessParamCheckingException(ExceptionConstants.SERIAL_NUMBERE_NOT_BE_EMPTY_CODE,
|
||||
ExceptionConstants.SERIAL_NUMBERE_NOT_BE_EMPTY_MSG);
|
||||
}
|
||||
serialNumberService.checkIsExist(id, materialName, serialNumber);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* create by: cjl
|
||||
|
||||
@ -25,7 +25,9 @@ public class SerialNumber {
|
||||
|
||||
private Long updater;
|
||||
|
||||
private Long depotHeadId;
|
||||
private String inBillNo;
|
||||
|
||||
private String outBillNo;
|
||||
|
||||
private Long tenantId;
|
||||
|
||||
@ -117,12 +119,20 @@ public class SerialNumber {
|
||||
this.updater = updater;
|
||||
}
|
||||
|
||||
public Long getDepotHeadId() {
|
||||
return depotHeadId;
|
||||
public String getInBillNo() {
|
||||
return inBillNo;
|
||||
}
|
||||
|
||||
public void setDepotHeadId(Long depotHeadId) {
|
||||
this.depotHeadId = depotHeadId;
|
||||
public void setInBillNo(String inBillNo) {
|
||||
this.inBillNo = inBillNo == null ? null : inBillNo.trim();
|
||||
}
|
||||
|
||||
public String getOutBillNo() {
|
||||
return outBillNo;
|
||||
}
|
||||
|
||||
public void setOutBillNo(String outBillNo) {
|
||||
this.outBillNo = outBillNo == null ? null : outBillNo.trim();
|
||||
}
|
||||
|
||||
public Long getTenantId() {
|
||||
|
||||
@ -805,63 +805,143 @@ public class SerialNumberExample {
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepotHeadIdIsNull() {
|
||||
addCriterion("depot_head_id is null");
|
||||
public Criteria andInBillNoIsNull() {
|
||||
addCriterion("in_bill_no is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepotHeadIdIsNotNull() {
|
||||
addCriterion("depot_head_id is not null");
|
||||
public Criteria andInBillNoIsNotNull() {
|
||||
addCriterion("in_bill_no is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepotHeadIdEqualTo(Long value) {
|
||||
addCriterion("depot_head_id =", value, "depotHeadId");
|
||||
public Criteria andInBillNoEqualTo(String value) {
|
||||
addCriterion("in_bill_no =", value, "inBillNo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepotHeadIdNotEqualTo(Long value) {
|
||||
addCriterion("depot_head_id <>", value, "depotHeadId");
|
||||
public Criteria andInBillNoNotEqualTo(String value) {
|
||||
addCriterion("in_bill_no <>", value, "inBillNo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepotHeadIdGreaterThan(Long value) {
|
||||
addCriterion("depot_head_id >", value, "depotHeadId");
|
||||
public Criteria andInBillNoGreaterThan(String value) {
|
||||
addCriterion("in_bill_no >", value, "inBillNo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepotHeadIdGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("depot_head_id >=", value, "depotHeadId");
|
||||
public Criteria andInBillNoGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("in_bill_no >=", value, "inBillNo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepotHeadIdLessThan(Long value) {
|
||||
addCriterion("depot_head_id <", value, "depotHeadId");
|
||||
public Criteria andInBillNoLessThan(String value) {
|
||||
addCriterion("in_bill_no <", value, "inBillNo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepotHeadIdLessThanOrEqualTo(Long value) {
|
||||
addCriterion("depot_head_id <=", value, "depotHeadId");
|
||||
public Criteria andInBillNoLessThanOrEqualTo(String value) {
|
||||
addCriterion("in_bill_no <=", value, "inBillNo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepotHeadIdIn(List<Long> values) {
|
||||
addCriterion("depot_head_id in", values, "depotHeadId");
|
||||
public Criteria andInBillNoLike(String value) {
|
||||
addCriterion("in_bill_no like", value, "inBillNo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepotHeadIdNotIn(List<Long> values) {
|
||||
addCriterion("depot_head_id not in", values, "depotHeadId");
|
||||
public Criteria andInBillNoNotLike(String value) {
|
||||
addCriterion("in_bill_no not like", value, "inBillNo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepotHeadIdBetween(Long value1, Long value2) {
|
||||
addCriterion("depot_head_id between", value1, value2, "depotHeadId");
|
||||
public Criteria andInBillNoIn(List<String> values) {
|
||||
addCriterion("in_bill_no in", values, "inBillNo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepotHeadIdNotBetween(Long value1, Long value2) {
|
||||
addCriterion("depot_head_id not between", value1, value2, "depotHeadId");
|
||||
public Criteria andInBillNoNotIn(List<String> values) {
|
||||
addCriterion("in_bill_no not in", values, "inBillNo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInBillNoBetween(String value1, String value2) {
|
||||
addCriterion("in_bill_no between", value1, value2, "inBillNo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInBillNoNotBetween(String value1, String value2) {
|
||||
addCriterion("in_bill_no not between", value1, value2, "inBillNo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOutBillNoIsNull() {
|
||||
addCriterion("out_bill_no is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOutBillNoIsNotNull() {
|
||||
addCriterion("out_bill_no is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOutBillNoEqualTo(String value) {
|
||||
addCriterion("out_bill_no =", value, "outBillNo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOutBillNoNotEqualTo(String value) {
|
||||
addCriterion("out_bill_no <>", value, "outBillNo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOutBillNoGreaterThan(String value) {
|
||||
addCriterion("out_bill_no >", value, "outBillNo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOutBillNoGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("out_bill_no >=", value, "outBillNo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOutBillNoLessThan(String value) {
|
||||
addCriterion("out_bill_no <", value, "outBillNo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOutBillNoLessThanOrEqualTo(String value) {
|
||||
addCriterion("out_bill_no <=", value, "outBillNo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOutBillNoLike(String value) {
|
||||
addCriterion("out_bill_no like", value, "outBillNo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOutBillNoNotLike(String value) {
|
||||
addCriterion("out_bill_no not like", value, "outBillNo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOutBillNoIn(List<String> values) {
|
||||
addCriterion("out_bill_no in", values, "outBillNo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOutBillNoNotIn(List<String> values) {
|
||||
addCriterion("out_bill_no not in", values, "outBillNo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOutBillNoBetween(String value1, String value2) {
|
||||
addCriterion("out_bill_no between", value1, value2, "outBillNo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOutBillNoNotBetween(String value1, String value2) {
|
||||
addCriterion("out_bill_no not between", value1, value2, "outBillNo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
|
||||
@ -14,22 +14,6 @@ import java.util.List;
|
||||
* @Date: 2019/1/21 17:09
|
||||
*/
|
||||
public interface SerialNumberMapperEx {
|
||||
/**
|
||||
* 根据条件查询序列号列表
|
||||
* */
|
||||
List<SerialNumberEx> selectByConditionSerialNumber(@Param("serialNumber") String serialNumber, @Param("materialName") String materialName,@Param("offset") Integer offset,@Param("rows") Integer rows);
|
||||
/**
|
||||
* 根据条件查询序列号数量
|
||||
* */
|
||||
Long countSerialNumber(@Param("serialNumber")String serialNumber,@Param("materialName")String materialName);
|
||||
/**
|
||||
* 通过id查询序列号复合信息
|
||||
* */
|
||||
List<SerialNumberEx> findById(Long id);
|
||||
/**
|
||||
* 通过序列号查询序列号实体信息
|
||||
* */
|
||||
List<SerialNumberEx> findBySerialNumber(@Param("serialNumber") String serialNumber);
|
||||
/**
|
||||
* 新增序列号信息
|
||||
* */
|
||||
@ -43,20 +27,16 @@ public interface SerialNumberMapperEx {
|
||||
* 未删除为卖出的视为有效
|
||||
* */
|
||||
int findSerialNumberByMaterialId(@Param("materialId") Long materialId);
|
||||
/**
|
||||
* 查询符合条件的序列号数量
|
||||
* */
|
||||
int countSerialNumberByMaterialIdAndDepotheadId(@Param("materialId")Long materialId, @Param("depotHeadId")Long depotHeadId, @Param("isSell")String isSell);
|
||||
/**
|
||||
* 卖出: update jsh_serial_number set is_Sell='1' ,depothead_Id='depotheadId' where 1=1 and material_Id='materialId'
|
||||
* and is_Sell !='1' and delete_Flag !='1' {limit 0,count}
|
||||
* */
|
||||
int sellSerialNumber(@Param("materialId")Long materialId, @Param("depotHeadId")Long depotHeadId, @Param("snArray") String snArray[], @Param("updateTime") Date updateTime,@Param("updater") Long updater);
|
||||
int sellSerialNumber(@Param("materialId")Long materialId, @Param("outBillNo")String outBillNo, @Param("snArray") String snArray[], @Param("updateTime") Date updateTime,@Param("updater") Long updater);
|
||||
/**
|
||||
* 赎回:update jsh_serial_number set is_Sell='0',depothead_Id=null where 1=1 and material_Id='materialId'
|
||||
* and depothead_Id='depotheadId' and is_Sell !='0' and delete_Flag !='1' {limit 0,count}
|
||||
* */
|
||||
int cancelSerialNumber(@Param("materialId")Long materialId, @Param("depotHeadId")Long depotHeadId, @Param("count")Integer count, @Param("updateTime") Date updateTime,@Param("updater") Long updater);
|
||||
int cancelSerialNumber(@Param("materialId")Long materialId, @Param("outBillNo")String outBillNo, @Param("count")Integer count, @Param("updateTime") Date updateTime,@Param("updater") Long updater);
|
||||
/**
|
||||
* 批量添加序列号
|
||||
* */
|
||||
|
||||
@ -25,6 +25,8 @@ public class DepotHeadVo4List extends DepotHead{
|
||||
|
||||
private BigDecimal finishDebt;
|
||||
|
||||
private String depotHeadType;
|
||||
|
||||
public String getProjectName() {
|
||||
return projectName;
|
||||
}
|
||||
@ -96,4 +98,12 @@ public class DepotHeadVo4List extends DepotHead{
|
||||
public void setFinishDebt(BigDecimal finishDebt) {
|
||||
this.finishDebt = finishDebt;
|
||||
}
|
||||
|
||||
public String getDepotHeadType() {
|
||||
return depotHeadType;
|
||||
}
|
||||
|
||||
public void setDepotHeadType(String depotHeadType) {
|
||||
this.depotHeadType = depotHeadType;
|
||||
}
|
||||
}
|
||||
@ -286,7 +286,7 @@ public class DepotHeadService {
|
||||
if (depotItemList != null && depotItemList.size() > 0) {
|
||||
for (DepotItem depotItem : depotItemList) {
|
||||
//BasicNumber=OperNumber*ratio
|
||||
serialNumberService.cancelSerialNumber(depotItem.getMaterialId(), depotItem.getHeaderId(), (depotItem.getBasicNumber() == null ? 0 : depotItem.getBasicNumber()).intValue(), userInfo);
|
||||
serialNumberService.cancelSerialNumber(depotItem.getMaterialId(), depotHead.getNumber(), (depotItem.getBasicNumber() == null ? 0 : depotItem.getBasicNumber()).intValue(), userInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -314,7 +314,7 @@ public class DepotItemService {
|
||||
continue;
|
||||
}
|
||||
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableSerialNumber())){
|
||||
serialNumberService.cancelSerialNumber(depotItem.getMaterialId(),depotItem.getHeaderId(),
|
||||
serialNumberService.cancelSerialNumber(depotItem.getMaterialId(),depotHead.getNumber(),
|
||||
(depotItem.getBasicNumber()==null?0:depotItem.getBasicNumber()).intValue(), userInfo);
|
||||
}
|
||||
}
|
||||
@ -340,7 +340,7 @@ public class DepotItemService {
|
||||
Long depotId = rowObj.getLong("depotId");
|
||||
if(BusinessConstants.SUB_TYPE_PURCHASE.equals(depotHead.getSubType())||
|
||||
BusinessConstants.SUB_TYPE_SALES_RETURN.equals(depotHead.getSubType())) {
|
||||
serialNumberService.addSerialNumberByBill(materialExtend.getMaterialId(), depotId, depotItem.getSnList());
|
||||
serialNumberService.addSerialNumberByBill(depotHead.getNumber(), materialExtend.getMaterialId(), depotId, depotItem.getSnList());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -450,7 +450,7 @@ public class DepotItemService {
|
||||
//判断商品是否开启序列号,开启的收回序列号,未开启的跳过
|
||||
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableSerialNumber())) {
|
||||
//查询单据子表中开启序列号的数据列表
|
||||
serialNumberService.checkAndUpdateSerialNumber(depotItem, userInfo, StringUtil.toNull(depotItem.getSnList()));
|
||||
serialNumberService.checkAndUpdateSerialNumber(depotItem, depotHead.getNumber(), userInfo, StringUtil.toNull(depotItem.getSnList()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,24 +86,12 @@ public class SerialNumberService {
|
||||
}
|
||||
|
||||
public List<SerialNumberEx> select(String serialNumber, String materialName, Integer offset, Integer rows)throws Exception {
|
||||
List<SerialNumberEx> list=null;
|
||||
try{
|
||||
list=serialNumberMapperEx.selectByConditionSerialNumber(serialNumber, materialName,offset, rows);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return list;
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public Long countSerialNumber(String serialNumber,String materialName)throws Exception {
|
||||
Long result=null;
|
||||
try{
|
||||
result=serialNumberMapperEx.countSerialNumber(serialNumber, materialName);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
@ -201,72 +189,6 @@ public class SerialNumberService {
|
||||
}
|
||||
return list==null?0:list.size();
|
||||
}
|
||||
|
||||
public List<SerialNumberEx> findById(Long id)throws Exception{
|
||||
List<SerialNumberEx> list=null;
|
||||
try{
|
||||
list=serialNumberMapperEx.findById(id);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public void checkIsExist(Long id, String materialName, String serialNumber) throws Exception{
|
||||
/**
|
||||
* 商品名称不为空时,检查商品名称是否存在
|
||||
* */
|
||||
if(StringUtil.isNotEmpty(materialName)){
|
||||
List<Material> mlist=null;
|
||||
try{
|
||||
mlist = materialMapperEx.findByMaterialName(materialName);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
|
||||
if(mlist==null||mlist.size()<1){
|
||||
//商品名称不存在
|
||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_NOT_EXISTS_CODE,
|
||||
ExceptionConstants.MATERIAL_NOT_EXISTS_MSG);
|
||||
}else if(mlist.size()>1){
|
||||
//商品信息不唯一
|
||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_NOT_ONLY_CODE,
|
||||
ExceptionConstants.MATERIAL_NOT_ONLY_MSG);
|
||||
|
||||
}
|
||||
}
|
||||
/***
|
||||
* 判断序列号是否已存在
|
||||
* */
|
||||
List <SerialNumberEx> list=null;
|
||||
try{
|
||||
list = serialNumberMapperEx.findBySerialNumber(serialNumber);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
if(list!=null&&list.size()>0){
|
||||
if(list.size()>1){
|
||||
//存在多个同名序列号
|
||||
throw new BusinessRunTimeException(ExceptionConstants.SERIAL_NUMBERE_ALREADY_EXISTS_CODE,
|
||||
ExceptionConstants.SERIAL_NUMBERE_ALREADY_EXISTS_MSG);
|
||||
}else{
|
||||
//存在一个序列号
|
||||
if(id==null){
|
||||
//新增,存在要添加的序列号
|
||||
throw new BusinessRunTimeException(ExceptionConstants.SERIAL_NUMBERE_ALREADY_EXISTS_CODE,
|
||||
ExceptionConstants.SERIAL_NUMBERE_ALREADY_EXISTS_MSG);
|
||||
}
|
||||
if(id.equals(list.get(0).getId())){
|
||||
//修改的是同一条数据
|
||||
}else{
|
||||
//存在一条不同的序列号信息
|
||||
throw new BusinessRunTimeException(ExceptionConstants.SERIAL_NUMBERE_ALREADY_EXISTS_CODE,
|
||||
ExceptionConstants.SERIAL_NUMBERE_ALREADY_EXISTS_MSG);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* create by: cjl
|
||||
* description:
|
||||
@ -341,9 +263,9 @@ public class SerialNumberService {
|
||||
* @Param: List<DepotItem>
|
||||
* @return void
|
||||
*/
|
||||
public void checkAndUpdateSerialNumber(DepotItem depotItem,User userInfo, String snList) throws Exception{
|
||||
public void checkAndUpdateSerialNumber(DepotItem depotItem, String outBillNo,User userInfo, String snList) throws Exception{
|
||||
if(depotItem!=null){
|
||||
sellSerialNumber(depotItem.getMaterialId(),depotItem.getHeaderId(), snList,userInfo);
|
||||
sellSerialNumber(depotItem.getMaterialId(), outBillNo, snList,userInfo);
|
||||
}
|
||||
}
|
||||
/**
|
||||
@ -362,11 +284,11 @@ public class SerialNumberService {
|
||||
* @return com.jsh.erp.datasource.entities.SerialNumberEx
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int sellSerialNumber(Long materialId, Long depotHeadId, String snList, User user) throws Exception{
|
||||
public int sellSerialNumber(Long materialId, String outBillNo, String snList, User user) throws Exception{
|
||||
int result=0;
|
||||
try{
|
||||
String [] snArray=snList.split(",");
|
||||
result = serialNumberMapperEx.sellSerialNumber(materialId, depotHeadId, snArray, new Date(),user==null?null:user.getId());
|
||||
result = serialNumberMapperEx.sellSerialNumber(materialId, outBillNo, snArray, new Date(),user==null?null:user.getId());
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
@ -385,10 +307,10 @@ public class SerialNumberService {
|
||||
* @return com.jsh.erp.datasource.entities.SerialNumberEx
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int cancelSerialNumber(Long materialId, Long depotHeadId,int count,User user) throws Exception{
|
||||
public int cancelSerialNumber(Long materialId, String outBillNo,int count,User user) throws Exception{
|
||||
int result=0;
|
||||
try{
|
||||
result = serialNumberMapperEx.cancelSerialNumber(materialId,depotHeadId,count,new Date(),user==null?null:user.getId());
|
||||
result = serialNumberMapperEx.cancelSerialNumber(materialId,outBillNo,count,new Date(),user==null?null:user.getId());
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
@ -470,7 +392,7 @@ public class SerialNumberService {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void addSerialNumberByBill(Long materialId, Long depotId, String snList) throws Exception {
|
||||
public void addSerialNumberByBill(String inBillNo, Long materialId, Long depotId, String snList) throws Exception {
|
||||
//将中文的逗号批量替换为英文逗号
|
||||
snList = snList.replaceAll(",",",");
|
||||
List<String> snArr = StringUtil.strToStringList(snList);
|
||||
@ -492,6 +414,7 @@ public class SerialNumberService {
|
||||
User userInfo = userService.getCurrentUser();
|
||||
serialNumber.setCreator(userInfo == null ? null : userInfo.getId());
|
||||
serialNumber.setUpdater(userInfo == null ? null : userInfo.getId());
|
||||
serialNumber.setInBillNo(inBillNo);
|
||||
serialNumberMapper.insertSelective(serialNumber);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
<mapper namespace="com.jsh.erp.datasource.mappers.DepotHeadMapperEx">
|
||||
|
||||
<resultMap extends="com.jsh.erp.datasource.mappers.DepotHeadMapper.BaseResultMap" id="ResultMapEx" type="com.jsh.erp.datasource.vo.DepotHeadVo4List">
|
||||
<result column="depotHeadType" jdbcType="VARCHAR" property="depotHeadType" />
|
||||
<result column="OrganName" jdbcType="VARCHAR" property="organName" />
|
||||
<result column="userName" jdbcType="VARCHAR" property="userName" />
|
||||
<result column="AccountName" jdbcType="VARCHAR" property="accountName" />
|
||||
@ -432,7 +433,7 @@
|
||||
</select>
|
||||
|
||||
<select id="getDetailByNumber" parameterType="com.jsh.erp.datasource.entities.DepotHeadExample" resultMap="ResultMapEx">
|
||||
select dh.*, s.supplier OrganName, a.name AccountName
|
||||
select dh.*, concat(dh.sub_type,dh.type) as depotHeadType, s.supplier OrganName, a.name AccountName
|
||||
from jsh_depot_head dh
|
||||
left join jsh_supplier s on dh.organ_id=s.id and ifnull(s.delete_Flag,'0') !='1'
|
||||
left join jsh_account a on dh.account_id=a.id and ifnull(a.delete_Flag,'0') !='1'
|
||||
|
||||
@ -13,7 +13,8 @@
|
||||
<result column="creator" jdbcType="BIGINT" property="creator" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="updater" jdbcType="BIGINT" property="updater" />
|
||||
<result column="depot_head_id" jdbcType="BIGINT" property="depotHeadId" />
|
||||
<result column="in_bill_no" jdbcType="VARCHAR" property="inBillNo" />
|
||||
<result column="out_bill_no" jdbcType="VARCHAR" property="outBillNo" />
|
||||
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
@ -76,7 +77,7 @@
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, material_id, depot_id, serial_number, is_sell, remark, delete_flag, create_time,
|
||||
creator, update_time, updater, depot_head_id, tenant_id
|
||||
creator, update_time, updater, in_bill_no, out_bill_no, tenant_id
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.SerialNumberExample" resultMap="BaseResultMap">
|
||||
select
|
||||
@ -112,13 +113,13 @@
|
||||
insert into jsh_serial_number (id, material_id, depot_id,
|
||||
serial_number, is_sell, remark,
|
||||
delete_flag, create_time, creator,
|
||||
update_time, updater, depot_head_id,
|
||||
tenant_id)
|
||||
update_time, updater, in_bill_no,
|
||||
out_bill_no, tenant_id)
|
||||
values (#{id,jdbcType=BIGINT}, #{materialId,jdbcType=BIGINT}, #{depotId,jdbcType=BIGINT},
|
||||
#{serialNumber,jdbcType=VARCHAR}, #{isSell,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
|
||||
#{deleteFlag,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{creator,jdbcType=BIGINT},
|
||||
#{updateTime,jdbcType=TIMESTAMP}, #{updater,jdbcType=BIGINT}, #{depotHeadId,jdbcType=BIGINT},
|
||||
#{tenantId,jdbcType=BIGINT})
|
||||
#{updateTime,jdbcType=TIMESTAMP}, #{updater,jdbcType=BIGINT}, #{inBillNo,jdbcType=VARCHAR},
|
||||
#{outBillNo,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.SerialNumber">
|
||||
insert into jsh_serial_number
|
||||
@ -156,8 +157,11 @@
|
||||
<if test="updater != null">
|
||||
updater,
|
||||
</if>
|
||||
<if test="depotHeadId != null">
|
||||
depot_head_id,
|
||||
<if test="inBillNo != null">
|
||||
in_bill_no,
|
||||
</if>
|
||||
<if test="outBillNo != null">
|
||||
out_bill_no,
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
tenant_id,
|
||||
@ -197,8 +201,11 @@
|
||||
<if test="updater != null">
|
||||
#{updater,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="depotHeadId != null">
|
||||
#{depotHeadId,jdbcType=BIGINT},
|
||||
<if test="inBillNo != null">
|
||||
#{inBillNo,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="outBillNo != null">
|
||||
#{outBillNo,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
#{tenantId,jdbcType=BIGINT},
|
||||
@ -247,8 +254,11 @@
|
||||
<if test="record.updater != null">
|
||||
updater = #{record.updater,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.depotHeadId != null">
|
||||
depot_head_id = #{record.depotHeadId,jdbcType=BIGINT},
|
||||
<if test="record.inBillNo != null">
|
||||
in_bill_no = #{record.inBillNo,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.outBillNo != null">
|
||||
out_bill_no = #{record.outBillNo,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.tenantId != null">
|
||||
tenant_id = #{record.tenantId,jdbcType=BIGINT},
|
||||
@ -271,7 +281,8 @@
|
||||
creator = #{record.creator,jdbcType=BIGINT},
|
||||
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
|
||||
updater = #{record.updater,jdbcType=BIGINT},
|
||||
depot_head_id = #{record.depotHeadId,jdbcType=BIGINT},
|
||||
in_bill_no = #{record.inBillNo,jdbcType=VARCHAR},
|
||||
out_bill_no = #{record.outBillNo,jdbcType=VARCHAR},
|
||||
tenant_id = #{record.tenantId,jdbcType=BIGINT}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
@ -310,8 +321,11 @@
|
||||
<if test="updater != null">
|
||||
updater = #{updater,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="depotHeadId != null">
|
||||
depot_head_id = #{depotHeadId,jdbcType=BIGINT},
|
||||
<if test="inBillNo != null">
|
||||
in_bill_no = #{inBillNo,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="outBillNo != null">
|
||||
out_bill_no = #{outBillNo,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
tenant_id = #{tenantId,jdbcType=BIGINT},
|
||||
@ -331,7 +345,8 @@
|
||||
creator = #{creator,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
updater = #{updater,jdbcType=BIGINT},
|
||||
depot_head_id = #{depotHeadId,jdbcType=BIGINT},
|
||||
in_bill_no = #{inBillNo,jdbcType=VARCHAR},
|
||||
out_bill_no = #{outBillNo,jdbcType=VARCHAR},
|
||||
tenant_id = #{tenantId,jdbcType=BIGINT}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
@ -11,82 +11,14 @@
|
||||
<result column="depotHeadType" jdbcType="VARCHAR" property="depotHeadType" />
|
||||
<result column="depotName" jdbcType="VARCHAR" property="depotName" />
|
||||
</resultMap>
|
||||
<select id="selectByConditionSerialNumber" resultMap="SerialNumberExBaseResultMap">
|
||||
select
|
||||
ser.id, ser.material_id, ser.serial_number, ser.is_sell, ser.remark, ser.delete_flag, ser.create_time,
|
||||
ser.update_time,me.bar_code as materialCode,mat.name as materialName,null as creator,null as updater,null as creatorName,
|
||||
null as updaterName,ser.depot_head_id, dh.number as depotHeadNumber,concat(dh.sub_type,dh.type) as depotHeadType, depot_id, d.name depotName
|
||||
FROM jsh_serial_number ser
|
||||
left join jsh_material mat on mat.id = ser.material_Id and ifnull(mat.delete_flag,'0') !='1'
|
||||
left join jsh_material_extend me on mat.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
|
||||
left join jsh_depot_head dh on dh.id= ser.depot_head_id and ifnull(dh.delete_flag,'0') !='1'
|
||||
left join jsh_depot d on ser.depot_id=d.id and ifnull(d.delete_flag,'0') !='1'
|
||||
where 1=1
|
||||
<if test="serialNumber != null">
|
||||
<bind name="serialNumber" value="'%' + _parameter.serialNumber + '%'" />
|
||||
and ser.serial_number like #{serialNumber}
|
||||
</if>
|
||||
<if test="materialName != null">
|
||||
<bind name="materialName" value="'%' + _parameter.materialName + '%'" />
|
||||
and mat.name like #{materialName}
|
||||
</if>
|
||||
and ifnull(ser.delete_flag,'0') !='1'
|
||||
order by ser.id desc
|
||||
<if test="offset != null and rows != null">
|
||||
limit #{offset},#{rows}
|
||||
</if>
|
||||
</select>
|
||||
<select id="countSerialNumber" resultType="java.lang.Long">
|
||||
SELECT
|
||||
COUNT(ser.id)
|
||||
FROM jsh_serial_number ser
|
||||
left JOIN jsh_material mat on mat.id = ser.material_Id and ifnull(mat.delete_flag,'0') !='1'
|
||||
where 1=1
|
||||
<if test="serialNumber != null">
|
||||
<bind name="serialNumber" value="'%' + _parameter.serialNumber + '%'" />
|
||||
and ser.serial_Number like #{serialNumber}
|
||||
</if>
|
||||
<if test="materialName != null">
|
||||
<bind name="materialName" value="'%' + _parameter.materialName + '%'" />
|
||||
and mat.name like #{materialName}
|
||||
</if>
|
||||
and ifnull(ser.delete_flag,'0') !='1'
|
||||
order by ser.id desc
|
||||
</select>
|
||||
<select id="findById" resultMap="SerialNumberExBaseResultMap">
|
||||
SELECT
|
||||
ser.id, ser.material_id, ser.serial_number, ser.is_sell, ser.remark, ser.delete_flag, ser.create_time,
|
||||
ser.update_time,ser.creator,ser.updater,mat.name as materialName,cr.username as creatorName,
|
||||
ur.username as updaterName,ser.depot_head_id
|
||||
FROM jsh_serial_number ser
|
||||
left JOIN jsh_material mat on mat.id = ser.material_Id and ifnull(mat.delete_Flag,'0') !='1'
|
||||
left join jsh_user cr on ser.creator=cr.id and ifnull(cr.status,'0') not in('1','2')
|
||||
left join jsh_user ur on ser.updater=ur.id and ifnull(ur.status,'0') not in('1','2')
|
||||
where 1=1
|
||||
and ser.id=#{id}
|
||||
and ifnull(ser.delete_flag,'0') !='1'
|
||||
order by ser.id desc
|
||||
</select>
|
||||
<select id="findBySerialNumber" resultMap="SerialNumberExBaseResultMap">
|
||||
SELECT
|
||||
ser.id, ser.material_id, ser.serial_number, ser.is_sell, ser.remark, ser.delete_flag, ser.create_time,
|
||||
ser.update_time,ser.creator,ser.updater,ser.depot_head_id
|
||||
FROM jsh_serial_number ser
|
||||
where 1=1
|
||||
<if test="serialNumber != null">
|
||||
and ser.serial_number=#{serialNumber}
|
||||
</if>
|
||||
and ifnull(ser.delete_flag,'0') !='1'
|
||||
order by ser.id desc
|
||||
</select>
|
||||
<insert id="addSerialNumber" parameterType="com.jsh.erp.datasource.entities.SerialNumberEx"
|
||||
useGeneratedKeys="true" keyProperty="id" keyColumn="id">
|
||||
insert into jsh_serial_number
|
||||
(material_id, serial_number, is_sell, remark,delete_flag,
|
||||
create_time, creator,update_time, updater,depot_head_id)
|
||||
create_time, creator,update_time, updater,in_bill_no, out_bill_no)
|
||||
values
|
||||
(#{materialId},#{serialNumber},#{isSell},#{remark},#{deleteFlag},
|
||||
#{createTime},#{creator},#{updateTime},#{updater},#{depotHeadId}
|
||||
#{createTime},#{creator},#{updateTime},#{updater},#{inBillNo},#{outBillNo}
|
||||
)
|
||||
</insert>
|
||||
<update id="updateSerialNumber" parameterType="com.jsh.erp.datasource.entities.SerialNumberEx">
|
||||
@ -113,8 +45,11 @@
|
||||
<if test="updater != null">
|
||||
updater = #{updater,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="depotHeadId != null">
|
||||
depot_head_id = #{depotHeadId,jdbcType=BIGINT},
|
||||
<if test="inBillNo != null">
|
||||
in_bill_no = #{inBillNo,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="outBillNo != null">
|
||||
out_bill_no = #{outBillNo,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
@ -131,26 +66,12 @@
|
||||
and ifnull(ser.delete_flag,'0') !='1'
|
||||
and ser.is_sell !='1'
|
||||
</select>
|
||||
<select id="countSerialNumberByMaterialIdAndDepotheadId" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
count(ser.id)
|
||||
FROM jsh_serial_number ser
|
||||
where 1=1
|
||||
<if test="materialId != null">
|
||||
and ser.material_id=#{materialId}
|
||||
</if>
|
||||
<if test="depotHeadId != null">
|
||||
and ser.depot_head_id=#{depotHeadId}
|
||||
</if>
|
||||
and ser.is_sell =#{isSell,jdbcType=VARCHAR}
|
||||
and ifnull(ser.delete_flag,'0') !='1'
|
||||
</select>
|
||||
<update id="sellSerialNumber">
|
||||
update jsh_serial_number
|
||||
<set>
|
||||
is_sell = '1',
|
||||
<if test="depotHeadId !=null ">
|
||||
depot_head_id = #{depotHeadId},
|
||||
<if test="outBillNo !=null ">
|
||||
out_bill_no = #{outBillNo},
|
||||
</if>
|
||||
<if test="updateTime !=null ">
|
||||
update_time = #{updateTime},
|
||||
@ -179,7 +100,7 @@
|
||||
<update id="cancelSerialNumber">
|
||||
update jsh_serial_number
|
||||
<set>
|
||||
is_sell = '0', depot_head_id=null,
|
||||
is_sell = '0', out_bill_no=null,
|
||||
<if test="updateTime !=null ">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
@ -191,8 +112,8 @@
|
||||
<if test="materialId != null">
|
||||
and material_id = #{materialId}
|
||||
</if>
|
||||
<if test="depotHeadId !=null ">
|
||||
and depot_head_id = #{depotHeadId,jdbcType=BIGINT}
|
||||
<if test="outBillNo !=null ">
|
||||
and out_bill_no = #{outBillNo,jdbcType=VARCHAR}
|
||||
</if>
|
||||
and is_sell != '0'
|
||||
and ifnull(delete_flag,'0') !='1'
|
||||
@ -204,8 +125,8 @@
|
||||
<if test="materialId != null">
|
||||
and selFrom.material_id = #{materialId}
|
||||
</if>
|
||||
<if test="depotHeadId !=null ">
|
||||
and selFrom.depot_head_id = #{depotHeadId,jdbcType=BIGINT}
|
||||
<if test="outBillNo !=null ">
|
||||
and selFrom.out_bill_no = #{outBillNo,jdbcType=VARCHAR}
|
||||
</if>
|
||||
and selFrom.is_sell !='0'
|
||||
and ifnull(selFrom.delete_flag,'0') !='1'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user