229 lines
7.1 KiB
Markdown
229 lines
7.1 KiB
Markdown
|
카렉스 모바일 정비의뢰서
|
||
|
|
||
|
#### 테이블 생성
|
||
|
##### 마스터 (mobile_csorder_master)
|
||
|
/*
|
||
|
고객주소 [w_csa_02010]
|
||
|
등록년월일 [w_csa_02005]
|
||
|
e-Mail [w_csa_02005]
|
||
|
차대번호 [w_csa_02005, carmst.dcarno]
|
||
|
*/
|
||
|
|
||
|
-- drop table mobile_csorder_master;
|
||
|
|
||
|
CREATE TABLE mobile_csorder_master
|
||
|
(
|
||
|
SABU VARCHAR2(1 BYTE),
|
||
|
SAUPJ VARCHAR2(2 BYTE), -- 매장[AD]
|
||
|
SJPNO VARCHAR2(15 BYTE) NOT NULL, -- 의뢰번호 [sqlca.fun_junpyo10( sdate, 'ZO', ls_saupj)]
|
||
|
sts varchar2(3), -- 의뢰 상태 (0:작성중, 1:작성완료, 2:erp전송완료 )
|
||
|
CUSTCODE VARCHAR2(15 BYTE), -- 고객 [carmst.custcode]
|
||
|
CARCODE VARCHAR2(6 BYTE), -- 차량 [carmst.carcode (+carno:carmst.carno)]
|
||
|
ORDER_DATE VARCHAR2(8 BYTE), -- 의뢰일자
|
||
|
S_TIME VARCHAR2(4 BYTE), -- 의뢰시간
|
||
|
EDATE VARCHAR2(14 BYTE), -- 완료시간
|
||
|
E_TIME VARCHAR2(4 BYTE), -- 완료일자
|
||
|
EMPNO VARCHAR2(6 BYTE), -- 정비담당
|
||
|
SEL_EMPNO VARCHAR2(8 BYTE), -- 상담자
|
||
|
|
||
|
TRAVEL NUMBER, -- 주행거리[carmst.travel]
|
||
|
|
||
|
add_consent varchar2(1),
|
||
|
|
||
|
COMMANTS VARCHAR2(255 BYTE), -- 종합소견
|
||
|
bigo VARCHAR2(255 BYTE), -- 특기사항
|
||
|
|
||
|
issu_date VARCHAR2(8 BYTE), -- 작성일
|
||
|
issu_empno VARCHAR2(6 BYTE), -- 작성자
|
||
|
JAKSINO VARCHAR2 (10 Byte), -- 작지번호
|
||
|
|
||
|
wantime VARCHAR2(8 BYTE), -- 완료버튼시각
|
||
|
|
||
|
CRT_USER VARCHAR2(8 BYTE),
|
||
|
CRT_DATE VARCHAR2(8 BYTE),
|
||
|
CRT_TIME VARCHAR2(8 BYTE),
|
||
|
UPD_USER VARCHAR2(8 BYTE),
|
||
|
UPD_DATE VARCHAR2(8 BYTE),
|
||
|
UPD_TIME VARCHAR2(8 BYTE)
|
||
|
|
||
|
|
||
|
);
|
||
|
|
||
|
COMMENT ON TABLE mobile_csorder_master IS '정비의뢰_헤더(정비사업자,차량소유주,특기사항)';
|
||
|
COMMENT ON COLUMN mobile_csorder_master.SAUPJ IS '매장';
|
||
|
COMMENT ON COLUMN mobile_csorder_master.SJPNO IS '의뢰번호';
|
||
|
COMMENT ON COLUMN mobile_csorder_master.STS IS '의뢰 상태 (0:작성중, 1:작성완료, 2:erp전송완료 )';
|
||
|
COMMENT ON COLUMN mobile_csorder_master.CUSTCODE IS '고객';
|
||
|
COMMENT ON COLUMN mobile_csorder_master.CARCODE IS '차량';
|
||
|
COMMENT ON COLUMN mobile_csorder_master.ORDER_DATE IS '의뢰일자';
|
||
|
COMMENT ON COLUMN mobile_csorder_master.S_TIME IS '의뢰시각';
|
||
|
COMMENT ON COLUMN mobile_csorder_master.EDATE IS '완료일자';
|
||
|
COMMENT ON COLUMN mobile_csorder_master.E_TIME IS '완료시각';
|
||
|
COMMENT ON COLUMN mobile_csorder_master.SEL_EMPNO IS '상담자';
|
||
|
COMMENT ON COLUMN mobile_csorder_master.TRAVEL IS '주행거리';
|
||
|
COMMENT ON COLUMN mobile_csorder_master.add_consent IS '추가정비 동의 여부(Y/N)';
|
||
|
COMMENT ON COLUMN mobile_csorder_master.COMMANTS IS '종합소견';
|
||
|
COMMENT ON COLUMN mobile_csorder_master.bigo IS '특기사항';
|
||
|
COMMENT ON COLUMN mobile_csorder_master.issu_date IS '작성일';
|
||
|
COMMENT ON COLUMN mobile_csorder_master.issu_empno IS '작성자';
|
||
|
COMMENT ON COLUMN mobile_csorder_master.wantime IS '완료버튼시각';
|
||
|
|
||
|
|
||
|
ALTER TABLE mobile_csorder_master ADD (
|
||
|
CONSTRAINT PK_mobile_csorder_master
|
||
|
PRIMARY KEY
|
||
|
(SJPNO));
|
||
|
|
||
|
---
|
||
|
|
||
|
##### 세부정보 (mobile_csorder_detail)
|
||
|
-- drop table mobile_csorder_detail;
|
||
|
|
||
|
CREATE TABLE mobile_csorder_detail
|
||
|
(
|
||
|
SAUPJ VARCHAR2(2 BYTE) NOT NULL,
|
||
|
SJPNO VARCHAR2(15 BYTE) NOT NULL,
|
||
|
SEQ NUMBER(5) NOT NULL,
|
||
|
cod VARCHAR2(15 BYTE),
|
||
|
chk_value VARCHAR2(40 BYTE)
|
||
|
|
||
|
);
|
||
|
|
||
|
COMMENT ON TABLE mobile_csorder_detail IS '정비의뢰_디테일 (세부점검 결과표)';
|
||
|
|
||
|
|
||
|
ALTER TABLE mobile_csorder_detail ADD (
|
||
|
CONSTRAINT PK_mobile_csorder_detail
|
||
|
PRIMARY KEY
|
||
|
(SJPNO, SEQ));
|
||
|
|
||
|
---
|
||
|
##### 작업내용 (mobile_csorder_worklist)
|
||
|
|
||
|
CREATE TABLE mobile_csorder_worklist
|
||
|
(
|
||
|
SAUPJ VARCHAR2(2 BYTE) NOT NULL,
|
||
|
SJPNO VARCHAR2(15 BYTE) NOT NULL,
|
||
|
SEQ NUMBER(5) NOT NULL,
|
||
|
ITNBR VARCHAR2(15 BYTE),
|
||
|
ITDSC VARCHAR2(40 BYTE),
|
||
|
SPRC NUMBER(13,2),
|
||
|
SQTY NUMBER(13,2),
|
||
|
SAMT NUMBER(15,2),
|
||
|
STS VARCHAR2(1 BYTE),
|
||
|
BIGO VARCHAR2(255 BYTE),
|
||
|
YEBI1 VARCHAR2(16 BYTE),
|
||
|
YEBI2 VARCHAR2(10 BYTE),
|
||
|
YEBI3 VARCHAR2(10 BYTE),
|
||
|
DYEBI1 NUMBER(13,2),
|
||
|
DYEBI2 NUMBER(13,2),
|
||
|
DYEBI3 NUMBER(13,2),
|
||
|
CRT_USER VARCHAR2(8 BYTE),
|
||
|
CRT_DATE VARCHAR2(8 BYTE),
|
||
|
CRT_TIME VARCHAR2(8 BYTE),
|
||
|
UPD_USER VARCHAR2(8 BYTE),
|
||
|
UPD_DATE VARCHAR2(8 BYTE),
|
||
|
UPD_TIME VARCHAR2(8 BYTE)
|
||
|
|
||
|
);
|
||
|
|
||
|
COMMENT ON TABLE mobile_csorder_worklist IS '정비의뢰_작업내역';
|
||
|
|
||
|
|
||
|
ALTER TABLE mobile_csorder_worklist ADD (
|
||
|
CONSTRAINT PK_mobile_csorder_worklist
|
||
|
PRIMARY KEY
|
||
|
(SJPNO, SEQ));
|
||
|
|
||
|
|
||
|
|
||
|
- ㄴㅇㄻㄴㅇㄹ
|
||
|
- ㄴㅇㅁㄻㄴㅇㄹ
|
||
|
ㅇㄴㅁㄹㄴㅇㄹㄴㅇ
|
||
|
|
||
|
|
||
|
---
|
||
|
|
||
|
##### 출력물(werp)
|
||
|
Select DISTINCT mst.sjpno,
|
||
|
mst.order_date,
|
||
|
mst.edate,
|
||
|
ref1.rfna1 as empname,
|
||
|
cmst.carno,
|
||
|
ref3.rfna1 as carkind_name,
|
||
|
cmst.travel as travel,
|
||
|
cust.addr0101 || ' ' || cust.addr0102 as addr,
|
||
|
cust.custname,
|
||
|
cust.telddd,
|
||
|
cust.telno1,
|
||
|
cust.telno2,
|
||
|
cust.htel01,
|
||
|
cust.htel02,
|
||
|
cust.htel03,
|
||
|
(
|
||
|
select SUM(nvl(A.cash, 0) + nvl(A.save, 0) + nvl(A.bill, 0) + nvl(A.card, 0)) as gumac
|
||
|
from csugum A
|
||
|
where A.saupj = :as_su
|
||
|
And A.sjpno = substr(i.iojpno, 1, 12)
|
||
|
And A.custcode = i.cust_no
|
||
|
And A.carcode = i.cvcod
|
||
|
) gumac,
|
||
|
det.seq,
|
||
|
decode(det.itnbr, null, det.itdsc, imst.itdsc) as itdsc,
|
||
|
ref2.rfna1 as unit,
|
||
|
Decode(det.yebi2, 'OZ5', det.sqty * -1, det.sqty) as sqty,
|
||
|
det.sprc,
|
||
|
Decode(det.yebi2, 'OZ5', (det.samt + det.dyebi3) * -1, det.samt + det.dyebi3) as sell_amt,
|
||
|
Decode(det.yebi2, 'OZ5', det.dyebi3 * -1, det.dyebi3) as vat,
|
||
|
Decode(det.yebi2, 'OZ5', det.samt * -1, det.samt) as samt,
|
||
|
jasa.trade as o_trade,
|
||
|
jasa.entry as o_entry,
|
||
|
jasa.addr as o_addr,
|
||
|
jasa.telno as o_tel,
|
||
|
jasa.faxno as o_fax,
|
||
|
mst.saupj,
|
||
|
mst.commants
|
||
|
From csorder_h mst,
|
||
|
csorder_d det,
|
||
|
itemas imst,
|
||
|
carmst cmst,
|
||
|
custmst cust,
|
||
|
cimhist i,
|
||
|
reffpf ref1,
|
||
|
reffpf ref2,
|
||
|
reffpf ref3,
|
||
|
(
|
||
|
select a.rfgub, b.cvnas as trade, b.sano as entry, b.addr1||' '||b.addr2 as addr,
|
||
|
b.telno as telno,
|
||
|
b.faxno as faxno, b.ownam as ownam
|
||
|
from reffpf a, vndmst b
|
||
|
where a.rfcod = 'AD' and
|
||
|
a.rfgub = :as_su and
|
||
|
a.rfna2 = b.cvcod
|
||
|
) jasa
|
||
|
Where mst.saupj = :as_su
|
||
|
And mst.sjpno like :as_sjpno
|
||
|
And mst.carcode like :as_carcode
|
||
|
And mst.order_date = :as_date
|
||
|
And mst.saupj = det.saupj
|
||
|
And mst.sjpno = det.sjpno
|
||
|
And det.itnbr = imst.itnbr(+)
|
||
|
And ref1.rfcod(+) = 'Z4'
|
||
|
And mst.empno = ref1.rfgub(+)
|
||
|
And ref2.rfcod(+) = '20'
|
||
|
And imst.unmsr = ref2.rfgub(+)
|
||
|
And mst.carcode = cmst.carcode
|
||
|
And ref3.rfcod(+) = 'Z0'
|
||
|
And cmst.carkind = ref3.rfgub(+)
|
||
|
And mst.custcode = cust.custcode
|
||
|
And mst.saupj = i.saupj(+)
|
||
|
And mst.custcode = i.cust_no(+)
|
||
|
And mst.carcode = i.cvcod(+)
|
||
|
And mst.sjpno = i.order_no(+)
|
||
|
And mst.saupj = jasa.rfgub
|
||
|
Order by mst.sjpno, det.seq
|
||
|
|
||
|
|
||
|
|
||
|
|