| | |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.MatCode; |
| | | import com.zy.asrs.service.MatCodeService; |
| | | import com.zy.common.entity.KeyValueVo; |
| | |
| | | import com.zy.ints.entity.WaitMatin; |
| | | import com.zy.ints.service.WaitMatinService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | | public class WaitMatinController extends BaseController { |
| | |
| | | @RequestMapping(value = "/waitMatin/head/page/auth") |
| | | @ManagerAuth |
| | | public R headPage(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam Map<String, Object> param){ |
| | | if (!Cools.isEmpty(param.get("modi_time"))){ |
| | | String val = String.valueOf(param.get("modi_time")); |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam Map<String, Object> param){ |
| | | if (!Cools.isEmpty(param.get("appe_time"))){ |
| | | String val = String.valueOf(param.get("appe_time")); |
| | | if (val.contains(RANGE_TIME_LINK)) { |
| | | String[] dates = val.split(RANGE_TIME_LINK); |
| | | param.put("startTime", DateUtils.convert(dates[0])); |
| | | param.put("endTime", DateUtils.convert(dates[1])); |
| | | param.remove("modi_time"); |
| | | param.remove("appe_time"); |
| | | } |
| | | } |
| | | return R.ok(waitMatinService.getHeadPage(toPage(curr, limit, param, WaitMatin.class))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/waitMatin/detl/list/auth") |
| | | @ManagerAuth |
| | | public R detlPage(@RequestParam String billNo){ |
| | | if (Cools.isEmpty(billNo)){ |
| | | return R.parse(BaseRes.PARAM); |
| | | } |
| | | List<WaitMatin> waitMatins = waitMatinService.selectList(new EntityWrapper<WaitMatin>().eq("bill_no", billNo)); |
| | | if (Cools.isEmpty(waitMatins)) { |
| | | return R.parse(BaseRes.EMPTY); |
| | | } |
| | | return R.ok().add(waitMatins); |
| | | } |
| | | |
| | | |
| | | /*************************************** xm-select ***********************************************/ |
| | |
| | | |
| | | @RequestMapping(value = "/waitMatin/add/auth") |
| | | @ManagerAuth |
| | | public R add(WaitMatin waitMatin) { |
| | | waitMatinService.insert(waitMatin); |
| | | return R.ok(); |
| | | @Transactional |
| | | public R add(@RequestBody List<WaitMatin> waitMatins) { |
| | | if (Cools.isEmpty(waitMatins)) { |
| | | return R.parse(BaseRes.PARAM); |
| | | } |
| | | if (waitMatinService.selectCount(new EntityWrapper<WaitMatin>().eq("bill_no", waitMatins.get(0).getBillNo())) > 0) { |
| | | return R.error("单据编号已存在"); |
| | | } |
| | | int i = 1; |
| | | Date now = new Date(); |
| | | for (WaitMatin waitMatin : waitMatins) { |
| | | waitMatin.setSeqNo(i); |
| | | waitMatin.setAppeTime(now); |
| | | waitMatin.setAppeUser(getUserId()); |
| | | waitMatin.setModiTime(now); |
| | | waitMatin.setModiUser(getUserId()); |
| | | if (!waitMatinService.insert(waitMatin)) { |
| | | throw new CoolException("添加单据明细失败"); |
| | | } |
| | | i++; |
| | | } |
| | | return R.ok("添加成功"); |
| | | } |
| | | |
| | | @RequestMapping(value = "/waitMatin/update/auth") |
| | | @RequestMapping(value = "/waitMatin/modify/auth") |
| | | @ManagerAuth |
| | | public R update(WaitMatin waitMatin){ |
| | | if (Cools.isEmpty(waitMatin) || null==waitMatin.getSeqNo()){ |
| | | @Transactional |
| | | public R update(@RequestBody List<WaitMatin> waitMatins){ |
| | | if (Cools.isEmpty(waitMatins)) { |
| | | return R.parse(BaseRes.PARAM); |
| | | } |
| | | Date now = new Date(); |
| | | List<WaitMatin> oldWaitMatin = waitMatinService.selectList(new EntityWrapper<WaitMatin>().eq("bill_no", waitMatins.get(0).getBillNo())); |
| | | Date appeTime = oldWaitMatin!=null?oldWaitMatin.get(0).getAppeTime():now; |
| | | Long appeUser = oldWaitMatin!=null?oldWaitMatin.get(0).getAppeUser():getUserId(); |
| | | if (!waitMatinService.delete(new EntityWrapper<WaitMatin>().eq("bill_no", waitMatins.get(0).getBillNo()))) { |
| | | return R.error(); |
| | | } |
| | | waitMatinService.updateById(waitMatin); |
| | | return R.ok(); |
| | | int i = 1; |
| | | for (WaitMatin waitMatin : waitMatins) { |
| | | waitMatin.setSeqNo(i); |
| | | waitMatin.setAppeTime(appeTime); |
| | | waitMatin.setAppeUser(appeUser); |
| | | waitMatin.setModiTime(now); |
| | | waitMatin.setModiUser(getUserId()); |
| | | if (!waitMatinService.insert(waitMatin)) { |
| | | throw new CoolException("修改单据明细失败"); |
| | | } |
| | | i++; |
| | | } |
| | | return R.ok("修改成功"); |
| | | } |
| | | |
| | | @RequestMapping(value = "/waitMatin/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | waitMatinService.deleteById(id); |
| | | public R delete(@RequestParam String billNo){ |
| | | if (!waitMatinService.delete(new EntityWrapper<WaitMatin>().eq("bill_no", billNo))) { |
| | | throw new CoolException("删除单据明细失败"); |
| | | } |
| | | return R.ok(); |
| | | return R.ok("删除成功"); |
| | | } |
| | | |
| | | @RequestMapping(value = "/waitMatin/export/auth") |