改为orders

This commit is contained in:
lym
2024-06-17 16:07:29 +08:00
parent 283d46e492
commit 387de1e86a
19 changed files with 108 additions and 51 deletions
@@ -24,21 +24,17 @@ import io.swagger.v3.oas.annotations.Operation;
import javax.validation.*; import javax.validation.*;
import javax.servlet.http.*; import javax.servlet.http.*;
import java.io.*;
import java.net.URLEncoder;
import java.util.*; import java.util.*;
import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.common.pojo.CommonResult; import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.framework.common.util.object.BeanUtils;
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.cf.imes.framework.common.pojo.CommonResult.success; import static com.cf.imes.framework.common.pojo.CommonResult.success;
import com.cf.imes.framework.operatelog.core.annotations.OperateLog; import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.*; import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.*;
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO; import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
import com.cf.imes.module.executor.service.order.OrderService; import com.cf.imes.module.executor.service.order.OrderService;
@@ -47,14 +43,10 @@ import com.cf.imes.module.executor.service.order.OrderService;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
@Tag(name = "管理后台 - 生产单管理") @Tag(name = "管理后台 - 生产单管理")
@@ -117,7 +109,7 @@ public class OrderController {
@Operation(summary = "还原") @Operation(summary = "还原")
@Parameter(name = "orderId", description = "生产单id", required = true, example = "1") @Parameter(name = "orderId", description = "生产单id", required = true, example = "1")
@PreAuthorize("@ss.hasPermission('executor:order:restore')") @PreAuthorize("@ss.hasPermission('executor:order:restore')")
public CommonResult<Boolean> restoreOrder(@RequestParam("orderId") Long orderId) { public CommonResult<Boolean> restoreOrder(@Valid @RequestBody Long orderId) {
orderService.restoreOrder(orderId); orderService.restoreOrder(orderId);
return success(true); return success(true);
} }
@@ -254,6 +246,7 @@ public class OrderController {
// 读取文件 // 读取文件
excelReadUtil.setErr(0); excelReadUtil.setErr(0);
Map<String, Object> map = excelReadUtil.read(file); Map<String, Object> map = excelReadUtil.read(file);
System.out.println(" map " + map);
System.err.println(excelReadUtil.isErr()); System.err.println(excelReadUtil.isErr());
// 判断是否读取有误 // 判断是否读取有误
if (excelReadUtil.isErr() == -1) { // 文件为空 if (excelReadUtil.isErr() == -1) { // 文件为空
@@ -261,6 +254,7 @@ public class OrderController {
return; return;
}else if (excelReadUtil.isErr() > 0) { }else if (excelReadUtil.isErr() > 0) {
// 返回文件 // 返回文件
System.out.println("(Map<Object, Object>) " + (Map<Object, Object>) map.get("order")+ " , (List<OrderPlateImportExcelVO>)" +(List<OrderPlateImportExcelVO>) map.get("plate"));
ExcelWriterUtil.write(response, (Map<Object, Object>) map.get("order"), (List<OrderPlateImportExcelVO>) map.get("plate"),orderService.getSavePath()+ "\\"+ "生产单Excel导入错误导出模板.xlsx"); ExcelWriterUtil.write(response, (Map<Object, Object>) map.get("order"), (List<OrderPlateImportExcelVO>) map.get("plate"),orderService.getSavePath()+ "\\"+ "生产单Excel导入错误导出模板.xlsx");
return; return;
} else { } else {
@@ -34,6 +34,9 @@ public class PlateGoodsRespVO {
@Schema(description = "板id", example = "11087") @Schema(description = "板id", example = "11087")
private Long id; private Long id;
@Schema(description = "板数量", example = "11087")
private Integer count = 1;
@Schema(description = "生产单号", example = "11087") @Schema(description = "生产单号", example = "11087")
private Long orderId; private Long orderId;
@@ -151,6 +154,12 @@ public class PlateGoodsRespVO {
@Schema(description = "是否孤形对角") @Schema(description = "是否孤形对角")
private Boolean isArcAcross; private Boolean isArcAcross;
@Schema(description = "是否异性")
private Boolean isSpecialShaped;
@Schema(description = "是否造型")
private Boolean isSculpt;
@Schema(description = "模块类型 ID", example = "12800") @Schema(description = "模块类型 ID", example = "12800")
private Long moduleTypeId; private Long moduleTypeId;
@@ -14,7 +14,7 @@ import com.cf.imes.framework.mybatis.core.dataobject.BaseDO;
* *
* @author 晨丰科技 * @author 晨丰科技
*/ */
@TableName("`order`") @TableName("`orders`")
@KeySequence("order_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 @KeySequence("order_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@@ -36,11 +36,11 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
.eqIfPresent(OrderDO::getOrderSort, reqVO.getOrderSort()) .eqIfPresent(OrderDO::getOrderSort, reqVO.getOrderSort())
.eqIfPresent(OrderDO::getDataType, reqVO.getDataType()) .eqIfPresent(OrderDO::getDataType, reqVO.getDataType())
.eqIfPresent(OrderDO::getStatus, reqVO.getStatus()) .eqIfPresent(OrderDO::getStatus, reqVO.getStatus())
.eqIfPresent(OrderDO::getCustomOrderNo, reqVO.getCustomOrderNo()) .likeIfPresent(OrderDO::getCustomOrderNo, reqVO.getCustomOrderNo())
.eqIfPresent(OrderDO::getCustomer, reqVO.getCustomer()) .eqIfPresent(OrderDO::getCustomer, reqVO.getCustomer())
.eqIfPresent(OrderDO::getAddress, reqVO.getAddress()) .likeIfPresent(OrderDO::getAddress, reqVO.getAddress())
.eqIfPresent(OrderDO::getPhoneNumber, reqVO.getPhoneNumber()) .eqIfPresent(OrderDO::getPhoneNumber, reqVO.getPhoneNumber())
.eqIfPresent(OrderDO::getDealer, reqVO.getDealer()) .likeIfPresent(OrderDO::getDealer, reqVO.getDealer())
.eqIfPresent(OrderDO::getDealerPhoneNumber, reqVO.getDealerPhoneNumber()) .eqIfPresent(OrderDO::getDealerPhoneNumber, reqVO.getDealerPhoneNumber())
.eqIfPresent(OrderDO::getSalesman, reqVO.getSalesman()) .eqIfPresent(OrderDO::getSalesman, reqVO.getSalesman())
.eqIfPresent(OrderDO::getSplitter, reqVO.getSplitter()) .eqIfPresent(OrderDO::getSplitter, reqVO.getSplitter())
@@ -67,9 +67,9 @@ public interface OrderPartsMapper extends BaseMapperX<OrderPartsDO> {
IPage<OrderPartsRespVO> selectProductList(@Param("page") IPage<OrderPartsRespVO> page , @Param("orderId")Long orderId, @Param("roomId")Long roomId , @Param("bodyId")Long bodyId,@Param("organId")Long organId); IPage<OrderPartsRespVO> selectProductList(@Param("page") IPage<OrderPartsRespVO> page , @Param("orderId")Long orderId, @Param("roomId")Long roomId , @Param("bodyId")Long bodyId,@Param("organId")Long organId);
List<PartGoodsRespVO> selectPartDetail(@Param("orderId") Long orderId, @Param("organId") Long organId);// 配件明细 List<PartGoodsRespVO> selectPartDetail(@Param("orderId") Long orderId, @Param("organId") Long organId, @Param("deleted") Integer deleted);// 配件明细
List<PartGoodsRespVO> selectPartAll(@Param("orderId") Long orderId, @Param("organId") Long organId);// 配件汇总 List<PartGoodsRespVO> selectPartAll(@Param("orderId") Long orderId, @Param("organId") Long organId, @Param("deleted") Integer deleted);// 配件汇总
// 单个修改删除状态 // 单个修改删除状态
@@ -89,9 +89,9 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
List<PlateDetialRespVO> selectPlateDetialListByIds(@Param("orderIds") List<Long> orderIds,@Param("organId") Long organId); List<PlateDetialRespVO> selectPlateDetialListByIds(@Param("orderIds") List<Long> orderIds,@Param("organId") Long organId);
List<PlateGoodsRespVO> selectPlateGoodsList(@Param("orderId") Long orderId, @Param("organId") Long organId); // 明细 List<PlateGoodsRespVO> selectPlateGoodsList(@Param("orderId") Long orderId, @Param("organId") Long organId, @Param("deleted") Integer deleted); // 明细
List<PlateGoodsRespVO> selectPlateGoodsListSummary(@Param("orderId") Long orderId, @Param("organId") Long organId); // 汇总 List<PlateGoodsRespVO> selectPlateGoodsListSummary(@Param("orderId") Long orderId, @Param("organId") Long organId, @Param("deleted") Integer deleted); // 汇总
// 单个修改删除状态 // 单个修改删除状态
@@ -106,4 +106,6 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
} }
void updateDeletedById(@Param("bodyId") Long bodyId, @Param("deleted") Integer deleted, @Param("organId") Long organId); void updateDeletedById(@Param("bodyId") Long bodyId, @Param("deleted") Integer deleted, @Param("organId") Long organId);
int countPlateByOrderId(@Param("orderId") Long orderId, @Param("organId") Long organId, @Param("deleted") Integer deleted);
} }
@@ -56,7 +56,7 @@ public interface OrderService {
* *
* @param orderId 编号组 * @param orderId 编号组
*/ */
void restoreOrder(Long orderId); void restoreOrder(@Valid Long orderId);
/** /**
* 获得生产单表 order_{N} * 获得生产单表 order_{N}
@@ -1,5 +1,6 @@
package com.cf.imes.module.executor.util.fileConversion.admin.api.webcad; package com.cf.imes.module.executor.util.fileConversion.admin.api.webcad;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator; import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
@@ -400,7 +401,7 @@ public class ApiTypeRealize {
.unit(parts.getString("Units")) .unit(parts.getString("Units"))
.price(parts.getDouble("Price")) .price(parts.getDouble("Price"))
.isComposite(parts.getBoolean("IsComposite")) .isComposite(parts.getBoolean("IsComposite"))
.remark(parts.getString("SpecExtras")) .remark(partsRemarkChange(parts))
.build(); .build();
partsInfos.put(parts.getInteger("DataID"), partsInfo); partsInfos.put(parts.getInteger("DataID"), partsInfo);
@@ -426,6 +427,22 @@ public class ApiTypeRealize {
return map; return map;
} }
// 配件备注集合
private String partsRemarkChange(JSONObject value) {
List<Map<String, String>> mapList = new ArrayList<>();
if (value != null && !value.isEmpty()) {
Map<String, String> map = new HashMap<>();
map.put("Remark", value.getString("Remark"));
map.put("SpecExtras", value.getString("SpecExtras"));
map.put("SpecialRemark", value.getString("SpecialRemark"));
map.put("DoorRemark", value.getString("DoorRemark"));
map.put("HingeRemark", value.getString("HingeRemark"));
mapList.add(map);
}
// 转String
String remark = JSON.toJSONString(mapList);
return remark;
}
/** /**
* 板材信息转换 写表 Integer指板材的ItemID板id 加一个板材自定义编号 * 板材信息转换 写表 Integer指板材的ItemID板id 加一个板材自定义编号
*/ */
@@ -70,6 +70,8 @@ public class ExcelReadUtil { // 文件读取
map.put("order", orderMap); map.put("order", orderMap);
if (orderMap.size() == 0) if (orderMap.size() == 0)
isErr = -1; isErr = -1;
if (list.size() == 0)
isErr = -1;
map.put("plate", list); map.put("plate", list);
return map; return map;
@@ -5,7 +5,7 @@
<select id="selectOrderPage" resultType="com.cf.imes.module.executor.controller.admin.plan.vo.OrderRespVOCopy"> <select id="selectOrderPage" resultType="com.cf.imes.module.executor.controller.admin.plan.vo.OrderRespVOCopy">
select a.id as orderId, a.order_date, a.delivery_date, a.customer, a.address, a.custom_order_no as defineId, select a.id as orderId, a.order_date, a.delivery_date, a.customer, a.address, a.custom_order_no as defineId,
count(op.id) as num, sum(op.area) as area count(op.id) as num, sum(op.area) as area
from `order` a from `orders` a
left join order_item oi on a.id = oi.order_id and a.organ_id = oi.organ_id left join order_item oi on a.id = oi.order_id and a.organ_id = oi.organ_id
inner join order_plate op on oi.plate_id = op.id and oi.organ_id = op.organ_id inner join order_plate op on oi.plate_id = op.id and oi.organ_id = op.organ_id
inner join order_goods og on op.goods_id = og.id and op.organ_id = og.organ_id inner join order_goods og on op.goods_id = og.id and op.organ_id = og.organ_id
@@ -16,14 +16,31 @@
<select id="selectPartDetail" <select id="selectPartDetail"
resultType="com.cf.imes.module.executor.controller.admin.orderParts.vo.PartGoodsRespVO"> resultType="com.cf.imes.module.executor.controller.admin.orderParts.vo.PartGoodsRespVO">
SELECT a.id, a.goods_id, a.name, a.material, a.type, a.model, a.spec, a.brand, a.factory, SELECT a.id,
a.unit, a.price, a.is_composite, a.remark, b.num, c.name as body_name, c.id as body_id, a.goods_id,
c.room_id, c.room_name, b.num * a.price AS total_price -- 添加计算总金额的列 a.name,
a.material,
a.type,
a.model,
a.spec,
a.brand,
a.factory,
a.unit,
a.price,
a.is_composite,
a.remark,
b.num,
c.name as body_name,
c.id as body_id,
c.room_id,
c.room_name,
b.num * a.price AS total_price -- 添加计算总金额的列
FROM order_parts a FROM order_parts a
LEFT JOIN order_item b ON a.id = b.parts_id LEFT JOIN order_item b ON a.id = b.parts_id
LEFT JOIN order_body c on c.id = b.body_id LEFT JOIN order_body c on c.id = b.body_id
WHERE b.order_id = #{orderId} WHERE b.order_id = #{orderId}
and b.organ_id = #{organId} and b.organ_id = #{organId}
and a.deleted = #{deleted}
</select> </select>
<select id="selectPartAll" <select id="selectPartAll"
@@ -44,7 +61,7 @@
WHERE WHERE
b.order_id = #{orderId} b.order_id = #{orderId}
AND b.organ_id = #{organId} AND b.organ_id = #{organId}
AND a.deleted = #{deleted}
</select> </select>
<update id="updateDeletedById"> <update id="updateDeletedById">
@@ -102,7 +102,7 @@
left JOIN order_plan_item opi on op.id = opi.plan_id left JOIN order_plan_item opi on op.id = opi.plan_id
left join order_item oi on opi.item_id = oi.id left join order_item oi on opi.item_id = oi.id
left join order_plate opl on oi.plate_id = opl.id left join order_plate opl on oi.plate_id = opl.id
left join `order` o on oi.order_id = o.id left join `orders` o on oi.order_id = o.id
where op.id = #{planId} where op.id = #{planId}
</select> </select>
@@ -11,7 +11,7 @@
from order_plate a from order_plate a
LEFT JOIN order_item oi on a.id = oi.plate_id and a.order_id = oi.order_id and a.organ_id = oi.organ_id LEFT JOIN order_item oi on a.id = oi.plate_id and a.order_id = oi.order_id and a.organ_id = oi.organ_id
LEFT JOIN `order` b on a.order_id = b.id and a.organ_id = b.organ_id LEFT JOIN `orders` b on a.order_id = b.id and a.organ_id = b.organ_id
LEFT JOIN order_goods c on a.goods_id = c.id and a.organ_id = c.organ_id LEFT JOIN order_goods c on a.goods_id = c.id and a.organ_id = c.organ_id
left join order_plan_item opi on oi.id = opi.item_id and oi.organ_id = opi.organ_id left join order_plan_item opi on oi.id = opi.item_id and oi.organ_id = opi.organ_id
<where> <where>
@@ -216,6 +216,8 @@
op.width, op.width,
op.thickness, op.thickness,
op.area, op.area,
op.is_special_shaped,
op.is_sculpt,
ogs.price, ogs.price,
ogs.brand, ogs.brand,
ogs.height as goods_height, ogs.height as goods_height,
@@ -235,6 +237,7 @@
left join order_goods gods on gods.id = op.goods_id left join order_goods gods on gods.id = op.goods_id
where op.order_id = #{orderId} where op.order_id = #{orderId}
and op.organ_id = #{organId} and op.organ_id = #{organId}
and op.deleted = #{deleted}
</select> </select>
<select id="selectPlateGoodsListSummary" resultType="com.cf.imes.module.executor.controller.admin.plate.vo.PlateGoodsRespVO"> <select id="selectPlateGoodsListSummary" resultType="com.cf.imes.module.executor.controller.admin.plate.vo.PlateGoodsRespVO">
@@ -261,6 +264,7 @@
left join order_goods gods on gods.id = op.goods_id left join order_goods gods on gods.id = op.goods_id
where op.order_id = #{orderId} where op.order_id = #{orderId}
and op.organ_id = #{organId} and op.organ_id = #{organId}
and op.deleted = #{deleted}
</select> </select>
<update id="updateDeletedById"> <update id="updateDeletedById">
@@ -271,4 +275,8 @@
WHERE body_id = #{bodyId} AND organ_id = #{organId} WHERE body_id = #{bodyId} AND organ_id = #{organId}
) )
</update> </update>
<select id="countPlateByOrderId" resultType="java.lang.Integer">
SELECT count(*) FROM order_plate
WHERE order_id = #{orderId} AND organ_id = #{organId} AND deleted = #{deleted}
</select>
</mapper> </mapper>
@@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.cf.imes.framework.mybatis.core.dataobject.BaseDO; import com.cf.imes.framework.mybatis.core.dataobject.BaseDO;
import lombok.*; import lombok.*;
@TableName(value = "`order`") // 由于 SQL Server 的 system_user 是关键字,所以使用 system_users @TableName(value = "`orders`") // 由于 SQL Server 的 system_user 是关键字,所以使用 system_users
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
@@ -58,7 +58,7 @@
join order_item oi on op.id = oi.plate_id join order_item oi on op.id = oi.plate_id
join order_body ob on oi.body_id = ob.id join order_body ob on oi.body_id = ob.id
join `order` o on op.order_id = o.id join `orders` o on op.order_id = o.id
join plate p on op.goods_id = p.goods_id join plate p on op.goods_id = p.goods_id
@@ -123,7 +123,7 @@
join order_item oi on op.id = oi.plate_id join order_item oi on op.id = oi.plate_id
join order_body ob on oi.body_id = ob.id join order_body ob on oi.body_id = ob.id
join `order` o on op.order_id = o.id join `orders` o on op.order_id = o.id
join plate p on op.goods_id = p.goods_id join plate p on op.goods_id = p.goods_id
where op.id = #{plateId} where op.id = #{plateId}
@@ -46,7 +46,7 @@
ops.processinfo_id as processID, ops.processinfo_id as processID,
ops.type as processType ops.type as processType
from order_process_step ops from order_process_step ops
join `order` o on ops.order_id = o.id and ops.organ_id = o.organ_id join `orders` o on ops.order_id = o.id and ops.organ_id = o.organ_id
join order_process_step_item opsi on ops.id = opsi.process_step_id and ops.organ_id = opsi.organ_id join order_process_step_item opsi on ops.id = opsi.process_step_id and ops.organ_id = opsi.organ_id
<where> <where>
@@ -41,7 +41,7 @@
p.material as material, p.material as material,
p.color as color p.color as color
from `order` o from `orders` o
join order_item oi on o.id = oi.order_id join order_item oi on o.id = oi.order_id
join order_plate op on oi.plate_id = op.id join order_plate op on oi.plate_id = op.id
@@ -26,7 +26,7 @@
o.phone_number as customerPhone, o.phone_number as customerPhone,
count(opn.order_id) as packageQuantity count(opn.order_id) as packageQuantity
from `order` o from `orders` o
join order_package opn on o.id = opn.order_id and o.organ_id = opn.organ_id join order_package opn on o.id = opn.order_id and o.organ_id = opn.organ_id
where o.id = #{orderNo} and opn.status &lt;&gt; 0 and o.organ_id = #{organId} ; where o.id = #{orderNo} and opn.status &lt;&gt; 0 and o.organ_id = #{organId} ;
@@ -85,7 +85,7 @@
when oi.plate_id !=0 then oi.plate_id end when oi.plate_id !=0 then oi.plate_id end
)as totalPieceCount )as totalPieceCount
FROM `order` o FROM `orders` o
join order_item oi on o.id = oi.order_id and o.organ_id = oi.organ_id join order_item oi on o.id = oi.order_id and o.organ_id = oi.organ_id
WHERE WHERE
@@ -126,7 +126,7 @@
o.address as address, o.address as address,
((SELECT COUNT(t2.id) FROM order_package t2 WHERE t2.create_time &lt;= opn.create_time and t2.order_id =#{orderNo})) as packNum ((SELECT COUNT(t2.id) FROM order_package t2 WHERE t2.create_time &lt;= opn.create_time and t2.order_id =#{orderNo})) as packNum
from `order` o from `orders` o
join order_package opn on o.id = opn.order_id and o.organ_id = opn.organ_id join order_package opn on o.id = opn.order_id and o.organ_id = opn.organ_id
where opn.order_id =#{orderNo} and opn.id = #{packageNo} and opn.status &lt;&gt; 0 and opn.organ_id = #{organId} where opn.order_id =#{orderNo} and opn.id = #{packageNo} and opn.status &lt;&gt; 0 and opn.organ_id = #{organId}