SELECT saleorderlist.SendDate, saleorderhead.Plandate, saleorderhead.SaleorderNO, saleorderhead.P_CODE, saleorderhead.P_Name, saleorderlist.Wl_Code, saleorderlist.Itemname, saleorderlist.Crl_Name, saleorderlist.Price, saleorderlist.Qty, saleorderlist.Amt, saleorderhead.GetMoneyMemo, saleorderhead.Saler, saleorderhead.End_flag, saleorderlist.PI_NO, saleorderlist.SaleOrderID FROM saleorderhead LEFT JOIN saleorderlist ON saleorderhead.SaleorderID = saleorderlist.SaleOrderID insert into saleorderhead SaleorderID, SaleorderNO, saleplanNO, P_CODE, P_Name, P_LinkMan, P_TEL, P_FAX, Send_Address, GetMoneyMemo, Sendmemo, Sendway, Plandate, Playway, Saler, BZ_memo, End_flag, Is_delete, NWX, Comfirm_Flag, write_datetime, edit_date, comfirm_date, SO_Class, GP_YN, doway_cong, doway_tiao, doway_print, doway_other, mould_no, major_size, workline, do_major_memo, amt_class, USE_YLLIST, last_account_amt, Sendcp_Stock, mould_flag, Comfirm_man, Approve_flag, Approve_DATE, Approve_MAN, Auditing_Flag, Auditing_man, Auditing_Datetime, Pre_material_Flag, Factory, JA_FLAG, JA_MAN, JA_TIME, Return_Progress, MADE_Source, sendto_time, plan_do_ok_time, CP_Version_no, RD, YP_State, Fact_OK_TIME, QC_MAN, MemoTEXT, Later_Source, mappath, producehelp, Custom_RD, made_class, yp_orderqty, Doway_cong_Flag, Doway_tiao_flag, Doway_print_Flag, #{SaleorderID}, #{SaleorderNO}, #{saleplanNO}, #{pCode}, #{pName}, #{pLinkman}, #{pTel}, #{pFax}, #{sendAddress}, #{GetMoneyMemo}, #{Sendmemo}, #{Sendway}, #{Plandate}, #{Playway}, #{Saler}, #{bzMemo}, #{endFlag}, #{isDelete}, #{NWX}, #{comfirmFlag}, #{writeDatetime}, #{editDate}, #{comfirmDate}, #{soClass}, #{gpYn}, #{dowayCong}, #{dowayTiao}, #{dowayPrint}, #{dowayOther}, #{mouldNo}, #{majorSize}, #{workline}, #{doMajorMemo}, #{amtClass}, #{useYllist}, #{lastAccountAmt}, #{sendcpStock}, #{mouldFlag}, #{comfirmMan}, #{approveFlag}, #{approveDate}, #{approveMan}, #{auditingFlag}, #{auditingMan}, #{auditingDatetime}, #{preMaterialFlag}, #{Factory}, #{jaFlag}, #{jaMan}, #{jaTime}, #{returnProgress}, #{madeSource}, #{sendtoTime}, #{planDoOkTime}, #{cpVersionNo}, #{RD}, #{ypState}, #{factOkTime}, #{qcMan}, #{MemoTEXT}, #{laterSource}, #{mappath}, #{producehelp}, #{customRd}, #{madeClass}, #{ypOrderqty}, #{dowayCongFlag}, #{dowayTiaoFlag}, #{dowayPrintFlag}, update saleorderhead SaleorderNO = #{SaleorderNO}, saleplanNO = #{saleplanNO}, P_CODE = #{pCode}, P_Name = #{pName}, P_LinkMan = #{pLinkman}, P_TEL = #{pTel}, P_FAX = #{pFax}, Send_Address = #{sendAddress}, GetMoneyMemo = #{GetMoneyMemo}, Sendmemo = #{Sendmemo}, Sendway = #{Sendway}, Plandate = #{Plandate}, Playway = #{Playway}, Saler = #{Saler}, BZ_memo = #{bzMemo}, End_flag = #{endFlag}, Is_delete = #{isDelete}, NWX = #{NWX}, Comfirm_Flag = #{comfirmFlag}, write_datetime = #{writeDatetime}, edit_date = #{editDate}, comfirm_date = #{comfirmDate}, SO_Class = #{soClass}, GP_YN = #{gpYn}, doway_cong = #{dowayCong}, doway_tiao = #{dowayTiao}, doway_print = #{dowayPrint}, doway_other = #{dowayOther}, mould_no = #{mouldNo}, major_size = #{majorSize}, workline = #{workline}, do_major_memo = #{doMajorMemo}, amt_class = #{amtClass}, USE_YLLIST = #{useYllist}, last_account_amt = #{lastAccountAmt}, Sendcp_Stock = #{sendcpStock}, mould_flag = #{mouldFlag}, Comfirm_man = #{comfirmMan}, Approve_flag = #{approveFlag}, Approve_DATE = #{approveDate}, Approve_MAN = #{approveMan}, Auditing_Flag = #{auditingFlag}, Auditing_man = #{auditingMan}, Auditing_Datetime = #{auditingDatetime}, Pre_material_Flag = #{preMaterialFlag}, Factory = #{Factory}, JA_FLAG = #{jaFlag}, JA_MAN = #{jaMan}, JA_TIME = #{jaTime}, Return_Progress = #{returnProgress}, MADE_Source = #{madeSource}, sendto_time = #{sendtoTime}, plan_do_ok_time = #{planDoOkTime}, CP_Version_no = #{cpVersionNo}, RD = #{RD}, YP_State = #{ypState}, Fact_OK_TIME = #{factOkTime}, QC_MAN = #{qcMan}, MemoTEXT = #{MemoTEXT}, Later_Source = #{laterSource}, mappath = #{mappath}, producehelp = #{producehelp}, Custom_RD = #{customRd}, made_class = #{madeClass}, yp_orderqty = #{ypOrderqty}, Doway_cong_Flag = #{dowayCongFlag}, Doway_tiao_flag = #{dowayTiaoFlag}, Doway_print_Flag = #{dowayPrintFlag}, where SaleorderID = #{SaleorderID} delete from saleorderhead where SaleorderID = #{SaleorderID} delete from saleorderhead where SaleorderID in #{SaleorderID} delete from saleorderlist where SaleOrderID in #{saleOrderID} delete from saleorderlist where SaleOrderID = #{saleOrderID} insert into saleorderlist( SaleOrderID, PNO, Wl_Code, Itemname, Itemstandard, Machine_no, Stock_dw, Qty, Weight, Crl_Name, Price, Amt, SendDate, MemoList, OrderQty, Q_Qty, wldm, PI_NO, RMB_HuiLv, RMB_AMT, Now_YM, YL_MRP, ZZGD_OrderQty, ZZGD_Q_Qty, Return_QTY, JA_QTY, JA_FLAG, JA_MAN, JA_time, Version_NO) values ( #{item.SaleOrderID}, #{item.PNO}, #{item.wlCode}, #{item.Itemname}, #{item.Itemstandard}, #{item.machineNo}, #{item.stockDw}, #{item.Qty}, #{item.Weight}, #{item.crlName}, #{item.Price}, #{item.Amt}, #{item.SendDate}, #{item.MemoList}, #{item.OrderQty}, #{item.qQty}, #{item.wldm}, #{item.piNo}, #{item.rmbHuilv}, #{item.rmbAmt}, #{item.nowYm}, #{item.ylMrp}, #{item.zzgdOrderqty}, #{item.zzgdQQty}, #{item.returnQty}, #{item.jaQty}, #{item.jaFlag}, #{item.jaMan}, #{item.jaTime}, #{item.versionNo})