Commit feead0f3 authored by Administrator's avatar Administrator

下载装箱单并连接盈信库

更新异常状态并更新异常信息
更新出库时间和入库时间
parent a2d94781
...@@ -63,6 +63,12 @@ ...@@ -63,6 +63,12 @@
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.1.0</version>
</dependency>
<dependency> <dependency>
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId> <artifactId>poi</artifactId>
......
package com.yxproject.start.api;
import com.yxproject.start.service.*;
import com.yxproject.start.entity.CardBodyInfoEntity;
import com.yxproject.start.entity.CountyListInfoEntity;
import com.yxproject.start.entity.GroupinfoEntity;
import com.yxproject.start.entity.ProductionTaskListEntity;
import com.yxproject.start.service.CardBodyInfoService;
import com.yxproject.start.service.CountyListInfoService;
import com.yxproject.start.utils.YXJSONResponse;
import net.sf.json.JSONObject;
import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by Administrator on 2018/11/7.
*/
@Path("admin")
public class AdminApi {
@Autowired
private CardBodyInfoService cardBodyInfoService;
@Autowired
private CountyListInfoService countyListInfoService;
@Autowired
private GroupinfoService groupinfoService;
@Autowired
private ProductionTaskListService productionTaskListService;
/**
* 通过任务单查询区县列表;
*
* @return
*/
@GET
@Path("getCountyList")
@Produces(MediaType.APPLICATION_JSON)
@RequiresPermissions("userInfo.add")//权限管理;
public String getCountyListInfoByTaskListID(@QueryParam("taskListID") String tasklistid, @Context HttpServletResponse resp) {
List<CountyListInfoEntity> countyListInfoEntity = countyListInfoService.findCountyListByTaskListID(tasklistid);
YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8");
yxjsonResponse.outPutSuccess(countyListInfoEntity);
Map map = new HashMap();
// map.put("MakeType",productionTaskListEntity);
return yxjsonResponse.toJSONString();
}
/**
* 更新卡机表;
*
* @return
*/
@GET
@Path("updateCardBody")
@Produces(MediaType.APPLICATION_JSON)
@RequiresPermissions("userInfo.add")//权限管理;
public String updateCardBodyInfo(@QueryParam("CardBody") String cardBodyInfoId, @Context HttpServletResponse resp) {
String map = "{\"CardBody\":\"20181016001\",\"makeType\":4,\"oldMakeType\":6}";
JSONObject jsonObject = JSONObject.fromObject(map);
CardBodyInfoEntity cardBodyInfoEntity = (CardBodyInfoEntity) jsonObject.toBean(jsonObject, CardBodyInfoEntity.class);
YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8");
int i = cardBodyInfoService.updateCardBodyInfo(cardBodyInfoEntity);
yxjsonResponse.outPutSuccess(i + "更新成功");
return yxjsonResponse.toJSONString();
}
/**
* 保存卡机表;
*
* @return
*/
@GET
@Path("addCardBody")
@Produces(MediaType.APPLICATION_JSON)
@RequiresPermissions("userInfo.add")//权限管理;
public String addCardBodyInfo(@QueryParam("CardBody") String cardBodyInfoId, @Context HttpServletResponse resp) {
String map = "{\"CardBody\":\"20181016001\",\"makeType\":4,\"oldMakeType\":7}";
JSONObject jsonObject = JSONObject.fromObject(map);
Object cardBodyInfo = jsonObject.get("CardBody");
Object groupInfoList = jsonObject.get("groupInfoList");
List<GroupinfoEntity> groupinfoEntities = (List<GroupinfoEntity>) groupInfoList;
CardBodyInfoEntity cardBodyInfoEntity = (CardBodyInfoEntity) cardBodyInfo;
YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8");
int i = cardBodyInfoService.addCardBodyInfoEntity(cardBodyInfoEntity, groupinfoEntities);
yxjsonResponse.outPutSuccess(i + "添加成功");
return yxjsonResponse.toJSONString();
}
@GET
@Path("downloadPackingList")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
@Consumes(MediaType.APPLICATION_JSON)
// @RequiresPermissions("userInfo.add")//权限管理;
public byte[] downloadPackingList(@QueryParam("cyclesheetID") String cyclesheetID, @Context HttpServletResponse response) {
// cyclesheetID ="20180802032";
response.setContentType("application/x-download");
response.setCharacterEncoding("UTF-8");
String dateTime = DateFormatUtils.format(new Date(), "yyyyMMddHH");
// //使用Servlet实现文件下载的时候,避免浏览器自动打开文件
String fout = null;
List<Map<String, Object>> countyInfoList = groupinfoService.findCountyInfoList(cyclesheetID);
List<ProductionTaskListEntity> productionTaskListEntityList = productionTaskListService.findProductionTaskListEntityByID(cyclesheetID);
fout = exportExcel(countyInfoList, productionTaskListEntityList.get(0).getMake_Type()+"", productionTaskListEntityList.get(0).getWorkshop(), 6000, productionTaskListEntityList.get(0).getCitycode() ,dateTime,cyclesheetID);
String outFile = dateTime + productionTaskListEntityList.get(0).getCitycode() + "二代身份证统计表";
try {
FileInputStream fis = new FileInputStream(new File(fout));
byte[] b = new byte[fis.available()];
fis.read(b);
fis.close();
response.addHeader("Content-Disposition", "attachment;filename=" + outFile + ".xls");
return b;
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
private String exportExcel(List<Map<String, Object>> countyInfoList, String typeName, String workShop, int sum, String cityName,String permanentPositionDate ,String cyclesheetid) {
if (typeName.contains("null")){
typeName=typeName.replace("null","");
}
//第一步创建workbook
HSSFWorkbook wb = new HSSFWorkbook();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
HSSFSheet sheet = wb.createSheet("二代身份证统计表");
sheet.setColumnWidth(0, (int) 30 * 100);
sheet.setColumnWidth(1, (int) 30 * 70);
sheet.setColumnWidth(2, (int) 30 * 80);
sheet.setColumnWidth(3, (int) 30 * 50);
sheet.setColumnWidth(4, (int) 30 * 110);
HSSFPrintSetup ps = sheet.getPrintSetup();
ps.setLandscape(true); // 打印方向,true:横向,false:纵向
ps.setPaperSize(HSSFPrintSetup.B5_PAPERSIZE); //纸张
sheet.setColumnWidth(0, (int) 35.7 * 100);
//第三步创建行row:添加表头0行
HSSFRow row = sheet.createRow(0);
HSSFCellStyle style = wb.createCellStyle();//样式
style.setVerticalAlignment(HSSFCellStyle.ALIGN_LEFT); //设置垂直居中
style.setAlignment(HSSFCellStyle.ALIGN_LEFT);
style.setWrapText(true);//设置自动换行
style.setBorderBottom(HSSFCellStyle.BORDER_THIN); //下边框
style.setBorderLeft(HSSFCellStyle.BORDER_THIN);//左边框
style.setBorderTop(HSSFCellStyle.BORDER_THIN);//上边框
style.setBorderRight(HSSFCellStyle.BORDER_THIN);//右边框
HSSFFont font = wb.createFont();
font.setFontHeightInPoints((short) 12);
style.setFont(font);
HSSFCellStyle style2 = wb.createCellStyle(); //表头样式
style2.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); //设置垂直居中
style2.setAlignment(HSSFCellStyle.ALIGN_CENTER);
HSSFFont font2 = wb.createFont();
font2.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);//粗体显示
font2.setFontHeightInPoints((short) 14);
style2.setFont(font2);
row = sheet.createRow(0); //创建下标为0的单元格
row.setHeightInPoints(Short.parseShort("20"));//设置行高
HSSFCell cell = row.createCell(0); //设定值
cell.setCellValue("二代身份证统计表");
cell.setCellStyle(style2);
for (int i = 0; i < 4; i++) {
cell = row.createCell(i + 1);
cell.setCellValue("");
cell.setCellStyle(style2);
}
CellRangeAddress callRangeAddress = new CellRangeAddress(0, 0, 0, 4);//起始行,结束行,起始列,结束列
sheet.addMergedRegion(callRangeAddress);
row = sheet.createRow(1);
row.setHeightInPoints(Short.parseShort("16"));//设置行高
cell = row.createCell(0);
cell.setCellValue("单位"); //设定值
cell.setCellStyle(style); //内容居中
cell = row.createCell(1); //第二个单元格
cell.setCellValue("数量");
cell.setCellStyle(style);
cell = row.createCell(2); //第三个单元格
cell.setCellValue("质检号");
cell.setCellStyle(style);
cell = row.createCell(3); //第四个单元格
cell.setCellValue("盒数");
cell.setCellStyle(style);
cell = row.createCell(4); //第五个单元格
cell.setCellValue("入库日期");
cell.setCellStyle(style);
row = sheet.createRow(2);//i+2行之后开始创建
row.setHeightInPoints(Short.parseShort("16"));//设置行高
//创建单元格并且添加数据
cell = row.createCell(0);
cell.setCellValue(cityName);
cell.setCellStyle(style);
for (int i = 0; i < 4; i++) {
cell = row.createCell(i + 1);
cell.setCellValue("");
cell.setCellStyle(style);
}
//第五步插入数据
int num = 0;
for (int i = 0; i < countyInfoList.size(); i++) {
Map<String, Object> map = countyInfoList.get(i);
//创建行
row = sheet.createRow(i + 3);//i+2行之后开始创建
row.setHeightInPoints(Short.parseShort("16"));//设置行高
//创建单元格并且添加数据
cell = row.createCell(0);
cell.setCellValue((String) map.get("countyName"));
cell.setCellStyle(style);
cell = row.createCell(1);
cell.setCellValue(map.get("download").toString().equals("0") ? "" : map.get("download").toString());
cell.setCellStyle(style);
cell = row.createCell(2);
cell.setCellValue("");
cell.setCellStyle(style);
cell = row.createCell(3);
cell.setCellValue(((Integer.parseInt(map.get("download").toString()) % 250==0?Integer.parseInt(map.get("download").toString()) / 250:Integer.parseInt(map.get("download").toString()) / 250+1)) + "");
num += ((Integer.parseInt(map.get("download").toString()) % 250==0?Integer.parseInt(map.get("download").toString()) / 250:Integer.parseInt(map.get("download").toString()) / 250+1));
cell.setCellStyle(style);
cell = row.createCell(4);
cell.setCellValue("");
cell.setCellStyle(style);
}
if (countyInfoList.size() < 16) {
for (int i = 0; i <= 16 - countyInfoList.size(); i++) {
//创建行
row = sheet.createRow(countyInfoList.size() + 3 + i);// 行之后开始创建
row.setHeightInPoints(Short.parseShort("16"));//设置行高
//创建单元格并且添加数据
for (int j = 0; j < 5; j++) {
cell = row.createCell(j);
cell.setCellValue("");
cell.setCellStyle(style);
}
}
row = sheet.createRow(18);
row.setHeightInPoints(Short.parseShort("16"));//设置行高
//创建单元格并且添加数据
cell = row.createCell(0);
cell.setCellValue("合计");
cell.setCellStyle(style);
cell = row.createCell(1);
cell.setCellValue(sum);
cell.setCellStyle(style);
cell = row.createCell(2);
cell.setCellValue("制证车间");
cell.setCellStyle(style);
if ("p1".equals(workShop) || "p3".equals(workShop)) {
cell = row.createCell(2);
cell.setCellValue(" 平 一 ");
cell.setCellStyle(style2);
} else {
cell = row.createCell(2);
cell.setCellValue("平二");
cell.setCellStyle(style2);
}
cell = row.createCell(3);
cell.setCellValue(num);
cell.setCellStyle(style);
cell = row.createCell(4);
cell.setCellValue(permanentPositionDate);
cell.setCellStyle(style);
row = sheet.createRow(19);
row.setHeightInPoints(Short.parseShort("16"));//设置行高
//创建单元格并且添加数据
cell = row.createCell(0);
cell.setCellValue("类型");
cell.setCellStyle(style);
cell = row.createCell(1);
cell.setCellValue(typeName);
cell.setCellStyle(style);
for (int j = 0; j < 3; j++) {
cell = row.createCell(j + 2);
cell.setCellValue("");
cell.setCellStyle(style);
}
CellRangeAddress callRangeNum1 = new CellRangeAddress(19, 19, 1, 4);//起始行,结束行,起始列,结束列
sheet.addMergedRegion(callRangeNum1);
row = sheet.createRow(20);
row.setHeightInPoints(Short.parseShort("32"));//设置行高
//创建单元格并且添加数据
cell = row.createCell(0);
cell.setCellValue("循环单");
cell.setCellStyle(style);
cell = row.createCell(1);
cell.setCellValue(cyclesheetid);
cell.setCellStyle(style);
for (int j = 0; j < 3; j++) {
cell = row.createCell(j + 2);
cell.setCellValue("");
cell.setCellStyle(style);
}
CellRangeAddress callRangeNum = new CellRangeAddress(20, 20, 1, 4);//起始行,结束行,起始列,结束列
sheet.addMergedRegion(callRangeNum);
row = sheet.createRow(21);
row.setHeightInPoints(Short.parseShort("16"));//设置行高
//创建单元格并且添加数据
cell = row.createCell(0);
cell.setCellValue("出库日期");
cell.setCellStyle(style);
cell = row.createCell(1);
cell.setCellValue("20 年 月 日");
cell.setCellStyle(style);
cell = row.createCell(2);
cell.setCellValue("");
cell.setCellStyle(style);
cell = row.createCell(3);
cell.setCellValue("");
cell.setCellStyle(style);
cell = row.createCell(4);
cell.setCellValue("");
cell.setCellStyle(style);
CellRangeAddress callRangedate = new CellRangeAddress(21, 21, 1, 4);//起始行,结束行,起始列,结束列
sheet.addMergedRegion(callRangedate);
}
if (countyInfoList.size() >= 16) {
row = sheet.createRow(countyInfoList.size() + 3);
row.setHeightInPoints(Short.parseShort("16"));//设置行高
//创建单元格并且添加数据
cell = row.createCell(0);
cell.setCellValue("合计");
cell.setCellStyle(style);
cell = row.createCell(1);
cell.setCellValue(sum);
cell.setCellStyle(style);
cell = row.createCell(2);
cell.setCellValue("制证车间");
cell.setCellStyle(style);
if ("p1".equals(workShop) || "p3".equals(workShop)) {
cell = row.createCell(2);
cell.setCellValue("平一");
cell.setCellStyle(style);
} else {
cell = row.createCell(2);
cell.setCellValue("平二");
cell.setCellStyle(style);
}
cell = row.createCell(3);
cell.setCellValue(num);
cell.setCellStyle(style);
cell = row.createCell(4);
cell.setCellValue(permanentPositionDate);
cell.setCellStyle(style);
row = sheet.createRow(countyInfoList.size() + 4);
row.setHeightInPoints(Short.parseShort("16"));//设置行高
//创建单元格并且添加数据
cell = row.createCell(0);
cell.setCellValue("类型");
cell.setCellStyle(style);
cell = row.createCell(1);
cell.setCellValue(typeName);
cell.setCellStyle(style);
for (int j = 0; j < 3; j++) {
cell = row.createCell(j + 2);
cell.setCellValue("");
cell.setCellStyle(style);
}
row = sheet.createRow(countyInfoList.size() + 5);
row.setHeightInPoints(Short.parseShort("32"));//设置行高
cell = row.createCell(0);
cell.setCellValue("循环单");
cell.setCellStyle(style);
cell = row.createCell(1);
cell.setCellValue(cyclesheetid);
cell.setCellStyle(style);
for (int j = 0; j < 3; j++) {
cell = row.createCell(j + 2);
cell.setCellValue("");
cell.setCellStyle(style);
}
CellRangeAddress callRangeNum = new CellRangeAddress(countyInfoList.size() + 5, countyInfoList.size() + 5, 1, 4);//起始行,结束行,起始列,结束列
sheet.addMergedRegion(callRangeNum);
row = sheet.createRow(countyInfoList.size() + 6);
row.setHeightInPoints(Short.parseShort("16"));//设置行高
//创建单元格并且添加数据
cell = row.createCell(0);
cell.setCellValue("出库日期");
cell.setCellStyle(style);
cell = row.createCell(1);
cell.setCellValue("20 年 月 日");
cell.setCellStyle(style);
for (int j = 0; j < 3; j++) {
cell = row.createCell(j + 2);
cell.setCellValue("");
cell.setCellStyle(style);
}
CellRangeAddress callRangedate = new CellRangeAddress(countyInfoList.size() + 6, countyInfoList.size() + 6, 1, 4);//起始行,结束行,起始列,结束列
sheet.addMergedRegion(callRangedate);
}
//创建分单
//创建辖区合单
HSSFSheet mergeSheet = wb.createSheet("辖区合单");
mergeSheet.setColumnWidth(0, (int) 30 * 115);
mergeSheet.setColumnWidth(1, (int) 30 * 70);
mergeSheet.setColumnWidth(2, (int) 30 * 80);
mergeSheet.setColumnWidth(3, (int) 30 * 50);
mergeSheet.setColumnWidth(4, (int) 30 * 110);
HSSFPrintSetup ps1 = mergeSheet.getPrintSetup();
ps1.setLandscape(true); // 打印方向,true:横向,false:纵向
ps1.setPaperSize(HSSFPrintSetup.B5_PAPERSIZE); //纸张
//计算合单的行数
int lineNum = 0;
//计算合单的总数
int mergeSum = 0;
//计算合单的盒数
int boxNum = 0;
for (int a = 0; a < countyInfoList.size(); a++) {
Map<String, Object> map = countyInfoList.get(a);
//第二步创建sheet
if (map.get("countyName").toString().contains("区")) {
//第三步创建行row:添加表头0行
row = mergeSheet.createRow(0);
row.setHeightInPoints(Short.parseShort("20"));//设置行高
cell = row.createCell(0); //第一个单元格
cell.setCellValue("二代身份证统计表"); //设定值
cell.setCellStyle(style2);
for (int j = 0; j < 4; j++) {
cell = row.createCell(j + 1);
cell.setCellValue("");
cell.setCellStyle(style2);
}
CellRangeAddress callRange = new CellRangeAddress(0, 0, 0, 4);//起始行,结束行,起始列,结束列
mergeSheet.addMergedRegion(callRange);
row = mergeSheet.createRow(1);
row.setHeightInPoints(Short.parseShort("16"));//设置行高
//第四步创建单元格
cell = row.createCell(0); //第一个单元格
cell.setCellValue("单位"); //设定值
cell.setCellStyle(style); //内容居中
cell = row.createCell(1); //第二个单元格
cell.setCellValue("数量");
cell.setCellStyle(style);
cell = row.createCell(2); //第三个单元格
cell.setCellValue("质检号");
cell.setCellStyle(style);
cell = row.createCell(3); //第四个单元格
cell.setCellValue("盒数");
cell.setCellStyle(style);
cell = row.createCell(4); //第五个单元格
cell.setCellValue("入库日期");
cell.setCellStyle(style);
//第五步插入数据
//创建行
row = mergeSheet.createRow(2);
row.setHeightInPoints(Short.parseShort("16"));//设置行高
//创建单元格并且添加数据
cell = row.createCell(0);
cell.setCellValue(cityName);
cell.setCellStyle(style);
for (int j = 0; j < 4; j++) {
cell = row.createCell(j + 1);
cell.setCellValue("");
cell.setCellStyle(style);
}
row = mergeSheet.createRow(lineNum + 3);
row.setHeightInPoints(Short.parseShort("16"));//设置行高
//创建单元格并且添加数据
cell = row.createCell(0);
cell.setCellValue(map.get("countyName").toString());
cell.setCellStyle(style);
cell = row.createCell(1);
cell.setCellValue(map.get("download") + "");
mergeSum += Integer.valueOf(map.get("download") + "");
cell.setCellStyle(style);
cell = row.createCell(2);
cell.setCellValue("");
cell.setCellStyle(style);
cell = row.createCell(3);
cell.setCellStyle(style);
cell.setCellValue(((Integer.parseInt(map.get("download") + "") % 250==0?Integer.parseInt(map.get("download") + "") / 250:Integer.parseInt(map.get("download") + "") / 250+1)) + "");
boxNum += ((Integer.parseInt(map.get("download") + "") % 250==0?Integer.parseInt(map.get("download") + "") / 250:Integer.parseInt(map.get("download") + "") / 250+1));
cell = row.createCell(4);
cell.setCellValue("");
cell.setCellStyle(style);
//创建空的行和列
for (int i = 0; i <= 14 - lineNum; i++) {
//创建行
row = mergeSheet.createRow(lineNum + 4 + i);// 行之后开始创建
row.setHeightInPoints(Short.parseShort("16"));//设置行高
//创建单元格并且添加数据
for (int j = 0; j < 5; j++) {
cell = row.createCell(j);
cell.setCellValue("");
cell.setCellStyle(style);
}
}
row = mergeSheet.createRow(18);
row.setHeightInPoints(Short.parseShort("16"));//设置行高
//创建单元格并且添加数据
cell = row.createCell(0);
cell.setCellValue("合计");
cell.setCellStyle(style);
cell = row.createCell(1);
cell.setCellValue(mergeSum + "");
cell.setCellStyle(style);
cell = row.createCell(2);
cell.setCellValue("制证车间");
cell.setCellStyle(style);
if ("p1".equals(workShop) || "p3".equals(workShop)) {
cell = row.createCell(2);
cell.setCellValue("平一");
cell.setCellStyle(style);
} else {
cell = row.createCell(2);
cell.setCellValue("平二");
cell.setCellStyle(style);
}
cell.setCellStyle(style);
cell = row.createCell(3);
cell.setCellValue(boxNum + "");
cell.setCellStyle(style);
cell = row.createCell(4);
cell.setCellValue(permanentPositionDate);
cell.setCellStyle(style);
//创建单元格并且添加数据
row = mergeSheet.createRow(19);
row.setHeightInPoints(Short.parseShort("16"));//设置行高
cell = row.createCell(0);
cell.setCellValue("类型");
cell.setCellStyle(style);
cell = row.createCell(1);
cell.setCellValue(typeName);
cell.setCellStyle(style);
cell = row.createCell(2);
cell.setCellValue("");
cell.setCellStyle(style);
cell = row.createCell(3);
cell.setCellValue("");
cell.setCellStyle(style);
cell = row.createCell(4);
cell.setCellValue("");
cell.setCellStyle(style);
CellRangeAddress callRangea = new CellRangeAddress(19, 19, 1, 4);//起始行,结束行,起始列,结束列
mergeSheet.addMergedRegion(callRangea);
//创建单元格并且添加数据
row = mergeSheet.createRow(20);
row.setHeightInPoints(Short.parseShort("32"));//设置行高
cell = row.createCell(0);
cell.setCellValue("编号");
cell.setCellStyle(style);
cell = row.createCell(1);
cell.setCellValue(cyclesheetid);
cell.setCellStyle(style);
cell = row.createCell(0);
cell.setCellValue("循环单");
cell.setCellStyle(style);
cell = row.createCell(2);
cell.setCellValue("");
cell.setCellStyle(style);
cell = row.createCell(3);
cell.setCellValue("");
cell.setCellStyle(style);
cell = row.createCell(4);
cell.setCellValue("");
cell.setCellStyle(style);
CellRangeAddress callRangea1 = new CellRangeAddress(20, 20, 1, 4);//起始行,结束行,起始列,结束列
mergeSheet.addMergedRegion(callRangea1);
row = mergeSheet.createRow(21);
row.setHeightInPoints(Short.parseShort("16"));//设置行高
//创建单元格并且添加数据
cell = row.createCell(0);
cell.setCellValue("出库日期");
cell.setCellStyle(style);
cell = row.createCell(1);
cell.setCellValue("20 年 月 日");
cell.setCellStyle(style);
cell = row.createCell(2);
cell.setCellValue("");
cell.setCellStyle(style);
cell = row.createCell(3);
cell.setCellValue("");
cell.setCellStyle(style);
cell = row.createCell(4);
cell.setCellValue("");
cell.setCellStyle(style);
CellRangeAddress callRangeb = new CellRangeAddress(21, 21, 1, 4);//起始行,结束行,起始列,结束列
mergeSheet.addMergedRegion(callRangeb);
lineNum++;
} else {
sheet = wb.createSheet(a + "-" + (String) map.get("countyName"));
sheet.setColumnWidth(0, (int) 30 * 100);
sheet.setColumnWidth(1, (int) 30 * 70);
sheet.setColumnWidth(2, (int) 30 * 80);
sheet.setColumnWidth(3, (int) 30 * 50);
sheet.setColumnWidth(4, (int) 30 * 110);
HSSFPrintSetup ps2 = sheet.getPrintSetup();
ps2.setLandscape(true); // 打印方向,true:横向,false:纵向
ps2.setPaperSize(HSSFPrintSetup.B5_PAPERSIZE);
//第三步创建行row:添加表头0行
row = sheet.createRow(0);
row.setHeightInPoints(Short.parseShort("20"));//设置行高
cell = row.createCell(0); //第一个单元格
cell.setCellValue("二代身份证统计表"); //设定值
cell.setCellStyle(style2);
for (int j = 0; j < 4; j++) {
cell = row.createCell(j + 1);
cell.setCellValue("");
cell.setCellStyle(style2);
}
CellRangeAddress callRange = new CellRangeAddress(0, 0, 0, 4);//起始行,结束行,起始列,结束列
sheet.addMergedRegion(callRange);
row = sheet.createRow(1);
row.setHeightInPoints(Short.parseShort("16"));//设置行高
//第四步创建单元格
cell = row.createCell(0); //第一个单元格
cell.setCellValue("单位"); //设定值
cell.setCellStyle(style); //内容居中
cell = row.createCell(1); //第二个单元格
cell.setCellValue("数量");
cell.setCellStyle(style);
cell = row.createCell(2); //第三个单元格
cell.setCellValue("质检号");
cell.setCellStyle(style);
cell = row.createCell(3); //第四个单元格
cell.setCellValue("盒数");
cell.setCellStyle(style);
cell = row.createCell(4); //第五个单元格
cell.setCellValue("入库日期");
cell.setCellStyle(style);
//第五步插入数据
//创建行
row = sheet.createRow(2);
row.setHeightInPoints(Short.parseShort("16"));//设置行高
//创建单元格并且添加数据
cell = row.createCell(0);
// cell.setCellValue(typeName);
cell.setCellValue(cityName);
cell.setCellStyle(style);
for (int j = 0; j < 4; j++) {
cell = row.createCell(j + 1);
cell.setCellValue("");
cell.setCellStyle(style);
}
row = sheet.createRow(3);
row.setHeightInPoints(Short.parseShort("16"));//设置行高
//创建单元格并且添加数据
cell = row.createCell(0);
cell.setCellValue(map.get("countyName").toString());
cell.setCellStyle(style);
cell = row.createCell(1);
cell.setCellValue(map.get("download") + "");
cell.setCellStyle(style);
cell = row.createCell(2);
cell.setCellValue("");
cell.setCellStyle(style);
cell = row.createCell(3);
cell.setCellStyle(style);
cell.setCellValue(((Integer.parseInt(map.get("download") + "") % 250==0?Integer.parseInt(map.get("download") + "") / 250:Integer.parseInt(map.get("download") + "") / 250+1)) + "");
cell = row.createCell(4);
cell.setCellValue("");
cell.setCellStyle(style);
//创建空的行和列
for (int i = 0; i <= 14; i++) {
//创建行
row = sheet.createRow(4 + i);// 行之后开始创建
row.setHeightInPoints(Short.parseShort("16"));//设置行高
//创建单元格并且添加数据
for (int j = 0; j < 5; j++) {
cell = row.createCell(j);
cell.setCellValue("");
cell.setCellStyle(style);
}
}
row = sheet.createRow(18);
row.setHeightInPoints(Short.parseShort("16"));//设置行高
//创建单元格并且添加数据
cell = row.createCell(0);
cell.setCellValue("合计");
cell.setCellStyle(style);
cell = row.createCell(1);
cell.setCellValue(Integer.valueOf(map.get("download") + ""));
cell.setCellStyle(style);
cell = row.createCell(2);
cell.setCellValue("制证车间");
cell.setCellStyle(style);
if ("p1".equals(workShop) || "p3".equals(workShop)) {
cell = row.createCell(2);
cell.setCellValue("平一");
cell.setCellStyle(style);
} else {
cell = row.createCell(2);
cell.setCellValue("平二");
cell.setCellStyle(style);
}
cell.setCellStyle(style);
cell = row.createCell(3);
cell.setCellValue(((Integer.parseInt(map.get("download") + "") % 250==0?Integer.parseInt(map.get("download") + "") / 250:Integer.parseInt(map.get("download") + "") / 250+1)) + "");
cell.setCellStyle(style);
cell = row.createCell(4);
cell.setCellValue(permanentPositionDate);
cell.setCellStyle(style);
//创建单元格并且添加数据
row = sheet.createRow(19);
row.setHeightInPoints(Short.parseShort("16"));//设置行高
cell = row.createCell(0);
cell.setCellValue("类型");
cell.setCellStyle(style);
cell = row.createCell(1);
cell.setCellValue(typeName);
cell.setCellStyle(style);
cell = row.createCell(2);
cell.setCellValue("");
cell.setCellStyle(style);
cell = row.createCell(3);
cell.setCellValue("");
cell.setCellStyle(style);
cell = row.createCell(4);
cell.setCellValue("");
cell.setCellStyle(style);
CellRangeAddress callRangea = new CellRangeAddress(19, 19, 1, 4);//起始行,结束行,起始列,结束列
sheet.addMergedRegion(callRangea);
//创建单元格并且添加数据
row = sheet.createRow(20);
row.setHeightInPoints(Short.parseShort("32"));//设置行高
cell = row.createCell(0);
cell.setCellValue("编号");
cell.setCellStyle(style);
cell = row.createCell(1);
cell.setCellValue(cyclesheetid);
cell.setCellStyle(style);
cell = row.createCell(0);
cell.setCellValue("循环单");
cell.setCellStyle(style);
cell = row.createCell(2);
cell.setCellValue("");
cell.setCellStyle(style);
cell = row.createCell(3);
cell.setCellValue("");
cell.setCellStyle(style);
cell = row.createCell(4);
cell.setCellValue("");
cell.setCellStyle(style);
CellRangeAddress callRangea1 = new CellRangeAddress(20, 20, 1, 4);//起始行,结束行,起始列,结束列
sheet.addMergedRegion(callRangea1);
row = sheet.createRow(21);
row.setHeightInPoints(Short.parseShort("16"));//设置行高
//创建单元格并且添加数据
cell = row.createCell(0);
cell.setCellValue("出库日期");
cell.setCellStyle(style);
cell = row.createCell(1);
cell.setCellValue("20 年 月 日");
cell.setCellStyle(style);
cell = row.createCell(2);
cell.setCellValue("");
cell.setCellStyle(style);
cell = row.createCell(3);
cell.setCellValue("");
cell.setCellStyle(style);
cell = row.createCell(4);
cell.setCellValue("");
cell.setCellStyle(style);
CellRangeAddress callRangeb = new CellRangeAddress(21, 21, 1, 4);//起始行,结束行,起始列,结束列
sheet.addMergedRegion(callRangeb);
}
}
//第六步将生成excel文件保存到指定路径下
FileOutputStream fout = null;
try {
fout = new FileOutputStream("E:\\Excel\\" + simpleDateFormat.format(new Date()) + countyInfoList.get(0).get("countyName") + ".xls");
// fout = new FileOutputStream("D:\\" + simpleDateFormat.format(new Date()) + list.get(0).getString("countyName") + ".xls");
wb.write(fout);
fout.close();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("Excel文件生成成功..." + new Date());
return "E:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("countyName") + ".xls";
// return "D:\\" + simpleDateFormat.format(new Date()) + list.get(0).getString("countyName") + ".xls";
}
}
...@@ -103,11 +103,10 @@ public class ShiroApi { ...@@ -103,11 +103,10 @@ public class ShiroApi {
* @return * @return
*/ */
@RequestMapping("/roleAdd") @RequestMapping("/roleAdd")
@RequiresPermissions("role.add")//权限管理; // @RequiresPermissions("role.add")//权限管理;
public String roleAdd(Map<String, Object> map) { public String roleAdd(Map<String, Object> map) {
Subject subject = SecurityUtils.getSubject(); List<SysPermission> permissionList = sysPermissionService.getAllActivePermission();
UserInfo ui = (UserInfo) subject.getPrincipal(); map.put("permissionList", permissionList);
map.put("userInfo", ui);
return "roleAdd"; return "roleAdd";
} }
...@@ -117,7 +116,7 @@ public class ShiroApi { ...@@ -117,7 +116,7 @@ public class ShiroApi {
* @return * @return
*/ */
@RequestMapping("/permissionAdd") @RequestMapping("/permissionAdd")
@RequiresPermissions("permission.add")//权限管理; // @RequiresPermissions("permission.add")//权限管理;
public String permissionAdd(Map<String, Object> map) { public String permissionAdd(Map<String, Object> map) {
List<SysPermission> permissionList = sysPermissionService.getAllActivePermission(); List<SysPermission> permissionList = sysPermissionService.getAllActivePermission();
map.put("permissionList", permissionList); map.put("permissionList", permissionList);
...@@ -130,7 +129,7 @@ public class ShiroApi { ...@@ -130,7 +129,7 @@ public class ShiroApi {
* @return * @return
*/ */
@RequestMapping("/userAdd") @RequestMapping("/userAdd")
@RequiresPermissions("userInfo.add")//权限管理; // @RequiresPermissions("userInfo.add")//权限管理;
public String userInfoAdd(Map<String, Object> map) { public String userInfoAdd(Map<String, Object> map) {
List<SysRole> list = sysRoleService.getAllActiveRoleInfo(); List<SysRole> list = sysRoleService.getAllActiveRoleInfo();
map.put("activeRoleList", list); map.put("activeRoleList", list);
......
package com.yxproject.start.api;
import com.yxproject.start.service.*;
import com.yxproject.start.entity.CardBodyInfoEntity;
import com.yxproject.start.entity.CountyListInfoEntity;
import com.yxproject.start.entity.GroupinfoEntity;
import com.yxproject.start.entity.ProductionTaskListEntity;
import com.yxproject.start.service.CardBodyInfoService;
import com.yxproject.start.service.CountyListInfoService;
import com.yxproject.start.utils.YXJSONResponse;
import net.sf.json.JSONObject;
import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by Administrator on 2018/11/7.
*/
@Path("admin")
public class TestApi {
@Autowired
private CardBodyInfoService cardBodyInfoService;
@Autowired
private CountyListInfoService countyListInfoService;
@Autowired
private GroupinfoService groupinfoService;
@Autowired
private ProductionTaskListService productionTaskListService;
/**
* 通过任务单查询区县列表;
*
* @return
*/
@GET
@Path("getCountyList")
@Produces(MediaType.APPLICATION_JSON)
@RequiresPermissions("userInfo.add")//权限管理;
public String getCountyListInfoByTaskListID(@QueryParam("taskListID") String tasklistid, @Context HttpServletResponse resp) {
List<CountyListInfoEntity> countyListInfoEntity = countyListInfoService.findCountyListByTaskListID(tasklistid);
YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8");
yxjsonResponse.outPutSuccess(countyListInfoEntity);
Map map = new HashMap();
// map.put("MakeType",productionTaskListEntity);
return yxjsonResponse.toJSONString();
}
/**
* 保存卡机表;
*
* @return
*/
@GET
@Path("addCardBody")
@Produces(MediaType.APPLICATION_JSON)
@RequiresPermissions("userInfo.add")//权限管理;
public String addCardBodyInfo(@QueryParam("CardBody") String cardBodyInfoId, @Context HttpServletResponse resp) {
String map = "{\"CardBodyId\":\"1}";
JSONObject jsonObject = JSONObject.fromObject(map);
Object cardBodyInfo = jsonObject.get("CardBody");
Object groupInfoList = jsonObject.get("groupInfoList");
List<GroupinfoEntity> groupinfoEntities = (List<GroupinfoEntity>) groupInfoList;
CardBodyInfoEntity cardBodyInfoEntity = (CardBodyInfoEntity) cardBodyInfo;
YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8");
int i = cardBodyInfoService.addCardBodyInfoEntity(cardBodyInfoEntity, groupinfoEntities);
yxjsonResponse.outPutSuccess(i + "添加成功");
return yxjsonResponse.toJSONString();
}
/**
* 更新循环单
* 添加异常状态;
* @return
*/
@GET
@Path("addExceptionState")
@Produces(MediaType.APPLICATION_JSON)
@RequiresPermissions("userInfo.add")//权限管理;
public String addExceptionState(@RequestParam("exception_information") String exception_information, @Context HttpServletResponse resp) {
String map = "{\"production_Task_List_Id\":\"20181016001\",\"make_Type\":8,\"old_Make_Type\":8,exception_State:0} ";
JSONObject jsonObject = JSONObject.fromObject(map);
ProductionTaskListEntity productionTaskListEntity = (ProductionTaskListEntity) jsonObject.toBean(jsonObject, ProductionTaskListEntity.class);
YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8");
int i = productionTaskListService.addExceptionState(productionTaskListEntity);
yxjsonResponse.outPutSuccess(i + "更新成功");
return yxjsonResponse.toJSONString();
}
/**
* 更新入库时间
*
* @return
*/
@GET
@Path("updatePutinstorageDate")
@Produces(MediaType.APPLICATION_JSON)
@RequiresPermissions("userInfo.add")//权限管理;
public String updatePutinstorageDate(@RequestParam("id") String id, @Context HttpServletResponse resp) {
String map = "{\"production_Task_List_Id\":\"20181016001\",\"make_Type\":8,\"old_Make_Type\":8,} ";
JSONObject jsonObject = JSONObject.fromObject(map);
ProductionTaskListEntity productionTaskListEntity = (ProductionTaskListEntity) jsonObject.toBean(jsonObject, ProductionTaskListEntity.class);
YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8");
int i = productionTaskListService.updateProductionTask(productionTaskListEntity);
yxjsonResponse.outPutSuccess(i + "更新成功");
return yxjsonResponse.toJSONString();
}
/**
* 更新出库时间
*
* @return
*/
@GET
@Path("updateOutboundDate")
@Produces(MediaType.APPLICATION_JSON)
@RequiresPermissions("userInfo.add")//权限管理;
public String updateOutboundDate(@RequestParam("id") String id, @Context HttpServletResponse resp) {
String map = "{\"production_Task_List_Id\":\"20181016001\",\"make_Type\":8,\"old_Make_Type\":8,} ";
JSONObject jsonObject = JSONObject.fromObject(map);
ProductionTaskListEntity productionTaskListEntity = (ProductionTaskListEntity) jsonObject.toBean(jsonObject, ProductionTaskListEntity.class);
YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8");
int i = productionTaskListService.updateProductionTask(productionTaskListEntity);
yxjsonResponse.outPutSuccess(i + "更新成功");
return yxjsonResponse.toJSONString();
}
/**
* 对出库数进行更改
* 更新出库数
* @return
*/
@GET
@Path("reviseOutBoundCount")
@Produces(MediaType.APPLICATION_JSON)
@RequiresPermissions("userInfo.add")//权限管理;
public String reviseOutBoundCount(@RequestParam("id") String id, @Context HttpServletResponse resp) {
String map = "{\"production_Task_List_Id\":\"20181016001\",\"make_Type\":8,\"old_Make_Type\":8,} ";
JSONObject jsonObject = JSONObject.fromObject(map);
ProductionTaskListEntity productionTaskListEntity = (ProductionTaskListEntity) jsonObject.toBean(jsonObject, ProductionTaskListEntity.class);
YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8");
int i = productionTaskListService.updateProductionTask(productionTaskListEntity);
yxjsonResponse.outPutSuccess(i + "更新成功");
return yxjsonResponse.toJSONString();
}
}
...@@ -1222,7 +1222,7 @@ public class UserInfoApi { ...@@ -1222,7 +1222,7 @@ public class UserInfoApi {
//第六步将生成excel文件保存到指定路径下 //第六步将生成excel文件保存到指定路径下
FileOutputStream fout = null; FileOutputStream fout = null;
try { try {
fout = new FileOutputStream("F:\\Excel\\" + simpleDateFormat.format(new Date()) + countyInfoList.get(0).get("COUNTYNAME") + ".xls"); fout = new FileOutputStream("E:\\Excel\\" + simpleDateFormat.format(new Date()) + countyInfoList.get(0).get("COUNTYNAME") + ".xls");
// fout = new FileOutputStream("D:\\" + simpleDateFormat.format(new Date()) + list.get(0).getString("COUNTYNAME") + ".xls"); // fout = new FileOutputStream("D:\\" + simpleDateFormat.format(new Date()) + list.get(0).getString("COUNTYNAME") + ".xls");
wb.write(fout); wb.write(fout);
fout.close(); fout.close();
...@@ -1231,7 +1231,7 @@ public class UserInfoApi { ...@@ -1231,7 +1231,7 @@ public class UserInfoApi {
} }
System.out.println("Excel文件生成成功..." + new Date()); System.out.println("Excel文件生成成功..." + new Date());
return "F:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("COUNTYNAME") + ".xls"; return "E:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("COUNTYNAME") + ".xls";
// return "D:\\" + simpleDateFormat.format(new Date()) + list.get(0).getString("COUNTYNAME") + ".xls"; // return "D:\\" + simpleDateFormat.format(new Date()) + list.get(0).getString("COUNTYNAME") + ".xls";
} }
......
package com.yxproject.start.config; package com.yxproject.start.config;
import com.yxproject.start.api.AdminApi; import com.yxproject.start.api.TestApi;
import com.yxproject.start.api.UserInfoApi; import com.yxproject.start.api.UserInfoApi;
import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.server.ResourceConfig;
public class JerseyConfig extends ResourceConfig { public class JerseyConfig extends ResourceConfig {
public JerseyConfig() { public JerseyConfig() {
register(UserInfoApi.class); register(UserInfoApi.class);
register(AdminApi.class); register(TestApi.class);
} }
} }
...@@ -8,14 +8,14 @@ import java.util.Objects; ...@@ -8,14 +8,14 @@ import java.util.Objects;
* Created by liuxinben on 2018/11/6.10:14 * Created by liuxinben on 2018/11/6.10:14
*/ */
@Entity @Entity
@Table(name = "COUNTY_LIST_INFO", schema = "DAHAI", catalog = "") @Table(name = "COUNTY_LIST_INFO", schema = "DAHAI")
public class CountyListInfoEntity { public class CountyListInfoEntity {
private String county_List_Id; private String county_List_Id;
private String save_Date; private String save_Date;
private String cyclesheetid; private String cyclesheetid;
private String county_Code; private String county_Code;
private Long finish_Count; private Long finish_Count;
private Long put_In_Storage_Count; private Long in_Storage_Count;
private Long out_Bound_Count; private Long out_Bound_Count;
@Id @Id
...@@ -65,13 +65,13 @@ public class CountyListInfoEntity { ...@@ -65,13 +65,13 @@ public class CountyListInfoEntity {
} }
@Basic @Basic
@Column(name = "PUT_IN_STORAGE_COUNT", nullable = true, precision = 0) @Column(name = "IN_STORAGE_COUNT", nullable = true, precision = 0)
public Long getPutInStorageCount() { public Long getInStorageCount() {
return put_In_Storage_Count; return in_Storage_Count;
} }
public void setPutInStorageCount(Long putInStorageCount) { public void setInStorageCount(Long InStorageCount) {
this.put_In_Storage_Count = putInStorageCount; this.in_Storage_Count = InStorageCount;
} }
@Basic @Basic
...@@ -95,12 +95,12 @@ public class CountyListInfoEntity { ...@@ -95,12 +95,12 @@ public class CountyListInfoEntity {
Objects.equals(cyclesheetid, that.cyclesheetid) && Objects.equals(cyclesheetid, that.cyclesheetid) &&
Objects.equals(county_Code, that.county_Code) && Objects.equals(county_Code, that.county_Code) &&
Objects.equals(finish_Count, that.finish_Count) && Objects.equals(finish_Count, that.finish_Count) &&
Objects.equals(put_In_Storage_Count, that.put_In_Storage_Count) && Objects.equals(in_Storage_Count, that.in_Storage_Count) &&
Objects.equals(out_Bound_Count, that.out_Bound_Count) ; Objects.equals(out_Bound_Count, that.out_Bound_Count) ;
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(county_List_Id, save_Date, cyclesheetid, county_Code, finish_Count, put_In_Storage_Count, out_Bound_Count); return Objects.hash(county_List_Id, save_Date, cyclesheetid, county_Code, finish_Count, in_Storage_Count, out_Bound_Count);
} }
} }
...@@ -12,6 +12,7 @@ public class GroupinfoEntity { ...@@ -12,6 +12,7 @@ public class GroupinfoEntity {
private Long valid_Count; private Long valid_Count;
private Long invalid_Count; private Long invalid_Count;
private Long special_Card_Count; private Long special_Card_Count;
public Long totalinvalidCount;
@Id @Id
@Column(name = "GROUPID", nullable = false, length = 20) @Column(name = "GROUPID", nullable = false, length = 20)
......
...@@ -3,8 +3,11 @@ package com.yxproject.start.entity; ...@@ -3,8 +3,11 @@ package com.yxproject.start.entity;
import javax.persistence.*; import javax.persistence.*;
import java.util.Objects; import java.util.Objects;
/**
* Created by Administrator on 2018/11/13.
*/
@Entity @Entity
@Table(name = "PRODUCTION_TASK_LIST", schema = "DAHAI", catalog = "") @Table(name = "PRODUCTION_TASK_LIST", schema = "DAHAI")
public class ProductionTaskListEntity { public class ProductionTaskListEntity {
private String production_Task_List_Id; private String production_Task_List_Id;
private long make_Type; private long make_Type;
...@@ -24,6 +27,7 @@ public class ProductionTaskListEntity { ...@@ -24,6 +27,7 @@ public class ProductionTaskListEntity {
private String outbound_Date; private String outbound_Date;
private String putinstorage_Date; private String putinstorage_Date;
private Long state; private Long state;
private Long exception_State;
@Id @Id
@Column(name = "PRODUCTION_TASK_LIST_ID", nullable = false, length = 20) @Column(name = "PRODUCTION_TASK_LIST_ID", nullable = false, length = 20)
...@@ -41,8 +45,8 @@ public class ProductionTaskListEntity { ...@@ -41,8 +45,8 @@ public class ProductionTaskListEntity {
return make_Type; return make_Type;
} }
public void setMake_Type(long make_Type) { public void setMake_Type(long setMake_Type){
this.make_Type = make_Type; setMake_Type= make_Type;
} }
@Basic @Basic
...@@ -184,7 +188,6 @@ public class ProductionTaskListEntity { ...@@ -184,7 +188,6 @@ public class ProductionTaskListEntity {
public void setOutbound_Date(String outbound_Date) { public void setOutbound_Date(String outbound_Date) {
this.outbound_Date = outbound_Date; this.outbound_Date = outbound_Date;
} }
@Basic @Basic
@Column(name = "PUTINSTORAGE_DATE", nullable = true, length = 8) @Column(name = "PUTINSTORAGE_DATE", nullable = true, length = 8)
public String getPutinstorage_Date() { public String getPutinstorage_Date() {
...@@ -203,6 +206,17 @@ public class ProductionTaskListEntity { ...@@ -203,6 +206,17 @@ public class ProductionTaskListEntity {
public void setState(Long state) { public void setState(Long state) {
this.state = state; this.state = state;
} }
@Basic
@Column(name = "EXCEPTION_STATE", nullable = true, precision = 0)
public Long getException_State() {
return exception_State;
}
public void setException_State(Long exception_State) {
this.exception_State = exception_State;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;
...@@ -224,15 +238,14 @@ public class ProductionTaskListEntity { ...@@ -224,15 +238,14 @@ public class ProductionTaskListEntity {
Objects.equals(qualityinspection_Date, that.qualityinspection_Date) && Objects.equals(qualityinspection_Date, that.qualityinspection_Date) &&
Objects.equals(exception_Information, that.exception_Information) && Objects.equals(exception_Information, that.exception_Information) &&
Objects.equals(outbound_Date, that.outbound_Date) && Objects.equals(outbound_Date, that.outbound_Date) &&
Objects.equals(exception_State, that.exception_State) &&
Objects.equals(state, that.state) && Objects.equals(state, that.state) &&
Objects.equals(putinstorage_Date, that.putinstorage_Date); Objects.equals(putinstorage_Date, that.putinstorage_Date);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(production_Task_List_Id, make_Type, old_Make_Type, citycode,workshop, submit_Date, handout_Date, is_Print, download_Date, print_Out, permanent_Position_Date, roll_Out_Workshop_Date, qualityinspection_Name, qualityinspection_Date, exception_Information, outbound_Date, putinstorage_Date,state); return Objects.hash(production_Task_List_Id, make_Type, old_Make_Type,exception_State, citycode,workshop, submit_Date, handout_Date, is_Print, download_Date, print_Out, permanent_Position_Date, roll_Out_Workshop_Date, qualityinspection_Name, qualityinspection_Date, exception_Information, outbound_Date, putinstorage_Date,state);
} }
} }
...@@ -13,5 +13,6 @@ import java.util.List; ...@@ -13,5 +13,6 @@ import java.util.List;
public interface CountyListInfoMapper { public interface CountyListInfoMapper {
public List<CountyListInfoEntity> findCountyListByTaskListID(String tasklistID); public List<CountyListInfoEntity> findCountyListByTaskListID(String tasklistID);
public int updateOutBoundCount(CountyListInfoEntity countyListInfoEntity);
} }
package com.yxproject.start.mapper; package com.yxproject.start.mapper;
import com.yxproject.start.entity.CountyListInfoEntity;
import com.yxproject.start.entity.GroupinfoEntity; import com.yxproject.start.entity.GroupinfoEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
...@@ -26,4 +27,8 @@ public interface GroupinfoMapper { ...@@ -26,4 +27,8 @@ public interface GroupinfoMapper {
public List<Map<String,Object>> findNormalCountyList(String cyclesheetid); public List<Map<String,Object>> findNormalCountyList(String cyclesheetid);
public List<CountyListInfoEntity> findCountyList(String cyclesheetid);
public int equalsvalidCount(GroupinfoEntity groupinfoEntity);
} }
...@@ -11,12 +11,12 @@ import java.util.List; ...@@ -11,12 +11,12 @@ import java.util.List;
*/ */
@Mapper @Mapper
public interface ProductionTaskListMapper { public interface ProductionTaskListMapper {
public List<ProductionTaskListEntity> findProductionTaskListEntity(String id); public List<ProductionTaskListEntity> findProductionTaskListEntity(String id);
public int insertProductionTaskListEntity(ProductionTaskListEntity productionTaskListEntity); public int insertProductionTaskListEntity(ProductionTaskListEntity productionTaskListEntity);
public int updateProductionTask(ProductionTaskListEntity productionTaskListEntity); public int updateProductionTask(ProductionTaskListEntity productionTaskListEntity);
public List<ProductionTaskListEntity> findProductionTaskListEntityByAcceptNo(String acceptNo); public List<ProductionTaskListEntity> findProductionTaskListEntityByAcceptNo(String acceptNo);
public List<ProductionTaskListEntity> findProductionTaskListEntityByState(int state); public List<ProductionTaskListEntity> findProductionTaskListEntityByState(int state);
public int addExceptionState(ProductionTaskListEntity productionTaskListEntity);
public int replaceExceptionInformation(ProductionTaskListEntity productionTaskListEntity);
} }
...@@ -10,5 +10,6 @@ import java.util.List; ...@@ -10,5 +10,6 @@ import java.util.List;
public interface CountyListInfoService { public interface CountyListInfoService {
public List<CountyListInfoEntity> findCountyListByTaskListID(String tasklistID); public List<CountyListInfoEntity> findCountyListByTaskListID(String tasklistID);
public int reviseOutBoundCount(CountyListInfoEntity map);
} }
...@@ -24,9 +24,17 @@ public interface ProductionTaskListService { ...@@ -24,9 +24,17 @@ public interface ProductionTaskListService {
public int savePoliceStationVailedInfoEntity(List<PoliceStationVailedInfoEntity> policeStationVailedInfoEntities); public int savePoliceStationVailedInfoEntity(List<PoliceStationVailedInfoEntity> policeStationVailedInfoEntities);
// public int replaceExceptionInformation(ProductionTaskListEntity state);
public List<PoliceStationVailedInfoEntity> find(String id); public List<PoliceStationVailedInfoEntity> find(String id);
public List<Map<String,Object>> findProductionTaskListEntityByState(int state); public List<Map<String,Object>> findProductionTaskListEntityByState(int state);
public int addExceptionState(ProductionTaskListEntity state);
public int updateOutboundDate(ProductionTaskListEntity map);
public int updatePutinstorageDate(ProductionTaskListEntity map);
} }
...@@ -19,10 +19,21 @@ public class CountyListInfoServiceImpl implements CountyListInfoService { ...@@ -19,10 +19,21 @@ public class CountyListInfoServiceImpl implements CountyListInfoService {
@Override @Override
public List<CountyListInfoEntity> findCountyListByTaskListID(String tasklistid) { public List<CountyListInfoEntity> findCountyListByTaskListID(String tasklistid) {
List<CountyListInfoEntity> byTaskListID = countyListInfoMapper.findCountyListByTaskListID(tasklistid); List<CountyListInfoEntity> byTaskListID = countyListInfoMapper.findCountyListByTaskListID(tasklistid);
return byTaskListID; return byTaskListID;
} }
@Override
public int reviseOutBoundCount(CountyListInfoEntity countyListInfoEntity) {
// int i = 0;
//
//
//
// CountyListInfoEntity.setOutBoundCount( );
// return CountyListInfoMapper.updateOutBoundCount(countyListInfoEntity);
//TODO
return 0;
}
} }
\ No newline at end of file
package com.yxproject.start.service.impl; package com.yxproject.start.service.impl;
import com.yxproject.start.entity.AcceptNoInfoEntity; import com.yxproject.start.entity.*;
import com.yxproject.start.entity.GroupinfoEntity;
import com.yxproject.start.entity.PoliceStationVailedInfoEntity;
import com.yxproject.start.entity.ProductionTaskListEntity;
import com.yxproject.start.entity.accu.AccCardTEntity; import com.yxproject.start.entity.accu.AccCardTEntity;
import com.yxproject.start.entity.prod.ProdCardTEntity; import com.yxproject.start.entity.prod.ProdCardTEntity;
import com.yxproject.start.mapper.*; import com.yxproject.start.mapper.*;
import com.yxproject.start.entity.CountyListInfoEntity;
import com.yxproject.start.service.ProductionTaskListService; import com.yxproject.start.service.ProductionTaskListService;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import java.util.Scanner;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -44,6 +43,7 @@ public class ProductionTaskListServiceImpl implements ProductionTaskListService ...@@ -44,6 +43,7 @@ public class ProductionTaskListServiceImpl implements ProductionTaskListService
public AcceptNoInfoMapper acceptNoInfoMapper; public AcceptNoInfoMapper acceptNoInfoMapper;
/** /**
* 查询任务单 * 查询任务单
* 通过任务单ID * 通过任务单ID
...@@ -426,6 +426,63 @@ public class ProductionTaskListServiceImpl implements ProductionTaskListService ...@@ -426,6 +426,63 @@ public class ProductionTaskListServiceImpl implements ProductionTaskListService
return null; return null;
} }
/**
* 更新任务单
* 更新异常状态
* @param
* @return
*/
@Override
public int addExceptionState(ProductionTaskListEntity productionTaskListEntity) {
int i =0;
if(productionTaskListEntity.getException_Information()!=null) {
productionTaskListEntity.setException_State((long)1);
i=productionTaskListMapper.updateProductionTask(productionTaskListEntity);
} else {
productionTaskListEntity.setException_State((long)0);
// i= productionTaskListMapper.updateProductionTask(productionTaskListEntity);
i=productionTaskListMapper.replaceExceptionInformation(productionTaskListEntity);
}
return i;
}
private CountyListInfoEntity countyListInfoEntity;
private GroupinfoEntity groupinfoEntity;
/**
* 更新出库时间
* @param
* @return
*/
@Override
public int updateOutboundDate(ProductionTaskListEntity productionTaskListEntity) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddhhmmss");
if(groupinfoEntity.totalinvalidCount.equals(countyListInfoEntity.getOutBoundCount())) {
productionTaskListEntity.setOutbound_Date(simpleDateFormat.format(new Date()));
return productionTaskListMapper.updateProductionTask(productionTaskListEntity);
}
else{
return 0;
}
}
/**
* 更新入库时间
* @param
* @return
*/
@Override
public int updatePutinstorageDate(ProductionTaskListEntity productionTaskListEntity) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddhhmmss");
if(groupinfoEntity.totalinvalidCount.equals(countyListInfoEntity.getInStorageCount())) {
productionTaskListEntity.setPutinstorage_Date(simpleDateFormat.format(new Date()));
return productionTaskListMapper.updateProductionTask(productionTaskListEntity);
}
else{
return 0;
}
}
/** /**
* 测试查询 * 测试查询
* *
......
...@@ -47,7 +47,6 @@ spring.jpa.show-sql=true ...@@ -47,7 +47,6 @@ spring.jpa.show-sql=true
# thymeleaf # thymeleaf
spring.thymeleaf.prefix=classpath:/templates/ spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=HTML
spring.thymeleaf.encoding=UTF-8 spring.thymeleaf.encoding=UTF-8
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<result column="cyclesheetid" property="cyclesheetid"/> <result column="cyclesheetid" property="cyclesheetid"/>
<result column="county_Code" property="county_Code"/> <result column="county_Code" property="county_Code"/>
<result column="finish_Count" property="finish_Count"/> <result column="finish_Count" property="finish_Count"/>
<result column="put_In_Storage_Count" property="put_In_Storage_Count"/> <result column="in_Storage_Count" property="in_Storage_Count"/>
<result column="out_Bound_Count" property="out_Bound_Count"/> <result column="out_Bound_Count" property="out_Bound_Count"/>
</resultMap> </resultMap>
...@@ -15,6 +15,12 @@ ...@@ -15,6 +15,12 @@
<!--Insert into DAHAI.SYS_PERMISSION (ID,AVAILABLE,NAME,PARENT_ID,PARENT_IDS,PERMISSION,RESOURCE_TYPE,URL) values (PERMISSION_seq.nextval,0,#{name},#{parentId},#{parentIds},#{permission},#{resourceType},#{url})--> <!--Insert into DAHAI.SYS_PERMISSION (ID,AVAILABLE,NAME,PARENT_ID,PARENT_IDS,PERMISSION,RESOURCE_TYPE,URL) values (PERMISSION_seq.nextval,0,#{name},#{parentId},#{parentIds},#{permission},#{resourceType},#{url})-->
<!--</insert>--> <!--</insert>-->
<select id="findCountyListByTaskListID" resultType="com.yxproject.start.entity.CountyListInfoEntity" parameterType="String"> <select id="findCountyListByTaskListID" resultType="com.yxproject.start.entity.CountyListInfoEntity" parameterType="String">
SELECT * FROM COUNTY_LIST_INFO where CYCLESHEETID=#{tasklistID} SELECT * FROM COUNTY_LIST_INFO where CYCLESHEETID=#{tasklistID}
</select> </select>
<update id="updateOutBoundCount" parameterType="com.yxproject.start.entity.CountyListInfoEntity" >
update COUNTY_LIST_INFO OUT_BOUND_COUNT =#{out_Bound_Count} where COUNTY_LIST_ID =#{county_List_Id}
</update>
</mapper> </mapper>
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<if test="groupno">,groupno =#{groupno}</if> <if test="groupno">,groupno =#{groupno}</if>
<if test="cyclesheetid">,cyclesheetid =#{cyclesheetid}</if> <if test="cyclesheetid">,cyclesheetid =#{cyclesheetid}</if>
<if test="grouptype">,grouptype =#{grouptype}</if> <if test="grouptype">,grouptype =#{grouptype}</if>
<if test="valid_Count">,valid_Count =#{valid_Count}</if> <if test="valid_Count">,vaild_Count =#{vaild_Count}</if>
<if test="invalid_Count">,invalid_Count =#{invalid_Count}</if> <if test="invalid_Count">,invalid_Count =#{invalid_Count}</if>
<if test="special_Card_Count">,special_Card_Count =#{special_Card_Count}</if> <if test="special_Card_Count">,special_Card_Count =#{special_Card_Count}</if>
where GROUPID=#{groupid} where GROUPID=#{groupid}
...@@ -46,4 +46,13 @@ ...@@ -46,4 +46,13 @@
SELECT * FROM TABLE(find_normal_county_list.GET_county_infos(#{cyclesheetid})) SELECT * FROM TABLE(find_normal_county_list.GET_county_infos(#{cyclesheetid}))
</select> </select>
<select id="findCountyList" resultType="com.yxproject.start.entity.CountyListInfoEntity" parameterType="String">
SELECT * FROM COUNTY_LIST_INFO where CYCLESHEETID =#{cyclesheetid}
</select>
<!--<select id="equalsvalidCount" resultType="com.yxproject.start.entity.CountyListInfoEntity" parameterType="String">-->
<!--select SUM(invalid_Count) AS totalinvalidCount where PRODUCTION_TASK_LIST_ID =#{production_Task_List_Id}-->
<!--</select>-->
</mapper> </mapper>
\ No newline at end of file
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
values (#{production_Task_List_Id},#{make_Type},#{old_Make_Type},#{citycode},#{workshop},#{submit_Date},#{handout_Date},#{is_Print},#{download_Date},#{print_Out},#{permanent_Position_Date},#{roll_Out_Workshop_Date},#{qualityinspection_Name},#{qualityinspection_Date},#{exception_Information},#{outbound_Date},#{putinstorage_Date},#{state}) values (#{production_Task_List_Id},#{make_Type},#{old_Make_Type},#{citycode},#{workshop},#{submit_Date},#{handout_Date},#{is_Print},#{download_Date},#{print_Out},#{permanent_Position_Date},#{roll_Out_Workshop_Date},#{qualityinspection_Name},#{qualityinspection_Date},#{exception_Information},#{outbound_Date},#{putinstorage_Date},#{state})
</insert> </insert>
<update id="updateProductionTask" parameterType="com.yxproject.start.entity.ProductionTaskListEntity"> <update id="updateProductionTask" parameterType="com.yxproject.start.entity.ProductionTaskListEntity" >
update PRODUCTION_TASK_LIST update PRODUCTION_TASK_LIST
<set> <set>
<if test="old_Make_Type ">OLD_MAKE_TYPE =#{old_Make_Type},</if> <if test="old_Make_Type ">OLD_MAKE_TYPE =#{old_Make_Type},</if>
...@@ -51,19 +51,25 @@ ...@@ -51,19 +51,25 @@
<if test="qualityinspection_Date">QUALITYINSPECTION_DATE =#{qualityinspection_Date},</if> <if test="qualityinspection_Date">QUALITYINSPECTION_DATE =#{qualityinspection_Date},</if>
<if test="exception_Information">EXCEPTION_INFORMATION =#{exception_Information},</if> <if test="exception_Information">EXCEPTION_INFORMATION =#{exception_Information},</if>
<if test="outbound_Date">OUTBOUND_DATE =#{outbound_Date},</if> <if test="outbound_Date">OUTBOUND_DATE =#{outbound_Date},</if>
<if test="state!=null">STATE =#{state},</if> <if test="state">STATE =#{state},</if>
<if test="putinstorage_Date!=null">PUTINSTORAGE_DATE =#{putinstorage_Date},</if> <if test="putinstorage_Date">PUTINSTORAGE_DATE =#{putinstorage_Date},</if>
<if test="exception_State != null ">EXCEPTION_STATE =#{exception_State}</if>
</set> </set>
<!--SET PRODUCTION_TASK_LIST_ID =#{production_Task_List_Id}-->
<!--<if test="old_Make_Type">,old_Make_Type =#{old_Make_Type}</if>-->
<!--<if test="make_Type">,make_Type =#{make_Type}</if>-->
<!--<if test="exception_State">,exception_State =#{exception_State}</if>-->
where PRODUCTION_TASK_LIST_ID =#{production_Task_List_Id} where PRODUCTION_TASK_LIST_ID =#{production_Task_List_Id}
</update> </update>
<select id="findProductionTaskListEntityByAcceptNo" resultType="com.yxproject.start.entity.ProductionTaskListEntity" parameterType="String"> <update id="replaceExceptionInformation" parameterType="com.yxproject.start.entity.ProductionTaskListEntity" >
select PRODUCTION_TASK_LIST_ID,MAKE_TYPE,OLD_MAKE_TYPE,CITYCODE,WORKSHOP,SUBMIT_DATE,HANDOUT_DATE,IS_PRINT,DOWNLOAD_DATE,PRINT_OUT,PERMANENT_POSITION_DATE,ROLL_OUT_WORKSHOP_DATE,QUALITYINSPECTION_NAME,QUALITYINSPECTION_DATE,EXCEPTION_INFORMATION,OUTBOUND_DATE,PUTINSTORAGE_DATE from PRODUCTION_TASK_LIST left join GROUPINFO on GROUPINFO.CYCLESHEETID = PRODUCTION_TASK_LIST.PRODUCTION_TASK_LIST_ID where GROUPINFO.GROUPNO =#{acceptNo} or GROUPINFO.GROUPNO =substr (#{acceptNo},0,8) update PRODUCTION_TASK_LIST SET exception_Information = NULL,EXCEPTION_STATE =#{exception_State} where PRODUCTION_TASK_LIST_ID =#{production_Task_List_Id}
</select> </update>
<select id="findProductionTaskListEntityByState" resultType="com.yxproject.start.entity.ProductionTaskListEntity" parameterType="Integer"> <select id="findProductionTaskListEntityByState" resultType="com.yxproject.start.entity.ProductionTaskListEntity" parameterType="Integer">
select * from PRODUCTION_TASK_LIST where STATE =#{state } select * from PRODUCTION_TASK_LIST where STATE =#{state}
</select> </select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment