INSERT INTO SOOrderType (OrderType, TypeDesc, Site, Active)
values (#{orderType}, #{typeDesc}, #{site}, #{active})
UPDATE SOOrderType
SET TypeDesc=#{typeDesc},
Active=#{active},
Site=#{site}
where OrderType = #{orderType}
and Site = #{site}
delete
from SOOrderType
where OrderType = #{orderType}
and Site = #{site}
INSERT INTO SOPlanner (PlannerType, TypeDesc, Site, Active)
values (#{plannerType}, #{typeDesc}, #{site}, #{active})
UPDATE SOPlanner
SET TypeDesc=#{typeDesc},
Active=#{active},
Site=#{site}
where PlannerType = #{plannerType}
and Site = #{site}
delete
from SOPlanner
where PlannerType = #{plannerType}
and Site = #{site}
delete
from ShopOrder
where site = #{site}
and orderNo = #{orderNo}
delete
from SORouting
where site = #{site}
and orderNo = #{orderNo}
and itemNo = #{itemNo}
insert into SORouting (Site, OrderNo, ItemNo, OperationDesc,
WorkCenterNo, MachSetupTime, MachRunFactor,
FactorUnit_DB, FactorUnit, QtyRequired,
QtyReported, QtyApprove, TimeRequired,
TimeReported, Efficiency, PlanStartTime,
PlanFinishTime, BarcodeID, Remark,
PartNo, Crewsize, ClosedFlag,
ActionNotes, QtyScheduled)
values (#{site}, #{orderNo}, #{itemNo}, #{operationDesc}, #{workCenterNo}, #{machSetupTime}, #{machRunFactor},
#{factorUnit_DB},
#{factorUnit}, #{qtyRequired}, #{qtyReported}, #{qtyApprove}, #{timeRequired}, #{timeReported},
#{efficiency},
#{planStartTime}, #{planFinishTime}, #{barcodeID}, #{remark}, #{partNo}, #{crewsize}, #{closedFlag},
#{actionNotes}, 0)
delete from SORouting_AvailableResource where site=#{site} and orderNo=#{orderNo} and ItemNo=#{itemNo}
update SORouting
set OperationDesc = #{operationDesc}
, WorkCenterNo = #{workCenterNo}
, MachSetupTime = #{machSetupTime}
, MachRunFactor = #{machRunFactor}
, FactorUnit = #{factorUnit}
, Efficiency =#{efficiency}
, TimeReported =#{timeRequired}
, PlanFinishTime = #{planFinishTime}
, PlanStartTime = #{planStartTime}
, Crewsize = #{crewsize}
, Remark= #{remark}
where site = #{site}
and OrderNo = #{orderNo}
and ItemNo = #{itemNo}
update ShopOrder
set NeedDate=#{needDate},
PlanStartDate=#{planStartDate},
OriginalNeedDate=#{originalNeedDate},
OrderType=#{orderType},
Planner=#{planner},
OriSOOrderNo=#{oriSOOrderNo},
ProjectID=#{projectID},
Leadtime=#{leadtime,jdbcType=FLOAT},
RepairSOFlag=#{repairSOFlag},
TechInfo=#{techInfo},
Remark=#{remark},
batch_no=#{batchNo},
total_roll=#{totalRoll,jdbcType=INTEGER}
where Site = #{site}
and OrderNo = #{orderNo}
update SORouting
NextItemNo = #{nextItemNo},
PreItemNo = #{preItemNo},
where site = #{site}
and OrderNo = #{orderNo}
and ItemNo = #{itemNo}
insert into ShopOrder
(Site, bu_no, OrderNo, Status, Status_Tmp, EnterDate, NeedDate, PlanStartDate,
OrderType, PartNo, LotSize, BOMRevNo, RoutingRevNo, ProjectID, CustomerID, batch_no, OrderRef1, OrderRef2)
values
(#{site}, #{buNo}, #{orderNo}, #{status}, #{statusTmp}, #{enterDate}, #{needDate}, #{planStartDate},
#{orderType}, #{partNo}, #{lotSize,jdbcType=FLOAT}, #{bOMRevNo}, #{routingRevNo}, #{projectID}, #{customerID}, #{batchNo}, #{orderRef1}, #{orderRef2})