bug
This commit is contained in:
parent
03097f4b61
commit
2ba5872015
|
|
@ -171,6 +171,12 @@ public class MaMachine extends BaseEntity {
|
|||
*/
|
||||
@ApiModelProperty(value = "数据所属组织")
|
||||
private String companyId;
|
||||
|
||||
/**
|
||||
* 绑定人
|
||||
*/
|
||||
@ApiModelProperty(value = "种类id")
|
||||
private String binder;
|
||||
/**
|
||||
* 标签编号
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ public class LeaseOutDetailsController extends BaseController {
|
|||
*/
|
||||
@ApiOperation(value = "根据二维码绑定设备-app")
|
||||
@PostMapping("bindMachineByQrCode")
|
||||
@Log(title = "APP机具设备标签二维码绑定", businessType = BusinessType.MATERIAL)
|
||||
public AjaxResult bindMachineByQrCode(@RequestBody MaMachine maMachine) {
|
||||
int i = leaseOutDetailsService.bindMachineByQrCode(maMachine);
|
||||
if (i == 0) {
|
||||
|
|
|
|||
|
|
@ -86,23 +86,19 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int bindMachineByQrCode(MaMachine maMachine) {
|
||||
List<MaMachine> maMachineByMaIdAndMaCode = maMachineMapper.getMaMachineByMaTypeAndMaCode(maMachine);
|
||||
if (CollUtil.isEmpty(maMachineByMaIdAndMaCode)) {
|
||||
maMachine.setCreateTime(new Date());
|
||||
int i = maMachineMapper.maMachineAdd(maMachine);
|
||||
String labelCode = maMachine.getQrCode();
|
||||
MaLabelBind maLabelBinds = maLabelBindMapper.selectMaLabelBindByMaCode(maMachine);
|
||||
if (maLabelBinds != null) {
|
||||
|
||||
MaLabelBindVO maLabelBind = new MaLabelBindVO();
|
||||
maLabelBind.setTypeId(maMachine.getTypeId());
|
||||
maLabelBind.setBindTime(new Date().toString());
|
||||
|
||||
maLabelBind.setBinder(SecurityUtils.getLoginUser().getUsername());
|
||||
maLabelBindMapper.updateMaLabelBind(maLabelBind);
|
||||
|
||||
return 0;
|
||||
} else {
|
||||
MaLabelBind maLabelBind = new MaLabelBind();
|
||||
|
|
@ -111,12 +107,12 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
|
|||
maLabelBind.setTypeId(maMachine.getTypeId());
|
||||
maLabelBind.setBindTime(new Date());
|
||||
|
||||
maLabelBind.setBinder(SecurityUtils.getLoginUser().getUsername());
|
||||
maLabelBind.setBinder(maMachine.getBinder());
|
||||
maLabelBind.setStatus("1");
|
||||
maLabelBind.setLabelType(9);
|
||||
maLabelBindMapper.insertLabelBind(maLabelBind);
|
||||
maLabelBindMapper.updateMalableCode(maLabelBind);
|
||||
maLabelBindMapper.updateMatypeNum(maLabelBind);
|
||||
maLabelBindMapper.updateMatypeNum(maLabelBind.getTypeId());
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class MaLabelBindController extends BaseController
|
|||
* 新增机具设备标签ma_label_bind
|
||||
*/
|
||||
@ApiOperation(value = "新增机具标签绑定管理列表")
|
||||
@Log(title = "机具设备标签ma_label_bind", businessType = BusinessType.INSERT)
|
||||
@Log(title = "机具设备标签二维码绑定", businessType = BusinessType.MATERIAL)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody MaLabelBindVO maLabelBindVO)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -93,5 +93,6 @@ public interface MaLabelBindMapper
|
|||
|
||||
void updateMalableCode(MaLabelBind maLabelBind);
|
||||
|
||||
void updateMatypeNum(MaLabelBind maLabelBind);
|
||||
void updateMatypeNum(Long typeId);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.bonus.sgzb.base.service.IMaLabelBindService;
|
|||
import com.bonus.sgzb.base.vo.MaLabelBindVO;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
|
@ -61,6 +62,7 @@ public class MaLabelBindServiceImpl implements IMaLabelBindService {
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult insertMaLabelBind(MaLabelBindVO maLabelBind) {
|
||||
int i = 0;
|
||||
int b = 0;
|
||||
|
|
@ -73,6 +75,8 @@ public class MaLabelBindServiceImpl implements IMaLabelBindService {
|
|||
maMachine.setTypeId(maLabelBind.getTypeId());
|
||||
maMachine.setQrCode(maLabelBind.getLabelCode());
|
||||
maLabelBindMapper.insertMaLabel(maMachine);
|
||||
//根据typeId修改库存
|
||||
maLabelBindMapper.updateMatypeNum(maLabelBind.getTypeId());
|
||||
maLabelBind.setMaId(String.valueOf(maMachine.getMaId()));
|
||||
maLabelBind.setStatus("1");
|
||||
maLabelBind.setIsBind("1");
|
||||
|
|
|
|||
|
|
@ -199,10 +199,12 @@
|
|||
ma_id = #{maId},is_bind =1
|
||||
where label_code =#{labelCode}
|
||||
</update>
|
||||
<update id="updateMatypeNum" parameterType="com.bonus.sgzb.base.api.domain.MaLabelBind">
|
||||
update ma_type set
|
||||
num = num + 1
|
||||
where type_id =#{typeId}
|
||||
<update id="updateMatypeNum">
|
||||
UPDATE ma_type
|
||||
SET num = IFNULL( num, 0 ) + 1,
|
||||
update_time = now()
|
||||
WHERE
|
||||
type_id = #{typeId}
|
||||
</update>
|
||||
<insert id="insertMaLabels">
|
||||
insert into ma_maLabel
|
||||
|
|
|
|||
Loading…
Reference in New Issue