新增成品区位填报表导出

master
FCD 2 months ago
parent c9de421ff4
commit 30b2e7ec6e

@ -3,12 +3,14 @@ package com.op.plan.controller;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Objects;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.op.common.core.domain.ExcelCol; import com.op.common.core.domain.ExcelCol;
import com.op.common.core.exception.ServiceException; import com.op.common.core.exception.ServiceException;
import com.op.common.core.utils.ServletUtils;
import com.op.common.core.utils.StringUtils; import com.op.common.core.utils.StringUtils;
import com.op.common.core.utils.poi.ExcelMapUtil; import com.op.common.core.utils.poi.ExcelMapUtil;
import com.op.plan.domain.*; import com.op.plan.domain.*;
@ -402,4 +404,17 @@ public class ProOrderWorkorderController extends BaseController {
String m = "000000010101000115"; String m = "000000010101000115";
System.out.println(m.substring(7)); System.out.println(m.substring(7));
} }
@RequiresPermissions("mes:pro:workorder:productExport")
@Log(title = "导出成品区位填报表", businessType = BusinessType.EXPORT)
@PostMapping("/productExport")
public void productExport(HttpServletResponse response, ProOrderWorkorder proOrderWorkorder) {
String factoryCode = Objects.requireNonNull(ServletUtils.getRequest()).getHeader("PoolName");
proOrderWorkorder.setFactoryCode(factoryCode.replace("ds_",""));
List<ProductFillIn> list = proOrderWorkorderService.getProductFillInList(proOrderWorkorder);
ExcelUtil<ProductFillIn> util = new ExcelUtil<>(ProductFillIn.class);
util.exportExcel(response, list, "物料区位信息");
}
} }

@ -0,0 +1,142 @@
package com.op.plan.domain;
import com.op.common.core.annotation.Excel;
/**
* remark
*
* @author 019117
* @date
*/
public class ProductFillIn {
/**
*
* **/
@Excel(name = "生产日期")
private String productionDate;
/**
*
* **/
@Excel(name = "工单号")
private String workOrderNumber;
/**
*
* **/
@Excel(name = "物料编码")
private String materialCode;
/**
*
* **/
@Excel(name = "物料名称")
private String materialName;
/**
*
* **/
@Excel(name = "批次编码")
private String batchCode;
/**
*
* **/
@Excel(name = "批次数量")
private String batchNumber;
/**
*
* **/
@Excel(name = "工厂编码")
private String factoryCode;
/**
*
* **/
@Excel(name = "地点")
private String location;
/**
*
* **/
@Excel(name = "区号")
private String areaCode;
public String getProductionDate() {
return productionDate;
}
public void setProductionDate(String productionDate) {
this.productionDate = productionDate;
}
public String getWorkOrderNumber() {
return workOrderNumber;
}
public void setWorkOrderNumber(String workOrderNumber) {
this.workOrderNumber = workOrderNumber;
}
public String getMaterialCode() {
return materialCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
public String getBatchCode() {
return batchCode;
}
public void setBatchCode(String batchCode) {
this.batchCode = batchCode;
}
public String getBatchNumber() {
return batchNumber;
}
public void setBatchNumber(String batchNumber) {
this.batchNumber = batchNumber;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public String getFactoryCode() {
return factoryCode;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getAreaCode() {
return areaCode;
}
public void setAreaCode(String areaCode) {
this.areaCode = areaCode;
}
}

@ -268,5 +268,7 @@ public interface ProOrderWorkorderMapper {
List<ProOrderWorkorder> getBPNBomList(ProOrderWorkorder proOrderWorkorder); List<ProOrderWorkorder> getBPNBomList(ProOrderWorkorder proOrderWorkorder);
List<BaseProduct> getPackType(@Param("workorderCodes")String[] workorderCodes); List<BaseProduct> getPackType(@Param("workorderCodes")String[] workorderCodes);
List<ProductFillIn> getProductFillInList(ProOrderWorkorder proOrderWorkorder);
} }

@ -162,4 +162,6 @@ public interface IProOrderWorkorderService {
List<ProOrderWorkorder> getBPNBomList(ProOrderWorkorder proOrderWorkorder); List<ProOrderWorkorder> getBPNBomList(ProOrderWorkorder proOrderWorkorder);
List<BaseProduct> getPackType(String[] workorderIds); List<BaseProduct> getPackType(String[] workorderIds);
List<ProductFillIn> getProductFillInList(ProOrderWorkorder proOrderWorkorder);
} }

@ -9,6 +9,7 @@ import com.op.common.core.domain.ExcelCol;
import com.op.common.core.domain.R; import com.op.common.core.domain.R;
import com.op.common.core.exception.ServiceException; import com.op.common.core.exception.ServiceException;
import com.op.common.core.utils.DateUtils; import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.ServletUtils;
import com.op.common.core.utils.bean.BeanUtils; import com.op.common.core.utils.bean.BeanUtils;
import com.op.common.core.utils.uuid.IdUtils; import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.core.web.domain.AjaxResult; import com.op.common.core.web.domain.AjaxResult;
@ -1851,4 +1852,10 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
String s = "000800003044"; String s = "000800003044";
System.out.println(s.substring(3)); System.out.println(s.substring(3));
} }
@Override
@DS("#header.poolName")
public List<ProductFillIn> getProductFillInList(ProOrderWorkorder proOrderWorkorder) {
return proOrderWorkorderMapper.getProductFillInList(proOrderWorkorder);
}
} }

