| | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.core.common.SnowflakeIdWorker; |
| | | import com.core.exception.CoolException; |
| | |
| | | private PakoutService pakoutService; |
| | | @Autowired |
| | | private SnowflakeIdWorker snowflakeIdWorker; |
| | | @Autowired |
| | | private MatService matService; |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | @Override |
| | | @Transactional |
| | | public R initOrder(InitOrderParam param, Long userId) { |
| | | return null; |
| | | Date now = new Date(); |
| | | for (PakinMatDto dto : param.getList()){ |
| | | Mat mat = matService.selectByMatnr(dto.getMatnr()); |
| | | if (mat == null) { |
| | | continue; |
| | | } |
| | | CustOrder custOrder = new CustOrder( |
| | | param.getNumber(), // 销售单号 |
| | | DateUtils.convert(now), // 单据日期[非空] |
| | | param.getCustomerTypeId(), // 客户编号 |
| | | null, // 经手人编号[空] |
| | | dto.getMatnr(), // 商品编号 |
| | | dto.getCount(), // 商品数量 |
| | | Cools.isEmpty(mat.getName())?0.0D:Double.parseDouble(mat.getName()), // 商品单价 |
| | | null, // 商品备注[空] |
| | | 1, // 状态 |
| | | now, // 添加时间 |
| | | now, // 修改时间 |
| | | null // 备注 |
| | | ); |
| | | if (!custOrderService.insert(custOrder)) { |
| | | throw new CoolException("保存销售订单失败"); |
| | | } |
| | | } |
| | | return R.ok("生成销售订单" + param.getNumber() + "成功"); |
| | | } |
| | | |
| | | } |