<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="接箍订单合同查询">
	<query id="CoreOrderJGGXPln.queryOrdering"  desc="查询待排产接箍合同">
		<![CDATA[
			SELECT T.JG_ORDERNO,
			       T.ORDER_NO,
			       T.ORDER_SEQ,
			       T.DELIVERY_NO,
			       T.BUYER_ID,
			       T.BUYER_NAME,
			       TO_CHAR(T.DELVRY_EDATE, 'YYYY-MM-DD') DELVRY_EDATE,
			       T.ORDERCONTACT,
			       DECODE(T.IF_MONITOR_JG, '1', '是', '0', '否') IF_MONITOR_JG,
			       T.MONITORDEMAND,
			       T.PSC,
			       T.MSC,
			       T.CODE_JG,
			       T.STEELCODE,
			       T.STEELNAME,
			       T.OUTDIAMETER,
			       T.WALLTHICK,
			       T.AIMWALLTHICK,
			       T.MODEL_CODE,
			       T.MODEL_DESC,
			       T.AIMLENGTH,
			       T.SINGLEWEIGHT,
			       T.ORDERWEIGHT,
			       T.ORDERNUM,
			       TO_CHAR(T.LATEST_PROD_DATE, 'YYYY-MM-DD') LATEST_PROD_DATE,
			       T.CREATE_NAME,
			       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
			       T.UPDATE_NAME,
			       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
			       DECODE(T.JGORDERSTATUS,
			              '0',
			              '待处理',
			              '1',
			              '完成配料',
			              '2',
			              '已下发') JGORDERSTATUS,
			       T.MATCHWEIGHT,
			       T.MATCHNUM,
			       DECODE(T.IFBUYPLAN, '1', '有', '0', '无') IFBUYPLAN,
			       T.BUYPLANID,
			       T.BUYPLANWEIGHT,
			       T.BUYPLANNUM,
			       T.GROUP_JGX,
			       T.JGWT_BLREQ
			  FROM PLN_ORDER_JG T
			 WHERE T.JG_ORDERNO IN (SELECT B.JG_ORDERNO
                          FROM PLN_JG_AND_BL B
                         WHERE B.JGPLAN_NUM < B.NUM_JG)
		]]>
	</query>
	
	<query id="CoreOrderJGGXPln.queryBLSJ"  desc="查询备料数据">
		<![CDATA[
				SELECT T.JG_ORDERNO,
				       T.REQ_BL_ID,
				       T.CODE_JG,
				       T.OUTDIAMETER,
				       T.WALLTHICK,
				       T.AIMLENGTH,
				       T.STEELCODE,
				       T.STEELNAME,
				       T.SINGLEWEIGHT,
				       T.CODE_JG_BL,
				       T.AIMLENGTH_BL,
				       T.SINGLEWEIGHT2,
				       T.JGBL_REQ_WEIGHT,
				       T.JGBL_REQ_NUM,
				       T.GETRATE,
				       T.WEIGHT_JG,
				       T.NUM_JG,
				       T.JGPLAN_NUM,
				       (NUM_JG - NVL(JGPLAN_NUM, 0)) AS JG_GS,
				       DECODE(PLANSTATUS,
				              '0',
				              '待处理',
				              '1',
				              '已下发',
				              '2',
				              '部分下发订单',
				              '3',
				              '全部下发订单') PLANSTATUS,
				       T.CREATE_NAME,
				       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
				       T.UPDATE_NAME,
				       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
				       T.SINGLE_ADDLEN
				  FROM PLN_JG_AND_BL T
				 WHERE T.JGPLAN_NUM < T.NUM_JG
				 ORDER BY CODE_JG, CODE_JG_BL
		]]>
	</query>
	
	<query id="CoreOrderJGGXPln.queryJGDD"  desc="查询接箍订单">
		<![CDATA[
			SELECT T.PRO_PLAN_ID,
			       T.PLAN_SEQ_NO,
			       T.PLINE_CODE,
			       T.PLINE_NAME,
			       T.MONITORDEMAND,
			       DECODE(T.IF_MONITOR_JG,'0','否','1','是') IF_MONITOR_JG,
			       T.PRDCR_NO,
			       T.CODE_JG,
			       T.STEELCODE,
			       T.STEELNAME,
			       T.OUTDIAMETER,
			       T.WALLTHICK,
			       T.AIMLENGTH,
			       T.SINGLEWEIGHT,
			       T.SPEC_JG,
			       T.SPEC_JG_DESC,
			       T.MODEL_CODE,
			       T.MODEL_DESC,
			       T.STYLE_JG,
			       T.DIAMETER,
			       T.CHECK_J_VAL,
			       T.CODE_JG_BL,
			       T.MIN_D,
			       T.MIN_H,
			       T.AIMLENGTH_BL,
			       T.DIAMETER_PL,
			       T.HEIGHT_PL,
			       T.LENGTH_MIN,
			       T.LENGTH_MAX,
			       T.PLAN_NUM,
			       T.SINGLE_CUT_NUN,
			       T.BL_NUM,
			       T.BL_WEIGHT,
			       T.PLAN_USETIME_JG,
			       TO_CHAR(T.PLAN_TIME_JG, 'YYYY-MM-DD HH24:MI:SS') PLAN_TIME_JG,
			       DECODE(T.PLANSTATUS, '0', '待处理', '1', '已下发') PLANSTATUS,
			       T.CREATE_NAME,
			       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
			       T.UPDATE_NAME,
			       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME
			  FROM PLN_GX_JG_M T
			 WHERE T.PLANSTATUS < '2'
			 ORDER BY T.CREATE_TIME DESC
		]]>
	</query>
	
	<query id="CoreOrderJGGXPln.queryJGDDCB"  desc="查询接箍订单从表">
		<![CDATA[
			SELECT T.PRO_PLAN_ID,
			       T.JG_ORDERNO,
			       T.ORDER_NO,
			       T.ORDER_SEQ,
			       T.DELIVERY_NO,
			       T.BUYER_ID,
			       T.BUYER_NAME,
			       T.MONITORDEMAND,
			       DECODE(T.IF_MONITOR_JG, '0', '否', '1', '是') IF_MONITOR_JG,
			       T.PRDCR_NO,
			       T.REQ_BL_ID,
			       T.CODE_JG,
			       T.CODE_JG_BL,
			       T.PLANNUM,
			       T.SPEC_JG,
			       T.SPEC_JG_DESC,
			       T.CREATE_NAME,
			       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
			       T.UPDATE_NAME,
			       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME
			  FROM PLN_GX_JG_D T
			 WHERE T.PRO_PLAN_ID IN
			       (SELECT T.PRO_PLAN_ID FROM PLN_GX_JG_M T WHERE T.PLANSTATUS < '2')
		]]>
	</query>
	
	<query id="CoreOrderJGGXPln.queryJGDDMForD"  desc="查询接箍订单对应的明细项">
		<![CDATA[
			SELECT T.PRO_PLAN_ID,
			       T.JG_ORDERNO,
			       T.ORDER_NO,
			       T.ORDER_SEQ,
			       T.DELIVERY_NO,
			       T.BUYER_ID,
			       T.BUYER_NAME,
			       T.MONITORDEMAND,
			       DECODE(T.IF_MONITOR_JG, '0', '否', '1', '是') IF_MONITOR_JG,
			       T.PRDCR_NO,
			       T.REQ_BL_ID,
			       T.CODE_JG,
			       T.CODE_JG_BL,
			       T.PLANNUM,
			       T.SPEC_JG,
			       T.SPEC_JG_DESC,
			       T.PRODUCED_NUM,
			       T.CREATE_NAME,
			       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
			       T.UPDATE_NAME,
			       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME
			  FROM PLN_GX_JG_D T
			 WHERE T.PRO_PLAN_ID = ?
		]]>
	</query>
	
	<query id="CoreOrderJGGXPln.queryJgPlHrCapcty"  desc="查询接箍小时能力">
		<![CDATA[
			SELECT T.HR_CAPCTY, T.WASTE_RATE, T.PLINE_NAME
			  FROM SLM_BASE_MATERIAL_J_PL T 
			 WHERE T.IN_MATERIAL_NO = ?
			   AND T.OUT_MATERIAL_NO = ?
			   AND T.PLINE_CODE = ?
			   AND (T.DISABLE_FL != '1' OR T.DISABLE_FL IS NULL)
		]]>
	</query>
	
	<query id="CoreOrderJGGXPln.queryOrderbase"  desc="查询接箍对应产线及小时能力">
		<![CDATA[
				SELECT T.PLINE_CODE,
				       T.PLINE_NAME,
				       T.DEPARTMENT_DESC,
				       T.PROCESS_DESC,
				       T1.IN_MATERIAL_NO,
				       T1.OUT_MATERIAL_NO,
				       T1.HR_CAPCTY,
				       T1.WASTE_RATE
				  FROM COM_BASE_PLINE T,
				       (SELECT B.IN_MATERIAL_NO,
						       B.OUT_MATERIAL_NO,
						       B.PLINE_CODE,
						       B.PLINE_NAME,
						       B.HR_CAPCTY,
						       B.WASTE_RATE
				          FROM SLM_BASE_MATERIAL_J_PL B
				         WHERE B.IN_MATERIAL_NO = ?
				           AND B.OUT_MATERIAL_NO = ?
				           AND (B.DISABLE_FL != '1' OR B.DISABLE_FL IS NULL)) T1
				 WHERE T.PROCESS_CODE = 'H'
				   AND T1.PLINE_CODE(+) = T.PLINE_CODE
		]]>
	</query>
	
	<query id="CoreOrderJGGXPln.queryPlnGxjgD"  desc="查询接箍工序订单明细项">
		<![CDATA[
			SELECT T.PRO_PLAN_ID,
			       T.JG_ORDERNO,
			       T.ORDER_NO,
			       T.ORDER_SEQ,
			       T.DELIVERY_NO,
			       T.BUYER_ID,
			       T.BUYER_NAME,
			       T.MONITORDEMAND,
			       T.IF_MONITOR_JG,
			       T.PRDCR_NO,
			       T.REQ_BL_ID,
			       T.CODE_JG,
			       T.CODE_JG_BL,
			       T.PLANNUM,
			       T.SPEC_JG,
			       T.SPEC_JG_DESC,
			       T.PRODUCED_NUM
			  FROM PLN_GX_JG_D T
			 WHERE T.PRO_PLAN_ID = ?
			   AND T.JG_ORDERNO = ?
		]]>
	</query>
	
	<query id="CoreOrderJGGXPln.queryJGDDById"  desc="查询接箍订单">
		<![CDATA[
			SELECT T.PRO_PLAN_ID,
			       T.PLAN_SEQ_NO,
			       T.PLINE_CODE,
			       T.PRDCR_NO,
			       T.CODE_JG,
			       T.SINGLEWEIGHT,
			       T.CODE_JG_BL,
			       T.PLAN_NUM,
			       T.SINGLE_CUT_NUN,
			       T.BL_NUM,
			       T.BL_WEIGHT,
			       T.PLAN_USETIME_JG,
			       TO_CHAR(T.PLAN_TIME_JG, 'YYYY-MM-DD HH24:MI:SS') PLAN_TIME_JG,
			       T.BATCHED_NUM,
			       T.PRODUCED_NUM,
			       T.PLANSTATUS,
			       T.CREATE_NAME,
			       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
			       T.UPDATE_NAME,
			       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME
			  FROM PLN_GX_JG_M T
			 WHERE T.PRO_PLAN_ID = ?
		]]>
	</query>
	
	<query id="CoreOrderJGGXPln.queryJGDDCBById"  desc="查询接箍订单从表">
		<![CDATA[
			SELECT T.PRO_PLAN_ID,
			       T.JG_ORDERNO,
			       T.ORDER_NO,
			       T.ORDER_SEQ,
			       T.DELIVERY_NO,
			       T.PRDCR_NO,
			       T.REQ_BL_ID,
			       T.CODE_JG,
			       T.CODE_JG_BL,
			       T.PLANNUM,
			       T.PRODUCED_NUM,
			       T.CREATE_NAME,
			       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
			       T.UPDATE_NAME,
			       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME
			  FROM PLN_GX_JG_D T
			 WHERE T.PRO_PLAN_ID = ?
			   AND T.JG_ORDERNO = ?
		]]>
	</query>
	
	<query id="CoreOrderJGGXPln.creatJgDdNum"  desc="生产订单编号">
		<![CDATA[
				SELECT ('JGD_' || TO_CHAR(SYSDATE, 'YYYYMMDD') ||
				       LPAD(DECODE(MAX(SUBSTR(T.PRO_PLAN_ID, 13) + 1),
				                    '',
				                    '0001',
				                    MAX(SUBSTR(T.PRO_PLAN_ID, 13) + 1)),
				             4,
				             '0')) PRO_PLAN_ID
				  FROM PLN_GX_JG_M T
				 WHERE SUBSTR(T.PRO_PLAN_ID, 0, 12) =
				       ('JGD_' || TO_CHAR(SYSDATE, 'YYYYMMDD'))
		]]>
	</query>
	
	<query id="CoreOrderJGGXPln.insertGxJgM"  desc="新增接箍订单">
		<![CDATA[
			INSERT INTO PLN_GX_JG_M
				  (PRO_PLAN_ID,
				   PLINE_CODE,
				   PLINE_NAME,
				   MONITORDEMAND,
				   IF_MONITOR_JG,
				   PRDCR_NO,
				   CODE_JG,
				   STEELCODE,
				   STEELNAME,
				   OUTDIAMETER,
				   WALLTHICK,
				   AIMLENGTH,
				   SINGLEWEIGHT,
				   SPEC_JG,
				   SPEC_JG_DESC,
				   MODEL_CODE,
				   MODEL_DESC,
				   STYLE_JG,
				   DIAMETER,
				   CHECK_J_VAL,
				   CODE_JG_BL,
				   MIN_D,
				   MIN_H,
				   AIMLENGTH_BL,
				   DIAMETER_PL,
				   HEIGHT_PL,
				   LENGTH_MIN,
				   LENGTH_MAX,
				   PLAN_NUM,
				   SINGLE_CUT_NUN,
				   BL_NUM,
				   BL_WEIGHT,
				   PLAN_USETIME_JG,
				   PLAN_TIME_JG,
				   BATCHED_NUM,
				   PRODUCED_NUM,
				   PLANSTATUS,
				   CREATE_NAME,
				   CREATE_TIME)
				  SELECT '#PRO_PLAN_ID#',
				         '#PLINE_CODE#',
				         '#PLINE_NAME#',
				         '#MONITORDEMAND#',
				         '#IF_MONITOR_JG#',
				         '#PRDCR_NO#',
				         '#CODE_JG#',
				         T1.STEELCODE_JG,
				         T1.STEELCODE_JG_DESC,
				         T1.DIAMETER_JG,
				         T1.HEIGHT_JG,
				         T1.LENGTH_JG,
				         T1.WEIGHT_JG,
				         T1.SPEC_JG,
				         T1.SPEC_JG_DESC,
				         T1.MODEL_CODE,
				         T1.MODEL_DESC,
				         T1.STYLE_JG,
				         T1.DIAMETER,
				         T1.CHECK_J_VAL,
				         '#CODE_JG_BL#',
				         T2.MIN_D,
				         T2.MIN_H,
				         '#AIMLENGTH_BL#',
				         T1.DIAMETER_PL,
				         T1.HEIGHT_PL,
				         T1.LENGTH_MIN,
				         T1.LENGTH_MAX,
				         '#PLAN_NUM#',
				         '#SINGLE_CUT_NUN#',
				         '#BL_NUM#',
				         '#BL_WEIGHT#',
				         '#PLAN_USETIME_JG#',
				         TO_DATE('#PLAN_TIME_JG#', 'YYYY-MM-DD HH24:MI:SS'),
				         '0',
				         '0',
				         '0',
				         '#CREATE_NAME#',
				         SYSDATE
				    FROM COM_MSC_JG T1, COM_MSC_BL T2
				   WHERE T1.CODE_JG = '#CODE_JG#'
				     AND T2.PSC_BL = '#CODE_JG_BL#'
		]]>
	</query>
	
	<query id="CoreOrderJGGXPln.insertGxJgD"  desc="新增接箍订单明细记录">
		<![CDATA[
			INSERT INTO PLN_GX_JG_D
				  (PRO_PLAN_ID,
				   JG_ORDERNO,
				   ORDER_NO,
				   ORDER_SEQ,
				   DELIVERY_NO,
				   BUYER_ID,
				   BUYER_NAME,
				   MONITORDEMAND,
				   IF_MONITOR_JG,
				   PRDCR_NO,
				   REQ_BL_ID,
				   CODE_JG,
				   CODE_JG_BL,
				   PLANNUM,
				   SPEC_JG,
				   SPEC_JG_DESC,
				   PRODUCED_NUM,
				   CREATE_NAME,
				   CREATE_TIME)
				  SELECT '#PRO_PLAN_ID#',
				         '#JG_ORDERNO#',
				         T1.ORDER_NO,
				         T1.ORDER_SEQ,
				         T1.DELIVERY_NO,
				         T1.BUYER_ID,
				         T1.BUYER_NAME,
				         T1.MONITORDEMAND,
				         T1.IF_MONITOR_JG,
				         T1.PRDCR_NO,
				         '#REQ_BL_ID#',
				         '#CODE_JG#',
				         '#CODE_JG_BL#',
				         '#PLANNUM#',
				         (SELECT B.SPEC_JG FROM COM_MSC_JG B WHERE B.CODE_JG = '#CODE_JG#'),
				         (SELECT B.SPEC_JG_DESC
				            FROM COM_MSC_JG B
				           WHERE B.CODE_JG = '#CODE_JG#'),
				         '0',
				         '#CREATE_NAME#',
				         SYSDATE
				    FROM PLN_ORDER_JG T1
				   WHERE T1.JG_ORDERNO = '#JG_ORDERNO#'
		]]>
	</query>
	
	<query id="CoreOrderJGGXPln.updateJgAndBlnum"  desc="回写接箍计划已排个数">
		<![CDATA[
			UPDATE PLN_JG_AND_BL T
			   SET T.JGPLAN_NUM = T.JGPLAN_NUM + ?
			 WHERE T.JG_ORDERNO = ?
			   AND T.REQ_BL_ID = ?
		]]>
	</query>
	
	<query id="CoreOrderJGGXPln.updateGxJgM"  desc="接箍订单加量">
		<![CDATA[
			UPDATE PLN_GX_JG_M T
			   SET T.PLAN_NUM        = T.PLAN_NUM + '#PLAN_NUM#',
			       T.BL_NUM          = T.BL_NUM + '#BL_NUM#',
			       T.BL_WEIGHT       = T.BL_WEIGHT + '#BL_WEIGHT#',
			       T.PLAN_USETIME_JG = T.PLAN_USETIME_JG + '#PLAN_USETIME_JG#',
			       T.UPDATE_NAME     = '#UPDATE_NAME#',
			       T.UPDATE_TIME     = SYSDATE
			 WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
		]]>
	</query>
	
	<query id="CoreOrderJGGXPln.updateGxJgD"  desc="接箍订单明细项加量">
		<![CDATA[
			UPDATE PLN_GX_JG_D T
			   SET T.PLANNUM     = T.PLANNUM + '#PLANNUM#',
			       T.UPDATE_NAME = '#UPDATE_NAME#',
			       T.UPDATE_TIME = SYSDATE
			 WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
			   AND T.JG_ORDERNO = '#JG_ORDERNO#'
		]]>
	</query>
	
	<query id="CoreOrderJGGXPln.updateJGDD"  desc="修改接箍订单">
		<![CDATA[
			UPDATE PLN_GX_JG_M T
			   SET T.PLINE_CODE      = '#PLINE_CODE#',
			       T.PLINE_NAME      = '#PLINE_NAME#',
			       T.PLAN_TIME_JG    = TO_DATE('#PLAN_TIME_JG#', 'YYYY-MM-DD HH24:MI:SS'),
			       T.PLAN_NUM        = '#PLAN_NUM#',
			       T.BL_NUM          = '#BL_NUM#',
			       T.BL_WEIGHT       = '#BL_WEIGHT#',
			       T.PLAN_USETIME_JG = '#PLAN_USETIME_JG#',
			       T.UPDATE_NAME     = '#UPDATE_NAME#',
			       T.UPDATE_TIME     = SYSDATE
			 WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
		]]>
	</query>
	
	<query id="CoreOrderJGGXPln.updateJGDDCB"  desc="修改接箍订单从表">
		<![CDATA[
			UPDATE PLN_GX_JG_D T
			   SET T.PLANNUM     = '#PLANNUM#',
			       T.UPDATE_NAME = '#UPDATE_NAME#',
			       T.UPDATE_TIME = SYSDATE
			 WHERE T.PRO_PLAN_ID = '#PRO_PLAN_ID#'
			   AND T.JG_ORDERNO = '#JG_ORDERNO#'
		]]>
	</query>
	
	
	
	
	
	
	
	
	
	<query id="CoreOrderJGGXPln.queryOrderingh"  desc="查询接箍合同">
		<![CDATA[
				SELECT T.MONITORDEMAND,T.IF_MONITOR_JG,T.PRDCR_NO 
				FROM PLN_ORDER_JG T WHERE T.JG_ORDERNO = ?
		]]>
	</query>
	
	
	
	
	
	
	
	
	
	
	
	<query id="CoreOrderJGGXPln.queryBLJCB"  desc="查询备料数据">
		<![CDATA[
				SELECT * 
				FROM COM_MSC_JG T WHERE T.CODE_JG = ?
		]]>
	</query>
	
	   <query id="CoreOrderJGGXPln.queryJGDDS"  desc="查询接箍订单数">
		<![CDATA[
				SELECT MAX(SUBSTR(t.pro_plan_id,13,3)) as shu FROM PLN_GX_JG_M T
				WHERE TO_CHAR(T.CREATE_TIME,'YYYY/MM/DD') = TO_CHAR(SYSDATE,'YYYY/MM/DD')
		]]>
	</query>
	
	 <query id="CoreOrderJGGXPln.queryDGDD"  desc="查询单个接箍订单">
		<![CDATA[
				SELECT * FROM PLN_GX_JG_M T
				WHERE T.PRO_PLAN_ID = ?
		]]>
	</query>
	
	<query id="CoreOrderJGGXPln.detTGJGDD"  desc="删除接箍订单">
		<![CDATA[
				DELETE FROM PLN_GX_JG_M T WHERE T.PRO_PLAN_ID = ?
		]]>
	</query>
	
	<query id="CoreOrderJGGXPln.UPTGJGDD"  desc="下发接箍订单">
		<![CDATA[
				UPDATE PLN_GX_JG_M T SET T.PLANSTATUS = '1' WHERE T.PRO_PLAN_ID = ?
		]]>
	</query>
	
	<query id="CoreOrderJGGXPln.qxTGJGDD"  desc="取消接箍订单">
		<![CDATA[
				UPDATE PLN_GX_JG_M T SET T.PLANSTATUS = '0' WHERE T.PRO_PLAN_ID = ?
		]]>
	</query>
	
	<query id="CoreOrderJGGXPln.UPDDTime"  desc="修改生产时间">
		<![CDATA[
				UPDATE PLN_GX_JG_M T SET T.PLAN_TIME_JG = TO_DATE(?, 'YYYY/MM/DD HH24:MI:SS') WHERE T.PRO_PLAN_ID = ?
		]]>
	</query>
	
	<query id="CoreOrderJGGXPln.DDSCPX"  desc="生产排序">
		<![CDATA[
				UPDATE PLN_GX_JG_M T SET T.PLAN_SEQ_NO = ? WHERE T.PRO_PLAN_ID = ?
		]]>
	</query>
	
	<query id="CoreOrderJGGXPln.detTGJGDDCB"  desc="删除接箍订单从表">
		<![CDATA[
				DELETE FROM PLN_GX_JG_D T WHERE T.PRO_PLAN_ID = ?
		]]>
		
	</query>
	
	<query id="CoreOrderJGGXPln.detTGJGDDCBMX"  desc="删除接箍订单从表明细">
		<![CDATA[
				DELETE FROM PLN_GX_JG_D T WHERE T.REQ_BL_ID = ? AND T.JG_ORDERNO = ?
		]]>
	</query>
	
	   <query id="CoreOrderJGGXPln.queryJGDDCBA"  desc="查询接箍订单从表A">
		<![CDATA[
			SELECT T.PRO_PLAN_ID,
			       T.JG_ORDERNO,
			       T.ORDER_NO,
			       T.ORDER_SEQ,
			       T.DELIVERY_NO,
			       T.BUYER_ID,
			       T.BUYER_NAME,
			       T.MONITORDEMAND,
			       DECODE(T.IF_MONITOR_JG, '0', '否', '1', '是') IF_MONITOR_JG,
			       T.PRDCR_NO,
			       T.REQ_BL_ID,
			       T.CODE_JG,
			       T.CODE_JG_BL,
			       T.PLANNUM,
			       T.SPEC_JG,
			       T.SPEC_JG_DESC,
			       T.CREATE_NAME,
			       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
			       T.UPDATE_NAME,
			       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME
			  FROM PLN_GX_JG_D T
			 WHERE T.PRO_PLAN_ID IN
			       (SELECT T.PRO_PLAN_ID FROM PLN_GX_JG_M T WHERE T.PLANSTATUS < '2')
		]]>
	</query>
	
	<query id="CoreOrderJGGXPln.queryJGDDBLMX"  desc="查询备料关系表明细">
		<![CDATA[
				 SELECT   JG_ORDERNO,
                      REQ_BL_ID,
                      CODE_JG,
                      OUTDIAMETER,
                      WALLTHICK,
                      AIMLENGTH,
                      STEELCODE,
                      STEELNAME,
                      SINGLEWEIGHT,
                      CODE_JG_BL,
                      AIMLENGTH_BL,
                      SINGLEWEIGHT2,
                      JGBL_REQ_WEIGHT,
                      JGBL_REQ_NUM,
                      GETRATE,
                      WEIGHT_JG,
                      NUM_JG,
                      NVL(JGPLAN_NUM,0) AS JGPLAN_NUM,
                      (NUM_JG-NVL(JGPLAN_NUM,0)) AS JG_GS,
                      PLANSTATUS，
                      CREATE_NAME,
                      TO_CHAR(CREATE_TIME,'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
                      UPDATE_NAME,
                      TO_CHAR(UPDATE_TIME,'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME
                      FROM PLN_JG_AND_BL T WHERE T.REQ_BL_ID = ? AND T.JG_ORDERNO = ?
		]]>
	</query>
	
	<query id="CoreOrderJGGXPln.queryJGDDHSL"  desc="查询生产耗时率">
		<![CDATA[
				SELECT HR_CAPCTY 
				FROM SLM_BASE_MATERIAL_J_PL T WHERE T.IN_MATERIAL_NO = ? AND T.OUT_MATERIAL_NO =? AND T.PLINE_CODE =?
		]]>
	</query>
		   <query id="CoreOrderJGGXPln.addJGDDToo"  desc="加入接箍订单">
		<![CDATA[
				UPDATE PLN_GX_JG_M T  SET T.PLAN_NUM = ?,                         
                         T.BL_NUM = ?,
                         T.BL_WEIGHT = ?,
                         T.PLAN_USETIME_JG =?,
                         T.UPDATE_NAME= ?,
                         T.UPDATE_TIME =TO_DATE(?, 'YYYY/MM/DD HH24:MI/SS')
                         WHERE T.PRO_PLAN_ID = ? 
		]]>
	</query>
	
	   <query id="CoreOrderJGGXPln.UPTGJGBL"  desc="更新备料关系表状态">
		<![CDATA[
				UPDATE PLN_JG_AND_BL T  SET T.PLANSTATUS = ?,T.JGPLAN_NUM = ?                         
                        		 WHERE T.REQ_BL_ID = ? AND T.JG_ORDERNO = ?
		]]>
	</query>
	
	 <query id="CoreOrderJGGXPln.UPTGJGBLA"  desc="更新备料关系表状态">
		<![CDATA[
				UPDATE PLN_JG_AND_BL T  SET T.PLANSTATUS = '0'                          
                        		 WHERE T.REQ_BL_ID = ? AND T.JG_ORDERNO = ?
		]]>
	</query>
	
	 <query id="CoreOrderJGGXPln.UPJGDD"  desc="修改生产线">
		<![CDATA[
				UPDATE PLN_GX_JG_M T  SET T.PLINE_CODE = ?,
				                          T.PLINE_NAME = ?,
				                          T.PLAN_USETIME_JG = ?,
				                          T.UPDATE_NAME = ?,
				                          T.UPDATE_TIME = TO_DATE(?, 'YYYY/MM/DD HH24:MI/SS')
                        		 WHERE T.PRO_PLAN_ID = ? 
		]]>
	</query>
	
	  <query id="CoreOrderJGGXPln.addTGJGDDCB"  desc="制作接箍订单从表">
		<![CDATA[
				INSERT INTO PLN_GX_JG_D(
      PRO_PLAN_ID,
      JG_ORDERNO,
      ORDER_NO,
      ORDER_SEQ,
      DELIVERY_NO,
      BUYER_ID,
      BUYER_NAME,
      MONITORDEMAND,
      IF_MONITOR_JG,
      PRDCR_NO,
      REQ_BL_ID,
      CODE_JG,
      CODE_JG_BL,
      PLANNUM,
      SPEC_JG,
      SPEC_JG_DESC,
      PRODUCED_NUM,
      CREATE_NAME,
      CREATE_TIME,
      UPDATE_NAME,
      UPDATE_TIME
) 
 select
       ?, 
       T.JG_ORDERNO,
       T.ORDER_NO,
       T.ORDER_SEQ,
       T.DELIVERY_NO,
       T.BUYER_ID,
       T.BUYER_NAME,
       T.MONITORDEMAND,
       T.IF_MONITOR_JG,
       T.PRDCR_NO,
       T1.REQ_BL_ID,
       T1.CODE_JG,
       T1.CODE_JG_BL,
       ?,
       T.SPEC_JG,
       T.SPEC_JG_DESC,
       '',
       ?,
       TO_DATE(?, 'YYYY/MM/DD HH24:MI:SS'),
       '',
       ''
        from PLN_ORDER_JG T, PLN_JG_AND_BL T1 
        WHERE T.JG_ORDERNO = T1.JG_ORDERNO AND T1.REQ_BL_ID = ? AND T1.JG_ORDERNO =?
		]]>
	</query>
	
		<query id="CoreOrderJGGXPln.addTGJGDD"  desc="制作接箍订单">
		<![CDATA[
			INSERT INTO PLN_GX_JG_M(
          PRO_PLAN_ID,
          PLAN_SEQ_NO,
          PLINE_CODE,
          PLINE_NAME,
          MONITORDEMAND,
          IF_MONITOR_JG,
          PRDCR_NO,
          CODE_JG,
          STEELCODE,
          STEELNAME,
          OUTDIAMETER,
          WALLTHICK,
          AIMLENGTH,
          SINGLEWEIGHT,
          SPEC_JG,
          SPEC_JG_DESC,
          MODEL_CODE,
          MODEL_DESC,
          STYLE_JG,
          DIAMETER,
          CHECK_J_VAL,
          CODE_JG_BL,
          MIN_D,
          MIN_H,
          AIMLENGTH_BL,
          DIAMETER_PL,
          HEIGHT_PL,
          LENGTH_MIN,
          LENGTH_MAX,
          PLAN_NUM,
          SINGLE_CUT_NUN,
          BL_NUM,
          BL_WEIGHT,
          PLAN_USETIME_JG,
          PLAN_TIME_JG,
          BATCHED_NUM,
          PRODUCED_NUM,
          PLANSTATUS,
          CREATE_NAME,
          CREATE_TIME,
          UPDATE_NAME,
          UPDATE_TIME)
          values
          (?, 
       '', 
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
         TO_DATE(?, 'YYYY/MM/DD HH24:MI:SS'),
        '',
        '',
        '0',
         ?,
         TO_DATE(?, 'YYYY/MM/DD HH24:MI:SS'),
        '',
        ''  ) 
    
		]]>
	</query>
	
	
	
	</queryMap>