Browse Source

更新

master
汪菘 2 years ago
parent
commit
6855a36b57
  1. 1
      nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding_trunk/HaiLiangFeedingTrunkDeviceDriver.java
  2. 17
      nladmin-system/src/main/java/org/nl/acs/order/rest/ProduceshiftorderController.java
  3. 10
      nladmin-system/src/main/java/org/nl/acs/order/rest/ProduceshiftorderdetailController.java
  4. 19
      nladmin-system/src/main/java/org/nl/acs/order/service/ProduceshiftorderService.java
  5. 8
      nladmin-system/src/main/java/org/nl/acs/order/service/ProduceshiftorderdetailService.java
  6. 7
      nladmin-system/src/main/java/org/nl/acs/order/service/dto/ProduceshiftorderdetailDto.java
  7. 123
      nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java
  8. 39
      nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderdetailServiceImpl.java
  9. 2
      nladmin-system/src/main/java/org/nl/acs/order/service/impl/Test.java
  10. BIN
      nladmin-system/src/main/java/org/nl/acs/order/service/wql/order.xls
  11. 16
      nladmin-system/src/main/java/org/nl/start/auto/run/LetteringSocketConnectionAutoRun.java
  12. 10
      qd/src/api/acs/order/order.js
  13. 4
      qd/src/views/acs/order/sorting/index.vue

1
nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding_trunk/HaiLiangFeedingTrunkDeviceDriver.java

@ -483,6 +483,7 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
last_lettering_frequency = lettering_frequency;
last_one_speed = one_speed;
last_coating_frequency = coating_frequency;
last_order_feeding_finish = order_feeding_finish;
}

17
nladmin-system/src/main/java/org/nl/acs/order/rest/ProduceshiftorderController.java

@ -49,6 +49,8 @@ public class ProduceshiftorderController {
return new ResponseEntity<>(produceshiftorderService.queryAll(whereJson, page), HttpStatus.OK);
}
@GetMapping(value = "/querySorting")
@Log("查询分拣工单")
@ApiOperation("查询分拣工单")
@ -173,6 +175,14 @@ public class ProduceshiftorderController {
return new ResponseEntity<>(HttpStatus.OK);
}
@Log("工单明细手动完成")
@ApiOperation("工单明细手动完成")
@PostMapping(value = "/manual_finish")
public ResponseEntity<Object> manual_finish(@Validated @RequestBody Map whereJson) {
produceshiftorderService.manual_finish(whereJson);
return new ResponseEntity<>(HttpStatus.OK);
}
@Log("工单强制完成")
@ApiOperation("工单强制完成")
@PostMapping(value = "/order_force_complete")
@ -236,6 +246,13 @@ public class ProduceshiftorderController {
return new ResponseEntity<>(HttpStatus.OK);
}
@Log("查询缓存所有工单")
@ApiOperation("查询缓存所有工单")
@PostMapping(value = "/findAllOrderFromCache")
public ResponseEntity<Object> findAllOrderFromCache() {
return new ResponseEntity<>(produceshiftorderService.findAllOrderFromCache(), HttpStatus.OK);
}
}

10
nladmin-system/src/main/java/org/nl/acs/order/rest/ProduceshiftorderdetailController.java

@ -24,7 +24,7 @@ import lombok.extern.slf4j.Slf4j;
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "order管理")
@Api(tags = "工单明细管理")
@RequestMapping("/api/produceshiftorderdetail")
@Slf4j
public class ProduceshiftorderdetailController {
@ -73,4 +73,12 @@ public class ProduceshiftorderdetailController {
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
produceshiftorderdetailService.download(produceshiftorderdetailService.queryAll(whereJson), response);
}
@Log("查询缓存所有工单明细")
@ApiOperation("查询缓存所有工单明细")
@PostMapping(value = "/findAllOrderDetailFromCache")
public ResponseEntity<Object> findAllOrderFromCache() {
return new ResponseEntity<>(produceshiftorderdetailService.findAllOrderDetailFromCache(), HttpStatus.OK);
}
}

19
nladmin-system/src/main/java/org/nl/acs/order/service/ProduceshiftorderService.java

