|
@@ -11,12 +11,12 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
|
import com.ruoyi.common.utils.ServletUtils;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
-import com.ruoyi.common.utils.http.HttpUtils;
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
|
|
import com.ruoyi.framework.web.service.TokenService;
|
|
|
import com.ruoyi.system.domain.SysCheckCode;
|
|
|
import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
|
|
|
+import com.ruoyi.warehouseBusiness.domain.TWarehousebillsitemsElabel;
|
|
|
import com.ruoyi.warehouseBusiness.domain.dto.WarehousebillsDTO;
|
|
|
import com.ruoyi.warehouseBusiness.domain.enums.WarehouseTypeEnum;
|
|
|
import com.ruoyi.warehouseBusiness.excel.CorpAnalysis;
|
|
@@ -30,7 +30,6 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.io.*;
|
|
|
import java.net.HttpURLConnection;
|
|
|
-import java.net.MalformedURLException;
|
|
|
import java.net.URL;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.util.List;
|
|
@@ -48,6 +47,9 @@ public class TWarehouseInStockController extends BaseController {
|
|
|
@Autowired
|
|
|
private ITWarehouseBillsService itWarehouseBillsService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ITWarehousebillsitemsElabelService labelService;
|
|
|
+
|
|
|
/**
|
|
|
* 查询单据是否允许修改
|
|
|
*/
|
|
@@ -78,20 +80,20 @@ public class TWarehouseInStockController extends BaseController {
|
|
|
tWarehouseBills.setfBilltype("SJRK");
|
|
|
// 获取登录用户数据
|
|
|
LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
|
|
|
- List<Map<String, Object>> list = itWarehouseBillsService.selectWarehouseBusinessListAddUser(tWarehouseBills,loginUser);
|
|
|
+ List<Map<String, Object>> list = itWarehouseBillsService.selectWarehouseBusinessListAddUser(tWarehouseBills, loginUser);
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/longRageDownloadTemplate")
|
|
|
- public AjaxResult longRageDownloadTemplate(){
|
|
|
+ public AjaxResult longRageDownloadTemplate() {
|
|
|
String filePath = "";
|
|
|
try {
|
|
|
// 文件名
|
|
|
String fileName = "入库模板.xlsx";
|
|
|
// 请求地址以及文件名转换
|
|
|
- String url = "http://121.36.212.131:8080/file/" + URLEncoder.encode(fileName,"UTF-8");
|
|
|
+ String url = "http://121.36.212.131:8080/file/" + URLEncoder.encode(fileName, "UTF-8");
|
|
|
// 下载文件并返回文件名
|
|
|
- filePath = downLoadFromUrl(url,fileName,RuoYiConfig.getDownloadPath());
|
|
|
+ filePath = downLoadFromUrl(url, fileName, RuoYiConfig.getDownloadPath());
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -100,12 +102,13 @@ public class TWarehouseInStockController extends BaseController {
|
|
|
|
|
|
/**
|
|
|
* 远程文件下载
|
|
|
- * @param urlStr 远程文件链接地址
|
|
|
+ *
|
|
|
+ * @param urlStr 远程文件链接地址
|
|
|
* @param fileName 下载文件名称
|
|
|
* @param savePath 保存路径
|
|
|
* @return 返回下载的文件名
|
|
|
*/
|
|
|
- public static String downLoadFromUrl(String urlStr,String fileName,String savePath) {
|
|
|
+ public static String downLoadFromUrl(String urlStr, String fileName, String savePath) {
|
|
|
try {
|
|
|
URL url = new URL(urlStr);
|
|
|
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
|
@@ -144,11 +147,11 @@ public class TWarehouseInStockController extends BaseController {
|
|
|
/**
|
|
|
* 从输入流中获取字节数组
|
|
|
*/
|
|
|
- public static byte[] readInputStream(InputStream inputStream) throws IOException {
|
|
|
+ public static byte[] readInputStream(InputStream inputStream) throws IOException {
|
|
|
byte[] buffer = new byte[1024];
|
|
|
int len = 0;
|
|
|
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
|
|
- while((len = inputStream.read(buffer)) != -1) {
|
|
|
+ while ((len = inputStream.read(buffer)) != -1) {
|
|
|
bos.write(buffer, 0, len);
|
|
|
}
|
|
|
bos.close();
|
|
@@ -515,4 +518,46 @@ public class TWarehouseInStockController extends BaseController {
|
|
|
return util.exportExcel(list, "客户分析");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 入库自动生成条形码
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/generate")
|
|
|
+ @RepeatSubmit
|
|
|
+ public AjaxResult generate(@RequestParam("id") Long id,
|
|
|
+ @RequestParam("itemId") Long itemId,
|
|
|
+ @RequestParam("number") int number,
|
|
|
+ @RequestParam("type") int type,
|
|
|
+ @RequestParam("corpId") Long corpId) {
|
|
|
+
|
|
|
+ if (StringUtils.isNull(id) || StringUtils.isNull(itemId) || StringUtils.isNull(corpId)) {
|
|
|
+ return AjaxResult.error("缺少必要参数");
|
|
|
+ }
|
|
|
+ AjaxResult a = labelService.generate(id, itemId, number, type, corpId);
|
|
|
+ return a;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 出库自动生成条形码
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/generateELabel")
|
|
|
+ @RepeatSubmit
|
|
|
+ public AjaxResult generateELabel(@RequestParam("originalBillNo") String originalBillNo) {
|
|
|
+
|
|
|
+ if (StringUtils.isNull(originalBillNo)) {
|
|
|
+ return AjaxResult.error("缺少必要参数");
|
|
|
+ }
|
|
|
+ TWarehouseBills tWarehouseBills = itWarehouseBillsService.selectBYOriginalBillNo(originalBillNo);
|
|
|
+ if (StringUtils.isNotNull(tWarehouseBills)) {
|
|
|
+ TWarehousebillsitemsElabel tWarehousebillsitemsElabel = new TWarehousebillsitemsElabel();
|
|
|
+ tWarehousebillsitemsElabel.setfGPid(tWarehouseBills.getfId());
|
|
|
+ tWarehousebillsitemsElabel.setfType(1);
|
|
|
+ tWarehousebillsitemsElabel.setfStatus(0);
|
|
|
+ List<TWarehousebillsitemsElabel> tWarehousebillsitemsElabelList = labelService.selectItemsElabelList(tWarehousebillsitemsElabel);
|
|
|
+ return AjaxResult.success(tWarehousebillsitemsElabelList);
|
|
|
+ } else {
|
|
|
+ return AjaxResult.error("操作失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|