| | |
| | | import com.bstek.dorado.annotation.Expose; |
| | | import com.bstek.dorado.data.provider.Page; |
| | | import com.ld.igds.check.CheckStandardManager; |
| | | import com.ld.igds.m.ManageUtil; |
| | | import com.ld.igds.check.dto.CheckItemData; |
| | | import com.ld.igds.m.ReportManage; |
| | | import com.ld.igds.m.service.HQualityManageService; |
| | | import com.ld.igds.models.Depot; |
| | | import com.ld.igds.models.DicTrigger; |
| | | import com.ld.igds.models.MQuality; |
| | | import com.ld.igds.view.service.HDepotService; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | private HQualityManageService qualityManageService; |
| | | @Autowired |
| | | private CheckStandardManager checkStandardManager; |
| | | @Autowired |
| | | private ReportManage reportManage; |
| | | @Autowired |
| | | private HDepotService depotService; |
| | | |
| | | /** |
| | | * 检验类别 |
| | |
| | | * |
| | | * @return |
| | | */ |
| | | // @DataProvider |
| | | // public List<DicTrigger> triggerType() { |
| | | // List<DicTrigger> list = new ArrayList<DicTrigger>(); |
| | | // list.add(new DicTrigger("01", "满仓初检")); |
| | | // list.add(new DicTrigger("02", "出仓检验")); |
| | | // list.add(new DicTrigger("03", "月度普检")); |
| | | // return list; |
| | | // } |
| | | @DataProvider |
| | | public List<DicTrigger> triggerType() { |
| | | List<DicTrigger> list = new ArrayList<DicTrigger>(); |
| | |
| | | */ |
| | | @DataResolver |
| | | public void saveQuality(MQuality data) { |
| | | String id = ""; |
| | | if (StringUtils.isEmpty(data.getId())) { |
| | | id = ManageUtil.createQualityId(data.getType(), data.getTime()); |
| | | data.setId( "ZJ_" + qualityManageService.getIdByTime(data.getTime())); |
| | | } |
| | | qualityManageService.saveQuality(id, data); |
| | | try { |
| | | qualityManageService.saveQuality(data.getId(), data); |
| | | //保存货位质检数据 |
| | | Depot depot = depotService.getDepotById(data.getCompanyId(), data.getDepotId()); |
| | | depot.setCheckDate(data.getTime()); |
| | | |
| | | //保存检测的化验项信息 |
| | | if (null != data.getCheckItems()) { |
| | | checkStandardManager.updateCheckItems(id, null, data.getCheckItems()); |
| | | checkStandardManager.updateCheckItems(data.getId(), null, data.getCheckItems()); |
| | | List<CheckItemData> checkItems = data.getCheckItems(); |
| | | |
| | | for (CheckItemData checkItem : checkItems) { |
| | | if("C01".equals(checkItem.getStandardId())){ |
| | | String value = checkItem.getValue(); |
| | | depot.setPerWet(Double.valueOf(value)); |
| | | } |
| | | if("C02".equals(checkItem.getStandardId())){ |
| | | String value = checkItem.getValue(); |
| | | depot.setPerImpurity(Double.valueOf(value)); |
| | | } |
| | | if("C03".equals(checkItem.getStandardId())){ |
| | | String value = checkItem.getValue(); |
| | | depot.setBulkWeight(Double.valueOf(value)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | depotService.updateDepot(depot); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | |
| | | return qualityManageService.delQuality(data); |
| | | } |
| | | |
| | | /** |
| | | * qualityManagerPR#getPer |
| | | * |
| | | * @param checkId |
| | | * @return |
| | | */ |
| | | @Expose |
| | | public CheckItemData getPer(String checkId) { |
| | | return qualityManageService.getCheckItem(checkId); |
| | | } |
| | | |
| | | /** |
| | | * qualityManagerPR#printQualityBill 打印质检报告单 |
| | | * |
| | | * @param data |
| | | * @return |
| | | */ |
| | | @Expose |
| | | public String printQualityBill(MQuality data) { |
| | | if (StringUtils.isEmpty(data.getFoodVariety())) { |
| | | return "粮情品种为空,不支持打印!"; |
| | | } |
| | | return reportManage.printQualityBill(data); |
| | | } |
| | | |
| | | } |