Browse Source

Merge remote-tracking branch 'origin/master'

master
文宽 史 2 years ago
parent
commit
cdc316e553
  1. 3
      src/main/java/com/spring/modules/base/service/PartService.java
  2. 54
      src/main/java/com/spring/modules/production/controller/ShopOrderController.java
  3. 203
      src/main/java/com/spring/modules/production/entity/ShopOrder.java
  4. 39
      src/main/java/com/spring/modules/production/mapper/ShopOrderMapper.java
  5. 23
      src/main/java/com/spring/modules/production/service/ShopOrderService.java
  6. 102
      src/main/java/com/spring/modules/production/service/impl/ShopOrderServiceImpl.java
  7. 24
      src/main/java/com/spring/modules/production/vo/ShopOrderVo.java
  8. 138
      src/main/resources/mapper/production/ShopOrderMapper.xml

3
src/main/java/com/spring/modules/base/service/PartService.java

@ -1,5 +1,6 @@
package com.spring.modules.base.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.spring.common.utils.PageUtils;
import com.spring.modules.base.data.LocationInformationVo;
import com.spring.modules.base.data.PartInformationVo;
@ -9,7 +10,7 @@ import com.spring.modules.base.entity.PartInformationEntity;
import java.util.List;
public interface PartService {
public interface PartService extends IService<PartInformationEntity> {
PageUtils partInformationSearch(PartInformationVo data);
List<PartSubPropertiesValueData> getPartItem(PartSubPropertiesValueData data);

54
src/main/java/com/spring/modules/production/controller/ShopOrderController.java

@ -0,0 +1,54 @@
package com.spring.modules.production.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.spring.common.utils.R;
import com.spring.modules.base.entity.PartInformationEntity;
import com.spring.modules.production.entity.ShopOrder;
import com.spring.modules.production.service.ShopOrderService;
import com.spring.modules.production.vo.ShopOrderVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/shop/order")
public class ShopOrderController {
@Autowired
private ShopOrderService shopOrderService;
@PostMapping("/list")
public R list(@RequestBody ShopOrderVo shopOrder){
List<ShopOrderVo> list = shopOrderService.queryShopOrderList(shopOrder);
return R.ok().put("rows",list);
}
@PostMapping("/page/{no}/{size}")
public R page(@RequestBody ShopOrderVo shopOrder, @PathVariable Integer no, @PathVariable Integer size){
IPage<ShopOrderVo> page = shopOrderService.queryShopOrderPageList(no, size, shopOrder);
return R.ok().put("rows",page);
}
@PostMapping("/part")
public R part(@RequestBody PartInformationEntity part){
List<PartInformationEntity> list = shopOrderService.queryPartList(part);
return R.ok().put("rows",list);
}
@PostMapping("/add")
public R add(@RequestBody ShopOrder shopOrder){
shopOrderService.saveShopOrder(shopOrder);
return R.ok("操作成功");
}
@PostMapping("/edit")
public R edit(@RequestBody ShopOrder shopOrder){
shopOrderService.updateShopOrder(shopOrder);
return R.ok("操作成功");
}
@PostMapping("/remove")
public R remove(@RequestBody ShopOrder shopOrder){
shopOrderService.deleteShopOrder(shopOrder);
return R.ok("操作成功");
}
}

203
src/main/java/com/spring/modules/production/entity/ShopOrder.java

@ -0,0 +1,203 @@
package com.spring.modules.production.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
@Data
@TableName("ShopOrder")
public class ShopOrder {
@TableField("OrderNo")
private String orderNo;
@TableField("Site")
private String site;
/**
* 创建人
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@TableField("EnterDate")
private Date enterDate;
/**
* 创建人
*/
@TableField("UserName")
private String username;
/**
* 要求日期
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@TableField("NeedDate")
private Date needDate;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@TableField("OriginalNeedDate")
private Date originalNeedDate;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@TableField("PlanStartDate")
private Date planStartDate;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@TableField("ReleaseDate")
private Date releaseDate;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@TableField("ReleaseGuys")
private String releaseGuys;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@TableField("ScheduleDate")
private Date scheduleDate;
@TableField("Scheduler")
private String scheduler;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@TableField("IssueDate")
private Date issueDate;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@TableField("ReportDate")
private Date reportDate;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@TableField("ReceiveDate")
private Date receiveDate;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@TableField("CloseDate")
private Date closeDate;
@TableField("Planner")
private String planner;
@TableField("Status")
private String status;
@TableField("Status_Tmp")
private String statusTmp;
@TableField("Printed")
private String printed;
@TableField("OrderType")
private String orderType;
@TableField("PartNo")
private String partNo;
@TableField("LotSize")
private BigDecimal lotSize;
@TableField("FinishedQty")
private BigDecimal finishedQty;
@TableField("ProjectID")
private String projectId;
@TableField("BOMRevNo")
private String BOMRevNo;
@TableField("RoutingRevNo")
private String routingRevNo;
@TableField("Leadtime")
private BigDecimal leadTime;
@TableField("Remark")
private String remark;
@TableField("OrderRef1")
private String orderRef1;
@TableField("OrderRef2")
private String orderRef2;
@TableField("CostRollUpFlag")
private String costRollUpFlag;
@TableField("ManualFlag")
private String manualFlag;
@TableField("OriSOOrderNo")
private String oriSoOrderNo;
@TableField("CustomerID")
private String customerId;
@TableField("TechInfo")
private String techInfo;
@TableField("ReceiveStatus")
private String receiveStatus;
@TableField("E_OriginalOrderNo")
private String eOriginalOrderNo;
@TableField("E_Levels")
private Integer eLevels;
@TableField("E_OriginalOrderType")
private String eOriginalOrderType;
@TableField("E_SeqNo")
private String eSeqNo;
@TableField("E_LevelCode")
private String eLevelCode;
@TableField("SFDCReportedFlag")
private String SFDCReportedFlag;
@TableField("RepairSOFlag")
private String repairSoFlag;
@TableField("ConfigurationFlag")
private String configurationFlag;
@TableField("MaterialSplitFlag")
private String materialSplitFlag;
@TableField("ObjectVersion")
private String objectVersion;
@TableField("ExpandFlag")
private String expandFlag;
@TableField("CodeNo")
private String codeNo;
@TableField("LE_SeqNo")
private BigDecimal LESeqNo;
@TableField("LE_ItemNo")
private Integer LEItemNo;
@TableField("LE_Levels")
private Integer LELevels;
@TableField("Prelev_order_no")
private String preOrderNo;
}

39
src/main/java/com/spring/modules/production/mapper/ShopOrderMapper.java

@ -0,0 +1,39 @@
package com.spring.modules.production.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.spring.modules.base.entity.PartInformationEntity;
import com.spring.modules.production.entity.ShopOrder;
import com.spring.modules.production.vo.ShopOrderVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Mapper
public interface ShopOrderMapper extends BaseMapper<ShopOrder> {
List<ShopOrderVo> selectShopOrderList(ShopOrderVo shopOrder);
IPage<ShopOrderVo> selectShopOrderPageList(@Param("page") Page<ShopOrderVo> page, @Param("params") ShopOrderVo shopOrder);
void autoNewRouting(@Param("site")String site,
@Param("orderNo")String orderNo,
@Param("partNo")String partNo,
@Param("lotSize") BigDecimal lotSize,
@Param("planStartDate") Date planStartDate);
void autoUpdateRouting(@Param("site")String site,
@Param("orderNo")String orderNo,
@Param("partNo")String partNo,
@Param("lotSize")BigDecimal lotSize,
@Param("planStartDate")Date planStartDate);
void autoDeleteRouting(@Param("site")String site,
@Param("orderNo")String orderNo);
List<PartInformationEntity> selectPartList(PartInformationEntity part);
}

23
src/main/java/com/spring/modules/production/service/ShopOrderService.java

@ -0,0 +1,23 @@
package com.spring.modules.production.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.spring.modules.base.entity.PartInformationEntity;
import com.spring.modules.production.entity.ShopOrder;
import com.spring.modules.production.vo.ShopOrderVo;
import java.util.List;
public interface ShopOrderService extends IService <ShopOrder> {
List<ShopOrderVo> queryShopOrderList(ShopOrderVo shopOrder);
void saveShopOrder(ShopOrder shopOrder);
void updateShopOrder(ShopOrder shopOrder);
void deleteShopOrder(ShopOrder shopOrder);
IPage<ShopOrderVo> queryShopOrderPageList(Integer no, Integer size, ShopOrderVo shopOrder);
List<PartInformationEntity> queryPartList(PartInformationEntity part);
}

102
src/main/java/com/spring/modules/production/service/impl/ShopOrderServiceImpl.java

@ -0,0 +1,102 @@
package com.spring.modules.production.service.impl;
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.spring.modules.base.entity.PartInformationEntity;
import com.spring.modules.base.service.PartService;
import com.spring.modules.production.entity.ShopOrder;
import com.spring.modules.production.mapper.ShopOrderMapper;
import com.spring.modules.production.service.ShopOrderService;
import com.spring.modules.production.vo.ShopOrderVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import java.util.List;
@Service
@Slf4j
public class ShopOrderServiceImpl extends ServiceImpl<ShopOrderMapper, ShopOrder> implements ShopOrderService {
@Autowired
private PartService partService;
@Override
public List<ShopOrderVo> queryShopOrderList(ShopOrderVo shopOrder) {
return baseMapper.selectShopOrderList(shopOrder);
}
@Override
@Transactional
public void saveShopOrder(ShopOrder shopOrder) {
checkShopOrderNo(shopOrder);
save(shopOrder);
baseMapper.autoNewRouting(shopOrder.getSite(), shopOrder.getOrderNo(), shopOrder.getPartNo(),shopOrder.getLotSize(),shopOrder.getPlanStartDate());
}
@Override
@Transactional
public void updateShopOrder(ShopOrder shopOrder) {
checkShopOrder(shopOrder);
lambdaUpdate()
.eq(ShopOrder::getSite,shopOrder.getSite())
.eq(ShopOrder::getOrderNo,shopOrder.getOrderNo())
.update(shopOrder);
baseMapper.autoUpdateRouting(shopOrder.getSite(), shopOrder.getOrderNo(), shopOrder.getPartNo(),shopOrder.getLotSize(),shopOrder.getPlanStartDate());
}
@Override
@Transactional
public void deleteShopOrder(ShopOrder shopOrder) {
checkShopOrder(shopOrder);
lambdaUpdate()
.eq(ShopOrder::getSite,shopOrder.getSite())
.eq(ShopOrder::getOrderNo,shopOrder.getOrderNo())
.remove();
baseMapper.autoDeleteRouting(shopOrder.getSite(), shopOrder.getOrderNo());
}
@Override
public IPage<ShopOrderVo> queryShopOrderPageList(Integer no, Integer size, ShopOrderVo shopOrder) {
Page<ShopOrderVo> page = new Page<>(no, size);
return baseMapper.selectShopOrderPageList(page,shopOrder);
}
@Override
public List<PartInformationEntity> queryPartList(PartInformationEntity part) {
return baseMapper.selectPartList(part);
}
private void checkShopOrderNo(ShopOrder shopOrder) {
checkShopOrder(shopOrder);
List<ShopOrder> list = lambdaQuery()
.eq(ShopOrder::getOrderNo, shopOrder.getOrderNo())
.eq(ShopOrder::getSite, shopOrder.getSite())
.list();
if (!list.isEmpty()){
throw new RuntimeException("订单号已存在");
}
List<PartInformationEntity> partList = partService.lambdaQuery()
.eq(PartInformationEntity::getPartNo, shopOrder.getPartNo())
.eq(PartInformationEntity::getSite, shopOrder.getSite()).list();
if (partList.isEmpty()){
throw new RuntimeException("产品编码不存在");
}
}
private void checkShopOrder(ShopOrder shopOrder) {
if (StringUtils.isEmpty(shopOrder.getOrderNo())){
throw new RuntimeException("订单号不能为空");
}
if (StringUtils.isEmpty(shopOrder.getSite())){
throw new RuntimeException("工厂编码不能为空");
}
if (StringUtils.isEmpty(shopOrder.getPartNo())){
throw new RuntimeException("产品编码不能为空");
}
}
}

24
src/main/java/com/spring/modules/production/vo/ShopOrderVo.java

@ -0,0 +1,24 @@
package com.spring.modules.production.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.spring.modules.production.entity.ShopOrder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@EqualsAndHashCode(callSuper = true)
@Data
public class ShopOrderVo extends ShopOrder {
private String partDesc;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date startDate;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date endDate;
}

138
src/main/resources/mapper/production/ShopOrderMapper.xml

@ -0,0 +1,138 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.spring.modules.production.mapper.ShopOrderMapper">
<sql id="columns">
so.OrderNo as orderNo,
so.Site as site,
so.EnterDate as enterDate,
so.UserName as username,
so.NeedDate as needDate,
so.OriginalNeedDate as originalNeedDate,
so.PlanStartDate as planStartDate,
so.ReleaseDate as releaseDate,
so.ReleaseGuys as releaseGuys,
so.ScheduleDate as scheduleDate,
so.Scheduler as scheduler,
so.IssueDate as issueDate,
so.ReportDate as reportDate,
so.ReceiveDate as receiveDate,
so.CloseDate as closeDate,
so.Planner as planner,
so.Status as status,
so.Status_Tmp as statusTmp,
so.Printed as printed,
so.OrderType as orderType,
so.PartNo as partNo,
so.LotSize as lotSize,
so.FinishedQty as finishedQty,
so.ProjectID as projectId,
so.BOMRevNo as BOMRevNo,
so.RoutingRevNo as routingRevNo,
so.Leadtime as leadTime,
so.Remark as remark,
so.OrderRef1 as orderRef1,
so.OrderRef2 as orderRef2,
so.CostRollUpFlag as costRollUpFlag,
so.ManualFlag as manualFlag,
so.OriSOOrderNo as oriSoOrderNo,
so.CustomerID as customerId,
so.TechInfo as techInfo,
so.ReceiveStatus as receiveStatus,
so.E_OriginalOrderNo as eOriginalOrderNo,
so.E_Levels as eLevels,
so.E_OriginalOrderType as eOriginalOrderType,
so.E_SeqNo as eSeqNo,
so.E_LevelCode as eLevelCode,
so.SFDCReportedFlag as SFDCReportedFlag,
so.RepairSOFlag as RepairSoFlag,
so.ConfigurationFlag as configurationFlag,
so.MaterialSplitFlag as materialSplitFlag,
so.ObjectVersion as objectVersion,
so.ExpandFlag as expandFlag,
so.CodeNo as codeNo,
so.LE_SeqNo as LESeqNo,
so.LE_ItemNo as LEItemNo,
so.LE_Levels as LELevels,
so.Prelev_order_no as preOrderNo
</sql>
<select id="selectShopOrderList" resultType="com.spring.modules.production.vo.ShopOrderVo">
SELECT
<include refid="columns" />,
p.part_desc as partDesc
FROM
ShopOrder so
left join part p on so.Site = p.site and so.PartNo = p.part_no
<where>
<if test="orderNo != null and orderNo != ''">
and so.OrderNo like #{orderNo}
</if>
<if test="site != null and site != ''">
and so.Site = #{site}
</if>
<if test="partNo != null and partNo != ''">
and so.PartNo like #{partNo}
</if>
<if test="startDate != null">
and so.PlanStartDate >= #{startDate}
</if>
<if test="endDate != null">
and #{endDate} >= so.PlanStartDate
</if>
</where>
</select>
<select id="selectShopOrderPageList" resultType="com.spring.modules.production.vo.ShopOrderVo">
SELECT
<include refid="columns" />,
p.part_desc as partDesc
FROM
ShopOrder so
left join part p on so.Site = p.site and so.PartNo = p.part_no
<where>
<if test="params.orderNo != null and params.orderNo != ''">
and so.OrderNo like #{params.orderNo}
</if>
<if test="params.site != null and params.site != ''">
and so.Site = #{params.site}
</if>
<if test="params.partNo != null and params.partNo != ''">
and so.PartNo like #{params.partNo}
</if>
<if test="params.startDate != null">
and so.PlanStartDate >= #{params.startDate}
</if>
<if test="params.endDate != null">
and #{params.endDate} >= so.PlanStartDate
</if>
</where>
</select>
<delete id="autoNewRouting">
Exec Shoporder_AutoNewRouting #{site},#{orderNo},#{partNo},#{lotSize},#{planStartDate}
</delete>
<delete id="autoUpdateRouting">
Exec Shoporder_AutoUpdateRouting #{site},#{orderNo},#{partNo},#{lotSize},#{planStartDate}
</delete>
<delete id="autoDeleteRouting">
Exec Shoporder_AutoDeleteRouting #{site},#{orderNo}
</delete>
<select id="selectPartList" resultType="com.spring.modules.base.entity.PartInformationEntity">
select part_no as partNo,part_desc as partDesc from part
<where>
<if test="partNo != null and partNo != ''">
and part_no like #{partNo}
</if>
<if test="partDesc != null and partDesc != ''">
and part_desc like #{partDesc}
</if>
<if test="site != null and site != ''">
and site like #{site}
</if>
</where>
</select>
</mapper>
Loading…
Cancel
Save