diff --git a/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisCommonController.java b/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisCommonController.java index fb3002024..af914a234 100644 --- a/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisCommonController.java +++ b/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisCommonController.java @@ -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(); diff --git a/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisElectronicPagApplyController.java b/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisElectronicPagApplyController.java index 2f196b51d..15ecea1c1 100644 --- a/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisElectronicPagApplyController.java +++ b/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisElectronicPagApplyController.java @@ -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)); + } + /** * 删除网点电子面单申请 */ diff --git a/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisElectronicPagController.java b/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisElectronicPagController.java index 98505bb2e..1de669a56 100644 --- a/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisElectronicPagController.java +++ b/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisElectronicPagController.java @@ -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()); - } - } /** * 新增电子面单 diff --git a/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisWaybillController.java b/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisWaybillController.java index 826fb600a..1f3b9ca47 100644 --- a/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisWaybillController.java +++ b/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisWaybillController.java @@ -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(); diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/domain/EmisElectronicPag.java b/emis-biz/src/main/java/com/xdadan/erp/emis/domain/EmisElectronicPag.java index fee7a9021..eeba508fe 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/domain/EmisElectronicPag.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/domain/EmisElectronicPag.java @@ -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:

电子面单 实体类

@@ -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; /* 已分配当前编号 */ diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/domain/EmisElectronicPagApply.java b/emis-biz/src/main/java/com/xdadan/erp/emis/domain/EmisElectronicPagApply.java index 06e9f40a7..617c66074 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/domain/EmisElectronicPagApply.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/domain/EmisElectronicPagApply.java @@ -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; // ------ diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/domain/EmisElectronicSitePag.java b/emis-biz/src/main/java/com/xdadan/erp/emis/domain/EmisElectronicSitePag.java index 87705b781..a3dc9b0a2 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/domain/EmisElectronicSitePag.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/domain/EmisElectronicSitePag.java @@ -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:

电子面单 实体类

+ * @version v1.0 + * @Description:

站点电子面单 实体类

*/ 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; diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/domain/enumtype/EmisBizErrorType.java b/emis-biz/src/main/java/com/xdadan/erp/emis/domain/enumtype/EmisBizErrorType.java index 607d4817e..3d5667762 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/domain/enumtype/EmisBizErrorType.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/domain/enumtype/EmisBizErrorType.java @@ -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; diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/mapper/EmisElectronicPagMapper.java b/emis-biz/src/main/java/com/xdadan/erp/emis/mapper/EmisElectronicPagMapper.java index f36d9d5ee..7af1a89dc 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/mapper/EmisElectronicPagMapper.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/mapper/EmisElectronicPagMapper.java @@ -73,15 +73,36 @@ public interface EmisElectronicPagMapper extends BaseMapper */ 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 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); } diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/mapper/EmisElectronicSitePagMapper.java b/emis-biz/src/main/java/com/xdadan/erp/emis/mapper/EmisElectronicSitePagMapper.java index 4910b1e1c..ffc78b802 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/mapper/EmisElectronicSitePagMapper.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/mapper/EmisElectronicSitePagMapper.java @@ -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

电子面单 Mapper 接口