@ -1144,4 +1144,36 @@
and pow.del_flag = '0' and pow.del_flag = '0'
</select> </select>
<select id="getProductFillInList" parameterType="com.op.plan.domain.ProOrderWorkorder" resultType="com.op.plan.domain.ProductFillIn">
SELECT
CONVERT(VARCHAR, pow.product_date, 23) productionDate,
SUBSTRING(pow.workorder_code_sap, 4, 10) workOrderNumber,
SUBSTRING(pow.product_code, 8,11) materialCode,
pow.product_name materialName,
CASE
WHEN LEN(powb.batch_code) = 24 THEN SUBSTRING(powb.batch_code, 13, 10)
WHEN LEN(powb.batch_code) <![CDATA[ < ]]> 24 THEN powb.batch_code
WHEN LEN(powb.batch_code) > 24 THEN CONVERT(VARCHAR(8), pow.create_time, 112)
ELSE ''
END batchCode,
powb.batch_quantity batchNumber,
#{factoryCode} factoryCode
FROM pro_order_workorder pow
LEFT JOIN pro_order_workorder_batch powb ON pow.workorder_id = powb.workorder_id
WHERE powb.del_flag = '0' AND pow.product_code like '00000001%' and pow.parent_order = #{parentOrder}
<if test="productDateStart != null ">and CONVERT(varchar(10),pow.product_date, 120) >= '${productDateStart}'</if>
<if test="productDateEnd != null ">and '${productDateEnd}' >= CONVERT(varchar(10),pow.product_date, 120)</if>
<if test="workorderCode != null and workorderCode != ''">and pow.workorder_code like concat('%', #{workorderCode}, '%')</if>
<if test="orderCode != null and orderCode != ''">and pow.workorder_code_sap like concat('%', #{orderCode}, '%')</if>
<if test="productCode != null and productCode != ''">and pow.product_code like concat('%', #{productCode},'%')</if>
<if test="prodLineCode != null and prodLineCode != ''">and pow.prod_line_code like concat('%', #{prodLineCode},'%')</if>
<if test="shiftId != null and shiftId != ''">and pow.shift_id = #{shiftId}</if>
<if test="status != null and status != ''">and pow.status = #{status}</if>
<if test="routeCode != null and routeCode != ''">and pow.route_code = #{routeCode}</if>
ORDER BY pow.create_time desc, pow.workorder_code_sap, powb.batch_code
</select>
</mapper> </mapper>

Loading…
Cancel
Save