|
|
|
@ -7,6 +7,7 @@ import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
|
|
import com.microsoft.windowsazure.exception.ServiceException;
|
|
|
|
|
import com.op.common.core.context.SecurityContextHolder;
|
|
|
|
|
import com.op.common.core.utils.uuid.IdUtils;
|
|
|
|
|
import com.op.common.core.web.domain.AjaxResult;
|
|
|
|
|
import com.op.wms.domain.BaseProduct;
|
|
|
|
|
import com.op.wms.domain.BpRawMaterialIn;
|
|
|
|
|
import com.op.wms.mapper.BaseProductMapper;
|
|
|
|
@ -72,6 +73,7 @@ public class BpRawMaterialInDetailServiceImpl implements IBpRawMaterialInDetailS
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public int insertBpRawMaterialInDetail(BpRawMaterialInDetail bpRawMaterialInDetail) throws ServiceException {
|
|
|
|
|
int reselt=1;
|
|
|
|
|
//获取当前所选工厂
|
|
|
|
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
|
|
|
|
String key = "#header.poolName";
|
|
|
|
@ -103,7 +105,7 @@ public class BpRawMaterialInDetailServiceImpl implements IBpRawMaterialInDetailS
|
|
|
|
|
bpRawMaterialIn1.setMaterialCode(String.valueOf(baseProduct));
|
|
|
|
|
bpRawMaterialIn1.setUnit(bpRawMaterialInDetail.getUnit());
|
|
|
|
|
bpRawMaterialIn1.setAmountReal(bpRawMaterialInDetail.getAmountReal());
|
|
|
|
|
bpRawMaterialInMapper.insertBpRawMaterialIn(bpRawMaterialIn1);
|
|
|
|
|
reselt=bpRawMaterialInMapper.insertBpRawMaterialIn(bpRawMaterialIn1);
|
|
|
|
|
}else {
|
|
|
|
|
//物料存在,加库存
|
|
|
|
|
bpRawMaterialIn.getAmountReal();//原有
|
|
|
|
@ -111,7 +113,6 @@ public class BpRawMaterialInDetailServiceImpl implements IBpRawMaterialInDetailS
|
|
|
|
|
bpRawMaterialIn.setAmountReal(bpRawMaterialIn.getAmountReal()+bpRawMaterialInDetail.getAmountReal());
|
|
|
|
|
bpRawMaterialInMapper.updateBpRawMaterialIn(bpRawMaterialIn);
|
|
|
|
|
}
|
|
|
|
|
int reselt=1;
|
|
|
|
|
return reselt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -136,9 +137,24 @@ public class BpRawMaterialInDetailServiceImpl implements IBpRawMaterialInDetailS
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public int deleteBpRawMaterialInDetailByIds(String[] ids)
|
|
|
|
|
public AjaxResult deleteBpRawMaterialInDetailByIds(String[] ids)
|
|
|
|
|
{
|
|
|
|
|
return bpRawMaterialInDetailMapper.deleteBpRawMaterialInDetailByIds(ids);
|
|
|
|
|
for (String id : ids) {
|
|
|
|
|
BpRawMaterialInDetail bpRawMaterialInDetail = bpRawMaterialInDetailMapper.selectBpRawMaterialInDetailById(id);
|
|
|
|
|
BpRawMaterialIn bpRawMaterialIn = bpRawMaterialInMapper.selectBpRawMaterialInBymateriaName(bpRawMaterialInDetail.getMaterialName());
|
|
|
|
|
if (bpRawMaterialIn==null){
|
|
|
|
|
bpRawMaterialInDetailMapper.deleteBpRawMaterialInDetailById(id);
|
|
|
|
|
}else {
|
|
|
|
|
if (bpRawMaterialIn.getAmountReal()>=bpRawMaterialInDetail.getAmountReal()){
|
|
|
|
|
bpRawMaterialInDetailMapper.deleteBpRawMaterialInDetailById(id);
|
|
|
|
|
bpRawMaterialIn.setAmountReal(bpRawMaterialIn.getAmountReal()-bpRawMaterialInDetail.getAmountReal());
|
|
|
|
|
bpRawMaterialInMapper.updateBpRawMaterialIn(bpRawMaterialIn);
|
|
|
|
|
}else {
|
|
|
|
|
return AjaxResult.error();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return AjaxResult.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -149,8 +165,7 @@ public class BpRawMaterialInDetailServiceImpl implements IBpRawMaterialInDetailS
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public int deleteBpRawMaterialInDetailById(String id)
|
|
|
|
|
{
|
|
|
|
|
public int deleteBpRawMaterialInDetailById(String id) {
|
|
|
|
|
return bpRawMaterialInDetailMapper.deleteBpRawMaterialInDetailById(id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|