Compare commits

...

2 Commits

Author SHA1 Message Date
dingjie 1e77850c42 Merge remote-tracking branch 'origin/dev' into dev 2023-12-21 20:28:46 +08:00
dingjie 881b8b80df 新购验收模块 2023-12-21 20:28:01 +08:00
20 changed files with 426 additions and 139 deletions

View File

@ -75,4 +75,10 @@ public interface MaTypeMapper {
List<MaType> selectMaTypeListByLevelNotFour(String parentId);
List<MaType> getMaTypeSelect(String parentId);
int deleteTypeByTypeId(Long typeId);
int deleteKeeperByTypeId(Long typeId);
int deletePropSetByTypeId(Long typeId);
}

View File

@ -125,25 +125,28 @@ public class MaTypeServiceImpl implements ITypeService {
}
// 库管员配置
if (maType.getKeeperUserId() >= 0L) {
maTypeMapper.deleteKeeperByTypeId(typeId);
MaTypeKeeper typeKeeper = new MaTypeKeeper();
typeKeeper.setUserId(maType.getKeeperUserId());
typeKeeper.setTypeId(typeId);
maTypeMapper.updateKeeperByTypeId(typeKeeper);
maTypeMapper.insertKeeper(typeKeeper);
}
// 维修员配置
if (maType.getRepairUserId() >= 0L) {
maTypeMapper.deleteTypeByTypeId(typeId);
MaTypeRepair typeRepair = new MaTypeRepair();
typeRepair.setUserId(maType.getRepairUserId());
typeRepair.setTypeId(typeId);
maTypeMapper.updateRepairByTypeId(typeRepair);
maTypeMapper.insertRepair(typeRepair);
}
// 资产属性配置
if (maType.getPropId() >= 0L) {
maTypeMapper.deletePropSetByTypeId(typeId);
MaPropSet propSet = new MaPropSet();
propSet.setTypeId(typeId);
propSet.setPropId(maType.getPropId());
maTypeMapper.updatePropSetByTypeId(propSet);
maTypeMapper.insertMaPropSet(propSet);
}
return i;
}
@ -353,7 +356,6 @@ public class MaTypeServiceImpl implements ITypeService {
childList.add(maType);
}
}
System.out.println(childList);
return childList;
}

View File

@ -89,38 +89,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getHouseSetList" resultType="com.bonus.sgzb.base.domain.MaHouseSet">
select mhs.house_id, mhs.type_id, mhs.ma_id, mhs.num, mhs.status, mhs.dept_id, mhs.del_flag,
mhs.create_by, mhs.create_time, mhs.update_by,mhs.update_time,mhs.remark,mhs.company_id,
mm.ma_code maCode , mt.type_name specificationType, mt1.type_name machineTypeName, mt2.type_name itemType
from ma_house_set mhs
left join ma_machine mm on mhs.ma_id = mm.ma_id
left join ma_type mt on mhs.type_id = mt.type_id
select mt.type_name specificationType, mt1.type_name machineTypeName, mt2.type_name itemType ,
mm.ma_code maCode, mhs.house_id, mhs.type_id, mhs.ma_id, mhs.num, mhs.status, mhs.dept_id, mhs.del_flag,
mhs.create_by, mhs.create_time, mhs.update_by,mhs.update_time,mhs.remark,mhs.company_id
from ma_type mt
left join ma_machine mm on mt.type_id = mm.type_id
left join ma_type mt1 on mt.parent_id = mt1.type_id
left join ma_type mt2 on mt1.parent_id = mt2.type_id
<where>
<if test="houseId != null and houseId != ''">
AND mhs.house_id = #{houseId}
</if>
<if test="typeId != null and typeId != ''">
AND mhs.type_id = #{typeId}
</if>
<if test="maId != null and maId != ''">
AND mhs.ma_id = #{maId}
</if>
<if test="status != null and status != ''">
and mhs.status = #{status}
</if>
<if test="deptId != null and deptId != ''">
and mhs.dept_id = #{deptId}
</if>
<if test="delFlag != null and delFlag != ''">
and mhs.del_flag = #{delFlag}
</if>
<if test="companyId != null and companyId != ''">
and mhs.company_id = #{companyId}
</if>
</where>
left join ma_house_set mhs on mt.type_id = mhs.type_id
where mt.manage_type = '0' and mt.level = '4'
<if test="houseId != null and houseId != ''">
AND mhs.house_id = #{houseId}
</if>
<if test="typeId != null and typeId != ''">
AND mhs.type_id = #{typeId}
</if>
<if test="maId != null and maId != ''">
AND mhs.ma_id = #{maId}
</if>
<if test="status != null and status != ''">
and mhs.status = #{status}
</if>
<if test="deptId != null and deptId != ''">
and mhs.dept_id = #{deptId}
</if>
<if test="delFlag != null and delFlag != ''">
and mhs.del_flag = #{delFlag}
</if>
<if test="companyId != null and companyId != ''">
and mhs.company_id = #{companyId}
</if>
</select>

View File

