Merge branch 'dev_New' of http://114.132.189.42:9002/r/product-inventory-management-after into dev_New
| | |
| | | |
| | | @ApiModelProperty("维修时间") |
| | | @Excel(name = "维修时间", width = 30, dateFormat = "yyyy-MM-dd") |
| | | private Date maintenanceTime; |
| | | private LocalDateTime maintenanceTime; |
| | | |
| | | @ApiModelProperty("维修结果") |
| | | @Excel(name = "维修结果") |
| | |
| | | */ |
| | | @RestController |
| | | @Api(tags = "计量器具台账记录") |
| | | @RequestMapping("/measuringInstrumentLedgerRecord") |
| | | @RequestMapping("Record") |
| | | public class MeasuringInstrumentLedgerRecordController extends BaseController { |
| | | |
| | | @Autowired |
| | |
| | | package com.ruoyi.production.dto; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import com.ruoyi.production.pojo.ProductOrder; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | |
| | | |
| | | @ApiModelProperty(value = "交期偏差") |
| | | private Integer deliveryDaysDiff; |
| | | |
| | | @ApiModelProperty(value = "交期") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate deliveryDate; |
| | | } |
| | |
| | | package com.ruoyi.production.dto; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import com.ruoyi.production.pojo.ProductionProductMain; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | |
| | | |
| | | @ApiModelProperty(value = "报废数量") |
| | | @Excel(name = "报废数量") |
| | | private BigDecimal scrapQty; |
| | | private BigDecimal scrapQty = BigDecimal.ZERO; |
| | | |
| | | //产品名称 |
| | | @Excel(name = "产品名称") |
| | |
| | | @Excel(name = "销售合同号") |
| | | private String salesContractNo; |
| | | |
| | | private LocalDate scheduleDate; |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate schedulingDate; |
| | | private String schedulingUserName; |
| | | private String customerName; |
| | | private String process; |
| | | private BigDecimal workHours; |
| | | private BigDecimal wages; |
| | | |
| | | |
| | | } |
| | |
| | | package com.ruoyi.production.dto; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | |
| | | /** |
| | | * @author :yys |
| | |
| | | */ |
| | | @ApiModelProperty(value = "排产日期") |
| | | @Excel(name = "生产日期") |
| | | private String schedulingDate; |
| | | private LocalDate schedulingDate; |
| | | |
| | | @ApiModelProperty(value = "开始时间") |
| | | private String entryDateStart; |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate entryDateStart; |
| | | @ApiModelProperty(value = "结束时间") |
| | | private String entryDateEnd; |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate entryDateEnd; |
| | | |
| | | |
| | | private BigDecimal outputNum; |
| | | |
| | | private BigDecimal outputRate; |
| | | private String outputRate; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate entryDate; |
| | | |
| | | private String dateType; |
| | | |
| | | |
| | | } |
| | |
| | | //合格数量=报工数量-报废数量 |
| | | BigDecimal productQty = productionProductOutput.getQuantity().subtract(productionProductOutput.getScrapQty()); |
| | | //只有合格数量>0才能增加相应数据 |
| | | if (productQty.compareTo(BigDecimal.ZERO)>0) { |
| | | if (productQty.compareTo(BigDecimal.ZERO) > 0) { |
| | | /*新增质检*/ |
| | | //对应的过程检或者出厂检 |
| | | List<ProductProcessRouteItem> productProcessRouteItems = productProcessRouteItemMapper.selectList(Wrappers.<ProductProcessRouteItem>lambdaQuery().eq(ProductProcessRouteItem::getProductRouteId, productProcessRouteItem.getProductRouteId())); |
| | |
| | | qualityInspect.setTestStandardId(qualityTestStandard.get(0).getId()); |
| | | qualityInspectMapper.updateById(qualityInspect); |
| | | qualityTestStandardParamMapper.selectList(Wrappers.<QualityTestStandardParam>lambdaQuery() |
| | | .eq(QualityTestStandardParam::getTestStandardId, qualityTestStandard.get(0).getId()))//默认获取最新的 |
| | | .eq(QualityTestStandardParam::getTestStandardId, qualityTestStandard.get(0).getId()))//默认获取最新的 |
| | | .forEach(qualityTestStandardParam -> { |
| | | QualityInspectParam param = new QualityInspectParam(); |
| | | BeanUtils.copyProperties(qualityTestStandardParam, param); |
| | |
| | | salesLedgerProductionAccountingMapper.insert(salesLedgerProductionAccounting); |
| | | } |
| | | //如果报废数量>0,需要进入报废的库存 |
| | | if (dto.getScrapQty().compareTo(BigDecimal.ZERO) > 0) { |
| | | stockUtils.addUnStock(productModel.getId(), dto.getScrapQty(), StockUnQualifiedRecordTypeEnum.PRODUCTION_SCRAP.getCode(), productionProductMain.getId()); |
| | | if (ObjectUtils.isNotEmpty(dto.getScrapQty())) { |
| | | if (BigDecimal.ZERO.compareTo(dto.getScrapQty()) > 0) { |
| | | stockUtils.addUnStock(productModel.getId(), dto.getScrapQty(), StockUnQualifiedRecordTypeEnum.PRODUCTION_SCRAP.getCode(), productionProductMain.getId()); |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | |
| | | productWorkOrderMapper.updateById(productWorkOrder); |
| | | //判断是否是最后一道工序 |
| | | List<ProductProcessRouteItem> productProcessRouteItems = productProcessRouteItemMapper.selectList(Wrappers.<ProductProcessRouteItem>lambdaQuery().eq(ProductProcessRouteItem::getProductRouteId, productProcessRouteItem.getProductRouteId())); |
| | | if (productProcessRouteItem.getDragSort() == productProcessRouteItems.size()){ |
| | | if (productProcessRouteItem.getDragSort() == productProcessRouteItems.size()) { |
| | | ProductOrder productOrder = productOrderMapper.selectById(productWorkOrder.getProductOrderId()); |
| | | productOrder.setCompleteQuantity(productOrder.getCompleteQuantity().subtract(productionProductOutput.getQuantity())); |
| | | productOrder.setEndTime(null); |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.production.dto.ProductionProductMainDto; |
| | | import com.ruoyi.production.dto.SalesLedgerProductionAccountingDto; |
| | | import com.ruoyi.production.mapper.ProductionProductMainMapper; |
| | |
| | | @Override |
| | | public IPage<SalesLedgerProductionAccountingDto> pageProductionAccounting(SalesLedgerProductionAccountingDto salesLedgerProductionAccountingDto, Page page) { |
| | | // TODO 管理员查询所有,其他人只能查自己 |
| | | boolean admin = SecurityUtils.isAdmin(SecurityUtils.getUserId()); |
| | | if (!admin) { |
| | | salesLedgerProductionAccountingDto.setSchedulingUserName(SecurityUtils.getUsername()); |
| | | } |
| | | if (salesLedgerProductionAccountingDto.getDateType().equals("month")) { |
| | | salesLedgerProductionAccountingDto.setEntryDate(null); |
| | | }else { |
| | | salesLedgerProductionAccountingDto.setEntryDateStart(null); |
| | | salesLedgerProductionAccountingDto.setEntryDateEnd(null); |
| | | } |
| | | return salesLedgerProductionAccountingMapper.pageProductionAccounting(page, salesLedgerProductionAccountingDto); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<ProductionProductMainDto> listProductionDetails(SalesLedgerProductionAccountingDto salesLedgerProductionAccountingDto, Page page) { |
| | | if (salesLedgerProductionAccountingDto.getDateType().equals("month")) { |
| | | salesLedgerProductionAccountingDto.setEntryDate(null); |
| | | }else { |
| | | salesLedgerProductionAccountingDto.setEntryDateStart(null); |
| | | salesLedgerProductionAccountingDto.setEntryDateEnd(null); |
| | | } |
| | | return productionProductMainMapper.listProductionDetails(salesLedgerProductionAccountingDto, page); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody List<QualityTestStandardBinding> qualityTestStandardBindings) { |
| | | return AjaxResult.success(qualityTestStandardBindingService.saveBatch(qualityTestStandardBindings)); |
| | | return AjaxResult.success(qualityTestStandardBindingService.add(qualityTestStandardBindings)); |
| | | } |
| | | |
| | | /** |
| | |
| | | public interface QualityTestStandardBindingService extends IService<QualityTestStandardBinding> { |
| | | |
| | | List<QualityTestStandardBindingDto> listBinding(Long testStandardId); |
| | | |
| | | int add(List<QualityTestStandardBinding> qualityTestStandardBindings); |
| | | } |
| | |
| | | package com.ruoyi.quality.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.quality.dto.QualityTestStandardBindingDto; |
| | | import com.ruoyi.quality.pojo.QualityTestStandardBinding; |
| | | import com.ruoyi.quality.mapper.QualityTestStandardBindingMapper; |
| | |
| | | public List<QualityTestStandardBindingDto> listBinding(Long testStandardId) { |
| | | return qualityTestStandardBindingMapper.listBinding(testStandardId); |
| | | } |
| | | |
| | | @Override |
| | | public int add(List<QualityTestStandardBinding> qualityTestStandardBindings) { |
| | | //判断是否已经有绑定过的数据 |
| | | for (QualityTestStandardBinding qualityTestStandardBinding : qualityTestStandardBindings) { |
| | | List<QualityTestStandardBinding> testStandardBindings = qualityTestStandardBindingMapper.selectList(Wrappers.<QualityTestStandardBinding>lambdaQuery() |
| | | .eq(QualityTestStandardBinding::getTestStandardId, qualityTestStandardBinding.getTestStandardId()) |
| | | .eq(QualityTestStandardBinding::getProductId, qualityTestStandardBinding.getProductId())); |
| | | if (testStandardBindings.size() > 0){ |
| | | throw new RuntimeException("该产品已经绑定过,请检查"); |
| | | } |
| | | } |
| | | saveBatch(qualityTestStandardBindings); |
| | | return 0; |
| | | } |
| | | } |
| | |
| | | |
| | | //现存量 |
| | | private String currentStock; |
| | | |
| | | } |
| | |
| | | <if test="deviceMaintenanceDto.maintenanceActuallyName != null"> |
| | | and dm.maintenance_actually_name like concat('%',#{deviceMaintenanceDto.maintenanceActuallyName},'%') |
| | | </if> |
| | | <if test="deviceMaintenanceDto.maintenancePlanTimeReq != null"> |
| | | and dm.maintenance_plan_time like concat('%',#{deviceMaintenanceDto.maintenancePlanTimeReq},'%') |
| | | <if test="deviceMaintenanceDto.maintenancePlanTime != null"> |
| | | and dm.maintenance_plan_time like concat('%',#{deviceMaintenanceDto.maintenancePlanTime},'%') |
| | | </if> |
| | | <if test="deviceMaintenanceDto.maintenanceActuallyTimeReq != null"> |
| | | and dm.maintenance_actually_time like concat('%',#{deviceMaintenanceDto.maintenanceActuallyTimeReq},'%') |
| | | <if test="deviceMaintenanceDto.maintenanceActuallyTime != null"> |
| | | and dm.maintenance_actually_time like concat('%',#{deviceMaintenanceDto.maintenanceActuallyTime},'%') |
| | | </if> |
| | | <if test="deviceMaintenanceDto.maintenanceActuallyTime != null"> |
| | | and dm.maintenance_actually_time >= str_to_date(#{deviceMaintenanceDto.maintenanceActuallyTime}, '%Y-%m-%d') |
| | |
| | | next_date, |
| | | record_date, |
| | | CASE |
| | | WHEN next_date >= DATE_FORMAT(now(),'%Y-%m-%d') THEN 1 |
| | | WHEN most_date >= DATE_FORMAT(now(),'%Y-%m-%d') THEN 1 |
| | | ELSE 2 |
| | | END AS status, |
| | | create_user, |
| | |
| | | </where> |
| | | ORDER BY update_time DESC |
| | | </select> |
| | | </mapper> |
| | | </mapper> |
| | |
| | | ppr.process_route_code, |
| | | pb.bom_no, |
| | | ROUND(po.complete_quantity / po.quantity * 100, 2) AS completionStatus, |
| | | DATEDIFF(sl.delivery_date, CURDATE()) AS delivery_days_diff |
| | | DATEDIFF(sl.delivery_date, CURDATE()) AS delivery_days_diff, |
| | | sl.delivery_date |
| | | from product_order po |
| | | left join sales_ledger sl on po.sales_ledger_id = sl.id |
| | | left join sales_ledger_product slp on po.sale_ledger_product_id = slp.id |
| | |
| | | sl.sales_contract_no, |
| | | sl.customer_name, |
| | | p.product_name, |
| | | pm.model, |
| | | pm.model as product_model_name, |
| | | pm.unit, |
| | | slpa.process, |
| | | ppo.quantity, |
| | |
| | | <if test="ew.schedulingUserName != null and ew.schedulingUserName !=''"> |
| | | and slpa.scheduling_user_name = #{ew.schedulingUserName} |
| | | </if> |
| | | <if test="ew.entryDate != null " > |
| | | and slpa.scheduling_date >= #{ew.entryDate} |
| | | and slpa.scheduling_date < DATE_ADD(#{ew.entryDate}, INTERVAL 1 DAY) |
| | | </if> |
| | | <if test="ew.entryDateStart != null and ew.entryDateEnd != null" > |
| | | and slpa.scheduling_date >= #{ew.entryDateStart} |
| | | and slpa.scheduling_date < date_add(#{ew.entryDateEnd}, INTERVAL 1 DAY) |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | |
| | | <select id="pageProductionAccounting" |
| | | resultType="com.ruoyi.production.dto.SalesLedgerProductionAccountingDto"> |
| | | SELECT |
| | | slpa.scheduling_user_id, |
| | | slpa.scheduling_user_name, |
| | | sum(ppout.quantity) as output_num, |
| | | sum(slpa.finished_num * work_hours) as wages, |
| | | SUM(slpa.finished_num) / SUM(ppout.quantity) as output_rate |
| | | slpa.scheduling_user_id, |
| | | slpa.scheduling_user_name, |
| | | sum(ppout.quantity) as output_num, |
| | | sum(slpa.finished_num * work_hours) as wages, |
| | | CONCAT( |
| | | ROUND( |
| | | CASE |
| | | WHEN SUM(ppout.quantity) = 0 OR SUM(ppout.quantity) IS NULL THEN 0 |
| | | ELSE SUM(slpa.finished_num) * 100.0 / SUM(ppout.quantity) |
| | | END, |
| | | 2 |
| | | ), |
| | | '%' |
| | | ) as output_rate |
| | | FROM sales_ledger_production_accounting slpa |
| | | LEFT JOIN production_product_main ppm ON slpa.sales_ledger_work_id = ppm.id |
| | | LEFT JOIN production_product_output ppout ON ppm.id = ppout.product_main_id |
| | | LEFT JOIN production_product_main ppm ON slpa.sales_ledger_work_id = ppm.id |
| | | LEFT JOIN production_product_output ppout ON ppm.id = ppout.product_main_id |
| | | <where> |
| | | <if test="ew.schedulingUserName != null and ew.schedulingUserName !=''" > |
| | | and slpa.scheduling_user_name = #{ew.schedulingUserName} |
| | | <if test="ew.schedulingUserName != null and ew.schedulingUserName !=''"> |
| | | and slpa.scheduling_user_name = #{ew.schedulingUserName} |
| | | </if> |
| | | <if test="ew.entryDate != null "> |
| | | and slpa.scheduling_date >= #{ew.entryDate} |
| | | and slpa.scheduling_date < DATE_ADD(DATE(#{ew.entryDate}), INTERVAL 1 DAY) |
| | | </if> |
| | | <if test="ew.entryDateStart != null and ew.entryDateEnd != null"> |
| | | and slpa.scheduling_date >= #{ew.entryDateStart} |
| | | and slpa.scheduling_date < DATE_ADD(DATE(#{ew.entryDateEnd}), INTERVAL 1 DAY) |
| | | </if> |
| | | |
| | | </where> |
| | | GROUP BY slpa.scheduling_user_name |
| | | |
| | |
| | | <if test="c.standardName != null and c.standardName != '' "> |
| | | AND standard_name like concat('%',#{c.standardName},'%') |
| | | </if> |
| | | <if test="c.state != null and c.state != '' "> |
| | | <if test="c.state != null "> |
| | | AND state =#{c.state} |
| | | </if> |
| | | <if test="c.inspectType != null and c.inspectType != '' "> |
| | | <if test="c.inspectType != null "> |
| | | AND inspect_type =#{c.inspectType} |
| | | </if> |
| | | </select> |
| | |
| | | left join safe_training st on std.safe_training_id = st.id |
| | | where std.user_id = #{c.userId} |
| | | <if test="c.trainingDate != null"> |
| | | and st.training_date = #{c.trainingDate} |
| | | and st.training_date = date_format(#{c.trainingDate},'%Y%m%d') |
| | | </if> |
| | | </select> |
| | | |
| | |
| | | <if test="c.placeTraining != null and c.placeTraining != ''"> |
| | | and st.place_training like concat('%', #{c.placeTraining}, '%') |
| | | </if> |
| | | <if test="c.trainingDate != null and c.trainingDate != ''"> |
| | | and st.training_date = #{c.trainingDate} |
| | | <if test="c.trainingDate != null "> |
| | | and st.training_date = date_format(#{c.trainingDate},'%Y%m%d') |
| | | </if> |
| | | </select> |
| | | <select id="getSafeTraining" resultType="com.ruoyi.safe.dto.SafeTrainingDto"> |
| | |
| | | </if> |
| | | </select> |
| | | <select id="stockInventoryPage" resultType="com.ruoyi.stock.dto.StockInRecordDto"> |
| | | select sir.*,si.qualitity, |
| | | select sir.*,si.qualitity as current_stock, |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name |
| | | p.product_name, |
| | | su.nick_name as create_by |
| | | from |
| | | stock_in_record sir |
| | | left join stock_inventory si on sir.product_model_id = si.product_model_id |
| | | left join product_model pm on sir.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | left join sys_user su on sir.create_user = su.user_id |
| | | <where> |
| | | <if test="ew.reportDate != null"> |
| | | and sir.create_time >= #{ew.reportDate} |