@ -3,7 +3,9 @@ package org.nl.acs.order.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
import org.nl.acs.order.service.dto.ProduceshiftorderdetailDto;
import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
@ -174,12 +176,19 @@ public interface ProduceshiftorderService {
*/
void detail_pause(Map whereJson);
/**
* 工单强制完成
*
*/
void order_force_complete(Map whereJson);
/**
* 工单明细手动完成
*
*/
void manual_finish(Map whereJson);
/**
* 工单明细强制完成
@ -242,4 +251,14 @@ public interface ProduceshiftorderService {
* @param whereJson
*/
Boolean print(JSONObject whereJson);
/**
*
* @return
*/
List<ProduceshiftorderDto> findAllOrderFromCache();
}

8
nladmin-system/src/main/java/org/nl/acs/order/service/ProduceshiftorderdetailService.java

@ -88,4 +88,12 @@ public interface ProduceshiftorderdetailService {
void reload();
/**
*
* @return
*/
List<ProduceshiftorderdetailDto> findAllOrderDetailFromCache();
void upodateDetailStatus(String order_code,String status);
}

7
nladmin-system/src/main/java/org/nl/acs/order/service/dto/ProduceshiftorderdetailDto.java

@ -88,6 +88,13 @@ public class ProduceshiftorderdetailDto implements Serializable {
private String length;
/** 工单明细状态 */
/**
*
00-就绪01-分拣中
02-下发工单明细暂停 03-工单明细暂停
04-下发强制完成 05-强制完成
06-自动完成 07-取消
*/
private String order_detail_status;
/** 上料数量 */

123
nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java

@ -11,7 +11,10 @@ import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.spire.xls.CellRange;
import com.spire.xls.PageSetup;
import com.spire.xls.Workbook;
import com.spire.xls.Worksheet;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device_driver.hailiang.hailiang_feeding_trunk.HaiLiangFeedingTrunkDeviceDriver;
@ -37,10 +40,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.awt.print.PageFormat;
import java.awt.print.Paper;
import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;
import java.awt.print.*;
import java.io.IOException;
import java.util.*;
@ -71,7 +71,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
}
public synchronized void reload() {
this.order = this.queryAllOrder("(order_status !='07' and order_status !='08' and order_status !='09') and is_deleted =0");
order = this.queryAllOrder("(order_status !='07' and order_status !='08' and order_status !='09') and is_deleted =0");
produceshiftorderdetailService.reload();
}
@ -335,6 +335,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
if (!StrUtil.equals(dto.getOrder_id(), "07") && !StrUtil.equals(dto.getOrder_id(), "08") && !StrUtil.equals(dto.getOrder_id(), "09")) {
order.add(dto);
}
produceshiftorderdetailService.reload();
}
@Override
@ -485,9 +486,23 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder");
JSONObject json= (JSONObject) JSONObject.toJSON(entity);
wo.update(json);
HashMap<String, String> map = new HashMap<>();
map.put("order_detail_status","07");
WQLObject.getWQLObject("acs_produceshiftorderdetail").update(map,"order_id = '"+ id + "'");
// HashMap<String, String> map = new HashMap<>();
// map.put("order_detail_status","07");
// WQLObject.getWQLObject("acs_produceshiftorderdetail").update(map,"order_id = '"+ id + "'");
produceshiftorderdetailService.upodateDetailStatus(entity.getOrder_code(),"05");
Iterator<ProduceshiftorderDto> iterator = order.iterator();
while (iterator.hasNext()) {
ProduceshiftorderDto produceshiftorderDto = iterator.next();
if (produceshiftorderDto.getOrder_id().equals(entity.getOrder_id())) {
iterator.remove();
}
}
if (!StrUtil.equals(entity.getOrder_id(), "07") && !StrUtil.equals(entity.getOrder_id(), "08") && !StrUtil.equals(entity.getOrder_id(), "09")) {
order.add(entity);
}
produceshiftorderdetailService.reload();
}
@ -551,12 +566,6 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
List<HaiLiangFeedingTrunkDeviceDriver> deviceAll = deviceAppService.findDeviceDriver(HaiLiangFeedingTrunkDeviceDriver.class);
if (deviceAll.get(0) instanceof HaiLiangFeedingTrunkDeviceDriver) {
haiLiangFeedingTrunkDeviceDriver = (HaiLiangFeedingTrunkDeviceDriver) deviceAll.get(0);
if(haiLiangFeedingTrunkDeviceDriver.getMode() !=2){
throw new BadRequestException("设备未联机,无法下发恢复!");
}
if(haiLiangFeedingTrunkDeviceDriver.getPause() == 0 ){
throw new BadRequestException("设备已处于恢复状态,无法下发恢复!");
}
haiLiangFeedingTrunkDeviceDriver.writing("to_pause","0");
}
}
@ -568,10 +577,6 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
List<HaiLiangFeedingTrunkDeviceDriver> deviceAll = deviceAppService.findDeviceDriver(HaiLiangFeedingTrunkDeviceDriver.class);
if (deviceAll.get(0) instanceof HaiLiangFeedingTrunkDeviceDriver) {
haiLiangFeedingTrunkDeviceDriver = (HaiLiangFeedingTrunkDeviceDriver) deviceAll.get(0);
if(haiLiangFeedingTrunkDeviceDriver.getMode() !=2){
throw new BadRequestException("设备未联机,无法下发恢复!");
}
haiLiangFeedingTrunkDeviceDriver.writing("to_pause","1");
}
}
@ -601,6 +606,9 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
throw new BadRequestException("未找到对应工单明细!");
}
if(ObjectUtil.isEmpty(dto)){
throw new BadRequestException("未找到对应工单!");
}
// 2.根据明细template_id 找到对应的模板
JSONObject jsonStor = WQL.getWO("QPRODUCESHIFTORDER").addParam("flag", "3").addParam("storage_id", detaildto.getTemplate_id()).process().uniqueResult(0);
@ -636,8 +644,9 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
jo.put("inspector",detaildto.getInspector());
jo.put("mg_weight",detaildto.getMg_weight());
//打印纸张大小
jo.put("page_length","50");
jo.put("page_height","40");
//1cm = 118px
jo.put("page_length",590);
jo.put("page_height",472);
print(jo);
}
@ -753,6 +762,22 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
}
@Override
public void manual_finish(Map whereJson) {
String order = whereJson.get("parent_order_code").toString();
String detail = whereJson.get("order_code").toString();
ProduceshiftorderdetailDto detaildto = produceshiftorderdetailService.findOrderDetailFromCache(order,detail);
if(ObjectUtil.isEmpty(detaildto)){
throw new BadRequestException("未找到对应工单明细!");
}
detaildto.setOrder_detail_status("05");
HaiLiangFeedingTrunkDeviceDriver haiLiangFeedingTrunkDeviceDriver;
List<HaiLiangFeedingTrunkDeviceDriver> deviceAll = deviceAppService.findDeviceDriver(HaiLiangFeedingTrunkDeviceDriver.class);
produceshiftorderdetailService.update(detaildto);
}
@Override
public void download(List<ProduceshiftorderDto> dtos, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
@ -863,7 +888,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
@Override
public List<ProduceshiftorderDto> findOrderByOrderStatusFromCache(String order_status) {
List<ProduceshiftorderDto> list = new ArrayList<ProduceshiftorderDto>();
Iterator var3 = order.iterator();
Iterator var3 = this.order.iterator();
while (var3.hasNext()) {
ProduceshiftorderDto oneorder = (ProduceshiftorderDto) var3.next();
if (StrUtil.equals(oneorder.getOrder_status(), order_status)) {
@ -1009,23 +1034,44 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
workBook.fill(map, sheet);
workBook.finish();
// 5.打印
Workbook workbook = new Workbook();
workbook.loadFromFile(pathName);
//创建 PrinterJob对象
PrinterJob printerJob = PrinterJob.getPrinterJob();
//指定打印页面为默认大小和方向
PageFormat pageFormat = printerJob.defaultPage();
//设置相关打印选项
Paper paper = pageFormat.getPaper();
paper.setSize(whereJson.getInteger("page_length"),whereJson.getInteger("page_height"));
paper.setImageableArea(0, 0, whereJson.getInteger("page_length"),whereJson.getInteger("page_height"));
pageFormat.setPaper(paper);
printerJob.setCopies(1);
printerJob.setPrintable(workbook, pageFormat);
Book book=new Book();
Workbook loDoc = new Workbook();
loDoc.loadFromFile(pathName);
Worksheet worksheet = loDoc.getWorksheets().get(0);
PageSetup pageSetup = worksheet.getPageSetup();
String printArea="A2:B8";
pageSetup.setPrintArea(printArea);
pageSetup.setLeftMargin(0);
pageSetup.setRightMargin(0);
pageSetup.setTopMargin(0);
pageSetup.setBottomMargin(0);
CellRange cellRanges = worksheet.getCellRange(printArea);
int height=0;
for (CellRange row : cellRanges.getRows()) {
height+= worksheet.getRowHeightPixels(row.getRow());
}
int width=0;
for (CellRange column : cellRanges.getColumns()) {
width+=worksheet.getColumnWidthPixels(column.getColumn());
}
PrinterJob loPrinterJob = PrinterJob.getPrinterJob();
PageFormat loPageFormat = loPrinterJob.defaultPage();
Paper loPaper = loPageFormat.getPaper();
loPaper.setImageableArea(0, 0, loPageFormat.getWidth(), loPageFormat.getHeight());
loPaper.setSize(142,113);
// loPaper.setSize(width/96.0*72,height/96.0*72);
loPageFormat.setPaper(loPaper);
loPrinterJob.setCopies(1);
loPrinterJob.setPrintable(loDoc, loPageFormat);
book.append(loDoc,loPageFormat);
loPrinterJob.setPageable(book);
try {
// 执行打印
printerJob.print();
loPrinterJob.print();
} catch (PrinterException e) {
e.printStackTrace();
return false;
@ -1033,4 +1079,9 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
return true;
}
@Override
public List<ProduceshiftorderDto> findAllOrderFromCache() {
return order;
}
}

39
nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderdetailServiceImpl.java

@ -121,8 +121,8 @@ public class ProduceshiftorderdetailServiceImpl implements Produceshiftorderdeta
iterator.remove();
}
}
if (!StrUtil.equals(dto.getOrder_detail_status(), "07") || !StrUtil.equals(dto.getOrder_detail_status(), "08")
||!StrUtil.equals(dto.getOrder_detail_status(), "09")) {
if (!StrUtil.equals(dto.getOrder_detail_status(), "05") || !StrUtil.equals(dto.getOrder_detail_status(), "06")
||!StrUtil.equals(dto.getOrder_detail_status(), "07")) {
detail.add(dto);
}
@ -206,7 +206,25 @@ public class ProduceshiftorderdetailServiceImpl implements Produceshiftorderdeta
}
public synchronized void reload() {
this.detail = this.queryAllOrderDteail(" (order_detail_status != '05' and order_detail_status != '06' and order_detail_status != '07') and is_deleted =0 order by order_detail_code");
this.detail = this.queryAllOrderDteail(" (order_detail_status != '05' and and order_detail_status != '06' and order_detail_status != '07') and is_deleted =0 order by order_detail_code");
}
@Override
public void upodateDetailStatus(String order_code,String status){
WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorderdetail");
JSONArray arr = wo.query("order_code = "+ order_code).getResultJSONArray(0);
List<ProduceshiftorderdetailDto> list = arr.toJavaList(ProduceshiftorderdetailDto.class);
for(int i=0;i<list.size();i++){
ProduceshiftorderdetailDto dto = list.get(i);
String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now();
dto.setUpdate_time(now);
dto.setUpdate_by(currentUsername);
dto.setOrder_detail_status(status);
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
wo.update(json);
}
reload();
}
@Override
@ -250,21 +268,22 @@ public class ProduceshiftorderdetailServiceImpl implements Produceshiftorderdeta
String msg2 = dto.getLettering_message2();
String icon = dto.getLettering_icon();
if(StrUtil.equals(icon,"1")){
icon = "<";
icon = "<<";
} else if (StrUtil.equals(icon,"2")) {
icon = ">";
} else {
icon = "";
}
message = msg1 + icon + msg2;
message = msg1 + " " + icon + " " + msg2;
//清缓存
try {
// LetteringSocketConnectionAutoRun.write("BUFFERCLEAR" + "\r\n");
String yh = "\"";
String strInst = "SETTEXT " + " S1 " + " " + yh + message + yh +"\r\n"; //2个变量
LetteringSocketConnectionAutoRun.write(strInst + "\r\n");
LetteringSocketConnectionAutoRun.write(strInst);
} catch (Exception e) {
e.printStackTrace();
return false;
}
return true;
@ -320,4 +339,10 @@ public class ProduceshiftorderdetailServiceImpl implements Produceshiftorderdeta
return true;
}
}
@Override
public List<ProduceshiftorderdetailDto> findAllOrderDetailFromCache() {
return detail;
}
}

