update ReturnGoodsRecord set settleAccountsDepartCoding = (select orgUnitCoding from SupplyRoomConfig where supplyRoomType = 4 and orgUnitCoding = (select settleAccountsDepartCoding from SupplyRoomConfig where supplyRoomType = 3 and orgUnitCoding = ReturnGoodsRecord.departCoding and settleAccountsDepartCoding is not null and settleAccountsDepartCoding <> '')) where settleAccountsDepartCoding is null; update ReturnGoodsRecord set settleAccountsDepart = (select orgUnitName from SupplyRoomConfig where supplyRoomType = 4 and orgUnitCoding = (select settleAccountsDepartCoding from SupplyRoomConfig where supplyRoomType = 3 and orgUnitCoding = ReturnGoodsRecord.departCoding and settleAccountsDepartCoding is not null and settleAccountsDepartCoding <> '')) where settleAccountsDepart is null; update ReturnGoodsRecord set settleAccountsDepartCoding = departCoding, settleAccountsDepart = depart where settleAccountsDepartCoding is null and settleAccountsDepart is null;