@@ -21,6 +27,26 @@ import com.xdadan.erp.emis.domain.EmisElectronicSitePag; */ public interface EmisElectronicSitePagMapper extends BaseMapper { + + + /** + * 获取单个面单是否可用 + * @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 diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/service/IEmisElectronicPagApplyService.java b/emis-biz/src/main/java/com/xdadan/erp/emis/service/IEmisElectronicPagApplyService.java index 19ebe8576..e1478fc85 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/service/IEmisElectronicPagApplyService.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/service/IEmisElectronicPagApplyService.java @@ -51,6 +51,13 @@ public interface IEmisElectronicPagApplyService */ public int updateEmisElectronicPagApply(EmisElectronicPagApply emisElectronicPagApply); + /** + * 发放 + * @param emisElectronicPagApply + * @return + */ + public int send(EmisElectronicPagApply emisElectronicPagApply); + /** * 批量删除网点电子面单申请 * diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/service/IEmisElectronicPagService.java b/emis-biz/src/main/java/com/xdadan/erp/emis/service/IEmisElectronicPagService.java index 071dc6809..511d9ddf2 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/service/IEmisElectronicPagService.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/service/IEmisElectronicPagService.java @@ -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 电子面单 diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/service/IEmisElectronicSitePagService.java b/emis-biz/src/main/java/com/xdadan/erp/emis/service/IEmisElectronicSitePagService.java index 4b6737090..c9665770c 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/service/IEmisElectronicSitePagService.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/service/IEmisElectronicSitePagService.java @@ -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 diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisElectronicPagApplyServiceImpl.java b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisElectronicPagApplyServiceImpl.java index a4ef96603..b32a5f3ef 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisElectronicPagApplyServiceImpl.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisElectronicPagApplyServiceImpl.java @@ -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); + } + /** * 批量删除网点电子面单申请 * diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisElectronicPagServiceImpl.java b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisElectronicPagServiceImpl.java index 615b1f0ff..41bda864a 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisElectronicPagServiceImpl.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisElectronicPagServiceImpl.java @@ -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> 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> 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 > 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> rstList = new ArrayList<>(); + // 循环占用运单数 + Integer needApplyNum = applyNum; + List 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 pagMap = new HashMap(); + + 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 pagMap = new HashMap(); + + 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); } diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisElectronicSitePagServiceImpl.java b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisElectronicSitePagServiceImpl.java index 69b1dc999..b912a1f2b 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisElectronicSitePagServiceImpl.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisElectronicSitePagServiceImpl.java @@ -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; + } + /** * 查询电子面单 * diff --git a/emis-biz/src/main/resources/mapper/EmisElectronicPagApplyMapper.xml b/emis-biz/src/main/resources/mapper/EmisElectronicPagApplyMapper.xml index cd1c9a70b..65f04e879 100644 --- a/emis-biz/src/main/resources/mapper/EmisElectronicPagApplyMapper.xml +++ b/emis-biz/src/main/resources/mapper/EmisElectronicPagApplyMapper.xml @@ -6,6 +6,7 @@ + @@ -13,25 +14,21 @@ - + + + - - - - - - - + @@ -74,7 +71,7 @@ - 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 @@ -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 @@ @@ -167,6 +162,7 @@ insert into emis_electronic_pag_apply id, + prefix, apply_seq, apply_date, provide_type, @@ -174,23 +170,21 @@ material_name, apply_man_code, apply_site_code, - unit_money, 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, - start_no, - end_no, - cur_start_no, - has_bill_count, - bl_allow_allocate, + provide_flag, del_flag, create_by, create_time, @@ -202,6 +196,7 @@ #{id}, + #{prefix}, #{applySeq}, #{applyDate}, #{provideType}, @@ -209,23 +204,21 @@ #{materialName}, #{applyManCode}, #{applySiteCode}, - #{unitMoney}, #{applyCount}, + #{unitMoney}, #{sumMoney}, #{blSend}, #{sendDate}, #{sendManCode}, #{sendSiteCode}, + #{sendCenterManCode}, + #{sendCenterSiteCode}, #{blCancel}, #{cancelManCode}, #{cancelDate}, #{cancelSiteCode}, #{userSiteCode}, - #{startNo}, - #{endNo}, - #{curStartNo}, - #{hasBillCount}, - #{blAllowAllocate}, + #{provideFlag}, #{delFlag}, #{createBy}, #{createTime}, @@ -240,6 +233,7 @@ update emis_electronic_pag_apply + prefix = #{prefix}, apply_seq = #{applySeq}, apply_date = #{applyDate}, provide_type = #{provideType}, @@ -247,23 +241,21 @@ material_name = #{materialName}, apply_man_code = #{applyManCode}, apply_site_code = #{applySiteCode}, - unit_money = #{unitMoney}, apply_count = #{applyCount}, + unit_money = #{unitMoney}, sum_money = #{sumMoney}, bl_send = #{blSend}, send_date = #{sendDate}, send_man_code = #{sendManCode}, send_site_code = #{sendSiteCode}, + send_center_man_code = #{sendCenterManCode}, + send_center_site_code = #{sendCenterSiteCode}, bl_cancel = #{blCancel}, cancel_man_code = #{cancelManCode}, cancel_date = #{cancelDate}, cancel_site_code = #{cancelSiteCode}, user_site_code = #{userSiteCode}, - start_no = #{startNo}, - end_no = #{endNo}, - cur_start_no = #{curStartNo}, - has_bill_count = #{hasBillCount}, - bl_allow_allocate = #{blAllowAllocate}, + provide_flag = #{provideFlag}, del_flag = #{delFlag}, create_by = #{createBy}, create_time = #{createTime}, @@ -286,4 +278,5 @@ #{id} + \ No newline at end of file diff --git a/emis-biz/src/main/resources/mapper/EmisElectronicPagMapper.xml b/emis-biz/src/main/resources/mapper/EmisElectronicPagMapper.xml index 0528560ea..798a816b5 100644 --- a/emis-biz/src/main/resources/mapper/EmisElectronicPagMapper.xml +++ b/emis-biz/src/main/resources/mapper/EmisElectronicPagMapper.xml @@ -6,9 +6,11 @@ + + @@ -27,7 +29,7 @@ - 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 @@ -92,9 +98,11 @@ insert into emis_electronic_pag id, + prefix, start_no, end_no, bill_count, + unit_money, bill_fee, cur_start_no, has_bill_count, @@ -113,9 +121,11 @@ #{id}, + #{prefix}, #{startNo}, #{endNo}, #{billCount}, + #{unitMoney}, #{billFee}, #{curStartNo}, #{hasBillCount}, @@ -137,9 +147,11 @@ update emis_electronic_pag + prefix = #{prefix}, start_no = #{startNo}, end_no = #{endNo}, bill_count = #{billCount}, + unit_money = #{unitMoney}, bill_fee = #{billFee}, cur_start_no = #{curStartNo}, has_bill_count = #{hasBillCount}, diff --git a/emis-biz/src/main/resources/mapper/EmisElectronicSitePagMapper.xml b/emis-biz/src/main/resources/mapper/EmisElectronicSitePagMapper.xml index 6debd39c0..4fcb0aed1 100644 --- a/emis-biz/src/main/resources/mapper/EmisElectronicSitePagMapper.xml +++ b/emis-biz/src/main/resources/mapper/EmisElectronicSitePagMapper.xml @@ -1,22 +1,27 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + - - + + + + + - + + + @@ -29,25 +34,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - 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 - + - + insert into emis_electronic_site_pag id, - use_site_code, - material_code, + prefix, start_no, end_no, + cur_start_no, + use_site_code, + material_code, bill_count, + unit_money, has_bill_count, bill_fee, - cur_start_no, provide_date, provide_man, provide_site, + apply_seq, + center_pag_id, + provide_flag, status, del_flag, create_by, @@ -118,20 +138,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" remark, create_site, update_site, - + #{id}, - #{useSiteCode}, - #{materialCode}, + #{prefix}, #{startNo}, #{endNo}, + #{curStartNo}, + #{useSiteCode}, + #{materialCode}, #{billCount}, + #{unitMoney}, #{hasBillCount}, #{billFee}, - #{curStartNo}, #{provideDate}, #{provideMan}, #{provideSite}, + #{applySeq}, + #{centerPagId}, + #{provideFlag}, #{status}, #{delFlag}, #{createBy}, @@ -141,23 +166,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{remark}, #{createSite}, #{updateSite}, - + update emis_electronic_site_pag - use_site_code = #{useSiteCode}, - material_code = #{materialCode}, + prefix = #{prefix}, start_no = #{startNo}, end_no = #{endNo}, + cur_start_no = #{curStartNo}, + use_site_code = #{useSiteCode}, + material_code = #{materialCode}, bill_count = #{billCount}, + unit_money = #{unitMoney}, has_bill_count = #{hasBillCount}, bill_fee = #{billFee}, - cur_start_no = #{curStartNo}, provide_date = #{provideDate}, provide_man = #{provideMan}, provide_site = #{provideSite}, + apply_seq = #{applySeq}, + center_pag_id = #{centerPagId}, + provide_flag = #{provideFlag}, status = #{status}, del_flag = #{delFlag}, create_by = #{createBy}, @@ -176,7 +206,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from emis_electronic_site_pag where id in + delete from emis_electronic_site_pag where id in #{id}