diff --git a/Corperate_Project/.classpath b/Corperate_Project/.classpath index 26f980f..bef3552 100644 --- a/Corperate_Project/.classpath +++ b/Corperate_Project/.classpath @@ -30,7 +30,7 @@ - + diff --git a/Corperate_Project/src/main/java/com/basicinfo/controller/LotRestController.java b/Corperate_Project/src/main/java/com/basicinfo/controller/LotRestController.java index 9030242..4b9f288 100644 --- a/Corperate_Project/src/main/java/com/basicinfo/controller/LotRestController.java +++ b/Corperate_Project/src/main/java/com/basicinfo/controller/LotRestController.java @@ -26,7 +26,7 @@ public class LotRestController { // 판매에서 로트 불러오기 @GetMapping(value="/getLot/{itemNo}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) - public ResponseEntity> getLot(@PathVariable("itemNo") int no) { + public ResponseEntity> getLot(@PathVariable("itemNo") String no) { System.out.println("?:" + no); return new ResponseEntity<>(service.getLot(no), HttpStatus.OK); diff --git a/Corperate_Project/src/main/java/com/ordersheet/controller/OrderSheetRestController.java b/Corperate_Project/src/main/java/com/ordersheet/controller/OrderSheetRestController.java index eb5bd1b..1c0c0e1 100644 --- a/Corperate_Project/src/main/java/com/ordersheet/controller/OrderSheetRestController.java +++ b/Corperate_Project/src/main/java/com/ordersheet/controller/OrderSheetRestController.java @@ -1,5 +1,6 @@ package com.ordersheet.controller; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -14,12 +15,14 @@ import org.springframework.web.bind.annotation.RestController; import com.spring.domain.ClientVO; +import com.spring.domain.ItemDTO; import com.spring.domain.MemberVO; import com.spring.domain.OrderSheetDetailVO; import com.spring.domain.OrderSheetVO; import com.spring.domain.PageDTO; import com.spring.paging.Criteria; import com.spring.service.ClientService; +import com.spring.service.LotRestService; import com.spring.service.MemberService; import com.spring.service.OrderSheetService; @@ -37,6 +40,9 @@ public class OrderSheetRestController { @Autowired private MemberService ms; + @Autowired + private LotRestService ls; + //testURL : http://localhost:8080/ordersheet/orderdetail/11 @GetMapping(value={"/orderdetail/{mainNo}"}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @@ -77,6 +83,8 @@ public ResponseEntity> selectOrder(@PathVariable("no") int n //수주 디테일 조회 List list = service.getSubList(no); + List lot_lists; + List itemDTOlist = new ArrayList(); for(OrderSheetDetailVO osdv : list) { osdv.setNo(osdv.getNo()); @@ -89,6 +97,11 @@ public ResponseEntity> selectOrder(@PathVariable("no") int n ClientVO osdvCv = cs.selectOne(Integer.toString(osdv.getClient_no())); osdv.setClient_name(osdvCv.getName()); + + lot_lists = ls.getLot(osdv.getItem_no()); + + itemDTOlist.add(new ItemDTO(osdv,lot_lists)); + } for(OrderSheetDetailVO osdv : list) { @@ -124,6 +137,7 @@ public ResponseEntity> selectOrder(@PathVariable("no") int n map.put("detailList", list); map.put("order", vo); + map.put("itemDTOlist", itemDTOlist); return new ResponseEntity<>(map, HttpStatus.OK); diff --git a/Corperate_Project/src/main/java/com/sell/controller/SellController.java b/Corperate_Project/src/main/java/com/sell/controller/SellController.java index 03da4ea..79a605b 100644 --- a/Corperate_Project/src/main/java/com/sell/controller/SellController.java +++ b/Corperate_Project/src/main/java/com/sell/controller/SellController.java @@ -21,6 +21,7 @@ import com.spring.domain.SellVO; import com.spring.paging.Client_Paging; import com.spring.service.ItemService; +import com.spring.service.OrderSheetService; import com.spring.service.SellDetailService; import com.spring.service.SellService; @@ -40,6 +41,9 @@ public class SellController { @Autowired(required = false) private ItemService iservice; + //@Autowired(required = false) + //private OrderSheetService osservice; + @GetMapping(value="/list") public void list(Model model) { @@ -65,7 +69,7 @@ public String insertSold(Model model, SellVO sell, SellDetailVO selldetail) { // System.out.println(memlists.get(i)); // } - System.out.println(sell.getOrder_no()); + System.out.println(sell.getDay()); service.insert(sell); System.out.println("selldetail 판매상세번호:"+selldetail.getNo()); @@ -75,7 +79,10 @@ public String insertSold(Model model, SellVO sell, SellDetailVO selldetail) { System.out.println("selldetail 로트코드:"+selldetail.getLot_code()); System.out.println("selldetail 판매번호:"+selldetail.getSell_no()); sdservice.insert(selldetail); + + // 판매 등록 시, 수주서 상태 변경 + // osservice.updateStatusToSold(sell.getOrder_no()); return "redirect:/sell/origin/list"; } @@ -93,7 +100,7 @@ public String deleteSold(Model model, @RequestParam(value="no") int no) { @PostMapping(value="/update") public String updateSold(Model model, SellVO sell) { - System.out.println(sell.getNo()+"/"+sell.getOrder_no()+"/"+sell.getMember_no()+"/"+sell.getDay()); + System.out.println(sell.getNo()+"/"+sell.getMember_no()+"/"+sell.getDay()); service.update(sell); diff --git a/Corperate_Project/src/main/java/com/sell/controller/SellRestController.java b/Corperate_Project/src/main/java/com/sell/controller/SellRestController.java index d482fd8..6edc181 100644 --- a/Corperate_Project/src/main/java/com/sell/controller/SellRestController.java +++ b/Corperate_Project/src/main/java/com/sell/controller/SellRestController.java @@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.RestController; import com.spring.domain.SellDetailVO; +import com.spring.domain.SellVO; import com.spring.service.SellService; @RestController @@ -23,7 +24,8 @@ public class SellRestController { //testURL : http://localhost:8080/ordersheet/orderdetail/11 @GetMapping(value={"/more/{mainNo}"}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) - public ResponseEntity> clientlist(@PathVariable("mainNo") int mainNo) { + public ResponseEntity> clientlist(@PathVariable("mainNo") int mainNo) { + System.out.println("mainNo : " + mainNo); return new ResponseEntity<>(service.getSubList(mainNo), HttpStatus.OK); } diff --git a/Corperate_Project/src/main/java/com/spring/domain/ItemDTO.java b/Corperate_Project/src/main/java/com/spring/domain/ItemDTO.java new file mode 100644 index 0000000..2b7b4e3 --- /dev/null +++ b/Corperate_Project/src/main/java/com/spring/domain/ItemDTO.java @@ -0,0 +1,20 @@ +package com.spring.domain; + +import java.util.List; + +import com.spring.paging.Paging; + +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class ItemDTO { + + private OrderSheetDetailVO orderSheetDetailVO; + private List lotList; + +} + +// Generic이 적용된 클래스 정의방식. +// 이렇게 정의한 이유는 ClientVO의 list를 담거나 MemverVO의 list를 모두 담을 수 있는 재사용성 높은 코드를 작성하기 위함. \ No newline at end of file diff --git a/Corperate_Project/src/main/java/com/spring/domain/SellDetailVO.java b/Corperate_Project/src/main/java/com/spring/domain/SellDetailVO.java index 04be149..ac4a40f 100644 --- a/Corperate_Project/src/main/java/com/spring/domain/SellDetailVO.java +++ b/Corperate_Project/src/main/java/com/spring/domain/SellDetailVO.java @@ -1,20 +1,23 @@ package com.spring.domain; +import java.util.ArrayList; + import lombok.Data; @Data public class SellDetailVO { - + private int no; - private int item_no; - private int amount; - private int sell_price; - private String lot_code; + private ArrayList item_no; + private ArrayList amount; + private ArrayList sell_price; + private ArrayList lot_code; private int sell_no; private String item_name; private int in_price; private int out_price; private String sell_day; + private int order_sheet_no; private String code; diff --git a/Corperate_Project/src/main/java/com/spring/domain/SellVO.java b/Corperate_Project/src/main/java/com/spring/domain/SellVO.java index b43a03b..540a49f 100644 --- a/Corperate_Project/src/main/java/com/spring/domain/SellVO.java +++ b/Corperate_Project/src/main/java/com/spring/domain/SellVO.java @@ -9,10 +9,22 @@ public class SellVO { private int no; private int member_no; - private int order_no; private String day; private String name; + private int item_no; + private int amount; + private int sell_price; + private String lot_code; + private int sell_no; + private String item_name; + private int in_price; + private int out_price; + private String sell_day; + private int order_sheet_no; + + + private String code; } diff --git a/Corperate_Project/src/main/java/com/spring/mapper/LotRestMapper.java b/Corperate_Project/src/main/java/com/spring/mapper/LotRestMapper.java index b98fb53..c74dd0d 100644 --- a/Corperate_Project/src/main/java/com/spring/mapper/LotRestMapper.java +++ b/Corperate_Project/src/main/java/com/spring/mapper/LotRestMapper.java @@ -6,6 +6,6 @@ public interface LotRestMapper { - public List getLot(int no); + public List getLot(String no); } diff --git a/Corperate_Project/src/main/java/com/spring/mapper/OrderSheetMapper.java b/Corperate_Project/src/main/java/com/spring/mapper/OrderSheetMapper.java index c1c0830..ffb3a7f 100644 --- a/Corperate_Project/src/main/java/com/spring/mapper/OrderSheetMapper.java +++ b/Corperate_Project/src/main/java/com/spring/mapper/OrderSheetMapper.java @@ -41,6 +41,9 @@ public int insertDetailSheet( //수주상태 준비완료 > 발주중 public void updateStatus(int order_no); + + //판매 완료시, 발주중 상태에서 판매 완료 상태로 변경 + public void updateStatusToSold(int order_no); } diff --git a/Corperate_Project/src/main/java/com/spring/mapper/SellDetailMapper.java b/Corperate_Project/src/main/java/com/spring/mapper/SellDetailMapper.java index b4aed9f..cca647e 100644 --- a/Corperate_Project/src/main/java/com/spring/mapper/SellDetailMapper.java +++ b/Corperate_Project/src/main/java/com/spring/mapper/SellDetailMapper.java @@ -2,17 +2,19 @@ import java.util.List; +import org.apache.ibatis.annotations.Param; + import com.spring.domain.SearchVO; import com.spring.domain.SellDetailVO; import com.spring.paging.Client_Paging; public interface SellDetailMapper { - void insert(SellDetailVO selldetail); - public List read(); public List selectAll(Client_Paging pageInfo); public int getTotalCount(SearchVO searchvo); + + void insert(@Param("itemNo")int itemNo,@Param("itemAmount") int itemAmount,@Param("itemPrice") int itemPrice,@Param("lot_code") String lot_code,@Param("order_sheet_no") int order_sheet_no); } diff --git a/Corperate_Project/src/main/java/com/spring/mapper/SellMapper.java b/Corperate_Project/src/main/java/com/spring/mapper/SellMapper.java index b496b60..88a077e 100644 --- a/Corperate_Project/src/main/java/com/spring/mapper/SellMapper.java +++ b/Corperate_Project/src/main/java/com/spring/mapper/SellMapper.java @@ -16,6 +16,6 @@ public interface SellMapper { public void update(SellVO sell); - public List getSubList(int mainNo); + public List getSubList(int mainNo); } diff --git a/Corperate_Project/src/main/java/com/spring/service/LotRestService.java b/Corperate_Project/src/main/java/com/spring/service/LotRestService.java index 1b1c758..0492dac 100644 --- a/Corperate_Project/src/main/java/com/spring/service/LotRestService.java +++ b/Corperate_Project/src/main/java/com/spring/service/LotRestService.java @@ -6,6 +6,8 @@ public interface LotRestService { - public List getLot(int no); + public List getLot(String no); + + } diff --git a/Corperate_Project/src/main/java/com/spring/service/LotRestServiceImpl.java b/Corperate_Project/src/main/java/com/spring/service/LotRestServiceImpl.java index 1dc7157..66674a8 100644 --- a/Corperate_Project/src/main/java/com/spring/service/LotRestServiceImpl.java +++ b/Corperate_Project/src/main/java/com/spring/service/LotRestServiceImpl.java @@ -15,8 +15,13 @@ public class LotRestServiceImpl implements LotRestService{ private LotRestMapper mapper; @Override - public List getLot(int no) { + public List getLot(String no) { System.out.println("리스트 사이즈 : " + mapper.getLot(no).size() + "/ 아이템 넘버 :"+ no ); + List lists = mapper.getLot(no); + + for(int i = 0 ; i < lists.size();i++) { + System.out.println(lists.get(i)); + } return mapper.getLot(no); } } diff --git a/Corperate_Project/src/main/java/com/spring/service/OrderSheetService.java b/Corperate_Project/src/main/java/com/spring/service/OrderSheetService.java index ba06969..50ac3cd 100644 --- a/Corperate_Project/src/main/java/com/spring/service/OrderSheetService.java +++ b/Corperate_Project/src/main/java/com/spring/service/OrderSheetService.java @@ -25,4 +25,5 @@ public interface OrderSheetService { //발주할때 수주참조하면 수주상태 준비완료>발주중 public void updateStatus(int order_no); + public void updateStatusToSold(int order_no); } diff --git a/Corperate_Project/src/main/java/com/spring/service/OrderSheetServiceImpl.java b/Corperate_Project/src/main/java/com/spring/service/OrderSheetServiceImpl.java index 2b7bd72..20c15df 100644 --- a/Corperate_Project/src/main/java/com/spring/service/OrderSheetServiceImpl.java +++ b/Corperate_Project/src/main/java/com/spring/service/OrderSheetServiceImpl.java @@ -225,4 +225,10 @@ public void updateStatus(int order_no) { mapper.updateStatus(order_no); } + + @Override + public void updateStatusToSold(int order_no) { + mapper.updateStatusToSold(order_no); + + } } diff --git a/Corperate_Project/src/main/java/com/spring/service/SellDetailServiceImpl.java b/Corperate_Project/src/main/java/com/spring/service/SellDetailServiceImpl.java index d37b930..ed9d133 100644 --- a/Corperate_Project/src/main/java/com/spring/service/SellDetailServiceImpl.java +++ b/Corperate_Project/src/main/java/com/spring/service/SellDetailServiceImpl.java @@ -19,8 +19,18 @@ public class SellDetailServiceImpl implements SellDetailService{ @Override public void insert(SellDetailVO selldetail) { - mapper.insert(selldetail); // 존재하지 않는 레코드를 얻으려고하면 null이 반환됨 - } + + int len = selldetail.getItem_no().size(); + + for (int i = 0; i < len; i++) { + int itemNo = selldetail.getItem_no().get(i); + int itemAmount = selldetail.getAmount().get(i); + int itemPrice = selldetail.getSell_price().get(i); + String lot_code = selldetail.getLot_code().get(i); + mapper.insert(itemNo,itemAmount,itemPrice,lot_code,selldetail.getOrder_sheet_no()); + } + } + @Override public List read() { diff --git a/Corperate_Project/src/main/java/com/spring/service/SellService.java b/Corperate_Project/src/main/java/com/spring/service/SellService.java index 8dc3113..00e6237 100644 --- a/Corperate_Project/src/main/java/com/spring/service/SellService.java +++ b/Corperate_Project/src/main/java/com/spring/service/SellService.java @@ -16,7 +16,7 @@ public interface SellService { public void update(SellVO sell); - public List getSubList(int mainNo); + public List getSubList(int mainNo); } diff --git a/Corperate_Project/src/main/java/com/spring/service/SellServiceImpl.java b/Corperate_Project/src/main/java/com/spring/service/SellServiceImpl.java index c365572..42f3f8d 100644 --- a/Corperate_Project/src/main/java/com/spring/service/SellServiceImpl.java +++ b/Corperate_Project/src/main/java/com/spring/service/SellServiceImpl.java @@ -20,7 +20,6 @@ public class SellServiceImpl implements SellService{ public void insert(SellVO sell) { System.out.println("SellServiceImpl member_no :"+sell.getMember_no()); - System.out.println("SellServiceImpl order_no :"+sell.getOrder_no()); System.out.println("SellServiceImpl day :"+sell.getDay()); mapper.insert(sell); // 존재하지 않는 레코드를 얻으려고하면 null이 반환됨 @@ -45,8 +44,8 @@ public void update(SellVO sell) { } @Override - public List getSubList(int mainNo) { - System.out.println("판매 리스트 불러오기"); + public List getSubList(int mainNo) { + System.out.println("판매 리스트 불러오기13"); return mapper.getSubList(mainNo); // 존재하지 않는 레코드를 얻으려고하면 null이 반환됨 } } diff --git a/Corperate_Project/src/main/resources/com/spring/mapper/LotRestMapper.xml b/Corperate_Project/src/main/resources/com/spring/mapper/LotRestMapper.xml index be30e14..acb1c59 100644 --- a/Corperate_Project/src/main/resources/com/spring/mapper/LotRestMapper.xml +++ b/Corperate_Project/src/main/resources/com/spring/mapper/LotRestMapper.xml @@ -4,8 +4,9 @@ "https://mybatis.org/dtd/mybatis-3-mapper.dtd"> - +select code from lot where item_no = #{no} order by code asc \ No newline at end of file diff --git a/Corperate_Project/src/main/resources/com/spring/mapper/OrderSheetMapper.xml b/Corperate_Project/src/main/resources/com/spring/mapper/OrderSheetMapper.xml index 3407207..2469511 100644 --- a/Corperate_Project/src/main/resources/com/spring/mapper/OrderSheetMapper.xml +++ b/Corperate_Project/src/main/resources/com/spring/mapper/OrderSheetMapper.xml @@ -146,6 +146,13 @@ where no = #{order_no} and status = 0 + + + + update ORDER_SHEET + set status = 2 + where no = #{order_no} + \ No newline at end of file diff --git a/Corperate_Project/src/main/resources/com/spring/mapper/SellDetailMapper.xml b/Corperate_Project/src/main/resources/com/spring/mapper/SellDetailMapper.xml index 19b32dc..91a6369 100644 --- a/Corperate_Project/src/main/resources/com/spring/mapper/SellDetailMapper.xml +++ b/Corperate_Project/src/main/resources/com/spring/mapper/SellDetailMapper.xml @@ -6,7 +6,7 @@ - insert into sell_detail values(sell_detail_seq.nextval,#{item_no},#{amount},#{sell_price},#{lot_code},sell_seq.currval) + insert into sell_detail values(sell_detail_seq.nextval,#{itemNo},#{itemAmount},#{itemPrice},#{lot_code},sell_seq.currval,#{order_sheet_no}) - select se.no, se.day, se.order_no, me.name name + select se.no, se.day, me.name name from(select * from sell) se inner join member me on se.member_no = me.no order by no desc @@ -21,13 +21,12 @@ on se.member_no = me.no order by no desc - update sell set member_no = #{member_no}, order_no = - #{order_no}, day = + update sell set member_no = #{member_no}, day = #{day} where no = #{no} - select sn.no, sn.sell_no, sn.amount, sn.sell_price, sn.lot_code, sn.item_no, it.code code, it.name name from(select * @@ -35,4 +34,5 @@ on se.member_no = me.no order by no desc where sell_no = #{mainNo}) sn inner join item it on sn.item_no = it.no + \ No newline at end of file diff --git a/Corperate_Project/src/main/webapp/WEB-INF/views/sell/origin/list.jsp b/Corperate_Project/src/main/webapp/WEB-INF/views/sell/origin/list.jsp index 505a5ca..45d2dc9 100644 --- a/Corperate_Project/src/main/webapp/WEB-INF/views/sell/origin/list.jsp +++ b/Corperate_Project/src/main/webapp/WEB-INF/views/sell/origin/list.jsp @@ -125,12 +125,21 @@ SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); str += "
"; str += ""; str += ""; - str += "

"; + str += ""; $("#sell_Detail_Insert_Area") .after(str); }); - $('#delete_detail').click(function() { - $("#sell_Detail_Insert_Area").next().remove(); + $("#sell_Detail_Insert_Area").on("click", ".deleteItemBtn", function(e){ + + var currentRowCount = $("#sell_Detail_Insert_Area").find("div[class=row]").length; + + // 마지막 한줄은 살아있어야 하므로 삭제하지는 않고 값 초기화 + if( currentRowCount == 1){ + $(this).parent().parent().find("input[type=text]").val(""); + return; + } + + $(this).parent().parent().remove(); }); $("#detail_Insert_Area") .on( @@ -182,16 +191,16 @@ SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); }); - $("#detail_Insert_Area").on("click", "#choiceItemBtn",function(e){ + $("#sell_Detail_Insert_Area").on("click", "#choiceItemBtn",function(e){ - + alert(secondModalName); + secondModalName = "item"; pageNum = 1; clickedLocation = $(this); // 품목입력을 위해 누른 input 의 위치 저장 console.log("clickedLocation: " + clickedLocation); // 두번째 모달에서 그려내야할 정보를 지정 - secondModalName = "item"; console.log("secondModalName: " + secondModalName); // 두번째 모달의 제목을 지정 @@ -258,7 +267,7 @@ SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); $("input[name='member_no']").val(memberNo); $("#choiceMemberBtn").val(memberName); - + secondModalName=""; } else if(secondModalName == "item"){ @@ -274,6 +283,7 @@ SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); clickedLocation.parent().parent().find('input[name=item_no]').val(itemNo); $("input[name='item_code']").val(itemCode); + $("input[name='item_name']").val(itemName); var form = {'itemNo':itemNo}; @@ -310,10 +320,169 @@ SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); requestLotRecord(itemNo); } + + else if(secondModalName == "order"){ + + //모달창 크기 초기화 + + //수주서번호 + no = $('input[name=clientRadio]:checked').parent().next().text(); + + //품목 + + $.getJSON("/ordersheet/selectOrder/"+no, + function(resdata){ + console.log("resdata.order"+resdata.order); + console.log("resdata.detailList"+resdata.detailList); + var vo = resdata.order; + + //주문서 삽입 + $("input[name='order_sheet_no']").val(vo.no); + + //담당자 삽입 + $("input[name='member_no']").val(vo.member_no); + $("input[name='member_name']").val(vo.member_name); + + //품목삽입 + var orderDetail = resdata.detailList; + + var itemDTOlist = resdata.itemDTOlist; + + alert(itemDTOlist); + + + //console.log("요청url : " + "/basicinfo/lotRest/getLot/" + orderDetail[i].item_no); + //console.log(orderDetail[i]); + + for(var i=0; i"; + str += "
"; + str += ""; + str += ""; + str += "
"; + str += ""; + str += "
"; + str += "
"; + str += ""; + str += ""; + str += "
"; + str += ""; + str += ""; + str += "
"; + str += ""; + str += ""; + str += "
"; + str += ""; + str += ""; + str += "
"; + str += ""; + str += ""; + str += "
"; + + $("#sell_Detail_Insert_Area").prepend(str); + //} + } + }); + } + secondModalName = ""; }); + $("#choiceOrderBtn").on("click", function(e){ + + pageNum = 1; + + // 두번째 모달에서 그려내야할 정보를 지정 + secondModalName = "order"; + console.log("secondModalName: " + secondModalName); + + // 두번째 모달의 제목을 지정 + $("#second-modal-title").text("수주서 선택"); + + // 두번째 모달의 select의 option을 그려내는 코드 + var str = ""; + str += ""; + str += ""; + str += ""; + str += ""; + $("#searchWhatColumn").html(str); + + // 초기화 코드 + $("#searchKeyword").val(""); + searchWhatColumn = ""; + searchKeyword = ""; + + // 두번째 모달의 테이블의 th를 그려내는 코드 + var str = ""; + str += ""; + str += ""; + str += "작성일자"; + str += "담당자"; + str += "수주처"; + str += "품목명"; + str += "납기일자"; + str += "주문금액합계"; + str += ""; + $("#secondModalThead").html(str); + + + // 두번째 모달의 테이블의 레코드를 그려내는 코드 + requestClientRecord2(); + }); }); + function requestClientRecord2(){ + console.log("요청url : " + "/basicinfo/" + secondModalName + "/pages/"+ pageNum +"/" + amount + "/" + searchWhatColumn + "/" + searchKeyword) + //요청url + url = "/basicinfo/"; + if (secondModalName == "order"){ + url = "/ordersheet/"; + } + + $.getJSON(url + secondModalName + "/pages/"+ pageNum +"/" + amount + "/" + searchWhatColumn + "/" + searchKeyword, + function(resdata){ + console.log("list: " + resdata.list); // 1페이지 레코드들이 담긴 객체 + console.log("totalCount: " + resdata.totalCount); // 검색조건으로 뽑힌 총 레코드 수 + console.log("cri: " + resdata.cri); // 검색에 사용된 기준정보가 담긴 객체 + + paintRecord(resdata.list); // 레코드들을 그리는 함수 + + }).fail(function(xhr, status, err){ + alert("데이터 조회실패"); + }); + } function goModal2(no, order, member, daay) { update_no = no; order_no = order; @@ -346,7 +515,37 @@ SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); } } - + else if(secondModalName == "order"){ + + + //toStringByFormatting(new Date(2021, 0, 1)); + // 2021-01-01 + + //$('.modal2').attr('class','modal-xl'); + + itemNo = new Array(); + + for(var i = 0, len = list.length || 0; i < len; i++){ + + + str += ""; + str += ""; + str += "" + list[i].no +""; + str += ""; + str += toStringByFormatting(new Date(list[i].day)); + str += ""; + str += "" + list[i].member_name +""; + str += "" + list[i].client_name +""; + str += "" + list[i].temp_item_name + ""; + str += "" ; + str += toStringByFormatting(new Date(list[i].out_day)); + str += ""; + str += "" + numberWithCommas(list[i].total_price) +"원"; + str += ""; + + + } + } else if(secondModalName == "item"){ for(var i = 0, len = list.length || 0; i < len; i++){ str += ""; @@ -465,26 +664,39 @@ SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); $.getJSON("/basicinfo/lotRest/getLot/" + itemNo , function(list){ console.log("list: " + list); - paintLotRecord(list); + var str = ""; + for(var i = 0, len = list.length || 0; i < len; i++){ + str += ""; + } + if(list.length == 0){ + str += ""; + } + + $("#getLotCode").html(str); }).fail(function(xhr, status, err){ alert("데이터 조회실패"); }); } - function paintLotRecord(list){ + function toStringByFormatting(source, delimiter = '-') { + const year = source.getFullYear(); + const month = leftPad(source.getMonth() + 1); + const day = leftPad(source.getDate()); - var str = ""; - if(secondModalName == "item"){ - for(var i = 0, len = list.length || 0; i < len; i++){ - str += ""; - } - } - - if(list.length == 0){ - str += ""; - } - $("#getLotCode").html(str); + return [year, month, day].join(delimiter); + } + + //날짜함수 + function leftPad(value) { + if (value >= 10) { + return value; + } + + return `0${value}`; + } + function numberWithCommas(x) { + return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); } @@ -495,6 +707,7 @@ SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); /* 비동기로 하단의 상세품목을 불러와 출력해주는 부분 */ $("#table1 tbody tr").on("click", function(){ + // 클릭된 수주서의 no 번호 var clickedMainNo = $(this).children("td")[0].innerHTML; console.log("clickedMainNo: " + clickedMainNo); @@ -502,14 +715,14 @@ SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); console.log("요청url : " + "/sell/origin/detail/more/" + clickedMainNo); $.getJSON("/sell/origin/detail/more/" + clickedMainNo, function(list){ + console.log("list: " + list); - $("#table2 tbody").empty(); for(var i = 0, len = list.length || 0; i < len; i++){ var str = ""; - + alert( list[i].code); str += ""; str += "" + list[i].no + ""; str += "" + list[i].item_no + ""; @@ -571,7 +784,7 @@ SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); - + @@ -581,8 +794,8 @@ SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); - - + + <%-- --%> @@ -596,7 +809,7 @@ SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
주문서 번호번호 담당자 번호 판매 날짜 Actions
${i.no}${i.order_no}${i.no}${i.order_no}${i.name}
@@ -723,7 +935,7 @@ SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");