2
nladmin-system/src/main/java/org/nl/acs/order/service/impl/Test.java

@ -5,7 +5,7 @@ public class Test {
public static void main(String[] args) {
Process printProcess;
String printName ="Zebra ZE500-4 RH (300 dpi)";
String printName ="PDF24";
try
{
printProcess = Runtime

BIN
nladmin-system/src/main/java/org/nl/acs/order/service/wql/order.xls

Binary file not shown.

16
nladmin-system/src/main/java/org/nl/start/auto/run/LetteringSocketConnectionAutoRun.java

@ -18,6 +18,7 @@ import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.net.Socket;
import java.util.Date;
import java.util.List;
@ -36,6 +37,7 @@ public class LetteringSocketConnectionAutoRun extends AbstractAutoRunnable {
boolean bConnected = true;
@Autowired
DeviceAppService deviceAppService;
public LetteringSocketConnectionAutoRun() {
this.recordTime = new Date((new Date()).getTime() - (long) this.recordTimeOut);
}
@ -91,7 +93,8 @@ public class LetteringSocketConnectionAutoRun extends AbstractAutoRunnable {
public static void write(String str) throws IOException {
System.out.println(str);
dos.write(hexStringToByte(bytesToHexString(stringToByte(str))));
// dos.write(hexStringToByte(bytesToHexString(stringToByte(str))));
dos.write(str.getBytes("UTF-8"));
}
public static byte[] stringToByte(String str) {
@ -101,12 +104,14 @@ public class LetteringSocketConnectionAutoRun extends AbstractAutoRunnable {
public static String bytesToHexString(byte[] src) {
StringBuilder builder = new StringBuilder();
Byte[] bytes = new Byte[src.length];
for (int i = 0; i < src.length; i++) {
int v = src[i] & 0xff;
String hv = Integer.toHexString(v);
if (hv.length() < 2) {
builder.append(0);
}
bytes[i] = Byte.parseByte(hv);
builder.append(hv);
}
return builder.toString().toUpperCase();
@ -150,10 +155,9 @@ public class LetteringSocketConnectionAutoRun extends AbstractAutoRunnable {
public static void main(String[] args) throws UnsupportedEncodingException {
JSONObject jo = new JSONObject();
jo.put("x",10.0);
jo.put("y",3.0);
jo.put("angle",0);
System.out.println(bytesToHexString(stringToByte(jo.toString())));
String write = "SETTEXT S1 '111 > 222'" + "\r\n";
// System.out.println(hexStringToByte(bytesToHexString(stringToByte(jo))));
// System.out.println(bytesToHexString(stringToByte(jo.toString())));
}
}

10
qd/src/api/acs/order/order.js

@ -143,5 +143,13 @@ export function reload() {
})
}
export function manual_finish(data) {
return request({
url: 'api/produceshiftorder/manual_finish',
method: 'post',
data
})
}
export default { add, edit, del, importExcel, getDtl, send, device_pause, device_restore, clear, stop, order_pause, order_force_complete, detail_pause, detail_force_complete,
selectTemplateList, selectColortypeList, reload, send_letteringMess, send_labelingMess }
selectTemplateList, selectColortypeList, reload, send_letteringMess, send_labelingMess, manual_finish }

4
qd/src/views/acs/order/sorting/index.vue

@ -174,7 +174,7 @@
<template slot-scope="scope">
<!-- <el-button v-if="scope.row.is_flag ==='1'" type="text" size="small" @click="handleClick(scope.row,'1')">暂停工单</el-button>-->
<el-button v-if="scope.row.is_flag ==='1'" type="text" size="small" @click="handleClick(scope.row,'2')">强制完成工单</el-button>
<!-- <el-button v-if="scope.row.is_flag ==='0'" type="text" size="small" @click="handleClick(scope.row,'3')">暂停明细</el-button>-->
<el-button v-if="scope.row.is_flag ==='0'" type="text" size="small" @click="handleClick(scope.row,'3')">手动完成</el-button>
<el-button v-if="scope.row.is_flag ==='0'" type="text" size="small" @click="handleClick(scope.row,'4')">强制完成明细</el-button>
</template>
</el-table-column>
@ -309,7 +309,7 @@ export default {
}
} else {
if (flag === '3') {
crudProduceshiftorder.detail_pause(row).then(res => {
crudProduceshiftorder.manual_finish(row).then(res => {
this.crud.toQuery()
this.crud.notify(status + '成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
}).catch(err => {

Loading…
Cancel
Save