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