| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | |
| | | |
| | | @RequestMapping(value = "/locSync/insertWrklocSync") |
| | | @ManagerAuth(memo = "同步上传清单数据插入") |
| | | @Transactional |
| | | public R insertWrklocSync(@RequestBody JSONObject param) { |
| | | Date now = new Date(); |
| | | Long userId = getUserId(); |
| | | List<WrkLocSync> list = JSONObject.parseArray(param.getJSONArray("list").toJSONString(), WrkLocSync.class); |
| | | // 插入创建人员和创建时间 |
| | | if (list.size() > 0) { |
| | | for (WrkLocSync elist : list) { |
| | | elist.setCreateBy(getUserId()); |
| | | elist.setCreateTime(new Date()); |
| | | for (WrkLocSync wrkLocSync : list) { |
| | | WrkLocSync sync = new WrkLocSync(); |
| | | sync.setMatnr(wrkLocSync.getMatnr()); |
| | | sync.setQty(wrkLocSync.getQty()); |
| | | sync.setState("N"); |
| | | sync.setCreateTime(now); |
| | | sync.setCreateBy(userId); |
| | | sync.setUpdateBy(userId); |
| | | sync.setUpdateTime(now); |
| | | if (!wrkLocSyncService.insert(sync)) { |
| | | throw new CoolException("同步失败"); |
| | | } |
| | | |
| | | } |
| | | Integer result = 0; |
| | | result = wrkLocSyncService.insertWrkLocSync(list); |
| | | return R.ok(result); |
| | | return R.ok(list.size()); |
| | | } |
| | | |
| | | |