|
|
@ -15,6 +15,7 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
package org.energy.modules.spares.controller; |
|
|
|
package org.energy.modules.spares.controller; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.xkcoding.http.util.StringUtil; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import io.swagger.annotations.ApiParam; |
|
|
|
import io.swagger.annotations.ApiParam; |
|
|
@ -26,7 +27,7 @@ import com.dayu.daf.core.mp.support.Condition; |
|
|
|
import com.dayu.daf.core.mp.support.Query; |
|
|
|
import com.dayu.daf.core.mp.support.Query; |
|
|
|
import com.dayu.daf.core.tool.api.R; |
|
|
|
import com.dayu.daf.core.tool.api.R; |
|
|
|
import com.dayu.daf.core.tool.utils.Func; |
|
|
|
import com.dayu.daf.core.tool.utils.Func; |
|
|
|
import org.energy.modules.spares.entity.Inbound; |
|
|
|
import org.energy.modules.spares.service.IMaterialService; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import org.springframework.web.bind.annotation.RequestParam; |
|
|
|
import org.springframework.web.bind.annotation.RequestParam; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
@ -35,6 +36,8 @@ import org.energy.modules.spares.vo.OutboundVO; |
|
|
|
import org.energy.modules.spares.service.IOutboundService; |
|
|
|
import org.energy.modules.spares.service.IOutboundService; |
|
|
|
import com.dayu.daf.core.boot.ctrl.DafController; |
|
|
|
import com.dayu.daf.core.boot.ctrl.DafController; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -50,6 +53,7 @@ import java.util.List; |
|
|
|
public class OutboundController extends DafController { |
|
|
|
public class OutboundController extends DafController { |
|
|
|
|
|
|
|
|
|
|
|
private IOutboundService outboundService; |
|
|
|
private IOutboundService outboundService; |
|
|
|
|
|
|
|
private IMaterialService materialService; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 详情 |
|
|
|
* 详情 |
|
|
@ -101,6 +105,10 @@ public class OutboundController extends DafController { |
|
|
|
@ApiOperationSupport(order = 5) |
|
|
|
@ApiOperationSupport(order = 5) |
|
|
|
@ApiOperation(value = "修改", notes = "传入outbound") |
|
|
|
@ApiOperation(value = "修改", notes = "传入outbound") |
|
|
|
public R update(@Valid @RequestBody Outbound outbound) { |
|
|
|
public R update(@Valid @RequestBody Outbound outbound) { |
|
|
|
|
|
|
|
if (outbound.getIstatus() == 2) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
materialService.updateNum(outbound.getMaterialNo(), Math.negateExact(outbound.getOutboundCount())); |
|
|
|
|
|
|
|
} |
|
|
|
return R.status(outboundService.updateById(outbound)); |
|
|
|
return R.status(outboundService.updateById(outbound)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -111,6 +119,22 @@ public class OutboundController extends DafController { |
|
|
|
@ApiOperationSupport(order = 6) |
|
|
|
@ApiOperationSupport(order = 6) |
|
|
|
@ApiOperation(value = "新增或修改", notes = "传入outbound") |
|
|
|
@ApiOperation(value = "新增或修改", notes = "传入outbound") |
|
|
|
public R submit(@Valid @RequestBody Outbound outbound) { |
|
|
|
public R submit(@Valid @RequestBody Outbound outbound) { |
|
|
|
|
|
|
|
String maxNo = outboundService.getMaxNo("'%" + outbound.getMaterialNo() + "%'"); |
|
|
|
|
|
|
|
int number; |
|
|
|
|
|
|
|
if (StringUtil.isNotEmpty(maxNo)){ |
|
|
|
|
|
|
|
number = Integer.parseInt(maxNo.substring(11)); |
|
|
|
|
|
|
|
number++; |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
number = 1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String numFormat = String.format("%06d", number); |
|
|
|
|
|
|
|
String no = outbound.getMaterialNo() + "OUT" + numFormat; |
|
|
|
|
|
|
|
outbound.setOutboundNo(no); |
|
|
|
|
|
|
|
Date date = new Date(); |
|
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); |
|
|
|
|
|
|
|
String time = sdf.format(date); |
|
|
|
|
|
|
|
outbound.setOutboundTime(time); |
|
|
|
|
|
|
|
outbound.setIstatus(1L); |
|
|
|
return R.status(outboundService.saveOrUpdate(outbound)); |
|
|
|
return R.status(outboundService.saveOrUpdate(outbound)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|