@ -159,9 +159,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<delete id="deleteTypeById" parameterType="Long">
update ma_type set del_flag = '2' where type_id = #{typeId}
</delete>
<delete id="deleteTypeByTypeId">
delete from ma_type_repair where type_id = #{typeId}
</delete>
<delete id="deleteKeeperByTypeId">
delete from ma_type_keeper where type_id = #{typeId}
</delete>
<delete id="deletePropSetByTypeId">
delete from ma_prop_set where type_id = #{typeId}
</delete>
<select id="selectMaTypeList" parameterType="String" resultMap="MaTypeResult">
select m.type_id, m.type_name, m.parent_id, m.status, m.num, m.unit_id, m.manage_type,
select m.type_id, m.type_name, m.parent_id, m.status, m.num, m.unit_id, m.unit_name, m.manage_type,
m.lease_price,m.eff_time, m.rent_price, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load,
m.holding_time, m.warn_num, mtf.file_name photoName, mtf.file_url photoUrl,
mtf2.file_name documentName, mtf2.file_url documentUrl, mtk.user_id keeperUserId,

View File

@ -10,14 +10,7 @@ import com.bonus.sgzb.material.vo.NoticeInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.bonus.sgzb.common.log.annotation.Log;
import com.bonus.sgzb.common.log.enums.BusinessType;
import com.bonus.sgzb.common.security.annotation.RequiresPermissions;
@ -81,10 +74,11 @@ public class PurchaseCheckInfoController extends BaseController
* 获取新购验收任务详细信息
*/
@ApiOperation("获取新购验收任务详细信息")
@GetMapping(value = "/{taskId}")
public AjaxResult getInfo(@PathVariable("taskId") Long taskId)
@GetMapping(value = "/getDetails")
public AjaxResult getInfo(@RequestParam(required = false) Long taskId,
@RequestParam(required = false) String keyword)
{
return success(purchaseCheckInfoService.selectPurchaseCheckInfoByTaskId(taskId));
return success(purchaseCheckInfoService.selectPurchaseCheckInfoByTaskId(taskId,keyword));
}
/**

View File

@ -10,14 +10,7 @@ import com.bonus.sgzb.material.vo.EquipmentNumberVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.core.utils.poi.ExcelUtil;
@ -42,13 +35,12 @@ public class PurchaseMacodeInfoController extends BaseController
*/
@ApiOperation(value = "查询新购验收编号管理列表")
@GetMapping("/list")
public TableDataInfo list(PurchaseMacodeInfo purchaseMacodeInfo) throws Exception {
startPage();
public AjaxResult list(PurchaseMacodeInfo purchaseMacodeInfo) throws Exception {
if (purchaseMacodeInfo.getTaskId() == null || purchaseMacodeInfo.getTaskId() == 0) {
throw new Exception("任务taskId为空!!!");
}
List<PurchaseMacodeInfo> list = purchaseMacodeInfoService.selectPurchaseMacodeInfoList(purchaseMacodeInfo);
return getDataTable(list);
return AjaxResult.success(list);
}
/**
@ -67,10 +59,10 @@ public class PurchaseMacodeInfoController extends BaseController
* 获取新购验收编号管理详细信息
*/
@ApiOperation(value = "获取新购验收编号管理详细信息")
@GetMapping(value = "/{taskId}")
public AjaxResult getInfo(@PathVariable("taskId") Long taskId)
@GetMapping(value = "/getInfo")
public AjaxResult getInfo(PurchaseMacodeInfo purchaseMacodeInfo)
{
return success(purchaseMacodeInfoService.selectPurchaseMacodeInfoByTaskId(taskId));
return success(purchaseMacodeInfoService.selectPurchaseMacodeInfo(purchaseMacodeInfo));
}
/**
@ -78,9 +70,8 @@ public class PurchaseMacodeInfoController extends BaseController
*/
@ApiOperation(value = "新增新购验收编号管理")
@PostMapping
public AjaxResult add(@RequestBody PurchaseMacodeInfo purchaseMacodeInfo)
{
return toAjax(purchaseMacodeInfoService.insertPurchaseMacodeInfo(purchaseMacodeInfo));
public AjaxResult add(@RequestBody List<PurchaseMacodeInfo> purchaseMacodeInfoList) throws Exception {
return toAjax(purchaseMacodeInfoService.insertPurchaseMacodeInfo(purchaseMacodeInfoList));
}
/**
@ -121,9 +112,9 @@ public class PurchaseMacodeInfoController extends BaseController
* 删除新购验收编号管理
*/
@ApiOperation(value = "删除新购验收编号管理")
@DeleteMapping("/{id}")
public AjaxResult remove(@PathVariable Long id)
@DeleteMapping("/{maCode}")
public AjaxResult remove(@PathVariable String maCode)
{
return toAjax(purchaseMacodeInfoService.deletePurchaseMacodeInfoById(id));
return toAjax(purchaseMacodeInfoService.deletePurchaseMacodeInfoByMaCode(maCode));
}
}

View File

@ -43,6 +43,10 @@ public class PurchaseCheckDetails extends BaseEntity
@ApiModelProperty(value = "验收数量")
private BigDecimal checkNum;
/** 绑定数量 */
@ApiModelProperty(value = "绑定数量")
private Integer bindNum;
/** 验收结论 */
@ApiModelProperty(value = "验收结论")
private String checkResult;
@ -103,6 +107,9 @@ public class PurchaseCheckDetails extends BaseEntity
@ApiModelProperty(value = "采购单号")
private String code;
@ApiModelProperty(value = "关键字筛选")
private String keyWord;
public void setTaskId(Long taskId)
{
this.taskId = taskId;
@ -279,6 +286,22 @@ public class PurchaseCheckDetails extends BaseEntity
this.code = code;
}
public String getKeyWord() {
return keyWord;
}
public void setKeyWord(String keyWord) {
this.keyWord = keyWord;
}
public Integer getBindNum() {
return bindNum;
}
public void setBindNum(Integer bindNum) {
this.bindNum = bindNum;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -37,6 +37,10 @@ public class PurchaseCheckInfo extends BaseEntity
@ApiModelProperty(value = "采购员")
private Long purchaser;
/** 采购员名称 */
@ApiModelProperty(value = "采购员名称")
private String purchaserName;
/** 数据所属组织 */
@ApiModelProperty(value = "数据所属组织")
private Integer companyId;
@ -55,6 +59,12 @@ public class PurchaseCheckInfo extends BaseEntity
@ApiModelProperty(value = "新购验收任务详情")
private List<PurchaseCheckDetails> checkDetailsList;
/**
* 任务状态(定义数据字典)
*/
@ApiModelProperty(value="任务状态(数据字典)")
private Integer taskStatus;
public Long getId() {
return id;
}
@ -141,6 +151,22 @@ public class PurchaseCheckInfo extends BaseEntity
this.purchasingTypeName = purchasingTypeName;
}
public String getPurchaserName() {
return purchaserName;
}
public void setPurchaserName(String purchaserName) {
this.purchaserName = purchaserName;
}
public Integer getTaskStatus() {
return taskStatus;
}
public void setTaskStatus(Integer taskStatus) {
this.taskStatus = taskStatus;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -1,10 +1,14 @@
package com.bonus.sgzb.material.domain;
import com.bonus.sgzb.common.core.web.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
import java.util.Date;
/**
* 新购验收编号管理对象
*
@ -66,6 +70,38 @@ public class PurchaseMacodeInfo extends BaseEntity
@ApiModelProperty(value = "机具ID")
private long maId;
/** 采购数量 */
@ApiModelProperty(value = "采购数量")
private Long purchaseNum;
/** 验收数量 */
@ApiModelProperty(value = "验收数量")
private BigDecimal checkNum;
/** 验收数量 */
@ApiModelProperty(value = "绑定数量")
private Integer bindNum;
@ApiModelProperty(value = "关键字筛选")
private String keyWord;
@ApiModelProperty(value = "规格编码")
private String specsCode;
@ApiModelProperty(value = "类型编码")
private String typeCode;
@ApiModelProperty(value = "固定资产编码")
private String assetsCode;
@ApiModelProperty(value = "采购时间")
private String purchaseTime;
/** 出厂日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "出厂日期")
private Date productionTime;
public Long getId() {
return id;
}
@ -170,6 +206,78 @@ public class PurchaseMacodeInfo extends BaseEntity
this.maId = maId;
}
public Long getPurchaseNum() {
return purchaseNum;
}
public void setPurchaseNum(Long purchaseNum) {
this.purchaseNum = purchaseNum;
}
public BigDecimal getCheckNum() {
return checkNum;
}
public void setCheckNum(BigDecimal checkNum) {
this.checkNum = checkNum;
}
public Integer getBindNum() {
return bindNum;
}
public void setBindNum(Integer bindNum) {
this.bindNum = bindNum;
}
public String getKeyWord() {
return keyWord;
}
public void setKeyWord(String keyWord) {
this.keyWord = keyWord;
}
public String getSpecsCode() {
return specsCode;
}
public void setSpecsCode(String specsCode) {
this.specsCode = specsCode;
}
public String getTypeCode() {
return typeCode;
}
public void setTypeCode(String typeCode) {
this.typeCode = typeCode;
}
public String getPurchaseTime() {
return purchaseTime;
}
public void setPurchaseTime(String purchaseTime) {
this.purchaseTime = purchaseTime;
}
public Date getProductionTime() {
return productionTime;
}
public void setProductionTime(Date productionTime) {
this.productionTime = productionTime;
}
public String getAssetsCode() {
return assetsCode;
}
public void setAssetsCode(String assetsCode) {
this.assetsCode = assetsCode;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -89,4 +89,11 @@ public interface PurchaseMacodeInfoMapper {
int updateMaMachine(MaMachine maMachine);
int selectMachineByMaCode(String codingRule);
int deletePurchaseMacodeInfoByMaCode(String maCode);
int deleteMaMachineInfoByMaCode(String maCode);
List<PurchaseMacodeInfo> selectPurchaseMacodeInfo(PurchaseMacodeInfo purchaseMacodeInfo);
}

View File

@ -20,7 +20,7 @@ public interface IPurchaseCheckInfoService
* @param taskId 新购验收任务purchase_check_info主键
* @return 新购验收任务purchase_check_info
*/
public PurchaseCheckInfo selectPurchaseCheckInfoByTaskId(Long taskId);
public PurchaseCheckInfo selectPurchaseCheckInfoByTaskId(Long taskId,String keyword);
/**
* 查询新购验收任务purchase_check_info列表

View File

@ -1,5 +1,6 @@
package com.bonus.sgzb.material.service;
import com.alibaba.fastjson.JSONObject;
import com.bonus.sgzb.material.domain.MaInputRecord;
import com.bonus.sgzb.material.domain.PurchaseMacodeInfo;
import com.bonus.sgzb.material.vo.EquipmentNumberVO;
@ -33,10 +34,10 @@ public interface IPurchaseMacodeInfoService
/**
* 新增新购验收编号管理purchase_macode_info
*
* @param purchaseMacodeInfo 新购验收编号管理purchase_macode_info
* @param purchaseMacodeInfoList 新购验收编号管理purchase_macode_info
* @return 结果
*/
public int insertPurchaseMacodeInfo(PurchaseMacodeInfo purchaseMacodeInfo);
public int insertPurchaseMacodeInfo(List<PurchaseMacodeInfo> purchaseMacodeInfoList) throws Exception;
/**
* 修改新购验收编号管理purchase_macode_info
@ -62,9 +63,13 @@ public interface IPurchaseMacodeInfoService
*/
public int deletePurchaseMacodeInfoByTaskId(Long taskId);
List<String> generateEquipmentNumber(EquipmentNumberVO equipmentNumberVO);
JSONObject generateEquipmentNumber(EquipmentNumberVO equipmentNumberVO);
int deletePurchaseMacodeInfoById(Long id);
int modifyManageStatus(MaInputRecord maInputRecord);
int deletePurchaseMacodeInfoByMaCode(String maCode);
List<PurchaseMacodeInfo> selectPurchaseMacodeInfo(PurchaseMacodeInfo purchaseMacodeInfo);
}

View File

@ -11,6 +11,7 @@ import com.bonus.sgzb.material.service.IPurchaseCheckDetailsService;
import com.bonus.sgzb.common.core.utils.DateUtils;
import com.bonus.sgzb.material.service.IPurchaseMacodeInfoService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
@ -72,19 +73,21 @@ public class PurchaseCheckDetailsServiceImpl implements IPurchaseCheckDetailsSer
* @return 结果
*/
@Override
@Transactional
public int updatePurchaseCheckDetails(List<PurchaseCheckDetails> purchaseCheckDetailsList) {
Long taskId = 0L;
for (PurchaseCheckDetails purchaseCheckDetails : purchaseCheckDetailsList) {
taskId = purchaseCheckDetails.getTaskId();
if ("通过".equals(purchaseCheckDetails.getCheckResult())) {
purchaseCheckDetails.setStatus(1);
// 通过之后往编码管理表里回填数据
if ("0".equals(purchaseCheckDetails.getManageType())) {
PurchaseMacodeInfo macodeInfo = new PurchaseMacodeInfo();
macodeInfo.setTypeId(purchaseCheckDetails.getTypeId());
macodeInfo.setTaskId(taskId);
macodeInfoService.insertPurchaseMacodeInfo(macodeInfo);
}
// // 通过之后往编码管理表里回填数据
// if ("0".equals(purchaseCheckDetails.getManageType())) {
// PurchaseMacodeInfo macodeInfo = new PurchaseMacodeInfo();
// macodeInfo.setTypeId(purchaseCheckDetails.getTypeId());
// macodeInfo.setTaskId(taskId);
// macodeInfo.setStatus("0");
// macodeInfoService.insertPurchaseMacodeInfo(macodeInfo);
// }
} else if ("不通过".equals(purchaseCheckDetails.getCheckResult())) {
purchaseCheckDetails.setStatus(0);
} else {

View File

@ -45,14 +45,16 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService
* 查询新购验收任务
*
* @param taskId 新购验收任务主键
* @param keyword 关键字筛选
* @return 新购验收任务
*/
@Override
public PurchaseCheckInfo selectPurchaseCheckInfoByTaskId(Long taskId)
public PurchaseCheckInfo selectPurchaseCheckInfoByTaskId(Long taskId,String keyword)
{
PurchaseCheckInfo purchaseCheckInfo = purchaseCheckInfoMapper.selectPurchaseCheckInfoByTaskId(taskId);
PurchaseCheckDetails purchaseCheckDetails = new PurchaseCheckDetails();
purchaseCheckDetails.setTaskId(purchaseCheckInfo.getTaskId());
purchaseCheckDetails.setKeyWord(keyword);
List<PurchaseCheckDetails> purchaseCheckDetailsList = purchaseCheckDetailsMapper.selectPurchaseCheckDetailsList(purchaseCheckDetails);
purchaseCheckInfo.setCheckDetailsList(purchaseCheckDetailsList);
return purchaseCheckInfo;

View File

@ -10,6 +10,7 @@ import com.alibaba.fastjson.JSONObject;
import com.bonus.sgzb.base.api.domain.MaMachine;
import com.bonus.sgzb.base.api.domain.MaType;
import com.bonus.sgzb.base.api.domain.TmTask;
import com.bonus.sgzb.common.core.utils.StringUtils;
import com.bonus.sgzb.material.domain.BmQrcodeInfo;
import com.bonus.sgzb.material.domain.MaInputRecord;
import com.bonus.sgzb.material.domain.PurchaseCheckDetails;
@ -19,6 +20,7 @@ import com.bonus.sgzb.material.service.IPurchaseMacodeInfoService;
import com.bonus.sgzb.common.core.utils.DateUtils;
import com.bonus.sgzb.material.vo.EquipmentNumberVO;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
@ -70,13 +72,48 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
/**
* 新增新购验收编号管理
*
* @param purchaseMacodeInfo 新购验收编号管理
* @param purchaseMacodeInfoList 新购验收编号管理
* @return 结果
*/
@Override
public int insertPurchaseMacodeInfo(PurchaseMacodeInfo purchaseMacodeInfo) {
purchaseMacodeInfo.setCreateTime(DateUtils.getNowDate());
return purchaseMacodeInfoMapper.insertPurchaseMacodeInfo(purchaseMacodeInfo);
public int insertPurchaseMacodeInfo(List<PurchaseMacodeInfo> purchaseMacodeInfoList) throws Exception {
for (PurchaseMacodeInfo purchaseMacodeInfo : purchaseMacodeInfoList) {
Long typeId = purchaseMacodeInfo.getTypeId();
String maCode = purchaseMacodeInfo.getMaCode();
if (StringUtils.isNotEmpty(maCode)) {
MaMachine maMachine = new MaMachine();
maMachine.setTypeId(typeId);
maMachine.setMaStatus("14");
maMachine.setQrCode(purchaseMacodeInfo.getQrCode());
// 设备原厂编号
String fixCode = purchaseMacodeInfo.getFixCode();
if ("0".equals(fixCode)) {
MaMachine machine = purchaseMacodeInfoMapper.selectMachineByAssetsCode(purchaseMacodeInfo.getAssetsCode());
if (machine != null) {
throw new Exception("固定资产编号已存在");
}
maMachine.setAssetsCode(purchaseMacodeInfo.getAssetsCode());
}
maMachine.setMaCode(maCode);
maMachine.setCreateTime(new Date());
purchaseMacodeInfoMapper.maMachineAdd(maMachine);
}
String qrCode = purchaseMacodeInfo.getQrCode();
// 二维码存储
if (StringUtils.isNotEmpty(qrCode)) {
BmQrcodeInfo bmQrcodeInfo = new BmQrcodeInfo();
bmQrcodeInfo.setTypeId(typeId);
bmQrcodeInfo.setQrCode(qrCode);
bmQrcodeInfo.setTaskId(purchaseMacodeInfo.getTaskId());
bmQrcodeInfo.setCreateTime(new Date());
qrcodeInfoMapper.insertBmQrcodeInfo(bmQrcodeInfo);
}
purchaseMacodeInfo.setStatus("0");
purchaseMacodeInfo.setCreateTime(DateUtils.getNowDate());
purchaseMacodeInfoMapper.insertPurchaseMacodeInfo(purchaseMacodeInfo);
}
return 1;
}
@ -90,39 +127,35 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
public int updatePurchaseMacodeInfo(List<PurchaseMacodeInfo> purchaseMacodeInfoList) throws Exception {
for (PurchaseMacodeInfo purchaseMacodeInfo : purchaseMacodeInfoList) {
MaMachine maMachine = new MaMachine();
Long typeId = purchaseMacodeInfo.getTypeId();
maMachine.setTypeId(typeId);
// 查询机具类型前三级名称
JSONObject jsonObject = purchaseMacodeInfoMapper.getTypeNameByTypeId(typeId);
String specsName = jsonObject.getString("specsName");
String typeName = jsonObject.getString("typeName");
String itemTypeName = jsonObject.getString("itemTypeName");
maMachine.setItemType(itemTypeName);
maMachine.setMaStatus("14");
maMachine.setDeviceType(typeName);
maMachine.setSpecificationType(specsName);
maMachine.setQrCode(purchaseMacodeInfo.getQrCode());
// 设备原厂编号
String fixCode = purchaseMacodeInfo.getFixCode();
if ("".equals(fixCode)) {
MaMachine machine = purchaseMacodeInfoMapper.selectMachineByAssetsCode(fixCode);
if (machine != null) {
throw new Exception("固定资产编号已存在");
String maCode = purchaseMacodeInfo.getMaCode();
if (StringUtils.isNotEmpty(maCode)) {
MaMachine maMachine = new MaMachine();
maMachine.setTypeId(typeId);
maMachine.setMaStatus("14");
maMachine.setQrCode(purchaseMacodeInfo.getQrCode());
// 设备原厂编号
String fixCode = purchaseMacodeInfo.getFixCode();
if ("1".equals(fixCode)) {
MaMachine machine = purchaseMacodeInfoMapper.selectMachineByAssetsCode(fixCode);
if (machine != null) {
throw new Exception("固定资产编号已存在");
}
maMachine.setAssetsCode(fixCode);
}
maMachine.setAssetsCode(fixCode);
maMachine.setMaCode(maCode);
purchaseMacodeInfoMapper.maMachineAdd(maMachine);
}
maMachine.setMaCode(purchaseMacodeInfo.getMaCode());
purchaseMacodeInfoMapper.maMachineAdd(maMachine);
String qrCode = purchaseMacodeInfo.getQrCode();
// 二维码存储
BmQrcodeInfo bmQrcodeInfo = new BmQrcodeInfo();
bmQrcodeInfo.setTypeId(typeId);
bmQrcodeInfo.setQrCode(purchaseMacodeInfo.getQrCode());
bmQrcodeInfo.setTaskId(purchaseMacodeInfo.getTaskId());
bmQrcodeInfo.setCreateTime(new Date());
qrcodeInfoMapper.insertBmQrcodeInfo(bmQrcodeInfo);
if (StringUtils.isNotEmpty(qrCode)) {
BmQrcodeInfo bmQrcodeInfo = new BmQrcodeInfo();
bmQrcodeInfo.setTypeId(typeId);
bmQrcodeInfo.setQrCode(qrCode);
bmQrcodeInfo.setTaskId(purchaseMacodeInfo.getTaskId());
bmQrcodeInfo.setCreateTime(new Date());
qrcodeInfoMapper.insertBmQrcodeInfo(bmQrcodeInfo);
}
// 修改新购机具编码
purchaseMacodeInfo.setUpdateTime(DateUtils.getNowDate());
purchaseMacodeInfoMapper.updatePurchaseMacodeInfo(purchaseMacodeInfo);
@ -159,28 +192,51 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
* @return 编码结果
*/
@Override
public List<String> generateEquipmentNumber(EquipmentNumberVO equipmentNumberVO) {
public JSONObject generateEquipmentNumber(EquipmentNumberVO equipmentNumberVO) {
Long typeId = equipmentNumberVO.getTypeId();
SimpleDateFormat sdf = new SimpleDateFormat("yyMM");
Date nowDate = DateUtils.getNowDate();
String format = sdf.format(nowDate);
JSONObject jsonObject = purchaseMacodeInfoMapper.getTypeByTypeId(typeId);
String typeCode = jsonObject.getString("typeCode");
String typeCode = jsonObject.getString("modelCode");
String specsCode = jsonObject.getString("specsCode");
//序列号
int count = purchaseMacodeInfoMapper.getSerialNumber(typeId, nowDate) + 1;
List<String> list = new ArrayList<>();
List<String> codeList = new ArrayList<>();
for (int i = 0; i < equipmentNumberVO.getCount(); i++) {
int i1 = count + i;
// 编码规则
String codingRule = "NXJJ" + typeCode + format + specsCode + "-000" + i1;
String codingRule = "NXJJ" + typeCode + format + specsCode;
String codeNum = "";
String code = format;
String code1 = format;
if (i1>9 && i1<100){
codeNum = "-00" + i1;
code1 = "-00" + i1;
}else if (i1>99 && i1<1000){
codeNum = "-0" + i1;
code1 = "-0" + i1;
}else {
codeNum = "-000" + i1;
code1 = "-000" + i1;
}
codingRule = codingRule + codeNum;
code = code + code1;
// 二维码
String code = format + "000" + i1;
list.add(codingRule);
int i2 = purchaseMacodeInfoMapper.selectMachineByMaCode(codingRule);
if (i2 <= 0) {
list.add(codingRule);
}
codeList.add(code);
}
return list;
JSONObject result = new JSONObject();
result.put("equipmentNum",list);
result.put("twoDimensionalCode",codeList);
return result;
}
/**
@ -214,6 +270,7 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
// 修改机具入库状态
MaMachine maMachine = new MaMachine();
maMachine.setMaId(maInputRecord.getMaId());
maMachine.setMaCode(maInputRecord.getMaCode());
maMachine.setMaStatus("15");
purchaseMacodeInfoMapper.updateMaMachine(maMachine);
@ -246,4 +303,26 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
return 1;
}
/**
* 根据机具编码删除编码
* @param maCode 机具编码
* @return 结果
*/
@Override
@Transactional
public int deletePurchaseMacodeInfoByMaCode(String maCode) {
purchaseMacodeInfoMapper.deleteMaMachineInfoByMaCode(maCode);
return purchaseMacodeInfoMapper.deletePurchaseMacodeInfoByMaCode(maCode);
}
/**
* 根据类型id和任务id查询编码详情
* @param purchaseMacodeInfo
* @return 结果
*/
@Override
public List<PurchaseMacodeInfo> selectPurchaseMacodeInfo(PurchaseMacodeInfo purchaseMacodeInfo) {
return purchaseMacodeInfoMapper.selectPurchaseMacodeInfo(purchaseMacodeInfo);
}
}

View File

@ -256,6 +256,14 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
Date nowDate = DateUtils.getNowDate();
String format = dateFormat.format(nowDate);
int taskNum = taskMapper.selectTaskNumByMonth(nowDate,taskType) + 1;
return code + format + "-000" + taskNum;
String codeNum="";
if (taskNum>9 && taskNum<100){
codeNum = code + format + "-00" + taskNum;
}else if (taskNum>99 && taskNum<1000){
codeNum = code + format + "-0" + taskNum;
}else {
codeNum = code + format + "-000" + taskNum;
}
return codeNum;
}
}

View File

@ -43,6 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join tm_task tk on pcd.task_id = tk.task_id
<where>
<if test="taskId != null "> and pcd.task_id = #{taskId}</if>
<if test="keyWord != null and keyWord != ''">(mt.type_name like concat('%',#{keyWord},'%') or mt1.type_name like concat('%',#{keyWord})</if>
<if test="typeId != null "> and pcd.type_id = #{typeId}</if>
<if test="purchasePrice != null and purchasePrice != ''"> and pcd.purchase_price = #{purchasePrice}</if>
<if test="purchaseNum != null "> and pcd.purchase_num = #{purchaseNum}</if>
@ -169,8 +170,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="checkDetails.typeId != null">#{checkDetails.typeId},</if>
<if test="checkDetails.purchasePrice != null">#{checkDetails.purchasePrice},</if>
<if test="checkDetails.purchaseNum != null">#{checkDetails.purchaseNum},</if>
<if test="checkDetails.checkNum != null">#{checkNum},</if>
<if test="checkDetails.checkResult != null">#{checkResult},</if>
<if test="checkDetails.checkNum != null">#{checkDetails.checkNum},</if>
<if test="checkDetails.checkResult != null">#{checkDetails.checkResult},</if>
<if test="checkDetails.supplierId != null">#{checkDetails.supplierId},</if>
<if test="checkDetails.status != null">#{checkDetails.status},</if>
<if test="checkDetails.createBy != null">#{checkDetails.createBy},</if>

View File

@ -24,16 +24,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectPurchaseCheckInfoList" parameterType="com.bonus.sgzb.material.domain.PurchaseCheckInfo" resultMap="PurchaseCheckInfoResult">
select pci.id,pci.task_id, pci.purchase_time, pci.arrival_time, pci.purchaser, pci.create_by, pci.create_time, pci.update_by,
pci.update_time, pci.remark, pci.company_id ,dict.name purchasingStatus,tk.code
pci.update_time, pci.remark, pci.company_id ,dict.name purchasingStatus,tk.code,su.user_name purchaserName,tk.task_status taskStatus
from purchase_check_info pci
left join tm_task tk on pci.task_id = tk.task_id
left join (select id,name from sys_dic where p_id = 23) dict on tk.task_status = dict.id
where task_type = 23 and tk.task_status in (select id from sys_dic where p_id = 23)
left join sys_user su on pci.purchaser = su.user_id
where task_type = 23 and tk.task_status in (24,25,26,27)
<if test="purchaseTime != null and purchaseTime != ''"> and tk.code = #{code}</if>
<if test="purchaseTime != null and purchaseTime != ''"> and pci.purchase_time = #{purchaseTime}</if>
<if test="arrivalTime != null and arrivalTime != ''"> and pci.arrival_time = #{arrivalTime}</if>
<if test="purchaser != null "> and pci.purchaser = #{purchaser}</if>
<if test="companyId != null "> and pci.company_id = #{companyId}</if>
order by pci.create_time desc
</select>
<select id="selectPurchaseCheckInfoByTaskId" parameterType="Long" resultMap="PurchaseCheckInfoResult">
@ -146,7 +148,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from purchase_check_info pci
left join tm_task tk on pci.task_id = tk.task_id
left join (select id,name from sys_dic where p_id = 50) dict on tk.task_status = dict.id
where task_type = 23 and tk.task_status in (select id from sys_dic where p_id = 50)
where task_type = 23 and tk.task_status in (26,28)
<if test="purchaseTime != null and purchaseTime != ''"> and tk.code = #{code}</if>
<if test="purchaseTime != null and purchaseTime != ''"> and pci.purchase_time = #{purchaseTime}</if>
<if test="arrivalTime != null and arrivalTime != ''"> and pci.arrival_time = #{arrivalTime}</if>

View File

@ -25,16 +25,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectPurchaseMacodeInfoList" parameterType="com.bonus.sgzb.material.domain.PurchaseMacodeInfo" resultMap="PurchaseMacodeInfoResult">
select pmi.task_id, pmi.type_id, pmi.ma_code, pmi.qr_code, pmi.fix_code, pmi.code_type, pmi.status, pmi.create_by,
pmi.create_time, pmi.update_by, pmi.update_time, pmi.remark, pmi.company_id, mt.type_name specificationType,
mt1.type_name typeName, mma.ma_id maId
from purchase_macode_info pmi
left join ma_type mt on pmi.type_id = mt.type_id
select distinct pcd.task_id, pcd.type_id, pmi.qr_code, pmi.fix_code, pmi.code_type, pmi.status,
pmi.remark, pmi.company_id, mt.type_name specificationType,
mt1.type_name typeName, pcd.check_num checkNum, pcd.purchase_num purchaseNum ,
IFNULL(pcd.bind_num,0) bindNum, mt.code typeCode,mt.model_code specsCode,pt.purchase_time purchaseTime
from purchase_check_details pcd
left join ma_type mt on pcd.type_id = mt.type_id
left join ma_type mt1 on mt.parent_id = mt1.type_id
left join ma_machine mma on pmi.ma_code = mma.ma_code
where pmi.task_id = #{taskId}
left join purchase_macode_info pmi on pmi.task_id = pcd.task_id and pmi.type_id = pcd.type_id
left join purchase_check_info pt on pcd.task_id = pt.task_id
where pcd.task_id = #{taskId}
<if test="typeId != null "> and pmi.type_id = #{typeId}</if>
<if test="fixCode != null and fixCode != ''"> and pmi.fix_code = #{fixCode}</if>
<if test="keyWord != null and keyWord != ''">(mt.type_name like concat('%',#{keyWord},'%') or mt1.type_name like concat('%',#{keyWord})</if>
<if test="typeName != null and typeName != ''"> and mt1.type_name = #{typeName}</if>
<if test="specificationType != null and specificationType != ''"> and mt.type_name = #{specificationType}</if>
<if test="codeType != null and codeType != ''"> and pmi.code_type = #{codeType}</if>
@ -110,10 +112,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<select id="getTypeByTypeId" resultType="com.alibaba.fastjson.JSONObject">
select mt.code specsCode,mt1.code typeCode,mt.type_name specsName,mt1.type_name typeName from ma_type mt
left join (select type_id,code,type_name from ma_type
where type_id in (select parent_id from ma_type where type_id = #{typeId})) mt1 on mt.parent_id = mt1.type_id
where mt.type_id = #{typeId}
select code specsCode,model_code modelCode,type_name specsName from ma_type
where type_id = #{typeId}
</select>
<select id="getSerialNumber" resultType="int">
@ -134,6 +134,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<delete id="deletePurchaseMacodeInfoById">
delete from purchase_macode_info where id = #{id}
</delete>
<delete id="deletePurchaseMacodeInfoByMaCode">
delete from purchase_macode_info where ma_code = #{maCode}
</delete>
<delete id="deleteMaMachineInfoByMaCode">
delete from ma_machine where ma_code = #{maCode}
</delete>
<select id="selectMachineByAssetsCode" resultType="com.bonus.sgzb.base.api.domain.MaMachine">
select ma_id, type_id, ma_code, pre_code, ma_status, qr_code, buy_price, ma_vender, out_fac_time, out_fac_code,
@ -165,7 +171,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="inOutNum != null and inOutNum != ''">in_out_num,</if>
<if test="buyTask != null and buyTask != ''">buy_task,</if>
<if test="ownHouse != null and ownHouse != ''">own_house,</if>
<if test="companyId != null and companyId != ''">company_id</if>
<if test="companyId != null and companyId != ''">company_id,</if>
<if test="createTime != null">create_time</if>
)values(
<if test="typeId != null and typeId != ''">#{typeId},</if>
<if test="maCode != null and maCode != ''">#{maCode},</if>
@ -187,7 +194,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="inOutNum != null and inOutNum != ''">#{inOutNum},</if>
<if test="buyTask != null and buyTask != ''">#{buyTask},</if>
<if test="ownHouse != null and ownHouse != ''">#{ownHouse},</if>
<if test="companyId != null and companyId != ''">#{companyId}</if>
<if test="companyId != null and companyId != ''">#{companyId},</if>
<if test="createTime != null">#{createTime}</if>
)
</insert>
@ -233,6 +241,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
create_time, remark, company_id
from ma_type where type_id = #{typeId}
</select>
<select id="selectMachineByMaCode" resultType="java.lang.Integer">
select count(*) from ma_machine where ma_code = #{codingRule}
</select>
<select id="selectPurchaseMacodeInfo" resultType="com.bonus.sgzb.material.domain.PurchaseMacodeInfo">
select pcd.production_time productionTime,mt.type_name specificationType, mt1.type_name typeName, pmi.ma_code maCode,
mm.assets_code assetsCode ,pmi.fix_code fixCode,pcd.type_id typeId,pcd.task_id taskId, mt.code specsCode,mt1.code typeCode
from purchase_macode_info pmi
left join purchase_check_details pcd on pmi.task_id = pcd.task_id and pmi.type_id = pcd.type_id
left join ma_machine mm on pmi.ma_code = mm.ma_code
left join ma_type mt on pcd.type_id = mt.type_id
left join ma_type mt1 on mt.parent_id = mt1.type_id
where pmi.task_id = #{taskId} and pmi.type_id = #{typeId}
<if test="productionTime != null">pcd.production_time = #{productionTime}</if>
</select>
<update id="updateTypeByTypeId">
update ma_type set num = #{num} where type_id = #{typeId}

View File

@ -18,11 +18,11 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
server-addr: 127.0.0.1:8848
namespace: sgzb_cloud_dev
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
server-addr: 127.0.0.1:8848
namespace: sgzb_cloud_dev
# 配置文件格式
file-extension: yml