Search in sources :

Example 1 with InstallPlanActual

use of com.eservice.api.model.install_plan_actual.InstallPlanActual in project sinsim by WilsonHu.

the class InstallPlanActualController method list.

@PostMapping("/list")
public Result list(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "0") Integer size) {
    PageHelper.startPage(page, size);
    List<InstallPlanActual> list = installPlanActualService.findAll();
    PageInfo pageInfo = new PageInfo(list);
    return ResultGenerator.genSuccessResult(pageInfo);
}
Also used : PageInfo(com.github.pagehelper.PageInfo) InstallPlanActual(com.eservice.api.model.install_plan_actual.InstallPlanActual)

Example 2 with InstallPlanActual

use of com.eservice.api.model.install_plan_actual.InstallPlanActual in project sinsim by WilsonHu.

the class TaskRecordController method createInstallPlanActual.

/**
 * 根据已完成的工序,自动生成 【对应工序的】的总装排产的实际完成情况
 */
public void createInstallPlanActual(TaskRecord tr) {
    /**
     * 如果机器某个工序已经完成(结束扫码),
     * 则该机器的 对应的总装的 工序的针数头数自动填写为全部完成,
     * 这样app用户就不需要重复去报告总装工序的情况。
     *
     * task_record --> process_record --> machine --> install_plan --> install_plan_actual
     */
    ProcessRecord pr = processRecordService.findById(tr.getProcessRecordId());
    Machine machine = machineService.findById(pr.getMachineId());
    List<InstallPlan> installPlanList = installPlanService.getInstallPlanByMachineId(machine.getId());
    MachineOrder machineOrder = machineOrderService.findById(machine.getOrderId());
    InstallGroup installGroup = installGroupService.getInstallGroupByTaskName(tr.getTaskName());
    for (InstallPlan installplan : installPlanList) {
        if (installGroup.getId() == installplan.getInstallGroupId()) {
            InstallPlanActual installPlanActual = new InstallPlanActual();
            installPlanActual.setCreateDate(new Date());
            installPlanActual.setInstallPlanId(installplan.getId());
            installPlanActual.setHeadCountDone(commonService.getRealSumValue(machineOrder.getHeadNum()));
            installPlanActualService.save(installPlanActual);
            // /这里可以获取id ! ...
            Logger.getLogger("").log(Level.INFO, "自动生成 实际总装 " + installPlanActual.getId() + ", 头数 " + installPlanActual.getHeadCountDone());
            break;
        } else {
        // Logger.getLogger("").log(Level.INFO, installGroup.getGroupName() + ", 无需生成 ");
        }
    }
}
Also used : InstallPlanActual(com.eservice.api.model.install_plan_actual.InstallPlanActual) ProcessRecord(com.eservice.api.model.process_record.ProcessRecord) MachineOrder(com.eservice.api.model.machine_order.MachineOrder) InstallGroup(com.eservice.api.model.install_group.InstallGroup) Machine(com.eservice.api.model.machine.Machine) Date(java.util.Date) InstallPlan(com.eservice.api.model.install_plan.InstallPlan)

Example 3 with InstallPlanActual

use of com.eservice.api.model.install_plan_actual.InstallPlanActual in project sinsim by WilsonHu.

the class InstallPlanActualController method addInstallPlanActualList.

/**
 * 一次性接收多个排产反馈
 * app 上一次性提交多个。
 * @return 添加或更新(比如分多次完成)成功的个数,比如非法的数据比如不合理的数量,无法被添加。
 *
 * 更新: app上不再反馈总装排产,在app扫码完成某工序时,自动生成对应installPlanActual的总装排产的数据,
 * 所以这个controller类,包括这个接口,应该不再被使用了
 */
@PostMapping("/addInstallPlanActualList")
public // public Result addInstallPlanActualList(List<String> installPlanActualList) { //不能支持List
Result addInstallPlanActualList(String installPlanActualListInfo) {
    List<InstallPlanActual> installPlanActualList = new ArrayList<>();
    installPlanActualList = JSONObject.parseArray(installPlanActualListInfo, InstallPlanActual.class);
    logger.info(" sss " + installPlanActualList.size());
    InstallPlanActual installPlanActual;
    Result result;
    int successSum = 0;
    for (int i = 0; i < installPlanActualList.size(); i++) {
        installPlanActual = installPlanActualList.get(i);
        result = add(JSON.toJSONString(installPlanActual));
        if (result.getCode() == ResultCode.SUCCESS.code) {
            successSum++;
        }
    }
    if (successSum < installPlanActualList.size()) {
        logger.info("未成功的个数:" + (installPlanActualList.size() - successSum));
        return ResultGenerator.genFailResult("添加或更新(比如分多次完成)成功的个数:" + successSum);
    } else {
        logger.info("全部添加或更新成功, 个数:" + successSum);
        return ResultGenerator.genSuccessResult("全部添加或更新成功, 个数:" + successSum);
    }
}
Also used : InstallPlanActual(com.eservice.api.model.install_plan_actual.InstallPlanActual) ArrayList(java.util.ArrayList) Result(com.eservice.api.core.Result)

Aggregations

InstallPlanActual (com.eservice.api.model.install_plan_actual.InstallPlanActual)3 Result (com.eservice.api.core.Result)1 InstallGroup (com.eservice.api.model.install_group.InstallGroup)1 InstallPlan (com.eservice.api.model.install_plan.InstallPlan)1 Machine (com.eservice.api.model.machine.Machine)1 MachineOrder (com.eservice.api.model.machine_order.MachineOrder)1 ProcessRecord (com.eservice.api.model.process_record.ProcessRecord)1 PageInfo (com.github.pagehelper.PageInfo)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1