| | |
| | | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.ManLocDetl; |
| | | import com.zy.asrs.entity.Mat; |
| | | import com.zy.asrs.entity.param.OrderInspectionRollParam; |
| | | import com.zy.asrs.entity.param.QualityGroupListParam; |
| | | import com.zy.asrs.entity.result.OrderPakoutDetailVo; |
| | | import com.zy.asrs.mapper.LocDetlMapper; |
| | | import com.zy.asrs.service.ApiLogService; |
| | | import com.zy.asrs.service.LocDetlService; |
| | | import com.zy.asrs.service.ManLocDetlService; |
| | | import com.zy.asrs.service.MatService; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | private LocDetlMapper locDetlMapper; |
| | | @Autowired |
| | | private MatService matService; |
| | | @Autowired |
| | | private ApiLogService apiLogService; |
| | | |
| | | @Value("${srXghyMes.qualityFinishedCheckoutUrl}") |
| | | private String qualityFinishedCheckoutUrl; |
| | | @Value("${srXghyMes.qualityFinishedCheckout}") |
| | | private String qualityFinishedCheckout; |
| | | |
| | | @RequestMapping(value = "/locDetl/update") |
| | | public R update1() { |
| | |
| | | return R.ok(sum); |
| | | } |
| | | |
| | | @RequestMapping(value = "/actual/shipment/locDetl/report/auth") |
| | | @ManagerAuth(memo = "卷号是否合格手动校验") |
| | | public R actualShipmentLocDetl(@RequestParam String model) { |
| | | Long userId = null; |
| | | try { |
| | | userId = getUserId(); |
| | | if (Cools.isEmpty(userId)) { |
| | | return R.error("用户异常").add("用户异常"); |
| | | } |
| | | } catch (Exception e){ |
| | | return R.error("用户异常").add("用户异常"); |
| | | } |
| | | List<LocDetl> locDetlList = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("model", model)); |
| | | OrderInspectionRollParam orderInspectionRollParam = new OrderInspectionRollParam(model); |
| | | String response = ""; |
| | | boolean success = false; |
| | | Map<String, Object> params = JSON.parseObject(JSON.toJSONString(orderInspectionRollParam), Map.class); |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(qualityFinishedCheckoutUrl) |
| | | .setPath(qualityFinishedCheckout) |
| | | .setParams(params) |
| | | .setUseFormUrlEncoded(true) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getBoolean("state")) { |
| | | String value = jsonObject.getString("value"); |
| | | if (value.equals("合格")){ |
| | | for (LocDetl locDetl : locDetlList) { |
| | | locDetl.setDanger(1); |
| | | locDetlService.updateById(locDetl); |
| | | } |
| | | } else if (value.equals("不合格")){ |
| | | for (LocDetl locDetl : locDetlList) { |
| | | locDetl.setDanger(2); |
| | | locDetlService.updateById(locDetl); |
| | | } |
| | | } else { |
| | | for (LocDetl locDetl : locDetlList) { |
| | | locDetl.setDanger(0); |
| | | locDetlService.updateById(locDetl); |
| | | } |
| | | } |
| | | success = true; |
| | | } else { |
| | | return R.error("查询卷号是否合格失败"); |
| | | } |
| | | } catch (Exception e) { |
| | | return R.error("查询卷号是否合格失败"+e.getMessage()); |
| | | } finally { |
| | | try { |
| | | // 保存接口日志 |
| | | apiLogService.save( |
| | | "查询卷号是否合格", |
| | | qualityFinishedCheckoutUrl+"/"+qualityFinishedCheckout, |
| | | null, |
| | | "127.0.0.1", |
| | | JSON.toJSONString(orderInspectionRollParam), |
| | | response, |
| | | success |
| | | ); |
| | | } catch (Exception e) { } |
| | | } |
| | | return R.error("上报失败").add("上报失败"); |
| | | } |
| | | |
| | | } |