3a09e4eb 康伟

kangwei: 药剂入库审核,补充departId参数

1 个父辈 7bfd3a2e
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.skua.core.context.BaseContextHandler;
import com.skua.core.context.SpringContextUtils;
import com.skua.core.util.ConvertUtils;
import com.skua.modules.common.service.ICommonSqlService;
import com.skua.modules.equipment.dto.EquipmentInDTO;
import com.skua.modules.equipment.dto.EquipmentOutDTO;
......@@ -74,20 +75,24 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia
public String auditMaterialINVO(MaterialINVO materialINVO)throws Exception {
boolean inAndOutStock = false;
String errMsg = null;
QueryWrapper<SuppliesWarehouse> queryWrapper = new QueryWrapper<SuppliesWarehouse>();
queryWrapper.eq("depart_id",materialINVO.getDepartId());
warehouseService.list();
//保存
MaterialIN materialINTemp = this.baseMapper.selectById(materialINVO.getId());
/* QueryWrapper<SuppliesWarehouse> queryWrapper = new QueryWrapper<SuppliesWarehouse>();
queryWrapper.eq("depart_id",materialINVO.getDepartId());*/
String inWarehouseId = null;
//主库数据源
JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master");
String warehouseSql = "select id from supplies_warehouse where depart_id = '"+materialINVO.getDepartId()+"' order by create_time desc limit 1";
String inWarehouseId = masterDB.queryForObject( warehouseSql,String.class );
if(materialINTemp != null && StringUtils.isNotEmpty(materialINTemp.getDepartId())){
String warehouseSql = "select id from supplies_warehouse where depart_id = '"+materialINTemp.getDepartId()+"' order by create_time desc limit 1";
inWarehouseId = masterDB.queryForObject( warehouseSql,String.class );
}
if(StringUtils.isEmpty(inWarehouseId)){
String departSql = "select depart_name from sys_depart where id = '"+materialINVO.getDepartId()+"'";
String departName = masterDB.queryForObject( warehouseSql,String.class );
return "所属厂站["+departName+"]下没有找到仓库信息!";
String departSql = "select depart_name from sys_depart where id = '"+materialINTemp.getDepartId()+"'";
String departName = masterDB.queryForObject( departSql,String.class );
return "所属厂站["+ ConvertUtils.getString(departName) +"]下没有找到仓库信息!";
}
//保存
MaterialIN materialINTemp = this.baseMapper.selectById(materialINVO.getId());
//purchasePlan.getApproveState() 审批状态 1通过2不通过
if("1".equals( materialINVO.getApproveState() )){
materialINTemp.setAuditStatus( "3" );
......@@ -96,8 +101,6 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia
if("2".equals( materialINVO.getApproveState() )){
materialINTemp.setAuditStatus( "2" );
}
// 审核通过,生成入库单据、物料单
if(inAndOutStock ){
//出库
......@@ -106,7 +109,6 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia
errMsg = syncEquipmentIn(materialINTemp,inWarehouseId);
}
this.baseMapper.updateById( materialINTemp ) ;
//审批记录
ApproveRecord record = new ApproveRecord( "YJIN", materialINVO.getApplyUser(), materialINVO.getId(), BaseContextHandler.getUserId(), materialINVO.getApproveMessage(), materialINVO.getApproveState());
recordMapper.insert( record ) ;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!