|  |  |  | 
|---|
|  |  |  | import com.core.common.R; | 
|---|
|  |  |  | import com.zy.asrs.entity.WrkDetlLog; | 
|---|
|  |  |  | import com.zy.asrs.service.WrkDetlLogService; | 
|---|
|  |  |  | import com.zy.common.utils.RoleUtils; | 
|---|
|  |  |  | import com.zy.common.web.BaseController; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.HashMap; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RestController | 
|---|
|  |  |  | public class WrkDetlLogController extends BaseController { | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestParam(required = false) String condition, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param) { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | Integer wrkNo = null; | 
|---|
|  |  |  | String orderNo = null; | 
|---|
|  |  |  | Date modiTimeStart = null, modiTimeEnd = null; | 
|---|
|  |  |  | for (Map.Entry<String, Object> entry : param.entrySet()) { | 
|---|
|  |  |  | String val = String.valueOf(entry.getValue()); | 
|---|
|  |  |  | if (Cools.isEmpty(val)) { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (val.contains(RANGE_TIME_LINK)) { | 
|---|
|  |  |  | String[] dates = val.split(RANGE_TIME_LINK); | 
|---|
|  |  |  | modiTimeStart = DateUtils.convert(dates[0]); | 
|---|
|  |  |  | modiTimeEnd = DateUtils.convert(dates[1]); | 
|---|
|  |  |  | } else if (entry.getKey().equals("wrk_no")) { | 
|---|
|  |  |  | wrkNo = Integer.parseInt(val); | 
|---|
|  |  |  | } else if (entry.getKey().equals("order_no")) { | 
|---|
|  |  |  | orderNo = val; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | excludeTrash(param); | 
|---|
|  |  |  | EntityWrapper<WrkDetlLog> wrapper = new EntityWrapper<>(); | 
|---|
|  |  |  | convert(param, wrapper); | 
|---|
|  |  |  | allLike(WrkDetlLog.class, param.keySet(), wrapper, condition); | 
|---|
|  |  |  | if (!Cools.isEmpty(orderByField)){ | 
|---|
|  |  |  | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | wrapper.orderBy("appe_time", false); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<WrkDetlLog> wrkDetlLogs = wrkDetlLogService.selectWrkDetlLogs(wrkNo, orderNo, modiTimeStart, modiTimeEnd, curr, limit); | 
|---|
|  |  |  | Page<WrkDetlLog> page1 = new Page<WrkDetlLog>(curr, limit).setRecords(wrkDetlLogs); | 
|---|
|  |  |  | page1.setTotal(wrkDetlLogService.selectWrkDetlLogsTotal(wrkNo, orderNo, modiTimeStart, modiTimeEnd)); | 
|---|
|  |  |  | return R.ok(page1); | 
|---|
|  |  |  | // 不同继承角色显示不同库信息 | 
|---|
|  |  |  | RoleUtils.addRoleWrapperByBarcode(getUserId(),wrapper); | 
|---|
|  |  |  | return R.ok(wrkDetlLogService.selectPage(new Page<>(curr, limit), wrapper)); | 
|---|
|  |  |  | //            Integer wrkNo = null; | 
|---|
|  |  |  | //            String orderNo = null; | 
|---|
|  |  |  | //            String matnr = null; | 
|---|
|  |  |  | //            String specs = null; | 
|---|
|  |  |  | //            String zpallet = null; | 
|---|
|  |  |  | //            String batch = null; | 
|---|
|  |  |  | //            Double anfme = null; | 
|---|
|  |  |  | //            Date modiTimeStart = null, modiTimeEnd = null; | 
|---|
|  |  |  | //            for (Map.Entry<String, Object> entry : param.entrySet()) { | 
|---|
|  |  |  | //                String val = String.valueOf(entry.getValue()); | 
|---|
|  |  |  | //                if (Cools.isEmpty(val)) { | 
|---|
|  |  |  | //                    continue; | 
|---|
|  |  |  | //                } | 
|---|
|  |  |  | //                if (val.contains(RANGE_TIME_LINK)) { | 
|---|
|  |  |  | //                    String[] dates = val.split(RANGE_TIME_LINK); | 
|---|
|  |  |  | //                    modiTimeStart = DateUtils.convert(dates[0]); | 
|---|
|  |  |  | //                    modiTimeEnd = DateUtils.convert(dates[1]); | 
|---|
|  |  |  | //                } else if (entry.getKey().equals("wrk_no")) { | 
|---|
|  |  |  | //                    wrkNo = Integer.parseInt(val); | 
|---|
|  |  |  | //                } else if (entry.getKey().equals("order_no")) { | 
|---|
|  |  |  | //                    orderNo = val; | 
|---|
|  |  |  | //                } else if (entry.getKey().equals("specs")) { | 
|---|
|  |  |  | //                    specs = val; | 
|---|
|  |  |  | //                } else if (entry.getKey().equals("zpallet")) { | 
|---|
|  |  |  | //                    zpallet = val; | 
|---|
|  |  |  | //                } else if (entry.getKey().equals("batch")) { | 
|---|
|  |  |  | //                    batch = val; | 
|---|
|  |  |  | //                } else if (entry.getKey().equals("anfme")) { | 
|---|
|  |  |  | //                    anfme = Double.parseDouble(val); | 
|---|
|  |  |  | //                }else if (entry.getKey().equals("matnr")) { | 
|---|
|  |  |  | //                    matnr = val; | 
|---|
|  |  |  | //                } | 
|---|
|  |  |  | //            } | 
|---|
|  |  |  | //            List<WrkDetlLog> wrkDetlLogs = wrkDetlLogService.selectWrkDetlLogs(wrkNo, orderNo,matnr,specs,zpallet,batch,anfme, modiTimeStart, modiTimeEnd, curr, limit); | 
|---|
|  |  |  | //            Page<WrkDetlLog> page1 = new Page<WrkDetlLog>(curr, limit).setRecords(wrkDetlLogs); | 
|---|
|  |  |  | //            page1.setTotal(wrkDetlLogService.selectWrkDetlLogsTotal(wrkNo, orderNo,matnr,specs,zpallet,batch,anfme, modiTimeStart, modiTimeEnd)); | 
|---|
|  |  |  | //            return R.ok(page1); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | return R.error("异常" + e); | 
|---|
|  |  |  | } | 
|---|