md
This commit is contained in:
parent
081c1f7b06
commit
a1efa5542b
@ -20,6 +20,7 @@ import com.xdadan.erp.common.core.page.TableDataInfo;
|
||||
import com.xdadan.erp.common.core.redis.RedissonService;
|
||||
import com.xdadan.erp.common.enums.BusinessType;
|
||||
import com.xdadan.erp.common.utils.DateUtils;
|
||||
import com.xdadan.erp.common.utils.SecurityUtils;
|
||||
import com.xdadan.erp.common.utils.poi.ExcelUtil;
|
||||
import com.xdadan.erp.emis.domain.EmisBrand;
|
||||
import com.xdadan.erp.emis.domain.EmisPrintTpl;
|
||||
@ -53,8 +54,9 @@ import java.util.Map;
|
||||
@RequestMapping("/emis/common")
|
||||
public class EmisCommonController extends BaseController
|
||||
{
|
||||
|
||||
@Autowired
|
||||
private IEmisElectronicPagService emisElectronicPagService;
|
||||
private IEmisElectronicSitePagService emisElectronicSitePagService;
|
||||
|
||||
@Autowired
|
||||
private IEmisRegionService emisRegionService;
|
||||
@ -73,10 +75,17 @@ public class EmisCommonController extends BaseController
|
||||
* 获取电子面单单号
|
||||
*/
|
||||
@RequestMapping(value = "/realMatchWaybill")
|
||||
public AjaxResult realMatchWaybill()
|
||||
public AjaxResult realMatchWaybill(String useSiteCode,String prefix)
|
||||
{
|
||||
try {
|
||||
String waybillNo = emisElectronicPagService.realMatchWaybill();
|
||||
if(StringUtils.isEmpty(useSiteCode)){
|
||||
try {
|
||||
useSiteCode= SecurityUtils.getLoginUser().getUser().getOwnerSiteCode();
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
String waybillNo = emisElectronicSitePagService.realMatchWaybill(useSiteCode,"T7080");
|
||||
return AjaxResult.success("处理成功",waybillNo);
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
|
||||
@ -11,8 +11,13 @@
|
||||
|
||||
package com.xdadan.erp.web.emis;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
import com.xdadan.erp.emis.domain.vo.AddressParseResult;
|
||||
import com.xdadan.erp.emis.service.IEmisElectronicPagService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@ -48,6 +53,9 @@ public class EmisElectronicPagApplyController extends BaseController
|
||||
@Autowired
|
||||
private IEmisElectronicPagApplyService emisElectronicPagApplyService;
|
||||
|
||||
@Autowired
|
||||
private IEmisElectronicPagService emisElectronicPagService;
|
||||
|
||||
/**
|
||||
* 查询网点电子面单申请列表
|
||||
*/
|
||||
@ -91,9 +99,12 @@ public class EmisElectronicPagApplyController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody EmisElectronicPagApply emisElectronicPagApply)
|
||||
{
|
||||
emisElectronicPagApply.setPrefix("T7080");
|
||||
return toAjax(emisElectronicPagApplyService.insertEmisElectronicPagApply(emisElectronicPagApply));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 修改网点电子面单申请
|
||||
*/
|
||||
@ -105,6 +116,66 @@ public class EmisElectronicPagApplyController extends BaseController
|
||||
return toAjax(emisElectronicPagApplyService.updateEmisElectronicPagApply(emisElectronicPagApply));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 申请发放
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:emisElectronicPagApply:send')")
|
||||
@Log(title = "网点电子面单发放", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/sendByApply")
|
||||
public AjaxResult sendByApply(@RequestBody EmisElectronicPagApply emisElectronicPagApply)
|
||||
{
|
||||
try {
|
||||
return toAjax(emisElectronicPagService.sendByApply(emisElectronicPagApply.getId()));
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
// 返回子定义异常
|
||||
if(ex instanceof EmisBizError){
|
||||
return AjaxResult.error("("+((EmisBizError)ex).getErrorCode()+")"+ex.getMessage());
|
||||
}
|
||||
|
||||
return AjaxResult.error("服务器异常,联系客服");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 总部直接下发
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:emisElectronicPagApply:send')")
|
||||
@Log(title = "网点电子面单发放", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/sendByApply")
|
||||
public AjaxResult sendByCenter(String prefix,String matialCode,String useSiteCode,Integer applyNum)
|
||||
{
|
||||
try {
|
||||
// prefix="T7080";
|
||||
return toAjax(emisElectronicPagService.sendByCenter(useSiteCode,matialCode,"T7080",applyNum));
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
// 返回子定义异常
|
||||
if(ex instanceof EmisBizError){
|
||||
return AjaxResult.error("("+((EmisBizError)ex).getErrorCode()+")"+ex.getMessage());
|
||||
}
|
||||
|
||||
return AjaxResult.error("服务器异常,联系客服");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:emisElectronicPagApply:cancel')")
|
||||
@Log(title = "网点电子面单取消", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/cancel")
|
||||
public AjaxResult cancel(@RequestBody EmisElectronicPagApply emisElectronicPagApply)
|
||||
{
|
||||
emisElectronicPagApply.setCancelDate(new Date());
|
||||
emisElectronicPagApply.setCancelManCode(getLoginUser().getUser().getEmpCode());
|
||||
emisElectronicPagApply.setCancelSiteCode(getLoginUser().getUser().getOwnerSiteCode());
|
||||
emisElectronicPagApply.setBlCancel("1");
|
||||
|
||||
return toAjax(emisElectronicPagApplyService.updateEmisElectronicPagApply(emisElectronicPagApply));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除网点电子面单申请
|
||||
*/
|
||||
|
||||
@ -83,20 +83,6 @@ public class EmisElectronicPagController extends BaseController
|
||||
return AjaxResult.success(emisElectronicPagService.selectEmisElectronicPagById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取电子面单单号
|
||||
*/
|
||||
@PostMapping(value = "/realMatchWaybill")
|
||||
public AjaxResult realMatchWaybill()
|
||||
{
|
||||
try {
|
||||
String waybillNo = emisElectronicPagService.realMatchWaybill();
|
||||
return AjaxResult.success("处理成功",waybillNo);
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
return AjaxResult.error(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增电子面单
|
||||
|
||||
@ -81,10 +81,8 @@ public class EmisWaybillController extends BaseController
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private IEmisElectronicPagService emisElectronicPagService;
|
||||
private IEmisElectronicSitePagService emisElectronicSitePagService;
|
||||
|
||||
@Autowired
|
||||
private IEmisTmsScanRecordService emisTmsScanRecordService;
|
||||
@ -141,7 +139,7 @@ public class EmisWaybillController extends BaseController
|
||||
try {
|
||||
|
||||
if(StringUtils.isEmpty(waybillOrder.getBillCode()) ){
|
||||
waybillOrder.setBillCode(emisElectronicPagService.realMatchWaybill());
|
||||
waybillOrder.setBillCode(emisElectronicSitePagService.realMatchWaybill("T7080"));
|
||||
}
|
||||
|
||||
EmisWaybill emisWaybillSave = waybillOrder.toDb();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* @Project: emis
|
||||
* @Title: EmisElectronicPag.java
|
||||
* @author linfso
|
||||
* @date 2024-05-27 05:38:24
|
||||
* @date 2024-05-27 10:16:56
|
||||
* @Copyright: ShangHai Duta 2022 All rights reserved.
|
||||
* @version v1.0
|
||||
* @Description: <p> 电子面单 实体类 </p>
|
||||
@ -26,7 +26,7 @@ import lombok.Data;
|
||||
* @ClassName EmisElectronicPag
|
||||
* @Description 电子面单
|
||||
* @author linfso
|
||||
* @date 2024-05-27 05:38:24
|
||||
* @date 2024-05-27 10:16:56
|
||||
*/
|
||||
@Data
|
||||
public class EmisElectronicPag extends BaseEntity
|
||||
@ -35,12 +35,16 @@ public class EmisElectronicPag extends BaseEntity
|
||||
|
||||
/* id */
|
||||
private Long id;
|
||||
/* 运单前缀 */
|
||||
private String prefix;
|
||||
/* 开始编号 */
|
||||
private String startNo;
|
||||
/* 结束编号 */
|
||||
private String endNo;
|
||||
/* 单号数量 */
|
||||
private Integer billCount;
|
||||
/* 单价 */
|
||||
private BigDecimal unitMoney;
|
||||
/* 面单费 */
|
||||
private BigDecimal billFee;
|
||||
/* 已分配当前编号 */
|
||||
|
||||
@ -35,6 +35,8 @@ public class EmisElectronicPagApply extends BaseEntity
|
||||
|
||||
/* id */
|
||||
private Long id;
|
||||
/* 运单前缀 */
|
||||
private String prefix;
|
||||
/* 申购序号 */
|
||||
private String applySeq;
|
||||
/* 申购时间 */
|
||||
@ -50,10 +52,10 @@ public class EmisElectronicPagApply extends BaseEntity
|
||||
private String applyManCode;
|
||||
/* 申购站点编号 */
|
||||
private String applySiteCode;
|
||||
/* 单价 */
|
||||
private BigDecimal unitMoney;
|
||||
/* 申请数量 */
|
||||
private Integer applyCount;
|
||||
/* 单价 */
|
||||
private BigDecimal unitMoney;
|
||||
/* 总金额 */
|
||||
private BigDecimal sumMoney;
|
||||
/* 是否已发放 */
|
||||
@ -65,6 +67,10 @@ public class EmisElectronicPagApply extends BaseEntity
|
||||
private String sendManCode;
|
||||
/* 发放站点代码 */
|
||||
private String sendSiteCode;
|
||||
/* 发放中心人编号 */
|
||||
private String sendCenterManCode;
|
||||
/* 发放中心站点代码 */
|
||||
private String sendCenterSiteCode;
|
||||
/* 是否取消 */
|
||||
private String blCancel;
|
||||
/* 取消人代码 */
|
||||
@ -76,16 +82,8 @@ public class EmisElectronicPagApply extends BaseEntity
|
||||
private String cancelSiteCode;
|
||||
/* 使用站点代码 */
|
||||
private String userSiteCode;
|
||||
/* 分配开始编号 */
|
||||
private String startNo;
|
||||
/* 分配结束编号 */
|
||||
private String endNo;
|
||||
/* 已使用当前编号 */
|
||||
private String curStartNo;
|
||||
/* 剩余数量 */
|
||||
private String hasBillCount;
|
||||
/* 是否允许自动分配单号 */
|
||||
private String blAllowAllocate;
|
||||
/* 发放标记 1-网点申请 2-总部直发 */
|
||||
private String provideFlag;
|
||||
|
||||
|
||||
// ------
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
/**
|
||||
/**
|
||||
* @Project: emis
|
||||
* @Title: EmisElectronicSitePag.java
|
||||
* @author linfso
|
||||
* @date 2024-05-27 05:41:50
|
||||
* @date 2024-05-27 12:02:16
|
||||
* @Copyright: ShangHai Duta 2022 All rights reserved.
|
||||
* @version v1.0
|
||||
* @Description: <p> 电子面单 实体类 </p>
|
||||
* @version v1.0
|
||||
* @Description: <p> 站点电子面单 实体类 </p>
|
||||
*/
|
||||
|
||||
package com.xdadan.erp.emis.domain;
|
||||
@ -24,33 +24,37 @@ import lombok.Data;
|
||||
|
||||
/**
|
||||
* @ClassName EmisElectronicSitePag
|
||||
* @Description 电子面单
|
||||
* @Description 站点电子面单
|
||||
* @author linfso
|
||||
* @date 2024-05-27 05:41:50
|
||||
* @date 2024-05-27 12:02:16
|
||||
*/
|
||||
@Data
|
||||
@Data
|
||||
public class EmisElectronicSitePag extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/* id */
|
||||
private Long id;
|
||||
/* 使用站点编号 */
|
||||
private String useSiteCode;
|
||||
/* 物料编码 */
|
||||
private String materialCode;
|
||||
/* 运单前缀 */
|
||||
private String prefix;
|
||||
/* 开始编号 */
|
||||
private String startNo;
|
||||
/* 结束编号 */
|
||||
private String endNo;
|
||||
/* 已分配当前编号 */
|
||||
private String curStartNo;
|
||||
/* 使用站点编号 */
|
||||
private String useSiteCode;
|
||||
/* 物料编码 */
|
||||
private String materialCode;
|
||||
/* 单号数量 */
|
||||
private Integer billCount;
|
||||
/* 单价 */
|
||||
private BigDecimal unitMoney;
|
||||
/* 剩余数量 */
|
||||
private Integer hasBillCount;
|
||||
/* 面单费 */
|
||||
private BigDecimal billFee;
|
||||
/* 已分配当前编号 */
|
||||
private String curStartNo;
|
||||
/* 发放日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date provideDate;
|
||||
@ -58,6 +62,12 @@ public class EmisElectronicSitePag extends BaseEntity
|
||||
private String provideMan;
|
||||
/* 发放站点 */
|
||||
private String provideSite;
|
||||
/* 流水号 */
|
||||
private String applySeq;
|
||||
/* 总部面单id */
|
||||
private Long centerPagId;
|
||||
/* 发放标记 1-网点申请 2-总部直发 */
|
||||
private String provideFlag;
|
||||
/* 状态 0-未启用 1-启用 */
|
||||
private Integer status;
|
||||
|
||||
|
||||
@ -5,8 +5,6 @@ import lombok.Getter;
|
||||
@Getter
|
||||
public enum EmisBizErrorType {
|
||||
|
||||
|
||||
|
||||
PARAM_ERROR1("E001", "参数不完整"),
|
||||
CALC_FEE_ERROR("E002", "运费计算错误"),
|
||||
CALC_WEIGHT_ERROR("E003", "重量计算错误"),
|
||||
@ -18,11 +16,16 @@ public enum EmisBizErrorType {
|
||||
PARSE_ADDRESS_ERROR("E980","地址解析错误"),
|
||||
|
||||
|
||||
// 面单 Not enough
|
||||
NOT_ENOUGH_PAG("E501","面单不足"),
|
||||
|
||||
SUCCESS("0000", "成功"),
|
||||
SYS_EXCEPTION("9998", "系统异常"),
|
||||
FAIL("9999", "失败"),
|
||||
|
||||
|
||||
|
||||
|
||||
;
|
||||
|
||||
private String errorCode;
|
||||
|
||||
@ -73,15 +73,36 @@ public interface EmisElectronicPagMapper extends BaseMapper<EmisElectronicPag>
|
||||
*/
|
||||
public int deleteEmisElectronicPagByIds(Long[] ids);
|
||||
|
||||
@Select("select count(1) from emis_electronic_pag where ('${startNo}'>=start_no and '${startNo}'<=end_no) or ('${endNo}'>=start_no and '${endNo}'<=end_no) ")
|
||||
public int checkPagIsExists(@Param("startNo") String startNo,@Param("endNo") String endNo);
|
||||
/**
|
||||
* 检查面单区段是否存在
|
||||
* @param startNo
|
||||
* @param endNo
|
||||
* @return
|
||||
*/
|
||||
@Select("select count(1) from emis_electronic_pag where prefix='${prefix}' and ('${startNo}'>=start_no and '${startNo}'<=end_no) or ('${endNo}'>=start_no and '${endNo}'<=end_no) ")
|
||||
public int checkPagIsExists(@Param("prefix")String prefix,@Param("startNo") String startNo,@Param("endNo") String endNo);
|
||||
|
||||
|
||||
@Select("select * from emis_electronic_pag where has_bill_count>0 limit 1 ")
|
||||
/**
|
||||
* 获取总可用面单数
|
||||
* @return
|
||||
*/
|
||||
@Select("select sum(has_bill_count) as has_bill_count from emis_electronic_pag where prefix='${prefix}' and has_bill_count>0 ")
|
||||
public int getTotalAvailablePag(@Param("prefix")String prefix);
|
||||
|
||||
|
||||
@Select("select * from emis_electronic_pag where prefix='${prefix}' and has_bill_count>0 order by has_bill_count asc ")
|
||||
@ResultMap("EmisElectronicPagResult")
|
||||
public EmisElectronicPag getOneAvailablePag();
|
||||
public List<EmisElectronicPag> getAvailablePagList(@Param("prefix")String prefix);
|
||||
|
||||
|
||||
@Update("update emis_electronic_pag set cur_start_no='${curStartNo}',has_bill_count=has_bill_count-1 where id=${id} ")
|
||||
public int updateRealMatchWaybill(@Param("curStartNo")String curStartNo,@Param("id")Long id);
|
||||
/**
|
||||
* 更新多区段面单
|
||||
* @param curStartNo
|
||||
* @param applyNum
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Update("update emis_electronic_pag set cur_start_no='${curStartNo}',has_bill_count=has_bill_count-${applyNum} where id=${id} ")
|
||||
public int updateRealMatchWaybillByApplyNum(@Param("curStartNo")String curStartNo,@Param("applyNum")Integer applyNum,@Param("id")Long id);
|
||||
}
|
||||
|
||||
@ -12,7 +12,13 @@ package com.xdadan.erp.emis.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.xdadan.erp.emis.domain.EmisElectronicPag;
|
||||
import com.xdadan.erp.emis.domain.EmisElectronicSitePag;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.ResultMap;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
/**
|
||||
* @ClassName EmisElectronicSitePagMapper
|
||||
* @Description <p> 电子面单 Mapper 接口 </p>
|
||||
@ -21,6 +27,26 @@ import com.xdadan.erp.emis.domain.EmisElectronicSitePag;
|
||||
*/
|
||||
public interface EmisElectronicSitePagMapper extends BaseMapper<EmisElectronicSitePag>
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* 获取单个面单是否可用
|
||||
* @return
|
||||
*/
|
||||
@Select("select * from emis_electronic_site_pag where use_site_code='${useSiteCode}' prefix='${prefix}' and has_bill_count>0 limit 1 ")
|
||||
@ResultMap("EmisElectronicSitePagResult")
|
||||
public EmisElectronicSitePag getOneAvailablePag(@Param("useSiteCode")String useSiteCode,@Param("prefix")String prefix);
|
||||
|
||||
/**
|
||||
* 更新面单占用
|
||||
* @param curStartNo
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Update("update emis_electronic_site_pag set cur_start_no='${curStartNo}',has_bill_count=has_bill_count-1 where id=${id} ")
|
||||
public int updateRealMatchWaybill(@Param("curStartNo")String curStartNo,@Param("id")Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 主键查询
|
||||
* @param id
|
||||
|
||||
@ -51,6 +51,13 @@ public interface IEmisElectronicPagApplyService
|
||||
*/
|
||||
public int updateEmisElectronicPagApply(EmisElectronicPagApply emisElectronicPagApply);
|
||||
|
||||
/**
|
||||
* 发放
|
||||
* @param emisElectronicPagApply
|
||||
* @return
|
||||
*/
|
||||
public int send(EmisElectronicPagApply emisElectronicPagApply);
|
||||
|
||||
/**
|
||||
* 批量删除网点电子面单申请
|
||||
*
|
||||
|
||||
@ -10,9 +10,12 @@
|
||||
package com.xdadan.erp.emis.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.xdadan.erp.emis.domain.EmisElectronicPag;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
import com.xdadan.erp.emis.domain.EmisElectronicPag;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
|
||||
/**
|
||||
* @ClassName EmisElectronicPagService
|
||||
* @Description 电子面单
|
||||
* @author linfso
|
||||
@ -27,9 +30,26 @@ public interface IEmisElectronicPagService
|
||||
*/
|
||||
public EmisElectronicPag selectEmisElectronicPagById(Long id);
|
||||
|
||||
public String realMatchWaybill() throws Exception;
|
||||
/**
|
||||
* 总部根据申请单发放电子面单发放
|
||||
* @param applyId
|
||||
* @return
|
||||
* @throws EmisBizError
|
||||
*/
|
||||
public int sendByApply(Long applyId) throws EmisBizError;
|
||||
|
||||
/**
|
||||
* 总部直接下发面单
|
||||
* @param applySiteCode
|
||||
* @param materialCode
|
||||
* @param prefix
|
||||
* @param applyNum
|
||||
* @return
|
||||
* @throws EmisBizError
|
||||
*/
|
||||
public int sendByCenter(String applySiteCode,String materialCode,String prefix,Integer applyNum) throws EmisBizError;
|
||||
|
||||
/**
|
||||
* 查询电子面单列表
|
||||
*
|
||||
* @param emisElectronicPag 电子面单
|
||||
|
||||
@ -11,8 +11,9 @@ package com.xdadan.erp.emis.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.xdadan.erp.emis.domain.EmisElectronicSitePag;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @ClassName EmisElectronicSitePagService
|
||||
* @Description 电子面单
|
||||
* @author linfso
|
||||
@ -20,6 +21,17 @@ import com.xdadan.erp.emis.domain.EmisElectronicSitePag;
|
||||
*/
|
||||
public interface IEmisElectronicSitePagService
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param useSiteCode
|
||||
* @param prefix
|
||||
* @return
|
||||
* @throws EmisBizError
|
||||
*/
|
||||
public String realMatchWaybill(String useSiteCode,String prefix) throws EmisBizError;
|
||||
|
||||
/**
|
||||
* 主键查询
|
||||
* @param id
|
||||
|
||||
@ -10,8 +10,10 @@
|
||||
|
||||
package com.xdadan.erp.emis.service.impl;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.xdadan.erp.emis.mapper.EmisElectronicPagMapper;
|
||||
import com.xdadan.erp.emis.service.EmisBaseService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -31,6 +33,7 @@ public class EmisElectronicPagApplyServiceImpl extends EmisBaseService implement
|
||||
@Autowired
|
||||
private EmisElectronicPagApplyMapper emisElectronicPagApplyMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 查询网点电子面单申请
|
||||
*
|
||||
@ -83,6 +86,25 @@ public class EmisElectronicPagApplyServiceImpl extends EmisBaseService implement
|
||||
return emisElectronicPagApplyMapper.updateEmisElectronicPagApply(emisElectronicPagApply);
|
||||
}
|
||||
|
||||
/**
|
||||
* 网点电子面单发放
|
||||
* @param emisElectronicPagApply
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int send(EmisElectronicPagApply emisElectronicPagApply)
|
||||
{
|
||||
// 检查总部次数是否可用
|
||||
|
||||
// 扣减总部次数,增加总部运单分配范围
|
||||
emisElectronicPagApply.setSendDate(new Date());
|
||||
emisElectronicPagApply.setSendManCode(getCurrentUser().getEmpCode());
|
||||
emisElectronicPagApply.setSendSiteCode(getCurrentUser().getOwnerSiteCode());
|
||||
emisElectronicPagApply.setBlSend("1");
|
||||
|
||||
return emisElectronicPagApplyMapper.updateEmisElectronicPagApply(emisElectronicPagApply);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除网点电子面单申请
|
||||
*
|
||||
|
||||
@ -10,10 +10,19 @@
|
||||
|
||||
package com.xdadan.erp.emis.service.impl;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.xdadan.erp.common.core.redis.RedissonService;
|
||||
import com.xdadan.erp.common.utils.DateUtils;
|
||||
import com.xdadan.erp.emis.domain.EmisElectronicPagApply;
|
||||
import com.xdadan.erp.emis.domain.EmisElectronicSitePag;
|
||||
import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
import com.xdadan.erp.emis.mapper.EmisElectronicPagApplyMapper;
|
||||
import com.xdadan.erp.emis.mapper.EmisElectronicSitePagMapper;
|
||||
import com.xdadan.erp.emis.service.EmisBaseService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
@ -22,23 +31,30 @@ import org.springframework.stereotype.Service;
|
||||
import com.xdadan.erp.emis.domain.EmisElectronicPag;
|
||||
import com.xdadan.erp.emis.mapper.EmisElectronicPagMapper;
|
||||
import com.xdadan.erp.emis.service.IEmisElectronicPagService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
/**
|
||||
* 电子面单Service业务层处理
|
||||
*
|
||||
* @author linfso
|
||||
* @date 2024-03-01 10:49:49
|
||||
*/
|
||||
@Service
|
||||
public class EmisElectronicPagServiceImpl implements IEmisElectronicPagService
|
||||
public class EmisElectronicPagServiceImpl extends EmisBaseService implements IEmisElectronicPagService
|
||||
{
|
||||
@Autowired
|
||||
private EmisElectronicPagMapper emisElectronicPagMapper;
|
||||
|
||||
@Autowired
|
||||
private EmisElectronicPagApplyMapper emisElectronicPagApplyMapper;
|
||||
|
||||
@Autowired
|
||||
private EmisElectronicSitePagMapper emisElectronicSitePagMapper;
|
||||
|
||||
@Autowired
|
||||
RedissonService redissonService;
|
||||
|
||||
public static String PAG_PREFIX="T7080";
|
||||
|
||||
/**
|
||||
* 查询电子面单
|
||||
@ -53,39 +69,324 @@ public class EmisElectronicPagServiceImpl implements IEmisElectronicPagService
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 分配电子面单
|
||||
* 总部根据申请单发放电子面单发放
|
||||
* @param applyId
|
||||
* @return
|
||||
* @throws EmisBizError
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public String realMatchWaybill() throws Exception {
|
||||
public int sendByApply(Long applyId) throws EmisBizError {
|
||||
|
||||
EmisElectronicPagApply emisElectronicPagApply=emisElectronicPagApplyMapper.selectEmisElectronicPagApplyById(applyId);
|
||||
if(emisElectronicPagApply==null){
|
||||
throw new EmisBizError(EmisBizErrorType.NOT_EXISTS,"流水号不存在");
|
||||
}
|
||||
|
||||
String prefix=emisElectronicPagApply.getPrefix();
|
||||
Integer applyNum=emisElectronicPagApply.getApplyCount();
|
||||
|
||||
// 发放主单
|
||||
if("1001".equals(emisElectronicPagApply.getMaterialCode())) {
|
||||
// 获取电子面单号
|
||||
// 获取分段电子面单数量
|
||||
List<Map<String, Object>> listPagNo = allocatePagNoList(prefix, applyNum);
|
||||
for (Map pagNoMap : listPagNo) {
|
||||
|
||||
String startNo = pagNoMap.get("startNo").toString();
|
||||
Long centerPagId = (Long) pagNoMap.get("centerPagId");
|
||||
String endNo = pagNoMap.get("endNo").toString();
|
||||
Integer subApplyNum = (Integer) pagNoMap.get("applyNum");
|
||||
|
||||
|
||||
// 插入网点运单表
|
||||
EmisElectronicSitePag emisElectronicSitePag = new EmisElectronicSitePag();
|
||||
emisElectronicSitePag.setStartNo(startNo);
|
||||
emisElectronicSitePag.setEndNo(endNo);
|
||||
emisElectronicSitePag.setCurStartNo(startNo);
|
||||
emisElectronicSitePag.setMaterialCode("1001");
|
||||
emisElectronicSitePag.setPrefix(prefix);
|
||||
emisElectronicSitePag.setUseSiteCode(emisElectronicPagApply.getApplySiteCode());
|
||||
emisElectronicSitePag.setBillCount(subApplyNum);
|
||||
emisElectronicSitePag.setUnitMoney(emisElectronicPagApply.getUnitMoney());
|
||||
emisElectronicSitePag.setHasBillCount(subApplyNum);
|
||||
emisElectronicSitePag.setBillFee(emisElectronicSitePag.getUnitMoney().multiply(new BigDecimal(subApplyNum)));
|
||||
emisElectronicSitePag.setProvideDate(new Date());
|
||||
emisElectronicSitePag.setProvideMan(getCurrentUser().getEmpCode());
|
||||
emisElectronicSitePag.setProvideSite(getCurrentUser().getOwnerSiteCode());
|
||||
emisElectronicSitePag.setStatus(1);
|
||||
emisElectronicSitePag.setProvideFlag("1");
|
||||
emisElectronicSitePag.setApplySeq(emisElectronicPagApply.getApplySeq());
|
||||
emisElectronicSitePag.setCenterPagId(centerPagId);
|
||||
emisElectronicSitePag.setRemark("网点申请发放");
|
||||
emisElectronicSitePag.preInsert();
|
||||
emisElectronicSitePagMapper.insertEmisElectronicSitePag(emisElectronicSitePag);
|
||||
|
||||
}
|
||||
}
|
||||
// 发放子单
|
||||
else if("1002".equals(emisElectronicPagApply.getMaterialCode())) {
|
||||
|
||||
// 插入网点运单表
|
||||
EmisElectronicSitePag emisElectronicSitePag = new EmisElectronicSitePag();
|
||||
emisElectronicSitePag.setBillCount(applyNum);
|
||||
// emisElectronicSitePag.setStartNo(startNo);
|
||||
// emisElectronicSitePag.setEndNo(endNo);
|
||||
// emisElectronicSitePag.setCurStartNo(startNo);
|
||||
emisElectronicSitePag.setMaterialCode("1002");
|
||||
emisElectronicSitePag.setPrefix(prefix);
|
||||
emisElectronicSitePag.setUseSiteCode(emisElectronicPagApply.getApplySiteCode());
|
||||
emisElectronicSitePag.setUseSiteCode(emisElectronicPagApply.getApplySiteCode());
|
||||
emisElectronicSitePag.setUnitMoney(BigDecimal.ZERO);
|
||||
emisElectronicSitePag.setHasBillCount(applyNum);
|
||||
emisElectronicSitePag.setBillFee(BigDecimal.ZERO);
|
||||
emisElectronicSitePag.setProvideDate(new Date());
|
||||
emisElectronicSitePag.setProvideMan(getCurrentUser().getEmpCode());
|
||||
emisElectronicSitePag.setProvideSite(getCurrentUser().getOwnerSiteCode());
|
||||
emisElectronicSitePag.setStatus(1);
|
||||
emisElectronicSitePag.setProvideFlag("1");
|
||||
emisElectronicSitePag.setApplySeq(emisElectronicPagApply.getApplySeq());
|
||||
// emisElectronicSitePag.setCenterPagId(0);
|
||||
emisElectronicSitePag.setRemark("网点申请发放");
|
||||
emisElectronicSitePag.preInsert();
|
||||
emisElectronicSitePagMapper.insertEmisElectronicSitePag(emisElectronicSitePag);
|
||||
|
||||
}else{
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL,"面单类型错误");
|
||||
}
|
||||
|
||||
// 更新运单已发放
|
||||
emisElectronicPagApply.setBlSend("1");
|
||||
emisElectronicPagApply.setSendCenterManCode(getCurrentUser().getEmpCode());
|
||||
emisElectronicPagApply.setSendCenterSiteCode(getCurrentUser().getOwnerSiteCode());
|
||||
|
||||
emisElectronicPagApply.setSendSiteCode(getCurrentUser().getOwnerSiteCode());
|
||||
emisElectronicPagApply.setSendManCode(getCurrentUser().getEmpCode());
|
||||
emisElectronicPagApply.setSendDate(new Date());
|
||||
emisElectronicPagApply.preUpdate();
|
||||
emisElectronicPagApplyMapper.updateEmisElectronicPagApply(emisElectronicPagApply);
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 总部根据申请单发放电子面单发放
|
||||
* @param applySiteCode
|
||||
* @param prefix
|
||||
* @param applyNum
|
||||
* @return
|
||||
* @throws EmisBizError
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int sendByCenter(String applySiteCode,String materialCode,String prefix,Integer applyNum) throws EmisBizError {
|
||||
|
||||
// 生成流水号
|
||||
String nowStr=DateUtils.parseDateToStr(DateUtils.YYYYMMDDHHMMSS,new Date());
|
||||
String applySeqNo=nowStr+Math.round(Math.random() * 23 + 1000);
|
||||
|
||||
EmisElectronicPagApply emisElectronicPagApply=new EmisElectronicPagApply();
|
||||
|
||||
if("1001".equals(materialCode)) {
|
||||
|
||||
emisElectronicPagApply.setApplySeq(applySeqNo);
|
||||
emisElectronicPagApply.setApplyDate(new Date());
|
||||
emisElectronicPagApply.setApplyManCode(getCurrentUser().getEmpCode());
|
||||
emisElectronicPagApply.setApplySiteCode(applySiteCode);
|
||||
emisElectronicPagApply.setMaterialCode("1001");
|
||||
emisElectronicPagApply.setUnitMoney(new BigDecimal(1.0f));
|
||||
emisElectronicPagApply.setApplyCount(applyNum);
|
||||
emisElectronicPagApply.setSumMoney(new BigDecimal(1.0f*(float)applyNum));
|
||||
emisElectronicPagApply.setProvideType("2");
|
||||
emisElectronicPagApply.setPrefix(prefix);
|
||||
|
||||
// 获取电子面单号
|
||||
// 获取分段电子面单数量
|
||||
List<Map<String,Object>> listPagNo=allocatePagNoList(prefix,applyNum);
|
||||
for (Map pagNoMap:listPagNo) {
|
||||
|
||||
String startNo=pagNoMap.get("startNo").toString();
|
||||
Long centerPagId=(Long)pagNoMap.get("centerPagId");
|
||||
String endNo=pagNoMap.get("endNo").toString();
|
||||
Integer subApplyNum=(Integer)pagNoMap.get("applyNum");
|
||||
|
||||
|
||||
// 插入网点运单表
|
||||
EmisElectronicSitePag emisElectronicSitePag=new EmisElectronicSitePag();
|
||||
emisElectronicSitePag.setBillCount(subApplyNum);
|
||||
emisElectronicSitePag.setStartNo(startNo);
|
||||
emisElectronicSitePag.setEndNo(endNo);
|
||||
emisElectronicSitePag.setCurStartNo(startNo);
|
||||
emisElectronicSitePag.setMaterialCode("1001");
|
||||
emisElectronicSitePag.setPrefix(prefix);
|
||||
emisElectronicSitePag.setUseSiteCode(applySiteCode);
|
||||
emisElectronicSitePag.setBillCount(subApplyNum);
|
||||
emisElectronicSitePag.setUnitMoney(new BigDecimal(1.0f));
|
||||
emisElectronicSitePag.setHasBillCount(subApplyNum);
|
||||
emisElectronicSitePag.setBillFee(emisElectronicSitePag.getUnitMoney().multiply(new BigDecimal(subApplyNum)));
|
||||
emisElectronicSitePag.setProvideDate(new Date());
|
||||
emisElectronicSitePag.setProvideMan(getCurrentUser().getEmpCode());
|
||||
emisElectronicSitePag.setProvideSite(getCurrentUser().getOwnerSiteCode());
|
||||
emisElectronicSitePag.setStatus(1);
|
||||
emisElectronicSitePag.setProvideFlag("2");
|
||||
emisElectronicSitePag.setApplySeq(applySeqNo);
|
||||
emisElectronicSitePag.setCenterPagId(centerPagId);
|
||||
emisElectronicSitePag.setRemark("总部直接下发");
|
||||
emisElectronicSitePag.preInsert();
|
||||
emisElectronicSitePagMapper.insertEmisElectronicSitePag(emisElectronicSitePag);
|
||||
|
||||
}
|
||||
}
|
||||
// 发放子单
|
||||
else if("1002".equals(materialCode)) {
|
||||
|
||||
emisElectronicPagApply.setApplySeq(applySeqNo);
|
||||
emisElectronicPagApply.setApplyDate(new Date());
|
||||
emisElectronicPagApply.setApplyManCode(getCurrentUser().getEmpCode());
|
||||
emisElectronicPagApply.setApplySiteCode(applySiteCode);
|
||||
emisElectronicPagApply.setMaterialCode("1002");
|
||||
emisElectronicPagApply.setUnitMoney(BigDecimal.ZERO);
|
||||
emisElectronicPagApply.setApplyCount(applyNum);
|
||||
emisElectronicPagApply.setSumMoney(BigDecimal.ZERO);
|
||||
emisElectronicPagApply.setProvideType("2");
|
||||
emisElectronicPagApply.setPrefix(prefix);
|
||||
|
||||
// 插入网点运单表
|
||||
EmisElectronicSitePag emisElectronicSitePag = new EmisElectronicSitePag();
|
||||
emisElectronicSitePag.setBillCount(applyNum);
|
||||
// emisElectronicSitePag.setStartNo(startNo);
|
||||
// emisElectronicSitePag.setEndNo(endNo);
|
||||
// emisElectronicSitePag.setCurStartNo(startNo);
|
||||
emisElectronicSitePag.setMaterialCode("1002");
|
||||
emisElectronicSitePag.setPrefix(prefix);
|
||||
emisElectronicSitePag.setUseSiteCode(applySiteCode);
|
||||
emisElectronicSitePag.setUnitMoney(BigDecimal.ZERO);
|
||||
emisElectronicSitePag.setHasBillCount(applyNum);
|
||||
emisElectronicSitePag.setBillFee(BigDecimal.ZERO);
|
||||
emisElectronicSitePag.setProvideDate(new Date());
|
||||
emisElectronicSitePag.setProvideMan(getCurrentUser().getEmpCode());
|
||||
emisElectronicSitePag.setProvideSite(getCurrentUser().getOwnerSiteCode());
|
||||
emisElectronicSitePag.setStatus(1);
|
||||
emisElectronicSitePag.setProvideFlag("2");
|
||||
emisElectronicSitePag.setApplySeq(applySeqNo);
|
||||
// emisElectronicSitePag.setCenterPagId(0);
|
||||
emisElectronicSitePag.setRemark("网点申请发放");
|
||||
emisElectronicSitePag.preInsert();
|
||||
emisElectronicSitePagMapper.insertEmisElectronicSitePag(emisElectronicSitePag);
|
||||
}
|
||||
|
||||
// 插入生成数据
|
||||
|
||||
emisElectronicPagApply.setSendCenterManCode(getCurrentUser().getEmpCode());
|
||||
emisElectronicPagApply.setSendCenterSiteCode(getCurrentUser().getOwnerSiteCode());
|
||||
emisElectronicPagApply.setBlSend("1");
|
||||
emisElectronicPagApply.setSendSiteCode(getCurrentUser().getOwnerSiteCode());
|
||||
emisElectronicPagApply.setSendManCode(getCurrentUser().getEmpCode());
|
||||
emisElectronicPagApply.setSendDate(new Date());
|
||||
emisElectronicPagApply.setRemark("总部直接下发");
|
||||
emisElectronicPagApply.preInsert();
|
||||
emisElectronicPagApplyMapper.insertEmisElectronicPagApply(emisElectronicPagApply);
|
||||
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分配号段
|
||||
* @param prefix
|
||||
* @param applyNum
|
||||
* @return
|
||||
* @throws EmisBizError
|
||||
*/
|
||||
public List<Map<String,Object> > allocatePagNoList(String prefix,Integer applyNum) throws EmisBizError {
|
||||
// 获取电子面单号
|
||||
// 获取分段电子面单数量
|
||||
String waybillNo = "";
|
||||
|
||||
String lockKey="REALMATCHWAYBILL_LOCK";
|
||||
redissonService.lock(lockKey, 120L);
|
||||
// 需要加锁
|
||||
EmisElectronicPag emisElectronicPag=emisElectronicPagMapper.getOneAvailablePag();
|
||||
if(emisElectronicPag==null){
|
||||
int hasCount=emisElectronicPagMapper.getTotalAvailablePag(prefix);
|
||||
if(hasCount<=0){
|
||||
redissonService.unlock(lockKey);
|
||||
throw new Exception("无可用面单号");
|
||||
throw new EmisBizError(EmisBizErrorType.NOT_ENOUGH_PAG,"面单不足");
|
||||
}
|
||||
|
||||
// 产生新单号
|
||||
String curStartNo = emisElectronicPag.getCurStartNo();
|
||||
if(StringUtils.isEmpty(curStartNo)) {
|
||||
curStartNo = emisElectronicPag.getStartNo();
|
||||
List<Map<String,Object>> rstList = new ArrayList<>();
|
||||
// 循环占用运单数
|
||||
Integer needApplyNum = applyNum;
|
||||
List<EmisElectronicPag> availablePagList=emisElectronicPagMapper.getAvailablePagList(prefix);
|
||||
for(EmisElectronicPag emisElectronicPag:availablePagList){
|
||||
|
||||
if(needApplyNum<=0){
|
||||
break;
|
||||
}
|
||||
// 产生新号段
|
||||
String curStartNo = emisElectronicPag.getCurStartNo();
|
||||
if(StringUtils.isEmpty(curStartNo)) {
|
||||
curStartNo = emisElectronicPag.getStartNo();
|
||||
}
|
||||
|
||||
// 如果已存在的数量足够分配,直接分配
|
||||
if(emisElectronicPag.getHasBillCount()>=needApplyNum) {
|
||||
|
||||
long newStartNumber = Long.valueOf(curStartNo.replace(prefix, ""));
|
||||
newStartNumber = newStartNumber + needApplyNum;
|
||||
String endNo = prefix + newStartNumber+"";
|
||||
// 更新当前值并且递减数量
|
||||
emisElectronicPagMapper.updateRealMatchWaybillByApplyNum(endNo, needApplyNum, emisElectronicPag.getId());
|
||||
|
||||
Map<String, Object> pagMap = new HashMap<String, Object>();
|
||||
|
||||
pagMap.put("prefix", prefix);
|
||||
pagMap.put("centerPagId", emisElectronicPag.getId());
|
||||
pagMap.put("startNo", curStartNo);
|
||||
pagMap.put("endNo", endNo);
|
||||
pagMap.put("applyNum", needApplyNum);
|
||||
|
||||
rstList.add(pagMap);
|
||||
|
||||
break;
|
||||
}
|
||||
// 不够分配的情况需要多次分配,把小的号段先占用完成
|
||||
else{
|
||||
Integer newStartNumber = Integer.valueOf(curStartNo.replace(prefix, ""));
|
||||
|
||||
Integer thisApplyNum = emisElectronicPag.getHasBillCount();
|
||||
|
||||
newStartNumber = newStartNumber + thisApplyNum;
|
||||
String endNo = prefix + newStartNumber;
|
||||
// 更新当前值并且递减数量
|
||||
emisElectronicPagMapper.updateRealMatchWaybillByApplyNum(endNo, thisApplyNum, emisElectronicPag.getId());
|
||||
|
||||
Map<String, Object> pagMap = new HashMap<String, Object>();
|
||||
|
||||
pagMap.put("prefix", prefix);
|
||||
pagMap.put("centerPagId", emisElectronicPag.getId());
|
||||
pagMap.put("startNo", curStartNo);
|
||||
pagMap.put("endNo", endNo);
|
||||
pagMap.put("applyNum", thisApplyNum);
|
||||
|
||||
rstList.add(pagMap);
|
||||
|
||||
needApplyNum=needApplyNum-thisApplyNum;
|
||||
|
||||
if(needApplyNum<=0){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
long newStartNumber = Long.valueOf(curStartNo.replace(PAG_PREFIX,""));
|
||||
newStartNumber= newStartNumber+1;
|
||||
|
||||
waybillNo=PAG_PREFIX+String.valueOf(newStartNumber);
|
||||
|
||||
// 更新当前值并且递减数量
|
||||
emisElectronicPagMapper.updateRealMatchWaybill(waybillNo,emisElectronicPag.getId());
|
||||
redissonService.unlock(lockKey);
|
||||
return waybillNo;
|
||||
|
||||
return rstList;
|
||||
}
|
||||
|
||||
|
||||
@ -110,7 +411,7 @@ public class EmisElectronicPagServiceImpl implements IEmisElectronicPagService
|
||||
@Override
|
||||
public int insertEmisElectronicPag(EmisElectronicPag emisElectronicPag) throws Exception {
|
||||
// 检查段是否有重复
|
||||
int existsCount=emisElectronicPagMapper.checkPagIsExists(emisElectronicPag.getStartNo(),emisElectronicPag.getEndNo());
|
||||
int existsCount=emisElectronicPagMapper.checkPagIsExists(emisElectronicPag.getPrefix(),emisElectronicPag.getStartNo(),emisElectronicPag.getEndNo());
|
||||
if(existsCount > 0){
|
||||
throw new Exception("号段已存在");
|
||||
}
|
||||
@ -157,12 +458,12 @@ public class EmisElectronicPagServiceImpl implements IEmisElectronicPagService
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String curStartNo="T7080110001";
|
||||
long newStartNumber = Long.valueOf(curStartNo.replace(PAG_PREFIX,""));
|
||||
newStartNumber= newStartNumber+1;
|
||||
|
||||
String waybillNo=PAG_PREFIX+String.valueOf(newStartNumber);
|
||||
System.out.println(waybillNo);
|
||||
// String curStartNo="T7080110001";
|
||||
// long newStartNumber = Long.valueOf(curStartNo.replace(PAG_PREFIX,""));
|
||||
// newStartNumber= newStartNumber+1;
|
||||
//
|
||||
// String waybillNo=PAG_PREFIX+String.valueOf(newStartNumber);
|
||||
// System.out.println(waybillNo);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -11,6 +11,13 @@
|
||||
package com.xdadan.erp.emis.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.xdadan.erp.common.core.redis.RedissonService;
|
||||
import com.xdadan.erp.emis.domain.EmisElectronicPag;
|
||||
import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
import com.xdadan.erp.emis.service.EmisBaseService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.xdadan.erp.emis.domain.EmisElectronicSitePag;
|
||||
@ -24,11 +31,50 @@ import com.xdadan.erp.emis.service.IEmisElectronicSitePagService;
|
||||
* @date 2024-05-27 05:41:50
|
||||
*/
|
||||
@Service
|
||||
public class EmisElectronicSitePagServiceImpl implements IEmisElectronicSitePagService
|
||||
public class EmisElectronicSitePagServiceImpl extends EmisBaseService implements IEmisElectronicSitePagService
|
||||
{
|
||||
@Autowired
|
||||
private EmisElectronicSitePagMapper emisElectronicSitePagMapper;
|
||||
|
||||
@Autowired
|
||||
RedissonService redissonService;
|
||||
|
||||
/**
|
||||
* 分配电子面单 1 个
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String realMatchWaybill(String useSiteCode,String prefix) throws EmisBizError {
|
||||
// 获取电子面单号
|
||||
// 获取分段电子面单数量
|
||||
String waybillNo = "";
|
||||
String lockKey="REALMATCHWAYBILL_BY_SITE_LOCK";
|
||||
redissonService.lock(lockKey, 120L);
|
||||
|
||||
// 需要加锁
|
||||
EmisElectronicSitePag emisElectronicSitePag=emisElectronicSitePagMapper.getOneAvailablePag(useSiteCode,prefix);
|
||||
if(emisElectronicSitePag==null){
|
||||
redissonService.unlock(lockKey);
|
||||
throw new EmisBizError(EmisBizErrorType.NOT_ENOUGH_PAG,"面单不足");
|
||||
}
|
||||
|
||||
// 产生新单号
|
||||
String curStartNo = emisElectronicSitePag.getCurStartNo();
|
||||
if(StringUtils.isEmpty(curStartNo)) {
|
||||
curStartNo = emisElectronicSitePag.getStartNo();
|
||||
}
|
||||
|
||||
Integer newStartNumber = Integer.valueOf(curStartNo.replace(prefix,""));
|
||||
newStartNumber= newStartNumber+1;
|
||||
|
||||
waybillNo=prefix+String.valueOf(newStartNumber);
|
||||
|
||||
// 更新当前值并且递减数量
|
||||
emisElectronicSitePagMapper.updateRealMatchWaybill(waybillNo,emisElectronicSitePag.getId());
|
||||
redissonService.unlock(lockKey);
|
||||
return waybillNo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询电子面单
|
||||
*
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
|
||||
<resultMap type="EmisElectronicPagApply" id="EmisElectronicPagApplyResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="prefix" column="prefix" />
|
||||
<result property="applySeq" column="apply_seq" />
|
||||
<result property="applyDate" column="apply_date" />
|
||||
<result property="provideType" column="provide_type" />
|
||||
@ -13,25 +14,21 @@
|
||||
<result property="materialName" column="material_name" />
|
||||
<result property="applyManCode" column="apply_man_code" />
|
||||
<result property="applySiteCode" column="apply_site_code" />
|
||||
<result property="unitMoney" column="unit_money" />
|
||||
<result property="applyCount" column="apply_count" />
|
||||
<result property="unitMoney" column="unit_money" />
|
||||
<result property="sumMoney" column="sum_money" />
|
||||
<result property="blSend" column="bl_send" />
|
||||
<result property="sendDate" column="send_date" />
|
||||
<result property="sendManCode" column="send_man_code" />
|
||||
<result property="sendSiteCode" column="send_site_code" />
|
||||
<result property="sendCenterManCode" column="send_center_man_code" />
|
||||
<result property="sendCenterSiteCode" column="send_center_site_code" />
|
||||
<result property="blCancel" column="bl_cancel" />
|
||||
<result property="cancelManCode" column="cancel_man_code" />
|
||||
<result property="cancelDate" column="cancel_date" />
|
||||
<result property="cancelSiteCode" column="cancel_site_code" />
|
||||
<result property="userSiteCode" column="user_site_code" />
|
||||
<result property="startNo" column="start_no" />
|
||||
<result property="endNo" column="end_no" />
|
||||
<result property="curStartNo" column="cur_start_no" />
|
||||
<result property="hasBillCount" column="has_bill_count" />
|
||||
<result property="blAllowAllocate" column="bl_allow_allocate" />
|
||||
|
||||
|
||||
<result property="provideFlag" column="provide_flag" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
@ -74,7 +71,7 @@
|
||||
|
||||
|
||||
<sql id="selectEmisElectronicPagApplyVo">
|
||||
select id, apply_seq, apply_date, provide_type, material_code, material_name, apply_man_code, apply_site_code, unit_money, apply_count, sum_money, bl_send, send_date, send_man_code, send_site_code, bl_cancel, cancel_man_code, cancel_date, cancel_site_code, user_site_code, start_no, end_no, cur_start_no, has_bill_count, bl_allow_allocate, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site from emis_electronic_pag_apply
|
||||
select id, prefix, apply_seq, apply_date, provide_type, material_code, material_name, apply_man_code, apply_site_code, apply_count, unit_money, sum_money, bl_send, send_date, send_man_code, send_site_code, send_center_man_code, send_center_site_code, bl_cancel, cancel_man_code, cancel_date, cancel_site_code, user_site_code, provide_flag, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site from emis_electronic_pag_apply
|
||||
</sql>
|
||||
|
||||
<select id="selectEmisElectronicPagApplyList" parameterType="EmisElectronicPagApply" resultMap="EmisElectronicPagApplyResult">
|
||||
@ -82,38 +79,37 @@
|
||||
<where>
|
||||
del_flag='0'
|
||||
<if test="id != null "> and id = #{id}</if>
|
||||
<if test="applySeq != null and applySeq != ''"> and apply_seq like concat('%', #{applySeq}, '%')</if>
|
||||
<if test="prefix != null and prefix != ''"> and prefix = #{prefix}</if>
|
||||
<if test="applySeq != null and applySeq != ''"> and apply_seq = #{applySeq}</if>
|
||||
<if test="applyDate != null "> and apply_date = #{applyDate}</if>
|
||||
<if test="provideType != null and provideType != ''"> and provide_type like concat('%', #{provideType}, '%')</if>
|
||||
<if test="materialCode != null and materialCode != ''"> and material_code like concat('%', #{materialCode}, '%')</if>
|
||||
<if test="provideType != null and provideType != ''"> and provide_type = #{provideType}</if>
|
||||
<if test="materialCode != null and materialCode != ''"> and material_code = #{materialCode}</if>
|
||||
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
|
||||
<if test="applyManCode != null and applyManCode != ''"> and apply_man_code like concat('%', #{applyManCode}, '%')</if>
|
||||
<if test="applySiteCode != null and applySiteCode != ''"> and apply_site_code like concat('%', #{applySiteCode}, '%')</if>
|
||||
<if test="unitMoney != null "> and unit_money = #{unitMoney}</if>
|
||||
<if test="applyManCode != null and applyManCode != ''"> and apply_man_code = #{applyManCode}</if>
|
||||
<if test="applySiteCode != null and applySiteCode != ''"> and apply_site_code = #{applySiteCode}</if>
|
||||
<if test="applyCount != null "> and apply_count = #{applyCount}</if>
|
||||
<if test="unitMoney != null "> and unit_money = #{unitMoney}</if>
|
||||
<if test="sumMoney != null "> and sum_money = #{sumMoney}</if>
|
||||
<if test="blSend != null and blSend != ''"> and bl_send like concat('%', #{blSend}, '%')</if>
|
||||
<if test="blSend != null and blSend != ''"> and bl_send = #{blSend}</if>
|
||||
<if test="sendDate != null "> and send_date = #{sendDate}</if>
|
||||
<if test="sendManCode != null and sendManCode != ''"> and send_man_code like concat('%', #{sendManCode}, '%')</if>
|
||||
<if test="sendSiteCode != null and sendSiteCode != ''"> and send_site_code like concat('%', #{sendSiteCode}, '%')</if>
|
||||
<if test="blCancel != null and blCancel != ''"> and bl_cancel like concat('%', #{blCancel}, '%')</if>
|
||||
<if test="cancelManCode != null and cancelManCode != ''"> and cancel_man_code like concat('%', #{cancelManCode}, '%')</if>
|
||||
<if test="sendManCode != null and sendManCode != ''"> and send_man_code = #{sendManCode}</if>
|
||||
<if test="sendSiteCode != null and sendSiteCode != ''"> and send_site_code = #{sendSiteCode}</if>
|
||||
<if test="sendCenterManCode != null and sendCenterManCode != ''"> and send_center_man_code = #{sendCenterManCode}</if>
|
||||
<if test="sendCenterSiteCode != null and sendCenterSiteCode != ''"> and send_center_site_code = #{sendCenterSiteCode}</if>
|
||||
<if test="blCancel != null and blCancel != ''"> and bl_cancel = #{blCancel}</if>
|
||||
<if test="cancelManCode != null and cancelManCode != ''"> and cancel_man_code = #{cancelManCode}</if>
|
||||
<if test="cancelDate != null "> and cancel_date = #{cancelDate}</if>
|
||||
<if test="cancelSiteCode != null and cancelSiteCode != ''"> and cancel_site_code like concat('%', #{cancelSiteCode}, '%')</if>
|
||||
<if test="userSiteCode != null and userSiteCode != ''"> and user_site_code like concat('%', #{userSiteCode}, '%')</if>
|
||||
<if test="startNo != null and startNo != ''"> and start_no like concat('%', #{startNo}, '%')</if>
|
||||
<if test="endNo != null and endNo != ''"> and end_no like concat('%', #{endNo}, '%')</if>
|
||||
<if test="curStartNo != null and curStartNo != ''"> and cur_start_no like concat('%', #{curStartNo}, '%')</if>
|
||||
<if test="hasBillCount != null and hasBillCount != ''"> and has_bill_count like concat('%', #{hasBillCount}, '%')</if>
|
||||
<if test="blAllowAllocate != null and blAllowAllocate != ''"> and bl_allow_allocate like concat('%', #{blAllowAllocate}, '%')</if>
|
||||
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{delFlag}, '%')</if>
|
||||
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
|
||||
<if test="cancelSiteCode != null and cancelSiteCode != ''"> and cancel_site_code = #{cancelSiteCode}</if>
|
||||
<if test="userSiteCode != null and userSiteCode != ''"> and user_site_code = #{userSiteCode}</if>
|
||||
<if test="provideFlag != null and provideFlag != ''"> and provide_flag = #{provideFlag}</if>
|
||||
<if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag}</if>
|
||||
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
|
||||
<if test="createTime != null "> and create_time = #{createTime}</if>
|
||||
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if>
|
||||
<if test="updateBy != null and updateBy != ''"> and update_by = #{updateBy}</if>
|
||||
<if test="updateTime != null "> and update_time = #{updateTime}</if>
|
||||
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
|
||||
<if test="createSite != null and createSite != ''"> and create_site like concat('%', #{createSite}, '%')</if>
|
||||
<if test="updateSite != null and updateSite != ''"> and update_site like concat('%', #{updateSite}, '%')</if>
|
||||
<if test="remark != null and remark != ''"> and remark = #{remark}</if>
|
||||
<if test="createSite != null and createSite != ''"> and create_site = #{createSite}</if>
|
||||
<if test="updateSite != null and updateSite != ''"> and update_site = #{updateSite}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
@ -122,6 +118,7 @@
|
||||
select count(1) from emis_electronic_pag_apply
|
||||
where del_flag='0'
|
||||
and id = #{id}
|
||||
and prefix = #{prefix}
|
||||
and apply_seq = #{applySeq}
|
||||
and apply_date = #{applyDate}
|
||||
and provide_type = #{provideType}
|
||||
@ -129,23 +126,21 @@
|
||||
and material_name = #{materialName}
|
||||
and apply_man_code = #{applyManCode}
|
||||
and apply_site_code = #{applySiteCode}
|
||||
and unit_money = #{unitMoney}
|
||||
and apply_count = #{applyCount}
|
||||
and unit_money = #{unitMoney}
|
||||
and sum_money = #{sumMoney}
|
||||
and bl_send = #{blSend}
|
||||
and send_date = #{sendDate}
|
||||
and send_man_code = #{sendManCode}
|
||||
and send_site_code = #{sendSiteCode}
|
||||
and send_center_man_code = #{sendCenterManCode}
|
||||
and send_center_site_code = #{sendCenterSiteCode}
|
||||
and bl_cancel = #{blCancel}
|
||||
and cancel_man_code = #{cancelManCode}
|
||||
and cancel_date = #{cancelDate}
|
||||
and cancel_site_code = #{cancelSiteCode}
|
||||
and user_site_code = #{userSiteCode}
|
||||
and start_no = #{startNo}
|
||||
and end_no = #{endNo}
|
||||
and cur_start_no = #{curStartNo}
|
||||
and has_bill_count = #{hasBillCount}
|
||||
and bl_allow_allocate = #{blAllowAllocate}
|
||||
and provide_flag = #{provideFlag}
|
||||
and del_flag = #{delFlag}
|
||||
and create_by = #{createBy}
|
||||
and create_time = #{createTime}
|
||||
@ -158,7 +153,7 @@
|
||||
</select>
|
||||
|
||||
<select id="selectEmisElectronicPagApplyById" parameterType="Long" resultMap="EmisElectronicPagApplyResult">
|
||||
select id, apply_seq, apply_date, provide_type, material_code, material_name, apply_man_code, apply_site_code, unit_money, apply_count, sum_money, bl_send, send_date, send_man_code, send_site_code, bl_cancel, cancel_man_code, cancel_date, cancel_site_code, user_site_code, start_no, end_no, cur_start_no, has_bill_count, bl_allow_allocate, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site
|
||||
select id, prefix, apply_seq, apply_date, provide_type, material_code, material_name, apply_man_code, apply_site_code, apply_count, unit_money, sum_money, bl_send, send_date, send_man_code, send_site_code, send_center_man_code, send_center_site_code, bl_cancel, cancel_man_code, cancel_date, cancel_site_code, user_site_code, provide_flag, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site
|
||||
from emis_electronic_pag_apply a
|
||||
where a.id = #{id}
|
||||
</select>
|
||||
@ -167,6 +162,7 @@
|
||||
insert into emis_electronic_pag_apply
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="prefix != null and prefix != ''">prefix,</if>
|
||||
<if test="applySeq != null and applySeq != ''">apply_seq,</if>
|
||||
<if test="applyDate != null">apply_date,</if>
|
||||
<if test="provideType != null and provideType != ''">provide_type,</if>
|
||||
@ -174,23 +170,21 @@
|
||||
<if test="materialName != null and materialName != ''">material_name,</if>
|
||||
<if test="applyManCode != null and applyManCode != ''">apply_man_code,</if>
|
||||
<if test="applySiteCode != null and applySiteCode != ''">apply_site_code,</if>
|
||||
<if test="unitMoney != null">unit_money,</if>
|
||||
<if test="applyCount != null">apply_count,</if>
|
||||
<if test="unitMoney != null">unit_money,</if>
|
||||
<if test="sumMoney != null">sum_money,</if>
|
||||
<if test="blSend != null and blSend != ''">bl_send,</if>
|
||||
<if test="sendDate != null">send_date,</if>
|
||||
<if test="sendManCode != null and sendManCode != ''">send_man_code,</if>
|
||||
<if test="sendSiteCode != null and sendSiteCode != ''">send_site_code,</if>
|
||||
<if test="sendCenterManCode != null and sendCenterManCode != ''">send_center_man_code,</if>
|
||||
<if test="sendCenterSiteCode != null and sendCenterSiteCode != ''">send_center_site_code,</if>
|
||||
<if test="blCancel != null and blCancel != ''">bl_cancel,</if>
|
||||
<if test="cancelManCode != null and cancelManCode != ''">cancel_man_code,</if>
|
||||
<if test="cancelDate != null">cancel_date,</if>
|
||||
<if test="cancelSiteCode != null and cancelSiteCode != ''">cancel_site_code,</if>
|
||||
<if test="userSiteCode != null and userSiteCode != ''">user_site_code,</if>
|
||||
<if test="startNo != null and startNo != ''">start_no,</if>
|
||||
<if test="endNo != null and endNo != ''">end_no,</if>
|
||||
<if test="curStartNo != null and curStartNo != ''">cur_start_no,</if>
|
||||
<if test="hasBillCount != null and hasBillCount != ''">has_bill_count,</if>
|
||||
<if test="blAllowAllocate != null and blAllowAllocate != ''">bl_allow_allocate,</if>
|
||||
<if test="provideFlag != null and provideFlag != ''">provide_flag,</if>
|
||||
<if test="delFlag != null and delFlag != ''">del_flag,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
@ -202,6 +196,7 @@
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="prefix != null and prefix != ''">#{prefix},</if>
|
||||
<if test="applySeq != null and applySeq != ''">#{applySeq},</if>
|
||||
<if test="applyDate != null">#{applyDate},</if>
|
||||
<if test="provideType != null and provideType != ''">#{provideType},</if>
|
||||
@ -209,23 +204,21 @@
|
||||
<if test="materialName != null and materialName != ''">#{materialName},</if>
|
||||
<if test="applyManCode != null and applyManCode != ''">#{applyManCode},</if>
|
||||
<if test="applySiteCode != null and applySiteCode != ''">#{applySiteCode},</if>
|
||||
<if test="unitMoney != null">#{unitMoney},</if>
|
||||
<if test="applyCount != null">#{applyCount},</if>
|
||||
<if test="unitMoney != null">#{unitMoney},</if>
|
||||
<if test="sumMoney != null">#{sumMoney},</if>
|
||||
<if test="blSend != null and blSend != ''">#{blSend},</if>
|
||||
<if test="sendDate != null">#{sendDate},</if>
|
||||
<if test="sendManCode != null and sendManCode != ''">#{sendManCode},</if>
|
||||
<if test="sendSiteCode != null and sendSiteCode != ''">#{sendSiteCode},</if>
|
||||
<if test="sendCenterManCode != null and sendCenterManCode != ''">#{sendCenterManCode},</if>
|
||||
<if test="sendCenterSiteCode != null and sendCenterSiteCode != ''">#{sendCenterSiteCode},</if>
|
||||
<if test="blCancel != null and blCancel != ''">#{blCancel},</if>
|
||||
<if test="cancelManCode != null and cancelManCode != ''">#{cancelManCode},</if>
|
||||
<if test="cancelDate != null">#{cancelDate},</if>
|
||||
<if test="cancelSiteCode != null and cancelSiteCode != ''">#{cancelSiteCode},</if>
|
||||
<if test="userSiteCode != null and userSiteCode != ''">#{userSiteCode},</if>
|
||||
<if test="startNo != null and startNo != ''">#{startNo},</if>
|
||||
<if test="endNo != null and endNo != ''">#{endNo},</if>
|
||||
<if test="curStartNo != null and curStartNo != ''">#{curStartNo},</if>
|
||||
<if test="hasBillCount != null and hasBillCount != ''">#{hasBillCount},</if>
|
||||
<if test="blAllowAllocate != null and blAllowAllocate != ''">#{blAllowAllocate},</if>
|
||||
<if test="provideFlag != null and provideFlag != ''">#{provideFlag},</if>
|
||||
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
@ -240,6 +233,7 @@
|
||||
<update id="updateEmisElectronicPagApply" parameterType="EmisElectronicPagApply">
|
||||
update emis_electronic_pag_apply
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="prefix != null and prefix != ''">prefix = #{prefix},</if>
|
||||
<if test="applySeq != null and applySeq != ''">apply_seq = #{applySeq},</if>
|
||||
<if test="applyDate != null">apply_date = #{applyDate},</if>
|
||||
<if test="provideType != null and provideType != ''">provide_type = #{provideType},</if>
|
||||
@ -247,23 +241,21 @@
|
||||
<if test="materialName != null and materialName != ''">material_name = #{materialName},</if>
|
||||
<if test="applyManCode != null and applyManCode != ''">apply_man_code = #{applyManCode},</if>
|
||||
<if test="applySiteCode != null and applySiteCode != ''">apply_site_code = #{applySiteCode},</if>
|
||||
<if test="unitMoney != null">unit_money = #{unitMoney},</if>
|
||||
<if test="applyCount != null">apply_count = #{applyCount},</if>
|
||||
<if test="unitMoney != null">unit_money = #{unitMoney},</if>
|
||||
<if test="sumMoney != null">sum_money = #{sumMoney},</if>
|
||||
<if test="blSend != null and blSend != ''">bl_send = #{blSend},</if>
|
||||
<if test="sendDate != null">send_date = #{sendDate},</if>
|
||||
<if test="sendManCode != null and sendManCode != ''">send_man_code = #{sendManCode},</if>
|
||||
<if test="sendSiteCode != null and sendSiteCode != ''">send_site_code = #{sendSiteCode},</if>
|
||||
<if test="sendCenterManCode != null and sendCenterManCode != ''">send_center_man_code = #{sendCenterManCode},</if>
|
||||
<if test="sendCenterSiteCode != null and sendCenterSiteCode != ''">send_center_site_code = #{sendCenterSiteCode},</if>
|
||||
<if test="blCancel != null and blCancel != ''">bl_cancel = #{blCancel},</if>
|
||||
<if test="cancelManCode != null and cancelManCode != ''">cancel_man_code = #{cancelManCode},</if>
|
||||
<if test="cancelDate != null">cancel_date = #{cancelDate},</if>
|
||||
<if test="cancelSiteCode != null and cancelSiteCode != ''">cancel_site_code = #{cancelSiteCode},</if>
|
||||
<if test="userSiteCode != null and userSiteCode != ''">user_site_code = #{userSiteCode},</if>
|
||||
<if test="startNo != null and startNo != ''">start_no = #{startNo},</if>
|
||||
<if test="endNo != null and endNo != ''">end_no = #{endNo},</if>
|
||||
<if test="curStartNo != null and curStartNo != ''">cur_start_no = #{curStartNo},</if>
|
||||
<if test="hasBillCount != null and hasBillCount != ''">has_bill_count = #{hasBillCount},</if>
|
||||
<if test="blAllowAllocate != null and blAllowAllocate != ''">bl_allow_allocate = #{blAllowAllocate},</if>
|
||||
<if test="provideFlag != null and provideFlag != ''">provide_flag = #{provideFlag},</if>
|
||||
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
||||
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
@ -286,4 +278,5 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@ -6,9 +6,11 @@
|
||||
|
||||
<resultMap type="EmisElectronicPag" id="EmisElectronicPagResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="prefix" column="prefix" />
|
||||
<result property="startNo" column="start_no" />
|
||||
<result property="endNo" column="end_no" />
|
||||
<result property="billCount" column="bill_count" />
|
||||
<result property="unitMoney" column="unit_money" />
|
||||
<result property="billFee" column="bill_fee" />
|
||||
<result property="curStartNo" column="cur_start_no" />
|
||||
<result property="hasBillCount" column="has_bill_count" />
|
||||
@ -27,7 +29,7 @@
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEmisElectronicPagVo">
|
||||
select id, start_no, end_no, bill_count, bill_fee, cur_start_no, has_bill_count, provide_date, provide_man, provide_site, status, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site from emis_electronic_pag
|
||||
select id, prefix, start_no, end_no, bill_count, unit_money, bill_fee, cur_start_no, has_bill_count, provide_date, provide_man, provide_site, status, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site from emis_electronic_pag
|
||||
</sql>
|
||||
|
||||
<select id="selectEmisElectronicPagList" parameterType="EmisElectronicPag" resultMap="EmisElectronicPagResult">
|
||||
@ -35,9 +37,11 @@
|
||||
<where>
|
||||
del_flag='0'
|
||||
<if test="id != null "> and id = #{id}</if>
|
||||
<if test="prefix != null and prefix != ''"> and prefix like concat('%', #{prefix}, '%')</if>
|
||||
<if test="startNo != null and startNo != ''"> and start_no like concat('%', #{startNo}, '%')</if>
|
||||
<if test="endNo != null and endNo != ''"> and end_no like concat('%', #{endNo}, '%')</if>
|
||||
<if test="billCount != null "> and bill_count = #{billCount}</if>
|
||||
<if test="unitMoney != null "> and unit_money = #{unitMoney}</if>
|
||||
<if test="billFee != null "> and bill_fee = #{billFee}</if>
|
||||
<if test="curStartNo != null and curStartNo != ''"> and cur_start_no like concat('%', #{curStartNo}, '%')</if>
|
||||
<if test="hasBillCount != null "> and has_bill_count = #{hasBillCount}</if>
|
||||
@ -61,9 +65,11 @@
|
||||
select count(1) from emis_electronic_pag
|
||||
where del_flag='0'
|
||||
and id = #{id}
|
||||
and prefix = #{prefix}
|
||||
and start_no = #{startNo}
|
||||
and end_no = #{endNo}
|
||||
and bill_count = #{billCount}
|
||||
and unit_money = #{unitMoney}
|
||||
and bill_fee = #{billFee}
|
||||
and cur_start_no = #{curStartNo}
|
||||
and has_bill_count = #{hasBillCount}
|
||||
@ -83,7 +89,7 @@
|
||||
</select>
|
||||
|
||||
<select id="selectEmisElectronicPagById" parameterType="Long" resultMap="EmisElectronicPagResult">
|
||||
select id, start_no, end_no, bill_count, bill_fee, cur_start_no, has_bill_count, provide_date, provide_man, provide_site, status, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site
|
||||
select id, prefix, start_no, end_no, bill_count, unit_money, bill_fee, cur_start_no, has_bill_count, provide_date, provide_man, provide_site, status, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site
|
||||
from emis_electronic_pag a
|
||||
where a.id = #{id}
|
||||
</select>
|
||||
@ -92,9 +98,11 @@
|
||||
insert into emis_electronic_pag
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="prefix != null and prefix != ''">prefix,</if>
|
||||
<if test="startNo != null and startNo != ''">start_no,</if>
|
||||
<if test="endNo != null and endNo != ''">end_no,</if>
|
||||
<if test="billCount != null">bill_count,</if>
|
||||
<if test="unitMoney != null">unit_money,</if>
|
||||
<if test="billFee != null">bill_fee,</if>
|
||||
<if test="curStartNo != null and curStartNo != ''">cur_start_no,</if>
|
||||
<if test="hasBillCount != null">has_bill_count,</if>
|
||||
@ -113,9 +121,11 @@
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="prefix != null and prefix != ''">#{prefix},</if>
|
||||
<if test="startNo != null and startNo != ''">#{startNo},</if>
|
||||
<if test="endNo != null and endNo != ''">#{endNo},</if>
|
||||
<if test="billCount != null">#{billCount},</if>
|
||||
<if test="unitMoney != null">#{unitMoney},</if>
|
||||
<if test="billFee != null">#{billFee},</if>
|
||||
<if test="curStartNo != null and curStartNo != ''">#{curStartNo},</if>
|
||||
<if test="hasBillCount != null">#{hasBillCount},</if>
|
||||
@ -137,9 +147,11 @@
|
||||
<update id="updateEmisElectronicPag" parameterType="EmisElectronicPag">
|
||||
update emis_electronic_pag
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="prefix != null and prefix != ''">prefix = #{prefix},</if>
|
||||
<if test="startNo != null and startNo != ''">start_no = #{startNo},</if>
|
||||
<if test="endNo != null and endNo != ''">end_no = #{endNo},</if>
|
||||
<if test="billCount != null">bill_count = #{billCount},</if>
|
||||
<if test="unitMoney != null">unit_money = #{unitMoney},</if>
|
||||
<if test="billFee != null">bill_fee = #{billFee},</if>
|
||||
<if test="curStartNo != null and curStartNo != ''">cur_start_no = #{curStartNo},</if>
|
||||
<if test="hasBillCount != null">has_bill_count = #{hasBillCount},</if>
|
||||
|
||||
@ -1,22 +1,27 @@
|
||||
<?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">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xdadan.erp.emis.mapper.EmisElectronicSitePagMapper">
|
||||
|
||||
|
||||
<resultMap type="EmisElectronicSitePag" id="EmisElectronicSitePagResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="useSiteCode" column="use_site_code" />
|
||||
<result property="materialCode" column="material_code" />
|
||||
<result property="prefix" column="prefix" />
|
||||
<result property="startNo" column="start_no" />
|
||||
<result property="endNo" column="end_no" />
|
||||
<result property="curStartNo" column="cur_start_no" />
|
||||
<result property="useSiteCode" column="use_site_code" />
|
||||
<result property="materialCode" column="material_code" />
|
||||
<result property="billCount" column="bill_count" />
|
||||
<result property="unitMoney" column="unit_money" />
|
||||
<result property="hasBillCount" column="has_bill_count" />
|
||||
<result property="billFee" column="bill_fee" />
|
||||
<result property="curStartNo" column="cur_start_no" />
|
||||
<result property="provideDate" column="provide_date" />
|
||||
<result property="provideMan" column="provide_man" />
|
||||
<result property="provideSite" column="provide_site" />
|
||||
<result property="applySeq" column="apply_seq" />
|
||||
<result property="centerPagId" column="center_pag_id" />
|
||||
<result property="provideFlag" column="provide_flag" />
|
||||
<result property="status" column="status" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="createBy" column="create_by" />
|
||||
@ -29,25 +34,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEmisElectronicSitePagVo">
|
||||
select id, use_site_code, material_code, start_no, end_no, bill_count, has_bill_count, bill_fee, cur_start_no, provide_date, provide_man, provide_site, status, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site from emis_electronic_site_pag
|
||||
select id, prefix, start_no, end_no, cur_start_no, use_site_code, material_code, bill_count, unit_money, has_bill_count, bill_fee, provide_date, provide_man, provide_site, apply_seq, center_pag_id, provide_flag, status, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site from emis_electronic_site_pag
|
||||
</sql>
|
||||
|
||||
<select id="selectEmisElectronicSitePagList" parameterType="EmisElectronicSitePag" resultMap="EmisElectronicSitePagResult">
|
||||
<include refid="selectEmisElectronicSitePagVo"/>
|
||||
<where>
|
||||
del_flag='0'
|
||||
<where>
|
||||
del_flag='0'
|
||||
<if test="id != null "> and id = #{id}</if>
|
||||
<if test="prefix != null and prefix != ''"> and prefix = #{prefix}</if>
|
||||
<if test="startNo != null and startNo != ''"> and start_no = #{startNo}</if>
|
||||
<if test="endNo != null and endNo != ''"> and end_no like concat('%', #{endNo}, '%')</if>
|
||||
<if test="curStartNo != null and curStartNo != ''"> and cur_start_no like concat('%', #{curStartNo}, '%')</if>
|
||||
<if test="useSiteCode != null and useSiteCode != ''"> and use_site_code like concat('%', #{useSiteCode}, '%')</if>
|
||||
<if test="materialCode != null and materialCode != ''"> and material_code like concat('%', #{materialCode}, '%')</if>
|
||||
<if test="startNo != null and startNo != ''"> and start_no like concat('%', #{startNo}, '%')</if>
|
||||
<if test="endNo != null and endNo != ''"> and end_no like concat('%', #{endNo}, '%')</if>
|
||||
<if test="billCount != null "> and bill_count = #{billCount}</if>
|
||||
<if test="unitMoney != null "> and unit_money = #{unitMoney}</if>
|
||||
<if test="hasBillCount != null "> and has_bill_count = #{hasBillCount}</if>
|
||||
<if test="billFee != null "> and bill_fee = #{billFee}</if>
|
||||
<if test="curStartNo != null and curStartNo != ''"> and cur_start_no like concat('%', #{curStartNo}, '%')</if>
|
||||
<if test="provideDate != null "> and provide_date = #{provideDate}</if>
|
||||
<if test="provideMan != null and provideMan != ''"> and provide_man like concat('%', #{provideMan}, '%')</if>
|
||||
<if test="provideSite != null and provideSite != ''"> and provide_site like concat('%', #{provideSite}, '%')</if>
|
||||
<if test="applySeq != null and applySeq != ''"> and apply_seq like concat('%', #{applySeq}, '%')</if>
|
||||
<if test="centerPagId != null "> and center_pag_id = #{centerPagId}</if>
|
||||
<if test="provideFlag != null and provideFlag != ''"> and provide_flag like concat('%', #{provideFlag}, '%')</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{delFlag}, '%')</if>
|
||||
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
|
||||
@ -65,17 +75,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
select count(1) from emis_electronic_site_pag
|
||||
where del_flag='0'
|
||||
and id = #{id}
|
||||
and use_site_code = #{useSiteCode}
|
||||
and material_code = #{materialCode}
|
||||
and prefix = #{prefix}
|
||||
and start_no = #{startNo}
|
||||
and end_no = #{endNo}
|
||||
and cur_start_no = #{curStartNo}
|
||||
and use_site_code = #{useSiteCode}
|
||||
and material_code = #{materialCode}
|
||||
and bill_count = #{billCount}
|
||||
and unit_money = #{unitMoney}
|
||||
and has_bill_count = #{hasBillCount}
|
||||
and bill_fee = #{billFee}
|
||||
and cur_start_no = #{curStartNo}
|
||||
and provide_date = #{provideDate}
|
||||
and provide_man = #{provideMan}
|
||||
and provide_site = #{provideSite}
|
||||
and apply_seq = #{applySeq}
|
||||
and center_pag_id = #{centerPagId}
|
||||
and provide_flag = #{provideFlag}
|
||||
and status = #{status}
|
||||
and del_flag = #{delFlag}
|
||||
and create_by = #{createBy}
|
||||
@ -87,28 +102,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
and update_site = #{updateSite}
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectEmisElectronicSitePagById" parameterType="Long" resultMap="EmisElectronicSitePagResult">
|
||||
select id, use_site_code, material_code, start_no, end_no, bill_count, has_bill_count, bill_fee, cur_start_no, provide_date, provide_man, provide_site, status, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site
|
||||
select id, prefix, start_no, end_no, cur_start_no, use_site_code, material_code, bill_count, unit_money, has_bill_count, bill_fee, provide_date, provide_man, provide_site, apply_seq, center_pag_id, provide_flag, status, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site
|
||||
from emis_electronic_site_pag a
|
||||
where a.id = #{id}
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertEmisElectronicSitePag" parameterType="EmisElectronicSitePag" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into emis_electronic_site_pag
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="useSiteCode != null and useSiteCode != ''">use_site_code,</if>
|
||||
<if test="materialCode != null and materialCode != ''">material_code,</if>
|
||||
<if test="prefix != null and prefix != ''">prefix,</if>
|
||||
<if test="startNo != null and startNo != ''">start_no,</if>
|
||||
<if test="endNo != null and endNo != ''">end_no,</if>
|
||||
<if test="curStartNo != null and curStartNo != ''">cur_start_no,</if>
|
||||
<if test="useSiteCode != null and useSiteCode != ''">use_site_code,</if>
|
||||
<if test="materialCode != null and materialCode != ''">material_code,</if>
|
||||
<if test="billCount != null">bill_count,</if>
|
||||
<if test="unitMoney != null">unit_money,</if>
|
||||
<if test="hasBillCount != null">has_bill_count,</if>
|
||||
<if test="billFee != null">bill_fee,</if>
|
||||
<if test="curStartNo != null and curStartNo != ''">cur_start_no,</if>
|
||||
<if test="provideDate != null">provide_date,</if>
|
||||
<if test="provideMan != null and provideMan != ''">provide_man,</if>
|
||||
<if test="provideSite != null and provideSite != ''">provide_site,</if>
|
||||
<if test="applySeq != null and applySeq != ''">apply_seq,</if>
|
||||
<if test="centerPagId != null">center_pag_id,</if>
|
||||
<if test="provideFlag != null and provideFlag != ''">provide_flag,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="delFlag != null and delFlag != ''">del_flag,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
@ -118,20 +138,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="createSite != null and createSite != ''">create_site,</if>
|
||||
<if test="updateSite != null and updateSite != ''">update_site,</if>
|
||||
</trim>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="useSiteCode != null and useSiteCode != ''">#{useSiteCode},</if>
|
||||
<if test="materialCode != null and materialCode != ''">#{materialCode},</if>
|
||||
<if test="prefix != null and prefix != ''">#{prefix},</if>
|
||||
<if test="startNo != null and startNo != ''">#{startNo},</if>
|
||||
<if test="endNo != null and endNo != ''">#{endNo},</if>
|
||||
<if test="curStartNo != null and curStartNo != ''">#{curStartNo},</if>
|
||||
<if test="useSiteCode != null and useSiteCode != ''">#{useSiteCode},</if>
|
||||
<if test="materialCode != null and materialCode != ''">#{materialCode},</if>
|
||||
<if test="billCount != null">#{billCount},</if>
|
||||
<if test="unitMoney != null">#{unitMoney},</if>
|
||||
<if test="hasBillCount != null">#{hasBillCount},</if>
|
||||
<if test="billFee != null">#{billFee},</if>
|
||||
<if test="curStartNo != null and curStartNo != ''">#{curStartNo},</if>
|
||||
<if test="provideDate != null">#{provideDate},</if>
|
||||
<if test="provideMan != null and provideMan != ''">#{provideMan},</if>
|
||||
<if test="provideSite != null and provideSite != ''">#{provideSite},</if>
|
||||
<if test="applySeq != null and applySeq != ''">#{applySeq},</if>
|
||||
<if test="centerPagId != null">#{centerPagId},</if>
|
||||
<if test="provideFlag != null and provideFlag != ''">#{provideFlag},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
@ -141,23 +166,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="createSite != null and createSite != ''">#{createSite},</if>
|
||||
<if test="updateSite != null and updateSite != ''">#{updateSite},</if>
|
||||
</trim>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateEmisElectronicSitePag" parameterType="EmisElectronicSitePag">
|
||||
update emis_electronic_site_pag
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="useSiteCode != null and useSiteCode != ''">use_site_code = #{useSiteCode},</if>
|
||||
<if test="materialCode != null and materialCode != ''">material_code = #{materialCode},</if>
|
||||
<if test="prefix != null and prefix != ''">prefix = #{prefix},</if>
|
||||
<if test="startNo != null and startNo != ''">start_no = #{startNo},</if>
|
||||
<if test="endNo != null and endNo != ''">end_no = #{endNo},</if>
|
||||
<if test="curStartNo != null and curStartNo != ''">cur_start_no = #{curStartNo},</if>
|
||||
<if test="useSiteCode != null and useSiteCode != ''">use_site_code = #{useSiteCode},</if>
|
||||
<if test="materialCode != null and materialCode != ''">material_code = #{materialCode},</if>
|
||||
<if test="billCount != null">bill_count = #{billCount},</if>
|
||||
<if test="unitMoney != null">unit_money = #{unitMoney},</if>
|
||||
<if test="hasBillCount != null">has_bill_count = #{hasBillCount},</if>
|
||||
<if test="billFee != null">bill_fee = #{billFee},</if>
|
||||
<if test="curStartNo != null and curStartNo != ''">cur_start_no = #{curStartNo},</if>
|
||||
<if test="provideDate != null">provide_date = #{provideDate},</if>
|
||||
<if test="provideMan != null and provideMan != ''">provide_man = #{provideMan},</if>
|
||||
<if test="provideSite != null and provideSite != ''">provide_site = #{provideSite},</if>
|
||||
<if test="applySeq != null and applySeq != ''">apply_seq = #{applySeq},</if>
|
||||
<if test="centerPagId != null">center_pag_id = #{centerPagId},</if>
|
||||
<if test="provideFlag != null and provideFlag != ''">provide_flag = #{provideFlag},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
||||
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
|
||||
@ -176,7 +206,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEmisElectronicSitePagByIds" parameterType="String">
|
||||
delete from emis_electronic_site_pag where id in
|
||||
delete from emis_electronic_site_pag where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user